@maptalks/vt 0.120.0 → 0.121.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.120.0
2
+ * @maptalks/vt v0.121.0
3
3
  * LICENSE : undefined
4
4
  * (c) 2016-2026 maptalks.org
5
5
  */
@@ -21,7 +21,7 @@
21
21
  })), t.default = e, Object.freeze(t);
22
22
  }
23
23
  var r = i(t), o = i(n);
24
- const a = "${", s = `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 b=t.stops[e];void 0===m[b[0].zoom]&&(m[b[0].zoom]={zoom:b[0].zoom,type:t.type,property:t.property,default:t.default,stops:[]}),m[b[0].zoom].stops.push([b[0].value,b[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: ${a}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: ${a}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 b(t){return M(t,"interval")}function M(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=M(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 A(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 I(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 L(t){return w(t)&&t.property}const B=new TextEncoder;new TextDecoder;const C="function"==typeof fetch&&"function"==typeof AbortController,O={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}let r=(e=e||{}).errorLog;k(r)&&(r=!0),e.method&&(e.method=e.method.toUpperCase());const i="POST"===e.method;if(C){const i=new AbortController,o=e;o.signal=i.signal,o.referrerPolicy=o.referrerPolicy||"origin",o.method=o.method||"GET";const s=new Request(t,o);return e.returnJSON&&s.headers.set("Accept","application/json"),fetch(s).then((i=>{const o=this._parseResponse(i,e.returnJSON,e.responseType);o.message?(o.url=t,n(o)):o.then((t=>{"arraybuffer"===e.responseType?n(null,{data:t,cacheControl:i.headers.get("Cache-Control"),expires:i.headers.get("Expires"),contentType:i.headers.get("Content-Type")}):n(null,t)})).catch((e=>{e.code&&e.code===DOMException.ABORT_ERR||(r&&console.error("Fetch error:",t,e),n(e))}))})).catch((e=>{e.code&&e.code===DOMException.ABORT_ERR||(r&&console.error("Fetch error:",t,e),n(e))})),i}{const r=O._getClient(n);if(r.open(e.method||"GET",t,!0),e){for(const t in e.headers)r.setRequestHeader(t,e.headers[t]);r.withCredentials="include"===e.credentials,e.responseType&&(r.responseType=e.responseType)}return r.send(i?e.body:null),r}},_parseResponse:(t,e,n)=>200!==t.status?{status:t.status,statusText:t.statusText,message:\`incorrect http request with status code(${a}t.status}): ${a}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(${a}t.status}): ${a}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=O._wrapCallback(e,t),e},getArrayBuffer(t,e,n){if(T(e)){const t=n;n=e,e=t}return e||(e={}),e.responseType="arraybuffer",O.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 X(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)N(t,n,e);else if("Polygon"===r)N(t,n[0],e);else if("MultiLineString"===r)for(const r of n)N(t,r,e);else if("MultiPolygon"===r)for(const r of n)N(t,r[0],e)}(s,o?4:3),s}function N(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 E(t,e,n,r){if(r.layer=e,"FeatureCollection"===n.type)for(let e=0;e<n.features.length;e++)z(t,n.features[e],r,e);else"Feature"===n.type?z(t,n,r):z(t,{geometry:n},r)}function z(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)D(i,a,n);else if("MultiPoint"===o)for(const t of i)D(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(X(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)z(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(X(l,o,a,e.properties,n.layer,n.hasAltitude))}function D(t,e,n){e.push(G(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=G(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 G(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)U(t,h,n,r,i,a.hasAltitude);else if("LineString"===o)R(t,h,n,r,i,!1,a.lineMetrics,a.hasAltitude);else if("MultiLineString"===o)H(t,h,n,r,i,!1,a.hasAltitude);else if("Polygon"===o)H(t,h,n,r,i,!0,a.hasAltitude);else if("MultiPolygon"===o)for(const e of t){const t=[];H(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(X(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(X(e.id,o,h,e.tags,e.layer,a.hasAltitude))}}return l.length?l:null}function U(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&&(W(e,t[a],t[a+1],t[a+2]),o&&e.push(t[a+3]))}}function R(t,e,n,r,i,o,s,a){let l=J(t);const u=0===i?K:Q;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,b,M;o&&g===d-p?(v=t[0],w=t[1]):(v=t[g+p],w=t[g+p+1]),a&&(b=t[g+3],M=o&&g===d-p?t[3]:t[g+p+3]);const P=0===i?y:x,_=0===i?v:w;let A=!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(tt(b,M,c)),s&&(l.start=f+h*c)):P>r?_<r&&(c=u(l,y,x,v,w,r),a&&l.push(tt(b,M,c)),s&&(l.start=f+h*c)):(W(l,y,x,m),a&&l.push(b)),_<n&&P>=n&&(c=u(l,y,x,v,w,n),a&&l.push(tt(b,M,c)),A=!0),_>r&&P<=r&&(c=u(l,y,x,v,w,r),a&&l.push(tt(b,M,c)),A=!0),!o&&A&&(s&&(l.end=f+h*c),e.push(l),l=J(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&&W(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])&&(W(l,l[0],l[1],l[2]),a&&l.push(l[3])),l.length&&e.push(l)}function J(t){const e=[];return e.size=t.size,e.start=t.start,e.end=t.end,e}function H(t,e,n,r,i,o,s){for(const a of t)R(a,e,n,r,i,o,!1,s)}function W(t,e,n,r){t.push(e,n,r)}function K(t,e,n,r,i,o){const s=(o-e)/(r-e);return W(t,o,n+(i-n)*s,1),s}function Q(t,e,n,r,i,o){const s=(o-n)/(i-n);return W(t,e+(r-e)*s,o,1),s}function tt(t,e,n){return t+(e-t)*n}function et(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=nt(o.geometry,e,n);else if("MultiLineString"===s||"Polygon"===s){a=[];for(const t of o.geometry)a.push(nt(t,e,n))}else if("MultiPolygon"===s){a=[];for(const t of o.geometry){const r=[];for(const i of t)r.push(nt(i,e,n));a.push(r)}}r.push(X(o.id,s,a,o.tags,o.layer,n))}return r}function nt(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 rt(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(it(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(it(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 it(t,e,n,r,i,o){return[Math.round(n*(t*r-i)),Math.round(n*(e*r-o))]}function ot(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)st(s,e,o,i);return s}function st(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)lt(s,i,t,n,!1,!1,r);else if("MultiLineString"===o||"Polygon"===o)for(let e=0;e<i.length;e++)lt(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++)lt(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 at(t,e,n){return 0===t[e+2]&&t[e+3]>0&&n}function lt(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||at(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)}O.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?O.jsonp(t,r):((e=e||{}).returnJSON=!0,O.get(t,e,r))};const ut={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 ht{constructor(t,e){const n=(e=this.options=function(t,e){for(const n in e)t[n]=e[n];return t}(Object.create(ut),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++)E(n,t[r].layer,t[r].data,e);return n}if("FeatureCollection"===t.type)for(let r=0;r<t.features.length;r++)z(n,t.features[r],e,r);else"Feature"===t.type?z(n,t,e):z(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=et(i,1,e.hasAltitude).concat(r)),o&&(r=r.concat(et(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=ct(e,n,r);let f=this.tiles[c];if(!f&&(u>1&&console.time("creation"),f=this.tiles[c]=ot(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${a}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,b=Z(t,h,n-p,n+g,0,f.minX,f.maxX,l),M=Z(t,h,n+d,n+y,0,f.minX,f.maxX,l);t=null,b&&(x=Z(b,h,r-p,r+g,1,f.minY,f.maxY,l),m=Z(b,h,r+d,r+y,1,f.minY,f.maxY,l),b=null),M&&(v=Z(M,h,r-p,r+g,1,f.minY,f.maxY,l),w=Z(M,h,r+d,r+y,1,f.minY,f.maxY,l),M=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=ct(t,e,n);if(this.tiles[l])return rt(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[ct(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]?rt(this.tiles[l],i,s):null):null}}function ct(t,e,n){return 32*((1<<t)*n+e)+t}function ft(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 pt(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 dt="undefined"!=typeof Float32Array?Float32Array:Array;function gt(t,e,n,r){return t[0]=e,t[1]=n,t[2]=r,t}function yt(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function xt(t,e,n,r,i){return t[0]=e,t[1]=n,t[2]=r,t[3]=i,t}function mt(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 vt(t,e,n){return t[0]=e,t[1]=n,t}function wt(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 dt(3),dt!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t)}(),function(){var t,e=(t=new dt(4),dt!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t)}(),function(){var t,e=(t=new dt(2),dt!=Float32Array&&(t[0]=0,t[1]=0),t)}();const bt=Math.PI/180,Mt=6378137*Math.PI/180,Pt=85.0511287798;function _t(t,e,n){if("EPSG:3857"===n)return function(t,e){const n=Pt,r=e[0],i=Math.max(Math.min(n,e[1]),-n);let o;o=0===i?0:Math.log(Math.tan((90+i)*bt/2))/bt;return t[0]=r*Mt,t[1]=o*Mt,t}(t,e);if("EPSG:4326"===n||"EPSG:4490"===n||"identity"===n)return At(t,e);if("baidu"===n)return At(t,e);throw new Error("unsupported projection:"+n)}function At(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=wt(c,f),y=wt(f,p),x=[],m=[],v=[];for(let t=e;t<n;t+=3){const e=t/3*2;vt(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||_t(x,x,"EPSG:3857"),St(m,x,c,f),St(v,x,d,c),r[e]=wt(c,m)/g,r[e+1]=wt(c,v)/y}}(h,e,n,r,i,o,a,c,f,p,!!d)}function St(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 Tt(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=kt(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=kt(t,e[n]*r,n<o-1?e[n+1]*r:t.length,r,!1);s===s.next&&(s.steiner=!0),i.push(Dt(s))}i.sort(Xt);for(let t=0;t<i.length;t++)n=Nt(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 kt(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=Kt(i/r|0,t[i],t[i+1],o);else for(let i=n-r;i>=e;i-=r)o=Kt(i/r|0,t[i],t[i+1],o);return o&&Zt(o,o.next)&&(Qt(o),o=o.next),o}function Lt(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(Qt(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=zt(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?Ot(t,r,i,o):Ct(t))e.push(l.i,t.i,u.i),Qt(t),t=u.next,a=u.next;else if((t=u)===a){s?1===s?Bt(t=Yt(Lt(t),e),e,n,r,i,o,2):2===s&&Vt(t,e,n,r,i,o):Bt(Lt(t),e,n,r,i,o,1);break}}}function Ct(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 Ot(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=zt(p,d,e,n,r),m=zt(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)&&Ut(r,n,n.next,i)&&Ht(r,i)&&Ht(i,r)&&(e.push(r.i,n.i,i.i),Qt(n),Qt(n.next),n=t=i),n=n.next}while(n!==t);return Lt(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&&Gt(s,t)){let a=Wt(s,t);return s=Lt(s,s.next),a=Lt(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 Xt(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 Nt(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);Ht(n,t)&&(e<h||e===h&&(n.x>o.x||n.x===o.x&&Et(o,n)))&&(o=n,h=e)}n=n.next}while(n!==a);return o}(t,e);if(!n)return e;const r=Wt(n,t);return Lt(r,r.next),Lt(n,n.next)}function Et(t,e){return jt(t.prev,t,e.prev)<0&&jt(e.next,t,t.next)<0}function zt(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 Dt(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 Gt(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&&Ut(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&(Ht(t,e)&&Ht(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 Ut(t,e,n,r){const i=Jt(jt(t,e,n)),o=Jt(jt(t,e,r)),s=Jt(jt(n,r,t)),a=Jt(jt(n,r,e));return i!==o&&s!==a||(!(0!==i||!Rt(t,n,e))||(!(0!==o||!Rt(t,r,e))||(!(0!==s||!Rt(n,t,r))||!(0!==a||!Rt(n,e,r)))))}function Rt(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 Jt(t){return t>0?1:t<0?-1:0}function Ht(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 Wt(t,e){const n=te(t.i,t.x,t.y),r=te(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 Kt(t,e,n,r){const i=te(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 Qt(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 te(t,e,n){return{i:t,x:e,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}const ee="__fea_idx";new Float32Array([-1e12])[0];const ne="maptalks_ombb";function re(){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:ie,ArrayPool:oe}=re();function se(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++){ae(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 ae(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||!pt(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],b=i[m],M=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=Tt(i,o,c,w,b)),P=_===x[0]||_===x[1]||_===x[2]?g:g+y):1===t&&(_===x[0]||_===x[1]||_===x[2]?P=0:5===_?(y=Tt(i,o,c,w,b),P=y):P=y);const A=P/u*(1/(100*h))/a;let I;I=1===e?M===p?1:0:"bottom"===n?M===p?f/100/l:0:M===p?0:-f/100/l,r[2*s]=A,r[2*s+1]=I,0===_&&(g+=y)}}(a,l,u,h,n,o,g,c[0],c[1],f,p,d)}function le(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 ue="undefined"!=typeof Float32Array?Float32Array:Array;function he(){var t=new ue(3);return ue!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function ce(t,e,n){var r=new ue(3);return r[0]=t,r[1]=e,r[2]=n,r}function fe(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function pe(t,e,n,r){return t[0]=e,t[1]=n,t[2]=r,t}function de(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t}function ge(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 ye(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function xe(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 me=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 ve(){var t=new ue(4);return ue!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function we(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=he()}(),function(){var t,e=(t=new ue(4),ue!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t)}();var be,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},Pe=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};he(),ce(1,0,0),ce(0,1,0),ve(),ve(),be=new ue(9),ue!=Float32Array&&(be[1]=0,be[2]=0,be[3]=0,be[5]=0,be[6]=0,be[7]=0),be[0]=1,be[4]=1,be[8]=1;\n/*!\n * Contains code from google filament\n * https://github.com/google/filament/\n * License Apache-2.0\n */\nconst _e=8,Ae=[],Ie=[],Se=[],Te=[];function Fe(t,e,n){const r=xe(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}(Ae,n[0],n[1],n[2],...r,...e);t=we(t,i),t=function(t){return t[3]<0?Me(t,t,-1):t}(t=Pe(t,t));const o=1/((1<<2*_e-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?xe(Se,n,e):xe(Se,e,n);return ye(xe(Te,n,e),s)<0&&Me(t,t,-1),t}const ke=[];const Le=[],Be=[],Ce=[],Oe=[],Ye=[],Ve=[],Xe=[];function Ne(t,e,n,r,i,o){pe(Oe,t[3*e],t[3*e+1],t[3*e+2]),pe(Ye,t[3*n],t[3*n+1],t[3*n+2]),pe(Ve,t[3*r],t[3*r+1],t[3*r+2]);const s=me(Le,Ve,Ye),a=me(Be,Oe,Ye),l=xe(Ce,s,a);ge(Xe,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]+=Xe[0],i[3*n]+=Xe[0],i[3*r]+=Xe[0],i[3*e+1]+=Xe[1],i[3*n+1]+=Xe[1],i[3*r+1]+=Xe[1],i[3*e+2]+=Xe[2],i[3*n+2]+=Xe[2],i[3*r+2]+=Xe[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 Ee(t,e,n){return t[0]=e[n],t[1]=e[n+1],t[2]=e[n+2],t}function ze(t,e,n){return t[0]=e[n],t[1]=e[n+1],t}const{StyleUtil:De,PackUtil:$e,ArrayPool:qe}=re(),Ge=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),Ge.reset();const{altitudeScale:y,altitudeProperty:x,defaultAltitude:m,heightProperty:v,minHeightProperty:P,defaultHeight:_,tangent:A,uv:I,topUVMode:T,sideUVMode:F,sideVerticalUVMode:k,top:B,side:C,textureYOrigin:O,topThickness:Y}=e,V=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:b,positionType:M,res:P,glScale:_,projectionCode:A},I,T){let F=e/t[0].extent;e===1/0&&(F=1);const k=e===1/0,L=T.get(),B=T.get(),C=T.get(),O=T.getProxy(),Y=T.get(),V=T.get(),X=T.get(),N=!!p,E=!!h,z=!!u,D=N?T.get():null;function $(t,n,r,i,o,s){let a=n;if(E){const u=Ft(O,r,3);if(0===u.length)return n;let h=O.getLength(),p=Y.currentIndex;for(let t=0;t<h;t++)Y[p++]=O[t];if(Y.currentIndex=p,n+=O.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=V.currentIndex;for(let t=0;t<h;t++)V[p++]=u[t];V.currentIndex=p,N&&It(g||0,t,n,D,Y,f,w,v,d[0],d[1],o,P,_,A,l),c>0&&!z&&(n=se(Y,O,r,V,n,D,0,c,e,N,y||0,x||0,m,d,v,b,i<0?!s:s)),X.setLength(n/3),X.fill(1,a/3,n/3)}if(z){E&&(c=0),a=n,n=se(Y,O,r,V,n,D,c,i,e,N,y||0,x||0,m,d,v,b,i<0?!s:s),X.setLength(n/3);const t=O.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,G=1/0,j=0;const Z=[-1,-1,e+1,e+1];let U=0,R=t.length;S(I)&&(U=I,R=I+1);let J=0,H=!1;const W=T.getProxy();let K,Q=!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[ne];let f=Array.isArray(c&&c[0]&&c[0][0])?c[0]:c;const{altitude:p,height:d}=ie.getFeaAltitudeAndHeight(l,n,r,i,o,a,s);d<0?(Q=!0,G=Math.min(p,G),q=Math.max(p-d,q)):(q=Math.max(p,q),G=Math.min(p-d,G));const g=Y.getLength();let y=0,x=j;W.setLength(0),O.setLength(0);const m=ie.calculateSignedArea(h[0])<0;for(let t=0,n=h.length;t<n;t++){let r=h[t];m&&(r=r.reverse()),r=le(r);const i=ie.calculateSignedArea(r)<0;if(!i&&t>0&&(y++,f=c&&c[y],j=$(x,j,W,d*F,f,k),O.setLength(0),W.setLength(0),x=j),e!==1/0&&(r=ie.clipPolygon(r,Z)),!r.length){t===n-1&&(j=$(x,j,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++]=O.getLength()/3,W.currentIndex=t}ft(O,O.getLength(),r,F,p,!1,M),t===n-1&&(j=$(x,j,W,d*F,f,k))}const v=Y.getLength()-g,w=(ee+"").trim();for(let t=0;t<v/3;t++){let t=B.currentIndex;B[t++]=void 0===l[w]?U:l[w],B.currentIndex=t,t=L.currentIndex,L[t++]=U,L.currentIndex=t,S(u)&&(t=C.currentIndex,C[t++]=u,C.currentIndex=t)}}K=l?Float32Array:ie.getUnsignedArrayType(B.getLength()?B[B.getLength()-1]:0);const tt={hasNegativeHeight:Q,maxAltitude:q===-1/0?0:q,minAltitude:G===1/0?0:G,vertices:Y,verticeTypes:X,indices:V,pickingIds:oe.createTypedArray(B,K),featureIndexes:L};if(C.getLength()){const t=H?ie.getPosArrayType(J):ie.getUnsignedArrayType(J);tt.featureIds=oe.createTypedArray(C,t)}else tt.featureIds=[];return D&&(D.setLength(Y.getLength()/3*2),tt.uvs=D),tt}(t,n,{altitudeScale:y,altitudeProperty:x,defaultAltitude:m||0,heightProperty:v,minHeightProperty:P,defaultHeight:_||0},{center:g,top:B,side:C,topThickness:10*Y||0,uv:I||A,uvSize:[i,i],uvOrigin:r,topUVMode:T,sideUVMode:F,sideVerticalUVMode:k,textureYOrigin:O,tileRatio:a,centimeterToPoint:l,verticalCentimeterToPoint:u,positionType:d,res:o,glScale:s,projectionCode:f},p,Ge),X=[],N=V.vertices.getLength()/3,E=$e.getIndexArrayType(N),z=qe.createTypedArray(V.indices,E);delete V.indices,X.push(z.buffer,V.pickingIds.buffer);const D=Math.max(Math.abs(V.maxAltitude),Math.abs(V.minAltitude)),$=$e.getPosArrayType(Math.max(512,D));V.vertices=qe.createTypedArray(V.vertices,$);const q=A?Ge.getProxy():new Float32Array(3*N);q.setLength&&q.setLength(3*N);const G=function(t,e,n){const r=n||[];r.setLength&&r.setLength(t.length);const i=ke;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?Ne(t,3*n,3*n+1,3*n+2,r,i):Ne(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}(V.vertices,z,q);let j=!0;const Z=G.getLength?G.getLength():G.length;for(let t=0;t<Z;t++){G[t]=-G[t];const e=G[t]%1;1-Math.abs(e)>1e-6?j=!1:0!==e&&(G[t]=Math.round(G[t]))}if(V.normals=G,A){let t=Ge.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){Ee(u,t,3*e),Ee(h,t,3*r),Ee(c,t,3*i),ze(f,n,2*e),ze(p,n,2*r),ze(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],b=p[0]-f[0],M=d[0]-f[0],P=p[1]-f[1],_=d[1]-f[1],A=1/(b*_-M*P);pe(g,(_*o-P*s)*A,(_*x-P*m)*A,(_*v-P*w)*A),pe(y,(b*s-M*o)*A,(b*m-M*x)*A,(b*w-M*v)*A),de(a[e],a[e],g),de(a[r],a[r],g),de(a[i],a[i],g),de(l[e],l[e],y),de(l[r],l[r],y),de(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=[],b=[];let M,P,_;function A(t){Ee(w,e,3*t),fe(b,w),P=a[t],fe(m,P),me(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,ye(w,P))),ge(m,m),xe(v,b,P),_=ye(v,l[t]),M=_<0?-1:1,s[4*t]=m[0],s[4*t+1]=m[1],s[4*t+2]=m[2],s[4*t+3]=M}for(let t=0,e=r.length;t<e;t+=3)A(r[t+0]),A(r[t+1]),A(r[t+2]);return s}(V.vertices,V.normals,V.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;gt(o,t[n]||0,t[n+1]||0,t[n+2]||0),xt(i,e[a]||0,e[a+1]||0,e[a+2]||0,e[a+3]||0),Fe(s,o,i),yt(r.subarray(a,a+4),s)}return r}(V.normals,t),V.tangents=t,X.push(t.buffer),delete V.normals}if(V.normals&&(j&&(V.normals=qe.createTypedArray(V.normals,Int8Array)),X.push(V.normals.buffer)),V.uvs){const t=V.uvs;V.uvs=qe.createTypedArray(t,Float32Array),X.push(V.uvs.buffer)}const U=function(t,e,n,r){const i={},o={},s=r.getLength();if(L(e.polygonFill)){let a=b(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=b(u),u=a(n,s)),delete s.$layer,delete s.$type,De.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(L(e.polygonOpacity)){let a=M(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=b(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,V.featureIndexes),R=function(t,e,n,r,i){const o=[[],[]],s=L(r.topPolygonFill),a=L(r.bottomPolygonFill),l=[255,255,255,255],u=e.getLength();if(s||a){let h=s&&b(r.topPolygonFill),c=a&&b(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=b(v),v=m(i,x)),delete x.$layer,delete x.$type,De.normalizeColor(Ze,v),mt(Ze,Ze,l);let M=Ue(o,Ze);M<0&&(M=o.length,o.push(yt([],Ze))),t[r]=M,u?(f=e[r],d=M):(p=e[r],g=M)}}return o.slice(2)}(V.verticeTypes,V.featureIndexes,t,h,c),J={data:{data:{aVertexColorType:R.length<=252?qe.createTypedArray(V.verticeTypes,Uint8Array):qe.createTypedArray(V.verticeTypes,Uint16Array),aPosition:V.vertices,aNormal:V.normals,aTexCoord0:V.uvs,aTangent:V.tangents,aPickingId:V.pickingIds},indices:z,properties:{maxAltitude:V.maxAltitude/100,minAltitude:V.minAltitude/100,hasNegativeHeight:V.hasNegativeHeight},dynamicAttributes:U.dynamicAttributes,vertexColors:R},buffers:X};return V.featureIds.length?(J.data.featureIds=V.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 Ue(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:Re,StyleUtil:Je,FilterUtil:He}=re();function We(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=He.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),pt(g,u,h,e)||(x.push(u,h),c&&x.push(u+l,h+l),Ke(g,u,e)||x.push(u,u+l));return n+i}let v=0,b=-1/0,M=1/0;const P=(ee+"").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,Je.normalizeColor(_,t)}else gt(_,255,255,255);const p=v/3*4,{altitude:w,height:A}=Re.getFeaAltitudeAndHeight(h,i,o,s,a,u,l);A<0?(M=Math.min(w,M),b=Math.max(w-A,b)):(M=Math.min(w-A,M),b=Math.max(w,b));let I=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=ft(g,I,e,f,w),v=m(I,v,A*f),I=v}const S=I/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 A=x.reduce(((t,e)=>Math.max(t,e)),0),I=new(Re.getIndexArrayType(A))(x),T=Math.max(Math.abs(b,Math.abs(M)));return{aPosition:new(Re.getPosArrayType(Math.max(512,T)))(g),indices:I,aPickingId:new Float32Array(d),aColor:y,maxAltitude:b===-1/0?0:b/100,minAltitude:M===1/0?0:M/100}}function Ke(t,e,n){const r=t[3*e],i=t[3*e+1];return r<0||r>n||i<0||i>n}function Qe(t,e,n,r){const i=We(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 tn=["Unknown","Point","LineString","Polygon","MultiPoint","MultiLineString","MultiPolygon","GeometryCollection"];function en(t){if(!t)return"true";const e=t[0];if(t.length<=1)return"any"===e?"false":"true";return\`(${a}"=="===e?rn(t[1],t[2],"===",!1):"!="===e?rn(t[1],t[2],"!==",!1):"<"===e||">"===e||"<="===e||">="===e?rn(t[1],t[2],e,!0):"any"===e?sn(t.slice(1),"||"):"all"===e?sn(t.slice(1),"&&"):"none"===e?un(sn(t.slice(1),"||")):"in"===e?an(t[1],t.slice(2)):"!in"===e?un(an(t[1],t.slice(2))):"has"===e?ln(t[1]):"!has"===e?un(ln(t[1])):"contains"===e?function(t,e,n){const r=nn(t);return void 0!==n?\`(${a}r} + '').indexOf("${a}e}") === ${a}n}\`:\`(${a}r} + '').indexOf("${a}e}") >= 0\`}(t[1],t[2],t[3]):"true"})\`}function nn(t){return"$"===t[0]?"f."+t.substring(1):"p["+JSON.stringify(t)+"]"}function rn(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=nn(i);return"length"!==o?(console.error(\`not support ${a}o} op\`),"false"):(s=\`((${a}s}+='').length)\`,on(s,i,e,n,r))}(t,e,n,r);var i;return on(nn(t),t,e,n,r)}function on(t,e,n,r,i){const o="$type"===e?tn.indexOf(n):JSON.stringify(n);return(i?\`typeof ${a}t}=== typeof ${a}o}&&\`:"")+t+r+o}function sn(t,e){return t.map(en).join(e)}function an(t,e){"$type"===t&&(e=e.map((t=>tn.indexOf(t))));const n=JSON.stringify(e.sort(hn)),r=nn(t);return e.length<=200?\`${a}n}.indexOf(${a}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; }(${a}r}, ${a}n},0,${a}e.length-1})\`}function ln(t){return"$id"===t?'"id" in f':\`${a}JSON.stringify(t)} in p\`}function un(t){return\`!(${a}t})\`}function hn(t,e){return t<e?-1:t>e?1:0}let cn=!1;try{const t=new OffscreenCanvas(1,1);t.getContext("2d").fillText("hello",0,0),cn=!0}catch(t){cn=!1}var fn=cn;const{VectorPack:pn,PolygonPack:dn,NativeLinePack:gn,LinePack:yn,PointPack:xn,NativePointPack:mn,LineExtrusionPack:vn,CirclePack:wn,RoundTubePack:bn,SquareTubePack:Mn,FilterUtil:Pn,PackUtil:_n,StyleUtil:An,TextUtil:In,DEFAULT_TEX_WIDTH:Sn,GlyphRequestor:Tn}=re(),Fn="__original_properties",kn="__fn-type_properties";class Ln{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=A(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=>{if(n.canceled)return void e(null,{canceled:!0});n.data.styleCounter=t.styleCounter,o&&A(n.data,o);const r=n.data.features;if(r){const t={};for(const e in r){const n=r[e];t[n.id]=n}const e=function(t){try{const e=JSON.stringify(t);return B.encode(e)}catch(t){console.error("encode JSON to Uint8Array error:",t)}}(t);e&&(n.data.featuresTypeArray=e,n.buffers=n.buffer||[],n.buffers.push(e.buffer));const i="id"===this.options.features;for(const t in r){const n=r[t];e&&delete n.geometry,i&&(r[t]=n.id)}}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={},this._cache&&this._cache.reset(),delete this._cache,this.requests={}}fetchIconGlyphs(t,e,n){if(this.options.workerGlyph&&fn){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 Tn),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++)Nn(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,b=-1;const M=[];let P=!1;for(let t=0;t<s.length;t++){b++;const r=s[t];r.type!==w&&(b=0,w=r.type);const a=0===r.type?p:d;jn(r.symbol,M,t),P=P||M[t]&&M[t].size>0;const{tileFeatures:l,tileFeaIndexes:u}=this._filterFeatures(c,r.type,r.filter,e,m,t);if(!l.length){a[b]=null;continue}const y=u[u.length-1],_=_n.getIndexArrayType(y);a[b]={styledFeatures:new _(u)},g.push({idx:t,typeIdx:b}),x.push(a[b].styledFeatures.buffer);const I=A({},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){I.debugIndex=t[e].index;break}}}let S=this._createTileGeometry(l,r,I);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=On(t.properties)),t&&(y.features||P&&m[r])){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=A({},t.originalFeature);delete e[Fn],n.customProps=A({},e),t=n}const i=A({},t);if(P&&m[r]&&(!y.features||"transient"===y.features)){const i=m[r];for(let r=0;r<i.length;r++){const i=M[r];i&&i.forEach((r=>{const i=e?e.properties:t.properties;i[kn]||(i[kn]=new Set),i[kn].add(r),n=!0}))}}o[r]=i}if(n)for(const t in o){const e=o[t],n=e.properties[kn];if(n){delete e.properties[kn],"transient"===y.features&&(e.fnTypeProps=A({},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=A({},i,{EXTENT:a,zoom:h,debugIndex:y,features:this.options.features,isWebGPU:this.options.isWebGPU,isWebGL1:this.options.isWebGL1});if("3d-extrusion"===g){Yn(o)&&(i.uv=1);const t=this.options.projectionCode,e=o.material&&o.material.textureWidth||Sn;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(Qe(r,a,o,i))]);if("point"===g){x=A(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=>{x.defaultMarkerVerticalAlignment="middle";const e=pn.genFnTypes(t);let n=r;return xn.needMerge(t,e,h)&&(n=xn.mergeLineFeatures(r,t,e,h)),new xn(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,mn,d)}if("line"===g)return x=A(x,{requestor:this.fetchIconGlyphs.bind(this),tileRatio:d}),Vn(r,o,x,yn,1,!0);if("native-line"===g)return Vn(r,o,x,gn,1,!0);if("fill"===g)return x=A(x,{requestor:this.fetchIconGlyphs.bind(this)}),Vn(r,o,x,dn);if("line-extrusion"===g){delete o.lineGradientProperty,o.lineJoin="miter",o.lineCap="butt";const t=Yn(o);if(t&&(i.uv=1),x=A(x,{tileSize:s,zScale:u,glScale:l}),o.mergeOnProperty){const t=pn.genFnTypes(o);r=yn.mergeLineFeatures(r,o,t,x.zoom)}if(t){const t=[];if(!1!==i.top){const e=A({},x);e.side=!1,t.push(new vn(r,o,e))}return!1!==i.side&&(x.side=!0,x.top=!1,t.push(new vn(r,o,x))),Promise.all(t.map((t=>t.load())))}return Promise.all([new vn(r,o,x).load()])}if("circle"===g)return Vn(r,o,x,wn);if("round-tube"===g||"square-tube"===g){const t="round-tube"===g?bn:Mn;return x=A(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=(ee+"").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=Pn.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=Pn.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 ${a}en(i)}\`)),renderPlugin:Bn(a),symbol:Cn(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 Cn(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 On(t){if(Array.isArray(t)||!F(t))return{};const e={};for(const n in t){const r=t[n];I(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]=Xn(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=pn.genFnTypes(a[e]);h=yn.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 Xn(t){if(!t)return 0;for(const e in t)if(L(t[e]))return 1;return 0}function Nn(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=Pn.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 En={get:(t,e)=>e in t?t[e]:t.originalFeature[e],has:(t,e)=>e in t||e in t.originalFeature},zn={get:function(t,e){return e in t?t[e]:t[Fn][e]},has:(t,e)=>e in t||e in t[Fn]},Dn={};function $n(t){const e={};e.originalFeature=t;const n=new Proxy(e,En);return n.properties=new Proxy({},zn),n.properties[Fn]=t.properties||Dn,n}function qn(t,e,n){t[e]||(t[e]=new Set),t[e].add(n)}const Gn=[];function jn(t,e,n){if(!t)return Gn;for(const r in t){if(!t[r]||!An.checkIfZoomFnTypeSymbol(r))continue;if(L(t[r]))qn(e,n,t[r].property);else{if("lineGradientProperty"===r){qn(e,n,t[r]);continue}if("textName"===r)if(I(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(Pn.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++)L(i[t][1])&&qn(e,t,i[t][1].property)}return e[n]}function Zn(t,e){Un(t.geometry,e)}function Un(t,e){if(t)switch(t.type){case"Point":Rn(t.coordinates,e);break;case"MultiPoint":case"LineString":Jn(t.coordinates,e);break;case"MultiLineString":!function(t,e){for(let n=0,r=t.length;n<r;n++)Jn(t[n],e)}(t.coordinates,e);break;case"Polygon":Hn(t.coordinates,e);break;case"MultiPolygon":!function(t,e){for(let n=0,r=t.length;n<r;n++)Hn(t[n],e)}(t.coordinates,e);break;case"GeometryCollection":const n=t.geometries.length;for(let r=0;r<n;r++)Un(t.geometries[r],e)}}function Rn(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 Jn(t,e){for(let n=0,r=t.length;n<r;n++)Rn(t[n],e)}function Hn(t,e){t.length&&Jn(t[0],e)}function Wn(t,e,n,r,i){Kn(t,e,n||0,r||t.length-1,i||tr)}function Kn(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);Kn(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(Qn(t,n,e),i(t[r],h)>0&&Qn(t,n,r);c<f;){for(Qn(t,c,f),c++,f--;i(t[c],h)<0;)c++;for(;i(t[f],h)>0;)f--}0===i(t[n],h)?Qn(t,n,f):Qn(t,++f,r),f<=e&&(n=f+1),e<=f&&(r=f-1)}}function Qn(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function tr(t,e){return t<e?-1:t>e?1:0}class er{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(!fr(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;fr(t,a)&&(e.leaf?n.push(s):cr(t,a)?this._all(s,n):i.push(s))}e=i.pop()}return n}collides(t){let e=this.data;if(!fr(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(fr(t,o)){if(e.leaf||cr(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=pr([]),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=nr(t,n.children,e);if(-1!==r)return n.children.splice(r,1),i.push(n),this._condense(i),this}l||n.leaf||!cr(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=pr(t.slice(e,n+1)),rr(o,this.toBBox),o;r||(r=Math.ceil(Math.log(i)/Math.log(s)),s=Math.ceil(i/Math.pow(s,r-1))),o=pr([]),o.leaf=!1,o.height=r;const a=Math.ceil(i/s),l=a*Math.ceil(Math.sqrt(s));dr(t,e,n,l,this.compareMinX);for(let i=e;i<=n;i+=l){const e=Math.min(i+l-1,n);dr(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 rr(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=lr(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),or(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=pr(n.children.splice(o,n.children.length-o));s.height=n.height,s.leaf=n.leaf,rr(n,this.toBBox),rr(s,this.toBBox),e?t[e-1].children.push(s):this._splitRoot(n,s)}_splitRoot(t,e){this.data=pr([t,e]),this.data.height=t.height+1,this.data.leaf=!1,rr(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=ir(t,0,s,this.toBBox),a=ir(t,s,n,this.toBBox),l=hr(e,a),u=lr(e)+lr(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:sr,i=t.leaf?this.compareMinY:ar;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=ir(t,0,e,i),s=ir(t,n-e,n,i);let a=ur(o)+ur(s);for(let r=e;r<n-e;r++){const e=t.children[r];or(o,t.leaf?i(e):e),a+=ur(o)}for(let r=n-e-1;r>=e;r--){const e=t.children[r];or(s,t.leaf?i(e):e),a+=ur(s)}return a}_adjustParentBBoxes(t,e,n){for(let r=n;r>=0;r--)or(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():rr(t[n],this.toBBox)}}function nr(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 rr(t,e){ir(t,0,t.children.length,e,t)}function ir(t,e,n,r,i){i||(i=pr(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];or(i,t.leaf?r(e):e)}return i}function or(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 sr(t,e){return t.minX-e.minX}function ar(t,e){return t.minY-e.minY}function lr(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function ur(t){return t.maxX-t.minX+(t.maxY-t.minY)}function hr(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 cr(t,e){return t.minX<=e.minX&&t.minY<=e.minY&&e.maxX<=t.maxX&&e.maxY<=t.maxY}function fr(t,e){return e.minX<=t.maxX&&e.minY<=t.maxY&&e.maxX>=t.minX&&e.maxY>=t.minY}function pr(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function dr(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;Wn(t,s,e,n,i),o.push(e,s,s,n)}}class gr{constructor(t=[],e=yr){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 yr(t,e){return t<e?-1:t>e?1:0}function xr(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var mr={exports:{}},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)/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},wr=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};mr.exports=function(t,e,n,r){return e.length>0&&Array.isArray(e[0])?wr(t,e,n,r):vr(t,e,n,r)};var br=mr.exports.nested=wr;mr.exports.flat=vr;const Mr=11102230246251565e-32,Pr=134217729,_r=(3+8*Mr)*Mr;function Ar(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 Sr=33306690738754716e-32,Tr=22204460492503146e-32,Fr=11093356479670487e-47,kr=Ir(4),Lr=Ir(8),Br=Ir(12),Cr=Ir(16),Or=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)>=Sr*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,b,M,P,_;const A=t-i,I=n-i,S=e-o,T=r-o;w=A*T,f=Pr*A,p=f-(f-A),d=A-p,f=Pr*T,g=f-(f-T),y=T-g,b=d*y-(w-p*g-d*g-p*y),M=S*I,f=Pr*S,p=f-(f-S),d=S-p,f=Pr*I,g=f-(f-I),y=I-g,P=d*y-(M-p*g-d*g-p*y),x=b-P,c=b-x,kr[0]=b-(x+c)+(c-P),m=w+x,c=m-w,v=w-(m-c)+(x-c),x=v-M,c=v-x,kr[1]=v-(x+c)+(c-M),_=m+x,c=_-m,kr[2]=m-(_-c)+(x-c),kr[3]=_;let F=function(t,e){let n=e[0];for(let r=1;r<t;r++)n+=e[r];return n}(4,kr),k=Tr*s;if(F>=k||-F>=k)return F;if(c=t-A,a=t-(A+c)+(c-i),c=n-I,u=n-(I+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=Fr*s+_r*Math.abs(F),F+=A*h+T*a-(S*u+I*l),F>=k||-F>=k)return F;w=a*T,f=Pr*a,p=f-(f-a),d=a-p,f=Pr*T,g=f-(f-T),y=T-g,b=d*y-(w-p*g-d*g-p*y),M=l*I,f=Pr*l,p=f-(f-l),d=l-p,f=Pr*I,g=f-(f-I),y=I-g,P=d*y-(M-p*g-d*g-p*y),x=b-P,c=b-x,Or[0]=b-(x+c)+(c-P),m=w+x,c=m-w,v=w-(m-c)+(x-c),x=v-M,c=v-x,Or[1]=v-(x+c)+(c-M),_=m+x,c=_-m,Or[2]=m-(_-c)+(x-c),Or[3]=_;const L=Ar(4,kr,4,Or,Lr);w=A*h,f=Pr*A,p=f-(f-A),d=A-p,f=Pr*h,g=f-(f-h),y=h-g,b=d*y-(w-p*g-d*g-p*y),M=S*u,f=Pr*S,p=f-(f-S),d=S-p,f=Pr*u,g=f-(f-u),y=u-g,P=d*y-(M-p*g-d*g-p*y),x=b-P,c=b-x,Or[0]=b-(x+c)+(c-P),m=w+x,c=m-w,v=w-(m-c)+(x-c),x=v-M,c=v-x,Or[1]=v-(x+c)+(c-M),_=m+x,c=_-m,Or[2]=m-(_-c)+(x-c),Or[3]=_;const B=Ar(L,Lr,4,Or,Br);w=a*h,f=Pr*a,p=f-(f-a),d=a-p,f=Pr*h,g=f-(f-h),y=h-g,b=d*y-(w-p*g-d*g-p*y),M=l*u,f=Pr*l,p=f-(f-l),d=l-p,f=Pr*u,g=f-(f-u),y=u-g,P=d*y-(M-p*g-d*g-p*y),x=b-P,c=b-x,Or[0]=b-(x+c)+(c-P),m=w+x,c=m-w,v=w-(m-c)+(x-c),x=v-M,c=v-x,Or[1]=v-(x+c)+(c-M),_=m+x,c=_-m,Or[2]=m-(_-c)+(x-c),Or[3]=_;const C=Ar(B,Br,4,Or,Cr);return Cr[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++)br(t[o],a)||l.push(t[o]);return function(t){t.sort(Rr);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 er(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=Gr(l,o),s.push(o)}var u=new er(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=Xr(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(Gr(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 Xr(t,e,n,r,i,o,s){for(var a=new gr([],Nr),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):Er(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&&Dr(n,p,s)&&Dr(r,p,s))return p}(l=a.pop())&&(l=l.node)}return null}function Nr(t,e){return t.dist-e.dist}function Er(t,e,n){if(zr(t,n)||zr(e,n))return 0;var r=Ur(t[0],t[1],e[0],e[1],n.minX,n.minY,n.maxX,n.minY);if(0===r)return 0;var i=Ur(t[0],t[1],e[0],e[1],n.minX,n.minY,n.minX,n.maxY);if(0===i)return 0;var o=Ur(t[0],t[1],e[0],e[1],n.maxX,n.minY,n.maxX,n.maxY);if(0===o)return 0;var s=Ur(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 zr(t,e){return t[0]>=e.minX&&t[0]<=e.maxX&&t[1]>=e.minY&&t[1]<=e.maxY}function Dr(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 Gr(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 Ur(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,b=f*y+p*x,M=d*y+g*x,P=m*w-v*v,_=P,A=P;0===P?(u=0,_=1,c=M,A=w):(c=m*M-v*b,(u=v*M-w*b)<0?(u=0,c=M,A=w):u>_&&(u=_,c=M+v,A=w)),c<0?(c=0,-b<0?u=0:-b>m?u=_:(u=-b,_=m)):c>A&&(c=A,-b+v<0?u=0:-b+v>m?u=_:(u=-b+v,_=m));var I=(1-(h=0===c?0:c/A))*i+h*s-((1-(l=0===u?0:u/_))*t+l*n),S=(1-h)*o+h*a-((1-l)*e+l*r);return I*I+S*S}function Rr(t,e){return t[0]===e[0]?t[1]-e[1]:t[0]-e[0]}const{PackUtil:Jr}=re();class Hr{constructor(t,e){this.x=t,this.y=e}clone(){return new Hr(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 Hr(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 Hr(this.y,-this.x)}}function Wr(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 Hr(t.x+a*e.x,t.y+a*e.y)}const Kr=[],Qr=[];function ti(t){if(S(t[0]&&t[0].x)){const e=[];let n=0;for(let r=0;r<t.length;r++)Qr[n]?(Qr[n][0]=t[r].x,Qr[n][1]=t[r].y):Qr[n]=[t[r].x,t[r].y],e.push(Qr[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]||(_t(i,e[t],"EPSG:3857"),Kr[s]?(Kr[s].x=i[0],Kr[s].y=i[1]):Kr[s]=new Hr(i[0],i[1]),o.push(Kr[s]),s++);Jr.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=Wr(t,r,s,a),c=Wr(i,o,s,a),f=Wr(l,u,t,r),p=Wr(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 Hr(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),h=new Hr(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 Hr(0,-1),p=new Hr(0,1),d=new Hr(-1,0),g=new Hr(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 ei=[];function ni(t,e){const n=Array.isArray(t&&t[0]&&t[0][0]);for(let r=0;r<t.length;r++)n?t[r]=ni(t[r]):(_t(ei,t[r],e),t[r][0]=ei[0],t[r][1]=ei[1]);return t}const{PackUtil:ri}=re();class ii extends Ln{constructor(t,e,n,r,i,o){super(t,e,n,r,i),(e=e||{}).extent||(e.extent=8192),this.setData(e.data,o)}clearData(){delete this.index}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")),I(t)&&"{"!=t.substring(0,1)||t.url){const r=t.url?t.url:t;O.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:new Map});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;this._genOMBB(r);let i=r;this._generate(i,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=ti(t,t.length);n.properties=n.properties||{},n.properties[ne]=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=ti(r,r.length);n.properties=n.properties||{},n.properties[ne]=n.properties[ne]||[],n.properties[ne][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:Un(t,e)}return e}({type:"FeatureCollection",features:t}):null;this.index=function(t,e){return new ht(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=new Map;let r=0;const i=this.options.featureIdProperty;return t&&(t.length,t.forEach(((t,o)=>{!function(t,o,s){if(!t)return;if("Feature"===t.type&&!t.geometry)return;if(S(t.id)||(t.id=r++),i){let e=i;F(i)&&(e=i[t.layer||"0"]),t.id=t.properties[e]}const a=A({},t);t.geometry?(a.geometry=A({},t.geometry),a.geometry.coordinates=null):t.coordinates&&(a.coordinates=null),n.set(t.id,a),e.push(t)}(t)}))),{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||(ri.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}}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 bi(t,e){for(var n=0;n<t.length;n++)e.writeSFixed32(t[n])}function Mi(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 Ai(t,e,n){t[n]=e,t[n+1]=e>>>8,t[n+2]=e>>>16,t[n+3]=e>>>24}function Ii(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=Ii(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)+Ii(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),Ai(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),Ai(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),Ai(this.buf,-1&t,this.pos),Ai(this.buf,Math.floor(t*hi),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),Ai(this.buf,-1&t,this.pos),Ai(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,bi,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,Mi,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=xr(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,Li=Bi;function Bi(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 Oi(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}Bi.types=["Unknown","Point","LineString","Polygon"],Bi.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},Bi.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]},Bi.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=Bi.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=Oi(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 Yi=Li,Vi=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 Yi(this._pbf,e,this.extent,this._keys,this._values)};var Ei=Vi,zi=function(t,e){this.layers=t.readFields(Di,{},e)};function Di(t,e,n){if(3===t){var r=new Ei(n,n.readVarint()+n.pos);r.length&&(e[r.name]=r)}}var $i=zi;const qi=2,Gi=new TextDecoder("utf-8");class ji extends Ln{constructor(t,e,n,r,i,o){super(t,e,n,r,i),e=e||{},o()}clearData(){this._abortRequests()}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;if(a)return setTimeout((()=>{this._readTile(n,i,o,null,a,e)}),1);r.referrer=t.referrer,r.errorLog=t.loadTileErrorLog;const{loadTileCachMaxSize:l,loadTileCacheLog:u}=t;return O.getArrayBuffer(n,r,((r,s)=>{if(!this._cache)return;let a,h=!1;const c=()=>{this._readTile(n,i,o,r,a,e)};if(r)r.loading||this._cache.add(n,{err:r,data:s&&s.data,cacheIndex:t.workerCacheIndex});else if(s&&s.data){h=!0,a=s.data;const e=function(t){if(!t)return!1;if(!(t instanceof ArrayBuffer))return!1;try{const e=new Uint8Array(t),n=e[0],r=e[1];return 31===n&&139===r}catch(t){console.error("arraybufferIsGZip read buffer error:",t)}return!1}(a),r=()=>{let e=!0;if(a&&("number"==typeof(i=l)&&!isNaN(i))&&l>0){const t=(r=a)&&r instanceof ArrayBuffer?r.byteLength/1048576:0;t>l&&(e=!1,u&&console.warn(\`url:${a}n},loadTileCachMaxSize exceeded: ${a}t} > ${a}l},the tile will not be cached.\`))}var r,i;e&&a&&this._cache.add(n,{err:null,data:a,cacheIndex:t.workerCacheIndex}),c()};e?function(t,e){try{const n=new DecompressionStream("gzip"),r=new Blob([t]).stream().pipeThrough(n);new Response(r).arrayBuffer().then((t=>{e(t)})).catch((t=>{console.error("decompressGzipWithBlob:",t),e()}))}catch(t){console.error("decompressGzipWithBlob:",t),e()}}(a,(t=>{t&&(a=t),r()})):r()}h||c()}))}_readTile(t,e,n,r,i,o){if(r)return void o(r);let s;try{s=new $i(new Si(i))}catch(r){const e=Gi.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[ne];l&&(I(l)&&(l=JSON.parse(l)),r.properties[ne]=ni(l,"EPSG:3857"));const h=e&&r.properties[e];if(h){const t=Zi(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(),this._abortRequests()}_abortRequests(){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 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}=re();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 ii(n,a,l,Hi,{},i):new ji(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)}clearData({mapId:t,layerId:e},n){const r=this._getLayerById(t,e);r&&(r.clearData(n),this._resetCache())}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?\`${a}t}-${a}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\`${a}t}-${a}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,i=(n.params||{}).loadTileErrorLog,o=(n.params||{}).loadTileErrorLogIgnoreCodes||[];this.dispatcher[r]({actorId:t.actorId,mapId:n.mapId,layerId:n.layerId,params:n.params},((t,n,s)=>{if(i&&t&&!t.loading){const e=t.status;S(e)&&-1===o.indexOf(e)&&console.error(r,t)}e(t,n,s)}))}}}`;
24
+ const a = "${", s = `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 b=t.stops[e];void 0===m[b[0].zoom]&&(m[b[0].zoom]={zoom:b[0].zoom,type:t.type,property:t.property,default:t.default,stops:[]}),m[b[0].zoom].stops.push([b[0].value,b[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: ${a}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: ${a}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 b(t){return M(t,"interval")}function M(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=M(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 A(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 I(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 L(t){return w(t)&&t.property}const B=new TextEncoder;new TextDecoder;const C="function"==typeof fetch&&"function"==typeof AbortController,O={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}let r=(e=e||{}).errorLog;k(r)&&(r=!0),e.method&&(e.method=e.method.toUpperCase());const i="POST"===e.method;if(C){const i=new AbortController,o=e;o.signal=i.signal,o.referrerPolicy=o.referrerPolicy||"origin",o.method=o.method||"GET";const s=new Request(t,o);return e.returnJSON&&s.headers.set("Accept","application/json"),fetch(s).then((i=>{const o=this._parseResponse(i,e.returnJSON,e.responseType);o.message?(o.url=t,n(o)):o.then((t=>{"arraybuffer"===e.responseType?n(null,{data:t,cacheControl:i.headers.get("Cache-Control"),expires:i.headers.get("Expires"),contentType:i.headers.get("Content-Type")}):n(null,t)})).catch((e=>{e.code&&e.code===DOMException.ABORT_ERR||(r&&console.error("Fetch error:",t,e),n(e))}))})).catch((e=>{e.code&&e.code===DOMException.ABORT_ERR||(r&&console.error("Fetch error:",t,e),n(e))})),i}{const r=O._getClient(n);if(r.open(e.method||"GET",t,!0),e){for(const t in e.headers)r.setRequestHeader(t,e.headers[t]);r.withCredentials="include"===e.credentials,e.responseType&&(r.responseType=e.responseType)}return r.send(i?e.body:null),r}},_parseResponse:(t,e,n)=>200!==t.status?{status:t.status,statusText:t.statusText,message:\`incorrect http request with status code(${a}t.status}): ${a}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(${a}t.status}): ${a}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=O._wrapCallback(e,t),e},getArrayBuffer(t,e,n){if(T(e)){const t=n;n=e,e=t}return e||(e={}),e.responseType="arraybuffer",O.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 X(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)N(t,n,e);else if("Polygon"===r)N(t,n[0],e);else if("MultiLineString"===r)for(const r of n)N(t,r,e);else if("MultiPolygon"===r)for(const r of n)N(t,r[0],e)}(s,o?4:3),s}function N(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 E(t,e,n,r){if(r.layer=e,"FeatureCollection"===n.type)for(let e=0;e<n.features.length;e++)z(t,n.features[e],r,e);else"Feature"===n.type?z(t,n,r):z(t,{geometry:n},r)}function z(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)D(i,a,n);else if("MultiPoint"===o)for(const t of i)D(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(X(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)z(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(X(l,o,a,e.properties,n.layer,n.hasAltitude))}function D(t,e,n){e.push(G(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=G(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 G(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 U(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)Z(t,h,n,r,i,a.hasAltitude);else if("LineString"===o)R(t,h,n,r,i,!1,a.lineMetrics,a.hasAltitude);else if("MultiLineString"===o)H(t,h,n,r,i,!1,a.hasAltitude);else if("Polygon"===o)H(t,h,n,r,i,!0,a.hasAltitude);else if("MultiPolygon"===o)for(const e of t){const t=[];H(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(X(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(X(e.id,o,h,e.tags,e.layer,a.hasAltitude))}}return l.length?l:null}function Z(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&&(W(e,t[a],t[a+1],t[a+2]),o&&e.push(t[a+3]))}}function R(t,e,n,r,i,o,s,a){let l=J(t);const u=0===i?K:Q;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,b,M;o&&g===d-p?(v=t[0],w=t[1]):(v=t[g+p],w=t[g+p+1]),a&&(b=t[g+3],M=o&&g===d-p?t[3]:t[g+p+3]);const P=0===i?y:x,_=0===i?v:w;let A=!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(tt(b,M,c)),s&&(l.start=f+h*c)):P>r?_<r&&(c=u(l,y,x,v,w,r),a&&l.push(tt(b,M,c)),s&&(l.start=f+h*c)):(W(l,y,x,m),a&&l.push(b)),_<n&&P>=n&&(c=u(l,y,x,v,w,n),a&&l.push(tt(b,M,c)),A=!0),_>r&&P<=r&&(c=u(l,y,x,v,w,r),a&&l.push(tt(b,M,c)),A=!0),!o&&A&&(s&&(l.end=f+h*c),e.push(l),l=J(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&&W(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])&&(W(l,l[0],l[1],l[2]),a&&l.push(l[3])),l.length&&e.push(l)}function J(t){const e=[];return e.size=t.size,e.start=t.start,e.end=t.end,e}function H(t,e,n,r,i,o,s){for(const a of t)R(a,e,n,r,i,o,!1,s)}function W(t,e,n,r){t.push(e,n,r)}function K(t,e,n,r,i,o){const s=(o-e)/(r-e);return W(t,o,n+(i-n)*s,1),s}function Q(t,e,n,r,i,o){const s=(o-n)/(i-n);return W(t,e+(r-e)*s,o,1),s}function tt(t,e,n){return t+(e-t)*n}function et(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=nt(o.geometry,e,n);else if("MultiLineString"===s||"Polygon"===s){a=[];for(const t of o.geometry)a.push(nt(t,e,n))}else if("MultiPolygon"===s){a=[];for(const t of o.geometry){const r=[];for(const i of t)r.push(nt(i,e,n));a.push(r)}}r.push(X(o.id,s,a,o.tags,o.layer,n))}return r}function nt(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 rt(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(it(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(it(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 it(t,e,n,r,i,o){return[Math.round(n*(t*r-i)),Math.round(n*(e*r-o))]}function ot(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)st(s,e,o,i);return s}function st(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)lt(s,i,t,n,!1,!1,r);else if("MultiLineString"===o||"Polygon"===o)for(let e=0;e<i.length;e++)lt(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++)lt(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 at(t,e,n){return 0===t[e+2]&&t[e+3]>0&&n}function lt(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||at(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)}O.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?O.jsonp(t,r):((e=e||{}).returnJSON=!0,O.get(t,e,r))};const ut={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 ht{constructor(t,e){const n=(e=this.options=function(t,e){for(const n in e)t[n]=e[n];return t}(Object.create(ut),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++)E(n,t[r].layer,t[r].data,e);return n}if("FeatureCollection"===t.type)for(let r=0;r<t.features.length;r++)z(n,t.features[r],e,r);else"Feature"===t.type?z(n,t,e):z(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=U(t,1,-1-n,n,0,-1,2,e),o=U(t,1,1-n,2+n,0,-1,2,e);return(i||o)&&(r=U(t,1,-n,1+n,0,-1,2,e)||[],i&&(r=et(i,1,e.hasAltitude).concat(r)),o&&(r=r.concat(et(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=ct(e,n,r);let f=this.tiles[c];if(!f&&(u>1&&console.time("creation"),f=this.tiles[c]=ot(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${a}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,b=U(t,h,n-p,n+g,0,f.minX,f.maxX,l),M=U(t,h,n+d,n+y,0,f.minX,f.maxX,l);t=null,b&&(x=U(b,h,r-p,r+g,1,f.minY,f.maxY,l),m=U(b,h,r+d,r+y,1,f.minY,f.maxY,l),b=null),M&&(v=U(M,h,r-p,r+g,1,f.minY,f.maxY,l),w=U(M,h,r+d,r+y,1,f.minY,f.maxY,l),M=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=ct(t,e,n);if(this.tiles[l])return rt(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[ct(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]?rt(this.tiles[l],i,s):null):null}}function ct(t,e,n){return 32*((1<<t)*n+e)+t}function ft(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 pt(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 dt="undefined"!=typeof Float32Array?Float32Array:Array;function gt(t,e,n,r){return t[0]=e,t[1]=n,t[2]=r,t}function yt(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function xt(t,e,n,r,i){return t[0]=e,t[1]=n,t[2]=r,t[3]=i,t}function mt(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 vt(t,e,n){return t[0]=e,t[1]=n,t}function wt(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 dt(3),dt!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t)}(),function(){var t,e=(t=new dt(4),dt!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t)}(),function(){var t,e=(t=new dt(2),dt!=Float32Array&&(t[0]=0,t[1]=0),t)}();const bt=Math.PI/180,Mt=6378137*Math.PI/180,Pt=85.0511287798;function _t(t,e,n){if("EPSG:3857"===n)return function(t,e){const n=Pt,r=e[0],i=Math.max(Math.min(n,e[1]),-n);let o;o=0===i?0:Math.log(Math.tan((90+i)*bt/2))/bt;return t[0]=r*Mt,t[1]=o*Mt,t}(t,e);if("EPSG:4326"===n||"EPSG:4490"===n||"identity"===n)return At(t,e);if("baidu"===n)return At(t,e);throw new Error("unsupported projection:"+n)}function At(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=wt(c,f),y=wt(f,p),x=[],m=[],v=[];for(let t=e;t<n;t+=3){const e=t/3*2;vt(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||_t(x,x,"EPSG:3857"),St(m,x,c,f),St(v,x,d,c),r[e]=wt(c,m)/g,r[e+1]=wt(c,v)/y}}(h,e,n,r,i,o,a,c,f,p,!!d)}function St(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 Tt(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=kt(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=kt(t,e[n]*r,n<o-1?e[n+1]*r:t.length,r,!1);s===s.next&&(s.steiner=!0),i.push(Dt(s))}i.sort(Xt);for(let t=0;t<i.length;t++)n=Nt(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 kt(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=Kt(i/r|0,t[i],t[i+1],o);else for(let i=n-r;i>=e;i-=r)o=Kt(i/r|0,t[i],t[i+1],o);return o&&Ut(o,o.next)&&(Qt(o),o=o.next),o}function Lt(t,e){if(!t)return t;e||(e=t);let n,r=t;do{if(n=!1,r.steiner||!Ut(r,r.next)&&0!==jt(r.prev,r,r.next))r=r.next;else{if(Qt(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=zt(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?Ot(t,r,i,o):Ct(t))e.push(l.i,t.i,u.i),Qt(t),t=u.next,a=u.next;else if((t=u)===a){s?1===s?Bt(t=Yt(Lt(t),e),e,n,r,i,o,2):2===s&&Vt(t,e,n,r,i,o):Bt(Lt(t),e,n,r,i,o,1);break}}}function Ct(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 Ot(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=zt(p,d,e,n,r),m=zt(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;!Ut(r,i)&&Zt(r,n,n.next,i)&&Ht(r,i)&&Ht(i,r)&&(e.push(r.i,n.i,i.i),Qt(n),Qt(n.next),n=t=i),n=n.next}while(n!==t);return Lt(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&&Gt(s,t)){let a=Wt(s,t);return s=Lt(s,s.next),a=Lt(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 Xt(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 Nt(t,e){const n=function(t,e){let n=e;const r=t.x,i=t.y;let o,s=-1/0;if(Ut(t,n))return n;do{if(Ut(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);Ht(n,t)&&(e<h||e===h&&(n.x>o.x||n.x===o.x&&Et(o,n)))&&(o=n,h=e)}n=n.next}while(n!==a);return o}(t,e);if(!n)return e;const r=Wt(n,t);return Lt(r,r.next),Lt(n,n.next)}function Et(t,e){return jt(t.prev,t,e.prev)<0&&jt(e.next,t,t.next)<0}function zt(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 Dt(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 Gt(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&&Zt(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&(Ht(t,e)&&Ht(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))||Ut(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 Ut(t,e){return t.x===e.x&&t.y===e.y}function Zt(t,e,n,r){const i=Jt(jt(t,e,n)),o=Jt(jt(t,e,r)),s=Jt(jt(n,r,t)),a=Jt(jt(n,r,e));return i!==o&&s!==a||(!(0!==i||!Rt(t,n,e))||(!(0!==o||!Rt(t,r,e))||(!(0!==s||!Rt(n,t,r))||!(0!==a||!Rt(n,e,r)))))}function Rt(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 Jt(t){return t>0?1:t<0?-1:0}function Ht(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 Wt(t,e){const n=te(t.i,t.x,t.y),r=te(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 Kt(t,e,n,r){const i=te(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 Qt(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 te(t,e,n){return{i:t,x:e,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}const ee="__fea_idx";new Float32Array([-1e12])[0];const ne="maptalks_ombb";function re(){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:ie,ArrayPool:oe}=re();function se(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++){ae(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 ae(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||!pt(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],b=i[m],M=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=Tt(i,o,c,w,b)),P=_===x[0]||_===x[1]||_===x[2]?g:g+y):1===t&&(_===x[0]||_===x[1]||_===x[2]?P=0:5===_?(y=Tt(i,o,c,w,b),P=y):P=y);const A=P/u*(1/(100*h))/a;let I;I=1===e?M===p?1:0:"bottom"===n?M===p?f/100/l:0:M===p?0:-f/100/l,r[2*s]=A,r[2*s+1]=I,0===_&&(g+=y)}}(a,l,u,h,n,o,g,c[0],c[1],f,p,d)}function le(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 ue="undefined"!=typeof Float32Array?Float32Array:Array;function he(){var t=new ue(3);return ue!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function ce(t,e,n){var r=new ue(3);return r[0]=t,r[1]=e,r[2]=n,r}function fe(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function pe(t,e,n,r){return t[0]=e,t[1]=n,t[2]=r,t}function de(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t}function ge(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 ye(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function xe(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 me=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 ve(){var t=new ue(4);return ue!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function we(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=he()}(),function(){var t,e=(t=new ue(4),ue!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t)}();var be,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},Pe=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};he(),ce(1,0,0),ce(0,1,0),ve(),ve(),be=new ue(9),ue!=Float32Array&&(be[1]=0,be[2]=0,be[3]=0,be[5]=0,be[6]=0,be[7]=0),be[0]=1,be[4]=1,be[8]=1;\n/*!\n * Contains code from google filament\n * https://github.com/google/filament/\n * License Apache-2.0\n */\nconst _e=8,Ae=[],Ie=[],Se=[],Te=[];function Fe(t,e,n){const r=xe(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}(Ae,n[0],n[1],n[2],...r,...e);t=we(t,i),t=function(t){return t[3]<0?Me(t,t,-1):t}(t=Pe(t,t));const o=1/((1<<2*_e-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?xe(Se,n,e):xe(Se,e,n);return ye(xe(Te,n,e),s)<0&&Me(t,t,-1),t}const ke=[];const Le=[],Be=[],Ce=[],Oe=[],Ye=[],Ve=[],Xe=[];function Ne(t,e,n,r,i,o){pe(Oe,t[3*e],t[3*e+1],t[3*e+2]),pe(Ye,t[3*n],t[3*n+1],t[3*n+2]),pe(Ve,t[3*r],t[3*r+1],t[3*r+2]);const s=me(Le,Ve,Ye),a=me(Be,Oe,Ye),l=xe(Ce,s,a);ge(Xe,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]+=Xe[0],i[3*n]+=Xe[0],i[3*r]+=Xe[0],i[3*e+1]+=Xe[1],i[3*n+1]+=Xe[1],i[3*r+1]+=Xe[1],i[3*e+2]+=Xe[2],i[3*n+2]+=Xe[2],i[3*r+2]+=Xe[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 Ee(t,e,n){return t[0]=e[n],t[1]=e[n+1],t[2]=e[n+2],t}function ze(t,e,n){return t[0]=e[n],t[1]=e[n+1],t}const{StyleUtil:De,PackUtil:$e,ArrayPool:qe}=re(),Ge=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),Ge.reset();const{altitudeScale:y,altitudeProperty:x,defaultAltitude:m,heightProperty:v,minHeightProperty:P,defaultHeight:_,tangent:A,uv:I,topUVMode:T,sideUVMode:F,sideVerticalUVMode:k,top:B,side:C,textureYOrigin:O,topThickness:Y}=e,V=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:b,positionType:M,res:P,glScale:_,projectionCode:A},I,T){let F=e/t[0].extent;e===1/0&&(F=1);const k=e===1/0,L=T.get(),B=T.get(),C=T.get(),O=T.getProxy(),Y=T.get(),V=T.get(),X=T.get(),N=!!p,E=!!h,z=!!u,D=N?T.get():null;function $(t,n,r,i,o,s){let a=n;if(E){const u=Ft(O,r,3);if(0===u.length)return n;let h=O.getLength(),p=Y.currentIndex;for(let t=0;t<h;t++)Y[p++]=O[t];if(Y.currentIndex=p,n+=O.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=V.currentIndex;for(let t=0;t<h;t++)V[p++]=u[t];V.currentIndex=p,N&&It(g||0,t,n,D,Y,f,w,v,d[0],d[1],o,P,_,A,l),c>0&&!z&&(n=se(Y,O,r,V,n,D,0,c,e,N,y||0,x||0,m,d,v,b,i<0?!s:s)),X.setLength(n/3),X.fill(1,a/3,n/3)}if(z){E&&(c=0),a=n,n=se(Y,O,r,V,n,D,c,i,e,N,y||0,x||0,m,d,v,b,i<0?!s:s),X.setLength(n/3);const t=O.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,G=1/0,j=0;const U=[-1,-1,e+1,e+1];let Z=0,R=t.length;S(I)&&(Z=I,R=I+1);let J=0,H=!1;const W=T.getProxy();let K,Q=!1;for(;Z<R;Z++){const l=t[Z],u=l.id;S(u)&&(Math.abs(u)>J&&(J=Math.abs(u)),u<0&&(H=!0));const h=l.geometry,c=l.properties[ne];let f=Array.isArray(c&&c[0]&&c[0][0])?c[0]:c;const{altitude:p,height:d}=ie.getFeaAltitudeAndHeight(l,n,r,i,o,a,s);d<0?(Q=!0,G=Math.min(p,G),q=Math.max(p-d,q)):(q=Math.max(p,q),G=Math.min(p-d,G));const g=Y.getLength();let y=0,x=j;W.setLength(0),O.setLength(0);const m=ie.calculateSignedArea(h[0])<0;for(let t=0,n=h.length;t<n;t++){let r=h[t];m&&(r=r.reverse()),r=le(r);const i=ie.calculateSignedArea(r)<0;if(!i&&t>0&&(y++,f=c&&c[y],j=$(x,j,W,d*F,f,k),O.setLength(0),W.setLength(0),x=j),e!==1/0&&(r=ie.clipPolygon(r,U)),!r.length){t===n-1&&(j=$(x,j,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++]=O.getLength()/3,W.currentIndex=t}ft(O,O.getLength(),r,F,p,!1,M),t===n-1&&(j=$(x,j,W,d*F,f,k))}const v=Y.getLength()-g,w=(ee+"").trim();for(let t=0;t<v/3;t++){let t=B.currentIndex;B[t++]=void 0===l[w]?Z:l[w],B.currentIndex=t,t=L.currentIndex,L[t++]=Z,L.currentIndex=t,S(u)&&(t=C.currentIndex,C[t++]=u,C.currentIndex=t)}}K=l?Float32Array:ie.getUnsignedArrayType(B.getLength()?B[B.getLength()-1]:0);const tt={hasNegativeHeight:Q,maxAltitude:q===-1/0?0:q,minAltitude:G===1/0?0:G,vertices:Y,verticeTypes:X,indices:V,pickingIds:oe.createTypedArray(B,K),featureIndexes:L};if(C.getLength()){const t=H?ie.getPosArrayType(J):ie.getUnsignedArrayType(J);tt.featureIds=oe.createTypedArray(C,t)}else tt.featureIds=[];return D&&(D.setLength(Y.getLength()/3*2),tt.uvs=D),tt}(t,n,{altitudeScale:y,altitudeProperty:x,defaultAltitude:m||0,heightProperty:v,minHeightProperty:P,defaultHeight:_||0},{center:g,top:B,side:C,topThickness:10*Y||0,uv:I||A,uvSize:[i,i],uvOrigin:r,topUVMode:T,sideUVMode:F,sideVerticalUVMode:k,textureYOrigin:O,tileRatio:a,centimeterToPoint:l,verticalCentimeterToPoint:u,positionType:d,res:o,glScale:s,projectionCode:f},p,Ge),X=[],N=V.vertices.getLength()/3,E=$e.getIndexArrayType(N),z=qe.createTypedArray(V.indices,E);delete V.indices,X.push(z.buffer,V.pickingIds.buffer);const D=Math.max(Math.abs(V.maxAltitude),Math.abs(V.minAltitude)),$=$e.getPosArrayType(Math.max(512,D));V.vertices=qe.createTypedArray(V.vertices,$);const q=A?Ge.getProxy():new Float32Array(3*N);q.setLength&&q.setLength(3*N);const G=function(t,e,n){const r=n||[];r.setLength&&r.setLength(t.length);const i=ke;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?Ne(t,3*n,3*n+1,3*n+2,r,i):Ne(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}(V.vertices,z,q);let j=!0;const U=G.getLength?G.getLength():G.length;for(let t=0;t<U;t++){G[t]=-G[t];const e=G[t]%1;1-Math.abs(e)>1e-6?j=!1:0!==e&&(G[t]=Math.round(G[t]))}if(V.normals=G,A){let t=Ge.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){Ee(u,t,3*e),Ee(h,t,3*r),Ee(c,t,3*i),ze(f,n,2*e),ze(p,n,2*r),ze(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],b=p[0]-f[0],M=d[0]-f[0],P=p[1]-f[1],_=d[1]-f[1],A=1/(b*_-M*P);pe(g,(_*o-P*s)*A,(_*x-P*m)*A,(_*v-P*w)*A),pe(y,(b*s-M*o)*A,(b*m-M*x)*A,(b*w-M*v)*A),de(a[e],a[e],g),de(a[r],a[r],g),de(a[i],a[i],g),de(l[e],l[e],y),de(l[r],l[r],y),de(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=[],b=[];let M,P,_;function A(t){Ee(w,e,3*t),fe(b,w),P=a[t],fe(m,P),me(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,ye(w,P))),ge(m,m),xe(v,b,P),_=ye(v,l[t]),M=_<0?-1:1,s[4*t]=m[0],s[4*t+1]=m[1],s[4*t+2]=m[2],s[4*t+3]=M}for(let t=0,e=r.length;t<e;t+=3)A(r[t+0]),A(r[t+1]),A(r[t+2]);return s}(V.vertices,V.normals,V.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;gt(o,t[n]||0,t[n+1]||0,t[n+2]||0),xt(i,e[a]||0,e[a+1]||0,e[a+2]||0,e[a+3]||0),Fe(s,o,i),yt(r.subarray(a,a+4),s)}return r}(V.normals,t),V.tangents=t,X.push(t.buffer),delete V.normals}if(V.normals&&(j&&(V.normals=qe.createTypedArray(V.normals,Int8Array)),X.push(V.normals.buffer)),V.uvs){const t=V.uvs;V.uvs=qe.createTypedArray(t,Float32Array),X.push(V.uvs.buffer)}const Z=function(t,e,n,r){const i={},o={},s=r.getLength();if(L(e.polygonFill)){let a=b(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=b(u),u=a(n,s)),delete s.$layer,delete s.$type,De.normalizeColor(Ue,u),l[4*e]=Ue[0],l[4*e+1]=Ue[1],l[4*e+2]=Ue[2],l[4*e+3]=Ue[3]}o.aColor=l}if(L(e.polygonOpacity)){let a=M(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=b(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,V.featureIndexes),R=function(t,e,n,r,i){const o=[[],[]],s=L(r.topPolygonFill),a=L(r.bottomPolygonFill),l=[255,255,255,255],u=e.getLength();if(s||a){let h=s&&b(r.topPolygonFill),c=a&&b(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=b(v),v=m(i,x)),delete x.$layer,delete x.$type,De.normalizeColor(Ue,v),mt(Ue,Ue,l);let M=Ze(o,Ue);M<0&&(M=o.length,o.push(yt([],Ue))),t[r]=M,u?(f=e[r],d=M):(p=e[r],g=M)}}return o.slice(2)}(V.verticeTypes,V.featureIndexes,t,h,c),J={data:{data:{aVertexColorType:R.length<=252?qe.createTypedArray(V.verticeTypes,Uint8Array):qe.createTypedArray(V.verticeTypes,Uint16Array),aPosition:V.vertices,aNormal:V.normals,aTexCoord0:V.uvs,aTangent:V.tangents,aPickingId:V.pickingIds},indices:z,properties:{maxAltitude:V.maxAltitude/100,minAltitude:V.minAltitude/100,hasNegativeHeight:V.hasNegativeHeight},dynamicAttributes:Z.dynamicAttributes,vertexColors:R},buffers:X};return V.featureIds.length?(J.data.featureIds=V.featureIds,X.push(J.data.featureIds.buffer)):J.data.featureIds=[],Z.aColor&&(J.data.data.aColor=Z.aColor,J.buffers.push(Z.aColor.buffer)),Z.aOpacity&&(J.data.data.aOpacity=Z.aOpacity,J.buffers.push(Z.aOpacity.buffer)),J.buffers.push(J.data.data.aPosition.buffer),J.data.pickingIdIndiceMap=$e.generatePickingIndiceIndex(J.data.data.aPickingId,J.data.indices),J}const Ue=[];function Ze(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:Re,StyleUtil:Je,FilterUtil:He}=re();function We(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=He.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),pt(g,u,h,e)||(x.push(u,h),c&&x.push(u+l,h+l),Ke(g,u,e)||x.push(u,u+l));return n+i}let v=0,b=-1/0,M=1/0;const P=(ee+"").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,Je.normalizeColor(_,t)}else gt(_,255,255,255);const p=v/3*4,{altitude:w,height:A}=Re.getFeaAltitudeAndHeight(h,i,o,s,a,u,l);A<0?(M=Math.min(w,M),b=Math.max(w-A,b)):(M=Math.min(w-A,M),b=Math.max(w,b));let I=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=ft(g,I,e,f,w),v=m(I,v,A*f),I=v}const S=I/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 A=x.reduce(((t,e)=>Math.max(t,e)),0),I=new(Re.getIndexArrayType(A))(x),T=Math.max(Math.abs(b,Math.abs(M)));return{aPosition:new(Re.getPosArrayType(Math.max(512,T)))(g),indices:I,aPickingId:new Float32Array(d),aColor:y,maxAltitude:b===-1/0?0:b/100,minAltitude:M===1/0?0:M/100}}function Ke(t,e,n){const r=t[3*e],i=t[3*e+1];return r<0||r>n||i<0||i>n}function Qe(t,e,n,r){const i=We(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 tn=["Unknown","Point","LineString","Polygon","MultiPoint","MultiLineString","MultiPolygon","GeometryCollection"];function en(t){if(!t)return"true";const e=t[0];if(t.length<=1)return"any"===e?"false":"true";return\`(${a}"=="===e?rn(t[1],t[2],"===",!1):"!="===e?rn(t[1],t[2],"!==",!1):"<"===e||">"===e||"<="===e||">="===e?rn(t[1],t[2],e,!0):"any"===e?sn(t.slice(1),"||"):"all"===e?sn(t.slice(1),"&&"):"none"===e?un(sn(t.slice(1),"||")):"in"===e?an(t[1],t.slice(2)):"!in"===e?un(an(t[1],t.slice(2))):"has"===e?ln(t[1]):"!has"===e?un(ln(t[1])):"contains"===e?function(t,e,n){const r=nn(t);return void 0!==n?\`(${a}r} + '').indexOf("${a}e}") === ${a}n}\`:\`(${a}r} + '').indexOf("${a}e}") >= 0\`}(t[1],t[2],t[3]):"true"})\`}function nn(t){return"$"===t[0]?"f."+t.substring(1):"p["+JSON.stringify(t)+"]"}function rn(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=nn(i);return"length"!==o?(console.error(\`not support ${a}o} op\`),"false"):(s=\`((${a}s}+='').length)\`,on(s,i,e,n,r))}(t,e,n,r);var i;return on(nn(t),t,e,n,r)}function on(t,e,n,r,i){const o="$type"===e?tn.indexOf(n):JSON.stringify(n);return(i?\`typeof ${a}t}=== typeof ${a}o}&&\`:"")+t+r+o}function sn(t,e){return t.map(en).join(e)}function an(t,e){"$type"===t&&(e=e.map((t=>tn.indexOf(t))));const n=JSON.stringify(e.sort(hn)),r=nn(t);return e.length<=200?\`${a}n}.indexOf(${a}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; }(${a}r}, ${a}n},0,${a}e.length-1})\`}function ln(t){return"$id"===t?'"id" in f':\`${a}JSON.stringify(t)} in p\`}function un(t){return\`!(${a}t})\`}function hn(t,e){return t<e?-1:t>e?1:0}let cn=!1;try{const t=new OffscreenCanvas(1,1);t.getContext("2d").fillText("hello",0,0),cn=!0}catch(t){cn=!1}var fn=cn;const{VectorPack:pn,PolygonPack:dn,NativeLinePack:gn,LinePack:yn,PointPack:xn,NativePointPack:mn,LineExtrusionPack:vn,CirclePack:wn,RoundTubePack:bn,SquareTubePack:Mn,FilterUtil:Pn,PackUtil:_n,StyleUtil:An,TextUtil:In,DEFAULT_TEX_WIDTH:Sn,GlyphRequestor:Tn}=re(),Fn="__original_properties",kn="__fn-type_properties";class Ln{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=A(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=>{if(n.canceled)return void e(null,{canceled:!0});n.data.styleCounter=t.styleCounter,o&&A(n.data,o);const r=n.data.features;if(r){const t={};for(const e in r){const n=r[e];t[n.id]=n}const e=function(t){try{const e=JSON.stringify(t);return B.encode(e)}catch(t){console.error("encode JSON to Uint8Array error:",t)}}(t);e&&(n.data.featuresTypeArray=e,n.buffers=n.buffer||[],n.buffers.push(e.buffer));const i="id"===this.options.features;for(const t in r){const n=r[t];e&&delete n.geometry,i&&(r[t]=n.id)}}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={},this._cache&&this._cache.reset(),delete this._cache,this.requests={}}fetchIconGlyphs(t,e,n){if(this.options.workerGlyph&&fn){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=>{if(!this._glyphRequestor){const t=this.options.sdfURL;this._glyphRequestor=new Tn(null,null,null,t)}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++)Nn(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,b=-1;const M=[];let P=!1;for(let t=0;t<s.length;t++){b++;const r=s[t];r.type!==w&&(b=0,w=r.type);const a=0===r.type?p:d;jn(r.symbol,M,t),P=P||M[t]&&M[t].size>0;const{tileFeatures:l,tileFeaIndexes:u}=this._filterFeatures(c,r.type,r.filter,e,m,t);if(!l.length){a[b]=null;continue}const y=u[u.length-1],_=_n.getIndexArrayType(y);a[b]={styledFeatures:new _(u)},g.push({idx:t,typeIdx:b}),x.push(a[b].styledFeatures.buffer);const I=A({},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){I.debugIndex=t[e].index;break}}}let S=this._createTileGeometry(l,r,I);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=On(t.properties)),t&&(y.features||P&&m[r])){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=A({},t.originalFeature);delete e[Fn],n.customProps=A({},e),t=n}const i=A({},t);if(P&&m[r]&&(!y.features||"transient"===y.features)){const i=m[r];for(let r=0;r<i.length;r++){const i=M[r];i&&i.forEach((r=>{const i=e?e.properties:t.properties;i[kn]||(i[kn]=new Set),i[kn].add(r),n=!0}))}}o[r]=i}if(n)for(const t in o){const e=o[t],n=e.properties[kn];if(n){delete e.properties[kn],"transient"===y.features&&(e.fnTypeProps=A({},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=A({},i,{EXTENT:a,zoom:h,debugIndex:y,features:this.options.features,isWebGPU:this.options.isWebGPU,isWebGL1:this.options.isWebGL1});if("3d-extrusion"===g){Yn(o)&&(i.uv=1);const t=this.options.projectionCode,e=o.material&&o.material.textureWidth||Sn;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(Qe(r,a,o,i))]);if("point"===g){x=A(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=>{x.defaultMarkerVerticalAlignment="middle";const e=pn.genFnTypes(t);let n=r;return xn.needMerge(t,e,h)&&(n=xn.mergeLineFeatures(r,t,e,h)),new xn(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,mn,d)}if("line"===g)return x=A(x,{requestor:this.fetchIconGlyphs.bind(this),tileRatio:d}),Vn(r,o,x,yn,1,!0);if("native-line"===g)return Vn(r,o,x,gn,1,!0);if("fill"===g)return x=A(x,{requestor:this.fetchIconGlyphs.bind(this)}),Vn(r,o,x,dn);if("line-extrusion"===g){delete o.lineGradientProperty,o.lineJoin="miter",o.lineCap="butt";const t=Yn(o);if(t&&(i.uv=1),x=A(x,{tileSize:s,zScale:u,glScale:l}),o.mergeOnProperty){const t=pn.genFnTypes(o);r=yn.mergeLineFeatures(r,o,t,x.zoom)}if(t){const t=[];if(!1!==i.top){const e=A({},x);e.side=!1,t.push(new vn(r,o,e))}return!1!==i.side&&(x.side=!0,x.top=!1,t.push(new vn(r,o,x))),Promise.all(t.map((t=>t.load())))}return Promise.all([new vn(r,o,x).load()])}if("circle"===g)return Vn(r,o,x,wn);if("round-tube"===g||"square-tube"===g){const t="round-tube"===g?bn:Mn;return x=A(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=(ee+"").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=Pn.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=Pn.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 ${a}en(i)}\`)),renderPlugin:Bn(a),symbol:Cn(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 Cn(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 On(t){if(Array.isArray(t)||!F(t))return{};const e={};for(const n in t){const r=t[n];I(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]=Xn(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=pn.genFnTypes(a[e]);h=yn.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 Xn(t){if(!t)return 0;for(const e in t)if(L(t[e]))return 1;return 0}function Nn(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=Pn.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 En={get:(t,e)=>e in t?t[e]:t.originalFeature[e],has:(t,e)=>e in t||e in t.originalFeature},zn={get:function(t,e){return e in t?t[e]:t[Fn][e]},has:(t,e)=>e in t||e in t[Fn]},Dn={};function $n(t){const e={};e.originalFeature=t;const n=new Proxy(e,En);return n.properties=new Proxy({},zn),n.properties[Fn]=t.properties||Dn,n}function qn(t,e,n){t[e]||(t[e]=new Set),t[e].add(n)}const Gn=[];function jn(t,e,n){if(!t)return Gn;for(const r in t){if(!t[r]||!An.checkIfZoomFnTypeSymbol(r))continue;if(L(t[r]))qn(e,n,t[r].property);else{if("lineGradientProperty"===r){qn(e,n,t[r]);continue}if("textName"===r)if(I(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(Pn.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++)L(i[t][1])&&qn(e,t,i[t][1].property)}return e[n]}function Un(t,e){Zn(t.geometry,e)}function Zn(t,e){if(t)switch(t.type){case"Point":Rn(t.coordinates,e);break;case"MultiPoint":case"LineString":Jn(t.coordinates,e);break;case"MultiLineString":!function(t,e){for(let n=0,r=t.length;n<r;n++)Jn(t[n],e)}(t.coordinates,e);break;case"Polygon":Hn(t.coordinates,e);break;case"MultiPolygon":!function(t,e){for(let n=0,r=t.length;n<r;n++)Hn(t[n],e)}(t.coordinates,e);break;case"GeometryCollection":const n=t.geometries.length;for(let r=0;r<n;r++)Zn(t.geometries[r],e)}}function Rn(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 Jn(t,e){for(let n=0,r=t.length;n<r;n++)Rn(t[n],e)}function Hn(t,e){t.length&&Jn(t[0],e)}function Wn(t,e,n,r,i){Kn(t,e,n||0,r||t.length-1,i||tr)}function Kn(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);Kn(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(Qn(t,n,e),i(t[r],h)>0&&Qn(t,n,r);c<f;){for(Qn(t,c,f),c++,f--;i(t[c],h)<0;)c++;for(;i(t[f],h)>0;)f--}0===i(t[n],h)?Qn(t,n,f):Qn(t,++f,r),f<=e&&(n=f+1),e<=f&&(r=f-1)}}function Qn(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function tr(t,e){return t<e?-1:t>e?1:0}class er{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(!fr(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;fr(t,a)&&(e.leaf?n.push(s):cr(t,a)?this._all(s,n):i.push(s))}e=i.pop()}return n}collides(t){let e=this.data;if(!fr(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(fr(t,o)){if(e.leaf||cr(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=pr([]),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=nr(t,n.children,e);if(-1!==r)return n.children.splice(r,1),i.push(n),this._condense(i),this}l||n.leaf||!cr(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=pr(t.slice(e,n+1)),rr(o,this.toBBox),o;r||(r=Math.ceil(Math.log(i)/Math.log(s)),s=Math.ceil(i/Math.pow(s,r-1))),o=pr([]),o.leaf=!1,o.height=r;const a=Math.ceil(i/s),l=a*Math.ceil(Math.sqrt(s));dr(t,e,n,l,this.compareMinX);for(let i=e;i<=n;i+=l){const e=Math.min(i+l-1,n);dr(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 rr(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=lr(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),or(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=pr(n.children.splice(o,n.children.length-o));s.height=n.height,s.leaf=n.leaf,rr(n,this.toBBox),rr(s,this.toBBox),e?t[e-1].children.push(s):this._splitRoot(n,s)}_splitRoot(t,e){this.data=pr([t,e]),this.data.height=t.height+1,this.data.leaf=!1,rr(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=ir(t,0,s,this.toBBox),a=ir(t,s,n,this.toBBox),l=hr(e,a),u=lr(e)+lr(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:sr,i=t.leaf?this.compareMinY:ar;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=ir(t,0,e,i),s=ir(t,n-e,n,i);let a=ur(o)+ur(s);for(let r=e;r<n-e;r++){const e=t.children[r];or(o,t.leaf?i(e):e),a+=ur(o)}for(let r=n-e-1;r>=e;r--){const e=t.children[r];or(s,t.leaf?i(e):e),a+=ur(s)}return a}_adjustParentBBoxes(t,e,n){for(let r=n;r>=0;r--)or(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():rr(t[n],this.toBBox)}}function nr(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 rr(t,e){ir(t,0,t.children.length,e,t)}function ir(t,e,n,r,i){i||(i=pr(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];or(i,t.leaf?r(e):e)}return i}function or(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 sr(t,e){return t.minX-e.minX}function ar(t,e){return t.minY-e.minY}function lr(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function ur(t){return t.maxX-t.minX+(t.maxY-t.minY)}function hr(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 cr(t,e){return t.minX<=e.minX&&t.minY<=e.minY&&e.maxX<=t.maxX&&e.maxY<=t.maxY}function fr(t,e){return e.minX<=t.maxX&&e.minY<=t.maxY&&e.maxX>=t.minX&&e.maxY>=t.minY}function pr(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function dr(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;Wn(t,s,e,n,i),o.push(e,s,s,n)}}class gr{constructor(t=[],e=yr){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 yr(t,e){return t<e?-1:t>e?1:0}function xr(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var mr={exports:{}},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)/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},wr=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};mr.exports=function(t,e,n,r){return e.length>0&&Array.isArray(e[0])?wr(t,e,n,r):vr(t,e,n,r)};var br=mr.exports.nested=wr;mr.exports.flat=vr;const Mr=11102230246251565e-32,Pr=134217729,_r=(3+8*Mr)*Mr;function Ar(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 Sr=33306690738754716e-32,Tr=22204460492503146e-32,Fr=11093356479670487e-47,kr=Ir(4),Lr=Ir(8),Br=Ir(12),Cr=Ir(16),Or=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)>=Sr*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,b,M,P,_;const A=t-i,I=n-i,S=e-o,T=r-o;w=A*T,f=Pr*A,p=f-(f-A),d=A-p,f=Pr*T,g=f-(f-T),y=T-g,b=d*y-(w-p*g-d*g-p*y),M=S*I,f=Pr*S,p=f-(f-S),d=S-p,f=Pr*I,g=f-(f-I),y=I-g,P=d*y-(M-p*g-d*g-p*y),x=b-P,c=b-x,kr[0]=b-(x+c)+(c-P),m=w+x,c=m-w,v=w-(m-c)+(x-c),x=v-M,c=v-x,kr[1]=v-(x+c)+(c-M),_=m+x,c=_-m,kr[2]=m-(_-c)+(x-c),kr[3]=_;let F=function(t,e){let n=e[0];for(let r=1;r<t;r++)n+=e[r];return n}(4,kr),k=Tr*s;if(F>=k||-F>=k)return F;if(c=t-A,a=t-(A+c)+(c-i),c=n-I,u=n-(I+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=Fr*s+_r*Math.abs(F),F+=A*h+T*a-(S*u+I*l),F>=k||-F>=k)return F;w=a*T,f=Pr*a,p=f-(f-a),d=a-p,f=Pr*T,g=f-(f-T),y=T-g,b=d*y-(w-p*g-d*g-p*y),M=l*I,f=Pr*l,p=f-(f-l),d=l-p,f=Pr*I,g=f-(f-I),y=I-g,P=d*y-(M-p*g-d*g-p*y),x=b-P,c=b-x,Or[0]=b-(x+c)+(c-P),m=w+x,c=m-w,v=w-(m-c)+(x-c),x=v-M,c=v-x,Or[1]=v-(x+c)+(c-M),_=m+x,c=_-m,Or[2]=m-(_-c)+(x-c),Or[3]=_;const L=Ar(4,kr,4,Or,Lr);w=A*h,f=Pr*A,p=f-(f-A),d=A-p,f=Pr*h,g=f-(f-h),y=h-g,b=d*y-(w-p*g-d*g-p*y),M=S*u,f=Pr*S,p=f-(f-S),d=S-p,f=Pr*u,g=f-(f-u),y=u-g,P=d*y-(M-p*g-d*g-p*y),x=b-P,c=b-x,Or[0]=b-(x+c)+(c-P),m=w+x,c=m-w,v=w-(m-c)+(x-c),x=v-M,c=v-x,Or[1]=v-(x+c)+(c-M),_=m+x,c=_-m,Or[2]=m-(_-c)+(x-c),Or[3]=_;const B=Ar(L,Lr,4,Or,Br);w=a*h,f=Pr*a,p=f-(f-a),d=a-p,f=Pr*h,g=f-(f-h),y=h-g,b=d*y-(w-p*g-d*g-p*y),M=l*u,f=Pr*l,p=f-(f-l),d=l-p,f=Pr*u,g=f-(f-u),y=u-g,P=d*y-(M-p*g-d*g-p*y),x=b-P,c=b-x,Or[0]=b-(x+c)+(c-P),m=w+x,c=m-w,v=w-(m-c)+(x-c),x=v-M,c=v-x,Or[1]=v-(x+c)+(c-M),_=m+x,c=_-m,Or[2]=m-(_-c)+(x-c),Or[3]=_;const C=Ar(B,Br,4,Or,Cr);return Cr[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++)br(t[o],a)||l.push(t[o]);return function(t){t.sort(Rr);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 er(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=Gr(l,o),s.push(o)}var u=new er(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=Xr(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(Gr(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 Xr(t,e,n,r,i,o,s){for(var a=new gr([],Nr),l=t.data;l;){for(var u=0;u<l.children.length;u++){var h=l.children[u],c=l.leaf?Ur(h,n,r):Er(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=Ur(p,e,n),g=Ur(p,r,i);if(f.dist<d&&f.dist<g&&Dr(n,p,s)&&Dr(r,p,s))return p}(l=a.pop())&&(l=l.node)}return null}function Nr(t,e){return t.dist-e.dist}function Er(t,e,n){if(zr(t,n)||zr(e,n))return 0;var r=Zr(t[0],t[1],e[0],e[1],n.minX,n.minY,n.maxX,n.minY);if(0===r)return 0;var i=Zr(t[0],t[1],e[0],e[1],n.minX,n.minY,n.minX,n.maxY);if(0===i)return 0;var o=Zr(t[0],t[1],e[0],e[1],n.maxX,n.minY,n.maxX,n.maxY);if(0===o)return 0;var s=Zr(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 zr(t,e){return t[0]>=e.minX&&t[0]<=e.maxX&&t[1]>=e.minY&&t[1]<=e.maxY}function Dr(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 Gr(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 Ur(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 Zr(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,b=f*y+p*x,M=d*y+g*x,P=m*w-v*v,_=P,A=P;0===P?(u=0,_=1,c=M,A=w):(c=m*M-v*b,(u=v*M-w*b)<0?(u=0,c=M,A=w):u>_&&(u=_,c=M+v,A=w)),c<0?(c=0,-b<0?u=0:-b>m?u=_:(u=-b,_=m)):c>A&&(c=A,-b+v<0?u=0:-b+v>m?u=_:(u=-b+v,_=m));var I=(1-(h=0===c?0:c/A))*i+h*s-((1-(l=0===u?0:u/_))*t+l*n),S=(1-h)*o+h*a-((1-l)*e+l*r);return I*I+S*S}function Rr(t,e){return t[0]===e[0]?t[1]-e[1]:t[0]-e[0]}const{PackUtil:Jr}=re();class Hr{constructor(t,e){this.x=t,this.y=e}clone(){return new Hr(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 Hr(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 Hr(this.y,-this.x)}}function Wr(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 Hr(t.x+a*e.x,t.y+a*e.y)}const Kr=[],Qr=[];function ti(t){if(S(t[0]&&t[0].x)){const e=[];let n=0;for(let r=0;r<t.length;r++)Qr[n]?(Qr[n][0]=t[r].x,Qr[n][1]=t[r].y):Qr[n]=[t[r].x,t[r].y],e.push(Qr[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]||(_t(i,e[t],"EPSG:3857"),Kr[s]?(Kr[s].x=i[0],Kr[s].y=i[1]):Kr[s]=new Hr(i[0],i[1]),o.push(Kr[s]),s++);Jr.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=Wr(t,r,s,a),c=Wr(i,o,s,a),f=Wr(l,u,t,r),p=Wr(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 Hr(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),h=new Hr(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 Hr(0,-1),p=new Hr(0,1),d=new Hr(-1,0),g=new Hr(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 ei=[];function ni(t,e){const n=Array.isArray(t&&t[0]&&t[0][0]);for(let r=0;r<t.length;r++)n?t[r]=ni(t[r]):(_t(ei,t[r],e),t[r][0]=ei[0],t[r][1]=ei[1]);return t}const{PackUtil:ri}=re();class ii extends Ln{constructor(t,e,n,r,i,o){super(t,e,n,r,i),(e=e||{}).extent||(e.extent=8192),this.setData(e.data,o)}clearData(){delete this.index}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")),I(t)&&"{"!=t.substring(0,1)||t.url){const r=t.url?t.url:t;O.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:new Map});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;this._genOMBB(r);let i=r;this._generate(i,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=ti(t,t.length);n.properties=n.properties||{},n.properties[ne]=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=ti(r,r.length);n.properties=n.properties||{},n.properties[ne]=n.properties[ne]||[],n.properties[ne][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++)Un(t.features[r],e);break;case"Feature":Un(t,e);break;default:Zn(t,e)}return e}({type:"FeatureCollection",features:t}):null;this.index=function(t,e){return new ht(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=new Map;let r=0;const i=this.options.featureIdProperty;return t&&(t.length,t.forEach(((t,o)=>{!function(t,o,s){if(!t)return;if("Feature"===t.type&&!t.geometry)return;if(S(t.id)||(t.id=r++),i){let e=i;F(i)&&(e=i[t.layer||"0"]),t.id=t.properties[e]}const a=A({},t);t.geometry?(a.geometry=A({},t.geometry),a.geometry.coordinates=null):t.coordinates&&(a.coordinates=null),n.set(t.id,a),e.push(t)}(t)}))),{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||(ri.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}}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 bi(t,e){for(var n=0;n<t.length;n++)e.writeSFixed32(t[n])}function Mi(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 Ai(t,e,n){t[n]=e,t[n+1]=e>>>8,t[n+2]=e>>>16,t[n+3]=e>>>24}function Ii(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=Ii(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)+Ii(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),Ai(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),Ai(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),Ai(this.buf,-1&t,this.pos),Ai(this.buf,Math.floor(t*hi),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),Ai(this.buf,-1&t,this.pos),Ai(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,bi,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,Mi,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=xr(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,Li=Bi;function Bi(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 Oi(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}Bi.types=["Unknown","Point","LineString","Polygon"],Bi.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},Bi.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]},Bi.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=Bi.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=Oi(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 Yi=Li,Vi=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 Yi(this._pbf,e,this.extent,this._keys,this._values)};var Ei=Vi,zi=function(t,e){this.layers=t.readFields(Di,{},e)};function Di(t,e,n){if(3===t){var r=new Ei(n,n.readVarint()+n.pos);r.length&&(e[r.name]=r)}}var $i=zi;const qi=2,Gi=new TextDecoder("utf-8");class ji extends Ln{constructor(t,e,n,r,i,o){super(t,e,n,r,i),e=e||{},o()}clearData(){this._abortRequests()}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;if(a)return setTimeout((()=>{this._readTile(n,i,o,null,a,e)}),1);r.referrer=t.referrer,r.errorLog=t.loadTileErrorLog;const{loadTileCachMaxSize:l,loadTileCacheLog:u}=t;return O.getArrayBuffer(n,r,((r,s)=>{if(!this._cache)return;let a,h=!1;const c=()=>{this._readTile(n,i,o,r,a,e)};if(r)r.loading||this._cache.add(n,{err:r,data:s&&s.data,cacheIndex:t.workerCacheIndex});else if(s&&s.data){h=!0,a=s.data;const e=function(t){if(!t)return!1;if(!(t instanceof ArrayBuffer))return!1;try{const e=new Uint8Array(t),n=e[0],r=e[1];return 31===n&&139===r}catch(t){console.error("arraybufferIsGZip read buffer error:",t)}return!1}(a),r=()=>{let e=!0;if(a&&("number"==typeof(i=l)&&!isNaN(i))&&l>0){const t=(r=a)&&r instanceof ArrayBuffer?r.byteLength/1048576:0;t>l&&(e=!1,u&&console.warn(\`url:${a}n},loadTileCachMaxSize exceeded: ${a}t} > ${a}l},the tile will not be cached.\`))}var r,i;e&&a&&this._cache.add(n,{err:null,data:a,cacheIndex:t.workerCacheIndex}),c()};e?function(t,e){try{const n=new DecompressionStream("gzip"),r=new Blob([t]).stream().pipeThrough(n);new Response(r).arrayBuffer().then((t=>{e(t)})).catch((t=>{console.error("decompressGzipWithBlob:",t),e()}))}catch(t){console.error("decompressGzipWithBlob:",t),e()}}(a,(t=>{t&&(a=t),r()})):r()}h||c()}))}_readTile(t,e,n,r,i,o){if(r)return void o(r);let s;try{s=new $i(new Si(i))}catch(r){const e=Gi.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[ne];l&&(I(l)&&(l=JSON.parse(l)),r.properties[ne]=ni(l,"EPSG:3857"));const h=e&&r.properties[e];if(h){const t=Ui(h),e=[];Zi(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(),this._abortRequests()}_abortRequests(){for(const t in this.requests){const e=this.requests[t];e&&e.abort&&e.abort()}this.requests={}}}function Ui(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 Zi(t,e,n,r){r||(r={index:0});for(let i=0;i<t.length;i++)if(Array.isArray(t[i]))Zi(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}=re();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 ii(n,a,l,Hi,{},i):new ji(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)}clearData({mapId:t,layerId:e},n){const r=this._getLayerById(t,e);r&&(r.clearData(n),this._resetCache())}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?\`${a}t}-${a}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\`${a}t}-${a}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,i=(n.params||{}).loadTileErrorLog,o=(n.params||{}).loadTileErrorLogIgnoreCodes||[];this.dispatcher[r]({actorId:t.actorId,mapId:n.mapId,layerId:n.layerId,params:n.params},((t,n,s)=>{if(i&&t&&!t.loading){const e=t.status;S(e)&&-1===o.indexOf(e)&&console.error(r,t)}e(t,n,s)}))}}}`;
25
25
  function l(e) {
26
26
  const t = function() {
27
27
  return "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : "undefined" != typeof window ? window : "undefined" != typeof global ? global : void 0;
@@ -377,19 +377,19 @@
377
377
  }
378
378
  return t;
379
379
  }
380
- function T(e, t, n, i, r) {
380
+ function b(e, t, n, i, r) {
381
381
  const o = e[t * i], a = e[t * i + 1], s = e[n * i], l = e[n * i + 1];
382
382
  return o === s && (o < 0 || o > r) && a !== l || a === l && (a < 0 || a > r) && o !== s;
383
383
  }
384
- function b(e, t, n) {
384
+ function T(e, t, n) {
385
385
  let i = n;
386
386
  return t && e && (i = +e[t]), isNaN(i) && (i = n || 0), 100 * i;
387
387
  }
388
388
  function S(e, t, n, i, r, o, a) {
389
389
  t || 0 === t || (t = 1);
390
- const s = b(e.properties, n, i), l = s * t;
390
+ const s = T(e.properties, n, i), l = s * t;
391
391
  let h = (o ? 100 * o : 0) || s;
392
- return r ? h = b(e.properties, r, o) : a && (h = s - b(e.properties, a, o)), h *= t,
392
+ return r ? h = T(e.properties, r, o) : a && (h = s - T(e.properties, a, o)), h *= t,
393
393
  {
394
394
  altitude: l,
395
395
  height: h
@@ -984,7 +984,7 @@
984
984
  function Ae(e, t, n) {
985
985
  return Math.min(Math.max(t, e), n);
986
986
  }
987
- function Te(e) {
987
+ function be(e) {
988
988
  var t = Math.round(e).toString(16).toUpperCase();
989
989
  return t.length < 2 ? "0" + t : t;
990
990
  }
@@ -1047,7 +1047,7 @@
1047
1047
  return null;
1048
1048
  }, ve.to.hex = function() {
1049
1049
  var e = me(arguments);
1050
- return "#" + Te(e[0]) + Te(e[1]) + Te(e[2]) + (e[3] < 1 ? Te(Math.round(255 * e[3])) : "");
1050
+ return "#" + be(e[0]) + be(e[1]) + be(e[2]) + (e[3] < 1 ? be(Math.round(255 * e[3])) : "");
1051
1051
  }, ve.to.rgb = function() {
1052
1052
  var e = me(arguments);
1053
1053
  return e.length < 4 || 1 === e[3] ? "rgb(" + Math.round(e[0]) + ", " + Math.round(e[1]) + ", " + Math.round(e[2]) + ")" : "rgba(" + Math.round(e[0]) + ", " + Math.round(e[1]) + ", " + Math.round(e[2]) + ", " + e[3] + ")";
@@ -1063,7 +1063,7 @@
1063
1063
  }, ve.to.keyword = function(e) {
1064
1064
  return xe[e.slice(0, 3)];
1065
1065
  };
1066
- var be = le.exports, Se = {
1066
+ var Te = le.exports, Se = {
1067
1067
  exports: {}
1068
1068
  }, we = {
1069
1069
  aliceblue: [ 240, 248, 255 ],
@@ -1578,7 +1578,7 @@
1578
1578
  }(i);
1579
1579
  }));
1580
1580
  }));
1581
- var ze = be, Ve = Ne, Ue = [].slice, Ge = [ "keyword", "gray", "hex" ], Be = {};
1581
+ var ze = Te, Ve = Ne, Ue = [].slice, Ge = [ "keyword", "gray", "hex" ], Be = {};
1582
1582
  Object.keys(Ve).forEach((function(e) {
1583
1583
  Be[Ue.call(Ve[e].labels).sort().join("")] = e;
1584
1584
  }));
@@ -1995,7 +1995,7 @@
1995
1995
  if (!e) return "true";
1996
1996
  const t = e[0];
1997
1997
  if (e.length <= 1) return "any" === t ? "false" : "true";
1998
- const n = "==" === t ? At(e[1], e[2], "===", !1) : "!=" === t ? At(e[1], e[2], "!==", !1) : "<" === t || ">" === t || "<=" === t || ">=" === t ? At(e[1], e[2], t, !0) : "any" === t ? bt(e.slice(1), "||") : "all" === t ? bt(e.slice(1), "&&") : "none" === t ? Mt(bt(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) {
1998
+ const n = "==" === t ? At(e[1], e[2], "===", !1) : "!=" === t ? At(e[1], e[2], "!==", !1) : "<" === t || ">" === t || "<=" === t || ">=" === t ? At(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) {
1999
1999
  const i = vt(e);
2000
2000
  return void 0 !== n ? `(${i} + '').indexOf("${t}") === ${n}` : `(${i} + '').indexOf("${t}") >= 0`;
2001
2001
  }(e[1], e[2], e[3]) : "true";
@@ -2009,15 +2009,15 @@
2009
2009
  const r = e.property, o = e.op;
2010
2010
  let a = vt(r);
2011
2011
  return "length" !== o ? (console.error(`not support ${o} op`), "false") : (a = `((${a}+='').length)`,
2012
- Tt(a, r, t, n, i));
2013
- }(e, t, n, i) : Tt(vt(e), e, t, n, i);
2012
+ bt(a, r, t, n, i));
2013
+ }(e, t, n, i) : bt(vt(e), e, t, n, i);
2014
2014
  var r;
2015
2015
  }
2016
- function Tt(e, t, n, i, r) {
2016
+ function bt(e, t, n, i, r) {
2017
2017
  const o = "$type" === t ? yt.indexOf(n) : JSON.stringify(n);
2018
2018
  return (r ? `typeof ${e}=== typeof ${o}&&` : "") + e + i + o;
2019
2019
  }
2020
- function bt(e, t) {
2020
+ function Tt(e, t) {
2021
2021
  return e.map(_t).join(t);
2022
2022
  }
2023
2023
  function St(e, t) {
@@ -2062,11 +2062,11 @@
2062
2062
  for (var n = e.length, i = []; n--; ) i[n] = t(e[n]);
2063
2063
  return i;
2064
2064
  }
2065
- function T(e, t) {
2065
+ function b(e, t) {
2066
2066
  var n = e.split("@"), i = "";
2067
2067
  return n.length > 1 && (i = n[0] + "@", e = n[1]), i + A((e = e.replace(g, ".")).split("."), t).join(".");
2068
2068
  }
2069
- function b(e) {
2069
+ function T(e) {
2070
2070
  for (var t, n, i = [], r = 0, o = e.length; r < o; ) (t = e.charCodeAt(r++)) >= 55296 && t <= 56319 && r < o ? 56320 == (64512 & (n = e.charCodeAt(r++))) ? i.push(((1023 & t) << 10) + (1023 & n) + 65536) : (i.push(t),
2071
2071
  r--) : i.push(t);
2072
2072
  return i;
@@ -2100,35 +2100,35 @@
2100
2100
  return S(g);
2101
2101
  }
2102
2102
  function I(e) {
2103
- var t, n, i, r, o, a, s, u, f, d, p, g, m, y, A, T = [];
2104
- for (g = (e = b(e)).length, t = 128, n = 0, o = 72, a = 0; a < g; ++a) (p = e[a]) < 128 && T.push(_(p));
2105
- for (i = r = T.length, r && T.push("-"); i < g; ) {
2103
+ var t, n, i, r, o, a, s, u, f, d, p, g, m, y, A, b = [];
2104
+ for (g = (e = T(e)).length, t = 128, n = 0, o = 72, a = 0; a < g; ++a) (p = e[a]) < 128 && b.push(_(p));
2105
+ for (i = r = b.length, r && b.push("-"); i < g; ) {
2106
2106
  for (s = l, a = 0; a < g; ++a) (p = e[a]) >= t && p < s && (s = p);
2107
2107
  for (s - t > x((l - n) / (m = i + 1)) && v("overflow"), n += (s - t) * m, t = s,
2108
2108
  a = 0; a < g; ++a) if ((p = e[a]) < t && ++n > l && v("overflow"), p == t) {
2109
2109
  for (u = n, f = h; !(u < (d = f <= o ? 1 : f >= o + c ? c : f - o)); f += h) A = u - d,
2110
- y = h - d, T.push(_(w(d + A % y, 0))), u = x(A / y);
2111
- T.push(_(w(u, 0))), o = M(n, m, i == r), n = 0, ++i;
2110
+ y = h - d, b.push(_(w(d + A % y, 0))), u = x(A / y);
2111
+ b.push(_(w(u, 0))), o = M(n, m, i == r), n = 0, ++i;
2112
2112
  }
2113
2113
  ++n, ++t;
2114
2114
  }
2115
- return T.join("");
2115
+ return b.join("");
2116
2116
  }
2117
2117
  if (a = {
2118
2118
  version: "1.3.2",
2119
2119
  ucs2: {
2120
- decode: b,
2120
+ decode: T,
2121
2121
  encode: S
2122
2122
  },
2123
2123
  decode: P,
2124
2124
  encode: I,
2125
2125
  toASCII: function(e) {
2126
- return T(e, (function(e) {
2126
+ return b(e, (function(e) {
2127
2127
  return p.test(e) ? "xn--" + I(e) : e;
2128
2128
  }));
2129
2129
  },
2130
2130
  toUnicode: function(e) {
2131
- return T(e, (function(e) {
2131
+ return b(e, (function(e) {
2132
2132
  return d.test(e) ? P(e.slice(4).toLowerCase()) : e;
2133
2133
  }));
2134
2134
  }
@@ -2716,14 +2716,14 @@
2716
2716
  return e;
2717
2717
  }
2718
2718
  }
2719
- class Tn {
2719
+ class bn {
2720
2720
  constructor(e) {
2721
2721
  this.type = Wt, this.input = e;
2722
2722
  }
2723
2723
  static parse(e, t) {
2724
2724
  if (2 !== e.length) return t.error("Expected two arguments.");
2725
2725
  const n = t.parse(e[1], 1, Lt);
2726
- return n ? new Tn(n) : t.error("No image name provided.");
2726
+ return n ? new bn(n) : t.error("No image name provided.");
2727
2727
  }
2728
2728
  evaluate(e) {
2729
2729
  const t = this.input.evaluate(e), n = cn.fromString(t);
@@ -2740,7 +2740,7 @@
2740
2740
  return [ "image", this.input.serialize() ];
2741
2741
  }
2742
2742
  }
2743
- const bn = {
2743
+ const Tn = {
2744
2744
  "to-boolean": Nt,
2745
2745
  "to-color": zt,
2746
2746
  "to-number": Ht,
@@ -2754,7 +2754,7 @@
2754
2754
  if (e.length < 2) return t.error("Expected at least one argument.");
2755
2755
  const n = e[0];
2756
2756
  if (("to-boolean" === n || "to-string" === n) && 2 !== e.length) return t.error("Expected one argument.");
2757
- const i = bn[n], r = [];
2757
+ const i = Tn[n], r = [];
2758
2758
  for (let n = 1; n < e.length; n++) {
2759
2759
  const i = t.parse(e[n], n, Ut);
2760
2760
  if (!i) return null;
@@ -2800,7 +2800,7 @@
2800
2800
  font: null,
2801
2801
  textColor: null
2802
2802
  } ]).serialize();
2803
- if ("resolvedImage" === this.type.kind) return new Tn(this.args[0]).serialize();
2803
+ if ("resolvedImage" === this.type.kind) return new bn(this.args[0]).serialize();
2804
2804
  const e = [ `to-${this.type.kind}` ];
2805
2805
  return this.eachChild((t => {
2806
2806
  e.push(t.serialize());
@@ -3336,11 +3336,11 @@
3336
3336
  function Ai(e) {
3337
3337
  return 255 * (e <= .0031308 ? 12.92 * e : 1.055 * Math.pow(e, 1 / 2.4) - .055);
3338
3338
  }
3339
- function Ti(e) {
3339
+ function bi(e) {
3340
3340
  return (e /= 255) <= .04045 ? e / 12.92 : Math.pow((e + .055) / 1.055, 2.4);
3341
3341
  }
3342
- function bi(e) {
3343
- const t = Ti(e.r), n = Ti(e.g), i = Ti(e.b), r = _i((.4124564 * t + .3575761 * n + .1804375 * i) / ui), o = _i((.2126729 * t + .7151522 * n + .072175 * i) / 1);
3342
+ function Ti(e) {
3343
+ const t = bi(e.r), n = bi(e.g), i = bi(e.b), r = _i((.4124564 * t + .3575761 * n + .1804375 * i) / ui), o = _i((.2126729 * t + .7151522 * n + .072175 * i) / 1);
3344
3344
  return {
3345
3345
  l: 116 * o - 16,
3346
3346
  a: 500 * (r - o),
@@ -3357,7 +3357,7 @@
3357
3357
  return e + n * (i > 180 || i < -180 ? i - 360 * Math.round(i / 360) : i);
3358
3358
  }
3359
3359
  const Mi = {
3360
- forward: bi,
3360
+ forward: Ti,
3361
3361
  reverse: Si,
3362
3362
  interpolate: function(e, t, n) {
3363
3363
  return {
@@ -3369,7 +3369,7 @@
3369
3369
  }
3370
3370
  }, Pi = {
3371
3371
  forward: function(e) {
3372
- const {l: t, a: n, b: i} = bi(e), r = Math.atan2(i, n) * xi;
3372
+ const {l: t, a: n, b: i} = Ti(e), r = Math.atan2(i, n) * xi;
3373
3373
  return {
3374
3374
  h: r < 0 ? r + 360 : r,
3375
3375
  c: Math.sqrt(n * n + i * i),
@@ -3962,7 +3962,7 @@
3962
3962
  coalesce: Fi,
3963
3963
  collator: On,
3964
3964
  format: An,
3965
- image: Tn,
3965
+ image: bn,
3966
3966
  in: zi,
3967
3967
  "index-of": Ui,
3968
3968
  interpolate: ki,
@@ -4180,7 +4180,7 @@
4180
4180
  h = typeof e.stops[0][0];
4181
4181
  } else {
4182
4182
  if ("identity" !== a) throw new Error(`Unknown function type "${a}"`);
4183
- s = Tr;
4183
+ s = br;
4184
4184
  }
4185
4185
  if (i) {
4186
4186
  const n = {}, i = [];
@@ -4269,11 +4269,11 @@
4269
4269
  }
4270
4270
  } : h(s, l, a);
4271
4271
  }
4272
- function Tr(e, t, n) {
4272
+ function br(e, t, n) {
4273
4273
  return "color" === t.type ? n = an.parse(n) : "formatted" === t.type ? n = hn.fromString(n.toString()) : "resolvedImage" === t.type ? n = cn.fromString(n.toString()) : pr(n) === t.type || "enum" === t.type && t.values[n] || (n = void 0),
4274
4274
  xr(n, e.default, t.default);
4275
4275
  }
4276
- class br {
4276
+ class Tr {
4277
4277
  constructor(e, t) {
4278
4278
  this.expression = e, this._warningHistory = {}, this._evaluator = new Pn, this._defaultValue = t ? function(e) {
4279
4279
  return "color" === e.type && (gr(e.default) || Array.isArray(e.default)) ? new an(0, 0, 0, 0) : "color" === e.type ? an.parse(e.default) || null : void 0 === e.default ? null : e.default;
@@ -4319,7 +4319,7 @@
4319
4319
  }(t) : void 0), i = n.parse(e, void 0, void 0, void 0, t && "string" === t.type ? {
4320
4320
  typeAnnotation: "coerce"
4321
4321
  } : void 0);
4322
- return i ? ur(new br(i, t)) : fr(n.errors);
4322
+ return i ? ur(new Tr(i, t)) : fr(n.errors);
4323
4323
  }
4324
4324
  class Mr {
4325
4325
  constructor(e, t) {
@@ -4475,7 +4475,7 @@
4475
4475
  return !1;
4476
4476
  }
4477
4477
  const Nr = {
4478
- StyleExpression: br,
4478
+ StyleExpression: Tr,
4479
4479
  isExpression: Sr,
4480
4480
  isExpressionFilter: function e(t) {
4481
4481
  if (!0 === t || !1 === t) return !0;
@@ -5078,7 +5078,7 @@
5078
5078
  }
5079
5079
  getAltitude(e) {
5080
5080
  const {altitudeProperty: t, defaultAltitude: n, altitudeScale: i} = this.options;
5081
- let r = b(e, t, n);
5081
+ let r = T(e, t, n);
5082
5082
  return i && (r *= i), this.maxAltitude = Math.max(this.maxAltitude, Math.abs(r)),
5083
5083
  r;
5084
5084
  }
@@ -5169,7 +5169,7 @@
5169
5169
  }
5170
5170
  return n;
5171
5171
  }
5172
- const To = [ "{", "}" ], bo = "";
5172
+ const bo = [ "{", "}" ], To = "";
5173
5173
  function So(e) {
5174
5174
  return e || "Open Sans Regular";
5175
5175
  }
@@ -5177,11 +5177,11 @@
5177
5177
  function Mo(e, t) {
5178
5178
  if (!et(e)) return e;
5179
5179
  function n(e) {
5180
- if (!t) return bo;
5180
+ if (!t) return To;
5181
5181
  const n = t[e];
5182
- return Ke(n) ? bo : Array.isArray(n) ? n.join() : n;
5182
+ return Ke(n) ? To : Array.isArray(n) ? n.join() : n;
5183
5183
  }
5184
- const [i, r] = To, o = Po(e);
5184
+ const [i, r] = bo, o = Po(e);
5185
5185
  for (let t = 0, a = o.length; t < a; t++) {
5186
5186
  const a = o[t], s = `${i}${a}${r}`;
5187
5187
  if (a.indexOf("|") > 0) {
@@ -5189,24 +5189,24 @@
5189
5189
  let i = !1;
5190
5190
  for (let r = 0; r < t.length; r++) {
5191
5191
  const o = n(t[r]);
5192
- if (o !== bo) {
5192
+ if (o !== To) {
5193
5193
  e = Io(e, s, o), i = !0;
5194
5194
  break;
5195
5195
  }
5196
5196
  }
5197
- i || (e = Io(e, s, bo));
5197
+ i || (e = Io(e, s, To));
5198
5198
  } else e = Io(e, s, n(a));
5199
5199
  }
5200
5200
  return e;
5201
5201
  }
5202
5202
  function Po(e) {
5203
- e += bo;
5204
- const [t, n] = To, i = [];
5205
- let r = !1, o = bo;
5203
+ e += To;
5204
+ const [t, n] = bo, i = [];
5205
+ let r = !1, o = To;
5206
5206
  for (let a = 0, s = e.length; a < s; a++) {
5207
5207
  const s = e[a];
5208
- r || s !== t || (r = !0), s === t && r && (o = bo), r && s !== t && s !== n && (o += s),
5209
- s === n && o && (r = !1, i.push(o), o = bo);
5208
+ r || s !== t || (r = !0), s === t && r && (o = To), r && s !== t && s !== n && (o += s),
5209
+ s === n && o && (r = !1, i.push(o), o = To);
5210
5210
  }
5211
5211
  return i;
5212
5212
  }
@@ -5218,7 +5218,7 @@
5218
5218
  }
5219
5219
  var Co = Object.freeze({
5220
5220
  __proto__: null,
5221
- EMPTY_STRING: bo,
5221
+ EMPTY_STRING: To,
5222
5222
  getSDFFont: So,
5223
5223
  replaceAll: Io,
5224
5224
  resolveExpVarNames: function e(t, n) {
@@ -5619,9 +5619,9 @@
5619
5619
  const o = 24, a = this.textSize[0] / o, f = 24, d = h.textKeepUpright, p = "map" === h.textRotationAlignment && "line" === h.textPlacement && !h.isIconText, g = t.glyphMap[e], m = ea(i ? i(null, u) : h.textHorizontalAlignment, r ? r(null, u) : h.textVerticalAlignment), y = 1.2 * f, x = function(e) {
5620
5620
  for (let t = 0; t < e.length; t++) if (!ko(e.charAt(t).charCodeAt(0))) return !1;
5621
5621
  return !0;
5622
- }(n), _ = x && h.textLetterSpacing / a || 0, v = [ h.textDx / a || 0, h.textDy / a || 0 ], A = ((s ? s(null, u) : h.textWrapWidth) || 10 * f) / a, T = {};
5623
- T.horizontal = Uo(n, g, A, y, m, 0, _, v, f, zo, this.options.isVector3D), x && p && d && (T.vertical = Uo(n, g, A, y, m, 0, _, v, f, Vo)),
5624
- l.textShape = T;
5622
+ }(n), _ = x && h.textLetterSpacing / a || 0, v = [ h.textDx / a || 0, h.textDy / a || 0 ], A = ((s ? s(null, u) : h.textWrapWidth) || 10 * f) / a, b = {};
5623
+ b.horizontal = Uo(n, g, A, y, m, 0, _, v, f, zo, this.options.isVector3D), x && p && d && (b.vertical = Uo(n, g, A, y, m, 0, _, v, f, Vo)),
5624
+ l.textShape = b;
5625
5625
  }
5626
5626
  if (c && c.icon) {
5627
5627
  if (!e || !e.positions[c.icon.url]) return null;
@@ -5646,7 +5646,7 @@
5646
5646
  }
5647
5647
  getIconAndGlyph() {
5648
5648
  if (this.iconGlyph) return this.iconGlyph;
5649
- const {markerFileFn: e, markerTypeFn: t, markerPathFn: n, markerWidthFn: i, markerHeightFn: r, markerFillFn: o, markerFillPatternFileFn: a, markerFillOpacityFn: s, 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 = {}, A = this.symbol, T = this.symbolDef, b = this.feature.properties, S = e ? e(null, b) : A.markerFile, w = t ? t(null, b) : A.markerType, M = S || w || A.markerPath, P = !Ke(this.symbolDef.textName);
5649
+ const {markerFileFn: e, markerTypeFn: t, markerPathFn: n, markerWidthFn: i, markerHeightFn: r, markerFillFn: o, markerFillPatternFileFn: a, markerFillOpacityFn: s, 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 = {}, A = this.symbol, b = this.symbolDef, T = this.feature.properties, S = e ? e(null, T) : A.markerFile, w = t ? t(null, T) : A.markerType, M = S || w || A.markerPath, P = !Ke(this.symbolDef.textName);
5650
5650
  let I, C;
5651
5651
  if (M) {
5652
5652
  I = function(e, t, n, i, r, o) {
@@ -5657,74 +5657,74 @@
5657
5657
  Qe(l) && (l = "identity" === l.type ? r(i, n) : Ao(l)))), Qe(h) && ("identity" !== h.type ? h = Ao(h) : (h = e.markerHeight,
5658
5658
  e[s] && (h = e[s](i, n)), Qe(h) && (h = "identity" === h.type ? o(i, n) : Ao(h)))),
5659
5659
  [ l, h ];
5660
- }(A, this.symbolDef, b, _, i, r) || [ 0, 0 ];
5660
+ }(A, this.symbolDef, T, _, i, r) || [ 0, 0 ];
5661
5661
  let e = A.markerTextFit;
5662
- if (l && (e = l(_, b)), e && T.textName && "none" !== e) {
5663
- const t = T.textSize;
5664
- let n = T.textName;
5665
- ie(n) && (n = re(n)(_, b));
5666
- const i = Mo(n, b);
5662
+ if (l && (e = l(_, T)), e && b.textName && "none" !== e) {
5663
+ const t = b.textSize;
5664
+ let n = b.textName;
5665
+ ie(n) && (n = re(n)(_, T));
5666
+ const i = Mo(n, T);
5667
5667
  if (i) {
5668
5668
  const n = "__fn_textSize".trim(), r = "__fn_textSize_0".trim();
5669
- ie(t) && !T[n] && (T[r] = re(t), T[n] = (e, t) => {
5670
- const n = T[r](e, t);
5669
+ ie(t) && !b[n] && (b[r] = re(t), b[n] = (e, t) => {
5670
+ const n = b[r](e, t);
5671
5671
  return ie(n) ? re(n)(e, t) : n;
5672
5672
  });
5673
- const o = vo(T, T, b, _);
5673
+ const o = vo(b, b, T, _);
5674
5674
  if ("width" !== e && "both" !== e || (I[0] = o[0] * i.length), "height" !== e && "both" !== e || (I[1] = o[1]),
5675
5675
  o[0] && o[1]) {
5676
5676
  let e = A.markerTextFitPadding || [ 0, 0, 0, 0 ];
5677
- h && (e = h(_, b)), I[0] += e[1] + e[3], I[1] += e[0] + e[2];
5677
+ h && (e = h(_, T)), I[0] += e[1] + e[3], I[1] += e[0] + e[2];
5678
5678
  }
5679
5679
  } else I[0] = I[1] = -1;
5680
5680
  }
5681
5681
  }
5682
- if (P && (C = vo(A, this.symbolDef, b, _)), !C && !I) return v;
5682
+ if (P && (C = vo(A, this.symbolDef, T, _)), !C && !I) return v;
5683
5683
  if (I && (I[0] = Math.ceil(I[0]), I[1] = Math.ceil(I[1])), C && (C[0] = Math.ceil(C[0]),
5684
5684
  C[1] = Math.ceil(C[1])), this.iconSize = I, this.textSize = C, M && I[0] >= 0 && I[1] >= 0) {
5685
5685
  let e;
5686
5686
  if (w) {
5687
5687
  const t = {};
5688
- if (t.markerType = w, "path" === w && (t.markerPath = n ? n(null, b) : A.markerPath,
5689
- t.markerPathWidth = g ? g(null, b) : A.markerPathWidth, t.markerPathHeight = m ? m(null, b) : A.markerPathHeight),
5688
+ if (t.markerType = w, "path" === w && (t.markerPath = n ? n(null, T) : A.markerPath,
5689
+ t.markerPathWidth = g ? g(null, T) : A.markerPathWidth, t.markerPathHeight = m ? m(null, T) : A.markerPathHeight),
5690
5690
  i) {
5691
- const e = i(null, b);
5691
+ const e = i(null, T);
5692
5692
  Ke(e) || (t.markerWidth = e);
5693
5693
  } else A.markerWidth >= 0 && (t.markerWidth = A.markerWidth);
5694
5694
  if (r) {
5695
- const e = r(null, b);
5695
+ const e = r(null, T);
5696
5696
  Ke(e) || (t.markerHeight = e);
5697
5697
  } else A.markerHeight >= 0 && (t.markerHeight = A.markerHeight);
5698
5698
  if (o) {
5699
- const e = o(null, b);
5699
+ const e = o(null, T);
5700
5700
  Ke(e) || (t.markerFill = e);
5701
5701
  } else A.markerFill && (t.markerFill = A.markerFill);
5702
5702
  if (a) {
5703
- const e = a(null, b);
5703
+ const e = a(null, T);
5704
5704
  Ke(e) || (t.markerFillPatternFile = e);
5705
5705
  } else A.markerFillPatternFile && (t.markerFillPatternFile = A.markerFillPatternFile);
5706
5706
  if (s) {
5707
- const e = s(null, b);
5707
+ const e = s(null, T);
5708
5708
  Ke(e) || (t.markerFillOpacity = e);
5709
5709
  } else A.markerFillOpacity >= 0 && (t.markerFillOpacity = A.markerFillOpacity);
5710
5710
  if (c) {
5711
- const e = c(null, b);
5711
+ const e = c(null, T);
5712
5712
  Ke(e) || (t.markerLineColor = e);
5713
5713
  } else A.markerLineColor && (t.markerLineColor = A.markerLineColor);
5714
5714
  if (u) {
5715
- const e = u(null, b);
5715
+ const e = u(null, T);
5716
5716
  Ke(e) || (t.markerLineWidth = e);
5717
5717
  } else A.markerLineWidth >= 0 && (t.markerLineWidth = A.markerLineWidth);
5718
5718
  if (f) {
5719
- const e = f(null, b);
5719
+ const e = f(null, T);
5720
5720
  Ke(e) || (t.markerLineOpacity = e);
5721
5721
  } else A.markerLineOpacity >= 0 && (t.markerLineOpacity = A.markerLineOpacity);
5722
5722
  if (d) {
5723
- const e = d(null, b);
5723
+ const e = d(null, T);
5724
5724
  Ke(e) || (t.markerLineDasharray = e);
5725
5725
  } else A.markerLineDasharray && (t.markerLineDasharray = A.markerLineDasharray);
5726
5726
  if (p) {
5727
- const e = p(null, b);
5727
+ const e = p(null, T);
5728
5728
  Ke(e) || (t.markerLinePatternFile = e);
5729
5729
  } else A.markerLinePatternFile && (t.markerLinePatternFile = A.markerLinePatternFile);
5730
5730
  e = "vector://" + JSON.stringify(t);
@@ -5778,10 +5778,10 @@
5778
5778
  };
5779
5779
  }
5780
5780
  if (P) {
5781
- const e = y ? y(this.options.zoom, b) : A.textName;
5781
+ const e = y ? y(this.options.zoom, T) : A.textName;
5782
5782
  if (e || 0 === e) {
5783
- const t = So(x ? x(null, b) : A.textFaceName);
5784
- let n = Mo(e, b);
5783
+ const t = So(x ? x(null, T) : A.textFaceName);
5784
+ let n = Mo(e, T);
5785
5785
  n && n.length && (n = Zo(n), v.glyph = {
5786
5786
  font: t,
5787
5787
  text: n
@@ -5881,10 +5881,10 @@
5881
5881
  const a = e[t], s = e[t + 1], y = a.dist(s), x = s.angleTo(a);
5882
5882
  for (;g + n < p + y; ) {
5883
5883
  g += n;
5884
- const _ = (g - p) / y, v = aa(a.x, s.x, _), A = aa(a.y, s.y, _), T = aa(a.z || 0, s.z || 0, _);
5884
+ const _ = (g - p) / y, v = aa(a.x, s.x, _), A = aa(a.y, s.y, _), b = aa(a.z || 0, s.z || 0, _);
5885
5885
  if (v >= 0 && v < l && A >= 0 && A < l && g - f >= 0 && g + f <= d) {
5886
5886
  const n = new na(v, A, x, t);
5887
- n.z = T, h && (n.axis = [ a.y - A, v - a.x ], n.angleR = T === (a.z || 0) ? 0 : Math.atan(.9 * (T - (a.z || 0)) * c / a.dist(n))),
5887
+ n.z = b, h && (n.axis = [ a.y - A, v - a.x ], n.angleR = b === (a.z || 0) ? 0 : Math.atan(.9 * (b - (a.z || 0)) * c / a.dist(n))),
5888
5888
  n.line = e, n._round(), !i || ia(e, n, o, i, r) ? m.push(n) : i && u++;
5889
5889
  }
5890
5890
  }
@@ -6140,7 +6140,7 @@
6140
6140
  return r.filter((e => e.geometry));
6141
6141
  }
6142
6142
  const Aa = "__index";
6143
- function Ta(e, t, n, i) {
6143
+ function ba(e, t, n, i) {
6144
6144
  const r = (Aa + "").trim(), o = function(e, t, n, i) {
6145
6145
  const r = (Aa + "").trim(), {mergeOnPropertyFn: o} = n;
6146
6146
  if (!t.mergeOnProperty) return [];
@@ -6176,7 +6176,7 @@
6176
6176
  }
6177
6177
  return [];
6178
6178
  }
6179
- class ba extends mo {
6179
+ class Ta extends mo {
6180
6180
  static needMerge(e, t, n) {
6181
6181
  if (!e) return !1;
6182
6182
  let i = "line" === e.textPlacement || "line" === e.markerPlacement;
@@ -6186,13 +6186,13 @@
6186
6186
  static mergeLineFeatures(e, t, n, i) {
6187
6187
  let r = t.textPlacement, o = t.markerPlacement;
6188
6188
  return n.textPlacementFn && (r = n.textPlacementFn(i)), n.markerPlacementFn && (o = n.markerPlacementFn(i)),
6189
- "line" !== r && "line" !== o ? e : Ta(e, t, n, i);
6189
+ "line" !== r && "line" !== o ? e : ba(e, t, n, i);
6190
6190
  }
6191
6191
  static splitPointSymbol(e, t = 0) {
6192
6192
  const n = [];
6193
6193
  if (Array.isArray(e)) {
6194
6194
  const t = e;
6195
- for (let e = 0; e < t.length; e++) t[e] && n.push(...ba.splitPointSymbol(t[e], e));
6195
+ for (let e = 0; e < t.length; e++) t[e] && n.push(...Ta.splitPointSymbol(t[e], e));
6196
6196
  return n;
6197
6197
  }
6198
6198
  let i = null, r = null;
@@ -6348,7 +6348,7 @@
6348
6348
  for (let n = 0; n < e.length; n++) if (Fo(e.charAt(n).charCodeAt(0))) t = 0; else if (t++,
6349
6349
  t >= 1) return !1;
6350
6350
  return !0;
6351
- }(e.getIconAndGlyph().glyph.text) ? 1 : 0, {textFillFn: x, textSizeFn: _, textHaloFillFn: v, textHaloRadiusFn: A, textHaloOpacityFn: T, textDxFn: b, textDyFn: I, textPitchAlignmentFn: C, textRotationAlignmentFn: O, textRotationFn: k, textAllowOverlapFn: R, textIgnorePlacementFn: F, textOpacityFn: E, markerWidthFn: D, markerHeightFn: H, markerDxFn: L, markerDyFn: N, markerPitchAlignmentFn: z, markerRotationAlignmentFn: V, markerRotationFn: U, markerAllowOverlapFn: G, markerIgnorePlacementFn: B, markerOpacityFn: W} = this._fnTypes;
6351
+ }(e.getIconAndGlyph().glyph.text) ? 1 : 0, {textFillFn: x, textSizeFn: _, textHaloFillFn: v, textHaloRadiusFn: A, textHaloOpacityFn: b, textDxFn: T, textDyFn: I, textPitchAlignmentFn: C, textRotationAlignmentFn: O, textRotationFn: k, textAllowOverlapFn: R, textIgnorePlacementFn: F, textOpacityFn: E, markerWidthFn: D, markerHeightFn: H, markerDxFn: L, markerDyFn: N, markerPitchAlignmentFn: z, markerRotationAlignmentFn: V, markerRotationFn: U, markerAllowOverlapFn: G, markerIgnorePlacementFn: B, markerOpacityFn: W} = this._fnTypes;
6352
6352
  let j, X, $, Y, q, Z = [ 0, 0, 0, 0 ], K = 14, J = [ 0, 0, 0, 0 ], Q = 0, ee = 0, te = 0, ne = 0, re = 0, oe = 0, ae = 0, se = 0, le = 0, he = 0, ce = 0, ue = 0, fe = 0, de = 0;
6353
6353
  if (g) {
6354
6354
  const t = e.getIconAndGlyph().glyph.font;
@@ -6359,17 +6359,17 @@
6359
6359
  if (!l) continue;
6360
6360
  const h = l.rect;
6361
6361
  if (!h) continue;
6362
- const c = 4, u = l.metrics.advance / 2, f = l.metrics.height / 2, d = t ? [ s.x + u, 0 ] : [ 0, 0 ], p = t ? [ 0, s.y - f ] : [ s.x + u, s.y - f ], g = l.metrics.left - c - u + p[0], m = l.metrics.top - c + p[1], y = g + h.w, x = m + h.h, _ = new o(g, m), v = new o(y, m), A = new o(g, x), T = new o(y, x);
6362
+ const c = 4, u = l.metrics.advance / 2, f = l.metrics.height / 2, d = t ? [ s.x + u, 0 ] : [ 0, 0 ], p = t ? [ 0, s.y - f ] : [ s.x + u, s.y - f ], g = l.metrics.left - c - u + p[0], m = l.metrics.top - c + p[1], y = g + h.w, x = m + h.h, _ = new o(g, m), v = new o(y, m), A = new o(g, x), b = new o(y, x);
6363
6363
  if (t && s.vertical) {
6364
6364
  const e = new o(-u, u), t = -Math.PI / 2, n = new o(5, 0);
6365
6365
  _._rotateAround(t, e)._add(n), v._rotateAround(t, e)._add(n), A._rotateAround(t, e)._add(n),
6366
- T._rotateAround(t, e)._add(n);
6366
+ b._rotateAround(t, e)._add(n);
6367
6367
  }
6368
6368
  r.push({
6369
6369
  tl: _,
6370
6370
  tr: v,
6371
6371
  bl: A,
6372
- br: T,
6372
+ br: b,
6373
6373
  tex: h,
6374
6374
  writingMode: e.writingMode,
6375
6375
  glyphOffset: d
@@ -6378,7 +6378,7 @@
6378
6378
  return r;
6379
6379
  }(r.horizontal, p, this.glyphAtlas.positions[t]), x && (Z = x(null, d), ie(Z) ? this.dynamicAttrs.aTextFill = 1 : Z = ht([], Z)),
6380
6380
  _ && (K = _(this.options.zoom, d), M(K) && (K = 14)), v && (J = v(null, d), ie(J) ? this.dynamicAttrs.aTextHaloFill = 1 : J = ht([], J)),
6381
- A && (Q = A(null, d)), T && (ee = 255 * T(null, d)), b && (te = b(null, d) || 0),
6381
+ A && (Q = A(null, d)), b && (ee = 255 * b(null, d)), T && (te = T(null, d) || 0),
6382
6382
  I && (ne = I(null, d) || 0), C && (he = +("map" === C(null, d))), O && (ue = +("map" === O(null, d))),
6383
6383
  k && (de = P(k(null, d), 0, 360) * Math.PI / 180);
6384
6384
  }
@@ -6429,7 +6429,7 @@
6429
6429
  E && (pe = 255 * (E(this.options.zoom, d) || 0));
6430
6430
  const ge = $ && $.length || 0;
6431
6431
  this.ensureDataCapacity(4 * (ge + (Y && Y.length || 0)), l.length);
6432
- const me = this.options.EXTENT, {altitudeScale: ye, altitudeProperty: xe, defaultAltitude: _e} = this.options, {altitude: ve} = S(e.feature, ye, xe, _e), Ae = this.needAltitudeAttribute(), Te = (e, t, n, i, r, o, a) => {
6432
+ const me = this.options.EXTENT, {altitudeScale: ye, altitudeProperty: xe, defaultAltitude: _e} = this.options, {altitude: ve} = S(e.feature, ye, xe, _e), Ae = this.needAltitudeAttribute(), be = (e, t, n, i, r, o, a) => {
6433
6433
  if (!t) return;
6434
6434
  const s = e ? ge : 1;
6435
6435
  for (let l = 0; l < t.length; l++) {
@@ -6447,12 +6447,12 @@
6447
6447
  _ = Ae ? Math.max(Math.abs(n), Math.abs(i)) : Math.max(Math.abs(n), Math.abs(i), Math.abs(r)),
6448
6448
  _ > this.maxPos && (this.maxPos = _);
6449
6449
  }
6450
- }, be = "text" === this.options.pluginType;
6450
+ }, Te = "text" === this.options.pluginType;
6451
6451
  for (let e = 0; e < l.length; e++) {
6452
6452
  const t = l[e], n = t.z || ve || 0;
6453
6453
  if (me !== 1 / 0 && w(t, me)) continue;
6454
6454
  const i = t.x, r = t.y;
6455
- m && Te(!1, Y, i, r, n, t), g && (be || Te(!0, $, i, r, n, t, !0), Te(!0, $, i, r, n, t, !1));
6455
+ m && be(!1, Y, i, r, n, t), g && (Te || be(!0, $, i, r, n, t, !0), be(!0, $, i, r, n, t, !1));
6456
6456
  }
6457
6457
  }
6458
6458
  _fillPos(e, t, n, i, r, o, a, s, l, h) {
@@ -6477,13 +6477,13 @@
6477
6477
  }
6478
6478
  }
6479
6479
  _fillFnTypeData(e, t, n, i, r, o, a, s, l, h, c, u, f, d, p, g, m, y, x, _, v, A) {
6480
- const {textFillFn: T, textSizeFn: b, textHaloFillFn: S, textHaloRadiusFn: w, textDxFn: P, textDyFn: I, textPitchAlignmentFn: C, textRotationAlignmentFn: O, textRotationFn: k, textAllowOverlapFn: R, textIgnorePlacementFn: F, textOpacityFn: E, textHaloOpacityFn: D, markerWidthFn: H, markerHeightFn: L, markerDxFn: N, markerDyFn: z, markerPitchAlignmentFn: V, markerRotationAlignmentFn: U, markerRotationFn: G, markerAllowOverlapFn: B, markerIgnorePlacementFn: W, markerOpacityFn: j} = this._fnTypes;
6481
- if (T) {
6480
+ const {textFillFn: b, textSizeFn: T, textHaloFillFn: S, textHaloRadiusFn: w, textDxFn: P, textDyFn: I, textPitchAlignmentFn: C, textRotationAlignmentFn: O, textRotationFn: k, textAllowOverlapFn: R, textIgnorePlacementFn: F, textOpacityFn: E, textHaloOpacityFn: D, markerWidthFn: H, markerHeightFn: L, markerDxFn: N, markerDyFn: z, markerPitchAlignmentFn: V, markerRotationAlignmentFn: U, markerRotationFn: G, markerAllowOverlapFn: B, markerIgnorePlacementFn: W, markerOpacityFn: j} = this._fnTypes;
6481
+ if (b) {
6482
6482
  let n = e.aTextFill.currentIndex;
6483
6483
  e.aTextFill[n++] = t[0], e.aTextFill[n++] = t[1], e.aTextFill[n++] = t[2], e.aTextFill[n++] = t[3],
6484
6484
  e.aTextFill.currentIndex = n;
6485
6485
  }
6486
- if (b) {
6486
+ if (T) {
6487
6487
  let t = e.aTextSize.currentIndex;
6488
6488
  e.aTextSize[t++] = n, e.aTextSize.currentIndex = t;
6489
6489
  }
@@ -6714,7 +6714,7 @@
6714
6714
  const Fa = 63, Ea = Math.cos(Math.PI / 180 * 37.5), Da = Math.pow(2, 16) / 1, Ha = new o, La = new o, Na = new o;
6715
6715
  class za extends mo {
6716
6716
  static mergeLineFeatures(e, t, n, i) {
6717
- return Ta(e, t, n, i);
6717
+ return ba(e, t, n, i);
6718
6718
  }
6719
6719
  constructor(e, t, n) {
6720
6720
  super(e, t, n);
@@ -6909,8 +6909,8 @@
6909
6909
  y = y || x, d.currentNormal = y;
6910
6910
  let l = y.add(x);
6911
6911
  0 === l.x && 0 === l.y || l._unit();
6912
- const _ = y.x * x.x + y.y * x.y, v = l.x * x.x + l.y * x.y, A = 0 !== v ? 1 / v : 1 / 0, T = 2 * Math.sqrt(2 - 2 * v), b = v < Ea && g && m, S = y.x * x.y - y.y * x.x > 0;
6913
- if (!s && b && t > u) {
6912
+ const _ = y.x * x.x + y.y * x.y, v = l.x * x.x + l.y * x.y, A = 0 !== v ? 1 / v : 1 / 0, b = 2 * Math.sqrt(2 - 2 * v), T = v < Ea && g && m, S = y.x * x.y - y.y * x.x > 0;
6913
+ if (!s && T && t > u) {
6914
6914
  const e = p.dist(g);
6915
6915
  if (e > 2 * f) {
6916
6916
  const t = p.sub(p.sub(g)._mult(f / e)._round());
@@ -6933,7 +6933,7 @@
6933
6933
  } else if ("bevel" === M || "fakeround" === M) {
6934
6934
  const e = -Math.sqrt(A * A - 1), t = S ? e : 0, n = S ? 0 : e;
6935
6935
  if (g && this.addCurrentVertex(p, y, t, n, d), "fakeround" === M) {
6936
- const e = Math.round(180 * T / Math.PI / 20);
6936
+ const e = Math.round(180 * b / Math.PI / 20);
6937
6937
  for (let t = 1; t < e; t++) {
6938
6938
  let n = t / e;
6939
6939
  if (.5 !== n) {
@@ -6950,7 +6950,7 @@
6950
6950
  this.addCurrentVertex(p, l, e, e, d);
6951
6951
  } else "round" === M && (g && (this.addCurrentVertex(p, y, 0, 0, d), this.addCurrentVertex(p, y, 1, 1, d, !0)),
6952
6952
  m && (this.addCurrentVertex(p, x, -1, -1, d, !0), this.addCurrentVertex(p, x, 0, 0, d)));
6953
- if (!s && b && t < c - 1) {
6953
+ if (!s && T && t < c - 1) {
6954
6954
  const e = p.dist(m);
6955
6955
  if (e > 2 * f) {
6956
6956
  const t = p.add(m.sub(p)._mult(f / e)._round());
@@ -7147,7 +7147,7 @@
7147
7147
  t || (t = e);
7148
7148
  let n, i = e;
7149
7149
  do {
7150
- if (n = !1, i.steiner || !Ss(i, i.next) && 0 !== bs(i.prev, i, i.next)) i = i.next; else {
7150
+ if (n = !1, i.steiner || !Ss(i, i.next) && 0 !== Ts(i.prev, i, i.next)) i = i.next; else {
7151
7151
  if (ks(i), i = t = i.prev, i === i.next) break;
7152
7152
  n = !0;
7153
7153
  }
@@ -7193,31 +7193,31 @@
7193
7193
  }
7194
7194
  function us(e) {
7195
7195
  const t = e.prev, n = e, i = e.next;
7196
- if (bs(t, n, i) >= 0) return !1;
7196
+ if (Ts(t, n, i) >= 0) return !1;
7197
7197
  const r = t.x, o = n.x, a = i.x, s = t.y, l = n.y, h = i.y, c = Math.min(r, o, a), u = Math.min(s, l, h), f = Math.max(r, o, a), d = Math.max(s, l, h);
7198
7198
  let p = i.next;
7199
7199
  for (;p !== t; ) {
7200
- if (p.x >= c && p.x <= f && p.y >= u && p.y <= d && As(r, s, o, l, a, h, p.x, p.y) && bs(p.prev, p, p.next) >= 0) return !1;
7200
+ if (p.x >= c && p.x <= f && p.y >= u && p.y <= d && As(r, s, o, l, a, h, p.x, p.y) && Ts(p.prev, p, p.next) >= 0) return !1;
7201
7201
  p = p.next;
7202
7202
  }
7203
7203
  return !0;
7204
7204
  }
7205
7205
  function fs(e, t, n, i) {
7206
7206
  const r = e.prev, o = e, a = e.next;
7207
- if (bs(r, o, a) >= 0) return !1;
7207
+ if (Ts(r, o, a) >= 0) return !1;
7208
7208
  const s = r.x, l = o.x, h = a.x, c = r.y, u = o.y, f = a.y, d = Math.min(s, l, h), p = Math.min(c, u, f), g = Math.max(s, l, h), m = Math.max(c, u, f), y = xs(d, p, t, n, i), x = xs(g, m, t, n, i);
7209
7209
  let _ = e.prevZ, v = e.nextZ;
7210
7210
  for (;_ && _.z >= y && v && v.z <= x; ) {
7211
- if (_.x >= d && _.x <= g && _.y >= p && _.y <= m && _ !== r && _ !== a && As(s, c, l, u, h, f, _.x, _.y) && bs(_.prev, _, _.next) >= 0) return !1;
7212
- if (_ = _.prevZ, v.x >= d && v.x <= g && v.y >= p && v.y <= m && v !== r && v !== a && As(s, c, l, u, h, f, v.x, v.y) && bs(v.prev, v, v.next) >= 0) return !1;
7211
+ if (_.x >= d && _.x <= g && _.y >= p && _.y <= m && _ !== r && _ !== a && As(s, c, l, u, h, f, _.x, _.y) && Ts(_.prev, _, _.next) >= 0) return !1;
7212
+ if (_ = _.prevZ, v.x >= d && v.x <= g && v.y >= p && v.y <= m && v !== r && v !== a && As(s, c, l, u, h, f, v.x, v.y) && Ts(v.prev, v, v.next) >= 0) return !1;
7213
7213
  v = v.nextZ;
7214
7214
  }
7215
7215
  for (;_ && _.z >= y; ) {
7216
- if (_.x >= d && _.x <= g && _.y >= p && _.y <= m && _ !== r && _ !== a && As(s, c, l, u, h, f, _.x, _.y) && bs(_.prev, _, _.next) >= 0) return !1;
7216
+ if (_.x >= d && _.x <= g && _.y >= p && _.y <= m && _ !== r && _ !== a && As(s, c, l, u, h, f, _.x, _.y) && Ts(_.prev, _, _.next) >= 0) return !1;
7217
7217
  _ = _.prevZ;
7218
7218
  }
7219
7219
  for (;v && v.z <= x; ) {
7220
- if (v.x >= d && v.x <= g && v.y >= p && v.y <= m && v !== r && v !== a && As(s, c, l, u, h, f, v.x, v.y) && bs(v.prev, v, v.next) >= 0) return !1;
7220
+ if (v.x >= d && v.x <= g && v.y >= p && v.y <= m && v !== r && v !== a && As(s, c, l, u, h, f, v.x, v.y) && Ts(v.prev, v, v.next) >= 0) return !1;
7221
7221
  v = v.nextZ;
7222
7222
  }
7223
7223
  return !0;
@@ -7236,7 +7236,7 @@
7236
7236
  do {
7237
7237
  let e = a.next.next;
7238
7238
  for (;e !== a.prev; ) {
7239
- if (a.i !== e.i && Ts(a, e)) {
7239
+ if (a.i !== e.i && bs(a, e)) {
7240
7240
  let s = Cs(a, e);
7241
7241
  return a = hs(a, a.next), s = hs(s, s.next), cs(a, t, n, i, r, o, 0), void cs(s, t, n, i, r, o, 0);
7242
7242
  }
@@ -7283,7 +7283,7 @@
7283
7283
  return hs(i, i.next), hs(n, n.next);
7284
7284
  }
7285
7285
  function ys(e, t) {
7286
- return bs(e.prev, e, t.prev) < 0 && bs(t.next, e, e.next) < 0;
7286
+ return Ts(e.prev, e, t.prev) < 0 && Ts(t.next, e, e.next) < 0;
7287
7287
  }
7288
7288
  function xs(e, t, n, i, r) {
7289
7289
  return (e = 1431655765 & ((e = 858993459 & ((e = 252645135 & ((e = 16711935 & ((e = (e - n) * r | 0) | e << 8)) | e << 4)) | e << 2)) | e << 1)) | (t = 1431655765 & ((t = 858993459 & ((t = 252645135 & ((t = 16711935 & ((t = (t - i) * r | 0) | t << 8)) | t << 4)) | t << 2)) | t << 1)) << 1;
@@ -7301,7 +7301,7 @@
7301
7301
  function As(e, t, n, i, r, o, a, s) {
7302
7302
  return !(e === a && t === s) && vs(e, t, n, i, r, o, a, s);
7303
7303
  }
7304
- function Ts(e, t) {
7304
+ function bs(e, t) {
7305
7305
  return e.next.i !== t.i && e.prev.i !== t.i && !function(e, t) {
7306
7306
  let n = e;
7307
7307
  do {
@@ -7317,16 +7317,16 @@
7317
7317
  n = n.next;
7318
7318
  } while (n !== e);
7319
7319
  return i;
7320
- }(e, t) && (bs(e.prev, e, t.prev) || bs(e, t.prev, t)) || Ss(e, t) && bs(e.prev, e, e.next) > 0 && bs(t.prev, t, t.next) > 0);
7320
+ }(e, t) && (Ts(e.prev, e, t.prev) || Ts(e, t.prev, t)) || Ss(e, t) && Ts(e.prev, e, e.next) > 0 && Ts(t.prev, t, t.next) > 0);
7321
7321
  }
7322
- function bs(e, t, n) {
7322
+ function Ts(e, t, n) {
7323
7323
  return (t.y - e.y) * (n.x - t.x) - (t.x - e.x) * (n.y - t.y);
7324
7324
  }
7325
7325
  function Ss(e, t) {
7326
7326
  return e.x === t.x && e.y === t.y;
7327
7327
  }
7328
7328
  function ws(e, t, n, i) {
7329
- const r = Ps(bs(e, t, n)), o = Ps(bs(e, t, i)), a = Ps(bs(n, i, e)), s = Ps(bs(n, i, t));
7329
+ const r = Ps(Ts(e, t, n)), o = Ps(Ts(e, t, i)), a = Ps(Ts(n, i, e)), s = Ps(Ts(n, i, t));
7330
7330
  return r !== o && a !== s || !(0 !== r || !Ms(e, n, t)) || !(0 !== o || !Ms(e, i, t)) || !(0 !== a || !Ms(n, e, i)) || !(0 !== s || !Ms(n, t, i));
7331
7331
  }
7332
7332
  function Ms(e, t, n) {
@@ -7336,7 +7336,7 @@
7336
7336
  return e > 0 ? 1 : e < 0 ? -1 : 0;
7337
7337
  }
7338
7338
  function Is(e, t) {
7339
- return bs(e.prev, e, e.next) < 0 ? bs(e, t, e.next) >= 0 && bs(e, e.prev, t) >= 0 : bs(e, t, e.prev) < 0 || bs(e, e.next, t) < 0;
7339
+ return Ts(e.prev, e, e.next) < 0 ? Ts(e, t, e.next) >= 0 && Ts(e, e.prev, t) >= 0 : Ts(e, t, e.prev) < 0 || Ts(e, e.next, t) < 0;
7340
7340
  }
7341
7341
  function Cs(e, t) {
7342
7342
  const n = Rs(e.i, e.x, e.y), i = Rs(t.i, t.x, t.y), r = e.next, o = t.prev;
@@ -7605,8 +7605,421 @@
7605
7605
  }
7606
7606
  return r;
7607
7607
  };
7608
- let rl = 0;
7609
- function ol(e) {
7608
+ var rl = {
7609
+ /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
7610
+ read: function(e, t, n, i, r) {
7611
+ var o, a, s = 8 * r - i - 1, l = (1 << s) - 1, h = l >> 1, c = -7, u = n ? r - 1 : 0, f = n ? -1 : 1, d = e[t + u];
7612
+ for (u += f, o = d & (1 << -c) - 1, d >>= -c, c += s; c > 0; o = 256 * o + e[t + u],
7613
+ u += f, c -= 8) ;
7614
+ for (a = o & (1 << -c) - 1, o >>= -c, c += i; c > 0; a = 256 * a + e[t + u], u += f,
7615
+ c -= 8) ;
7616
+ if (0 === o) o = 1 - h; else {
7617
+ if (o === l) return a ? NaN : 1 / 0 * (d ? -1 : 1);
7618
+ a += Math.pow(2, i), o -= h;
7619
+ }
7620
+ return (d ? -1 : 1) * a * Math.pow(2, o - i);
7621
+ },
7622
+ write: function(e, t, n, i, r, o) {
7623
+ var a, s, l, h = 8 * o - r - 1, c = (1 << h) - 1, u = c >> 1, f = 23 === r ? Math.pow(2, -24) - Math.pow(2, -77) : 0, d = i ? 0 : o - 1, p = i ? 1 : -1, g = t < 0 || 0 === t && 1 / t < 0 ? 1 : 0;
7624
+ for (t = Math.abs(t), isNaN(t) || t === 1 / 0 ? (s = isNaN(t) ? 1 : 0, a = c) : (a = Math.floor(Math.log(t) / Math.LN2),
7625
+ t * (l = Math.pow(2, -a)) < 1 && (a--, l *= 2), (t += a + u >= 1 ? f / l : f * Math.pow(2, 1 - u)) * l >= 2 && (a++,
7626
+ l /= 2), a + u >= c ? (s = 0, a = c) : a + u >= 1 ? (s = (t * l - 1) * Math.pow(2, r),
7627
+ a += u) : (s = t * Math.pow(2, u - 1) * Math.pow(2, r), a = 0)); r >= 8; e[n + d] = 255 & s,
7628
+ d += p, s /= 256, r -= 8) ;
7629
+ for (a = a << r | s, h += r; h > 0; e[n + d] = 255 & a, d += p, a /= 256, h -= 8) ;
7630
+ e[n + d - p] |= 128 * g;
7631
+ }
7632
+ }, ol = sl, al = rl;
7633
+ function sl(e) {
7634
+ this.buf = ArrayBuffer.isView && ArrayBuffer.isView(e) ? e : new Uint8Array(e || 0),
7635
+ this.pos = 0, this.type = 0, this.length = this.buf.length;
7636
+ }
7637
+ sl.Varint = 0, sl.Fixed64 = 1, sl.Bytes = 2, sl.Fixed32 = 5;
7638
+ var ll = 4294967296, hl = 1 / ll, cl = "undefined" == typeof TextDecoder ? null : new TextDecoder("utf8");
7639
+ function ul(e) {
7640
+ return e.type === sl.Bytes ? e.readVarint() + e.pos : e.pos + 1;
7641
+ }
7642
+ function fl(e, t, n) {
7643
+ return n ? 4294967296 * t + (e >>> 0) : 4294967296 * (t >>> 0) + (e >>> 0);
7644
+ }
7645
+ function dl(e, t, n) {
7646
+ var i = t <= 16383 ? 1 : t <= 2097151 ? 2 : t <= 268435455 ? 3 : Math.floor(Math.log(t) / (7 * Math.LN2));
7647
+ n.realloc(i);
7648
+ for (var r = n.pos - 1; r >= e; r--) n.buf[r + i] = n.buf[r];
7649
+ }
7650
+ function pl(e, t) {
7651
+ for (var n = 0; n < e.length; n++) t.writeVarint(e[n]);
7652
+ }
7653
+ function gl(e, t) {
7654
+ for (var n = 0; n < e.length; n++) t.writeSVarint(e[n]);
7655
+ }
7656
+ function ml(e, t) {
7657
+ for (var n = 0; n < e.length; n++) t.writeFloat(e[n]);
7658
+ }
7659
+ function yl(e, t) {
7660
+ for (var n = 0; n < e.length; n++) t.writeDouble(e[n]);
7661
+ }
7662
+ function xl(e, t) {
7663
+ for (var n = 0; n < e.length; n++) t.writeBoolean(e[n]);
7664
+ }
7665
+ function _l(e, t) {
7666
+ for (var n = 0; n < e.length; n++) t.writeFixed32(e[n]);
7667
+ }
7668
+ function vl(e, t) {
7669
+ for (var n = 0; n < e.length; n++) t.writeSFixed32(e[n]);
7670
+ }
7671
+ function Al(e, t) {
7672
+ for (var n = 0; n < e.length; n++) t.writeFixed64(e[n]);
7673
+ }
7674
+ function bl(e, t) {
7675
+ for (var n = 0; n < e.length; n++) t.writeSFixed64(e[n]);
7676
+ }
7677
+ function Tl(e, t) {
7678
+ return (e[t] | e[t + 1] << 8 | e[t + 2] << 16) + 16777216 * e[t + 3];
7679
+ }
7680
+ function Sl(e, t, n) {
7681
+ e[n] = t, e[n + 1] = t >>> 8, e[n + 2] = t >>> 16, e[n + 3] = t >>> 24;
7682
+ }
7683
+ function wl(e, t) {
7684
+ return (e[t] | e[t + 1] << 8 | e[t + 2] << 16) + (e[t + 3] << 24);
7685
+ }
7686
+ sl.prototype = {
7687
+ destroy: function() {
7688
+ this.buf = null;
7689
+ },
7690
+ readFields: function(e, t, n) {
7691
+ for (n = n || this.length; this.pos < n; ) {
7692
+ var i = this.readVarint(), r = i >> 3, o = this.pos;
7693
+ this.type = 7 & i, e(r, t, this), this.pos === o && this.skip(i);
7694
+ }
7695
+ return t;
7696
+ },
7697
+ readMessage: function(e, t) {
7698
+ return this.readFields(e, t, this.readVarint() + this.pos);
7699
+ },
7700
+ readFixed32: function() {
7701
+ var e = Tl(this.buf, this.pos);
7702
+ return this.pos += 4, e;
7703
+ },
7704
+ readSFixed32: function() {
7705
+ var e = wl(this.buf, this.pos);
7706
+ return this.pos += 4, e;
7707
+ },
7708
+ readFixed64: function() {
7709
+ var e = Tl(this.buf, this.pos) + Tl(this.buf, this.pos + 4) * ll;
7710
+ return this.pos += 8, e;
7711
+ },
7712
+ readSFixed64: function() {
7713
+ var e = Tl(this.buf, this.pos) + wl(this.buf, this.pos + 4) * ll;
7714
+ return this.pos += 8, e;
7715
+ },
7716
+ readFloat: function() {
7717
+ var e = al.read(this.buf, this.pos, !0, 23, 4);
7718
+ return this.pos += 4, e;
7719
+ },
7720
+ readDouble: function() {
7721
+ var e = al.read(this.buf, this.pos, !0, 52, 8);
7722
+ return this.pos += 8, e;
7723
+ },
7724
+ readVarint: function(e) {
7725
+ var t, n, i = this.buf;
7726
+ return t = 127 & (n = i[this.pos++]), n < 128 ? t : (t |= (127 & (n = i[this.pos++])) << 7,
7727
+ n < 128 ? t : (t |= (127 & (n = i[this.pos++])) << 14, n < 128 ? t : (t |= (127 & (n = i[this.pos++])) << 21,
7728
+ n < 128 ? t : function(e, t, n) {
7729
+ var i, r, o = n.buf;
7730
+ if (i = (112 & (r = o[n.pos++])) >> 4, r < 128) return fl(e, i, t);
7731
+ if (i |= (127 & (r = o[n.pos++])) << 3, r < 128) return fl(e, i, t);
7732
+ if (i |= (127 & (r = o[n.pos++])) << 10, r < 128) return fl(e, i, t);
7733
+ if (i |= (127 & (r = o[n.pos++])) << 17, r < 128) return fl(e, i, t);
7734
+ if (i |= (127 & (r = o[n.pos++])) << 24, r < 128) return fl(e, i, t);
7735
+ if (i |= (1 & (r = o[n.pos++])) << 31, r < 128) return fl(e, i, t);
7736
+ throw new Error("Expected varint not more than 10 bytes");
7737
+ }(t |= (15 & (n = i[this.pos])) << 28, e, this))));
7738
+ },
7739
+ readVarint64: function() {
7740
+ return this.readVarint(!0);
7741
+ },
7742
+ readSVarint: function() {
7743
+ var e = this.readVarint();
7744
+ return e % 2 == 1 ? (e + 1) / -2 : e / 2;
7745
+ },
7746
+ readBoolean: function() {
7747
+ return Boolean(this.readVarint());
7748
+ },
7749
+ readString: function() {
7750
+ var e = this.readVarint() + this.pos, t = this.pos;
7751
+ return this.pos = e, e - t >= 12 && cl ? function(e, t, n) {
7752
+ return cl.decode(e.subarray(t, n));
7753
+ }(this.buf, t, e) : function(e, t, n) {
7754
+ for (var i = "", r = t; r < n; ) {
7755
+ var o, a, s, l = e[r], h = null, c = l > 239 ? 4 : l > 223 ? 3 : l > 191 ? 2 : 1;
7756
+ if (r + c > n) break;
7757
+ 1 === c ? l < 128 && (h = l) : 2 === c ? 128 == (192 & (o = e[r + 1])) && (h = (31 & l) << 6 | 63 & o) <= 127 && (h = null) : 3 === c ? (o = e[r + 1],
7758
+ a = e[r + 2], 128 == (192 & o) && 128 == (192 & a) && ((h = (15 & l) << 12 | (63 & o) << 6 | 63 & a) <= 2047 || h >= 55296 && h <= 57343) && (h = null)) : 4 === c && (o = e[r + 1],
7759
+ a = e[r + 2], s = e[r + 3], 128 == (192 & o) && 128 == (192 & a) && 128 == (192 & s) && ((h = (15 & l) << 18 | (63 & o) << 12 | (63 & a) << 6 | 63 & s) <= 65535 || h >= 1114112) && (h = null)),
7760
+ null === h ? (h = 65533, c = 1) : h > 65535 && (h -= 65536, i += String.fromCharCode(h >>> 10 & 1023 | 55296),
7761
+ h = 56320 | 1023 & h), i += String.fromCharCode(h), r += c;
7762
+ }
7763
+ return i;
7764
+ }(this.buf, t, e);
7765
+ },
7766
+ readBytes: function() {
7767
+ var e = this.readVarint() + this.pos, t = this.buf.subarray(this.pos, e);
7768
+ return this.pos = e, t;
7769
+ },
7770
+ readPackedVarint: function(e, t) {
7771
+ if (this.type !== sl.Bytes) return e.push(this.readVarint(t));
7772
+ var n = ul(this);
7773
+ for (e = e || []; this.pos < n; ) e.push(this.readVarint(t));
7774
+ return e;
7775
+ },
7776
+ readPackedSVarint: function(e) {
7777
+ if (this.type !== sl.Bytes) return e.push(this.readSVarint());
7778
+ var t = ul(this);
7779
+ for (e = e || []; this.pos < t; ) e.push(this.readSVarint());
7780
+ return e;
7781
+ },
7782
+ readPackedBoolean: function(e) {
7783
+ if (this.type !== sl.Bytes) return e.push(this.readBoolean());
7784
+ var t = ul(this);
7785
+ for (e = e || []; this.pos < t; ) e.push(this.readBoolean());
7786
+ return e;
7787
+ },
7788
+ readPackedFloat: function(e) {
7789
+ if (this.type !== sl.Bytes) return e.push(this.readFloat());
7790
+ var t = ul(this);
7791
+ for (e = e || []; this.pos < t; ) e.push(this.readFloat());
7792
+ return e;
7793
+ },
7794
+ readPackedDouble: function(e) {
7795
+ if (this.type !== sl.Bytes) return e.push(this.readDouble());
7796
+ var t = ul(this);
7797
+ for (e = e || []; this.pos < t; ) e.push(this.readDouble());
7798
+ return e;
7799
+ },
7800
+ readPackedFixed32: function(e) {
7801
+ if (this.type !== sl.Bytes) return e.push(this.readFixed32());
7802
+ var t = ul(this);
7803
+ for (e = e || []; this.pos < t; ) e.push(this.readFixed32());
7804
+ return e;
7805
+ },
7806
+ readPackedSFixed32: function(e) {
7807
+ if (this.type !== sl.Bytes) return e.push(this.readSFixed32());
7808
+ var t = ul(this);
7809
+ for (e = e || []; this.pos < t; ) e.push(this.readSFixed32());
7810
+ return e;
7811
+ },
7812
+ readPackedFixed64: function(e) {
7813
+ if (this.type !== sl.Bytes) return e.push(this.readFixed64());
7814
+ var t = ul(this);
7815
+ for (e = e || []; this.pos < t; ) e.push(this.readFixed64());
7816
+ return e;
7817
+ },
7818
+ readPackedSFixed64: function(e) {
7819
+ if (this.type !== sl.Bytes) return e.push(this.readSFixed64());
7820
+ var t = ul(this);
7821
+ for (e = e || []; this.pos < t; ) e.push(this.readSFixed64());
7822
+ return e;
7823
+ },
7824
+ skip: function(e) {
7825
+ var t = 7 & e;
7826
+ if (t === sl.Varint) for (;this.buf[this.pos++] > 127; ) ; else if (t === sl.Bytes) this.pos = this.readVarint() + this.pos; else if (t === sl.Fixed32) this.pos += 4; else {
7827
+ if (t !== sl.Fixed64) throw new Error("Unimplemented type: " + t);
7828
+ this.pos += 8;
7829
+ }
7830
+ },
7831
+ writeTag: function(e, t) {
7832
+ this.writeVarint(e << 3 | t);
7833
+ },
7834
+ realloc: function(e) {
7835
+ for (var t = this.length || 16; t < this.pos + e; ) t *= 2;
7836
+ if (t !== this.length) {
7837
+ var n = new Uint8Array(t);
7838
+ n.set(this.buf), this.buf = n, this.length = t;
7839
+ }
7840
+ },
7841
+ finish: function() {
7842
+ return this.length = this.pos, this.pos = 0, this.buf.subarray(0, this.length);
7843
+ },
7844
+ writeFixed32: function(e) {
7845
+ this.realloc(4), Sl(this.buf, e, this.pos), this.pos += 4;
7846
+ },
7847
+ writeSFixed32: function(e) {
7848
+ this.realloc(4), Sl(this.buf, e, this.pos), this.pos += 4;
7849
+ },
7850
+ writeFixed64: function(e) {
7851
+ this.realloc(8), Sl(this.buf, -1 & e, this.pos), Sl(this.buf, Math.floor(e * hl), this.pos + 4),
7852
+ this.pos += 8;
7853
+ },
7854
+ writeSFixed64: function(e) {
7855
+ this.realloc(8), Sl(this.buf, -1 & e, this.pos), Sl(this.buf, Math.floor(e * hl), this.pos + 4),
7856
+ this.pos += 8;
7857
+ },
7858
+ writeVarint: function(e) {
7859
+ (e = +e || 0) > 268435455 || e < 0 ? function(e, t) {
7860
+ var n, i;
7861
+ if (e >= 0 ? (n = e % 4294967296 | 0, i = e / 4294967296 | 0) : (i = ~(-e / 4294967296),
7862
+ 4294967295 ^ (n = ~(-e % 4294967296)) ? n = n + 1 | 0 : (n = 0, i = i + 1 | 0)),
7863
+ e >= 0x10000000000000000 || e < -0x10000000000000000) throw new Error("Given varint doesn't fit into 10 bytes");
7864
+ t.realloc(10), function(e, t, n) {
7865
+ n.buf[n.pos++] = 127 & e | 128, e >>>= 7, n.buf[n.pos++] = 127 & e | 128, e >>>= 7,
7866
+ n.buf[n.pos++] = 127 & e | 128, e >>>= 7, n.buf[n.pos++] = 127 & e | 128, e >>>= 7,
7867
+ n.buf[n.pos] = 127 & e;
7868
+ }(n, 0, t), function(e, t) {
7869
+ var n = (7 & e) << 4;
7870
+ t.buf[t.pos++] |= n | ((e >>>= 3) ? 128 : 0), e && (t.buf[t.pos++] = 127 & e | ((e >>>= 7) ? 128 : 0),
7871
+ e && (t.buf[t.pos++] = 127 & e | ((e >>>= 7) ? 128 : 0), e && (t.buf[t.pos++] = 127 & e | ((e >>>= 7) ? 128 : 0),
7872
+ e && (t.buf[t.pos++] = 127 & e | ((e >>>= 7) ? 128 : 0), e && (t.buf[t.pos++] = 127 & e)))));
7873
+ }(i, t);
7874
+ }(e, this) : (this.realloc(4), this.buf[this.pos++] = 127 & e | (e > 127 ? 128 : 0),
7875
+ e <= 127 || (this.buf[this.pos++] = 127 & (e >>>= 7) | (e > 127 ? 128 : 0), e <= 127 || (this.buf[this.pos++] = 127 & (e >>>= 7) | (e > 127 ? 128 : 0),
7876
+ e <= 127 || (this.buf[this.pos++] = e >>> 7 & 127))));
7877
+ },
7878
+ writeSVarint: function(e) {
7879
+ this.writeVarint(e < 0 ? 2 * -e - 1 : 2 * e);
7880
+ },
7881
+ writeBoolean: function(e) {
7882
+ this.writeVarint(Boolean(e));
7883
+ },
7884
+ writeString: function(e) {
7885
+ e = String(e), this.realloc(4 * e.length), this.pos++;
7886
+ var t = this.pos;
7887
+ this.pos = function(e, t, n) {
7888
+ for (var i, r, o = 0; o < t.length; o++) {
7889
+ if ((i = t.charCodeAt(o)) > 55295 && i < 57344) {
7890
+ if (!r) {
7891
+ i > 56319 || o + 1 === t.length ? (e[n++] = 239, e[n++] = 191, e[n++] = 189) : r = i;
7892
+ continue;
7893
+ }
7894
+ if (i < 56320) {
7895
+ e[n++] = 239, e[n++] = 191, e[n++] = 189, r = i;
7896
+ continue;
7897
+ }
7898
+ i = r - 55296 << 10 | i - 56320 | 65536, r = null;
7899
+ } else r && (e[n++] = 239, e[n++] = 191, e[n++] = 189, r = null);
7900
+ i < 128 ? e[n++] = i : (i < 2048 ? e[n++] = i >> 6 | 192 : (i < 65536 ? e[n++] = i >> 12 | 224 : (e[n++] = i >> 18 | 240,
7901
+ e[n++] = i >> 12 & 63 | 128), e[n++] = i >> 6 & 63 | 128), e[n++] = 63 & i | 128);
7902
+ }
7903
+ return n;
7904
+ }(this.buf, e, this.pos);
7905
+ var n = this.pos - t;
7906
+ n >= 128 && dl(t, n, this), this.pos = t - 1, this.writeVarint(n), this.pos += n;
7907
+ },
7908
+ writeFloat: function(e) {
7909
+ this.realloc(4), al.write(this.buf, e, this.pos, !0, 23, 4), this.pos += 4;
7910
+ },
7911
+ writeDouble: function(e) {
7912
+ this.realloc(8), al.write(this.buf, e, this.pos, !0, 52, 8), this.pos += 8;
7913
+ },
7914
+ writeBytes: function(e) {
7915
+ var t = e.length;
7916
+ this.writeVarint(t), this.realloc(t);
7917
+ for (var n = 0; n < t; n++) this.buf[this.pos++] = e[n];
7918
+ },
7919
+ writeRawMessage: function(e, t) {
7920
+ this.pos++;
7921
+ var n = this.pos;
7922
+ e(t, this);
7923
+ var i = this.pos - n;
7924
+ i >= 128 && dl(n, i, this), this.pos = n - 1, this.writeVarint(i), this.pos += i;
7925
+ },
7926
+ writeMessage: function(e, t, n) {
7927
+ this.writeTag(e, sl.Bytes), this.writeRawMessage(t, n);
7928
+ },
7929
+ writePackedVarint: function(e, t) {
7930
+ t.length && this.writeMessage(e, pl, t);
7931
+ },
7932
+ writePackedSVarint: function(e, t) {
7933
+ t.length && this.writeMessage(e, gl, t);
7934
+ },
7935
+ writePackedBoolean: function(e, t) {
7936
+ t.length && this.writeMessage(e, xl, t);
7937
+ },
7938
+ writePackedFloat: function(e, t) {
7939
+ t.length && this.writeMessage(e, ml, t);
7940
+ },
7941
+ writePackedDouble: function(e, t) {
7942
+ t.length && this.writeMessage(e, yl, t);
7943
+ },
7944
+ writePackedFixed32: function(e, t) {
7945
+ t.length && this.writeMessage(e, _l, t);
7946
+ },
7947
+ writePackedSFixed32: function(e, t) {
7948
+ t.length && this.writeMessage(e, vl, t);
7949
+ },
7950
+ writePackedFixed64: function(e, t) {
7951
+ t.length && this.writeMessage(e, Al, t);
7952
+ },
7953
+ writePackedSFixed64: function(e, t) {
7954
+ t.length && this.writeMessage(e, bl, t);
7955
+ },
7956
+ writeBytesField: function(e, t) {
7957
+ this.writeTag(e, sl.Bytes), this.writeBytes(t);
7958
+ },
7959
+ writeFixed32Field: function(e, t) {
7960
+ this.writeTag(e, sl.Fixed32), this.writeFixed32(t);
7961
+ },
7962
+ writeSFixed32Field: function(e, t) {
7963
+ this.writeTag(e, sl.Fixed32), this.writeSFixed32(t);
7964
+ },
7965
+ writeFixed64Field: function(e, t) {
7966
+ this.writeTag(e, sl.Fixed64), this.writeFixed64(t);
7967
+ },
7968
+ writeSFixed64Field: function(e, t) {
7969
+ this.writeTag(e, sl.Fixed64), this.writeSFixed64(t);
7970
+ },
7971
+ writeVarintField: function(e, t) {
7972
+ this.writeTag(e, sl.Varint), this.writeVarint(t);
7973
+ },
7974
+ writeSVarintField: function(e, t) {
7975
+ this.writeTag(e, sl.Varint), this.writeSVarint(t);
7976
+ },
7977
+ writeStringField: function(e, t) {
7978
+ this.writeTag(e, sl.Bytes), this.writeString(t);
7979
+ },
7980
+ writeFloatField: function(e, t) {
7981
+ this.writeTag(e, sl.Fixed32), this.writeFloat(t);
7982
+ },
7983
+ writeDoubleField: function(e, t) {
7984
+ this.writeTag(e, sl.Fixed64), this.writeDouble(t);
7985
+ },
7986
+ writeBooleanField: function(e, t) {
7987
+ this.writeVarintField(e, Boolean(t));
7988
+ }
7989
+ };
7990
+ var Ml = n(ol);
7991
+ const Pl = 3;
7992
+ function Il(e, t, n) {
7993
+ 1 === e && (t.glyphs = Object.create(null), n.readMessage(Cl, t));
7994
+ }
7995
+ function Cl(e, t, n) {
7996
+ if (3 === e) {
7997
+ const e = n.readMessage(Ol, {}), i = Pl;
7998
+ e.width = e.width || 0, e.height = e.height || 0, e.left = e.left || 0, e.top = e.top || 0,
7999
+ e.advance = e.advance || 0;
8000
+ const r = e.width + 2 * i, o = e.height + 2 * i;
8001
+ t.glyphs[e.id] = {
8002
+ charCode: e.id,
8003
+ bitmap: {
8004
+ width: r,
8005
+ height: o,
8006
+ data: new Uint8ClampedArray(e.bitmap || new ArrayBuffer(r * o))
8007
+ },
8008
+ metrics: {
8009
+ width: e.width,
8010
+ height: e.height,
8011
+ left: 1,
8012
+ top: -2,
8013
+ advance: e.advance
8014
+ }
8015
+ };
8016
+ } else 4 === e ? t.ascender = n.readSVarint() : 5 === e && (t.descender = n.readSVarint());
8017
+ }
8018
+ function Ol(e, t, n) {
8019
+ 1 === e ? t.id = n.readVarint() : 2 === e ? t.bitmap = n.readBytes() : 3 === e ? t.width = n.readVarint() : 4 === e ? t.height = n.readVarint() : 5 === e ? t.left = n.readSVarint() : 6 === e ? t.top = n.readSVarint() : 7 === e && (t.advance = n.readVarint());
8020
+ }
8021
+ let kl = 0;
8022
+ function Rl(e) {
7610
8023
  const t = {
7611
8024
  width: e.bitmap.width,
7612
8025
  height: e.bitmap.height,
@@ -7618,7 +8031,7 @@
7618
8031
  metrics: Ze({}, e.metrics)
7619
8032
  };
7620
8033
  }
7621
- var al = Object.freeze({
8034
+ var Fl = Object.freeze({
7622
8035
  __proto__: null,
7623
8036
  calculateSignedArea: A,
7624
8037
  clipPolygon: Ds,
@@ -7635,8 +8048,8 @@
7635
8048
  return e[0] = r, e[1] = o, e[2] = Math.sign(i + 1e-5) * (2 * a + s) * mt + i, e;
7636
8049
  }
7637
8050
  });
7638
- const sl = {}, ll = {}, hl = [];
7639
- var cl = Object.freeze({
8051
+ const El = {}, Dl = {}, Hl = [];
8052
+ var Ll = Object.freeze({
7640
8053
  __proto__: null,
7641
8054
  loadSymbolFnTypes: function e(t, n) {
7642
8055
  if (!t) return null;
@@ -7669,7 +8082,7 @@
7669
8082
  const i = n()[0];
7670
8083
  h.zoom = i;
7671
8084
  try {
7672
- return this["__fn_" + e].evaluateWithoutErrorHandling(h, sl, ll, null, hl);
8085
+ return this["__fn_" + e].evaluateWithoutErrorHandling(h, El, Dl, null, Hl);
7673
8086
  } catch (e) {
7674
8087
  return null;
7675
8088
  }
@@ -7692,7 +8105,7 @@
7692
8105
  return i ? a : t;
7693
8106
  }
7694
8107
  });
7695
- const ul = {
8108
+ const Nl = {
7696
8109
  polygonPatternFile: 1,
7697
8110
  markerFile: 1,
7698
8111
  markerPlacement: 1,
@@ -7704,18 +8117,18 @@
7704
8117
  lineJoin: 1,
7705
8118
  lineCap: 1,
7706
8119
  linePatternFile: 1
7707
- }, fl = {
8120
+ }, zl = {
7708
8121
  textHorizontalAlignment: 1,
7709
8122
  textVerticalAlignment: 1,
7710
8123
  textWrapWidth: 1,
7711
8124
  markerHorizontalAlignment: 1,
7712
8125
  markerVerticalAlignment: 1
7713
- }, dl = {
8126
+ }, Vl = {
7714
8127
  lineDasharray: 1,
7715
8128
  topPolygonFill: 1,
7716
8129
  bottomPolygonFill: 1
7717
8130
  };
7718
- Object.assign(fl, ul), Object.assign(dl, ul), e.ArrayPool = oo, e.CirclePack = class extends mo {
8131
+ Object.assign(zl, Nl), Object.assign(Vl, Nl), e.ArrayPool = oo, e.CirclePack = class extends mo {
7719
8132
  getFormat() {
7720
8133
  return Vs;
7721
8134
  }
@@ -7740,15 +8153,12 @@
7740
8153
  _getPlacement(e, t) {
7741
8154
  return this._fnTypes.markerPlacementFn ? this._fnTypes.markerPlacementFn(this.options.zoom, e.feature.properties) : t.markerPlacement;
7742
8155
  }
7743
- }, e.DEFAULT_TEX_WIDTH = 23.25, e.FilterUtil = Jr, e.FuncTypeUtil = cl, e.GlyphAtlas = F,
8156
+ }, e.DEFAULT_TEX_WIDTH = 23.25, e.FilterUtil = Jr, e.FuncTypeUtil = Ll, e.GlyphAtlas = F,
7744
8157
  e.GlyphRequestor = class {
7745
8158
  constructor(e, t = 15, n, i) {
7746
8159
  this.entries = {}, this._cachedFont = {}, this._cache = new Qs(2048, (function() {})),
7747
8160
  this._framer = e, this._limit = t, this._isCompactChars = n, this._sdfURL = i;
7748
8161
  }
7749
- _isValidSDFURL(e) {
7750
- return e && e.indexOf("{stack}") >= 0 && e.indexOf("{range}") > 0;
7751
- }
7752
8162
  getGlyphs(e, t) {
7753
8163
  if (!e || !Object.keys(e).length) return void t(null, {
7754
8164
  glyphs: null
@@ -7766,7 +8176,7 @@
7766
8176
  const e = r && !Fo(+c), u = t + ":" + c + ":" + e;
7767
8177
  let f;
7768
8178
  if (this._cache.has(u) ? f = this._cache.get(u) : (f = this._tinySDF(n[t], t, c, e),
7769
- this._cache.add(u, f), l++), f = ol(f), o[t][c] = f, s.push(f.bitmap.data.buffer),
8179
+ this._cache.add(u, f), l++), f = Rl(f), o[t][c] = f, s.push(f.bitmap.data.buffer),
7770
8180
  this._framer && l > this._limit) return void this._framer(a(h, o, s));
7771
8181
  }
7772
8182
  }
@@ -7783,15 +8193,78 @@
7783
8193
  o(0, {}, []);
7784
8194
  }
7785
8195
  _requestRemoteSDF(e, t) {
7786
- const n = [];
7787
- for (const t in e) for (const i of e[t]) n.push(this._requestGlyph(t, i));
7788
- Promise.all(n).then((e => {
7789
- t(null, e);
8196
+ const n = {}, i = [];
8197
+ let r = 0, o = !1;
8198
+ const a = e => {
8199
+ o || (o = !0, t(e, e ? null : {
8200
+ glyphs: n,
8201
+ buffers: i
8202
+ }));
8203
+ };
8204
+ for (const t in e) {
8205
+ if ("options" === t) continue;
8206
+ n[t] = {};
8207
+ const s = this._getFontEntry(t), l = this._groupByRange(e[t]);
8208
+ for (const [e, h] of l) {
8209
+ const l = [];
8210
+ for (const e of h) {
8211
+ const t = s.glyphs[e];
8212
+ t && t.bitmap && t.bitmap.data || l.push(e);
8213
+ }
8214
+ if (0 === l.length) for (const e of h) {
8215
+ const r = s.glyphs[e];
8216
+ if (r && r.bitmap && r.bitmap.data) {
8217
+ r.metrics || (r.metrics = {
8218
+ width: 0,
8219
+ height: 0,
8220
+ left: 0,
8221
+ top: 0,
8222
+ advance: 0
8223
+ });
8224
+ const o = Rl(r);
8225
+ n[t][e] = o, i.push(o.bitmap.data.buffer);
8226
+ }
8227
+ } else r++, this._loadGlyphRange(t, e, ((e, s) => {
8228
+ if (!o) if (e) a(e); else {
8229
+ for (const e of h) {
8230
+ const r = s[e];
8231
+ if (!r || !r.bitmap || !r.bitmap.data) continue;
8232
+ r.metrics || (r.metrics = {
8233
+ width: 0,
8234
+ height: 0,
8235
+ left: 0,
8236
+ top: 0,
8237
+ advance: 0
8238
+ });
8239
+ const o = Rl(r);
8240
+ n[t][e] = o, i.push(o.bitmap.data.buffer);
8241
+ }
8242
+ 0 == --r && a();
8243
+ }
8244
+ }));
8245
+ }
8246
+ }
8247
+ 0 === r && a();
8248
+ }
8249
+ _loadGlyphRange(e, t, n) {
8250
+ const i = this._getFontEntry(e);
8251
+ if (i.ranges[t]) return void n(null, i.glyphs);
8252
+ if (i.requests[t]) return void i.requests[t].push(n);
8253
+ i.requests[t] = [ n ];
8254
+ const r = `${t}-${t + 255}`;
8255
+ let o = this._sdfURL.replace("{fontstack}", e).replace("{stack}", e).replace("{range}", r);
8256
+ fetch(o).then((e => {
8257
+ if (!e.ok) throw new Error(`HTTP ${e.status}`);
8258
+ return e.arrayBuffer();
8259
+ })).then((e => {
8260
+ const n = new Ml(new Uint8Array(e)).readFields(Il, {});
8261
+ i.ascender = n.ascender, i.descender = n.descender;
8262
+ for (const e in n.glyphs) i.glyphs[+e] = n.glyphs[e];
8263
+ i.ranges[t] = !0, this._flushCallbacks(i, t, null);
8264
+ })).catch((e => {
8265
+ this._flushCallbacks(i, t, e);
7790
8266
  }));
7791
8267
  }
7792
- _requestGlyph() {
7793
- return Promise.resolve(null);
7794
- }
7795
8268
  _tinySDF(e, t, n, i) {
7796
8269
  const r = t;
7797
8270
  let o = e.tinySDF;
@@ -7802,8 +8275,8 @@
7802
8275
  o = e.tinySDF = new tl(24, 2, 8, .25, r, t);
7803
8276
  }
7804
8277
  const s = String.fromCodePoint(n), l = o.ctx.measureText(s), h = Math.round(l.width), c = o.draw(s, h + 4, 28);
7805
- if (rl < 4) {
7806
- const e = "undefined" != typeof document && document.getElementById("sdf-debug-" + rl++);
8278
+ if (kl < 4) {
8279
+ const e = "undefined" != typeof document && document.getElementById("sdf-debug-" + kl++);
7807
8280
  e && (e.width = h + 4, e.height = o.canvas.height, e.getContext("2d").drawImage(o.canvas, 0, 0));
7808
8281
  }
7809
8282
  return {
@@ -7822,6 +8295,31 @@
7822
8295
  }
7823
8296
  };
7824
8297
  }
8298
+ _getFontEntry(e) {
8299
+ return this.entries[e] = this.entries[e] || {
8300
+ glyphs: {},
8301
+ requests: {},
8302
+ ranges: {},
8303
+ ascender: void 0,
8304
+ descender: void 0,
8305
+ tinySDF: null
8306
+ };
8307
+ }
8308
+ _groupByRange(e) {
8309
+ const t = new Map;
8310
+ for (const n in e) {
8311
+ const e = 256 * Math.floor(n / 256);
8312
+ (t.get(e) || t.set(e, []).get(e)).push(+n);
8313
+ }
8314
+ return t;
8315
+ }
8316
+ _flushCallbacks(e, t, n) {
8317
+ const i = e.requests[t];
8318
+ delete e.requests[t], i.forEach((t => t(n, e.glyphs)));
8319
+ }
8320
+ _isValidSDFURL(e) {
8321
+ return e && (e.includes("{fontstack}") || e.includes("{stack}")) && e.includes("{range}");
8322
+ }
7825
8323
  }, e.INVALID_TEX_COORD = zs, e.IconAtlas = k, e.LRUCache = Qs, e.LineExtrusionPack = class extends za {
7826
8324
  constructor(e, t, n) {
7827
8325
  super(e, t, n), this._hasALineHeight = n.altitudeProperty;
@@ -8056,7 +8554,7 @@
8056
8554
  }
8057
8555
  _filterPolygonEdges(e) {
8058
8556
  const t = this.options.EXTENT, n = this.elements, i = n.getLength();
8059
- for (let r = 0; r < i; r += 2) if (!T(this.data.aPosition, n[r], n[r + 1], 3, t)) {
8557
+ for (let r = 0; r < i; r += 2) if (!b(this.data.aPosition, n[r], n[r + 1], 3, t)) {
8060
8558
  let t = e.currentIndex;
8061
8559
  e[t++] = n[r], e[t++] = n[r + 1], e.currentIndex = t;
8062
8560
  }
@@ -8119,7 +8617,7 @@
8119
8617
  hasElements() {
8120
8618
  return !1;
8121
8619
  }
8122
- }, e.PackUtil = al, e.PointPack = ba, e.PolygonPack = class extends mo {
8620
+ }, e.PackUtil = Fl, e.PointPack = Ta, e.PolygonPack = class extends mo {
8123
8621
  constructor(...e) {
8124
8622
  super(...e), this.lineElements = [];
8125
8623
  }
@@ -8183,15 +8681,15 @@
8183
8681
  }
8184
8682
  let y, x = 0;
8185
8683
  u && (y = u(this.options.zoom, f));
8186
- const _ = this.needAltitudeAttribute() ? 2 : 3, v = [ -1, -1, t.extent + 1, t.extent + 1 ], A = this._flattened = this._flattened || this._arrayPool.getProxy(), T = this._holeIndices = this._holeIndices || this._arrayPool.getProxy();
8684
+ const _ = this.needAltitudeAttribute() ? 2 : 3, v = [ -1, -1, t.extent + 1, t.extent + 1 ], A = this._flattened = this._flattened || this._arrayPool.getProxy(), b = this._holeIndices = this._holeIndices || this._arrayPool.getProxy();
8187
8685
  for (let e = 0; e < p.length; e++) {
8188
8686
  const t = p[e], a = this.data.aPosition.getLength() / _;
8189
- A.setLength(0), T.setLength(0);
8687
+ A.setLength(0), b.setLength(0);
8190
8688
  for (let e = 0; e < t.length; e++) {
8191
8689
  let a = t[e];
8192
8690
  if (this.options.EXTENT !== 1 / 0 && 0 === this.maxPosZ && 0 === this.minPosZ && (a = Ds(a, v)),
8193
8691
  0 === a.length) continue;
8194
- 0 !== e && T.push(A.length / 3), this.ensureDataCapacity(a.length);
8692
+ 0 !== e && b.push(A.length / 3), this.ensureDataCapacity(a.length);
8195
8693
  const s = this.data;
8196
8694
  for (let e = 0; e < a.length; e++) {
8197
8695
  const t = a[e].x, l = a[e].y, h = a[e].z || 0;
@@ -8229,13 +8727,13 @@
8229
8727
  c > this.maxPos && (this.maxPos = c), f > this.maxPos && (this.maxPos = f), A.push(t, l, h);
8230
8728
  }
8231
8729
  }
8232
- let s = ss(A, T, 3);
8730
+ let s = ss(A, b, 3);
8233
8731
  if (A.length && !s.length) {
8234
8732
  const e = [];
8235
8733
  for (let t = 0; t < A.length; t += 3) e[t] = A[t], e[t + 1] = A[t + 2], e[t + 2] = A[t + 1];
8236
- if (s = ss(e, T, 3), !s.length) {
8734
+ if (s = ss(e, b, 3), !s.length) {
8237
8735
  for (let t = 0; t < A.length; t += 3) e[t] = A[t + 1], e[t + 1] = A[t + 2], e[t + 2] = A[t];
8238
- s = ss(e, T, 3);
8736
+ s = ss(e, b, 3);
8239
8737
  }
8240
8738
  }
8241
8739
  for (let e = 0; e < s.length; e += 3) this.addElements(a + s[e], a + s[e + 1], a + s[e + 2]);
@@ -8244,8 +8742,8 @@
8244
8742
  ensureDataCapacity(e) {
8245
8743
  super.ensureDataCapacity(1, e);
8246
8744
  }
8247
- }, e.RGBAImage = v, e.RoundTubePack = Us, e.SYMBOLS_NEED_REBUILD_IN_VECTOR = dl,
8248
- e.SYMBOLS_NEED_REBUILD_IN_VT = fl, e.SquareTubePack = class extends Us {
8745
+ }, e.RGBAImage = v, e.RoundTubePack = Us, e.SYMBOLS_NEED_REBUILD_IN_VECTOR = Vl,
8746
+ e.SYMBOLS_NEED_REBUILD_IN_VT = zl, e.SquareTubePack = class extends Us {
8249
8747
  addHalfVertex(e, t, n, i, r, o, a, s) {
8250
8748
  const {x: l, y: h, z: c} = e, u = 1 * this.scaledDistance, {x: f, y: d, z: p} = a.dir, g = Js(this.feaLineWidth, this.feaLineHeight, f, d, p, t, n, r);
8251
8749
  this.prevVertex && this.fillTubeElements(r), this.fillData(this.data, l, h, c || 0, g, r, u, s);
@@ -8447,8 +8945,8 @@
8447
8945
  whitesmoke: [ 245, 245, 245 ],
8448
8946
  yellow: [ 255, 255, 0 ],
8449
8947
  yellowgreen: [ 154, 205, 50 ]
8450
- }, A = _, T = Object.hasOwnProperty, b = Object.create(null);
8451
- for (var S in v) T.call(v, S) && (b[v[S]] = S);
8948
+ }, A = _, b = Object.hasOwnProperty, T = Object.create(null);
8949
+ for (var S in v) b.call(v, S) && (T[v[S]] = S);
8452
8950
  var w = d.exports = {
8453
8951
  to: {},
8454
8952
  get: {}
@@ -8494,7 +8992,7 @@
8494
8992
  for (n = 0; n < 3; n++) r[n] = parseInt(t[n + 1], 0);
8495
8993
  t[4] && (t[5] ? r[3] = .01 * parseFloat(t[4]) : r[3] = parseFloat(t[4]));
8496
8994
  } else {
8497
- if (!(t = e.match(/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/))) return (t = e.match(/^(\w+)$/)) ? "transparent" === t[1] ? [ 0, 0, 0, 0 ] : T.call(v, t[1]) ? ((r = v[t[1]])[3] = 1,
8995
+ if (!(t = e.match(/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/))) return (t = e.match(/^(\w+)$/)) ? "transparent" === t[1] ? [ 0, 0, 0, 0 ] : b.call(v, t[1]) ? ((r = v[t[1]])[3] = 1,
8498
8996
  r) : null : null;
8499
8997
  for (n = 0; n < 3; n++) r[n] = Math.round(2.55 * parseFloat(t[n + 1]));
8500
8998
  t[4] && (t[5] ? r[3] = .01 * parseFloat(t[4]) : r[3] = parseFloat(t[4]));
@@ -8533,7 +9031,7 @@
8533
9031
  var e = A(arguments), t = "";
8534
9032
  return e.length >= 4 && 1 !== e[3] && (t = ", " + e[3]), "hwb(" + e[0] + ", " + e[1] + "%, " + e[2] + "%" + t + ")";
8535
9033
  }, w.to.keyword = function(e) {
8536
- return b[e.slice(0, 3)];
9034
+ return T[e.slice(0, 3)];
8537
9035
  };
8538
9036
  var I = d.exports, C = {
8539
9037
  exports: {}
@@ -9361,9 +9859,9 @@
9361
9859
  var n, i, r;
9362
9860
  if (Me(e)) {
9363
9861
  var o, a = e.stops && "object" == typeof e.stops[0][0], s = a || pe(e.property), l = a || !s, h = e.type || t || "exponential";
9364
- if ("exponential" === h) o = _e; else if ("interval" === h) o = xe; else if ("categorical" === h) o = ye; else if ("identity" === h) o = Te; else if ("color-interpolate" === h) o = Ae; else {
9862
+ if ("exponential" === h) o = _e; else if ("interval" === h) o = xe; else if ("categorical" === h) o = ye; else if ("identity" === h) o = be; else if ("color-interpolate" === h) o = Ae; else {
9365
9863
  if ("calculate-expression" !== h) throw new Error('Unknown function type "' + h + '"');
9366
- o = be;
9864
+ o = Te;
9367
9865
  }
9368
9866
  if (a) {
9369
9867
  var c = {}, u = [];
@@ -9431,11 +9929,11 @@
9431
9929
  }
9432
9930
  return n && 1 === n.length ? n[0][1] : null;
9433
9931
  }
9434
- function Te(e, t) {
9932
+ function be(e, t) {
9435
9933
  return n = t, i = e.default, pe(n) ? n : pe(i) ? i : pe(r) ? r : null;
9436
9934
  var n, i, r;
9437
9935
  }
9438
- function be(e, t) {
9936
+ function Te(e, t) {
9439
9937
  const n = String(e.property), i = e.expression, r = t;
9440
9938
  function o(t) {
9441
9939
  return de(t) || ge(t) || isNaN(t) ? e.default : t;
@@ -9825,15 +10323,15 @@
9825
10323
  continue;
9826
10324
  }
9827
10325
  if ("error" === c) continue;
9828
- let m, y = s;
9829
- if (0 === s.indexOf("vector://") && (m = JSON.parse(s.substring(9)), "path" === m.markerType && (y = t.Util.getMarkerPathBase64(m, m.markerWidth, m.markerHeight))),
9830
- 0 === s.indexOf("vector://") && "path" !== m.markerType) {
10326
+ let y, x = s;
10327
+ if (0 === s.indexOf("vector://") && (y = JSON.parse(s.substring(9)), "path" === y.markerType && (x = t.Util.getMarkerPathBase64(y, y.markerWidth, y.markerHeight))),
10328
+ x = t.formatResourceUrl(x), 0 === s.indexOf("vector://") && "path" !== y.markerType) {
9831
10329
  p = p || new t.Marker([ 0, 0 ]);
9832
- const {markerFill: e, markerLineColor: n} = m;
9833
- e && Array.isArray(e) && (m.markerFill = Ke(e)), n && Array.isArray(n) && (m.markerLineColor = Ke(n)),
9834
- delete m.markerHorizontalAlignment, delete m.markerVerticalAlignment, delete m.markerDx,
9835
- delete m.markerDy, delete m.markerPlacement, delete m.markerFile, m.markerWidth = l[0],
9836
- m.markerHeight = l[1], p.setSymbol(m);
10330
+ const {markerFill: e, markerLineColor: n} = y;
10331
+ e && Array.isArray(e) && (y.markerFill = Ke(e)), n && Array.isArray(n) && (y.markerLineColor = Ke(n)),
10332
+ delete y.markerHorizontalAlignment, delete y.markerVerticalAlignment, delete y.markerDx,
10333
+ delete y.markerDy, delete y.markerPlacement, delete y.markerFile, y.markerWidth = l[0],
10334
+ y.markerHeight = l[1], p.setSymbol(y);
9837
10335
  const i = p["_getSprite".trim()]();
9838
10336
  if (i) {
9839
10337
  const e = i.canvas, t = e.width, n = e.height, a = e.getContext("2d", {
@@ -9854,11 +10352,24 @@
9854
10352
  continue;
9855
10353
  }
9856
10354
  this._requesting[s] = [], this._requesting[s].push(h);
9857
- const e = new Image;
9858
- e.index = n, e.size = l, e.onload = u, e.onerror = f, e.onabort = f, e.url = s,
9859
- e.crossOrigin = "Anonymous", g = !0, a++, e.src = d && d(y) || y;
10355
+ const e = e => {
10356
+ e.index = n, e.size = l, e.url = s, e.crossOrigin = "Anonymous";
10357
+ };
10358
+ if ((m = x) && t.Browser.decodeImageInWorker && m instanceof ImageBitmap) createImageBitmap(x).then((t => {
10359
+ e(t), u.call(t);
10360
+ })).catch((e => {
10361
+ f.call({
10362
+ index: n,
10363
+ url: s
10364
+ }, e);
10365
+ })); else {
10366
+ const t = new Image;
10367
+ e(t), t.onload = u, t.onerror = f, t.onabort = f, t.src = d && d(x) || x;
10368
+ }
10369
+ g = !0, a++;
9860
10370
  }
9861
10371
  }
10372
+ var m;
9862
10373
  g || n(null, {
9863
10374
  icons: r,
9864
10375
  buffers: o
@@ -9924,10 +10435,10 @@
9924
10435
  return n && n(e) || e;
9925
10436
  }
9926
10437
  });
9927
- const r = !t.getRenderer().isEnableWorkAround("win-intel-gpu-crash");
10438
+ const r = !t.getRenderer().isEnableWorkAround("win-intel-gpu-crash"), o = t.options.sdfURL;
9928
10439
  this._glyphRequestor = new Je((e => {
9929
10440
  t.getMap().getRenderer().callInNextFrame(e);
9930
- }), t.options.glyphSdfLimitPerFrame, r);
10441
+ }), t.options.glyphSdfLimitPerFrame, r, o);
9931
10442
  }
9932
10443
  initialize(e) {
9933
10444
  e(null);
@@ -10286,10 +10797,10 @@
10286
10797
  }
10287
10798
  return e;
10288
10799
  }
10289
- function Tt(e, t, n) {
10800
+ function bt(e, t, n) {
10290
10801
  return Math.min(n, Math.max(t, e));
10291
10802
  }
10292
- function bt(e, t, n) {
10803
+ function Tt(e, t, n) {
10293
10804
  if (e === n || e === t) return e;
10294
10805
  const i = n - t;
10295
10806
  return ((e - t) % i + i) % i + t;
@@ -12412,7 +12923,7 @@
12412
12923
  * BSD License
12413
12924
  * https://github.com/gdsmith/jquery.easing/
12414
12925
  */
12415
- var yn = Math.pow, xn = Math.sqrt, _n = Math.sin, vn = Math.cos, An = Math.PI, Tn = 1.70158, bn = 1.525 * Tn, Sn = Tn + 1, wn = 2 * An / 3, Mn = 2 * An / 4.5;
12926
+ var yn = Math.pow, xn = Math.sqrt, _n = Math.sin, vn = Math.cos, An = Math.PI, bn = 1.70158, Tn = 1.525 * bn, Sn = bn + 1, wn = 2 * An / 3, Mn = 2 * An / 4.5;
12416
12927
  function Pn(e) {
12417
12928
  var t = 7.5625, n = 2.75;
12418
12929
  return e < 1 / n ? t * e * e : e < 2 / n ? t * (e -= 1.5 / n) * e + .75 : e < 2.5 / n ? t * (e -= 2.25 / n) * e + .9375 : t * (e -= 2.625 / n) * e + .984375;
@@ -12544,17 +13055,17 @@
12544
13055
 
12545
13056
  case "easeinback":
12546
13057
  return function(e) {
12547
- return Sn * e * e * e - Tn * e * e;
13058
+ return Sn * e * e * e - bn * e * e;
12548
13059
  }(t);
12549
13060
 
12550
13061
  case "easeoutback":
12551
13062
  return function(e) {
12552
- return 1 + Sn * yn(e - 1, 3) + Tn * yn(e - 1, 2);
13063
+ return 1 + Sn * yn(e - 1, 3) + bn * yn(e - 1, 2);
12553
13064
  }(t);
12554
13065
 
12555
13066
  case "easeinoutback":
12556
13067
  return function(e) {
12557
- return e < .5 ? yn(2 * e, 2) * (2 * (bn + 1) * e - bn) / 2 : (yn(2 * e - 2, 2) * ((bn + 1) * (2 * e - 2) + bn) + 2) / 2;
13068
+ return e < .5 ? yn(2 * e, 2) * (2 * (Tn + 1) * e - Tn) / 2 : (yn(2 * e - 2, 2) * ((Tn + 1) * (2 * e - 2) + Tn) + 2) / 2;
12558
13069
  }(t);
12559
13070
 
12560
13071
  case "easeinbounce":
@@ -13262,7 +13773,7 @@
13262
13773
  function Ai(e, t, i, r, o, a, s, l) {
13263
13774
  const {res: h, extent: c, extent2d: u} = i.properties.tile, {xmin: f, ymax: d} = u, p = f + r.x * o, g = d - r.y * o;
13264
13775
  let m = null;
13265
- if (l) for (let e = 0; e < l.length; e++) if (Ti(l[e], p, g, h)) {
13776
+ if (l) for (let e = 0; e < l.length; e++) if (bi(l[e], p, g, h)) {
13266
13777
  m = l[e];
13267
13778
  break;
13268
13779
  }
@@ -13274,11 +13785,11 @@
13274
13785
  }
13275
13786
  return e[0] = r.x, e[1] = r.y, e;
13276
13787
  }
13277
- function Ti(e, t, n, i) {
13788
+ function bi(e, t, n, i) {
13278
13789
  const r = _i.set(t, n)._multi(i / e.res);
13279
13790
  return e.extent2d.contains(r);
13280
13791
  }
13281
- const {SYMBOLS_NEED_REBUILD_IN_VT: bi, StyleUtil: Si, FuncTypeUtil: wi} = h(), {loginIBLResOnCanvas: Mi, logoutIBLResOnCanvas: Pi, getIBLResOnCanvas: Ii} = n.reshader.pbr.PBRUtils, Ci = "__gl_textures", Oi = [], ki = new r.Point(0, 0), Ri = new r.Point(0, 0), Fi = new Float32Array(1), Ei = [], Di = e => 0 === e.properties.level, Hi = e => e.properties.level > 0;
13792
+ const {SYMBOLS_NEED_REBUILD_IN_VT: Ti, StyleUtil: Si, FuncTypeUtil: wi} = h(), {loginIBLResOnCanvas: Mi, logoutIBLResOnCanvas: Pi, getIBLResOnCanvas: Ii} = n.reshader.pbr.PBRUtils, Ci = "__gl_textures", Oi = [], ki = new r.Point(0, 0), Ri = new r.Point(0, 0), Fi = new Float32Array(1), Ei = [], Di = e => 0 === e.properties.level, Hi = e => e.properties.level > 0;
13282
13793
  class Li {
13283
13794
  static getBloomSymbol() {
13284
13795
  return [ "bloom" ];
@@ -13643,7 +14154,7 @@
13643
14154
  _isNeedRefreshStyle(e, t) {
13644
14155
  for (const n in t) if (Et(t, n)) {
13645
14156
  if (Si.isFnTypeSymbol(t[n]) && !this.layer.options.features && (!e[n] || e[n].property !== t[n].property)) return !0;
13646
- if (bi[n] && !ae(t[n], e[n])) return !0;
14157
+ if (Ti[n] && !ae(t[n], e[n])) return !0;
13647
14158
  }
13648
14159
  return !1;
13649
14160
  }
@@ -13947,7 +14458,7 @@
13947
14458
  }
13948
14459
  const v = performance.now();
13949
14460
  n.terrainQueryStatus[c] = x;
13950
- const {xmin: A, ymax: T} = l, b = ki.set(A, T), S = this.layer.getTileSize().width / n.extent, w = t.length / e.length;
14461
+ const {xmin: A, ymax: b} = l, T = ki.set(A, b), S = this.layer.getTileSize().width / n.extent, w = t.length / e.length;
13951
14462
  let M = e.queryResult;
13952
14463
  M || (M = e.queryResult = new Map);
13953
14464
  let P = !0;
@@ -13959,11 +14470,11 @@
13959
14470
  const o = i + r * s;
13960
14471
  let l, h, c = M.get(o);
13961
14472
  if (c || 0 === c) e[n] !== c && (e[n] = c, e.dirty = !0); else {
13962
- for (let e = 0; e < m.length; e++) if (Ti(m[e], A + S * i, T - S * r, a)) {
14473
+ for (let e = 0; e < m.length; e++) if (bi(m[e], A + S * i, b - S * r, a)) {
13963
14474
  l = m[e];
13964
14475
  break;
13965
14476
  }
13966
- l && (g.getRenderer().isTileCached(l.id) || e[n] === ut) && (Ri.set(i, r), h = this.layer.queryTilePointTerrain(Ri, l, b, s, a)),
14477
+ l && (g.getRenderer().isTileCached(l.id) || e[n] === ut) && (Ri.set(i, r), h = this.layer.queryTilePointTerrain(Ri, l, T, s, a)),
13967
14478
  c = e[n], h && (c = null === h[0] ? ut : h[0], Fi[0] = c, c = Fi[0]), e[n] !== c && (e[n] = c,
13968
14479
  e.dirty = !0), h && h[1] ? M.set(o, c) : P = !1;
13969
14480
  }
@@ -14208,13 +14719,13 @@
14208
14719
  const v = new n.reshader.Material(g, rr), A = new n.reshader.Mesh(s, v, {
14209
14720
  castShadow: !1,
14210
14721
  picking: !0
14211
- }), T = {};
14212
- return x && s.data.aTexInfo && (T.HAS_PATTERN = 1), x && s.data.aTexCoord && (T.HAS_TEX_COORD = 1,
14213
- T.INVALID_TEX_COORD = nr + ".0"), s.data.aAltitude && (T.HAS_ALTITUDE = 1), s.data.aColor && (T.HAS_COLOR = 1),
14214
- s.data.aOpacity && (T.HAS_OPACITY = 1), s.data.aUVScale && (T.HAS_UV_SCALE = 1),
14215
- s.data.aUVOffset && (T.HAS_UV_OFFSET = 1), s.data.aPatternOrigin && (T.HAS_PATTERN_ORIGIN = 1),
14216
- s.data.aPatternWidth && (T.HAS_PATTERN_WIDTH = 1), s.data.aPatternOffset && (T.HAS_PATTERN_OFFSET = 1),
14217
- c && (T.IS_VT = 1), A.setDefines(T), A.positionMatrix = this.getAltitudeOffsetMatrix(),
14722
+ }), b = {};
14723
+ return x && s.data.aTexInfo && (b.HAS_PATTERN = 1), x && s.data.aTexCoord && (b.HAS_TEX_COORD = 1,
14724
+ b.INVALID_TEX_COORD = nr + ".0"), s.data.aAltitude && (b.HAS_ALTITUDE = 1), s.data.aColor && (b.HAS_COLOR = 1),
14725
+ s.data.aOpacity && (b.HAS_OPACITY = 1), s.data.aUVScale && (b.HAS_UV_SCALE = 1),
14726
+ s.data.aUVOffset && (b.HAS_UV_OFFSET = 1), s.data.aPatternOrigin && (b.HAS_PATTERN_ORIGIN = 1),
14727
+ s.data.aPatternWidth && (b.HAS_PATTERN_WIDTH = 1), s.data.aPatternOffset && (b.HAS_PATTERN_OFFSET = 1),
14728
+ c && (b.IS_VT = 1), A.setDefines(b), A.positionMatrix = this.getAltitudeOffsetMatrix(),
14218
14729
  A.setLocalTransform(t), A.properties.symbolIndex = l, A;
14219
14730
  }
14220
14731
  _preparePatternWidth(e, t, n, i, r) {
@@ -15108,7 +15619,7 @@
15108
15619
  default: null,
15109
15620
  property: "_symbol_lineDashColor"
15110
15621
  }
15111
- }, _r = "_line_gradient_property", {PackUtil: vr} = h(), Ar = new r.Point(0, 0), Tr = "_vector3dlayer_id", br = (_r + "").trim();
15622
+ }, _r = "_line_gradient_property", {PackUtil: vr} = h(), Ar = new r.Point(0, 0), br = "_vector3dlayer_id", Tr = (_r + "").trim();
15112
15623
  function Sr(e, t, n) {
15113
15624
  let i = !ze(t.visible), o = !ze(t.opacity), a = t;
15114
15625
  (i || o) && (a = r.MapboxUtil.loadGeoSymbol(t, n)), Object.defineProperty(e, "getVisible", {
@@ -15210,7 +15721,7 @@
15210
15721
  }
15211
15722
  function Mr(e, t) {
15212
15723
  const n = e.lineGradientProperty;
15213
- return n && (t[br] = t[n], t.mapbox_clip_start = 0, t.mapbox_clip_end = 1, delete t[n]),
15724
+ return n && (t[Tr] = t[n], t.mapbox_clip_start = 0, t.mapbox_clip_end = 1, delete t[n]),
15214
15725
  n;
15215
15726
  }
15216
15727
  class Pr extends gr {
@@ -15242,7 +15753,7 @@
15242
15753
  if (!t[n] || !t[n].isValid()) continue;
15243
15754
  const i = t[n].geometry, {features: r} = i.properties;
15244
15755
  if (!r) continue;
15245
- const o = e && e[Tr];
15756
+ const o = e && e[br];
15246
15757
  r[o] && (r[o].feature.properties[_r] = e.properties[_r], this._changedMeshes.push(t[n]),
15247
15758
  this.setToRedraw());
15248
15759
  }
@@ -15505,7 +16016,7 @@
15505
16016
  if (n && 1 === y && e[r] > 0) {
15506
16017
  let {fadeOutDelay: e, fadingDuration: t} = this.sceneConfig;
15507
16018
  St(t) && (t = Or), St(e) && (e = Rr);
15508
- const i = Tt(1 - (a.getFrameTimestamp() - n - e) / t, 0, 1);
16019
+ const i = bt(1 - (a.getFrameTimestamp() - n - e) / t, 0, 1);
15509
16020
  y *= i, i > 0 && this.setToRedraw();
15510
16021
  }
15511
16022
  }
@@ -15581,7 +16092,7 @@
15581
16092
  n[i] = l = t ? e : -e;
15582
16093
  }
15583
16094
  return s - Math.abs(l) < r ? h = l > 0 ? (s - l) / r : 1 - (s + l) / r : t ? (l < 0 && (n[i] = l = s + o),
15584
- h = (s - l) / r) : (l > 0 && (n[i] = l = -(s + a)), h = 1 - (s + l) / r), (h < 0 || h > 1) && (h = Tt(h, 0, 1)),
16095
+ h = (s - l) / r) : (l > 0 && (n[i] = l = -(s + a)), h = 1 - (s + l) / r), (h < 0 || h > 1) && (h = bt(h, 0, 1)),
15585
16096
  h;
15586
16097
  }
15587
16098
  _getBoxTimestamps(e) {
@@ -15909,16 +16420,16 @@
15909
16420
  const y = m[2];
15910
16421
  let x = 1;
15911
16422
  if (l.markerPerspectiveRatio) {
15912
- x = Tt(.5 + .5 * (1 - (1 - h / y) * l.markerPerspectiveRatio), 0, 4);
16423
+ x = bt(.5 + .5 * (1 - (1 - h / y) * l.markerPerspectiveRatio), 0, 4);
15913
16424
  }
15914
- const {aShape: _, aMarkerDx: v, aMarkerDy: A, aMarkerWidth: T, aMarkerHeight: b, aPitchAlign: S, aRotationAlign: w, aRotation: M} = c, P = v ? v[r] : u.markerDx, I = A ? A[r] : u.markerDy, C = S ? S[2 * r] : l.markerPitchWithMap, O = w ? w[2 * r] : l.markerRotateWithMap, k = n.vec2.set(fo, P || 0, -(I || 0));
16425
+ const {aShape: _, aMarkerDx: v, aMarkerDy: A, aMarkerWidth: b, aMarkerHeight: T, aPitchAlign: S, aRotationAlign: w, aRotation: M} = c, P = v ? v[r] : u.markerDx, I = A ? A[r] : u.markerDy, C = S ? S[2 * r] : l.markerPitchWithMap, O = w ? w[2 * r] : l.markerRotateWithMap, k = n.vec2.set(fo, P || 0, -(I || 0));
15915
16426
  let R = n.vec2.set(lo, _[2 * r] / 10, _[2 * r + 1] / 10), F = n.vec2.set(ho, _[2 * r + 2] / 10, _[2 * r + 3] / 10), E = n.vec2.set(co, _[2 * r + 4] / 10, _[2 * r + 5] / 10), D = n.vec2.set(uo, _[2 * r + 6] / 10, _[2 * r + 7] / 10);
15916
16427
  0 === l.flipY && 1 === C && (n.vec2.multiply(R, R, po), n.vec2.multiply(F, F, po),
15917
16428
  n.vec2.multiply(E, E, po), n.vec2.multiply(D, D, po));
15918
16429
  const [H, L] = ji(i.geometry);
15919
- let N = T ? T[r] : u.markerWidth;
16430
+ let N = b ? b[r] : u.markerWidth;
15920
16431
  St(N) && (N = H || eo);
15921
- let z = b ? b[r] : u.markerHeight;
16432
+ let z = T ? T[r] : u.markerHeight;
15922
16433
  St(z) && (z = L || to);
15923
16434
  const V = n.vec2.set(go, N / no, z / no);
15924
16435
  let U;
@@ -15935,46 +16446,46 @@
15935
16446
  const W = s ? s.devicePixelRatio : a.getDevicePixelRatio();
15936
16447
  return 1 !== W && (e[0] *= W, e[1] *= W, e[2] *= W, e[3] *= W), e;
15937
16448
  }
15938
- const {PackUtil: yo} = h(), xo = 1, _o = [], vo = [], Ao = [], To = [], bo = [], So = [], wo = [ 1, -1 ];
16449
+ const {PackUtil: yo} = h(), xo = 1, _o = [], vo = [], Ao = [], bo = [], To = [], So = [], wo = [ 1, -1 ];
15939
16450
  function Mo(e, i, r, o, a, s, l, h, c) {
15940
16451
  const u = o.material.uniforms, f = c.cameraToCenterDistance, d = o.geometry.properties, p = this.getSymbol(d.symbolIndex), g = "line" === p.textPlacement && !Ft(p), m = t.MapStateCache[c.id], y = io, x = r[2];
15941
16452
  let _ = 1;
15942
16453
  if (u.textPerspectiveRatio) {
15943
- _ = Tt(.5 + .5 * (1 - (1 - f / x) * u.textPerspectiveRatio), 0, 4);
16454
+ _ = bt(.5 + .5 * (1 - (1 - f / x) * u.textPerspectiveRatio), 0, 4);
15944
16455
  }
15945
- const {aTextDx: v, aTextDy: A, aPitchAlign: T, aRotationAlign: b, aRotation: S, aType: w, aDxDy: M} = o.geometry.properties;
16456
+ const {aTextDx: v, aTextDy: A, aPitchAlign: b, aRotationAlign: T, aRotation: S, aType: w, aDxDy: M} = o.geometry.properties;
15946
16457
  let P, I, C;
15947
16458
  M ? (P = M[4 * l + 2], I = M[4 * l + 3]) : (P = v ? v[l] : p.textDx, I = A ? A[l] : p.textDy),
15948
- T && (C = w ? T[2 * l + 1] : T[l]);
15949
- const O = T ? C : u.textPitchWithMap;
16459
+ b && (C = w ? b[2 * l + 1] : b[l]);
16460
+ const O = b ? C : u.textPitchWithMap;
15950
16461
  let k;
15951
- b && (k = w ? b[2 * l + 1] : b[l]);
15952
- const R = b ? k : u.textRotateWithMap, F = n.vec2.set(So, P || 0, -(I || 0));
16462
+ T && (k = w ? T[2 * l + 1] : T[l]);
16463
+ const R = T ? k : u.textRotateWithMap, F = n.vec2.set(So, P || 0, -(I || 0));
15953
16464
  if (g) {
15954
16465
  const {aOffset: t, aShape: o} = d, a = t.length !== o.length;
15955
16466
  let s, f, p, g;
15956
16467
  if (a ? (s = n.vec3.set(vo, t[3 * l] / 10, t[3 * l + 1] / 10, t[3 * l + 2] / 10),
15957
- f = n.vec3.set(Ao, t[3 * l + 3] / 10, t[3 * l + 4] / 10, t[3 * l + 5] / 10), p = n.vec3.set(To, t[3 * l + 6] / 10, t[3 * l + 7] / 10, t[3 * l + 8] / 10),
15958
- g = n.vec3.set(bo, t[3 * l + 9] / 10, t[3 * l + 10] / 10, t[3 * l + 11] / 10)) : (s = n.vec2.set(vo, t[2 * l] / 10, t[2 * l + 1] / 10),
15959
- f = n.vec2.set(Ao, t[2 * l + 2] / 10, t[2 * l + 3] / 10), p = n.vec2.set(To, t[2 * l + 4] / 10, t[2 * l + 5] / 10),
15960
- g = n.vec2.set(bo, t[2 * l + 6] / 10, t[2 * l + 7] / 10)), 1 === O) {
16468
+ f = n.vec3.set(Ao, t[3 * l + 3] / 10, t[3 * l + 4] / 10, t[3 * l + 5] / 10), p = n.vec3.set(bo, t[3 * l + 6] / 10, t[3 * l + 7] / 10, t[3 * l + 8] / 10),
16469
+ g = n.vec3.set(To, t[3 * l + 9] / 10, t[3 * l + 10] / 10, t[3 * l + 11] / 10)) : (s = n.vec2.set(vo, t[2 * l] / 10, t[2 * l + 1] / 10),
16470
+ f = n.vec2.set(Ao, t[2 * l + 2] / 10, t[2 * l + 3] / 10), p = n.vec2.set(bo, t[2 * l + 4] / 10, t[2 * l + 5] / 10),
16471
+ g = n.vec2.set(To, t[2 * l + 6] / 10, t[2 * l + 7] / 10)), 1 === O) {
15961
16472
  const t = Be(m ? m.resolution : c.getResolution(), c);
15962
16473
  Kr(e, i, s, f, p, g, h, F, u, c, x, _, a, t);
15963
16474
  } else n.vec2.multiply(s, s, wo), n.vec2.multiply(f, f, wo), n.vec2.multiply(p, p, wo),
15964
16475
  n.vec2.multiply(g, g, wo), Jr(e, r, s, f, p, g, F, _);
15965
16476
  } else {
15966
16477
  const {aShape: t} = d;
15967
- let o, s = n.vec2.set(vo, t[2 * l] / 10, -t[2 * l + 1] / 10), f = n.vec2.set(Ao, t[2 * l + 2] / 10, -t[2 * l + 3] / 10), v = n.vec2.set(To, t[2 * l + 4] / 10, -t[2 * l + 5] / 10), A = n.vec2.set(bo, t[2 * l + 6] / 10, -t[2 * l + 7] / 10);
16478
+ let o, s = n.vec2.set(vo, t[2 * l] / 10, -t[2 * l + 1] / 10), f = n.vec2.set(Ao, t[2 * l + 2] / 10, -t[2 * l + 3] / 10), v = n.vec2.set(bo, t[2 * l + 4] / 10, -t[2 * l + 5] / 10), A = n.vec2.set(To, t[2 * l + 6] / 10, -t[2 * l + 7] / 10);
15968
16479
  0 === u.flipY && 1 === O && (n.vec2.multiply(s, s, wo), n.vec2.multiply(f, f, wo),
15969
16480
  n.vec2.multiply(v, v, wo), n.vec2.multiply(A, A, wo)), o = S ? w && S.length > w.length ? S[2 * l + 1] / 9362 : S[l] / 9362 : (p.textRotation || 0) * Math.PI / 180;
15970
- const T = g ? 0 : (m ? m.bearing : c.getBearing()) * Math.PI / 180;
15971
- if (o || T) {
15972
- const e = Qr(_o, o, T, R, O);
16481
+ const b = g ? 0 : (m ? m.bearing : c.getBearing()) * Math.PI / 180;
16482
+ if (o || b) {
16483
+ const e = Qr(_o, o, b, R, O);
15973
16484
  s = n.vec2.transformMat2(s, s, e), f = n.vec2.transformMat2(f, f, e), v = n.vec2.transformMat2(v, v, e),
15974
16485
  A = n.vec2.transformMat2(A, A, e);
15975
16486
  }
15976
- const b = a / y;
15977
- n.vec2.scale(s, s, b), n.vec2.scale(f, f, b), n.vec2.scale(v, v, b), n.vec2.scale(A, A, b),
16487
+ const T = a / y;
16488
+ n.vec2.scale(s, s, T), n.vec2.scale(f, f, T), n.vec2.scale(v, v, T), n.vec2.scale(A, A, T),
15978
16489
  1 === O ? Kr(e, i, s, f, v, A, h, F, u, c, x, _) : Jr(e, r, s, f, v, A, F, _);
15979
16490
  }
15980
16491
  s = s || 0, e[0] -= s + xo, e[1] -= s + xo, e[2] += s + xo, e[3] += s + xo;
@@ -16340,7 +16851,7 @@
16340
16851
  width: 1,
16341
16852
  define: "HAS_TEXT_ROTATION",
16342
16853
  evaluate: n => {
16343
- const i = t.MapStateCache[e.id], r = i ? i.zoom : e.getZoom(), o = bt(d(r, n), 0, 360) * Math.PI / 180;
16854
+ const i = t.MapStateCache[e.id], r = i ? i.zoom : e.getZoom(), o = Tt(d(r, n), 0, 360) * Math.PI / 180;
16344
16855
  return x[0] = 9362 * o, x[0];
16345
16856
  }
16346
16857
  }, {
@@ -16375,13 +16886,13 @@
16375
16886
  let x = Uo;
16376
16887
  const _ = 3 * n[r];
16377
16888
  y && y[_] !== ct ? (Uo[0] = y[_], Uo[1] = y[_ + 1], Uo[2] = y[_ + 2]) : x = pi(Uo, m, a, s.width, s.height);
16378
- const v = i, {boxes: A, collision: T} = this._getCollideBoxes(t, r);
16379
- let b = 0;
16889
+ const v = i, {boxes: A, collision: b} = this._getCollideBoxes(t, r);
16890
+ let T = 0;
16380
16891
  if (c || 1 === t.material.uniforms.textRotateWithMap || h.textRotation) {
16381
16892
  let i = 0;
16382
16893
  for (let o = r; o < r + 6 * v; o += 6) {
16383
- const r = A[b] = A[b] || [];
16384
- b++;
16894
+ const r = A[T] = A[T] || [];
16895
+ T++;
16385
16896
  const l = Mo.call(this, r, m, x, t, p, g, n[o], a, s);
16386
16897
  if (!e) {
16387
16898
  const t = this.isCollides(l);
@@ -16394,13 +16905,13 @@
16394
16905
  for (let h = r; h < o; h += 6) {
16395
16906
  const r = d[2 * n[h] + 1];
16396
16907
  if (l !== r || h === o - 6) {
16397
- const c = n[h === o - 6 ? h : h - 6], u = Mo.call(this, No, m, x, t, p, g, i, a, s), f = Mo.call(this, zo, m, x, t, p, g, c, a, s), d = A[b] = A[b] || [];
16398
- b++, d[0] = Math.min(u[0], f[0]), d[1] = Math.min(u[1], f[1]), d[2] = Math.max(u[2], f[2]),
16908
+ const c = n[h === o - 6 ? h : h - 6], u = Mo.call(this, No, m, x, t, p, g, i, a, s), f = Mo.call(this, zo, m, x, t, p, g, c, a, s), d = A[T] = A[T] || [];
16909
+ T++, d[0] = Math.min(u[0], f[0]), d[1] = Math.min(u[1], f[1]), d[2] = Math.max(u[2], f[2]),
16399
16910
  d[3] = Math.max(u[3], f[3]), i = n[h], l = r, !e && this.isCollides(d) && (e = 1);
16400
16911
  }
16401
16912
  }
16402
16913
  }
16403
- return T.collides = e, T;
16914
+ return b.collides = e, b;
16404
16915
  }
16405
16916
  function Bo(e, t) {
16406
16917
  const i = function(e, t) {
@@ -16705,7 +17216,7 @@
16705
17216
  index: 0,
16706
17217
  define: "HAS_MARKER_ROTATION",
16707
17218
  evaluate: n => {
16708
- const i = t.MapStateCache[e.id], r = i ? i.zoom : e.getZoom(), o = bt(d(r, n), 0, 360) * Math.PI / 180;
17219
+ const i = t.MapStateCache[e.id], r = i ? i.zoom : e.getZoom(), o = Tt(d(r, n), 0, 360) * Math.PI / 180;
16709
17220
  return A[0] = 9362 * o, A[0];
16710
17221
  }
16711
17222
  }, {
@@ -16716,7 +17227,7 @@
16716
17227
  index: 1,
16717
17228
  define: "HAS_TEXT_ROTATION",
16718
17229
  evaluate: n => {
16719
- const i = t.MapStateCache[e.id], r = i ? i.zoom : e.getZoom(), o = bt(p(r, n), 0, 360) * Math.PI / 180;
17230
+ const i = t.MapStateCache[e.id], r = i ? i.zoom : e.getZoom(), o = Tt(p(r, n), 0, 360) * Math.PI / 180;
16720
17231
  return A[0] = 9362 * o, A[0];
16721
17232
  }
16722
17233
  }, {
@@ -16879,33 +17390,33 @@
16879
17390
  const o = y[4 * t], c = y[4 * t + 1], f = y[4 * t + 2], d = y[4 * t + 3];
16880
17391
  if (!(o || c || f || d)) return;
16881
17392
  const p = v[e], x = _[p] && _[p].feature, A = x && x.properties || {};
16882
- let T = s ? s(u, A) : a;
16883
- if (Me(T)) {
16884
- T = (A.textSizeFn = A.textSizeFn || Pe(T))(u, A);
17393
+ let b = s ? s(u, A) : a;
17394
+ if (Me(b)) {
17395
+ b = (A.textSizeFn = A.textSizeFn || Pe(b))(u, A);
16885
17396
  }
16886
- T /= io;
16887
- let b, S = h && h(u, A) || l;
17397
+ b /= io;
17398
+ let T, S = h && h(u, A) || l;
16888
17399
  if (Me(S)) {
16889
17400
  S = (A.fitPaddingFn = A.fitPaddingFn || Ie(S))(u, A);
16890
17401
  }
16891
- if (S = S || ra, S[0] === S[2] && S[1] === S[3] || (b = r.aPadOffset, b || (b = r.aPadOffset = new Int16Array(2 * g.length))),
17402
+ if (S = S || ra, S[0] === S[2] && S[1] === S[3] || (T = r.aPadOffset, T || (T = r.aPadOffset = new Int16Array(2 * g.length))),
16892
17403
  g && n) {
16893
- const t = Math.abs((f - o) / 10 * T) + (S[1] + S[3] || 0);
16894
- if (Yo[0] = t, g[e] !== Yo[0] && (kt(g, Yo[0], e, e + $o), g.dirty = !0), b) {
17404
+ const t = Math.abs((f - o) / 10 * b) + (S[1] + S[3] || 0);
17405
+ if (Yo[0] = t, g[e] !== Yo[0] && (kt(g, Yo[0], e, e + $o), g.dirty = !0), T) {
16895
17406
  const t = (S[1] + S[3]) / 2 - S[3];
16896
- if (qo[0] = t, b[2 * e] !== qo[0]) {
16897
- for (let n = e; n < e + $o; n++) b[2 * n] = t;
16898
- b.dirty = !0;
17407
+ if (qo[0] = t, T[2 * e] !== qo[0]) {
17408
+ for (let n = e; n < e + $o; n++) T[2 * n] = t;
17409
+ T.dirty = !0;
16899
17410
  }
16900
17411
  }
16901
17412
  }
16902
17413
  if (m && i) {
16903
- const t = Math.abs((d - c) / 10 * T) + (S[0] + S[2] || 0);
16904
- if (Yo[0] = t, m[e] !== Yo[0] && (kt(m, Yo[0], e, e + $o), m.dirty = !0), b) {
17414
+ const t = Math.abs((d - c) / 10 * b) + (S[0] + S[2] || 0);
17415
+ if (Yo[0] = t, m[e] !== Yo[0] && (kt(m, Yo[0], e, e + $o), m.dirty = !0), T) {
16905
17416
  const t = S[0] - (S[0] + S[2]) / 2;
16906
- if (qo[0] = t, b[2 * e + 1] !== qo[0]) {
16907
- for (let n = e; n < e + $o; n++) b[2 * n + 1] = t;
16908
- b.dirty = !0;
17417
+ if (qo[0] = t, T[2 * e + 1] !== qo[0]) {
17418
+ for (let n = e; n < e + $o; n++) T[2 * n + 1] = t;
17419
+ T.dirty = !0;
16909
17420
  }
16910
17421
  }
16911
17422
  }
@@ -16928,8 +17439,8 @@
16928
17439
  const t = e / Xo;
16929
17440
  A(x[e], t, !0, !0);
16930
17441
  }
16931
- const {aPadOffset: T} = r;
16932
- T && (n.data.aPadOffset = T, n.isBufferGenerated() && n.generateBuffers(this.regl, {
17442
+ const {aPadOffset: b} = r;
17443
+ b && (n.data.aPadOffset = b, n.isBufferGenerated() && n.generateBuffers(this.regl, {
16933
17444
  excludeElementsInVAO: !0
16934
17445
  }));
16935
17446
  }
@@ -17343,15 +17854,15 @@
17343
17854
  }
17344
17855
  const pa = [], ga = [], ma = [];
17345
17856
  function ya(e, t, i, r, o, a, s, l, h, c, u, f, d) {
17346
- const {aGlyphOffset: p, aSegment: g, aTextDx: m, aTextDy: y, symbolIndex: x} = t.geometry.properties, _ = this.getSymbol(x), v = m ? m[o] : _.textDx, A = y ? y[o] : _.textDy, T = n.vec2.set(ma, v || 0, A || 0), b = n.vec2.set(pa, p[2 * o], p[2 * o + 1]), S = n.vec3.set(ga, g[3 * o], g[3 * o + 1], g[3 * o + 2]), w = function(e, t, n, i, r, o, a, s, l, h, c, u, f, d, p, g, m, y) {
17857
+ const {aGlyphOffset: p, aSegment: g, aTextDx: m, aTextDy: y, symbolIndex: x} = t.geometry.properties, _ = this.getSymbol(x), v = m ? m[o] : _.textDx, A = y ? y[o] : _.textDy, b = n.vec2.set(ma, v || 0, A || 0), T = n.vec2.set(pa, p[2 * o], p[2 * o + 1]), S = n.vec3.set(ga, g[3 * o], g[3 * o + 1], g[3 * o + 2]), w = function(e, t, n, i, r, o, a, s, l, h, c, u, f, d, p, g, m, y) {
17347
17858
  p || (p = i);
17348
17859
  const x = t.geometry.properties.line, _ = o[0] * u, v = f ? _ - a : _ + a;
17349
- let A = v > 0 ? 1 : -1, T = 0;
17350
- f && (A *= -1, T = Math.PI), A < 0 && (T += Math.PI);
17351
- const b = h + c, S = Math.abs(v);
17860
+ let A = v > 0 ? 1 : -1, b = 0;
17861
+ f && (A *= -1, b = Math.PI), A < 0 && (b += Math.PI);
17862
+ const T = h + c, S = Math.abs(v);
17352
17863
  let w = A > 0 ? l : l + 1, M = fi.convert(i), P = fi.convert(i), I = fi.convert(r), C = fi.convert(r), O = 0, k = 0;
17353
17864
  for (;O + k <= S; ) {
17354
- if (w += A, w < h || w >= b) return null;
17865
+ if (w += A, w < h || w >= T) return null;
17355
17866
  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],
17356
17867
  I.x = x[3 * w], I.y = x[3 * w + 1], O += k, k = P.dist(M) / d;
17357
17868
  }
@@ -17360,14 +17871,14 @@
17360
17871
  const {extent: n} = t.properties.tile, i = g.getTileSize().width / n, r = g.getMap();
17361
17872
  let o = I.sub(C).mult(R)._add(C);
17362
17873
  M = Ai(gi, r, t, I, i, g, m, D), P = Ai(mi, r, t, C, i, g, m, D), o = Ai(yi, r, t, o, i, g, m, D);
17363
- const a = T + Math.atan2(M[1] - P[1], M[0] - P[0]);
17874
+ const a = b + Math.atan2(M[1] - P[1], M[0] - P[0]);
17364
17875
  return e[0] = (o[0] - p[0]) / d, e[1] = (o[1] - p[1]) / d, e[2] = a, e;
17365
17876
  }
17366
17877
  const H = M.sub(P), L = H.mult(R)._add(P);
17367
17878
  L._add(H._unit()._perp()._mult(s * A));
17368
- const N = T + Math.atan2(M.y - P.y, M.x - P.x);
17879
+ const N = b + Math.atan2(M.y - P.y, M.x - P.x);
17369
17880
  return e[0] = (L.x - i[0]) / d, e[1] = (L.y - i[1]) / d, e[2] = N, e;
17370
- }(e, t, r, a, s, b, T[0], T[1], S[0], S[1], S[2], i / 24, h, l, c, u, f, d);
17881
+ }(e, t, r, a, s, T, b[0], b[1], S[0], S[1], S[2], i / 24, h, l, c, u, f, d);
17371
17882
  return w;
17372
17883
  }
17373
17884
  const xa = [], _a = [];
@@ -17384,7 +17895,7 @@
17384
17895
  } else m = 0, y = xa[0] > _a[0] ? 1 : 0;
17385
17896
  return 2 * y + m;
17386
17897
  }
17387
- var Aa = "#define SHADER_NAME TEXT_VERT\n#define RAD 0.0174532925\n#ifdef HAS_ALTITUDE\nattribute vec2 aPosition;\nattribute float aAltitude;\n#else\nattribute vec3 aPosition;\n#endif\nattribute vec4 aShape;\n#ifdef ENABLE_COLLISION\nattribute float aOpacity;\n#endif\n#ifdef HAS_OPACITY\nattribute float aColorOpacity;\n#endif\n#ifdef HAS_TEXT_SIZE\nattribute float aTextSize;\n#else\nuniform float textSize;\n#endif\n#ifdef HAS_TEXT_DX\nattribute float aTextDx;\n#else\nuniform float textDx;\n#endif\n#ifdef HAS_TEXT_DY\nattribute float aTextDy;\n#else\nuniform float textDy;\n#endif\n#if defined(HAS_PITCH_ALIGN)\nattribute float aPitchAlign;\n#else\nuniform float textPitchWithMap;\n#endif\n#if defined(HAS_TEXT_ROTATION_ALIGN)\nattribute float aRotationAlign;\n#else\nuniform float textRotateWithMap;\n#endif\nuniform float flipY;\n#if defined(HAS_TEXT_ROTATION)\nattribute float aRotation;\n#else\nuniform float textRotation;\n#endif\nuniform float cameraToCenterDistance;\nuniform mat4 positionMatrix;\nuniform mat4 projViewModelMatrix;\nuniform float textPerspectiveRatio;\nuniform vec2 glyphTexSize;\nuniform vec2 canvasSize;\nuniform float glyphSize;\nuniform float mapPitch;\nuniform float mapRotation;\nuniform float zoomScale;\nuniform float tileRatio;\nuniform float layerScale;\nuniform float isRenderingTerrain;\n#ifndef PICKING_MODE\nvarying vec2 vTexCoord;\nvarying float vGammaScale;\nvarying float vTextSize;\nvarying float vOpacity;\n#ifdef HAS_TEXT_FILL\nattribute vec4 aTextFill;\nvarying vec4 vTextFill;\n#endif\n#ifdef HAS_TEXT_HALO_FILL\nattribute vec4 aTextHaloFill;\nvarying vec4 vTextHaloFill;\n#endif\n#if defined(HAS_TEXT_HALO_RADIUS) || defined(HAS_TEXT_HALO_OPACITY)\nattribute vec2 aTextHalo;\nvarying vec2 vTextHalo;\n#endif\n#include <highlight_vert>\n#else\n#include <fbo_picking_vert>\n#endif\n#include <vt_position_vert>\nvoid main() {\n vec3 c = unpackVTPosition();\n#ifdef HAS_TEXT_SIZE\nfloat d = aTextSize * layerScale;\n#else\nfloat d = textSize * layerScale;\n#endif\n#ifdef HAS_TEXT_DX\nfloat e = aTextDx;\n#else\nfloat e = textDx;\n#endif\n#ifdef HAS_TEXT_DY\nfloat f = aTextDy;\n#else\nfloat f = textDy;\n#endif\n#if defined(HAS_PITCH_ALIGN)\nfloat h = aPitchAlign;\n#else\nfloat h = textPitchWithMap;\n#endif\n#if defined(HAS_ROTATION_ALIGN)\nfloat i = aRotationAlign;\n#else\nfloat i = textRotateWithMap;\n#endif\ngl_Position = projViewModelMatrix * positionMatrix * vec4(c, 1.);\n float j = gl_Position.w;\n float k;\n if(isRenderingTerrain == 1. && h == 1.) {\n k = 1.;\n } else {\n float l = (1. - cameraToCenterDistance / j) * textPerspectiveRatio;\n k = clamp(.5 + .5 * (1. - l), .0, 4.);\n }\n#ifdef HAS_TEXT_ROTATION\nfloat m = -aRotation / 9362. - mapRotation * i;\n#else\nfloat m = -textRotation - mapRotation * i;\n#endif\nif(h == 1.) {\n \n#ifdef REVERSE_MAP_ROTATION_ON_PITCH\nm += mapRotation;\n#else\nm -= mapRotation;\n#endif\n }\n float n = sin(m);\n float o = cos(m);\n mat2 u = mat2(o, -1. * n, n, o);\n vec2 v = aShape.xy / 10.0;\n if(h == 1. && flipY == .0) {\n v = v * vec2(1., -1.);\n }\n vec2 A = aShape.zw;\n v = u * (v / glyphSize * d);\n float B;\n if(isRenderingTerrain == 1.) {\n B = 1.;\n } else {\n B = j / cameraToCenterDistance;\n }\n if(h == .0) {\n vec2 C = v * 2. / canvasSize;\n gl_Position.xy += C * k * j;\n } else {\n float D;\n if(isRenderingTerrain == 1.) {\n D = tileRatio / zoomScale;\n } else {\n D = tileRatio / zoomScale * B * k;\n }\n vec2 C = v;\n gl_Position = projViewModelMatrix * positionMatrix * vec4(c + vec3(C, .0) * D, 1.);\n }\n gl_Position.xy += vec2(e, -f) * 2. / canvasSize * j;\n#ifndef PICKING_MODE\nif(h == .0) {\n vGammaScale = mix(1., B, textPerspectiveRatio);\n } else {\n vGammaScale = B + mapPitch / 4.;\n }\n vTexCoord = A / glyphTexSize;\n vGammaScale = clamp(vGammaScale, .0, 1.);\n vTextSize = d;\n#ifdef ENABLE_COLLISION\nvOpacity = aOpacity / 255.;\n#else\nvOpacity = 1.;\n#endif\n#ifdef HAS_OPACITY\nvOpacity *= aColorOpacity / 255.;\n#endif\n#ifdef HAS_TEXT_FILL\nvTextFill = aTextFill / 255.;\n#endif\n#ifdef HAS_TEXT_HALO_FILL\nvTextHaloFill = aTextHaloFill / 255.;\n#endif\n#if defined(HAS_TEXT_HALO_RADIUS) || defined(HAS_TEXT_HALO_OPACITY)\nvTextHalo = aTextHalo;\n#endif\nhighlight_setVarying();\n#else\n#ifdef ENABLE_COLLISION\nbool E = aOpacity == 255.;\n#else\nbool E = true;\n#endif\nfbo_picking_setData(gl_Position.w, E);\n#endif\n}", Ta = "#define SHADER_NAME TEXT_VERT\n#define RAD 0.0174532925\nstruct TextVertexUniforms {\n textSize: f32,\n textDx: f32,\n textDy: f32,\n textPitchWithMap: f32,\n textRotateWithMap: f32,\n textRotation: f32,\n flipY: f32,\n textPerspectiveRatio: f32,\n glyphTexSize: vec2f,\n zoomScale: f32,\n tileRatio: f32,\n positionMatrix: mat4x4f,\n projViewModelMatrix: mat4x4f\n};\nstruct TextUniforms {\n cameraToCenterDistance: f32,\n canvasSize: vec2f,\n glyphSize: f32,\n mapPitch: f32,\n mapRotation: f32,\n layerScale: f32,\n isRenderingTerrain: f32\n};\n@group(0) @binding($b) var<uniform> uniforms: TextVertexUniforms;\n@group(0) @binding($b) var<uniform> textUniforms: TextUniforms;\nstruct VertexInput {\n#ifdef HAS_ALTITUDE\n @location($i) aPosition: POSITION_TYPE_2,\n @location($i) aAltitude: f32,\n#else\n @location($i) aPosition: POSITION_TYPE_3,\n#endif\n @location($i) aShape: vec4i,\n#ifdef ENABLE_COLLISION\n @location($i) aOpacity: u32,\n#endif\n#ifdef HAS_OPACITY\n @location($i) aColorOpacity: u32,\n#endif\n#ifdef HAS_TEXT_SIZE\n @location($i) aTextSize: u32,\n#endif\n#ifdef HAS_TEXT_DX\n @location($i) aTextDx: i32,\n#endif\n#ifdef HAS_TEXT_DY\n @location($i) aTextDy: i32,\n#endif\n#ifdef HAS_PITCH_ALIGN\n @location($i) aPitchAlign: u32,\n#endif\n#ifdef HAS_TEXT_ROTATION_ALIGN\n @location($i) aRotationAlign: u32,\n#endif\n#ifdef HAS_TEXT_ROTATION\n @location($i) aRotation: u32,\n#endif\n#ifdef HAS_TEXT_FILL\n @location($i) aTextFill: vec4u,\n#endif\n#ifdef HAS_TEXT_HALO_FILL\n @location($i) aTextHaloFill: vec4u,\n#endif\n#if HAS_TEXT_HALO_RADIUS || HAS_TEXT_HALO_OPACITY\n @location($i) aTextHalo: vec2u,\n#endif\n};\nstruct VertexOutput {\n @builtin(position) position: vec4f,\n#ifndef PICKING_MODE\n @location($o) vTexCoord: vec2f,\n @location($o) vGammaScale: f32,\n @location($o) vTextSize: f32,\n @location($o) vOpacity: f32,\n #ifdef HAS_TEXT_FILL\n @location($o) vTextFill: vec4f,\n #endif\n #ifdef HAS_TEXT_HALO_FILL\n @location($o) vTextHaloFill: vec4f,\n #endif\n #if HAS_TEXT_HALO_RADIUS || HAS_TEXT_HALO_OPACITY\n @location($o) vTextHalo: vec2f,\n #endif\n#endif\n};\n#include <vt_position_vert>\n#include <highlight_vert>\n#ifdef PICKING_MODE\n#include <fbo_picking_vert>\n#endif\n@vertex\nfn main(input: VertexInput) -> VertexOutput {\n let isRenderingTerrain = textUniforms.isRenderingTerrain;\n let layerScale = textUniforms.layerScale;\n var output: VertexOutput;\n var position = unpackVTPosition(input);\n#ifdef HAS_TEXT_SIZE\n var myTextSize = input.aTextSize * layerScale;\n#else\n var myTextSize = uniforms.textSize * layerScale;\n#endif\n#ifdef HAS_TEXT_DX\n var myTextDx = input.aTextDx;\n#else\n var myTextDx = uniforms.textDx;\n#endif\n#ifdef HAS_TEXT_DY\n var myTextDy = input.aTextDy;\n#else\n var myTextDy = uniforms.textDy;\n#endif\n#ifdef HAS_PITCH_ALIGN\n var isPitchWithMap = input.aPitchAlign;\n#else\n var isPitchWithMap = uniforms.textPitchWithMap;\n#endif\n#ifdef HAS_TEXT_ROTATION_ALIGN\n var isRotateWithMap = input.aRotationAlign;\n#else\n var isRotateWithMap = uniforms.textRotateWithMap;\n#endif\n output.position = uniforms.projViewModelMatrix * uniforms.positionMatrix * vec4f(position, 1.0);\n var projDistance = output.position.w;\n var perspectiveRatio: f32;\n if (isRenderingTerrain == 1.0 && isPitchWithMap == 1.0) {\n perspectiveRatio = 1.0;\n } else {\n var distanceRatio = (1.0 - textUniforms.cameraToCenterDistance / projDistance) * uniforms.textPerspectiveRatio;\n perspectiveRatio = clamp(\n 0.5 + 0.5 * (1.0 - distanceRatio),\n 0.0,\n 4.0);\n }\n let mapRotation = textUniforms.mapRotation;\n#ifdef HAS_TEXT_ROTATION\n var rotation = -input.aRotation / 9362.0 - mapRotation * isRotateWithMap;\n#else\n var rotation = -uniforms.textRotation - mapRotation * isRotateWithMap;\n#endif\n if (isPitchWithMap == 1.0) {\n#ifdef REVERSE_MAP_ROTATION_ON_PITCH\n rotation += mapRotation;\n#else\n rotation -= mapRotation;\n#endif\n }\n var angleSin = sin(rotation);\n var angleCos = cos(rotation);\n var shapeMatrix = mat2x2f(angleCos, -1.0 * angleSin, angleSin, angleCos);\n var shape = vec2f(input.aShape.xy) / 10.0;\n if (isPitchWithMap == 1.0 && uniforms.flipY == 0.0) {\n shape = shape * vec2f(1.0, -1.0);\n }\n var texCoord = vec2f(input.aShape.zw);\n shape = shapeMatrix * (shape / textUniforms.glyphSize * myTextSize);\n let tileRatio = uniforms.tileRatio;\n let zoomScale = uniforms.zoomScale;\n var cameraScale: f32;\n if (isRenderingTerrain == 1.0) {\n cameraScale = 1.0;\n } else {\n cameraScale = projDistance / textUniforms.cameraToCenterDistance;\n }\n let canvasSize = textUniforms.canvasSize;\n if (isPitchWithMap == 0.0) {\n var offset = shape * 2.0 / canvasSize;\n output.position = vec4(output.position.xy + offset * perspectiveRatio * projDistance, output.position.zw);\n } else {\n var offsetScale: f32;\n if (isRenderingTerrain == 1.0) {\n offsetScale = tileRatio / zoomScale;\n } else {\n offsetScale = tileRatio / zoomScale * cameraScale * perspectiveRatio;\n }\n var offset = shape;\n output.position = uniforms.projViewModelMatrix * uniforms.positionMatrix * vec4f(position + vec3f(offset, 0.0) * offsetScale, 1.0);\n }\n let dxdy = vec2f(myTextDx, -myTextDy) * 2.0 / canvasSize * projDistance;\n output.position = vec4(output.position.xy + dxdy, output.position.zw);\n#ifndef PICKING_MODE\n if (isPitchWithMap == 0.0) {\n output.vGammaScale = mix(1.0, cameraScale, uniforms.textPerspectiveRatio);\n } else {\n output.vGammaScale = cameraScale + textUniforms.mapPitch / 4.0;\n }\n output.vTexCoord = texCoord / uniforms.glyphTexSize;\n output.vGammaScale = clamp(output.vGammaScale, 0.0, 1.0);\n output.vTextSize = myTextSize;\n#ifdef ENABLE_COLLISION\n output.vOpacity = f32(input.aOpacity) / 255.0;\n#else\n output.vOpacity = 1.0;\n#endif\n#ifdef HAS_OPACITY\n output.vOpacity *= f32(input.aColorOpacity) / 255.0;\n#endif\n#ifdef HAS_TEXT_FILL\n output.vTextFill = vec4f(input.aTextFill) / 255.0;\n#endif\n#ifdef HAS_TEXT_HALO_FILL\n output.vTextHaloFill = vec4f(input.aTextHaloFill) / 255.0;\n#endif\n#if HAS_TEXT_HALO_RADIUS || HAS_TEXT_HALO_OPACITY\n output.vTextHalo = vec2f(input.aTextHalo);\n#endif\n#if HAS_HIGHLIGHT_COLOR || HAS_HIGHLIGHT_OPACITY\n highlight_setVarying(input, &output);\n#endif\n#else\n#ifdef ENABLE_COLLISION\n var visible = f32(input.aOpacity) == 255.0;\n#else\n var visible = true;\n#endif\n fbo_picking_setData(input, &output, output.position.w, visible);\n#endif\n return output;\n}", ba = "#define SHADER_NAME TEXT_LINE\n#ifdef HAS_ALTITUDE\nattribute vec2 aPosition;\nattribute float aAltitude;\n#else\nattribute vec3 aPosition;\n#endif\nattribute vec2 aTexCoord;\n#ifdef HAS_OFFSET_Z\nattribute vec3 aOffset;\nuniform float altitudeScale;\n#else\nattribute vec2 aOffset;\n#endif\n#ifdef ENABLE_COLLISION\nattribute float aOpacity;\n#endif\n#ifdef HAS_OPACITY\nattribute float aColorOpacity;\n#endif\n#ifdef HAS_TEXT_SIZE\nattribute float aTextSize;\n#else\nuniform float textSize;\n#endif\n#ifdef HAS_TEXT_DX\nattribute float aTextDx;\n#else\nuniform float textDx;\n#endif\n#ifdef HAS_TEXT_DY\nattribute float aTextDy;\n#else\nuniform float textDy;\n#endif\n#if defined(HAS_PITCH_ALIGN)\nattribute float aPitchAlign;\n#else\nuniform float textPitchWithMap;\n#endif\nuniform float zoomScale;\nuniform float cameraToCenterDistance;\nuniform mat4 projViewModelMatrix;\nuniform float textPerspectiveRatio;\nuniform float mapPitch;\nuniform vec2 glyphTexSize;\nuniform vec2 canvasSize;\nuniform float tileRatio;\nuniform float layerScale;\nuniform float isRenderingTerrain;\nuniform float textPitchFilter;\n#ifndef PICKING_MODE\nvarying vec2 vTexCoord;\nvarying float vGammaScale;\nvarying float vTextSize;\nvarying float vOpacity;\n#ifdef HAS_TEXT_FILL\nattribute vec4 aTextFill;\nvarying vec4 vTextFill;\n#endif\n#ifdef HAS_TEXT_HALO_FILL\nattribute vec4 aTextHaloFill;\nvarying vec4 vTextHaloFill;\n#endif\n#if defined(HAS_TEXT_HALO_RADIUS) || defined(HAS_TEXT_HALO_OPACITY)\nattribute vec2 aTextHalo;\nvarying vec2 vTextHalo;\n#endif\n#include <highlight_vert>\n#else\n#include <fbo_picking_vert>\n#endif\n#include <vt_position_vert>\nvoid main() {\n vec3 c = unpackVTPosition();\n#ifdef HAS_TEXT_DX\nfloat d = aTextDx;\n#else\nfloat d = textDx;\n#endif\n#ifdef HAS_TEXT_DY\nfloat e = aTextDy;\n#else\nfloat e = textDy;\n#endif\n#ifdef HAS_TEXT_SIZE\nfloat f = aTextSize * layerScale;\n#else\nfloat f = textSize * layerScale;\n#endif\n#ifdef HAS_PITCH_ALIGN\nfloat h = aPitchAlign;\n#else\nfloat h = textPitchWithMap;\n#endif\ngl_Position = projViewModelMatrix * vec4(c, 1.);\n float i = gl_Position.w;\n float j = i / cameraToCenterDistance;\n float k;\n if(isRenderingTerrain == 1.) {\n k = 1.;\n } else {\n float l = (1. - cameraToCenterDistance / i) * textPerspectiveRatio;\n k = clamp(.5 + .5 * (1. - l), .0, 4.);\n }\n#ifdef HAS_OFFSET_Z\nvec3 m = aOffset / 10.0;\n m[2] /= altitudeScale;\n#else\nvec3 m = vec3(aOffset / 10.0, .0);\n#endif\nvec2 n = aTexCoord;\n if(h == 1.) {\n float o;\n if(isRenderingTerrain == 1.) {\n o = tileRatio;\n } else {\n o = tileRatio / zoomScale * j * k;\n }\n m.xy *= o;\n gl_Position = projViewModelMatrix * vec4(c + m, 1.);\n } else {\n gl_Position.xy += m.xy * 2. / canvasSize * k * i;\n }\n gl_Position.xy += vec2(d, -e) * 2. / canvasSize * i;\n if(textPitchFilter > .0) {\n if(textPitchFilter == 1. && h == .0 || textPitchFilter == 2. && h == 1.) {\n gl_Position = vec4(-9999., -9999., .0, 1.);\n }\n }\n#ifndef PICKING_MODE\nif(h == 1.) {\n vGammaScale = j + mapPitch / 4.;\n } else {\n vGammaScale = mix(1., j, textPerspectiveRatio);\n }\n vGammaScale = clamp(vGammaScale, .0, 1.);\n vTexCoord = n / glyphTexSize;\n vTextSize = f;\n#ifdef ENABLE_COLLISION\nvOpacity = aOpacity / 255.;\n#else\nvOpacity = 1.;\n#endif\n#ifdef HAS_OPACITY\nvOpacity *= aColorOpacity / 255.;\n#endif\n#ifdef HAS_TEXT_FILL\nvTextFill = aTextFill / 255.;\n#endif\n#ifdef HAS_TEXT_HALO_FILL\nvTextHaloFill = aTextHaloFill / 255.;\n#endif\n#if defined(HAS_TEXT_HALO_RADIUS) || defined(HAS_TEXT_HALO_OPACITY)\nvTextHalo = aTextHalo;\n#endif\nhighlight_setVarying();\n#else\n#ifdef ENABLE_COLLISION\nbool u = aOpacity == 255.;\n#else\nbool u = true;\n#endif\nfbo_picking_setData(gl_Position.w, u);\n#endif\n}", Sa = "#define SHADER_NAME TEXT_LINE\nstruct TextLineUniforms {\n textSize: f32,\n textDx: f32,\n textDy: f32,\n textPitchWithMap: f32,\n projViewModelMatrix: mat4x4f,\n textPerspectiveRatio: f32,\n glyphTexSize: vec2f,\n tileRatio: f32,\n zoomScale: f32,\n}\nstruct ShaderUniforms {\n cameraToCenterDistance: f32,\n mapPitch: f32,\n canvasSize: vec2f,\n textPitchFilter: f32,\n isRenderingTerrain: f32,\n layerScale: f32,\n #ifdef HAS_OFFSET_Z\n altitudeScale: f32,\n #endif\n}\n@group(0) @binding($b) var<uniform> uniforms: TextLineUniforms;\n@group(0) @binding($b) var<uniform> shaderUniforms: ShaderUniforms;\nstruct VertexInput {\n#ifdef HAS_ALTITUDE\n @location($i) aPosition: POSITION_TYPE_2,\n @location($i) aAltitude: f32,\n#else\n @location($i) aPosition: POSITION_TYPE_3,\n#endif\n @location($i) aTexCoord: vec2u,\n#ifdef HAS_OFFSET_Z\n @location($i) aOffset: vec3i,\n#else\n @location($i) aOffset: vec2i,\n#endif\n#ifdef ENABLE_COLLISION\n @location($i) aOpacity: u32,\n#endif\n#ifdef HAS_OPACITY\n @location($i) aColorOpacity: u32,\n#endif\n#ifdef HAS_TEXT_SIZE\n @location($i) aTextSize: u32,\n#endif\n#ifdef HAS_TEXT_DX\n @location($i) aTextDx: i32,\n#endif\n#ifdef HAS_TEXT_DY\n @location($i) aTextDy: i32,\n#endif\n#ifdef HAS_PITCH_ALIGN\n @location($i) aPitchAlign: u32,\n#endif\n#ifdef HAS_TEXT_FILL\n @location($i) aTextFill: vec4u,\n#endif\n#ifdef HAS_TEXT_HALO_FILL\n @location($i) aTextHaloFill: vec4u,\n#endif\n#if HAS_TEXT_HALO_RADIUS || HAS_TEXT_HALO_OPACITY\n @location($i) aTextHalo: vec2u,\n#endif\n};\nstruct VertexOutput {\n @builtin(position) position: vec4f,\n#ifndef PICKING_MODE\n @location($o) vTexCoord: vec2f,\n @location($o) vGammaScale: f32,\n @location($o) vTextSize: f32,\n @location($o) vOpacity: f32,\n #ifdef HAS_TEXT_FILL\n @location($o) vTextFill: vec4f,\n #endif\n #ifdef HAS_TEXT_HALO_FILL\n @location($o) vTextHaloFill: vec4f,\n #endif\n #if HAS_TEXT_HALO_RADIUS || HAS_TEXT_HALO_OPACITY\n @location($o) vTextHalo: vec2f,\n #endif\n#endif\n};\n#include <vt_position_vert>\n#include <fbo_picking_vert>\n@vertex\nfn main(input: VertexInput) -> VertexOutput {\n var output: VertexOutput;\n var position = unpackVTPosition(input);\n#ifdef HAS_TEXT_DX\n var myTextDx = f32(input.aTextDx);\n#else\n var myTextDx = uniforms.textDx;\n#endif\n#ifdef HAS_TEXT_DY\n var myTextDy = f32(input.aTextDy);\n#else\n var myTextDy = uniforms.textDy;\n#endif\n#ifdef HAS_TEXT_SIZE\n var myTextSize = f32(input.aTextSize) * shaderUniforms.layerScale;\n#else\n var myTextSize = uniforms.textSize * shaderUniforms.layerScale;\n#endif\n#ifdef HAS_PITCH_ALIGN\n var isPitchWithMap = f32(input.aPitchAlign);\n#else\n var isPitchWithMap = uniforms.textPitchWithMap;\n#endif\n output.position = uniforms.projViewModelMatrix * vec4f(position, 1.0);\n var projDistance = output.position.w;\n var cameraScale = projDistance / shaderUniforms.cameraToCenterDistance;\n var perspectiveRatio: f32;\n if (shaderUniforms.isRenderingTerrain == 1.0) {\n perspectiveRatio = 1.0;\n } else {\n var distanceRatio = (1.0 - shaderUniforms.cameraToCenterDistance / projDistance) * uniforms.textPerspectiveRatio;\n perspectiveRatio = clamp(\n 0.5 + 0.5 * (1.0 - distanceRatio),\n 0.0,\n 4.0);\n }\n#ifdef HAS_OFFSET_Z\n var offset = vec3f(input.aOffset) / 10.0;\n offset.z /= shaderUniforms.altitudeScale;\n#else\n var offset = vec3f(vec2f(input.aOffset) / 10.0, 0.0);\n#endif\n var texCoord = vec2f(input.aTexCoord);\n if (isPitchWithMap == 1.0) {\n var offsetScale: f32;\n if (shaderUniforms.isRenderingTerrain == 1.0) {\n offsetScale = uniforms.tileRatio;\n } else {\n offsetScale = uniforms.tileRatio / uniforms.zoomScale * cameraScale * perspectiveRatio;\n }\n offset = offset * offsetScale;\n output.position = uniforms.projViewModelMatrix * vec4f(position + offset, 1.0);\n } else {\n let perspOffset = offset.xy * 2.0 / shaderUniforms.canvasSize * perspectiveRatio * projDistance;\n output.position = vec4f(output.position.xy + perspOffset, output.position.zw);\n }\n let dxdy = vec2f(myTextDx, -myTextDy) * 2.0 / shaderUniforms.canvasSize * projDistance;\n output.position = vec4f(output.position.xy + dxdy, output.position.zw);\n if (shaderUniforms.textPitchFilter > 0.0) {\n if ((shaderUniforms.textPitchFilter == 1.0 && isPitchWithMap == 0.0) || (shaderUniforms.textPitchFilter == 2.0 && isPitchWithMap == 1.0)) {\n output.position = vec4f(-9999.0, -9999.0, 0.0, 1.0);\n }\n }\n#ifndef PICKING_MODE\n if (isPitchWithMap == 1.0) {\n output.vGammaScale = cameraScale + shaderUniforms.mapPitch / 4.0;\n } else {\n output.vGammaScale = mix(1.0, cameraScale, uniforms.textPerspectiveRatio);\n }\n output.vGammaScale = clamp(output.vGammaScale, 0.0, 1.0);\n output.vTexCoord = texCoord / uniforms.glyphTexSize;\n output.vTextSize = myTextSize;\n#ifdef ENABLE_COLLISION\n output.vOpacity = f32(input.aOpacity) / 255.0;\n#else\n output.vOpacity = 1.0;\n#endif\n#ifdef HAS_OPACITY\n output.vOpacity *= f32(input.aColorOpacity) / 255.0;\n#endif\n#ifdef HAS_TEXT_FILL\n output.vTextFill = vec4f(input.aTextFill) / 255.0;\n#endif\n#ifdef HAS_TEXT_HALO_FILL\n output.vTextHaloFill = vec4f(input.aTextHaloFill) / 255.0;\n#endif\n#if HAS_TEXT_HALO_RADIUS || HAS_TEXT_HALO_OPACITY\n output.vTextHalo = vec2f(input.aTextHalo);\n#endif\n#if HAS_HIGHLIGHT_COLOR || HAS_HIGHLIGHT_OPACITY\n highlight_setVarying(input, &output);\n#endif\n#else\n#ifdef ENABLE_COLLISION\n var visible = f32(input.aOpacity) == 255.0;\n#else\n var visible = true;\n#endif\n fbo_picking_setData(input, &output, output.position.w, visible);\n#endif\n return output;\n}", wa = "#define SHADER_NAME TEXT_FRAG\nprecision mediump float;\nuniform float layerOpacity;\nvarying vec2 vTexCoord;\nvarying float vOpacity;\nuniform float alphaTest;\n#include <text_render_frag>\n#include <highlight_frag>\nvoid main() {\n gl_FragColor = renderText(vTexCoord) * vOpacity * layerOpacity;\n if(gl_FragColor.a < alphaTest) {\n discard;\n }\n gl_FragColor = highlight_blendColor(gl_FragColor);\n}", Ma = "struct TextFragUniforms {\n layerOpacity: f32,\n}\nstruct TextUniforms {\n alphaTest: f32\n}\n@group(0) @binding($b) var<uniform> uniforms: TextFragUniforms;\n@group(0) @binding($b) var<uniform> textUniforms: TextUniforms;\n#include <text_render_frag>\n#include <highlight_frag>\n@fragment\nfn main(input: VertexOutput) -> @location(0) vec4f {\n var fragColor = renderText(input) * input.vOpacity * uniforms.layerOpacity;\n if (fragColor.a < textUniforms.alphaTest) {\n discard;\n }\n #if HAS_HIGHLIGHT_OPACITY || HAS_HIGHLIGHT_COLOR\n return highlight_blendColor(fragColor, input);\n #else\n return fragColor;\n #endif\n}";
17898
+ var Aa = "#define SHADER_NAME TEXT_VERT\n#define RAD 0.0174532925\n#ifdef HAS_ALTITUDE\nattribute vec2 aPosition;\nattribute float aAltitude;\n#else\nattribute vec3 aPosition;\n#endif\nattribute vec4 aShape;\n#ifdef ENABLE_COLLISION\nattribute float aOpacity;\n#endif\n#ifdef HAS_OPACITY\nattribute float aColorOpacity;\n#endif\n#ifdef HAS_TEXT_SIZE\nattribute float aTextSize;\n#else\nuniform float textSize;\n#endif\n#ifdef HAS_TEXT_DX\nattribute float aTextDx;\n#else\nuniform float textDx;\n#endif\n#ifdef HAS_TEXT_DY\nattribute float aTextDy;\n#else\nuniform float textDy;\n#endif\n#if defined(HAS_PITCH_ALIGN)\nattribute float aPitchAlign;\n#else\nuniform float textPitchWithMap;\n#endif\n#if defined(HAS_TEXT_ROTATION_ALIGN)\nattribute float aRotationAlign;\n#else\nuniform float textRotateWithMap;\n#endif\nuniform float flipY;\n#if defined(HAS_TEXT_ROTATION)\nattribute float aRotation;\n#else\nuniform float textRotation;\n#endif\nuniform float cameraToCenterDistance;\nuniform mat4 positionMatrix;\nuniform mat4 projViewModelMatrix;\nuniform float textPerspectiveRatio;\nuniform vec2 glyphTexSize;\nuniform vec2 canvasSize;\nuniform float glyphSize;\nuniform float mapPitch;\nuniform float mapRotation;\nuniform float zoomScale;\nuniform float tileRatio;\nuniform float layerScale;\nuniform float isRenderingTerrain;\n#ifndef PICKING_MODE\nvarying vec2 vTexCoord;\nvarying float vGammaScale;\nvarying float vTextSize;\nvarying float vOpacity;\n#ifdef HAS_TEXT_FILL\nattribute vec4 aTextFill;\nvarying vec4 vTextFill;\n#endif\n#ifdef HAS_TEXT_HALO_FILL\nattribute vec4 aTextHaloFill;\nvarying vec4 vTextHaloFill;\n#endif\n#if defined(HAS_TEXT_HALO_RADIUS) || defined(HAS_TEXT_HALO_OPACITY)\nattribute vec2 aTextHalo;\nvarying vec2 vTextHalo;\n#endif\n#include <highlight_vert>\n#else\n#include <fbo_picking_vert>\n#endif\n#include <vt_position_vert>\nvoid main() {\n vec3 c = unpackVTPosition();\n#ifdef HAS_TEXT_SIZE\nfloat d = aTextSize * layerScale;\n#else\nfloat d = textSize * layerScale;\n#endif\n#ifdef HAS_TEXT_DX\nfloat e = aTextDx;\n#else\nfloat e = textDx;\n#endif\n#ifdef HAS_TEXT_DY\nfloat f = aTextDy;\n#else\nfloat f = textDy;\n#endif\n#if defined(HAS_PITCH_ALIGN)\nfloat h = aPitchAlign;\n#else\nfloat h = textPitchWithMap;\n#endif\n#if defined(HAS_ROTATION_ALIGN)\nfloat i = aRotationAlign;\n#else\nfloat i = textRotateWithMap;\n#endif\ngl_Position = projViewModelMatrix * positionMatrix * vec4(c, 1.);\n float j = gl_Position.w;\n float k;\n if(isRenderingTerrain == 1. && h == 1.) {\n k = 1.;\n } else {\n float l = (1. - cameraToCenterDistance / j) * textPerspectiveRatio;\n k = clamp(.5 + .5 * (1. - l), .0, 4.);\n }\n#ifdef HAS_TEXT_ROTATION\nfloat m = -aRotation / 9362. - mapRotation * i;\n#else\nfloat m = -textRotation - mapRotation * i;\n#endif\nif(h == 1.) {\n \n#ifdef REVERSE_MAP_ROTATION_ON_PITCH\nm += mapRotation;\n#else\nm -= mapRotation;\n#endif\n }\n float n = sin(m);\n float o = cos(m);\n mat2 u = mat2(o, -1. * n, n, o);\n vec2 v = aShape.xy / 10.0;\n if(h == 1. && flipY == .0) {\n v = v * vec2(1., -1.);\n }\n vec2 A = aShape.zw;\n v = u * (v / glyphSize * d);\n float B;\n if(isRenderingTerrain == 1.) {\n B = 1.;\n } else {\n B = j / cameraToCenterDistance;\n }\n if(h == .0) {\n vec2 C = v * 2. / canvasSize;\n gl_Position.xy += C * k * j;\n } else {\n float D;\n if(isRenderingTerrain == 1.) {\n D = tileRatio / zoomScale;\n } else {\n D = tileRatio / zoomScale * B * k;\n }\n vec2 C = v;\n gl_Position = projViewModelMatrix * positionMatrix * vec4(c + vec3(C, .0) * D, 1.);\n }\n gl_Position.xy += vec2(e, -f) * 2. / canvasSize * j;\n#ifndef PICKING_MODE\nif(h == .0) {\n vGammaScale = mix(1., B, textPerspectiveRatio);\n } else {\n vGammaScale = B + mapPitch / 4.;\n }\n vTexCoord = A / glyphTexSize;\n vGammaScale = clamp(vGammaScale, .0, 1.);\n vTextSize = d;\n#ifdef ENABLE_COLLISION\nvOpacity = aOpacity / 255.;\n#else\nvOpacity = 1.;\n#endif\n#ifdef HAS_OPACITY\nvOpacity *= aColorOpacity / 255.;\n#endif\n#ifdef HAS_TEXT_FILL\nvTextFill = aTextFill / 255.;\n#endif\n#ifdef HAS_TEXT_HALO_FILL\nvTextHaloFill = aTextHaloFill / 255.;\n#endif\n#if defined(HAS_TEXT_HALO_RADIUS) || defined(HAS_TEXT_HALO_OPACITY)\nvTextHalo = aTextHalo;\n#endif\nhighlight_setVarying();\n#else\n#ifdef ENABLE_COLLISION\nbool E = aOpacity == 255.;\n#else\nbool E = true;\n#endif\nfbo_picking_setData(gl_Position.w, E);\n#endif\n}", ba = "#define SHADER_NAME TEXT_VERT\n#define RAD 0.0174532925\nstruct TextVertexUniforms {\n textSize: f32,\n textDx: f32,\n textDy: f32,\n textPitchWithMap: f32,\n textRotateWithMap: f32,\n textRotation: f32,\n flipY: f32,\n textPerspectiveRatio: f32,\n glyphTexSize: vec2f,\n zoomScale: f32,\n tileRatio: f32,\n positionMatrix: mat4x4f,\n projViewModelMatrix: mat4x4f\n};\nstruct TextUniforms {\n cameraToCenterDistance: f32,\n canvasSize: vec2f,\n glyphSize: f32,\n mapPitch: f32,\n mapRotation: f32,\n layerScale: f32,\n isRenderingTerrain: f32\n};\n@group(0) @binding($b) var<uniform> uniforms: TextVertexUniforms;\n@group(0) @binding($b) var<uniform> textUniforms: TextUniforms;\nstruct VertexInput {\n#ifdef HAS_ALTITUDE\n @location($i) aPosition: POSITION_TYPE_2,\n @location($i) aAltitude: f32,\n#else\n @location($i) aPosition: POSITION_TYPE_3,\n#endif\n @location($i) aShape: vec4i,\n#ifdef ENABLE_COLLISION\n @location($i) aOpacity: u32,\n#endif\n#ifdef HAS_OPACITY\n @location($i) aColorOpacity: u32,\n#endif\n#ifdef HAS_TEXT_SIZE\n @location($i) aTextSize: u32,\n#endif\n#ifdef HAS_TEXT_DX\n @location($i) aTextDx: i32,\n#endif\n#ifdef HAS_TEXT_DY\n @location($i) aTextDy: i32,\n#endif\n#ifdef HAS_PITCH_ALIGN\n @location($i) aPitchAlign: u32,\n#endif\n#ifdef HAS_TEXT_ROTATION_ALIGN\n @location($i) aRotationAlign: u32,\n#endif\n#ifdef HAS_TEXT_ROTATION\n @location($i) aRotation: u32,\n#endif\n#ifdef HAS_TEXT_FILL\n @location($i) aTextFill: vec4u,\n#endif\n#ifdef HAS_TEXT_HALO_FILL\n @location($i) aTextHaloFill: vec4u,\n#endif\n#if HAS_TEXT_HALO_RADIUS || HAS_TEXT_HALO_OPACITY\n @location($i) aTextHalo: vec2u,\n#endif\n};\nstruct VertexOutput {\n @builtin(position) position: vec4f,\n#ifndef PICKING_MODE\n @location($o) vTexCoord: vec2f,\n @location($o) vGammaScale: f32,\n @location($o) vTextSize: f32,\n @location($o) vOpacity: f32,\n #ifdef HAS_TEXT_FILL\n @location($o) vTextFill: vec4f,\n #endif\n #ifdef HAS_TEXT_HALO_FILL\n @location($o) vTextHaloFill: vec4f,\n #endif\n #if HAS_TEXT_HALO_RADIUS || HAS_TEXT_HALO_OPACITY\n @location($o) vTextHalo: vec2f,\n #endif\n#endif\n};\n#include <vt_position_vert>\n#include <highlight_vert>\n#ifdef PICKING_MODE\n#include <fbo_picking_vert>\n#endif\n@vertex\nfn main(input: VertexInput) -> VertexOutput {\n let isRenderingTerrain = textUniforms.isRenderingTerrain;\n let layerScale = textUniforms.layerScale;\n var output: VertexOutput;\n var position = unpackVTPosition(input);\n#ifdef HAS_TEXT_SIZE\n var myTextSize = input.aTextSize * layerScale;\n#else\n var myTextSize = uniforms.textSize * layerScale;\n#endif\n#ifdef HAS_TEXT_DX\n var myTextDx = input.aTextDx;\n#else\n var myTextDx = uniforms.textDx;\n#endif\n#ifdef HAS_TEXT_DY\n var myTextDy = input.aTextDy;\n#else\n var myTextDy = uniforms.textDy;\n#endif\n#ifdef HAS_PITCH_ALIGN\n var isPitchWithMap = input.aPitchAlign;\n#else\n var isPitchWithMap = uniforms.textPitchWithMap;\n#endif\n#ifdef HAS_TEXT_ROTATION_ALIGN\n var isRotateWithMap = input.aRotationAlign;\n#else\n var isRotateWithMap = uniforms.textRotateWithMap;\n#endif\n output.position = uniforms.projViewModelMatrix * uniforms.positionMatrix * vec4f(position, 1.0);\n var projDistance = output.position.w;\n var perspectiveRatio: f32;\n if (isRenderingTerrain == 1.0 && isPitchWithMap == 1.0) {\n perspectiveRatio = 1.0;\n } else {\n var distanceRatio = (1.0 - textUniforms.cameraToCenterDistance / projDistance) * uniforms.textPerspectiveRatio;\n perspectiveRatio = clamp(\n 0.5 + 0.5 * (1.0 - distanceRatio),\n 0.0,\n 4.0);\n }\n let mapRotation = textUniforms.mapRotation;\n#ifdef HAS_TEXT_ROTATION\n var rotation = -input.aRotation / 9362.0 - mapRotation * isRotateWithMap;\n#else\n var rotation = -uniforms.textRotation - mapRotation * isRotateWithMap;\n#endif\n if (isPitchWithMap == 1.0) {\n#ifdef REVERSE_MAP_ROTATION_ON_PITCH\n rotation += mapRotation;\n#else\n rotation -= mapRotation;\n#endif\n }\n var angleSin = sin(rotation);\n var angleCos = cos(rotation);\n var shapeMatrix = mat2x2f(angleCos, -1.0 * angleSin, angleSin, angleCos);\n var shape = vec2f(input.aShape.xy) / 10.0;\n if (isPitchWithMap == 1.0 && uniforms.flipY == 0.0) {\n shape = shape * vec2f(1.0, -1.0);\n }\n var texCoord = vec2f(input.aShape.zw);\n shape = shapeMatrix * (shape / textUniforms.glyphSize * myTextSize);\n let tileRatio = uniforms.tileRatio;\n let zoomScale = uniforms.zoomScale;\n var cameraScale: f32;\n if (isRenderingTerrain == 1.0) {\n cameraScale = 1.0;\n } else {\n cameraScale = projDistance / textUniforms.cameraToCenterDistance;\n }\n let canvasSize = textUniforms.canvasSize;\n if (isPitchWithMap == 0.0) {\n var offset = shape * 2.0 / canvasSize;\n output.position = vec4(output.position.xy + offset * perspectiveRatio * projDistance, output.position.zw);\n } else {\n var offsetScale: f32;\n if (isRenderingTerrain == 1.0) {\n offsetScale = tileRatio / zoomScale;\n } else {\n offsetScale = tileRatio / zoomScale * cameraScale * perspectiveRatio;\n }\n var offset = shape;\n output.position = uniforms.projViewModelMatrix * uniforms.positionMatrix * vec4f(position + vec3f(offset, 0.0) * offsetScale, 1.0);\n }\n let dxdy = vec2f(myTextDx, -myTextDy) * 2.0 / canvasSize * projDistance;\n output.position = vec4(output.position.xy + dxdy, output.position.zw);\n#ifndef PICKING_MODE\n if (isPitchWithMap == 0.0) {\n output.vGammaScale = mix(1.0, cameraScale, uniforms.textPerspectiveRatio);\n } else {\n output.vGammaScale = cameraScale + textUniforms.mapPitch / 4.0;\n }\n output.vTexCoord = texCoord / uniforms.glyphTexSize;\n output.vGammaScale = clamp(output.vGammaScale, 0.0, 1.0);\n output.vTextSize = myTextSize;\n#ifdef ENABLE_COLLISION\n output.vOpacity = f32(input.aOpacity) / 255.0;\n#else\n output.vOpacity = 1.0;\n#endif\n#ifdef HAS_OPACITY\n output.vOpacity *= f32(input.aColorOpacity) / 255.0;\n#endif\n#ifdef HAS_TEXT_FILL\n output.vTextFill = vec4f(input.aTextFill) / 255.0;\n#endif\n#ifdef HAS_TEXT_HALO_FILL\n output.vTextHaloFill = vec4f(input.aTextHaloFill) / 255.0;\n#endif\n#if HAS_TEXT_HALO_RADIUS || HAS_TEXT_HALO_OPACITY\n output.vTextHalo = vec2f(input.aTextHalo);\n#endif\n#if HAS_HIGHLIGHT_COLOR || HAS_HIGHLIGHT_OPACITY\n highlight_setVarying(input, &output);\n#endif\n#else\n#ifdef ENABLE_COLLISION\n var visible = f32(input.aOpacity) == 255.0;\n#else\n var visible = true;\n#endif\n fbo_picking_setData(input, &output, output.position.w, visible);\n#endif\n return output;\n}", Ta = "#define SHADER_NAME TEXT_LINE\n#ifdef HAS_ALTITUDE\nattribute vec2 aPosition;\nattribute float aAltitude;\n#else\nattribute vec3 aPosition;\n#endif\nattribute vec2 aTexCoord;\n#ifdef HAS_OFFSET_Z\nattribute vec3 aOffset;\nuniform float altitudeScale;\n#else\nattribute vec2 aOffset;\n#endif\n#ifdef ENABLE_COLLISION\nattribute float aOpacity;\n#endif\n#ifdef HAS_OPACITY\nattribute float aColorOpacity;\n#endif\n#ifdef HAS_TEXT_SIZE\nattribute float aTextSize;\n#else\nuniform float textSize;\n#endif\n#ifdef HAS_TEXT_DX\nattribute float aTextDx;\n#else\nuniform float textDx;\n#endif\n#ifdef HAS_TEXT_DY\nattribute float aTextDy;\n#else\nuniform float textDy;\n#endif\n#if defined(HAS_PITCH_ALIGN)\nattribute float aPitchAlign;\n#else\nuniform float textPitchWithMap;\n#endif\nuniform float zoomScale;\nuniform float cameraToCenterDistance;\nuniform mat4 projViewModelMatrix;\nuniform float textPerspectiveRatio;\nuniform float mapPitch;\nuniform vec2 glyphTexSize;\nuniform vec2 canvasSize;\nuniform float tileRatio;\nuniform float layerScale;\nuniform float isRenderingTerrain;\nuniform float textPitchFilter;\n#ifndef PICKING_MODE\nvarying vec2 vTexCoord;\nvarying float vGammaScale;\nvarying float vTextSize;\nvarying float vOpacity;\n#ifdef HAS_TEXT_FILL\nattribute vec4 aTextFill;\nvarying vec4 vTextFill;\n#endif\n#ifdef HAS_TEXT_HALO_FILL\nattribute vec4 aTextHaloFill;\nvarying vec4 vTextHaloFill;\n#endif\n#if defined(HAS_TEXT_HALO_RADIUS) || defined(HAS_TEXT_HALO_OPACITY)\nattribute vec2 aTextHalo;\nvarying vec2 vTextHalo;\n#endif\n#include <highlight_vert>\n#else\n#include <fbo_picking_vert>\n#endif\n#include <vt_position_vert>\nvoid main() {\n vec3 c = unpackVTPosition();\n#ifdef HAS_TEXT_DX\nfloat d = aTextDx;\n#else\nfloat d = textDx;\n#endif\n#ifdef HAS_TEXT_DY\nfloat e = aTextDy;\n#else\nfloat e = textDy;\n#endif\n#ifdef HAS_TEXT_SIZE\nfloat f = aTextSize * layerScale;\n#else\nfloat f = textSize * layerScale;\n#endif\n#ifdef HAS_PITCH_ALIGN\nfloat h = aPitchAlign;\n#else\nfloat h = textPitchWithMap;\n#endif\ngl_Position = projViewModelMatrix * vec4(c, 1.);\n float i = gl_Position.w;\n float j = i / cameraToCenterDistance;\n float k;\n if(isRenderingTerrain == 1.) {\n k = 1.;\n } else {\n float l = (1. - cameraToCenterDistance / i) * textPerspectiveRatio;\n k = clamp(.5 + .5 * (1. - l), .0, 4.);\n }\n#ifdef HAS_OFFSET_Z\nvec3 m = aOffset / 10.0;\n m[2] /= altitudeScale;\n#else\nvec3 m = vec3(aOffset / 10.0, .0);\n#endif\nvec2 n = aTexCoord;\n if(h == 1.) {\n float o;\n if(isRenderingTerrain == 1.) {\n o = tileRatio;\n } else {\n o = tileRatio / zoomScale * j * k;\n }\n m.xy *= o;\n gl_Position = projViewModelMatrix * vec4(c + m, 1.);\n } else {\n gl_Position.xy += m.xy * 2. / canvasSize * k * i;\n }\n gl_Position.xy += vec2(d, -e) * 2. / canvasSize * i;\n if(textPitchFilter > .0) {\n if(textPitchFilter == 1. && h == .0 || textPitchFilter == 2. && h == 1.) {\n gl_Position = vec4(-9999., -9999., .0, 1.);\n }\n }\n#ifndef PICKING_MODE\nif(h == 1.) {\n vGammaScale = j + mapPitch / 4.;\n } else {\n vGammaScale = mix(1., j, textPerspectiveRatio);\n }\n vGammaScale = clamp(vGammaScale, .0, 1.);\n vTexCoord = n / glyphTexSize;\n vTextSize = f;\n#ifdef ENABLE_COLLISION\nvOpacity = aOpacity / 255.;\n#else\nvOpacity = 1.;\n#endif\n#ifdef HAS_OPACITY\nvOpacity *= aColorOpacity / 255.;\n#endif\n#ifdef HAS_TEXT_FILL\nvTextFill = aTextFill / 255.;\n#endif\n#ifdef HAS_TEXT_HALO_FILL\nvTextHaloFill = aTextHaloFill / 255.;\n#endif\n#if defined(HAS_TEXT_HALO_RADIUS) || defined(HAS_TEXT_HALO_OPACITY)\nvTextHalo = aTextHalo;\n#endif\nhighlight_setVarying();\n#else\n#ifdef ENABLE_COLLISION\nbool u = aOpacity == 255.;\n#else\nbool u = true;\n#endif\nfbo_picking_setData(gl_Position.w, u);\n#endif\n}", Sa = "#define SHADER_NAME TEXT_LINE\nstruct TextLineUniforms {\n textSize: f32,\n textDx: f32,\n textDy: f32,\n textPitchWithMap: f32,\n projViewModelMatrix: mat4x4f,\n textPerspectiveRatio: f32,\n glyphTexSize: vec2f,\n tileRatio: f32,\n zoomScale: f32,\n}\nstruct ShaderUniforms {\n cameraToCenterDistance: f32,\n mapPitch: f32,\n canvasSize: vec2f,\n textPitchFilter: f32,\n isRenderingTerrain: f32,\n layerScale: f32,\n #ifdef HAS_OFFSET_Z\n altitudeScale: f32,\n #endif\n}\n@group(0) @binding($b) var<uniform> uniforms: TextLineUniforms;\n@group(0) @binding($b) var<uniform> shaderUniforms: ShaderUniforms;\nstruct VertexInput {\n#ifdef HAS_ALTITUDE\n @location($i) aPosition: POSITION_TYPE_2,\n @location($i) aAltitude: f32,\n#else\n @location($i) aPosition: POSITION_TYPE_3,\n#endif\n @location($i) aTexCoord: vec2u,\n#ifdef HAS_OFFSET_Z\n @location($i) aOffset: vec3i,\n#else\n @location($i) aOffset: vec2i,\n#endif\n#ifdef ENABLE_COLLISION\n @location($i) aOpacity: u32,\n#endif\n#ifdef HAS_OPACITY\n @location($i) aColorOpacity: u32,\n#endif\n#ifdef HAS_TEXT_SIZE\n @location($i) aTextSize: u32,\n#endif\n#ifdef HAS_TEXT_DX\n @location($i) aTextDx: i32,\n#endif\n#ifdef HAS_TEXT_DY\n @location($i) aTextDy: i32,\n#endif\n#ifdef HAS_PITCH_ALIGN\n @location($i) aPitchAlign: u32,\n#endif\n#ifdef HAS_TEXT_FILL\n @location($i) aTextFill: vec4u,\n#endif\n#ifdef HAS_TEXT_HALO_FILL\n @location($i) aTextHaloFill: vec4u,\n#endif\n#if HAS_TEXT_HALO_RADIUS || HAS_TEXT_HALO_OPACITY\n @location($i) aTextHalo: vec2u,\n#endif\n};\nstruct VertexOutput {\n @builtin(position) position: vec4f,\n#ifndef PICKING_MODE\n @location($o) vTexCoord: vec2f,\n @location($o) vGammaScale: f32,\n @location($o) vTextSize: f32,\n @location($o) vOpacity: f32,\n #ifdef HAS_TEXT_FILL\n @location($o) vTextFill: vec4f,\n #endif\n #ifdef HAS_TEXT_HALO_FILL\n @location($o) vTextHaloFill: vec4f,\n #endif\n #if HAS_TEXT_HALO_RADIUS || HAS_TEXT_HALO_OPACITY\n @location($o) vTextHalo: vec2f,\n #endif\n#endif\n};\n#include <vt_position_vert>\n#include <fbo_picking_vert>\n@vertex\nfn main(input: VertexInput) -> VertexOutput {\n var output: VertexOutput;\n var position = unpackVTPosition(input);\n#ifdef HAS_TEXT_DX\n var myTextDx = f32(input.aTextDx);\n#else\n var myTextDx = uniforms.textDx;\n#endif\n#ifdef HAS_TEXT_DY\n var myTextDy = f32(input.aTextDy);\n#else\n var myTextDy = uniforms.textDy;\n#endif\n#ifdef HAS_TEXT_SIZE\n var myTextSize = f32(input.aTextSize) * shaderUniforms.layerScale;\n#else\n var myTextSize = uniforms.textSize * shaderUniforms.layerScale;\n#endif\n#ifdef HAS_PITCH_ALIGN\n var isPitchWithMap = f32(input.aPitchAlign);\n#else\n var isPitchWithMap = uniforms.textPitchWithMap;\n#endif\n output.position = uniforms.projViewModelMatrix * vec4f(position, 1.0);\n var projDistance = output.position.w;\n var cameraScale = projDistance / shaderUniforms.cameraToCenterDistance;\n var perspectiveRatio: f32;\n if (shaderUniforms.isRenderingTerrain == 1.0) {\n perspectiveRatio = 1.0;\n } else {\n var distanceRatio = (1.0 - shaderUniforms.cameraToCenterDistance / projDistance) * uniforms.textPerspectiveRatio;\n perspectiveRatio = clamp(\n 0.5 + 0.5 * (1.0 - distanceRatio),\n 0.0,\n 4.0);\n }\n#ifdef HAS_OFFSET_Z\n var offset = vec3f(input.aOffset) / 10.0;\n offset.z /= shaderUniforms.altitudeScale;\n#else\n var offset = vec3f(vec2f(input.aOffset) / 10.0, 0.0);\n#endif\n var texCoord = vec2f(input.aTexCoord);\n if (isPitchWithMap == 1.0) {\n var offsetScale: f32;\n if (shaderUniforms.isRenderingTerrain == 1.0) {\n offsetScale = uniforms.tileRatio;\n } else {\n offsetScale = uniforms.tileRatio / uniforms.zoomScale * cameraScale * perspectiveRatio;\n }\n offset = offset * offsetScale;\n output.position = uniforms.projViewModelMatrix * vec4f(position + offset, 1.0);\n } else {\n let perspOffset = offset.xy * 2.0 / shaderUniforms.canvasSize * perspectiveRatio * projDistance;\n output.position = vec4f(output.position.xy + perspOffset, output.position.zw);\n }\n let dxdy = vec2f(myTextDx, -myTextDy) * 2.0 / shaderUniforms.canvasSize * projDistance;\n output.position = vec4f(output.position.xy + dxdy, output.position.zw);\n if (shaderUniforms.textPitchFilter > 0.0) {\n if ((shaderUniforms.textPitchFilter == 1.0 && isPitchWithMap == 0.0) || (shaderUniforms.textPitchFilter == 2.0 && isPitchWithMap == 1.0)) {\n output.position = vec4f(-9999.0, -9999.0, 0.0, 1.0);\n }\n }\n#ifndef PICKING_MODE\n if (isPitchWithMap == 1.0) {\n output.vGammaScale = cameraScale + shaderUniforms.mapPitch / 4.0;\n } else {\n output.vGammaScale = mix(1.0, cameraScale, uniforms.textPerspectiveRatio);\n }\n output.vGammaScale = clamp(output.vGammaScale, 0.0, 1.0);\n output.vTexCoord = texCoord / uniforms.glyphTexSize;\n output.vTextSize = myTextSize;\n#ifdef ENABLE_COLLISION\n output.vOpacity = f32(input.aOpacity) / 255.0;\n#else\n output.vOpacity = 1.0;\n#endif\n#ifdef HAS_OPACITY\n output.vOpacity *= f32(input.aColorOpacity) / 255.0;\n#endif\n#ifdef HAS_TEXT_FILL\n output.vTextFill = vec4f(input.aTextFill) / 255.0;\n#endif\n#ifdef HAS_TEXT_HALO_FILL\n output.vTextHaloFill = vec4f(input.aTextHaloFill) / 255.0;\n#endif\n#if HAS_TEXT_HALO_RADIUS || HAS_TEXT_HALO_OPACITY\n output.vTextHalo = vec2f(input.aTextHalo);\n#endif\n#if HAS_HIGHLIGHT_COLOR || HAS_HIGHLIGHT_OPACITY\n highlight_setVarying(input, &output);\n#endif\n#else\n#ifdef ENABLE_COLLISION\n var visible = f32(input.aOpacity) == 255.0;\n#else\n var visible = true;\n#endif\n fbo_picking_setData(input, &output, output.position.w, visible);\n#endif\n return output;\n}", wa = "#define SHADER_NAME TEXT_FRAG\nprecision mediump float;\nuniform float layerOpacity;\nvarying vec2 vTexCoord;\nvarying float vOpacity;\nuniform float alphaTest;\n#include <text_render_frag>\n#include <highlight_frag>\nvoid main() {\n gl_FragColor = renderText(vTexCoord) * vOpacity * layerOpacity;\n if(gl_FragColor.a < alphaTest) {\n discard;\n }\n gl_FragColor = highlight_blendColor(gl_FragColor);\n}", Ma = "struct TextFragUniforms {\n layerOpacity: f32,\n}\nstruct TextUniforms {\n alphaTest: f32\n}\n@group(0) @binding($b) var<uniform> uniforms: TextFragUniforms;\n@group(0) @binding($b) var<uniform> textUniforms: TextUniforms;\n#include <text_render_frag>\n#include <highlight_frag>\n@fragment\nfn main(input: VertexOutput) -> @location(0) vec4f {\n var fragColor = renderText(input) * input.vOpacity * uniforms.layerOpacity;\n if (fragColor.a < textUniforms.alphaTest) {\n discard;\n }\n #if HAS_HIGHLIGHT_OPACITY || HAS_HIGHLIGHT_COLOR\n return highlight_blendColor(fragColor, input);\n #else\n return fragColor;\n #endif\n}";
17388
17899
  const {TextUtil: Pa, PackUtil: Ia, FilterUtil: Ca, TEXT_MAX_ANGLE: Oa} = h(), ka = function(e) {
17389
17900
  const t = this.layer.getRenderer();
17390
17901
  return !this._isHalo0(e) && t.isTileNearCamera(e) && "line" !== e.geometry.properties.textPlacement;
@@ -17617,25 +18128,25 @@
17617
18128
  }
17618
18129
  _updateLabelAttributes(e, i, r, o, a, s, l) {
17619
18130
  const h = this.layer.getRenderer(), c = e.material.uniforms, u = 1 === c.textPitchWithMap, f = !u && h.getTerrainHelper && h.getTerrainHelper(), d = this.isEnableCollision(), p = this.getMap(), g = e.geometry, m = g.desc.positionSize, {aShape: y, aOffset: x, aAnchor: _, aAltitude: v, aPitchRotation: A} = g.properties;
17620
- let {aProjectedAnchor: T} = g.properties;
17621
- T || (T = g.properties.aProjectedAnchor = new Array(_.length / m * 3));
17622
- const b = g.properties.aTextSize, S = !l, w = i[r], M = w * m;
18131
+ let {aProjectedAnchor: b} = g.properties;
18132
+ b || (b = g.properties.aProjectedAnchor = new Array(_.length / m * 3));
18133
+ const T = g.properties.aTextSize, S = !l, w = i[r], M = w * m;
17623
18134
  let P;
17624
18135
  P = g.data.aAltitude ? n.vec3.set(za, _[M], _[M + 1], v[w]) : Ia.unpackPosition(za, _[M], _[M + 1], _[M + 2]);
17625
18136
  const I = pi(Va, P, s, p.width, p.height), C = g.properties.aTerrainAltitude;
17626
18137
  let O;
17627
18138
  if (C) {
17628
18139
  const e = C[w];
17629
- if (e === ut) return T[3 * w] = ct, T[3 * w + 1] = ct, T[3 * w + 2] = ct, !1;
18140
+ if (e === ut) return b[3 * w] = ct, b[3 * w + 1] = ct, b[3 * w + 2] = ct, !1;
17630
18141
  e ? (O = n.vec3.set(is, ...P), O[2] = 100 * e, O = pi(O, O, s, p.width, p.height)) : O = I;
17631
18142
  } else O = I;
17632
18143
  const k = t.MapStateCache[p.id], R = k ? k.devicePixelRatio : p.getdevicePixelRatio();
17633
- if (n.vec4.scale(os, O, 1 / R), p.isOffscreen(os)) return d || ss(x, i, r, o), T[3 * w] = ct,
17634
- T[3 * w + 1] = ct, T[3 * w + 2] = ct, !1;
17635
- S && (P = I), T[3 * w] = O[0], T[3 * w + 1] = O[1], T[3 * w + 2] = O[2];
18144
+ if (n.vec4.scale(os, O, 1 / R), p.isOffscreen(os)) return d || ss(x, i, r, o), b[3 * w] = ct,
18145
+ b[3 * w + 1] = ct, b[3 * w + 2] = ct, !1;
18146
+ S && (P = I), b[3 * w] = O[0], b[3 * w + 1] = O[1], b[3 * w + 2] = O[2];
17636
18147
  const F = S ? 1 : g.properties.tileExtent / this.layer.getTileSize().width;
17637
18148
  let E = !0;
17638
- const D = i[r], H = i[o - 1], L = b ? b[D] : e.properties.textSize, N = this._updateNormal(e, L, a, D, H, P, za, F, l);
18149
+ const D = i[r], H = i[o - 1], L = T ? T[D] : e.properties.textSize, N = this._updateNormal(e, L, a, D, H, P, za, F, l);
17639
18150
  if (null === N) return ss(x, i, r, o), !1;
17640
18151
  const z = H - D <= 3, V = Math.floor(N / 2), U = N % 2;
17641
18152
  for (let t = r; t < o; t += 6) {
@@ -17709,7 +18220,7 @@
17709
18220
  name: "text",
17710
18221
  vert: Aa,
17711
18222
  frag: wa,
17712
- wgslVert: Ta,
18223
+ wgslVert: ba,
17713
18224
  wgslFrag: Ma,
17714
18225
  uniforms: t,
17715
18226
  defines: a,
@@ -17720,7 +18231,7 @@
17720
18231
  s.stencil = At({}, i.stencil), s.stencil.enable = !0, s.stencil.func.cmp = "<",
17721
18232
  s.stencil.func.ref = (e, t) => 2 * t.level + (t.isHalo || 0) + 1), this._shaderAlongLine = new n.reshader.MeshShader({
17722
18233
  name: "text-along-line",
17723
- vert: ba,
18234
+ vert: Ta,
17724
18235
  frag: wa,
17725
18236
  wgslVert: Sa,
17726
18237
  wgslFrag: Ma,
@@ -17733,7 +18244,7 @@
17733
18244
  }, a), i = new n.reshader.FBORayPicking(this.renderer, {
17734
18245
  name: "text-picking",
17735
18246
  vert: Aa,
17736
- wgslVert: Ta,
18247
+ wgslVert: ba,
17737
18248
  defines: e,
17738
18249
  uniforms: t,
17739
18250
  extraCommandProps: {
@@ -17746,7 +18257,7 @@
17746
18257
  };
17747
18258
  const r = new n.reshader.FBORayPicking(this.renderer, {
17748
18259
  name: "line-text-picking",
17749
- vert: ba,
18260
+ vert: Ta,
17750
18261
  wgslVert: Sa,
17751
18262
  uniforms: t,
17752
18263
  defines: e,
@@ -18039,7 +18550,7 @@
18039
18550
  return "lines";
18040
18551
  }
18041
18552
  }
18042
- const {DEFAULT_TEX_WIDTH: ys} = h(), xs = [ 1, 1, 1 ], _s = [ 1, 1, 1, 1 ], vs = [ 0, 0 ], As = [ 1, 1 ], Ts = [], bs = new r.Coordinate(0, 0), Ss = new r.Coordinate(0, 0), ws = [], Ms = [];
18553
+ const {DEFAULT_TEX_WIDTH: ys} = h(), xs = [ 1, 1, 1 ], _s = [ 1, 1, 1, 1 ], vs = [ 0, 0 ], As = [ 1, 1 ], bs = [], Ts = new r.Coordinate(0, 0), Ss = new r.Coordinate(0, 0), ws = [], Ms = [];
18043
18554
  class Ps extends Li {
18044
18555
  isEnableTileStencil() {
18045
18556
  return !1;
@@ -18146,8 +18657,8 @@
18146
18657
  if (1 === this.dataConfig.topUVMode) return e[0] = 0, e[1] = 0, e;
18147
18658
  const s = this.getMap(), l = this.getSymbol(t).material;
18148
18659
  let h = i;
18149
- !this.dataConfig.side && l && l.textureOrigin && (bs.set(l.textureOrigin[0], l.textureOrigin[1]),
18150
- s.coordToPointAtRes(bs, r, Ss), h = n.vec2.set(ws, i[0] - Ss.x, i[1] - Ss.y));
18660
+ !this.dataConfig.side && l && l.textureOrigin && (Ts.set(l.textureOrigin[0], l.textureOrigin[1]),
18661
+ s.coordToPointAtRes(Ts, r, Ss), h = n.vec2.set(ws, i[0] - Ss.x, i[1] - Ss.y));
18151
18662
  const c = !!l && l.uvOffsetInMeter;
18152
18663
  let u = l && l.uvOffset || vs;
18153
18664
  const f = this.getUVOffsetAnim();
@@ -18165,7 +18676,7 @@
18165
18676
  super.callShader(e, t);
18166
18677
  }
18167
18678
  getShadowMeshes() {
18168
- if (!this.isVisible()) return Ts;
18679
+ if (!this.isVisible()) return bs;
18169
18680
  this.shadowCount = this.scene.getMeshes().length;
18170
18681
  const e = this.scene.getMeshes().filter((e => 0 === e.properties.level));
18171
18682
  for (let t = 0; t < e.length; t++) {
@@ -18992,9 +19503,9 @@
18992
19503
  };
18993
19504
  const x = this._hasFuncType(), _ = this._getMeterScale(), v = n.mat4.identity([]);
18994
19505
  n.mat4.scale(v, v, [ _, _, _ ]);
18995
- const A = [], T = this.getSymbols();
18996
- for (let e = 0; e < T.length; e++) {
18997
- const t = T[e], r = this._gltfMeshInfos[e];
19506
+ const A = [], b = this.getSymbols();
19507
+ for (let e = 0; e < b.length; e++) {
19508
+ const t = b[e], r = this._gltfMeshInfos[e];
18998
19509
  if (!r) continue;
18999
19510
  const o = this._gltfPack[e][0], {fixSizeOnZoom: h} = t;
19000
19511
  let c = n.mat4.identity([]);
@@ -19010,8 +19521,8 @@
19010
19521
  const s = this._calAnchorTranslation(a, t);
19011
19522
  Math.abs(s) > Math.abs(u) && (u = s);
19012
19523
  }));
19013
- const _ = [ 0, 0, u ], b = r.map(((r, x) => {
19014
- const {geometry: v, materialInfo: A, morphWeights: T, extraInfo: b, nodeIndex: S} = r;
19524
+ const _ = [ 0, 0, u ], T = r.map(((r, x) => {
19525
+ const {geometry: v, materialInfo: A, morphWeights: b, extraInfo: T, nodeIndex: S} = r;
19015
19526
  t.alphaTest && (A.alphaTest = t.alphaTest);
19016
19527
  const w = new (this.getMaterialClazz(A))(A), M = {}, P = new n.reshader.InstancedMesh(g, f, v, w, {
19017
19528
  transparent: !1,
@@ -19023,14 +19534,14 @@
19023
19534
  P.setUniform("numJoints", t.numJoints), P.setUniform("skinAnimation", +this._isSkinAnimating(e)),
19024
19535
  P.properties.startTime = a, M.HAS_SKIN = 1;
19025
19536
  }
19026
- T && (P.setUniform("morphWeights", T), M.HAS_MORPH = 1);
19537
+ b && (P.setUniform("morphWeights", b), M.HAS_MORPH = 1);
19027
19538
  let I = t.markerOpacity;
19028
19539
  I || 0 === I || (I = 1);
19029
19540
  let C = t.markerFill;
19030
19541
  if (C && De(C) && C.startsWith("rgba")) {
19031
19542
  I *= Nt(C);
19032
19543
  }
19033
- P.setUniform("hasAlpha", b.alphaMode && "BLEND" === b.alphaMode.toUpperCase() || I < 1),
19544
+ P.setUniform("hasAlpha", T.alphaMode && "BLEND" === T.alphaMode.toUpperCase() || I < 1),
19034
19545
  Mt(P.uniforms, "polygonFill", t, "markerFill", rl, Ct(this.colorCache)), Mt(P.uniforms, "polygonOpacity", t, "markerOpacity", 1);
19035
19546
  const O = [];
19036
19547
  P.setPositionMatrix((() => {
@@ -19057,7 +19568,7 @@
19057
19568
  index: e
19058
19569
  }, P;
19059
19570
  }));
19060
- A.push(...b);
19571
+ A.push(...T);
19061
19572
  }
19062
19573
  return A.insContext = {
19063
19574
  instanceData: d,
@@ -19076,7 +19587,7 @@
19076
19587
  gapLength: this.dataConfig.gapLength || 0,
19077
19588
  direction: this.dataConfig.direction || 0,
19078
19589
  scaleVertex: !0
19079
- }, f = this._gltfPack[0][0], {aPosition: d, aAltitude: p, aPickingId: g} = s, m = new t.Coordinate(0, 0, 0), y = new t.Coordinate(0, 0, 0), x = [], _ = p ? [] : x, v = [], A = [], T = [], b = [], S = [], w = [], M = this.layer.getTileSize().width / o * this.layer.getRenderer().getTileGLScale(a), P = this.layer.getRenderer().getZScale();
19590
+ }, f = this._gltfPack[0][0], {aPosition: d, aAltitude: p, aPickingId: g} = s, m = new t.Coordinate(0, 0, 0), y = new t.Coordinate(0, 0, 0), x = [], _ = p ? [] : x, v = [], A = [], b = [], T = [], S = [], w = [], M = this.layer.getTileSize().width / o * this.layer.getRenderer().getTileGLScale(a), P = this.layer.getRenderer().getZScale();
19080
19591
  let I = g[0];
19081
19592
  const C = [];
19082
19593
  for (let e = 0; e < d.length - l; e += l) {
@@ -19097,15 +19608,15 @@
19097
19608
  m.set(i, o, a), y.set(c, O, k);
19098
19609
  const n = ll(m, y, t.t);
19099
19610
  x.push(n.x, n.y), _.push(n.z), v.push(R), A.push(-t.rotationZ * Math.PI / 180),
19100
- T.push(t.rotationXY * Math.PI / 180), b.push(...t.scale);
19611
+ b.push(t.rotationXY * Math.PI / 180), T.push(...t.scale);
19101
19612
  }
19102
19613
  }
19103
19614
  i.data = {
19104
19615
  aPosition: new d.constructor(x),
19105
19616
  aPickingId: new g.constructor(v),
19106
19617
  aZRotation: A,
19107
- aXYRotation: T,
19108
- aScaleXYZ: b
19618
+ aXYRotation: b,
19619
+ aScaleXYZ: T
19109
19620
  }, p && (i.data.aAltitude = new p.constructor(_));
19110
19621
  }
19111
19622
  _calGLTFScale(e) {
@@ -19174,15 +19685,15 @@
19174
19685
  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];
19175
19686
  }
19176
19687
  const {aPosition: h, aPickingId: c, aXYRotation: u, aZRotation: f, aAltitude: d, aScaleXYZ: p} = o, g = h.length / a, m = this.layer.getTileSize().width / i * this.layer.getRenderer().getTileGLScale(r), y = this.layer.getRenderer().getZScale(), x = 100 * (this.dataConfig.altitudeOffset || 0);
19177
- let _ = 1 / 0, v = 1 / 0, A = 1 / 0, T = -1 / 0, b = -1 / 0, S = -1 / 0;
19688
+ let _ = 1 / 0, v = 1 / 0, A = 1 / 0, b = -1 / 0, T = -1 / 0, S = -1 / 0;
19178
19689
  const w = [], M = [];
19179
19690
  for (let e = 0; e < g; e++) {
19180
19691
  d ? n.vec3.set(M, h[e * a], h[e * a + 1], d[e]) : Xs.unpackPosition(M, h[e * a], h[e * a + 1], h[e * a + 2]);
19181
19692
  const t = n.vec3.set(w, M[0] * m, -M[1] * m, (M[2] + x) * y);
19182
- t[0] < _ && (_ = t[0]), t[0] > T && (T = t[0]), t[1] < v && (v = t[1]), t[1] > b && (b = t[1]),
19693
+ t[0] < _ && (_ = t[0]), t[0] > b && (b = t[0]), t[1] < v && (v = t[1]), t[1] > T && (T = t[1]),
19183
19694
  t[2] < A && (A = t[2]), t[2] > S && (S = t[2]);
19184
19695
  }
19185
- const P = (_ + T) / 2, I = (v + b) / 2, C = (A + S) / 2, O = [], k = this._hasFuncType(), R = [ 0, 0, 1 ], F = [ 0, 0, 0 ];
19696
+ const P = (_ + b) / 2, I = (v + T) / 2, C = (A + S) / 2, O = [], k = this._hasFuncType(), R = [ 0, 0, 1 ], F = [ 0, 0, 0 ];
19186
19697
  for (let t = 0; t < g; t++) {
19187
19698
  d ? n.vec3.set(M, h[t * a], h[t * a + 1], d[t]) : Xs.unpackPosition(M, h[t * a], h[t * a + 1], h[t * a + 2]);
19188
19699
  const i = M[0], r = M[1], o = n.vec3.set(w, i * m - P, -r * m - I, (M[2] + x) * y - C), g = n.vec3.set(Ks, 1, 1, 1);
@@ -19220,13 +19731,13 @@
19220
19731
  let c = l.translationX || 0, u = l.translationY || 0, f = l.translationZ || 0;
19221
19732
  a && (c = u = f = 0);
19222
19733
  let d = l.rotationX || 0, p = l.rotationY || 0, g = l.rotationZ || 0, m = l.scaleX || 1, y = l.scaleY || 1, x = l.scaleZ || 1;
19223
- const _ = r && r[o], v = i && i[_], A = t.MapStateCache[s.id], T = A ? A.zoom : s.getZoom(), b = v && v.feature && v.feature.properties, S = this._getModelHeightScale(T, b);
19224
- a || (this._txFn && (c = this._txFn(T, b)), this._tyFn && (u = this._tyFn(T, b)),
19225
- this._tzFn && (f = this._tzFn(T, b)));
19734
+ const _ = r && r[o], v = i && i[_], A = t.MapStateCache[s.id], b = A ? A.zoom : s.getZoom(), T = v && v.feature && v.feature.properties, S = this._getModelHeightScale(b, T);
19735
+ a || (this._txFn && (c = this._txFn(b, T)), this._tyFn && (u = this._tyFn(b, T)),
19736
+ this._tzFn && (f = this._tzFn(b, T)));
19226
19737
  const w = n.vec3.set(Ys, c * h, u * h, f * h);
19227
- this._rxFn && (d = this._rxFn(T, b)), this._ryFn && (p = this._ryFn(T, b)), this._rzFn && (g = this._rzFn(T, b));
19738
+ this._rxFn && (d = this._rxFn(b, T)), this._ryFn && (p = this._ryFn(b, T)), this._rzFn && (g = this._rzFn(b, T));
19228
19739
  const M = n.vec3.set(qs, d, p, g);
19229
- this._sxFn && (m = this._sxFn(T, b)), this._syFn && (y = this._syFn(T, b)), this._szFn && (x = this._szFn(T, b));
19740
+ this._sxFn && (m = this._sxFn(b, T)), this._syFn && (y = this._syFn(b, T)), this._szFn && (x = this._szFn(b, T));
19230
19741
  const P = n.vec3.set(Zs, m * S, y * S, x * S);
19231
19742
  return this._getGLTFMatrix(e, w, M, P);
19232
19743
  }
@@ -19611,11 +20122,11 @@
19611
20122
  return n = t, t = Math.PI * n / 180, e[0] = Math.sin(t), e[1] = Math.cos(t), e;
19612
20123
  }
19613
20124
  var vl = "#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}", Al = "#ifdef HAS_ALTITUDE\n struct VertexInput {\n @location($i) aPosition: vec2i,\n @location($i) aAltitude: f32,\n#else\n struct VertexInput {\n @location($i) aPosition: vec4i,\n#endif\n @location($i) aExtrude: vec2i,\n @location($i) aTexCoord: vec2i,\n @location($i) aQuat: vec4f,\n };\nstruct VertexOutput {\n @builtin(position) position: vec4f,\n @location($o) vTexCoord: vec2f,\n};\nstruct BillboardUniforms {\n positionMatrix: mat4x4f,\n projViewModelMatrix: mat4x4f,\n extrudeScale: f32,\n};\n@group(0) @binding($b) var<uniform> uniforms: BillboardUniforms;\n#ifdef PICKING_MODE\n #include <fbo_picking_vert>\n#endif\n#include <vt_position_vert>\n#if HAS_SHADOWING && !HAS_BLOOM\n #include <vsm_shadow_vert>\n#endif\nfn quatToMat4(q: vec4f) -> mat4x4f {\n let x = q.x;\n let y = q.y;\n let z = q.z;\n let w = q.w;\n let x2 = x * x;\n let y2 = y * y;\n let z2 = z * z;\n let xy = x * y;\n let xz = x * z;\n let yz = y * z;\n let wx = w * x;\n let wy = w * y;\n let wz = w * z;\n return mat4x4f(\n 1.0 - 2.0 * (y2 + z2), 2.0 * (xy - wz), 2.0 * (xz + wy), 0.0,\n 2.0 * (xy + wz), 1.0 - 2.0 * (x2 + z2), 2.0 * (yz - wx), 0.0,\n 2.0 * (xz - wy), 2.0 * (yz + wx), 1.0 - 2.0 * (x2 + y2), 0.0,\n 0.0, 0.0, 0.0, 1.0\n );\n}\n@vertex\nfn main(\n input: VertexInput\n) -> VertexOutput {\n var output: VertexOutput;\n let extrude = vec4f(f32(input.aExtrude.x) * uniforms.extrudeScale, 0.0, f32(input.aExtrude.y), 1.0);\n let rotationMat4 = quatToMat4(input.aQuat);\n let offset = (rotationMat4 * extrude).xyz;\n let position = unpackVTPositionOffset(input, offset);\n output.vTexCoord = vec2f(input.aTexCoord);\n output.position = uniforms.projViewModelMatrix * uniforms.positionMatrix * vec4f(position, 1.0);\n #ifdef PICKING_MODE\n fbo_picking_setData(output.position.w, true);\n #elif HAS_SHADOWING && !HAS_BLOOM\n shadow_computeShadowPars(vec4f(position, 1.0), &output);\n #endif\n return output;\n}";
19614
- function Tl(e, t, n) {
20125
+ function bl(e, t, n) {
19615
20126
  n = n || {}, this.w = e || 64, this.h = t || 64, this.autoResize = !!n.autoResize,
19616
20127
  this.shelves = [], this.freebins = [], this.stats = {}, this.bins = {}, this.maxId = 0;
19617
20128
  }
19618
- function bl(e, t, n) {
20129
+ function Tl(e, t, n) {
19619
20130
  this.x = 0, this.y = e, this.w = this.free = t, this.h = n;
19620
20131
  }
19621
20132
  function Sl(e, t, n, i, r, o, a) {
@@ -19644,7 +20155,7 @@
19644
20155
  }
19645
20156
  return t;
19646
20157
  }
19647
- Tl.prototype.pack = function(e, t) {
20158
+ bl.prototype.pack = function(e, t) {
19648
20159
  e = [].concat(e), t = t || {};
19649
20160
  for (var n, i, r, o, a = [], s = 0; s < e.length; s++) if (n = e[s].w || e[s].width,
19650
20161
  i = e[s].h || e[s].height, r = e[s].id, n && i) {
@@ -19652,7 +20163,7 @@
19652
20163
  t.inPlace && (e[s].x = o.x, e[s].y = o.y, e[s].id = o.id), a.push(o);
19653
20164
  }
19654
20165
  return this.shrink(), a;
19655
- }, Tl.prototype.packOne = function(e, t, n) {
20166
+ }, bl.prototype.packOne = function(e, t, n) {
19656
20167
  var i, r, o, a, s, l, h, c, u = {
19657
20168
  freebin: -1,
19658
20169
  shelf: -1,
@@ -19672,18 +20183,18 @@
19672
20183
  t > r.h || t < r.h && (o = (r.h - t) * e) < u.waste && (u.freebin = -1, u.waste = o,
19673
20184
  u.shelf = a);
19674
20185
  }
19675
- 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 bl(f, this.w, t),
20186
+ 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 Tl(f, this.w, t),
19676
20187
  this.allocShelf(this.shelves.push(r) - 1, e, t, n)) : this.autoResize ? (s = l = this.h,
19677
20188
  ((h = c = this.w) <= s || e > h) && (c = 2 * Math.max(e, h)), (s < h || t > s) && (l = 2 * Math.max(t, s)),
19678
20189
  this.resize(c, l), this.packOne(e, t, n)) : null;
19679
- }, Tl.prototype.allocFreebin = function(e, t, n, i) {
20190
+ }, bl.prototype.allocFreebin = function(e, t, n, i) {
19680
20191
  var r = this.freebins.splice(e, 1)[0];
19681
20192
  return r.id = i, r.w = t, r.h = n, r.refcount = 0, this.bins[i] = r, this.ref(r),
19682
20193
  r;
19683
- }, Tl.prototype.allocShelf = function(e, t, n, i) {
20194
+ }, bl.prototype.allocShelf = function(e, t, n, i) {
19684
20195
  var r = this.shelves[e].alloc(t, n, i);
19685
20196
  return this.bins[i] = r, this.ref(r), r;
19686
- }, Tl.prototype.shrink = function() {
20197
+ }, bl.prototype.shrink = function() {
19687
20198
  if (this.shelves.length > 0) {
19688
20199
  for (var e = 0, t = 0, n = 0; n < this.shelves.length; n++) {
19689
20200
  var i = this.shelves[n];
@@ -19691,28 +20202,28 @@
19691
20202
  }
19692
20203
  this.resize(e, t);
19693
20204
  }
19694
- }, Tl.prototype.getBin = function(e) {
20205
+ }, bl.prototype.getBin = function(e) {
19695
20206
  return this.bins[e];
19696
- }, Tl.prototype.ref = function(e) {
20207
+ }, bl.prototype.ref = function(e) {
19697
20208
  if (1 == ++e.refcount) {
19698
20209
  var t = e.h;
19699
20210
  this.stats[t] = 1 + (0 | this.stats[t]);
19700
20211
  }
19701
20212
  return e.refcount;
19702
- }, Tl.prototype.unref = function(e) {
20213
+ }, bl.prototype.unref = function(e) {
19703
20214
  return 0 === e.refcount ? 0 : (0 == --e.refcount && (this.stats[e.h]--, delete this.bins[e.id],
19704
20215
  this.freebins.push(e)), e.refcount);
19705
- }, Tl.prototype.clear = function() {
20216
+ }, bl.prototype.clear = function() {
19706
20217
  this.shelves = [], this.freebins = [], this.stats = {}, this.bins = {}, this.maxId = 0;
19707
- }, Tl.prototype.resize = function(e, t) {
20218
+ }, bl.prototype.resize = function(e, t) {
19708
20219
  this.w = e, this.h = t;
19709
20220
  for (var n = 0; n < this.shelves.length; n++) this.shelves[n].resize(e);
19710
20221
  return !0;
19711
- }, bl.prototype.alloc = function(e, t, n) {
20222
+ }, Tl.prototype.alloc = function(e, t, n) {
19712
20223
  if (e > this.free || t > this.h) return null;
19713
20224
  var i = this.x;
19714
20225
  return this.x += e, this.free -= e, new Sl(n, i, this.y, e, t, e, this.h);
19715
- }, bl.prototype.resize = function(e) {
20226
+ }, Tl.prototype.resize = function(e) {
19716
20227
  return this.free += e - this.w, this.w = e, !0;
19717
20228
  };
19718
20229
  class Pl {
@@ -19908,16 +20419,16 @@
19908
20419
  const t = 6 * e;
19909
20420
  A.push(t, t + 1, t + 2), A.push(t + 3, t + 4, t + 5);
19910
20421
  }
19911
- const T = {
20422
+ const b = {
19912
20423
  aPosition: f,
19913
20424
  aPickingId: g,
19914
20425
  aExtrude: d,
19915
20426
  aQuat: p,
19916
20427
  aTexCoord: _
19917
- }, {feaPickingIdMap: b, aFeaIds: S} = e.properties, w = new S.constructor(u);
19918
- for (let e = 0; e < g.length; e++) w[e] = b[g[e]];
20428
+ }, {feaPickingIdMap: T, aFeaIds: S} = e.properties, w = new S.constructor(u);
20429
+ for (let e = 0; e < g.length; e++) w[e] = T[g[e]];
19919
20430
  s.aFeaIds = w, s.aTexCoord = _;
19920
- const M = new n.reshader.Geometry(T, new v(A), 0, {
20431
+ const M = new n.reshader.Geometry(b, new v(A), 0, {
19921
20432
  positionSize: t
19922
20433
  });
19923
20434
  return M.properties = e.properties, M;
@@ -19942,7 +20453,7 @@
19942
20453
  Cl[0] = s, Cl[1] = l, e.set(Cl, h + 10);
19943
20454
  }
19944
20455
  _fillFnTextureData(e, t, n) {
19945
- const i = t.properties, {textureCache: r, oldPickingId: o} = i, a = o.length, s = new Tl(0, 0, {
20456
+ const i = t.properties, {textureCache: r, oldPickingId: o} = i, a = o.length, s = new bl(0, 0, {
19946
20457
  autoResize: !0
19947
20458
  }), l = (kl || (kl = document.createElement("canvas")), kl), h = l.getContext("2d");
19948
20459
  s.pack(n, {
@@ -20242,9 +20753,6 @@
20242
20753
  constructor(e, t) {
20243
20754
  (t = t || {}).spatialReference = null, super(e, t), this._idMaps = new Map, this.setData(t.data);
20244
20755
  }
20245
- onAdd() {
20246
- this._prepareOptions();
20247
- }
20248
20756
  _prepareOptions() {
20249
20757
  const e = this.getMap(), t = e.getMaxNativeZoom(), n = e.getProjection(), i = "EPSG:4326" === n.code || "EPSG:4490" === n.code;
20250
20758
  var r;
@@ -20518,7 +21026,7 @@
20518
21026
  this.layer._sortGeometries();
20519
21027
  const r = this.layer.getGeometries();
20520
21028
  for (let o = 0; o < r.length; o++) {
20521
- const a = r[o][Tr];
21029
+ const a = r[o][br];
20522
21030
  if (!this.features[a]) continue;
20523
21031
  const s = this.features[a];
20524
21032
  if (Array.isArray(s)) for (let r = 0; r < s.length; r++) {
@@ -20601,10 +21109,10 @@
20601
21109
  return n && n(t) || t;
20602
21110
  }
20603
21111
  });
20604
- const t = !this._isEnableWorkAround("win-intel-gpu-crash");
21112
+ const t = !this._isEnableWorkAround("win-intel-gpu-crash"), n = e.options.sdfURL;
20605
21113
  this._glyphRequestor = new oh((t => {
20606
21114
  e.getMap().getRenderer().callInNextFrame(t);
20607
- }), e.options.glyphSdfLimitPerFrame, t), this.requestor = this._fetchPattern.bind(this),
21115
+ }), e.options.glyphSdfLimitPerFrame, t, n), this.requestor = this._fetchPattern.bind(this),
20608
21116
  this._markerRequestor = this._fetchIconGlyphs.bind(this);
20609
21117
  }
20610
21118
  _fetchPattern(e, t, n) {
@@ -20746,7 +21254,7 @@
20746
21254
  if (!n) return this.markRebuild(), this.setToRedraw(), !1;
20747
21255
  const h = e._getInternalSymbol(), c = this.getMap(), u = r.MapStateCache[c.id], f = {
20748
21256
  zoom: u ? u.zoom : c.getZoom()
20749
- }, d = e[Tr];
21257
+ }, d = e[br];
20750
21258
  let p = this.features[d];
20751
21259
  Array.isArray(p) || (p = [ p ]);
20752
21260
  const g = [];
@@ -20849,8 +21357,8 @@
20849
21357
  }
20850
21358
  }
20851
21359
  _convertGeo(e) {
20852
- void 0 === e[Tr] && (e[Tr] = this._counter++);
20853
- const t = e[Tr];
21360
+ void 0 === e[br] && (e[br] = this._counter++);
21361
+ const t = e[br];
20854
21362
  this.features[t] && this._removeFeatures(t), this.features[t] = wr(e, this._kidGen, this.features[t]),
20855
21363
  this.featuresChanged = !0;
20856
21364
  const n = this.features[t];
@@ -20861,21 +21369,21 @@
20861
21369
  const n = Array.isArray(e) ? e[0].id : e.id;
20862
21370
  if (this._featureMapping[n] = e, Array.isArray(e)) for (let n = 0; n < e.length; n++) {
20863
21371
  const i = e[n][ph];
20864
- if (e[n][Tr] = t, this._allFeatures[i] = {
21372
+ if (e[n][br] = t, this._allFeatures[i] = {
20865
21373
  feature: e[n]
20866
- }, this._allFeatures[i][Tr] = t, !this.needCheckPointLineSymbols()) continue;
21374
+ }, this._allFeatures[i][br] = t, !this.needCheckPointLineSymbols()) continue;
20867
21375
  const r = {
20868
21376
  feature: e[n]
20869
21377
  };
20870
- (Ah(e[n]) || Th(e[n])) && (this._markerFeatures[i] = r), Th(e[n]) && (this._textFeatures[i] = r),
21378
+ (Ah(e[n]) || bh(e[n])) && (this._markerFeatures[i] = r), bh(e[n]) && (this._textFeatures[i] = r),
20871
21379
  wh(e[n]) && (this._lineFeatures[i] = r);
20872
21380
  } else {
20873
- e[Tr] = t;
21381
+ e[br] = t;
20874
21382
  const n = {
20875
21383
  feature: e
20876
21384
  }, i = e[ph];
20877
21385
  if (this._allFeatures[i] = n, !this.needCheckPointLineSymbols()) return;
20878
- (Ah(e) || Th(e)) && (this._markerFeatures[i] = n), Th(e) && (this._textFeatures[i] = n),
21386
+ (Ah(e) || bh(e)) && (this._markerFeatures[i] = n), bh(e) && (this._textFeatures[i] = n),
20879
21387
  wh(e) && (this._lineFeatures[i] = n);
20880
21388
  }
20881
21389
  }
@@ -20905,14 +21413,14 @@
20905
21413
  if (!r) return;
20906
21414
  const o = r.pick(e, t, n.tolerance);
20907
21415
  if (o && o.data && o.data.feature) {
20908
- const e = o.data.feature, t = this._geometries[e[Tr]];
21416
+ const e = o.data.feature, t = this._geometries[e[br]];
20909
21417
  n && n.includeInternals ? i.push(t) : (o.geometry = t, delete o.plugin, delete o.data,
20910
21418
  delete o.point, i.push(o));
20911
21419
  }
20912
21420
  })), i;
20913
21421
  }
20914
21422
  _getFeaKeyId(e) {
20915
- const t = e[Tr], n = this.features[t];
21423
+ const t = e[br], n = this.features[t];
20916
21424
  return Array.isArray(n) ? n[0][ph] : n[ph];
20917
21425
  }
20918
21426
  _updateDirtyTargets() {
@@ -20941,7 +21449,7 @@
20941
21449
  if (this.setToRedraw(), this.canvas && e && e.length) {
20942
21450
  for (let t = 0; t < e.length; t++) {
20943
21451
  const n = e[t];
20944
- n && delete n[Tr];
21452
+ n && delete n[br];
20945
21453
  }
20946
21454
  this._convertGeometries(e), this.markRebuild(), _h(this);
20947
21455
  }
@@ -20949,8 +21457,8 @@
20949
21457
  onGeometryRemove(e) {
20950
21458
  if (e && e.length) {
20951
21459
  for (let t = 0; t < e.length; t++) {
20952
- const n = e[t], i = n[Tr];
20953
- void 0 !== i && (delete n[Tr], delete this._geometries[i], this._removeFeatures(i),
21460
+ const n = e[t], i = n[br];
21461
+ void 0 !== i && (delete n[br], delete this._geometries[i], this._removeFeatures(i),
20954
21462
  delete this.features[i], this.featuresChanged = !0);
20955
21463
  }
20956
21464
  this.markRebuild(), _h(this), this.layer.fire("removegeo", {
@@ -20961,7 +21469,7 @@
20961
21469
  }
20962
21470
  }
20963
21471
  onGeometrySymbolChange(e) {
20964
- const t = e.target._getParent() || e.target, n = t[Tr];
21472
+ const t = e.target._getParent() || e.target, n = t[br];
20965
21473
  if (void 0 === n) return;
20966
21474
  let i = e.properties;
20967
21475
  if (Array.isArray(i)) {
@@ -20986,25 +21494,25 @@
20986
21494
  }
20987
21495
  onGeometryShapeChange(e) {
20988
21496
  const t = e.target._getParent() || e.target;
20989
- void 0 !== t[Tr] && (this._convertGeometries([ t ]), this.markRebuildGeometry(),
21497
+ void 0 !== t[br] && (this._convertGeometries([ t ]), this.markRebuildGeometry(),
20990
21498
  _h(this));
20991
21499
  }
20992
21500
  onGeometryPositionChange(e) {
20993
- const t = e.target._getParent() || e.target, n = t[Tr];
21501
+ const t = e.target._getParent() || e.target, n = t[br];
20994
21502
  void 0 !== n && (this._convertGeometries([ t ]), this._dirtyTargetsInCurrentFrame[n] = t,
20995
21503
  _h(this));
20996
21504
  }
20997
21505
  onGeometryZIndexChange(e) {
20998
- void 0 !== (e.target._getParent() || e.target)[Tr] && this.markRebuild();
21506
+ void 0 !== (e.target._getParent() || e.target)[br] && this.markRebuild();
20999
21507
  }
21000
21508
  onGeometryShow(e) {
21001
- void 0 !== (e.target._getParent() || e.target)[Tr] && this._onShowHide(e);
21509
+ void 0 !== (e.target._getParent() || e.target)[br] && this._onShowHide(e);
21002
21510
  }
21003
21511
  onGeometryHide(e) {
21004
- void 0 !== (e.target._getParent() || e.target)[Tr] && this._onShowHide(e);
21512
+ void 0 !== (e.target._getParent() || e.target)[br] && this._onShowHide(e);
21005
21513
  }
21006
21514
  _onShowHide(e) {
21007
- const t = e.target._getParent() || e.target, n = t[Tr], i = this.features[n];
21515
+ const t = e.target._getParent() || e.target, n = t[br], i = this.features[n];
21008
21516
  if (i) {
21009
21517
  const e = t.isVisible();
21010
21518
  if (Array.isArray(i)) {
@@ -21021,7 +21529,7 @@
21021
21529
  this._showHideUpdated = !0;
21022
21530
  }
21023
21531
  onGeometryPropertiesChange(e) {
21024
- const t = e.target._getParent() || e.target, n = t[Tr];
21532
+ const t = e.target._getParent() || e.target, n = t[br];
21025
21533
  void 0 !== n && this.features[n] && (this.features[n] = wr(t, this._kidGen), this._refreshFeatures(this.features[n], n),
21026
21534
  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.meshes && this.painter.onFeatureChange(this.features[n], this.meshes),
21027
21535
  _h(this));
@@ -21112,7 +21620,7 @@
21112
21620
  for (let n = 0; n < e.length; n++) {
21113
21621
  const i = this.layer.getGeometryById(e[n]);
21114
21622
  if (i) {
21115
- const e = this.features[i[Tr]];
21623
+ const e = this.features[i[br]];
21116
21624
  if (Array.isArray(e)) for (let n = 0; n < e.length; n++) t.push(e[n].id); else t.push(e.id);
21117
21625
  }
21118
21626
  }
@@ -21151,12 +21659,12 @@
21151
21659
  const t = (dh + "markerFile").trim(), n = (dh + "markerType").trim();
21152
21660
  return e[t] || e[n];
21153
21661
  }
21154
- function Th({properties: e}) {
21662
+ function bh({properties: e}) {
21155
21663
  return e[(dh + "textName").trim()];
21156
21664
  }
21157
- const bh = (dh + "lineWidth").trim(), Sh = (_r + "").trim();
21665
+ const Th = (dh + "lineWidth").trim(), Sh = (_r + "").trim();
21158
21666
  function wh(e) {
21159
- return 2 === e.type && !e.properties[Sh] || 3 === e.type && void 0 !== e.properties[bh];
21667
+ return 2 === e.type && !e.properties[Sh] || 3 === e.type && void 0 !== e.properties[Th];
21160
21668
  }
21161
21669
  function Mh(e) {
21162
21670
  if (!Array.isArray(e)) return 0;
@@ -21351,7 +21859,7 @@
21351
21859
  getRayCastData(e, t) {
21352
21860
  const n = this.painter.getRayCastData(e, t);
21353
21861
  if (!n || !n.feature) return null;
21354
- const i = n.feature[Tr];
21862
+ const i = n.feature[br];
21355
21863
  return this._geometries[i];
21356
21864
  }
21357
21865
  _groupPolygonFeatures(e) {
@@ -21579,7 +22087,7 @@
21579
22087
  let n = e;
21580
22088
  do {
21581
22089
  const i = n.prev, r = n.next.next;
21582
- !xc(i, r) && _c(i, n, n.next, r) && Tc(i, r) && Tc(r, i) && (t.push(i.i, n.i, r.i),
22090
+ !xc(i, r) && _c(i, n, n.next, r) && bc(i, r) && bc(r, i) && (t.push(i.i, n.i, r.i),
21583
22091
  wc(n), wc(n.next), n = e = r), n = n.next;
21584
22092
  } while (n !== e);
21585
22093
  return ic(n);
@@ -21590,7 +22098,7 @@
21590
22098
  let e = a.next.next;
21591
22099
  for (;e !== a.prev; ) {
21592
22100
  if (a.i !== e.i && mc(a, e)) {
21593
- let s = bc(a, e);
22101
+ let s = Tc(a, e);
21594
22102
  return a = ic(a, a.next), s = ic(s, s.next), rc(a, t, n, i, r, o, 0), void rc(s, t, n, i, r, o, 0);
21595
22103
  }
21596
22104
  e = e.next;
@@ -21626,7 +22134,7 @@
21626
22134
  do {
21627
22135
  if (i >= n.x && n.x >= l && i !== n.x && pc(r < h ? i : a, r, l, h, r < h ? a : i, r, n.x, n.y)) {
21628
22136
  const t = Math.abs(r - n.y) / (i - n.x);
21629
- Tc(n, e) && (t < c || t === c && (n.x > o.x || n.x === o.x && uc(o, n))) && (o = n,
22137
+ bc(n, e) && (t < c || t === c && (n.x > o.x || n.x === o.x && uc(o, n))) && (o = n,
21630
22138
  c = t);
21631
22139
  }
21632
22140
  n = n.next;
@@ -21634,7 +22142,7 @@
21634
22142
  return o;
21635
22143
  }(e, t);
21636
22144
  if (!n) return t;
21637
- const i = bc(n, e);
22145
+ const i = Tc(n, e);
21638
22146
  return ic(i, i.next), ic(n, n.next);
21639
22147
  }
21640
22148
  function uc(e, t) {
@@ -21664,7 +22172,7 @@
21664
22172
  n = n.next;
21665
22173
  } while (n !== e);
21666
22174
  return !1;
21667
- }(e, t) && (Tc(e, t) && Tc(t, e) && function(e, t) {
22175
+ }(e, t) && (bc(e, t) && bc(t, e) && function(e, t) {
21668
22176
  let n = e, i = !1;
21669
22177
  const r = (e.x + t.x) / 2, o = (e.y + t.y) / 2;
21670
22178
  do {
@@ -21690,10 +22198,10 @@
21690
22198
  function Ac(e) {
21691
22199
  return e > 0 ? 1 : e < 0 ? -1 : 0;
21692
22200
  }
21693
- function Tc(e, t) {
22201
+ function bc(e, t) {
21694
22202
  return yc(e.prev, e, e.next) < 0 ? yc(e, t, e.next) >= 0 && yc(e, e.prev, t) >= 0 : yc(e, t, e.prev) < 0 || yc(e, e.next, t) < 0;
21695
22203
  }
21696
- function bc(e, t) {
22204
+ function Tc(e, t) {
21697
22205
  const n = Mc(e.i, e.x, e.y), i = Mc(t.i, t.x, t.y), r = e.next, o = t.prev;
21698
22206
  return e.next = t, t.prev = e, n.next = r, r.prev = n, i.next = n, n.prev = i, o.next = i,
21699
22207
  i.prev = o, i;
@@ -21753,16 +22261,16 @@
21753
22261
  let f, d = 0, p = 0, g = 0, m = 0;
21754
22262
  const y = u ? [ 1, 3, 4 ] : [ 2, 3, 4 ];
21755
22263
  for (let u = o.getLength() - 1; u >= a; u--) {
21756
- const a = o[u], x = 3 * a + 1, _ = 3 * a + 2, v = r[3 * a], A = r[x], T = r[_];
22264
+ const a = o[u], x = 3 * a + 1, _ = 3 * a + 2, v = r[3 * a], A = r[x], b = r[_];
21757
22265
  d || p || (d = Math.max(r[_], r[3 * o[u - 3] + 2]), p = Math.min(r[_], r[3 * o[u - 3] + 2]),
21758
22266
  f = d - p);
21759
- let b = g;
22267
+ let T = g;
21760
22268
  const S = u % 6;
21761
- 0 === e ? (5 === S && (m = ec(r, o, u, v, A)), b = S === y[0] || S === y[1] || S === y[2] ? g : g + m) : 1 === e && (S === y[0] || S === y[1] || S === y[2] ? b = 0 : 5 === S ? (m = ec(r, o, u, v, A),
21762
- b = m) : b = m);
21763
- const w = b / h * (1 / (100 * c)) / s;
22269
+ 0 === e ? (5 === S && (m = ec(r, o, u, v, A)), 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 = ec(r, o, u, v, A),
22270
+ T = m) : T = m);
22271
+ const w = T / h * (1 / (100 * c)) / s;
21764
22272
  let M;
21765
- M = 1 === t ? T === d ? 1 : 0 : "bottom" === n ? T === d ? f / 100 / l : 0 : T === d ? 0 : -f / 100 / l,
22273
+ M = 1 === t ? b === d ? 1 : 0 : "bottom" === n ? b === d ? f / 100 / l : 0 : b === d ? 0 : -f / 100 / l,
21766
22274
  i[2 * a] = w, i[2 * a + 1] = M, 0 === S && (g += m);
21767
22275
  }
21768
22276
  }(s, l, h, c, n, o, g, u[0], u[1], f, d, p);
@@ -21890,7 +22398,7 @@
21890
22398
  const {StyleUtil: cu, PackUtil: uu, ArrayPool: fu} = h(), du = fu.getInstance();
21891
22399
  function pu(e, t, n, i, r, o, a, s, l, h, c, u, f, d, p, g) {
21892
22400
  void 0 === t.top && (t.top = !0), void 0 === t.side && (t.side = !0), du.reset();
21893
- const {altitudeScale: m, altitudeProperty: y, defaultAltitude: x, heightProperty: _, minHeightProperty: v, defaultHeight: A, tangent: T, uv: b, topUVMode: S, sideUVMode: w, sideVerticalUVMode: M, top: P, side: I, textureYOrigin: C, topThickness: O} = t, k = !!g, R = function(e, t, {altitudeScale: n, altitudeProperty: i, defaultAltitude: r, heightProperty: o, minHeightProperty: a, defaultHeight: s}, {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: A, positionType: T, res: b, glScale: S, projectionCode: w}, M, P) {
22401
+ const {altitudeScale: m, altitudeProperty: y, defaultAltitude: x, heightProperty: _, minHeightProperty: v, defaultHeight: A, tangent: b, uv: T, topUVMode: S, sideUVMode: w, sideVerticalUVMode: M, top: P, side: I, textureYOrigin: C, topThickness: O} = t, k = !!g, R = function(e, t, {altitudeScale: n, altitudeProperty: i, defaultAltitude: r, heightProperty: o, minHeightProperty: a, defaultHeight: s}, {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: A, positionType: b, res: T, glScale: S, projectionCode: w}, M, P) {
21894
22402
  let I = t / e[0].extent;
21895
22403
  t === 1 / 0 && (I = 1);
21896
22404
  const C = t === 1 / 0, O = P.get(), k = P.get(), R = P.get(), F = P.getProxy(), E = P.get(), D = P.get(), H = P.get(), L = !!d, N = !!c, z = !!h, V = L ? P.get() : null;
@@ -21909,7 +22417,7 @@
21909
22417
  }
21910
22418
  c = h.length, d = D.currentIndex;
21911
22419
  for (let e = 0; e < c; e++) D[d++] = h[e];
21912
- D.currentIndex = d, L && Jh(g || 0, e, n, V, E, f, v, _, p[0], p[1], o, b, S, w, l),
22420
+ D.currentIndex = d, L && Jh(g || 0, e, n, V, E, f, v, _, p[0], p[1], o, T, S, w, l),
21913
22421
  u > 0 && !z && (n = Cc(E, F, i, D, n, V, 0, u, t, L, m || 0, y || 0, x, p, _, A, r < 0 ? !a : a)),
21914
22422
  H.setLength(n / 3), H.fill(1, s / 3, n / 3);
21915
22423
  }
@@ -21956,7 +22464,7 @@
21956
22464
  let e = Z.currentIndex;
21957
22465
  Z[e++] = F.getLength() / 3, Z.currentIndex = e;
21958
22466
  }
21959
- zh(F, F.getLength(), i, I, d, 0, T), e === n - 1 && (W = U(y, W, Z, p * I, f, C));
22467
+ zh(F, F.getLength(), i, I, d, 0, b), e === n - 1 && (W = U(y, W, Z, p * I, f, C));
21960
22468
  }
21961
22469
  const _ = E.getLength() - g, v = (ht + "").trim();
21962
22470
  for (let e = 0; e < _ / 3; e++) {
@@ -21993,7 +22501,7 @@
21993
22501
  top: P,
21994
22502
  side: I,
21995
22503
  topThickness: 10 * O || 0,
21996
- uv: b || T,
22504
+ uv: T || b,
21997
22505
  uvSize: [ r, r ],
21998
22506
  uvOrigin: i,
21999
22507
  topUVMode: S,
@@ -22011,7 +22519,7 @@
22011
22519
  delete R.indices, F.push(H.buffer, R.pickingIds.buffer);
22012
22520
  const L = Math.max(Math.abs(R.maxAltitude), Math.abs(R.minAltitude)), N = p || uu.getPosArrayType(Math.max(512, L));
22013
22521
  R.vertices = fu.createTypedArray(R.vertices, N);
22014
- const z = T ? du.getProxy() : new Float32Array(3 * E);
22522
+ const z = b ? du.getProxy() : new Float32Array(3 * E);
22015
22523
  z.setLength && z.setLength(3 * E);
22016
22524
  const V = function(e, t, n) {
22017
22525
  const i = n || [];
@@ -22033,7 +22541,7 @@
22033
22541
  const t = V[e] % 1;
22034
22542
  1 - Math.abs(t) > 1e-6 ? U = !1 : 0 !== t && (V[e] = Math.round(V[e]));
22035
22543
  }
22036
- if (R.normals = V, T) {
22544
+ if (R.normals = V, b) {
22037
22545
  let e = du.get();
22038
22546
  e.setLength(4 * E), e = function(e, t, n, i, r) {
22039
22547
  const o = e.length / 3, a = r || new Array(4 * o), s = [], l = [];
@@ -22042,19 +22550,19 @@
22042
22550
  function y(t, i, r) {
22043
22551
  lu(h, e, 3 * t), lu(c, e, 3 * i), lu(u, e, 3 * r), hu(f, n, 2 * t), hu(d, n, 2 * i),
22044
22552
  hu(p, n, 2 * r);
22045
- const o = c[0] - h[0], a = u[0] - h[0], y = c[1] - h[1], x = u[1] - h[1], _ = c[2] - h[2], v = u[2] - h[2], A = d[0] - f[0], T = p[0] - f[0], b = d[1] - f[1], S = p[1] - f[1], w = 1 / (A * S - T * b);
22046
- Hc(g, (S * o - b * a) * w, (S * y - b * x) * w, (S * _ - b * v) * w), Hc(m, (A * a - T * o) * w, (A * x - T * y) * w, (A * v - T * _) * w),
22553
+ const o = c[0] - h[0], a = u[0] - h[0], y = c[1] - h[1], x = u[1] - h[1], _ = c[2] - h[2], v = u[2] - h[2], A = d[0] - f[0], b = p[0] - f[0], T = d[1] - f[1], S = p[1] - f[1], w = 1 / (A * S - b * T);
22554
+ Hc(g, (S * o - T * a) * w, (S * y - T * x) * w, (S * _ - T * v) * w), Hc(m, (A * a - b * o) * w, (A * x - b * y) * w, (A * v - b * _) * w),
22047
22555
  Lc(s[t], s[t], g), Lc(s[i], s[i], g), Lc(s[r], s[r], g), Lc(l[t], l[t], m), Lc(l[i], l[i], m),
22048
22556
  Lc(l[r], l[r], m);
22049
22557
  }
22050
22558
  for (let e = 0, t = i.length; e < t; e += 3) y(i[e + 0], i[e + 1], i[e + 2]);
22051
22559
  const x = [], _ = [], v = [], A = [];
22052
- let T, b, S;
22560
+ let b, T, S;
22053
22561
  function w(e) {
22054
- lu(v, t, 3 * e), Dc(A, v), b = s[e], Dc(x, b), Uc(x, x, function(e, t, n) {
22562
+ lu(v, t, 3 * e), Dc(A, v), T = s[e], Dc(x, T), Uc(x, x, function(e, t, n) {
22055
22563
  return e[0] = t[0] * n, e[1] = t[1] * n, e[2] = t[2] * n, e;
22056
- }(v, v, zc(v, b))), Nc(x, x), Vc(_, A, b), S = zc(_, l[e]), T = S < 0 ? -1 : 1,
22057
- a[4 * e] = x[0], a[4 * e + 1] = x[1], a[4 * e + 2] = x[2], a[4 * e + 3] = T;
22564
+ }(v, v, zc(v, T))), Nc(x, x), Vc(_, A, T), S = zc(_, l[e]), b = S < 0 ? -1 : 1,
22565
+ a[4 * e] = x[0], a[4 * e + 1] = x[1], a[4 * e + 2] = x[2], a[4 * e + 3] = b;
22058
22566
  }
22059
22567
  for (let e = 0, t = i.length; e < t; e += 3) w(i[e + 0]), w(i[e + 1]), w(i[e + 2]);
22060
22568
  return a;
@@ -22258,7 +22766,7 @@
22258
22766
  let a, s, l;
22259
22767
  for (;n || r.length; ) {
22260
22768
  if (n || (n = r.pop(), s = r[r.length - 1], a = o.pop(), l = !0), n.leaf) {
22261
- const i = Tu(e, n.children, t);
22769
+ const i = bu(e, n.children, t);
22262
22770
  if (-1 !== i) return n.children.splice(i, 1), r.push(n), this._condense(r), this;
22263
22771
  }
22264
22772
  l || n.leaf || !ku(n, i) ? s ? (a++, n = s.children[a], l = !1) : n = null : (r.push(n),
@@ -22289,7 +22797,7 @@
22289
22797
  _build(e, t, n, i) {
22290
22798
  const r = n - t + 1;
22291
22799
  let o, a = this._maxEntries;
22292
- if (r <= a) return o = Fu(e.slice(t, n + 1)), bu(o, this.toBBox), o;
22800
+ if (r <= a) return o = Fu(e.slice(t, n + 1)), Tu(o, this.toBBox), o;
22293
22801
  i || (i = Math.ceil(Math.log(r) / Math.log(a)), a = Math.ceil(r / Math.pow(a, i - 1))),
22294
22802
  o = Fu([]), o.leaf = !1, o.height = i;
22295
22803
  const s = Math.ceil(r / a), l = s * Math.ceil(Math.sqrt(a));
@@ -22302,7 +22810,7 @@
22302
22810
  o.children.push(this._build(e, n, r, i - 1));
22303
22811
  }
22304
22812
  }
22305
- return bu(o, this.toBBox), o;
22813
+ return Tu(o, this.toBBox), o;
22306
22814
  }
22307
22815
  _chooseSubtree(e, t, n, i) {
22308
22816
  for (;i.push(t), !t.leaf && i.length - 1 !== n; ) {
@@ -22326,11 +22834,11 @@
22326
22834
  const n = e[t], i = n.children.length, r = this._minEntries;
22327
22835
  this._chooseSplitAxis(n, r, i);
22328
22836
  const o = this._chooseSplitIndex(n, r, i), a = Fu(n.children.splice(o, n.children.length - o));
22329
- a.height = n.height, a.leaf = n.leaf, bu(n, this.toBBox), bu(a, this.toBBox), t ? e[t - 1].children.push(a) : this._splitRoot(n, a);
22837
+ a.height = n.height, a.leaf = n.leaf, Tu(n, this.toBBox), Tu(a, this.toBBox), t ? e[t - 1].children.push(a) : this._splitRoot(n, a);
22330
22838
  }
22331
22839
  _splitRoot(e, t) {
22332
22840
  this.data = Fu([ e, t ]), this.data.height = e.height + 1, this.data.leaf = !1,
22333
- bu(this.data, this.toBBox);
22841
+ Tu(this.data, this.toBBox);
22334
22842
  }
22335
22843
  _chooseSplitIndex(e, t, n) {
22336
22844
  let i, r = 1 / 0, o = 1 / 0;
@@ -22363,15 +22871,15 @@
22363
22871
  }
22364
22872
  _condense(e) {
22365
22873
  for (let t, n = e.length - 1; n >= 0; n--) 0 === e[n].children.length ? n > 0 ? (t = e[n - 1].children,
22366
- t.splice(t.indexOf(e[n]), 1)) : this.clear() : bu(e[n], this.toBBox);
22874
+ t.splice(t.indexOf(e[n]), 1)) : this.clear() : Tu(e[n], this.toBBox);
22367
22875
  }
22368
22876
  }
22369
- function Tu(e, t, n) {
22877
+ function bu(e, t, n) {
22370
22878
  if (!n) return t.indexOf(e);
22371
22879
  for (let i = 0; i < t.length; i++) if (n(e, t[i])) return i;
22372
22880
  return -1;
22373
22881
  }
22374
- function bu(e, t) {
22882
+ function Tu(e, t) {
22375
22883
  Su(e, 0, e.children.length, t, e);
22376
22884
  }
22377
22885
  function Su(e, t, n, i, r) {
@@ -22513,13 +23021,13 @@
22513
23021
  if (0 === a || 0 === s || a > 0 != s > 0) return l;
22514
23022
  const h = Math.abs(a + s);
22515
23023
  return Math.abs(l) >= Xu * h ? l : -function(e, t, n, i, r, o, a) {
22516
- let s, l, h, c, u, f, d, p, g, m, y, x, _, v, A, T, b, S;
23024
+ let s, l, h, c, u, f, d, p, g, m, y, x, _, v, A, b, T, S;
22517
23025
  const w = e - r, M = n - r, P = t - o, I = i - o;
22518
23026
  v = w * I, f = Gu * w, d = f - (f - w), p = w - d, f = Gu * I, g = f - (f - I),
22519
- m = I - g, A = p * m - (v - d * g - p * g - d * m), T = P * M, f = Gu * P, d = f - (f - P),
22520
- p = P - d, f = Gu * M, g = f - (f - M), m = M - g, b = p * m - (T - d * g - p * g - d * m),
22521
- y = A - b, u = A - y, qu[0] = A - (y + u) + (u - b), x = v + y, u = x - v, _ = v - (x - u) + (y - u),
22522
- y = _ - T, u = _ - y, qu[1] = _ - (y + u) + (u - T), S = x + y, u = S - x, qu[2] = x - (S - u) + (y - u),
23027
+ m = I - g, A = p * m - (v - d * g - p * g - d * m), b = P * M, f = Gu * P, d = f - (f - P),
23028
+ p = P - d, f = Gu * M, g = f - (f - M), m = M - g, T = p * m - (b - d * g - p * g - d * m),
23029
+ y = A - T, u = A - y, qu[0] = A - (y + u) + (u - T), x = v + y, u = x - v, _ = v - (x - u) + (y - u),
23030
+ y = _ - b, u = _ - y, qu[1] = _ - (y + u) + (u - b), S = x + y, u = S - x, qu[2] = x - (S - u) + (y - u),
22523
23031
  qu[3] = S;
22524
23032
  let C = function(e, t) {
22525
23033
  let n = t[0];
@@ -22531,24 +23039,24 @@
22531
23039
  u = t - P, l = t - (P + u) + (u - o), u = i - I, c = i - (I + u) + (u - o), 0 === s && 0 === l && 0 === h && 0 === c) return C;
22532
23040
  if (O = Yu * a + Bu * Math.abs(C), C += w * c + I * s - (P * h + M * l), C >= O || -C >= O) return C;
22533
23041
  v = s * I, f = Gu * s, d = f - (f - s), p = s - d, f = Gu * I, g = f - (f - I),
22534
- m = I - g, A = p * m - (v - d * g - p * g - d * m), T = l * M, f = Gu * l, d = f - (f - l),
22535
- p = l - d, f = Gu * M, g = f - (f - M), m = M - g, b = p * m - (T - d * g - p * g - d * m),
22536
- y = A - b, u = A - y, Qu[0] = A - (y + u) + (u - b), x = v + y, u = x - v, _ = v - (x - u) + (y - u),
22537
- y = _ - T, u = _ - y, Qu[1] = _ - (y + u) + (u - T), S = x + y, u = S - x, Qu[2] = x - (S - u) + (y - u),
23042
+ m = I - g, A = p * m - (v - d * g - p * g - d * m), b = l * M, f = Gu * l, d = f - (f - l),
23043
+ p = l - d, f = Gu * M, g = f - (f - M), m = M - g, T = p * m - (b - d * g - p * g - d * m),
23044
+ y = A - T, u = A - y, Qu[0] = A - (y + u) + (u - T), x = v + y, u = x - v, _ = v - (x - u) + (y - u),
23045
+ y = _ - b, u = _ - y, Qu[1] = _ - (y + u) + (u - b), S = x + y, u = S - x, Qu[2] = x - (S - u) + (y - u),
22538
23046
  Qu[3] = S;
22539
23047
  const k = Wu(4, qu, 4, Qu, Zu);
22540
23048
  v = w * c, f = Gu * w, d = f - (f - w), p = w - d, f = Gu * c, g = f - (f - c),
22541
- m = c - g, A = p * m - (v - d * g - p * g - d * m), T = P * h, f = Gu * P, d = f - (f - P),
22542
- p = P - d, f = Gu * h, g = f - (f - h), m = h - g, b = p * m - (T - d * g - p * g - d * m),
22543
- y = A - b, u = A - y, Qu[0] = A - (y + u) + (u - b), x = v + y, u = x - v, _ = v - (x - u) + (y - u),
22544
- y = _ - T, u = _ - y, Qu[1] = _ - (y + u) + (u - T), S = x + y, u = S - x, Qu[2] = x - (S - u) + (y - u),
23049
+ m = c - g, A = p * m - (v - d * g - p * g - d * m), b = P * h, f = Gu * P, d = f - (f - P),
23050
+ p = P - d, f = Gu * h, g = f - (f - h), m = h - g, T = p * m - (b - d * g - p * g - d * m),
23051
+ y = A - T, u = A - y, Qu[0] = A - (y + u) + (u - T), x = v + y, u = x - v, _ = v - (x - u) + (y - u),
23052
+ y = _ - b, u = _ - y, Qu[1] = _ - (y + u) + (u - b), S = x + y, u = S - x, Qu[2] = x - (S - u) + (y - u),
22545
23053
  Qu[3] = S;
22546
23054
  const R = Wu(k, Zu, 4, Qu, Ku);
22547
23055
  v = s * c, f = Gu * s, d = f - (f - s), p = s - d, f = Gu * c, g = f - (f - c),
22548
- m = c - g, A = p * m - (v - d * g - p * g - d * m), T = l * h, f = Gu * l, d = f - (f - l),
22549
- p = l - d, f = Gu * h, g = f - (f - h), m = h - g, b = p * m - (T - d * g - p * g - d * m),
22550
- y = A - b, u = A - y, Qu[0] = A - (y + u) + (u - b), x = v + y, u = x - v, _ = v - (x - u) + (y - u),
22551
- y = _ - T, u = _ - y, Qu[1] = _ - (y + u) + (u - T), S = x + y, u = S - x, Qu[2] = x - (S - u) + (y - u),
23056
+ m = c - g, A = p * m - (v - d * g - p * g - d * m), b = l * h, f = Gu * l, d = f - (f - l),
23057
+ p = l - d, f = Gu * h, g = f - (f - h), m = h - g, T = p * m - (b - d * g - p * g - d * m),
23058
+ y = A - T, u = A - y, Qu[0] = A - (y + u) + (u - T), x = v + y, u = x - v, _ = v - (x - u) + (y - u),
23059
+ y = _ - b, u = _ - y, Qu[1] = _ - (y + u) + (u - b), S = x + y, u = S - x, Qu[2] = x - (S - u) + (y - u),
22552
23060
  Qu[3] = S;
22553
23061
  const F = Wu(R, Ku, 4, Qu, Ju);
22554
23062
  return Ju[F - 1];
@@ -22686,9 +23194,9 @@
22686
23194
  return (o = e[0] - i) * o + (a = e[1] - r) * a;
22687
23195
  }
22688
23196
  function df(e, t, n, i, r, o, a, s) {
22689
- var l, h, c, u, f = n - e, d = i - t, p = a - r, g = s - o, m = e - r, y = t - o, x = f * f + d * d, _ = f * p + d * g, v = p * p + g * g, A = f * m + d * y, T = p * m + g * y, b = x * v - _ * _, S = b, w = b;
22690
- 0 === b ? (h = 0, S = 1, u = T, w = v) : (u = x * T - _ * A, (h = _ * T - v * A) < 0 ? (h = 0,
22691
- u = T, w = v) : h > S && (h = S, u = T + _, w = v)), u < 0 ? (u = 0, -A < 0 ? h = 0 : -A > x ? h = S : (h = -A,
23197
+ var l, h, c, u, f = n - e, d = i - t, p = a - r, g = s - o, m = e - r, y = t - o, x = f * f + d * d, _ = f * p + d * g, v = p * p + g * g, A = f * m + d * y, b = p * m + g * y, T = x * v - _ * _, S = T, w = T;
23198
+ 0 === T ? (h = 0, S = 1, u = b, w = v) : (u = x * b - _ * A, (h = _ * b - v * A) < 0 ? (h = 0,
23199
+ u = b, w = v) : h > S && (h = S, u = b + _, w = v)), u < 0 ? (u = 0, -A < 0 ? h = 0 : -A > x ? h = S : (h = -A,
22692
23200
  S = x)) : u > w && (u = w, -A + _ < 0 ? h = 0 : -A + _ > x ? h = S : (h = -A + _,
22693
23201
  S = x));
22694
23202
  var M = (1 - (c = 0 === u ? 0 : u / w)) * r + c * a - ((1 - (l = 0 === h ? 0 : h / S)) * e + l * n), P = (1 - c) * o + c * s - ((1 - l) * t + l * i);
@@ -22804,10 +23312,10 @@
22804
23312
  return null;
22805
23313
  }
22806
23314
  }
22807
- const Af = [], {DEFAULT_TEX_WIDTH: Tf} = h();
22808
- class bf extends mn {
23315
+ const Af = [], {DEFAULT_TEX_WIDTH: bf} = h();
23316
+ class Tf extends mn {
22809
23317
  static fromJSON(e) {
22810
- return Ih(e, "ExtrudePolygonLayer", bf);
23318
+ return Ih(e, "ExtrudePolygonLayer", Tf);
22811
23319
  }
22812
23320
  getPolygonOffsetCount() {
22813
23321
  return 0;
@@ -22839,7 +23347,7 @@
22839
23347
  return n && n.updateDataConfig(e, t), this;
22840
23348
  }
22841
23349
  }
22842
- bf.registerJSONType("ExtrudePolygonLayer"), bf.mergeOptions({
23350
+ Tf.registerJSONType("ExtrudePolygonLayer"), Tf.mergeOptions({
22843
23351
  cullFace: !1,
22844
23352
  castShadow: !0
22845
23353
  });
@@ -22963,11 +23471,11 @@
22963
23471
  const a = this._extrudeCenter, s = 1 / 0, l = t.MapStateCache[o.id], h = l ? l.zoom : o.getZoom(), c = new t.Point(0, 0), u = new t.Coordinate(0, 0), f = Ee({}, wf, this.layer.options.dataConfig);
22964
23472
  if (f.uv = !0, f.top && (f.top = i), f.side && (f.side = r), !1 === f.top && !1 === f.side) return null;
22965
23473
  if (!e.length) return null;
22966
- const d = o.getGLRes(), p = o.getProjection().code, g = i ? this.painterSymbol && this.painterSymbol.material : this.sidePainterSymbol && this.sidePainterSymbol.material, m = g && g.textureWidth || Tf, y = [ Lt(o, 1, u, d) / 100, Lt(o, 1, u, d, 1) / 100 ];
23474
+ const d = o.getGLRes(), p = o.getProjection().code, g = i ? this.painterSymbol && this.painterSymbol.material : this.sidePainterSymbol && this.sidePainterSymbol.material, m = g && g.textureWidth || bf, y = [ Lt(o, 1, u, d) / 100, Lt(o, 1, u, d, 1) / 100 ];
22967
23475
  return pu(e, f, s, c, m, o.getGLRes(), 1, 1, y, this._zScale, n, h, p, undefined, Float32Array, a);
22968
23476
  }
22969
23477
  updateMesh(e) {
22970
- const t = e[Tr];
23478
+ const t = e[br];
22971
23479
  let n = this.features[t];
22972
23480
  if (!n || !this.meshes) return;
22973
23481
  const i = this._createPackData([ n ], this.painterSymbol, !0, !1);
@@ -23010,7 +23518,7 @@
23010
23518
  return this.painter ? this.painter.getShadowMeshes() : [];
23011
23519
  }
23012
23520
  }
23013
- bf.registerRenderer("gl", Pf), bf.registerRenderer("gpu", Pf), bf.registerRenderer("canvas", null),
23521
+ Tf.registerRenderer("gl", Pf), Tf.registerRenderer("gpu", Pf), Tf.registerRenderer("canvas", null),
23014
23522
  r.DrawToolLayer.setLayerClass(Ch, Rh, Hh);
23015
23523
  const {PackUtil: If, FilterUtil: Cf, SYMBOLS_NEED_REBUILD_IN_VT: Of, SYMBOLS_NEED_REBUILD_IN_VECTOR: kf} = h();
23016
23524
  n.reshader.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"),
@@ -23031,7 +23539,7 @@
23031
23539
  return o.transcoders.inject(Rf);
23032
23540
  }));
23033
23541
  } else r.registerWorkerAdapter("@maptalks/vt", Rf);
23034
- e.BillBoardPainter = Rl, e.BillBoardPlugin = Zl, e.ExtrudePolygonLayer = bf, e.FillPainter = cr,
23542
+ e.BillBoardPainter = Rl, e.BillBoardPlugin = Zl, e.ExtrudePolygonLayer = Tf, e.FillPainter = cr,
23035
23543
  e.FillPlugin = Hl, e.FilterUtil = Cf, e.GLTFPhongPlugin = Xl, e.GLTFStandardPlugin = $l,
23036
23544
  e.GeoJSONVectorTileLayer = eh, e.HeatmapPlugin = Yl, e.IconPainter = fa, e.IconPlugin = zl,
23037
23545
  e.LineGradientPlugin = Nl, e.LinePainter = gr, e.LinePlugin = Ll, e.LineStringLayer = Rh,
@@ -23041,6 +23549,6 @@
23041
23549
  e.SYMBOLS_NEED_REBUILD_IN_VT = Of, e.TerrainFlatMaskPainter = Dl, e.TerrainFlatMaskPlugin = Kl,
23042
23550
  e.TextPainter = as, e.TextPlugin = Vl, e.TubePlugin = jl, e.Vector3DLayer = mn,
23043
23551
  e.VectorTileLayer = ln, e.VectorTileLayerRenderer = Yt, e.WaterPlugin = ql, e.WireframePainter = Es,
23044
- e.WireframePlugin = Bl, e.getVectorPacker = h, "undefined" != typeof console && console.log("@maptalks/vt v0.120.0");
23552
+ e.WireframePlugin = Bl, e.getVectorPacker = h, "undefined" != typeof console && console.log("@maptalks/vt v0.121.0");
23045
23553
  }));
23046
23554
  //# sourceMappingURL=maptalks.vt.js.map