@maptalks/vt 0.106.2 → 0.107.0

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.106.2
2
+ * @maptalks/vt v0.107.0
3
3
  * LICENSE : undefined
4
4
  * (c) 2016-2025 maptalks.org
5
5
  */
@@ -19,9 +19,9 @@ import { isFunctionDefinition as _, interpolated as v, piecewiseConstant as b, l
19
19
 
20
20
  import T from "animation-easings";
21
21
 
22
- import { createFilter as S } from "@maptalks/feature-filter";
22
+ import { createFilter as w } from "@maptalks/feature-filter";
23
23
 
24
- import w from "@maptalks/vt-plugin";
24
+ import S from "@maptalks/vt-plugin";
25
25
 
26
26
  import { vec2 as M, vec3 as P, vec4 as I } from "gl-matrix";
27
27
 
@@ -31,7 +31,7 @@ import { buildNormals as k, buildTangents as F, packTangentFrame as O } from "@m
31
31
 
32
32
  import R from "rbush";
33
33
 
34
- const E = "${", D = `function(t){let e;const n={width:100,height:10};let r=!1;try{const t=new OffscreenCanvas(1,1);t.getContext("2d").fillText("hello",0,0),r=!0}catch(t){r=!1}function i(){if(!e){const{width:t,height:i}=n;r?e=new OffscreenCanvas(t,i):(e=document.createElement("canvas"),e.width=t,e.height=i)}return e}class o{constructor(t,e={}){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 e=0,n=t.length;e<n;e++){const n=t[e][0];r=Math.min(n,r),i=Math.max(n,i)}this.min=r,this.max=i,this.valueOffset=this.max-this.min,this.options=Object.assign({},n,e),this._initImgData()}getImageData(){return this.imgData}_initImgData(){const t=i(),{width:e,height:n}=this.options;t.width=e,t.height=n;const r=t.getContext("2d");r.clearRect(0,0,t.width,t.height);const o=r.createLinearGradient(0,0,t.width,0),{colors:s,valueOffset:a}=this;for(let t=0,e=s.length;t<e;t++){const[e,n]=s[t],r=(e-this.min)/a;o.addColorStop(r,n)}r.fillStyle=o,r.fillRect(0,0,t.width,t.height),this.imgData=r.getImageData(0,0,t.width,t.height)}getColor(t){t=Math.max(this.min,t);const e=((t=Math.min(t,this.max))-this.min)/this.valueOffset;let n=Math.round(e*this.imgData.width);n=Math.min(n,this.imgData.width-1);const r=4*n;return[this.imgData.data[r],this.imgData.data[r+1],this.imgData.data[r+2],this.imgData.data[r+3]]}}var s;function a(t){return null==t}function l(t){return!a(t)}function u(t){return""===t}function h(t,e){var n,r,i;if(w(t)){var o,s=t.stops&&"object"==typeof t.stops[0][0],a=s||l(t.property),u=s||!a,d=t.type||e||"exponential";if("exponential"===d)o=p;else if("interval"===d)o=f;else if("categorical"===d)o=c;else if("identity"===d)o=y;else if("color-interpolate"===d)o=g;else{if("calculate-expression"!==d)throw new Error('Unknown function type "'+d+'"');o=x}if(s){var m={},v=[];for(let e=0;e<t.stops.length;e++){var M=t.stops[e];void 0===m[M[0].zoom]&&(m[M[0].zoom]={zoom:M[0].zoom,type:t.type,property:t.property,default:t.default,stops:[]}),m[M[0].zoom].stops.push([M[0].value,M[1]])}for(let t in m)v.push([m[t].zoom,h(m[t])]);n=function(e,n){const r=p({stops:v,base:t.base},e)(e,n);return"function"==typeof r?r(e,n):r},r=!1,i=!1}else u?(n=function(e){const n=o(t,e);return"function"==typeof n?n(e):n},r=!0,i=!1):(n=function(e,n){const r=o(t,n?n[t.property]:null);return"function"==typeof r?r(e,n):r},r=!1,i=!0)}else n=function(){return t},r=!0,i=!0;return n.isZoomConstant=i,n.isFeatureConstant=r,n}function c(t,e){for(let n=0;n<t.stops.length;n++)if(e===t.stops[n][0])return t.stops[n][1];return t.default}function f(t,e){for(var n=0;n<t.stops.length&&!(e<t.stops[n][0]);n++);return t.stops[Math.max(n-1,0)][1]}function p(t,e){for(var n=l(t.base)&&!u(t.base)?t.base:1,r=0;!(r>=t.stops.length||e<=t.stops[r][0]);)r++;return 0===r?t.stops[r][1]:r===t.stops.length?t.stops[r-1][1]:m(e,n,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 d={width:100,height:1};function g(t,e){const n=t.stops;if(n&&n.length>1){let t;if(s){const e=JSON.stringify(n);if(!s.has(e)){const t=new o(n,d);s.set(e,t)}t=s.get(e)}else t=new o(n,d);const[r,i,a,l]=t.getColor(e);return[r/255,i/255,a/255,l/255]}return n&&1===n.length?n[0][1]:null}function y(t,e){return n=e,r=t.default,l(n)?n:l(r)?r:l(i)?i:null;var n,r,i}function x(t,e){const n=String(t.property),r=t.expression,i=e;function o(e){return a(e)||u(e)||isNaN(e)?t.default:e}if(!l(e)||u(e)||isNaN(e)||e<0)return o(t.default);{const e=function t(e,n,r){const i=Number(r),o=String(n);return Array.isArray(e)?e.map((e=>t(e,o,i))):e===o?i:e}(r,n,i);return o(function e(n){if(!Array.isArray(n)){if("number"==typeof n)return n;throw new Error("Invalid expression format")}{const r=n[0];if(!["+","-","*","/"].includes(r))throw new Error(\`Unknown operator: ${E}r}\`);const i=n.slice(1).map((t=>e(t)));switch(r){case"+":return i.reduce(((t,e)=>t+e),0);case"-":return i.reduce(((t,e)=>t-e));case"*":return i.reduce(((t,e)=>t*e),1);case"/":return i.some((t=>0===t))?t.default:i.reduce(((t,e)=>t/e));default:throw new Error(\`Unsupported operator: ${E}r}\`)}}}(e))}}function m(t,e,n,r,i,o){return"function"==typeof i?function(){var s=i.apply(void 0,arguments),a=o.apply(void 0,arguments);return m(t,e,n,r,s,a)}:i.length?function(t,e,n,r,i,o){var s=[];for(let a=0;a<i.length;a++)s[a]=v(t,e,n,r,i[a],o[a]);return s}(t,e,n,r,i,o):v(t,e,n,r,i,o)}function v(t,e,n,r,i,o){var s,a=r-n,l=t-n;return i*(1-(s=1===e?l/a:(Math.pow(e,l)-1)/(Math.pow(e,a)-1)))+o*s}function w(t){return t&&"object"==typeof t&&(t.stops||t.property&&"identity"===t.type||t.expression&&"calculate-expression"===t.type)}function M(t){return b(t,"interval")}function b(t,e){if(!w(t))return function(){return t};let n=!0,r=!0;const i=(t=JSON.parse(JSON.stringify(t))).stops;if(i)for(let t=0;t<i.length;t++)if(w(i[t][1])){const o=b(i[t][1],e);n=n&&o.isZoomConstant,r=r&&o.isFeatureConstant,i[t]=[i[t][0],o]}const o=h(t,e);return o.isZoomConstant=n&&o.isZoomConstant,o.isFeatureConstant=r&&o.isFeatureConstant,o}let P=0;const _="function"==typeof Object.assign;function I(t,...e){if(_)return Object.assign(t,...e),t;for(let n=0;n<e.length;n++){const r=e[n];for(const e in r)t[e]=r[e]}return t}function A(t){return!k(t)&&("string"==typeof t||null!==t.constructor&&t.constructor===String)}function S(t){return"number"==typeof t&&!isNaN(t)}function F(t){return!k(t)&&("function"==typeof t||null!==t.constructor&&t.constructor===Function)}function T(t){return!Array.isArray(t)&&"object"==typeof t&&!!t}function k(t){return null==t}function B(t){return w(t)&&t.property}const L="function"==typeof fetch&&"function"==typeof AbortController,C={jsonp:function(t,e){const n="_maptalks_jsonp_"+P++;t.match(/\\?/)?t+="&callback="+n:t+="?callback="+n;let r=document.createElement("script");return r.type="text/javascript",r.src=t,window[n]=function(t){e(null,t),document.getElementsByTagName("head")[0].removeChild(r),r=null,delete window[n]},document.getElementsByTagName("head")[0].appendChild(r),this},get:function(t,e,n){if(F(e)){const t=n;n=e,e=t}(e=e||{}).method&&(e.method=e.method.toUpperCase());const r="POST"===e.method;if(L){const r=new AbortController,i=e;i.signal=r.signal,i.referrerPolicy=i.referrerPolicy||"origin",i.method=i.method||"GET";const o=new Request(t,i);return e.returnJSON&&o.headers.set("Accept","application/json"),fetch(o).then((r=>{const i=this._parseResponse(r,e.returnJSON,e.responseType);i.message?(i.url=t,n(i)):i.then((t=>{"arraybuffer"===e.responseType?n(null,{data:t,cacheControl:r.headers.get("Cache-Control"),expires:r.headers.get("Expires"),contentType:r.headers.get("Content-Type")}):n(null,t)})).catch((e=>{e.code&&e.code===DOMException.ABORT_ERR||(console.error("Fetch error:",t,e),n(e))}))})).catch((e=>{e.code&&e.code===DOMException.ABORT_ERR||(console.error("Fetch error:",t,e),n(e))})),r}{const i=C._getClient(n);if(i.open(e.method||"GET",t,!0),e){for(const t in e.headers)i.setRequestHeader(t,e.headers[t]);i.withCredentials="include"===e.credentials,e.responseType&&(i.responseType=e.responseType)}return i.send(r?e.body:null),i}},_parseResponse:(t,e,n)=>200!==t.status?{status:t.status,statusText:t.statusText,message:\`incorrect http request with status code(${E}t.status}): ${E}t.statusText}\`}:"arraybuffer"===n?t.arrayBuffer():e?t.json():t.text(),_wrapCallback:function(t,e){return function(){if(4===t.readyState)if(200===t.status)if("arraybuffer"===t.responseType){0===t.response.byteLength?e({status:200,statusText:t.statusText,message:"http status 200 returned without content."}):e(null,{data:t.response,cacheControl:t.getResponseHeader("Cache-Control"),expires:t.getResponseHeader("Expires"),contentType:t.getResponseHeader("Content-Type")})}else e(null,t.responseText);else e({status:t.status,statusText:t.statusText,message:\`incorrect http request with status code(${E}t.status}): ${E}t.statusText}\`})}},_getClient:function(t){let e;try{e=new XMLHttpRequest}catch(t){try{e=new ActiveXObject("Msxml2.XMLHTTP")}catch(t){try{e=new ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}}return e.onreadystatechange=C._wrapCallback(e,t),e},getArrayBuffer(t,e,n){if(F(e)){const t=n;n=e,e=t}return e||(e={}),e.responseType="arraybuffer",C.get(t,e,n)}};function Y(t,e,n,r,i=3){let o=r;const s=n-e>>1;let a,l=n-e;const u=t[e],h=t[e+1],c=t[n],f=t[n+1];for(let r=e+i;r<n;r+=i){const e=V(t[r],t[r+1],u,h,c,f);if(e>o)a=r,o=e;else if(e===o){const t=Math.abs(r-s);t<l&&(a=r,l=t)}}o>r&&(a-e>i&&Y(t,e,a,r,i),t[a+2]=o,n-a>i&&Y(t,a,n,r,i))}function V(t,e,n,r,i,o){let s=i-n,a=o-r;if(0!==s||0!==a){const l=((t-n)*s+(e-r)*a)/(s*s+a*a);l>1?(n=i,r=o):l>0&&(n+=s*l,r+=a*l)}return s=t-n,a=e-r,s*s+a*a}function O(t,e,n,r,i,o){const s={id:null==t?null:t,type:e,geometry:n,tags:r,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};i&&(s.layer=i);return function(t,e){const n=t.geometry,r=t.type;if("Point"===r||"MultiPoint"===r||"LineString"===r)X(t,n,e);else if("Polygon"===r)X(t,n[0],e);else if("MultiLineString"===r)for(const r of n)X(t,r,e);else if("MultiPolygon"===r)for(const r of n)X(t,r[0],e)}(s,o?4:3),s}function X(t,e,n){for(let r=0;r<e.length;r+=n)t.minX=Math.min(t.minX,e[r]),t.minY=Math.min(t.minY,e[r+1]),t.maxX=Math.max(t.maxX,e[r]),t.maxY=Math.max(t.maxY,e[r+1])}function N(t,e,n,r){if(r.layer=e,"FeatureCollection"===n.type)for(let e=0;e<n.features.length;e++)E(t,n.features[e],r,e);else"Feature"===n.type?E(t,n,r):E(t,{geometry:n},r)}function E(t,e,n,r){if(!e.geometry)return;const i=e.geometry.coordinates,o=e.geometry.type,s=Math.pow(n.tolerance/((1<<n.maxZoom)*n.extent),2);let a=[],l=e.id;if(n.promoteId?l=e.properties[n.promoteId]:n.generateId&&(l=r||0),"Point"===o)z(i,a,n);else if("MultiPoint"===o)for(const t of i)z(t,a,n);else if("LineString"===o)$(i,a,s,!1,n);else if("MultiLineString"===o){if(n.lineMetrics){for(const r of i)a=[],$(r,a,s,!1,n),t.push(O(l,"LineString",a,e.properties,n.layer,n.hasAltitude));return}q(i,a,s,!1,n)}else if("Polygon"===o)q(i,a,s,!0,n);else{if("MultiPolygon"!==o){if("GeometryCollection"===o){for(const i of e.geometry.geometries)E(t,{id:l,geometry:i,properties:e.properties},n,r);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const t of i){const e=[];q(t,e,s,!0,n),a.push(e)}}t.push(O(l,o,a,e.properties,n.layer,n.hasAltitude))}function z(t,e,n){e.push(D(t[0]),j(t[1],n.projection),0),n.hasAltitude&&(t.length>2?e.push(t[2]):e.push(0))}function $(t,e,n,r,i){let o,s,a=0;for(let n=0;n<t.length;n++){const l=D(t[n][0]),u=j(t[n][1],i.projection);e.push(l,u,0),i.hasAltitude&&(t[n].length>2?e.push(t[n][2]):e.push(0)),n>0&&(a+=r?(o*u-l*s)/2:Math.sqrt(Math.pow(l-o,2)+Math.pow(u-s,2))),o=l,s=u}const l=i.hasAltitude?4:3,u=e.length-l;e[2]=1,Y(e,0,u,n,l),e[u+2]=1,e.size=Math.abs(a),e.start=0,e.end=e.size}function q(t,e,n,r,i){for(let o=0;o<t.length;o++){const s=[];$(t[o],s,n,r,i),e.push(s)}}function D(t){return t/360+.5}function j(t,e){if("EPSG:4326"===e)return(90-t)/360;const n=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+n)/(1-n))/Math.PI;return r<0?0:r>1?1:r}function Z(t,e,n,r,i,o,s,a){if(r/=e,o>=(n/=e)&&s<r)return t;if(s<n||o>=r)return null;const l=[];for(const e of t){const t=e.geometry;let o=e.type;const s=0===i?e.minX:e.minY,u=0===i?e.maxX:e.maxY;if(s>=n&&u<r){l.push(e);continue}if(u<n||s>=r)continue;let h=[];if("Point"===o||"MultiPoint"===o)G(t,h,n,r,i,a.hasAltitude);else if("LineString"===o)U(t,h,n,r,i,!1,a.lineMetrics,a.hasAltitude);else if("MultiLineString"===o)J(t,h,n,r,i,!1,a.hasAltitude);else if("Polygon"===o)J(t,h,n,r,i,!0,a.hasAltitude);else if("MultiPolygon"===o)for(const e of t){const t=[];J(e,t,n,r,i,!0,a.hasAltitude),t.length&&h.push(t)}if(h.length){if(a.lineMetrics&&"LineString"===o){for(const t of h)l.push(O(e.id,o,t,e.tags,e.layer,a.hasAltitude));continue}"LineString"!==o&&"MultiLineString"!==o||(1===h.length?(o="LineString",h=h[0]):o="MultiLineString"),"Point"!==o&&"MultiPoint"!==o||(o=3===h.length?"Point":"MultiPoint"),l.push(O(e.id,o,h,e.tags,e.layer,a.hasAltitude))}}return l.length?l:null}function G(t,e,n,r,i,o){const s=o?4:3;for(let a=0;a<t.length;a+=s){const s=t[a+i];s>=n&&s<=r&&(H(e,t[a],t[a+1],t[a+2]),o&&e.push(t[a+3]))}}function U(t,e,n,r,i,o,s,a){let l=R(t);const u=0===i?W:K;let h,c,f=t.start;const p=a?4:3,d=o?t.length:t.length-p;for(let g=0;g<d;g+=p){const y=t[g],x=t[g+1],m=t[g+2];let v,w,M,b;o&&g===d-p?(v=t[0],w=t[1]):(v=t[g+p],w=t[g+p+1]),a&&(M=t[g+3],b=o&&g===d-p?t[3]:t[g+p+3]);const P=0===i?y:x,_=0===i?v:w;let I=!1;s&&(h=Math.sqrt(Math.pow(y-v,2)+Math.pow(x-w,2))),P<n?_>n&&(c=u(l,y,x,v,w,n),a&&l.push(Q(M,b,c)),s&&(l.start=f+h*c)):P>r?_<r&&(c=u(l,y,x,v,w,r),a&&l.push(Q(M,b,c)),s&&(l.start=f+h*c)):(H(l,y,x,m),a&&l.push(M)),_<n&&P>=n&&(c=u(l,y,x,v,w,n),a&&l.push(Q(M,b,c)),I=!0),_>r&&P<=r&&(c=u(l,y,x,v,w,r),a&&l.push(Q(M,b,c)),I=!0),!o&&I&&(s&&(l.end=f+h*c),e.push(l),l=R(t)),s&&(f+=h)}let g=t.length-p;if(!o){const e=t[g],o=t[g+1],s=t[g+2],u=0===i?e:o;if(u>=n&&u<=r&&H(l,e,o,s),u>=n&&u<=r&&a){const e=t[g+3];l.push(e)}}g=l.length-p,o&&g>=p&&(l[g]!==l[0]||l[g+1]!==l[1])&&(H(l,l[0],l[1],l[2]),a&&l.push(l[3])),l.length&&e.push(l)}function R(t){const e=[];return e.size=t.size,e.start=t.start,e.end=t.end,e}function J(t,e,n,r,i,o,s){for(const a of t)U(a,e,n,r,i,o,!1,s)}function H(t,e,n,r){t.push(e,n,r)}function W(t,e,n,r,i,o){const s=(o-e)/(r-e);return H(t,o,n+(i-n)*s,1),s}function K(t,e,n,r,i,o){const s=(o-n)/(i-n);return H(t,e+(r-e)*s,o,1),s}function Q(t,e,n){return t+(e-t)*n}function tt(t,e,n){const r=[];for(let i=0;i<t.length;i++){const o=t[i],s=o.type;let a;if("Point"===s||"MultiPoint"===s||"LineString"===s)a=et(o.geometry,e,n);else if("MultiLineString"===s||"Polygon"===s){a=[];for(const t of o.geometry)a.push(et(t,e,n))}else if("MultiPolygon"===s){a=[];for(const t of o.geometry){const r=[];for(const i of t)r.push(et(i,e,n));a.push(r)}}r.push(O(o.id,s,a,o.tags,o.layer,n))}return r}function et(t,e,n){const r=[];r.size=t.size,void 0!==t.start&&(r.start=t.start,r.end=t.end);const i=n?4:3;for(let o=0;o<t.length;o+=i)r.push(t[o]+e,t[o+1],t[o+2]),n&&r.push(t[o+3]);return r}function nt(t,e,n){if(t.transformed)return t;const r=1<<t.z,i=t.x,o=t.y,s=n?3:2;for(const a of t.features){const t=a.geometry,l=a.type;if(a.geometry=[],1===l)for(let l=0;l<t.length;l+=s)a.geometry.push(rt(t[l],t[l+1],e,r,i,o)),n&&a.geometry[a.geometry.length-1].push(t[l+2]);else for(let l=0;l<t.length;l++){const u=[];for(let a=0;a<t[l].length;a+=s)u.push(rt(t[l][a],t[l][a+1],e,r,i,o)),n&&u[u.length-1].push(t[l][a+2]);a.geometry.push(u)}}return t.transformed=!0,t}function rt(t,e,n,r,i,o){return[Math.round(n*(t*r-i)),Math.round(n*(e*r-o))]}function it(t,e,n,r,i){const o=e===i.maxZoom?0:i.tolerance/((1<<e)*i.extent),s={features:[],numPoints:0,numSimplified:0,numFeatures:t.length,source:null,x:n,y:r,z:e,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const e of t)ot(s,e,o,i);return s}function ot(t,e,n,r){const i=e.geometry,o=e.type,s=[],a=r.hasAltitude?4:3;if(t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY),"Point"===o||"MultiPoint"===o)for(let e=0;e<i.length;e+=a)s.push(i[e],i[e+1]),r.hasAltitude&&s.push(i[e+3]),t.numPoints++,t.numSimplified++;else if("LineString"===o)at(s,i,t,n,!1,!1,r);else if("MultiLineString"===o||"Polygon"===o)for(let e=0;e<i.length;e++)at(s,i[e],t,n,"Polygon"===o,0===e,r);else if("MultiPolygon"===o)for(let e=0;e<i.length;e++){const o=i[e];for(let e=0;e<o.length;e++)at(s,o[e],t,n,!0,0===e,r)}if(s.length){let n=e.tags||null;if("LineString"===o&&r.lineMetrics){n={};for(const t in e.tags)n[t]=e.tags[t];n.mapbox_clip_start=i.start/i.size,n.mapbox_clip_end=i.end/i.size}const a={geometry:s,type:"Polygon"===o||"MultiPolygon"===o?3:"LineString"===o||"MultiLineString"===o?2:1,tags:n};e.layer&&(a.layer=e.layer),null!==e.id&&(a.id=e.id),t.features.push(a)}}function st(t,e,n){return 0===t[e+2]&&t[e+3]>0&&n}function at(t,e,n,r,i,o,s){const a=r*r,{hasAltitude:l,disableFilter:u}=s,h=l?4:3;if(!u&&r>0&&e.size<(i?a:r))return void(n.numPoints+=e.length/h);const c=[];for(let t=0;t<e.length;t+=h)(0===r||e[t+2]>a||st(e,t,l))&&(n.numSimplified++,c.push(e[t],e[t+1]),l&&c.push(e[t+3])),n.numPoints++;i&&function(t,e,n){const r=n?3:2;let i=0;for(let e=0,n=t.length,o=n-r;e<n;o=e,e+=r)i+=(t[e]-t[o])*(t[e+1]+t[o+1]);if(i>0===e){const e=r,i=r-1,o=r-2;for(let s=0,a=t.length;s<a/2;s+=r){const r=t[s],l=t[s+1];let u;n&&(u=t[s+2]),t[s]=t[a-e-s],t[s+1]=t[a-i-s],n&&(t[s+2]=t[a-o-s]),t[a-e-s]=r,t[a-i-s]=l,n&&(t[a-o-s]=u)}}}(c,o,l),t.push(c)}C.getJSON=function(t,e,n){if(F(e)){const t=n;n=e,e=t}const r=function(t,e){const r="string"==typeof e?JSON.parse(e):e||null;n(t,r)};return e&&e.jsonp?C.jsonp(t,r):((e=e||{}).returnJSON=!0,C.get(t,e,r))};const lt={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 ut{constructor(t,e){const n=(e=this.options=function(t,e){for(const n in e)t[n]=e[n];return t}(Object.create(lt),e)).debug;if(n&&console.time("preprocess data"),e.maxZoom<0||e.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(e.promoteId&&e.generateId)throw new Error("promoteId and generateId cannot be used together.");let r=function(t,e){const n=[];if(Array.isArray(t)){for(let r=0;r<t.length;r++)N(n,t[r].layer,t[r].data,e);return n}if("FeatureCollection"===t.type)for(let r=0;r<t.features.length;r++)E(n,t.features[r],e,r);else"Feature"===t.type?E(n,t,e):E(n,{geometry:t},e);return n}(t,e);this.tiles={},this.tileCoords=[],n&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",e.indexMaxZoom,e.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),r=function(t,e){const n=e.buffer/e.extent;let r=t;const i=Z(t,1,-1-n,n,0,-1,2,e),o=Z(t,1,1-n,2+n,0,-1,2,e);return(i||o)&&(r=Z(t,1,-n,1+n,0,-1,2,e)||[],i&&(r=tt(i,1,e.hasAltitude).concat(r)),o&&(r=r.concat(tt(o,-1,e.hasAltitude)))),r}(r,e),r.length&&this.splitTile(r,0,0,0),n&&(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,e,n,r,i,o,s){const a=[t,e,n,r],l=this.options,u=l.debug;for(;a.length;){r=a.pop(),n=a.pop(),e=a.pop(),t=a.pop();const h=1<<e,c=ht(e,n,r);let f=this.tiles[c];if(!f&&(u>1&&console.time("creation"),f=this.tiles[c]=it(t,e,n,r,l),this.tileCoords.push({z:e,x:n,y:r}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",e,n,r,f.numFeatures,f.numPoints,f.numSimplified),console.timeEnd("creation"));const t=\`z${E}e}\`;this.stats[t]=(this.stats[t]||0)+1,this.total++}if(f.source=t,null==i){if(e===l.indexMaxZoom||f.numPoints<=l.indexMaxPoints)continue}else{if(e===l.maxZoom||e===i)continue;if(null!=i){const t=i-e;if(n!==o>>t||r!==s>>t)continue}}if(f.source=null,0===t.length)continue;u>1&&console.time("clipping");const p=.5*l.buffer/l.extent,d=.5-p,g=.5+p,y=1+p;let x=null,m=null,v=null,w=null,M=Z(t,h,n-p,n+g,0,f.minX,f.maxX,l),b=Z(t,h,n+d,n+y,0,f.minX,f.maxX,l);t=null,M&&(x=Z(M,h,r-p,r+g,1,f.minY,f.maxY,l),m=Z(M,h,r+d,r+y,1,f.minY,f.maxY,l),M=null),b&&(v=Z(b,h,r-p,r+g,1,f.minY,f.maxY,l),w=Z(b,h,r+d,r+y,1,f.minY,f.maxY,l),b=null),u>1&&console.timeEnd("clipping"),a.push(x||[],e+1,2*n,2*r),a.push(m||[],e+1,2*n,2*r+1),a.push(v||[],e+1,2*n+1,2*r),a.push(w||[],e+1,2*n+1,2*r+1)}}getTile(t,e,n){t=+t,e=+e,n=+n;const r=this.options,{extent:i,debug:o}=r,{hasAltitude:s,wrapX:a}=r;if(t<0||t>24)return null;if(a){const n=1<<t;e=e+n&n-1}const l=ht(t,e,n);if(this.tiles[l])return nt(this.tiles[l],i,s);o>1&&console.log("drilling down to z%d-%d-%d",t,e,n);let u,h=t,c=e,f=n;for(;!u&&h>0;)h--,c>>=1,f>>=1,u=this.tiles[ht(h,c,f)];return u&&u.source?(o>1&&(console.log("found parent tile z%d-%d-%d",h,c,f),console.time("drilling down")),this.splitTile(u.source,h,c,f,t,e,n),o>1&&console.timeEnd("drilling down"),this.tiles[l]?nt(this.tiles[l],i,s):null):null}}function ht(t,e,n){return 32*((1<<t)*n+e)+t}function ct(t,e,n,r,i,o,s){const a=n&&Array.isArray(n[0]);for(let l=0,u=n.length;l<u;l++){t[e]=(a?n[l][0]:n[l].x)*r,t[e+1]=(a?n[l][1]:n[l].y)*r,s!==Float32Array&&(t[e]=Math.round(t[e]),t[e+1]=Math.round(t[e+1]));let h=i||0;Array.isArray(i)&&(h=i[l]),h=h?Math.round(r*h):0,t[e+2]=h,e+=3,o&&0!==l&&l!==u-1&&(t[e]=t[e-3],t[e+1]=t[e-2],t[e+2]=t[e-1],e+=3)}return t.trySetLength&&t.trySetLength(e),e}function ft(t,e,n,r){const i=t[3*e],o=t[3*e+1],s=t[3*n],a=t[3*n+1];return i===s&&(i<0||i>r)||o===a&&(o<0||o>r)}var pt="undefined"!=typeof Float32Array?Float32Array:Array;function dt(t,e,n,r){return t[0]=e,t[1]=n,t[2]=r,t}function gt(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function yt(t,e,n,r,i){return t[0]=e,t[1]=n,t[2]=r,t[3]=i,t}function xt(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t[2]=e[2]/n[2],t[3]=e[3]/n[3],t}function mt(t,e,n){return t[0]=e,t[1]=n,t}function vt(t,e){var n=e[0]-t[0],r=e[1]-t[1];return Math.hypot(n,r)}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)}),function(){var t,e=(t=new pt(3),pt!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t)}(),function(){var t,e=(t=new pt(4),pt!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t)}(),function(){var t,e=(t=new pt(2),pt!=Float32Array&&(t[0]=0,t[1]=0),t)}();const wt=Math.PI/180,Mt=6378137*Math.PI/180,bt=85.0511287798;function Pt(t,e,n){if("EPSG:3857"===n)return function(t,e){const n=bt,r=e[0],i=Math.max(Math.min(n,e[1]),-n);let o;o=0===i?0:Math.log(Math.tan((90+i)*wt/2))/wt;return t[0]=r*Mt,t[1]=o*Mt,t}(t,e);if("EPSG:4326"===n||"EPSG:4490"===n||"identity"===n)return _t(t,e);if("baidu"===n)return _t(t,e);throw new Error("unsupported projection:"+n)}function _t(t,e){return t[0]=e[0],t[1]=e[1],t}function It(t,e,n,r,i,o,s,a,l,u,h,c,f,p,d){0===t?function(t,e,n,r,i,o,s,a,l,u){const h=1/(100*o[0]),c=1/(100*o[1]),f=u&&u[0]||0,p=u&&u[1]||0,d=[0,0];for(let i=t;i<e;i+=3){const t=i/3*2,e=r[i]-f,o=r[i+1]-p;n[t]=d[0]+e/s*h/a,n[t+1]=d[1]-o/s*c/l}}(e,n,r,i,0,s,a,l,u,d):1===t&&function(t,e,n,r,i,o,s,a,l,u,h){if(!t)return;let c,f,p,d;0===t[4]?(c=t[0],f=t[1],p=t[2],d=t[3]):(c=t[1],f=t[2],p=t[3],d=t[0]);const g=vt(c,f),y=vt(f,p),x=[],m=[],v=[];for(let t=e;t<n;t+=3){const e=t/3*2;mt(x,(o.x/l+i[t]/s)*a,o.y/l*a+(h?i[t+1]:-i[t+1])/s*a),"EPSG:4326"!==u&&"EPSG:4490"!==u||Pt(x,x,"EPSG:3857"),At(m,x,c,f),At(v,x,d,c),r[e]=vt(c,m)/g,r[e+1]=vt(c,v)/y}}(h,e,n,r,i,o,a,c,f,p,!!d)}function At(t,e,n,r){const i=n[0]-r[0],o=n[1]-r[1];let s=(e[0]-n[0])*(n[0]-r[0])+(e[1]-n[1])*(n[1]-r[1]);return s/=i*i+o*o,t[0]=n[0]+s*i,t[1]=n[1]+s*o,t}function St(t,e,n,r,i){const o=3*e[n-1],s=3*e[n-1]+1,a=t[o],l=t[s];return u=r,h=i,c=a,f=l,Math.sqrt((c-u)*(c-u)+(f-h)*(f-h));var u,h,c,f}function Ft(t,e,n=2){const r=e&&e.length,i=r?e[0]*n:t.length;let o=Tt(t,0,i,n,!0);const s=[];if(!o||o.next===o.prev)return s;let a,l,u;if(r&&(o=function(t,e,n,r){const i=[];for(let n=0,o=e.length;n<o;n++){const s=Tt(t,e[n]*r,n<o-1?e[n+1]*r:t.length,r,!1);s===s.next&&(s.steiner=!0),i.push(zt(s))}i.sort(Ot);for(let t=0;t<i.length;t++)n=Xt(i[t],n);return n}(t,e,o,n)),t.length>80*n){a=1/0,l=1/0;let e=-1/0,r=-1/0;for(let o=n;o<i;o+=n){const n=t[o],i=t[o+1];n<a&&(a=n),i<l&&(l=i),n>e&&(e=n),i>r&&(r=i)}u=Math.max(e-a,r-l),u=0!==u?32767/u:0}return Bt(o,s,n,a,l,u,0),s}function Tt(t,e,n,r,i){let o;if(i===function(t,e,n,r){let i=0;for(let o=e,s=n-r;o<n;o+=r)i+=(t[s]-t[o])*(t[o+1]+t[s+1]),s=o;return i}(t,e,n,r)>0)for(let i=e;i<n;i+=r)o=Wt(i/r|0,t[i],t[i+1],o);else for(let i=n-r;i>=e;i-=r)o=Wt(i/r|0,t[i],t[i+1],o);return o&&Zt(o,o.next)&&(Kt(o),o=o.next),o}function kt(t,e){if(!t)return t;e||(e=t);let n,r=t;do{if(n=!1,r.steiner||!Zt(r,r.next)&&0!==jt(r.prev,r,r.next))r=r.next;else{if(Kt(r),r=e=r.prev,r===r.next)break;n=!0}}while(n||r!==e);return e}function Bt(t,e,n,r,i,o,s){if(!t)return;!s&&o&&function(t,e,n,r){let i=t;do{0===i.z&&(i.z=Et(i.x,i.y,e,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){let e,n=1;do{let r,i=t;t=null;let o=null;for(e=0;i;){e++;let s=i,a=0;for(let t=0;t<n&&(a++,s=s.nextZ,s);t++);let l=n;for(;a>0||l>0&&s;)0!==a&&(0===l||!s||i.z<=s.z)?(r=i,i=i.nextZ,a--):(r=s,s=s.nextZ,l--),o?o.nextZ=r:t=r,r.prevZ=o,o=r;i=s}o.nextZ=null,n*=2}while(e>1)}(i)}(t,r,i,o);let a=t;for(;t.prev!==t.next;){const l=t.prev,u=t.next;if(o?Ct(t,r,i,o):Lt(t))e.push(l.i,t.i,u.i),Kt(t),t=u.next,a=u.next;else if((t=u)===a){s?1===s?Bt(t=Yt(kt(t),e),e,n,r,i,o,2):2===s&&Vt(t,e,n,r,i,o):Bt(kt(t),e,n,r,i,o,1);break}}}function Lt(t){const e=t.prev,n=t,r=t.next;if(jt(e,n,r)>=0)return!1;const i=e.x,o=n.x,s=r.x,a=e.y,l=n.y,u=r.y,h=Math.min(i,o,s),c=Math.min(a,l,u),f=Math.max(i,o,s),p=Math.max(a,l,u);let d=r.next;for(;d!==e;){if(d.x>=h&&d.x<=f&&d.y>=c&&d.y<=p&&qt(i,a,o,l,s,u,d.x,d.y)&&jt(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}function Ct(t,e,n,r){const i=t.prev,o=t,s=t.next;if(jt(i,o,s)>=0)return!1;const a=i.x,l=o.x,u=s.x,h=i.y,c=o.y,f=s.y,p=Math.min(a,l,u),d=Math.min(h,c,f),g=Math.max(a,l,u),y=Math.max(h,c,f),x=Et(p,d,e,n,r),m=Et(g,y,e,n,r);let v=t.prevZ,w=t.nextZ;for(;v&&v.z>=x&&w&&w.z<=m;){if(v.x>=p&&v.x<=g&&v.y>=d&&v.y<=y&&v!==i&&v!==s&&qt(a,h,l,c,u,f,v.x,v.y)&&jt(v.prev,v,v.next)>=0)return!1;if(v=v.prevZ,w.x>=p&&w.x<=g&&w.y>=d&&w.y<=y&&w!==i&&w!==s&&qt(a,h,l,c,u,f,w.x,w.y)&&jt(w.prev,w,w.next)>=0)return!1;w=w.nextZ}for(;v&&v.z>=x;){if(v.x>=p&&v.x<=g&&v.y>=d&&v.y<=y&&v!==i&&v!==s&&qt(a,h,l,c,u,f,v.x,v.y)&&jt(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;w&&w.z<=m;){if(w.x>=p&&w.x<=g&&w.y>=d&&w.y<=y&&w!==i&&w!==s&&qt(a,h,l,c,u,f,w.x,w.y)&&jt(w.prev,w,w.next)>=0)return!1;w=w.nextZ}return!0}function Yt(t,e){let n=t;do{const r=n.prev,i=n.next.next;!Zt(r,i)&&Gt(r,n,n.next,i)&&Jt(r,i)&&Jt(i,r)&&(e.push(r.i,n.i,i.i),Kt(n),Kt(n.next),n=t=i),n=n.next}while(n!==t);return kt(n)}function Vt(t,e,n,r,i,o){let s=t;do{let t=s.next.next;for(;t!==s.prev;){if(s.i!==t.i&&Dt(s,t)){let a=Ht(s,t);return s=kt(s,s.next),a=kt(a,a.next),Bt(s,e,n,r,i,o,0),void Bt(a,e,n,r,i,o,0)}t=t.next}s=s.next}while(s!==t)}function Ot(t,e){let n=t.x-e.x;if(0===n&&(n=t.y-e.y,0===n)){n=(t.next.y-t.y)/(t.next.x-t.x)-(e.next.y-e.y)/(e.next.x-e.x)}return n}function Xt(t,e){const n=function(t,e){let n=e;const r=t.x,i=t.y;let o,s=-1/0;if(Zt(t,n))return n;do{if(Zt(t,n.next))return n.next;if(i<=n.y&&i>=n.next.y&&n.next.y!==n.y){const t=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(t<=r&&t>s&&(s=t,o=n.x<n.next.x?n:n.next,t===r))return o}n=n.next}while(n!==e);if(!o)return null;const a=o,l=o.x,u=o.y;let h=1/0;n=o;do{if(r>=n.x&&n.x>=l&&r!==n.x&&$t(i<u?r:s,i,l,u,i<u?s:r,i,n.x,n.y)){const e=Math.abs(i-n.y)/(r-n.x);Jt(n,t)&&(e<h||e===h&&(n.x>o.x||n.x===o.x&&Nt(o,n)))&&(o=n,h=e)}n=n.next}while(n!==a);return o}(t,e);if(!n)return e;const r=Ht(n,t);return kt(r,r.next),kt(n,n.next)}function Nt(t,e){return jt(t.prev,t,e.prev)<0&&jt(e.next,t,t.next)<0}function Et(t,e,n,r,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-n)*i|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-r)*i|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function zt(t){let e=t,n=t;do{(e.x<n.x||e.x===n.x&&e.y<n.y)&&(n=e),e=e.next}while(e!==t);return n}function $t(t,e,n,r,i,o,s,a){return(i-s)*(e-a)>=(t-s)*(o-a)&&(t-s)*(r-a)>=(n-s)*(e-a)&&(n-s)*(o-a)>=(i-s)*(r-a)}function qt(t,e,n,r,i,o,s,a){return!(t===s&&e===a)&&$t(t,e,n,r,i,o,s,a)}function Dt(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&Gt(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&(Jt(t,e)&&Jt(e,t)&&function(t,e){let n=t,r=!1;const i=(t.x+e.x)/2,o=(t.y+e.y)/2;do{n.y>o!=n.next.y>o&&n.next.y!==n.y&&i<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==t);return r}(t,e)&&(jt(t.prev,t,e.prev)||jt(t,e.prev,e))||Zt(t,e)&&jt(t.prev,t,t.next)>0&&jt(e.prev,e,e.next)>0)}function jt(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function Zt(t,e){return t.x===e.x&&t.y===e.y}function Gt(t,e,n,r){const i=Rt(jt(t,e,n)),o=Rt(jt(t,e,r)),s=Rt(jt(n,r,t)),a=Rt(jt(n,r,e));return i!==o&&s!==a||(!(0!==i||!Ut(t,n,e))||(!(0!==o||!Ut(t,r,e))||(!(0!==s||!Ut(n,t,r))||!(0!==a||!Ut(n,e,r)))))}function Ut(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function Rt(t){return t>0?1:t<0?-1:0}function Jt(t,e){return jt(t.prev,t,t.next)<0?jt(t,e,t.next)>=0&&jt(t,t.prev,e)>=0:jt(t,e,t.prev)<0||jt(t,t.next,e)<0}function Ht(t,e){const n=Qt(t.i,t.x,t.y),r=Qt(e.i,e.x,e.y),i=t.next,o=e.prev;return t.next=e,e.prev=t,n.next=i,i.prev=n,r.next=n,n.prev=r,o.next=r,r.prev=o,r}function Wt(t,e,n,r){const i=Qt(t,e,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function Kt(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 Qt(t,e,n){return{i:t,x:e,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}const te="__fea_idx";new Float32Array([-1e12])[0];const ee="maptalks_ombb";function ne(){return function(){if("undefined"!=typeof undefinedThis)return globalThis;if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof undefined)return global;throw new Error("unable to locate global object")}().maptalks_vt_packers}const{PackUtil:re,ArrayPool:ie}=ne();function oe(t,e,n,r,i,o,s,a,l,u,h,c,f,p,d,g,y){const x=e.getLength(),m=i/3;for(let n=2,r=x;n<r;n+=3)t[i+n-2]=e[n-2],t[i+n-1]=e[n-1],t[i+n-0]=e[n]-s;i+=x;for(let n=2,r=x;n<r;n+=3)t[i+n-2]=e[n-2],t[i+n-1]=e[n-1],t[i+n-0]=e[n]-a;i+=x,t.trySetLength(i+x),t.copyWithin(i,i-2*x,i-x),i+=x,t.trySetLength(i+x),t.copyWithin(i,i-2*x,i-x),i+=x,(n=n||[]).push(x/3);const v=n.getLength();for(let e=0;e<v;e++){se(m+(n[e-1]||0),m+n[e],t,x/3,l,r,u,h,c,f,o,p,d,g,y)}return i}function se(t,e,n,r,i,o,s,a,l,u,h,c,f,p,d){const g=o.getLength();let y,x;for(let s=t,a=e;s<a-1;s++)if(y=s,x=s+1,i===1/0||!ft(n,y,x,i))if((s-t)%2==1&&(y+=2*r,x+=2*r),d){let t=o.currentIndex;o[t++]=y+r,o[t++]=x,o[t++]=y,o[t++]=x+r,o[t++]=x,o[t++]=y+r,o.currentIndex=t}else{let t=o.currentIndex;o[t++]=y+r,o[t++]=y,o[t++]=x,o[t++]=x,o[t++]=x+r,o[t++]=y+r,o.currentIndex=t}s&&function(t,e,n,r,i,o,s,a,l,u,h,c){let f,p=0,d=0,g=0,y=0;const x=c?[1,3,4]:[2,3,4];for(let c=o.getLength()-1;c>=s;c--){const s=o[c],m=3*s+1,v=3*s+2,w=i[3*s],M=i[m],b=i[v];p||d||(p=Math.max(i[v],i[3*o[c-3]+2]),d=Math.min(i[v],i[3*o[c-3]+2]),f=p-d);let P=g;const _=c%6;0===t?(5===_&&(y=St(i,o,c,w,M)),P=_===x[0]||_===x[1]||_===x[2]?g:g+y):1===t&&(_===x[0]||_===x[1]||_===x[2]?P=0:5===_?(y=St(i,o,c,w,M),P=y):P=y);const I=P/u*(1/(100*h))/a;let A;A=1===e?b===p?1:0:"bottom"===n?b===p?f/100/l:0:b===p?0:-f/100/l,r[2*s]=I,r[2*s+1]=A,0===_&&(g+=y)}}(a,l,u,h,n,o,g,c[0],c[1],f,p,d)}function ae(t){const e=[t[0]];let n=t[0];for(let r=1;r<t.length;r++)Array.isArray(t[r])?t[r][0]===n[0]&&t[r][1]===n[1]&&t[r][2]===n[2]||e.push(t[r]):t[r].x===n.x&&t[r].y===n.y&&t[r].z===n.z||e.push(t[r]),n=t[r];return e}var le="undefined"!=typeof Float32Array?Float32Array:Array;function ue(){var t=new le(3);return le!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function he(t,e,n){var r=new le(3);return r[0]=t,r[1]=e,r[2]=n,r}function ce(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function fe(t,e,n,r){return t[0]=e,t[1]=n,t[2]=r,t}function pe(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t}function de(t,e){var n=e[0],r=e[1],i=e[2],o=n*n+r*r+i*i;return o>0&&(o=1/Math.sqrt(o),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o),t}function ge(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function ye(t,e,n){var r=e[0],i=e[1],o=e[2],s=n[0],a=n[1],l=n[2];return t[0]=i*l-o*a,t[1]=o*s-r*l,t[2]=r*a-i*s,t}var xe=function(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t};function me(){var t=new le(4);return le!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function ve(t,e){var n=e[0]+e[4]+e[8],r=void 0;if(n>0)r=Math.sqrt(n+1),t[3]=.5*r,r=.5/r,t[0]=(e[5]-e[7])*r,t[1]=(e[6]-e[2])*r,t[2]=(e[1]-e[3])*r;else{var i=0;e[4]>e[0]&&(i=1),e[8]>e[3*i+i]&&(i=2);var o=(i+1)%3,s=(i+2)%3;r=Math.sqrt(e[3*i+i]-e[3*o+o]-e[3*s+s]+1),t[i]=.5*r,r=.5/r,t[3]=(e[3*o+s]-e[3*s+o])*r,t[o]=(e[3*o+i]+e[3*i+o])*r,t[s]=(e[3*s+i]+e[3*i+s])*r}return t}!function(){var t=ue()}(),function(){var t,e=(t=new le(4),le!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t)}();var we,Me=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t},be=function(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],s=n*n+r*r+i*i+o*o;return s>0&&(s=1/Math.sqrt(s),t[0]=n*s,t[1]=r*s,t[2]=i*s,t[3]=o*s),t};ue(),he(1,0,0),he(0,1,0),me(),me(),we=new le(9),le!=Float32Array&&(we[1]=0,we[2]=0,we[3]=0,we[5]=0,we[6]=0,we[7]=0),we[0]=1,we[4]=1,we[8]=1;\n/*!\n * Contains code from google filament\n * https://github.com/google/filament/\n * License Apache-2.0\n */\nconst Pe=8,_e=[],Ie=[],Ae=[],Se=[];function Fe(t,e,n){const r=ye(Ie,e,n),i=function(t,e,n,r,i,o,s,a,l,u){return t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=o,t[5]=s,t[6]=a,t[7]=l,t[8]=u,t}(_e,n[0],n[1],n[2],...r,...e);t=ve(t,i),t=function(t){return t[3]<0?Me(t,t,-1):t}(t=be(t,t));const o=1/((1<<2*Pe-1)-1);if(t[3]<o){t[3]=o;const e=Math.sqrt(1-o*o);t[0]*=e,t[1]*=e,t[2]*=e}const s=n[3]>0?ye(Ae,n,e):ye(Ae,e,n);return ge(ye(Se,n,e),s)<0&&Me(t,t,-1),t}const Te=[];const ke=[],Be=[],Le=[],Ce=[],Ye=[],Ve=[],Oe=[];function Xe(t,e,n,r,i,o){fe(Ce,t[3*e],t[3*e+1],t[3*e+2]),fe(Ye,t[3*n],t[3*n+1],t[3*n+2]),fe(Ve,t[3*r],t[3*r+1],t[3*r+2]);const s=xe(ke,Ve,Ye),a=xe(Be,Ce,Ye),l=ye(Le,s,a);de(Oe,l),i[3*e]=i[3*e]||0,i[3*n]=i[3*n]||0,i[3*r]=i[3*r]||0,i[3*e+1]=i[3*e+1]||0,i[3*n+1]=i[3*n+1]||0,i[3*r+1]=i[3*r+1]||0,i[3*e+2]=i[3*e+2]||0,i[3*n+2]=i[3*n+2]||0,i[3*r+2]=i[3*r+2]||0,i[3*e]+=Oe[0],i[3*n]+=Oe[0],i[3*r]+=Oe[0],i[3*e+1]+=Oe[1],i[3*n+1]+=Oe[1],i[3*r+1]+=Oe[1],i[3*e+2]+=Oe[2],i[3*n+2]+=Oe[2],i[3*r+2]+=Oe[2],o[e]+=1,o[n]+=1,o[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,e,n){return t[0]=e[n],t[1]=e[n+1],t[2]=e[n+2],t}function Ee(t,e,n){return t[0]=e[n],t[1]=e[n+1],t}const{StyleUtil:ze,PackUtil:$e,ArrayPool:qe}=ne(),De=qe.getInstance();function je(t,e,n,r,i,o,s,a,l,u,h,c,f,p,d,g){void 0===e.top&&(e.top=!0),void 0===e.side&&(e.side=!0),De.reset();const{altitudeScale:y,altitudeProperty:x,defaultAltitude:m,heightProperty:v,minHeightProperty:P,defaultHeight:_,tangent:I,uv:A,topUVMode:F,sideUVMode:T,sideVerticalUVMode:k,top:L,side:C,textureYOrigin:Y,topThickness:V}=e,O=function(t,e,{altitudeScale:n,altitudeProperty:r,defaultAltitude:i,heightProperty:o,minHeightProperty:s,defaultHeight:a},{center:l,side:u,top:h,topThickness:c,uvOrigin:f,uv:p,uvSize:d,topUVMode:g,sideUVMode:y,sideVerticalUVMode:x,textureYOrigin:m,tileRatio:v,centimeterToPoint:w,verticalCentimeterToPoint:M,positionType:b,res:P,glScale:_,projectionCode:I},A,F){let T=e/t[0].extent;e===1/0&&(T=1);const k=e===1/0,B=F.get(),L=F.get(),C=F.get(),Y=F.getProxy(),V=F.get(),O=F.get(),X=F.get(),N=!!p,E=!!h,z=!!u,$=N?F.get():null;function q(t,n,r,i,o,s){let a=n;if(E){const u=Ft(Y,r,3);if(0===u.length)return n;let h=Y.getLength(),p=V.currentIndex;for(let t=0;t<h;t++)V[p++]=Y[t];if(V.currentIndex=p,n+=Y.getLength(),s)for(let e=2,n=u.length;e<n;e+=3)u[e]+=t/3,u[e-1]+=t/3,u[e-2]+=t/3;else{let e;for(let n=2,r=u.length;n<r;n+=3)e=u[n-1],u[n-1]=u[n]+t/3,u[n]=e+t/3,u[n-2]+=t/3}h=u.length,p=O.currentIndex;for(let t=0;t<h;t++)O[p++]=u[t];O.currentIndex=p,N&&It(g||0,t,n,$,V,f,w,v,d[0],d[1],o,P,_,I,l),c>0&&!z&&(n=oe(V,Y,r,O,n,$,0,c,e,N,y||0,x||0,m,d,v,M,i<0?!s:s)),X.setLength(n/3),X.fill(1,a/3,n/3)}if(z){E&&(c=0),a=n,n=oe(V,Y,r,O,n,$,c,i,e,N,y||0,x||0,m,d,v,M,i<0?!s:s),X.setLength(n/3);const t=Y.getLength()/3;X.fill(1,a/3,a/3+t),X.fill(0,a/3+t,a/3+2*t),X.fill(1,a/3+2*t,a/3+3*t),X.fill(0,a/3+3*t,n/3)}return n}let D=-1/0,j=1/0,Z=0;const G=[-1,-1,e+1,e+1];let U=0,R=t.length;S(A)&&(U=A,R=A+1);let J=0,H=!1;const W=F.getProxy();let K=!1;for(;U<R;U++){const l=t[U],u=l.id;S(u)&&(Math.abs(u)>J&&(J=Math.abs(u)),u<0&&(H=!0));const h=l.geometry,c=l.properties[ee];let f=Array.isArray(c&&c[0]&&c[0][0])?c[0]:c;const{altitude:p,height:d}=re.getFeaAltitudeAndHeight(l,n,r,i,o,a,s);d<0?(K=!0,j=Math.min(p,j),D=Math.max(p-d,D)):(D=Math.max(p,D),j=Math.min(p-d,j));const g=V.getLength();let y=0,x=Z;W.setLength(0),Y.setLength(0);const m=re.calculateSignedArea(h[0])<0;for(let t=0,n=h.length;t<n;t++){let r=h[t];m&&(r=r.reverse()),r=ae(r);const i=re.calculateSignedArea(r)<0;if(!i&&t>0&&(y++,f=c&&c[y],Z=q(x,Z,W,d*T,f,k),Y.setLength(0),W.setLength(0),x=Z),e!==1/0&&(r=re.clipPolygon(r,G)),!r.length){t===n-1&&(Z=q(x,Z,W,d*T,f,k));continue}const o=r.length;if(Array.isArray(r[0])?r[0][0]===r[o-1][0]&&r[0][1]===r[o-1][1]||r.push([r[0][0],r[0][1]]):r[0].x===r[o-1].x&&r[0].y===r[o-1].y||r.push(r[0]),i){let t=W.currentIndex;W[t++]=Y.getLength()/3,W.currentIndex=t}ct(Y,Y.getLength(),r,T,p,!1,b),t===n-1&&(Z=q(x,Z,W,d*T,f,k))}const v=V.getLength()-g,w=(te+"").trim();for(let t=0;t<v/3;t++){let t=L.currentIndex;L[t++]=void 0===l[w]?U:l[w],L.currentIndex=t,t=B.currentIndex,B[t++]=U,B.currentIndex=t,S(u)&&(t=C.currentIndex,C[t++]=u,C.currentIndex=t)}}const Q=re.getUnsignedArrayType(L.getLength()?L[L.getLength()-1]:0),tt={hasNegativeHeight:K,maxAltitude:D===-1/0?0:D,minAltitude:j===1/0?0:j,vertices:V,verticeTypes:X,indices:O,pickingIds:ie.createTypedArray(L,Q),featureIndexes:B};if(C.getLength()){const t=H?re.getPosArrayType(J):re.getUnsignedArrayType(J);tt.featureIds=ie.createTypedArray(C,t)}else tt.featureIds=[];return $&&($.setLength(V.getLength()/3*2),tt.uvs=$),tt}(t,n,{altitudeScale:y,altitudeProperty:x,defaultAltitude:m||0,heightProperty:v,minHeightProperty:P,defaultHeight:_||0},{center:g,top:L,side:C,topThickness:10*V||0,uv:A||I,uvSize:[i,i],uvOrigin:r,topUVMode:F,sideUVMode:T,sideVerticalUVMode:k,textureYOrigin:Y,tileRatio:a,centimeterToPoint:l,verticalCentimeterToPoint:u,positionType:d,res:o,glScale:s,projectionCode:f},p,De),X=[],N=O.vertices.getLength()/3,E=$e.getIndexArrayType(N),z=qe.createTypedArray(O.indices,E);delete O.indices,X.push(z.buffer,O.pickingIds.buffer);const $=Math.max(Math.abs(O.maxAltitude),Math.abs(O.minAltitude)),q=$e.getPosArrayType(Math.max(512,$));O.vertices=qe.createTypedArray(O.vertices,q);const D=I?De.getProxy():new Float32Array(3*N);D.setLength&&D.setLength(3*N);const j=function(t,e,n){const r=n||[];r.setLength&&r.setLength(t.length);const i=Te;i.length<t.length/3&&(i.length=t.length/3),i.fill(0,0,t.length/3);const o=void 0===e.length?e:e.length;for(let n=0;n<o/3;n++)void 0===e.length?Xe(t,3*n,3*n+1,3*n+2,r,i):Xe(t,e[3*n],e[3*n+1],e[3*n+2],r,i);for(let t=0;t<r.length;t+=3){const e=i[t/3];0!==e?(r[t]/=e,r[t+1]/=e,r[t+2]/=e):(r[t]=0,r[t+1]=0,r[t+2]=0)}return r}(O.vertices,z,D);let Z=!0;const G=j.getLength?j.getLength():j.length;for(let t=0;t<G;t++){j[t]=-j[t];const e=j[t]%1;1-Math.abs(e)>1e-6?Z=!1:0!==e&&(j[t]=Math.round(j[t]))}if(O.normals=j,I){let t=De.get();t.setLength(4*N),t=function(t,e,n,r,i){const o=t.length/3,s=i||new Array(4*o),a=[],l=[];for(let t=0;t<o;t++)a[t]=[0,0,0],l[t]=[0,0,0];const u=[0,0,0],h=[0,0,0],c=[0,0,0],f=[0,0],p=[0,0],d=[0,0],g=[0,0,0],y=[0,0,0];function x(e,r,i){Ne(u,t,3*e),Ne(h,t,3*r),Ne(c,t,3*i),Ee(f,n,2*e),Ee(p,n,2*r),Ee(d,n,2*i);const o=h[0]-u[0],s=c[0]-u[0],x=h[1]-u[1],m=c[1]-u[1],v=h[2]-u[2],w=c[2]-u[2],M=p[0]-f[0],b=d[0]-f[0],P=p[1]-f[1],_=d[1]-f[1],I=1/(M*_-b*P);fe(g,(_*o-P*s)*I,(_*x-P*m)*I,(_*v-P*w)*I),fe(y,(M*s-b*o)*I,(M*m-b*x)*I,(M*w-b*v)*I),pe(a[e],a[e],g),pe(a[r],a[r],g),pe(a[i],a[i],g),pe(l[e],l[e],y),pe(l[r],l[r],y),pe(l[i],l[i],y)}for(let t=0,e=r.length;t<e;t+=3)x(r[t+0],r[t+1],r[t+2]);const m=[],v=[],w=[],M=[];let b,P,_;function I(t){Ne(w,e,3*t),ce(M,w),P=a[t],ce(m,P),xe(m,m,function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t}(w,w,ge(w,P))),de(m,m),ye(v,M,P),_=ge(v,l[t]),b=_<0?-1:1,s[4*t]=m[0],s[4*t+1]=m[1],s[4*t+2]=m[2],s[4*t+3]=b}for(let t=0,e=r.length;t<e;t+=3)I(r[t+0]),I(r[t+1]),I(r[t+2]);return s}(O.vertices,O.normals,O.uvs,z,t),t=function(t,e){const n=e.getLength(),r=new Float32Array(n),i=[],o=[],s=[];for(let a=0;a<n;a+=4){const n=a/4*3;dt(o,t[n]||0,t[n+1]||0,t[n+2]||0),yt(i,e[a]||0,e[a+1]||0,e[a+2]||0,e[a+3]||0),Fe(s,o,i),gt(r.subarray(a,a+4),s)}return r}(O.normals,t),O.tangents=t,X.push(t.buffer),delete O.normals}if(O.normals&&(Z&&(O.normals=qe.createTypedArray(O.normals,Int8Array)),X.push(O.normals.buffer)),O.uvs){const t=O.uvs;O.uvs=qe.createTypedArray(t,Float32Array),X.push(O.uvs.buffer)}const U=function(t,e,n,r){const i={},o={},s=r.getLength();if(B(e.polygonFill)){let a=M(e.polygonFill);const l=new Uint8Array(4*s);l.fill(255);for(let e=0;e<s;e++){const o=t[r[e]],s=o.properties||{};s.$layer=o.layer,s.$type=o.type;let u=a(n,s);w(u)&&(i.aColor=1,a=M(u),u=a(n,s)),delete s.$layer,delete s.$type,ze.normalizeColor(Ze,u),l[4*e]=Ze[0],l[4*e+1]=Ze[1],l[4*e+2]=Ze[2],l[4*e+3]=Ze[3]}o.aColor=l}if(B(e.polygonOpacity)){let a=b(e.polygonOpacity,"exponential");const l=new Uint8Array(s);l.fill(255);for(let e=0;e<s;e++){const o=t[r[e]],s=o.properties||{};s.$layer=o.layer,s.$type=o.type;let u=a(n,s);w(u)&&(i.aOpacity=1,a=M(u),u=a(n,s)),delete s.$layer,delete s.$type,l[e]=255*u}o.aOpacity=l}return o.dynamicAttributes=i,o}(t,h,c,O.featureIndexes),R=function(t,e,n,r,i){const o=[[],[]],s=B(r.topPolygonFill),a=B(r.bottomPolygonFill),l=[255,255,255,255],u=e.getLength();if(s||a){let h=s&&M(r.topPolygonFill),c=a&&M(r.bottomPolygonFill),f=null,p=null,d=null,g=null;for(let r=0;r<u;r++){if(1===t[r]&&!s||0===t[r]&&!a)continue;const u=1===t[r];if(u&&e[r]===f){t[r]=d;continue}if(!u&&e[r]===p){t[r]=g;continue}const y=n[e[r]],x=y.properties||{};x.$layer=y.layer,x.$type=y.type;let m=u?h:c,v=m(i,x);w(v)&&(m=M(v),v=m(i,x)),delete x.$layer,delete x.$type,ze.normalizeColor(Ze,v),xt(Ze,Ze,l);let b=Ge(o,Ze);b<0&&(b=o.length,o.push(gt([],Ze))),t[r]=b,u?(f=e[r],d=b):(p=e[r],g=b)}}return o.slice(2)}(O.verticeTypes,O.featureIndexes,t,h,c),J={data:{data:{aVertexColorType:R.length<=252?qe.createTypedArray(O.verticeTypes,Uint8Array):qe.createTypedArray(O.verticeTypes,Uint16Array),aPosition:O.vertices,aNormal:O.normals,aTexCoord0:O.uvs,aTangent:O.tangents,aPickingId:O.pickingIds},indices:z,properties:{maxAltitude:O.maxAltitude/100,minAltitude:O.minAltitude/100,hasNegativeHeight:O.hasNegativeHeight},dynamicAttributes:U.dynamicAttributes,vertexColors:R},buffers:X};return O.featureIds.length?(J.data.featureIds=O.featureIds,X.push(J.data.featureIds.buffer)):J.data.featureIds=[],U.aColor&&(J.data.data.aColor=U.aColor,J.buffers.push(U.aColor.buffer)),U.aOpacity&&(J.data.data.aOpacity=U.aOpacity,J.buffers.push(U.aOpacity.buffer)),J.buffers.push(J.data.data.aPosition.buffer),J.data.pickingIdIndiceMap=$e.generatePickingIndiceIndex(J.data.data.aPickingId,J.data.indices),J}const Ze=[];function Ge(t,e){for(let i=0;i<t.length;i++)if(n=e,r=t[i],n[0]===r[0]&&n[1]===r[1]&&n[2]===r[2]&&n[3]===r[3])return i;var n,r;return-1}const{PackUtil:Ue,StyleUtil:Re,FilterUtil:Je}=ne();function He(t,e,n,r,{altitudeScale:i,altitudeProperty:o,defaultAltitude:s,heightProperty:a,minHeightProperty:l,defaultHeight:u,bottom:h}){const c=h,f=e/t[0].extent,p=2*function(t,e){let n=0;for(let e=0,r=t.length;e<r;e++){const r=t[e];if(S(r.geometry[0][0]))n+=3*r.geometry.length;else for(let t=0,e=r.geometry.length;t<e;t++){let e=3*r.geometry[t].length;3===r.type&&(e-=3),n+=e}}return n}(t)+3*t.length*2,d=[],g=new Int16Array(p),y=new Uint8Array(g.length/3*4);w(n)&&(n=Je.compileFilter(n));const x=[];function m(t,n,r){const i=n-t,o=g.subarray(t,n),s=g.subarray(n,n+i);s.set(o);for(let t=2,e=s.length;t<e;t+=3)s[t]=o[t]-r;const a=t/3,l=i/3;let u,h;for(let t=a,n=l+a;t<n;t++)t<n-1?(u=t,h=t+1):(u=t,h=a),ft(g,u,h,e)||(x.push(u,h),c&&x.push(u+l,h+l),We(g,u,e)||x.push(u,u+l));return n+i}let v=0,M=-1/0,b=1/0;const P=(te+"").trim(),_=[];for(let e=0,h=t.length;e<h;e++){const h=t[e],c=h.geometry;if(n){let t;t="function"==typeof n?n(h&&h.properties):n,Re.normalizeColor(_,t)}else dt(_,255,255,255);const p=v/3*4,{altitude:w,height:I}=Ue.getFeaAltitudeAndHeight(h,i,o,s,a,u,l);I<0?(b=Math.min(w,b),M=Math.max(w-I,M)):(b=Math.min(w-I,b),M=Math.max(w,M));let A=v;for(let t=0,e=c.length;t<e;t++){let e=c[t];const n=e.length;e[0][0]===e[n-1][0]&&e[0][1]===e[n-1][1]&&(e=e.slice(0,n-1)),v=ct(g,A,e,f,w),v=m(A,v,I*f),A=v}const S=A/3*4;for(let t=p;t<S;t+=4)y[t]=_[0],y[t+1]=_[1],y[t+2]=_[2],y[t+3]=255*(r||1);const F=x.length-d.length;for(let t=0;t<F;t++)d.push(h[P])}const I=x.reduce(((t,e)=>Math.max(t,e)),0),A=new(Ue.getIndexArrayType(I))(x),F=Ue.getUnsignedArrayType(t.length),T=Math.max(Math.abs(M,Math.abs(b)));return{aPosition:new(Ue.getPosArrayType(Math.max(512,T)))(g),indices:A,aPickingId:new F(d),aColor:y,maxAltitude:M===-1/0?0:M/100,minAltitude:b===1/0?0:b/100}}function We(t,e,n){const r=t[3*e],i=t[3*e+1];return r<0||r>n||i<0||i>n}function Ke(t,e,n,r){const i=He(t,e,n.lineColor,n.lineOpacity,r),{minAltitude:o,maxAltitude:s}=i;delete i.minAltitude,delete i.maxAltitude;const a=[i.aPosition.buffer,i.indices.buffer,i.aPickingId.buffer],l=i.indices;return delete i.indices,{data:{data:i,properties:{minAltitude:o,maxAltitude:s},indices:l},buffers:a}}\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 */const Qe=["Unknown","Point","LineString","Polygon","MultiPoint","MultiLineString","MultiPolygon","GeometryCollection"];function tn(t){if(!t)return"true";const e=t[0];if(t.length<=1)return"any"===e?"false":"true";return\`(${E}"=="===e?nn(t[1],t[2],"===",!1):"!="===e?nn(t[1],t[2],"!==",!1):"<"===e||">"===e||"<="===e||">="===e?nn(t[1],t[2],e,!0):"any"===e?on(t.slice(1),"||"):"all"===e?on(t.slice(1),"&&"):"none"===e?ln(on(t.slice(1),"||")):"in"===e?sn(t[1],t.slice(2)):"!in"===e?ln(sn(t[1],t.slice(2))):"has"===e?an(t[1]):"!has"===e?ln(an(t[1])):"contains"===e?function(t,e,n){const r=en(t);return void 0!==n?\`(${E}r} + '').indexOf("${E}e}") === ${E}n}\`:\`(${E}r} + '').indexOf("${E}e}") >= 0\`}(t[1],t[2],t[3]):"true"})\`}function en(t){return"$"===t[0]?"f."+t.substring(1):"p["+JSON.stringify(t)+"]"}function nn(t,e,n,r){if("object"==typeof(i=t)&&i&&t.op)return function(t,e,n,r){const i=t.property,o=t.op;let s=en(i);return"length"!==o?(console.error(\`not support ${E}o} op\`),"false"):(s=\`((${E}s}+='').length)\`,rn(s,i,e,n,r))}(t,e,n,r);var i;return rn(en(t),t,e,n,r)}function rn(t,e,n,r,i){const o="$type"===e?Qe.indexOf(n):JSON.stringify(n);return(i?\`typeof ${E}t}=== typeof ${E}o}&&\`:"")+t+r+o}function on(t,e){return t.map(tn).join(e)}function sn(t,e){"$type"===t&&(e=e.map((t=>Qe.indexOf(t))));const n=JSON.stringify(e.sort(un)),r=en(t);return e.length<=200?\`${E}n}.indexOf(${E}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; }(${E}r}, ${E}n},0,${E}e.length-1})\`}function an(t){return"$id"===t?'"id" in f':\`${E}JSON.stringify(t)} in p\`}function ln(t){return\`!(${E}t})\`}function un(t,e){return t<e?-1:t>e?1:0}let hn=!1;try{const t=new OffscreenCanvas(1,1);t.getContext("2d").fillText("hello",0,0),hn=!0}catch(t){hn=!1}var cn=hn;const{VectorPack:fn,PolygonPack:pn,NativeLinePack:dn,LinePack:gn,PointPack:yn,NativePointPack:xn,LineExtrusionPack:mn,CirclePack:vn,RoundTubePack:wn,SquareTubePack:Mn,FilterUtil:bn,PackUtil:Pn,StyleUtil:_n,TextUtil:In,DEFAULT_TEX_WIDTH:An,GlyphRequestor:Sn}=ne(),Fn="__original_properties",Tn="__fn-type_properties";class kn{constructor(t,e,n,r,i){this.id=t,this.options=e,this.upload=n,this._compileStyle(e.style),this.requests={},this._cache=r,this._styleCounter=1,this.loadings=i}updateStyle(t,e){this.options.style=t,this._styleCounter=t.styleCounter,this._compileStyle(t),e()}updateOptions(t,e){this.options=I(this.options,t),e()}loadTile(t,e){const n=this.loadings,r=t.tileInfo.url,i=this.options.debugTile;if(i){const{x:n,y:r,z:o}=t.tileInfo;let s=!1;for(let t=0;t<i.length;t++)if(n===i[t].x&&r===i[t].y&&o===i[t].z){s=!0;break}if(!s)return void e()}if(n[r])return void n[r].push({context:t,callback:e,ref:this});n[r]=[{context:t,callback:e,ref:this}];const o=this.options.featureIdProperty;this.requests[r]=this.getTileFeatures(t,((e,i,s,a)=>{const l=n[r];if(delete n[r],this.checkIfCanceled(r))return delete this.requests[r],void this._callWaitings(l,null,{canceled:!0});if(delete this.requests[r],(this.options.debug||o)&&i)for(let e=0;e<i.length;e++)if(this.options.debug&&(i[e]._debug_info={index:e,id:i[e].id,tileId:t.tileInfo.id}),o){const t=T(o)?o[i[e].layer]:o,n=i[e].properties;i[e].id=n&&n[t]||null}if(e)this._callWaitings(l,e);else if(i&&i.length){if(l)for(let t=0;t<l.length;t++)this._onTileLoad.call(l[t].ref,l[t].context,l[t].callback,r,s,i,a)}else this._callWaitings(l)}))}_onTileLoad(t,e,n,r,i,o){this._createTileData(r,i,t).then((n=>{n.canceled?e(null,{canceled:!0}):(n.data.styleCounter=t.styleCounter,o&&I(n.data,o),e(null,n.data,n.buffers))})).catch((t=>{e(t)}))}abortTile(t,e){delete this.requests[t],this._cancelLoadings(t),e()}_cancelLoadings(t){const e=this.loadings[t];if(e)for(let t=0;t<e.length;t++)e[t].callback(null,{canceled:!0});delete this.loadings[t]}_callWaitings(t,e,n){if(t)for(let r=0;r<t.length;r++)t[r].callback(e,n)}checkIfCanceled(t){return!this.requests[t]}onRemove(){this.loadings={},delete this._cache,this.requests={}}fetchIconGlyphs(t,e,n){if(this.options.workerGlyph&&cn){const r=[];if(t&&Object.keys(t).length){const e=new Promise((e=>{this.upload("fetchIconGlyphs",{icons:t},null,((t,n)=>{e({err:t,iconData:n})}))}));r.push(e)}if(e&&Object.keys(e).length){const t=new Promise((t=>{this._glyphRequestor||(this._glyphRequestor=new Sn),this._glyphRequestor.getGlyphs(e,((e,n)=>{t({err:e,glyphData:n})}))}));r.push(t)}Promise.all(r).then((t=>{const e={icons:null,glyphs:null};for(let r=0;r<t.length;r++){if(t[r].err)return void n(t[r].err);t[r].iconData?e.icons=t[r].iconData.icons:t[r].glyphData&&(e.glyphs=t[r].glyphData.glyphs)}return e})).then((t=>{n(null,t)}))}else this.upload("fetchIconGlyphs",{icons:t,glyphs:e},null,n)}_createTileData(t,e,n){if(!e.length)return Promise.resolve({data:null,buffers:[]});const{glScale:r,tileInfo:i}=n,o=!this.options.style.style.length&&!this.options.style.featureStyle.length;let s=this.pluginConfig.slice(0);o&&(s=this._updateLayerPluginConfig(t)),this.featurePlugins&&function(t){for(let e=1;e<arguments.length;e++){const n=arguments[e];if(n)for(let e=0,r=n.length;e<r;e++)t.push(n[e])}t.length}(s,this.featurePlugins);const a={};for(let t=0;t<s.length;t++)Xn(e,n.tileInfo.z,s[t],a);const l=[],u=[];for(let t=0;t<e.length;t++){const n=e[t],r=a[t];if(r){u.fill(null);let t=0;for(const e in r){let i=0;const o=r[e].values();for(const t of o){let r=u[i];r||(r=$n(n),u[i]=r),r.properties[e]=t,i++}i>t&&(t=i)}for(let e=0;e<t;e++)l.push(u[e])}else l.push(n)}const h=(e=l)[0].extent,c=i.z,f={x:i.extent2d.xmin*r,y:i.extent2d.ymax*r},p=[],d=[],g=[],y=this.options,x=[],m={},v=[Promise.resolve(n.styleCounter)];let w=0,M=-1;const b=[];let P=!1;for(let t=0;t<s.length;t++){M++;const r=s[t];r.type!==w&&(M=0,w=r.type);const a=0===r.type?p:d;if(r.symbol&&!1===r.symbol.visible){a[M]=null;continue}jn(r.symbol,b,t),P=P||b[t]&&b[t].size>0;const{tileFeatures:l,tileFeaIndexes:u}=this._filterFeatures(c,r.type,r.filter,e,m,t);if(!l.length){a[M]=null;continue}const y=u[u.length-1],_=Pn.getIndexArrayType(y);a[M]={styledFeatures:new _(u)},g.push({idx:t,typeIdx:M}),x.push(a[M].styledFeatures.buffer);const A=I({},n,{extent:h,zoom:c,tilePoint:f});if(this.options.debugTile){const t=this.options.debugTile;for(let e=0;e<t.length;e++){const{x:n,y:r,z:o}=t[e];if(i.x===n&&i.y===r&&i.z===o){A.debugIndex=t[e].index;break}}}let S=this._createTileGeometry(l,r,A);o&&(S=S.then((t=>{if(!t)return null;if(t.data)t.data.layer=l[0].layer;else if(Array.isArray(t))for(let e=0;e<t.length;e++)t[e]&&t[e].data&&(t[e].data.layer=l[0].layer);return t}))),v.push(S)}return Promise.all(v).then((([n,...r])=>{if(n!==this._styleCounter)return{canceled:!0};function i(t,e){if(void 0!==t.data.ref)return;const n=s[g[e].idx],r=n.renderPlugin.dataConfig;if(t.data.type=r.type,t.data.filter=n.filter.def,r.altitudeOffset&&(t.data.properties.minAltitude+=r.altitudeOffset,t.data.properties.maxAltitude+=r.altitudeOffset),t.buffers&&t.buffers.length)for(let e=0;e<t.buffers.length;e++)x.push(t.buffers[e])}for(let t=0;t<r.length;t++){if(!r[t])continue;const e=r[t],n=0===s[g[t].idx].type?p:d;if(Array.isArray(e)){const r=[];for(let n=0;n<e.length;n++)e[n]&&(i(e[n],t),(void 0===e[n].data.ref||e[e[n].data.ref])&&r.push(e[n].data));r.length&&(n[g[t].typeIdx].data=r)}else i(e,t),n[g[t].typeIdx].data=e.data}const o={},a=t;if(y.features||y.schema||P){let t,n=!1;for(let r=0,i=e.length;r<i;r++)if(t=e[r],a[t.layer].properties||(a[t.layer].properties=Cn(t.properties)),t&&(y.features||P&&m[r]))if("id"===y.features)o[r]=t.id;else{y.pickingGeometry||delete t.geometry,delete t.extent,delete t.properties.$layer,delete t.properties.$type,delete t.__index;const e=t.originalFeature;if(e){const e=t.properties,n=I({},t.originalFeature);delete e[Fn],n.customProps=I({},e),t=n}const i=I({},t);if(P&&m[r]&&(!y.features||"transient"===y.features)){const i=m[r];for(let r=0;r<i.length;r++){const i=b[r];i&&i.forEach((r=>{const i=e?e.properties:t.properties;i[Tn]||(i[Tn]=new Set),i[Tn].add(r),n=!0}))}}o[r]=i}if(n)for(const t in o){const e=o[t],n=e.properties[Tn];if(n){delete e.properties[Tn],"transient"===y.features&&(e.fnTypeProps=I({},e.properties));for(const t in e.properties)n.has(t)||("transient"===y.features?delete e.fnTypeProps[t]:delete e.properties[t])}}}return{data:{styleCounter:n,schema:a,data:p,featureData:d,extent:h,features:o},buffers:x}})).catch((t=>{console.error(t)}))}_createTileGeometry(t,e,n){let r=t;const i=e.renderPlugin.dataConfig,o=e.symbol,s=this.options.tileSize,{extent:a,glScale:l,zScale:u,zoom:h,tilePoint:c,centimeterToPoint:f,verticalCentimeterToPoint:p}=n,d=a/s,g=i.type,y=n.debugIndex;let x=I({},i,{EXTENT:a,zoom:h,debugIndex:y,features:this.options.features});if("3d-extrusion"===g){Yn(o)&&(i.uv=1);const t=this.options.projectionCode,e=o.material&&o.material.textureWidth||An;return Promise.all([Promise.resolve(je(r,i,a,c,e,n.tileInfo.res,l,a/this.options.tileSize,f,p,o,h,t,y))])}if("3d-wireframe"===g)return Promise.all([Promise.resolve(Ke(r,a,o,i))]);if("point"===g){x=I(x,{requestor:this.fetchIconGlyphs.bind(this),altitudeToTileScale:u*a/this.options.tileSize/l,pluginType:e.renderPlugin.type});let t=o;return Array.isArray(o)||(t=[o]),t=t.map(((t,e)=>(t&&(t.index={index:e},t.isIconText=function(t){return t.markerType||t.markerFile}(t)),t))).filter((t=>!!t)),Promise.all(t.map((t=>{const e=fn.genFnTypes(t);let n=r;return yn.needMerge(t,e,h)&&(n=yn.mergeLineFeatures(r,t,e,h)),new yn(n,t,x).load(d)})))}if("native-point"===g){const t=u*a/this.options.tileSize/l;return x.altitudeToTileScale=t,Vn(r,o,x,xn,d)}if("line"===g)return x=I(x,{requestor:this.fetchIconGlyphs.bind(this),tileRatio:d}),Vn(r,o,x,gn,1,!0);if("native-line"===g)return Vn(r,o,x,dn,1,!0);if("fill"===g)return x=I(x,{requestor:this.fetchIconGlyphs.bind(this)}),Vn(r,o,x,pn);if("line-extrusion"===g){delete o.lineGradientProperty,o.lineJoin="miter",o.lineCap="butt";const t=Yn(o);if(t&&(i.uv=1),x=I(x,{tileSize:s,zScale:u,glScale:l}),o.mergeOnProperty){const t=fn.genFnTypes(o);r=gn.mergeLineFeatures(r,o,t,x.zoom)}if(t){const t=[];if(!1!==i.top){const e=I({},x);e.side=!1,t.push(new mn(r,o,e))}return!1!==i.side&&(x.side=!0,x.top=!1,t.push(new mn(r,o,x))),Promise.all(t.map((t=>t.load())))}return Promise.all([new mn(r,o,x).load()])}if("circle"===g)return Vn(r,o,x,vn);if("round-tube"===g||"square-tube"===g){const t="round-tube"===g?wn:Mn;return x=I(x,{requestor:this.fetchIconGlyphs.bind(this),radialSegments:"round-tube"===g?i.radialSegments||8:4,centimeterToPoint:f,verticalCentimeterToPoint:p,tileRatio:d,isTube:!0}),Vn(r,o,x,t)}return Promise.resolve([])}_filterFeatures(t,e,n,r,i,o){const s=(te+"").trim(),a=[],l=[],u=r.length;for(let h=0;h<u;h++)if((1===e||void 0===r[h].id||!this.styledFeatures[r[h].id])&&((!n.def||"default"===n.def)&&!i[h]||!0===n.def||n.def&&(void 0!==n.def.condition||Array.isArray(n.def))&&n(r[h],t))){const t=r[h];if(void 0===t[s]&&(t[s]=h),i[h]||(i[h]=[]),i[h].push(o),l.push(t),a.push(h),1===e)break}return{tileFeatures:l,tileFeaIndexes:a}}_compileStyle(t){const{style:e,featureStyle:n}=t,r={};n.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=bn.compileStyle(e);for(let t=0;t<e.length;t++)i[t].filter&&(i[t].filter.def=e[t].filter?e[t].filter.value||e[t].filter:void 0),i[t].type=0;const o=[],s=bn.compileStyle(n);for(let t=0;t<n.length;t++)s[t].type=1,s[t].filter.def=n[t].filter?n[t].filter.value||n[t].filter:void 0,s[t].renderPlugin&&o.push(s[t]);this.pluginConfig=i,this.featurePlugins=o,this.styledFeatures=r}_updateLayerPluginConfig(t){let e=this._layerPlugins;this._layerPlugins||(e=this._layerPlugins={});const n=["","Point","LineString","Polygon","MultiPoint","MultiLineString","MultiPolygon"],r=[];for(const o in t){const s=o;if(!e[o]){const r=[];for(let e=0;e<t[o].types.length;e++){const a=t[o].types[e],l=["all",["==","$layer",s],["==","$type",n[a]]],u={filter:(i=l,new Function("f",\`var p = (f && f.properties || {}); return ${E}tn(i)}\`)),renderPlugin:Bn(a),symbol:Ln(a)};u.filter.def=l,u.type=0,r.push(u)}e[s]=r}r.push(...e[s])}var i;return r}}function Bn(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 Ln(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 Cn(t){if(Array.isArray(t)||!T(t))return{};const e={};for(const n in t){const r=t[n];A(r)?e[n]="string":S(r)?e[n]="number":!0===r||!1===r?e[n]="boolean":Array.isArray(r)?e[n]="array":e[n]="object"}return e}function Yn(t){if(!t)return 0;let e=0;for(const n in t){if(("normalTexture"===n||"bumpTexture"===n)&&t[n])return 2;if(n.indexOf("Texture")>0&&t[n])e=1;else if(T(t[n])){const r=Yn(t[n]);if(2===r)return r;1===r&&(e=1)}}return e}function Vn(t,e,n,r,i,o){const s={},a=Array.isArray(e)?e:[e];let l=-1;for(let t=0;t<a.length;t++)s[t]=On(a[t]),!s[t]&&a[t]&&-1===l&&(l=t);const u=[];for(let e=0;e<a.length;e++){if(!a[e])continue;a[e].index={index:e};let h=t;if(o&&a[e].mergeOnProperty){const r=fn.genFnTypes(a[e]);h=gn.mergeLineFeatures(t,a[0],r,n.zoom)}s[e]||e===l?u.push(new r(h,a[e],n).load(i)):u.push({data:{ref:l,symbolIndex:{index:e}}})}return Promise.all(u)}function On(t){if(!t)return 0;for(const e in t)if(B(t[e]))return 1;return 0}function Xn(t,e,n,r){const i=n.customProperties;if(!i)return t;if(i)for(let t=0;t<i.length;t++)i[t].fn=bn.compileFilter(i[t].filter);for(let n=0;n<i.length;n++)for(let o=0,s=t.length;o<s;o++)if(i[n].fn(t[o],e))for(const t in i[n].properties){const e=i[n].properties[t];k(e)||(r[o]||(r[o]={}),r[o][t]||(r[o][t]=new Set),r[o][t].add(e))}}const Nn={get:(t,e)=>e in t?t[e]:t.originalFeature[e],has:(t,e)=>e in t||e in t.originalFeature},En={get:function(t,e){return e in t?t[e]:t[Fn][e]},has:(t,e)=>e in t||e in t[Fn]},zn={};function $n(t){const e={};e.originalFeature=t;const n=new Proxy(e,Nn);return n.properties=new Proxy({},En),n.properties[Fn]=t.properties||zn,n}function qn(t,e,n){t[e]||(t[e]=new Set),t[e].add(n)}const Dn=[];function jn(t,e,n){if(!t)return Dn;for(const r in t){if(!t[r]||!_n.checkIfZoomFnTypeSymbol(r))continue;if(B(t[r]))qn(e,n,t[r].property);else{if("lineGradientProperty"===r){qn(e,n,t[r]);continue}if("textName"===r)if(A(t[r])){const i=In.resolveVarNames(t[r]);if(i)for(let t=0;t<i.length;t++)qn(e,n,i[t])}else if(bn.isExpression(t[r])){const i=[];In.resolveExpVarNames(i,t[r]);for(let t=0;t<i.length;t++)qn(e,n,i[t])}}const i=t[r].stops;if(i&&i.length)for(let t=0;t<i.length;t++)B(i[t][1])&&qn(e,t,i[t][1].property)}return e[n]}function Zn(t,e){Gn(t.geometry,e)}function Gn(t,e){if(t)switch(t.type){case"Point":Un(t.coordinates,e);break;case"MultiPoint":case"LineString":Rn(t.coordinates,e);break;case"MultiLineString":!function(t,e){for(let n=0,r=t.length;n<r;n++)Rn(t[n],e)}(t.coordinates,e);break;case"Polygon":Jn(t.coordinates,e);break;case"MultiPolygon":!function(t,e){for(let n=0,r=t.length;n<r;n++)Jn(t[n],e)}(t.coordinates,e);break;case"GeometryCollection":const n=t.geometries.length;for(let r=0;r<n;r++)Gn(t.geometries[r],e)}}function Un(t,e){e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.max(e[2],t[0]),e[3]=Math.max(e[3],t[1])}function Rn(t,e){for(let n=0,r=t.length;n<r;n++)Un(t[n],e)}function Jn(t,e){t.length&&Rn(t[0],e)}function Hn(t,e,n,r,i){Wn(t,e,n||0,r||t.length-1,i||Qn)}function Wn(t,e,n,r,i){for(;r>n;){if(r-n>600){var o=r-n+1,s=e-n+1,a=Math.log(o),l=.5*Math.exp(2*a/3),u=.5*Math.sqrt(a*l*(o-l)/o)*(s-o/2<0?-1:1);Wn(t,e,Math.max(n,Math.floor(e-s*l/o+u)),Math.min(r,Math.floor(e+(o-s)*l/o+u)),i)}var h=t[e],c=n,f=r;for(Kn(t,n,e),i(t[r],h)>0&&Kn(t,n,r);c<f;){for(Kn(t,c,f),c++,f--;i(t[c],h)<0;)c++;for(;i(t[f],h)>0;)f--}0===i(t[n],h)?Kn(t,n,f):Kn(t,++f,r),f<=e&&(n=f+1),e<=f&&(r=f-1)}}function Kn(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function Qn(t,e){return t<e?-1:t>e?1:0}class tr{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()}all(){return this._all(this.data,[])}search(t){let e=this.data;const n=[];if(!cr(t,e))return n;const r=this.toBBox,i=[];for(;e;){for(let o=0;o<e.children.length;o++){const s=e.children[o],a=e.leaf?r(s):s;cr(t,a)&&(e.leaf?n.push(s):hr(t,a)?this._all(s,n):i.push(s))}e=i.pop()}return n}collides(t){let e=this.data;if(!cr(t,e))return!1;const n=[];for(;e;){for(let r=0;r<e.children.length;r++){const i=e.children[r],o=e.leaf?this.toBBox(i):i;if(cr(t,o)){if(e.leaf||hr(t,o))return!0;n.push(i)}}e=n.pop()}return!1}load(t){if(!t||!t.length)return this;if(t.length<this._minEntries){for(let e=0;e<t.length;e++)this.insert(t[e]);return this}let e=this._build(t.slice(),0,t.length-1,0);if(this.data.children.length)if(this.data.height===e.height)this._splitRoot(this.data,e);else{if(this.data.height<e.height){const t=this.data;this.data=e,e=t}this._insert(e,this.data.height-e.height-1,!0)}else this.data=e;return this}insert(t){return t&&this._insert(t,this.data.height-1),this}clear(){return this.data=fr([]),this}remove(t,e){if(!t)return this;let n=this.data;const r=this.toBBox(t),i=[],o=[];let s,a,l;for(;n||i.length;){if(n||(n=i.pop(),a=i[i.length-1],s=o.pop(),l=!0),n.leaf){const r=er(t,n.children,e);if(-1!==r)return n.children.splice(r,1),i.push(n),this._condense(i),this}l||n.leaf||!hr(n,r)?a?(s++,n=a.children[s],l=!1):n=null:(i.push(n),o.push(s),s=0,a=n,n=n.children[0])}return this}toBBox(t){return t}compareMinX(t,e){return t.minX-e.minX}compareMinY(t,e){return t.minY-e.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}_all(t,e){const n=[];for(;t;)t.leaf?e.push(...t.children):n.push(...t.children),t=n.pop();return e}_build(t,e,n,r){const i=n-e+1;let o,s=this._maxEntries;if(i<=s)return o=fr(t.slice(e,n+1)),nr(o,this.toBBox),o;r||(r=Math.ceil(Math.log(i)/Math.log(s)),s=Math.ceil(i/Math.pow(s,r-1))),o=fr([]),o.leaf=!1,o.height=r;const a=Math.ceil(i/s),l=a*Math.ceil(Math.sqrt(s));pr(t,e,n,l,this.compareMinX);for(let i=e;i<=n;i+=l){const e=Math.min(i+l-1,n);pr(t,i,e,a,this.compareMinY);for(let n=i;n<=e;n+=a){const i=Math.min(n+a-1,e);o.children.push(this._build(t,n,i,r-1))}}return nr(o,this.toBBox),o}_chooseSubtree(t,e,n,r){for(;r.push(e),!e.leaf&&r.length-1!==n;){let n,r=1/0,s=1/0;for(let a=0;a<e.children.length;a++){const l=e.children[a],u=ar(l),h=(i=t,o=l,(Math.max(o.maxX,i.maxX)-Math.min(o.minX,i.minX))*(Math.max(o.maxY,i.maxY)-Math.min(o.minY,i.minY))-u);h<s?(s=h,r=u<r?u:r,n=l):h===s&&u<r&&(r=u,n=l)}e=n||e.children[0]}var i,o;return e}_insert(t,e,n){const r=n?t:this.toBBox(t),i=[],o=this._chooseSubtree(r,this.data,e,i);for(o.children.push(t),ir(o,r);e>=0&&i[e].children.length>this._maxEntries;)this._split(i,e),e--;this._adjustParentBBoxes(r,i,e)}_split(t,e){const n=t[e],r=n.children.length,i=this._minEntries;this._chooseSplitAxis(n,i,r);const o=this._chooseSplitIndex(n,i,r),s=fr(n.children.splice(o,n.children.length-o));s.height=n.height,s.leaf=n.leaf,nr(n,this.toBBox),nr(s,this.toBBox),e?t[e-1].children.push(s):this._splitRoot(n,s)}_splitRoot(t,e){this.data=fr([t,e]),this.data.height=t.height+1,this.data.leaf=!1,nr(this.data,this.toBBox)}_chooseSplitIndex(t,e,n){let r,i=1/0,o=1/0;for(let s=e;s<=n-e;s++){const e=rr(t,0,s,this.toBBox),a=rr(t,s,n,this.toBBox),l=ur(e,a),u=ar(e)+ar(a);l<i?(i=l,r=s,o=u<o?u:o):l===i&&u<o&&(o=u,r=s)}return r||n-e}_chooseSplitAxis(t,e,n){const r=t.leaf?this.compareMinX:or,i=t.leaf?this.compareMinY:sr;this._allDistMargin(t,e,n,r)<this._allDistMargin(t,e,n,i)&&t.children.sort(r)}_allDistMargin(t,e,n,r){t.children.sort(r);const i=this.toBBox,o=rr(t,0,e,i),s=rr(t,n-e,n,i);let a=lr(o)+lr(s);for(let r=e;r<n-e;r++){const e=t.children[r];ir(o,t.leaf?i(e):e),a+=lr(o)}for(let r=n-e-1;r>=e;r--){const e=t.children[r];ir(s,t.leaf?i(e):e),a+=lr(s)}return a}_adjustParentBBoxes(t,e,n){for(let r=n;r>=0;r--)ir(e[r],t)}_condense(t){for(let e,n=t.length-1;n>=0;n--)0===t[n].children.length?n>0?(e=t[n-1].children,e.splice(e.indexOf(t[n]),1)):this.clear():nr(t[n],this.toBBox)}}function er(t,e,n){if(!n)return e.indexOf(t);for(let r=0;r<e.length;r++)if(n(t,e[r]))return r;return-1}function nr(t,e){rr(t,0,t.children.length,e,t)}function rr(t,e,n,r,i){i||(i=fr(null)),i.minX=1/0,i.minY=1/0,i.maxX=-1/0,i.maxY=-1/0;for(let o=e;o<n;o++){const e=t.children[o];ir(i,t.leaf?r(e):e)}return i}function ir(t,e){return t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY),t}function or(t,e){return t.minX-e.minX}function sr(t,e){return t.minY-e.minY}function ar(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function lr(t){return t.maxX-t.minX+(t.maxY-t.minY)}function ur(t,e){const n=Math.max(t.minX,e.minX),r=Math.max(t.minY,e.minY),i=Math.min(t.maxX,e.maxX),o=Math.min(t.maxY,e.maxY);return Math.max(0,i-n)*Math.max(0,o-r)}function hr(t,e){return t.minX<=e.minX&&t.minY<=e.minY&&e.maxX<=t.maxX&&e.maxY<=t.maxY}function cr(t,e){return e.minX<=t.maxX&&e.minY<=t.maxY&&e.maxX>=t.minX&&e.maxY>=t.minY}function fr(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function pr(t,e,n,r,i){const o=[e,n];for(;o.length;){if((n=o.pop())-(e=o.pop())<=r)continue;const s=e+Math.ceil((n-e)/r/2)*r;Hn(t,s,e,n,i),o.push(e,s,s,n)}}class dr{constructor(t=[],e=gr){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this._down(t)}push(t){this.data.push(t),this.length++,this._up(this.length-1)}pop(){if(0===this.length)return;const t=this.data[0],e=this.data.pop();return this.length--,this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:e,compare:n}=this,r=e[t];for(;t>0;){const i=t-1>>1,o=e[i];if(n(r,o)>=0)break;e[t]=o,t=i}e[t]=r}_down(t){const{data:e,compare:n}=this,r=this.length>>1,i=e[t];for(;t<r;){let r=1+(t<<1),o=e[r];const s=r+1;if(s<this.length&&n(e[s],o)<0&&(r=s,o=e[s]),n(o,i)>=0)break;e[t]=o,t=r}e[t]=i}}function gr(t,e){return t<e?-1:t>e?1:0}function yr(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var xr={exports:{}},mr=function(t,e,n,r){var i=t[0],o=t[1],s=!1;void 0===n&&(n=0),void 0===r&&(r=e.length);for(var a=(r-n)/2,l=0,u=a-1;l<a;u=l++){var h=e[n+2*l+0],c=e[n+2*l+1],f=e[n+2*u+0],p=e[n+2*u+1];c>o!=p>o&&i<(f-h)*(o-c)/(p-c)+h&&(s=!s)}return s},vr=function(t,e,n,r){var i=t[0],o=t[1],s=!1;void 0===n&&(n=0),void 0===r&&(r=e.length);for(var a=r-n,l=0,u=a-1;l<a;u=l++){var h=e[l+n][0],c=e[l+n][1],f=e[u+n][0],p=e[u+n][1];c>o!=p>o&&i<(f-h)*(o-c)/(p-c)+h&&(s=!s)}return s};xr.exports=function(t,e,n,r){return e.length>0&&Array.isArray(e[0])?vr(t,e,n,r):mr(t,e,n,r)};var wr=xr.exports.nested=vr;xr.exports.flat=mr;const Mr=11102230246251565e-32,br=134217729,Pr=(3+8*Mr)*Mr;function _r(t,e,n,r,i){let o,s,a,l,u=e[0],h=r[0],c=0,f=0;h>u==h>-u?(o=u,u=e[++c]):(o=h,h=r[++f]);let p=0;if(c<t&&f<n)for(h>u==h>-u?(s=u+o,a=o-(s-u),u=e[++c]):(s=h+o,a=o-(s-h),h=r[++f]),o=s,0!==a&&(i[p++]=a);c<t&&f<n;)h>u==h>-u?(s=o+u,l=s-o,a=o-(s-l)+(u-l),u=e[++c]):(s=o+h,l=s-o,a=o-(s-l)+(h-l),h=r[++f]),o=s,0!==a&&(i[p++]=a);for(;c<t;)s=o+u,l=s-o,a=o-(s-l)+(u-l),u=e[++c],o=s,0!==a&&(i[p++]=a);for(;f<n;)s=o+h,l=s-o,a=o-(s-l)+(h-l),h=r[++f],o=s,0!==a&&(i[p++]=a);return 0===o&&0!==p||(i[p++]=o),p}function Ir(t){return new Float64Array(t)}const Ar=33306690738754716e-32,Sr=22204460492503146e-32,Fr=11093356479670487e-47,Tr=Ir(4),kr=Ir(8),Br=Ir(12),Lr=Ir(16),Cr=Ir(4);function Yr(t,e,n,r,i,o){const s=(e-o)*(n-i),a=(t-i)*(r-o),l=s-a;if(0===s||0===a||s>0!=a>0)return l;const u=Math.abs(s+a);return Math.abs(l)>=Ar*u?l:-function(t,e,n,r,i,o,s){let a,l,u,h,c,f,p,d,g,y,x,m,v,w,M,b,P,_;const I=t-i,A=n-i,S=e-o,F=r-o;w=I*F,f=br*I,p=f-(f-I),d=I-p,f=br*F,g=f-(f-F),y=F-g,M=d*y-(w-p*g-d*g-p*y),b=S*A,f=br*S,p=f-(f-S),d=S-p,f=br*A,g=f-(f-A),y=A-g,P=d*y-(b-p*g-d*g-p*y),x=M-P,c=M-x,Tr[0]=M-(x+c)+(c-P),m=w+x,c=m-w,v=w-(m-c)+(x-c),x=v-b,c=v-x,Tr[1]=v-(x+c)+(c-b),_=m+x,c=_-m,Tr[2]=m-(_-c)+(x-c),Tr[3]=_;let T=function(t,e){let n=e[0];for(let r=1;r<t;r++)n+=e[r];return n}(4,Tr),k=Sr*s;if(T>=k||-T>=k)return T;if(c=t-I,a=t-(I+c)+(c-i),c=n-A,u=n-(A+c)+(c-i),c=e-S,l=e-(S+c)+(c-o),c=r-F,h=r-(F+c)+(c-o),0===a&&0===l&&0===u&&0===h)return T;if(k=Fr*s+Pr*Math.abs(T),T+=I*h+F*a-(S*u+A*l),T>=k||-T>=k)return T;w=a*F,f=br*a,p=f-(f-a),d=a-p,f=br*F,g=f-(f-F),y=F-g,M=d*y-(w-p*g-d*g-p*y),b=l*A,f=br*l,p=f-(f-l),d=l-p,f=br*A,g=f-(f-A),y=A-g,P=d*y-(b-p*g-d*g-p*y),x=M-P,c=M-x,Cr[0]=M-(x+c)+(c-P),m=w+x,c=m-w,v=w-(m-c)+(x-c),x=v-b,c=v-x,Cr[1]=v-(x+c)+(c-b),_=m+x,c=_-m,Cr[2]=m-(_-c)+(x-c),Cr[3]=_;const B=_r(4,Tr,4,Cr,kr);w=I*h,f=br*I,p=f-(f-I),d=I-p,f=br*h,g=f-(f-h),y=h-g,M=d*y-(w-p*g-d*g-p*y),b=S*u,f=br*S,p=f-(f-S),d=S-p,f=br*u,g=f-(f-u),y=u-g,P=d*y-(b-p*g-d*g-p*y),x=M-P,c=M-x,Cr[0]=M-(x+c)+(c-P),m=w+x,c=m-w,v=w-(m-c)+(x-c),x=v-b,c=v-x,Cr[1]=v-(x+c)+(c-b),_=m+x,c=_-m,Cr[2]=m-(_-c)+(x-c),Cr[3]=_;const L=_r(B,kr,4,Cr,Br);w=a*h,f=br*a,p=f-(f-a),d=a-p,f=br*h,g=f-(f-h),y=h-g,M=d*y-(w-p*g-d*g-p*y),b=l*u,f=br*l,p=f-(f-l),d=l-p,f=br*u,g=f-(f-u),y=u-g,P=d*y-(b-p*g-d*g-p*y),x=M-P,c=M-x,Cr[0]=M-(x+c)+(c-P),m=w+x,c=m-w,v=w-(m-c)+(x-c),x=v-b,c=v-x,Cr[1]=v-(x+c)+(c-b),_=m+x,c=_-m,Cr[2]=m-(_-c)+(x-c),Cr[3]=_;const C=_r(L,Br,4,Cr,Lr);return Lr[C-1]}(t,e,n,r,i,o,u)}function Vr(t,e,n){e=Math.max(0,void 0===e?2:e),n=n||0;var r=function(t){for(var e=t[0],n=t[0],r=t[0],i=t[0],o=0;o<t.length;o++){var s=t[o];s[0]<e[0]&&(e=s),s[0]>r[0]&&(r=s),s[1]<n[1]&&(n=s),s[1]>i[1]&&(i=s)}var a=[e,n,r,i],l=a.slice();for(o=0;o<t.length;o++)wr(t[o],a)||l.push(t[o]);return function(t){t.sort(Ur);for(var e=[],n=0;n<t.length;n++){for(;e.length>=2&&$r(e[e.length-2],e[e.length-1],t[n])<=0;)e.pop();e.push(t[n])}for(var r=[],i=t.length-1;i>=0;i--){for(;r.length>=2&&$r(r[r.length-2],r[r.length-1],t[i])<=0;)r.pop();r.push(t[i])}return r.pop(),e.pop(),e.concat(r)}(l)}(t),i=new tr(16);i.toBBox=function(t){return{minX:t[0],minY:t[1],maxX:t[0],maxY:t[1]}},i.compareMinX=function(t,e){return t[0]-e[0]},i.compareMinY=function(t,e){return t[1]-e[1]},i.load(t);for(var o,s=[],a=0;a<r.length;a++){var l=r[a];i.remove(l),o=Dr(l,o),s.push(o)}var u=new tr(16);for(a=0;a<s.length;a++)u.insert(qr(s[a]));for(var h=e*e,c=n*n;s.length;){var f=s.shift(),p=f.p,d=f.next.p,g=jr(p,d);if(!(g<c)){var y=g/h;(l=Or(i,f.prev.p,p,d,f.next.next.p,y,u))&&Math.min(jr(l,p),jr(l,d))<=y&&(s.push(f),s.push(Dr(l,f)),i.remove(l),u.remove(f),u.insert(qr(f)),u.insert(qr(f.next)))}}f=o;var x=[];do{x.push(f.p),f=f.next}while(f!==o);return x.push(f.p),x}function Or(t,e,n,r,i,o,s){for(var a=new dr([],Xr),l=t.data;l;){for(var u=0;u<l.children.length;u++){var h=l.children[u],c=l.leaf?Zr(h,n,r):Nr(n,r,h);c>o||a.push({node:h,dist:c})}for(;a.length&&!a.peek().node.children;){var f=a.pop(),p=f.node,d=Zr(p,e,n),g=Zr(p,r,i);if(f.dist<d&&f.dist<g&&zr(n,p,s)&&zr(r,p,s))return p}(l=a.pop())&&(l=l.node)}return null}function Xr(t,e){return t.dist-e.dist}function Nr(t,e,n){if(Er(t,n)||Er(e,n))return 0;var r=Gr(t[0],t[1],e[0],e[1],n.minX,n.minY,n.maxX,n.minY);if(0===r)return 0;var i=Gr(t[0],t[1],e[0],e[1],n.minX,n.minY,n.minX,n.maxY);if(0===i)return 0;var o=Gr(t[0],t[1],e[0],e[1],n.maxX,n.minY,n.maxX,n.maxY);if(0===o)return 0;var s=Gr(t[0],t[1],e[0],e[1],n.minX,n.maxY,n.maxX,n.maxY);return 0===s?0:Math.min(r,i,o,s)}function Er(t,e){return t[0]>=e.minX&&t[0]<=e.maxX&&t[1]>=e.minY&&t[1]<=e.maxY}function zr(t,e,n){for(var r,i,o,s,a=Math.min(t[0],e[0]),l=Math.min(t[1],e[1]),u=Math.max(t[0],e[0]),h=Math.max(t[1],e[1]),c=n.search({minX:a,minY:l,maxX:u,maxY:h}),f=0;f<c.length;f++)if(r=c[f].p,i=c[f].next.p,o=t,r!==(s=e)&&i!==o&&$r(r,i,o)>0!=$r(r,i,s)>0&&$r(o,s,r)>0!=$r(o,s,i)>0)return!1;return!0}function $r(t,e,n){return Yr(t[0],t[1],e[0],e[1],n[0],n[1])}function qr(t){var e=t.p,n=t.next.p;return t.minX=Math.min(e[0],n[0]),t.minY=Math.min(e[1],n[1]),t.maxX=Math.max(e[0],n[0]),t.maxY=Math.max(e[1],n[1]),t}function Dr(t,e){var n={p:t,prev:null,next:null,minX:0,minY:0,maxX:0,maxY:0};return e?(n.next=e.next,n.prev=e,e.next.prev=n,e.next=n):(n.prev=n,n.next=n),n}function jr(t,e){var n=t[0]-e[0],r=t[1]-e[1];return n*n+r*r}function Zr(t,e,n){var r=e[0],i=e[1],o=n[0]-r,s=n[1]-i;if(0!==o||0!==s){var a=((t[0]-r)*o+(t[1]-i)*s)/(o*o+s*s);a>1?(r=n[0],i=n[1]):a>0&&(r+=o*a,i+=s*a)}return(o=t[0]-r)*o+(s=t[1]-i)*s}function Gr(t,e,n,r,i,o,s,a){var l,u,h,c,f=n-t,p=r-e,d=s-i,g=a-o,y=t-i,x=e-o,m=f*f+p*p,v=f*d+p*g,w=d*d+g*g,M=f*y+p*x,b=d*y+g*x,P=m*w-v*v,_=P,I=P;0===P?(u=0,_=1,c=b,I=w):(c=m*b-v*M,(u=v*b-w*M)<0?(u=0,c=b,I=w):u>_&&(u=_,c=b+v,I=w)),c<0?(c=0,-M<0?u=0:-M>m?u=_:(u=-M,_=m)):c>I&&(c=I,-M+v<0?u=0:-M+v>m?u=_:(u=-M+v,_=m));var A=(1-(h=0===c?0:c/I))*i+h*s-((1-(l=0===u?0:u/_))*t+l*n),S=(1-h)*o+h*a-((1-l)*e+l*r);return A*A+S*S}function Ur(t,e){return t[0]===e[0]?t[1]-e[1]:t[0]-e[0]}const{PackUtil:Rr}=ne();class Jr{constructor(t,e){this.x=t,this.y=e}clone(){return new Jr(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 Jr(this.x-t.x,this.y-t.y)}distance(t){const e=this.x-t.x,n=this.y-t.y;return Math.sqrt(e*e+n*n)}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 Jr(this.y,-this.x)}}function Hr(t,e,n,r){const i=e.x*r.y-e.y*r.x,o=n.x-t.x,s=n.y-t.y,a=(o*r.y-s*r.x)/i;return new Jr(t.x+a*e.x,t.y+a*e.y)}const Wr=[],Kr=[];function Qr(t){if(S(t[0]&&t[0].x)){const e=[];let n=0;for(let r=0;r<t.length;r++)Kr[n]?(Kr[n][0]=t[r].x,Kr[n][1]=t[r].y):Kr[n]=[t[r].x,t[r].y],e.push(Kr[n]),n++;t=e}try{const e=Vr(t,1/0);let n=[1/0,1/0],r=[-1/0,-1/0];for(let t=0;t<e.length;t++)e[t][0]<n[0]&&(n[0]=e[t][0]),e[t][0]>r[0]&&(r[0]=e[t][0]),e[t][1]<n[1]&&(n[1]=e[t][1]),e[t][1]>r[1]&&(r[1]=e[t][1]);const i=[];let o=[],s=0;for(let t=0;t<e.length;t++)t===e.length-1&&e[t][0]===e[0][0]&&e[t][1]===e[0][1]||(Pt(i,e[t],"EPSG:3857"),Wr[s]?(Wr[s].x=i[0],Wr[s].y=i[1]):Wr[s]=new Jr(i[0],i[1]),o.push(Wr[s]),s++);Rr.calculateSignedArea(o)<0&&(o=o.reverse());const a=function(t){let e,n=Number.MAX_VALUE;const r=function(t,r,i,o,s,a,l,u){var h=Hr(t,r,s,a),c=Hr(i,o,s,a),f=Hr(l,u,t,r),p=Hr(l,u,i,o),d=h.distance(c)*h.distance(f);0!==d&&d<n&&(e=[h,f,p,c],n=d)};var i=[];for(let e=0;e<t.length;e++)i.push(t[(e+1)%t.length].diff(t[e])),i[e].normalize();var o,s,a,l,u=new Jr(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),h=new Jr(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);for(let e=0;e<t.length;e++){var c=t[e];c.x<u.x&&(u.x=c.x,o=e),c.x>h.x&&(h.x=c.x,s=e),c.y<u.y&&(u.y=c.y,l=e),c.y>h.y&&(h.y=c.y,a=e)}var f=new Jr(0,-1),p=new Jr(0,1),d=new Jr(-1,0),g=new Jr(1,0);for(let e=0;e<t.length;e++){var y=[Math.acos(f.dot(i[o])),Math.acos(p.dot(i[s])),Math.acos(d.dot(i[a])),Math.acos(g.dot(i[l]))];switch(y.indexOf(Math.min.apply(Math,y))){case 0:(p=(f=i[o].clone()).clone()).negate(),(g=(d=f.orthogonal()).clone()).negate(),o=(o+1)%t.length;break;case 1:(f=(p=i[s].clone()).clone()).negate(),(g=(d=f.orthogonal()).clone()).negate(),s=(s+1)%t.length;break;case 2:(g=(d=i[a].clone()).clone()).negate(),(p=(f=g.orthogonal()).clone()).negate(),a=(a+1)%t.length;break;case 3:(d=(g=i[l].clone()).clone()).negate(),(p=(f=g.orthogonal()).clone()).negate(),l=(l+1)%t.length}r(t[o],f,t[s],p,t[a],d,t[l],g)}return e}(o);if(!a||4!==a.length)return null;const l=a[0].distance(a[1]),u=a[1].distance(a[2]),h=a.map((t=>[t.x,t.y]));return h.push(+(u>l)),h}catch(t){return null}}const ti=[];function ei(t,e){const n=Array.isArray(t&&t[0]&&t[0][0]);for(let r=0;r<t.length;r++)n?t[r]=ei(t[r]):(Pt(ti,t[r],e),t[r][0]=ti[0],t[r][1]=ti[1]);return t}const{PackUtil:ni}=ne();class ri extends kn{constructor(t,e,n,r,i,o){super(t,e,n,r,i),(e=e||{}).extent||(e.extent=8192),this.setData(e.data,o)}setData(t,e){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 e();const n={maxZoom:24,tolerance:this.options.simplifyTolerance,extent:this.options.extent,buffer:S(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&&(n.projection=this.options.projection,"EPSG:4490"===n.projection&&(n.projection="EPSG:4326")),A(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),e(t)),!i)return void e(null,{extent:null,idMap:{}});let o=i;if(this.options.convertFn){o=new Function("data",this.options.convertFn+"\\nreturn convert(data)")(o)}const s=Array.isArray(o)?o:o.features;this._genOMBB(s);const{sample1000:a,idMap:l}=this._generateId(s);this._generate(a,l,o,n,e)}))}else{"string"==typeof t&&(t=JSON.parse(t));const r=Array.isArray(t)?t:t.features,i=r&&r.length;this._genOMBB(r);let o=r;if(r&&i>1e3){o=[];for(let t=0;t<i;t++)ii(r[t],o,t,i)}this._generate(o,null,t,n,e)}}_genOMBB(t){if(this.options.generateOMBB&&t)for(let e=0;e<t.length;e++){const n=t[e];if(n&&n.geometry&&n.geometry.coordinates)if("Polygon"===n.geometry.type){const t=n.geometry.coordinates[0];if(!t)continue;const e=Qr(t,t.length);n.properties=n.properties||{},n.properties[ee]=e}else if("MultiPolygon"===n.geometry.type){const t=n.geometry.coordinates;for(let e=0;e<t.length;e++){if(!t[e])continue;const r=t[e][0];if(!r)continue;const i=Qr(r,r.length);n.properties=n.properties||{},n.properties[ee]=n.properties[ee]||[],n.properties[ee][e]=i}}}}_generate(t,e,n,r,i){try{const o=t&&t.length?function(t){let e=[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY];switch(t.type){case"FeatureCollection":const n=t.features.length;for(let r=0;r<n;r++)Zn(t.features[r],e);break;case"Feature":Zn(t,e);break;default:Gn(t,e)}return e}({type:"FeatureCollection",features:t}):null;this.index=function(t,e){return new ut(t,e)}(n,this.options.geojsonvt||r),i(null,{extent:o,idMap:e})}catch(t){console.warn(t),i({error:t.message})}}_generateId(t){const e=[],n={};let r=0;const i=this.options.featureIdProperty;if(t){const o=t.length;t.forEach(((t,s)=>{!function(t,o,s){if(t&&("Feature"!==t.type||t.geometry)){if(S(t.id)||(t.id=r++),i){let e=i;T(i)&&(e=i[t.layer||"0"]),t.id=t.properties[e]}n[t.id]=I({},t),t.geometry?(n[t.id].geometry=I({},t.geometry),n[t.id].geometry.coordinates=null):t.coordinates&&(n[t.id].coordinates=null),ii(t,e,o,s)}}(t,s,o)}))}return{sample1000:e,idMap:n}}getTileFeatures(t,e){const n=t.tileInfo,r=[];if(!this.index)return this.empty?(setTimeout((function(){e(null,r,[])}),1),1):(setTimeout((function(){e({loading:!0})}),1),1);const i=this.index.getTile(n.z,n.x,n.y);if(!i||0===i.features.length)return setTimeout((function(){e(null,r,[])}),1),1;const o=[];for(let t=0,e=i.features.length;t<e;t++){const e=i.features[t];let n=e.layer;void 0===n&&(n="0"),o[n]={types:{}};o[n].types[e.type]=1,e.tags=e.tags||{},e.geometry.converted||(ni.convertGeometry(e),e.geometry.converted=1),r.push({type:e.type,layer:n,id:e.id,geometry:e.geometry,properties:e.tags,extent:this.options.extent})}for(const t in o)o[t].types=Object.keys(o[t].types).map((t=>+t));return setTimeout((function(){e(null,r,o)}),1),1}onRemove(){super.onRemove(),delete this.index}}function ii(t,e,n,r){const i=Math.floor(r/998);(0===n||n===r-1||(0===i||n%i==0)&&e.length<999)&&e.push(t)}var oi={\n/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */\nread:function(t,e,n,r,i){var o,s,a=8*i-r-1,l=(1<<a)-1,u=l>>1,h=-7,c=n?i-1:0,f=n?-1:1,p=t[e+c];for(c+=f,o=p&(1<<-h)-1,p>>=-h,h+=a;h>0;o=256*o+t[e+c],c+=f,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=r;h>0;s=256*s+t[e+c],c+=f,h-=8);if(0===o)o=1-u;else{if(o===l)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,r),o-=u}return(p?-1:1)*s*Math.pow(2,o-r)},write:function(t,e,n,r,i,o){var s,a,l,u=8*o-i-1,h=(1<<u)-1,c=h>>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:o-1,d=r?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=h):(s=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-s))<1&&(s--,l*=2),(e+=s+c>=1?f/l:f*Math.pow(2,1-c))*l>=2&&(s++,l/=2),s+c>=h?(a=0,s=h):s+c>=1?(a=(e*l-1)*Math.pow(2,i),s+=c):(a=e*Math.pow(2,c-1)*Math.pow(2,i),s=0));i>=8;t[n+p]=255&a,p+=d,a/=256,i-=8);for(s=s<<i|a,u+=i;u>0;t[n+p]=255&s,p+=d,s/=256,u-=8);t[n+p-d]|=128*g}},si=li,ai=oi;function li(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}li.Varint=0,li.Fixed64=1,li.Bytes=2,li.Fixed32=5;var ui=4294967296,hi=1/ui,ci="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function fi(t){return t.type===li.Bytes?t.readVarint()+t.pos:t.pos+1}function pi(t,e,n){return n?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function di(t,e,n){var r=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));n.realloc(r);for(var i=n.pos-1;i>=t;i--)n.buf[i+r]=n.buf[i]}function gi(t,e){for(var n=0;n<t.length;n++)e.writeVarint(t[n])}function yi(t,e){for(var n=0;n<t.length;n++)e.writeSVarint(t[n])}function xi(t,e){for(var n=0;n<t.length;n++)e.writeFloat(t[n])}function mi(t,e){for(var n=0;n<t.length;n++)e.writeDouble(t[n])}function vi(t,e){for(var n=0;n<t.length;n++)e.writeBoolean(t[n])}function wi(t,e){for(var n=0;n<t.length;n++)e.writeFixed32(t[n])}function Mi(t,e){for(var n=0;n<t.length;n++)e.writeSFixed32(t[n])}function bi(t,e){for(var n=0;n<t.length;n++)e.writeFixed64(t[n])}function Pi(t,e){for(var n=0;n<t.length;n++)e.writeSFixed64(t[n])}function _i(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+16777216*t[e+3]}function Ii(t,e,n){t[n]=e,t[n+1]=e>>>8,t[n+2]=e>>>16,t[n+3]=e>>>24}function Ai(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}li.prototype={destroy:function(){this.buf=null},readFields:function(t,e,n){for(n=n||this.length;this.pos<n;){var r=this.readVarint(),i=r>>3,o=this.pos;this.type=7&r,t(i,e,this),this.pos===o&&this.skip(r)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=_i(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=Ai(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=_i(this.buf,this.pos)+_i(this.buf,this.pos+4)*ui;return this.pos+=8,t},readSFixed64:function(){var t=_i(this.buf,this.pos)+Ai(this.buf,this.pos+4)*ui;return this.pos+=8,t},readFloat:function(){var t=ai.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=ai.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,n,r=this.buf;return e=127&(n=r[this.pos++]),n<128?e:(e|=(127&(n=r[this.pos++]))<<7,n<128?e:(e|=(127&(n=r[this.pos++]))<<14,n<128?e:(e|=(127&(n=r[this.pos++]))<<21,n<128?e:function(t,e,n){var r,i,o=n.buf;if(i=o[n.pos++],r=(112&i)>>4,i<128)return pi(t,r,e);if(i=o[n.pos++],r|=(127&i)<<3,i<128)return pi(t,r,e);if(i=o[n.pos++],r|=(127&i)<<10,i<128)return pi(t,r,e);if(i=o[n.pos++],r|=(127&i)<<17,i<128)return pi(t,r,e);if(i=o[n.pos++],r|=(127&i)<<24,i<128)return pi(t,r,e);if(i=o[n.pos++],r|=(1&i)<<31,i<128)return pi(t,r,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(n=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,e=this.pos;return this.pos=t,t-e>=12&&ci?function(t,e,n){return ci.decode(t.subarray(e,n))}(this.buf,e,t):function(t,e,n){var r="",i=e;for(;i<n;){var o,s,a,l=t[i],u=null,h=l>239?4:l>223?3:l>191?2:1;if(i+h>n)break;1===h?l<128&&(u=l):2===h?128==(192&(o=t[i+1]))&&(u=(31&l)<<6|63&o)<=127&&(u=null):3===h?(o=t[i+1],s=t[i+2],128==(192&o)&&128==(192&s)&&((u=(15&l)<<12|(63&o)<<6|63&s)<=2047||u>=55296&&u<=57343)&&(u=null)):4===h&&(o=t[i+1],s=t[i+2],a=t[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&((u=(15&l)<<18|(63&o)<<12|(63&s)<<6|63&a)<=65535||u>=1114112)&&(u=null)),null===u?(u=65533,h=1):u>65535&&(u-=65536,r+=String.fromCharCode(u>>>10&1023|55296),u=56320|1023&u),r+=String.fromCharCode(u),i+=h}return r}(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==li.Bytes)return t.push(this.readVarint(e));var n=fi(this);for(t=t||[];this.pos<n;)t.push(this.readVarint(e));return t},readPackedSVarint:function(t){if(this.type!==li.Bytes)return t.push(this.readSVarint());var e=fi(this);for(t=t||[];this.pos<e;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==li.Bytes)return t.push(this.readBoolean());var e=fi(this);for(t=t||[];this.pos<e;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==li.Bytes)return t.push(this.readFloat());var e=fi(this);for(t=t||[];this.pos<e;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==li.Bytes)return t.push(this.readDouble());var e=fi(this);for(t=t||[];this.pos<e;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==li.Bytes)return t.push(this.readFixed32());var e=fi(this);for(t=t||[];this.pos<e;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==li.Bytes)return t.push(this.readSFixed32());var e=fi(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==li.Bytes)return t.push(this.readFixed64());var e=fi(this);for(t=t||[];this.pos<e;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==li.Bytes)return t.push(this.readSFixed64());var e=fi(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed64());return t},skip:function(t){var e=7&t;if(e===li.Varint)for(;this.buf[this.pos++]>127;);else if(e===li.Bytes)this.pos=this.readVarint()+this.pos;else if(e===li.Fixed32)this.pos+=4;else{if(e!==li.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e<this.pos+t;)e*=2;if(e!==this.length){var n=new Uint8Array(e);n.set(this.buf),this.buf=n,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(t){this.realloc(4),Ii(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),Ii(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),Ii(this.buf,-1&t,this.pos),Ii(this.buf,Math.floor(t*hi),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),Ii(this.buf,-1&t,this.pos),Ii(this.buf,Math.floor(t*hi),this.pos+4),this.pos+=8},writeVarint:function(t){(t=+t||0)>268435455||t<0?function(t,e){var n,r;t>=0?(n=t%4294967296|0,r=t/4294967296|0):(r=~(-t/4294967296),4294967295^(n=~(-t%4294967296))?n=n+1|0:(n=0,r=r+1|0));if(t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,n){n.buf[n.pos++]=127&t|128,t>>>=7,n.buf[n.pos++]=127&t|128,t>>>=7,n.buf[n.pos++]=127&t|128,t>>>=7,n.buf[n.pos++]=127&t|128,t>>>=7,n.buf[n.pos]=127&t}(n,0,e),function(t,e){var n=(7&t)<<4;if(e.buf[e.pos++]|=n|((t>>>=3)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;e.buf[e.pos++]=127&t}(r,e)}(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 e=this.pos;this.pos=function(t,e,n){for(var r,i,o=0;o<e.length;o++){if((r=e.charCodeAt(o))>55295&&r<57344){if(!i){r>56319||o+1===e.length?(t[n++]=239,t[n++]=191,t[n++]=189):i=r;continue}if(r<56320){t[n++]=239,t[n++]=191,t[n++]=189,i=r;continue}r=i-55296<<10|r-56320|65536,i=null}else i&&(t[n++]=239,t[n++]=191,t[n++]=189,i=null);r<128?t[n++]=r:(r<2048?t[n++]=r>>6|192:(r<65536?t[n++]=r>>12|224:(t[n++]=r>>18|240,t[n++]=r>>12&63|128),t[n++]=r>>6&63|128),t[n++]=63&r|128)}return n}(this.buf,t,this.pos);var n=this.pos-e;n>=128&&di(e,n,this),this.pos=e-1,this.writeVarint(n),this.pos+=n},writeFloat:function(t){this.realloc(4),ai.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),ai.write(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var n=0;n<e;n++)this.buf[this.pos++]=t[n]},writeRawMessage:function(t,e){this.pos++;var n=this.pos;t(e,this);var r=this.pos-n;r>=128&&di(n,r,this),this.pos=n-1,this.writeVarint(r),this.pos+=r},writeMessage:function(t,e,n){this.writeTag(t,li.Bytes),this.writeRawMessage(e,n)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,gi,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,yi,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,vi,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,xi,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,mi,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,wi,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,Mi,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,bi,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,Pi,e)},writeBytesField:function(t,e){this.writeTag(t,li.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,li.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,li.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,li.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,li.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,li.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,li.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,li.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,li.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,li.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}};var Si=yr(si),Fi=Ti;function Ti(t,e){this.x=t,this.y=e}Ti.prototype={clone:function(){return new Ti(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},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 e=t.x-this.x,n=t.y-this.y;return e*e+n*n},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,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[0]*this.x+t[1]*this.y,n=t[2]*this.x+t[3]*this.y;return this.x=e,this.y=n,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),n=Math.sin(t),r=e*this.x-n*this.y,i=n*this.x+e*this.y;return this.x=r,this.y=i,this},_rotateAround:function(t,e){var n=Math.cos(t),r=Math.sin(t),i=e.x+n*(this.x-e.x)-r*(this.y-e.y),o=e.y+r*(this.x-e.x)+n*(this.y-e.y);return this.x=i,this.y=o,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},Ti.convert=function(t){return t instanceof Ti?t:Array.isArray(t)?new Ti(t[0],t[1]):t};var ki=Fi,Bi=Li;function Li(t,e,n,r,i){this.properties={},this.extent=n,this.type=0,this._pbf=t,this._geometry=-1,this._keys=r,this._values=i,t.readFields(Ci,this,e)}function Ci(t,e,n){1==t?e.id=n.readVarint():2==t?function(t,e){var n=t.readVarint()+t.pos;for(;t.pos<n;){var r=e._keys[t.readVarint()],i=e._values[t.readVarint()];e.properties[r]=i}}(n,e):3==t?e.type=n.readVarint():4==t&&(e._geometry=n.pos)}function Yi(t){for(var e,n,r=0,i=0,o=t.length,s=o-1;i<o;s=i++)e=t[i],r+=((n=t[s]).x-e.x)*(e.y+n.y);return r}Li.types=["Unknown","Point","LineString","Polygon"],Li.prototype.loadGeometry=function(){var t=this._pbf;t.pos=this._geometry;for(var e,n=t.readVarint()+t.pos,r=1,i=0,o=0,s=0,a=[];t.pos<n;){if(i<=0){var l=t.readVarint();r=7&l,i=l>>3}if(i--,1===r||2===r)o+=t.readSVarint(),s+=t.readSVarint(),1===r&&(e&&a.push(e),e=[]),e.push(new ki(o,s));else{if(7!==r)throw new Error("unknown command "+r);e&&e.push(e[0].clone())}}return e&&a.push(e),a},Li.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,n=1,r=0,i=0,o=0,s=1/0,a=-1/0,l=1/0,u=-1/0;t.pos<e;){if(r<=0){var h=t.readVarint();n=7&h,r=h>>3}if(r--,1===n||2===n)(i+=t.readSVarint())<s&&(s=i),i>a&&(a=i),(o+=t.readSVarint())<l&&(l=o),o>u&&(u=o);else if(7!==n)throw new Error("unknown command "+n)}return[s,l,a,u]},Li.prototype.toGeoJSON=function(t,e,n){var r,i,o=this.extent*Math.pow(2,n),s=this.extent*t,a=this.extent*e,l=this.loadGeometry(),u=Li.types[this.type];function h(t){for(var e=0;e<t.length;e++){var n=t[e],r=180-360*(n.y+a)/o;t[e]=[360*(n.x+s)/o-180,360/Math.PI*Math.atan(Math.exp(r*Math.PI/180))-90]}}switch(this.type){case 1:var c=[];for(r=0;r<l.length;r++)c[r]=l[r][0];h(l=c);break;case 2:for(r=0;r<l.length;r++)h(l[r]);break;case 3:for(l=function(t){var e=t.length;if(e<=1)return[t];for(var n,r,i=[],o=0;o<e;o++){var s=Yi(t[o]);0!==s&&(void 0===r&&(r=s<0),r===s<0?(n&&i.push(n),n=[t[o]]):n.push(t[o]))}n&&i.push(n);return i}(l),r=0;r<l.length;r++)for(i=0;i<l[r].length;i++)h(l[r][i])}1===l.length?l=l[0]:u="Multi"+u;var f={type:"Feature",geometry:{type:u,coordinates:l},properties:this.properties};return"id"in this&&(f.id=this.id),f};var Vi=Bi,Oi=Xi;function Xi(t,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(Ni,this,e),this.length=this._features.length}function Ni(t,e,n){15===t?e.version=n.readVarint():1===t?e.name=n.readString():5===t?e.extent=n.readVarint():2===t?e._features.push(n.pos):3===t?e._keys.push(n.readString()):4===t&&e._values.push(function(t){var e=null,n=t.readVarint()+t.pos;for(;t.pos<n;){var r=t.readVarint()>>3;e=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 e}(n))}Xi.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var e=this._pbf.readVarint()+this._pbf.pos;return new Vi(this._pbf,e,this.extent,this._keys,this._values)};var Ei=Oi,zi=function(t,e){this.layers=t.readFields($i,{},e)};function $i(t,e,n){if(3===t){var r=new Ei(n,n.readVarint()+n.pos);r.length&&(e[r.name]=r)}}var qi=zi;const Di=2;class ji extends kn{constructor(t,e,n,r,i,o){super(t,e,n,r,i),e=e||{},o()}getTileFeatures(t,e){const n=t.tileInfo.url,r=t.fetchOptions||{},{altitudePropertyName:i,disableAltitudeWarning:o}=t,s=this._cache.get(n);if(s&&s.cacheIndex===t.workerCacheIndex){const{err:t,data:r}=s;return setTimeout((()=>{this._readTile(n,i,o,t,r,e)}),1)}const{tileArrayBuffer:a}=t;return a?setTimeout((()=>{this._readTile(n,i,o,null,a,e)}),1):(r.referrer=t.referrer,C.getArrayBuffer(n,r,((r,s)=>{this._cache&&(r?r.loading||this._cache.add(n,{err:r,data:s&&s.data,cacheIndex:t.workerCacheIndex}):s&&s.data&&this._cache.add(n,{err:null,data:s.data,cacheIndex:t.workerCacheIndex}),this._readTile(n,i,o,r,s&&s.data,e))})))}_readTile(t,e,n,r,i,o){if(r)return void o(r);let s;try{s=new qi(new Si(i))}catch(r){return void o(r.message,[],[])}const a=[];if(!s.layers)return void o(null,a,[]);const l={};let u;for(const t in s.layers)if(h=s.layers,c=t,Object.prototype.hasOwnProperty.call(h,c)){l[t]={types:{}};const i=l[t].types;for(let o=0,l=s.layers[t].length;o<l;o++)try{u=s.layers[t].feature(o),i[u.type]=1;const r={type:u.type,layer:t,geometry:u.loadGeometry(),properties:u.properties,extent:u.extent};void 0!==u.id&&(r.id=u.id);let l=r.properties[ee];l&&(A(l)&&(l=JSON.parse(l)),r.properties[ee]=ei(l,"EPSG:3857"));const h=e&&r.properties[e];if(h){const t=Zi(h),e=[];Gi(r.geometry,t,e),e.length&&!n&&(console.warn("feature.geometry is not consistent with altitude values:"),console.warn(JSON.stringify(r,null,2)))}a.push(r)}catch(r){console.warn("error when load vt geometry:",r)}}var h,c;for(const t in l)l[t].types=Object.keys(l[t].types).map((t=>+t));o(null,a,l,{byteLength:i.byteLength})}abortTile(t,e){const n=this.requests[t];delete this.requests[t],n&&n.abort&&n.abort(),this._cancelLoadings(t),e()}onRemove(){super.onRemove();for(const t in this.requests){const e=this.requests[t];e&&e.abort&&e.abort()}this.requests={}}}function Zi(t){const e=atob(t),n=new Uint8Array(e.length);for(let t=0;t<e.length;t++)n[t]=e.charCodeAt(t);return new Float32Array(n.buffer)}function Gi(t,e,n,r){r||(r={index:0});for(let i=0;i<t.length;i++)if(Array.isArray(t[i]))Gi(t[i],e,n,r);else{const o=r.index;k(e[o])?n.push(Di):t[i].z=100*e[o],r.index++}}const{LRUCache:Ui}=ne();let Ri=0;const Ji=new Ui(128);class Hi{constructor(t){this._layers={},this._callbacks={},this.workerId=t}addLayer({actorId:t,mapId:e,layerId:n,params:r},i){if(this._getLayerById(e,n))return;const o=this._genKey(e,n),s=r.type,a=r.options,l=this.send.bind(this,t);this._layers[o]="GeoJSONVectorTileLayer"===s?new ri(n,a,l,Ji,{},i):new ji(n,a,l,Ji,{},i)}removeLayer({mapId:t,layerId:e},n){const r=this._getLayerById(t,e),i=this._genKey(t,e);delete this._layers[i],r&&r.onRemove(n)}loadTile({mapId:t,layerId:e,params:n},r){const i=this._getLayerById(t,e);i&&i.loadTile(n,r)}abortTile({mapId:t,layerId:e,params:n},r){const i=this._getLayerById(t,e);i&&i.abortTile&&i.abortTile(n.url,r)}removeTile({mapId:t,layerId:e,params:n},r){const i=this._getLayerById(t,e);i&&i.removeTile(n,r)}updateStyle({mapId:t,layerId:e,params:n},r){const i=this._getLayerById(t,e);i&&i.updateStyle(n,r)}updateOptions({mapId:t,layerId:e,params:n},r){const i=this._getLayerById(t,e);i&&i.updateOptions(n,r)}setData({mapId:t,layerId:e,params:n},r){const i=this._getLayerById(t,e);i&&i.setData(n.data,r)}receive(t){const e=t.callback,n=this._callbacks[e];delete this._callbacks[e],n&&t.error?n(new Error(t.error)):n&&n(null,t.data)}send(t,e,n,r,i){const o=i?\`${E}t}-${E}Ri++}\`:null;i&&(this._callbacks[o]=i),postMessage({type:"<request>",workerId:this.workerId,actorId:t,command:e,params:n,callback:String(o)},r||[])}_genKey(t,e){return\`${E}t}-${E}e}\`}_getLayerById(t,e){const n=this._genKey(t,e);return this._layers[n]}_resetCache(){Ji.reset()}}t.initialize=function(){},t.onmessage=function(t,e){const n=t.data;if(this.dispatcher||(this.dispatcher=new Hi(t.workerId)),"<response>"===t.type)this.dispatcher.workerId===t.workerId&&this.dispatcher.receive(t);else{const r=n.command;this.dispatcher[r]({actorId:t.actorId,mapId:n.mapId,layerId:n.layerId,params:n.params},((t,n,i)=>{t&&404!==t.status&&204!==t.status&&!t.loading&&console.error(r,t),e(t,n,i)}))}}}`;
34
+ const E = "${", D = `function(t){let e;const n={width:100,height:10};let r=!1;try{const t=new OffscreenCanvas(1,1);t.getContext("2d").fillText("hello",0,0),r=!0}catch(t){r=!1}function i(){if(!e){const{width:t,height:i}=n;r?e=new OffscreenCanvas(t,i):(e=document.createElement("canvas"),e.width=t,e.height=i)}return e}class o{constructor(t,e={}){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 e=0,n=t.length;e<n;e++){const n=t[e][0];r=Math.min(n,r),i=Math.max(n,i)}this.min=r,this.max=i,this.valueOffset=this.max-this.min,this.options=Object.assign({},n,e),this._initImgData()}getImageData(){return this.imgData}_initImgData(){const t=i(),{width:e,height:n}=this.options;t.width=e,t.height=n;const r=t.getContext("2d");r.clearRect(0,0,t.width,t.height);const o=r.createLinearGradient(0,0,t.width,0),{colors:s,valueOffset:a}=this;for(let t=0,e=s.length;t<e;t++){const[e,n]=s[t],r=(e-this.min)/a;o.addColorStop(r,n)}r.fillStyle=o,r.fillRect(0,0,t.width,t.height),this.imgData=r.getImageData(0,0,t.width,t.height)}getColor(t){t=Math.max(this.min,t);const e=((t=Math.min(t,this.max))-this.min)/this.valueOffset;let n=Math.round(e*this.imgData.width);n=Math.min(n,this.imgData.width-1);const r=4*n;return[this.imgData.data[r],this.imgData.data[r+1],this.imgData.data[r+2],this.imgData.data[r+3]]}}var s;function a(t){return null==t}function l(t){return!a(t)}function u(t){return""===t}function h(t,e){var n,r,i;if(w(t)){var o,s=t.stops&&"object"==typeof t.stops[0][0],a=s||l(t.property),u=s||!a,d=t.type||e||"exponential";if("exponential"===d)o=p;else if("interval"===d)o=f;else if("categorical"===d)o=c;else if("identity"===d)o=y;else if("color-interpolate"===d)o=g;else{if("calculate-expression"!==d)throw new Error('Unknown function type "'+d+'"');o=x}if(s){var m={},v=[];for(let e=0;e<t.stops.length;e++){var M=t.stops[e];void 0===m[M[0].zoom]&&(m[M[0].zoom]={zoom:M[0].zoom,type:t.type,property:t.property,default:t.default,stops:[]}),m[M[0].zoom].stops.push([M[0].value,M[1]])}for(let t in m)v.push([m[t].zoom,h(m[t])]);n=function(e,n){const r=p({stops:v,base:t.base},e)(e,n);return"function"==typeof r?r(e,n):r},r=!1,i=!1}else u?(n=function(e){const n=o(t,e);return"function"==typeof n?n(e):n},r=!0,i=!1):(n=function(e,n){const r=o(t,n?n[t.property]:null);return"function"==typeof r?r(e,n):r},r=!1,i=!0)}else n=function(){return t},r=!0,i=!0;return n.isZoomConstant=i,n.isFeatureConstant=r,n}function c(t,e){for(let n=0;n<t.stops.length;n++)if(e===t.stops[n][0])return t.stops[n][1];return t.default}function f(t,e){for(var n=0;n<t.stops.length&&!(e<t.stops[n][0]);n++);return t.stops[Math.max(n-1,0)][1]}function p(t,e){for(var n=l(t.base)&&!u(t.base)?t.base:1,r=0;!(r>=t.stops.length||e<=t.stops[r][0]);)r++;return 0===r?t.stops[r][1]:r===t.stops.length?t.stops[r-1][1]:m(e,n,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 d={width:100,height:1};function g(t,e){const n=t.stops;if(n&&n.length>1){let t;if(s){const e=JSON.stringify(n);if(!s.has(e)){const t=new o(n,d);s.set(e,t)}t=s.get(e)}else t=new o(n,d);const[r,i,a,l]=t.getColor(e);return[r/255,i/255,a/255,l/255]}return n&&1===n.length?n[0][1]:null}function y(t,e){return n=e,r=t.default,l(n)?n:l(r)?r:l(i)?i:null;var n,r,i}function x(t,e){const n=String(t.property),r=t.expression,i=e;function o(e){return a(e)||u(e)||isNaN(e)?t.default:e}if(!l(e)||u(e)||isNaN(e)||e<0)return o(t.default);{const e=function t(e,n,r){const i=Number(r),o=String(n);return Array.isArray(e)?e.map((e=>t(e,o,i))):e===o?i:e}(r,n,i);return o(function e(n){if(!Array.isArray(n)){if("number"==typeof n)return n;throw new Error("Invalid expression format")}{const r=n[0];if(!["+","-","*","/"].includes(r))throw new Error(\`Unknown operator: ${E}r}\`);const i=n.slice(1).map((t=>e(t)));switch(r){case"+":return i.reduce(((t,e)=>t+e),0);case"-":return i.reduce(((t,e)=>t-e));case"*":return i.reduce(((t,e)=>t*e),1);case"/":return i.some((t=>0===t))?t.default:i.reduce(((t,e)=>t/e));default:throw new Error(\`Unsupported operator: ${E}r}\`)}}}(e))}}function m(t,e,n,r,i,o){return"function"==typeof i?function(){var s=i.apply(void 0,arguments),a=o.apply(void 0,arguments);return m(t,e,n,r,s,a)}:i.length?function(t,e,n,r,i,o){var s=[];for(let a=0;a<i.length;a++)s[a]=v(t,e,n,r,i[a],o[a]);return s}(t,e,n,r,i,o):v(t,e,n,r,i,o)}function v(t,e,n,r,i,o){var s,a=r-n,l=t-n;return i*(1-(s=1===e?l/a:(Math.pow(e,l)-1)/(Math.pow(e,a)-1)))+o*s}function w(t){return t&&"object"==typeof t&&(t.stops||t.property&&"identity"===t.type||t.expression&&"calculate-expression"===t.type)}function M(t){return b(t,"interval")}function b(t,e){if(!w(t))return function(){return t};let n=!0,r=!0;const i=(t=JSON.parse(JSON.stringify(t))).stops;if(i)for(let t=0;t<i.length;t++)if(w(i[t][1])){const o=b(i[t][1],e);n=n&&o.isZoomConstant,r=r&&o.isFeatureConstant,i[t]=[i[t][0],o]}const o=h(t,e);return o.isZoomConstant=n&&o.isZoomConstant,o.isFeatureConstant=r&&o.isFeatureConstant,o}let P=0;const _="function"==typeof Object.assign;function I(t,...e){if(_)return Object.assign(t,...e),t;for(let n=0;n<e.length;n++){const r=e[n];for(const e in r)t[e]=r[e]}return t}function A(t){return!k(t)&&("string"==typeof t||null!==t.constructor&&t.constructor===String)}function S(t){return"number"==typeof t&&!isNaN(t)}function T(t){return!k(t)&&("function"==typeof t||null!==t.constructor&&t.constructor===Function)}function F(t){return!Array.isArray(t)&&"object"==typeof t&&!!t}function k(t){return null==t}function B(t){return w(t)&&t.property}const L="function"==typeof fetch&&"function"==typeof AbortController,C={jsonp:function(t,e){const n="_maptalks_jsonp_"+P++;t.match(/\\?/)?t+="&callback="+n:t+="?callback="+n;let r=document.createElement("script");return r.type="text/javascript",r.src=t,window[n]=function(t){e(null,t),document.getElementsByTagName("head")[0].removeChild(r),r=null,delete window[n]},document.getElementsByTagName("head")[0].appendChild(r),this},get:function(t,e,n){if(T(e)){const t=n;n=e,e=t}(e=e||{}).method&&(e.method=e.method.toUpperCase());const r="POST"===e.method;if(L){const r=new AbortController,i=e;i.signal=r.signal,i.referrerPolicy=i.referrerPolicy||"origin",i.method=i.method||"GET";const o=new Request(t,i);return e.returnJSON&&o.headers.set("Accept","application/json"),fetch(o).then((r=>{const i=this._parseResponse(r,e.returnJSON,e.responseType);i.message?(i.url=t,n(i)):i.then((t=>{"arraybuffer"===e.responseType?n(null,{data:t,cacheControl:r.headers.get("Cache-Control"),expires:r.headers.get("Expires"),contentType:r.headers.get("Content-Type")}):n(null,t)})).catch((e=>{e.code&&e.code===DOMException.ABORT_ERR||(console.error("Fetch error:",t,e),n(e))}))})).catch((e=>{e.code&&e.code===DOMException.ABORT_ERR||(console.error("Fetch error:",t,e),n(e))})),r}{const i=C._getClient(n);if(i.open(e.method||"GET",t,!0),e){for(const t in e.headers)i.setRequestHeader(t,e.headers[t]);i.withCredentials="include"===e.credentials,e.responseType&&(i.responseType=e.responseType)}return i.send(r?e.body:null),i}},_parseResponse:(t,e,n)=>200!==t.status?{status:t.status,statusText:t.statusText,message:\`incorrect http request with status code(${E}t.status}): ${E}t.statusText}\`}:"arraybuffer"===n?t.arrayBuffer():e?t.json():t.text(),_wrapCallback:function(t,e){return function(){if(4===t.readyState)if(200===t.status)if("arraybuffer"===t.responseType){0===t.response.byteLength?e({status:200,statusText:t.statusText,message:"http status 200 returned without content."}):e(null,{data:t.response,cacheControl:t.getResponseHeader("Cache-Control"),expires:t.getResponseHeader("Expires"),contentType:t.getResponseHeader("Content-Type")})}else e(null,t.responseText);else e({status:t.status,statusText:t.statusText,message:\`incorrect http request with status code(${E}t.status}): ${E}t.statusText}\`})}},_getClient:function(t){let e;try{e=new XMLHttpRequest}catch(t){try{e=new ActiveXObject("Msxml2.XMLHTTP")}catch(t){try{e=new ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}}return e.onreadystatechange=C._wrapCallback(e,t),e},getArrayBuffer(t,e,n){if(T(e)){const t=n;n=e,e=t}return e||(e={}),e.responseType="arraybuffer",C.get(t,e,n)}};function Y(t,e,n,r,i=3){let o=r;const s=n-e>>1;let a,l=n-e;const u=t[e],h=t[e+1],c=t[n],f=t[n+1];for(let r=e+i;r<n;r+=i){const e=V(t[r],t[r+1],u,h,c,f);if(e>o)a=r,o=e;else if(e===o){const t=Math.abs(r-s);t<l&&(a=r,l=t)}}o>r&&(a-e>i&&Y(t,e,a,r,i),t[a+2]=o,n-a>i&&Y(t,a,n,r,i))}function V(t,e,n,r,i,o){let s=i-n,a=o-r;if(0!==s||0!==a){const l=((t-n)*s+(e-r)*a)/(s*s+a*a);l>1?(n=i,r=o):l>0&&(n+=s*l,r+=a*l)}return s=t-n,a=e-r,s*s+a*a}function O(t,e,n,r,i,o){const s={id:null==t?null:t,type:e,geometry:n,tags:r,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};i&&(s.layer=i);return function(t,e){const n=t.geometry,r=t.type;if("Point"===r||"MultiPoint"===r||"LineString"===r)X(t,n,e);else if("Polygon"===r)X(t,n[0],e);else if("MultiLineString"===r)for(const r of n)X(t,r,e);else if("MultiPolygon"===r)for(const r of n)X(t,r[0],e)}(s,o?4:3),s}function X(t,e,n){for(let r=0;r<e.length;r+=n)t.minX=Math.min(t.minX,e[r]),t.minY=Math.min(t.minY,e[r+1]),t.maxX=Math.max(t.maxX,e[r]),t.maxY=Math.max(t.maxY,e[r+1])}function N(t,e,n,r){if(r.layer=e,"FeatureCollection"===n.type)for(let e=0;e<n.features.length;e++)E(t,n.features[e],r,e);else"Feature"===n.type?E(t,n,r):E(t,{geometry:n},r)}function E(t,e,n,r){if(!e.geometry)return;const i=e.geometry.coordinates,o=e.geometry.type,s=Math.pow(n.tolerance/((1<<n.maxZoom)*n.extent),2);let a=[],l=e.id;if(n.promoteId?l=e.properties[n.promoteId]:n.generateId&&(l=r||0),"Point"===o)z(i,a,n);else if("MultiPoint"===o)for(const t of i)z(t,a,n);else if("LineString"===o)$(i,a,s,!1,n);else if("MultiLineString"===o){if(n.lineMetrics){for(const r of i)a=[],$(r,a,s,!1,n),t.push(O(l,"LineString",a,e.properties,n.layer,n.hasAltitude));return}D(i,a,s,!1,n)}else if("Polygon"===o)D(i,a,s,!0,n);else{if("MultiPolygon"!==o){if("GeometryCollection"===o){for(const i of e.geometry.geometries)E(t,{id:l,geometry:i,properties:e.properties},n,r);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const t of i){const e=[];D(t,e,s,!0,n),a.push(e)}}t.push(O(l,o,a,e.properties,n.layer,n.hasAltitude))}function z(t,e,n){e.push(q(t[0]),j(t[1],n.projection),0),n.hasAltitude&&(t.length>2?e.push(t[2]):e.push(0))}function $(t,e,n,r,i){let o,s,a=0;for(let n=0;n<t.length;n++){const l=q(t[n][0]),u=j(t[n][1],i.projection);e.push(l,u,0),i.hasAltitude&&(t[n].length>2?e.push(t[n][2]):e.push(0)),n>0&&(a+=r?(o*u-l*s)/2:Math.sqrt(Math.pow(l-o,2)+Math.pow(u-s,2))),o=l,s=u}const l=i.hasAltitude?4:3,u=e.length-l;e[2]=1,Y(e,0,u,n,l),e[u+2]=1,e.size=Math.abs(a),e.start=0,e.end=e.size}function D(t,e,n,r,i){for(let o=0;o<t.length;o++){const s=[];$(t[o],s,n,r,i),e.push(s)}}function q(t){return t/360+.5}function j(t,e){if("EPSG:4326"===e)return(90-t)/360;const n=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+n)/(1-n))/Math.PI;return r<0?0:r>1?1:r}function Z(t,e,n,r,i,o,s,a){if(r/=e,o>=(n/=e)&&s<r)return t;if(s<n||o>=r)return null;const l=[];for(const e of t){const t=e.geometry;let o=e.type;const s=0===i?e.minX:e.minY,u=0===i?e.maxX:e.maxY;if(s>=n&&u<r){l.push(e);continue}if(u<n||s>=r)continue;let h=[];if("Point"===o||"MultiPoint"===o)G(t,h,n,r,i,a.hasAltitude);else if("LineString"===o)U(t,h,n,r,i,!1,a.lineMetrics,a.hasAltitude);else if("MultiLineString"===o)J(t,h,n,r,i,!1,a.hasAltitude);else if("Polygon"===o)J(t,h,n,r,i,!0,a.hasAltitude);else if("MultiPolygon"===o)for(const e of t){const t=[];J(e,t,n,r,i,!0,a.hasAltitude),t.length&&h.push(t)}if(h.length){if(a.lineMetrics&&"LineString"===o){for(const t of h)l.push(O(e.id,o,t,e.tags,e.layer,a.hasAltitude));continue}"LineString"!==o&&"MultiLineString"!==o||(1===h.length?(o="LineString",h=h[0]):o="MultiLineString"),"Point"!==o&&"MultiPoint"!==o||(o=3===h.length?"Point":"MultiPoint"),l.push(O(e.id,o,h,e.tags,e.layer,a.hasAltitude))}}return l.length?l:null}function G(t,e,n,r,i,o){const s=o?4:3;for(let a=0;a<t.length;a+=s){const s=t[a+i];s>=n&&s<=r&&(H(e,t[a],t[a+1],t[a+2]),o&&e.push(t[a+3]))}}function U(t,e,n,r,i,o,s,a){let l=R(t);const u=0===i?W:K;let h,c,f=t.start;const p=a?4:3,d=o?t.length:t.length-p;for(let g=0;g<d;g+=p){const y=t[g],x=t[g+1],m=t[g+2];let v,w,M,b;o&&g===d-p?(v=t[0],w=t[1]):(v=t[g+p],w=t[g+p+1]),a&&(M=t[g+3],b=o&&g===d-p?t[3]:t[g+p+3]);const P=0===i?y:x,_=0===i?v:w;let I=!1;s&&(h=Math.sqrt(Math.pow(y-v,2)+Math.pow(x-w,2))),P<n?_>n&&(c=u(l,y,x,v,w,n),a&&l.push(Q(M,b,c)),s&&(l.start=f+h*c)):P>r?_<r&&(c=u(l,y,x,v,w,r),a&&l.push(Q(M,b,c)),s&&(l.start=f+h*c)):(H(l,y,x,m),a&&l.push(M)),_<n&&P>=n&&(c=u(l,y,x,v,w,n),a&&l.push(Q(M,b,c)),I=!0),_>r&&P<=r&&(c=u(l,y,x,v,w,r),a&&l.push(Q(M,b,c)),I=!0),!o&&I&&(s&&(l.end=f+h*c),e.push(l),l=R(t)),s&&(f+=h)}let g=t.length-p;if(!o){const e=t[g],o=t[g+1],s=t[g+2],u=0===i?e:o;if(u>=n&&u<=r&&H(l,e,o,s),u>=n&&u<=r&&a){const e=t[g+3];l.push(e)}}g=l.length-p,o&&g>=p&&(l[g]!==l[0]||l[g+1]!==l[1])&&(H(l,l[0],l[1],l[2]),a&&l.push(l[3])),l.length&&e.push(l)}function R(t){const e=[];return e.size=t.size,e.start=t.start,e.end=t.end,e}function J(t,e,n,r,i,o,s){for(const a of t)U(a,e,n,r,i,o,!1,s)}function H(t,e,n,r){t.push(e,n,r)}function W(t,e,n,r,i,o){const s=(o-e)/(r-e);return H(t,o,n+(i-n)*s,1),s}function K(t,e,n,r,i,o){const s=(o-n)/(i-n);return H(t,e+(r-e)*s,o,1),s}function Q(t,e,n){return t+(e-t)*n}function tt(t,e,n){const r=[];for(let i=0;i<t.length;i++){const o=t[i],s=o.type;let a;if("Point"===s||"MultiPoint"===s||"LineString"===s)a=et(o.geometry,e,n);else if("MultiLineString"===s||"Polygon"===s){a=[];for(const t of o.geometry)a.push(et(t,e,n))}else if("MultiPolygon"===s){a=[];for(const t of o.geometry){const r=[];for(const i of t)r.push(et(i,e,n));a.push(r)}}r.push(O(o.id,s,a,o.tags,o.layer,n))}return r}function et(t,e,n){const r=[];r.size=t.size,void 0!==t.start&&(r.start=t.start,r.end=t.end);const i=n?4:3;for(let o=0;o<t.length;o+=i)r.push(t[o]+e,t[o+1],t[o+2]),n&&r.push(t[o+3]);return r}function nt(t,e,n){if(t.transformed)return t;const r=1<<t.z,i=t.x,o=t.y,s=n?3:2;for(const a of t.features){const t=a.geometry,l=a.type;if(a.geometry=[],1===l)for(let l=0;l<t.length;l+=s)a.geometry.push(rt(t[l],t[l+1],e,r,i,o)),n&&a.geometry[a.geometry.length-1].push(t[l+2]);else for(let l=0;l<t.length;l++){const u=[];for(let a=0;a<t[l].length;a+=s)u.push(rt(t[l][a],t[l][a+1],e,r,i,o)),n&&u[u.length-1].push(t[l][a+2]);a.geometry.push(u)}}return t.transformed=!0,t}function rt(t,e,n,r,i,o){return[Math.round(n*(t*r-i)),Math.round(n*(e*r-o))]}function it(t,e,n,r,i){const o=e===i.maxZoom?0:i.tolerance/((1<<e)*i.extent),s={features:[],numPoints:0,numSimplified:0,numFeatures:t.length,source:null,x:n,y:r,z:e,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const e of t)ot(s,e,o,i);return s}function ot(t,e,n,r){const i=e.geometry,o=e.type,s=[],a=r.hasAltitude?4:3;if(t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY),"Point"===o||"MultiPoint"===o)for(let e=0;e<i.length;e+=a)s.push(i[e],i[e+1]),r.hasAltitude&&s.push(i[e+3]),t.numPoints++,t.numSimplified++;else if("LineString"===o)at(s,i,t,n,!1,!1,r);else if("MultiLineString"===o||"Polygon"===o)for(let e=0;e<i.length;e++)at(s,i[e],t,n,"Polygon"===o,0===e,r);else if("MultiPolygon"===o)for(let e=0;e<i.length;e++){const o=i[e];for(let e=0;e<o.length;e++)at(s,o[e],t,n,!0,0===e,r)}if(s.length){let n=e.tags||null;if("LineString"===o&&r.lineMetrics){n={};for(const t in e.tags)n[t]=e.tags[t];n.mapbox_clip_start=i.start/i.size,n.mapbox_clip_end=i.end/i.size}const a={geometry:s,type:"Polygon"===o||"MultiPolygon"===o?3:"LineString"===o||"MultiLineString"===o?2:1,tags:n};e.layer&&(a.layer=e.layer),null!==e.id&&(a.id=e.id),t.features.push(a)}}function st(t,e,n){return 0===t[e+2]&&t[e+3]>0&&n}function at(t,e,n,r,i,o,s){const a=r*r,{hasAltitude:l,disableFilter:u}=s,h=l?4:3;if(!u&&r>0&&e.size<(i?a:r))return void(n.numPoints+=e.length/h);const c=[];for(let t=0;t<e.length;t+=h)(0===r||e[t+2]>a||st(e,t,l))&&(n.numSimplified++,c.push(e[t],e[t+1]),l&&c.push(e[t+3])),n.numPoints++;i&&function(t,e,n){const r=n?3:2;let i=0;for(let e=0,n=t.length,o=n-r;e<n;o=e,e+=r)i+=(t[e]-t[o])*(t[e+1]+t[o+1]);if(i>0===e){const e=r,i=r-1,o=r-2;for(let s=0,a=t.length;s<a/2;s+=r){const r=t[s],l=t[s+1];let u;n&&(u=t[s+2]),t[s]=t[a-e-s],t[s+1]=t[a-i-s],n&&(t[s+2]=t[a-o-s]),t[a-e-s]=r,t[a-i-s]=l,n&&(t[a-o-s]=u)}}}(c,o,l),t.push(c)}C.getJSON=function(t,e,n){if(T(e)){const t=n;n=e,e=t}const r=function(t,e){const r="string"==typeof e?JSON.parse(e):e||null;n(t,r)};return e&&e.jsonp?C.jsonp(t,r):((e=e||{}).returnJSON=!0,C.get(t,e,r))};const lt={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 ut{constructor(t,e){const n=(e=this.options=function(t,e){for(const n in e)t[n]=e[n];return t}(Object.create(lt),e)).debug;if(n&&console.time("preprocess data"),e.maxZoom<0||e.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(e.promoteId&&e.generateId)throw new Error("promoteId and generateId cannot be used together.");let r=function(t,e){const n=[];if(Array.isArray(t)){for(let r=0;r<t.length;r++)N(n,t[r].layer,t[r].data,e);return n}if("FeatureCollection"===t.type)for(let r=0;r<t.features.length;r++)E(n,t.features[r],e,r);else"Feature"===t.type?E(n,t,e):E(n,{geometry:t},e);return n}(t,e);this.tiles={},this.tileCoords=[],n&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",e.indexMaxZoom,e.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),r=function(t,e){const n=e.buffer/e.extent;let r=t;const i=Z(t,1,-1-n,n,0,-1,2,e),o=Z(t,1,1-n,2+n,0,-1,2,e);return(i||o)&&(r=Z(t,1,-n,1+n,0,-1,2,e)||[],i&&(r=tt(i,1,e.hasAltitude).concat(r)),o&&(r=r.concat(tt(o,-1,e.hasAltitude)))),r}(r,e),r.length&&this.splitTile(r,0,0,0),n&&(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,e,n,r,i,o,s){const a=[t,e,n,r],l=this.options,u=l.debug;for(;a.length;){r=a.pop(),n=a.pop(),e=a.pop(),t=a.pop();const h=1<<e,c=ht(e,n,r);let f=this.tiles[c];if(!f&&(u>1&&console.time("creation"),f=this.tiles[c]=it(t,e,n,r,l),this.tileCoords.push({z:e,x:n,y:r}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",e,n,r,f.numFeatures,f.numPoints,f.numSimplified),console.timeEnd("creation"));const t=\`z${E}e}\`;this.stats[t]=(this.stats[t]||0)+1,this.total++}if(f.source=t,null==i){if(e===l.indexMaxZoom||f.numPoints<=l.indexMaxPoints)continue}else{if(e===l.maxZoom||e===i)continue;if(null!=i){const t=i-e;if(n!==o>>t||r!==s>>t)continue}}if(f.source=null,0===t.length)continue;u>1&&console.time("clipping");const p=.5*l.buffer/l.extent,d=.5-p,g=.5+p,y=1+p;let x=null,m=null,v=null,w=null,M=Z(t,h,n-p,n+g,0,f.minX,f.maxX,l),b=Z(t,h,n+d,n+y,0,f.minX,f.maxX,l);t=null,M&&(x=Z(M,h,r-p,r+g,1,f.minY,f.maxY,l),m=Z(M,h,r+d,r+y,1,f.minY,f.maxY,l),M=null),b&&(v=Z(b,h,r-p,r+g,1,f.minY,f.maxY,l),w=Z(b,h,r+d,r+y,1,f.minY,f.maxY,l),b=null),u>1&&console.timeEnd("clipping"),a.push(x||[],e+1,2*n,2*r),a.push(m||[],e+1,2*n,2*r+1),a.push(v||[],e+1,2*n+1,2*r),a.push(w||[],e+1,2*n+1,2*r+1)}}getTile(t,e,n){t=+t,e=+e,n=+n;const r=this.options,{extent:i,debug:o}=r,{hasAltitude:s,wrapX:a}=r;if(t<0||t>24)return null;if(a){const n=1<<t;e=e+n&n-1}const l=ht(t,e,n);if(this.tiles[l])return nt(this.tiles[l],i,s);o>1&&console.log("drilling down to z%d-%d-%d",t,e,n);let u,h=t,c=e,f=n;for(;!u&&h>0;)h--,c>>=1,f>>=1,u=this.tiles[ht(h,c,f)];return u&&u.source?(o>1&&(console.log("found parent tile z%d-%d-%d",h,c,f),console.time("drilling down")),this.splitTile(u.source,h,c,f,t,e,n),o>1&&console.timeEnd("drilling down"),this.tiles[l]?nt(this.tiles[l],i,s):null):null}}function ht(t,e,n){return 32*((1<<t)*n+e)+t}function ct(t,e,n,r,i,o,s){const a=n&&Array.isArray(n[0]);for(let l=0,u=n.length;l<u;l++){t[e]=(a?n[l][0]:n[l].x)*r,t[e+1]=(a?n[l][1]:n[l].y)*r,s!==Float32Array&&(t[e]=Math.round(t[e]),t[e+1]=Math.round(t[e+1]));let h=i||0;Array.isArray(i)&&(h=i[l]),h=h?Math.round(r*h):0,t[e+2]=h,e+=3,o&&0!==l&&l!==u-1&&(t[e]=t[e-3],t[e+1]=t[e-2],t[e+2]=t[e-1],e+=3)}return t.trySetLength&&t.trySetLength(e),e}function ft(t,e,n,r){const i=t[3*e],o=t[3*e+1],s=t[3*n],a=t[3*n+1];return i===s&&(i<0||i>r)||o===a&&(o<0||o>r)}var pt="undefined"!=typeof Float32Array?Float32Array:Array;function dt(t,e,n,r){return t[0]=e,t[1]=n,t[2]=r,t}function gt(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function yt(t,e,n,r,i){return t[0]=e,t[1]=n,t[2]=r,t[3]=i,t}function xt(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t[2]=e[2]/n[2],t[3]=e[3]/n[3],t}function mt(t,e,n){return t[0]=e,t[1]=n,t}function vt(t,e){var n=e[0]-t[0],r=e[1]-t[1];return Math.hypot(n,r)}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)}),function(){var t,e=(t=new pt(3),pt!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t)}(),function(){var t,e=(t=new pt(4),pt!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t)}(),function(){var t,e=(t=new pt(2),pt!=Float32Array&&(t[0]=0,t[1]=0),t)}();const wt=Math.PI/180,Mt=6378137*Math.PI/180,bt=85.0511287798;function Pt(t,e,n){if("EPSG:3857"===n)return function(t,e){const n=bt,r=e[0],i=Math.max(Math.min(n,e[1]),-n);let o;o=0===i?0:Math.log(Math.tan((90+i)*wt/2))/wt;return t[0]=r*Mt,t[1]=o*Mt,t}(t,e);if("EPSG:4326"===n||"EPSG:4490"===n||"identity"===n)return _t(t,e);if("baidu"===n)return _t(t,e);throw new Error("unsupported projection:"+n)}function _t(t,e){return t[0]=e[0],t[1]=e[1],t}function It(t,e,n,r,i,o,s,a,l,u,h,c,f,p,d){0===t?function(t,e,n,r,i,o,s,a,l,u){const h=1/(100*o[0]),c=1/(100*o[1]),f=u&&u[0]||0,p=u&&u[1]||0,d=[0,0];for(let i=t;i<e;i+=3){const t=i/3*2,e=r[i]-f,o=r[i+1]-p;n[t]=d[0]+e/s*h/a,n[t+1]=d[1]-o/s*c/l}}(e,n,r,i,0,s,a,l,u,d):1===t&&function(t,e,n,r,i,o,s,a,l,u,h){if(!t)return;let c,f,p,d;0===t[4]?(c=t[0],f=t[1],p=t[2],d=t[3]):(c=t[1],f=t[2],p=t[3],d=t[0]);const g=vt(c,f),y=vt(f,p),x=[],m=[],v=[];for(let t=e;t<n;t+=3){const e=t/3*2;mt(x,(o.x/l+i[t]/s)*a,o.y/l*a+(h?i[t+1]:-i[t+1])/s*a),"EPSG:4326"!==u&&"EPSG:4490"!==u||Pt(x,x,"EPSG:3857"),At(m,x,c,f),At(v,x,d,c),r[e]=vt(c,m)/g,r[e+1]=vt(c,v)/y}}(h,e,n,r,i,o,a,c,f,p,!!d)}function At(t,e,n,r){const i=n[0]-r[0],o=n[1]-r[1];let s=(e[0]-n[0])*(n[0]-r[0])+(e[1]-n[1])*(n[1]-r[1]);return s/=i*i+o*o,t[0]=n[0]+s*i,t[1]=n[1]+s*o,t}function St(t,e,n,r,i){const o=3*e[n-1],s=3*e[n-1]+1,a=t[o],l=t[s];return u=r,h=i,c=a,f=l,Math.sqrt((c-u)*(c-u)+(f-h)*(f-h));var u,h,c,f}function Tt(t,e,n=2){const r=e&&e.length,i=r?e[0]*n:t.length;let o=Ft(t,0,i,n,!0);const s=[];if(!o||o.next===o.prev)return s;let a,l,u;if(r&&(o=function(t,e,n,r){const i=[];for(let n=0,o=e.length;n<o;n++){const s=Ft(t,e[n]*r,n<o-1?e[n+1]*r:t.length,r,!1);s===s.next&&(s.steiner=!0),i.push(zt(s))}i.sort(Ot);for(let t=0;t<i.length;t++)n=Xt(i[t],n);return n}(t,e,o,n)),t.length>80*n){a=1/0,l=1/0;let e=-1/0,r=-1/0;for(let o=n;o<i;o+=n){const n=t[o],i=t[o+1];n<a&&(a=n),i<l&&(l=i),n>e&&(e=n),i>r&&(r=i)}u=Math.max(e-a,r-l),u=0!==u?32767/u:0}return Bt(o,s,n,a,l,u,0),s}function Ft(t,e,n,r,i){let o;if(i===function(t,e,n,r){let i=0;for(let o=e,s=n-r;o<n;o+=r)i+=(t[s]-t[o])*(t[o+1]+t[s+1]),s=o;return i}(t,e,n,r)>0)for(let i=e;i<n;i+=r)o=Wt(i/r|0,t[i],t[i+1],o);else for(let i=n-r;i>=e;i-=r)o=Wt(i/r|0,t[i],t[i+1],o);return o&&Zt(o,o.next)&&(Kt(o),o=o.next),o}function kt(t,e){if(!t)return t;e||(e=t);let n,r=t;do{if(n=!1,r.steiner||!Zt(r,r.next)&&0!==jt(r.prev,r,r.next))r=r.next;else{if(Kt(r),r=e=r.prev,r===r.next)break;n=!0}}while(n||r!==e);return e}function Bt(t,e,n,r,i,o,s){if(!t)return;!s&&o&&function(t,e,n,r){let i=t;do{0===i.z&&(i.z=Et(i.x,i.y,e,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){let e,n=1;do{let r,i=t;t=null;let o=null;for(e=0;i;){e++;let s=i,a=0;for(let t=0;t<n&&(a++,s=s.nextZ,s);t++);let l=n;for(;a>0||l>0&&s;)0!==a&&(0===l||!s||i.z<=s.z)?(r=i,i=i.nextZ,a--):(r=s,s=s.nextZ,l--),o?o.nextZ=r:t=r,r.prevZ=o,o=r;i=s}o.nextZ=null,n*=2}while(e>1)}(i)}(t,r,i,o);let a=t;for(;t.prev!==t.next;){const l=t.prev,u=t.next;if(o?Ct(t,r,i,o):Lt(t))e.push(l.i,t.i,u.i),Kt(t),t=u.next,a=u.next;else if((t=u)===a){s?1===s?Bt(t=Yt(kt(t),e),e,n,r,i,o,2):2===s&&Vt(t,e,n,r,i,o):Bt(kt(t),e,n,r,i,o,1);break}}}function Lt(t){const e=t.prev,n=t,r=t.next;if(jt(e,n,r)>=0)return!1;const i=e.x,o=n.x,s=r.x,a=e.y,l=n.y,u=r.y,h=Math.min(i,o,s),c=Math.min(a,l,u),f=Math.max(i,o,s),p=Math.max(a,l,u);let d=r.next;for(;d!==e;){if(d.x>=h&&d.x<=f&&d.y>=c&&d.y<=p&&Dt(i,a,o,l,s,u,d.x,d.y)&&jt(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}function Ct(t,e,n,r){const i=t.prev,o=t,s=t.next;if(jt(i,o,s)>=0)return!1;const a=i.x,l=o.x,u=s.x,h=i.y,c=o.y,f=s.y,p=Math.min(a,l,u),d=Math.min(h,c,f),g=Math.max(a,l,u),y=Math.max(h,c,f),x=Et(p,d,e,n,r),m=Et(g,y,e,n,r);let v=t.prevZ,w=t.nextZ;for(;v&&v.z>=x&&w&&w.z<=m;){if(v.x>=p&&v.x<=g&&v.y>=d&&v.y<=y&&v!==i&&v!==s&&Dt(a,h,l,c,u,f,v.x,v.y)&&jt(v.prev,v,v.next)>=0)return!1;if(v=v.prevZ,w.x>=p&&w.x<=g&&w.y>=d&&w.y<=y&&w!==i&&w!==s&&Dt(a,h,l,c,u,f,w.x,w.y)&&jt(w.prev,w,w.next)>=0)return!1;w=w.nextZ}for(;v&&v.z>=x;){if(v.x>=p&&v.x<=g&&v.y>=d&&v.y<=y&&v!==i&&v!==s&&Dt(a,h,l,c,u,f,v.x,v.y)&&jt(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;w&&w.z<=m;){if(w.x>=p&&w.x<=g&&w.y>=d&&w.y<=y&&w!==i&&w!==s&&Dt(a,h,l,c,u,f,w.x,w.y)&&jt(w.prev,w,w.next)>=0)return!1;w=w.nextZ}return!0}function Yt(t,e){let n=t;do{const r=n.prev,i=n.next.next;!Zt(r,i)&&Gt(r,n,n.next,i)&&Jt(r,i)&&Jt(i,r)&&(e.push(r.i,n.i,i.i),Kt(n),Kt(n.next),n=t=i),n=n.next}while(n!==t);return kt(n)}function Vt(t,e,n,r,i,o){let s=t;do{let t=s.next.next;for(;t!==s.prev;){if(s.i!==t.i&&qt(s,t)){let a=Ht(s,t);return s=kt(s,s.next),a=kt(a,a.next),Bt(s,e,n,r,i,o,0),void Bt(a,e,n,r,i,o,0)}t=t.next}s=s.next}while(s!==t)}function Ot(t,e){let n=t.x-e.x;if(0===n&&(n=t.y-e.y,0===n)){n=(t.next.y-t.y)/(t.next.x-t.x)-(e.next.y-e.y)/(e.next.x-e.x)}return n}function Xt(t,e){const n=function(t,e){let n=e;const r=t.x,i=t.y;let o,s=-1/0;if(Zt(t,n))return n;do{if(Zt(t,n.next))return n.next;if(i<=n.y&&i>=n.next.y&&n.next.y!==n.y){const t=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(t<=r&&t>s&&(s=t,o=n.x<n.next.x?n:n.next,t===r))return o}n=n.next}while(n!==e);if(!o)return null;const a=o,l=o.x,u=o.y;let h=1/0;n=o;do{if(r>=n.x&&n.x>=l&&r!==n.x&&$t(i<u?r:s,i,l,u,i<u?s:r,i,n.x,n.y)){const e=Math.abs(i-n.y)/(r-n.x);Jt(n,t)&&(e<h||e===h&&(n.x>o.x||n.x===o.x&&Nt(o,n)))&&(o=n,h=e)}n=n.next}while(n!==a);return o}(t,e);if(!n)return e;const r=Ht(n,t);return kt(r,r.next),kt(n,n.next)}function Nt(t,e){return jt(t.prev,t,e.prev)<0&&jt(e.next,t,t.next)<0}function Et(t,e,n,r,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-n)*i|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-r)*i|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function zt(t){let e=t,n=t;do{(e.x<n.x||e.x===n.x&&e.y<n.y)&&(n=e),e=e.next}while(e!==t);return n}function $t(t,e,n,r,i,o,s,a){return(i-s)*(e-a)>=(t-s)*(o-a)&&(t-s)*(r-a)>=(n-s)*(e-a)&&(n-s)*(o-a)>=(i-s)*(r-a)}function Dt(t,e,n,r,i,o,s,a){return!(t===s&&e===a)&&$t(t,e,n,r,i,o,s,a)}function qt(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&Gt(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&(Jt(t,e)&&Jt(e,t)&&function(t,e){let n=t,r=!1;const i=(t.x+e.x)/2,o=(t.y+e.y)/2;do{n.y>o!=n.next.y>o&&n.next.y!==n.y&&i<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==t);return r}(t,e)&&(jt(t.prev,t,e.prev)||jt(t,e.prev,e))||Zt(t,e)&&jt(t.prev,t,t.next)>0&&jt(e.prev,e,e.next)>0)}function jt(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function Zt(t,e){return t.x===e.x&&t.y===e.y}function Gt(t,e,n,r){const i=Rt(jt(t,e,n)),o=Rt(jt(t,e,r)),s=Rt(jt(n,r,t)),a=Rt(jt(n,r,e));return i!==o&&s!==a||(!(0!==i||!Ut(t,n,e))||(!(0!==o||!Ut(t,r,e))||(!(0!==s||!Ut(n,t,r))||!(0!==a||!Ut(n,e,r)))))}function Ut(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function Rt(t){return t>0?1:t<0?-1:0}function Jt(t,e){return jt(t.prev,t,t.next)<0?jt(t,e,t.next)>=0&&jt(t,t.prev,e)>=0:jt(t,e,t.prev)<0||jt(t,t.next,e)<0}function Ht(t,e){const n=Qt(t.i,t.x,t.y),r=Qt(e.i,e.x,e.y),i=t.next,o=e.prev;return t.next=e,e.prev=t,n.next=i,i.prev=n,r.next=n,n.prev=r,o.next=r,r.prev=o,r}function Wt(t,e,n,r){const i=Qt(t,e,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function Kt(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 Qt(t,e,n){return{i:t,x:e,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}const te="__fea_idx";new Float32Array([-1e12])[0];const ee="maptalks_ombb";function ne(){return function(){if("undefined"!=typeof undefinedThis)return globalThis;if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof undefined)return global;throw new Error("unable to locate global object")}().maptalks_vt_packers}const{PackUtil:re,ArrayPool:ie}=ne();function oe(t,e,n,r,i,o,s,a,l,u,h,c,f,p,d,g,y){const x=e.getLength(),m=i/3;for(let n=2,r=x;n<r;n+=3)t[i+n-2]=e[n-2],t[i+n-1]=e[n-1],t[i+n-0]=e[n]-s;i+=x;for(let n=2,r=x;n<r;n+=3)t[i+n-2]=e[n-2],t[i+n-1]=e[n-1],t[i+n-0]=e[n]-a;i+=x,t.trySetLength(i+x),t.copyWithin(i,i-2*x,i-x),i+=x,t.trySetLength(i+x),t.copyWithin(i,i-2*x,i-x),i+=x,(n=n||[]).push(x/3);const v=n.getLength();for(let e=0;e<v;e++){se(m+(n[e-1]||0),m+n[e],t,x/3,l,r,u,h,c,f,o,p,d,g,y)}return i}function se(t,e,n,r,i,o,s,a,l,u,h,c,f,p,d){const g=o.getLength();let y,x;for(let s=t,a=e;s<a-1;s++)if(y=s,x=s+1,i===1/0||!ft(n,y,x,i))if((s-t)%2==1&&(y+=2*r,x+=2*r),d){let t=o.currentIndex;o[t++]=y+r,o[t++]=x,o[t++]=y,o[t++]=x+r,o[t++]=x,o[t++]=y+r,o.currentIndex=t}else{let t=o.currentIndex;o[t++]=y+r,o[t++]=y,o[t++]=x,o[t++]=x,o[t++]=x+r,o[t++]=y+r,o.currentIndex=t}s&&function(t,e,n,r,i,o,s,a,l,u,h,c){let f,p=0,d=0,g=0,y=0;const x=c?[1,3,4]:[2,3,4];for(let c=o.getLength()-1;c>=s;c--){const s=o[c],m=3*s+1,v=3*s+2,w=i[3*s],M=i[m],b=i[v];p||d||(p=Math.max(i[v],i[3*o[c-3]+2]),d=Math.min(i[v],i[3*o[c-3]+2]),f=p-d);let P=g;const _=c%6;0===t?(5===_&&(y=St(i,o,c,w,M)),P=_===x[0]||_===x[1]||_===x[2]?g:g+y):1===t&&(_===x[0]||_===x[1]||_===x[2]?P=0:5===_?(y=St(i,o,c,w,M),P=y):P=y);const I=P/u*(1/(100*h))/a;let A;A=1===e?b===p?1:0:"bottom"===n?b===p?f/100/l:0:b===p?0:-f/100/l,r[2*s]=I,r[2*s+1]=A,0===_&&(g+=y)}}(a,l,u,h,n,o,g,c[0],c[1],f,p,d)}function ae(t){const e=[t[0]];let n=t[0];for(let r=1;r<t.length;r++)Array.isArray(t[r])?t[r][0]===n[0]&&t[r][1]===n[1]&&t[r][2]===n[2]||e.push(t[r]):t[r].x===n.x&&t[r].y===n.y&&t[r].z===n.z||e.push(t[r]),n=t[r];return e}var le="undefined"!=typeof Float32Array?Float32Array:Array;function ue(){var t=new le(3);return le!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function he(t,e,n){var r=new le(3);return r[0]=t,r[1]=e,r[2]=n,r}function ce(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function fe(t,e,n,r){return t[0]=e,t[1]=n,t[2]=r,t}function pe(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t}function de(t,e){var n=e[0],r=e[1],i=e[2],o=n*n+r*r+i*i;return o>0&&(o=1/Math.sqrt(o),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o),t}function ge(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function ye(t,e,n){var r=e[0],i=e[1],o=e[2],s=n[0],a=n[1],l=n[2];return t[0]=i*l-o*a,t[1]=o*s-r*l,t[2]=r*a-i*s,t}var xe=function(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t};function me(){var t=new le(4);return le!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function ve(t,e){var n=e[0]+e[4]+e[8],r=void 0;if(n>0)r=Math.sqrt(n+1),t[3]=.5*r,r=.5/r,t[0]=(e[5]-e[7])*r,t[1]=(e[6]-e[2])*r,t[2]=(e[1]-e[3])*r;else{var i=0;e[4]>e[0]&&(i=1),e[8]>e[3*i+i]&&(i=2);var o=(i+1)%3,s=(i+2)%3;r=Math.sqrt(e[3*i+i]-e[3*o+o]-e[3*s+s]+1),t[i]=.5*r,r=.5/r,t[3]=(e[3*o+s]-e[3*s+o])*r,t[o]=(e[3*o+i]+e[3*i+o])*r,t[s]=(e[3*s+i]+e[3*i+s])*r}return t}!function(){var t=ue()}(),function(){var t,e=(t=new le(4),le!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t)}();var we,Me=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t},be=function(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],s=n*n+r*r+i*i+o*o;return s>0&&(s=1/Math.sqrt(s),t[0]=n*s,t[1]=r*s,t[2]=i*s,t[3]=o*s),t};ue(),he(1,0,0),he(0,1,0),me(),me(),we=new le(9),le!=Float32Array&&(we[1]=0,we[2]=0,we[3]=0,we[5]=0,we[6]=0,we[7]=0),we[0]=1,we[4]=1,we[8]=1;\n/*!\n * Contains code from google filament\n * https://github.com/google/filament/\n * License Apache-2.0\n */\nconst Pe=8,_e=[],Ie=[],Ae=[],Se=[];function Te(t,e,n){const r=ye(Ie,e,n),i=function(t,e,n,r,i,o,s,a,l,u){return t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=o,t[5]=s,t[6]=a,t[7]=l,t[8]=u,t}(_e,n[0],n[1],n[2],...r,...e);t=ve(t,i),t=function(t){return t[3]<0?Me(t,t,-1):t}(t=be(t,t));const o=1/((1<<2*Pe-1)-1);if(t[3]<o){t[3]=o;const e=Math.sqrt(1-o*o);t[0]*=e,t[1]*=e,t[2]*=e}const s=n[3]>0?ye(Ae,n,e):ye(Ae,e,n);return ge(ye(Se,n,e),s)<0&&Me(t,t,-1),t}const Fe=[];const ke=[],Be=[],Le=[],Ce=[],Ye=[],Ve=[],Oe=[];function Xe(t,e,n,r,i,o){fe(Ce,t[3*e],t[3*e+1],t[3*e+2]),fe(Ye,t[3*n],t[3*n+1],t[3*n+2]),fe(Ve,t[3*r],t[3*r+1],t[3*r+2]);const s=xe(ke,Ve,Ye),a=xe(Be,Ce,Ye),l=ye(Le,s,a);de(Oe,l),i[3*e]=i[3*e]||0,i[3*n]=i[3*n]||0,i[3*r]=i[3*r]||0,i[3*e+1]=i[3*e+1]||0,i[3*n+1]=i[3*n+1]||0,i[3*r+1]=i[3*r+1]||0,i[3*e+2]=i[3*e+2]||0,i[3*n+2]=i[3*n+2]||0,i[3*r+2]=i[3*r+2]||0,i[3*e]+=Oe[0],i[3*n]+=Oe[0],i[3*r]+=Oe[0],i[3*e+1]+=Oe[1],i[3*n+1]+=Oe[1],i[3*r+1]+=Oe[1],i[3*e+2]+=Oe[2],i[3*n+2]+=Oe[2],i[3*r+2]+=Oe[2],o[e]+=1,o[n]+=1,o[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,e,n){return t[0]=e[n],t[1]=e[n+1],t[2]=e[n+2],t}function Ee(t,e,n){return t[0]=e[n],t[1]=e[n+1],t}const{StyleUtil:ze,PackUtil:$e,ArrayPool:De}=ne(),qe=De.getInstance();function je(t,e,n,r,i,o,s,a,l,u,h,c,f,p,d,g){void 0===e.top&&(e.top=!0),void 0===e.side&&(e.side=!0),qe.reset();const{altitudeScale:y,altitudeProperty:x,defaultAltitude:m,heightProperty:v,minHeightProperty:P,defaultHeight:_,tangent:I,uv:A,topUVMode:T,sideUVMode:F,sideVerticalUVMode:k,top:L,side:C,textureYOrigin:Y,topThickness:V}=e,O=function(t,e,{altitudeScale:n,altitudeProperty:r,defaultAltitude:i,heightProperty:o,minHeightProperty:s,defaultHeight:a},{center:l,side:u,top:h,topThickness:c,uvOrigin:f,uv:p,uvSize:d,topUVMode:g,sideUVMode:y,sideVerticalUVMode:x,textureYOrigin:m,tileRatio:v,centimeterToPoint:w,verticalCentimeterToPoint:M,positionType:b,res:P,glScale:_,projectionCode:I},A,T){let F=e/t[0].extent;e===1/0&&(F=1);const k=e===1/0,B=T.get(),L=T.get(),C=T.get(),Y=T.getProxy(),V=T.get(),O=T.get(),X=T.get(),N=!!p,E=!!h,z=!!u,$=N?T.get():null;function D(t,n,r,i,o,s){let a=n;if(E){const u=Tt(Y,r,3);if(0===u.length)return n;let h=Y.getLength(),p=V.currentIndex;for(let t=0;t<h;t++)V[p++]=Y[t];if(V.currentIndex=p,n+=Y.getLength(),s)for(let e=2,n=u.length;e<n;e+=3)u[e]+=t/3,u[e-1]+=t/3,u[e-2]+=t/3;else{let e;for(let n=2,r=u.length;n<r;n+=3)e=u[n-1],u[n-1]=u[n]+t/3,u[n]=e+t/3,u[n-2]+=t/3}h=u.length,p=O.currentIndex;for(let t=0;t<h;t++)O[p++]=u[t];O.currentIndex=p,N&&It(g||0,t,n,$,V,f,w,v,d[0],d[1],o,P,_,I,l),c>0&&!z&&(n=oe(V,Y,r,O,n,$,0,c,e,N,y||0,x||0,m,d,v,M,i<0?!s:s)),X.setLength(n/3),X.fill(1,a/3,n/3)}if(z){E&&(c=0),a=n,n=oe(V,Y,r,O,n,$,c,i,e,N,y||0,x||0,m,d,v,M,i<0?!s:s),X.setLength(n/3);const t=Y.getLength()/3;X.fill(1,a/3,a/3+t),X.fill(0,a/3+t,a/3+2*t),X.fill(1,a/3+2*t,a/3+3*t),X.fill(0,a/3+3*t,n/3)}return n}let q=-1/0,j=1/0,Z=0;const G=[-1,-1,e+1,e+1];let U=0,R=t.length;S(A)&&(U=A,R=A+1);let J=0,H=!1;const W=T.getProxy();let K=!1;for(;U<R;U++){const l=t[U],u=l.id;S(u)&&(Math.abs(u)>J&&(J=Math.abs(u)),u<0&&(H=!0));const h=l.geometry,c=l.properties[ee];let f=Array.isArray(c&&c[0]&&c[0][0])?c[0]:c;const{altitude:p,height:d}=re.getFeaAltitudeAndHeight(l,n,r,i,o,a,s);d<0?(K=!0,j=Math.min(p,j),q=Math.max(p-d,q)):(q=Math.max(p,q),j=Math.min(p-d,j));const g=V.getLength();let y=0,x=Z;W.setLength(0),Y.setLength(0);const m=re.calculateSignedArea(h[0])<0;for(let t=0,n=h.length;t<n;t++){let r=h[t];m&&(r=r.reverse()),r=ae(r);const i=re.calculateSignedArea(r)<0;if(!i&&t>0&&(y++,f=c&&c[y],Z=D(x,Z,W,d*F,f,k),Y.setLength(0),W.setLength(0),x=Z),e!==1/0&&(r=re.clipPolygon(r,G)),!r.length){t===n-1&&(Z=D(x,Z,W,d*F,f,k));continue}const o=r.length;if(Array.isArray(r[0])?r[0][0]===r[o-1][0]&&r[0][1]===r[o-1][1]||r.push([r[0][0],r[0][1]]):r[0].x===r[o-1].x&&r[0].y===r[o-1].y||r.push(r[0]),i){let t=W.currentIndex;W[t++]=Y.getLength()/3,W.currentIndex=t}ct(Y,Y.getLength(),r,F,p,!1,b),t===n-1&&(Z=D(x,Z,W,d*F,f,k))}const v=V.getLength()-g,w=(te+"").trim();for(let t=0;t<v/3;t++){let t=L.currentIndex;L[t++]=void 0===l[w]?U:l[w],L.currentIndex=t,t=B.currentIndex,B[t++]=U,B.currentIndex=t,S(u)&&(t=C.currentIndex,C[t++]=u,C.currentIndex=t)}}const Q=re.getUnsignedArrayType(L.getLength()?L[L.getLength()-1]:0),tt={hasNegativeHeight:K,maxAltitude:q===-1/0?0:q,minAltitude:j===1/0?0:j,vertices:V,verticeTypes:X,indices:O,pickingIds:ie.createTypedArray(L,Q),featureIndexes:B};if(C.getLength()){const t=H?re.getPosArrayType(J):re.getUnsignedArrayType(J);tt.featureIds=ie.createTypedArray(C,t)}else tt.featureIds=[];return $&&($.setLength(V.getLength()/3*2),tt.uvs=$),tt}(t,n,{altitudeScale:y,altitudeProperty:x,defaultAltitude:m||0,heightProperty:v,minHeightProperty:P,defaultHeight:_||0},{center:g,top:L,side:C,topThickness:10*V||0,uv:A||I,uvSize:[i,i],uvOrigin:r,topUVMode:T,sideUVMode:F,sideVerticalUVMode:k,textureYOrigin:Y,tileRatio:a,centimeterToPoint:l,verticalCentimeterToPoint:u,positionType:d,res:o,glScale:s,projectionCode:f},p,qe),X=[],N=O.vertices.getLength()/3,E=$e.getIndexArrayType(N),z=De.createTypedArray(O.indices,E);delete O.indices,X.push(z.buffer,O.pickingIds.buffer);const $=Math.max(Math.abs(O.maxAltitude),Math.abs(O.minAltitude)),D=$e.getPosArrayType(Math.max(512,$));O.vertices=De.createTypedArray(O.vertices,D);const q=I?qe.getProxy():new Float32Array(3*N);q.setLength&&q.setLength(3*N);const j=function(t,e,n){const r=n||[];r.setLength&&r.setLength(t.length);const i=Fe;i.length<t.length/3&&(i.length=t.length/3),i.fill(0,0,t.length/3);const o=void 0===e.length?e:e.length;for(let n=0;n<o/3;n++)void 0===e.length?Xe(t,3*n,3*n+1,3*n+2,r,i):Xe(t,e[3*n],e[3*n+1],e[3*n+2],r,i);for(let t=0;t<r.length;t+=3){const e=i[t/3];0!==e?(r[t]/=e,r[t+1]/=e,r[t+2]/=e):(r[t]=0,r[t+1]=0,r[t+2]=0)}return r}(O.vertices,z,q);let Z=!0;const G=j.getLength?j.getLength():j.length;for(let t=0;t<G;t++){j[t]=-j[t];const e=j[t]%1;1-Math.abs(e)>1e-6?Z=!1:0!==e&&(j[t]=Math.round(j[t]))}if(O.normals=j,I){let t=qe.get();t.setLength(4*N),t=function(t,e,n,r,i){const o=t.length/3,s=i||new Array(4*o),a=[],l=[];for(let t=0;t<o;t++)a[t]=[0,0,0],l[t]=[0,0,0];const u=[0,0,0],h=[0,0,0],c=[0,0,0],f=[0,0],p=[0,0],d=[0,0],g=[0,0,0],y=[0,0,0];function x(e,r,i){Ne(u,t,3*e),Ne(h,t,3*r),Ne(c,t,3*i),Ee(f,n,2*e),Ee(p,n,2*r),Ee(d,n,2*i);const o=h[0]-u[0],s=c[0]-u[0],x=h[1]-u[1],m=c[1]-u[1],v=h[2]-u[2],w=c[2]-u[2],M=p[0]-f[0],b=d[0]-f[0],P=p[1]-f[1],_=d[1]-f[1],I=1/(M*_-b*P);fe(g,(_*o-P*s)*I,(_*x-P*m)*I,(_*v-P*w)*I),fe(y,(M*s-b*o)*I,(M*m-b*x)*I,(M*w-b*v)*I),pe(a[e],a[e],g),pe(a[r],a[r],g),pe(a[i],a[i],g),pe(l[e],l[e],y),pe(l[r],l[r],y),pe(l[i],l[i],y)}for(let t=0,e=r.length;t<e;t+=3)x(r[t+0],r[t+1],r[t+2]);const m=[],v=[],w=[],M=[];let b,P,_;function I(t){Ne(w,e,3*t),ce(M,w),P=a[t],ce(m,P),xe(m,m,function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t}(w,w,ge(w,P))),de(m,m),ye(v,M,P),_=ge(v,l[t]),b=_<0?-1:1,s[4*t]=m[0],s[4*t+1]=m[1],s[4*t+2]=m[2],s[4*t+3]=b}for(let t=0,e=r.length;t<e;t+=3)I(r[t+0]),I(r[t+1]),I(r[t+2]);return s}(O.vertices,O.normals,O.uvs,z,t),t=function(t,e){const n=e.getLength(),r=new Float32Array(n),i=[],o=[],s=[];for(let a=0;a<n;a+=4){const n=a/4*3;dt(o,t[n]||0,t[n+1]||0,t[n+2]||0),yt(i,e[a]||0,e[a+1]||0,e[a+2]||0,e[a+3]||0),Te(s,o,i),gt(r.subarray(a,a+4),s)}return r}(O.normals,t),O.tangents=t,X.push(t.buffer),delete O.normals}if(O.normals&&(Z&&(O.normals=De.createTypedArray(O.normals,Int8Array)),X.push(O.normals.buffer)),O.uvs){const t=O.uvs;O.uvs=De.createTypedArray(t,Float32Array),X.push(O.uvs.buffer)}const U=function(t,e,n,r){const i={},o={},s=r.getLength();if(B(e.polygonFill)){let a=M(e.polygonFill);const l=new Uint8Array(4*s);l.fill(255);for(let e=0;e<s;e++){const o=t[r[e]],s=o.properties||{};s.$layer=o.layer,s.$type=o.type;let u=a(n,s);w(u)&&(i.aColor=1,a=M(u),u=a(n,s)),delete s.$layer,delete s.$type,ze.normalizeColor(Ze,u),l[4*e]=Ze[0],l[4*e+1]=Ze[1],l[4*e+2]=Ze[2],l[4*e+3]=Ze[3]}o.aColor=l}if(B(e.polygonOpacity)){let a=b(e.polygonOpacity,"exponential");const l=new Uint8Array(s);l.fill(255);for(let e=0;e<s;e++){const o=t[r[e]],s=o.properties||{};s.$layer=o.layer,s.$type=o.type;let u=a(n,s);w(u)&&(i.aOpacity=1,a=M(u),u=a(n,s)),delete s.$layer,delete s.$type,l[e]=255*u}o.aOpacity=l}return o.dynamicAttributes=i,o}(t,h,c,O.featureIndexes),R=function(t,e,n,r,i){const o=[[],[]],s=B(r.topPolygonFill),a=B(r.bottomPolygonFill),l=[255,255,255,255],u=e.getLength();if(s||a){let h=s&&M(r.topPolygonFill),c=a&&M(r.bottomPolygonFill),f=null,p=null,d=null,g=null;for(let r=0;r<u;r++){if(1===t[r]&&!s||0===t[r]&&!a)continue;const u=1===t[r];if(u&&e[r]===f){t[r]=d;continue}if(!u&&e[r]===p){t[r]=g;continue}const y=n[e[r]],x=y.properties||{};x.$layer=y.layer,x.$type=y.type;let m=u?h:c,v=m(i,x);w(v)&&(m=M(v),v=m(i,x)),delete x.$layer,delete x.$type,ze.normalizeColor(Ze,v),xt(Ze,Ze,l);let b=Ge(o,Ze);b<0&&(b=o.length,o.push(gt([],Ze))),t[r]=b,u?(f=e[r],d=b):(p=e[r],g=b)}}return o.slice(2)}(O.verticeTypes,O.featureIndexes,t,h,c),J={data:{data:{aVertexColorType:R.length<=252?De.createTypedArray(O.verticeTypes,Uint8Array):De.createTypedArray(O.verticeTypes,Uint16Array),aPosition:O.vertices,aNormal:O.normals,aTexCoord0:O.uvs,aTangent:O.tangents,aPickingId:O.pickingIds},indices:z,properties:{maxAltitude:O.maxAltitude/100,minAltitude:O.minAltitude/100,hasNegativeHeight:O.hasNegativeHeight},dynamicAttributes:U.dynamicAttributes,vertexColors:R},buffers:X};return O.featureIds.length?(J.data.featureIds=O.featureIds,X.push(J.data.featureIds.buffer)):J.data.featureIds=[],U.aColor&&(J.data.data.aColor=U.aColor,J.buffers.push(U.aColor.buffer)),U.aOpacity&&(J.data.data.aOpacity=U.aOpacity,J.buffers.push(U.aOpacity.buffer)),J.buffers.push(J.data.data.aPosition.buffer),J.data.pickingIdIndiceMap=$e.generatePickingIndiceIndex(J.data.data.aPickingId,J.data.indices),J}const Ze=[];function Ge(t,e){for(let i=0;i<t.length;i++)if(n=e,r=t[i],n[0]===r[0]&&n[1]===r[1]&&n[2]===r[2]&&n[3]===r[3])return i;var n,r;return-1}const{PackUtil:Ue,StyleUtil:Re,FilterUtil:Je}=ne();function He(t,e,n,r,{altitudeScale:i,altitudeProperty:o,defaultAltitude:s,heightProperty:a,minHeightProperty:l,defaultHeight:u,bottom:h}){const c=h,f=e/t[0].extent,p=2*function(t,e){let n=0;for(let e=0,r=t.length;e<r;e++){const r=t[e];if(S(r.geometry[0][0]))n+=3*r.geometry.length;else for(let t=0,e=r.geometry.length;t<e;t++){let e=3*r.geometry[t].length;3===r.type&&(e-=3),n+=e}}return n}(t)+3*t.length*2,d=[],g=new Int16Array(p),y=new Uint8Array(g.length/3*4);w(n)&&(n=Je.compileFilter(n));const x=[];function m(t,n,r){const i=n-t,o=g.subarray(t,n),s=g.subarray(n,n+i);s.set(o);for(let t=2,e=s.length;t<e;t+=3)s[t]=o[t]-r;const a=t/3,l=i/3;let u,h;for(let t=a,n=l+a;t<n;t++)t<n-1?(u=t,h=t+1):(u=t,h=a),ft(g,u,h,e)||(x.push(u,h),c&&x.push(u+l,h+l),We(g,u,e)||x.push(u,u+l));return n+i}let v=0,M=-1/0,b=1/0;const P=(te+"").trim(),_=[];for(let e=0,h=t.length;e<h;e++){const h=t[e],c=h.geometry;if(n){let t;t="function"==typeof n?n(h&&h.properties):n,Re.normalizeColor(_,t)}else dt(_,255,255,255);const p=v/3*4,{altitude:w,height:I}=Ue.getFeaAltitudeAndHeight(h,i,o,s,a,u,l);I<0?(b=Math.min(w,b),M=Math.max(w-I,M)):(b=Math.min(w-I,b),M=Math.max(w,M));let A=v;for(let t=0,e=c.length;t<e;t++){let e=c[t];const n=e.length;e[0][0]===e[n-1][0]&&e[0][1]===e[n-1][1]&&(e=e.slice(0,n-1)),v=ct(g,A,e,f,w),v=m(A,v,I*f),A=v}const S=A/3*4;for(let t=p;t<S;t+=4)y[t]=_[0],y[t+1]=_[1],y[t+2]=_[2],y[t+3]=255*(r||1);const T=x.length-d.length;for(let t=0;t<T;t++)d.push(h[P])}const I=x.reduce(((t,e)=>Math.max(t,e)),0),A=new(Ue.getIndexArrayType(I))(x),T=Ue.getUnsignedArrayType(t.length),F=Math.max(Math.abs(M,Math.abs(b)));return{aPosition:new(Ue.getPosArrayType(Math.max(512,F)))(g),indices:A,aPickingId:new T(d),aColor:y,maxAltitude:M===-1/0?0:M/100,minAltitude:b===1/0?0:b/100}}function We(t,e,n){const r=t[3*e],i=t[3*e+1];return r<0||r>n||i<0||i>n}function Ke(t,e,n,r){const i=He(t,e,n.lineColor,n.lineOpacity,r),{minAltitude:o,maxAltitude:s}=i;delete i.minAltitude,delete i.maxAltitude;const a=[i.aPosition.buffer,i.indices.buffer,i.aPickingId.buffer],l=i.indices;return delete i.indices,{data:{data:i,properties:{minAltitude:o,maxAltitude:s},indices:l},buffers:a}}\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 */const Qe=["Unknown","Point","LineString","Polygon","MultiPoint","MultiLineString","MultiPolygon","GeometryCollection"];function tn(t){if(!t)return"true";const e=t[0];if(t.length<=1)return"any"===e?"false":"true";return\`(${E}"=="===e?nn(t[1],t[2],"===",!1):"!="===e?nn(t[1],t[2],"!==",!1):"<"===e||">"===e||"<="===e||">="===e?nn(t[1],t[2],e,!0):"any"===e?on(t.slice(1),"||"):"all"===e?on(t.slice(1),"&&"):"none"===e?ln(on(t.slice(1),"||")):"in"===e?sn(t[1],t.slice(2)):"!in"===e?ln(sn(t[1],t.slice(2))):"has"===e?an(t[1]):"!has"===e?ln(an(t[1])):"contains"===e?function(t,e,n){const r=en(t);return void 0!==n?\`(${E}r} + '').indexOf("${E}e}") === ${E}n}\`:\`(${E}r} + '').indexOf("${E}e}") >= 0\`}(t[1],t[2],t[3]):"true"})\`}function en(t){return"$"===t[0]?"f."+t.substring(1):"p["+JSON.stringify(t)+"]"}function nn(t,e,n,r){if("object"==typeof(i=t)&&i&&t.op)return function(t,e,n,r){const i=t.property,o=t.op;let s=en(i);return"length"!==o?(console.error(\`not support ${E}o} op\`),"false"):(s=\`((${E}s}+='').length)\`,rn(s,i,e,n,r))}(t,e,n,r);var i;return rn(en(t),t,e,n,r)}function rn(t,e,n,r,i){const o="$type"===e?Qe.indexOf(n):JSON.stringify(n);return(i?\`typeof ${E}t}=== typeof ${E}o}&&\`:"")+t+r+o}function on(t,e){return t.map(tn).join(e)}function sn(t,e){"$type"===t&&(e=e.map((t=>Qe.indexOf(t))));const n=JSON.stringify(e.sort(un)),r=en(t);return e.length<=200?\`${E}n}.indexOf(${E}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; }(${E}r}, ${E}n},0,${E}e.length-1})\`}function an(t){return"$id"===t?'"id" in f':\`${E}JSON.stringify(t)} in p\`}function ln(t){return\`!(${E}t})\`}function un(t,e){return t<e?-1:t>e?1:0}let hn=!1;try{const t=new OffscreenCanvas(1,1);t.getContext("2d").fillText("hello",0,0),hn=!0}catch(t){hn=!1}var cn=hn;const{VectorPack:fn,PolygonPack:pn,NativeLinePack:dn,LinePack:gn,PointPack:yn,NativePointPack:xn,LineExtrusionPack:mn,CirclePack:vn,RoundTubePack:wn,SquareTubePack:Mn,FilterUtil:bn,PackUtil:Pn,StyleUtil:_n,TextUtil:In,DEFAULT_TEX_WIDTH:An,GlyphRequestor:Sn}=ne(),Tn="__original_properties",Fn="__fn-type_properties";class kn{constructor(t,e,n,r,i){this.id=t,this.options=e,this.upload=n,this._compileStyle(e.style),this.requests={},this._cache=r,this._styleCounter=1,this.loadings=i}updateStyle(t,e){this.options.style=t,this._styleCounter=t.styleCounter,this._compileStyle(t),e()}updateOptions(t,e){this.options=I(this.options,t),e()}loadTile(t,e){const n=this.loadings,r=t.tileInfo.url,i=this.options.debugTile;if(i){const{x:n,y:r,z:o}=t.tileInfo;let s=!1;for(let t=0;t<i.length;t++)if(n===i[t].x&&r===i[t].y&&o===i[t].z){s=!0;break}if(!s)return void e()}if(n[r])return void n[r].push({context:t,callback:e,ref:this});n[r]=[{context:t,callback:e,ref:this}];const o=this.options.featureIdProperty;this.requests[r]=this.getTileFeatures(t,((e,i,s,a)=>{const l=n[r];if(delete n[r],this.checkIfCanceled(r))return delete this.requests[r],void this._callWaitings(l,null,{canceled:!0});if(delete this.requests[r],(this.options.debug||o)&&i)for(let e=0;e<i.length;e++)if(this.options.debug&&(i[e]._debug_info={index:e,id:i[e].id,tileId:t.tileInfo.id}),o){const t=F(o)?o[i[e].layer]:o,n=i[e].properties;i[e].id=n&&n[t]||null}if(e)this._callWaitings(l,e);else if(i&&i.length){if(l)for(let t=0;t<l.length;t++)this._onTileLoad.call(l[t].ref,l[t].context,l[t].callback,r,s,i,a)}else this._callWaitings(l)}))}_onTileLoad(t,e,n,r,i,o){this._createTileData(r,i,t).then((n=>{n.canceled?e(null,{canceled:!0}):(n.data.styleCounter=t.styleCounter,o&&I(n.data,o),e(null,n.data,n.buffers))})).catch((t=>{e(t)}))}abortTile(t,e){delete this.requests[t],this._cancelLoadings(t),e()}_cancelLoadings(t){const e=this.loadings[t];if(e)for(let t=0;t<e.length;t++)e[t].callback(null,{canceled:!0});delete this.loadings[t]}_callWaitings(t,e,n){if(t)for(let r=0;r<t.length;r++)t[r].callback(e,n)}checkIfCanceled(t){return!this.requests[t]}onRemove(){this.loadings={},delete this._cache,this.requests={}}fetchIconGlyphs(t,e,n){if(this.options.workerGlyph&&cn){const r=[];if(t&&Object.keys(t).length){const e=new Promise((e=>{this.upload("fetchIconGlyphs",{icons:t},null,((t,n)=>{e({err:t,iconData:n})}))}));r.push(e)}if(e&&Object.keys(e).length){const t=new Promise((t=>{this._glyphRequestor||(this._glyphRequestor=new Sn),this._glyphRequestor.getGlyphs(e,((e,n)=>{t({err:e,glyphData:n})}))}));r.push(t)}Promise.all(r).then((t=>{const e={icons:null,glyphs:null};for(let r=0;r<t.length;r++){if(t[r].err)return void n(t[r].err);t[r].iconData?e.icons=t[r].iconData.icons:t[r].glyphData&&(e.glyphs=t[r].glyphData.glyphs)}return e})).then((t=>{n(null,t)}))}else this.upload("fetchIconGlyphs",{icons:t,glyphs:e},null,n)}_createTileData(t,e,n){if(!e.length)return Promise.resolve({data:null,buffers:[]});const{glScale:r,tileInfo:i}=n,o=!this.options.style.style.length&&!this.options.style.featureStyle.length;let s=this.pluginConfig.slice(0);o&&(s=this._updateLayerPluginConfig(t)),this.featurePlugins&&function(t){for(let e=1;e<arguments.length;e++){const n=arguments[e];if(n)for(let e=0,r=n.length;e<r;e++)t.push(n[e])}t.length}(s,this.featurePlugins);const a={};for(let t=0;t<s.length;t++)Xn(e,n.tileInfo.z,s[t],a);const l=[],u=[];for(let t=0;t<e.length;t++){const n=e[t],r=a[t];if(r){u.fill(null);let t=0;for(const e in r){let i=0;const o=r[e].values();for(const t of o){let r=u[i];r||(r=$n(n),u[i]=r),r.properties[e]=t,i++}i>t&&(t=i)}for(let e=0;e<t;e++)l.push(u[e])}else l.push(n)}const h=(e=l)[0].extent,c=i.z,f={x:i.extent2d.xmin*r,y:i.extent2d.ymax*r},p=[],d=[],g=[],y=this.options,x=[],m={},v=[Promise.resolve(n.styleCounter)];let w=0,M=-1;const b=[];let P=!1;for(let t=0;t<s.length;t++){M++;const r=s[t];r.type!==w&&(M=0,w=r.type);const a=0===r.type?p:d;if(r.symbol&&!1===r.symbol.visible){a[M]=null;continue}jn(r.symbol,b,t),P=P||b[t]&&b[t].size>0;const{tileFeatures:l,tileFeaIndexes:u}=this._filterFeatures(c,r.type,r.filter,e,m,t);if(!l.length){a[M]=null;continue}const y=u[u.length-1],_=Pn.getIndexArrayType(y);a[M]={styledFeatures:new _(u)},g.push({idx:t,typeIdx:M}),x.push(a[M].styledFeatures.buffer);const A=I({},n,{extent:h,zoom:c,tilePoint:f});if(this.options.debugTile){const t=this.options.debugTile;for(let e=0;e<t.length;e++){const{x:n,y:r,z:o}=t[e];if(i.x===n&&i.y===r&&i.z===o){A.debugIndex=t[e].index;break}}}let S=this._createTileGeometry(l,r,A);o&&(S=S.then((t=>{if(!t)return null;if(t.data)t.data.layer=l[0].layer;else if(Array.isArray(t))for(let e=0;e<t.length;e++)t[e]&&t[e].data&&(t[e].data.layer=l[0].layer);return t}))),v.push(S)}return Promise.all(v).then((([n,...r])=>{if(n!==this._styleCounter)return{canceled:!0};function i(t,e){if(void 0!==t.data.ref)return;const n=s[g[e].idx],r=n.renderPlugin.dataConfig;if(t.data.type=r.type,t.data.filter=n.filter.def,r.altitudeOffset&&(t.data.properties.minAltitude+=r.altitudeOffset,t.data.properties.maxAltitude+=r.altitudeOffset),t.buffers&&t.buffers.length)for(let e=0;e<t.buffers.length;e++)x.push(t.buffers[e])}for(let t=0;t<r.length;t++){if(!r[t])continue;const e=r[t],n=0===s[g[t].idx].type?p:d;if(Array.isArray(e)){const r=[];for(let n=0;n<e.length;n++)e[n]&&(i(e[n],t),(void 0===e[n].data.ref||e[e[n].data.ref])&&r.push(e[n].data));r.length&&(n[g[t].typeIdx].data=r)}else i(e,t),n[g[t].typeIdx].data=e.data}const o={},a=t;if(y.features||y.schema||P){let t,n=!1;for(let r=0,i=e.length;r<i;r++)if(t=e[r],a[t.layer].properties||(a[t.layer].properties=Cn(t.properties)),t&&(y.features||P&&m[r]))if("id"===y.features)o[r]=t.id;else{y.pickingGeometry||delete t.geometry,delete t.extent,delete t.properties.$layer,delete t.properties.$type,delete t.__index;const e=t.originalFeature;if(e){const e=t.properties,n=I({},t.originalFeature);delete e[Tn],n.customProps=I({},e),t=n}const i=I({},t);if(P&&m[r]&&(!y.features||"transient"===y.features)){const i=m[r];for(let r=0;r<i.length;r++){const i=b[r];i&&i.forEach((r=>{const i=e?e.properties:t.properties;i[Fn]||(i[Fn]=new Set),i[Fn].add(r),n=!0}))}}o[r]=i}if(n)for(const t in o){const e=o[t],n=e.properties[Fn];if(n){delete e.properties[Fn],"transient"===y.features&&(e.fnTypeProps=I({},e.properties));for(const t in e.properties)n.has(t)||("transient"===y.features?delete e.fnTypeProps[t]:delete e.properties[t])}}}return{data:{styleCounter:n,schema:a,data:p,featureData:d,extent:h,features:o},buffers:x}})).catch((t=>{console.error(t)}))}_createTileGeometry(t,e,n){let r=t;const i=e.renderPlugin.dataConfig,o=e.symbol,s=this.options.tileSize,{extent:a,glScale:l,zScale:u,zoom:h,tilePoint:c,centimeterToPoint:f,verticalCentimeterToPoint:p}=n,d=a/s,g=i.type,y=n.debugIndex;let x=I({},i,{EXTENT:a,zoom:h,debugIndex:y,features:this.options.features});if("3d-extrusion"===g){Yn(o)&&(i.uv=1);const t=this.options.projectionCode,e=o.material&&o.material.textureWidth||An;return Promise.all([Promise.resolve(je(r,i,a,c,e,n.tileInfo.res,l,a/this.options.tileSize,f,p,o,h,t,y))])}if("3d-wireframe"===g)return Promise.all([Promise.resolve(Ke(r,a,o,i))]);if("point"===g){x=I(x,{requestor:this.fetchIconGlyphs.bind(this),altitudeToTileScale:u*a/this.options.tileSize/l,pluginType:e.renderPlugin.type});let t=o;return Array.isArray(o)||(t=[o]),t=t.map(((t,e)=>(t&&(t.index={index:e},t.isIconText=function(t){return t.markerType||t.markerFile}(t)),t))).filter((t=>!!t)),Promise.all(t.map((t=>{const e=fn.genFnTypes(t);let n=r;return yn.needMerge(t,e,h)&&(n=yn.mergeLineFeatures(r,t,e,h)),new yn(n,t,x).load(d)})))}if("native-point"===g){const t=u*a/this.options.tileSize/l;return x.altitudeToTileScale=t,Vn(r,o,x,xn,d)}if("line"===g)return x=I(x,{requestor:this.fetchIconGlyphs.bind(this),tileRatio:d}),Vn(r,o,x,gn,1,!0);if("native-line"===g)return Vn(r,o,x,dn,1,!0);if("fill"===g)return x=I(x,{requestor:this.fetchIconGlyphs.bind(this)}),Vn(r,o,x,pn);if("line-extrusion"===g){delete o.lineGradientProperty,o.lineJoin="miter",o.lineCap="butt";const t=Yn(o);if(t&&(i.uv=1),x=I(x,{tileSize:s,zScale:u,glScale:l}),o.mergeOnProperty){const t=fn.genFnTypes(o);r=gn.mergeLineFeatures(r,o,t,x.zoom)}if(t){const t=[];if(!1!==i.top){const e=I({},x);e.side=!1,t.push(new mn(r,o,e))}return!1!==i.side&&(x.side=!0,x.top=!1,t.push(new mn(r,o,x))),Promise.all(t.map((t=>t.load())))}return Promise.all([new mn(r,o,x).load()])}if("circle"===g)return Vn(r,o,x,vn);if("round-tube"===g||"square-tube"===g){const t="round-tube"===g?wn:Mn;return x=I(x,{requestor:this.fetchIconGlyphs.bind(this),radialSegments:"round-tube"===g?i.radialSegments||8:4,centimeterToPoint:f,verticalCentimeterToPoint:p,tileRatio:d,isTube:!0}),Vn(r,o,x,t)}return Promise.resolve([])}_filterFeatures(t,e,n,r,i,o){const s=(te+"").trim(),a=[],l=[],u=r.length;for(let h=0;h<u;h++)if((1===e||void 0===r[h].id||!this.styledFeatures[r[h].id])&&((!n.def||"default"===n.def)&&!i[h]||!0===n.def||n.def&&(void 0!==n.def.condition||Array.isArray(n.def))&&n(r[h],t))){const t=r[h];if(void 0===t[s]&&(t[s]=h),i[h]||(i[h]=[]),i[h].push(o),l.push(t),a.push(h),1===e)break}return{tileFeatures:l,tileFeaIndexes:a}}_compileStyle(t){const{style:e,featureStyle:n}=t,r={};n.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=bn.compileStyle(e);for(let t=0;t<e.length;t++)i[t].filter&&(i[t].filter.def=e[t].filter?e[t].filter.value||e[t].filter:void 0),i[t].type=0;const o=[],s=bn.compileStyle(n);for(let t=0;t<n.length;t++)s[t].type=1,s[t].filter.def=n[t].filter?n[t].filter.value||n[t].filter:void 0,s[t].renderPlugin&&o.push(s[t]);this.pluginConfig=i,this.featurePlugins=o,this.styledFeatures=r}_updateLayerPluginConfig(t){let e=this._layerPlugins;this._layerPlugins||(e=this._layerPlugins={});const n=["","Point","LineString","Polygon","MultiPoint","MultiLineString","MultiPolygon"],r=[];for(const o in t){const s=o;if(!e[o]){const r=[];for(let e=0;e<t[o].types.length;e++){const a=t[o].types[e],l=["all",["==","$layer",s],["==","$type",n[a]]],u={filter:(i=l,new Function("f",\`var p = (f && f.properties || {}); return ${E}tn(i)}\`)),renderPlugin:Bn(a),symbol:Ln(a)};u.filter.def=l,u.type=0,r.push(u)}e[s]=r}r.push(...e[s])}var i;return r}}function Bn(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 Ln(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 Cn(t){if(Array.isArray(t)||!F(t))return{};const e={};for(const n in t){const r=t[n];A(r)?e[n]="string":S(r)?e[n]="number":!0===r||!1===r?e[n]="boolean":Array.isArray(r)?e[n]="array":e[n]="object"}return e}function Yn(t){if(!t)return 0;let e=0;for(const n in t){if(("normalTexture"===n||"bumpTexture"===n)&&t[n])return 2;if(n.indexOf("Texture")>0&&t[n])e=1;else if(F(t[n])){const r=Yn(t[n]);if(2===r)return r;1===r&&(e=1)}}return e}function Vn(t,e,n,r,i,o){const s={},a=Array.isArray(e)?e:[e];let l=-1;for(let t=0;t<a.length;t++)s[t]=On(a[t]),!s[t]&&a[t]&&-1===l&&(l=t);const u=[];for(let e=0;e<a.length;e++){if(!a[e])continue;a[e].index={index:e};let h=t;if(o&&a[e].mergeOnProperty){const r=fn.genFnTypes(a[e]);h=gn.mergeLineFeatures(t,a[0],r,n.zoom)}s[e]||e===l?u.push(new r(h,a[e],n).load(i)):u.push({data:{ref:l,symbolIndex:{index:e}}})}return Promise.all(u)}function On(t){if(!t)return 0;for(const e in t)if(B(t[e]))return 1;return 0}function Xn(t,e,n,r){const i=n.customProperties;if(!i)return t;if(i)for(let t=0;t<i.length;t++)i[t].fn=bn.compileFilter(i[t].filter);for(let n=0;n<i.length;n++)for(let o=0,s=t.length;o<s;o++)if(i[n].fn(t[o],e))for(const t in i[n].properties){const e=i[n].properties[t];k(e)||(r[o]||(r[o]={}),r[o][t]||(r[o][t]=new Set),r[o][t].add(e))}}const Nn={get:(t,e)=>e in t?t[e]:t.originalFeature[e],has:(t,e)=>e in t||e in t.originalFeature},En={get:function(t,e){return e in t?t[e]:t[Tn][e]},has:(t,e)=>e in t||e in t[Tn]},zn={};function $n(t){const e={};e.originalFeature=t;const n=new Proxy(e,Nn);return n.properties=new Proxy({},En),n.properties[Tn]=t.properties||zn,n}function Dn(t,e,n){t[e]||(t[e]=new Set),t[e].add(n)}const qn=[];function jn(t,e,n){if(!t)return qn;for(const r in t){if(!t[r]||!_n.checkIfZoomFnTypeSymbol(r))continue;if(B(t[r]))Dn(e,n,t[r].property);else{if("lineGradientProperty"===r){Dn(e,n,t[r]);continue}if("textName"===r)if(A(t[r])){const i=In.resolveVarNames(t[r]);if(i)for(let t=0;t<i.length;t++)Dn(e,n,i[t])}else if(bn.isExpression(t[r])){const i=[];In.resolveExpVarNames(i,t[r]);for(let t=0;t<i.length;t++)Dn(e,n,i[t])}}const i=t[r].stops;if(i&&i.length)for(let t=0;t<i.length;t++)B(i[t][1])&&Dn(e,t,i[t][1].property)}return e[n]}function Zn(t,e){Gn(t.geometry,e)}function Gn(t,e){if(t)switch(t.type){case"Point":Un(t.coordinates,e);break;case"MultiPoint":case"LineString":Rn(t.coordinates,e);break;case"MultiLineString":!function(t,e){for(let n=0,r=t.length;n<r;n++)Rn(t[n],e)}(t.coordinates,e);break;case"Polygon":Jn(t.coordinates,e);break;case"MultiPolygon":!function(t,e){for(let n=0,r=t.length;n<r;n++)Jn(t[n],e)}(t.coordinates,e);break;case"GeometryCollection":const n=t.geometries.length;for(let r=0;r<n;r++)Gn(t.geometries[r],e)}}function Un(t,e){e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.max(e[2],t[0]),e[3]=Math.max(e[3],t[1])}function Rn(t,e){for(let n=0,r=t.length;n<r;n++)Un(t[n],e)}function Jn(t,e){t.length&&Rn(t[0],e)}function Hn(t,e,n,r,i){Wn(t,e,n||0,r||t.length-1,i||Qn)}function Wn(t,e,n,r,i){for(;r>n;){if(r-n>600){var o=r-n+1,s=e-n+1,a=Math.log(o),l=.5*Math.exp(2*a/3),u=.5*Math.sqrt(a*l*(o-l)/o)*(s-o/2<0?-1:1);Wn(t,e,Math.max(n,Math.floor(e-s*l/o+u)),Math.min(r,Math.floor(e+(o-s)*l/o+u)),i)}var h=t[e],c=n,f=r;for(Kn(t,n,e),i(t[r],h)>0&&Kn(t,n,r);c<f;){for(Kn(t,c,f),c++,f--;i(t[c],h)<0;)c++;for(;i(t[f],h)>0;)f--}0===i(t[n],h)?Kn(t,n,f):Kn(t,++f,r),f<=e&&(n=f+1),e<=f&&(r=f-1)}}function Kn(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function Qn(t,e){return t<e?-1:t>e?1:0}class tr{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()}all(){return this._all(this.data,[])}search(t){let e=this.data;const n=[];if(!cr(t,e))return n;const r=this.toBBox,i=[];for(;e;){for(let o=0;o<e.children.length;o++){const s=e.children[o],a=e.leaf?r(s):s;cr(t,a)&&(e.leaf?n.push(s):hr(t,a)?this._all(s,n):i.push(s))}e=i.pop()}return n}collides(t){let e=this.data;if(!cr(t,e))return!1;const n=[];for(;e;){for(let r=0;r<e.children.length;r++){const i=e.children[r],o=e.leaf?this.toBBox(i):i;if(cr(t,o)){if(e.leaf||hr(t,o))return!0;n.push(i)}}e=n.pop()}return!1}load(t){if(!t||!t.length)return this;if(t.length<this._minEntries){for(let e=0;e<t.length;e++)this.insert(t[e]);return this}let e=this._build(t.slice(),0,t.length-1,0);if(this.data.children.length)if(this.data.height===e.height)this._splitRoot(this.data,e);else{if(this.data.height<e.height){const t=this.data;this.data=e,e=t}this._insert(e,this.data.height-e.height-1,!0)}else this.data=e;return this}insert(t){return t&&this._insert(t,this.data.height-1),this}clear(){return this.data=fr([]),this}remove(t,e){if(!t)return this;let n=this.data;const r=this.toBBox(t),i=[],o=[];let s,a,l;for(;n||i.length;){if(n||(n=i.pop(),a=i[i.length-1],s=o.pop(),l=!0),n.leaf){const r=er(t,n.children,e);if(-1!==r)return n.children.splice(r,1),i.push(n),this._condense(i),this}l||n.leaf||!hr(n,r)?a?(s++,n=a.children[s],l=!1):n=null:(i.push(n),o.push(s),s=0,a=n,n=n.children[0])}return this}toBBox(t){return t}compareMinX(t,e){return t.minX-e.minX}compareMinY(t,e){return t.minY-e.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}_all(t,e){const n=[];for(;t;)t.leaf?e.push(...t.children):n.push(...t.children),t=n.pop();return e}_build(t,e,n,r){const i=n-e+1;let o,s=this._maxEntries;if(i<=s)return o=fr(t.slice(e,n+1)),nr(o,this.toBBox),o;r||(r=Math.ceil(Math.log(i)/Math.log(s)),s=Math.ceil(i/Math.pow(s,r-1))),o=fr([]),o.leaf=!1,o.height=r;const a=Math.ceil(i/s),l=a*Math.ceil(Math.sqrt(s));pr(t,e,n,l,this.compareMinX);for(let i=e;i<=n;i+=l){const e=Math.min(i+l-1,n);pr(t,i,e,a,this.compareMinY);for(let n=i;n<=e;n+=a){const i=Math.min(n+a-1,e);o.children.push(this._build(t,n,i,r-1))}}return nr(o,this.toBBox),o}_chooseSubtree(t,e,n,r){for(;r.push(e),!e.leaf&&r.length-1!==n;){let n,r=1/0,s=1/0;for(let a=0;a<e.children.length;a++){const l=e.children[a],u=ar(l),h=(i=t,o=l,(Math.max(o.maxX,i.maxX)-Math.min(o.minX,i.minX))*(Math.max(o.maxY,i.maxY)-Math.min(o.minY,i.minY))-u);h<s?(s=h,r=u<r?u:r,n=l):h===s&&u<r&&(r=u,n=l)}e=n||e.children[0]}var i,o;return e}_insert(t,e,n){const r=n?t:this.toBBox(t),i=[],o=this._chooseSubtree(r,this.data,e,i);for(o.children.push(t),ir(o,r);e>=0&&i[e].children.length>this._maxEntries;)this._split(i,e),e--;this._adjustParentBBoxes(r,i,e)}_split(t,e){const n=t[e],r=n.children.length,i=this._minEntries;this._chooseSplitAxis(n,i,r);const o=this._chooseSplitIndex(n,i,r),s=fr(n.children.splice(o,n.children.length-o));s.height=n.height,s.leaf=n.leaf,nr(n,this.toBBox),nr(s,this.toBBox),e?t[e-1].children.push(s):this._splitRoot(n,s)}_splitRoot(t,e){this.data=fr([t,e]),this.data.height=t.height+1,this.data.leaf=!1,nr(this.data,this.toBBox)}_chooseSplitIndex(t,e,n){let r,i=1/0,o=1/0;for(let s=e;s<=n-e;s++){const e=rr(t,0,s,this.toBBox),a=rr(t,s,n,this.toBBox),l=ur(e,a),u=ar(e)+ar(a);l<i?(i=l,r=s,o=u<o?u:o):l===i&&u<o&&(o=u,r=s)}return r||n-e}_chooseSplitAxis(t,e,n){const r=t.leaf?this.compareMinX:or,i=t.leaf?this.compareMinY:sr;this._allDistMargin(t,e,n,r)<this._allDistMargin(t,e,n,i)&&t.children.sort(r)}_allDistMargin(t,e,n,r){t.children.sort(r);const i=this.toBBox,o=rr(t,0,e,i),s=rr(t,n-e,n,i);let a=lr(o)+lr(s);for(let r=e;r<n-e;r++){const e=t.children[r];ir(o,t.leaf?i(e):e),a+=lr(o)}for(let r=n-e-1;r>=e;r--){const e=t.children[r];ir(s,t.leaf?i(e):e),a+=lr(s)}return a}_adjustParentBBoxes(t,e,n){for(let r=n;r>=0;r--)ir(e[r],t)}_condense(t){for(let e,n=t.length-1;n>=0;n--)0===t[n].children.length?n>0?(e=t[n-1].children,e.splice(e.indexOf(t[n]),1)):this.clear():nr(t[n],this.toBBox)}}function er(t,e,n){if(!n)return e.indexOf(t);for(let r=0;r<e.length;r++)if(n(t,e[r]))return r;return-1}function nr(t,e){rr(t,0,t.children.length,e,t)}function rr(t,e,n,r,i){i||(i=fr(null)),i.minX=1/0,i.minY=1/0,i.maxX=-1/0,i.maxY=-1/0;for(let o=e;o<n;o++){const e=t.children[o];ir(i,t.leaf?r(e):e)}return i}function ir(t,e){return t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY),t}function or(t,e){return t.minX-e.minX}function sr(t,e){return t.minY-e.minY}function ar(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function lr(t){return t.maxX-t.minX+(t.maxY-t.minY)}function ur(t,e){const n=Math.max(t.minX,e.minX),r=Math.max(t.minY,e.minY),i=Math.min(t.maxX,e.maxX),o=Math.min(t.maxY,e.maxY);return Math.max(0,i-n)*Math.max(0,o-r)}function hr(t,e){return t.minX<=e.minX&&t.minY<=e.minY&&e.maxX<=t.maxX&&e.maxY<=t.maxY}function cr(t,e){return e.minX<=t.maxX&&e.minY<=t.maxY&&e.maxX>=t.minX&&e.maxY>=t.minY}function fr(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function pr(t,e,n,r,i){const o=[e,n];for(;o.length;){if((n=o.pop())-(e=o.pop())<=r)continue;const s=e+Math.ceil((n-e)/r/2)*r;Hn(t,s,e,n,i),o.push(e,s,s,n)}}class dr{constructor(t=[],e=gr){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this._down(t)}push(t){this.data.push(t),this.length++,this._up(this.length-1)}pop(){if(0===this.length)return;const t=this.data[0],e=this.data.pop();return this.length--,this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:e,compare:n}=this,r=e[t];for(;t>0;){const i=t-1>>1,o=e[i];if(n(r,o)>=0)break;e[t]=o,t=i}e[t]=r}_down(t){const{data:e,compare:n}=this,r=this.length>>1,i=e[t];for(;t<r;){let r=1+(t<<1),o=e[r];const s=r+1;if(s<this.length&&n(e[s],o)<0&&(r=s,o=e[s]),n(o,i)>=0)break;e[t]=o,t=r}e[t]=i}}function gr(t,e){return t<e?-1:t>e?1:0}function yr(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var xr={exports:{}},mr=function(t,e,n,r){var i=t[0],o=t[1],s=!1;void 0===n&&(n=0),void 0===r&&(r=e.length);for(var a=(r-n)/2,l=0,u=a-1;l<a;u=l++){var h=e[n+2*l+0],c=e[n+2*l+1],f=e[n+2*u+0],p=e[n+2*u+1];c>o!=p>o&&i<(f-h)*(o-c)/(p-c)+h&&(s=!s)}return s},vr=function(t,e,n,r){var i=t[0],o=t[1],s=!1;void 0===n&&(n=0),void 0===r&&(r=e.length);for(var a=r-n,l=0,u=a-1;l<a;u=l++){var h=e[l+n][0],c=e[l+n][1],f=e[u+n][0],p=e[u+n][1];c>o!=p>o&&i<(f-h)*(o-c)/(p-c)+h&&(s=!s)}return s};xr.exports=function(t,e,n,r){return e.length>0&&Array.isArray(e[0])?vr(t,e,n,r):mr(t,e,n,r)};var wr=xr.exports.nested=vr;xr.exports.flat=mr;const Mr=11102230246251565e-32,br=134217729,Pr=(3+8*Mr)*Mr;function _r(t,e,n,r,i){let o,s,a,l,u=e[0],h=r[0],c=0,f=0;h>u==h>-u?(o=u,u=e[++c]):(o=h,h=r[++f]);let p=0;if(c<t&&f<n)for(h>u==h>-u?(s=u+o,a=o-(s-u),u=e[++c]):(s=h+o,a=o-(s-h),h=r[++f]),o=s,0!==a&&(i[p++]=a);c<t&&f<n;)h>u==h>-u?(s=o+u,l=s-o,a=o-(s-l)+(u-l),u=e[++c]):(s=o+h,l=s-o,a=o-(s-l)+(h-l),h=r[++f]),o=s,0!==a&&(i[p++]=a);for(;c<t;)s=o+u,l=s-o,a=o-(s-l)+(u-l),u=e[++c],o=s,0!==a&&(i[p++]=a);for(;f<n;)s=o+h,l=s-o,a=o-(s-l)+(h-l),h=r[++f],o=s,0!==a&&(i[p++]=a);return 0===o&&0!==p||(i[p++]=o),p}function Ir(t){return new Float64Array(t)}const Ar=33306690738754716e-32,Sr=22204460492503146e-32,Tr=11093356479670487e-47,Fr=Ir(4),kr=Ir(8),Br=Ir(12),Lr=Ir(16),Cr=Ir(4);function Yr(t,e,n,r,i,o){const s=(e-o)*(n-i),a=(t-i)*(r-o),l=s-a;if(0===s||0===a||s>0!=a>0)return l;const u=Math.abs(s+a);return Math.abs(l)>=Ar*u?l:-function(t,e,n,r,i,o,s){let a,l,u,h,c,f,p,d,g,y,x,m,v,w,M,b,P,_;const I=t-i,A=n-i,S=e-o,T=r-o;w=I*T,f=br*I,p=f-(f-I),d=I-p,f=br*T,g=f-(f-T),y=T-g,M=d*y-(w-p*g-d*g-p*y),b=S*A,f=br*S,p=f-(f-S),d=S-p,f=br*A,g=f-(f-A),y=A-g,P=d*y-(b-p*g-d*g-p*y),x=M-P,c=M-x,Fr[0]=M-(x+c)+(c-P),m=w+x,c=m-w,v=w-(m-c)+(x-c),x=v-b,c=v-x,Fr[1]=v-(x+c)+(c-b),_=m+x,c=_-m,Fr[2]=m-(_-c)+(x-c),Fr[3]=_;let F=function(t,e){let n=e[0];for(let r=1;r<t;r++)n+=e[r];return n}(4,Fr),k=Sr*s;if(F>=k||-F>=k)return F;if(c=t-I,a=t-(I+c)+(c-i),c=n-A,u=n-(A+c)+(c-i),c=e-S,l=e-(S+c)+(c-o),c=r-T,h=r-(T+c)+(c-o),0===a&&0===l&&0===u&&0===h)return F;if(k=Tr*s+Pr*Math.abs(F),F+=I*h+T*a-(S*u+A*l),F>=k||-F>=k)return F;w=a*T,f=br*a,p=f-(f-a),d=a-p,f=br*T,g=f-(f-T),y=T-g,M=d*y-(w-p*g-d*g-p*y),b=l*A,f=br*l,p=f-(f-l),d=l-p,f=br*A,g=f-(f-A),y=A-g,P=d*y-(b-p*g-d*g-p*y),x=M-P,c=M-x,Cr[0]=M-(x+c)+(c-P),m=w+x,c=m-w,v=w-(m-c)+(x-c),x=v-b,c=v-x,Cr[1]=v-(x+c)+(c-b),_=m+x,c=_-m,Cr[2]=m-(_-c)+(x-c),Cr[3]=_;const B=_r(4,Fr,4,Cr,kr);w=I*h,f=br*I,p=f-(f-I),d=I-p,f=br*h,g=f-(f-h),y=h-g,M=d*y-(w-p*g-d*g-p*y),b=S*u,f=br*S,p=f-(f-S),d=S-p,f=br*u,g=f-(f-u),y=u-g,P=d*y-(b-p*g-d*g-p*y),x=M-P,c=M-x,Cr[0]=M-(x+c)+(c-P),m=w+x,c=m-w,v=w-(m-c)+(x-c),x=v-b,c=v-x,Cr[1]=v-(x+c)+(c-b),_=m+x,c=_-m,Cr[2]=m-(_-c)+(x-c),Cr[3]=_;const L=_r(B,kr,4,Cr,Br);w=a*h,f=br*a,p=f-(f-a),d=a-p,f=br*h,g=f-(f-h),y=h-g,M=d*y-(w-p*g-d*g-p*y),b=l*u,f=br*l,p=f-(f-l),d=l-p,f=br*u,g=f-(f-u),y=u-g,P=d*y-(b-p*g-d*g-p*y),x=M-P,c=M-x,Cr[0]=M-(x+c)+(c-P),m=w+x,c=m-w,v=w-(m-c)+(x-c),x=v-b,c=v-x,Cr[1]=v-(x+c)+(c-b),_=m+x,c=_-m,Cr[2]=m-(_-c)+(x-c),Cr[3]=_;const C=_r(L,Br,4,Cr,Lr);return Lr[C-1]}(t,e,n,r,i,o,u)}function Vr(t,e,n){e=Math.max(0,void 0===e?2:e),n=n||0;var r=function(t){for(var e=t[0],n=t[0],r=t[0],i=t[0],o=0;o<t.length;o++){var s=t[o];s[0]<e[0]&&(e=s),s[0]>r[0]&&(r=s),s[1]<n[1]&&(n=s),s[1]>i[1]&&(i=s)}var a=[e,n,r,i],l=a.slice();for(o=0;o<t.length;o++)wr(t[o],a)||l.push(t[o]);return function(t){t.sort(Ur);for(var e=[],n=0;n<t.length;n++){for(;e.length>=2&&$r(e[e.length-2],e[e.length-1],t[n])<=0;)e.pop();e.push(t[n])}for(var r=[],i=t.length-1;i>=0;i--){for(;r.length>=2&&$r(r[r.length-2],r[r.length-1],t[i])<=0;)r.pop();r.push(t[i])}return r.pop(),e.pop(),e.concat(r)}(l)}(t),i=new tr(16);i.toBBox=function(t){return{minX:t[0],minY:t[1],maxX:t[0],maxY:t[1]}},i.compareMinX=function(t,e){return t[0]-e[0]},i.compareMinY=function(t,e){return t[1]-e[1]},i.load(t);for(var o,s=[],a=0;a<r.length;a++){var l=r[a];i.remove(l),o=qr(l,o),s.push(o)}var u=new tr(16);for(a=0;a<s.length;a++)u.insert(Dr(s[a]));for(var h=e*e,c=n*n;s.length;){var f=s.shift(),p=f.p,d=f.next.p,g=jr(p,d);if(!(g<c)){var y=g/h;(l=Or(i,f.prev.p,p,d,f.next.next.p,y,u))&&Math.min(jr(l,p),jr(l,d))<=y&&(s.push(f),s.push(qr(l,f)),i.remove(l),u.remove(f),u.insert(Dr(f)),u.insert(Dr(f.next)))}}f=o;var x=[];do{x.push(f.p),f=f.next}while(f!==o);return x.push(f.p),x}function Or(t,e,n,r,i,o,s){for(var a=new dr([],Xr),l=t.data;l;){for(var u=0;u<l.children.length;u++){var h=l.children[u],c=l.leaf?Zr(h,n,r):Nr(n,r,h);c>o||a.push({node:h,dist:c})}for(;a.length&&!a.peek().node.children;){var f=a.pop(),p=f.node,d=Zr(p,e,n),g=Zr(p,r,i);if(f.dist<d&&f.dist<g&&zr(n,p,s)&&zr(r,p,s))return p}(l=a.pop())&&(l=l.node)}return null}function Xr(t,e){return t.dist-e.dist}function Nr(t,e,n){if(Er(t,n)||Er(e,n))return 0;var r=Gr(t[0],t[1],e[0],e[1],n.minX,n.minY,n.maxX,n.minY);if(0===r)return 0;var i=Gr(t[0],t[1],e[0],e[1],n.minX,n.minY,n.minX,n.maxY);if(0===i)return 0;var o=Gr(t[0],t[1],e[0],e[1],n.maxX,n.minY,n.maxX,n.maxY);if(0===o)return 0;var s=Gr(t[0],t[1],e[0],e[1],n.minX,n.maxY,n.maxX,n.maxY);return 0===s?0:Math.min(r,i,o,s)}function Er(t,e){return t[0]>=e.minX&&t[0]<=e.maxX&&t[1]>=e.minY&&t[1]<=e.maxY}function zr(t,e,n){for(var r,i,o,s,a=Math.min(t[0],e[0]),l=Math.min(t[1],e[1]),u=Math.max(t[0],e[0]),h=Math.max(t[1],e[1]),c=n.search({minX:a,minY:l,maxX:u,maxY:h}),f=0;f<c.length;f++)if(r=c[f].p,i=c[f].next.p,o=t,r!==(s=e)&&i!==o&&$r(r,i,o)>0!=$r(r,i,s)>0&&$r(o,s,r)>0!=$r(o,s,i)>0)return!1;return!0}function $r(t,e,n){return Yr(t[0],t[1],e[0],e[1],n[0],n[1])}function Dr(t){var e=t.p,n=t.next.p;return t.minX=Math.min(e[0],n[0]),t.minY=Math.min(e[1],n[1]),t.maxX=Math.max(e[0],n[0]),t.maxY=Math.max(e[1],n[1]),t}function qr(t,e){var n={p:t,prev:null,next:null,minX:0,minY:0,maxX:0,maxY:0};return e?(n.next=e.next,n.prev=e,e.next.prev=n,e.next=n):(n.prev=n,n.next=n),n}function jr(t,e){var n=t[0]-e[0],r=t[1]-e[1];return n*n+r*r}function Zr(t,e,n){var r=e[0],i=e[1],o=n[0]-r,s=n[1]-i;if(0!==o||0!==s){var a=((t[0]-r)*o+(t[1]-i)*s)/(o*o+s*s);a>1?(r=n[0],i=n[1]):a>0&&(r+=o*a,i+=s*a)}return(o=t[0]-r)*o+(s=t[1]-i)*s}function Gr(t,e,n,r,i,o,s,a){var l,u,h,c,f=n-t,p=r-e,d=s-i,g=a-o,y=t-i,x=e-o,m=f*f+p*p,v=f*d+p*g,w=d*d+g*g,M=f*y+p*x,b=d*y+g*x,P=m*w-v*v,_=P,I=P;0===P?(u=0,_=1,c=b,I=w):(c=m*b-v*M,(u=v*b-w*M)<0?(u=0,c=b,I=w):u>_&&(u=_,c=b+v,I=w)),c<0?(c=0,-M<0?u=0:-M>m?u=_:(u=-M,_=m)):c>I&&(c=I,-M+v<0?u=0:-M+v>m?u=_:(u=-M+v,_=m));var A=(1-(h=0===c?0:c/I))*i+h*s-((1-(l=0===u?0:u/_))*t+l*n),S=(1-h)*o+h*a-((1-l)*e+l*r);return A*A+S*S}function Ur(t,e){return t[0]===e[0]?t[1]-e[1]:t[0]-e[0]}const{PackUtil:Rr}=ne();class Jr{constructor(t,e){this.x=t,this.y=e}clone(){return new Jr(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 Jr(this.x-t.x,this.y-t.y)}distance(t){const e=this.x-t.x,n=this.y-t.y;return Math.sqrt(e*e+n*n)}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 Jr(this.y,-this.x)}}function Hr(t,e,n,r){const i=e.x*r.y-e.y*r.x,o=n.x-t.x,s=n.y-t.y,a=(o*r.y-s*r.x)/i;return new Jr(t.x+a*e.x,t.y+a*e.y)}const Wr=[],Kr=[];function Qr(t){if(S(t[0]&&t[0].x)){const e=[];let n=0;for(let r=0;r<t.length;r++)Kr[n]?(Kr[n][0]=t[r].x,Kr[n][1]=t[r].y):Kr[n]=[t[r].x,t[r].y],e.push(Kr[n]),n++;t=e}try{const e=Vr(t,1/0);let n=[1/0,1/0],r=[-1/0,-1/0];for(let t=0;t<e.length;t++)e[t][0]<n[0]&&(n[0]=e[t][0]),e[t][0]>r[0]&&(r[0]=e[t][0]),e[t][1]<n[1]&&(n[1]=e[t][1]),e[t][1]>r[1]&&(r[1]=e[t][1]);const i=[];let o=[],s=0;for(let t=0;t<e.length;t++)t===e.length-1&&e[t][0]===e[0][0]&&e[t][1]===e[0][1]||(Pt(i,e[t],"EPSG:3857"),Wr[s]?(Wr[s].x=i[0],Wr[s].y=i[1]):Wr[s]=new Jr(i[0],i[1]),o.push(Wr[s]),s++);Rr.calculateSignedArea(o)<0&&(o=o.reverse());const a=function(t){let e,n=Number.MAX_VALUE;const r=function(t,r,i,o,s,a,l,u){var h=Hr(t,r,s,a),c=Hr(i,o,s,a),f=Hr(l,u,t,r),p=Hr(l,u,i,o),d=h.distance(c)*h.distance(f);0!==d&&d<n&&(e=[h,f,p,c],n=d)};var i=[];for(let e=0;e<t.length;e++)i.push(t[(e+1)%t.length].diff(t[e])),i[e].normalize();var o,s,a,l,u=new Jr(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),h=new Jr(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);for(let e=0;e<t.length;e++){var c=t[e];c.x<u.x&&(u.x=c.x,o=e),c.x>h.x&&(h.x=c.x,s=e),c.y<u.y&&(u.y=c.y,l=e),c.y>h.y&&(h.y=c.y,a=e)}var f=new Jr(0,-1),p=new Jr(0,1),d=new Jr(-1,0),g=new Jr(1,0);for(let e=0;e<t.length;e++){var y=[Math.acos(f.dot(i[o])),Math.acos(p.dot(i[s])),Math.acos(d.dot(i[a])),Math.acos(g.dot(i[l]))];switch(y.indexOf(Math.min.apply(Math,y))){case 0:(p=(f=i[o].clone()).clone()).negate(),(g=(d=f.orthogonal()).clone()).negate(),o=(o+1)%t.length;break;case 1:(f=(p=i[s].clone()).clone()).negate(),(g=(d=f.orthogonal()).clone()).negate(),s=(s+1)%t.length;break;case 2:(g=(d=i[a].clone()).clone()).negate(),(p=(f=g.orthogonal()).clone()).negate(),a=(a+1)%t.length;break;case 3:(d=(g=i[l].clone()).clone()).negate(),(p=(f=g.orthogonal()).clone()).negate(),l=(l+1)%t.length}r(t[o],f,t[s],p,t[a],d,t[l],g)}return e}(o);if(!a||4!==a.length)return null;const l=a[0].distance(a[1]),u=a[1].distance(a[2]),h=a.map((t=>[t.x,t.y]));return h.push(+(u>l)),h}catch(t){return null}}const ti=[];function ei(t,e){const n=Array.isArray(t&&t[0]&&t[0][0]);for(let r=0;r<t.length;r++)n?t[r]=ei(t[r]):(Pt(ti,t[r],e),t[r][0]=ti[0],t[r][1]=ti[1]);return t}const{PackUtil:ni}=ne();class ri extends kn{constructor(t,e,n,r,i,o){super(t,e,n,r,i),(e=e||{}).extent||(e.extent=8192),this.setData(e.data,o)}setData(t,e){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 e();const n={maxZoom:24,tolerance:this.options.simplifyTolerance,extent:this.options.extent,buffer:S(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&&(n.projection=this.options.projection,"EPSG:4490"===n.projection&&(n.projection="EPSG:4326")),A(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),e(t)),!i)return void e(null,{extent:null,idMap:{}});let o=i;if(this.options.convertFn){o=new Function("data",this.options.convertFn+"\\nreturn convert(data)")(o)}const s=Array.isArray(o)?o:o.features;this._genOMBB(s);const{sample1000:a,idMap:l}=this._generateId(s);this._generate(a,l,o,n,e)}))}else{"string"==typeof t&&(t=JSON.parse(t));const r=Array.isArray(t)?t:t.features,i=r&&r.length;this._genOMBB(r);let o=r;if(r&&i>1e3){o=[];for(let t=0;t<i;t++)ii(r[t],o,t,i)}this._generate(o,null,t,n,e)}}_genOMBB(t){if(this.options.generateOMBB&&t)for(let e=0;e<t.length;e++){const n=t[e];if(n&&n.geometry&&n.geometry.coordinates)if("Polygon"===n.geometry.type){const t=n.geometry.coordinates[0];if(!t)continue;const e=Qr(t,t.length);n.properties=n.properties||{},n.properties[ee]=e}else if("MultiPolygon"===n.geometry.type){const t=n.geometry.coordinates;for(let e=0;e<t.length;e++){if(!t[e])continue;const r=t[e][0];if(!r)continue;const i=Qr(r,r.length);n.properties=n.properties||{},n.properties[ee]=n.properties[ee]||[],n.properties[ee][e]=i}}}}_generate(t,e,n,r,i){try{const o=t&&t.length?function(t){let e=[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY];switch(t.type){case"FeatureCollection":const n=t.features.length;for(let r=0;r<n;r++)Zn(t.features[r],e);break;case"Feature":Zn(t,e);break;default:Gn(t,e)}return e}({type:"FeatureCollection",features:t}):null;this.index=function(t,e){return new ut(t,e)}(n,this.options.geojsonvt||r),i(null,{extent:o,idMap:e})}catch(t){console.warn(t),i({error:t.message})}}_generateId(t){const e=[],n={};let r=0;const i=this.options.featureIdProperty;if(t){const o=t.length;t.forEach(((t,s)=>{!function(t,o,s){if(t&&("Feature"!==t.type||t.geometry)){if(S(t.id)||(t.id=r++),i){let e=i;F(i)&&(e=i[t.layer||"0"]),t.id=t.properties[e]}n[t.id]=I({},t),t.geometry?(n[t.id].geometry=I({},t.geometry),n[t.id].geometry.coordinates=null):t.coordinates&&(n[t.id].coordinates=null),ii(t,e,o,s)}}(t,s,o)}))}return{sample1000:e,idMap:n}}getTileFeatures(t,e){const n=t.tileInfo,r=[];if(!this.index)return this.empty?(setTimeout((function(){e(null,r,[])}),1),1):(setTimeout((function(){e({loading:!0})}),1),1);const i=this.index.getTile(n.z,n.x,n.y);if(!i||0===i.features.length)return setTimeout((function(){e(null,r,[])}),1),1;const o=[];for(let t=0,e=i.features.length;t<e;t++){const e=i.features[t];let n=e.layer;void 0===n&&(n="0"),o[n]={types:{}};o[n].types[e.type]=1,e.tags=e.tags||{},e.geometry.converted||(ni.convertGeometry(e),e.geometry.converted=1),r.push({type:e.type,layer:n,id:e.id,geometry:e.geometry,properties:e.tags,extent:this.options.extent})}for(const t in o)o[t].types=Object.keys(o[t].types).map((t=>+t));return setTimeout((function(){e(null,r,o)}),1),1}onRemove(){super.onRemove(),delete this.index}}function ii(t,e,n,r){const i=Math.floor(r/998);(0===n||n===r-1||(0===i||n%i==0)&&e.length<999)&&e.push(t)}var oi={\n/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */\nread:function(t,e,n,r,i){var o,s,a=8*i-r-1,l=(1<<a)-1,u=l>>1,h=-7,c=n?i-1:0,f=n?-1:1,p=t[e+c];for(c+=f,o=p&(1<<-h)-1,p>>=-h,h+=a;h>0;o=256*o+t[e+c],c+=f,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=r;h>0;s=256*s+t[e+c],c+=f,h-=8);if(0===o)o=1-u;else{if(o===l)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,r),o-=u}return(p?-1:1)*s*Math.pow(2,o-r)},write:function(t,e,n,r,i,o){var s,a,l,u=8*o-i-1,h=(1<<u)-1,c=h>>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:o-1,d=r?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=h):(s=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-s))<1&&(s--,l*=2),(e+=s+c>=1?f/l:f*Math.pow(2,1-c))*l>=2&&(s++,l/=2),s+c>=h?(a=0,s=h):s+c>=1?(a=(e*l-1)*Math.pow(2,i),s+=c):(a=e*Math.pow(2,c-1)*Math.pow(2,i),s=0));i>=8;t[n+p]=255&a,p+=d,a/=256,i-=8);for(s=s<<i|a,u+=i;u>0;t[n+p]=255&s,p+=d,s/=256,u-=8);t[n+p-d]|=128*g}},si=li,ai=oi;function li(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}li.Varint=0,li.Fixed64=1,li.Bytes=2,li.Fixed32=5;var ui=4294967296,hi=1/ui,ci="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function fi(t){return t.type===li.Bytes?t.readVarint()+t.pos:t.pos+1}function pi(t,e,n){return n?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function di(t,e,n){var r=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));n.realloc(r);for(var i=n.pos-1;i>=t;i--)n.buf[i+r]=n.buf[i]}function gi(t,e){for(var n=0;n<t.length;n++)e.writeVarint(t[n])}function yi(t,e){for(var n=0;n<t.length;n++)e.writeSVarint(t[n])}function xi(t,e){for(var n=0;n<t.length;n++)e.writeFloat(t[n])}function mi(t,e){for(var n=0;n<t.length;n++)e.writeDouble(t[n])}function vi(t,e){for(var n=0;n<t.length;n++)e.writeBoolean(t[n])}function wi(t,e){for(var n=0;n<t.length;n++)e.writeFixed32(t[n])}function Mi(t,e){for(var n=0;n<t.length;n++)e.writeSFixed32(t[n])}function bi(t,e){for(var n=0;n<t.length;n++)e.writeFixed64(t[n])}function Pi(t,e){for(var n=0;n<t.length;n++)e.writeSFixed64(t[n])}function _i(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+16777216*t[e+3]}function Ii(t,e,n){t[n]=e,t[n+1]=e>>>8,t[n+2]=e>>>16,t[n+3]=e>>>24}function Ai(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}li.prototype={destroy:function(){this.buf=null},readFields:function(t,e,n){for(n=n||this.length;this.pos<n;){var r=this.readVarint(),i=r>>3,o=this.pos;this.type=7&r,t(i,e,this),this.pos===o&&this.skip(r)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=_i(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=Ai(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=_i(this.buf,this.pos)+_i(this.buf,this.pos+4)*ui;return this.pos+=8,t},readSFixed64:function(){var t=_i(this.buf,this.pos)+Ai(this.buf,this.pos+4)*ui;return this.pos+=8,t},readFloat:function(){var t=ai.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=ai.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,n,r=this.buf;return e=127&(n=r[this.pos++]),n<128?e:(e|=(127&(n=r[this.pos++]))<<7,n<128?e:(e|=(127&(n=r[this.pos++]))<<14,n<128?e:(e|=(127&(n=r[this.pos++]))<<21,n<128?e:function(t,e,n){var r,i,o=n.buf;if(i=o[n.pos++],r=(112&i)>>4,i<128)return pi(t,r,e);if(i=o[n.pos++],r|=(127&i)<<3,i<128)return pi(t,r,e);if(i=o[n.pos++],r|=(127&i)<<10,i<128)return pi(t,r,e);if(i=o[n.pos++],r|=(127&i)<<17,i<128)return pi(t,r,e);if(i=o[n.pos++],r|=(127&i)<<24,i<128)return pi(t,r,e);if(i=o[n.pos++],r|=(1&i)<<31,i<128)return pi(t,r,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(n=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,e=this.pos;return this.pos=t,t-e>=12&&ci?function(t,e,n){return ci.decode(t.subarray(e,n))}(this.buf,e,t):function(t,e,n){var r="",i=e;for(;i<n;){var o,s,a,l=t[i],u=null,h=l>239?4:l>223?3:l>191?2:1;if(i+h>n)break;1===h?l<128&&(u=l):2===h?128==(192&(o=t[i+1]))&&(u=(31&l)<<6|63&o)<=127&&(u=null):3===h?(o=t[i+1],s=t[i+2],128==(192&o)&&128==(192&s)&&((u=(15&l)<<12|(63&o)<<6|63&s)<=2047||u>=55296&&u<=57343)&&(u=null)):4===h&&(o=t[i+1],s=t[i+2],a=t[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&((u=(15&l)<<18|(63&o)<<12|(63&s)<<6|63&a)<=65535||u>=1114112)&&(u=null)),null===u?(u=65533,h=1):u>65535&&(u-=65536,r+=String.fromCharCode(u>>>10&1023|55296),u=56320|1023&u),r+=String.fromCharCode(u),i+=h}return r}(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==li.Bytes)return t.push(this.readVarint(e));var n=fi(this);for(t=t||[];this.pos<n;)t.push(this.readVarint(e));return t},readPackedSVarint:function(t){if(this.type!==li.Bytes)return t.push(this.readSVarint());var e=fi(this);for(t=t||[];this.pos<e;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==li.Bytes)return t.push(this.readBoolean());var e=fi(this);for(t=t||[];this.pos<e;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==li.Bytes)return t.push(this.readFloat());var e=fi(this);for(t=t||[];this.pos<e;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==li.Bytes)return t.push(this.readDouble());var e=fi(this);for(t=t||[];this.pos<e;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==li.Bytes)return t.push(this.readFixed32());var e=fi(this);for(t=t||[];this.pos<e;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==li.Bytes)return t.push(this.readSFixed32());var e=fi(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==li.Bytes)return t.push(this.readFixed64());var e=fi(this);for(t=t||[];this.pos<e;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==li.Bytes)return t.push(this.readSFixed64());var e=fi(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed64());return t},skip:function(t){var e=7&t;if(e===li.Varint)for(;this.buf[this.pos++]>127;);else if(e===li.Bytes)this.pos=this.readVarint()+this.pos;else if(e===li.Fixed32)this.pos+=4;else{if(e!==li.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e<this.pos+t;)e*=2;if(e!==this.length){var n=new Uint8Array(e);n.set(this.buf),this.buf=n,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(t){this.realloc(4),Ii(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),Ii(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),Ii(this.buf,-1&t,this.pos),Ii(this.buf,Math.floor(t*hi),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),Ii(this.buf,-1&t,this.pos),Ii(this.buf,Math.floor(t*hi),this.pos+4),this.pos+=8},writeVarint:function(t){(t=+t||0)>268435455||t<0?function(t,e){var n,r;t>=0?(n=t%4294967296|0,r=t/4294967296|0):(r=~(-t/4294967296),4294967295^(n=~(-t%4294967296))?n=n+1|0:(n=0,r=r+1|0));if(t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,n){n.buf[n.pos++]=127&t|128,t>>>=7,n.buf[n.pos++]=127&t|128,t>>>=7,n.buf[n.pos++]=127&t|128,t>>>=7,n.buf[n.pos++]=127&t|128,t>>>=7,n.buf[n.pos]=127&t}(n,0,e),function(t,e){var n=(7&t)<<4;if(e.buf[e.pos++]|=n|((t>>>=3)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;e.buf[e.pos++]=127&t}(r,e)}(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 e=this.pos;this.pos=function(t,e,n){for(var r,i,o=0;o<e.length;o++){if((r=e.charCodeAt(o))>55295&&r<57344){if(!i){r>56319||o+1===e.length?(t[n++]=239,t[n++]=191,t[n++]=189):i=r;continue}if(r<56320){t[n++]=239,t[n++]=191,t[n++]=189,i=r;continue}r=i-55296<<10|r-56320|65536,i=null}else i&&(t[n++]=239,t[n++]=191,t[n++]=189,i=null);r<128?t[n++]=r:(r<2048?t[n++]=r>>6|192:(r<65536?t[n++]=r>>12|224:(t[n++]=r>>18|240,t[n++]=r>>12&63|128),t[n++]=r>>6&63|128),t[n++]=63&r|128)}return n}(this.buf,t,this.pos);var n=this.pos-e;n>=128&&di(e,n,this),this.pos=e-1,this.writeVarint(n),this.pos+=n},writeFloat:function(t){this.realloc(4),ai.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),ai.write(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var n=0;n<e;n++)this.buf[this.pos++]=t[n]},writeRawMessage:function(t,e){this.pos++;var n=this.pos;t(e,this);var r=this.pos-n;r>=128&&di(n,r,this),this.pos=n-1,this.writeVarint(r),this.pos+=r},writeMessage:function(t,e,n){this.writeTag(t,li.Bytes),this.writeRawMessage(e,n)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,gi,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,yi,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,vi,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,xi,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,mi,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,wi,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,Mi,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,bi,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,Pi,e)},writeBytesField:function(t,e){this.writeTag(t,li.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,li.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,li.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,li.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,li.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,li.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,li.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,li.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,li.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,li.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}};var Si=yr(si),Ti=Fi;function Fi(t,e){this.x=t,this.y=e}Fi.prototype={clone:function(){return new Fi(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},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 e=t.x-this.x,n=t.y-this.y;return e*e+n*n},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,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[0]*this.x+t[1]*this.y,n=t[2]*this.x+t[3]*this.y;return this.x=e,this.y=n,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),n=Math.sin(t),r=e*this.x-n*this.y,i=n*this.x+e*this.y;return this.x=r,this.y=i,this},_rotateAround:function(t,e){var n=Math.cos(t),r=Math.sin(t),i=e.x+n*(this.x-e.x)-r*(this.y-e.y),o=e.y+r*(this.x-e.x)+n*(this.y-e.y);return this.x=i,this.y=o,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},Fi.convert=function(t){return t instanceof Fi?t:Array.isArray(t)?new Fi(t[0],t[1]):t};var ki=Ti,Bi=Li;function Li(t,e,n,r,i){this.properties={},this.extent=n,this.type=0,this._pbf=t,this._geometry=-1,this._keys=r,this._values=i,t.readFields(Ci,this,e)}function Ci(t,e,n){1==t?e.id=n.readVarint():2==t?function(t,e){var n=t.readVarint()+t.pos;for(;t.pos<n;){var r=e._keys[t.readVarint()],i=e._values[t.readVarint()];e.properties[r]=i}}(n,e):3==t?e.type=n.readVarint():4==t&&(e._geometry=n.pos)}function Yi(t){for(var e,n,r=0,i=0,o=t.length,s=o-1;i<o;s=i++)e=t[i],r+=((n=t[s]).x-e.x)*(e.y+n.y);return r}Li.types=["Unknown","Point","LineString","Polygon"],Li.prototype.loadGeometry=function(){var t=this._pbf;t.pos=this._geometry;for(var e,n=t.readVarint()+t.pos,r=1,i=0,o=0,s=0,a=[];t.pos<n;){if(i<=0){var l=t.readVarint();r=7&l,i=l>>3}if(i--,1===r||2===r)o+=t.readSVarint(),s+=t.readSVarint(),1===r&&(e&&a.push(e),e=[]),e.push(new ki(o,s));else{if(7!==r)throw new Error("unknown command "+r);e&&e.push(e[0].clone())}}return e&&a.push(e),a},Li.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,n=1,r=0,i=0,o=0,s=1/0,a=-1/0,l=1/0,u=-1/0;t.pos<e;){if(r<=0){var h=t.readVarint();n=7&h,r=h>>3}if(r--,1===n||2===n)(i+=t.readSVarint())<s&&(s=i),i>a&&(a=i),(o+=t.readSVarint())<l&&(l=o),o>u&&(u=o);else if(7!==n)throw new Error("unknown command "+n)}return[s,l,a,u]},Li.prototype.toGeoJSON=function(t,e,n){var r,i,o=this.extent*Math.pow(2,n),s=this.extent*t,a=this.extent*e,l=this.loadGeometry(),u=Li.types[this.type];function h(t){for(var e=0;e<t.length;e++){var n=t[e],r=180-360*(n.y+a)/o;t[e]=[360*(n.x+s)/o-180,360/Math.PI*Math.atan(Math.exp(r*Math.PI/180))-90]}}switch(this.type){case 1:var c=[];for(r=0;r<l.length;r++)c[r]=l[r][0];h(l=c);break;case 2:for(r=0;r<l.length;r++)h(l[r]);break;case 3:for(l=function(t){var e=t.length;if(e<=1)return[t];for(var n,r,i=[],o=0;o<e;o++){var s=Yi(t[o]);0!==s&&(void 0===r&&(r=s<0),r===s<0?(n&&i.push(n),n=[t[o]]):n.push(t[o]))}n&&i.push(n);return i}(l),r=0;r<l.length;r++)for(i=0;i<l[r].length;i++)h(l[r][i])}1===l.length?l=l[0]:u="Multi"+u;var f={type:"Feature",geometry:{type:u,coordinates:l},properties:this.properties};return"id"in this&&(f.id=this.id),f};var Vi=Bi,Oi=Xi;function Xi(t,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(Ni,this,e),this.length=this._features.length}function Ni(t,e,n){15===t?e.version=n.readVarint():1===t?e.name=n.readString():5===t?e.extent=n.readVarint():2===t?e._features.push(n.pos):3===t?e._keys.push(n.readString()):4===t&&e._values.push(function(t){var e=null,n=t.readVarint()+t.pos;for(;t.pos<n;){var r=t.readVarint()>>3;e=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 e}(n))}Xi.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var e=this._pbf.readVarint()+this._pbf.pos;return new Vi(this._pbf,e,this.extent,this._keys,this._values)};var Ei=Oi,zi=function(t,e){this.layers=t.readFields($i,{},e)};function $i(t,e,n){if(3===t){var r=new Ei(n,n.readVarint()+n.pos);r.length&&(e[r.name]=r)}}var Di=zi;const qi=2,ji=new TextDecoder("utf-8");class Zi extends kn{constructor(t,e,n,r,i,o){super(t,e,n,r,i),e=e||{},o()}getTileFeatures(t,e){const n=t.tileInfo.url,r=t.fetchOptions||{},{altitudePropertyName:i,disableAltitudeWarning:o}=t,s=this._cache.get(n);if(s&&s.cacheIndex===t.workerCacheIndex){const{err:t,data:r}=s;return setTimeout((()=>{this._readTile(n,i,o,t,r,e)}),1)}const{tileArrayBuffer:a}=t;return a?setTimeout((()=>{this._readTile(n,i,o,null,a,e)}),1):(r.referrer=t.referrer,C.getArrayBuffer(n,r,((r,s)=>{this._cache&&(r?r.loading||this._cache.add(n,{err:r,data:s&&s.data,cacheIndex:t.workerCacheIndex}):s&&s.data&&this._cache.add(n,{err:null,data:s.data,cacheIndex:t.workerCacheIndex}),this._readTile(n,i,o,r,s&&s.data,e))})))}_readTile(t,e,n,r,i,o){if(r)return void o(r);let s;try{s=new Di(new Si(i))}catch(r){const e=ji.decode(i);return r.message+="\\n"+t+"\\n"+e,void o(r.message,[],[])}const a=[];if(!s.layers)return void o(null,a,[]);const l={};let u;for(const t in s.layers)if(h=s.layers,c=t,Object.prototype.hasOwnProperty.call(h,c)){l[t]={types:{}};const i=l[t].types;for(let o=0,l=s.layers[t].length;o<l;o++)try{u=s.layers[t].feature(o),i[u.type]=1;const r={type:u.type,layer:t,geometry:u.loadGeometry(),properties:u.properties,extent:u.extent};void 0!==u.id&&(r.id=u.id);let l=r.properties[ee];l&&(A(l)&&(l=JSON.parse(l)),r.properties[ee]=ei(l,"EPSG:3857"));const h=e&&r.properties[e];if(h){const t=Gi(h),e=[];Ui(r.geometry,t,e),e.length&&!n&&(console.warn("feature.geometry is not consistent with altitude values:"),console.warn(JSON.stringify(r,null,2)))}a.push(r)}catch(r){console.warn("error when load vt geometry:",r)}}var h,c;for(const t in l)l[t].types=Object.keys(l[t].types).map((t=>+t));o(null,a,l,{byteLength:i.byteLength})}abortTile(t,e){const n=this.requests[t];delete this.requests[t],n&&n.abort&&n.abort(),this._cancelLoadings(t),e()}onRemove(){super.onRemove();for(const t in this.requests){const e=this.requests[t];e&&e.abort&&e.abort()}this.requests={}}}function Gi(t){const e=atob(t),n=new Uint8Array(e.length);for(let t=0;t<e.length;t++)n[t]=e.charCodeAt(t);return new Float32Array(n.buffer)}function Ui(t,e,n,r){r||(r={index:0});for(let i=0;i<t.length;i++)if(Array.isArray(t[i]))Ui(t[i],e,n,r);else{const o=r.index;k(e[o])?n.push(qi):t[i].z=100*e[o],r.index++}}const{LRUCache:Ri}=ne();let Ji=0;const Hi=new Ri(128);class Wi{constructor(t){this._layers={},this._callbacks={},this.workerId=t}addLayer({actorId:t,mapId:e,layerId:n,params:r},i){if(this._getLayerById(e,n))return;const o=this._genKey(e,n),s=r.type,a=r.options,l=this.send.bind(this,t);this._layers[o]="GeoJSONVectorTileLayer"===s?new ri(n,a,l,Hi,{},i):new Zi(n,a,l,Hi,{},i)}removeLayer({mapId:t,layerId:e},n){const r=this._getLayerById(t,e),i=this._genKey(t,e);delete this._layers[i],r&&r.onRemove(n)}loadTile({mapId:t,layerId:e,params:n},r){const i=this._getLayerById(t,e);i&&i.loadTile(n,r)}abortTile({mapId:t,layerId:e,params:n},r){const i=this._getLayerById(t,e);i&&i.abortTile&&i.abortTile(n.url,r)}removeTile({mapId:t,layerId:e,params:n},r){const i=this._getLayerById(t,e);i&&i.removeTile(n,r)}updateStyle({mapId:t,layerId:e,params:n},r){const i=this._getLayerById(t,e);i&&i.updateStyle(n,r)}updateOptions({mapId:t,layerId:e,params:n},r){const i=this._getLayerById(t,e);i&&i.updateOptions(n,r)}setData({mapId:t,layerId:e,params:n},r){const i=this._getLayerById(t,e);i&&i.setData(n.data,r)}receive(t){const e=t.callback,n=this._callbacks[e];delete this._callbacks[e],n&&t.error?n(new Error(t.error)):n&&n(null,t.data)}send(t,e,n,r,i){const o=i?\`${E}t}-${E}Ji++}\`:null;i&&(this._callbacks[o]=i),postMessage({type:"<request>",workerId:this.workerId,actorId:t,command:e,params:n,callback:String(o)},r||[])}_genKey(t,e){return\`${E}t}-${E}e}\`}_getLayerById(t,e){const n=this._genKey(t,e);return this._layers[n]}_resetCache(){Hi.reset()}}t.initialize=function(){},t.onmessage=function(t,e){const n=t.data;if(this.dispatcher||(this.dispatcher=new Wi(t.workerId)),"<response>"===t.type)this.dispatcher.workerId===t.workerId&&this.dispatcher.receive(t);else{const r=n.command;this.dispatcher[r]({actorId:t.actorId,mapId:n.mapId,layerId:n.layerId,params:n.params},((t,n,i)=>{t&&404!==t.status&&204!==t.status&&!t.loading&&console.error(r,t),e(t,n,i)}))}}}`;
35
35
 
36
36
  function L(e) {
37
37
  const t = function() {
@@ -396,7 +396,7 @@ function L(e) {
396
396
  let i = n;
397
397
  return t && e && (i = +e[t]), isNaN(i) && (i = n || 0), 100 * i;
398
398
  }
399
- function S(e, t, n, i, r, s, o) {
399
+ function w(e, t, n, i, r, s, o) {
400
400
  t || 0 === t || (t = 1);
401
401
  const a = T(e.properties, n, i), l = a * t;
402
402
  let h = (s ? 100 * s : 0) || a;
@@ -406,7 +406,7 @@ function L(e) {
406
406
  height: h
407
407
  };
408
408
  }
409
- function w(e, t) {
409
+ function S(e, t) {
410
410
  return t < 1 / 0 && (e.x < 0 || e.x > t || e.y < 0 || e.y > t);
411
411
  }
412
412
  function M(e) {
@@ -1074,9 +1074,9 @@ function L(e) {
1074
1074
  }, ve.to.keyword = function(e) {
1075
1075
  return xe[e.slice(0, 3)];
1076
1076
  };
1077
- var Te = le.exports, Se = {
1077
+ var Te = le.exports, we = {
1078
1078
  exports: {}
1079
- }, we = {
1079
+ }, Se = {
1080
1080
  aliceblue: [ 240, 248, 255 ],
1081
1081
  antiquewhite: [ 250, 235, 215 ],
1082
1082
  aqua: [ 0, 255, 255 ],
@@ -1226,8 +1226,8 @@ function L(e) {
1226
1226
  yellow: [ 255, 255, 0 ],
1227
1227
  yellowgreen: [ 154, 205, 50 ]
1228
1228
  }, Me = {};
1229
- for (var Pe in we) we.hasOwnProperty(Pe) && (Me[we[Pe]] = Pe);
1230
- var Ie = Se.exports = {
1229
+ for (var Pe in Se) Se.hasOwnProperty(Pe) && (Me[Se[Pe]] = Pe);
1230
+ var Ie = we.exports = {
1231
1231
  rgb: {
1232
1232
  channels: 3,
1233
1233
  labels: "rgb"
@@ -1320,13 +1320,13 @@ function L(e) {
1320
1320
  var t = Me[e];
1321
1321
  if (t) return t;
1322
1322
  var n, i, r, s = 1 / 0;
1323
- for (var o in we) if (we.hasOwnProperty(o)) {
1324
- var a = (i = e, r = we[o], Math.pow(i[0] - r[0], 2) + Math.pow(i[1] - r[1], 2) + Math.pow(i[2] - r[2], 2));
1323
+ for (var o in Se) if (Se.hasOwnProperty(o)) {
1324
+ var a = (i = e, r = Se[o], Math.pow(i[0] - r[0], 2) + Math.pow(i[1] - r[1], 2) + Math.pow(i[2] - r[2], 2));
1325
1325
  a < s && (s = a, n = o);
1326
1326
  }
1327
1327
  return n;
1328
1328
  }, Ie.keyword.rgb = function(e) {
1329
- return we[e];
1329
+ return Se[e];
1330
1330
  }, Ie.rgb.xyz = function(e) {
1331
1331
  var t = e[0] / 255, n = e[1] / 255, i = e[2] / 255;
1332
1332
  return [ 100 * (.4124 * (t = t > .04045 ? Math.pow((t + .055) / 1.055, 2.4) : t / 12.92) + .3576 * (n = n > .04045 ? Math.pow((n + .055) / 1.055, 2.4) : n / 12.92) + .1805 * (i = i > .04045 ? Math.pow((i + .055) / 1.055, 2.4) : i / 12.92)), 100 * (.2126 * t + .7152 * n + .0722 * i), 100 * (.0193 * t + .1192 * n + .9505 * i) ];
@@ -1531,7 +1531,7 @@ function L(e) {
1531
1531
  }, Ie.rgb.gray = function(e) {
1532
1532
  return [ (e[0] + e[1] + e[2]) / 3 / 255 * 100 ];
1533
1533
  };
1534
- var Oe = Se.exports, Re = Oe;
1534
+ var Oe = we.exports, Re = Oe;
1535
1535
  function Ee(e, t) {
1536
1536
  return function(n) {
1537
1537
  return t(e(n));
@@ -2006,7 +2006,7 @@ function L(e) {
2006
2006
  if (!e) return "true";
2007
2007
  const t = e[0];
2008
2008
  if (e.length <= 1) return "any" === t ? "false" : "true";
2009
- const n = "==" === t ? bt(e[1], e[2], "===", !1) : "!=" === t ? bt(e[1], e[2], "!==", !1) : "<" === t || ">" === t || "<=" === t || ">=" === t ? bt(e[1], e[2], t, !0) : "any" === t ? Tt(e.slice(1), "||") : "all" === t ? Tt(e.slice(1), "&&") : "none" === t ? Mt(Tt(e.slice(1), "||")) : "in" === t ? St(e[1], e.slice(2)) : "!in" === t ? Mt(St(e[1], e.slice(2))) : "has" === t ? wt(e[1]) : "!has" === t ? Mt(wt(e[1])) : "contains" === t ? function(e, t, n) {
2009
+ const n = "==" === t ? bt(e[1], e[2], "===", !1) : "!=" === t ? bt(e[1], e[2], "!==", !1) : "<" === t || ">" === t || "<=" === t || ">=" === t ? bt(e[1], e[2], t, !0) : "any" === t ? Tt(e.slice(1), "||") : "all" === t ? Tt(e.slice(1), "&&") : "none" === t ? Mt(Tt(e.slice(1), "||")) : "in" === t ? wt(e[1], e.slice(2)) : "!in" === t ? Mt(wt(e[1], e.slice(2))) : "has" === t ? St(e[1]) : "!has" === t ? Mt(St(e[1])) : "contains" === t ? function(e, t, n) {
2010
2010
  const i = vt(e);
2011
2011
  return void 0 !== n ? `(${i} + '').indexOf("${t}") === ${n}` : `(${i} + '').indexOf("${t}") >= 0`;
2012
2012
  }(e[1], e[2], e[3]) : "true";
@@ -2031,12 +2031,12 @@ function L(e) {
2031
2031
  function Tt(e, t) {
2032
2032
  return e.map(_t).join(t);
2033
2033
  }
2034
- function St(e, t) {
2034
+ function wt(e, t) {
2035
2035
  "$type" === e && (t = t.map((e => yt.indexOf(e))));
2036
2036
  const n = JSON.stringify(t.sort(Pt)), i = vt(e);
2037
2037
  return t.length <= 200 ? `${n}.indexOf(${i}) !== -1` : `function(v, a, i, j) {\n while (i <= j) { var m = (i + j) >> 1;\n if (a[m] === v) return true; if (a[m] > v) j = m - 1; else i = m + 1;\n }\n return false; }(${i}, ${n},0,${t.length - 1})`;
2038
2038
  }
2039
- function wt(e) {
2039
+ function St(e) {
2040
2040
  return "$id" === e ? '"id" in f' : `${JSON.stringify(e)} in p`;
2041
2041
  }
2042
2042
  function Mt(e) {
@@ -2082,14 +2082,14 @@ function L(e) {
2082
2082
  r--) : i.push(t);
2083
2083
  return i;
2084
2084
  }
2085
- function S(e) {
2085
+ function w(e) {
2086
2086
  return b(e, (function(e) {
2087
2087
  var t = "";
2088
2088
  return e > 65535 && (t += _((e -= 65536) >>> 10 & 1023 | 55296), e = 56320 | 1023 & e),
2089
2089
  t + _(e);
2090
2090
  })).join("");
2091
2091
  }
2092
- function w(e, t) {
2092
+ function S(e, t) {
2093
2093
  return e + 22 + 75 * (e < 26) - ((0 != t) << 5);
2094
2094
  }
2095
2095
  function M(e, t, n) {
@@ -2108,7 +2108,7 @@ function L(e) {
2108
2108
  b = M(y - s, t = g.length + 1, 0 == s), x(y / t) > l - _ && v("overflow"), _ += x(y / t),
2109
2109
  y %= t, g.splice(y++, 0, _);
2110
2110
  }
2111
- return S(g);
2111
+ return w(g);
2112
2112
  }
2113
2113
  function I(e) {
2114
2114
  var t, n, i, r, s, o, a, u, f, d, p, g, m, y, b, A = [];
@@ -2118,8 +2118,8 @@ function L(e) {
2118
2118
  for (a - t > x((l - n) / (m = i + 1)) && v("overflow"), n += (a - t) * m, t = a,
2119
2119
  o = 0; o < g; ++o) if ((p = e[o]) < t && ++n > l && v("overflow"), p == t) {
2120
2120
  for (u = n, f = h; !(u < (d = f <= s ? 1 : f >= s + c ? c : f - s)); f += h) b = u - d,
2121
- y = h - d, A.push(_(w(d + b % y, 0))), u = x(b / y);
2122
- A.push(_(w(u, 0))), s = M(n, m, i == r), n = 0, ++i;
2121
+ y = h - d, A.push(_(S(d + b % y, 0))), u = x(b / y);
2122
+ A.push(_(S(u, 0))), s = M(n, m, i == r), n = 0, ++i;
2123
2123
  }
2124
2124
  ++n, ++t;
2125
2125
  }
@@ -2129,7 +2129,7 @@ function L(e) {
2129
2129
  version: "1.3.2",
2130
2130
  ucs2: {
2131
2131
  decode: T,
2132
- encode: S
2132
+ encode: w
2133
2133
  },
2134
2134
  decode: P,
2135
2135
  encode: I,
@@ -2757,7 +2757,7 @@ function L(e) {
2757
2757
  "to-number": Lt,
2758
2758
  "to-string": Ht
2759
2759
  };
2760
- class Sn {
2760
+ class wn {
2761
2761
  constructor(e, t) {
2762
2762
  this.type = e, this.args = t;
2763
2763
  }
@@ -2771,7 +2771,7 @@ function L(e) {
2771
2771
  if (!i) return null;
2772
2772
  r.push(i);
2773
2773
  }
2774
- return new Sn(i, r);
2774
+ return new wn(i, r);
2775
2775
  }
2776
2776
  evaluate(e) {
2777
2777
  if ("boolean" === this.type.kind) return Boolean(this.args[0].evaluate(e));
@@ -2818,7 +2818,7 @@ function L(e) {
2818
2818
  })), e;
2819
2819
  }
2820
2820
  }
2821
- var wn = Sn;
2821
+ var Sn = wn;
2822
2822
  const Mn = [ "Unknown", "Point", "LineString", "Polygon" ];
2823
2823
  var Pn = class {
2824
2824
  constructor() {
@@ -3176,7 +3176,7 @@ function L(e) {
3176
3176
  }
3177
3177
  _parse(e, t) {
3178
3178
  function n(e, t, n) {
3179
- return "assert" === n ? new vn(t, [ e ]) : "coerce" === n ? new wn(t, [ e ]) : e;
3179
+ return "assert" === n ? new vn(t, [ e ]) : "coerce" === n ? new Sn(t, [ e ]) : e;
3180
3180
  }
3181
3181
  if (null !== e && "string" != typeof e && "boolean" != typeof e && "number" != typeof e || (e = [ "literal", e ]),
3182
3182
  Array.isArray(e)) {
@@ -3227,7 +3227,7 @@ function L(e) {
3227
3227
  if (e instanceof Cn && "error" === e.name) return !1;
3228
3228
  if (e instanceof kn) return !1;
3229
3229
  if (e instanceof qn) return !1;
3230
- const t = e instanceof wn || e instanceof vn;
3230
+ const t = e instanceof Sn || e instanceof vn;
3231
3231
  let n = !0;
3232
3232
  return e.eachChild((e => {
3233
3233
  n = t ? n && ii(e) : n && e instanceof mn;
@@ -3359,17 +3359,17 @@ function L(e) {
3359
3359
  alpha: e.a
3360
3360
  };
3361
3361
  }
3362
- function Si(e) {
3362
+ function wi(e) {
3363
3363
  let t = (e.l + 16) / 116, n = isNaN(e.a) ? t : t + e.a / 500, i = isNaN(e.b) ? t : t - e.b / 200;
3364
3364
  return t = 1 * vi(t), n = ui * vi(n), i = fi * vi(i), new on(bi(3.2404542 * n - 1.5371385 * t - .4985314 * i), bi(-.969266 * n + 1.8760108 * t + .041556 * i), bi(.0556434 * n - .2040259 * t + 1.0572252 * i), e.alpha);
3365
3365
  }
3366
- function wi(e, t, n) {
3366
+ function Si(e, t, n) {
3367
3367
  const i = t - e;
3368
3368
  return e + n * (i > 180 || i < -180 ? i - 360 * Math.round(i / 360) : i);
3369
3369
  }
3370
3370
  const Mi = {
3371
3371
  forward: Ti,
3372
- reverse: Si,
3372
+ reverse: wi,
3373
3373
  interpolate: function(e, t, n) {
3374
3374
  return {
3375
3375
  l: hi(e.l, t.l, n),
@@ -3390,7 +3390,7 @@ function L(e) {
3390
3390
  },
3391
3391
  reverse: function(e) {
3392
3392
  const t = e.h * yi, n = e.c;
3393
- return Si({
3393
+ return wi({
3394
3394
  l: e.l,
3395
3395
  a: Math.cos(t) * n,
3396
3396
  b: Math.sin(t) * n,
@@ -3399,7 +3399,7 @@ function L(e) {
3399
3399
  },
3400
3400
  interpolate: function(e, t, n) {
3401
3401
  return {
3402
- h: wi(e.h, t.h, n),
3402
+ h: Si(e.h, t.h, n),
3403
3403
  c: hi(e.c, t.c, n),
3404
3404
  l: hi(e.l, t.l, n),
3405
3405
  alpha: hi(e.alpha, t.alpha, n)
@@ -3989,10 +3989,10 @@ function L(e) {
3989
3989
  slice: Yi,
3990
3990
  step: oi,
3991
3991
  string: vn,
3992
- "to-boolean": wn,
3993
- "to-color": wn,
3994
- "to-number": wn,
3995
- "to-string": wn,
3992
+ "to-boolean": Sn,
3993
+ "to-color": Sn,
3994
+ "to-number": Sn,
3995
+ "to-string": Sn,
3996
3996
  var: ei,
3997
3997
  within: qn
3998
3998
  };
@@ -4312,10 +4312,10 @@ function L(e) {
4312
4312
  }
4313
4313
  }
4314
4314
  }
4315
- function Sr(e) {
4315
+ function wr(e) {
4316
4316
  return Array.isArray(e) && e.length > 0 && "string" == typeof e[0] && e[0] in cr;
4317
4317
  }
4318
- function wr(e, t) {
4318
+ function Sr(e, t) {
4319
4319
  const n = new ni(cr, [], t ? function(e) {
4320
4320
  const t = {
4321
4321
  color: zt,
@@ -4359,7 +4359,7 @@ function L(e) {
4359
4359
  }
4360
4360
  }
4361
4361
  function Ir(e, t) {
4362
- if ("error" === (e = wr(e, t)).result) return e;
4362
+ if ("error" === (e = Sr(e, t)).result) return e;
4363
4363
  const n = e.value.expression, i = $n(n);
4364
4364
  if (!i && !function(e) {
4365
4365
  return "data-driven" === e["property-type"];
@@ -4428,13 +4428,13 @@ function L(e) {
4428
4428
  } catch (e) {
4429
4429
  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${JSON.stringify(n, null, 2)}\n `);
4430
4430
  }
4431
- const r = wr(i, null);
4431
+ const r = Sr(i, null);
4432
4432
  let s = null;
4433
4433
  if ("error" === r.result) throw new Error(r.value.map((e => `${e.key}: ${e.message}`)).join(", "));
4434
4434
  s = (e, t, n) => r.value.evaluate(e, t, {}, n);
4435
4435
  let o = null, a = null;
4436
4436
  if (i !== n) {
4437
- const e = wr(n, null);
4437
+ const e = Sr(n, null);
4438
4438
  if ("error" === e.result) throw new Error(e.value.map((e => `${e.key}: ${e.message}`)).join(", "));
4439
4439
  o = (t, n, i, r, s) => e.value.evaluate(t, n, {}, i, void 0, void 0, r, s), a = !$n(e.value.expression);
4440
4440
  }
@@ -4487,7 +4487,7 @@ function L(e) {
4487
4487
  }
4488
4488
  const Nr = {
4489
4489
  StyleExpression: Tr,
4490
- isExpression: Sr,
4490
+ isExpression: wr,
4491
4491
  isExpressionFilter: function e(t) {
4492
4492
  if (!0 === t || !1 === t) return !0;
4493
4493
  if (!Array.isArray(t) || 0 === t.length) return !1;
@@ -4520,11 +4520,11 @@ function L(e) {
4520
4520
  return !0;
4521
4521
  }
4522
4522
  },
4523
- createExpression: wr,
4523
+ createExpression: Sr,
4524
4524
  createPropertyExpression: Ir,
4525
4525
  normalizePropertyExpression: function(e, t) {
4526
4526
  if (gr(e)) return new Cr(e, t);
4527
- if (Sr(e)) {
4527
+ if (wr(e)) {
4528
4528
  const n = Ir(e, t);
4529
4529
  if ("error" === n.result) throw new Error(n.value.map((e => `${e.key}: ${e.message}`)).join(", "));
4530
4530
  return n.value;
@@ -4864,7 +4864,7 @@ function L(e) {
4864
4864
  if (Array.isArray(r.geometry) && r.properties) {
4865
4865
  let t = r.geometry[0];
4866
4866
  for (;Array.isArray(t); ) t = t[0];
4867
- Je(t.x) || (n = e);
4867
+ t && !Je(t.x) && (n = e);
4868
4868
  }
4869
4869
  if (!n) if (n = [], Array.isArray(r.geometry)) for (let t = 0; t < e.length; t++) {
4870
4870
  const i = $e({}, e[t]);
@@ -4876,6 +4876,15 @@ function L(e) {
4876
4876
  i[t] = r[t], n.push(i);
4877
4877
  }
4878
4878
  }
4879
+ if (this.options.altitudeProperty) for (let e = 0; e < n.length; e++) {
4880
+ const t = n[e];
4881
+ if (!t || !t.geometry || 1 !== t.type && 4 !== t.type) continue;
4882
+ const i = this.getAltitude(t.properties);
4883
+ if (i) for (let e = 0; e < t.geometry.length; e++) {
4884
+ const n = t.geometry[e];
4885
+ if (n && n.length) for (let e = 0; e < n.length; e++) n[e].z += i;
4886
+ }
4887
+ }
4879
4888
  if (this.maxPosZ = 0, this.minPosZ = 0, !this.options.forceAltitudeAttribute) {
4880
4889
  const e = "line" === this.symbolDef.textPlacement;
4881
4890
  let t = -1 / 0, i = 1 / 0, r = !1;
@@ -5173,8 +5182,8 @@ function L(e) {
5173
5182
  function Ts(e) {
5174
5183
  return e || "Open Sans Regular";
5175
5184
  }
5176
- const Ss = /\{[\w-]+(?:\|[\w-]+)*\}/g;
5177
- function ws(e, t) {
5185
+ const ws = /\{[\w-]+(?:\|[\w-]+)*\}/g;
5186
+ function Ss(e, t) {
5178
5187
  if (!et(e)) return e;
5179
5188
  function n(e) {
5180
5189
  if (!t) return As;
@@ -5224,9 +5233,9 @@ function L(e) {
5224
5233
  resolveExpVarNames: function e(t, n) {
5225
5234
  if (2 !== n.length || "get" !== n[0]) for (let i = 0; i < n.length; i++) 2 === n[i].length && "get" === n[i][0] ? t.push(n[i][1]) : Array.isArray(n[i]) && e(t, n[i]); else t.push(n[1]);
5226
5235
  },
5227
- resolveText: ws,
5236
+ resolveText: Ss,
5228
5237
  resolveText_bak: function(e, t) {
5229
- return et(e) ? e.replace(Ss, (function(e) {
5238
+ return et(e) ? e.replace(ws, (function(e) {
5230
5239
  if (!t) return "";
5231
5240
  if ((e = e.substring(1, e.length - 1)).indexOf("|") > 0) {
5232
5241
  const n = e.split("|");
@@ -5241,7 +5250,7 @@ function L(e) {
5241
5250
  })) : e;
5242
5251
  },
5243
5252
  resolveVarNames: function(e) {
5244
- return e.match(Ss);
5253
+ return e.match(ws);
5245
5254
  },
5246
5255
  templateKeys: Ms
5247
5256
  });
@@ -5632,7 +5641,7 @@ function L(e) {
5632
5641
  }
5633
5642
  getIconAndGlyph() {
5634
5643
  if (this.iconGlyph) return this.iconGlyph;
5635
- const {markerFileFn: e, markerTypeFn: t, markerPathFn: n, markerWidthFn: i, markerHeightFn: r, markerFillFn: s, markerFillPatternFileFn: o, markerFillOpacityFn: a, markerTextFitFn: l, markerTextFitPaddingFn: h, markerLineColorFn: c, markerLineWidthFn: u, markerLineOpacityFn: f, markerLineDasharrayFn: d, markerLinePatternFileFn: p, markerPathWidthFn: g, markerPathHeightFn: m, textNameFn: y, textFaceNameFn: x} = this._fnTypes, {zoom: _} = this.options, v = {}, b = this.symbol, A = this.symbolDef, T = this.feature.properties, S = e ? e(null, T) : b.markerFile, w = t ? t(null, T) : b.markerType, M = S || w || b.markerPath, P = !Je(this.symbolDef.textName);
5644
+ const {markerFileFn: e, markerTypeFn: t, markerPathFn: n, markerWidthFn: i, markerHeightFn: r, markerFillFn: s, markerFillPatternFileFn: o, markerFillOpacityFn: a, markerTextFitFn: l, markerTextFitPaddingFn: h, markerLineColorFn: c, markerLineWidthFn: u, markerLineOpacityFn: f, markerLineDasharrayFn: d, markerLinePatternFileFn: p, markerPathWidthFn: g, markerPathHeightFn: m, textNameFn: y, textFaceNameFn: x} = this._fnTypes, {zoom: _} = this.options, v = {}, b = this.symbol, A = this.symbolDef, T = this.feature.properties, w = e ? e(null, T) : b.markerFile, S = t ? t(null, T) : b.markerType, M = w || S || b.markerPath, P = !Je(this.symbolDef.textName);
5636
5645
  let I, C;
5637
5646
  if (M) {
5638
5647
  I = function(e, t, n, i, r, s) {
@@ -5649,7 +5658,7 @@ function L(e) {
5649
5658
  const t = A.textSize;
5650
5659
  let n = A.textName;
5651
5660
  ie(n) && (n = re(n)(_, T));
5652
- const i = ws(n, T);
5661
+ const i = Ss(n, T);
5653
5662
  if (i) {
5654
5663
  const n = "__fn_textSize".trim(), r = "__fn_textSize_0".trim();
5655
5664
  ie(t) && !A[n] && (A[r] = re(t), A[n] = (e, t) => {
@@ -5669,9 +5678,9 @@ function L(e) {
5669
5678
  if (I && (I[0] = Math.ceil(I[0]), I[1] = Math.ceil(I[1])), C && (C[0] = Math.ceil(C[0]),
5670
5679
  C[1] = Math.ceil(C[1])), this.iconSize = I, this.textSize = C, M && I[0] >= 0 && I[1] >= 0) {
5671
5680
  let e;
5672
- if (w) {
5681
+ if (S) {
5673
5682
  const t = {};
5674
- if (t.markerType = w, "path" === w && (t.markerPath = n ? n(null, T) : b.markerPath,
5683
+ if (t.markerType = S, "path" === S && (t.markerPath = n ? n(null, T) : b.markerPath,
5675
5684
  t.markerPathWidth = g ? g(null, T) : b.markerPathWidth, t.markerPathHeight = m ? m(null, T) : b.markerPathHeight),
5676
5685
  i) {
5677
5686
  const e = i(null, T);
@@ -5714,7 +5723,7 @@ function L(e) {
5714
5723
  Je(e) || (t.markerLinePatternFile = e);
5715
5724
  } else b.markerLinePatternFile && (t.markerLinePatternFile = b.markerLinePatternFile);
5716
5725
  e = "vector://" + JSON.stringify(t);
5717
- } else e = S ? S.replace($s, this._thisReplacer) : b.markerPath ? function(e, t, n) {
5726
+ } else e = w ? w.replace($s, this._thisReplacer) : b.markerPath ? function(e, t, n) {
5718
5727
  if (!e.markerPath) return null;
5719
5728
  let i = 1;
5720
5729
  const r = function(e) {
@@ -5767,7 +5776,7 @@ function L(e) {
5767
5776
  const e = y ? y(this.options.zoom, T) : b.textName;
5768
5777
  if (e || 0 === e) {
5769
5778
  const t = Ts(x ? x(null, T) : b.textFaceName);
5770
- let n = ws(e, T);
5779
+ let n = Ss(e, T);
5771
5780
  n && n.length && (n = qs(n), v.glyph = {
5772
5781
  font: t,
5773
5782
  text: n
@@ -6047,37 +6056,37 @@ function L(e) {
6047
6056
  const a = o[e];
6048
6057
  if ("vertex" === t) for (let e = 0; e < a.length; e++) {
6049
6058
  const t = a[e];
6050
- for (let o = 0; o < t.length; o++) w(t[o], n) || (s.push(t[o]), i && (0 === o ? xo(t[o], t[o], t[e + 1], r) : xo(t[o], t[o - 1], t[o], r)));
6059
+ for (let o = 0; o < t.length; o++) S(t[o], n) || (s.push(t[o]), i && (0 === o ? xo(t[o], t[o], t[e + 1], r) : xo(t[o], t[o - 1], t[o], r)));
6051
6060
  } else if ("vertex-first" === t) {
6052
6061
  const e = a[0];
6053
- e && e[0] && !w(e[0], n) && (s.push(e[0]), i && xo(e[0], e[0], e[1], r));
6062
+ e && e[0] && !S(e[0], n) && (s.push(e[0]), i && xo(e[0], e[0], e[1], r));
6054
6063
  } else if ("vertex-last" === t || "vertex-firstlast" === t) {
6055
6064
  const e = a[0];
6056
- if ("vertex-firstlast" === t && e && e[0] && !w(e[0], n) && (s.push(e[0]), i && xo(e[0], e[0], e[1], r)),
6057
- e && e[e.length - 1] && !w(e[e.length - 1], n)) {
6065
+ if ("vertex-firstlast" === t && e && e[0] && !S(e[0], n) && (s.push(e[0]), i && xo(e[0], e[0], e[1], r)),
6066
+ e && e[e.length - 1] && !S(e[e.length - 1], n)) {
6058
6067
  const t = e.length - 1;
6059
6068
  s.push(e[t]), i && xo(e[t], e[t - 1], e[t], r);
6060
6069
  }
6061
6070
  } else {
6062
6071
  const e = fo(a, 16);
6063
- w(e, n) || s.push(e);
6072
+ S(e, n) || s.push(e);
6064
6073
  }
6065
6074
  }
6066
6075
  } else if (2 === e.type) for (let o = 0; o < e.geometry.length; o++) {
6067
6076
  const a = e.geometry[o];
6068
- if ("vertex" === t) for (let e = 0; e < a.length; e++) w(a[e], n) || (s.push(a[e]),
6077
+ if ("vertex" === t) for (let e = 0; e < a.length; e++) S(a[e], n) || (s.push(a[e]),
6069
6078
  i && (0 === e ? xo(a[e], a[e], a[e + 1], r) : xo(a[e], a[e - 1], a[e], r))); else if ("vertex-last" === t || "vertex-firstlast" === t) {
6070
- if ("vertex-firstlast" !== t || w(a[0], n) || (s.push(a[0]), i && xo(a[0], a[0], a[1], r)),
6071
- a && a[a.length - 1] && !w(a[a.length - 1], n)) {
6079
+ if ("vertex-firstlast" !== t || S(a[0], n) || (s.push(a[0]), i && xo(a[0], a[0], a[1], r)),
6080
+ a && a[a.length - 1] && !S(a[a.length - 1], n)) {
6072
6081
  const e = a.length - 1;
6073
6082
  s.push(a[e]), i && xo(a[e], a[e - 1], a[e], r);
6074
6083
  }
6075
- } else w(a[0], n) || (s.push(a[0]), i && xo(a[0], a[0], a[1], r));
6084
+ } else S(a[0], n) || (s.push(a[0]), i && xo(a[0], a[0], a[1], r));
6076
6085
  } else if (1 === e.type) for (let t = 0; t < e.geometry.length; t++) {
6077
6086
  const r = e.geometry[t];
6078
6087
  for (let e = 0; e < r.length; e++) {
6079
6088
  const t = r[e];
6080
- w(t, n) || (i && (t.xRotation = 0, t.yRotation = 0, t.zRotation = 0), s.push(t));
6089
+ S(t, n) || (i && (t.xRotation = 0, t.yRotation = 0, t.zRotation = 0), s.push(t));
6081
6090
  }
6082
6091
  }
6083
6092
  return s;
@@ -6415,7 +6424,7 @@ function L(e) {
6415
6424
  E && (pe = 255 * (E(this.options.zoom, d) || 0));
6416
6425
  const ge = Y && Y.length || 0;
6417
6426
  this.ensureDataCapacity(4 * (ge + (Z && Z.length || 0)), l.length);
6418
- const me = this.options.EXTENT, {altitudeScale: ye, altitudeProperty: xe, defaultAltitude: _e} = this.options, {altitude: ve} = S(e.feature, ye, xe, _e), be = this.needAltitudeAttribute(), Ae = (e, t, n, i, r, s, o) => {
6427
+ const me = this.options.EXTENT, {altitudeScale: ye, altitudeProperty: xe, defaultAltitude: _e} = this.options, {altitude: ve} = w(e.feature, ye, xe, _e), be = this.needAltitudeAttribute(), Ae = (e, t, n, i, r, s, o) => {
6419
6428
  if (!t) return;
6420
6429
  const a = e ? ge : 1;
6421
6430
  for (let l = 0; l < t.length; l++) {
@@ -6436,7 +6445,7 @@ function L(e) {
6436
6445
  }, Te = "text" === this.options.pluginType;
6437
6446
  for (let e = 0; e < l.length; e++) {
6438
6447
  const t = l[e], n = t.z || ve || 0;
6439
- if (me !== 1 / 0 && w(t, me)) continue;
6448
+ if (me !== 1 / 0 && S(t, me)) continue;
6440
6449
  const i = t.x, r = t.y;
6441
6450
  m && Ae(!1, Z, i, r, n, t), g && (Te || Ae(!0, Y, i, r, n, t, !0), Ae(!0, Y, i, r, n, t, !1));
6442
6451
  }
@@ -6463,7 +6472,7 @@ function L(e) {
6463
6472
  }
6464
6473
  }
6465
6474
  _fillFnTypeData(e, t, n, i, r, s, o, a, l, h, c, u, f, d, p, g, m, y, x, _, v, b) {
6466
- const {textFillFn: A, textSizeFn: T, textHaloFillFn: S, textHaloRadiusFn: w, textDxFn: P, textDyFn: I, textPitchAlignmentFn: C, textRotationAlignmentFn: k, textRotationFn: F, textAllowOverlapFn: O, textIgnorePlacementFn: R, textOpacityFn: E, textHaloOpacityFn: D, markerWidthFn: L, markerHeightFn: H, markerDxFn: N, markerDyFn: z, markerPitchAlignmentFn: V, markerRotationAlignmentFn: U, markerRotationFn: B, markerAllowOverlapFn: G, markerIgnorePlacementFn: j, markerOpacityFn: W} = this._fnTypes;
6475
+ const {textFillFn: A, textSizeFn: T, textHaloFillFn: w, textHaloRadiusFn: S, textDxFn: P, textDyFn: I, textPitchAlignmentFn: C, textRotationAlignmentFn: k, textRotationFn: F, textAllowOverlapFn: O, textIgnorePlacementFn: R, textOpacityFn: E, textHaloOpacityFn: D, markerWidthFn: L, markerHeightFn: H, markerDxFn: N, markerDyFn: z, markerPitchAlignmentFn: V, markerRotationAlignmentFn: U, markerRotationFn: B, markerAllowOverlapFn: G, markerIgnorePlacementFn: j, markerOpacityFn: W} = this._fnTypes;
6467
6476
  if (A) {
6468
6477
  let n = e.aTextFill.currentIndex;
6469
6478
  e.aTextFill[n++] = t[0], e.aTextFill[n++] = t[1], e.aTextFill[n++] = t[2], e.aTextFill[n++] = t[3],
@@ -6473,12 +6482,12 @@ function L(e) {
6473
6482
  let t = e.aTextSize.currentIndex;
6474
6483
  e.aTextSize[t++] = n, e.aTextSize.currentIndex = t;
6475
6484
  }
6476
- if (S) {
6485
+ if (w) {
6477
6486
  let t = e.aTextHaloFill.currentIndex;
6478
6487
  e.aTextHaloFill[t++] = i[0], e.aTextHaloFill[t++] = i[1], e.aTextHaloFill[t++] = i[2],
6479
6488
  e.aTextHaloFill[t++] = i[3], e.aTextHaloFill.currentIndex = t;
6480
6489
  }
6481
- if (w || D) {
6490
+ if (S || D) {
6482
6491
  let t = e.aTextHalo.currentIndex;
6483
6492
  e.aTextHalo[t++] = r || 0, e.aTextHalo.currentIndex = t, t = e.aTextHalo.currentIndex,
6484
6493
  e.aTextHalo[t++] = 255 * (M(s) ? 1 : s), e.aTextHalo.currentIndex = t;
@@ -6664,7 +6673,7 @@ function L(e) {
6664
6673
  return Math.atan2(this.y - e.y, this.x - e.x);
6665
6674
  }
6666
6675
  }
6667
- var So, wo = "undefined" != typeof Float32Array ? Float32Array : Array;
6676
+ var wo, So = "undefined" != typeof Float32Array ? Float32Array : Array;
6668
6677
  function Mo(e, t, n, i) {
6669
6678
  return e[0] = t, e[1] = n, e[2] = i, e;
6670
6679
  }
@@ -6689,13 +6698,13 @@ function L(e) {
6689
6698
  Math.hypot || (Math.hypot = function() {
6690
6699
  for (var e = 0, t = arguments.length; t--; ) e += arguments[t] * arguments[t];
6691
6700
  return Math.sqrt(e);
6692
- }), So = new wo(3), wo != Float32Array && (So[0] = 0, So[1] = 0, So[2] = 0), function() {
6693
- var e = new wo(4);
6694
- wo != Float32Array && (e[0] = 0, e[1] = 0, e[2] = 0, e[3] = 0);
6701
+ }), wo = new So(3), So != Float32Array && (wo[0] = 0, wo[1] = 0, wo[2] = 0), function() {
6702
+ var e = new So(4);
6703
+ So != Float32Array && (e[0] = 0, e[1] = 0, e[2] = 0, e[3] = 0);
6695
6704
  }();
6696
6705
  !function() {
6697
- var e = new wo(2);
6698
- wo != Float32Array && (e[0] = 0, e[1] = 0);
6706
+ var e = new So(2);
6707
+ So != Float32Array && (e[0] = 0, e[1] = 0);
6699
6708
  }();
6700
6709
  const Oo = 63, Ro = Math.cos(Math.PI / 180 * 37.5), Eo = Math.pow(2, 16) / 1, Do = new s, Lo = new s, Ho = new s;
6701
6710
  class No extends gs {
@@ -6895,7 +6904,7 @@ function L(e) {
6895
6904
  y = y || x, d.currentNormal = y;
6896
6905
  let l = y.add(x);
6897
6906
  0 === l.x && 0 === l.y || l._unit();
6898
- const _ = y.x * x.x + y.y * x.y, v = l.x * x.x + l.y * x.y, b = 0 !== v ? 1 / v : 1 / 0, A = 2 * Math.sqrt(2 - 2 * v), T = v < Ro && g && m, S = y.x * x.y - y.y * x.x > 0;
6907
+ const _ = y.x * x.x + y.y * x.y, v = l.x * x.x + l.y * x.y, b = 0 !== v ? 1 / v : 1 / 0, A = 2 * Math.sqrt(2 - 2 * v), T = v < Ro && g && m, w = y.x * x.y - y.y * x.x > 0;
6899
6908
  if (!a && T && t > u) {
6900
6909
  const e = p.dist(g);
6901
6910
  if (e > 2 * f) {
@@ -6903,21 +6912,21 @@ function L(e) {
6903
6912
  t.z = p.z, this.updateDistance(g, t), this.addCurrentVertex(t, y, 0, 0, d), g = t;
6904
6913
  }
6905
6914
  }
6906
- const w = g && m;
6907
- d.middleVertex = w;
6908
- let M = w ? n : h ? "butt" : i;
6909
- if (w && "round" === M && (b < s ? M = "miter" : b <= 2 && (M = "fakeround")), "miter" === M && b > r && !a && (M = "bevel"),
6915
+ const S = g && m;
6916
+ d.middleVertex = S;
6917
+ let M = S ? n : h ? "butt" : i;
6918
+ if (S && "round" === M && (b < s ? M = "miter" : b <= 2 && (M = "fakeround")), "miter" === M && b > r && !a && (M = "bevel"),
6910
6919
  "bevel" === M && (b > 2 && (M = "flipbevel"), b < r && (M = "miter")), g && this.updateDistance(g, p),
6911
6920
  "miter" === M) a ? (this.addCurrentVertex(p, y, 0, 0, d), d.dir = m.sub(p)._unit(),
6912
6921
  this.addCurrentVertex(p, x, 0, 0, d)) : (l._mult(b), this.addCurrentVertex(p, l, 0, 0, d),
6913
6922
  o && (d.currentNormal = x, d.dir = m.sub(p)._unit(), this.addCurrentVertex(p, l, 0, 0, d))); else if ("flipbevel" === M) {
6914
6923
  if (b > 100) l = x.mult(-1); else {
6915
6924
  const e = b * y.add(x).mag() / y.sub(x).mag();
6916
- l._perp()._mult(e * (S ? -1 : 1));
6925
+ l._perp()._mult(e * (w ? -1 : 1));
6917
6926
  }
6918
6927
  this.addCurrentVertex(p, l, 0, 0, d), this.addCurrentVertex(p, l.mult(-1), 0, 0, d);
6919
6928
  } else if ("bevel" === M || "fakeround" === M) {
6920
- const e = -Math.sqrt(b * b - 1), t = S ? e : 0, n = S ? 0 : e;
6929
+ const e = -Math.sqrt(b * b - 1), t = w ? e : 0, n = w ? 0 : e;
6921
6930
  if (g && this.addCurrentVertex(p, y, t, n, d), "fakeround" === M) {
6922
6931
  const e = Math.round(180 * A / Math.PI / 20);
6923
6932
  for (let t = 1; t < e; t++) {
@@ -6926,8 +6935,8 @@ function L(e) {
6926
6935
  const e = n - .5;
6927
6936
  n += n * e * (n - 1) * ((1.0904 + _ * (_ * (3.55645 - 1.43519 * _) - 3.2452)) * e * e + (.848013 + _ * (.215638 * _ - 1.06021)));
6928
6937
  }
6929
- const i = x.sub(y)._mult(n)._add(y)._unit()._mult(S ? -1 : 1);
6930
- this.addHalfVertex(p, i.x, i.y, !1, S, 0, d);
6938
+ const i = x.sub(y)._mult(n)._add(y)._unit()._mult(w ? -1 : 1);
6939
+ this.addHalfVertex(p, i.x, i.y, !1, w, 0, d);
6931
6940
  }
6932
6941
  }
6933
6942
  m && (d.currentNormal = x, d.dir = m.sub(p)._unit(), this.addCurrentVertex(p, x, -t, -n, d));
@@ -7212,7 +7221,7 @@ function L(e) {
7212
7221
  let n = e;
7213
7222
  do {
7214
7223
  const i = n.prev, r = n.next.next;
7215
- !Ta(i, r) && Sa(i, n, n.next, r) && Pa(i, r) && Pa(r, i) && (t.push(i.i, n.i, r.i),
7224
+ !Ta(i, r) && wa(i, n, n.next, r) && Pa(i, r) && Pa(r, i) && (t.push(i.i, n.i, r.i),
7216
7225
  ka(n), ka(n.next), n = e = r), n = n.next;
7217
7226
  } while (n !== e);
7218
7227
  return la(n);
@@ -7291,7 +7300,7 @@ function L(e) {
7291
7300
  return e.next.i !== t.i && e.prev.i !== t.i && !function(e, t) {
7292
7301
  let n = e;
7293
7302
  do {
7294
- if (n.i !== e.i && n.next.i !== e.i && n.i !== t.i && n.next.i !== t.i && Sa(n, n.next, e, t)) return !0;
7303
+ if (n.i !== e.i && n.next.i !== e.i && n.i !== t.i && n.next.i !== t.i && wa(n, n.next, e, t)) return !0;
7295
7304
  n = n.next;
7296
7305
  } while (n !== e);
7297
7306
  return !1;
@@ -7311,11 +7320,11 @@ function L(e) {
7311
7320
  function Ta(e, t) {
7312
7321
  return e.x === t.x && e.y === t.y;
7313
7322
  }
7314
- function Sa(e, t, n, i) {
7323
+ function wa(e, t, n, i) {
7315
7324
  const r = Ma(Aa(e, t, n)), s = Ma(Aa(e, t, i)), o = Ma(Aa(n, i, e)), a = Ma(Aa(n, i, t));
7316
- return r !== s && o !== a || !(0 !== r || !wa(e, n, t)) || !(0 !== s || !wa(e, i, t)) || !(0 !== o || !wa(n, e, i)) || !(0 !== a || !wa(n, t, i));
7325
+ return r !== s && o !== a || !(0 !== r || !Sa(e, n, t)) || !(0 !== s || !Sa(e, i, t)) || !(0 !== o || !Sa(n, e, i)) || !(0 !== a || !Sa(n, t, i));
7317
7326
  }
7318
- function wa(e, t, n) {
7327
+ function Sa(e, t, n) {
7319
7328
  return t.x <= Math.max(e.x, n.x) && t.x >= Math.min(e.x, n.x) && t.y <= Math.max(e.y, n.y) && t.y >= Math.min(e.y, n.y);
7320
7329
  }
7321
7330
  function Ma(e) {
@@ -7611,7 +7620,7 @@ function L(e) {
7611
7620
  convertGeometry: N,
7612
7621
  convertRTLText: qs,
7613
7622
  generatePickingIndiceIndex: I,
7614
- getFeaAltitudeAndHeight: S,
7623
+ getFeaAltitudeAndHeight: w,
7615
7624
  getIndexArrayType: E,
7616
7625
  getPosArrayType: D,
7617
7626
  getUnsignedArrayType: L,
@@ -7851,7 +7860,7 @@ function L(e) {
7851
7860
  placeVector(e) {
7852
7861
  const t = e.feature;
7853
7862
  if (this._hasALineHeight) {
7854
- const {altitudeScale: e, altitudeProperty: n, defaultAltitude: i, heightProperty: r, defaultHeight: s, minHeightProperty: o} = this.options, {altitude: a, height: l} = S(t, e, n, i, r, s, o);
7863
+ const {altitudeScale: e, altitudeProperty: n, defaultAltitude: i, heightProperty: r, defaultHeight: s, minHeightProperty: o} = this.options, {altitude: a, height: l} = w(t, e, n, i, r, s, o);
7855
7864
  this.feaAltitude = a, this.feaMinHeight = (a - l) / a * 32767, a > this.maxAltitude && (this.maxAltitude = a);
7856
7865
  }
7857
7866
  return super.placeVector(e);
@@ -8312,9 +8321,7 @@ function q(e, t) {
8312
8321
  }
8313
8322
 
8314
8323
  function $(e, t) {
8315
- let n = t.altitudeToPoint(100, e);
8316
- const i = t.options.heightFactor;
8317
- return i && 1 !== i && (n /= i), n / 100 / 100;
8324
+ return t.altitudeToPoint(100, e) / 100 / 100;
8318
8325
  }
8319
8326
 
8320
8327
  function J(e, t, n) {
@@ -8650,7 +8657,7 @@ class se extends e.worker.Actor {
8650
8657
  command: "addLayer",
8651
8658
  params: {
8652
8659
  type: r,
8653
- options: n
8660
+ options: JSON.parse(JSON.stringify(n))
8654
8661
  }
8655
8662
  };
8656
8663
  this._isDedicated ? (void 0 === this._dedicatedVTWorkers[i] && (this._dedicatedVTWorkers[i] = this.getDedicatedWorker()),
@@ -8682,7 +8689,7 @@ class se extends e.worker.Actor {
8682
8689
  mapId: this._mapId,
8683
8690
  layerId: n,
8684
8691
  command: "updateStyle",
8685
- params: e
8692
+ params: JSON.parse(JSON.stringify(e))
8686
8693
  };
8687
8694
  this._isDedicated ? void 0 !== this._dedicatedVTWorkers[n] && this.send(i, null, t, this._dedicatedVTWorkers[n]) : this.broadcast(i, null, t);
8688
8695
  }
@@ -8691,7 +8698,7 @@ class se extends e.worker.Actor {
8691
8698
  mapId: this._mapId,
8692
8699
  layerId: n,
8693
8700
  command: "updateOptions",
8694
- params: e
8701
+ params: JSON.parse(JSON.stringify(e))
8695
8702
  };
8696
8703
  this._isDedicated ? void 0 !== this._dedicatedVTWorkers[n] && this.send(i, null, t, this._dedicatedVTWorkers[n]) : this.broadcast(i, null, t);
8697
8704
  }
@@ -8955,7 +8962,7 @@ function _e(t, n, i, r, s, o) {
8955
8962
  for (let l = 0, h = (n || t).length; l < h; l++) {
8956
8963
  let h = n ? t[n[l]] : t[l];
8957
8964
  "id" === s.options.features && s.getFeature && (h = s.getFeature(h), h.layer = i),
8958
- s instanceof e.TileLayer && (h = Se(h, o));
8965
+ s instanceof e.TileLayer && (h = we(h, o));
8959
8966
  a[n ? n[l] : h[xe]] = {
8960
8967
  feature: h,
8961
8968
  symbol: r
@@ -8974,7 +8981,7 @@ const ve = "__original_properties", be = "__external_properties", Ae = {
8974
8981
  }
8975
8982
  }, Te = {};
8976
8983
 
8977
- function Se(e, t) {
8984
+ function we(e, t) {
8978
8985
  const n = e.properties;
8979
8986
  if (n && n[ve]) return e;
8980
8987
  t && (e = U({}, e)), e.customProps = e.customProps || {};
@@ -8983,7 +8990,7 @@ function Se(e, t) {
8983
8990
  e;
8984
8991
  }
8985
8992
 
8986
- function we(e) {
8993
+ function Se(e) {
8987
8994
  for (let t = 1; t < arguments.length; t++) {
8988
8995
  const n = arguments[t];
8989
8996
  for (const t in n) e[t] = n[t];
@@ -9006,7 +9013,25 @@ function Ie(e) {
9006
9013
  }
9007
9014
 
9008
9015
  function Ce(e) {
9009
- return JSON.parse(JSON.stringify(e));
9016
+ const t = JSON.parse(JSON.stringify(e));
9017
+ if (Array.isArray(e)) for (let n = 0; n < e.length; n++) {
9018
+ if (!t[n]) continue;
9019
+ const {symbol: i} = t[n];
9020
+ if (!i) continue;
9021
+ const r = e[n].symbol;
9022
+ for (const e in r) i[e] || (i[e] = r[e]);
9023
+ } else if (e) {
9024
+ if (e.style) {
9025
+ const n = Ce(e.style);
9026
+ return t.style = n, t;
9027
+ }
9028
+ if (e.symbol) {
9029
+ const n = Ce(e.symbol);
9030
+ return t.symbol = n, t;
9031
+ }
9032
+ for (const n in e) t[n] || (t[n] = e[n]);
9033
+ }
9034
+ return t;
9010
9035
  }
9011
9036
 
9012
9037
  function ke(e, t, n, i, r, s) {
@@ -9157,13 +9182,10 @@ class $e extends e.renderer.TileLayerCanvasRenderer {
9157
9182
  const a = o.updateSymbol(n, s[t].symbol);
9158
9183
  return !a && et(n) && this.setStyle(), this.setToRedraw(), a;
9159
9184
  }
9160
- needToRedraw() {
9161
- const e = super.needToRedraw();
9162
- if (!e) {
9163
- const e = this._getFramePlugins();
9164
- for (let t = 0; t < e.length; t++) if (e[t] && e[t].needToRedraw()) return !0;
9165
- }
9166
- return e;
9185
+ testIfNeedRedraw() {
9186
+ const e = this._getFramePlugins();
9187
+ for (let t = 0; t < e.length; t++) if (e[t] && e[t].needToRedraw()) return !0;
9188
+ return super.testIfNeedRedraw();
9167
9189
  }
9168
9190
  needRetireFrames() {
9169
9191
  if (this._needRetire) return !0;
@@ -9319,6 +9341,9 @@ class $e extends e.renderer.TileLayerCanvasRenderer {
9319
9341
  isForeground(e) {
9320
9342
  return !(!this._vtCurrentTiles || !this._vtCurrentTiles[e.properties.tile.id]);
9321
9343
  }
9344
+ getCurrentTiles() {
9345
+ return this._vtCurrentTiles;
9346
+ }
9322
9347
  _getTileZoomDiff(t) {
9323
9348
  const n = this.layer;
9324
9349
  let i = n._getTileZoom(this.getMap().getZoom());
@@ -9381,12 +9406,20 @@ class $e extends e.renderer.TileLayerCanvasRenderer {
9381
9406
  return $(this.layer.getSpatialReference().getResolution(e), t);
9382
9407
  }
9383
9408
  getRenderedFeatures() {
9384
- const e = [], t = this.tileCache.keys();
9385
- for (let n = 0; n < t.length; n++) {
9386
- const i = this.tileCache.get(t[n]);
9409
+ const e = this.tileCache.keys();
9410
+ return this._getFeaturesByKeys(e);
9411
+ }
9412
+ getCurrentRenderedFeatures() {
9413
+ const e = this._vtCurrentTiles && Object.keys(this._vtCurrentTiles);
9414
+ return this._getFeaturesByKeys(e);
9415
+ }
9416
+ _getFeaturesByKeys(e) {
9417
+ const t = [];
9418
+ for (let n = 0; n < e.length; n++) {
9419
+ const i = this.tileCache.get(e[n]);
9387
9420
  if (!i || !i.info || !i.image) continue;
9388
9421
  const {info: r, image: s} = i, o = nt(s);
9389
- e.push({
9422
+ t.push({
9390
9423
  tile: {
9391
9424
  id: r.id,
9392
9425
  x: r.x,
@@ -9398,7 +9431,7 @@ class $e extends e.renderer.TileLayerCanvasRenderer {
9398
9431
  features: o
9399
9432
  });
9400
9433
  }
9401
- return e;
9434
+ return t;
9402
9435
  }
9403
9436
  _onReceiveMVTData(e, t, n) {
9404
9437
  if (this.setToRedraw(), !this._requestingMVT[e]) return;
@@ -9771,6 +9804,7 @@ class $e extends e.renderer.TileLayerCanvasRenderer {
9771
9804
  if (!s || n && !n(s)) return;
9772
9805
  if (!u[o]) return;
9773
9806
  if (!r[o]) return;
9807
+ if (this.drawingParentTiles && !s.painter.shouldDrawParentTile()) return;
9774
9808
  const f = i && Ze(s), d = this.regl, p = this.gl, g = {
9775
9809
  regl: d,
9776
9810
  layer: this.layer,
@@ -9836,7 +9870,8 @@ class $e extends e.renderer.TileLayerCanvasRenderer {
9836
9870
  if (!this.layer.isVisible()) return i;
9837
9871
  return this._getFramePlugins().forEach((r => {
9838
9872
  if (!r) return;
9839
- if (!this._isVisible(r)) return;
9873
+ if (!1 === (r.painter && r.painter.sceneConfig).picking) return;
9874
+ if (!r.isVisible()) return;
9840
9875
  const s = r.pick(e, t, n.tolerance);
9841
9876
  s && (s.type = r.getType(), i.push(s));
9842
9877
  })), i;
@@ -10367,7 +10402,7 @@ class ht extends e.TileLayer {
10367
10402
  }
10368
10403
  queryTerrainTiles(e) {
10369
10404
  const t = this.getRenderer(), n = t && t.getTerrainHelper();
10370
- return t && n ? n.getTerrainTiles(e) : null;
10405
+ return t && n ? n.getTerrainTiles(this, e) : null;
10371
10406
  }
10372
10407
  _setStyle(e) {
10373
10408
  if (e && e.$root) {
@@ -10394,8 +10429,7 @@ class ht extends e.TileLayer {
10394
10429
  featureStyle: o
10395
10430
  };
10396
10431
  return e.$root && (a.$root = e.$root), a;
10397
- }(e = JSON.parse(JSON.stringify(e))), this._originFeatureStyle = e.featureStyle || [],
10398
- this._featureStyle = function(e) {
10432
+ }(e = Ce(e)), this._originFeatureStyle = e.featureStyle || [], this._featureStyle = function(e) {
10399
10433
  if (!e || !Array.isArray(e)) return [];
10400
10434
  const t = [];
10401
10435
  for (let n = 0; n < e.length; n++) {
@@ -10434,6 +10468,15 @@ class ht extends e.TileLayer {
10434
10468
  getTotalPolygonOffset() {
10435
10469
  return this._totalPolygonOffset;
10436
10470
  }
10471
+ _convertTileFeatuers(e) {
10472
+ for (let t = 0, n = e.length; t < n; t++) {
10473
+ const n = e[t];
10474
+ if (!n) continue;
10475
+ const i = n.features || [];
10476
+ this._convertFeatures(i);
10477
+ }
10478
+ return e;
10479
+ }
10437
10480
  _convertFeatures(e) {
10438
10481
  if (!e || !e.length) return;
10439
10482
  const t = this._getTileConfig();
@@ -10448,17 +10491,17 @@ class ht extends e.TileLayer {
10448
10491
  r.geometry = f;
10449
10492
  }
10450
10493
  }
10494
+ getCurrentRenderedFeatures() {
10495
+ const e = this.getRenderer();
10496
+ if (!e) return [];
10497
+ const t = e.getCurrentRenderedFeatures() || [];
10498
+ return this._convertTileFeatuers(t);
10499
+ }
10451
10500
  getRenderedFeatures() {
10452
10501
  const e = this.getRenderer();
10453
10502
  if (!e) return [];
10454
10503
  const t = e.getRenderedFeatures() || [];
10455
- for (let e = 0, n = t.length; e < n; e++) {
10456
- const n = t[e];
10457
- if (!n) continue;
10458
- const i = n.features || [];
10459
- this._convertFeatures(i);
10460
- }
10461
- return t;
10504
+ return this._convertTileFeatuers(t);
10462
10505
  }
10463
10506
  getRenderedFeaturesAsync(t = {}) {
10464
10507
  return new Promise(((n, i) => {
@@ -11008,7 +11051,7 @@ const yt = {
11008
11051
  let _t = 1;
11009
11052
 
11010
11053
  function vt(e, t) {
11011
- const n = w.extend(e, {
11054
+ const n = S.extend(e, {
11012
11055
  init: function() {
11013
11056
  this._meshCache = {};
11014
11057
  },
@@ -11030,7 +11073,7 @@ function vt(e, t) {
11030
11073
  }
11031
11074
  this._meshCache || (this._meshCache = {});
11032
11075
  const l = r.excludes;
11033
- this._excludes ? l !== this._excludes && (this._excludesFunc = l ? S(l) : null,
11076
+ this._excludes ? l !== this._excludes && (this._excludesFunc = l ? w(l) : null,
11034
11077
  this._excludes = l) : l && (this._excludes = l), a.startFrame(e), this._frameCache = {};
11035
11078
  },
11036
11079
  updateCollision: function(e) {
@@ -11298,12 +11341,12 @@ function bt(e) {
11298
11341
  }(e)), e.empty);
11299
11342
  }
11300
11343
 
11301
- const {StyleUtil: At} = H(), Tt = "_fn_type_", St = "__current_fn_types";
11344
+ const {StyleUtil: At} = H(), Tt = "_fn_type_", wt = "__current_fn_types";
11302
11345
 
11303
- function wt(e, t, n, i) {
11346
+ function St(e, t, n, i) {
11304
11347
  if (!bt(e.properties.features)) for (let r = 0; r < n.length; r++) {
11305
11348
  const {symbolName: s} = n[r];
11306
- (e[St] = e[St] || {})[s] = t[s], Mt(e, t, n[r], i);
11349
+ (e[wt] = e[wt] || {})[s] = t[s], Mt(e, t, n[r], i);
11307
11350
  }
11308
11351
  }
11309
11352
 
@@ -11394,7 +11437,7 @@ function Ct(e, t, n, i, r, s) {
11394
11437
  }
11395
11438
 
11396
11439
  function kt(e, t, n) {
11397
- const i = t[n.symbolName], r = e[St];
11440
+ const i = t[n.symbolName], r = e[wt];
11398
11441
  return !x(i, r[n.symbolName]) && (r[n.symbolName] = i, !0);
11399
11442
  }
11400
11443
 
@@ -11702,14 +11745,14 @@ class fn {
11702
11745
  if (i) {
11703
11746
  let r = "";
11704
11747
  for (const s in i) i[s] && (r += s, n[s].uniformDeclares && t.push(...n[s].uniformDeclares),
11705
- n[s].defines && we(e, n[s].defines));
11748
+ n[s].defines && Se(e, n[s].defines));
11706
11749
  this._includeKeys = r;
11707
11750
  }
11708
11751
  }
11709
11752
  setIncludeUniformValues(e, t) {
11710
11753
  if (t && t.isRenderingTerrain && this.isTerrainSkin()) return;
11711
11754
  const n = t && t.includes;
11712
- if (n) for (const i in n) n[i] && t[i].renderUniforms && we(e, t[i].renderUniforms);
11755
+ if (n) for (const i in n) n[i] && t[i].renderUniforms && Se(e, t[i].renderUniforms);
11713
11756
  }
11714
11757
  createGeometries(e, t) {
11715
11758
  if (!e.length) return hn;
@@ -11722,7 +11765,7 @@ class fn {
11722
11765
  e[i] && !e[i].is2D && (this._is2D = !1);
11723
11766
  const r = this.createGeometry(e[i], t, i);
11724
11767
  if (r && r.geometry) {
11725
- const s = r.geometry.properties, {pickingIdMap: o, idPickingMap: a, hasFeaIds: l} = this._getIdMap(e[i]);
11768
+ const s = r.geometry.properties, {feaIdToPickingIdMap: o, pickingIdToFeaIdMap: a, hasFeaIds: l} = this._getIdMap(e[i]);
11726
11769
  l && (s.feaIdPickingMap = o, s.feaPickingIdMap = a), s.symbolIndex = r.symbolIndex,
11727
11770
  s.features = t, s.is2D = e[i].is2D, s.layer = this.layer, s.positionBounding = e[i].positionBounding,
11728
11771
  this.postCreateGeometry(r, n);
@@ -11745,8 +11788,8 @@ class fn {
11745
11788
  }
11746
11789
  return {
11747
11790
  hasFeaIds: r,
11748
- idPickingMap: n,
11749
- pickingIdMap: i
11791
+ pickingIdToFeaIdMap: n,
11792
+ feaIdToPickingIdMap: i
11750
11793
  };
11751
11794
  }
11752
11795
  createGeometry() {
@@ -11856,7 +11899,7 @@ class fn {
11856
11899
  const i = this.scene.getMeshes(), r = [];
11857
11900
  i.forEach((e => {
11858
11901
  e.properties.hlBloomMesh && n && n.bloom && r.push(e.properties.hlBloomMesh), r.push(e);
11859
- })), this._setLayerUniforms(t), this.scene.setMeshes(r), this._drawCount += this.renderer.render(e, t, this.scene, this.getRenderFBO(n)),
11902
+ })), this._setLayerUniforms(t), this.scene.setMeshes(r), t.painterContext = n, this._drawCount += this.renderer.render(e, t, this.scene, this.getRenderFBO(n)),
11860
11903
  this.scene.setMeshes(i);
11861
11904
  }
11862
11905
  _setLayerUniforms(e) {
@@ -11912,7 +11955,7 @@ class fn {
11912
11955
  coordinate: a.coordinate,
11913
11956
  plugin: this.pluginIndex
11914
11957
  };
11915
- return Ie(u.properties.nodeIndex) || (d.data.nodeIndex = u.properties.nodeIndex),
11958
+ return Ie(u.properties.nodeIndex) || (d.data || (d.data = {}), d.data.nodeIndex = u.properties.nodeIndex),
11916
11959
  d;
11917
11960
  }
11918
11961
  return null;
@@ -11920,14 +11963,14 @@ class fn {
11920
11963
  _convertProxyFeature(e) {
11921
11964
  const t = e && e.feature;
11922
11965
  if (!t || !t.customProps) return e;
11923
- const n = we({}, e);
11924
- return n.feature = we({}, e.feature), delete n.feature.customProps, n.feature.properties = we({}, t.properties, t.properties[ve], t.properties[be]),
11966
+ const n = Se({}, e);
11967
+ return n.feature = Se({}, e.feature), delete n.feature.customProps, n.feature.properties = Se({}, t.properties, t.properties[ve], t.properties[be]),
11925
11968
  delete n.feature.properties[be], delete n.feature.properties[ve], delete n.feature.properties.$layer,
11926
11969
  delete n.feature.properties.$type, n;
11927
11970
  }
11928
11971
  updateSceneConfig() {}
11929
11972
  updateDataConfig(e) {
11930
- return we(this.dataConfig, e), !0;
11973
+ return Se(this.dataConfig, e), !0;
11931
11974
  }
11932
11975
  deleteMesh(e, t) {
11933
11976
  if (e) if (this.scene.removeMesh(e), Array.isArray(e)) for (let n = 0; n < e.length; n++) {
@@ -12007,7 +12050,7 @@ class fn {
12007
12050
  _compileSymbols() {
12008
12051
  const e = this.getMap(), t = [], n = () => (t[0] = e.getZoom(), t);
12009
12052
  this._symbol = [], this._visibleFn = [];
12010
- for (let e = 0; e < this.symbolDef.length; e++) this._symbol[e] = Qt.loadSymbolFnTypes(we({}, this.symbolDef[e]), n),
12053
+ for (let e = 0; e < this.symbolDef.length; e++) this._symbol[e] = Qt.loadSymbolFnTypes(Se({}, this.symbolDef[e]), n),
12011
12054
  this.symbolDef[e] && _(this.symbolDef[e].visible) && (this._visibleFn[e] = v(this.symbolDef[e].visible));
12012
12055
  }
12013
12056
  getFnTypeConfig(e) {
@@ -12263,19 +12306,19 @@ class fn {
12263
12306
  }
12264
12307
  const v = performance.now();
12265
12308
  i.terrainQueryStatus[c] = x;
12266
- const {xmin: b, ymax: A} = l, T = on.set(b, A), S = this.layer.getTileSize().width / i.extent, w = n.length / t.length;
12309
+ const {xmin: b, ymax: A} = l, T = on.set(b, A), w = this.layer.getTileSize().width / i.extent, S = n.length / t.length;
12267
12310
  let M = t.queryResult;
12268
12311
  M || (M = t.queryResult = new Map);
12269
12312
  let P = !0;
12270
12313
  for (let e = r; e <= s; e++) {
12271
- let i = n[e * w];
12314
+ let i = n[e * S];
12272
12315
  i < 0 ? i = 0 : i > a && (i = a);
12273
- let r = n[e * w + 1];
12316
+ let r = n[e * S + 1];
12274
12317
  r < 0 ? r = 0 : r > a && (r = a);
12275
12318
  const s = i + r * a;
12276
12319
  let l, h, c = M.get(s);
12277
12320
  if (c || 0 === c) t[e] !== c && (t[e] = c, t.dirty = !0); else {
12278
- for (let e = 0; e < m.length; e++) if ($t(m[e], b + S * i, A - S * r, o)) {
12321
+ for (let e = 0; e < m.length; e++) if ($t(m[e], b + w * i, A - w * r, o)) {
12279
12322
  l = m[e];
12280
12323
  break;
12281
12324
  }
@@ -12291,6 +12334,9 @@ class fn {
12291
12334
  terrainTileInfos: m
12292
12335
  }));
12293
12336
  }
12337
+ shouldDrawParentTile() {
12338
+ return !0;
12339
+ }
12294
12340
  }
12295
12341
 
12296
12342
  function dn(e, t) {
@@ -12310,7 +12356,7 @@ class gn extends fn {
12310
12356
  };
12311
12357
  e.iconAtlas && e.iconAtlas.image && (e.iconAtlas.image.dataType = e.type, e.iconAtlas.image.type = "icon"),
12312
12358
  e.glyphAtlas && e.glyphAtlas.image && (e.glyphAtlas.image.type = "glyph");
12313
- const n = we({}, e.data), i = {
12359
+ const n = Se({}, e.data), i = {
12314
12360
  primitive: this.getPrimitive(),
12315
12361
  positionSize: e.positionSize
12316
12362
  };
@@ -12321,7 +12367,7 @@ class gn extends fn {
12321
12367
  }, e.iconAtlas && (r.properties.iconAtlas = e.iconAtlas.image, r.properties.iconPositions = e.iconAtlas.positions),
12322
12368
  e.glyphAtlas && (r.properties.glyphAtlas = e.glyphAtlas.image), bt(t) || (r.properties.aFeaIds = e.featureIds,
12323
12369
  this._prepareFeatureIds(r, e)), e.markerPlacement && (r.properties.markerPlacement = e.markerPlacement),
12324
- e.textPlacement && (r.properties.textPlacement = e.textPlacement), we(r.properties, e.properties),
12370
+ e.textPlacement && (r.properties.textPlacement = e.textPlacement), Se(r.properties, e.properties),
12325
12371
  {
12326
12372
  geometry: r,
12327
12373
  symbolIndex: e.symbolIndex
@@ -12398,7 +12444,7 @@ const {INVALID_TEX_COORD: bn} = H(), An = a.identity([]), Tn = {
12398
12444
  uvOffset: [ 0, 0 ],
12399
12445
  patternWidth: [ 0, 0 ],
12400
12446
  patternOffset: [ 0, 0 ]
12401
- }, Sn = [], wn = new e.Coordinate(0, 0), Mn = new e.Coordinate(0, 0), Pn = new e.Coordinate(0, 0), In = [];
12447
+ }, wn = [], Sn = new e.Coordinate(0, 0), Mn = new e.Coordinate(0, 0), Pn = new e.Coordinate(0, 0), In = [];
12402
12448
 
12403
12449
  class Cn extends gn {
12404
12450
  static getBloomSymbol() {
@@ -12421,11 +12467,11 @@ class Cn extends gn {
12421
12467
  return !0;
12422
12468
  }
12423
12469
  getAnalysisMeshes() {
12424
- if (!this.isVisible()) return Sn;
12470
+ if (!this.isVisible()) return wn;
12425
12471
  return this.scene.getMeshes().filter((e => 0 === e.properties.level));
12426
12472
  }
12427
12473
  createMesh(t, n, i) {
12428
- const r = this.getMap(), {tilePoint: o} = i, {geometry: a, symbolIndex: l, ref: h} = t, c = this.layer instanceof e.TileLayer, u = this.layer.getTileSize().width, d = a.properties.tileExtent / u, p = a.properties.tileResolution, g = r.pointAtResToCoord(wn.set(o[0], o[1]), p), m = {
12474
+ const r = this.getMap(), {tilePoint: o} = i, {geometry: a, symbolIndex: l, ref: h} = t, c = this.layer instanceof e.TileLayer, u = this.layer.getTileSize().width, d = a.properties.tileExtent / u, p = a.properties.tileResolution, g = r.pointAtResToCoord(Sn.set(o[0], o[1]), p), m = {
12429
12475
  tileExtent: a.properties.tileExtent,
12430
12476
  tileRatio: d
12431
12477
  }, y = this.getSymbol(l), x = this.getSymbolDef(l);
@@ -12435,7 +12481,7 @@ class Cn extends gn {
12435
12481
  ke(m, "polygonOpacity", y, "polygonOpacity", Tn.polygonOpacity), ke(m, "uvScale", y, "uvScale", Tn.uvScale),
12436
12482
  void 0 === h) {
12437
12483
  const e = this.getFnTypeConfig(l);
12438
- wt(a, x, e, this.layer), a.generateBuffers(this.regl);
12484
+ St(a, x, e, this.layer), a.generateBuffers(this.regl);
12439
12485
  }
12440
12486
  const v = a.properties.iconAtlas, b = 2048;
12441
12487
  if (v && a.data.aTexInfo) {
@@ -12446,7 +12492,7 @@ class Cn extends gn {
12446
12492
  const t = m.tileScale;
12447
12493
  if (a.data.aPatternOrigin) return e[0] = o[0] * t % b, e[1] = o[1] * t % b, e;
12448
12494
  const n = y.polygonPatternFileOrigin;
12449
- return n ? (wn.set(n[0], n[1]), r.coordToPointAtRes(wn, p, Mn), f.set(e, o[0] - Mn.x, o[1] - Mn.y)) : (e[0] = o[0] * t % b,
12495
+ return n ? (Sn.set(n[0], n[1]), r.coordToPointAtRes(Sn, p, Mn), f.set(e, o[0] - Mn.x, o[1] - Mn.y)) : (e[0] = o[0] * t % b,
12450
12496
  e[1] = o[1] * t % b, e);
12451
12497
  }
12452
12498
  });
@@ -12487,13 +12533,13 @@ class Cn extends gn {
12487
12533
  const A = new s.Material(m, Tn), T = new s.Mesh(a, A, {
12488
12534
  castShadow: !1,
12489
12535
  picking: !0
12490
- }), S = {};
12491
- return v && a.data.aTexInfo && (S.HAS_PATTERN = 1), v && a.data.aTexCoord && (S.HAS_TEX_COORD = 1,
12492
- S.INVALID_TEX_COORD = bn + ".0"), a.data.aAltitude && (S.HAS_ALTITUDE = 1), a.data.aColor && (S.HAS_COLOR = 1),
12493
- a.data.aOpacity && (S.HAS_OPACITY = 1), a.data.aUVScale && (S.HAS_UV_SCALE = 1),
12494
- a.data.aUVOffset && (S.HAS_UV_OFFSET = 1), a.data.aPatternOrigin && (S.HAS_PATTERN_ORIGIN = 1),
12495
- a.data.aPatternWidth && (S.HAS_PATTERN_WIDTH = 1), a.data.aPatternOffset && (S.HAS_PATTERN_OFFSET = 1),
12496
- c && (S.IS_VT = 1), T.setDefines(S), T.positionMatrix = this.getAltitudeOffsetMatrix(),
12536
+ }), w = {};
12537
+ return v && a.data.aTexInfo && (w.HAS_PATTERN = 1), v && a.data.aTexCoord && (w.HAS_TEX_COORD = 1,
12538
+ w.INVALID_TEX_COORD = bn + ".0"), a.data.aAltitude && (w.HAS_ALTITUDE = 1), a.data.aColor && (w.HAS_COLOR = 1),
12539
+ a.data.aOpacity && (w.HAS_OPACITY = 1), a.data.aUVScale && (w.HAS_UV_SCALE = 1),
12540
+ a.data.aUVOffset && (w.HAS_UV_OFFSET = 1), a.data.aPatternOrigin && (w.HAS_PATTERN_ORIGIN = 1),
12541
+ a.data.aPatternWidth && (w.HAS_PATTERN_WIDTH = 1), a.data.aPatternOffset && (w.HAS_PATTERN_OFFSET = 1),
12542
+ c && (w.IS_VT = 1), T.setDefines(w), T.positionMatrix = this.getAltitudeOffsetMatrix(),
12497
12543
  T.setLocalTransform(n), T.properties.symbolIndex = l, T;
12498
12544
  }
12499
12545
  _preparePatternWidth(e, t, n, i, r) {
@@ -12565,7 +12611,7 @@ class Cn extends gn {
12565
12611
  }
12566
12612
  c = a[e];
12567
12613
  const t = o(null, r[c].feature.properties);
12568
- t ? (wn.set(t[0], t[1]), s.coordToPointAtRes(wn, i, Mn), u = h[2 * e] = Mn.x, f = h[2 * e + 1] = Mn.y) : (u = h[2 * e] = n[0],
12614
+ t ? (Sn.set(t[0], t[1]), s.coordToPointAtRes(Sn, i, Mn), u = h[2 * e] = Mn.x, f = h[2 * e + 1] = Mn.y) : (u = h[2 * e] = n[0],
12569
12615
  f = h[2 * e + 1] = n[1]);
12570
12616
  }
12571
12617
  t.data.aPatternOrigin = h;
@@ -12634,7 +12680,7 @@ class Cn extends gn {
12634
12680
  const o = {
12635
12681
  viewport: r,
12636
12682
  stencil: {
12637
- enable: () => this.isEnableTileStencil(t),
12683
+ enable: (e, t) => t.geometryProperties.is2D && this.isEnableTileStencil(t.painterContext),
12638
12684
  func: {
12639
12685
  cmp: () => this.isOnly2D() ? "=" : "<=",
12640
12686
  ref: (e, t) => t.stencilRef
@@ -12763,7 +12809,7 @@ class Rn extends gn {
12763
12809
  if (!t.geometry) return null;
12764
12810
  const {geometry: i, symbolIndex: r, ref: o} = t, a = this.getSymbolDef(r);
12765
12811
  if (void 0 === o) {
12766
- wt(i, a, this.getFnTypeConfig(r), this.layer);
12812
+ St(i, a, this.getFnTypeConfig(r), this.layer);
12767
12813
  }
12768
12814
  const l = this.getSymbol(r), h = {
12769
12815
  tileResolution: i.properties.tileResolution,
@@ -12895,6 +12941,7 @@ class Rn extends gn {
12895
12941
  symbolName: "lineDx",
12896
12942
  type: Int8Array,
12897
12943
  width: 2,
12944
+ index: 0,
12898
12945
  define: "HAS_LINE_DX",
12899
12946
  evaluate: t => {
12900
12947
  const n = s(e.getZoom(), t);
@@ -12905,6 +12952,7 @@ class Rn extends gn {
12905
12952
  symbolName: "lineDy",
12906
12953
  type: Int8Array,
12907
12954
  width: 2,
12955
+ index: 1,
12908
12956
  define: "HAS_LINE_DY",
12909
12957
  evaluate: t => {
12910
12958
  const n = o(e.getZoom(), t);
@@ -12962,17 +13010,17 @@ class Rn extends gn {
12962
13010
  isEnableTileStencil(e) {
12963
13011
  return !!!(e && e.isRenderingTerrain && this.isTerrainSkin());
12964
13012
  }
12965
- getExtraCommandProps(e) {
12966
- const t = this.canvas;
13013
+ getExtraCommandProps() {
13014
+ const e = this.canvas;
12967
13015
  return {
12968
13016
  viewport: {
12969
13017
  x: (e, t) => t.viewport ? t.viewport.x : 0,
12970
13018
  y: (e, t) => t.viewport ? t.viewport.y : 0,
12971
- width: (e, n) => n.viewport ? n.viewport.width : t ? t.width : 1,
12972
- height: (e, n) => n.viewport ? n.viewport.height : t ? t.height : 1
13019
+ width: (t, n) => n.viewport ? n.viewport.width : e ? e.width : 1,
13020
+ height: (t, n) => n.viewport ? n.viewport.height : e ? e.height : 1
12973
13021
  },
12974
13022
  stencil: {
12975
- enable: () => this.isEnableTileStencil(e),
13023
+ enable: (e, t) => this.isEnableTileStencil(t.painterContext),
12976
13024
  mask: 255,
12977
13025
  func: {
12978
13026
  cmp: () => "<=",
@@ -13494,7 +13542,7 @@ class jn extends Rn {
13494
13542
  createMesh(e, t) {
13495
13543
  const {geometry: n, symbolIndex: i, ref: r} = e, o = this.getSymbolDef(i);
13496
13544
  if (void 0 === r) {
13497
- wt(n, o, this.getFnTypeConfig(i), this.layer);
13545
+ St(n, o, this.getFnTypeConfig(i), this.layer);
13498
13546
  }
13499
13547
  const a = {
13500
13548
  tileResolution: n.properties.tileResolution,
@@ -14122,7 +14170,7 @@ function gi(e, t, n, i, r) {
14122
14170
  return d.set(e, o, -s, s, o);
14123
14171
  }
14124
14172
 
14125
- const mi = 15, yi = 15, xi = 2048, _i = 24, vi = .01, bi = [], Ai = [], Ti = [], Si = [], wi = [], Mi = [], Pi = [], Ii = [], Ci = [ 1, -1 ], ki = [ 1, 1 ];
14173
+ const mi = 15, yi = 15, xi = 2048, _i = 24, vi = .01, bi = [], Ai = [], Ti = [], wi = [], Si = [], Mi = [], Pi = [], Ii = [], Ci = [ 1, -1 ], ki = [ 1, 1 ];
14126
14174
 
14127
14175
  function Fi(e, t, n, i, r) {
14128
14176
  const s = t.material.uniforms, a = r.cameraToCenterDistance, l = t.geometry.properties, h = this.getSymbol(l.symbolIndex), c = t.geometry.desc.positionSize, u = l.aAnchor, d = o.set(bi, u[n * c], u[n * c + 1], 2 === c ? 0 : u[n * c + 2]), {aTerrainAltitude: p} = l;
@@ -14136,8 +14184,8 @@ function Fi(e, t, n, i, r) {
14136
14184
  if (s.markerPerspectiveRatio) {
14137
14185
  y = Me(.5 + .5 * (1 - (1 - a / m) * s.markerPerspectiveRatio), 0, 4);
14138
14186
  }
14139
- const {aShape: x, aMarkerDx: _, aMarkerDy: v, aMarkerWidth: b, aMarkerHeight: A, aPitchAlign: T, aRotationAlign: S, aRotation: w} = l, M = _ ? _[n] : h.markerDx, P = v ? v[n] : h.markerDy, I = T ? T[2 * n] : s.markerPitchWithMap, C = S ? S[2 * n] : s.markerRotateWithMap, k = f.set(Ii, M || 0, -(P || 0));
14140
- let F = f.set(Si, x[2 * n] / 10, x[2 * n + 1] / 10), O = f.set(wi, x[2 * n + 2] / 10, x[2 * n + 3] / 10), R = f.set(Mi, x[2 * n + 4] / 10, x[2 * n + 5] / 10), E = f.set(Pi, x[2 * n + 6] / 10, x[2 * n + 7] / 10);
14187
+ const {aShape: x, aMarkerDx: _, aMarkerDy: v, aMarkerWidth: b, aMarkerHeight: A, aPitchAlign: T, aRotationAlign: w, aRotation: S} = l, M = _ ? _[n] : h.markerDx, P = v ? v[n] : h.markerDy, I = T ? T[2 * n] : s.markerPitchWithMap, C = w ? w[2 * n] : s.markerRotateWithMap, k = f.set(Ii, M || 0, -(P || 0));
14188
+ let F = f.set(wi, x[2 * n] / 10, x[2 * n + 1] / 10), O = f.set(Si, x[2 * n + 2] / 10, x[2 * n + 3] / 10), R = f.set(Mi, x[2 * n + 4] / 10, x[2 * n + 5] / 10), E = f.set(Pi, x[2 * n + 6] / 10, x[2 * n + 7] / 10);
14141
14189
  0 === s.flipY && 1 === I && (f.multiply(F, F, Ci), f.multiply(O, O, Ci), f.multiply(R, R, Ci),
14142
14190
  f.multiply(E, E, Ci));
14143
14191
  const [D, L] = vn(t.geometry);
@@ -14147,7 +14195,7 @@ function Fi(e, t, n, i, r) {
14147
14195
  Ie(N) && (N = L || yi);
14148
14196
  const z = f.set(ki, H / xi, N / xi);
14149
14197
  let V;
14150
- f.mul(F, F, z), f.mul(O, O, z), f.mul(R, R, z), f.mul(E, E, z), V = w ? w[2 * n] / 9362 : -(h.markerRotation || 0) * Math.PI / 180;
14198
+ f.mul(F, F, z), f.mul(O, O, z), f.mul(R, R, z), f.mul(E, E, z), V = S ? S[2 * n] / 9362 : -(h.markerRotation || 0) * Math.PI / 180;
14151
14199
  const U = -V, B = r.getBearing() * Math.PI / 180;
14152
14200
  if (B * C || U) {
14153
14201
  const e = gi(Ti, U, B, C, I);
@@ -14168,13 +14216,13 @@ function Ui(e, t, n, i, r, s, a, l, h) {
14168
14216
  if (c.textPerspectiveRatio) {
14169
14217
  x = Me(.5 + .5 * (1 - (1 - u / y) * c.textPerspectiveRatio), 0, 4);
14170
14218
  }
14171
- const {aTextDx: _, aTextDy: v, aPitchAlign: b, aRotationAlign: A, aRotation: T, aType: S, aDxDy: w} = i.geometry.properties;
14219
+ const {aTextDx: _, aTextDy: v, aPitchAlign: b, aRotationAlign: A, aRotation: T, aType: w, aDxDy: S} = i.geometry.properties;
14172
14220
  let M, P, I;
14173
- w ? (M = w[4 * a + 2], P = w[4 * a + 3]) : (M = _ ? _[a] : p.textDx, P = v ? v[a] : p.textDy),
14174
- b && (I = S ? b[2 * a + 1] : b[a]);
14221
+ S ? (M = S[4 * a + 2], P = S[4 * a + 3]) : (M = _ ? _[a] : p.textDx, P = v ? v[a] : p.textDy),
14222
+ b && (I = w ? b[2 * a + 1] : b[a]);
14175
14223
  const C = b ? I : c.textPitchWithMap;
14176
14224
  let k;
14177
- A && (k = S ? A[2 * a + 1] : A[a]);
14225
+ A && (k = w ? A[2 * a + 1] : A[a]);
14178
14226
  const F = A ? k : c.textRotateWithMap, O = f.set(zi, M || 0, -(P || 0));
14179
14227
  if (g) {
14180
14228
  const {aOffset: i, aShape: r} = d, s = i.length !== r.length;
@@ -14191,7 +14239,7 @@ function Ui(e, t, n, i, r, s, a, l, h) {
14191
14239
  const {aShape: i} = d;
14192
14240
  let s, o = f.set(Di, i[2 * a] / 10, -i[2 * a + 1] / 10), u = f.set(Li, i[2 * a + 2] / 10, -i[2 * a + 3] / 10), _ = f.set(Hi, i[2 * a + 4] / 10, -i[2 * a + 5] / 10), v = f.set(Ni, i[2 * a + 6] / 10, -i[2 * a + 7] / 10);
14193
14241
  0 === c.flipY && 1 === C && (f.multiply(o, o, Vi), f.multiply(u, u, Vi), f.multiply(_, _, Vi),
14194
- f.multiply(v, v, Vi)), s = T ? S && T.length > S.length ? T[2 * a + 1] / 9362 : T[a] / 9362 : (p.textRotation || 0) * Math.PI / 180;
14242
+ f.multiply(v, v, Vi)), s = T ? w && T.length > w.length ? T[2 * a + 1] / 9362 : T[a] / 9362 : (p.textRotation || 0) * Math.PI / 180;
14195
14243
  const b = g ? 0 : h.getBearing() * Math.PI / 180;
14196
14244
  if (s || b) {
14197
14245
  const e = gi(Ei, s, b, F, C);
@@ -14294,7 +14342,7 @@ function Wi(e, t, n, i, r, o) {
14294
14342
  }
14295
14343
 
14296
14344
  function Xi(e, t, n, i, r, s) {
14297
- wt(e, t, n, this.layer);
14345
+ St(e, t, n, this.layer);
14298
14346
  const o = e.properties;
14299
14347
  if (!o.textInitialized) {
14300
14348
  qi.call(this, e, i || s, r), o.textInitialized = !0;
@@ -14336,7 +14384,7 @@ function Xi(e, t, n, i, r, s) {
14336
14384
 
14337
14385
  function Yi(e, t, n, i) {
14338
14386
  const r = n.properties.glyphAtlas, s = r && yn(t, r, !1);
14339
- return we(e = e || {}, {
14387
+ return Se(e = e || {}, {
14340
14388
  flipY: 0,
14341
14389
  tileResolution: n.properties.tileResolution,
14342
14390
  tileRatio: n.properties.tileRatio,
@@ -14683,7 +14731,7 @@ function ur(e, t, n, i, r, o, a, l, h) {
14683
14731
  };
14684
14732
  let g;
14685
14733
  if (u) {
14686
- const e = we({}, f);
14734
+ const e = Se({}, f);
14687
14735
  e.isHalo = 1;
14688
14736
  const i = new s.Material(e);
14689
14737
  g = new s.Mesh(t, i, p), g.properties.isHalo = 1, g.setUniform("alphaTest", vi),
@@ -14693,7 +14741,7 @@ function ur(e, t, n, i, r, o, a, l, h) {
14693
14741
  HAS_HALO_ATTR: 1
14694
14742
  };
14695
14743
  if (a && (x.ENABLE_COLLISION = 1), pr.call(this, t, x), g) {
14696
- const e = we({}, x);
14744
+ const e = Se({}, x);
14697
14745
  Zi.call(this, x, g), g.setDefines(e);
14698
14746
  }
14699
14747
  return u && Zi.call(this, x, y), y.setDefines(x), y.setUniform("alphaTest", vi),
@@ -14738,7 +14786,7 @@ function pr(e, t) {
14738
14786
  }
14739
14787
 
14740
14788
  function gr(e, t, n, i) {
14741
- wt(e, t, n, i), function(e) {
14789
+ St(e, t, n, i), function(e) {
14742
14790
  const {aMarkerWidth: t, aMarkerHeight: n, aMarkerDx: i, aMarkerDy: r, aPitchAlign: s, aRotationAlign: o, aRotation: a, aOverlap: l} = e.data;
14743
14791
  if (t) {
14744
14792
  const n = (Tt + "aMarkerWidth").trim();
@@ -15092,19 +15140,19 @@ function vr(e, t) {
15092
15140
  const h = e.getZoom(), {fitIcons: c, fitWidthIcons: u, fitHeightIcons: f} = i, {aMarkerWidth: d, aMarkerHeight: p, labelShape: g} = i, m = t.properties.iconElements, {features: y, aPickingId: x} = i, A = (e, t, n, r) => {
15093
15141
  const c = g[4 * t], u = g[4 * t + 1], f = g[4 * t + 2], m = g[4 * t + 3];
15094
15142
  if (!(c || u || f || m)) return;
15095
- const A = x[e], T = y[A] && y[A].feature, S = T && T.properties || {};
15096
- let w = o ? o(h, S) : s;
15097
- if (_(w)) {
15098
- w = (S.textSizeFn = S.textSizeFn || v(w))(h, S);
15143
+ const A = x[e], T = y[A] && y[A].feature, w = T && T.properties || {};
15144
+ let S = o ? o(h, w) : s;
15145
+ if (_(S)) {
15146
+ S = (w.textSizeFn = w.textSizeFn || v(S))(h, w);
15099
15147
  }
15100
- w /= _i;
15101
- let M, P = l && l(h, S) || a;
15148
+ S /= _i;
15149
+ let M, P = l && l(h, w) || a;
15102
15150
  if (_(P)) {
15103
- P = (S.fitPaddingFn = S.fitPaddingFn || b(P))(h, S);
15151
+ P = (w.fitPaddingFn = w.fitPaddingFn || b(P))(h, w);
15104
15152
  }
15105
15153
  if (P = P || _r, P[0] === P[2] && P[1] === P[3] || (M = i.aPadOffset, M || (M = i.aPadOffset = new Int8Array(2 * d.length))),
15106
15154
  d && n) {
15107
- const t = Math.abs((f - c) / 10 * w) + (P[1] + P[3] || 0);
15155
+ const t = Math.abs((f - c) / 10 * S) + (P[1] + P[3] || 0);
15108
15156
  if (hr[0] = t, d[e] !== hr[0] && (De(d, hr[0], e, e + lr), d.dirty = !0), M) {
15109
15157
  const t = (P[1] + P[3]) / 2 - P[3];
15110
15158
  if (cr[0] = t, M[2 * e] !== cr[0]) {
@@ -15114,7 +15162,7 @@ function vr(e, t) {
15114
15162
  }
15115
15163
  }
15116
15164
  if (p && r) {
15117
- const t = Math.abs((m - u) / 10 * w) + (P[0] + P[2] || 0);
15165
+ const t = Math.abs((m - u) / 10 * S) + (P[0] + P[2] || 0);
15118
15166
  if (hr[0] = t, p[e] !== hr[0] && (De(p, hr[0], e, e + lr), p.dirty = !0), M) {
15119
15167
  const t = P[0] - (P[0] + P[2]) / 2;
15120
15168
  if (cr[0] = t, M[2 * e + 1] !== cr[0]) {
@@ -15148,7 +15196,7 @@ function vr(e, t) {
15148
15196
 
15149
15197
  const {FilterUtil: br} = H(), Ar = [], Tr = {
15150
15198
  collides: -1
15151
- }, Sr = [ xi, xi ], wr = a.identity([]), Mr = [];
15199
+ }, wr = [ xi, xi ], Sr = a.identity([]), Mr = [];
15152
15200
 
15153
15201
  class Pr extends ti {
15154
15202
  static getBloomSymbol() {
@@ -15512,7 +15560,7 @@ class Pr extends ti {
15512
15560
  }
15513
15561
  }
15514
15562
  getUniformValues(t, n) {
15515
- const i = n && n.isRenderingTerrainSkin, r = this.layer.getTileSize().width, s = i ? wr : t.projViewMatrix, o = t.cameraToCenterDistance, a = f.set(Mr, t.width, t.height);
15563
+ const i = n && n.isRenderingTerrainSkin, r = this.layer.getTileSize().width, s = i ? Sr : t.projViewMatrix, o = t.cameraToCenterDistance, a = f.set(Mr, t.width, t.height);
15516
15564
  i && f.set(a, r, r);
15517
15565
  const l = this.getBlendFunc(), h = e.Util.isFunction(l.src) ? l.src() : l.src;
15518
15566
  return {
@@ -15522,7 +15570,7 @@ class Pr extends ti {
15522
15570
  projViewMatrix: s,
15523
15571
  cameraToCenterDistance: o,
15524
15572
  canvasSize: a,
15525
- iconSize: Sr,
15573
+ iconSize: wr,
15526
15574
  resolution: t.getResolution(),
15527
15575
  glyphSize: _i,
15528
15576
  gammaScale: 1,
@@ -15553,19 +15601,19 @@ function Ir(e, t) {
15553
15601
  const Cr = [], kr = [], Fr = [];
15554
15602
 
15555
15603
  function Or(e, t, n, i, r, s, a, l, h, c, u, d, p) {
15556
- const {aGlyphOffset: g, aSegment: m, aTextDx: y, aTextDy: x, symbolIndex: _} = t.geometry.properties, v = this.getSymbol(_), b = y ? y[r] : v.textDx, A = x ? x[r] : v.textDy, T = f.set(Fr, b || 0, A || 0), S = f.set(Cr, g[2 * r], g[2 * r + 1]), w = o.set(kr, m[3 * r], m[3 * r + 1], m[3 * r + 2]), M = function(e, t, n, i, r, s, o, a, l, h, c, u, f, d, p, g, m, y) {
15604
+ const {aGlyphOffset: g, aSegment: m, aTextDx: y, aTextDy: x, symbolIndex: _} = t.geometry.properties, v = this.getSymbol(_), b = y ? y[r] : v.textDx, A = x ? x[r] : v.textDy, T = f.set(Fr, b || 0, A || 0), w = f.set(Cr, g[2 * r], g[2 * r + 1]), S = o.set(kr, m[3 * r], m[3 * r + 1], m[3 * r + 2]), M = function(e, t, n, i, r, s, o, a, l, h, c, u, f, d, p, g, m, y) {
15557
15605
  p || (p = i);
15558
15606
  const x = t.geometry.properties.line, _ = s[0] * u, v = f ? _ - o : _ + o;
15559
15607
  let b = v > 0 ? 1 : -1, A = 0;
15560
15608
  f && (b *= -1, A = Math.PI), b < 0 && (A += Math.PI);
15561
- const T = h + c, S = Math.abs(v);
15562
- let w = b > 0 ? l : l + 1, M = Vt.convert(i), P = Vt.convert(i), I = Vt.convert(r), C = Vt.convert(r), k = 0, F = 0;
15563
- for (;k + F <= S; ) {
15564
- if (w += b, w < h || w >= T) return null;
15565
- P.x = M.x, P.y = M.y, C.x = I.x, C.y = I.y, M.x = n[3 * w], M.y = n[3 * w + 1],
15566
- I.x = x[3 * w], I.y = x[3 * w + 1], k += F, F = P.dist(M) / d;
15567
- }
15568
- const O = (S - k) / F, R = g && g.getRenderer(), E = R && R.getTerrainHelper(), D = t.properties.tile.terrainTileInfos;
15609
+ const T = h + c, w = Math.abs(v);
15610
+ let S = b > 0 ? l : l + 1, M = Vt.convert(i), P = Vt.convert(i), I = Vt.convert(r), C = Vt.convert(r), k = 0, F = 0;
15611
+ for (;k + F <= w; ) {
15612
+ if (S += b, S < h || S >= T) return null;
15613
+ P.x = M.x, P.y = M.y, C.x = I.x, C.y = I.y, M.x = n[3 * S], M.y = n[3 * S + 1],
15614
+ I.x = x[3 * S], I.y = x[3 * S + 1], k += F, F = P.dist(M) / d;
15615
+ }
15616
+ const O = (w - k) / F, R = g && g.getRenderer(), E = R && R.getTerrainHelper(), D = t.properties.tile.terrainTileInfos;
15569
15617
  if (!y && E) {
15570
15618
  const {extent: n} = t.properties.tile, i = g.getTileSize().width / n, r = g.getMap();
15571
15619
  let s = I.sub(C).mult(O)._add(C);
@@ -15577,7 +15625,7 @@ function Or(e, t, n, i, r, s, a, l, h, c, u, d, p) {
15577
15625
  H._add(L._unit()._perp()._mult(a * b));
15578
15626
  const N = A + Math.atan2(M.y - P.y, M.x - P.x);
15579
15627
  return e[0] = (H.x - i[0]) / d, e[1] = (H.y - i[1]) / d, e[2] = N, e;
15580
- }(e, t, i, s, a, S, T[0], T[1], w[0], w[1], w[2], n / 24, h, l, c, u, d, p);
15628
+ }(e, t, i, s, a, w, T[0], T[1], S[0], S[1], S[2], n / 24, h, l, c, u, d, p);
15581
15629
  return M;
15582
15630
  }
15583
15631
 
@@ -15831,9 +15879,9 @@ class xs extends ti {
15831
15879
  }
15832
15880
  }
15833
15881
  _updateLabelAttributes(e, t, n, i, r, s, l) {
15834
- const h = this.layer.getRenderer(), u = e.material.uniforms, d = 1 === u.textPitchWithMap, g = !d && h.getTerrainHelper && h.getTerrainHelper(), m = this.isEnableCollision(), y = this.getMap(), x = e.geometry, _ = x.desc.positionSize, {aShape: v, aOffset: b, aAnchor: A, aAltitude: T, aPitchRotation: S} = x.properties;
15835
- let {aProjectedAnchor: w} = x.properties;
15836
- w || (w = x.properties.aProjectedAnchor = new Array(A.length / _ * 3));
15882
+ const h = this.layer.getRenderer(), u = e.material.uniforms, d = 1 === u.textPitchWithMap, g = !d && h.getTerrainHelper && h.getTerrainHelper(), m = this.isEnableCollision(), y = this.getMap(), x = e.geometry, _ = x.desc.positionSize, {aShape: v, aOffset: b, aAnchor: A, aAltitude: T, aPitchRotation: w} = x.properties;
15883
+ let {aProjectedAnchor: S} = x.properties;
15884
+ S || (S = x.properties.aProjectedAnchor = new Array(A.length / _ * 3));
15837
15885
  const M = x.properties.aTextSize, P = !l, I = t[n], C = I * _;
15838
15886
  let k;
15839
15887
  k = x.data.aAltitude ? o.set(Jr, A[C], A[C + 1], T[I]) : Vr.unpackPosition(Jr, A[C], A[C + 1], A[C + 2]);
@@ -15841,13 +15889,13 @@ class xs extends ti {
15841
15889
  let R;
15842
15890
  if (O) {
15843
15891
  const e = O[I];
15844
- if (e === me) return w[3 * I] = ge, w[3 * I + 1] = ge, w[3 * I + 2] = ge, !1;
15892
+ if (e === me) return S[3 * I] = ge, S[3 * I + 1] = ge, S[3 * I + 2] = ge, !1;
15845
15893
  e ? (R = o.set(gs, ...k), R[2] = 100 * e, R = Bt(R, R, s, y.width, y.height)) : R = F;
15846
15894
  } else R = F;
15847
15895
  const E = y.getDevicePixelRatio();
15848
- if (c.scale(ys, R, 1 / E), y.isOffscreen(ys)) return m || _s(b, t, n, i), w[3 * I] = ge,
15849
- w[3 * I + 1] = ge, w[3 * I + 2] = ge, !1;
15850
- P && (k = F), w[3 * I] = R[0], w[3 * I + 1] = R[1], w[3 * I + 2] = R[2];
15896
+ if (c.scale(ys, R, 1 / E), y.isOffscreen(ys)) return m || _s(b, t, n, i), S[3 * I] = ge,
15897
+ S[3 * I + 1] = ge, S[3 * I + 2] = ge, !1;
15898
+ P && (k = F), S[3 * I] = R[0], S[3 * I + 1] = R[1], S[3 * I + 2] = R[2];
15851
15899
  const D = P ? 1 : x.properties.tileExtent / this.layer.getTileSize().width;
15852
15900
  let L = !0;
15853
15901
  const H = t[n], N = t[i - 1], z = M ? M[H] : e.properties.textSize, V = this._updateNormal(e, z, r, H, N, k, Jr, D, l);
@@ -15866,8 +15914,8 @@ class xs extends ti {
15866
15914
  const x = gi(Qr, y, 0, u.textRotateWithMap, u.textPitchWithMap), _ = b.length > v.length;
15867
15915
  let A;
15868
15916
  if (_) {
15869
- o.set(as, S[3 * h], S[3 * h + 1], 0);
15870
- const e = o.normalize(as, as), t = -S[3 * h + 2];
15917
+ o.set(as, w[3 * h], w[3 * h + 1], 0);
15918
+ const e = o.normalize(as, as), t = -w[3 * h + 2];
15871
15919
  if (t) {
15872
15920
  const n = p.setAxisAngle(rs, e, t);
15873
15921
  a.fromTranslation(ss, Yr), a.fromQuat(os, n), A = a.multiply(os, os, ss);
@@ -15923,8 +15971,8 @@ class xs extends ti {
15923
15971
  extraCommandProps: n
15924
15972
  });
15925
15973
  let o = n;
15926
- if (this.layer.getRenderer().isEnableWorkAround("win-intel-gpu-crash") && (o = we({}, n),
15927
- o.stencil = we({}, n.stencil), o.stencil.enable = !0, o.stencil.func.cmp = "<",
15974
+ if (this.layer.getRenderer().isEnableWorkAround("win-intel-gpu-crash") && (o = Se({}, n),
15975
+ o.stencil = Se({}, n.stencil), o.stencil.enable = !0, o.stencil.func.cmp = "<",
15928
15976
  o.stencil.func.ref = (e, t) => 2 * t.level + (t.isHalo || 0) + 1), this._shaderAlongLine = new s.MeshShader({
15929
15977
  vert: Hr,
15930
15978
  frag: Nr,
@@ -16014,7 +16062,7 @@ class Ts extends gn {
16014
16062
  createMesh(e, t) {
16015
16063
  const {geometry: n, symbolIndex: i, ref: r} = e, o = this.getSymbol(i);
16016
16064
  if (void 0 === r) {
16017
- wt(n, this.getSymbolDef(i), this.getFnTypeConfig(i), this.layer), n.generateBuffers(this.regl);
16065
+ St(n, this.getSymbolDef(i), this.getFnTypeConfig(i), this.layer), n.generateBuffers(this.regl);
16018
16066
  }
16019
16067
  const a = {};
16020
16068
  ke(a, "markerOpacity", o, "markerOpacity", 1), ke(a, "markerSize", o, "markerSize", 10),
@@ -16105,9 +16153,9 @@ class Ts extends gn {
16105
16153
  }
16106
16154
  }
16107
16155
 
16108
- var Ss = "#define SHADER_NAME NATIVE_LINE\n#ifdef HAS_ALTITUDE\nattribute vec2 aPosition;\nattribute float aAltitude;\n#else\nattribute vec3 aPosition;\n#endif\nuniform mat4 projViewModelMatrix;\nuniform mat4 positionMatrix;\n#ifndef PICKING_MODE\n#if defined(HAS_COLOR)\nattribute vec4 aColor;\nvarying vec4 vColor;\n#endif\n#else\n#include <fbo_picking_vert>\n#endif\n#include <vt_position_vert>\nvoid main() {\n vec3 c = unpackVTPosition();\n gl_Position = projViewModelMatrix * positionMatrix * vec4(c, 1.);\n#ifndef PICKING_MODE\n#if defined(HAS_COLOR)\nvColor = aColor / 255.;\n#endif\n#else\nfbo_picking_setData(gl_Position.w, true);\n#endif\n}";
16156
+ var ws = "#define SHADER_NAME NATIVE_LINE\n#ifdef HAS_ALTITUDE\nattribute vec2 aPosition;\nattribute float aAltitude;\n#else\nattribute vec3 aPosition;\n#endif\nuniform mat4 projViewModelMatrix;\nuniform mat4 positionMatrix;\n#ifndef PICKING_MODE\n#if defined(HAS_COLOR)\nattribute vec4 aColor;\nvarying vec4 vColor;\n#endif\n#else\n#include <fbo_picking_vert>\n#endif\n#include <vt_position_vert>\nvoid main() {\n vec3 c = unpackVTPosition();\n gl_Position = projViewModelMatrix * positionMatrix * vec4(c, 1.);\n#ifndef PICKING_MODE\n#if defined(HAS_COLOR)\nvColor = aColor / 255.;\n#endif\n#else\nfbo_picking_setData(gl_Position.w, true);\n#endif\n}";
16109
16157
 
16110
- const ws = a.identity([]);
16158
+ const Ss = a.identity([]);
16111
16159
 
16112
16160
  class Ms extends gn {
16113
16161
  constructor(e, t, n, i, r, s) {
@@ -16138,30 +16186,30 @@ class Ms extends gn {
16138
16186
  isEnableTileStencil(e) {
16139
16187
  return !!!(e && e.isRenderingTerrain && this.isTerrainSkin());
16140
16188
  }
16141
- init(e) {
16142
- const t = this.regl;
16143
- this.renderer = new s.Renderer(t);
16144
- const n = this.canvas, i = {
16189
+ init() {
16190
+ const e = this.regl;
16191
+ this.renderer = new s.Renderer(e);
16192
+ const t = this.canvas, n = {
16145
16193
  x: (e, t) => t.viewport ? t.viewport.x : 0,
16146
16194
  y: (e, t) => t.viewport ? t.viewport.y : 0,
16147
- width: (e, t) => t.viewport ? t.viewport.width : n ? n.width : 1,
16148
- height: (e, t) => t.viewport ? t.viewport.height : n ? n.height : 1
16149
- }, r = [ {
16195
+ width: (e, n) => n.viewport ? n.viewport.width : t ? t.width : 1,
16196
+ height: (e, n) => n.viewport ? n.viewport.height : t ? t.height : 1
16197
+ }, i = [ {
16150
16198
  name: "projViewModelMatrix",
16151
16199
  type: "function",
16152
16200
  fn: function(e, t) {
16153
16201
  const n = [];
16154
16202
  return a.multiply(n, t.projViewMatrix, t.modelMatrix), n;
16155
16203
  }
16156
- } ], o = this.sceneConfig.depthRange, l = {
16157
- vert: Ss,
16204
+ } ], r = this.sceneConfig.depthRange, o = {
16205
+ vert: ws,
16158
16206
  frag: "#define SHADER_NAME NATIVE_LINE\nprecision mediump float;\nuniform float lineOpacity;\nuniform vec4 lineColor;\nuniform float layerOpacity;\n#if defined(HAS_COLOR)\nvarying vec4 vColor;\n#endif\nvoid main() {\n gl_FragColor = lineColor * lineOpacity;\n#if defined(HAS_COLOR)\ngl_FragColor *= vColor;\n#endif\ngl_FragColor *= layerOpacity;\n}",
16159
- uniforms: r,
16207
+ uniforms: i,
16160
16208
  defines: null,
16161
16209
  extraCommandProps: {
16162
- viewport: i,
16210
+ viewport: n,
16163
16211
  stencil: {
16164
- enable: () => this.isEnableTileStencil(e),
16212
+ enable: (e, t) => this.isEnableTileStencil(t.painterContext),
16165
16213
  mask: 255,
16166
16214
  func: {
16167
16215
  cmp: () => this.isOnly2D() ? "=" : "<=",
@@ -16176,7 +16224,7 @@ class Ms extends gn {
16176
16224
  },
16177
16225
  depth: {
16178
16226
  enable: !0,
16179
- range: o || [ 0, 1 ],
16227
+ range: r || [ 0, 1 ],
16180
16228
  func: this.sceneConfig.depthFunc || "<="
16181
16229
  },
16182
16230
  blend: {
@@ -16190,9 +16238,9 @@ class Ms extends gn {
16190
16238
  }
16191
16239
  }
16192
16240
  };
16193
- this.shader = new s.MeshShader(l), this.pickingFBO && (this.picking = [ new s.FBORayPicking(this.renderer, {
16194
- vert: "#define PICKING_MODE 1\n" + Ss,
16195
- uniforms: r,
16241
+ this.shader = new s.MeshShader(o), this.pickingFBO && (this.picking = [ new s.FBORayPicking(this.renderer, {
16242
+ vert: "#define PICKING_MODE 1\n" + ws,
16243
+ uniforms: i,
16196
16244
  extraCommandProps: {
16197
16245
  viewport: this.pickingViewport
16198
16246
  }
@@ -16201,7 +16249,7 @@ class Ms extends gn {
16201
16249
  getUniformValues(e, t) {
16202
16250
  const n = t && t.isRenderingTerrainSkin;
16203
16251
  return {
16204
- projViewMatrix: n ? ws : e.projViewMatrix,
16252
+ projViewMatrix: n ? Ss : e.projViewMatrix,
16205
16253
  viewport: n && t && t.viewport
16206
16254
  };
16207
16255
  }
@@ -16237,7 +16285,7 @@ class Hs extends fn {
16237
16285
  a.fromScaling(e, Is), a.multiply(e, n, e), n = e;
16238
16286
  }
16239
16287
  const c = this.getSymbolDef(o), u = this.getFnTypeConfig(o);
16240
- wt(r, c, u, this.layer);
16288
+ St(r, c, u, this.layer);
16241
16289
  const f = this.getShader(), d = f.getGeometryDefines ? f.getGeometryDefines(r) : {}, p = this.getSymbol(o), g = Re(this.colorCache);
16242
16290
  if (r.data.aExtrude) {
16243
16291
  d.IS_LINE_EXTRUSION = 1;
@@ -16454,7 +16502,7 @@ class Vs extends Hs {
16454
16502
  t.aExtrusionOpacity = e;
16455
16503
  }
16456
16504
  const i = new s.Geometry(t, e.indices);
16457
- return we(i.properties, e.properties), this._prepareFeatureIds(i, e), {
16505
+ return Se(i.properties, e.properties), this._prepareFeatureIds(i, e), {
16458
16506
  geometry: i,
16459
16507
  symbolIndex: {
16460
16508
  index: 0
@@ -16463,7 +16511,7 @@ class Vs extends Hs {
16463
16511
  }
16464
16512
  updateSceneConfig(e) {
16465
16513
  let t;
16466
- if (this.sceneConfig.cullFace !== e.cullFace && (t = !0), we(this.sceneConfig, e),
16514
+ if (this.sceneConfig.cullFace !== e.cullFace && (t = !0), Se(this.sceneConfig, e),
16467
16515
  t) {
16468
16516
  const e = this.getShaderConfig();
16469
16517
  this.shader.dispose(), this.shader = new s.PhongShader(e);
@@ -16554,7 +16602,7 @@ class Vs extends Hs {
16554
16602
  this.material = new s.PhongMaterial(i);
16555
16603
  }
16556
16604
  getUniformValues(e, t) {
16557
- const n = e.viewMatrix, i = e.projMatrix, r = e.cameraPosition, s = this._getLightUniformValues(), o = we({
16605
+ const n = e.viewMatrix, i = e.projMatrix, r = e.cameraPosition, s = this._getLightUniformValues(), o = Se({
16558
16606
  viewMatrix: n,
16559
16607
  projMatrix: i,
16560
16608
  cameraPosition: r,
@@ -16692,7 +16740,7 @@ class js extends Hs {
16692
16740
  };
16693
16741
  e.data.aAltitude && (t.altitudeAttribute = "aAltitude");
16694
16742
  const n = new s.Geometry(e.data, e.indices, 0, t);
16695
- return we(n.properties, e.properties), e.vertexColors && (n.properties.vertexColors = e.vertexColors),
16743
+ return Se(n.properties, e.properties), e.vertexColors && (n.properties.vertexColors = e.vertexColors),
16696
16744
  this.material.uniforms.normalTexture && !n.data[n.desc.tangentAttribute] && n.data[n.desc.uv0Attribute] && (n.data[n.desc.normalAttribute] || n.createNormal(),
16697
16745
  n.createTangent()), this._prepareFeatureIds(n, e), {
16698
16746
  geometry: n,
@@ -16708,7 +16756,7 @@ class js extends Hs {
16708
16756
  let n = !!e.ssr && this.getSymbols()[0].ssr;
16709
16757
  const i = this.shader, r = i.shaderDefines;
16710
16758
  if (n) {
16711
- const t = we({}, r, e.ssr.defines);
16759
+ const t = Se({}, r, e.ssr.defines);
16712
16760
  i.shaderDefines = t;
16713
16761
  }
16714
16762
  if (e.onlyUpdateDepthInTaa && (this.shader = this._updateDepthShader, !n && this._previousSSR && (this.shader = i,
@@ -16719,7 +16767,7 @@ class js extends Hs {
16719
16767
  this.shader = i, n && (i.shaderDefines = r), delete this.shadowCount, this._previousSSR = n;
16720
16768
  }
16721
16769
  updateSceneConfig(e) {
16722
- we(this.sceneConfig, e), this.setToRedraw();
16770
+ Se(this.sceneConfig, e), this.setToRedraw();
16723
16771
  }
16724
16772
  delete() {
16725
16773
  super.delete(), this.disposeIBLTextures(), this.material.dispose(), this._updateDepthShader && (this._updateDepthShader.dispose(),
@@ -16800,7 +16848,7 @@ class js extends Hs {
16800
16848
  _updateMaterial(t) {
16801
16849
  if (t) {
16802
16850
  const e = this.getSymbols()[0].material;
16803
- e && we(e, t);
16851
+ e && Se(e, t);
16804
16852
  }
16805
16853
  const n = this.layer instanceof e.TileLayer, i = this.dataConfig, r = t || this.getSymbols()[0].material, o = {};
16806
16854
  let a = !1;
@@ -16881,7 +16929,7 @@ class Zs extends gn {
16881
16929
  if (!t.geometry) return null;
16882
16930
  const i = this.getMap(), {geometry: r, symbolIndex: o, ref: a} = t, l = this.getSymbolDef(o);
16883
16931
  if (void 0 === a) {
16884
- wt(r, l, this.getFnTypeConfig(o), this.layer);
16932
+ St(r, l, this.getFnTypeConfig(o), this.layer);
16885
16933
  }
16886
16934
  const h = this.getSymbol(o), {tileResolution: c, tileRatio: u} = r.properties, f = {
16887
16935
  tileResolution: c,
@@ -17085,7 +17133,7 @@ class Zs extends gn {
17085
17133
  }
17086
17134
  }
17087
17135
 
17088
- const {PackUtil: qs} = H(), $s = [], Js = [], Ks = [], Qs = [], eo = [], to = [], no = [ 0, 0, 0 ], io = [ 0, 0, 0 ], ro = [ 1, 1, 1 ], so = [], oo = [ 1, 1, 1, 1 ], ao = [], lo = [ 1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1 ], ho = e => class extends e {
17136
+ const {PackUtil: qs} = H(), $s = [], Js = [], Ks = [], Qs = [], eo = [], to = [], no = [], io = [ 0, 0, 0 ], ro = [ 0, 0, 0 ], so = [ 1, 1, 1 ], oo = [], ao = [ 1, 1, 1, 1 ], lo = [], ho = [ 1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1 ], co = e => class extends e {
17089
17137
  constructor(e, t, n, i, r, o) {
17090
17138
  super(e, t, n, i, r, o), this._ready = !1, this.scene.sortFunction = this.sortByCommandKey;
17091
17139
  const a = i.fetchOptions || {};
@@ -17111,7 +17159,7 @@ const {PackUtil: qs} = H(), $s = [], Js = [], Ks = [], Qs = [], eo = [], to = []
17111
17159
  const {data: n, positionSize: i} = e;
17112
17160
  return {
17113
17161
  geometry: {
17114
- properties: we({}, e.properties),
17162
+ properties: Se({}, e.properties),
17115
17163
  data: n,
17116
17164
  positionSize: i,
17117
17165
  features: t
@@ -17120,23 +17168,23 @@ const {PackUtil: qs} = H(), $s = [], Js = [], Ks = [], Qs = [], eo = [], to = []
17120
17168
  };
17121
17169
  }
17122
17170
  getFnTypeConfig() {
17123
- return so;
17171
+ return oo;
17124
17172
  }
17125
17173
  createMesh(e, t, {tileTranslationMatrix: n, tileExtent: i, tilePoint: r}, {timestamp: l}) {
17126
17174
  if (!this._ready) return null;
17127
17175
  const h = this.getMap(), {geometry: c} = e, {positionSize: u, features: f} = c;
17128
17176
  if (!c.data.aPosition || 0 === c.data.aPosition.length) return null;
17129
17177
  "native-line" === this.dataConfig.type && this._arrangeAlongLine(0, c, r);
17130
- const {aPosition: d, aPickingId: p, aXYRotation: g, aZRotation: m, aAltitude: y} = c.data;
17131
- let x = d.length / u;
17132
- const _ = {
17133
- instance_vectorA: new Float32Array(4 * x),
17134
- instance_vectorB: new Float32Array(4 * x),
17135
- instance_vectorC: new Float32Array(4 * x),
17178
+ const {aPosition: d} = c.data;
17179
+ let p = d.length / u;
17180
+ const g = {
17181
+ instance_vectorA: new Float32Array(4 * p),
17182
+ instance_vectorB: new Float32Array(4 * p),
17183
+ instance_vectorC: new Float32Array(4 * p),
17136
17184
  aPickingId: []
17137
- }, v = this._updateInstanceData(_, n, i, c.properties.z, d, y, g, m, u, p, f);
17138
- c.data.aTerrainAltitude && (_.aTerrainAltitude = c.data.aTerrainAltitude);
17139
- const b = {}, A = _.aPickingId, T = function(e) {
17185
+ }, m = this._updateInstanceData(g, n, i, c.properties.z, c.data, u, f);
17186
+ c.data.aTerrainAltitude && (g.aTerrainAltitude = c.data.aTerrainAltitude);
17187
+ const y = {}, x = g.aPickingId, _ = function(e) {
17140
17188
  const t = new Map;
17141
17189
  for (let n = 0; n < e.length; n++) {
17142
17190
  const i = e[n];
@@ -17144,36 +17192,36 @@ const {PackUtil: qs} = H(), $s = [], Js = [], Ks = [], Qs = [], eo = [], to = []
17144
17192
  r || (r = [], t.set(i, r)), r.push(n);
17145
17193
  }
17146
17194
  return t;
17147
- }(A);
17148
- for (const e in _) b[e] = {
17195
+ }(x);
17196
+ for (const e in g) y[e] = {
17149
17197
  buffer: this.regl.buffer({
17150
- dimension: _[e].length / x,
17151
- data: _[e]
17198
+ dimension: g[e].length / p,
17199
+ data: g[e]
17152
17200
  }),
17153
17201
  divisor: 1
17154
17202
  };
17155
- const S = this._hasFuncType(), w = this._getMeterScale(), M = a.identity([]);
17156
- a.scale(M, M, [ w, w, w ]);
17157
- const P = [], I = this.getSymbols();
17158
- for (let e = 0; e < I.length; e++) {
17159
- const t = I[e], i = this._gltfMeshInfos[e];
17203
+ const v = this._hasFuncType(), b = this._getMeterScale(), A = a.identity([]);
17204
+ a.scale(A, A, [ b, b, b ]);
17205
+ const T = [], w = this.getSymbols();
17206
+ for (let e = 0; e < w.length; e++) {
17207
+ const t = w[e], i = this._gltfMeshInfos[e];
17160
17208
  if (!i) continue;
17161
17209
  const r = this._gltfPack[e][0], {fixSizeOnZoom: u} = t;
17162
17210
  let f = a.identity([]);
17163
- S || (f = this._getSymbolTRSMatrix(f));
17211
+ v || (f = this._getSymbolTRSMatrix(f));
17164
17212
  let d = 0;
17165
17213
  i.forEach((e => {
17166
17214
  const {geometry: n, nodeMatrix: i} = e;
17167
- a.multiply(ao, lo, i), a.multiply(ao, f, ao);
17168
- const r = a.multiply(ao, M, ao), s = n.boundingBox.copy();
17215
+ a.multiply(lo, ho, i), a.multiply(lo, f, lo);
17216
+ const r = a.multiply(lo, A, lo), s = n.boundingBox.copy();
17169
17217
  s.transform(r);
17170
17218
  const o = this._calAnchorTranslation(s, t);
17171
17219
  Math.abs(o) > Math.abs(d) && (d = o);
17172
17220
  }));
17173
- const p = [ 0, 0, d ], g = i.map(((i, g) => {
17174
- const {geometry: m, materialInfo: y, morphWeights: S, extraInfo: w, nodeIndex: P} = i;
17175
- t.alphaTest && (y.alphaTest = t.alphaTest);
17176
- const I = new (this.getMaterialClazz(y))(y), C = {}, k = new s.InstancedMesh(b, x, m, I, {
17221
+ const b = [ 0, 0, d ], S = i.map(((i, v) => {
17222
+ const {geometry: T, materialInfo: w, morphWeights: S, extraInfo: M, nodeIndex: P} = i;
17223
+ t.alphaTest && (w.alphaTest = t.alphaTest);
17224
+ const I = new (this.getMaterialClazz(w))(w), C = {}, k = new s.InstancedMesh(y, p, T, I, {
17177
17225
  transparent: !1,
17178
17226
  picking: !0
17179
17227
  });
@@ -17183,14 +17231,14 @@ const {PackUtil: qs} = H(), $s = [], Js = [], Ks = [], Qs = [], eo = [], to = []
17183
17231
  k.setUniform("numJoints", t.numJoints), k.setUniform("skinAnimation", +this._isSkinAnimating(e)),
17184
17232
  k.properties.startTime = l, C.HAS_SKIN = 1;
17185
17233
  }
17186
- S && (k.setUniform("morphWeights", S), C.HAS_MORPH = 1), k.setUniform("hasAlpha", w.alphaMode && "BLEND" === w.alphaMode.toUpperCase()),
17187
- ke(k.uniforms, "polygonFill", t, "markerFill", oo, Re(this.colorCache)), ke(k.uniforms, "polygonOpacity", t, "markerOpacity", 1);
17234
+ S && (k.setUniform("morphWeights", S), C.HAS_MORPH = 1), k.setUniform("hasAlpha", M.alphaMode && "BLEND" === M.alphaMode.toUpperCase()),
17235
+ ke(k.uniforms, "polygonFill", t, "markerFill", ao, Re(this.colorCache)), ke(k.uniforms, "polygonOpacity", t, "markerOpacity", 1);
17188
17236
  const F = [];
17189
17237
  k.setPositionMatrix((() => {
17190
- const t = this._getMeshNodeMatrix(e, g, P);
17191
- a.multiply(F, lo, t), a.multiply(F, f, F), a.multiply(F, M, F);
17192
- const n = a.identity(ao);
17193
- if (0 !== d && (a.fromTranslation(n, p), a.multiply(F, n, F)), Le(u)) {
17238
+ const t = this._getMeshNodeMatrix(e, v, P);
17239
+ a.multiply(F, ho, t), a.multiply(F, f, F), a.multiply(F, A, F);
17240
+ const n = a.identity(lo);
17241
+ if (0 !== d && (a.fromTranslation(n, b), a.multiply(F, n, F)), Le(u)) {
17194
17242
  const e = h.getGLScale() / h.getGLScale(u);
17195
17243
  return o.set($s, e, e, e), a.fromScaling(n, $s), a.multiply(n, n, F);
17196
17244
  }
@@ -17199,26 +17247,26 @@ const {PackUtil: qs} = H(), $s = [], Js = [], Ks = [], Qs = [], eo = [], to = []
17199
17247
  const O = this.layer.getRenderer().getZScale(), R = [], E = [];
17200
17248
  return k.setLocalTransform((() => {
17201
17249
  const e = this.layer.options.altitude || 0;
17202
- return o.copy(E, v), E[2] += 100 * e * O, a.translate(R, n, E), R;
17203
- })), m.generateBuffers(this.regl, {
17250
+ return o.copy(E, m), E[2] += 100 * e * O, a.translate(R, n, E), R;
17251
+ })), T.generateBuffers(this.regl, {
17204
17252
  excludeElementsInVAO: !0
17205
- }), _.instance_color && (C.HAS_INSTANCE_COLOR = 1), _.aTerrainAltitude && (C.HAS_INSTANCE_TERRAIN_ALTITUDE = 1,
17253
+ }), g.instance_color && (C.HAS_INSTANCE_COLOR = 1), g.aTerrainAltitude && (C.HAS_INSTANCE_TERRAIN_ALTITUDE = 1,
17206
17254
  k.setUniform("terrainAltitudeScale", 100 * this.layer.getRenderer().getZScale())),
17207
- C.HAS_LAYER_OPACITY = 1, we(k.properties, c.properties), k.properties.aPickingId = A,
17208
- k.properties.nodeIndex = P, k.properties.pickingIdIndiceMap = T, k.setDefines(C),
17255
+ C.HAS_LAYER_OPACITY = 1, Se(k.properties, c.properties), k.properties.aPickingId = x,
17256
+ k.properties.nodeIndex = P, k.properties.pickingIdIndiceMap = _, k.setDefines(C),
17209
17257
  k.properties.symbolIndex = {
17210
17258
  index: e
17211
17259
  }, k;
17212
17260
  }));
17213
- P.push(...g);
17261
+ T.push(...S);
17214
17262
  }
17215
- return P.insContext = {
17216
- instanceData: _,
17263
+ return T.insContext = {
17264
+ instanceData: g,
17217
17265
  tileTranslationMatrix: n,
17218
17266
  tileExtent: i,
17219
17267
  aPosition: d,
17220
17268
  positionSize: u
17221
- }, P;
17269
+ }, T;
17222
17270
  }
17223
17271
  _arrangeAlongLine(e, t) {
17224
17272
  const {tileExtent: n, z: r} = t.properties, {data: s, positionSize: a} = t;
@@ -17229,32 +17277,33 @@ const {PackUtil: qs} = H(), $s = [], Js = [], Ks = [], Qs = [], eo = [], to = []
17229
17277
  gapLength: this.dataConfig.gapLength || 0,
17230
17278
  direction: this.dataConfig.direction || 0,
17231
17279
  scaleVertex: !0
17232
- }, u = this._gltfPack[0][0], {aPosition: f, aAltitude: d, aPickingId: p} = s, g = new i(0, 0, 0), m = new i(0, 0, 0), y = [], x = d ? [] : y, _ = [], v = [], b = [], A = [], T = [], S = this.layer.getTileSize().width / n * this.layer.getRenderer().getTileGLScale(r), w = this.layer.getRenderer().getZScale();
17233
- let M = p[0];
17280
+ }, u = this._gltfPack[0][0], {aPosition: f, aAltitude: d, aPickingId: p} = s, g = new i(0, 0, 0), m = new i(0, 0, 0), y = [], x = d ? [] : y, _ = [], v = [], b = [], A = [], T = [], w = [], S = this.layer.getTileSize().width / n * this.layer.getRenderer().getTileGLScale(r), M = this.layer.getRenderer().getZScale();
17281
+ let P = p[0];
17234
17282
  for (let e = 0; e < f.length - a; e += a) {
17235
17283
  const t = p[e / a + 1];
17236
- if (t !== M) {
17237
- M = t;
17284
+ if (t !== P) {
17285
+ P = t;
17238
17286
  continue;
17239
17287
  }
17240
- d ? o.set(A, f[e], f[e + 1], d[e / a]) : qs.unpackPosition(A, f[e], f[e + 1], f[e + 2]);
17241
- const [n, i, r] = A;
17288
+ d ? o.set(T, f[e], f[e + 1], d[e / a]) : qs.unpackPosition(T, f[e], f[e + 1], f[e + 2]);
17289
+ const [n, i, r] = T;
17242
17290
  let s = e + a;
17243
- d ? o.set(T, f[s], f[s + 1], d[s / a]) : qs.unpackPosition(T, f[s], f[s + 1], f[s + 2]);
17244
- const [h, P, I] = T, C = p[e / a], k = g.set(n * S, i * S, r * w), F = m.set(h * S, P * S, I * w), O = k.distanceTo(F), R = u.arrangeAlongLine(k, F, O, l, 1, c);
17245
- for (let e = 0; e < R.length; e++) {
17246
- const t = R[e];
17247
- g.set(n, i, r), m.set(h, P, I);
17248
- const s = co(g, m, t.t);
17249
- y.push(s.x, s.y), x.push(s.z), _.push(C), v.push(-t.rotationZ * Math.PI / 180),
17250
- b.push(t.rotationXY * Math.PI / 180);
17291
+ d ? o.set(w, f[s], f[s + 1], d[s / a]) : qs.unpackPosition(w, f[s], f[s + 1], f[s + 2]);
17292
+ const [h, I, C] = w, k = p[e / a], F = g.set(n * S, i * S, r * M), O = m.set(h * S, I * S, C * M), R = F.distanceTo(O), E = u.arrangeAlongLine(F, O, R, l, 1, c);
17293
+ for (let e = 0; e < E.length; e++) {
17294
+ const t = E[e];
17295
+ g.set(n, i, r), m.set(h, I, C);
17296
+ const s = uo(g, m, t.t);
17297
+ y.push(s.x, s.y), x.push(s.z), _.push(k), v.push(-t.rotationZ * Math.PI / 180),
17298
+ b.push(t.rotationXY * Math.PI / 180), A.push(...t.scale);
17251
17299
  }
17252
17300
  }
17253
17301
  t.data = {
17254
17302
  aPosition: new f.constructor(y),
17255
17303
  aPickingId: new p.constructor(_),
17256
17304
  aZRotation: v,
17257
- aXYRotation: b
17305
+ aXYRotation: b,
17306
+ aScaleXYZ: A
17258
17307
  }, d && (t.data.aAltitude = new d.constructor(x));
17259
17308
  }
17260
17309
  _calGLTFScale(e) {
@@ -17310,7 +17359,7 @@ const {PackUtil: qs} = H(), $s = [], Js = [], Ks = [], Qs = [], eo = [], to = []
17310
17359
  n && this.setToRedraw(!0), super.prepareRender(e);
17311
17360
  }
17312
17361
  getShadowMeshes() {
17313
- if (!this.isVisible()) return so;
17362
+ if (!this.isVisible()) return oo;
17314
17363
  this.shadowCount = this.scene.getMeshes().length;
17315
17364
  return this.scene.getMeshes().filter((e => 0 === e.properties.level));
17316
17365
  }
@@ -17318,38 +17367,40 @@ const {PackUtil: qs} = H(), $s = [], Js = [], Ks = [], Qs = [], eo = [], to = []
17318
17367
  const t = this.getSymbols()[e];
17319
17368
  return !!(t && t.animation && this._gltfPack[e] && this._gltfPack[e][0] && this._gltfPack[e][0].hasSkinAnimation());
17320
17369
  }
17321
- _updateInstanceData(e, t, n, i, r, s, l, h, c, u, f) {
17322
- function d(t, n, i, r) {
17370
+ _updateInstanceData(e, t, n, i, r, s, l) {
17371
+ function h(t, n, i, r) {
17323
17372
  e[t][4 * n] = i[r], e[t][4 * n + 1] = i[r + 4], e[t][4 * n + 2] = i[r + 8], e[t][4 * n + 3] = i[r + 12];
17324
17373
  }
17325
- const p = r.length / c, g = this.layer.getTileSize().width / n * this.layer.getRenderer().getTileGLScale(i), m = this.layer.getRenderer().getZScale(), y = 100 * (this.dataConfig.altitudeOffset || 0);
17326
- let x = 1 / 0, _ = 1 / 0, v = 1 / 0, b = -1 / 0, A = -1 / 0, T = -1 / 0;
17327
- const S = [], w = [];
17328
- for (let e = 0; e < p; e++) {
17329
- s ? o.set(w, r[e * c], r[e * c + 1], s[e]) : qs.unpackPosition(w, r[e * c], r[e * c + 1], r[e * c + 2]);
17330
- const t = o.set(S, w[0] * g, -w[1] * g, (w[2] + y) * m);
17331
- t[0] < x && (x = t[0]), t[0] > b && (b = t[0]), t[1] < _ && (_ = t[1]), t[1] > A && (A = t[1]),
17332
- t[2] < v && (v = t[2]), t[2] > T && (T = t[2]);
17333
- }
17334
- const M = (x + b) / 2, P = (_ + A) / 2, I = (v + T) / 2, C = [], k = this._hasFuncType(), F = [ 0, 0, 1 ], O = [ 0, 0, 0 ];
17335
- for (let t = 0; t < p; t++) {
17336
- s ? o.set(w, r[t * c], r[t * c + 1], s[t]) : qs.unpackPosition(w, r[t * c], r[t * c + 1], r[t * c + 2]);
17337
- const n = w[0], i = w[1], p = o.set(S, n * g - M, -i * g - P, (w[2] + y) * m - I), x = l && l[t] || 0, _ = h && h[t] || 0;
17338
- if (x || _) {
17339
- a.fromRotation(C, _, F);
17340
- const e = o.set($s, Math.cos(_), Math.sin(_), 0), t = o.rotateZ(e, e, O, 90 * Math.PI / 180);
17341
- a.rotate(C, C, x, t);
17342
- const n = a.fromTranslation(ao, p);
17343
- a.multiply(C, n, C);
17344
- } else a.fromTranslation(C, p);
17345
- if (k) {
17346
- const e = this._getSymbolTRSMatrix(ao, f, u, t);
17347
- a.multiply(C, C, e);
17348
- }
17349
- d("instance_vectorA", t, C, 0), d("instance_vectorB", t, C, 1), d("instance_vectorC", t, C, 2),
17374
+ const {aPosition: c, aPickingId: u, aXYRotation: f, aZRotation: d, aAltitude: p, aScaleXYZ: g} = r, m = c.length / s, y = this.layer.getTileSize().width / n * this.layer.getRenderer().getTileGLScale(i), x = this.layer.getRenderer().getZScale(), _ = 100 * (this.dataConfig.altitudeOffset || 0);
17375
+ let v = 1 / 0, b = 1 / 0, A = 1 / 0, T = -1 / 0, w = -1 / 0, S = -1 / 0;
17376
+ const M = [], P = [];
17377
+ for (let e = 0; e < m; e++) {
17378
+ p ? o.set(P, c[e * s], c[e * s + 1], p[e]) : qs.unpackPosition(P, c[e * s], c[e * s + 1], c[e * s + 2]);
17379
+ const t = o.set(M, P[0] * y, -P[1] * y, (P[2] + _) * x);
17380
+ t[0] < v && (v = t[0]), t[0] > T && (T = t[0]), t[1] < b && (b = t[1]), t[1] > w && (w = t[1]),
17381
+ t[2] < A && (A = t[2]), t[2] > S && (S = t[2]);
17382
+ }
17383
+ const I = (v + T) / 2, C = (b + w) / 2, k = (A + S) / 2, F = [], O = this._hasFuncType(), R = [ 0, 0, 1 ], E = [ 0, 0, 0 ];
17384
+ for (let t = 0; t < m; t++) {
17385
+ p ? o.set(P, c[t * s], c[t * s + 1], p[t]) : qs.unpackPosition(P, c[t * s], c[t * s + 1], c[t * s + 2]);
17386
+ const n = P[0], i = P[1], r = o.set(M, n * y - I, -i * y - C, (P[2] + _) * x - k), m = o.set(eo, 1, 1, 1);
17387
+ g && (o.set(m, g[3 * t], g[3 * t + 1], g[3 * t + 2]), a.fromScaling(to, m));
17388
+ const v = f && f[t] || 0, b = d && d[t] || 0;
17389
+ if (v || b) {
17390
+ a.fromRotation(F, b, R);
17391
+ const e = o.set($s, Math.cos(b), Math.sin(b), 0), t = o.rotateZ(e, e, E, 90 * Math.PI / 180);
17392
+ a.rotate(F, F, v, t), g && a.multiply(F, F, to);
17393
+ const n = a.fromTranslation(lo, r);
17394
+ a.multiply(F, n, F);
17395
+ } else a.fromTranslation(F, r), g && a.multiply(F, F, to);
17396
+ if (O) {
17397
+ const e = this._getSymbolTRSMatrix(lo, l, u, t);
17398
+ a.multiply(F, F, e);
17399
+ }
17400
+ h("instance_vectorA", t, F, 0), h("instance_vectorB", t, F, 1), h("instance_vectorC", t, F, 2),
17350
17401
  e.aPickingId[t] = u[t];
17351
17402
  }
17352
- return o.set(S, M, P, I), S;
17403
+ return o.set(M, I, C, k), M;
17353
17404
  }
17354
17405
  _getMeterScale() {
17355
17406
  if (!this._meterScale) {
@@ -17367,8 +17418,8 @@ const {PackUtil: qs} = H(), $s = [], Js = [], Ks = [], Qs = [], eo = [], to = []
17367
17418
  this._rxFn && (u = this._rxFn(_, v)), this._ryFn && (f = this._ryFn(_, v)), this._rzFn && (d = this._rzFn(_, v));
17368
17419
  const T = o.set(Ks, u, f, d);
17369
17420
  this._sxFn && (p = this._sxFn(_, v)), this._syFn && (g = this._syFn(_, v)), this._szFn && (m = this._szFn(_, v));
17370
- const S = o.set(Qs, p * b, g * b, m * b);
17371
- return this._getGLTFMatrix(e, A, T, S);
17421
+ const w = o.set(Qs, p * b, g * b, m * b);
17422
+ return this._getGLTFMatrix(e, A, T, w);
17372
17423
  }
17373
17424
  _getModelHeightScale(e, t) {
17374
17425
  const n = this.symbolDef[0];
@@ -17452,40 +17503,43 @@ const {PackUtil: qs} = H(), $s = [], Js = [], Ks = [], Qs = [], eo = [], to = []
17452
17503
  delete this._nodeMatrixMap;
17453
17504
  }
17454
17505
  _getGLTFMatrix(e, t, n, i) {
17455
- const r = o.set($s, ...t || no), s = n || io, l = i || ro, h = p.fromEuler(to, s[0], s[1], s[2]);
17506
+ const r = o.set($s, ...t || io), s = n || ro, l = i || so, h = p.fromEuler(no, s[0], s[1], s[2]);
17456
17507
  return a.fromRotationTranslationScale(e, h, r, l);
17457
17508
  }
17509
+ shouldDrawParentTile() {
17510
+ return !1;
17511
+ }
17458
17512
  };
17459
17513
 
17460
- function co(e, t, n) {
17461
- const i = uo(e.x, t.x, n), r = uo(e.y, t.y, n), s = uo(e.z || 0, t.z || 0, n);
17514
+ function uo(e, t, n) {
17515
+ const i = fo(e.x, t.x, n), r = fo(e.y, t.y, n), s = fo(e.z || 0, t.z || 0, n);
17462
17516
  return new e.constructor(i, r, s);
17463
17517
  }
17464
17518
 
17465
- function uo(e, t, n) {
17519
+ function fo(e, t, n) {
17466
17520
  return e + n * (t - e);
17467
17521
  }
17468
17522
 
17469
- class fo extends(ho(Vs)){
17523
+ class po extends(co(Vs)){
17470
17524
  getMaterialClazz(e) {
17471
17525
  return e.diffuseFactor ? s.PhongSpecularGlossinessMaterial : s.PhongMaterial;
17472
17526
  }
17473
17527
  }
17474
17528
 
17475
- class po extends(ho(js)){
17529
+ class go extends(co(js)){
17476
17530
  getMaterialClazz(e) {
17477
17531
  return e.specularGlossinessTexture || e.diffuseTexture ? s.pbr.StandardSpecularGlossinessMaterial : s.pbr.StandardMaterial;
17478
17532
  }
17479
17533
  }
17480
17534
 
17481
- const {getPBRUniforms: go} = s.pbr.PBRUtils, mo = {
17535
+ const {getPBRUniforms: mo} = s.pbr.PBRUtils, yo = {
17482
17536
  color: [ 2.0303, 2.028, 2.028 ],
17483
17537
  direction: [ 0, -.2717, -1 ]
17484
- }, yo = .3737, xo = {
17538
+ }, xo = .3737, _o = {
17485
17539
  index: 0
17486
- }, _o = [ 0, 0, 0 ], vo = [ 2, 2 ];
17540
+ }, vo = [ 0, 0, 0 ], bo = [ 2, 2 ];
17487
17541
 
17488
- class bo extends gn {
17542
+ class Ao extends gn {
17489
17543
  supportRenderMode(e) {
17490
17544
  return "fxaa" === e || "fxaaBeforeTaa" === e;
17491
17545
  }
@@ -17500,7 +17554,7 @@ class bo extends gn {
17500
17554
  }
17501
17555
  needToRedraw() {
17502
17556
  if (super.needToRedraw()) return !0;
17503
- return this.getSymbol(xo).animation;
17557
+ return this.getSymbol(_o).animation;
17504
17558
  }
17505
17559
  createMesh(e, t) {
17506
17560
  const {geometry: n} = e;
@@ -17509,7 +17563,7 @@ class bo extends gn {
17509
17563
  castShadow: !1,
17510
17564
  picking: !0
17511
17565
  });
17512
- return i.properties.symbolIndex = xo, i.setLocalTransform(t), i;
17566
+ return i.properties.symbolIndex = _o, i.setLocalTransform(t), i;
17513
17567
  }
17514
17568
  callShader(e, t) {
17515
17569
  super.callShader(e, t), this.transformWater();
@@ -17520,15 +17574,15 @@ class bo extends gn {
17520
17574
  this._prepareMesh(e, t), super.addMesh(...arguments);
17521
17575
  }
17522
17576
  _prepareMesh(e) {
17523
- const t = this.getSymbol(xo).ssr;
17577
+ const t = this.getSymbol(_o).ssr;
17524
17578
  for (let n = 0; n < e.length; n++) e[n].ssr = t ? 1 : 0;
17525
17579
  }
17526
17580
  paint(e) {
17527
17581
  e.states && e.states.includesChanged && (this.shader.dispose(), this._waterShader.dispose(),
17528
17582
  this._createShader(e));
17529
- const t = !!e.ssr && this.getSymbol(xo).ssr, n = this._waterShader, i = n.shaderDefines;
17583
+ const t = !!e.ssr && this.getSymbol(_o).ssr, n = this._waterShader, i = n.shaderDefines;
17530
17584
  if (t) {
17531
- const t = we({}, i, e.ssr.defines);
17585
+ const t = Se({}, i, e.ssr.defines);
17532
17586
  n.shaderDefines = t;
17533
17587
  }
17534
17588
  this.updateIBLDefines(n), this._water.ssr = t ? 1 : 0, super.paint(e), t && (n.shaderDefines = i);
@@ -17621,7 +17675,7 @@ class bo extends gn {
17621
17675
  return g.fromRotation(n, Math.PI * i / 180);
17622
17676
  }
17623
17677
  } ], r = {
17624
- TIME_NOISE_TEXTURE_REPEAT: yo
17678
+ TIME_NOISE_TEXTURE_REPEAT: xo
17625
17679
  };
17626
17680
  this.fillIncludes(r, i, e);
17627
17681
  const o = {
@@ -17704,28 +17758,28 @@ class bo extends gn {
17704
17758
  };
17705
17759
  }
17706
17760
  _getWaterUniform(e, t) {
17707
- const {iblTexes: n, dfgLUT: i} = this.getIBLRes(), r = go(e, n, i, t && t.ssr, t && t.jitter), s = e.getLightManager();
17761
+ const {iblTexes: n, dfgLUT: i} = this.getIBLRes(), r = mo(e, n, i, t && t.ssr, t && t.jitter), s = e.getLightManager();
17708
17762
  let o = s && s.getDirectionalLight() || {};
17709
- const a = s && s.getAmbientLight() || {}, l = this.getSymbol(xo), h = this._waterDir = this._waterDir || [], u = this._waveParams = this._waveParams || [];
17763
+ const a = s && s.getAmbientLight() || {}, l = this.getSymbol(_o), h = this._waterDir = this._waterDir || [], u = this._waveParams = this._waveParams || [];
17710
17764
  c.set(u, .09, l.uvScale || 3, .03, -.5);
17711
- we(r, {
17765
+ Se(r, {
17712
17766
  ambientColor: a.color || [ .2, .2, .2 ],
17713
17767
  viewMatrix: e.viewMatrix,
17714
- lightDirection: o.direction || mo.direction,
17715
- lightColor: o.color || mo.color,
17768
+ lightDirection: o.direction || yo.direction,
17769
+ lightColor: o.color || yo.color,
17716
17770
  camPos: e.cameraPosition,
17717
17771
  timeElapsed: l.animation ? (this.layer.getRenderer().getFrameTimestamp() || 0) / (1 / (l.waterSpeed || 1) * 1e4) : 0,
17718
17772
  normalTexture: this._normalTex || this._emptyTex,
17719
17773
  heightTexture: this._pertTex || this._emptyTex,
17720
17774
  waveParams: u,
17721
- waterDir: Ao(h, l.waterDirection || 0),
17775
+ waterDir: To(h, l.waterDirection || 0),
17722
17776
  waterBaseColor: l.waterBaseColor || [ .1451, .2588, .4863, 1 ],
17723
17777
  contrast: l.contrast || 1,
17724
- hsv: l.hsv || _o
17778
+ hsv: l.hsv || vo
17725
17779
  });
17726
17780
  const f = this.layer.getRenderer();
17727
17781
  return r.layerOpacity = f._getLayerOpacity(), this.setIncludeUniformValues(r, t),
17728
- t && t.ssr && t.ssr.renderUniforms && we(r, t.ssr.renderUniforms), r;
17782
+ t && t.ssr && t.ssr.renderUniforms && Se(r, t.ssr.renderUniforms), r;
17729
17783
  }
17730
17784
  delete() {
17731
17785
  super.delete(), this._emptyTex && (this._emptyTex.destroy(), delete this._emptyTex),
@@ -17744,68 +17798,526 @@ class bo extends gn {
17744
17798
  transformWater() {
17745
17799
  const e = this.getMap(), t = l.getGroundTransform(this._water.localTransform, e);
17746
17800
  this._water.setLocalTransform(t);
17747
- const n = e._get2DExtentAtRes(e.getGLRes()), i = n.getWidth(), r = n.getHeight(), s = e.cameraLookAt, o = s[0] - i, a = s[1] + r, h = o / vo[0], c = a / vo[1], u = h % 1, f = c % 1, d = h * yo % 1, p = c * yo % 1, g = i / vo[0] * 2, m = r / vo[1] * 2;
17801
+ const n = e._get2DExtentAtRes(e.getGLRes()), i = n.getWidth(), r = n.getHeight(), s = e.cameraLookAt, o = s[0] - i, a = s[1] + r, h = o / bo[0], c = a / bo[1], u = h % 1, f = c % 1, d = h * xo % 1, p = c * xo % 1, g = i / bo[0] * 2, m = r / bo[1] * 2;
17748
17802
  this._water.setUniform("uvOffset", [ u, f ]), this._water.setUniform("noiseUvOffset", [ d, p ]),
17749
17803
  this._water.setUniform("uvScale", [ g, -m ]);
17750
17804
  }
17751
17805
  }
17752
17806
 
17753
- function Ao(e, t) {
17807
+ function To(e, t) {
17754
17808
  var n;
17755
17809
  return n = t, t = Math.PI * n / 180, e[0] = Math.sin(t), e[1] = Math.cos(t), e;
17756
17810
  }
17757
17811
 
17758
- const To = vt("fill", Cn);
17812
+ var wo = "#define SHADER_NAME BILL_BOARD\n#include <gl2_vert>\n#ifdef HAS_ALTITUDE\nattribute vec2 aPosition;\nattribute float aAltitude;\n#else\nattribute vec3 aPosition;\n#endif\nattribute vec2 aExtrude;\nattribute vec2 aTexCoord;\nattribute vec4 aQuat;\nvarying vec2 vTexCoord;\nuniform mat4 positionMatrix;\nuniform mat4 projViewModelMatrix;\nuniform float extrudeScale;\n#ifdef PICKING_MODE\n#include <fbo_picking_vert>\n#endif\n#include <vt_position_vert>\n#if defined(HAS_SHADOWING) && !defined(HAS_BLOOM)\n#include <vsm_shadow_vert>\n#endif\nmat4 c(vec4 q) {\n float x = q.x, y = q.y, z = q.z, w = q.w;\n float d = x * x, e = y * y, f = z * z;\n float xy = x * y, xz = x * z, yz = y * z;\n float wx = w * x, wy = w * y, wz = w * z;\n return mat4(1. - 2. * (e + f), 2. * (xy + wz), 2. * (xz - wy), .0, 2. * (xy - wz), 1. - 2. * (d + f), 2. * (yz + wx), .0, 2. * (xz + wy), 2. * (yz - wx), 1. - 2. * (d + e), .0, .0, .0, .0, 1.);\n}\nvoid main() {\n vec4 h = vec4(aExtrude.x * extrudeScale, .0, aExtrude.y, 1.);\n mat4 i = c(aQuat);\n vec3 j = (i * h).xyz;\n vec3 k = unpackVTPosition(j);\n vTexCoord = aTexCoord;\n gl_Position = projViewModelMatrix * positionMatrix * vec4(k, 1.);\n#ifdef PICKING_MODE\nfbo_picking_setData(gl_Position.w, true);\n#elif defined(HAS_SHADOWING) && !defined(HAS_BLOOM)\nshadow_computeShadowPars(vec4(k, 1.));\n#endif\n}";
17759
17813
 
17760
- To.registerAt(ht);
17814
+ function So(e, t, n) {
17815
+ n = n || {}, this.w = e || 64, this.h = t || 64, this.autoResize = !!n.autoResize,
17816
+ this.shelves = [], this.freebins = [], this.stats = {}, this.bins = {}, this.maxId = 0;
17817
+ }
17761
17818
 
17762
- const So = vt("line", Rn);
17819
+ function Mo(e, t, n) {
17820
+ this.x = 0, this.y = e, this.w = this.free = t, this.h = n;
17821
+ }
17763
17822
 
17764
- So.registerAt(ht);
17823
+ function Po(e, t, n, i, r, s, o) {
17824
+ this.id = e, this.x = t, this.y = n, this.w = i, this.h = r, this.maxw = s || i,
17825
+ this.maxh = o || r, this.refcount = 0;
17826
+ }
17765
17827
 
17766
- const wo = vt("line-gradient", jn);
17828
+ /*!
17829
+ * Codes from mapbox-gl-js
17830
+ * github.com/mapbox/mapbox-gl-js
17831
+ * MIT License
17832
+ */ function Io(e, {width: t, height: n}, i, r) {
17833
+ if (r) {
17834
+ if (r.length !== t * n * i) throw new RangeError("mismatched image size");
17835
+ } else r = new Uint8Array(t * n * i);
17836
+ return e.width = t, e.height = n, e.data = r, e;
17837
+ }
17767
17838
 
17768
- wo.registerAt(ht);
17839
+ function Co(e, t, n, i, r, s) {
17840
+ if (0 === r.width || 0 === r.height) return t;
17841
+ if (r.width > e.width || r.height > e.height || n.x > e.width - r.width || n.y > e.height - r.height) throw new RangeError("out of range source coordinates for image copy");
17842
+ if (r.width > t.width || r.height > t.height || i.x > t.width - r.width || i.y > t.height - r.height) throw new RangeError("out of range destination coordinates for image copy");
17843
+ const o = e.data, a = t.data;
17844
+ if (o === a) return t;
17845
+ for (let l = 0; l < r.height; l++) {
17846
+ const h = ((n.y + l) * e.width + n.x) * s, c = ((i.y + l) * t.width + i.x) * s;
17847
+ for (let e = 0; e < r.width * s; e++) a[c + e] = o[h + e];
17848
+ }
17849
+ return t;
17850
+ }
17769
17851
 
17770
- const Mo = vt("icon", Pr);
17852
+ So.prototype.pack = function(e, t) {
17853
+ e = [].concat(e), t = t || {};
17854
+ for (var n, i, r, s, o = [], a = 0; a < e.length; a++) if (n = e[a].w || e[a].width,
17855
+ i = e[a].h || e[a].height, r = e[a].id, n && i) {
17856
+ if (!(s = this.packOne(n, i, r))) continue;
17857
+ t.inPlace && (e[a].x = s.x, e[a].y = s.y, e[a].id = s.id), o.push(s);
17858
+ }
17859
+ return this.shrink(), o;
17860
+ }, So.prototype.packOne = function(e, t, n) {
17861
+ var i, r, s, o, a, l, h, c, u = {
17862
+ freebin: -1,
17863
+ shelf: -1,
17864
+ waste: 1 / 0
17865
+ }, f = 0;
17866
+ if ("string" == typeof n || "number" == typeof n) {
17867
+ if (i = this.getBin(n)) return this.ref(i), i;
17868
+ "number" == typeof n && (this.maxId = Math.max(n, this.maxId));
17869
+ } else n = ++this.maxId;
17870
+ for (o = 0; o < this.freebins.length; o++) {
17871
+ if (t === (i = this.freebins[o]).maxh && e === i.maxw) return this.allocFreebin(o, e, t, n);
17872
+ t > i.maxh || e > i.maxw || t <= i.maxh && e <= i.maxw && (s = i.maxw * i.maxh - e * t) < u.waste && (u.waste = s,
17873
+ u.freebin = o);
17874
+ }
17875
+ for (o = 0; o < this.shelves.length; o++) if (f += (r = this.shelves[o]).h, !(e > r.free)) {
17876
+ if (t === r.h) return this.allocShelf(o, e, t, n);
17877
+ t > r.h || t < r.h && (s = (r.h - t) * e) < u.waste && (u.freebin = -1, u.waste = s,
17878
+ u.shelf = o);
17879
+ }
17880
+ return -1 !== u.freebin ? this.allocFreebin(u.freebin, e, t, n) : -1 !== u.shelf ? this.allocShelf(u.shelf, e, t, n) : t <= this.h - f && e <= this.w ? (r = new Mo(f, this.w, t),
17881
+ this.allocShelf(this.shelves.push(r) - 1, e, t, n)) : this.autoResize ? (a = l = this.h,
17882
+ ((h = c = this.w) <= a || e > h) && (c = 2 * Math.max(e, h)), (a < h || t > a) && (l = 2 * Math.max(t, a)),
17883
+ this.resize(c, l), this.packOne(e, t, n)) : null;
17884
+ }, So.prototype.allocFreebin = function(e, t, n, i) {
17885
+ var r = this.freebins.splice(e, 1)[0];
17886
+ return r.id = i, r.w = t, r.h = n, r.refcount = 0, this.bins[i] = r, this.ref(r),
17887
+ r;
17888
+ }, So.prototype.allocShelf = function(e, t, n, i) {
17889
+ var r = this.shelves[e].alloc(t, n, i);
17890
+ return this.bins[i] = r, this.ref(r), r;
17891
+ }, So.prototype.shrink = function() {
17892
+ if (this.shelves.length > 0) {
17893
+ for (var e = 0, t = 0, n = 0; n < this.shelves.length; n++) {
17894
+ var i = this.shelves[n];
17895
+ t += i.h, e = Math.max(i.w - i.free, e);
17896
+ }
17897
+ this.resize(e, t);
17898
+ }
17899
+ }, So.prototype.getBin = function(e) {
17900
+ return this.bins[e];
17901
+ }, So.prototype.ref = function(e) {
17902
+ if (1 == ++e.refcount) {
17903
+ var t = e.h;
17904
+ this.stats[t] = 1 + (0 | this.stats[t]);
17905
+ }
17906
+ return e.refcount;
17907
+ }, So.prototype.unref = function(e) {
17908
+ return 0 === e.refcount ? 0 : (0 == --e.refcount && (this.stats[e.h]--, delete this.bins[e.id],
17909
+ this.freebins.push(e)), e.refcount);
17910
+ }, So.prototype.clear = function() {
17911
+ this.shelves = [], this.freebins = [], this.stats = {}, this.bins = {}, this.maxId = 0;
17912
+ }, So.prototype.resize = function(e, t) {
17913
+ this.w = e, this.h = t;
17914
+ for (var n = 0; n < this.shelves.length; n++) this.shelves[n].resize(e);
17915
+ return !0;
17916
+ }, Mo.prototype.alloc = function(e, t, n) {
17917
+ if (e > this.free || t > this.h) return null;
17918
+ var i = this.x;
17919
+ return this.x += e, this.free -= e, new Po(n, i, this.y, e, t, e, this.h);
17920
+ }, Mo.prototype.resize = function(e) {
17921
+ return this.free += e - this.w, this.w = e, !0;
17922
+ };
17771
17923
 
17772
- Mo.registerAt(ht);
17924
+ class ko {
17925
+ constructor(e, t) {
17926
+ Io(this, e, 4, t);
17927
+ }
17928
+ resize(e) {
17929
+ !function(e, {width: t, height: n}, i) {
17930
+ if (t === e.width && n === e.height) return;
17931
+ const r = Io({}, {
17932
+ width: t,
17933
+ height: n
17934
+ }, i);
17935
+ Co(e, r, {
17936
+ x: 0,
17937
+ y: 0
17938
+ }, {
17939
+ x: 0,
17940
+ y: 0
17941
+ }, {
17942
+ width: Math.min(e.width, t),
17943
+ height: Math.min(e.height, n)
17944
+ }, i), e.width = t, e.height = n, e.data = r.data;
17945
+ }(this, e, 4);
17946
+ }
17947
+ clone() {
17948
+ return new ko({
17949
+ width: this.width,
17950
+ height: this.height
17951
+ }, new Uint8Array(this.data));
17952
+ }
17953
+ static copy(e, t, n, i, r) {
17954
+ Co(e, t, n, i, r, 4);
17955
+ }
17956
+ }
17773
17957
 
17774
- const Po = vt("text", xs);
17958
+ const Fo = new e.Point(0, 0), Oo = [], Ro = [], Eo = document.createElement("canvas");
17775
17959
 
17776
- Po.registerAt(ht);
17960
+ class Do extends gn {
17961
+ constructor(...e) {
17962
+ super(...e), this._ready = !0;
17963
+ const t = this.getSymbolDef({
17964
+ index: 0
17965
+ }), n = B(t && t.source);
17966
+ if (this._ready = !n, _(t.width) ? this._widthFn = v(t.width) : this._width = t.width,
17967
+ _(t.height) ? this._heightFn = v(t.height) : this._height = t.height, _(t.rotationX) ? this._rotationXFn = v(t.rotationX) : this._rotationX = t.rotationX,
17968
+ _(t.rotationY) ? this._rotationYFn = v(t.rotationY) : this._rotationY = t.rotationY,
17969
+ _(t.rotationZ) ? this._rotationZFn = v(t.rotationZ) : this._rotationZ = t.rotationZ,
17970
+ n) {
17971
+ const e = this._image = new Image;
17972
+ e.onload = () => {
17973
+ this._ready = !0;
17974
+ }, e.src = t.source;
17975
+ }
17976
+ }
17977
+ needToRedraw() {
17978
+ const e = this.getSymbolDef({
17979
+ index: 0
17980
+ });
17981
+ if (!e || !j(e.source)) return super.needToRedraw();
17982
+ const t = this.layer.getRenderer().getCurrentTiles();
17983
+ if (!t || bt(t)) return super.needToRedraw();
17984
+ return this._checkIfSourceUpdated() || super.needToRedraw();
17985
+ }
17986
+ _checkIfSourceUpdated() {
17987
+ let e = !1;
17988
+ const t = this.layer.getRenderer(), n = t.getCurrentTiles(), i = this.getSymbolDef({
17989
+ index: 0
17990
+ }).source, r = t.tileCache, s = [];
17991
+ for (const t in n) {
17992
+ const n = r.get(t);
17993
+ if (!(n && n.image && n.image.cache && n.image.cache[0])) continue;
17994
+ let {geometry: o} = n.image.cache[0];
17995
+ if (!o || !o[0] || !o[0].geometry) continue;
17996
+ o = o[0].geometry.properties.billGeometry;
17997
+ const {oldPickingId: a, contextCache: l, textureCache: h, features: c, billTexture: u} = o.properties;
17998
+ if (!a || !a.length) continue;
17999
+ let f = !1, d = !1;
18000
+ const p = a.length;
18001
+ for (let t = 0; t < p; t++) {
18002
+ const n = a[t], r = l[n] = l[n] || {}, o = c[n] && c[n].feature;
18003
+ if (!o) continue;
18004
+ const u = h[n];
18005
+ let p = 0, g = 0;
18006
+ u && (p = u.width, g = u.height);
18007
+ let m, y = i(r, o.properties);
18008
+ y.redraw ? (f = e = !0, m = h[n] = y.data, p === m.width && g === m.height || (d = !0)) : m = h[n],
18009
+ s.push({
18010
+ id: n,
18011
+ w: m.width,
18012
+ h: m.height
18013
+ });
18014
+ }
18015
+ if (f) {
18016
+ const e = d ? o.properties.aTexCoord : null, t = this._fillFnTextureData(e, o, s);
18017
+ u({
18018
+ width: t.width,
18019
+ height: t.height,
18020
+ data: t.data,
18021
+ format: t.format,
18022
+ mag: "linear",
18023
+ min: "linear",
18024
+ flipY: !1,
18025
+ premultiplyAlpha: !0
18026
+ }), d && o.updateData("aTexCoord", o.properties.aTexCoord);
18027
+ }
18028
+ }
18029
+ return e;
18030
+ }
18031
+ isTerrainSkin() {
18032
+ return !1;
18033
+ }
18034
+ isTerrainVector() {
18035
+ return this.layer.options.awareOfTerrain;
18036
+ }
18037
+ isUniqueStencilRefPerTile() {
18038
+ return !1;
18039
+ }
18040
+ createMesh(e, t, {tilePoint: n}) {
18041
+ if (!this._ready) return null;
18042
+ let {geometry: i} = e;
18043
+ const {features: r, tileResolution: o, tileRatio: a} = i.properties;
18044
+ if (!i.data.aPosition || 0 === i.data.aPosition.length) return null;
18045
+ const l = this._createBillboard(i, i.desc.positionSize, r);
18046
+ l.generateBuffers(this.regl), i.properties.billGeometry = l;
18047
+ const h = new s.Material({
18048
+ texture: l.properties.billTexture
18049
+ }), c = new s.Mesh(l, h, {
18050
+ castShadow: !1,
18051
+ picking: !0
18052
+ }), u = this.getMap();
18053
+ Fo.set(n[0], n[1]);
18054
+ const f = u.altitudeToPoint(1, o) * a;
18055
+ c.setUniform("extrudeScale", f / 100);
18056
+ const d = [];
18057
+ c.setFunctionUniform("textureSize", (() => {
18058
+ const e = l.properties.billTexture;
18059
+ return d[0] = e.width, d[1] = e.height, d;
18060
+ }));
18061
+ const p = {};
18062
+ return c.geometry.data.aAltitude && (p.HAS_ALTITUDE = 1), c.setDefines(p), c.positionMatrix = this.getAltitudeOffsetMatrix(),
18063
+ c.setLocalTransform(t), c.properties.symbolIndex = {
18064
+ index: 0
18065
+ }, c;
18066
+ }
18067
+ _createBillboard(e, t, n) {
18068
+ const i = e.properties.z, {aPosition: r, aPickingId: o} = e.data, a = e.properties;
18069
+ a.oldPickingId = o;
18070
+ const l = a.contextCache = [], h = a.textureCache = [], c = o.length, u = 6 * c, f = new r.constructor(u * t), d = new Int16Array(2 * u), p = new Float32Array(4 * u), g = new o.constructor(u), m = this.getSymbolDef({
18071
+ index: 0
18072
+ }).source, y = [];
18073
+ for (let e = 0; e < c; e++) {
18074
+ const n = r.subarray(e * t, (e + 1) * t), i = o[e];
18075
+ f.set(n, 6 * e * t), f.set(n, (6 * e + 1) * t), f.set(n, (6 * e + 2) * t), f.set(n, (6 * e + 3) * t),
18076
+ f.set(n, (6 * e + 4) * t), f.set(n, (6 * e + 5) * t), g[6 * e] = i, g[6 * e + 1] = i,
18077
+ g[6 * e + 2] = i, g[6 * e + 3] = i, g[6 * e + 4] = i, g[6 * e + 5] = i;
18078
+ }
18079
+ const x = j(m);
18080
+ for (let e = 0; e < c; e++) {
18081
+ const t = o[e], r = n[t];
18082
+ let s;
18083
+ if (x) {
18084
+ s = m(l[t] = l[t] || {}, r && r.feature && r.feature.properties).data, h[t] = s,
18085
+ y.push({
18086
+ id: t,
18087
+ w: s.width,
18088
+ h: s.height
18089
+ });
18090
+ } else s = this._image;
18091
+ this._fillExtrude(d, e, r, i), this._fillQuat(p, e, r, i);
18092
+ }
18093
+ const _ = new Int16Array(2 * u);
18094
+ if (y.length) {
18095
+ const t = this._fillFnTextureData(_, e, y);
18096
+ a.billTexture = yn(this.regl, t, !1, !1);
18097
+ } else {
18098
+ const e = {
18099
+ x: 0,
18100
+ y: 0,
18101
+ w: this._image.width,
18102
+ h: this._image.height
18103
+ };
18104
+ for (let t = 0; t < c; t++) this._fillTexCoord(_, t, e, 1);
18105
+ const t = this._image;
18106
+ a.billTexture = this.regl.texture({
18107
+ width: t.width,
18108
+ height: t.height,
18109
+ data: t
18110
+ });
18111
+ }
18112
+ const v = 6 * c < 65536 ? Uint16Array : Uint32Array;
18113
+ const b = [];
18114
+ for (let e = 0; e < c; e++) {
18115
+ const t = 6 * e;
18116
+ b.push(t, t + 1, t + 2), b.push(t + 3, t + 4, t + 5);
18117
+ }
18118
+ const A = {
18119
+ aPosition: f,
18120
+ aPickingId: g,
18121
+ aExtrude: d,
18122
+ aQuat: p,
18123
+ aTexCoord: _
18124
+ }, {feaPickingIdMap: T, aFeaIds: w} = e.properties, S = new w.constructor(u);
18125
+ for (let e = 0; e < g.length; e++) S[e] = T[g[e]];
18126
+ a.aFeaIds = S, a.aTexCoord = _;
18127
+ const M = new s.Geometry(A, new v(b), 0, {
18128
+ positionSize: t
18129
+ });
18130
+ return M.properties = e.properties, M;
18131
+ }
18132
+ _fillQuat(e, t, n, i) {
18133
+ let r = this._rotationX || 0, s = this._rotationY || 0, o = this._rotationZ || 0;
18134
+ const a = n && n.feature && n.feature.properties;
18135
+ this._rotationXFn && (r = this._rotationXFn(i, a)), this._rotationYFn && (s = this._rotationYFn(i, a)),
18136
+ this._rotationZFn && (o = this._rotationZFn(i, a)), p.fromEuler(Ro, r, s, -o);
18137
+ for (let n = 0; n < 6; n++) e.set(Ro, 4 * (t + n));
18138
+ }
18139
+ _fillExtrude(e, t, n, i) {
18140
+ let r = this._width || 0, s = this._height || 0;
18141
+ const o = n && n.feature && n.feature.properties;
18142
+ this._widthFn && (r = this._widthFn(i, o)), this._heightFn && (s = this._heightFn(i, o));
18143
+ const a = r / 2 * 100, l = s / 2 * 100;
18144
+ Oo[0] = -a, Oo[1] = -l, e.set(Oo, 2 * t), Oo[0] = a, Oo[1] = l, e.set(Oo, 2 * t + 2),
18145
+ Oo[0] = -a, Oo[1] = l, e.set(Oo, 2 * t + 4), Oo[0] = -a, Oo[1] = -l, e.set(Oo, 2 * t + 6),
18146
+ Oo[0] = a, Oo[1] = -l, e.set(Oo, 2 * t + 8), Oo[0] = a, Oo[1] = l, e.set(Oo, 2 * t + 10);
18147
+ }
18148
+ _fillFnTextureData(e, t, n) {
18149
+ const i = t.properties, {textureCache: r, oldPickingId: s} = i, o = s.length, a = new So(0, 0, {
18150
+ autoResize: !0
18151
+ }), l = Eo.getContext("2d");
18152
+ a.pack(n, {
18153
+ inPlace: !0
18154
+ });
18155
+ const h = this.sceneConfig.textureLimit || 1024;
18156
+ let c = 1;
18157
+ a.w * a.h > h * h && (c = Math.sqrt(h * h / (a.w * a.h)), a.resize(Math.floor(a.w * c), Math.floor(a.h * c)));
18158
+ const u = new ko({
18159
+ width: a.w,
18160
+ height: a.h
18161
+ });
18162
+ for (let t = 0; t < o; t++) {
18163
+ const i = n[t];
18164
+ e && this._fillTexCoord(e, t, i, c);
18165
+ const s = r[i.id];
18166
+ if (!s) continue;
18167
+ const o = Math.floor(i.w * c), a = Math.floor(i.h * c);
18168
+ Eo.width = o, Eo.height = a, l.drawImage(s, 0, 0, o, a);
18169
+ const h = l.getImageData(0, 0, o, a);
18170
+ ko.copy(h, u, {
18171
+ x: 0,
18172
+ y: 0
18173
+ }, {
18174
+ x: Math.floor(i.x * c),
18175
+ y: Math.floor(i.y * c)
18176
+ }, {
18177
+ width: o,
18178
+ height: a
18179
+ });
18180
+ }
18181
+ return u.format = "rgba", u;
18182
+ }
18183
+ _fillTexCoord(e, t, n, i) {
18184
+ const {x: r, y: s, w: o, h: a} = n, l = Math.floor(r * i), h = Math.floor((r + o) * i), c = Math.floor(s * i), u = Math.floor((s + a) * i);
18185
+ Oo[0] = l, Oo[1] = u, e.set(Oo, 2 * t), Oo[0] = h, Oo[1] = c, e.set(Oo, 2 * t + 2),
18186
+ Oo[0] = l, Oo[1] = c, e.set(Oo, 2 * t + 4), Oo[0] = l, Oo[1] = u, e.set(Oo, 2 * t + 6),
18187
+ Oo[0] = h, Oo[1] = u, e.set(Oo, 2 * t + 8), Oo[0] = h, Oo[1] = c, e.set(Oo, 2 * t + 10);
18188
+ }
18189
+ init() {
18190
+ const e = this.regl;
18191
+ this.renderer = new s.Renderer(e);
18192
+ const t = [], n = {
18193
+ vert: wo,
18194
+ frag: "#define SHADER_NAME BILL_BOARD\nprecision mediump float;\nuniform sampler2D texture;\nuniform vec2 textureSize;\nvarying vec2 vTexCoord;\nvoid main() {\n gl_FragColor = texture2D(texture, vTexCoord / textureSize);\n#if defined(HAS_SHADOWING) && !defined(HAS_BLOOM)\nfloat c = shadow_computeShadow();\n gl_FragColor.rgb = shadow_blend(gl_FragColor.rgb, c);\n#endif\n}",
18195
+ uniforms: [ {
18196
+ name: "projViewModelMatrix",
18197
+ type: "function",
18198
+ fn: function(e, n) {
18199
+ return a.multiply(t, n.projViewMatrix, n.modelMatrix), t;
18200
+ }
18201
+ } ],
18202
+ defines: null,
18203
+ extraCommandProps: {
18204
+ viewport: {
18205
+ x: 0,
18206
+ y: 0,
18207
+ width: () => this.canvas ? this.canvas.width : 1,
18208
+ height: () => this.canvas ? this.canvas.height : 1
18209
+ },
18210
+ depth: {
18211
+ enable: !0,
18212
+ range: this.sceneConfig.depthRange || [ 0, 1 ],
18213
+ func: this.sceneConfig.depthFunc || "<="
18214
+ },
18215
+ blend: {
18216
+ enable: !0,
18217
+ func: this.getBlendFunc(),
18218
+ equation: "add"
18219
+ },
18220
+ cull: {
18221
+ enable: !1
18222
+ }
18223
+ }
18224
+ };
18225
+ if (this.shader = new s.MeshShader(n), this.shader.version = 300, this.pickingFBO) {
18226
+ const e = [];
18227
+ this.picking = [ new s.FBORayPicking(this.renderer, {
18228
+ vert: "#define PICKING_MODE 1\n" + wo,
18229
+ uniforms: [ {
18230
+ name: "projViewModelMatrix",
18231
+ type: "function",
18232
+ fn: function(t, n) {
18233
+ return a.multiply(e, n.projViewMatrix, n.modelMatrix), e;
18234
+ }
18235
+ } ],
18236
+ extraCommandProps: {
18237
+ viewport: this.pickingViewport,
18238
+ depth: {
18239
+ enable: !0,
18240
+ range: this.sceneConfig.depthRange || [ 0, 1 ],
18241
+ func: this.sceneConfig.depthFunc || "<="
18242
+ },
18243
+ cull: {
18244
+ enable: !1
18245
+ }
18246
+ }
18247
+ }, this.pickingFBO, this.getMap()) ];
18248
+ }
18249
+ }
18250
+ getUniformValues(e) {
18251
+ return {
18252
+ projViewMatrix: e.projViewMatrix
18253
+ };
18254
+ }
18255
+ deleteMesh(e, t) {
18256
+ if (Array.isArray(e)) for (let t = 0; t < e.length; t++) {
18257
+ const n = e[t];
18258
+ if (n.geometry) {
18259
+ const e = n.geometry.properties;
18260
+ e.textureCache && (delete e.billTexture, delete e.textureCache, delete e.contextCache);
18261
+ }
18262
+ } else if (e.geometry) {
18263
+ const t = e.geometry.properties;
18264
+ t.textureCache && (delete t.billTexture, delete t.textureCache, delete t.contextCache);
18265
+ }
18266
+ return super.deleteMesh(e, t);
18267
+ }
18268
+ }
17777
18269
 
17778
- const Io = vt("native-line", Ms);
18270
+ const Lo = vt("fill", Cn);
17779
18271
 
17780
- Io.registerAt(ht);
18272
+ Lo.registerAt(ht);
18273
+
18274
+ const Ho = vt("line", Rn);
18275
+
18276
+ Ho.registerAt(ht);
18277
+
18278
+ const No = vt("line-gradient", jn);
18279
+
18280
+ No.registerAt(ht);
18281
+
18282
+ const zo = vt("icon", Pr);
18283
+
18284
+ zo.registerAt(ht);
18285
+
18286
+ const Vo = vt("text", xs);
18287
+
18288
+ Vo.registerAt(ht);
18289
+
18290
+ const Uo = vt("native-line", Ms);
18291
+
18292
+ Uo.registerAt(ht);
17781
18293
 
17782
18294
  vt("native-point", Ts).registerAt(ht);
17783
18295
 
17784
- const Co = vt("phong", Vs);
18296
+ const Bo = vt("phong", Vs);
17785
18297
 
17786
- Co.registerAt(ht);
18298
+ Bo.registerAt(ht);
17787
18299
 
17788
- const ko = vt("wireframe", Bs);
18300
+ const Go = vt("wireframe", Bs);
17789
18301
 
17790
- ko.registerAt(ht);
18302
+ Go.registerAt(ht);
17791
18303
 
17792
- const Fo = vt("lit", js);
18304
+ const jo = vt("lit", js);
17793
18305
 
17794
- Fo.registerAt(ht);
18306
+ jo.registerAt(ht);
17795
18307
 
17796
- const Oo = vt("tube", Zs);
18308
+ const Wo = vt("tube", Zs);
17797
18309
 
17798
- Oo.registerAt(ht);
18310
+ Wo.registerAt(ht);
17799
18311
 
17800
- const Ro = vt("gltf-phong", fo);
18312
+ const Xo = vt("gltf-phong", po);
17801
18313
 
17802
- Ro.registerAt(ht);
18314
+ Xo.registerAt(ht);
17803
18315
 
17804
- const Eo = vt("gltf-lit", po);
18316
+ const Yo = vt("gltf-lit", go);
17805
18317
 
17806
- Eo.registerAt(ht);
18318
+ Yo.registerAt(ht);
17807
18319
 
17808
- const Do = vt("heatmap", class extends gn {
18320
+ const Zo = vt("heatmap", class extends gn {
17809
18321
  createFnTypeConfig(e, t) {
17810
18322
  const n = v(t.heatmapWeight), i = new Int16Array(1);
17811
18323
  return [ {
@@ -17823,7 +18335,7 @@ const Do = vt("heatmap", class extends gn {
17823
18335
  createMesh(e, t) {
17824
18336
  const {geometry: n, symbolIndex: i, ref: r} = e;
17825
18337
  if (void 0 === r) {
17826
- wt(n, this.getSymbolDef(i), this.getFnTypeConfig(i), this.layer);
18338
+ St(n, this.getSymbolDef(i), this.getFnTypeConfig(i), this.layer);
17827
18339
  }
17828
18340
  const o = this.getSymbol(i), a = {
17829
18341
  tileRatio: n.properties.tileRatio,
@@ -17869,31 +18381,35 @@ const Do = vt("heatmap", class extends gn {
17869
18381
  }
17870
18382
  });
17871
18383
 
17872
- Do.registerAt(ht);
18384
+ Zo.registerAt(ht);
18385
+
18386
+ const qo = vt("water", Ao);
18387
+
18388
+ qo.registerAt(ht);
17873
18389
 
17874
- const Lo = vt("water", bo);
18390
+ const $o = vt("billboard", Do);
17875
18391
 
17876
- Lo.registerAt(ht), mt.registerPainter("lit", js), mt.registerPainter("icon", Pr),
18392
+ $o.registerAt(ht), mt.registerPainter("lit", js), mt.registerPainter("icon", Pr),
17877
18393
  mt.registerPainter("fill", Cn), mt.registerPainter("line", Rn), mt.registerPainter("line-gradient", jn),
17878
- mt.registerPainter("water", bo), mt.registerPainter("tube", Zs);
18394
+ mt.registerPainter("water", Ao), mt.registerPainter("tube", Zs), mt.registerPainter("billboard", Do);
17879
18395
 
17880
- class Ho extends ht {
18396
+ class Jo extends ht {
17881
18397
  getTileUrl(e, t, n) {
17882
18398
  const i = this.getMap().getResolution(n);
17883
18399
  return super.getTileUrl(e, t, function(e) {
17884
- return 19 - Math.log(e / No) / Math.LN2;
18400
+ return 19 - Math.log(e / Ko) / Math.LN2;
17885
18401
  }(i));
17886
18402
  }
17887
18403
  static fromJSON(e) {
17888
- return e && "MapboxVectorTileLayer" === e.type ? new Ho(e.id, e.options) : null;
18404
+ return e && "MapboxVectorTileLayer" === e.type ? new Jo(e.id, e.options) : null;
17889
18405
  }
17890
18406
  }
17891
18407
 
17892
- Ho.registerJSONType("MapboxVectorTileLayer");
18408
+ Jo.registerJSONType("MapboxVectorTileLayer");
17893
18409
 
17894
- const No = 12756274 * Math.PI / (256 * Math.pow(2, 20));
18410
+ const Ko = 12756274 * Math.PI / (256 * Math.pow(2, 20));
17895
18411
 
17896
- class zo extends ht {
18412
+ class Qo extends ht {
17897
18413
  constructor(e, t) {
17898
18414
  (t = t || {}).spatialReference = null, super(e, t), this.setData(t.data);
17899
18415
  }
@@ -17936,7 +18452,7 @@ class zo extends ht {
17936
18452
  getWorkerOptions() {
17937
18453
  const e = super.getWorkerOptions();
17938
18454
  let t = this.options.data;
17939
- return B(t) || t && t.url ? (t.url && (t = JSON.parse(JSON.stringify(t))), t = Uo(t, this.getURLModifier())) : t = this.features,
18455
+ return B(t) || t && t.url ? (t.url && (t = JSON.parse(JSON.stringify(t))), t = ta(t, this.getURLModifier())) : t = this.features,
17940
18456
  e.data = t, e.tileBuffer = this.options.tileBuffer, e.extent = this.options.extent,
17941
18457
  e.hasAltitude = this.options.enableAltitude, e.simplifyTolerance = this.options.simplifyTolerance,
17942
18458
  e.projection = this.getSpatialReference().getProjection().code, e.generateOMBB = this.options.generateOMBB,
@@ -17960,7 +18476,7 @@ class zo extends ht {
17960
18476
  const t = e.getWorkerConnection();
17961
18477
  if (t) {
17962
18478
  let n = this.options.data;
17963
- B(n) || n && n.url ? (n.url && (n = JSON.parse(JSON.stringify(n))), n = Uo(n, this.getURLModifier())) : n = this.features,
18479
+ B(n) || n && n.url ? (n.url && (n = JSON.parse(JSON.stringify(n))), n = ta(n, this.getURLModifier())) : n = this.features,
17964
18480
  t.setData(n, ((t, n) => {
17965
18481
  e.clear(), this.onWorkerReady(null, n), e.setToRedraw(), setTimeout((() => {
17966
18482
  e.setToRedraw();
@@ -17996,7 +18512,7 @@ class zo extends ht {
17996
18512
  return this._idMaps[e];
17997
18513
  }
17998
18514
  static fromJSON(e) {
17999
- return e && "GeoJSONVectorTileLayer" === e.type ? new zo(e.id, e.options) : null;
18515
+ return e && "GeoJSONVectorTileLayer" === e.type ? new Qo(e.id, e.options) : null;
18000
18516
  }
18001
18517
  getGeometryById(e) {
18002
18518
  return this._idMaps ? this._idMaps[e] : null;
@@ -18027,16 +18543,16 @@ class zo extends ht {
18027
18543
  }
18028
18544
  }
18029
18545
 
18030
- function Vo(e) {
18546
+ function ea(e) {
18031
18547
  let t = document.createElement("a");
18032
18548
  return t.href = e, e = t.href, t = null, e;
18033
18549
  }
18034
18550
 
18035
- function Uo(e, t) {
18036
- return e.url ? e.url = t ? t(e.url) : Vo(e.url) : e = t ? t(e) : Vo(e), e;
18551
+ function ta(e, t) {
18552
+ return e.url ? e.url = t ? t(e.url) : ea(e.url) : e = t ? t(e) : ea(e), e;
18037
18553
  }
18038
18554
 
18039
- zo.registerJSONType("GeoJSONVectorTileLayer"), zo.mergeOptions({
18555
+ Qo.registerJSONType("GeoJSONVectorTileLayer"), Qo.mergeOptions({
18040
18556
  features: "id",
18041
18557
  tileBuffer: 64,
18042
18558
  extent: 8192,
@@ -18046,17 +18562,17 @@ zo.registerJSONType("GeoJSONVectorTileLayer"), zo.mergeOptions({
18046
18562
  generateOMBB: !0
18047
18563
  });
18048
18564
 
18049
- const {SYMBOLS_NEED_REBUILD_IN_VECTOR: Bo, GlyphRequestor: Go, PointPack: jo, LinePack: Wo, StyledPoint: Xo, VectorPack: Yo, StyledVector: Zo} = H();
18565
+ const {SYMBOLS_NEED_REBUILD_IN_VECTOR: na, GlyphRequestor: ia, PointPack: ra, LinePack: sa, StyledPoint: oa, VectorPack: aa, StyledVector: la} = H();
18050
18566
 
18051
- let qo = !1, $o = 1;
18567
+ let ha = !1, ca = 1;
18052
18568
 
18053
- const Jo = "_symbol_".trim(), Ko = (pe + "").trim();
18569
+ const ua = "_symbol_".trim(), fa = (pe + "").trim();
18054
18570
 
18055
- let Qo = new Float32Array(1);
18571
+ let da = new Float32Array(1);
18056
18572
 
18057
- const ea = [];
18573
+ const pa = [];
18058
18574
 
18059
- class ta extends e.renderer.CanvasRenderer {
18575
+ class ga extends e.renderer.CanvasRenderer {
18060
18576
  constructor(...e) {
18061
18577
  super(...e), this.features = {}, this._geometries = {}, this._counter = 0, this._allFeatures = {},
18062
18578
  this._featureMapping = {}, this._markerFeatures = {}, this._textFeatures = {}, this._lineFeatures = {},
@@ -18076,7 +18592,7 @@ class ta extends e.renderer.CanvasRenderer {
18076
18592
  return e || (this.painter && this.painter.needToRedraw() || this._markerPainter && this._markerPainter.needToRedraw() || this._linePainter && this._linePainter.needToRedraw());
18077
18593
  }
18078
18594
  getAnalysisMeshes() {
18079
- return this.painter && this.painter.getAnalysisMeshes() || ea;
18595
+ return this.painter && this.painter.getAnalysisMeshes() || pa;
18080
18596
  }
18081
18597
  getRayCastData() {
18082
18598
  return null;
@@ -18177,12 +18693,12 @@ class ta extends e.renderer.CanvasRenderer {
18177
18693
  if (!this.features[o]) continue;
18178
18694
  const a = this.features[o];
18179
18695
  if (Array.isArray(a)) for (let r = 0; r < a.length; r++) {
18180
- const s = a[r], o = s[Ko];
18696
+ const s = a[r], o = s[fa];
18181
18697
  (!e || e[o] || t && (!t || t[o])) && (s.visible || (this._showHideUpdated = !0),
18182
18698
  this._addCoordsToCenter(s.geometry, i, s.coordinates), n.push(s));
18183
18699
  } else {
18184
18700
  a.visible || (this._showHideUpdated = !0);
18185
- const r = a[Ko];
18701
+ const r = a[fa];
18186
18702
  if (e && !e[r] && (!t || t && !t[r])) continue;
18187
18703
  this._addCoordsToCenter(a.geometry, i, a.coordinates), n.push(a);
18188
18704
  }
@@ -18239,8 +18755,8 @@ class ta extends e.renderer.CanvasRenderer {
18239
18755
  _addCoord(e, t, n, i, r, s) {
18240
18756
  const o = this.getMap().getProjection().isSphere();
18241
18757
  let a = !1;
18242
- (s[0] > 180 || s[0] < -180) && (a = !0, o && !qo && (qo = !0, console.warn(`Layer(${this.layer.getId()}) has invalid longitude value: ${s[0]}`))),
18243
- (s[1] > 90 || s[1] < -90) && (a = !0, o && !qo && (qo = !0, console.warn(`Layer(${this.layer.getId()}) has invalid latitude value: ${s[1]}`))),
18758
+ (s[0] > 180 || s[0] < -180) && (a = !0, o && !ha && (ha = !0, console.warn(`Layer(${this.layer.getId()}) has invalid longitude value: ${s[0]}`))),
18759
+ (s[1] > 90 || s[1] < -90) && (a = !0, o && !ha && (ha = !0, console.warn(`Layer(${this.layer.getId()}) has invalid latitude value: ${s[1]}`))),
18244
18760
  a || (e[0] += t, e[1] += n, e[2] += i || 0, e[3] += r);
18245
18761
  }
18246
18762
  _fillCommonProps(e) {
@@ -18249,7 +18765,7 @@ class ta extends e.renderer.CanvasRenderer {
18249
18765
  n.aPickingId = e.data.aPickingId;
18250
18766
  }
18251
18767
  _isEnableWorkAround(e) {
18252
- return "win-intel-gpu-crash" === e && (this.layer.options.workarounds["win-intel-gpu-crash"] && ia(this.gl));
18768
+ return "win-intel-gpu-crash" === e && (this.layer.options.workarounds["win-intel-gpu-crash"] && ya(this.gl));
18253
18769
  }
18254
18770
  prepareRequestors() {
18255
18771
  if (this._iconRequestor) return;
@@ -18262,7 +18778,7 @@ class ta extends e.renderer.CanvasRenderer {
18262
18778
  }
18263
18779
  });
18264
18780
  const t = !this._isEnableWorkAround("win-intel-gpu-crash");
18265
- this._glyphRequestor = new Go((t => {
18781
+ this._glyphRequestor = new ia((t => {
18266
18782
  e.getMap().getRenderer().callInNextFrame(t);
18267
18783
  }), e.options.glyphSdfLimitPerFrame, t), this.requestor = this._fetchPattern.bind(this),
18268
18784
  this._markerRequestor = this._fetchIconGlyphs.bind(this);
@@ -18295,7 +18811,7 @@ class ta extends e.renderer.CanvasRenderer {
18295
18811
  delete this._markerMeshes));
18296
18812
  const {features: i, center: r} = this._getFeaturesToRender(this._markerFeatures, this._textFeatures), s = [], l = [];
18297
18813
  for (let e = 0; e < i.length; e++) {
18298
- const t = i[e][Ko];
18814
+ const t = i[e][fa];
18299
18815
  this._markerFeatures[t] && s.push(i[e]), this._textFeatures[t] && l.push(i[e]);
18300
18816
  }
18301
18817
  if (!s.length && !l.length) return void (this._markerMeshes && (this._markerPainter.deleteMesh(this._markerMeshes),
@@ -18317,7 +18833,7 @@ class ta extends e.renderer.CanvasRenderer {
18317
18833
  a.translate(s, s, o.set(f, r[0], r[1], 0)), a.scale(s, s, o.set(u, 1, 1, this._zScale));
18318
18834
  const l = this._markerPainter.createMeshes(t, s);
18319
18835
  for (let e = 0; e < l.length; e++) l[e].geometry.properties.originElements = l[e].geometry.properties.elements.slice(),
18320
- l[e].properties.level = 0, l[e].material.set("flipY", 1), l[e].properties.meshKey = $o++;
18836
+ l[e].properties.level = 0, l[e].material.set("flipY", 1), l[e].properties.meshKey = ca++;
18321
18837
  this._markerMeshes = l, h && (this._showHideUpdated = !0), this._isCreatingMarkerMesh = !1,
18322
18838
  this.setToRedraw(), this.layer.fire("buildmarkermesh");
18323
18839
  }));
@@ -18353,7 +18869,7 @@ class ta extends e.renderer.CanvasRenderer {
18353
18869
  markerHeightType: Uint16Array,
18354
18870
  allowEmptyPack: 1
18355
18871
  };
18356
- return [ this._markerSymbol ].map(((n, i) => new jo(0 === i ? e : t, n, r).load()));
18872
+ return [ this._markerSymbol ].map(((n, i) => new ra(0 === i ? e : t, n, r).load()));
18357
18873
  }
18358
18874
  updateMesh() {}
18359
18875
  _updateMarkerMesh(e) {
@@ -18367,15 +18883,15 @@ class ta extends e.renderer.CanvasRenderer {
18367
18883
  const s = [], o = [], a = [], l = this.getMap().getZoom();
18368
18884
  let h, c;
18369
18885
  h = Array.isArray(t) ? t.map((e => e ? A(e, (() => (s[0] = l, s))) : e)) : A(t, (() => (s[0] = l,
18370
- s))), c = Array.isArray(t) ? t.map((e => e ? Yo.genFnTypes(e) : e)) : Yo.genFnTypes(t);
18886
+ s))), c = Array.isArray(t) ? t.map((e => e ? aa.genFnTypes(e) : e)) : aa.genFnTypes(t);
18371
18887
  for (let e = 0; e < r.length; e++) {
18372
18888
  if (!r[e]) continue;
18373
- const i = Array.isArray(t) ? t[e] : t, s = Array.isArray(h) ? h[e] : h, o = Array.isArray(c) ? c[e] : c, a = new Xo(r, i, s, o, n).getIconAndGlyph();
18374
- if (!this._markerAtlas || !jo.isAtlasLoaded(a, this._markerAtlas)) return this._markRebuild(),
18889
+ const i = Array.isArray(t) ? t[e] : t, s = Array.isArray(h) ? h[e] : h, o = Array.isArray(c) ? c[e] : c, a = new oa(r, i, s, o, n).getIconAndGlyph();
18890
+ if (!this._markerAtlas || !ra.isAtlasLoaded(a, this._markerAtlas)) return this._markRebuild(),
18375
18891
  this.setToRedraw(), !1;
18376
18892
  }
18377
18893
  for (let e = 0; e < r.length; e++) {
18378
- const t = r[e][Ko];
18894
+ const t = r[e][fa];
18379
18895
  this._markerFeatures[t] && o.push(r[e]), this._textFeatures[t] && a.push(r[e]);
18380
18896
  }
18381
18897
  const u = r[0].id, f = this._createPointPacks(o, a, this._markerAtlas, this._markerCenter), d = this._markerMeshes;
@@ -18397,7 +18913,7 @@ class ta extends e.renderer.CanvasRenderer {
18397
18913
  })), !0;
18398
18914
  }
18399
18915
  _updateLineMesh(e) {
18400
- return this._updateMesh(e, this._lineMeshes, this._lineAtlas, this._lineCenter, this._linePainter, Wo, Ln, this._groupLineFeas);
18916
+ return this._updateMesh(e, this._lineMeshes, this._lineAtlas, this._lineCenter, this._linePainter, sa, Ln, this._groupLineFeas);
18401
18917
  }
18402
18918
  _updateMesh(e, t, n, i, r, s, o, a) {
18403
18919
  if (!t) return !1;
@@ -18411,8 +18927,8 @@ class ta extends e.renderer.CanvasRenderer {
18411
18927
  for (let e = 0; e < u.length; e++) {
18412
18928
  const t = u[e];
18413
18929
  if (!t) continue;
18414
- const i = Array.isArray(l) ? l[e] : l, r = Yo.genFnTypes(i), o = new Zo(u, i, r, h), a = s === Wo ? o.getLineResource() : o.getPolygonResource();
18415
- if (!Yo.isAtlasLoaded(a, n[e])) return this._markRebuild(), this.setToRedraw(),
18930
+ const i = Array.isArray(l) ? l[e] : l, r = aa.genFnTypes(i), o = new la(u, i, r, h), a = s === sa ? o.getLineResource() : o.getPolygonResource();
18931
+ if (!aa.isAtlasLoaded(a, n[e])) return this._markRebuild(), this.setToRedraw(),
18416
18932
  !1;
18417
18933
  f.push(t);
18418
18934
  }
@@ -18450,7 +18966,7 @@ class ta extends e.renderer.CanvasRenderer {
18450
18966
  let n = r + 1;
18451
18967
  for (;i[n] === t; ) n++;
18452
18968
  const s = n - r, o = e.geometry.desc.positionSize;
18453
- Qo.length !== 3 * s && (Qo = new Float32Array(s * o), Qo.fill(-1 / 0, 0)), e.geometry.updateSubData(e.geometry.desc.positionAttribute, Qo, r * o);
18969
+ da.length !== 3 * s && (da = new Float32Array(s * o), da.fill(-1 / 0, 0)), e.geometry.updateSubData(e.geometry.desc.positionAttribute, da, r * o);
18454
18970
  }
18455
18971
  this.layer.fire("updatemesh"), this.setToRedraw();
18456
18972
  }
@@ -18462,7 +18978,7 @@ class ta extends e.renderer.CanvasRenderer {
18462
18978
  if (!t.length) return;
18463
18979
  const i = this._showHideUpdated;
18464
18980
  this._lineCenter = n;
18465
- const r = this._groupLineFeas(t), s = U({}, Ln), o = r.map(((t, i) => this.createMesh(this._linePainter, Wo, s, t, e && e[i], n)));
18981
+ const r = this._groupLineFeas(t), s = U({}, Ln), o = r.map(((t, i) => this.createMesh(this._linePainter, sa, s, t, e && e[i], n)));
18466
18982
  this._isCreatingLineMesh = !0, Promise.all(o).then((e => {
18467
18983
  this._lineMeshes && this._linePainter.deleteMesh(this._lineMeshes);
18468
18984
  const t = [], n = [];
@@ -18481,10 +18997,10 @@ class ta extends e.renderer.CanvasRenderer {
18481
18997
  }));
18482
18998
  }
18483
18999
  _groupLineFeas(e) {
18484
- const t = (Jo + "lineDasharray").trim(), n = (Jo + "linePatternFile").trim(), i = [], r = [], s = [];
19000
+ const t = (ua + "lineDasharray").trim(), n = (ua + "linePatternFile").trim(), i = [], r = [], s = [];
18485
19001
  for (let o = 0; o < e.length; o++) {
18486
19002
  const a = e[o], l = a.properties && a.properties[t];
18487
- l && ha(l) ? s.push(a) : a.properties && a.properties[n] ? r.push(a) : i.push(a);
19003
+ l && Ta(l) ? s.push(a) : a.properties && a.properties[n] ? r.push(a) : i.push(a);
18488
19004
  }
18489
19005
  return [ i, r, s ];
18490
19006
  }
@@ -18518,23 +19034,23 @@ class ta extends e.renderer.CanvasRenderer {
18518
19034
  if (!e) return;
18519
19035
  const n = Array.isArray(e) ? e[0].id : e.id;
18520
19036
  if (this._featureMapping[n] = e, Array.isArray(e)) for (let n = 0; n < e.length; n++) {
18521
- const i = e[n][Ko];
19037
+ const i = e[n][fa];
18522
19038
  if (e[n][Vn] = t, this._allFeatures[i] = {
18523
19039
  feature: e[n]
18524
19040
  }, this._allFeatures[i][Vn] = t, !this.needCheckPointLineSymbols()) continue;
18525
19041
  const r = {
18526
19042
  feature: e[n]
18527
19043
  };
18528
- (ra(e[n]) || sa(e[n])) && (this._markerFeatures[i] = r), sa(e[n]) && (this._textFeatures[i] = r),
18529
- la(e[n]) && (this._lineFeatures[i] = r);
19044
+ (xa(e[n]) || _a(e[n])) && (this._markerFeatures[i] = r), _a(e[n]) && (this._textFeatures[i] = r),
19045
+ Aa(e[n]) && (this._lineFeatures[i] = r);
18530
19046
  } else {
18531
19047
  e[Vn] = t;
18532
19048
  const n = {
18533
19049
  feature: e
18534
- }, i = e[Ko];
19050
+ }, i = e[fa];
18535
19051
  if (this._allFeatures[i] = n, !this.needCheckPointLineSymbols()) return;
18536
- (ra(e) || sa(e)) && (this._markerFeatures[i] = n), sa(e) && (this._textFeatures[i] = n),
18537
- la(e) && (this._lineFeatures[i] = n);
19052
+ (xa(e) || _a(e)) && (this._markerFeatures[i] = n), _a(e) && (this._textFeatures[i] = n),
19053
+ Aa(e) && (this._lineFeatures[i] = n);
18538
19054
  }
18539
19055
  }
18540
19056
  needCheckPointLineSymbols() {
@@ -18543,11 +19059,11 @@ class ta extends e.renderer.CanvasRenderer {
18543
19059
  _removeFeatures(e) {
18544
19060
  const t = this.features[e];
18545
19061
  if (t) if (Array.isArray(t)) for (let e = 0; e < t.length; e++) {
18546
- const n = t[e][Ko], i = t[e].id;
19062
+ const n = t[e][fa], i = t[e].id;
18547
19063
  delete this._featureMapping[i], delete this._allFeatures[n], delete this._markerFeatures[n],
18548
19064
  delete this._textFeatures[n], delete this._lineFeatures[n];
18549
19065
  } else {
18550
- const e = t[Ko], n = t.id;
19066
+ const e = t[fa], n = t.id;
18551
19067
  delete this._featureMapping[n], delete this._allFeatures[e], delete this._markerFeatures[e],
18552
19068
  delete this._textFeatures[e], delete this._lineFeatures[e];
18553
19069
  }
@@ -18567,7 +19083,7 @@ class ta extends e.renderer.CanvasRenderer {
18567
19083
  }
18568
19084
  _getFeaKeyId(e) {
18569
19085
  const t = e[Vn], n = this.features[t];
18570
- return Array.isArray(n) ? n[0][Ko] : n[Ko];
19086
+ return Array.isArray(n) ? n[0][fa] : n[fa];
18571
19087
  }
18572
19088
  _updateDirtyTargets() {
18573
19089
  let e = !1;
@@ -18586,14 +19102,14 @@ class ta extends e.renderer.CanvasRenderer {
18586
19102
  e = e || t;
18587
19103
  }
18588
19104
  }
18589
- this._dirtyTargetsInCurrentFrame = {}, e && (na(this), this.layer.fire("partialupdate"));
19105
+ this._dirtyTargetsInCurrentFrame = {}, e && (ma(this), this.layer.fire("partialupdate"));
18590
19106
  }
18591
19107
  _convertAndRebuild(e) {
18592
- this._convertGeo(e), this._markRebuild(), na(this);
19108
+ this._convertGeo(e), this._markRebuild(), ma(this);
18593
19109
  }
18594
19110
  onGeometryAdd(e) {
18595
19111
  this.setToRedraw(), this.canvas && e && e.length && (this._convertGeometries(e),
18596
- this._markRebuild(), na(this));
19112
+ this._markRebuild(), ma(this));
18597
19113
  }
18598
19114
  onGeometryRemove(e) {
18599
19115
  if (e && e.length) {
@@ -18601,7 +19117,7 @@ class ta extends e.renderer.CanvasRenderer {
18601
19117
  const n = e[t][Vn];
18602
19118
  void 0 !== n && (delete this._geometries[n], this._removeFeatures(n), delete this.features[n]);
18603
19119
  }
18604
- this._markRebuild(), na(this);
19120
+ this._markRebuild(), ma(this);
18605
19121
  }
18606
19122
  }
18607
19123
  onGeometrySymbolChange(e) {
@@ -18617,26 +19133,26 @@ class ta extends e.renderer.CanvasRenderer {
18617
19133
  for (const t in i) i[t] && U(e, i[t]);
18618
19134
  i = e;
18619
19135
  }
18620
- for (const e in i) if (q(i, e) && Bo[e]) return void this._convertAndRebuild(t);
19136
+ for (const e in i) if (q(i, e) && na[e]) return void this._convertAndRebuild(t);
18621
19137
  const r = t._getInternalSymbol(), s = this.features[n];
18622
19138
  if (this._convertGeo(t), s) if (function(e, t) {
18623
19139
  return Array.isArray(e) ? !!Array.isArray(t) && e.length === t.length : !Array.isArray(t);
18624
19140
  }(r, s)) {
18625
19141
  if (Array.isArray(r)) for (let e = 0; e < r.length; e++) {
18626
- if (!ca(r[e], s[e])) return void this._convertAndRebuild(t);
18627
- } else if (!ca(r, s)) return void this._convertAndRebuild(t);
19142
+ if (!wa(r[e], s[e])) return void this._convertAndRebuild(t);
19143
+ } else if (!wa(r, s)) return void this._convertAndRebuild(t);
18628
19144
  this.onGeometryPositionChange(e);
18629
19145
  } else this._convertAndRebuild(t); else this._convertAndRebuild(t);
18630
19146
  }
18631
19147
  onGeometryShapeChange(e) {
18632
19148
  const t = e.target._getParent() || e.target;
18633
19149
  void 0 !== t[Vn] && (this._convertGeometries([ t ]), this._markRebuildGeometry(),
18634
- na(this));
19150
+ ma(this));
18635
19151
  }
18636
19152
  onGeometryPositionChange(e) {
18637
19153
  const t = e.target._getParent() || e.target, n = t[Vn];
18638
19154
  void 0 !== n && (this._convertGeometries([ t ]), this._dirtyTargetsInCurrentFrame[n] = t,
18639
- na(this));
19155
+ ma(this));
18640
19156
  }
18641
19157
  onGeometryZIndexChange(e) {
18642
19158
  void 0 !== (e.target._getParent() || e.target)[Vn] && this._markRebuild();
@@ -18658,7 +19174,7 @@ class ta extends e.renderer.CanvasRenderer {
18658
19174
  if (e === i.visible) return;
18659
19175
  i.visible = e;
18660
19176
  }
18661
- this._markShowHide(), na(this);
19177
+ this._markShowHide(), ma(this);
18662
19178
  }
18663
19179
  }
18664
19180
  _markShowHide() {
@@ -18668,7 +19184,7 @@ class ta extends e.renderer.CanvasRenderer {
18668
19184
  const t = e.target._getParent() || e.target, n = t[Vn];
18669
19185
  void 0 !== n && this.painter && (this.features[n] = Bn(t, this._kidGen), this._refreshFeatures(this.features[n], n),
18670
19186
  this._markerMeshes && this._markerMeshes.length && this._markerPainter.needRebuildOnGometryPropertiesChanged() || this._lineMeshes && this._lineMeshes.length && this._linePainter.needRebuildOnGometryPropertiesChanged() || this.meshes && this.meshes.length && this.painter.needRebuildOnGometryPropertiesChanged() ? this._markRebuild() : this.painter.onFeatureChange(this.features[n], this.meshes),
18671
- na(this));
19187
+ ma(this));
18672
19188
  }
18673
19189
  createContext() {
18674
19190
  const e = this.canvas.gl && this.canvas.gl.wrap;
@@ -18776,7 +19292,7 @@ class ta extends e.renderer.CanvasRenderer {
18776
19292
  delete this._outlineAll, delete this._outlineFeatures, this.setToRedraw();
18777
19293
  }
18778
19294
  isEnableWorkAround(e) {
18779
- return "win-intel-gpu-crash" === e && (this.layer.options.workarounds["win-intel-gpu-crash"] && ia(this.gl));
19295
+ return "win-intel-gpu-crash" === e && (this.layer.options.workarounds["win-intel-gpu-crash"] && ya(this.gl));
18780
19296
  }
18781
19297
  _getCentiMeterScale(e) {
18782
19298
  return $(e, this.getMap());
@@ -18791,11 +19307,11 @@ class ta extends e.renderer.CanvasRenderer {
18791
19307
  }
18792
19308
  }
18793
19309
 
18794
- function na(e) {
19310
+ function ma(e) {
18795
19311
  e.setToRedraw();
18796
19312
  }
18797
19313
 
18798
- function ia(e) {
19314
+ function ya(e) {
18799
19315
  const t = e.getExtension("WEBGL_debug_renderer_info");
18800
19316
  if (t && "undefined" != typeof navigator) {
18801
19317
  const n = e.getParameter(t.UNMASKED_RENDERER_WEBGL), i = "Win32" === navigator.platform || "Win64" === navigator.platform;
@@ -18804,38 +19320,38 @@ function ia(e) {
18804
19320
  return !1;
18805
19321
  }
18806
19322
 
18807
- function ra({properties: e}) {
18808
- const t = (Jo + "markerFile").trim(), n = (Jo + "markerType").trim();
19323
+ function xa({properties: e}) {
19324
+ const t = (ua + "markerFile").trim(), n = (ua + "markerType").trim();
18809
19325
  return e[t] || e[n];
18810
19326
  }
18811
19327
 
18812
- function sa({properties: e}) {
18813
- return e[(Jo + "textName").trim()];
19328
+ function _a({properties: e}) {
19329
+ return e[(ua + "textName").trim()];
18814
19330
  }
18815
19331
 
18816
- const oa = (Jo + "lineWidth").trim(), aa = (Hn + "").trim();
19332
+ const va = (ua + "lineWidth").trim(), ba = (Hn + "").trim();
18817
19333
 
18818
- function la(e) {
18819
- return 2 === e.type && !e.properties[aa] || 3 === e.type && void 0 !== e.properties[oa];
19334
+ function Aa(e) {
19335
+ return 2 === e.type && !e.properties[ba] || 3 === e.type && void 0 !== e.properties[va];
18820
19336
  }
18821
19337
 
18822
- function ha(e) {
19338
+ function Ta(e) {
18823
19339
  if (!Array.isArray(e)) return 0;
18824
19340
  let t = 0;
18825
19341
  for (let n = 0; n < e.length; n++) t += e[n];
18826
19342
  return t;
18827
19343
  }
18828
19344
 
18829
- function ca(e, t) {
18830
- if (Object.keys(e).sort().join() !== Object.keys(t.properties || {}).filter((e => 0 === e.indexOf(Jo))).map((e => e.substring(Jo.length))).sort().join()) return !1;
19345
+ function wa(e, t) {
19346
+ if (Object.keys(e).sort().join() !== Object.keys(t.properties || {}).filter((e => 0 === e.indexOf(ua))).map((e => e.substring(ua.length))).sort().join()) return !1;
18831
19347
  for (const n in e) if (q(e, n)) {
18832
- const i = (Jo + n).trim();
19348
+ const i = (ua + n).trim();
18833
19349
  if (_(e[n]) !== _(t.properties[i])) return !1;
18834
19350
  }
18835
19351
  return !0;
18836
19352
  }
18837
19353
 
18838
- function ua(t, n, i) {
19354
+ function Sa(t, n, i) {
18839
19355
  if (!t || t.type !== n) return null;
18840
19356
  const r = new i(t.id, t.options), s = t.geometries, o = [];
18841
19357
  for (let t = 0; t < s.length; t++) {
@@ -18845,9 +19361,9 @@ function ua(t, n, i) {
18845
19361
  return r.addGeometry(o), r;
18846
19362
  }
18847
19363
 
18848
- class fa extends mt {
19364
+ class Ma extends mt {
18849
19365
  static fromJSON(e) {
18850
- return ua(e, "PointLayer", fa);
19366
+ return Sa(e, "PointLayer", Ma);
18851
19367
  }
18852
19368
  constructor(...e) {
18853
19369
  super(...e), this.options.sceneConfig || (this.options.sceneConfig = U({}, ae));
@@ -18860,7 +19376,7 @@ class fa extends mt {
18860
19376
  }
18861
19377
  }
18862
19378
 
18863
- fa.mergeOptions({
19379
+ Ma.mergeOptions({
18864
19380
  glyphSdfLimitPerFrame: 15,
18865
19381
  iconErrorUrl: null,
18866
19382
  workarounds: {
@@ -18868,9 +19384,9 @@ fa.mergeOptions({
18868
19384
  },
18869
19385
  collision: !1,
18870
19386
  collisionFrameLimit: 1
18871
- }), fa.registerJSONType("PointLayer"), fa.registerRenderer("canvas", null);
19387
+ }), Ma.registerJSONType("PointLayer"), Ma.registerRenderer("canvas", null);
18872
19388
 
18873
- fa.registerRenderer("gl", class extends ta {
19389
+ Ma.registerRenderer("gl", class extends ga {
18874
19390
  constructor(...t) {
18875
19391
  super(...t), this.GeometryTypes = [ e.Marker, e.MultiPoint ];
18876
19392
  }
@@ -18881,28 +19397,28 @@ fa.registerRenderer("gl", class extends ta {
18881
19397
  }
18882
19398
  });
18883
19399
 
18884
- const {LinePack: da} = H();
19400
+ const {LinePack: Pa} = H();
18885
19401
 
18886
- class pa extends mt {
19402
+ class Ia extends mt {
18887
19403
  static fromJSON(e) {
18888
- return ua(e, "LineStringLayer", pa);
19404
+ return Sa(e, "LineStringLayer", Ia);
18889
19405
  }
18890
19406
  }
18891
19407
 
18892
- pa.mergeOptions({
19408
+ Ia.mergeOptions({
18893
19409
  meshRenderOrder: 1
18894
- }), pa.registerJSONType("LineStringLayer");
19410
+ }), Ia.registerJSONType("LineStringLayer");
18895
19411
 
18896
- const ga = (Hn + "").trim();
19412
+ const Ca = (Hn + "").trim();
18897
19413
 
18898
- pa.registerRenderer("gl", class extends ta {
19414
+ Ia.registerRenderer("gl", class extends ga {
18899
19415
  constructor(...t) {
18900
19416
  super(...t), this.GeometryTypes = [ e.LineString, e.MultiLineString ];
18901
19417
  }
18902
19418
  createPainter() {
18903
19419
  const e = mt.get3DPainterClass("line-gradient");
18904
19420
  this.painterSymbol = U({}, {
18905
- lineGradientProperty: ga
19421
+ lineGradientProperty: Ca
18906
19422
  }, Ln), this._defineSymbolBloom(this.painterSymbol, e.getBloomSymbol());
18907
19423
  const t = U({}, this.layer.options.sceneConfig || {});
18908
19424
  void 0 === t.depthMask && (t.depthMask = !0);
@@ -18910,10 +19426,10 @@ pa.registerRenderer("gl", class extends ta {
18910
19426
  }
18911
19427
  buildMesh() {
18912
19428
  let {features: e, center: t} = this._getFeaturesToRender();
18913
- if (e = e.filter((e => !!e.properties[ga])), !e.length) return;
19429
+ if (e = e.filter((e => !!e.properties[Ca])), !e.length) return;
18914
19430
  const n = this._showHideUpdated;
18915
19431
  this._meshCenter = t;
18916
- const i = U({}, this.painterSymbol), r = this.createMesh(this.painter, da, i, e, null, t);
19432
+ const i = U({}, this.painterSymbol), r = this.createMesh(this.painter, Pa, i, e, null, t);
18917
19433
  this._isCreatingMesh = !0, r.then((e => {
18918
19434
  this.meshes && this.painter.deleteMesh(this.meshes);
18919
19435
  const t = [], i = e && e.meshes;
@@ -18924,19 +19440,19 @@ pa.registerRenderer("gl", class extends ta {
18924
19440
  this.meshes = t, n && (this._showHideUpdated = n), this._isCreatingMesh = !1, this.setToRedraw();
18925
19441
  }));
18926
19442
  }
18927
- }), pa.registerRenderer("canvas", null);
19443
+ }), Ia.registerRenderer("canvas", null);
18928
19444
 
18929
- const {PolygonPack: ma} = H();
19445
+ const {PolygonPack: ka} = H();
18930
19446
 
18931
- class ya extends mt {
19447
+ class Fa extends mt {
18932
19448
  static fromJSON(e) {
18933
- return ua(e, "PolygonLayer", ya);
19449
+ return Sa(e, "PolygonLayer", Fa);
18934
19450
  }
18935
19451
  }
18936
19452
 
18937
- ya.registerJSONType("PolygonLayer");
19453
+ Fa.registerJSONType("PolygonLayer");
18938
19454
 
18939
- const xa = {
19455
+ const Oa = {
18940
19456
  polygonFill: {
18941
19457
  type: "identity",
18942
19458
  default: [ 1, 1, 1, 1 ],
@@ -18989,7 +19505,7 @@ const xa = {
18989
19505
  }
18990
19506
  };
18991
19507
 
18992
- class _a extends ta {
19508
+ class Ra extends ga {
18993
19509
  constructor() {
18994
19510
  super(...arguments), this.GeometryTypes = [ e.Polygon, e.MultiPolygon ];
18995
19511
  }
@@ -19001,7 +19517,7 @@ class _a extends ta {
19001
19517
  if (!t.length) return;
19002
19518
  const i = this._showHideUpdated;
19003
19519
  this._meshCenter = n;
19004
- const r = this._groupPolygonFeatures(t), s = U({}, xa), o = r.map(((t, i) => this.createMesh(this.painter, ma, s, t, e && e[i], n)));
19520
+ const r = this._groupPolygonFeatures(t), s = U({}, Oa), o = r.map(((t, i) => this.createMesh(this.painter, ka, s, t, e && e[i], n)));
19005
19521
  this._isCreatingMesh = !0, Promise.all(o).then((e => {
19006
19522
  this.meshes && this.painter.deleteMesh(this.meshes), e = function(e) {
19007
19523
  const t = [];
@@ -19037,16 +19553,16 @@ class _a extends ta {
19037
19553
  return [ t, n ];
19038
19554
  }
19039
19555
  createPainter() {
19040
- const e = mt.get3DPainterClass("fill"), t = this.painterSymbol = U({}, xa);
19556
+ const e = mt.get3DPainterClass("fill"), t = this.painterSymbol = U({}, Oa);
19041
19557
  this._defineSymbolBloom(t, e.getBloomSymbol());
19042
19558
  return new e(this.regl, this.layer, t, this.layer.options.sceneConfig, 0);
19043
19559
  }
19044
19560
  updateMesh(e) {
19045
- return this._updateMesh(e, this.meshes, this.atlas, this._meshCenter, this.painter, ma, xa, this._groupPolygonFeatures);
19561
+ return this._updateMesh(e, this.meshes, this.atlas, this._meshCenter, this.painter, ka, Oa, this._groupPolygonFeatures);
19046
19562
  }
19047
19563
  }
19048
19564
 
19049
- function va(e, t, n, i, r, s, o) {
19565
+ function Ea(e, t, n, i, r, s, o) {
19050
19566
  const a = n && Array.isArray(n[0]);
19051
19567
  for (let s = 0, l = n.length; s < l; s++) {
19052
19568
  e[t] = (a ? n[s][0] : n[s].x) * i, e[t + 1] = (a ? n[s][1] : n[s].y) * i, o !== Float32Array && (e[t] = Math.round(e[t]),
@@ -19057,25 +19573,25 @@ function va(e, t, n, i, r, s, o) {
19057
19573
  return e.trySetLength && e.trySetLength(t), t;
19058
19574
  }
19059
19575
 
19060
- function ba(e, t, n, i) {
19576
+ function Da(e, t, n, i) {
19061
19577
  const r = e[3 * t], s = e[3 * t + 1], o = e[3 * n], a = e[3 * n + 1];
19062
19578
  return r === o && (r < 0 || r > i) || s === a && (s < 0 || s > i);
19063
19579
  }
19064
19580
 
19065
- ya.registerRenderer("gl", _a), ya.registerRenderer("canvas", null);
19581
+ Fa.registerRenderer("gl", Ra), Fa.registerRenderer("canvas", null);
19066
19582
 
19067
- const Aa = Math.PI / 180, Ta = 6378137 * Math.PI / 180, Sa = 85.0511287798;
19583
+ const La = Math.PI / 180, Ha = 6378137 * Math.PI / 180, Na = 85.0511287798;
19068
19584
 
19069
- function wa(e, t, n) {
19585
+ function za(e, t, n) {
19070
19586
  return function(e, t) {
19071
- const n = Sa, i = t[0], r = Math.max(Math.min(n, t[1]), -n);
19587
+ const n = Na, i = t[0], r = Math.max(Math.min(n, t[1]), -n);
19072
19588
  let s;
19073
- s = 0 === r ? 0 : Math.log(Math.tan((90 + r) * Aa / 2)) / Aa;
19074
- return e[0] = i * Ta, e[1] = s * Ta, e;
19589
+ s = 0 === r ? 0 : Math.log(Math.tan((90 + r) * La / 2)) / La;
19590
+ return e[0] = i * Ha, e[1] = s * Ha, e;
19075
19591
  }(e, t);
19076
19592
  }
19077
19593
 
19078
- function Ma(e, t, n, i, r, s, o, a, l, h, c, u, f, d, p) {
19594
+ function Va(e, t, n, i, r, s, o, a, l, h, c, u, f, d, p) {
19079
19595
  0 === e ? function(e, t, n, i, r, s, o, a, l, h) {
19080
19596
  const c = 1 / (100 * s[0]), u = 1 / (100 * s[1]), f = h && h[0] || 0, d = h && h[1] || 0, p = [ 0, 0 ];
19081
19597
  for (let r = e; r < t; r += 3) {
@@ -19090,27 +19606,27 @@ function Ma(e, t, n, i, r, s, o, a, l, h, c, u, f, d, p) {
19090
19606
  const g = M.distance(u, f), m = M.distance(f, d), y = [], x = [], _ = [];
19091
19607
  for (let e = t; e < n; e += 3) {
19092
19608
  const t = e / 3 * 2, n = (s.x / l + r[e] / o) * a, d = s.y / l * a + (c ? r[e + 1] : -r[e + 1]) / o * a;
19093
- M.set(y, n, d), "EPSG:4326" !== h && "EPSG:4490" !== h || wa(y, y), Pa(x, y, u, f),
19094
- Pa(_, y, p, u), i[t] = M.distance(u, x) / g, i[t + 1] = M.distance(u, _) / m;
19609
+ M.set(y, n, d), "EPSG:4326" !== h && "EPSG:4490" !== h || za(y, y), Ua(x, y, u, f),
19610
+ Ua(_, y, p, u), i[t] = M.distance(u, x) / g, i[t + 1] = M.distance(u, _) / m;
19095
19611
  }
19096
19612
  }(c, t, n, i, r, s, a, u, f, d, !!p);
19097
19613
  }
19098
19614
 
19099
- function Pa(e, t, n, i) {
19615
+ function Ua(e, t, n, i) {
19100
19616
  const r = n[0] - i[0], s = n[1] - i[1];
19101
19617
  let o = (t[0] - n[0]) * (n[0] - i[0]) + (t[1] - n[1]) * (n[1] - i[1]);
19102
19618
  return o /= r * r + s * s, e[0] = n[0] + o * r, e[1] = n[1] + o * s, e;
19103
19619
  }
19104
19620
 
19105
- function Ia(e, t, n, i, r) {
19621
+ function Ba(e, t, n, i, r) {
19106
19622
  const s = 3 * t[n - 1], o = 3 * t[n - 1] + 1, a = e[s], l = e[o];
19107
19623
  return h = i, c = r, u = a, f = l, Math.sqrt((u - h) * (u - h) + (f - c) * (f - c));
19108
19624
  var h, c, u, f;
19109
19625
  }
19110
19626
 
19111
- const {PackUtil: Ca, ArrayPool: ka} = H();
19627
+ const {PackUtil: Ga, ArrayPool: ja} = H();
19112
19628
 
19113
- function Fa(e, t, n, i, r, s, o, a, l, h, c, u, f, d, p, g, m) {
19629
+ function Wa(e, t, n, i, r, s, o, a, l, h, c, u, f, d, p, g, m) {
19114
19630
  const y = t.getLength(), x = r / 3;
19115
19631
  for (let n = 2, i = y; n < i; n += 3) e[r + n - 2] = t[n - 2], e[r + n - 1] = t[n - 1],
19116
19632
  e[r + n - 0] = t[n] - o;
@@ -19121,15 +19637,15 @@ function Fa(e, t, n, i, r, s, o, a, l, h, c, u, f, d, p, g, m) {
19121
19637
  e.copyWithin(r, r - 2 * y, r - y), r += y, (n = n || []).push(y / 3);
19122
19638
  const _ = n.getLength();
19123
19639
  for (let t = 0; t < _; t++) {
19124
- Oa(x + (n[t - 1] || 0), x + n[t], e, y / 3, l, i, h, c, u, f, s, d, p, g, m);
19640
+ Xa(x + (n[t - 1] || 0), x + n[t], e, y / 3, l, i, h, c, u, f, s, d, p, g, m);
19125
19641
  }
19126
19642
  return r;
19127
19643
  }
19128
19644
 
19129
- function Oa(e, t, n, i, r, s, o, a, l, h, c, u, f, d, p) {
19645
+ function Xa(e, t, n, i, r, s, o, a, l, h, c, u, f, d, p) {
19130
19646
  const g = s.getLength();
19131
19647
  let m, y;
19132
- for (let o = e, a = t; o < a - 1; o++) if (m = o, y = o + 1, r === 1 / 0 || !ba(n, m, y, r)) if ((o - e) % 2 == 1 && (m += 2 * i,
19648
+ for (let o = e, a = t; o < a - 1; o++) if (m = o, y = o + 1, r === 1 / 0 || !Da(n, m, y, r)) if ((o - e) % 2 == 1 && (m += 2 * i,
19133
19649
  y += 2 * i), p) {
19134
19650
  let e = s.currentIndex;
19135
19651
  s[e++] = m + i, s[e++] = y, s[e++] = m, s[e++] = y + i, s[e++] = y, s[e++] = m + i,
@@ -19147,18 +19663,18 @@ function Oa(e, t, n, i, r, s, o, a, l, h, c, u, f, d, p) {
19147
19663
  d || p || (d = Math.max(r[_], r[3 * s[u - 3] + 2]), p = Math.min(r[_], r[3 * s[u - 3] + 2]),
19148
19664
  f = d - p);
19149
19665
  let T = g;
19150
- const S = u % 6;
19151
- 0 === e ? (5 === S && (m = Ia(r, s, u, v, b)), T = S === y[0] || S === y[1] || S === y[2] ? g : g + m) : 1 === e && (S === y[0] || S === y[1] || S === y[2] ? T = 0 : 5 === S ? (m = Ia(r, s, u, v, b),
19666
+ const w = u % 6;
19667
+ 0 === e ? (5 === w && (m = Ba(r, s, u, v, b)), T = w === y[0] || w === y[1] || w === y[2] ? g : g + m) : 1 === e && (w === y[0] || w === y[1] || w === y[2] ? T = 0 : 5 === w ? (m = Ba(r, s, u, v, b),
19152
19668
  T = m) : T = m);
19153
- const w = T / h * (1 / (100 * c)) / a;
19669
+ const S = T / h * (1 / (100 * c)) / a;
19154
19670
  let M;
19155
19671
  M = 1 === t ? A === d ? 1 : 0 : "bottom" === n ? A === d ? f / 100 / l : 0 : A === d ? 0 : -f / 100 / l,
19156
- i[2 * o] = w, i[2 * o + 1] = M, 0 === S && (g += m);
19672
+ i[2 * o] = S, i[2 * o + 1] = M, 0 === w && (g += m);
19157
19673
  }
19158
19674
  }(a, l, h, c, n, s, g, u[0], u[1], f, d, p);
19159
19675
  }
19160
19676
 
19161
- function Ra(e) {
19677
+ function Ya(e) {
19162
19678
  const t = [ e[0] ];
19163
19679
  let n = e[0];
19164
19680
  for (let i = 1; i < e.length; i++) Array.isArray(e[i]) ? e[i][0] === n[0] && e[i][1] === n[1] && e[i][2] === n[2] || t.push(e[i]) : e[i].x === n.x && e[i].y === n.y && e[i].z === n.z || t.push(e[i]),
@@ -19166,11 +19682,11 @@ function Ra(e) {
19166
19682
  return t;
19167
19683
  }
19168
19684
 
19169
- const {StyleUtil: Ea, PackUtil: Da, ArrayPool: La} = H(), Ha = La.getInstance();
19685
+ const {StyleUtil: Za, PackUtil: qa, ArrayPool: $a} = H(), Ja = $a.getInstance();
19170
19686
 
19171
- function Na(e, t, n, i, r, s, o, a, l, h, c, u, f, d, p, g) {
19172
- void 0 === t.top && (t.top = !0), void 0 === t.side && (t.side = !0), Ha.reset();
19173
- const {altitudeScale: m, altitudeProperty: y, defaultAltitude: x, heightProperty: A, minHeightProperty: T, defaultHeight: S, tangent: w, uv: M, topUVMode: R, sideUVMode: E, sideVerticalUVMode: D, top: L, side: H, textureYOrigin: N, topThickness: z} = t, V = !!g, U = function(e, t, {altitudeScale: n, altitudeProperty: i, defaultAltitude: r, heightProperty: s, minHeightProperty: o, defaultHeight: a}, {center: l, side: h, top: c, topThickness: u, uvOrigin: f, uv: d, uvSize: p, topUVMode: g, sideUVMode: m, sideVerticalUVMode: y, textureYOrigin: x, tileRatio: _, centimeterToPoint: v, verticalCentimeterToPoint: b, positionType: A, res: T, glScale: S, projectionCode: w}, M, P) {
19687
+ function Ka(e, t, n, i, r, s, o, a, l, h, c, u, f, d, p, g) {
19688
+ void 0 === t.top && (t.top = !0), void 0 === t.side && (t.side = !0), Ja.reset();
19689
+ const {altitudeScale: m, altitudeProperty: y, defaultAltitude: x, heightProperty: A, minHeightProperty: T, defaultHeight: w, tangent: S, uv: M, topUVMode: R, sideUVMode: E, sideVerticalUVMode: D, top: L, side: H, textureYOrigin: N, topThickness: z} = t, V = !!g, U = function(e, t, {altitudeScale: n, altitudeProperty: i, defaultAltitude: r, heightProperty: s, minHeightProperty: o, defaultHeight: a}, {center: l, side: h, top: c, topThickness: u, uvOrigin: f, uv: d, uvSize: p, topUVMode: g, sideUVMode: m, sideVerticalUVMode: y, textureYOrigin: x, tileRatio: _, centimeterToPoint: v, verticalCentimeterToPoint: b, positionType: A, res: T, glScale: w, projectionCode: S}, M, P) {
19174
19690
  let I = t / e[0].extent;
19175
19691
  t === 1 / 0 && (I = 1);
19176
19692
  const k = t === 1 / 0, F = P.get(), O = P.get(), R = P.get(), E = P.getProxy(), D = P.get(), L = P.get(), H = P.get(), N = !!d, z = !!c, V = !!h, U = N ? P.get() : null;
@@ -19189,12 +19705,12 @@ function Na(e, t, n, i, r, s, o, a, l, h, c, u, f, d, p, g) {
19189
19705
  }
19190
19706
  c = h.length, d = L.currentIndex;
19191
19707
  for (let e = 0; e < c; e++) L[d++] = h[e];
19192
- L.currentIndex = d, N && Ma(g || 0, e, n, U, D, f, v, _, p[0], p[1], s, T, S, w, l),
19193
- u > 0 && !V && (n = Fa(D, E, i, L, n, U, 0, u, t, N, m || 0, y || 0, x, p, _, b, r < 0 ? !o : o)),
19708
+ L.currentIndex = d, N && Va(g || 0, e, n, U, D, f, v, _, p[0], p[1], s, T, w, S, l),
19709
+ u > 0 && !V && (n = Wa(D, E, i, L, n, U, 0, u, t, N, m || 0, y || 0, x, p, _, b, r < 0 ? !o : o)),
19194
19710
  H.setLength(n / 3), H.fill(1, a / 3, n / 3);
19195
19711
  }
19196
19712
  if (V) {
19197
- z && (u = 0), a = n, n = Fa(D, E, i, L, n, U, u, r, t, N, m || 0, y || 0, x, p, _, b, r < 0 ? !o : o),
19713
+ z && (u = 0), a = n, n = Wa(D, E, i, L, n, U, u, r, t, N, m || 0, y || 0, x, p, _, b, r < 0 ? !o : o),
19198
19714
  H.setLength(n / 3);
19199
19715
  const e = E.getLength() / 3;
19200
19716
  H.fill(1, a / 3, a / 3 + e), H.fill(0, a / 3 + e, a / 3 + 2 * e), H.fill(1, a / 3 + 2 * e, a / 3 + 3 * e),
@@ -19214,19 +19730,19 @@ function Na(e, t, n, i, r, s, o, a, l, h, c, u, f, d, p, g) {
19214
19730
  G(h) && (Math.abs(h) > $ && ($ = Math.abs(h)), h < 0 && (J = !0));
19215
19731
  const c = l.geometry, u = l.properties[ye];
19216
19732
  let f = Array.isArray(u && u[0] && u[0][0]) ? u[0] : u;
19217
- const {altitude: d, height: p} = Ca.getFeaAltitudeAndHeight(l, n, i, r, s, a, o);
19733
+ const {altitude: d, height: p} = Ga.getFeaAltitudeAndHeight(l, n, i, r, s, a, o);
19218
19734
  p < 0 ? (Q = !0, W = Math.min(d, W), j = Math.max(d - p, j)) : (j = Math.max(d, j),
19219
19735
  W = Math.min(d - p, W));
19220
19736
  const g = D.getLength();
19221
19737
  let m = 0, y = X;
19222
19738
  K.setLength(0), E.setLength(0);
19223
- const x = Ca.calculateSignedArea(c[0]) < 0;
19739
+ const x = Ga.calculateSignedArea(c[0]) < 0;
19224
19740
  for (let e = 0, n = c.length; e < n; e++) {
19225
19741
  let i = c[e];
19226
- x && (i = i.reverse()), i = Ra(i);
19227
- const r = Ca.calculateSignedArea(i) < 0;
19742
+ x && (i = i.reverse()), i = Ya(i);
19743
+ const r = Ga.calculateSignedArea(i) < 0;
19228
19744
  if (!r && e > 0 && (m++, f = u && u[m], X = B(y, X, K, p * I, f, k), E.setLength(0),
19229
- K.setLength(0), y = X), t !== 1 / 0 && (i = Ca.clipPolygon(i, Y)), !i.length) {
19745
+ K.setLength(0), y = X), t !== 1 / 0 && (i = Ga.clipPolygon(i, Y)), !i.length) {
19230
19746
  e === n - 1 && (X = B(y, X, K, p * I, f, k));
19231
19747
  continue;
19232
19748
  }
@@ -19236,7 +19752,7 @@ function Na(e, t, n, i, r, s, o, a, l, h, c, u, f, d, p, g) {
19236
19752
  let e = K.currentIndex;
19237
19753
  K[e++] = E.getLength() / 3, K.currentIndex = e;
19238
19754
  }
19239
- va(E, E.getLength(), i, I, d, 0, A), e === n - 1 && (X = B(y, X, K, p * I, f, k));
19755
+ Ea(E, E.getLength(), i, I, d, 0, A), e === n - 1 && (X = B(y, X, K, p * I, f, k));
19240
19756
  }
19241
19757
  const _ = D.getLength() - g, v = (pe + "").trim();
19242
19758
  for (let e = 0; e < _ / 3; e++) {
@@ -19245,19 +19761,19 @@ function Na(e, t, n, i, r, s, o, a, l, h, c, u, f, d, p, g) {
19245
19761
  F.currentIndex = e, G(h) && (e = R.currentIndex, R[e++] = h, R.currentIndex = e);
19246
19762
  }
19247
19763
  }
19248
- const ee = Ca.getUnsignedArrayType(O.getLength() ? O[O.getLength() - 1] : 0), te = {
19764
+ const ee = Ga.getUnsignedArrayType(O.getLength() ? O[O.getLength() - 1] : 0), te = {
19249
19765
  hasNegativeHeight: Q,
19250
19766
  maxAltitude: j === -1 / 0 ? 0 : j,
19251
19767
  minAltitude: W === 1 / 0 ? 0 : W,
19252
19768
  vertices: D,
19253
19769
  verticeTypes: H,
19254
19770
  indices: L,
19255
- pickingIds: ka.createTypedArray(O, ee),
19771
+ pickingIds: ja.createTypedArray(O, ee),
19256
19772
  featureIndexes: F
19257
19773
  };
19258
19774
  if (R.getLength()) {
19259
- const e = J ? Ca.getPosArrayType($) : Ca.getUnsignedArrayType($);
19260
- te.featureIds = ka.createTypedArray(R, e);
19775
+ const e = J ? Ga.getPosArrayType($) : Ga.getUnsignedArrayType($);
19776
+ te.featureIds = ja.createTypedArray(R, e);
19261
19777
  } else te.featureIds = [];
19262
19778
  return U && (U.setLength(D.getLength() / 3 * 2), te.uvs = U), te;
19263
19779
  }(e, n, {
@@ -19266,13 +19782,13 @@ function Na(e, t, n, i, r, s, o, a, l, h, c, u, f, d, p, g) {
19266
19782
  defaultAltitude: x || 0,
19267
19783
  heightProperty: A,
19268
19784
  minHeightProperty: T,
19269
- defaultHeight: S || 0
19785
+ defaultHeight: w || 0
19270
19786
  }, {
19271
19787
  center: g,
19272
19788
  top: L,
19273
19789
  side: H,
19274
19790
  topThickness: 10 * z || 0,
19275
- uv: M || w,
19791
+ uv: M || S,
19276
19792
  uvSize: [ r, r ],
19277
19793
  uvOrigin: i,
19278
19794
  topUVMode: R,
@@ -19286,11 +19802,11 @@ function Na(e, t, n, i, r, s, o, a, l, h, c, u, f, d, p, g) {
19286
19802
  res: s,
19287
19803
  glScale: o,
19288
19804
  projectionCode: f
19289
- }, d, Ha), B = [], j = U.vertices.getLength() / 3, W = Da.getIndexArrayType(j), X = La.createTypedArray(U.indices, W);
19805
+ }, d, Ja), B = [], j = U.vertices.getLength() / 3, W = qa.getIndexArrayType(j), X = $a.createTypedArray(U.indices, W);
19290
19806
  delete U.indices, B.push(X.buffer, U.pickingIds.buffer);
19291
- const Y = Math.max(Math.abs(U.maxAltitude), Math.abs(U.minAltitude)), q = p || Da.getPosArrayType(Math.max(512, Y));
19292
- U.vertices = La.createTypedArray(U.vertices, q);
19293
- const $ = w ? Ha.getProxy() : new Float32Array(3 * j);
19807
+ const Y = Math.max(Math.abs(U.maxAltitude), Math.abs(U.minAltitude)), q = p || qa.getPosArrayType(Math.max(512, Y));
19808
+ U.vertices = $a.createTypedArray(U.vertices, q);
19809
+ const $ = S ? Ja.getProxy() : new Float32Array(3 * j);
19294
19810
  $.setLength && $.setLength(3 * j);
19295
19811
  const J = k(U.vertices, X, $);
19296
19812
  let K = !0;
@@ -19300,8 +19816,8 @@ function Na(e, t, n, i, r, s, o, a, l, h, c, u, f, d, p, g) {
19300
19816
  const t = J[e] % 1;
19301
19817
  1 - Math.abs(t) > 1e-6 ? K = !1 : 0 !== t && (J[e] = Math.round(J[e]));
19302
19818
  }
19303
- if (U.normals = J, w) {
19304
- let e = Ha.get();
19819
+ if (U.normals = J, S) {
19820
+ let e = Ja.get();
19305
19821
  e.setLength(4 * j), e = F(U.vertices, U.normals, U.uvs, X, e), e = function(e, t) {
19306
19822
  const n = t.getLength(), i = new Float32Array(n), r = [], s = [], o = [];
19307
19823
  for (let a = 0; a < n; a += 4) {
@@ -19312,10 +19828,10 @@ function Na(e, t, n, i, r, s, o, a, l, h, c, u, f, d, p, g) {
19312
19828
  return i;
19313
19829
  }(U.normals, e), U.tangents = e, B.push(e.buffer), delete U.normals;
19314
19830
  }
19315
- if (U.normals && (K && (U.normals = La.createTypedArray(U.normals, Int8Array)),
19831
+ if (U.normals && (K && (U.normals = $a.createTypedArray(U.normals, Int8Array)),
19316
19832
  B.push(U.normals.buffer)), U.uvs) {
19317
19833
  const e = U.uvs;
19318
- U.uvs = La.createTypedArray(e, Float32Array), B.push(U.uvs.buffer);
19834
+ U.uvs = $a.createTypedArray(e, Float32Array), B.push(U.uvs.buffer);
19319
19835
  }
19320
19836
  if (g) {
19321
19837
  const e = U.vertices, t = e.length;
@@ -19332,8 +19848,8 @@ function Na(e, t, n, i, r, s, o, a, l, h, c, u, f, d, p, g) {
19332
19848
  o.$layer = s.layer, o.$type = s.type;
19333
19849
  let h = a(n, o);
19334
19850
  _(h) && (r.aColor = 1, a = b(h), h = a(n, o)), delete o.$layer, delete o.$type,
19335
- Ea.normalizeColor(za, h), l[4 * t] = za[0], l[4 * t + 1] = za[1], l[4 * t + 2] = za[2],
19336
- l[4 * t + 3] = za[3];
19851
+ Za.normalizeColor(Qa, h), l[4 * t] = Qa[0], l[4 * t + 1] = Qa[1], l[4 * t + 2] = Qa[2],
19852
+ l[4 * t + 3] = Qa[3];
19337
19853
  }
19338
19854
  s.aColor = l;
19339
19855
  }
@@ -19369,10 +19885,10 @@ function Na(e, t, n, i, r, s, o, a, l, h, c, u, f, d, p, g) {
19369
19885
  const m = n[t[i]], y = m.properties || {};
19370
19886
  y.$layer = m.layer, y.$type = m.type;
19371
19887
  let x = h ? c : u, v = x(r, y);
19372
- _(v) && (x = b(v), v = x(r, y)), delete y.$layer, delete y.$type, Ea.normalizeColor(za, v),
19373
- I.divide(za, za, l);
19374
- let A = Va(s, za);
19375
- A < 0 && (A = s.length, s.push(I.copy([], za))), e[i] = A, h ? (f = t[i], p = A) : (d = t[i],
19888
+ _(v) && (x = b(v), v = x(r, y)), delete y.$layer, delete y.$type, Za.normalizeColor(Qa, v),
19889
+ I.divide(Qa, Qa, l);
19890
+ let A = el(s, Qa);
19891
+ A < 0 && (A = s.length, s.push(I.copy([], Qa))), e[i] = A, h ? (f = t[i], p = A) : (d = t[i],
19376
19892
  g = A);
19377
19893
  }
19378
19894
  }
@@ -19380,7 +19896,7 @@ function Na(e, t, n, i, r, s, o, a, l, h, c, u, f, d, p, g) {
19380
19896
  }(U.verticeTypes, U.featureIndexes, e, c, u), ne = {
19381
19897
  data: {
19382
19898
  data: {
19383
- aVertexColorType: te.length <= 252 ? La.createTypedArray(U.verticeTypes, Uint8Array) : La.createTypedArray(U.verticeTypes, Uint16Array),
19899
+ aVertexColorType: te.length <= 252 ? $a.createTypedArray(U.verticeTypes, Uint8Array) : $a.createTypedArray(U.verticeTypes, Uint16Array),
19384
19900
  aPosition: U.vertices,
19385
19901
  aNormal: U.normals,
19386
19902
  aTexCoord0: U.uvs,
@@ -19401,21 +19917,21 @@ function Na(e, t, n, i, r, s, o, a, l, h, c, u, f, d, p, g) {
19401
19917
  return U.featureIds.length ? (ne.data.featureIds = U.featureIds, B.push(ne.data.featureIds.buffer)) : ne.data.featureIds = [],
19402
19918
  ee.aColor && (ne.data.data.aColor = ee.aColor, ne.buffers.push(ee.aColor.buffer)),
19403
19919
  ee.aOpacity && (ne.data.data.aOpacity = ee.aOpacity, ne.buffers.push(ee.aOpacity.buffer)),
19404
- ne.buffers.push(ne.data.data.aPosition.buffer), ne.data.pickingIdIndiceMap = Da.generatePickingIndiceIndex(ne.data.data.aPickingId, ne.data.indices),
19920
+ ne.buffers.push(ne.data.data.aPosition.buffer), ne.data.pickingIdIndiceMap = qa.generatePickingIndiceIndex(ne.data.data.aPickingId, ne.data.indices),
19405
19921
  ne;
19406
19922
  }
19407
19923
 
19408
- const za = [];
19924
+ const Qa = [];
19409
19925
 
19410
- function Va(e, t) {
19926
+ function el(e, t) {
19411
19927
  for (let n = 0; n < e.length; n++) if (I.exactEquals(t, e[n])) return n;
19412
19928
  return -1;
19413
19929
  }
19414
19930
 
19415
19931
  H();
19416
19932
 
19417
- class Ua {
19418
- constructor(e = [], t = Ba) {
19933
+ class tl {
19934
+ constructor(e = [], t = nl) {
19419
19935
  if (this.data = e, this.length = this.data.length, this.compare = t, this.length > 0) for (let e = (this.length >> 1) - 1; e >= 0; e--) this._down(e);
19420
19936
  }
19421
19937
  push(e) {
@@ -19450,13 +19966,13 @@ class Ua {
19450
19966
  }
19451
19967
  }
19452
19968
 
19453
- function Ba(e, t) {
19969
+ function nl(e, t) {
19454
19970
  return e < t ? -1 : e > t ? 1 : 0;
19455
19971
  }
19456
19972
 
19457
- var Ga = {
19973
+ var il = {
19458
19974
  exports: {}
19459
- }, ja = function(e, t, n, i) {
19975
+ }, rl = function(e, t, n, i) {
19460
19976
  var r = e[0], s = e[1], o = !1;
19461
19977
  void 0 === n && (n = 0), void 0 === i && (i = t.length);
19462
19978
  for (var a = (i - n) / 2, l = 0, h = a - 1; l < a; h = l++) {
@@ -19464,7 +19980,7 @@ var Ga = {
19464
19980
  u > s != d > s && r < (f - c) * (s - u) / (d - u) + c && (o = !o);
19465
19981
  }
19466
19982
  return o;
19467
- }, Wa = function(e, t, n, i) {
19983
+ }, sl = function(e, t, n, i) {
19468
19984
  var r = e[0], s = e[1], o = !1;
19469
19985
  void 0 === n && (n = 0), void 0 === i && (i = t.length);
19470
19986
  for (var a = i - n, l = 0, h = a - 1; l < a; h = l++) {
@@ -19474,17 +19990,17 @@ var Ga = {
19474
19990
  return o;
19475
19991
  };
19476
19992
 
19477
- Ga.exports = function(e, t, n, i) {
19478
- return t.length > 0 && Array.isArray(t[0]) ? Wa(e, t, n, i) : ja(e, t, n, i);
19993
+ il.exports = function(e, t, n, i) {
19994
+ return t.length > 0 && Array.isArray(t[0]) ? sl(e, t, n, i) : rl(e, t, n, i);
19479
19995
  };
19480
19996
 
19481
- var Xa = Ga.exports.nested = Wa;
19997
+ var ol = il.exports.nested = sl;
19482
19998
 
19483
- Ga.exports.flat = ja;
19999
+ il.exports.flat = rl;
19484
20000
 
19485
- const Ya = 11102230246251565e-32, Za = 134217729, qa = (3 + 8 * Ya) * Ya;
20001
+ const al = 11102230246251565e-32, ll = 134217729, hl = (3 + 8 * al) * al;
19486
20002
 
19487
- function $a(e, t, n, i, r) {
20003
+ function cl(e, t, n, i, r) {
19488
20004
  let s, o, a, l, h = t[0], c = i[0], u = 0, f = 0;
19489
20005
  c > h == c > -h ? (s = h, h = t[++u]) : (s = c, c = i[++f]);
19490
20006
  let d = 0;
@@ -19499,60 +20015,60 @@ function $a(e, t, n, i, r) {
19499
20015
  return 0 === s && 0 !== d || (r[d++] = s), d;
19500
20016
  }
19501
20017
 
19502
- function Ja(e) {
20018
+ function ul(e) {
19503
20019
  return new Float64Array(e);
19504
20020
  }
19505
20021
 
19506
- const Ka = 33306690738754716e-32, Qa = 22204460492503146e-32, el = 11093356479670487e-47, tl = Ja(4), nl = Ja(8), il = Ja(12), rl = Ja(16), sl = Ja(4);
20022
+ const fl = 33306690738754716e-32, dl = 22204460492503146e-32, pl = 11093356479670487e-47, gl = ul(4), ml = ul(8), yl = ul(12), xl = ul(16), _l = ul(4);
19507
20023
 
19508
- function ol(e, t, n, i, r, s) {
20024
+ function vl(e, t, n, i, r, s) {
19509
20025
  const o = (t - s) * (n - r), a = (e - r) * (i - s), l = o - a;
19510
20026
  if (0 === o || 0 === a || o > 0 != a > 0) return l;
19511
20027
  const h = Math.abs(o + a);
19512
- return Math.abs(l) >= Ka * h ? l : -function(e, t, n, i, r, s, o) {
19513
- let a, l, h, c, u, f, d, p, g, m, y, x, _, v, b, A, T, S;
19514
- const w = e - r, M = n - r, P = t - s, I = i - s;
19515
- v = w * I, f = Za * w, d = f - (f - w), p = w - d, f = Za * I, g = f - (f - I),
19516
- m = I - g, b = p * m - (v - d * g - p * g - d * m), A = P * M, f = Za * P, d = f - (f - P),
19517
- p = P - d, f = Za * M, g = f - (f - M), m = M - g, T = p * m - (A - d * g - p * g - d * m),
19518
- y = b - T, u = b - y, tl[0] = b - (y + u) + (u - T), x = v + y, u = x - v, _ = v - (x - u) + (y - u),
19519
- y = _ - A, u = _ - y, tl[1] = _ - (y + u) + (u - A), S = x + y, u = S - x, tl[2] = x - (S - u) + (y - u),
19520
- tl[3] = S;
20028
+ return Math.abs(l) >= fl * h ? l : -function(e, t, n, i, r, s, o) {
20029
+ let a, l, h, c, u, f, d, p, g, m, y, x, _, v, b, A, T, w;
20030
+ const S = e - r, M = n - r, P = t - s, I = i - s;
20031
+ v = S * I, f = ll * S, d = f - (f - S), p = S - d, f = ll * I, g = f - (f - I),
20032
+ m = I - g, b = p * m - (v - d * g - p * g - d * m), A = P * M, f = ll * P, d = f - (f - P),
20033
+ p = P - d, f = ll * M, g = f - (f - M), m = M - g, T = p * m - (A - d * g - p * g - d * m),
20034
+ y = b - T, u = b - y, gl[0] = b - (y + u) + (u - T), x = v + y, u = x - v, _ = v - (x - u) + (y - u),
20035
+ y = _ - A, u = _ - y, gl[1] = _ - (y + u) + (u - A), w = x + y, u = w - x, gl[2] = x - (w - u) + (y - u),
20036
+ gl[3] = w;
19521
20037
  let C = function(e, t) {
19522
20038
  let n = t[0];
19523
20039
  for (let i = 1; i < e; i++) n += t[i];
19524
20040
  return n;
19525
- }(4, tl), k = Qa * o;
20041
+ }(4, gl), k = dl * o;
19526
20042
  if (C >= k || -C >= k) return C;
19527
- if (u = e - w, a = e - (w + u) + (u - r), u = n - M, h = n - (M + u) + (u - r),
20043
+ if (u = e - S, a = e - (S + u) + (u - r), u = n - M, h = n - (M + u) + (u - r),
19528
20044
  u = t - P, l = t - (P + u) + (u - s), u = i - I, c = i - (I + u) + (u - s), 0 === a && 0 === l && 0 === h && 0 === c) return C;
19529
- if (k = el * o + qa * Math.abs(C), C += w * c + I * a - (P * h + M * l), C >= k || -C >= k) return C;
19530
- v = a * I, f = Za * a, d = f - (f - a), p = a - d, f = Za * I, g = f - (f - I),
19531
- m = I - g, b = p * m - (v - d * g - p * g - d * m), A = l * M, f = Za * l, d = f - (f - l),
19532
- p = l - d, f = Za * M, g = f - (f - M), m = M - g, T = p * m - (A - d * g - p * g - d * m),
19533
- y = b - T, u = b - y, sl[0] = b - (y + u) + (u - T), x = v + y, u = x - v, _ = v - (x - u) + (y - u),
19534
- y = _ - A, u = _ - y, sl[1] = _ - (y + u) + (u - A), S = x + y, u = S - x, sl[2] = x - (S - u) + (y - u),
19535
- sl[3] = S;
19536
- const F = $a(4, tl, 4, sl, nl);
19537
- v = w * c, f = Za * w, d = f - (f - w), p = w - d, f = Za * c, g = f - (f - c),
19538
- m = c - g, b = p * m - (v - d * g - p * g - d * m), A = P * h, f = Za * P, d = f - (f - P),
19539
- p = P - d, f = Za * h, g = f - (f - h), m = h - g, T = p * m - (A - d * g - p * g - d * m),
19540
- y = b - T, u = b - y, sl[0] = b - (y + u) + (u - T), x = v + y, u = x - v, _ = v - (x - u) + (y - u),
19541
- y = _ - A, u = _ - y, sl[1] = _ - (y + u) + (u - A), S = x + y, u = S - x, sl[2] = x - (S - u) + (y - u),
19542
- sl[3] = S;
19543
- const O = $a(F, nl, 4, sl, il);
19544
- v = a * c, f = Za * a, d = f - (f - a), p = a - d, f = Za * c, g = f - (f - c),
19545
- m = c - g, b = p * m - (v - d * g - p * g - d * m), A = l * h, f = Za * l, d = f - (f - l),
19546
- p = l - d, f = Za * h, g = f - (f - h), m = h - g, T = p * m - (A - d * g - p * g - d * m),
19547
- y = b - T, u = b - y, sl[0] = b - (y + u) + (u - T), x = v + y, u = x - v, _ = v - (x - u) + (y - u),
19548
- y = _ - A, u = _ - y, sl[1] = _ - (y + u) + (u - A), S = x + y, u = S - x, sl[2] = x - (S - u) + (y - u),
19549
- sl[3] = S;
19550
- const R = $a(O, il, 4, sl, rl);
19551
- return rl[R - 1];
20045
+ if (k = pl * o + hl * Math.abs(C), C += S * c + I * a - (P * h + M * l), C >= k || -C >= k) return C;
20046
+ v = a * I, f = ll * a, d = f - (f - a), p = a - d, f = ll * I, g = f - (f - I),
20047
+ m = I - g, b = p * m - (v - d * g - p * g - d * m), A = l * M, f = ll * l, d = f - (f - l),
20048
+ p = l - d, f = ll * M, g = f - (f - M), m = M - g, T = p * m - (A - d * g - p * g - d * m),
20049
+ y = b - T, u = b - y, _l[0] = b - (y + u) + (u - T), x = v + y, u = x - v, _ = v - (x - u) + (y - u),
20050
+ y = _ - A, u = _ - y, _l[1] = _ - (y + u) + (u - A), w = x + y, u = w - x, _l[2] = x - (w - u) + (y - u),
20051
+ _l[3] = w;
20052
+ const F = cl(4, gl, 4, _l, ml);
20053
+ v = S * c, f = ll * S, d = f - (f - S), p = S - d, f = ll * c, g = f - (f - c),
20054
+ m = c - g, b = p * m - (v - d * g - p * g - d * m), A = P * h, f = ll * P, d = f - (f - P),
20055
+ p = P - d, f = ll * h, g = f - (f - h), m = h - g, T = p * m - (A - d * g - p * g - d * m),
20056
+ y = b - T, u = b - y, _l[0] = b - (y + u) + (u - T), x = v + y, u = x - v, _ = v - (x - u) + (y - u),
20057
+ y = _ - A, u = _ - y, _l[1] = _ - (y + u) + (u - A), w = x + y, u = w - x, _l[2] = x - (w - u) + (y - u),
20058
+ _l[3] = w;
20059
+ const O = cl(F, ml, 4, _l, yl);
20060
+ v = a * c, f = ll * a, d = f - (f - a), p = a - d, f = ll * c, g = f - (f - c),
20061
+ m = c - g, b = p * m - (v - d * g - p * g - d * m), A = l * h, f = ll * l, d = f - (f - l),
20062
+ p = l - d, f = ll * h, g = f - (f - h), m = h - g, T = p * m - (A - d * g - p * g - d * m),
20063
+ y = b - T, u = b - y, _l[0] = b - (y + u) + (u - T), x = v + y, u = x - v, _ = v - (x - u) + (y - u),
20064
+ y = _ - A, u = _ - y, _l[1] = _ - (y + u) + (u - A), w = x + y, u = w - x, _l[2] = x - (w - u) + (y - u),
20065
+ _l[3] = w;
20066
+ const R = cl(O, yl, 4, _l, xl);
20067
+ return xl[R - 1];
19552
20068
  }(e, t, n, i, r, s, h);
19553
20069
  }
19554
20070
 
19555
- function al(e, t, n) {
20071
+ function bl(e, t, n) {
19556
20072
  t = Math.max(0, void 0 === t ? 2 : t), n = n || 0;
19557
20073
  var i = function(e) {
19558
20074
  for (var t = e[0], n = e[0], i = e[0], r = e[0], s = 0; s < e.length; s++) {
@@ -19560,15 +20076,15 @@ function al(e, t, n) {
19560
20076
  o[0] < t[0] && (t = o), o[0] > i[0] && (i = o), o[1] < n[1] && (n = o), o[1] > r[1] && (r = o);
19561
20077
  }
19562
20078
  var a = [ t, n, i, r ], l = a.slice();
19563
- for (s = 0; s < e.length; s++) Xa(e[s], a) || l.push(e[s]);
20079
+ for (s = 0; s < e.length; s++) ol(e[s], a) || l.push(e[s]);
19564
20080
  return function(e) {
19565
- e.sort(_l);
20081
+ e.sort(Rl);
19566
20082
  for (var t = [], n = 0; n < e.length; n++) {
19567
- for (;t.length >= 2 && dl(t[t.length - 2], t[t.length - 1], e[n]) <= 0; ) t.pop();
20083
+ for (;t.length >= 2 && Pl(t[t.length - 2], t[t.length - 1], e[n]) <= 0; ) t.pop();
19568
20084
  t.push(e[n]);
19569
20085
  }
19570
20086
  for (var i = [], r = e.length - 1; r >= 0; r--) {
19571
- for (;i.length >= 2 && dl(i[i.length - 2], i[i.length - 1], e[r]) <= 0; ) i.pop();
20087
+ for (;i.length >= 2 && Pl(i[i.length - 2], i[i.length - 1], e[r]) <= 0; ) i.pop();
19572
20088
  i.push(e[r]);
19573
20089
  }
19574
20090
  return i.pop(), t.pop(), t.concat(i);
@@ -19588,16 +20104,16 @@ function al(e, t, n) {
19588
20104
  }, r.load(e);
19589
20105
  for (var s, o = [], a = 0; a < i.length; a++) {
19590
20106
  var l = i[a];
19591
- r.remove(l), s = gl(l, s), o.push(s);
20107
+ r.remove(l), s = Cl(l, s), o.push(s);
19592
20108
  }
19593
20109
  var h = new R(16);
19594
- for (a = 0; a < o.length; a++) h.insert(pl(o[a]));
20110
+ for (a = 0; a < o.length; a++) h.insert(Il(o[a]));
19595
20111
  for (var c = t * t, u = n * n; o.length; ) {
19596
- var f = o.shift(), d = f.p, p = f.next.p, g = ml(d, p);
20112
+ var f = o.shift(), d = f.p, p = f.next.p, g = kl(d, p);
19597
20113
  if (!(g < u)) {
19598
20114
  var m = g / c;
19599
- (l = ll(r, f.prev.p, d, p, f.next.next.p, m, h)) && Math.min(ml(l, d), ml(l, p)) <= m && (o.push(f),
19600
- o.push(gl(l, f)), r.remove(l), h.remove(f), h.insert(pl(f)), h.insert(pl(f.next)));
20115
+ (l = Al(r, f.prev.p, d, p, f.next.next.p, m, h)) && Math.min(kl(l, d), kl(l, p)) <= m && (o.push(f),
20116
+ o.push(Cl(l, f)), r.remove(l), h.remove(f), h.insert(Il(f)), h.insert(Il(f.next)));
19601
20117
  }
19602
20118
  }
19603
20119
  f = s;
@@ -19608,65 +20124,65 @@ function al(e, t, n) {
19608
20124
  return y.push(f.p), y;
19609
20125
  }
19610
20126
 
19611
- function ll(e, t, n, i, r, s, o) {
19612
- for (var a = new Ua([], hl), l = e.data; l; ) {
20127
+ function Al(e, t, n, i, r, s, o) {
20128
+ for (var a = new tl([], Tl), l = e.data; l; ) {
19613
20129
  for (var h = 0; h < l.children.length; h++) {
19614
- var c = l.children[h], u = l.leaf ? yl(c, n, i) : cl(n, i, c);
20130
+ var c = l.children[h], u = l.leaf ? Fl(c, n, i) : wl(n, i, c);
19615
20131
  u > s || a.push({
19616
20132
  node: c,
19617
20133
  dist: u
19618
20134
  });
19619
20135
  }
19620
20136
  for (;a.length && !a.peek().node.children; ) {
19621
- var f = a.pop(), d = f.node, p = yl(d, t, n), g = yl(d, i, r);
19622
- if (f.dist < p && f.dist < g && fl(n, d, o) && fl(i, d, o)) return d;
20137
+ var f = a.pop(), d = f.node, p = Fl(d, t, n), g = Fl(d, i, r);
20138
+ if (f.dist < p && f.dist < g && Ml(n, d, o) && Ml(i, d, o)) return d;
19623
20139
  }
19624
20140
  (l = a.pop()) && (l = l.node);
19625
20141
  }
19626
20142
  return null;
19627
20143
  }
19628
20144
 
19629
- function hl(e, t) {
20145
+ function Tl(e, t) {
19630
20146
  return e.dist - t.dist;
19631
20147
  }
19632
20148
 
19633
- function cl(e, t, n) {
19634
- if (ul(e, n) || ul(t, n)) return 0;
19635
- var i = xl(e[0], e[1], t[0], t[1], n.minX, n.minY, n.maxX, n.minY);
20149
+ function wl(e, t, n) {
20150
+ if (Sl(e, n) || Sl(t, n)) return 0;
20151
+ var i = Ol(e[0], e[1], t[0], t[1], n.minX, n.minY, n.maxX, n.minY);
19636
20152
  if (0 === i) return 0;
19637
- var r = xl(e[0], e[1], t[0], t[1], n.minX, n.minY, n.minX, n.maxY);
20153
+ var r = Ol(e[0], e[1], t[0], t[1], n.minX, n.minY, n.minX, n.maxY);
19638
20154
  if (0 === r) return 0;
19639
- var s = xl(e[0], e[1], t[0], t[1], n.maxX, n.minY, n.maxX, n.maxY);
20155
+ var s = Ol(e[0], e[1], t[0], t[1], n.maxX, n.minY, n.maxX, n.maxY);
19640
20156
  if (0 === s) return 0;
19641
- var o = xl(e[0], e[1], t[0], t[1], n.minX, n.maxY, n.maxX, n.maxY);
20157
+ var o = Ol(e[0], e[1], t[0], t[1], n.minX, n.maxY, n.maxX, n.maxY);
19642
20158
  return 0 === o ? 0 : Math.min(i, r, s, o);
19643
20159
  }
19644
20160
 
19645
- function ul(e, t) {
20161
+ function Sl(e, t) {
19646
20162
  return e[0] >= t.minX && e[0] <= t.maxX && e[1] >= t.minY && e[1] <= t.maxY;
19647
20163
  }
19648
20164
 
19649
- function fl(e, t, n) {
20165
+ function Ml(e, t, n) {
19650
20166
  for (var i, r, s, o, a = Math.min(e[0], t[0]), l = Math.min(e[1], t[1]), h = Math.max(e[0], t[0]), c = Math.max(e[1], t[1]), u = n.search({
19651
20167
  minX: a,
19652
20168
  minY: l,
19653
20169
  maxX: h,
19654
20170
  maxY: c
19655
- }), f = 0; f < u.length; f++) if (i = u[f].p, r = u[f].next.p, s = e, i !== (o = t) && r !== s && dl(i, r, s) > 0 != dl(i, r, o) > 0 && dl(s, o, i) > 0 != dl(s, o, r) > 0) return !1;
20171
+ }), f = 0; f < u.length; f++) if (i = u[f].p, r = u[f].next.p, s = e, i !== (o = t) && r !== s && Pl(i, r, s) > 0 != Pl(i, r, o) > 0 && Pl(s, o, i) > 0 != Pl(s, o, r) > 0) return !1;
19656
20172
  return !0;
19657
20173
  }
19658
20174
 
19659
- function dl(e, t, n) {
19660
- return ol(e[0], e[1], t[0], t[1], n[0], n[1]);
20175
+ function Pl(e, t, n) {
20176
+ return vl(e[0], e[1], t[0], t[1], n[0], n[1]);
19661
20177
  }
19662
20178
 
19663
- function pl(e) {
20179
+ function Il(e) {
19664
20180
  var t = e.p, n = e.next.p;
19665
20181
  return e.minX = Math.min(t[0], n[0]), e.minY = Math.min(t[1], n[1]), e.maxX = Math.max(t[0], n[0]),
19666
20182
  e.maxY = Math.max(t[1], n[1]), e;
19667
20183
  }
19668
20184
 
19669
- function gl(e, t) {
20185
+ function Cl(e, t) {
19670
20186
  var n = {
19671
20187
  p: e,
19672
20188
  prev: null,
@@ -19680,12 +20196,12 @@ function gl(e, t) {
19680
20196
  n.next = n), n;
19681
20197
  }
19682
20198
 
19683
- function ml(e, t) {
20199
+ function kl(e, t) {
19684
20200
  var n = e[0] - t[0], i = e[1] - t[1];
19685
20201
  return n * n + i * i;
19686
20202
  }
19687
20203
 
19688
- function yl(e, t, n) {
20204
+ function Fl(e, t, n) {
19689
20205
  var i = t[0], r = t[1], s = n[0] - i, o = n[1] - r;
19690
20206
  if (0 !== s || 0 !== o) {
19691
20207
  var a = ((e[0] - i) * s + (e[1] - r) * o) / (s * s + o * o);
@@ -19694,28 +20210,28 @@ function yl(e, t, n) {
19694
20210
  return (s = e[0] - i) * s + (o = e[1] - r) * o;
19695
20211
  }
19696
20212
 
19697
- function xl(e, t, n, i, r, s, o, a) {
19698
- var l, h, c, u, f = n - e, d = i - t, p = o - r, g = a - s, m = e - r, y = t - s, x = f * f + d * d, _ = f * p + d * g, v = p * p + g * g, b = f * m + d * y, A = p * m + g * y, T = x * v - _ * _, S = T, w = T;
19699
- 0 === T ? (h = 0, S = 1, u = A, w = v) : (u = x * A - _ * b, (h = _ * A - v * b) < 0 ? (h = 0,
19700
- u = A, w = v) : h > S && (h = S, u = A + _, w = v)), u < 0 ? (u = 0, -b < 0 ? h = 0 : -b > x ? h = S : (h = -b,
19701
- S = x)) : u > w && (u = w, -b + _ < 0 ? h = 0 : -b + _ > x ? h = S : (h = -b + _,
19702
- S = x));
19703
- var M = (1 - (c = 0 === u ? 0 : u / w)) * r + c * o - ((1 - (l = 0 === h ? 0 : h / S)) * e + l * n), P = (1 - c) * s + c * a - ((1 - l) * t + l * i);
20213
+ function Ol(e, t, n, i, r, s, o, a) {
20214
+ var l, h, c, u, f = n - e, d = i - t, p = o - r, g = a - s, m = e - r, y = t - s, x = f * f + d * d, _ = f * p + d * g, v = p * p + g * g, b = f * m + d * y, A = p * m + g * y, T = x * v - _ * _, w = T, S = T;
20215
+ 0 === T ? (h = 0, w = 1, u = A, S = v) : (u = x * A - _ * b, (h = _ * A - v * b) < 0 ? (h = 0,
20216
+ u = A, S = v) : h > w && (h = w, u = A + _, S = v)), u < 0 ? (u = 0, -b < 0 ? h = 0 : -b > x ? h = w : (h = -b,
20217
+ w = x)) : u > S && (u = S, -b + _ < 0 ? h = 0 : -b + _ > x ? h = w : (h = -b + _,
20218
+ w = x));
20219
+ var M = (1 - (c = 0 === u ? 0 : u / S)) * r + c * o - ((1 - (l = 0 === h ? 0 : h / w)) * e + l * n), P = (1 - c) * s + c * a - ((1 - l) * t + l * i);
19704
20220
  return M * M + P * P;
19705
20221
  }
19706
20222
 
19707
- function _l(e, t) {
20223
+ function Rl(e, t) {
19708
20224
  return e[0] === t[0] ? e[1] - t[1] : e[0] - t[0];
19709
20225
  }
19710
20226
 
19711
- const {PackUtil: vl} = H();
20227
+ const {PackUtil: El} = H();
19712
20228
 
19713
- class bl {
20229
+ class Dl {
19714
20230
  constructor(e, t) {
19715
20231
  this.x = e, this.y = t;
19716
20232
  }
19717
20233
  clone() {
19718
- return new bl(this.x, this.y);
20234
+ return new Dl(this.x, this.y);
19719
20235
  }
19720
20236
  normalize() {
19721
20237
  const e = this.length();
@@ -19728,7 +20244,7 @@ class bl {
19728
20244
  return Math.sqrt(this.x * this.x + this.y * this.y);
19729
20245
  }
19730
20246
  diff(e) {
19731
- return new bl(this.x - e.x, this.y - e.y);
20247
+ return new Dl(this.x - e.x, this.y - e.y);
19732
20248
  }
19733
20249
  distance(e) {
19734
20250
  const t = this.x - e.x, n = this.y - e.y;
@@ -19741,51 +20257,51 @@ class bl {
19741
20257
  return this.x === e.x && this.y === e.y;
19742
20258
  }
19743
20259
  orthogonal() {
19744
- return new bl(this.y, -this.x);
20260
+ return new Dl(this.y, -this.x);
19745
20261
  }
19746
20262
  }
19747
20263
 
19748
- function Al(e, t, n, i) {
20264
+ function Ll(e, t, n, i) {
19749
20265
  const r = t.x * i.y - t.y * i.x, s = n.x - e.x, o = n.y - e.y, a = (s * i.y - o * i.x) / r;
19750
- return new bl(e.x + a * t.x, e.y + a * t.y);
20266
+ return new Dl(e.x + a * t.x, e.y + a * t.y);
19751
20267
  }
19752
20268
 
19753
- const Tl = [], Sl = [];
20269
+ const Hl = [], Nl = [];
19754
20270
 
19755
- function wl(e) {
20271
+ function zl(e) {
19756
20272
  if (G(e[0] && e[0].x)) {
19757
20273
  const t = [];
19758
20274
  let n = 0;
19759
- for (let i = 0; i < e.length; i++) Sl[n] ? (Sl[n][0] = e[i].x, Sl[n][1] = e[i].y) : Sl[n] = [ e[i].x, e[i].y ],
19760
- t.push(Sl[n]), n++;
20275
+ for (let i = 0; i < e.length; i++) Nl[n] ? (Nl[n][0] = e[i].x, Nl[n][1] = e[i].y) : Nl[n] = [ e[i].x, e[i].y ],
20276
+ t.push(Nl[n]), n++;
19761
20277
  e = t;
19762
20278
  }
19763
20279
  try {
19764
- const t = al(e, 1 / 0);
20280
+ const t = bl(e, 1 / 0);
19765
20281
  let n = [ 1 / 0, 1 / 0 ], i = [ -1 / 0, -1 / 0 ];
19766
20282
  for (let e = 0; e < t.length; e++) t[e][0] < n[0] && (n[0] = t[e][0]), t[e][0] > i[0] && (i[0] = t[e][0]),
19767
20283
  t[e][1] < n[1] && (n[1] = t[e][1]), t[e][1] > i[1] && (i[1] = t[e][1]);
19768
20284
  const r = [];
19769
20285
  let s = [], o = 0;
19770
- for (let e = 0; e < t.length; e++) e === t.length - 1 && t[e][0] === t[0][0] && t[e][1] === t[0][1] || (wa(r, t[e]),
19771
- Tl[o] ? (Tl[o].x = r[0], Tl[o].y = r[1]) : Tl[o] = new bl(r[0], r[1]), s.push(Tl[o]),
20286
+ for (let e = 0; e < t.length; e++) e === t.length - 1 && t[e][0] === t[0][0] && t[e][1] === t[0][1] || (za(r, t[e]),
20287
+ Hl[o] ? (Hl[o].x = r[0], Hl[o].y = r[1]) : Hl[o] = new Dl(r[0], r[1]), s.push(Hl[o]),
19772
20288
  o++);
19773
- vl.calculateSignedArea(s) < 0 && (s = s.reverse());
20289
+ El.calculateSignedArea(s) < 0 && (s = s.reverse());
19774
20290
  const a = function(e) {
19775
20291
  let t, n = Number.MAX_VALUE;
19776
20292
  const i = function(e, i, r, s, o, a, l, h) {
19777
- var c = Al(e, i, o, a), u = Al(r, s, o, a), f = Al(l, h, e, i), d = Al(l, h, r, s), p = c.distance(u) * c.distance(f);
20293
+ var c = Ll(e, i, o, a), u = Ll(r, s, o, a), f = Ll(l, h, e, i), d = Ll(l, h, r, s), p = c.distance(u) * c.distance(f);
19778
20294
  0 !== p && p < n && (t = [ c, f, d, u ], n = p);
19779
20295
  };
19780
20296
  var r = [];
19781
20297
  for (let t = 0; t < e.length; t++) r.push(e[(t + 1) % e.length].diff(e[t])), r[t].normalize();
19782
- var s, o, a, l, h = new bl(Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY), c = new bl(Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY);
20298
+ var s, o, a, l, h = new Dl(Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY), c = new Dl(Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY);
19783
20299
  for (let t = 0; t < e.length; t++) {
19784
20300
  var u = e[t];
19785
20301
  u.x < h.x && (h.x = u.x, s = t), u.x > c.x && (c.x = u.x, o = t), u.y < h.y && (h.y = u.y,
19786
20302
  l = t), u.y > c.y && (c.y = u.y, a = t);
19787
20303
  }
19788
- var f = new bl(0, -1), d = new bl(0, 1), p = new bl(-1, 0), g = new bl(1, 0);
20304
+ var f = new Dl(0, -1), d = new Dl(0, 1), p = new Dl(-1, 0), g = new Dl(1, 0);
19789
20305
  for (let t = 0; t < e.length; t++) {
19790
20306
  var m = [ Math.acos(f.dot(r[s])), Math.acos(d.dot(r[o])), Math.acos(p.dot(r[a])), Math.acos(g.dot(r[l])) ];
19791
20307
  switch (m.indexOf(Math.min.apply(Math, m))) {
@@ -19820,11 +20336,11 @@ function wl(e) {
19820
20336
  }
19821
20337
  }
19822
20338
 
19823
- const {DEFAULT_TEX_WIDTH: Ml} = H();
20339
+ const {DEFAULT_TEX_WIDTH: Vl} = H();
19824
20340
 
19825
- class Pl extends mt {
20341
+ class Ul extends mt {
19826
20342
  static fromJSON(e) {
19827
- return ua(e, "ExtrudePolygonLayer", Pl);
20343
+ return Sa(e, "ExtrudePolygonLayer", Ul);
19828
20344
  }
19829
20345
  getPolygonOffsetCount() {
19830
20346
  return 0;
@@ -19857,12 +20373,12 @@ class Pl extends mt {
19857
20373
  }
19858
20374
  }
19859
20375
 
19860
- Pl.registerJSONType("ExtrudePolygonLayer"), Pl.mergeOptions({
20376
+ Ul.registerJSONType("ExtrudePolygonLayer"), Ul.mergeOptions({
19861
20377
  cullFace: !1,
19862
20378
  castShadow: !0
19863
20379
  });
19864
20380
 
19865
- const Il = {
20381
+ const Bl = {
19866
20382
  polygonFill: {
19867
20383
  type: "identity",
19868
20384
  default: [ 1, 1, 1, 1 ],
@@ -19883,11 +20399,11 @@ const Il = {
19883
20399
  default: [ 1, 1, 1, 1 ],
19884
20400
  property: "_symbol_bottomPolygonFill"
19885
20401
  }
19886
- }, Cl = {
20402
+ }, Gl = {
19887
20403
  defaultAltitude: 20
19888
- }, kl = e => 1 === e.properties.top;
20404
+ }, jl = e => 1 === e.properties.top;
19889
20405
 
19890
- Pl.registerRenderer("gl", class extends _a {
20406
+ Ul.registerRenderer("gl", class extends Ra {
19891
20407
  constructor(...t) {
19892
20408
  super(...t), this.GeometryTypes = [ e.Polygon, e.MultiPolygon ];
19893
20409
  }
@@ -19924,8 +20440,8 @@ Pl.registerRenderer("gl", class extends _a {
19924
20440
  }
19925
20441
  createPainter() {
19926
20442
  const e = mt.get3DPainterClass("lit");
19927
- this.painterSymbol = U({}, Il), this.sidePainterSymbol = U({}, Il), this._defineSymbolBloom(this.painterSymbol, e.getBloomSymbol());
19928
- const t = this.layer, n = U({}, Cl, t.options.dataConfig || {});
20443
+ this.painterSymbol = U({}, Bl), this.sidePainterSymbol = U({}, Bl), this._defineSymbolBloom(this.painterSymbol, e.getBloomSymbol());
20444
+ const t = this.layer, n = U({}, Gl, t.options.dataConfig || {});
19929
20445
  t.options.material && (this.painterSymbol.material = t.options.material), t.options.sideMaterial ? this.sidePainterSymbol.material = t.options.sideMaterial : this.sidePainterSymbol.material = t.options.material;
19930
20446
  const i = {
19931
20447
  cullFace: t.options.cullFace
@@ -19950,9 +20466,9 @@ Pl.registerRenderer("gl", class extends _a {
19950
20466
  }
19951
20467
  _renderMeshes(...e) {
19952
20468
  const t = e[0], n = t.sceneFilter;
19953
- t.sceneFilter = e => (!n || n(e)) && kl(e);
20469
+ t.sceneFilter = e => (!n || n(e)) && jl(e);
19954
20470
  const i = super._renderMeshes(...e);
19955
- t.sceneFilter = e => (!n || n(e)) && kl(e);
20471
+ t.sceneFilter = e => (!n || n(e)) && jl(e);
19956
20472
  const r = this.painter;
19957
20473
  this.painter = this.sidePainter;
19958
20474
  const s = t.sceneFilter = e => (!n || n(e)) && (e => 1 === e.properties.side)(e);
@@ -19977,12 +20493,12 @@ Pl.registerRenderer("gl", class extends _a {
19977
20493
  }
19978
20494
  _createPackData(t, n, i, r) {
19979
20495
  const s = this.getMap();
19980
- n = Il;
19981
- const o = this._extrudeCenter, a = 1 / 0, l = s.getZoom(), h = new e.Point(0, 0), c = new e.Coordinate(0, 0), u = U({}, Cl, this.layer.options.dataConfig);
20496
+ n = Bl;
20497
+ const o = this._extrudeCenter, a = 1 / 0, l = s.getZoom(), h = new e.Point(0, 0), c = new e.Coordinate(0, 0), u = U({}, Gl, this.layer.options.dataConfig);
19982
20498
  if (u.uv = !0, u.top && (u.top = i), u.side && (u.side = r), !1 === u.top && !1 === u.side) return null;
19983
20499
  if (!t.length) return null;
19984
- const f = s.getGLRes(), d = s.getProjection().code, p = i ? this.painterSymbol && this.painterSymbol.material : this.sidePainterSymbol && this.sidePainterSymbol.material, g = p && p.textureWidth || Ml, m = [ Ue(s, 1, c, f) / 100, Ue(s, 1, c, f, 1) / 100 ];
19985
- return Na(t, u, a, h, g, s.getGLRes(), 1, 1, m, this._zScale, n, l, d, undefined, Float32Array, o);
20500
+ const f = s.getGLRes(), d = s.getProjection().code, p = i ? this.painterSymbol && this.painterSymbol.material : this.sidePainterSymbol && this.sidePainterSymbol.material, g = p && p.textureWidth || Vl, m = [ Ue(s, 1, c, f) / 100, Ue(s, 1, c, f, 1) / 100 ];
20501
+ return Ka(t, u, a, h, g, s.getGLRes(), 1, 1, m, this._zScale, n, l, d, undefined, Float32Array, o);
19986
20502
  }
19987
20503
  updateMesh(e) {
19988
20504
  const t = e[Vn];
@@ -20001,11 +20517,11 @@ Pl.registerRenderer("gl", class extends _a {
20001
20517
  const e = [];
20002
20518
  for (let t = 0; t < n.length; t++) {
20003
20519
  const i = n[t] && n[t][0];
20004
- e[t] = wl(i);
20520
+ e[t] = zl(i);
20005
20521
  }
20006
20522
  t.getProperties()[ye] = e;
20007
20523
  } else {
20008
- const e = wl(n[0]);
20524
+ const e = zl(n[0]);
20009
20525
  t.getProperties()[ye] = e;
20010
20526
  }
20011
20527
  }
@@ -20024,15 +20540,15 @@ Pl.registerRenderer("gl", class extends _a {
20024
20540
  getShadowMeshes() {
20025
20541
  return this.painter ? this.painter.getShadowMeshes() : [];
20026
20542
  }
20027
- }), Pl.registerRenderer("canvas", null);
20543
+ }), Ul.registerRenderer("canvas", null);
20028
20544
 
20029
- const {PackUtil: Fl, FilterUtil: Ol, SYMBOLS_NEED_REBUILD_IN_VT: Rl, SYMBOLS_NEED_REBUILD_IN_VECTOR: El} = H();
20545
+ const {PackUtil: Wl, FilterUtil: Xl, SYMBOLS_NEED_REBUILD_IN_VT: Yl, SYMBOLS_NEED_REBUILD_IN_VECTOR: Zl} = H();
20030
20546
 
20031
- s.ShaderLib.register("vt_position_vert", "#ifdef HAS_TERRAIN_ALTITUDE\n attribute float aTerrainAltitude;\n#endif\nuniform float minAltitude;\n#ifdef HAS_ALTITUDE\n vec3 unpackVTPosition() {\n float altitude = aAltitude;\n #ifdef HAS_TERRAIN_ALTITUDE\n altitude += aTerrainAltitude * 100.0;\n #endif\n altitude += minAltitude * 100.0;\n return vec3(aPosition, altitude);\n }\n#else\n float position_modValue = 16384.0;\n float position_delta = 0.00001;\n vec3 unpackVTPosition() {\n float z = aPosition.z;\n vec2 pos = sign(aPosition.xy + position_delta) * mod(abs(aPosition.xy), position_modValue);\n vec2 highs = floor(abs(aPosition.xy) / position_modValue);\n float altitude = sign(z + position_delta) * (highs.x * 2.0 + highs.y) * pow(2.0, 15.0) + z;\n #ifdef HAS_TERRAIN_ALTITUDE\n altitude += aTerrainAltitude * 100.0;\n #endif\n altitude += minAltitude * 100.0;\n return vec3(pos, altitude);\n }\n#endif");
20547
+ s.ShaderLib.register("vt_position_vert", "#ifdef HAS_TERRAIN_ALTITUDE\n attribute float aTerrainAltitude;\n#endif\nuniform float minAltitude;\nvec3 unpackVTPosition(vec2 aPosition, float aAltitude) {\n float altitude = aAltitude;\n #ifdef HAS_TERRAIN_ALTITUDE\n altitude += aTerrainAltitude * 100.0;\n #endif\n altitude += minAltitude * 100.0;\n return vec3(aPosition, altitude);\n}\n#ifdef HAS_ALTITUDE\n vec3 unpackVTPosition(vec3 offset) {\n return unpackVTPosition(aPosition + offset.xy, aAltitude + offset.z);\n }\n vec3 unpackVTPosition() {\n return unpackVTPosition(aPosition, aAltitude);\n }\n#else\n float position_modValue = 16384.0;\n float position_delta = 0.00001;\n vec3 unpackVTPosition(vec3 offset) {\n float z = aPosition.z;\n vec2 pos = sign(aPosition.xy + position_delta) * mod(abs(aPosition.xy), position_modValue);\n vec2 highs = floor(abs(aPosition.xy) / position_modValue);\n float altitude = sign(z + position_delta) * (highs.x * 2.0 + highs.y) * pow(2.0, 15.0) + z;\n return unpackVTPosition(pos + offset.xy, altitude + offset.z);\n }\n vec3 unpackVTPosition() {\n return unpackVTPosition(vec3(0.0));\n }\n#endif");
20032
20548
 
20033
20549
  r.mat4.create();
20034
20550
 
20035
- const Dl = function(e, t) {
20551
+ const ql = function(e, t) {
20036
20552
  const n = e.toString(), i = n.indexOf("{") + 1, r = n.substring(0, i);
20037
20553
  let s = `${r}\n (` + t.toString() + ")({});\n";
20038
20554
  return s += "\n" + n.substring(r.length), s;
@@ -20041,14 +20557,14 @@ const Dl = function(e, t) {
20041
20557
  if (r.transcoders) {
20042
20558
  const t = e.Map.VERSION;
20043
20559
  if (t.indexOf("1.0.0-beta") >= 0 || t.indexOf("1.0.0-alpha") >= 0) {
20044
- const t = r.transcoders.inject(Dl);
20560
+ const t = r.transcoders.inject(ql);
20045
20561
  e.registerWorkerAdapter("@maptalks/vt", t);
20046
20562
  } else e.registerWorkerAdapter("@maptalks/vt", (function() {
20047
- return r.transcoders.inject(Dl);
20563
+ return r.transcoders.inject(ql);
20048
20564
  }));
20049
- } else e.registerWorkerAdapter("@maptalks/vt", Dl);
20565
+ } else e.registerWorkerAdapter("@maptalks/vt", ql);
20050
20566
 
20051
- export { Pl as ExtrudePolygonLayer, Cn as FillPainter, To as FillPlugin, Ol as FilterUtil, Ro as GLTFPhongPlugin, Eo as GLTFStandardPlugin, zo as GeoJSONVectorTileLayer, Do as HeatmapPlugin, Pr as IconPainter, Mo as IconPlugin, wo as LineGradientPlugin, Rn as LinePainter, So as LinePlugin, pa as LineStringLayer, Fo as LitPlugin, Ho as MapboxVectorTileLayer, Ms as NativeLinePainter, Io as NativeLinePlugin, Ts as NativePointPainter, Fl as PackUtil, Vs as PhongPainter, Co as PhongPlugin, fa as PointLayer, ya as PolygonLayer, El as SYMBOLS_NEED_REBUILD_IN_VECTOR, Rl as SYMBOLS_NEED_REBUILD_IN_VT, xs as TextPainter, Po as TextPlugin, Oo as TubePlugin, mt as Vector3DLayer, ht as VectorTileLayer, $e as VectorTileLayerRenderer, Lo as WaterPlugin, Bs as WireframePainter, ko as WireframePlugin };
20567
+ export { Do as BillBoardPainter, $o as BillBoardPlugin, Ul as ExtrudePolygonLayer, Cn as FillPainter, Lo as FillPlugin, Xl as FilterUtil, Xo as GLTFPhongPlugin, Yo as GLTFStandardPlugin, Qo as GeoJSONVectorTileLayer, Zo as HeatmapPlugin, Pr as IconPainter, zo as IconPlugin, No as LineGradientPlugin, Rn as LinePainter, Ho as LinePlugin, Ia as LineStringLayer, jo as LitPlugin, Jo as MapboxVectorTileLayer, Ms as NativeLinePainter, Uo as NativeLinePlugin, Ts as NativePointPainter, Wl as PackUtil, Vs as PhongPainter, Bo as PhongPlugin, Ma as PointLayer, Fa as PolygonLayer, Zl as SYMBOLS_NEED_REBUILD_IN_VECTOR, Yl as SYMBOLS_NEED_REBUILD_IN_VT, xs as TextPainter, Vo as TextPlugin, Wo as TubePlugin, mt as Vector3DLayer, ht as VectorTileLayer, $e as VectorTileLayerRenderer, qo as WaterPlugin, Bs as WireframePainter, Go as WireframePlugin };
20052
20568
 
20053
- "undefined" != typeof console && console.log("@maptalks/vt v0.106.2");
20569
+ "undefined" != typeof console && console.log("@maptalks/vt v0.107.0");
20054
20570
  //# sourceMappingURL=maptalks.vt.es.js.map