@maptalks/vt 0.63.6 → 0.63.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @maptalks/vt v0.63.6
2
+ * @maptalks/vt v0.63.9
3
3
  * LICENSE : undefined
4
4
  * (c) 2016-2022 maptalks.org
5
5
  */
@@ -22,7 +22,7 @@
22
22
  })), e.default = t, Object.freeze(e);
23
23
  }
24
24
  var r = i(e), s = i(n);
25
- const o = 'function(t){\n/*!\n Feature Filter by\n\n (c) mapbox 2016 and maptalks 2018\n www.mapbox.com | www.maptalks.org\n License: MIT, header required.\n */\nconst n=["Unknown","Point","LineString","Polygon","MultiPoint","MultiLineString","MultiPolygon","GeometryCollection"];function i(t){return new Function("f","var p = (f && f.properties || {}); return "+e(t))}function e(t){if(!t)return"true";const n=t[0];if(t.length<=1)return"any"===n?"false":"true";return`(${"=="===n?s(t[1],t[2],"===",!1):"!="===n?s(t[1],t[2],"!==",!1):"<"===n||">"===n||"<="===n||">="===n?s(t[1],t[2],n,!0):"any"===n?o(t.slice(1),"||"):"all"===n?o(t.slice(1),"&&"):"none"===n?u(o(t.slice(1),"||")):"in"===n?a(t[1],t.slice(2)):"!in"===n?u(a(t[1],t.slice(2))):"has"===n?h(t[1]):"!has"===n?u(h(t[1])):"true"})`}function r(t){return"$"===t[0]?"f."+t.substring(1):"p["+JSON.stringify(t)+"]"}function s(t,i,e,s){const o=r(t),a="$type"===t?n.indexOf(i):JSON.stringify(i);return(s?`typeof ${o}=== typeof ${a}&&`:"")+o+e+a}function o(t,n){return t.map(e).join(n)}function a(t,i){"$type"===t&&(i=i.map(t=>n.indexOf(t)));const e=JSON.stringify(i.sort(l)),s=r(t);return i.length<=200?`${e}.indexOf(${s}) !== -1`:`function(v, a, i, j) {\\n while (i <= j) { var m = (i + j) >> 1;\\n if (a[m] === v) return true; if (a[m] > v) j = m - 1; else i = m + 1;\\n }\\n return false; }(${s}, ${e},0,${i.length-1})`}function h(t){return"$id"===t?\'"id" in f\':JSON.stringify(t)+" in p"}function u(t){return`!(${t})`}function l(t,n){return t<n?-1:t>n?1:0}function c(t){for(let n=1;n<arguments.length;n++){const i=arguments[n];for(const n in i)t[n]=i[n]}return t}function f(t,n){for(let i=0;i<t.stops.length;i++)if(n===t.stops[i][0])return t.stops[i][1];return t.default}function d(t,n){for(var i=0;i<t.stops.length&&!(n<t.stops[i][0]);i++);return t.stops[Math.max(i-1,0)][1]}function y(t,n){for(var i=void 0!==t.base?t.base:1,e=0;!(e>=t.stops.length||n<=t.stops[e][0]);)e++;return 0===e?t.stops[e][1]:e===t.stops.length?t.stops[e-1][1]:function t(n,i,e,r,s,o){return"function"==typeof s?function(){var a=s.apply(void 0,arguments),h=o.apply(void 0,arguments);return t(n,i,e,r,a,h)}:s.length?function(t,n,i,e,r,s){var o=[];for(let a=0;a<r.length;a++)o[a]=p(t,n,i,e,r[a],s[a]);return o}(n,i,e,r,s,o):p(n,i,e,r,s,o)}(n,i,t.stops[e-1][0],t.stops[e][0],t.stops[e-1][1],t.stops[e][1])}function v(t,n){return function(t,n,i){return void 0!==t?t:void 0!==n?n:void 0!==i?i:null}(n,t.default)}function p(t,n,i,e,r,s){var o,a=e-i,h=t-i;return r*(1-(o=1===n?h/a:(Math.pow(n,h)-1)/(Math.pow(n,a)-1)))+s*o}function m(t){return t&&"object"==typeof t&&(t.stops||t.property&&"identity"===t.type)}function g(t){return b(t,"exponential")}function w(t){return b(t,"interval")}function M(t,n){if(!t)return null;var i=!1;if(Array.isArray(t)){var e,r=[];for(let s=0;s<t.length;s++)(e=M(t[s],n))?(r.push(e),i=!0):r.push(t[s]);return i?r:t}var s,o={__fn_types_loaded:!0},a=[];for(s in t)t.hasOwnProperty(s)&&a.push(s);const h=function(t){Object.defineProperty(o,t,{get:function(){return this["__fn_"+t]||(this["__fn_"+t]=g(this["_"+t])),this["__fn_"+t].apply(this,n())},set:function(n){this["_"+t]=n},configurable:!0,enumerable:!0})};for(let n=0,e=a.length;n<e;n++)m(t[s=a[n]])?(i=!0,o["_"+s]=t[s],h(s)):o[s]=t[s];return i?o:t}function b(t,n){if(!m(t))return function(){return t};let i=!0,e=!0;const r=(t=JSON.parse(JSON.stringify(t))).stops;if(r)for(let t=0;t<r.length;t++)if(m(r[t][1])){const s=b(r[t][1],n);i=i&&s.isZoomConstant,e=e&&s.isFeatureConstant,r[t]=[r[t][0],s]}const s=function t(n,i){var e,r,s;if(m(n)){var o,a=n.stops&&"object"==typeof n.stops[0][0],h=a||void 0!==n.property,u=a||!h,l=n.type||i||"exponential";if("exponential"===l)o=y;else if("interval"===l)o=d;else if("categorical"===l)o=f;else{if("identity"!==l)throw new Error(\'Unknown function type "\'+l+\'"\');o=v}if(a){var c={},p=[];for(let t=0;t<n.stops.length;t++){var g=n.stops[t];void 0===c[g[0].zoom]&&(c[g[0].zoom]={zoom:g[0].zoom,type:n.type,property:n.property,default:n.default,stops:[]}),c[g[0].zoom].stops.push([g[0].value,g[1]])}for(let n in c)p.push([c[n].zoom,t(c[n])]);e=function(t,i){const e=y({stops:p,base:n.base},t)(t,i);return"function"==typeof e?e(t,i):e},r=!1,s=!1}else u?(e=function(t){const i=o(n,t);return"function"==typeof i?i(t):i},r=!0,s=!1):(e=function(t,i){const e=o(n,i?i[n.property]:null);return"function"==typeof e?e(t,i):e},r=!1,s=!0)}else e=function(){return n},r=!0,s=!0;return e.isZoomConstant=s,e.isFeatureConstant=r,e}(t,n);return s.isZoomConstant=i&&s.isZoomConstant,s.isFeatureConstant=e&&s.isFeatureConstant,s}let x=0;const F="function"==typeof Object.assign;function A(t,...n){if(F)return Object.assign(t,...n),t;for(let i=0;i<n.length;i++){const e=n[i];for(const n in e)t[n]=e[n]}return t}function k(t){return!O(t)&&("string"==typeof t||null!==t.constructor&&t.constructor===String)}function P(t){return"number"==typeof t&&!isNaN(t)}function S(t){return!O(t)&&("function"==typeof t||null!==t.constructor&&t.constructor===Function)}function _(t){return!Array.isArray(t)&&"object"==typeof t&&!!t}function O(t){return null==t}function I(t){for(let n=1;n<arguments.length;n++){const i=arguments[n];if(i)for(let n=0,e=i.length;n<e;n++)t.push(i[n])}return t.length}function T(t){return t<65536?Uint16Array:Uint32Array}function L(t){return t<256?Uint8Array:t<65536?Uint16Array:Uint32Array}function U(t){return(t=Math.abs(t))<128?Int8Array:t<32768?Int16Array:Float32Array}function z(t){return function t(n){if(!Array.isArray(n))return t([n]);const e=[];for(let t=0;t<n.length;t++){let r;r=!0===n[t].filter?function(){return!0}:i(n[t].filter),e.push(c({},n[t],{filter:r}))}return e}(t=t.map(t=>{const n=A({},t);return n.filter&&n.filter.value&&(n.filter=n.filter.value),n}))}function D(t){return m(t)&&t.property}const E="function"==typeof fetch&&"function"==typeof AbortController,C={jsonp:function(t,n){const i="_maptalks_jsonp_"+x++;t.match(/\\?/)?t+="&callback="+i:t+="?callback="+i;let e=document.createElement("script");return e.type="text/javascript",e.src=t,window[i]=function(t){n(null,t),document.getElementsByTagName("head")[0].removeChild(e),e=null,delete window[i]},document.getElementsByTagName("head")[0].appendChild(e),this},get:function(t,n,i){if(S(n)){const t=i;i=n,n=t}(n=n||{}).method&&(n.method=n.method.toUpperCase());const e="POST"===n.method;if(E){const r=new AbortController,s={signal:r.signal,method:n.method||"GET",referrerPolicy:"origin"};return e&&(O(n.body)||(s.body=JSON.stringify(n.body))),O(n.headers)||(s.headers=n.headers),O(n.credentials)||(s.credentials=n.credentials),fetch(t,s).then(t=>{const e=this.t(t,n.returnJSON,n.responseType);e.message?i(e):e.then(e=>{"arraybuffer"===n.responseType?i(null,{data:e,cacheControl:t.headers.get("Cache-Control"),expires:t.headers.get("Expires"),contentType:t.headers.get("Content-Type")}):i(null,e)}).catch(t=>{t.code&&t.code===DOMException.ABORT_ERR||(console.error(t),i(t))})}).catch(t=>{t.code&&t.code===DOMException.ABORT_ERR||(console.error(t),i(t))}),r}{const r=C.s(i);if(r.open(n.method||"GET",t,!0),n){for(const t in n.headers)r.setRequestHeader(t,n.headers[t]);r.withCredentials="include"===n.credentials,n.responseType&&(r.responseType=n.responseType)}return r.send(e?n.body:null),r}},t:(t,n,i)=>200!==t.status?{status:t.status,statusText:t.statusText,message:`incorrect http request with status code(${t.status}): ${t.statusText}`}:"arraybuffer"===i?t.arrayBuffer():n?t.json():t.text(),o:function(t,n){return function(){if(4===t.readyState)if(200===t.status)if("arraybuffer"===t.responseType){0===t.response.byteLength?n({status:200,statusText:t.statusText,message:"http status 200 returned without content."}):n(null,{data:t.response,cacheControl:t.getResponseHeader("Cache-Control"),expires:t.getResponseHeader("Expires"),contentType:t.getResponseHeader("Content-Type")})}else n(null,t.responseText);else n({status:t.status,statusText:t.statusText,message:`incorrect http request with status code(${t.status}): ${t.statusText}`})}},s:function(t){let n;try{n=new XMLHttpRequest}catch(t){try{n=new ActiveXObject("Msxml2.XMLHTTP")}catch(t){try{n=new ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}}return n.onreadystatechange=C.o(n,t),n},getArrayBuffer(t,n,i){if(S(n)){const t=i;i=n,n=t}return n||(n={}),n.responseType="arraybuffer",C.get(t,n,i)}};function j(t,n,i,e,r,s){var o=r-i,a=s-e;if(0!==o||0!==a){var h=((t-i)*o+(n-e)*a)/(o*o+a*a);h>1?(i=r,e=s):h>0&&(i+=o*h,e+=a*h)}return(o=t-i)*o+(a=n-e)*a}function N(t,n,i,e){var r={id:void 0===t?null:t,type:n,geometry:i,tags:e,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(t){var n=t.geometry,i=t.type;if("Point"===i||"MultiPoint"===i||"LineString"===i)H(t,n);else if("Polygon"===i||"MultiLineString"===i)for(var e=0;e<n.length;e++)H(t,n[e]);else if("MultiPolygon"===i)for(e=0;e<n.length;e++)for(var r=0;r<n[e].length;r++)H(t,n[e][r])}(r),r}function H(t,n){for(var i=0;i<n.length;i+=3)t.minX=Math.min(t.minX,n[i]),t.minY=Math.min(t.minY,n[i+1]),t.maxX=Math.max(t.maxX,n[i]),t.maxY=Math.max(t.maxY,n[i+1])}function V(t,n,i,e){if(n.geometry){var r=n.geometry.coordinates,s=n.geometry.type,o=Math.pow(i.tolerance/((1<<i.maxZoom)*i.extent),2),a=[],h=n.id;if(i.promoteId?h=n.properties[i.promoteId]:i.generateId&&(h=e||0),"Point"===s)R(r,a);else if("MultiPoint"===s)for(var u=0;u<r.length;u++)R(r[u],a);else if("LineString"===s)$(r,a,o,!1);else if("MultiLineString"===s){if(i.lineMetrics){for(u=0;u<r.length;u++)a=[],$(r[u],a,o,!1),t.push(N(h,"LineString",a,n.properties));return}W(r,a,o,!1)}else if("Polygon"===s)W(r,a,o,!0);else{if("MultiPolygon"!==s){if("GeometryCollection"===s){for(u=0;u<n.geometry.geometries.length;u++)V(t,{id:h,geometry:n.geometry.geometries[u],properties:n.properties},i,e);return}throw new Error("Input data is not a valid GeoJSON object.")}for(u=0;u<r.length;u++){var l=[];W(r[u],l,o,!0),a.push(l)}}t.push(N(h,s,a,n.properties))}}function R(t,n){n.push(q(t[0])),n.push(B(t[1])),n.push(0)}function $(t,n,i,e){for(var r,s,o=0,a=0;a<t.length;a++){var h=q(t[a][0]),u=B(t[a][1]);n.push(h),n.push(u),n.push(0),a>0&&(o+=e?(r*u-h*s)/2:Math.sqrt(Math.pow(h-r,2)+Math.pow(u-s,2))),r=h,s=u}var l=n.length-3;n[2]=1,function t(n,i,e,r){for(var s,o=r,a=e-i>>1,h=e-i,u=n[i],l=n[i+1],c=n[e],f=n[e+1],d=i+3;d<e;d+=3){var y=j(n[d],n[d+1],u,l,c,f);if(y>o)s=d,o=y;else if(y===o){var v=Math.abs(d-a);v<h&&(s=d,h=v)}}o>r&&(s-i>3&&t(n,i,s,r),n[s+2]=o,e-s>3&&t(n,s,e,r))}(n,0,l,i),n[l+2]=1,n.size=Math.abs(o),n.start=0,n.end=n.size}function W(t,n,i,e){for(var r=0;r<t.length;r++){var s=[];$(t[r],s,i,e),n.push(s)}}function q(t){return t/360+.5}function B(t){var n=Math.sin(t*Math.PI/180),i=.5-.25*Math.log((1+n)/(1-n))/Math.PI;return i<0?0:i>1?1:i}function G(t,n,i,e,r,s,o,a){if(e/=n,s>=(i/=n)&&o<e)return t;if(o<i||s>=e)return null;for(var h=[],u=0;u<t.length;u++){var l=t[u],c=l.geometry,f=l.type,d=0===r?l.minX:l.minY,y=0===r?l.maxX:l.maxY;if(d>=i&&y<e)h.push(l);else if(!(y<i||d>=e)){var v=[];if("Point"===f||"MultiPoint"===f)J(c,v,i,e,r);else if("LineString"===f)X(c,v,i,e,r,!1,a.lineMetrics);else if("MultiLineString"===f)Y(c,v,i,e,r,!1);else if("Polygon"===f)Y(c,v,i,e,r,!0);else if("MultiPolygon"===f)for(var p=0;p<c.length;p++){var m=[];Y(c[p],m,i,e,r,!0),m.length&&v.push(m)}if(v.length){if(a.lineMetrics&&"LineString"===f){for(p=0;p<v.length;p++)h.push(N(l.id,f,v[p],l.tags));continue}"LineString"!==f&&"MultiLineString"!==f||(1===v.length?(f="LineString",v=v[0]):f="MultiLineString"),"Point"!==f&&"MultiPoint"!==f||(f=3===v.length?"Point":"MultiPoint"),h.push(N(l.id,f,v,l.tags))}}}return h.length?h:null}function J(t,n,i,e,r){for(var s=0;s<t.length;s+=3){var o=t[s+r];o>=i&&o<=e&&(n.push(t[s]),n.push(t[s+1]),n.push(t[s+2]))}}function X(t,n,i,e,r,s,o){for(var a,h,u=Z(t),l=0===r?Q:tt,c=t.start,f=0;f<t.length-3;f+=3){var d=t[f],y=t[f+1],v=t[f+2],p=t[f+3],m=t[f+4],g=0===r?d:y,w=0===r?p:m,M=!1;o&&(a=Math.sqrt(Math.pow(d-p,2)+Math.pow(y-m,2))),g<i?w>i&&(h=l(u,d,y,p,m,i),o&&(u.start=c+a*h)):g>e?w<e&&(h=l(u,d,y,p,m,e),o&&(u.start=c+a*h)):K(u,d,y,v),w<i&&g>=i&&(h=l(u,d,y,p,m,i),M=!0),w>e&&g<=e&&(h=l(u,d,y,p,m,e),M=!0),!s&&M&&(o&&(u.end=c+a*h),n.push(u),u=Z(t)),o&&(c+=a)}var b=t.length-3;d=t[b],y=t[b+1],v=t[b+2],(g=0===r?d:y)>=i&&g<=e&&K(u,d,y,v),b=u.length-3,s&&b>=3&&(u[b]!==u[0]||u[b+1]!==u[1])&&K(u,u[0],u[1],u[2]),u.length&&n.push(u)}function Z(t){var n=[];return n.size=t.size,n.start=t.start,n.end=t.end,n}function Y(t,n,i,e,r,s){for(var o=0;o<t.length;o++)X(t[o],n,i,e,r,s,!1)}function K(t,n,i,e){t.push(n),t.push(i),t.push(e)}function Q(t,n,i,e,r,s){var o=(s-n)/(e-n);return t.push(s),t.push(i+(r-i)*o),t.push(1),o}function tt(t,n,i,e,r,s){var o=(s-i)/(r-i);return t.push(n+(e-n)*o),t.push(s),t.push(1),o}function nt(t,n){for(var i=[],e=0;e<t.length;e++){var r,s=t[e],o=s.type;if("Point"===o||"MultiPoint"===o||"LineString"===o)r=it(s.geometry,n);else if("MultiLineString"===o||"Polygon"===o){r=[];for(var a=0;a<s.geometry.length;a++)r.push(it(s.geometry[a],n))}else if("MultiPolygon"===o)for(r=[],a=0;a<s.geometry.length;a++){for(var h=[],u=0;u<s.geometry[a].length;u++)h.push(it(s.geometry[a][u],n));r.push(h)}i.push(N(s.id,o,r,s.tags))}return i}function it(t,n){var i=[];i.size=t.size,void 0!==t.start&&(i.start=t.start,i.end=t.end);for(var e=0;e<t.length;e+=3)i.push(t[e]+n,t[e+1],t[e+2]);return i}function et(t,n){if(t.transformed)return t;var i,e,r,s=1<<t.z,o=t.x,a=t.y;for(i=0;i<t.features.length;i++){var h=t.features[i],u=h.geometry,l=h.type;if(h.geometry=[],1===l)for(e=0;e<u.length;e+=2)h.geometry.push(rt(u[e],u[e+1],n,s,o,a));else for(e=0;e<u.length;e++){var c=[];for(r=0;r<u[e].length;r+=2)c.push(rt(u[e][r],u[e][r+1],n,s,o,a));h.geometry.push(c)}}return t.transformed=!0,t}function rt(t,n,i,e,r,s){return[Math.round(i*(t*e-r)),Math.round(i*(n*e-s))]}function st(t,n,i,e,r){for(var s=n===r.maxZoom?0:r.tolerance/((1<<n)*r.extent),o={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:i,y:e,z:n,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},a=0;a<t.length;a++){o.numFeatures++,ot(o,t[a],s,r);var h=t[a].minX,u=t[a].minY,l=t[a].maxX,c=t[a].maxY;h<o.minX&&(o.minX=h),u<o.minY&&(o.minY=u),l>o.maxX&&(o.maxX=l),c>o.maxY&&(o.maxY=c)}return o}function ot(t,n,i,e){var r=n.geometry,s=n.type,o=[];if("Point"===s||"MultiPoint"===s)for(var a=0;a<r.length;a+=3)o.push(r[a]),o.push(r[a+1]),t.numPoints++,t.numSimplified++;else if("LineString"===s)at(o,r,t,i,!1,!1);else if("MultiLineString"===s||"Polygon"===s)for(a=0;a<r.length;a++)at(o,r[a],t,i,"Polygon"===s,0===a);else if("MultiPolygon"===s)for(var h=0;h<r.length;h++){var u=r[h];for(a=0;a<u.length;a++)at(o,u[a],t,i,!0,0===a)}if(o.length){var l=n.tags||null;if("LineString"===s&&e.lineMetrics){for(var c in l={},n.tags)l[c]=n.tags[c];l.mapbox_clip_start=r.start/r.size,l.mapbox_clip_end=r.end/r.size}var f={geometry:o,type:"Polygon"===s||"MultiPolygon"===s?3:"LineString"===s||"MultiLineString"===s?2:1,tags:l};null!==n.id&&(f.id=n.id),t.features.push(f)}}function at(t,n,i,e,r,s){var o=e*e;if(e>0&&n.size<(r?o:e))i.numPoints+=n.length/3;else{for(var a=[],h=0;h<n.length;h+=3)(0===e||n[h+2]>o)&&(i.numSimplified++,a.push(n[h]),a.push(n[h+1])),i.numPoints++;r&&function(t,n){for(var i=0,e=0,r=t.length,s=r-2;e<r;s=e,e+=2)i+=(t[e]-t[s])*(t[e+1]+t[s+1]);if(i>0===n)for(e=0,r=t.length;e<r/2;e+=2){var o=t[e],a=t[e+1];t[e]=t[r-2-e],t[e+1]=t[r-1-e],t[r-2-e]=o,t[r-1-e]=a}}(a,s),t.push(a)}}function ht(t,n){var i=(n=this.options=function(t,n){for(var i in n)t[i]=n[i];return t}(Object.create(this.options),n)).debug;if(i&&console.time("preprocess data"),n.maxZoom<0||n.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(n.promoteId&&n.generateId)throw new Error("promoteId and generateId cannot be used together.");var e=function(t,n){var i=[];if("FeatureCollection"===t.type)for(var e=0;e<t.features.length;e++)V(i,t.features[e],n,e);else"Feature"===t.type?V(i,t,n):V(i,{geometry:t},n);return i}(t,n);this.tiles={},this.tileCoords=[],i&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",n.indexMaxZoom,n.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),(e=function(t,n){var i=n.buffer/n.extent,e=t,r=G(t,1,-1-i,i,0,-1,2,n),s=G(t,1,1-i,2+i,0,-1,2,n);return(r||s)&&(e=G(t,1,-i,1+i,0,-1,2,n)||[],r&&(e=nt(r,1).concat(e)),s&&(e=e.concat(nt(s,-1)))),e}(e,n)).length&&this.splitTile(e,0,0,0),i&&(e.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}function ut(t,n,i){return 32*((1<<t)*i+n)+t}function lt(t,n,i,e,r,s){const o=i&&Array.isArray(i[0]);for(let a=0,h=i.length;a<h;a++){t[n]=Math.round((o?i[a][0]:i[a].x)*e),t[n+1]=Math.round((o?i[a][1]:i[a].y)*e);let u=r||0;Array.isArray(r)&&(u=r[a]),u=u?Math.round(e*u):0,t[n+2]=u,n+=3,s&&0!==a&&a!==h-1&&(t[n]=t[n-3],t[n+1]=t[n-2],t[n+2]=t[n-1],n+=3)}return n}function ct(t,n,i,e){const r=t[3*n],s=t[3*n+1],o=t[3*i],a=t[3*i+1];return r===o&&(r<0||r>e)||s===a&&(s<0||s>e)}C.getJSON=function(t,n,i){if(S(n)){const t=i;i=n,n=t}const e=function(t,n){const e="string"==typeof n?JSON.parse(n):n||null;i(t,e)};return n&&n.jsonp?C.jsonp(t,e):((n=n||{}).returnJSON=!0,C.get(t,n,e))},ht.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},ht.prototype.splitTile=function(t,n,i,e,r,s,o){for(var a=[t,n,i,e],h=this.options,u=h.debug;a.length;){e=a.pop(),i=a.pop(),n=a.pop(),t=a.pop();var l=1<<n,c=ut(n,i,e),f=this.tiles[c];if(!f&&(u>1&&console.time("creation"),f=this.tiles[c]=st(t,n,i,e,h),this.tileCoords.push({z:n,x:i,y:e}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",n,i,e,f.numFeatures,f.numPoints,f.numSimplified),console.timeEnd("creation"));var d="z"+n;this.stats[d]=(this.stats[d]||0)+1,this.total++}if(f.source=t,r){if(n===h.maxZoom||n===r)continue;var y=1<<r-n;if(i!==Math.floor(s/y)||e!==Math.floor(o/y))continue}else if(n===h.indexMaxZoom||f.numPoints<=h.indexMaxPoints)continue;if(f.source=null,0!==t.length){u>1&&console.time("clipping");var v,p,m,g,w,M,b=.5*h.buffer/h.extent,x=.5-b,F=.5+b,A=1+b;v=p=m=g=null,w=G(t,l,i-b,i+F,0,f.minX,f.maxX,h),M=G(t,l,i+x,i+A,0,f.minX,f.maxX,h),t=null,w&&(v=G(w,l,e-b,e+F,1,f.minY,f.maxY,h),p=G(w,l,e+x,e+A,1,f.minY,f.maxY,h),w=null),M&&(m=G(M,l,e-b,e+F,1,f.minY,f.maxY,h),g=G(M,l,e+x,e+A,1,f.minY,f.maxY,h),M=null),u>1&&console.timeEnd("clipping"),a.push(v||[],n+1,2*i,2*e),a.push(p||[],n+1,2*i,2*e+1),a.push(m||[],n+1,2*i+1,2*e),a.push(g||[],n+1,2*i+1,2*e+1)}}},ht.prototype.getTile=function(t,n,i){var e=this.options,r=e.extent,s=e.debug;if(t<0||t>24)return null;var o=1<<t,a=ut(t,n=(n%o+o)%o,i);if(this.tiles[a])return et(this.tiles[a],r);s>1&&console.log("drilling down to z%d-%d-%d",t,n,i);for(var h,u=t,l=n,c=i;!h&&u>0;)u--,l=Math.floor(l/2),c=Math.floor(c/2),h=this.tiles[ut(u,l,c)];return h&&h.source?(s>1&&console.log("found parent tile z%d-%d-%d",u,l,c),s>1&&console.time("drilling down"),this.splitTile(h.source,u,l,c,t,n,i),s>1&&console.timeEnd("drilling down"),this.tiles[a]?et(this.tiles[a],r):null):null};class ft{constructor(t,n){this.x=t,this.y=n}clone(){return new ft(this.x,this.y)}normalize(){const t=this.length();this.x/=t,this.y/=t}negate(){this.x=-this.x,this.y=-this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}diff(t){return new ft(this.x-t.x,this.y-t.y)}distance(t){const n=this.x-t.x,i=this.y-t.y;return Math.sqrt(n*n+i*i)}dot(t){return this.x*t.x+this.y*t.y}equals(t){return this.x===t.x&&this.y===t.y}orthogonal(){return new ft(this.y,-this.x)}}function dt(t,n,i){const e=(n.x-t.x)*(i.y-t.y)-(n.y-t.y)*(i.x-t.x);return e>1e-5?1:e<-1e-5?2:0}function yt(t,n,i,e){const r=n.x*e.y-n.y*e.x,s=i.x-t.x,o=i.y-t.y,a=(s*e.y-o*e.x)/r;return new ft(t.x+a*n.x,t.y+a*n.y)}const vt=[];function pt(t,n,i){let e=0;const r=[];for(let s=n;s<i;s+=3)vt[e]?(vt[e].x=t[s],vt[e].y=t[s+1]):vt[e]=new ft(t[s],t[s+1]),r.push(vt[e]),e++;const s=function(t){let n;this.UpdateOmbb=function(t,i,e,r,s,o,a,h){const u=yt(t,i,s,o),l=yt(e,r,s,o),c=yt(a,h,t,i),f=yt(a,h,e,r),d=u.distance(l)*u.distance(c);d<this.BestObbArea&&(n=[u,c,f,l],this.BestObbArea=d)},this.BestObbArea=Number.MAX_VALUE;const i=[];for(let n=0;n<t.length;n++)i.push(t[(n+1)%t.length].diff(t[n])),i[n].normalize();const e=new ft(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),r=new ft(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);let s,o,a,h;for(let n=0;n<t.length;n++){const i=t[n];i.x<e.x&&(e.x=i.x,s=n),i.x>r.x&&(r.x=i.x,o=n),i.y<e.y&&(e.y=i.y,h=n),i.y>r.y&&(r.y=i.y,a=n)}let u=new ft(0,-1),l=new ft(0,1),c=new ft(-1,0),f=new ft(1,0);for(let n=0;n<t.length;n++){const n=[Math.acos(u.dot(i[s])),Math.acos(l.dot(i[o])),Math.acos(c.dot(i[a])),Math.acos(f.dot(i[h]))];switch(n.indexOf(Math.min.apply(Math,n))){case 0:u=i[s].clone(),l=u.clone(),l.negate(),c=u.orthogonal(),f=c.clone(),f.negate(),s=(s+1)%t.length;break;case 1:l=i[o].clone(),u=l.clone(),u.negate(),c=u.orthogonal(),f=c.clone(),f.negate(),o=(o+1)%t.length;break;case 2:c=i[a].clone(),f=c.clone(),f.negate(),u=f.orthogonal(),l=u.clone(),l.negate(),a=(a+1)%t.length;break;case 3:f=i[h].clone(),c=f.clone(),c.negate(),u=f.orthogonal(),l=u.clone(),l.negate(),h=(h+1)%t.length}this.UpdateOmbb(t[s],u,t[o],l,t[a],c,t[h],f)}return n}(function(t){if(t.length<3)return t;let n=t[0];const i=[];for(let i=1;i<t.length;i++)(t[i].x<n.x||Math.abs(t[i].x-n.x)<1e-5&&t[i].y<n.y)&&(n=t[i]);let e=t[0];do{i.unshift(n.clone());for(let i=1;i<t.length;i++){const r=dt(n,e,t[i]);(e.equals(n)||1===r||0===r&&n.distance(t[i])>n.distance(e))&&(e=t[i])}n=e}while(!e.equals(i[i.length-1]));return i}(r)),o=s[0].distance(s[1]),a=s[1].distance(s[2]),h=s.map(t=>[t.x,t.y]);return h.push(+(a>o)),h}var mt="undefined"!=typeof Float32Array?Float32Array:Array;function gt(){var t=new mt(3);return mt!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function wt(t,n,i){var e=new mt(3);return e[0]=t,e[1]=n,e[2]=i,e}function Mt(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t}function bt(t,n,i,e){return t[0]=n,t[1]=i,t[2]=e,t}function xt(t,n,i){return t[0]=n[0]+i[0],t[1]=n[1]+i[1],t[2]=n[2]+i[2],t}function Ft(t,n,i){return t[0]=n[0]/i[0],t[1]=n[1]/i[1],t[2]=n[2]/i[2],t}function At(t,n){var i=n[0],e=n[1],r=n[2],s=i*i+e*e+r*r;return s>0&&(s=1/Math.sqrt(s),t[0]=n[0]*s,t[1]=n[1]*s,t[2]=n[2]*s),t}function kt(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]}function Pt(t,n,i){var e=n[0],r=n[1],s=n[2],o=i[0],a=i[1],h=i[2];return t[0]=r*h-s*a,t[1]=s*o-e*h,t[2]=e*a-r*o,t}var St=function(t,n,i){return t[0]=n[0]-i[0],t[1]=n[1]-i[1],t[2]=n[2]-i[2],t};function _t(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t}function Ot(t,n,i,e,r){return t[0]=n,t[1]=i,t[2]=e,t[3]=r,t}function It(){var t=new mt(4);return mt!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function Tt(t,n){var i=n[0]+n[4]+n[8],e=void 0;if(i>0)e=Math.sqrt(i+1),t[3]=.5*e,e=.5/e,t[0]=(n[5]-n[7])*e,t[1]=(n[6]-n[2])*e,t[2]=(n[1]-n[3])*e;else{var r=0;n[4]>n[0]&&(r=1),n[8]>n[3*r+r]&&(r=2);var s=(r+1)%3,o=(r+2)%3;e=Math.sqrt(n[3*r+r]-n[3*s+s]-n[3*o+o]+1),t[r]=.5*e,e=.5/e,t[3]=(n[3*s+o]-n[3*o+s])*e,t[s]=(n[3*s+r]+n[3*r+s])*e,t[o]=(n[3*o+r]+n[3*r+o])*e}return t}gt(),function(){var t,n=(t=new mt(4),mt!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t)}();var Lt,Ut=function(t,n,i){return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=n[3]*i,t},zt=function(t,n){var i=n[0],e=n[1],r=n[2],s=n[3],o=i*i+e*e+r*r+s*s;return o>0&&(o=1/Math.sqrt(o),t[0]=i*o,t[1]=e*o,t[2]=r*o,t[3]=s*o),t};function Dt(t,n){var i=n[0]-t[0],e=n[1]-t[1];return Math.sqrt(i*i+e*e)}function Et(t,n,i,e,r,s,o,a,h,u){0===t?function(t,n,i,e,r,s,o,a,h){const u=[0,0];for(let r=t;r<n;r+=3){const t=r/3*2,n=e[r],l=e[r+1];i[t]=u[0]+n*s*o/a,i[t+1]=u[1]-l*s*o/h}}(n,i,e,r,0,o,a,h,u):1===t&&function(t,n,i,e){const r=pt(e,t,n),s=r[4],o=r[s],a=r[s+1],h=r[s+2],u=(a[1]-o[1])/(a[0]-o[0]),l=(h[1]-a[1])/(h[0]-a[0]),c=Dt(o,a),f=Dt(a,h);for(let r=t;r<n;r+=3){const t=r/3*2,n=e[r],s=e[r+1];i[t]=jt(n,s,o,u,c),i[t+1]=-jt(n,s,a,l,f)}}(n,i,e,r)}gt(),wt(1,0,0),wt(0,1,0),It(),It(),Lt=new mt(9),mt!=Float32Array&&(Lt[1]=0,Lt[2]=0,Lt[3]=0,Lt[5]=0,Lt[6]=0,Lt[7]=0),Lt[0]=1,Lt[4]=1,Lt[8]=1,function(){var t=function(){var t=new mt(2);return mt!=Float32Array&&(t[0]=0,t[1]=0),t}()}();const Ct=[];function jt(t,n,i,e,r){return Ct[0]=(e*e*i[0]+e*(n-i[1])+t)/(e*e+1),Ct[1]=e*(Ct[0]-i[0])+i[1],Dt(i,Ct)/r}function Nt(t,n,i,e,r){const s=3*n[i-1],o=3*n[i-1]+1,a=t[s],h=t[o];return u=e,l=r,c=a,f=h,Math.sqrt((c-u)*(c-u)+(f-l)*(f-l));var u,l,c,f}"undefined"!=typeof undefinedThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof undefined?global:"undefined"!=typeof self&&self;var Ht=Vt;function Vt(t,n){this.x=t,this.y=n}function Rt(t,n,i){i=i||{},this.w=t||64,this.h=n||64,this.autoResize=!!i.autoResize,this.shelves=[],this.freebins=[],this.stats={},this.bins={},this.maxId=0}function $t(t,n,i){this.x=0,this.y=t,this.w=this.free=n,this.h=i}function Wt(t,n,i,e,r,s,o){this.id=t,this.x=n,this.y=i,this.w=e,this.h=r,this.maxw=s||e,this.maxh=o||r,this.refcount=0}Vt.prototype={clone:function(){return new Vt(this.x,this.y)},add:function(t){return this.clone().u(t)},sub:function(t){return this.clone().v(t)},multByPoint:function(t){return this.clone().m(t)},divByPoint:function(t){return this.clone().M(t)},mult:function(t){return this.clone().F(t)},div:function(t){return this.clone().A(t)},rotate:function(t){return this.clone().k(t)},rotateAround:function(t,n){return this.clone().P(t,n)},matMult:function(t){return this.clone().S(t)},unit:function(){return this.clone()._()},perp:function(){return this.clone().O()},round:function(){return this.clone().I()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var n=t.x-this.x,i=t.y-this.y;return n*n+i*i},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,n){return Math.atan2(this.x*n-this.y*t,this.x*t+this.y*n)},S:function(t){var n=t[0]*this.x+t[1]*this.y,i=t[2]*this.x+t[3]*this.y;return this.x=n,this.y=i,this},u:function(t){return this.x+=t.x,this.y+=t.y,this},v:function(t){return this.x-=t.x,this.y-=t.y,this},F:function(t){return this.x*=t,this.y*=t,this},A:function(t){return this.x/=t,this.y/=t,this},m:function(t){return this.x*=t.x,this.y*=t.y,this},M:function(t){return this.x/=t.x,this.y/=t.y,this},_:function(){return this.A(this.mag()),this},O:function(){var t=this.y;return this.y=this.x,this.x=-t,this},k:function(t){var n=Math.cos(t),i=Math.sin(t),e=n*this.x-i*this.y,r=i*this.x+n*this.y;return this.x=e,this.y=r,this},P:function(t,n){var i=Math.cos(t),e=Math.sin(t),r=n.x+i*(this.x-n.x)-e*(this.y-n.y),s=n.y+e*(this.x-n.x)+i*(this.y-n.y);return this.x=r,this.y=s,this},I:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},Vt.convert=function(t){return t instanceof Vt?t:Array.isArray(t)?new Vt(t[0],t[1]):t},Rt.prototype.pack=function(t,n){t=[].concat(t),n=n||{};for(var i,e,r,s,o=[],a=0;a<t.length;a++)if(i=t[a].w||t[a].width,e=t[a].h||t[a].height,r=t[a].id,i&&e){if(!(s=this.packOne(i,e,r)))continue;n.inPlace&&(t[a].x=s.x,t[a].y=s.y,t[a].id=s.id),o.push(s)}return this.shrink(),o},Rt.prototype.packOne=function(t,n,i){var e,r,s,o,a,h,u,l,c={freebin:-1,shelf:-1,waste:1/0},f=0;if("string"==typeof i||"number"==typeof i){if(e=this.getBin(i))return this.ref(e),e;"number"==typeof i&&(this.maxId=Math.max(i,this.maxId))}else i=++this.maxId;for(o=0;o<this.freebins.length;o++){if(n===(e=this.freebins[o]).maxh&&t===e.maxw)return this.allocFreebin(o,t,n,i);n>e.maxh||t>e.maxw||n<=e.maxh&&t<=e.maxw&&(s=e.maxw*e.maxh-t*n)<c.waste&&(c.waste=s,c.freebin=o)}for(o=0;o<this.shelves.length;o++)if(f+=(r=this.shelves[o]).h,!(t>r.free)){if(n===r.h)return this.allocShelf(o,t,n,i);n>r.h||n<r.h&&(s=(r.h-n)*t)<c.waste&&(c.freebin=-1,c.waste=s,c.shelf=o)}return-1!==c.freebin?this.allocFreebin(c.freebin,t,n,i):-1!==c.shelf?this.allocShelf(c.shelf,t,n,i):n<=this.h-f&&t<=this.w?(r=new $t(f,this.w,n),this.allocShelf(this.shelves.push(r)-1,t,n,i)):this.autoResize?(a=h=this.h,((u=l=this.w)<=a||t>u)&&(l=2*Math.max(t,u)),(a<u||n>a)&&(h=2*Math.max(n,a)),this.resize(l,h),this.packOne(t,n,i)):null},Rt.prototype.allocFreebin=function(t,n,i,e){var r=this.freebins.splice(t,1)[0];return r.id=e,r.w=n,r.h=i,r.refcount=0,this.bins[e]=r,this.ref(r),r},Rt.prototype.allocShelf=function(t,n,i,e){var r=this.shelves[t].alloc(n,i,e);return this.bins[e]=r,this.ref(r),r},Rt.prototype.shrink=function(){if(this.shelves.length>0){for(var t=0,n=0,i=0;i<this.shelves.length;i++){var e=this.shelves[i];n+=e.h,t=Math.max(e.w-e.free,t)}this.resize(t,n)}},Rt.prototype.getBin=function(t){return this.bins[t]},Rt.prototype.ref=function(t){if(1==++t.refcount){var n=t.h;this.stats[n]=1+(0|this.stats[n])}return t.refcount},Rt.prototype.unref=function(t){return 0===t.refcount?0:(0==--t.refcount&&(this.stats[t.h]--,delete this.bins[t.id],this.freebins.push(t)),t.refcount)},Rt.prototype.clear=function(){this.shelves=[],this.freebins=[],this.stats={},this.bins={},this.maxId=0},Rt.prototype.resize=function(t,n){this.w=t,this.h=n;for(var i=0;i<this.shelves.length;i++)this.shelves[i].resize(t);return!0},$t.prototype.alloc=function(t,n,i){if(t>this.free||n>this.h)return null;var e=this.x;return this.x+=t,this.free-=t,new Wt(i,e,this.y,t,n,t,this.h)},$t.prototype.resize=function(t){return this.free+=t-this.w,this.w=t,!0};var qt={exports:{}};qt.exports=function(){function t(t,n,i){var e=t[n];t[n]=t[i],t[i]=e}function n(t,n){return t<n?-1:t>n?1:0}return function(i,e,r,s,o){!function n(i,e,r,s,o){for(;s>r;){if(s-r>600){var a=s-r+1,h=e-r+1,u=Math.log(a),l=.5*Math.exp(2*u/3),c=.5*Math.sqrt(u*l*(a-l)/a)*(h-a/2<0?-1:1),f=Math.max(r,Math.floor(e-h*l/a+c)),d=Math.min(s,Math.floor(e+(a-h)*l/a+c));n(i,e,f,d,o)}var y=i[e],v=r,p=s;for(t(i,r,e),o(i[s],y)>0&&t(i,r,s);v<p;){for(t(i,v,p),v++,p--;o(i[v],y)<0;)v++;for(;o(i[p],y)>0;)p--}0===o(i[r],y)?t(i,r,p):(p++,t(i,p,s)),p<=e&&(r=p+1),e<=p&&(s=p-1)}}(i,e,r||0,s||i.length-1,o||n)}}();var Bt=qt.exports,Gt={exports:{}};function Jt(t,n){if(!(this instanceof Jt))return new Jt(t,n);if(this.data=t||[],this.length=this.data.length,this.compare=n||Xt,this.length>0)for(var i=(this.length>>1)-1;i>=0;i--)this.T(i)}function Xt(t,n){return t<n?-1:t>n?1:0}Gt.exports=Jt,Gt.exports.default=Jt,Jt.prototype={push:function(t){this.data.push(t),this.length++,this.L(this.length-1)},pop:function(){if(0!==this.length){var t=this.data[0];return this.length--,this.length>0&&(this.data[0]=this.data[this.length],this.T(0)),this.data.pop(),t}},peek:function(){return this.data[0]},L:function(t){for(var n=this.data,i=this.compare,e=n[t];t>0;){var r=t-1>>1,s=n[r];if(i(e,s)>=0)break;n[t]=s,t=r}n[t]=e},T:function(t){for(var n=this.data,i=this.compare,e=this.length>>1,r=n[t];t<e;){var s=1+(t<<1),o=s+1,a=n[s];if(o<this.length&&i(n[o],a)<0&&(s=o,a=n[o]),i(a,r)>=0)break;n[t]=a,t=s}n[t]=r}};var Zt=Gt.exports,Yt={exports:{}},Kt={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},Qt={exports:{}},tn=function(t){return!(!t||"string"==typeof t)&&(t instanceof Array||Array.isArray(t)||t.length>=0&&(t.splice instanceof Function||Object.getOwnPropertyDescriptor(t,t.length-1)&&"String"!==t.constructor.name))},nn=Array.prototype.concat,en=Array.prototype.slice,rn=Qt.exports=function(t){for(var n=[],i=0,e=t.length;i<e;i++){var r=t[i];tn(r)?n=nn.call(n,en.call(r)):n.push(r)}return n};rn.wrap=function(t){return function(){return t(rn(arguments))}};var sn=Kt,on=Qt.exports,an=Object.hasOwnProperty,hn={};for(var un in sn)an.call(sn,un)&&(hn[sn[un]]=un);var ln=Yt.exports={to:{},get:{}};function cn(t,n,i){return Math.min(Math.max(n,t),i)}function fn(t){var n=Math.round(t).toString(16).toUpperCase();return n.length<2?"0"+n:n}ln.get=function(t){var n,i;switch(t.substring(0,3).toLowerCase()){case"hsl":n=ln.get.hsl(t),i="hsl";break;case"hwb":n=ln.get.hwb(t),i="hwb";break;default:n=ln.get.rgb(t),i="rgb"}return n?{model:i,value:n}:null},ln.get.rgb=function(t){if(!t)return null;var n,i,e,r=[0,0,0,1];if(n=t.match(/^#([a-f0-9]{6})([a-f0-9]{2})?$/i)){for(e=n[2],n=n[1],i=0;i<3;i++){var s=2*i;r[i]=parseInt(n.slice(s,s+2),16)}e&&(r[3]=parseInt(e,16)/255)}else if(n=t.match(/^#([a-f0-9]{3,4})$/i)){for(e=(n=n[1])[3],i=0;i<3;i++)r[i]=parseInt(n[i]+n[i],16);e&&(r[3]=parseInt(e+e,16)/255)}else if(n=t.match(/^rgba?\\(\\s*([+-]?\\d+)(?=[\\s,])\\s*(?:,\\s*)?([+-]?\\d+)(?=[\\s,])\\s*(?:,\\s*)?([+-]?\\d+)\\s*(?:[,|\\/]\\s*([+-]?[\\d\\.]+)(%?)\\s*)?\\)$/)){for(i=0;i<3;i++)r[i]=parseInt(n[i+1],0);n[4]&&(n[5]?r[3]=.01*parseFloat(n[4]):r[3]=parseFloat(n[4]))}else{if(!(n=t.match(/^rgba?\\(\\s*([+-]?[\\d\\.]+)\\%\\s*,?\\s*([+-]?[\\d\\.]+)\\%\\s*,?\\s*([+-]?[\\d\\.]+)\\%\\s*(?:[,|\\/]\\s*([+-]?[\\d\\.]+)(%?)\\s*)?\\)$/)))return(n=t.match(/^(\\w+)$/))?"transparent"===n[1]?[0,0,0,0]:an.call(sn,n[1])?((r=sn[n[1]])[3]=1,r):null:null;for(i=0;i<3;i++)r[i]=Math.round(2.55*parseFloat(n[i+1]));n[4]&&(n[5]?r[3]=.01*parseFloat(n[4]):r[3]=parseFloat(n[4]))}for(i=0;i<3;i++)r[i]=cn(r[i],0,255);return r[3]=cn(r[3],0,1),r},ln.get.hsl=function(t){if(!t)return null;var n=t.match(/^hsla?\\(\\s*([+-]?(?:\\d{0,3}\\.)?\\d+)(?:deg)?\\s*,?\\s*([+-]?[\\d\\.]+)%\\s*,?\\s*([+-]?[\\d\\.]+)%\\s*(?:[,|\\/]\\s*([+-]?(?=\\.\\d|\\d)(?:0|[1-9]\\d*)?(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)\\s*)?\\)$/);if(n){var i=parseFloat(n[4]);return[(parseFloat(n[1])%360+360)%360,cn(parseFloat(n[2]),0,100),cn(parseFloat(n[3]),0,100),cn(isNaN(i)?1:i,0,1)]}return null},ln.get.hwb=function(t){if(!t)return null;var n=t.match(/^hwb\\(\\s*([+-]?\\d{0,3}(?:\\.\\d+)?)(?:deg)?\\s*,\\s*([+-]?[\\d\\.]+)%\\s*,\\s*([+-]?[\\d\\.]+)%\\s*(?:,\\s*([+-]?(?=\\.\\d|\\d)(?:0|[1-9]\\d*)?(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)\\s*)?\\)$/);if(n){var i=parseFloat(n[4]);return[(parseFloat(n[1])%360+360)%360,cn(parseFloat(n[2]),0,100),cn(parseFloat(n[3]),0,100),cn(isNaN(i)?1:i,0,1)]}return null},ln.to.hex=function(){var t=on(arguments);return"#"+fn(t[0])+fn(t[1])+fn(t[2])+(t[3]<1?fn(Math.round(255*t[3])):"")},ln.to.rgb=function(){var t=on(arguments);return t.length<4||1===t[3]?"rgb("+Math.round(t[0])+", "+Math.round(t[1])+", "+Math.round(t[2])+")":"rgba("+Math.round(t[0])+", "+Math.round(t[1])+", "+Math.round(t[2])+", "+t[3]+")"},ln.to.rgb.percent=function(){var t=on(arguments),n=Math.round(t[0]/255*100),i=Math.round(t[1]/255*100),e=Math.round(t[2]/255*100);return t.length<4||1===t[3]?"rgb("+n+"%, "+i+"%, "+e+"%)":"rgba("+n+"%, "+i+"%, "+e+"%, "+t[3]+")"},ln.to.hsl=function(){var t=on(arguments);return t.length<4||1===t[3]?"hsl("+t[0]+", "+t[1]+"%, "+t[2]+"%)":"hsla("+t[0]+", "+t[1]+"%, "+t[2]+"%, "+t[3]+")"},ln.to.hwb=function(){var t=on(arguments),n="";return t.length>=4&&1!==t[3]&&(n=", "+t[3]),"hwb("+t[0]+", "+t[1]+"%, "+t[2]+"%"+n+")"},ln.to.keyword=function(t){return hn[t.slice(0,3)]};var dn={exports:{}},yn=Kt,vn={};for(var pn in yn)yn.hasOwnProperty(pn)&&(vn[yn[pn]]=pn);var mn=dn.exports={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};for(var gn in mn)if(mn.hasOwnProperty(gn)){if(!("channels"in mn[gn]))throw new Error("missing channels property: "+gn);if(!("labels"in mn[gn]))throw new Error("missing channel labels property: "+gn);if(mn[gn].labels.length!==mn[gn].channels)throw new Error("channel and label counts mismatch: "+gn);var wn=mn[gn].channels,Mn=mn[gn].labels;delete mn[gn].channels,delete mn[gn].labels,Object.defineProperty(mn[gn],"channels",{value:wn}),Object.defineProperty(mn[gn],"labels",{value:Mn})}function bn(t,n){return Math.pow(t[0]-n[0],2)+Math.pow(t[1]-n[1],2)+Math.pow(t[2]-n[2],2)}mn.rgb.hsl=function(t){var n,i,e=t[0]/255,r=t[1]/255,s=t[2]/255,o=Math.min(e,r,s),a=Math.max(e,r,s),h=a-o;return a===o?n=0:e===a?n=(r-s)/h:r===a?n=2+(s-e)/h:s===a&&(n=4+(e-r)/h),(n=Math.min(60*n,360))<0&&(n+=360),i=(o+a)/2,[n,100*(a===o?0:i<=.5?h/(a+o):h/(2-a-o)),100*i]},mn.rgb.hsv=function(t){var n,i,e,r,s,o=t[0]/255,a=t[1]/255,h=t[2]/255,u=Math.max(o,a,h),l=u-Math.min(o,a,h),c=function(t){return(u-t)/6/l+.5};return 0===l?r=s=0:(s=l/u,n=c(o),i=c(a),e=c(h),o===u?r=e-i:a===u?r=1/3+n-e:h===u&&(r=2/3+i-n),r<0?r+=1:r>1&&(r-=1)),[360*r,100*s,100*u]},mn.rgb.hwb=function(t){var n=t[0],i=t[1],e=t[2];return[mn.rgb.hsl(t)[0],100*(1/255*Math.min(n,Math.min(i,e))),100*(e=1-1/255*Math.max(n,Math.max(i,e)))]},mn.rgb.cmyk=function(t){var n,i=t[0]/255,e=t[1]/255,r=t[2]/255;return[100*((1-i-(n=Math.min(1-i,1-e,1-r)))/(1-n)||0),100*((1-e-n)/(1-n)||0),100*((1-r-n)/(1-n)||0),100*n]},mn.rgb.keyword=function(t){var n=vn[t];if(n)return n;var i,e=1/0;for(var r in yn)if(yn.hasOwnProperty(r)){var s=bn(t,yn[r]);s<e&&(e=s,i=r)}return i},mn.keyword.rgb=function(t){return yn[t]},mn.rgb.xyz=function(t){var n=t[0]/255,i=t[1]/255,e=t[2]/255;return[100*(.4124*(n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92)+.3576*(i=i>.04045?Math.pow((i+.055)/1.055,2.4):i/12.92)+.1805*(e=e>.04045?Math.pow((e+.055)/1.055,2.4):e/12.92)),100*(.2126*n+.7152*i+.0722*e),100*(.0193*n+.1192*i+.9505*e)]},mn.rgb.lab=function(t){var n=mn.rgb.xyz(t),i=n[0],e=n[1],r=n[2];return e/=100,r/=108.883,i=(i/=95.047)>.008856?Math.pow(i,1/3):7.787*i+16/116,[116*(e=e>.008856?Math.pow(e,1/3):7.787*e+16/116)-16,500*(i-e),200*(e-(r=r>.008856?Math.pow(r,1/3):7.787*r+16/116))]},mn.hsl.rgb=function(t){var n,i,e,r,s,o=t[0]/360,a=t[1]/100,h=t[2]/100;if(0===a)return[s=255*h,s,s];n=2*h-(i=h<.5?h*(1+a):h+a-h*a),r=[0,0,0];for(var u=0;u<3;u++)(e=o+1/3*-(u-1))<0&&e++,e>1&&e--,s=6*e<1?n+6*(i-n)*e:2*e<1?i:3*e<2?n+(i-n)*(2/3-e)*6:n,r[u]=255*s;return r},mn.hsl.hsv=function(t){var n=t[0],i=t[1]/100,e=t[2]/100,r=i,s=Math.max(e,.01);return i*=(e*=2)<=1?e:2-e,r*=s<=1?s:2-s,[n,100*(0===e?2*r/(s+r):2*i/(e+i)),100*((e+i)/2)]},mn.hsv.rgb=function(t){var n=t[0]/60,i=t[1]/100,e=t[2]/100,r=Math.floor(n)%6,s=n-Math.floor(n),o=255*e*(1-i),a=255*e*(1-i*s),h=255*e*(1-i*(1-s));switch(e*=255,r){case 0:return[e,h,o];case 1:return[a,e,o];case 2:return[o,e,h];case 3:return[o,a,e];case 4:return[h,o,e];case 5:return[e,o,a]}},mn.hsv.hsl=function(t){var n,i,e,r=t[0],s=t[1]/100,o=t[2]/100,a=Math.max(o,.01);return e=(2-s)*o,i=s*a,[r,100*(i=(i/=(n=(2-s)*a)<=1?n:2-n)||0),100*(e/=2)]},mn.hwb.rgb=function(t){var n,i,e,r,s,o,a,h=t[0]/360,u=t[1]/100,l=t[2]/100,c=u+l;switch(c>1&&(u/=c,l/=c),e=6*h-(n=Math.floor(6*h)),0!=(1&n)&&(e=1-e),r=u+e*((i=1-l)-u),n){default:case 6:case 0:s=i,o=r,a=u;break;case 1:s=r,o=i,a=u;break;case 2:s=u,o=i,a=r;break;case 3:s=u,o=r,a=i;break;case 4:s=r,o=u,a=i;break;case 5:s=i,o=u,a=r}return[255*s,255*o,255*a]},mn.cmyk.rgb=function(t){var n=t[0]/100,i=t[1]/100,e=t[2]/100,r=t[3]/100;return[255*(1-Math.min(1,n*(1-r)+r)),255*(1-Math.min(1,i*(1-r)+r)),255*(1-Math.min(1,e*(1-r)+r))]},mn.xyz.rgb=function(t){var n,i,e,r=t[0]/100,s=t[1]/100,o=t[2]/100;return i=-.9689*r+1.8758*s+.0415*o,e=.0557*r+-.204*s+1.057*o,n=(n=3.2406*r+-1.5372*s+-.4986*o)>.0031308?1.055*Math.pow(n,1/2.4)-.055:12.92*n,i=i>.0031308?1.055*Math.pow(i,1/2.4)-.055:12.92*i,e=e>.0031308?1.055*Math.pow(e,1/2.4)-.055:12.92*e,[255*(n=Math.min(Math.max(0,n),1)),255*(i=Math.min(Math.max(0,i),1)),255*(e=Math.min(Math.max(0,e),1))]},mn.xyz.lab=function(t){var n=t[0],i=t[1],e=t[2];return i/=100,e/=108.883,n=(n/=95.047)>.008856?Math.pow(n,1/3):7.787*n+16/116,[116*(i=i>.008856?Math.pow(i,1/3):7.787*i+16/116)-16,500*(n-i),200*(i-(e=e>.008856?Math.pow(e,1/3):7.787*e+16/116))]},mn.lab.xyz=function(t){var n,i,e,r=t[0];n=t[1]/500+(i=(r+16)/116),e=i-t[2]/200;var s=Math.pow(i,3),o=Math.pow(n,3),a=Math.pow(e,3);return i=s>.008856?s:(i-16/116)/7.787,n=o>.008856?o:(n-16/116)/7.787,e=a>.008856?a:(e-16/116)/7.787,[n*=95.047,i*=100,e*=108.883]},mn.lab.lch=function(t){var n,i=t[0],e=t[1],r=t[2];return(n=360*Math.atan2(r,e)/2/Math.PI)<0&&(n+=360),[i,Math.sqrt(e*e+r*r),n]},mn.lch.lab=function(t){var n,i=t[0],e=t[1];return n=t[2]/360*2*Math.PI,[i,e*Math.cos(n),e*Math.sin(n)]},mn.rgb.ansi16=function(t){var n=t[0],i=t[1],e=t[2],r=1 in arguments?arguments[1]:mn.rgb.hsv(t)[2];if(0===(r=Math.round(r/50)))return 30;var s=30+(Math.round(e/255)<<2|Math.round(i/255)<<1|Math.round(n/255));return 2===r&&(s+=60),s},mn.hsv.ansi16=function(t){return mn.rgb.ansi16(mn.hsv.rgb(t),t[2])},mn.rgb.ansi256=function(t){var n=t[0],i=t[1],e=t[2];return n===i&&i===e?n<8?16:n>248?231:Math.round((n-8)/247*24)+232:16+36*Math.round(n/255*5)+6*Math.round(i/255*5)+Math.round(e/255*5)},mn.ansi16.rgb=function(t){var n=t%10;if(0===n||7===n)return t>50&&(n+=3.5),[n=n/10.5*255,n,n];var i=.5*(1+~~(t>50));return[(1&n)*i*255,(n>>1&1)*i*255,(n>>2&1)*i*255]},mn.ansi256.rgb=function(t){if(t>=232){var n=10*(t-232)+8;return[n,n,n]}var i;return t-=16,[Math.floor(t/36)/5*255,Math.floor((i=t%36)/6)/5*255,i%6/5*255]},mn.rgb.hex=function(t){var n=(((255&Math.round(t[0]))<<16)+((255&Math.round(t[1]))<<8)+(255&Math.round(t[2]))).toString(16).toUpperCase();return"000000".substring(n.length)+n},mn.hex.rgb=function(t){var n=t.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!n)return[0,0,0];var i=n[0];3===n[0].length&&(i=i.split("").map((function(t){return t+t})).join(""));var e=parseInt(i,16);return[e>>16&255,e>>8&255,255&e]},mn.rgb.hcg=function(t){var n,i=t[0]/255,e=t[1]/255,r=t[2]/255,s=Math.max(Math.max(i,e),r),o=Math.min(Math.min(i,e),r),a=s-o;return n=a<=0?0:s===i?(e-r)/a%6:s===e?2+(r-i)/a:4+(i-e)/a+4,n/=6,[360*(n%=1),100*a,100*(a<1?o/(1-a):0)]},mn.hsl.hcg=function(t){var n=t[1]/100,i=t[2]/100,e=1,r=0;return(e=i<.5?2*n*i:2*n*(1-i))<1&&(r=(i-.5*e)/(1-e)),[t[0],100*e,100*r]},mn.hsv.hcg=function(t){var n=t[1]/100,i=t[2]/100,e=n*i,r=0;return e<1&&(r=(i-e)/(1-e)),[t[0],100*e,100*r]},mn.hcg.rgb=function(t){var n=t[0]/360,i=t[1]/100,e=t[2]/100;if(0===i)return[255*e,255*e,255*e];var r,s=[0,0,0],o=n%1*6,a=o%1,h=1-a;switch(Math.floor(o)){case 0:s[0]=1,s[1]=a,s[2]=0;break;case 1:s[0]=h,s[1]=1,s[2]=0;break;case 2:s[0]=0,s[1]=1,s[2]=a;break;case 3:s[0]=0,s[1]=h,s[2]=1;break;case 4:s[0]=a,s[1]=0,s[2]=1;break;default:s[0]=1,s[1]=0,s[2]=h}return r=(1-i)*e,[255*(i*s[0]+r),255*(i*s[1]+r),255*(i*s[2]+r)]},mn.hcg.hsv=function(t){var n=t[1]/100,i=n+t[2]/100*(1-n),e=0;return i>0&&(e=n/i),[t[0],100*e,100*i]},mn.hcg.hsl=function(t){var n=t[1]/100,i=t[2]/100*(1-n)+.5*n,e=0;return i>0&&i<.5?e=n/(2*i):i>=.5&&i<1&&(e=n/(2*(1-i))),[t[0],100*e,100*i]},mn.hcg.hwb=function(t){var n=t[1]/100,i=n+t[2]/100*(1-n);return[t[0],100*(i-n),100*(1-i)]},mn.hwb.hcg=function(t){var n=t[1]/100,i=1-t[2]/100,e=i-n,r=0;return e<1&&(r=(i-e)/(1-e)),[t[0],100*e,100*r]},mn.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]},mn.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]},mn.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]},mn.gray.hsl=mn.gray.hsv=function(t){return[0,0,t[0]]},mn.gray.hwb=function(t){return[0,100,t[0]]},mn.gray.cmyk=function(t){return[0,0,0,t[0]]},mn.gray.lab=function(t){return[t[0],0,0]},mn.gray.hex=function(t){var n=255&Math.round(t[0]/100*255),i=((n<<16)+(n<<8)+n).toString(16).toUpperCase();return"000000".substring(i.length)+i},mn.rgb.gray=function(t){return[(t[0]+t[1]+t[2])/3/255*100]};var xn=dn.exports;function Fn(t){var n=function(){for(var t={},n=Object.keys(xn),i=n.length,e=0;e<i;e++)t[n[e]]={distance:-1,parent:null};return t}(),i=[t];for(n[t].distance=0;i.length;)for(var e=i.pop(),r=Object.keys(xn[e]),s=r.length,o=0;o<s;o++){var a=r[o],h=n[a];-1===h.distance&&(h.distance=n[e].distance+1,h.parent=e,i.unshift(a))}return n}function An(t,n){return function(i){return n(t(i))}}function kn(t,n){for(var i=[n[t].parent,t],e=xn[n[t].parent][t],r=n[t].parent;n[r].parent;)i.unshift(n[r].parent),e=An(xn[n[r].parent][r],e),r=n[r].parent;return e.conversion=i,e}var Pn=dn.exports,Sn=function(t){for(var n=Fn(t),i={},e=Object.keys(n),r=e.length,s=0;s<r;s++){var o=e[s];null!==n[o].parent&&(i[o]=kn(o,n))}return i},_n={};Object.keys(Pn).forEach((function(t){_n[t]={},Object.defineProperty(_n[t],"channels",{value:Pn[t].channels}),Object.defineProperty(_n[t],"labels",{value:Pn[t].labels});var n=Sn(t);Object.keys(n).forEach((function(i){var e=n[i];_n[t][i]=function(t){var n=function(n){if(null==n)return n;arguments.length>1&&(n=Array.prototype.slice.call(arguments));var i=t(n);if("object"==typeof i)for(var e=i.length,r=0;r<e;r++)i[r]=Math.round(i[r]);return i};return"conversion"in t&&(n.conversion=t.conversion),n}(e),_n[t][i].raw=function(t){var n=function(n){return null==n?n:(arguments.length>1&&(n=Array.prototype.slice.call(arguments)),t(n))};return"conversion"in t&&(n.conversion=t.conversion),n}(e)}))}));var On=_n,In=Yt.exports,Tn=On,Ln=[].slice,Un=["keyword","gray","hex"],zn={};Object.keys(Tn).forEach((function(t){zn[Ln.call(Tn[t].labels).sort().join("")]=t}));var Dn={};function En(t,n){if(!(this instanceof En))return new En(t,n);if(n&&n in Un&&(n=null),n&&!(n in Tn))throw new Error("Unknown model: "+n);var i,e;if(null==t)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(t instanceof En)this.model=t.model,this.color=t.color.slice(),this.valpha=t.valpha;else if("string"==typeof t){var r=In.get(t);if(null===r)throw new Error("Unable to parse color from string: "+t);this.model=r.model,e=Tn[this.model].channels,this.color=r.value.slice(0,e),this.valpha="number"==typeof r.value[e]?r.value[e]:1}else if(t.length){this.model=n||"rgb",e=Tn[this.model].channels;var s=Ln.call(t,0,e);this.color=Hn(s,e),this.valpha="number"==typeof t[e]?t[e]:1}else if("number"==typeof t)t&=16777215,this.model="rgb",this.color=[t>>16&255,t>>8&255,255&t],this.valpha=1;else{this.valpha=1;var o=Object.keys(t);"alpha"in t&&(o.splice(o.indexOf("alpha"),1),this.valpha="number"==typeof t.alpha?t.alpha:0);var a=o.sort().join("");if(!(a in zn))throw new Error("Unable to parse color from object: "+JSON.stringify(t));this.model=zn[a];var h=Tn[this.model].labels,u=[];for(i=0;i<h.length;i++)u.push(t[h[i]]);this.color=Hn(u)}if(Dn[this.model])for(e=Tn[this.model].channels,i=0;i<e;i++){var l=Dn[this.model][i];l&&(this.color[i]=l(this.color[i]))}this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze&&Object.freeze(this)}function Cn(t,n,i){return(t=Array.isArray(t)?t:[t]).forEach((function(t){(Dn[t]||(Dn[t]=[]))[n]=i})),t=t[0],function(e){var r;return arguments.length?(i&&(e=i(e)),(r=this[t]()).color[n]=e,r):(r=this[t]().color[n],i&&(r=i(r)),r)}}function jn(t){return function(n){return Math.max(0,Math.min(t,n))}}function Nn(t){return Array.isArray(t)?t:[t]}function Hn(t,n){for(var i=0;i<n;i++)"number"!=typeof t[i]&&(t[i]=0);return t}En.prototype={toString:function(){return this.string()},toJSON:function(){return this[this.model]()},string:function(t){var n=this.model in In.to?this:this.rgb(),i=1===(n=n.round("number"==typeof t?t:1)).valpha?n.color:n.color.concat(this.valpha);return In.to[n.model](i)},percentString:function(t){var n=this.rgb().round("number"==typeof t?t:1),i=1===n.valpha?n.color:n.color.concat(this.valpha);return In.to.rgb.percent(i)},array:function(){return 1===this.valpha?this.color.slice():this.color.concat(this.valpha)},object:function(){for(var t={},n=Tn[this.model].channels,i=Tn[this.model].labels,e=0;e<n;e++)t[i[e]]=this.color[e];return 1!==this.valpha&&(t.alpha=this.valpha),t},unitArray:function(){var t=this.rgb().color;return t[0]/=255,t[1]/=255,t[2]/=255,1!==this.valpha&&t.push(this.valpha),t},unitObject:function(){var t=this.rgb().object();return t.r/=255,t.g/=255,t.b/=255,1!==this.valpha&&(t.alpha=this.valpha),t},round:function(t){return t=Math.max(t||0,0),new En(this.color.map(function(t){return function(n){return function(t,n){return Number(t.toFixed(n))}(n,t)}}(t)).concat(this.valpha),this.model)},alpha:function(t){return arguments.length?new En(this.color.concat(Math.max(0,Math.min(1,t))),this.model):this.valpha},red:Cn("rgb",0,jn(255)),green:Cn("rgb",1,jn(255)),blue:Cn("rgb",2,jn(255)),hue:Cn(["hsl","hsv","hsl","hwb","hcg"],0,(function(t){return(t%360+360)%360})),saturationl:Cn("hsl",1,jn(100)),lightness:Cn("hsl",2,jn(100)),saturationv:Cn("hsv",1,jn(100)),value:Cn("hsv",2,jn(100)),chroma:Cn("hcg",1,jn(100)),gray:Cn("hcg",2,jn(100)),white:Cn("hwb",1,jn(100)),wblack:Cn("hwb",2,jn(100)),cyan:Cn("cmyk",0,jn(100)),magenta:Cn("cmyk",1,jn(100)),yellow:Cn("cmyk",2,jn(100)),black:Cn("cmyk",3,jn(100)),x:Cn("xyz",0,jn(100)),y:Cn("xyz",1,jn(100)),z:Cn("xyz",2,jn(100)),l:Cn("lab",0,jn(100)),a:Cn("lab",1),b:Cn("lab",2),keyword:function(t){return arguments.length?new En(t):Tn[this.model].keyword(this.color)},hex:function(t){return arguments.length?new En(t):In.to.hex(this.rgb().round().color)},rgbNumber:function(){var t=this.rgb().color;return(255&t[0])<<16|(255&t[1])<<8|255&t[2]},luminosity:function(){for(var t=this.rgb().color,n=[],i=0;i<t.length;i++){var e=t[i]/255;n[i]=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4)}return.2126*n[0]+.7152*n[1]+.0722*n[2]},contrast:function(t){var n=this.luminosity(),i=t.luminosity();return n>i?(n+.05)/(i+.05):(i+.05)/(n+.05)},level:function(t){var n=this.contrast(t);return n>=7.1?"AAA":n>=4.5?"AA":""},isDark:function(){var t=this.rgb().color;return(299*t[0]+587*t[1]+114*t[2])/1e3<128},isLight:function(){return!this.isDark()},negate:function(){for(var t=this.rgb(),n=0;n<3;n++)t.color[n]=255-t.color[n];return t},lighten:function(t){var n=this.hsl();return n.color[2]+=n.color[2]*t,n},darken:function(t){var n=this.hsl();return n.color[2]-=n.color[2]*t,n},saturate:function(t){var n=this.hsl();return n.color[1]+=n.color[1]*t,n},desaturate:function(t){var n=this.hsl();return n.color[1]-=n.color[1]*t,n},whiten:function(t){var n=this.hwb();return n.color[1]+=n.color[1]*t,n},blacken:function(t){var n=this.hwb();return n.color[2]+=n.color[2]*t,n},grayscale:function(){var t=this.rgb().color,n=.3*t[0]+.59*t[1]+.11*t[2];return En.rgb(n,n,n)},fade:function(t){return this.alpha(this.valpha-this.valpha*t)},opaquer:function(t){return this.alpha(this.valpha+this.valpha*t)},rotate:function(t){var n=this.hsl(),i=n.color[0];return i=(i=(i+t)%360)<0?360+i:i,n.color[0]=i,n},mix:function(t,n){if(!t||!t.rgb)throw new Error(\'Argument to "mix" was not a Color instance, but rather an instance of \'+typeof t);var i=t.rgb(),e=this.rgb(),r=void 0===n?.5:n,s=2*r-1,o=i.alpha()-e.alpha(),a=((s*o==-1?s:(s+o)/(1+s*o))+1)/2,h=1-a;return En.rgb(a*i.red()+h*e.red(),a*i.green()+h*e.green(),a*i.blue()+h*e.blue(),i.alpha()*r+e.alpha()*(1-r))}},Object.keys(Tn).forEach((function(t){if(-1===Un.indexOf(t)){var n=Tn[t].channels;En.prototype[t]=function(){if(this.model===t)return new En(this);if(arguments.length)return new En(arguments,t);var i="number"==typeof arguments[n]?n:this.valpha;return new En(Nn(Tn[this.model][t].raw(this.color)).concat(i),t)},En[t]=function(i){return"number"==typeof i&&(i=Hn(Ln.call(arguments),n)),new En(i,t)}}}));var Vn=En;class Rn{constructor(t,n){this.position=t,this.index=n,this.faces=[],this.neighbors=[]}addUniqueNeighbor(t){-1===this.neighbors.indexOf(t)&&this.neighbors.push(t)}}class $n{constructor(t,n,i,e){this.a=e.a,this.b=e.b,this.c=e.c,this.v1=t,this.v2=n,this.v3=i,this.normal=[],this.computeNormal(),t.faces.push(this),t.addUniqueNeighbor(n),t.addUniqueNeighbor(i),n.faces.push(this),n.addUniqueNeighbor(t),n.addUniqueNeighbor(i),i.faces.push(this),i.addUniqueNeighbor(t),i.addUniqueNeighbor(n)}computeNormal(){const t=this.v1.position,n=this.v2.position,i=this.v3.position,e=Pt([],St([],i,n),St([],t,n));At(this.normal,e)}hasVertex(t){return t===this.v1||t===this.v2||t===this.v3}}\n/*!\n * Contains code from google filament\n * https://github.com/google/filament/\n * License Apache-2.0\n */const Wn=[],qn=[],Bn=[],Gn=[];function Jn(t,n,i){const e=Pt(qn,n,i);t=Tt(t,function(t,n,i,e,r,s,o,a,h,u){return t[0]=n,t[1]=i,t[2]=e,t[3]=r,t[4]=s,t[5]=o,t[6]=a,t[7]=h,t[8]=u,t}(Wn,i[0],i[1],i[2],...e,...n));if((t=function(t){return t[3]<0?Ut(t,t,-1):t}(t=zt(t,t)))[3]<1/32767){t[3]=1/32767;const n=Math.sqrt(.9999999990686206);t[0]*=n,t[1]*=n,t[2]*=n}const r=i[3]>0?Pt(Bn,i,n):Pt(Bn,n,i);return kt(Pt(Gn,i,n),r)<0&&Ut(t,t,-1),t}function Xn(t,n){const i=[],e=[];let r=0;for(r=0;r<t.length;r+=3){const n=new Rn([t[r],t[r+1],t[r+2]],r/3);i.push(n)}if(!n.length){const t=n;n=[];for(let i=0;i<t;i++)n.push(i)}for(r=0;r<n.length/3;r++){const t={a:n[3*r],b:n[3*r+1],c:n[3*r+2]};new $n(i[t.a],i[t.b],i[t.c],t)}const s=[],o=[0,0,0];for(r=0;r<i.length;r++){const t=i[r],n=t.index;bt(o,0,0,0);let a=t.faces.length;for(let n=0;n<a;n++)xt(o,o,t.faces[n].normal);a=a||1,bt(s,a,a,a),Ft(o,o,s),e[3*n]=o[0],e[3*n+1]=o[1],e[3*n+2]=o[2]}return e}\n/*!\n * Contains code from THREE.JS\n * https://github.com/mrdoob/three.js/\n * License MIT\n * \n * Generate tangents per vertex.\n */function Zn(t,n,i){return t[0]=n[i],t[1]=n[i+1],t[2]=n[i+2],t}function Yn(t,n,i){return t[0]=n[i],t[1]=n[i+1],t}var Kn={exports:{}};function Qn(t,n,i){i=i||2;var e,r,s,o,a,h,u,l=n&&n.length,c=l?n[0]*i:t.length,f=ti(t,0,c,i,!0),d=[];if(!f||f.next===f.prev)return d;if(l&&(f=function(t,n,i,e){var r,s,o,a,h,u=[];for(r=0,s=n.length;r<s;r++)o=n[r]*e,a=r<s-1?n[r+1]*e:t.length,(h=ti(t,o,a,e,!1))===h.next&&(h.steiner=!0),u.push(ci(h));for(u.sort(ai),r=0;r<u.length;r++)i=ni(i=hi(u[r],i),i.next);return i}(t,n,f,i)),t.length>80*i){e=s=t[0],r=o=t[1];for(var y=i;y<c;y+=i)(a=t[y])<e&&(e=a),(h=t[y+1])<r&&(r=h),a>s&&(s=a),h>o&&(o=h);u=0!==(u=Math.max(s-e,o-r))?1/u:0}return ii(f,d,i,e,r,u),d}function ti(t,n,i,e,r){var s,o;if(r===Ai(t,n,i,e)>0)for(s=n;s<i;s+=e)o=bi(s,t[s],t[s+1],o);else for(s=i-e;s>=n;s-=e)o=bi(s,t[s],t[s+1],o);return o&&vi(o,o.next)&&(xi(o),o=o.next),o}function ni(t,n){if(!t)return t;n||(n=t);var i,e=t;do{if(i=!1,e.steiner||!vi(e,e.next)&&0!==yi(e.prev,e,e.next))e=e.next;else{if(xi(e),(e=n=e.prev)===e.next)break;i=!0}}while(i||e!==n);return n}function ii(t,n,i,e,r,s,o){if(t){!o&&s&&function(t,n,i,e){var r=t;do{null===r.z&&(r.z=li(r.x,r.y,n,i,e)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){var n,i,e,r,s,o,a,h,u=1;do{for(i=t,t=null,s=null,o=0;i;){for(o++,e=i,a=0,n=0;n<u&&(a++,e=e.nextZ);n++);for(h=u;a>0||h>0&&e;)0!==a&&(0===h||!e||i.z<=e.z)?(r=i,i=i.nextZ,a--):(r=e,e=e.nextZ,h--),s?s.nextZ=r:t=r,r.prevZ=s,s=r;i=e}s.nextZ=null,u*=2}while(o>1)}(r)}(t,e,r,s);for(var a,h,u=t;t.prev!==t.next;)if(a=t.prev,h=t.next,s?ri(t,e,r,s):ei(t))n.push(a.i/i),n.push(t.i/i),n.push(h.i/i),xi(t),t=h.next,u=h.next;else if((t=h)===u){o?1===o?ii(t=si(ni(t),n,i),n,i,e,r,s,2):2===o&&oi(t,n,i,e,r,s):ii(ni(t),n,i,e,r,s,1);break}}}function ei(t){var n=t.prev,i=t,e=t.next;if(yi(n,i,e)>=0)return!1;for(var r=t.next.next;r!==t.prev;){if(fi(n.x,n.y,i.x,i.y,e.x,e.y,r.x,r.y)&&yi(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function ri(t,n,i,e){var r=t.prev,s=t,o=t.next;if(yi(r,s,o)>=0)return!1;for(var a=r.x<s.x?r.x<o.x?r.x:o.x:s.x<o.x?s.x:o.x,h=r.y<s.y?r.y<o.y?r.y:o.y:s.y<o.y?s.y:o.y,u=r.x>s.x?r.x>o.x?r.x:o.x:s.x>o.x?s.x:o.x,l=r.y>s.y?r.y>o.y?r.y:o.y:s.y>o.y?s.y:o.y,c=li(a,h,n,i,e),f=li(u,l,n,i,e),d=t.prevZ,y=t.nextZ;d&&d.z>=c&&y&&y.z<=f;){if(d!==t.prev&&d!==t.next&&fi(r.x,r.y,s.x,s.y,o.x,o.y,d.x,d.y)&&yi(d.prev,d,d.next)>=0)return!1;if(d=d.prevZ,y!==t.prev&&y!==t.next&&fi(r.x,r.y,s.x,s.y,o.x,o.y,y.x,y.y)&&yi(y.prev,y,y.next)>=0)return!1;y=y.nextZ}for(;d&&d.z>=c;){if(d!==t.prev&&d!==t.next&&fi(r.x,r.y,s.x,s.y,o.x,o.y,d.x,d.y)&&yi(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;y&&y.z<=f;){if(y!==t.prev&&y!==t.next&&fi(r.x,r.y,s.x,s.y,o.x,o.y,y.x,y.y)&&yi(y.prev,y,y.next)>=0)return!1;y=y.nextZ}return!0}function si(t,n,i){var e=t;do{var r=e.prev,s=e.next.next;!vi(r,s)&&pi(r,e,e.next,s)&&wi(r,s)&&wi(s,r)&&(n.push(r.i/i),n.push(e.i/i),n.push(s.i/i),xi(e),xi(e.next),e=t=s),e=e.next}while(e!==t);return ni(e)}function oi(t,n,i,e,r,s){var o=t;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&di(o,a)){var h=Mi(o,a);return o=ni(o,o.next),h=ni(h,h.next),ii(o,n,i,e,r,s),void ii(h,n,i,e,r,s)}a=a.next}o=o.next}while(o!==t)}function ai(t,n){return t.x-n.x}function hi(t,n){var i=function(t,n){var i,e=n,r=t.x,s=t.y,o=-1/0;do{if(s<=e.y&&s>=e.next.y&&e.next.y!==e.y){var a=e.x+(s-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(a<=r&&a>o){if(o=a,a===r){if(s===e.y)return e;if(s===e.next.y)return e.next}i=e.x<e.next.x?e:e.next}}e=e.next}while(e!==n);if(!i)return null;if(r===o)return i;var h,u=i,l=i.x,c=i.y,f=1/0;e=i;do{r>=e.x&&e.x>=l&&r!==e.x&&fi(s<c?r:o,s,l,c,s<c?o:r,s,e.x,e.y)&&(h=Math.abs(s-e.y)/(r-e.x),wi(e,t)&&(h<f||h===f&&(e.x>i.x||e.x===i.x&&ui(i,e)))&&(i=e,f=h)),e=e.next}while(e!==u);return i}(t,n);if(!i)return n;var e=Mi(i,t),r=ni(i,i.next);return ni(e,e.next),n===i?r:n}function ui(t,n){return yi(t.prev,t,n.prev)<0&&yi(n.next,t,t.next)<0}function li(t,n,i,e,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*r)|t<<8))|t<<4))|t<<2))|t<<1))|(n=1431655765&((n=858993459&((n=252645135&((n=16711935&((n=32767*(n-e)*r)|n<<8))|n<<4))|n<<2))|n<<1))<<1}function ci(t){var n=t,i=t;do{(n.x<i.x||n.x===i.x&&n.y<i.y)&&(i=n),n=n.next}while(n!==t);return i}function fi(t,n,i,e,r,s,o,a){return(r-o)*(n-a)-(t-o)*(s-a)>=0&&(t-o)*(e-a)-(i-o)*(n-a)>=0&&(i-o)*(s-a)-(r-o)*(e-a)>=0}function di(t,n){return t.next.i!==n.i&&t.prev.i!==n.i&&!function(t,n){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==n.i&&i.next.i!==n.i&&pi(i,i.next,t,n))return!0;i=i.next}while(i!==t);return!1}(t,n)&&(wi(t,n)&&wi(n,t)&&function(t,n){var i=t,e=!1,r=(t.x+n.x)/2,s=(t.y+n.y)/2;do{i.y>s!=i.next.y>s&&i.next.y!==i.y&&r<(i.next.x-i.x)*(s-i.y)/(i.next.y-i.y)+i.x&&(e=!e),i=i.next}while(i!==t);return e}(t,n)&&(yi(t.prev,t,n.prev)||yi(t,n.prev,n))||vi(t,n)&&yi(t.prev,t,t.next)>0&&yi(n.prev,n,n.next)>0)}function yi(t,n,i){return(n.y-t.y)*(i.x-n.x)-(n.x-t.x)*(i.y-n.y)}function vi(t,n){return t.x===n.x&&t.y===n.y}function pi(t,n,i,e){var r=gi(yi(t,n,i)),s=gi(yi(t,n,e)),o=gi(yi(i,e,t)),a=gi(yi(i,e,n));return r!==s&&o!==a||(!(0!==r||!mi(t,i,n))||(!(0!==s||!mi(t,e,n))||(!(0!==o||!mi(i,t,e))||!(0!==a||!mi(i,n,e)))))}function mi(t,n,i){return n.x<=Math.max(t.x,i.x)&&n.x>=Math.min(t.x,i.x)&&n.y<=Math.max(t.y,i.y)&&n.y>=Math.min(t.y,i.y)}function gi(t){return t>0?1:t<0?-1:0}function wi(t,n){return yi(t.prev,t,t.next)<0?yi(t,n,t.next)>=0&&yi(t,t.prev,n)>=0:yi(t,n,t.prev)<0||yi(t,t.next,n)<0}function Mi(t,n){var i=new Fi(t.i,t.x,t.y),e=new Fi(n.i,n.x,n.y),r=t.next,s=n.prev;return t.next=n,n.prev=t,i.next=r,r.prev=i,e.next=i,i.prev=e,s.next=e,e.prev=s,e}function bi(t,n,i,e){var r=new Fi(t,n,i);return e?(r.next=e.next,r.prev=e,e.next.prev=r,e.next=r):(r.prev=r,r.next=r),r}function xi(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Fi(t,n,i){this.i=t,this.x=n,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Ai(t,n,i,e){for(var r=0,s=n,o=i-e;s<i;s+=e)r+=(t[o]-t[s])*(t[s+1]+t[o+1]),o=s;return r}Kn.exports=Qn,Kn.exports.default=Qn,Qn.deviation=function(t,n,i,e){var r=n&&n.length,s=r?n[0]*i:t.length,o=Math.abs(Ai(t,0,s,i));if(r)for(var a=0,h=n.length;a<h;a++){var u=n[a]*i,l=a<h-1?n[a+1]*i:t.length;o-=Math.abs(Ai(t,u,l,i))}var c=0;for(a=0;a<e.length;a+=3){var f=e[a]*i,d=e[a+1]*i,y=e[a+2]*i;c+=Math.abs((t[f]-t[y])*(t[d+1]-t[f+1])-(t[f]-t[d])*(t[y+1]-t[f+1]))}return 0===o&&0===c?0:Math.abs((c-o)/o)},Qn.flatten=function(t){for(var n=t[0][0].length,i={vertices:[],holes:[],dimensions:n},e=0,r=0;r<t.length;r++){for(var s=0;s<t[r].length;s++)for(var o=0;o<n;o++)i.vertices.push(t[r][s][o]);r>0&&(e+=t[r-1].length,i.holes.push(e))}return i};var ki=Kn.exports;\n/*!\n * @maptalks/vector-packer v0.63.4\n * LICENSE : UNLICENSED\n * (c) 2016-2022 maptalks.com\n */const Pi={Point:1,LineString:2,Polygon:3,MultiPoint:4,MultiLineString:5,MultiPolygon:6};function Si(t,n={}){var i=[];if("FeatureCollection"===t.type)for(var e=0;e<t.features.length;e++)_i(i,t.features[e],n,e);else _i(i,"Feature"===t.type?t:{geometry:t},n);return i}function _i(t,n,i,e){if(n.geometry&&n.geometry.geometry){var r=n.geometry.coordinates,s=n.geometry.type,o=[],a=n.id;if(i.promoteId?a=n.properties[i.promoteId]:i.generateId&&(a=e||0),"Point"===s)Oi(r,o);else if("MultiPoint"===s)for(var h=0;h<r.length;h++)Oi(r[h],o);else if("LineString"===s)Ti([r],o);else if("MultiLineString"===s){if(i.lineMetrics){for(h=0;h<r.length;h++)Ii(r[h],o=[]),t.push(Li(a,"LineString",o,n.properties));return}Ti(r,o)}else if("Polygon"===s)Ti(r,o);else{if("MultiPolygon"!==s){if("GeometryCollection"===s){for(h=0;h<n.geometry.geometries.length;h++)_i(t,{id:a,geometry:n.geometry.geometries[h],properties:n.properties},i,e);return}return void console.warn(`Input data type(${s}) is not a valid GeoJSON geometry type.`)}for(h=0;h<r.length;h++){var u=[];Ti(r[h],u),o.push(u)}}t.push(Li(a,s,o,n.properties))}}function Oi(t,n){n.push([new Ht(t[0],t[1])])}function Ii(t,n){for(var i=0;i<t.length;i++)n.push(new Ht(t[i][0],t[i][1]))}function Ti(t,n,i,e){for(var r=0;r<t.length;r++){var s=[];Ii(t[r],s),n.push(s)}}function Li(t,n,i,e){return{id:void 0===t?null:t,type:Pi[n],geometry:i,properties:e}}\n/*!\n * Codes from mapbox-gl-js\n * github.com/mapbox/mapbox-gl-js\n * MIT License\n */function Ui(t,{width:n,height:i},e,r){if(r){if(r.length!==n*i*e)throw new RangeError("mismatched image size")}else r=new Uint8Array(n*i*e);return t.width=n,t.height=i,t.data=r,t}function zi(t,{width:n,height:i},e){if(n===t.width&&i===t.height)return;const r=Ui({},{width:n,height:i},e);Di(t,r,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,n),height:Math.min(t.height,i)},e),t.width=n,t.height=i,t.data=r.data}function Di(t,n,i,e,r,s){if(0===r.width||0===r.height)return n;if(r.width>t.width||r.height>t.height||i.x>t.width-r.width||i.y>t.height-r.height)throw new RangeError("out of range source coordinates for image copy");if(r.width>n.width||r.height>n.height||e.x>n.width-r.width||e.y>n.height-r.height)throw new RangeError("out of range destination coordinates for image copy");const o=t.data,a=n.data;if(o===a)return n;for(let h=0;h<r.height;h++){const u=((i.y+h)*t.width+i.x)*s,l=((e.y+h)*n.width+e.x)*s;for(let t=0;t<r.width*s;t++)a[l+t]=o[u+t]}return n}class Ei{constructor(t,n){Ui(this,t,1,n)}resize(t){zi(this,t,1)}clone(){return new Ei({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,n,i,e,r){Di(t,n,i,e,r,1)}}class Ci{constructor(t,n){Ui(this,t,4,n)}resize(t){zi(this,t,4)}clone(){return new Ci({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,n,i,e,r){Di(t,n,i,e,r,4)}}\n/*!\n * Codes from mapbox-gl-js\n * github.com/mapbox/mapbox-gl-js\n * MIT License\n */class ji{constructor(t,{pixelRatio:n}){this.paddedRect=t,this.pixelRatio=n||1}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}}class Ni{constructor(t){this.glyphMap=t,this.build()}build(){const t=this.glyphMap,n={},i=new Rt(0,0,{autoResize:!0}),e=[];for(const i in t){const r=t[i],s={x:0,y:0,w:r.data.width+2,h:r.data.height+2};e.push(s),n[i]=new ji(s,r)}if(i.pack(e,{inPlace:!0}),!Hi(i.w)||!Hi(i.h)){const t=Vi(i.w),n=Vi(i.h);i.resize(t,n)}const r=new Ci({width:i.w,height:i.h});for(const i in t){const e=t[i],s=n[i].paddedRect;Ci.copy(e.data,r,{x:0,y:0},{x:s.x+1,y:s.y+1},e.data)}this.image=r,this.positions=n}}function Hi(t){return 0==(t&t-1)&&0!==t}function Vi(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}\n/*!\n * Codes from mapbox-gl-js\n * github.com/mapbox/mapbox-gl-js\n * MIT License\n * TODO 升级为potpack\n */class Ri{constructor(t){this.glyphMap=t,this.build()}build(){const t=this.glyphMap,n={},i=new Rt(0,0,{autoResize:!0}),e=[];for(const i in t){const r=t[i],s=n[i]={};for(const t in r){const n=r[+t];if(!n||0===n.bitmap.width||0===n.bitmap.height)continue;const i={x:0,y:0,w:n.bitmap.width+2,h:n.bitmap.height+2};e.push(i),s[t]={rect:i,metrics:n.metrics}}}i.pack(e,{inPlace:!0});const r=new Ei({width:i.w,height:i.h});for(const i in t){const e=t[i];for(const t in e){const s=e[+t];if(!s||0===s.bitmap.width||0===s.bitmap.height)continue;const o=n[i][t].rect;Ei.copy(s.bitmap,r,{x:0,y:0},{x:o.x+1,y:o.y+1},s.bitmap)}}this.image=r,this.positions=n}}function $i(t){return t<65536?Uint16Array:Uint32Array}function Wi(t){return(t=Math.abs(t))<128?Int8Array:t<32768?Int16Array:Float32Array}function qi(t){return t<256?Uint8Array:t<65536?Uint16Array:Float32Array}function Bi(t){const n=t.type,i=[];if(1===n||4===n)for(let n=0;n<t.geometry.length;n++)Oi(t.geometry[n],i);else if(2===n)Ti(t.geometry,i);else if(3===n)Ti(t.geometry,i);else if(5===n)Ti(t.geometry,i);else if(6===n)for(let n=0;n<t.geometry.length;n++){const e=[];Ti(t.geometry[n],e),i.push(e)}return t.geometry=i,t}function Gi(t){for(let n=1;n<arguments.length;n++){const i=arguments[n];for(const n in i)t[n]=i[n]}return t}function Ji(t){return null==t}function Xi(t){return"number"==typeof t&&!isNaN(t)}function Zi(t){return"object"==typeof t&&!!t}function Yi(t){return!Ji(t)&&("string"==typeof t||null!==t.constructor&&t.constructor===String)}const Ki=Object.prototype.hasOwnProperty;function Qi(t,n){return Ki.call(t,n)}function te(t){return m(t)&&t.property}function ne(t){let n=0;for(let i,e,r=0,s=t.length,o=s-1;r<s;o=r++)i=t[r],e=t[o],n+=void 0!==i.x?(e.x-i.x)*(i.y+e.y):(e[0]-i[0])*(i[1]+e[1]);return n}function ie(t,n,i,e,r){const s=t[n*e],o=t[n*e+1],a=t[i*e],h=t[i*e+1];return s===a&&(s<0||s>r)&&o!==h||o===h&&(o<0||o>r)&&s!==a}function ee(t,n,i){let e=i;return n&&t&&(e=t[n]),void 0===e&&(e=i),10*(e||0)}function re(t,n,i,e,r,s,o){const a=ee(t.properties,i,e),h=a*n;let u=a;return r?u=ee(t.properties,r,s):o&&(u=a-ee(t.properties,o,0)),u*=n,{altitude:h,height:u}}function se(t,n){return n<1/0&&(t.x<0||t.x>n||t.y<0||t.y>n)}function oe(t){return null==t}function ae(t,n,i){if(t===i||t===n)return t;const e=i-n;return((t-n)%e+e)%e+n}class he{constructor(t,n,i,e){this.feature=t,this.symbol=n,this.fnTypes=i,this.options=e}getPolygonResource(){let t=this.symbol.polygonPatternFile;const{polygonPatternFileFn:n}=this.fnTypes;return this.U(t,n)}getLineResource(){let t=this.symbol.linePatternFile;const{linePatternFileFn:n}=this.fnTypes;return this.U(t,n)}U(t,n){return n&&(t=n(this.options.zoom,this.feature.properties)),t}}const ue={lineWidth:1,lineStrokeWidth:1,lineDx:1,lineDy:1,lineOpacity:1,linePatternAnimSpeed:1,markerWidth:1,markerHeight:1,markerDx:1,markerDy:1,markerSpacing:1,markerOpacity:1,markerRotation:1,textWrapWidth:1,textSpacing:1,textSize:1,textHaloRadius:1,textHaloOpacity:1,textDx:1,textDy:1,textOpacity:1,textRotation:1,polygonOpacity:1};class le{static isAtlasLoaded(t,n={}){const{iconAtlas:i}=n;return!!(!t||i&&i.positions[t])}static genFnTypes(t){const n={};for(const i in t)if(te(t[i])){const e=(i+"_Fn_0").trim(),r=(i+"Fn").trim();ue[i]?(n[e]=g(t[i]),n[r]=(t,i)=>{const r=n[e](t,i);return te(r)?g(r)(t,i):r}):(n[e]=w(t[i]),n[r]=(t,i)=>{const r=n[e](t,i);return te(r)?w(r)(t,i):r})}return n}constructor(t,n,i){this.options=i,this.features=this.D(t),this.symbolDef=n,this.symbol=M(n,()=>[i.zoom]),this.styledVectors=[],this.properties={},this.C=le.genFnTypes(this.symbolDef),te(this.symbolDef.visible)&&(this.j=g(this.symbolDef.visible)),i.atlas&&(this.iconAtlas=i.atlas.iconAtlas,this.glyphAtlas=i.atlas.glyphAtlas)}D(t){if(!t.length)return t;const n="__fea_idx".trim();let e,r=0,s=t[r];for(;!s.geometry;)r++,s=t[r];if(Array.isArray(s.geometry)&&s.properties){let n=s.geometry[0];for(;Array.isArray(n);)n=n[0];n instanceof Ht&&(e=t)}if(!e)if(e=[],Array.isArray(s.geometry))for(let n=0;n<t.length;n++){const i=Gi({},t[n]);e.push(Bi(i))}else for(let i=0;i<t.length;i++){const r=t[i],s=Si(r);for(let t=0;t<s.length;t++){const i=s[t];i[n]=r[n],e.push(i)}}const o=this.options.order;if(o){const t=[];for(let n=0;n<o.length;n++)o[n]&&t.push(i(o[n]));e=e.sort((n,i)=>{const e=t.length;let r=e,s=e;for(let o=0;o<e&&(t[o](n)&&(r=o),t[o](i)&&(s=o),!(r<e&&s<e));o++);return r-s})}return e}load(t=1){const n="__fea_idx".trim(),i="_debug_info".trim(),e=this.C,r=this.styledVectors;this.count=0;const s=this.features;if(!s||!s.length)return Promise.resolve(null);const o={},a={},h={zoom:this.options.zoom},u=M(this.symbolDef,()=>[h.zoom]);let l=0,c=s.length;const f=this.options.debugIndex;try{for(;l<c;l++){const t=s[l];if(!t||!t.geometry)continue;if(void 0!==f&&t[i].index!==f)continue;t.properties||(t.properties={}),t.properties.$layer=t.layer,t.properties.$type=t.type;const c=this.createStyledVector(t,u,e,h,o,a);c&&c.feature.geometry&&(c.featureIdx=void 0===t[n]?l:t[n],this.count++,r.push(c))}}catch(t){return Promise.reject(t)}return this.options.atlas?Promise.resolve(this.pack(t)):this.loadAtlas(o,a).then(()=>this.pack(t))}loadAtlas(t,n){return new Promise((i,e)=>{this.fetchAtlas(t,n,(t,n)=>{if(t)e(t);else{if(n){const{icons:t,glyphs:i}=n;if(t&&Object.keys(t).length){for(const n in t){const i=t[n],{width:e,height:r,data:s}=i.data;i.data=new Ci({width:e,height:r},s)}this.iconAtlas=new Ni(t)}if(i&&Object.keys(i).length){for(const t in i){const n=i[t];for(const t in n){const i=n[t],{width:e,height:r,data:s}=i.bitmap;i.bitmap=new Ei({width:e,height:r},s)}}this.glyphAtlas=new Ri(i)}}i({glyphAtlas:this.glyphAtlas,iconAtlas:this.iconAtlas})}})})}fetchAtlas(t,n,i){Object.keys(t).length>0||Object.keys(n).length>0?this.options.requestor(t,n,i):i()}pack(t){if(!this.count)return null;if(null==t)throw new Error("layout scale is undefined");const n=this.createDataPack(this.styledVectors,t);if(!n)return null;n.properties=this.properties,this.empty&&(n.empty=!0);const i=n.buffers;delete n.buffers;const e={data:n,buffers:i};if(this.iconAtlas){const t=e.data.iconAtlas=ce(this.iconAtlas);if(t.glyphMap)for(const n in t.glyphMap)i.push(t.glyphMap[n].data.data.buffer);i.push(e.data.iconAtlas.image.data.buffer)}return this.glyphAtlas&&(e.data.glyphAtlas=ce(this.glyphAtlas),i.push(e.data.glyphAtlas.image.data.buffer)),e}createStyledVector(t,n,i,e){return new he(t,n,i,e)}createDataPack(t,n){if(!t||!t.length)return null;this.maxIndex=0,this.maxPos=0,this.maxAltitude=0;const i=this.data={};let e=this.elements=[];const r=this.getFormat(Array.isArray(t[0])?t[0][0].symbol:t[0].symbol);for(let t=0;t<r.length;t++)i[r[t].name]=[];let s=[],o=0;const a=[];let h=0,u=!1;for(let e=0,r=t.length;e<r;e++){if(!t[e].feature.geometry)continue;const r=Array.isArray(t[e])?t[e][0].feature.id:t[e].feature.id;Xi(r)&&(Math.abs(r)>h&&(h=Math.abs(r)),r<0&&(u=!0));const l=this.data.aPosition.length;if(Array.isArray(t[e]))for(let i=0;i<t[e].length;i++)this.N(t[e][i],n);else this.N(t[e],n);const c=(i.aPosition.length-l)/3;for(let n=0;n<c;n++)s.push(t[e].featureIdx),Xi(r)&&a.push(r);o=Math.max(o,t[e].featureIdx)}if(this.hasElements()&&!e.length)return null;s=new(qi(o))(s),r[0].type=this.options.positionType?this.options.positionType:Wi(Math.max(this.maxPos,this.maxAltitude));const l=this.options.center;if(l&&(l[0]||l[1])){const t=i.aPosition;for(let n=0;n<t.length;n+=3)t[n]-=l[0],t[n+1]-=l[1]}const c=function(t,n){const i={};for(let e=0;e<t.length;e++){const r=t[e],s=r.type,o=r.name;i[o]=s===Array?n[o]:new s(n[o])}return i}(r,i);c.aPickingId=s;const f=[];for(const t in c)f.push(c[t].buffer);e=new($i(this.maxIndex))(e),f.push(e.buffer);const d={data:c,indices:this.hasElements()?e:null,positionSize:3,\n//!this.maxAltitude ? 2 : 3,\nbuffers:f,symbolIndex:this.symbolDef.index||{index:0}};if(a.length){const t=u?Wi(h):qi(h);d.featureIds=new t(a),f.push(d.featureIds.buffer)}else d.featureIds=[];return d}N(t,n){this.j&&this.j.isZoomConstant&&!this.j(null,t.feature.properties)||this.placeVector(t,n,this.formatWidth)}addElements(...t){this.maxIndex=Math.max(this.maxIndex,...t),this.elements.push(...t)}hasElements(){return!0}getAltitude(t){const{altitudeProperty:n,defaultAltitude:i,altitudeScale:e}=this.options;let r=ee(t,n,i);return e&&(r*=e),this.maxAltitude=Math.max(this.maxAltitude,Math.abs(r)),r}getIconAtlasMaxValue(){const t=this.iconAtlas.positions;let n=0;for(const i in t)if(Qi(t,i)){const{tl:e,displaySize:r}=t[i],s=Math.max(e[0],e[1],r[0]-1,r[1]-1);s>n&&(n=s)}return n}}function ce(t){let n=t.positions,i=t.image&&t.image.format||"alpha";if(t instanceof Ni){n={};for(const i in t.positions){const e=t.positions[i];n[i]={paddedRect:e.paddedRect,pixelRatio:e.pixelRatio,tl:e.tl,br:e.br,displaySize:e.displaySize}}i="rgba"}const e=t.image;return{image:{width:e.width,height:e.height,data:e.data,format:i},glyphMap:t.glyphMap,positions:n}}function fe(t,n,i,e){const r="__fn_textSize".trim();let s=t.textSize;if(Ji(n.textSize))return[16,16];t[r]&&(s=t[r]);const o=[];var a;return o[0]=Ji(a=s)||"function"!=typeof a&&(null===a.constructor||a.constructor!==Function)?s:s(e,i),o[1]=o[0],o}function de(t){const n=t.stops;let i=-1/0;for(let t=0;t<n.length;t++){let e=n[t][1];Zi(n[t][1])&&(e=de(n[t][1])),e>i&&(i=e)}return i}const ye=/\\{([\\w_]+)\\}/g;function ve(t,n){return Yi(t)?t.replace(ye,(function(t,i){if(!n)return"";const e=n[i];return Ji(e)?"":Array.isArray(e)?e.join():e})):t}const pe=t=>t>=11904&&t<=12031,me=t=>t>=12032&&t<=12255,ge=t=>t>=12272&&t<=12287,we=t=>t>=12288&&t<=12351,Me=t=>t>=12352&&t<=12447,be=t=>t>=12448&&t<=12543,xe=t=>t>=12544&&t<=12591,Fe=t=>t>=12704&&t<=12735,Ae=t=>t>=12736&&t<=12783,ke=t=>t>=12784&&t<=12799,Pe=t=>t>=12800&&t<=13055,Se=t=>t>=13056&&t<=13311,_e=t=>t>=13312&&t<=19903,Oe=t=>t>=19968&&t<=40959,Ie=t=>t>=40960&&t<=42127,Te=t=>t>=42128&&t<=42191,Le=t=>t>=63744&&t<=64255,Ue=t=>t>=64336&&t<=65023,ze=t=>t>=65040&&t<=65055,De=t=>t>=65072&&t<=65103,Ee=t=>t>=65104&&t<=65135,Ce=t=>t>=65136&&t<=65279,je=t=>t>=65280&&t<=65519;function Ne(t){return!((t=>t>=1536&&t<=1791)(t)||(t=>t>=1872&&t<=1919)(t)||(t=>t>=2208&&t<=2303)(t)||Ue(t)||Ce(t))}function He(t){return!!(746===t||747===t||!(t<4352)&&(Fe(t)||xe(t)||De(t)&&!(t>=65097&&t<=65103)||Le(t)||Se(t)||pe(t)||Ae(t)||!(!we(t)||t>=12296&&t<=12305||t>=12308&&t<=12319||12336===t)||_e(t)||Oe(t)||Pe(t)||(t=>t>=12592&&t<=12687)(t)||(t=>t>=43360&&t<=43391)(t)||(t=>t>=55216&&t<=55295)(t)||(t=>t>=4352&&t<=4607)(t)||(t=>t>=44032&&t<=55215)(t)||Me(t)||ge(t)||(t=>t>=12688&&t<=12703)(t)||me(t)||ke(t)||be(t)&&12540!==t||!(!je(t)||65288===t||65289===t||65293===t||t>=65306&&t<=65310||65339===t||65341===t||65343===t||t>=65371&&t<=65503||65507===t||t>=65512&&t<=65519)||!(!Ee(t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||(t=>t>=5120&&t<=5759)(t)||(t=>t>=6320&&t<=6399)(t)||ze(t)||(t=>t>=19904&&t<=19967)(t)||Ie(t)||Te(t)))}function Ve(t){return!(He(t)||function(t){return!!((t=>t>=128&&t<=255)(t)&&(167===t||169===t||174===t||177===t||188===t||189===t||190===t||215===t||247===t)||(t=>t>=8192&&t<=8303)(t)&&(8214===t||8224===t||8225===t||8240===t||8241===t||8251===t||8252===t||8258===t||8263===t||8264===t||8265===t||8273===t)||(t=>t>=8448&&t<=8527)(t)||(t=>t>=8528&&t<=8591)(t)||(t=>t>=8960&&t<=9215)(t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||9003===t||t>=9085&&t<=9114||t>=9150&&t<=9165||9167===t||t>=9169&&t<=9179||t>=9186&&t<=9215)||(t=>t>=9216&&t<=9279)(t)&&9251!==t||(t=>t>=9280&&t<=9311)(t)||(t=>t>=9312&&t<=9471)(t)||(t=>t>=9632&&t<=9727)(t)||(t=>t>=9728&&t<=9983)(t)&&!(t>=9754&&t<=9759)||(t=>t>=11008&&t<=11263)(t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||we(t)||be(t)||(t=>t>=57344&&t<=63743)(t)||De(t)||Ee(t)||je(t)||8734===t||8756===t||8757===t||t>=9984&&t<=10087||t>=10102&&t<=10131||65532===t||65533===t)}(t))}function Re(t){return t>=1424&&t<=2303||Ue(t)||Ce(t)}const $e=[[9,9],[32,32],[5760,5760],[8192,8198],[8200,8202],[8287,12288],[6158,6158],[8203,8205]];function We(t){for(const n of $e)if(t>=n[0]&&t<=n[1])return!0;return!1}const qe={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\\\":"\","]":"﹈","^":"^",H:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};function Be(t,n,i,e,r,s,o,a,h,u){let l=t.trim();2===u&&(l=function(t){let n="";for(let i=0;i<t.length;i++){const e=t.charCodeAt(i+1)||null,r=t.charCodeAt(i-1)||null;n+=e&&Ve(e)&&!qe[t[i+1]]||r&&Ve(r)&&!qe[t[i-1]]||!qe[t[i]]?t[i]:qe[t[i]]}return n}(l));const c=[],f={positionedGlyphs:c,text:l,top:a[1],bottom:a[1],left:a[0],right:a[0],writingMode:u};let d;return d=function(t,n){const i=[];let e=0;for(let r=0;r<n.length;r++){const s=n[r];i.push(t.substring(e,s)),e=s}return e<t.length&&i.push(t.substring(e,t.length)),i}(l,function(t,n,i,e){if(!i)return[];if(!t)return[];const r=[],s=function(t,n,i,e){let r=0;for(let i=0;i<t.length;i++){const s=e[t.charCodeAt(i)];s&&(r+=s.metrics.advance+n)}return r/Math.max(1,Math.ceil(r/i))}(t,n,i,e);let o=0;for(let i=0;i<t.length;i++){const h=t.charCodeAt(i),u=e[h];u&&!Ge[h]&&(o+=u.metrics.advance+n),i<t.length-1&&(Je[h]||!((a=h)<11904)&&(Fe(a)||xe(a)||De(a)||Le(a)||Se(a)||pe(a)||Ae(a)||we(a)||_e(a)||Oe(a)||Pe(a)||je(a)||Me(a)||ge(a)||me(a)||ke(a)||be(a)||ze(a)||Te(a)||Ie(a)))&&r.push(Ye(i+1,o,s,r,Ze(h,t.charCodeAt(i+1)),!1))}var a;return function t(n){return n?t(n.priorBreak).concat(n.index):[]}(Ye(t.length,o,s,r,0,!0))}(l,o,i,n)),function(t,n,i,e,r,s,o,a,h){let u=0,l=8,c=0;const f=t.positionedGlyphs,d="right"===s?1:"left"===s?0:.5;for(let t=0;t<i.length;t++){let r=i[t];if(r=r.trim(),!r.length){l-=e;continue}const s=f.length;for(let t=0;t<r.length;t++){const i=r.charCodeAt(t),e=n[i];e&&(He(i)&&1!==o?(32!==i&&f.push({glyph:i,x:u,y:0,vertical:!0}),u+=h+a):(32!==i&&f.push({glyph:i,x:u,y:l,vertical:!1}),u+=e.metrics.advance+a))}f.length!==s&&(c=Math.max(u-a,c),Qe(f,n,s,f.length-1,d)),u=0,l-=e}const{horizontalAlign:y,verticalAlign:v}=Ke(r);!function(t,n,i,e,r,s,o){const a=(n-i)*r,h=-(-e*o+.5)*s;if(a||h)for(let n=0;n<t.length;n++)t[n].x+=a,t[n].y+=h}(f,d,y,v,c,e,i.length);const p=i.length*e;t.top+=-v*p,t.bottom=t.top+p,t.left+=-y*c,t.right=t.left+c}(f,n,d,e,r,s,u,o,h),!!c.length&&f}const Ge={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Je={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function Xe(t,n,i,e){const r=Math.pow(t-n,2);return e?t<n?r/2:2*r:r+Math.abs(i)*i}function Ze(t,n){let i=0;return 10===t&&(i-=1e4),40!==t&&65288!==t||(i+=50),41!==n&&65289!==n||(i+=50),i}function Ye(t,n,i,e,r,s){let o=null,a=Xe(n,i,r,s);for(let t=0;t<e.length;t++){const h=e[t],u=Xe(n-h.x,i,r,s)+h.badness;u<=a&&(o=h,a=u)}return{index:t,x:n,priorBreak:o,badness:a}}function Ke(t){let n=.5,i=.5;switch(t){case"right":case"top-right":case"bottom-right":n=1;break;case"left":case"top-left":case"bottom-left":n=0}switch(t){case"bottom":case"bottom-right":case"bottom-left":i=1;break;case"top":case"top-right":case"top-left":i=0}return{horizontalAlign:n,verticalAlign:i}}function Qe(t,n,i,e,r){if(!r)return;const s=n[t[e].glyph];if(s){const n=(t[e].x+s.metrics.advance)*r;if(!n)return;for(let r=i;r<=e;r++)t[r].x-=n}}function tr(t){if(!function(t){for(const n of t)if(Re(n.charCodeAt(0)))return!0;return!1}(t))return t;const n=[],i=[],e=[];let r=0,s=0,o=1,a=1;for(const h of t){const t=h.codePointAt(0);We(t)?(e.push(h),r++):(o=Re(t)?-1:1,a!==o?(s=r,i.length&&(a>0&&i.reverse(),n.push(...i)),e.length&&(n.splice(s,0,...e),e.length=0),a=o,i.length=0):e.length&&(i.push(...e),e.length=0),i.push(h),r++)}return e.length&&i.push(...e),i.length&&(a>0&&i.reverse(),n.push(...i)),n.reverse().join("")}const nr=/\\{ *([\\w_]+) *\\}/g;class ir{constructor(t,n,i,e,r){this.feature=t,this.symbolDef=n,this.symbol=i,this.options=r,this.V=this.R.bind(this),this.C=e}R(t,n){return this.feature.properties[n]||"default"}getShape(t,n){if(this.W)return this.W;const{textHorizontalAlignmentFn:i,textVerticalAlignmentFn:e,markerHorizontalAlignmentFn:r,markerVerticalAlignmentFn:s,textWrapWidthFn:o}=this.C;let a;const h=this.symbol,u=this.getIconAndGlyph(),l=this.feature.properties;if(u&&u.glyph){const{font:t,text:r}=u.glyph;if(""===r)return null;const s=this.size[0]/24,c=24,f=h.textKeepUpright,d="map"===h.textRotationAlignment&&"line"===h.textPlacement&&!h.isIconText,y=n.glyphMap[t],v=er(i?i(null,l):h.textHorizontalAlignment,e?e(null,l):h.textVerticalAlignment),p=1.2*c,m=function(t){for(let n=0;n<t.length;n++)if(!Ne(t.charAt(n).charCodeAt(0)))return!1;return!0}(r),g=m&&h.textLetterSpacing/s||0,w=[h.textDx/s||0,h.textDy/s||0],M=((o?o(null,l):h.textWrapWidth)||10*c)/s;a={},a.horizontal=Be(r,y,M,p,v,"center",g,w,c,1),m&&d&&f&&(a.vertical=Be(r,y,M,p,v,"center",g,w,c,2))}else if(u&&u.icon){if(!t.positions[u.icon.url])return null;const n=er(r?r(null,l):h.markerHorizontalAlignment,s?s(null,l):h.markerVerticalAlignment);a=function(t,n){const{horizontalAlign:i,verticalAlign:e}=Ke(n),r=-24*i,s=-24*e;return{image:t,top:s,bottom:s+24,left:r,right:r+24}}(t.positions[u.icon.url],n),this.size||(this.size=a.image.displaySize)}return this.W=a,a}getIconAndGlyph(){if(this.iconGlyph)return this.iconGlyph;const{markerFileFn:t,markerTypeFn:n,markerPathFn:i,markerWidthFn:e,markerHeightFn:r,markerFillFn:s,markerFillPatternFileFn:o,markerFillOpacityFn:a,markerTextFitFn:h,markerTextFitPaddingFn:u,markerLineColorFn:l,markerLineWidthFn:c,markerLineOpacityFn:f,markerLineDasharrayFn:d,markerLinePatternFileFn:y,markerPathWidthFn:v,markerPathHeightFn:p,textNameFn:w,textFaceNameFn:M,textStyleFn:b,textWeightFn:x}=this.C,{zoom:F}=this.options,A={},k=this.symbol,P=this.feature.properties,S=t?t(null,P):k.markerFile,_=n?n(null,P):k.markerType,O=S||_||k.markerPath,I=!Ji(this.symbolDef.textName);let T;if(O){T=function(t,n,i,e,r,s){if(Ji(n.markerWidth)&&Ji(n.markerHeight))return null;const o="__fn_markerWidth".trim(),a="__fn_markerHeight".trim();let h=n.markerWidth||0,u=n.markerHeight||0;return Zi(h)&&("identity"!==h.type?h=de(h):(h=t.markerWidth,t[o]&&(h=t[o](e,i)),Zi(h)&&(h="identity"===h.type?r(e,i):de(h)))),Zi(u)&&("identity"!==u.type?u=de(u):(u=t.markerHeight,t[a]&&(u=t[a](e,i)),Zi(u)&&(u="identity"===u.type?s(e,i):de(u)))),[h,u]}(k,this.symbolDef,P,F,e,r)||[0,0];let t=k.markerTextFit;if(h&&(t=h(F,P)),t&&t&&"none"!==t){const n=k.text.textSize;let i=k.text.textName;m(i)&&(i=g(i)(F,P));const e=ve(i,P);if(e){const i="__fn_textSize".trim(),r="__fn_textSize_0".trim();m(n)&&!k.text[i]&&(k.text[r]=g(n),k.text[i]=(t,n)=>{const i=k.text[r](t,n);return m(i)?g(i)(t,n):i});const s=fe(k.text,k.text,P,F);if("width"!==t&&"both"!==t||(T[0]=s[0]*e.length),"height"!==t&&"both"!==t||(T[1]=s[1]),s[0]&&s[1]){let t=k.markerTextFitPadding||[0,0,0,0];u&&(t=u(F,P)),T[0]+=t[1]+t[3],T[1]+=t[0]+t[2]}}else T[0]=T[1]=-1}}if(I&&(T=fe(k,this.symbolDef,P,F)),!T)return A;if(T[0]=Math.ceil(T[0]),T[1]=Math.ceil(T[1]),this.size=T,O&&T[0]>=0&&T[1]>=0){let t;if(_){const n={};if(n.markerType=_,"path"===_&&(n.markerPath=i?i(null,P):k.markerPath,n.markerPathWidth=v?v(null,P):k.markerPathWidth,n.markerPathHeight=p?p(null,P):k.markerPathHeight),e){const t=e(null,P);Ji(t)||(n.markerWidth=t)}else k.markerWidth>=0&&(n.markerWidth=k.markerWidth);if(r){const t=r(null,P);Ji(t)||(n.markerHeight=t)}else k.markerHeight>=0&&(n.markerHeight=k.markerHeight);if(s){const t=s(null,P);Ji(t)||(n.markerFill=t)}else k.markerFill&&(n.markerFill=k.markerFill);if(o){const t=o(null,P);Ji(t)||(n.markerFillPatternFile=t)}else k.markerFillPatternFile&&(n.markerFillPatternFile=k.markerFillPatternFile);if(a){const t=a(null,P);Ji(t)||(n.markerFillOpacity=t)}else k.markerFillOpacity>=0&&(n.markerFillOpacity=k.markerFillOpacity);if(l){const t=l(null,P);Ji(t)||(n.markerLineColor=t)}else k.markerLineColor&&(n.markerLineColor=k.markerLineColor);if(c){const t=c(null,P);Ji(t)||(n.markerLineWidth=t)}else k.markerLineWidth>=0&&(n.markerLineWidth=k.markerLineWidth);if(f){const t=f(null,P);Ji(t)||(n.markerLineOpacity=t)}else k.markerLineOpacity>=0&&(n.markerLineOpacity=k.markerLineOpacity);if(d){const t=d(null,P);Ji(t)||(n.markerLineDasharray=t)}else k.markerLineDasharray&&(n.markerLineDasharray=k.markerLineDasharray);if(y){const t=y(null,P);Ji(t)||(n.markerLinePatternFile=t)}else k.markerLinePatternFile&&(n.markerLinePatternFile=k.markerLinePatternFile);t="vector://"+JSON.stringify(n)}else t=S?S.replace(nr,this.V):k.markerPath?function(t,n,i){if(!t.markerPath)return null;let e=1;const r=function(t){const n={stroke:{stroke:t.markerLineColor,"stroke-width":t.markerLineWidth,"stroke-opacity":t.markerLineOpacity,"stroke-dasharray":null,"stroke-linecap":"butt","stroke-linejoin":"round"},fill:{fill:t.markerFill,"fill-opacity":t.markerFillOpacity}};return 0===n.stroke["stroke-width"]&&(n.stroke["stroke-opacity"]=0),n}(t);Xi(t.markerOpacity)&&(e=t.markerOpacity),Xi(t.opacity)&&(e*=t.opacity);const s={};if(r){for(const t in r.stroke)Qi(r.stroke,t)&&(Ji(r.stroke[t])||(s[t]=r.stroke[t]));for(const t in r.fill)Qi(r.fill,t)&&(Ji(r.fill[t])||(s[t]=r.fill[t]))}const o=Array.isArray(t.markerPath)?t.markerPath:[t.markerPath];let a;const h=[];for(let t=0;t<o.length;t++)a=Yi(o[t])?{path:o[t]}:o[t],a=Gi({},a,s),a.d=a.path,delete a.path,h.push(a);const u=[\'<svg version="1.1"\',\'xmlns="http://www.w3.org/2000/svg"\'];e<1&&u.push(\'opacity="\'+e+\'"\'),t.markerPathWidth&&t.markerPathHeight&&u.push(\'viewBox="0 0 \'+t.markerPathWidth+" "+t.markerPathHeight+\'"\'),u.push(\'preserveAspectRatio="none"\'),n&&u.push(\'width="\'+n+\'"\'),i&&u.push(\'height="\'+i+\'"\'),u.push("><defs></defs>");for(let t=0;t<h.length;t++){let n="<path ";for(const i in h[t])Qi(h[t],i)&&(n+=" "+i+\'="\'+h[t][i]+\'"\');n+="></path>",u.push(n)}return u.push("</svg>"),"data:image/svg+xml;base64,"+btoa(u.join(" "))}(k,T[0],T[1]):null;A.icon={url:t,size:T}}if(I){const t=w?w(null,P):k.textName;if(t||0===t){const n=function(t,n,i){return[n||"normal",i||"normal","24px",t||"monospace"].join(" ")}(M?M(null,P):k.textFaceName,b?b(null,P):k.textStyle,x?x(null,P):k.textWeight);let i=ve(t,P);i&&i.length&&(i=tr(i),A.glyph={font:n,text:i})}}return this.iconGlyph=A,A}}function er(t,n){n&&"middle"!==n||(n="center"),t&&"middle"!==t||(t="center");let i="center"!==n?n:"";return i+="center"!==t?(i.length?"-":"")+t:"",i\n/*!\n * From mapbox-gl-js\n * MIT License\n * https://github.com/mapbox/mapbox-gl-js\n */}function rr(t,n,i,e,r){const s=[];for(let o=0;o<t.length;o++){const a=t[o];let h;for(let t=0;t<a.length-1;t++){let o=a[t],u=a[t+1];o.x<n&&u.x<n||(o.x<n?o=new Ht(n,o.y+(n-o.x)/(u.x-o.x)*(u.y-o.y)).I():u.x<n&&(u=new Ht(n,o.y+(n-o.x)/(u.x-o.x)*(u.y-o.y)).I()),o.y<i&&u.y<i||(o.y<i?o=new Ht(o.x+(i-o.y)/(u.y-o.y)*(u.x-o.x),i).I():u.y<i&&(u=new Ht(o.x+(i-o.y)/(u.y-o.y)*(u.x-o.x),i).I()),o.x>=e&&u.x>=e||(o.x>=e?o=new Ht(e,o.y+(e-o.x)/(u.x-o.x)*(u.y-o.y)).I():u.x>=e&&(u=new Ht(e,o.y+(e-o.x)/(u.x-o.x)*(u.y-o.y)).I()),o.y>=r&&u.y>=r||(o.y>=r?o=new Ht(o.x+(r-o.y)/(u.y-o.y)*(u.x-o.x),r).I():u.y>=r&&(u=new Ht(o.x+(r-o.y)/(u.y-o.y)*(u.x-o.x),r).I()),h&&o.equals(h[h.length-1])||(h=[o],s.push(h)),h.push(u)))))}}return s}class sr extends Ht{constructor(t,n,i,e){super(t,n),this.angle=i,void 0!==e&&(this.segment=e)}clone(){return new sr(this.x,this.y,this.angle,this.segment)}}\n/*!\n * From mapbox-gl-js\n * MIT License\n * https://github.com/mapbox/mapbox-gl-js\n */function or(t,n,i,e,r){if(void 0===n.segment)return!0;let s=n,o=n.segment+1,a=0;for(;a>-i/2;){if(o--,o<0)return!1;a-=t[o].dist(s),s=t[o]}a+=t[o].dist(t[o+1]),o++;const h=[];let u=0;for(;a<i/2;){const n=t[o],i=t[o+1];if(!i)return!1;let s=t[o-1].angleTo(n)-n.angleTo(i);for(s=Math.abs((s+3*Math.PI)%(2*Math.PI)-Math.PI),h.push({distance:a,angleDelta:s}),u+=s;a-h[0].distance>e;)u-=h.shift().angleDelta;if(u>r)return!1;o++,a+=n.dist(i)}return!0}function ar(t,n,i,e,r,s,o,a,h){const u=function(t,n,i){return t?.6*n*i:0}(e,s,o),l=function(t,n){return Math.max(t?t.right-t.left:0,n?n.right-n.left:0)}(e,r),c=0===t[0].x||t[0].x===h||0===t[0].y||t[0].y===h;return n-l*o<n/4&&(n=l*o+n/4),function t(n,i,e,r,s,o,a,h,u){const l=o/2,c=function(t){let n=0;for(let i=0;i<t.length-1;i++)n+=t[i].dist(t[i+1]);return n}(n);let f=0,d=i-e,y=[];for(let t=0;t<n.length-1;t++){const i=n[t],a=n[t+1],h=i.dist(a),v=a.angleTo(i);for(;d+e<f+h;){d+=e;const p=(d-f)/h,m=hr(i.x,a.x,p),g=hr(i.y,a.y,p);if(m>=0&&m<u&&g>=0&&g<u&&d-l>=0&&d+l<=c){const i=new sr(m,g,v,t);i.line=n,i.I(),r&&!or(n,i,o,r,s)||y.push(i)}}f+=h}return h||y.length||a||(y=t(n,f/2,e,r,s,o,a,!0,u)),y}(t,c?n/2*a%n:(l/2+2*s)*o*a%n,n,u,i,l*o,c,!1,h)}function hr(t,n,i){return t*(1-i)+n*i}function ur(t,n){const i=t.length;if(i<=1)return[t];const e=[];let r,s;for(let n=0;n<i;n++){const i=ne(t[n]);0!==i&&(t[n].area=Math.abs(i),void 0===s&&(s=i<0),s===i<0?(r&&e.push(r),r=[t[n]]):r.push(t[n]))}if(r&&e.push(r),n>1)for(let t=0;t<e.length;t++)e[t].length<=n||(Bt(e[t],n,1,e[t].length-1,lr),e[t]=e[t].slice(0,n));return e}function lr(t,n){return n.area-t.area}function cr(t,n,i){const e=n.distSqr(i);if(0===e)return t.distSqr(n);const r=((t.x-n.x)*(i.x-n.x)+(t.y-n.y)*(i.y-n.y))/e;return t.distSqr(r<0?n:r>1?i:i.sub(n).F(r).u(n))}function fr(t,n=1,i=!1){let e=1/0,r=1/0,s=-1/0,o=-1/0;const a=t[0];for(let t=0;t<a.length;t++){const n=a[t];(!t||n.x<e)&&(e=n.x),(!t||n.y<r)&&(r=n.y),(!t||n.x>s)&&(s=n.x),(!t||n.y>o)&&(o=n.y)}const h=Math.min(s-e,o-r);let u=h/2;const l=new Zt(null,dr);if(0===h)return new Ht(e,r);for(let n=e;n<s;n+=h)for(let i=r;i<o;i+=h)l.push(new yr(n+u,i+u,u,t));let c=function(t){let n=0,i=0,e=0;const r=t[0];for(let t=0,s=r.length,o=s-1;t<s;o=t++){const s=r[t],a=r[o],h=s.x*a.y-a.x*s.y;i+=(s.x+a.x)*h,e+=(s.y+a.y)*h,n+=3*h}return new yr(i/n,e/n,0,t)}(t),f=l.length;for(;l.length;){const e=l.pop();(e.d>c.d||!c.d)&&(c=e,i&&console.log("found best %d after %d probes",Math.round(1e4*e.d)/1e4,f)),e.max-c.d<=n||(u=e.h/2,l.push(new yr(e.p.x-u,e.p.y-u,u,t)),l.push(new yr(e.p.x+u,e.p.y-u,u,t)),l.push(new yr(e.p.x-u,e.p.y+u,u,t)),l.push(new yr(e.p.x+u,e.p.y+u,u,t)),f+=4)}return i&&(console.log("num probes: "+f),console.log("best distance: "+c.d)),c.p}function dr(t,n){return n.max-t.max}function yr(t,n,i,e){this.p=new Ht(t,n),this.h=i,this.d=function(t,n){let i=!1,e=1/0;for(let r=0;r<n.length;r++){const s=n[r];for(let n=0,r=s.length,o=r-1;n<r;o=n++){const r=s[n],a=s[o];r.y>t.y!=a.y>t.y&&t.x<(a.x-r.x)*(t.y-r.y)/(a.y-r.y)+r.x&&(i=!i),e=Math.min(e,cr(t,r,a))}}return(i?1:-1)*Math.sqrt(e)}(this.p,e),this.max=this.d+this.h*Math.SQRT2}const vr=45*Math.PI/100;function pr(t,n){const i={},e={},r=[];let s=0;function o(n){r.push(t[n]),s++}function a(t,n,i){const s=e[t];return delete e[t],e[n]=s,r[s].geometry[0].pop(),r[s].geometry[0]=r[s].geometry[0].concat(i[0]),s}function h(t,n,e){const s=i[n];return delete i[n],i[t]=s,r[s].geometry[0].shift(),r[s].geometry[0]=e[0].concat(r[s].geometry[0]),s}function u(t,n,i){const e=i?n[0][n[0].length-1]:n[0][0];return`${t}:${e.x}:${e.y}`}for(let l=0;l<t.length;l++){const c=t[l],f=c.geometry;if(!f)continue;const d=c.properties[n]?c.properties[n].toString():null;if(!d){o(l);continue}const y=u(d,f),v=u(d,f,!0);if(y in e&&v in i&&e[y]!==i[v]){const t=h(y,v,f),n=a(y,v,r[t].geometry);delete i[y],delete e[v],e[u(d,r[n].geometry,!0)]=n,r[t].geometry=null}else y in e?a(y,v,f):v in i?h(y,v,f):(o(l),i[y]=s-1,e[v]=s-1)}return r.filter(t=>t.geometry)}class mr extends le{static needMerge(t){return t.mergeOnProperty&&("line"===t.textPlacement||"line"===t.markerPlacement)}static mergeLineFeatures(t,n,i){const e="__index".trim(),r=function(t,n,i){const e="__index".trim(),r=le.genFnTypes(n),{mergeOnPropertyFn:s}=r;if(!n.mergeOnProperty||"line"!==n.textPlacement&&"line"!==n.markerPlacement)return[];if(!(oe(o=n.mergeOnProperty)||"string"!=typeof o&&(null===o.constructor||o.constructor!==String)||"line"!==n.textPlacement&&"line"!==n.markerPlacement))return[{features:t,property:n.mergeOnProperty}];var o;const a=[],h={},u=[];for(let r=0;r<t.length;r++){t[r][e]=r;const o=t[r].properties=t[r].properties||{};o.$layer=t[r].layer,o.$type=t[r].type;let l=n.markerPlacement;"line"!==l&&(l=n.textPlacement);const c=s?s(i,o):n.mergeOnProperty;"line"!==l||oe(c)?u.push(t[r]):(void 0===h[c]&&(h[c]=a.length,a.push({features:[],property:c})),a[h[c]].features.push(t[r]))}return u.length&&a.push({features:u}),a}(t,n,i);if(r.length){const n=[];for(let i=0;i<r.length;i++)n.push(r[i].property?pr(r[i].features,r[i].property):t);if(1===n.length)return n[0];{let t=[];for(let i=0;i<n.length;i++)t=t.concat(n[i]);return t.sort((t,n)=>t[e]-n[e]),t}}}static splitPointSymbol(t,n=0){const i=[];if(Array.isArray(t)){const n=t;for(let t=0;t<n.length;t++)n[t]&&i.push(...mr.splitPointSymbol(n[t],t));return i}let e=null,r=null;for(const n in t)0===n.indexOf("marker")?(e=e||{},e[n]=t[n]):0===n.indexOf("text")&&(r=r||{},r[n]=t[n]);return e&&(e.isIconText=!0,t.mergeOnProperty&&(e.mergeOnProperty=t.mergeOnProperty),i.push(e)),r&&(e&&(r.textPlacement=e.markerPlacement,r.textSpacing=e.markerSpacing,r.isIconText=!0),t.mergeOnProperty&&(r.mergeOnProperty=t.mergeOnProperty),i.push(r)),void 0!==t.visible&&(e&&(e.visible=t.visible),r&&(r.visible=t.visible)),e&&(e.markerTextFit&&r&&(e.text={},e.text.textName=r.textName,e.text.textSize=r.textSize),e.index={index:n,type:0}),r&&(r.index={index:n,type:1}),i}static isAtlasLoaded(t,n){const{icon:i,glyph:e}=t,{iconAtlas:r,glyphAtlas:s}=n;if(i&&(!r||!r.positions[i.url]))return!1;if(e){if(!s||!s.positions[e.font])return!1;const t=s.positions[e.font],{text:n}=e;for(let i=0;i<n.length;i++)if(!t[n.charCodeAt(i)])return!1}return!0}constructor(t,n,i){super(t,n,i)}createStyledVector(t,n,i,e,r,s){const o=new ir(t,this.symbolDef,n,i,e),a=o.getIconAndGlyph();if(a.icon&&!this.options.atlas){const{url:t,size:n}=a.icon;r[t]||(r[t]=a.icon.size),r[t][0]<n[0]&&(r[t][0]=n[0]),r[t][1]<n[1]&&(r[t][1]=n[1])}if(a.glyph&&!this.options.atlas){const{font:t,text:i}=a.glyph,e=s[t]=s[t]||{};for(let t=0;t<i.length;t++)e[i.charCodeAt(t)]=1;"line"===n.textPlacement&&(s.options={isCharsCompact:!1})}return this.options.allowEmptyPack||a.icon||a.glyph?o:null}getFormat(t){const n=void 0!==t.textName,i=n?function(t){return"line"!==t.textPlacement||t.isIconText?[{type:Int16Array,width:3,name:"aPosition"},{type:Int16Array,width:2,name:"aShape"},{type:Uint16Array,width:2,name:"aTexCoord"},{type:Uint8Array,width:1,name:"aCount"}]:[{type:Int16Array,width:3,name:"aPosition"},{type:Int16Array,width:2,name:"aShape"},{type:Uint16Array,width:2,name:"aTexCoord"},{type:Uint8Array,width:1,name:"aCount"},{type:Int16Array,width:2,name:"aGlyphOffset"},{type:Uint16Array,width:3,name:"aSegment"},{type:Uint8Array,width:1,name:"aVertical"}]}(t):[{type:Int16Array,width:3,name:"aPosition"},{type:Int16Array,width:2,name:"aShape"},{type:Uint16Array,width:2,name:"aTexCoord"}];n?i.push(...this.q()):i.push(...this.B());const{markerOpacityFn:e,textOpacityFn:r,markerPitchAlignmentFn:s,textPitchAlignmentFn:o,markerRotationAlignmentFn:a,textRotationAlignmentFn:h,markerRotationFn:u,textRotationFn:l,markerAllowOverlapFn:c,textAllowOverlapFn:f,markerIgnorePlacementFn:d,textIgnorePlacementFn:y}=this.C;return(e||r)&&i.push({type:Uint8Array,width:1,name:"aColorOpacity"}),(s||o)&&i.push({type:Uint8Array,width:1,name:"aPitchAlign"}),(a||h)&&i.push({type:Uint8Array,width:1,name:"aRotationAlign"}),(u||l)&&i.push({type:Uint16Array,width:1,name:"aRotation"}),(c||f||d||y)&&i.push({type:Uint8Array,width:1,name:"aOverlap"}),i}q(){const{textFillFn:t,textSizeFn:n,textHaloFillFn:i,textHaloRadiusFn:e,textHaloOpacityFn:r,textDxFn:s,textDyFn:o}=this.C,a=[];return t&&a.push({type:Uint8Array,width:4,name:"aTextFill"}),n&&a.push({type:Uint8Array,width:1,name:"aTextSize"}),i&&a.push({type:Uint8Array,width:4,name:"aTextHaloFill"}),e&&a.push({type:Uint8Array,width:1,name:"aTextHaloRadius"}),r&&a.push({type:Uint8Array,width:1,name:"aTextHaloOpacity"}),s&&a.push({type:Int8Array,width:1,name:"aTextDx"}),o&&a.push({type:Int8Array,width:1,name:"aTextDy"}),a}B(){const{markerWidthFn:t,markerHeightFn:n,markerDxFn:i,markerDyFn:e}=this.C,r=[];return t&&r.push({type:Uint8Array,width:1,name:"aMarkerWidth"}),n&&r.push({type:Uint8Array,width:1,name:"aMarkerHeight"}),i&&r.push({type:Int8Array,width:1,name:"aMarkerDx"}),e&&r.push({type:Int8Array,width:1,name:"aMarkerDy"}),r}createDataPack(){if(!this.iconAtlas&&!this.glyphAtlas){if(!this.options.allowEmptyPack)return null;this.empty=!0}this.lineVertex=[];const t=super.createDataPack.apply(this,arguments);return t?(t.lineVertex=new Int16Array(this.lineVertex),t.buffers.push(t.lineVertex.buffer),t):null}placeVector(t,n){const i=t.getShape(this.iconAtlas,this.glyphAtlas);if(!this.options.allowEmptyPack&&!i)return;const e=this.G(t,i,n);if(0===e.length)return;const r=this.data;let s=this.data.aPosition.length/3;const o=t.symbol,a=t.feature.properties,h="line"===o.textPlacement&&!o.isIconText,u=void 0!==o.textName,l=u&&h&&function(t){let n=0;for(let i=0;i<t.length;i++)if(He(t.charAt(i).charCodeAt(0)))n=0;else if(n++,n>=1)return!1;return!0}(t.getIconAndGlyph().glyph.text)?1:0,{textFillFn:c,textSizeFn:f,textHaloFillFn:d,textHaloRadiusFn:y,textHaloOpacityFn:v,textDxFn:p,textDyFn:g,textPitchAlignmentFn:w,textRotationAlignmentFn:M,textRotationFn:b,textAllowOverlapFn:x,textIgnorePlacementFn:F,textOpacityFn:A,markerWidthFn:k,markerHeightFn:P,markerDxFn:S,markerDyFn:_,markerPitchAlignmentFn:O,markerRotationAlignmentFn:I,markerRotationFn:T,markerAllowOverlapFn:L,markerIgnorePlacementFn:U,markerOpacityFn:z}=this.C;let D,E,C,j,N,H,V,R,$,W,q,B,G,J,X,Z,Y;if(u){const n=t.getIconAndGlyph().glyph.font;D=function(t,n,i){const e=t.positionedGlyphs,r=[];for(let s=0;s<e.length;s++){const o=e[s],a=i[o.glyph];if(!a)continue;const h=a.rect;if(!h)continue;const u=4,l=a.metrics.advance/2,c=a.metrics.height/2,f=n?[o.x+l,0]:[0,0],d=n?[0,o.y-c]:[o.x+l,o.y-c],y=a.metrics.left-u-l+d[0],v=a.metrics.top-u+d[1],p=y+h.w,m=v+h.h,g=new Ht(y,v),w=new Ht(p,v),M=new Ht(y,m),b=new Ht(p,m);if(n&&o.vertical){const t=new Ht(-l,l),n=-Math.PI/2,i=new Ht(5,0);g.P(n,t).u(i),w.P(n,t).u(i),M.P(n,t).u(i),b.P(n,t).u(i)}r.push({tl:g,tr:w,bl:M,br:b,tex:h,writingMode:t.writingMode,glyphOffset:f})}return r}(i.horizontal,h,this.glyphAtlas.positions[n]),c&&(E=c(null,a),m(E)?E=[0,0,0,0]:(E=Array.isArray(E)?E.map(t=>255*t):Vn(E).array(),3===E.length&&E.push(255))),f&&(C=f(this.options.zoom,a),oe(C)&&(C=14)),d&&(j=d(null,a),j=Array.isArray(j)?j.map(t=>255*t):Vn(j).array(),3===j.length&&j.push(255)),y&&(N=y(null,a)),v&&(H=255*v(null,a)),p&&(V=p(null,a)||0),g&&(R=g(null,a)||0),w&&(G=+("map"===w(null,a))),M&&(J=+("map"===M(null,a))),b&&(X=ae(b(null,a),0,360)*Math.PI/180)}else D=i?function(t){const n=t.image,i=t.top-1/n.pixelRatio,e=t.left-1/n.pixelRatio,r=t.bottom+1/n.pixelRatio,s=t.right+1/n.pixelRatio;let o,a,h,u;return o=new Ht(e,i),a=new Ht(s,i),h=new Ht(s,r),u=new Ht(e,r),[{tl:o,tr:a,bl:u,br:h,tex:{x:n.tl[0],y:n.tl[1],w:n.displaySize[0],h:n.displaySize[1]},writingMode:void 0,glyphOffset:[0,0]}]}(i):function(){const t=new Ht(0,0),n=new Ht(0,0),i=new Ht(0,0);return[{tl:t,tr:n,bl:new Ht(0,0),br:i,tex:{x:0,y:0,w:0,h:0},writingMode:void 0,glyphOffset:[0,0]}]}(),k&&($=k(null,a)),P&&(W=P(null,a)),S&&(q=S(null,a)),_&&(B=_(null,a)),O&&(G=+("map"===O(null,a))),I&&(J=+("map"===I(null,a))),T&&(X=ae(T(null,a),0,360)*Math.PI/180);const K=L||x;K&&(Z=K(null,a)||0);const Q=U||F;let tt;Q&&(Y=Q(null,a)||0);const nt=A||z;nt&&(tt=255*nt(this.options.zoom,a));const it=this.options.EXTENT,et=D.length,rt=this.getAltitude(t.feature.properties);for(let t=0;t<e.length;t++){const n=e[t];if(it!==1/0&&se(n,it))continue;const i=n.x,o=n.y,a=D.length;for(let t=0;t<a;t++){const e=D[t],{tl:a,tr:c,bl:f,br:d,tex:y}=e;this.J(r,i,o,rt,10*a.x,10*a.y,y.x,y.y+y.h),u&&this.X(r,h,et,e.glyphOffset,n,l),this.Z(r,E,C,j,N,H,V,R,$,W,q,B,tt,G,J,X,Z,Y),this.J(r,i,o,rt,10*c.x,10*c.y,y.x+y.w,y.y+y.h),u&&this.X(r,h,et,e.glyphOffset,n,l),this.Z(r,E,C,j,N,H,V,R,$,W,q,B,tt,G,J,X,Z,Y),this.J(r,i,o,rt,10*f.x,10*f.y,y.x,y.y),u&&this.X(r,h,et,e.glyphOffset,n,l),this.Z(r,E,C,j,N,H,V,R,$,W,q,B,tt,G,J,X,Z,Y),this.J(r,i,o,rt,10*d.x,10*d.y,y.x+y.w,y.y),u&&this.X(r,h,et,e.glyphOffset,n,l),this.Z(r,E,C,j,N,H,V,R,$,W,q,B,tt,G,J,X,Z,Y),this.addElements(s,s+1,s+2),this.addElements(s+1,s+2,s+3),s+=4;const v=Math.max(Math.abs(i),Math.abs(o),Math.abs(rt));v>this.maxPos&&(this.maxPos=v)}}}J(t,n,i,e,r,s,o,a){t.aPosition.push(n,i,e),t.aShape.push(r,s),t.aTexCoord.push(o,a)}X(t,n,i,e,r,s){if(t.aCount.push(i),n){t.aGlyphOffset.push(e[0],e[1]);const n=r.startIndex;t.aSegment.push(r.segment+n,n,r.line.length),t.aVertical.push(s)}}Z(t,n,i,e,r,s,o,a,h,u,l,c,f,d,y,v,p,m){const{textFillFn:g,textSizeFn:w,textHaloFillFn:M,textHaloRadiusFn:b,textHaloOpacityFn:x,textDxFn:F,textDyFn:A,textPitchAlignmentFn:k,textRotationAlignmentFn:P,textRotationFn:S,textAllowOverlapFn:_,textIgnorePlacementFn:O,textOpacityFn:I,markerWidthFn:T,markerHeightFn:L,markerDxFn:U,markerDyFn:z,markerPitchAlignmentFn:D,markerRotationAlignmentFn:E,markerRotationFn:C,markerAllowOverlapFn:j,markerIgnorePlacementFn:N,markerOpacityFn:H}=this.C;g&&t.aTextFill.push(...n),w&&t.aTextSize.push(i),M&&t.aTextHaloFill.push(...e),b&&t.aTextHaloRadius.push(r),x&&t.aTextHaloOpacity.push(s),F&&t.aTextDx.push(o),A&&t.aTextDy.push(a),T&&t.aMarkerWidth.push(h),L&&t.aMarkerHeight.push(u),U&&t.aMarkerDx.push(l),z&&t.aMarkerDy.push(c),(H||I)&&t.aColorOpacity.push(f),(k||D)&&t.aPitchAlign.push(d),(E||P)&&t.aRotationAlign.push(y),(C||S)&&t.aRotation.push(9362*v);const V=j||_,R=N||O;(V||R)&&t.aOverlap.push((V?8:0)+4*p+((R?2:0)+m)),r>0&&(this.properties.hasHalo=1)}G(t,n,i){const{feature:e,symbol:r}=t,s=this.Y(t,r),o=e.properties,{markerSpacingFn:a,textSpacingFn:h}=this.C,u=((a?a(null,o):r.markerSpacing)||(h?h(null,o):r.textSpacing)||250)*i;return function(t,n,i,e,r,s,o){const{feature:a,size:h,symbol:u}=t,l=h?24:0,c=e*(h?h[0]/l:1),f=[];if("line"===s){let t=a.geometry;r&&(t=rr(a.geometry,0,0,r,r));for(let e=0;e<t.length;e++){const s=ar(t[e],o,vr,u.isIconText?null:i.vertical||i.horizontal||i,null,l,u.isIconText?1:c,1,r||1/0);if(u.textPlacement&&!u.isIconText)for(let t=0;t<s.length;t++)s[t].startIndex=n.length/3;if(f.push.apply(f,s),u.textPlacement&&!u.isIconText)for(let i=0;i<t[e].length;i++)n.push(t[e][i].x,t[e][i].y,0)}}else if(3===a.type){const t=ur(a.geometry,0);for(let n=0;n<t.length;n++){const i=t[n];if("vertex"===s)for(let t=0;t<i.length;t++){const n=i[t];for(let t=0;t<n.length;t++)se(n[t],r)||f.push(n[t])}else{const t=fr(i,16);se(t,r)||f.push(t)}}}else if(2===a.type)for(let t=0;t<a.geometry.length;t++){const n=a.geometry[t];if("vertex"===s)for(let t=0;t<n.length;t++)se(n[t],r)||f.push(n[t]);else se(n[0],r)||f.push(n[0])}else if(1===a.type)for(let t=0;t<a.geometry.length;t++){const n=a.geometry[t];for(let t=0;t<n.length;t++){const i=n[t];se(i,r)||f.push(i)}}return f}(t,this.lineVertex,n,i,this.options.EXTENT,s,u)}Y(t,n){return this.C.markerPlacementFn?this.C.markerPlacementFn(this.options.zoom,t.feature.properties):n.markerPlacement||n.textPlacement}}const gr=Math.cos(Math.PI/180*37.5),wr=Math.pow(2,16)/1;class Mr extends le{constructor(t,n,i){super(t,n,i);let e=!1;const{lineDasharrayFn:r,lineDashColorFn:s}=this.C;r&&(e=function(t,n,i){for(let e=0;e<t.length;e++)if(i(n,t[e].properties))return!0;return!1}(t,this.options.zoom,r),e&&(this.dasharrayFn=r)),(Fr(this.symbol.lineDasharray)||e)&&s&&(this.dashColorFn=s)}createStyledVector(t,n,i,e,r){const s=new he(t,n,i,e),o=s.getLineResource();return!this.options.atlas&&o&&(r[o]=[0,0]),s}getFormat(){const{lineWidthFn:t,lineStrokeWidthFn:n,lineStrokeColorFn:i,lineColorFn:e,lineOpacityFn:r,lineDxFn:s,lineDyFn:o,linePatternAnimSpeedFn:a,linePatternGapFn:h}=this.C,u=[{type:Int16Array,width:3,name:"aPosition"}];if(u.push(this.options.center||this.iconAtlas?{type:Int8Array,width:3,name:"aExtrude"}:{type:Int8Array,width:2,name:"aExtrude"}),u.push({type:Uint16Array,width:1,name:"aLinesofar"}),t&&u.push({type:Uint8Array,width:1,name:"aLineWidth"}),n&&u.push({type:Uint8Array,width:1,name:"aLineStrokeWidth"}),e&&u.push({type:Uint8Array,width:4,name:"aColor"}),i&&u.push({type:Uint8Array,width:4,name:"aStrokeColor"}),r&&u.push({type:Uint8Array,width:1,name:"aOpacity"}),this.symbol.lineOffset&&u.push({type:Int8Array,width:2,name:"aExtrudeOffset"}),this.dasharrayFn&&u.push({type:Uint8Array,width:4,name:"aDasharray"}),this.dashColorFn&&u.push({type:Uint8Array,width:4,name:"aDashColor"}),this.iconAtlas){const t=this.getIconAtlasMaxValue();u.push({type:t>255?Uint16Array:Uint8Array,width:4,name:"aTexInfo"})}return s&&u.push({type:Int8Array,width:1,name:"aLineDx"}),o&&u.push({type:Int8Array,width:1,name:"aLineDy"}),a&&u.push({type:Int8Array,width:1,name:"aLinePatternAnimSpeed"}),h&&u.push({type:Uint8Array,width:1,name:"aLinePatternGap"}),u}placeVector(t){const{lineJoinFn:n,lineCapFn:i,lineWidthFn:e,lineStrokeWidthFn:r,lineStrokeColorFn:s,lineColorFn:o,lineOpacityFn:a,lineJoinPatternModeFn:h,lineDxFn:u,lineDyFn:l,linePatternAnimSpeedFn:c,linePatternGapFn:f}=this.C,d=this.symbol,y=t.feature,v=3===y.type,p=y.properties,g=this.elements;v&&(this.elements=[]);let w=d.lineJoin||"miter",M=d.lineCap||"butt";if(n&&(w=n(this.options.zoom,p)||"miter"),i&&(M=i(this.options.zoom,p)||"butt"),e){let t=e(this.options.zoom,p);Ji(t)&&(t=4),this.feaLineWidth=t}else this.feaLineWidth=d.lineWidth;if(r){let t=r(this.options.zoom,p);Ji(t)&&(t=0),this.feaLineStrokeWidth=t}else this.feaLineStrokeWidth=d.lineStrokeWidth||0;if(o&&(this.feaColor=o(this.options.zoom,p)||[0,0,0,255],m(this.feaColor)?this.feaColor=[0,0,0,0]:(this.feaColor=Array.isArray(this.feaColor)?this.feaColor.map(t=>255*t):Vn(this.feaColor).array(),3===this.feaColor.length&&this.feaColor.push(255))),s&&(this.feaStrokeColor=s(this.options.zoom,p)||[0,0,0,255],m(this.feaStrokeColor)?this.feaStrokeColor=[0,0,0,0]:(this.feaStrokeColor=Array.isArray(this.feaStrokeColor)?this.feaStrokeColor.map(t=>255*t):Vn(this.feaStrokeColor).array(),3===this.feaStrokeColor.length&&this.feaStrokeColor.push(255))),a){let t=a(this.options.zoom,p);Ji(t)&&(t=1),this.feaOpacity=255*t}if(this.dasharrayFn){let t=this.dasharrayFn(this.options.zoom,p)||[0,0,0,0];if(t.length<4){const n=t;1===t.length?t=[n[0],n[0],n[0],n[0]]:2===t.length?t=[n[0],n[1],n[0],n[1]]:3===t.length&&(t=[n[0],n[1],n[2],n[2]])}this.feaDash=t}if(this.dashColorFn){let t=(this.dashColorFn?this.dashColorFn(this.options.zoom,p):this.symbol.lineDashColor)||[0,0,0,0];t=Array.isArray(t)?t.map(t=>255*t):Vn(t).array(),3===t.length&&t.push(255),this.feaDashColor=t}if(this.iconAtlas){const n=t.getLineResource(),i=this.iconAtlas.glyphMap[n];if(this.feaTexInfo=this.feaTexInfo||[0,0,0,0],i){const{tl:t,displaySize:i}=this.iconAtlas.positions[n];this.feaTexInfo[0]=t[0]+1,this.feaTexInfo[1]=t[1]+1,this.feaTexInfo[2]=i[0]-3,this.feaTexInfo[3]=i[1]-3}else this.feaTexInfo[0]=this.feaTexInfo[1]=this.feaTexInfo[2]=this.feaTexInfo[3]=0;this.feaJoinPatternMode=h?h(this.options.zoom,p)||0:d.lineJoinPatternMode||0}if(u){let t=u(this.options.zoom,p);Ji(t)&&(t=0),this.feaLineDx=t}if(l){let t=l(this.options.zoom,p);Ji(t)&&(t=0),this.feaLineDy=t}if(c){let t=c(this.options.zoom,p);Ji(t)&&(t=0),0!==t&&(this.properties.hasPatternAnim=1),this.feaPatternAnimSpeed=t}if(f){let t=f(this.options.zoom,p);Ji(t)&&(t=0),this.feaLinePatternGap=t}const b=this.options.EXTENT;let x=y.geometry;b!==1/0&&3!==y.type&&(x=rr(y.geometry,-1,-1,b+1,b+1));for(let t=0;t<x.length;t++)this.offset=this.data.aPosition.length/3,this.K(x[t],y,w,M,2,1.05),v&&(this.tt(g),this.elements=[]);v&&(this.elements=g)}nt(){return this.iconAtlas&&this.feaTexInfo[2]&&this.feaTexInfo[3]}K(t,n,i,e,r,s){const o=this.nt()||Fr(this.feaDash)||Fr(this.symbol.lineDasharray);this.overscaling=1;const a=this.options.EXTENT;if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.symbol.lineGradientProperty&&n.properties&&Qi(n.properties,"mapbox_clip_start")&&Qi(n.properties,"mapbox_clip_end")){this.clipStart=+n.properties.mapbox_clip_start,this.clipEnd=+n.properties.mapbox_clip_end;for(let n=0;n<t.length-1;n++)this.totalDistance+=t[n].dist(t[n+1]);this.updateScaledDistance()}const h=3===n.type;let u=t.length;for(;u>=2&&t[u-1].equals(t[u-2]);)u--;let l=0;for(;l<u-1&&t[l].equals(t[l+1]);)l++;if(u<(h?3:2))return;"bevel"===i&&(r=1.05);const c=this.overscaling<=16?15*a/(512*this.overscaling):0,f={vertexLength:0,primitiveLength:0};let d,y,v,p,m;this.e1=this.e2=-1,h&&(d=t[u-2],m=t[l].sub(d)._().O());for(let n=l;n<u;n++){if(v=n===u-1?h?t[l+1]:void 0:t[n+1],v&&t[n].equals(v))continue;m&&(p=m),d&&(y=d),d=t[n],m=v?v.sub(d)._().O():p,p=p||m;let a=p.add(m);0===a.x&&0===a.y||a._();const g=p.x*m.x+p.y*m.y,w=a.x*m.x+a.y*m.y,M=0!==w?1/w:1/0,b=2*Math.sqrt(2-2*w),x=w<gr&&y&&v,F=p.x*m.y-p.y*m.x>0;if(!o&&x&&n>l){const t=d.dist(y);if(t>2*c){const n=d.sub(d.sub(y).F(c/t).I());this.updateDistance(y,n),this.addCurrentVertex(n,p,0,0,f),y=n}}const A=y&&v;let k=A?i:h?"butt":e;if(A&&"round"===k&&(M<s?k="miter":M<=2&&(k="fakeround")),"miter"===k&&M>r&&(k="bevel"),"bevel"===k&&(M>2&&(k="flipbevel"),M<r&&(k="miter")),y&&this.updateDistance(y,d),(n>l&&n<u-1||h&&n===u-1)&&o){const t=this.feaJoinPatternMode?0:-p.mag()*w;this.addCurrentVertex(d,p,t,t,f),this.it=1}if("miter"===k)a.F(M),this.addCurrentVertex(d,a,0,0,f);else if("flipbevel"===k){if(M>100)a=m.mult(-1);else{const t=M*p.add(m).mag()/p.sub(m).mag();a.O().F(t*(F?-1:1))}this.addCurrentVertex(d,a,0,0,f),this.addCurrentVertex(d,a.mult(-1),0,0,f)}else if("bevel"===k||"fakeround"===k){const t=-Math.sqrt(M*M-1),n=F?t:0,i=F?0:t;if(y&&this.addCurrentVertex(d,p,n,i,f),"fakeround"===k){const t=Math.round(180*b/Math.PI/20);for(let n=1;n<t;n++){let i=n/t;if(.5!==i){const t=i-.5;i+=i*t*(i-1)*((1.0904+g*(g*(3.55645-1.43519*g)-3.2452))*t*t+(.848013+g*(.215638*g-1.06021)))}const e=m.sub(p).F(i).u(p)._().F(F?-1:1);this.addHalfVertex(d,e.x,e.y,!1,F,0,f)}}v&&this.addCurrentVertex(d,m,-n,-i,f)}else if("butt"===k)this.addCurrentVertex(d,a,0,0,f);else if("square"===k){const t=y?1:-1;this.addCurrentVertex(d,a,t,t,f)}else"round"===k&&(y&&(this.addCurrentVertex(d,p,0,0,f),this.addCurrentVertex(d,p,1,1,f,!0)),v&&(this.addCurrentVertex(d,m,-1,-1,f,!0),this.addCurrentVertex(d,m,0,0,f)));if(!o&&x&&n<u-1){const t=d.dist(v);if(t>2*c){const n=d.add(v.sub(d).F(c/t).I());this.updateDistance(d,n),this.addCurrentVertex(n,m,0,0,f),d=n}}if((n>l&&n<u-1||h&&n===l)&&o){delete this.it;const t=this.feaJoinPatternMode?0:m.mag()*w;this.addCurrentVertex(d,m,t,t,f)}}}addCurrentVertex(t,n,i,e,r,s=!1){const o=n.y*e-n.x,a=-n.y-n.x*e;this.addHalfVertex(t,n.x+n.y*i,n.y-n.x*i,s,!1,i,r),this.addHalfVertex(t,o,a,s,!0,-e,r),this.distance>wr/2&&0===this.totalDistance&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,n,i,e,r,s))}addHalfVertex({x:t,y:n},i,e,r,s,o,a){this.fillData(this.data,t,n,i,e,r,s,1*this.scaledDistance);const h=a.vertexLength++;this.e1>=0&&this.e2>=0&&(this.addElements(this.e1,this.e2,h),a.primitiveLength++),s?this.e2=h:this.e1=h}fillData(t,n,i,e,r,s,o,a){const{lineWidthFn:h,lineStrokeWidthFn:u,lineStrokeColorFn:l,lineColorFn:c,lineOpacityFn:f,lineDxFn:d,lineDyFn:y,linePatternAnimSpeedFn:v,linePatternGapFn:p}=this.C;if(this.options.center?t.aPosition.push(n,i,0):t.aPosition.push(n=(n<<1)+(s?1:0),i=(i<<1)+(o?1:0),0),t.aExtrude.push(63*e,63*r),this.options.center||this.iconAtlas){let n=0;this.options.center&&(n+=2*s+o),this.iconAtlas&&(n+=4*(this.it&&this.feaJoinPatternMode?1:0)),t.aExtrude.push(n)}t.aLinesofar.push(a),h&&t.aLineWidth.push(Math.round(2*this.feaLineWidth)),u&&t.aLineStrokeWidth.push(Math.round(2*this.feaLineStrokeWidth)),c&&t.aColor.push(...this.feaColor),l&&t.aStrokeColor.push(...this.feaStrokeColor),f&&t.aOpacity.push(this.feaOpacity),this.dasharrayFn&&t.aDasharray.push(...this.feaDash),this.dashColorFn&&t.aDashColor.push(...this.feaDashColor),this.iconAtlas&&t.aTexInfo.push(...this.feaTexInfo),d&&t.aLineDx.push(this.feaLineDx),y&&t.aLineDy.push(this.feaLineDy),v&&t.aLinePatternAnimSpeed.push(127*this.feaPatternAnimSpeed),p&&t.aLinePatternGap.push(10*this.feaLinePatternGap),this.maxPos=Math.max(this.maxPos,Math.abs(n)+1,Math.abs(i)+1)}addElements(t,n,i){super.addElements(this.offset+t,this.offset+n,this.offset+i)}tt(t){const n=this.options.EXTENT,i=this.elements;for(let e=0;e<i.length;e+=3)n!==1/0&&(xr(this.data.aPosition,i[e],i[e+1],3,n)||xr(this.data.aPosition,i[e+1],i[e+2],3,n))||t.push(i[e],i[e+1],i[e+2])}et(t){if(t.length<=1)return t;const n=[],i=this.options.EXTENT;let e,r=!0;for(e=0;e<t.length-1;e++){const s=br(t[e],t[e+1],i);s&&r||(n.push(t[e]),r=s)}return r||n.push(t[e]),n}updateDistance(t,n){this.distance+=t.dist(n),this.updateScaledDistance()}updateScaledDistance(){this.scaledDistance=this.totalDistance>0?(this.clipStart+(this.clipEnd-this.clipStart)*this.distance/this.totalDistance)*(wr-1):this.distance}}function br(t,n,i){return i!==1/0&&(t.x<0&&n.x<0||t.x>i&&n.x>i||t.y<0&&n.y<0||t.y>i&&n.y>i)}function xr(t,n,i,e,r){if(r===1/0)return!1;const s=Math.floor(.5*t[n*e]),o=Math.floor(.5*t[n*e+1]),a=Math.floor(.5*t[i*e]),h=Math.floor(.5*t[i*e+1]);return s===a&&(s<0||s>r)&&o!==h||o===h&&(o<0||o>r)&&s!==a}function Fr(t){if(!Array.isArray(t))return!1;for(let n=0;n<t.length;n++)if(t[n])return!0;return!1}class Ar extends Mr{constructor(t,n,i){super(t,n,i),this.rt=i.altitudeProperty}getFormat(){const{lineColorFn:t,lineWidthFn:n}=this.C,i=[{type:Int16Array,width:3,name:"aPosition"},{type:Uint16Array,width:1,name:"aLinesofar"},{type:Uint8Array,width:1,name:"aUp"},{type:Int16Array,width:3,name:"aExtrudedPosition"},{type:Int8Array,width:2,name:"aExtrude"}];return t&&i.push({type:Uint8Array,width:4,name:"aColor"}),n&&i.push({type:Uint8Array,width:1,name:"aLineWidth"}),this.rt&&i.push({type:Array,width:1,name:"aLineHeight"}),i}placeVector(t){const n=t.feature;if(this.rt){const{altitudeScale:t,altitudeProperty:i,defaultAltitude:e,heightProperty:r,defaultHeight:s,minHeightProperty:o}=this.options,{altitude:a,height:h}=re(n,t,i,e,r,s,o);this.feaAltitude=a,this.feaMinHeight=(a-h)/a*32767,a>this.maxAltitude&&(this.maxAltitude=a)}return super.placeVector(t)}K(t,n,i,e,r,s){const o=this.data.aPosition.length/3;super.K(t,n,i,e,r,s);const a=this.data.aPosition.length/3,h=this.data.aPosition.length/3-this.offset;if(3!==n.type&&h>0&&!1!==this.options.side){const t=!1!==this.options.top?1:0,n=t+4;let i=this.data.aPosition.length/3;for(const t in this.data){const n=this.data[t],e=n.length/i;for(let t=0;t<e;t++)n.push(n[o*e+3*e+t])}i=this.data.aPosition.length/3;for(const t in this.data){const e=this.data[t],r=e.length/i;for(let t=0;t<r;t++)e.push(e[o*r+r*n+t])}i=this.data.aPosition.length/3;for(const t in this.data){const e=this.data[t],r=e.length/i;for(let t=0;t<r;t++)e.push(e[o*r+r*(n+3)+t])}super.addElements(t+1,h+1,h),super.addElements(h,h+1,h+2);const e=this.data.aPosition.length/3-this.offset;i=this.data.aPosition.length/3;for(const t in this.data){const n=this.data[t],e=n.length/i;for(let t=0;t<e;t++)n.push(n[a*e-e+t])}i=this.data.aPosition.length/3;for(const t in this.data){const e=this.data[t],r=e.length/i;for(let t=0;t<r;t++)e.push(e[a*r-n*r-r+t])}i=this.data.aPosition.length/3;for(const t in this.data){const e=this.data[t],r=e.length/i;for(let t=0;t<r;t++)e.push(e[a*r-n*r-3*r+t])}super.addElements(e,h-3,e+1),super.addElements(h-3,e+2,e+1)}}fillData(t,n,i,e,r,s,o,a){const h=!1!==this.options.top,u=!1!==this.options.side,l=this.feaLineWidth||this.symbol.lineWidth/2*(this.options.EXTENT/this.options.tileSize),c=63*e,f=63*r,d=l*e+n,y=l*r+i;this.st(t,n,i,e,r,s,o,a,d,y,c,f),u&&(h&&this.st(t,n,i,e,r,s,o,a,d,y,c,f),this.st(t,n,i,e,r,s,o,a,d,y,c,f),this.ot(t,n,i,e,r,s,o,a,d,y,c,f),this.ot(t,n,i,e,r,s,o,a,d,y,c,f)),this.maxPos=Math.max(this.maxPos,Math.abs(n),Math.abs(i))}st(t,n,i,e,r,s,o,a,h,u,l,c){const{lineColorFn:f,lineWidthFn:d}=this.C;t.aPosition.push(n,i,32767),t.aLinesofar.push(a),t.aUp.push(+o),t.aExtrudedPosition.push(h,u,1),t.aExtrude.push(l,c),f&&t.aColor.push(...this.feaColor),d&&t.aLineWidth.push(Math.round(2*this.feaLineWidth)),this.rt&&t.aLineHeight.push(this.feaAltitude)}ot(t,n,i,e,r,s,o,a,h,u,l,c){const{lineColorFn:f,lineWidthFn:d}=this.C;t.aPosition.push(n,i,this.feaMinHeight||0),t.aLinesofar.push(a),t.aUp.push(+o),t.aExtrudedPosition.push(h,u,1),t.aExtrude.push(l,c),f&&t.aColor.push(...this.feaColor),d&&t.aLineWidth.push(Math.round(2*this.feaLineWidth)),this.rt&&t.aLineHeight.push(this.feaAltitude)}addElements(t,n,i){const e=!1!==this.options.top,r=!1!==this.options.side,s=(e?1:0)+(r?4:0);if(t*=s,n*=s,this.data.aUp[this.offset+(i*=s)+4]){if(e&&super.addElements(n,t,i),r){const t=e?1:0;super.addElements(n+t,i+t,i+t+2),super.addElements(n+t+1,i+t+1+2,n+t+1+2)}}else if(e&&super.addElements(t,i,n),r){const n=e?1:0;super.addElements(t+n,t+n+2,i+n),super.addElements(t+n+1+2,i+n+1+2,i+n+1)}}createDataPack(t,n){this.maxAltitude=0;const i=super.createDataPack(t,n);if(!i)return i;const{data:e,indices:r}=i;this.getFormat().reduce((t,n)=>(t[n.name]={size:n.width},t),{}).aPickingId={size:1};const{aExtrudedPosition:s,aPosition:o,aLinesofar:a,aUp:h,aExtrude:u,aColor:l,aLineHeight:c,aLineWidth:f}=e,d={},y=Xn(s,r);let v,p=!0;for(let t=0;t<y.length;t++)y[t]=-y[t],y[t]%1!=0&&(p=!1);if(!1!==this.options.top&&this.symbol.material&&function(t){for(const n in t)if(n.indexOf("Texture")>=0&&t[n])return!0;return!1}(this.symbol.material)&&(v=function(t,n,i){const e=[];for(let r=0;r<t.length;r+=3){const t=n[r/3];e.push(t/256,i[r/3]?1:0)}return e}(s,a,h)),d.aPosition=o,v&&(d.aTexCoord0=new Float32Array(v)),d.aNormal=p?new Int8Array(y):new Float32Array(y),d.aPickingId=e.aPickingId,d.aExtrude=u,l&&(d.aColor=l),f&&(d.aLineWidth=f),c){const t=Wi(this.maxAltitude);d.aLineHeight=new t(c)}const m=[];for(const t in d)m.push(d[t].buffer);return i.data=d,i.buffers=m,i}}const kr=Math.pow(2,16)/1;class Pr extends le{getFormat(){return[{type:Int16Array,width:3,name:"aPosition"}]}placeVector(t){const n=t.feature,i=3===n.type,e=n.geometry,r=this.elements;i&&(this.elements=[]);for(let t=0;t<e.length;t++)this.offset=this.data.aPosition.length/3,this.K(e[t],n),i&&(this.tt(r),this.elements=[]);i&&(this.elements=r)}K(t,n){const i=3===n.type;let e=t.length;for(;e>=2&&t[e-1].equals(t[e-2]);)e--;let r,s,o,a=0;for(;a<e-1&&t[a].equals(t[a+1]);)a++;if(!(e<(i?3:2))){this.distance=0,this.vertexLength=0,this.primitiveLength=0,this.e1=this.e2=this.e3=-1,i&&(r=t[e-2]);for(let n=a;n<e;n++)o=i&&n===e-1?t[a+1]:t[n+1],o&&t[n].equals(o)||(r&&(s=r),r=t[n],s&&(this.distance+=r.dist(s)),this.addCurrentVertex(r,this.distance))}}addCurrentVertex(t,n){const i=this.vertexLength++;this.addLineVertex(this.data,t,n),i>=1&&this.addElements(i-1,i),n>kr&&(this.distance=0,this.addCurrentVertex(t,this.distance))}addLineVertex(t,n){t.aPosition.push(n.x,n.y,0),this.maxPos=Math.max(this.maxPos,Math.abs(n.x),Math.abs(n.y))}addElements(t,n){super.addElements(this.offset+t,this.offset+n)}tt(t){const n=this.options.EXTENT,i=this.elements;for(let e=0;e<i.length;e+=2)ie(this.data.aPosition,i[e],i[e+1],3,n)||t.push(i[e],i[e+1])}}const Sr=45*Math.PI/100;class _r extends le{getFormat(){return[{type:Int16Array,width:3,name:"aPosition"}]}placeVector(t){const n=this.G(t,this.symbol.markerSpacing||250,this.symbol.markerPlacement||"point"),i=this.getAltitude(t.feature.properties);for(let t=0;t<n.length;t++){const e=n[t];this.data.aPosition.push(e.x,e.y),this.data.aPosition.push(i);const r=Math.max(Math.abs(e.x),Math.abs(e.y));r>this.maxPos&&(this.maxPos=r)}}G(t,n,i){const e=t.feature,r=t.feature.type,s=this.options.EXTENT,o=[];if("line"===i){let t=e.geometry;s&&(t=rr(e.geometry,0,0,s,s));for(let i=0;i<t.length;i++){const e=ar(t[i],n,Sr,null,null,24,1,1,s||1/0);o.push.apply(o,e)}}else if(3===r){const t=ur(e.geometry,0);for(let n=0;n<t.length;n++){const i=fr(t[n],16);se(i,s)||o.push(i)}}else if(2===e.type)for(let t=0;t<e.geometry.length;t++){const n=e.geometry[t];se(n[0],s)||o.push(n[0])}else if(1===e.type)for(let t=0;t<e.geometry.length;t++){const n=e.geometry[t];for(let t=0;t<n.length;t++){const i=n[t];se(i,s)||o.push(i)}}return o}hasElements(){return!1}}\n/*!\n * from @turf/bboxClip\n * https://github.com/Turfjs/turf\n * MIT LICENSE\n */const Or=[],Ir=[];function Tr(t,n){var i,e,r,s,o,a,h;for(e=1;e<=8;e*=2){for(i=[],s=!(Ur(r=t[t.length-1],n)&e),o=0;o<t.length;o++){if((h=!(Ur(a=t[o],n)&e))!==s){const t=Lr(r,a,e,n);i.push(void 0!==a.x?new Ht(t[0],t[1]):t)}h&&i.push(a),r=a,s=h}if(!(t=i).length)break}return i}function Lr(t,n,i,e){return Or[0]=void 0===t.x?t[0]:t.x,Or[1]=void 0===t.y?t[1]:t.y,t=Or,Ir[0]=void 0===n.x?n[0]:n.x,Ir[1]=void 0===n.y?n[1]:n.y,n=Ir,8&i?[t[0]+(n[0]-t[0])*(e[3]-t[1])/(n[1]-t[1]),e[3]]:4&i?[t[0]+(n[0]-t[0])*(e[1]-t[1])/(n[1]-t[1]),e[1]]:2&i?[e[2],t[1]+(n[1]-t[1])*(e[2]-t[0])/(n[0]-t[0])]:1&i?[e[0],t[1]+(n[1]-t[1])*(e[0]-t[0])/(n[0]-t[0])]:null}function Ur(t,n){Or[0]=void 0===t.x?t[0]:t.x,Or[1]=void 0===t.y?t[1]:t.y;var i=0;return(t=Or)[0]<n[0]?i|=1:t[0]>n[2]&&(i|=2),t[1]<n[1]?i|=4:t[1]>n[3]&&(i|=8),i}class zr extends le{constructor(...t){super(...t),this.lineElements=[]}createStyledVector(t,n,i,e,r){const s=new he(t,n,i,e),o=s.getPolygonResource();return!this.options.atlas&&o&&(r[o]=[0,0]),s}getFormat(){const t=[{type:Int16Array,width:3,name:"aPosition"}],{polygonFillFn:n,polygonOpacityFn:i,uvScaleFn:e,uvOffsetFn:r}=this.C;if(this.iconAtlas){const n=this.getIconAtlasMaxValue();t.push({type:n>255?Uint16Array:Uint8Array,width:4,name:"aTexInfo"})}return n&&t.push({type:Uint8Array,width:4,name:"aColor"}),i&&t.push({type:Uint8Array,width:1,name:"aOpacity"}),e&&t.push({type:Uint16Array,width:2,name:"aUVScale"}),r&&t.push({type:Uint8Array,width:2,name:"aUVOffset"}),t}createDataPack(...t){this.maxLineIndex=0,this.lineElements=[];const n=super.createDataPack(...t);if(!n)return n;let i=this.lineElements;return i=new($i(this.maxLineIndex))(this.lineElements),n.lineIndices=i,n.buffers.push(i.buffer),n}placeVector(t,n){const i=t.feature;this.at(i.geometry,i,n)}at(t,n){let i,e,r,s;const{polygonFillFn:o,polygonOpacityFn:a,uvScaleFn:h,uvOffsetFn:u}=this.C,l=n.properties;o&&(i=o(this.options.zoom,l)||[255,255,255,255],m(i)?i=[0,0,0,0]:(i=Array.isArray(i)?i.map(t=>255*t):Vn(i).array(),3===i.length&&i.push(255))),a&&(e=a(this.options.zoom,l),Ji(e)&&(e=1),e*=255),h&&(r=h(this.options.zoom,l),Ji(r)&&(r=[1,1]),r=[255*r[0],255*r[1]]),u&&(s=u(this.options.zoom,l),Ji(s)&&(s=[0,0]),s=[255*s[0],255*s[1]]);const c=!!this.iconAtlas,f=ur(t,500),d=this.getAltitude(l),y=[0,0],v=[0,0];if(c){const{polygonPatternFileFn:t}=this.C,n=t?t(null,l):this.symbol.polygonPatternFile;if(this.iconAtlas.glyphMap[n]){const t=this.iconAtlas.positions[n];y[0]=t.tl[0]+1,y[1]=t.tl[1]+1,v[0]=t.displaySize[0]-3,v[1]=t.displaySize[1]-3}}const p=[-1,-1,n.extent+1,n.extent+1];for(let t=0;t<f.length;t++){const n=f[t],o=this.data.aPosition.length/3,a=[],h=[];for(let t=0;t<n.length;t++){let o=n[t];if(this.options.EXTENT!==1/0&&(o=Tr(o,p)),0===o.length)continue;0!==t&&h.push(a.length/2);const u=this.lineElements.length;this.data.aPosition.push(o[0].x,o[0].y,d),c&&this.data.aTexInfo.push(...y,...v),void 0!==i&&this.data.aColor.push(...i),void 0!==e&&this.data.aOpacity.push(e),void 0!==r&&this.data.aUVScale.push(...r),void 0!==s&&this.data.aUVOffset.push(...s),this.maxPos=Math.max(this.maxPos,Math.abs(o[0].x),Math.abs(o[0].y)),this.addLineElements(u+o.length-1,u),a.push(o[0].x),a.push(o[0].y);for(let t=1;t<o.length;t++)this.data.aPosition.push(o[t].x,o[t].y,d),c&&this.data.aTexInfo.push(...y,...v),void 0!==i&&this.data.aColor.push(...i),void 0!==e&&this.data.aOpacity.push(e),void 0!==r&&this.data.aUVScale.push(...r),void 0!==s&&this.data.aUVOffset.push(...s),this.maxPos=Math.max(this.maxPos,Math.abs(o[t].x),Math.abs(o[t].y)),this.addLineElements(u+t-1,u+t),a.push(o[t].x),a.push(o[t].y)}const u=ki(a,h);for(let t=0;t<u.length;t+=3)this.addElements(o+u[t],o+u[t+1],o+u[t+2])}}addLineElements(...t){this.maxLineIndex=Math.max(this.maxLineIndex,...t),this.lineElements.push(...t)}}var Dr=Object.freeze({__proto__:null,clipPolygon:Tr,calculateSignedArea:ne,getFeaAltitudeAndHeight:re,convertRTLText:tr});const Er={polygonPatternFile:1,markerFile:1,markerPlacement:1,markerSpacing:1,textName:1,textStyle:1,textFaceName:1,textWeight:1,textPlacement:1,textSpacing:1,lineJoin:1,lineCap:1,linePatternFile:1};Object.assign({visible:1,textHorizontalAlignment:1,textVerticalAlignment:1,textWrapWidth:1,markerHorizontalAlignment:1,markerVerticalAlignment:1},Er),Object.assign({lineDasharray:1},Er);function Cr(t,n,i,e,r,s,o,a,h,u,l,c,f,d,y){const v=n.length,p=r/3;for(let i=2,e=v;i<e;i+=3)t[r+i-2]=n[i-2],t[r+i-1]=n[i-1],t[r+i-0]=n[i]-s;r+=v;for(let i=2,e=v;i<e;i+=3)t[r+i-2]=n[i-2],t[r+i-1]=n[i-1],t[r+i-0]=n[i]-o;r+=v;for(let i=2,e=v;i<e;i+=3)t[r+i-2]=n[i-2],t[r+i-1]=n[i-1],t[r+i-0]=n[i]-s;r+=v;for(let i=2,e=v;i<e;i+=3)t[r+i-2]=n[i-2],t[r+i-1]=n[i-1],t[r+i-0]=n[i]-o;r+=v,(i=i||[]).push(v/3);for(let n=0;n<i.length;n++){jr(p+(i[n-1]||0),p+i[n],t,v/3,a,e,h,u,l,c,f,d,y)}return r}function jr(t,n,i,e,r,s,o,a,h,u,l,c,f){const d=s.length;let y,v;for(let o=t,a=n;o<a-1;o++)y=o,v=o+1,ct(i,y,v,r)||((o-t)%2==1&&(y+=2*e,v+=2*e),s.push(y+e,y,v),s.push(v,v+e,y+e));o&&function(t,n,i,e,r,s,o,a,h){let u,l=0,c=0,f=0,d=0;for(let y=e.length-1;y>=0;y--){const v=3*e[y],p=3*e[y]+1,m=3*e[y]+2,g=i[v],w=i[p],M=i[m];l||c||(l=Math.max(i[m],i[3*e[y-2]+2]),c=Math.min(i[m],i[3*e[y-2]+2]),u=l-c);let b=f;const x=y%6;0===t?(5===x&&(d=Nt(i,e,y,g,w)),b=2===x||3===x||4===x?f:f+d):1===t&&(2===x||3===x||4===x?b=0:5===x?(d=Nt(i,e,y,g,w),b=d):b=d);const F=b*o*a/r,A=M===l?0:u*h/s;n[v/3*2]=F,n[v/3*2+1]=-A,0===x&&(f+=d)}}(a,h,i,s.slice(d,s.length),u[0],u[1],l,c,f)}function Nr(t,n,i,e,r,s,o,a,h,u){void 0===n.top&&(n.top=!0),void 0===n.side&&(n.side=!0);const{altitudeScale:l,altitudeProperty:c,defaultAltitude:f,heightProperty:d,minHeightProperty:y,defaultHeight:v,tangent:p,uv:m,uvScale:M,topUVMode:b,sideUVMode:x,top:F,side:A,topThickness:k}=n,S=function(t,n,{altitudeScale:i,altitudeProperty:e,defaultAltitude:r,heightProperty:s,minHeightProperty:o,defaultHeight:a},{side:h,top:u,topThickness:l,uvOrigin:c,uv:f,uvSize:d,topUVMode:y,sideUVMode:v,glScale:p,localScale:m,vScale:g},w){const M=n/t[0].extent,b=[],x=[],F=[],A=[],k=[],S=[],_=!!f,O=!!u,T=!!h,z=_?[]:null;function D(t,i,e,r){if(O){const r=ki(A,e,3);if(0===r.length)return i;let s;I(k,A),i+=A.length;for(let n=2,i=r.length;n<i;n+=3)s=r[n-1],r[n-1]=r[n]+t/3,r[n]=s+t/3,r[n-2]+=t/3;I(S,r),_&&Et(y||0,t,i,z,k,0,p,m,d[0],d[1]),l>0&&!T&&(i=Cr(k,A,e,S,i,0,l,n,_,v||0,z,d,p,m,g))}return T&&(O&&(l=0),i=Cr(k,A,e,S,i,l,r,n,_,v||0,z,d,p,m,g)),i}let E=0,C=0;const j=[-1,-1,n+1,n+1];let N=0,H=t.length;void 0!==w&&(N=w,H=w+1);let V=0,R=!1;for(;N<H;N++){const h=t[N],u=h.id;P(u)&&(Math.abs(u)>V&&(V=Math.abs(u)),u<0&&(R=!0));const l=h.geometry,{altitude:c,height:f}=Dr.getFeaAltitudeAndHeight(h,i,e,r,s,a,o);E=Math.max(Math.abs(c),E);const d=k.length;let y=C,v=[];A.length=0;for(let t=0,i=l.length;t<i;t++){const e=Dr.calculateSignedArea(l[t])<0;!e&&t>0&&(C=D(y,C,v,f*M),A.length=0,v=[],y=C);let r=l[t];if(n!==1/0&&(r=Dr.clipPolygon(r,j)),!r.length){t===i-1&&(C=D(y,C,v,f*M));continue}const s=r.length;Array.isArray(r[0])?r[0][0]===r[s-1][0]&&r[0][1]===r[s-1][1]||r.push([r[0][0],r[0][1]]):r[0].x===r[s-1].x&&r[0].y===r[s-1].y||r.push(r[0]),e&&v.push(A.length/3),lt(A,A.length,r,M,c),t===i-1&&(C=D(y,C,v,f*M))}const p=k.length-d,m="__fea_idx".trim();for(let t=0;t<p/3;t++)x.push(void 0===h[m]?N:h[m]),b.push(N),P(u)&&F.push(u)}const $=L(x.length?x[x.length-1]:0),W={maxAltitude:E,vertices:new(U(Math.max(512,E)))(k),indices:S,pickingIds:new $(x),featureIndexes:b};if(F.length){const t=R?U(V):L(V);W.featureIds=new t(F)}else W.featureIds=[];return z&&(z.length=k.length/3*2,W.uvs=z),W}(t,i,{altitudeScale:l,altitudeProperty:c,defaultAltitude:f||0,heightProperty:d,minHeightProperty:y,defaultHeight:v||0},{top:F,side:A,topThickness:10*k||0,uv:m||p,uvSize:M?[.5*M[0],.5*M[1]]:[.5,.5],uvOrigin:e,topUVMode:b,sideUVMode:x,glScale:r,localScale:o,vScale:s},u),_=[],O=new(T(S.vertices.length/3))(S.indices);delete S.indices,_.push(O.buffer,S.vertices.buffer,S.pickingIds.buffer);const z=Xn(S.vertices,O);let E=!0;for(let t=0;t<z.length;t++)z[t]=-z[t],z[t]%1!=0&&(E=!1);if(S.normals=z,p){let t=function(t,n,i,e){const r=t.length/3,s=new Array(4*r),o=[],a=[];for(let t=0;t<r;t++)o[t]=[0,0,0],a[t]=[0,0,0];const h=[0,0,0],u=[0,0,0],l=[0,0,0],c=[0,0],f=[0,0],d=[0,0],y=[0,0,0],v=[0,0,0];function p(n,e,r){Zn(h,t,3*n),Zn(u,t,3*e),Zn(l,t,3*r),Yn(c,i,2*n),Yn(f,i,2*e),Yn(d,i,2*r);const s=u[0]-h[0],p=l[0]-h[0],m=u[1]-h[1],g=l[1]-h[1],w=u[2]-h[2],M=l[2]-h[2],b=f[0]-c[0],x=d[0]-c[0],F=f[1]-c[1],A=d[1]-c[1],k=1/(b*A-x*F);bt(y,(A*s-F*p)*k,(A*m-F*g)*k,(A*w-F*M)*k),bt(v,(b*p-x*s)*k,(b*g-x*m)*k,(b*M-x*w)*k),xt(o[n],o[n],y),xt(o[e],o[e],y),xt(o[r],o[r],y),xt(a[n],a[n],v),xt(a[e],a[e],v),xt(a[r],a[r],v)}for(let t=0,n=e.length;t<n;t+=3)p(e[t+0],e[t+1],e[t+2]);const m=[],g=[],w=[],M=[];let b,x,F;function A(t){Zn(w,n,3*t),Mt(M,w),x=o[t],Mt(m,x),St(m,m,function(t,n,i){return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t}(w,w,kt(w,x))),At(m,m),Pt(g,M,x),F=kt(g,a[t]),b=F<0?-1:1,s[4*t]=m[0],s[4*t+1]=m[1],s[4*t+2]=m[2],s[4*t+3]=b}for(let t=0,n=e.length;t<n;t+=3)A(e[t+0]),A(e[t+1]),A(e[t+2]);return s}(S.vertices,S.normals,S.uvs,O);t=function(t,n){const i=new Float32Array(n.length),e=[],r=[],s=[];for(let o=0;o<n.length;o+=4){const a=o/4*3;bt(r,t[a]||0,t[a+1]||0,t[a+2]||0),Ot(e,n[o]||0,n[o+1]||0,n[o+2]||0,n[o+3]||0),Jn(s,r,e),_t(i.subarray(o,o+4),s)}return i}(S.normals,t),S.tangents=t,_.push(t.buffer),delete S.normals}if(S.normals&&(S.normals=E?new Int8Array(S.normals):new Float32Array(S.normals),_.push(S.normals.buffer)),S.uvs){const t=S.uvs;S.uvs=new Float32Array(t),_.push(S.uvs.buffer)}const C=function(t,n,i,e){const r={};if(D(n.polygonFill)){const s={},o=w(n.polygonFill),a=new Uint8Array(4*e.length);for(let n=0;n<e.length;n++){const r=t[e[n]],h=r.properties||{};h.$layer=r.layer,h.$type=r.type;let u=o(i,h);if(delete h.$layer,delete h.$type,Array.isArray(u)||(u=s[u]=s[u]||Vn(u).array()),Array.isArray(u)){for(let t=0;t<u.length;t++)Hr[t]=255*u[t];3===u.length&&(Hr[3]=255)}a[4*n]=Hr[0],a[4*n+1]=Hr[1],a[4*n+2]=Hr[2],a[4*n+3]=Hr[3]}r.aColor=a}if(D(n.polygonOpacity)){const s=g(n.polygonOpacity),o=new Uint8Array(e.length);for(let n=0;n<e.length;n++){const r=t[e[n]],a=r.properties||{};a.$layer=r.layer,a.$type=r.type;const h=s(i,a);delete a.$layer,delete a.$type,o[n]=255*h}r.aOpacity=o}return r}(t,a,h,S.featureIndexes),j={data:{data:{aPosition:S.vertices,aNormal:S.normals,aTexCoord0:S.uvs,aTangent:S.tangents,aPickingId:S.pickingIds},indices:O,properties:{maxAltitude:S.maxAltitude}},buffers:_};return S.featureIds.length?(j.data.featureIds=S.featureIds,_.push(j.data.featureIds.buffer)):j.data.featureIds=[],C.aColor&&(j.data.data.aColor=C.aColor,j.buffers.push(C.aColor.buffer)),C.aOpacity&&(j.data.data.aOpacity=C.aOpacity,j.buffers.push(C.aOpacity.buffer)),j}const Hr=[];function Vr(t,n,{altitudeScale:i,altitudeProperty:e,defaultAltitude:r,heightProperty:s,minHeightProperty:o,defaultHeight:a,bottom:h}){const u=h,l=n/t[0].extent,c=2*function(t,n){let i=0;for(let e=0,r=t.length;e<r;e++){const r=t[e];if(P(r.geometry[0][0])){const t=3*r.geometry.length;i+=n?2*t-6:t}else for(let t=0,e=r.geometry.length;t<e;t++){let e=3*r.geometry[t].length;3===r.type&&(e-=3),i+=n?2*e-6:e}}return i}(t)+3*t.length*2,f=[],d=new Int16Array(c),y=[];function v(t,i,e){const r=i-t,s=d.subarray(t,i),o=d.subarray(i,i+r);o.set(s);for(let t=2,n=o.length;t<n;t+=3)o[t]=s[t]-e;const a=t/3,h=r/3;let l,c;for(let t=a,i=h+a;t<i;t++)t<i-1?(l=t,c=t+1):(l=t,c=a),ct(d,l,c,n)||(y.push(l,c),u&&y.push(l+h,c+h),Rr(d,l,n)||y.push(l,l+h));return i+r}let p=0,m=0;const g="__fea_idx".trim();for(let n=0,h=t.length;n<h;n++){const h=t[n],u=h.geometry,{altitude:c,height:w}=Dr.getFeaAltitudeAndHeight(h,i,e,r,s,a,o);m=Math.max(Math.abs(c),m);let M=p;for(let t=0,n=u.length;t<n;t++){let n=u[t];const i=n.length;n[0][0]===n[i-1][0]&&n[0][1]===n[i-1][1]&&(n=n.slice(0,i-1)),p=lt(d,M,n,l,c),p=v(M,p,w*l),M=p}const b=y.length-f.length;for(let t=0;t<b;t++)f.push(h[g])}const w=new(T(y.reduce((t,n)=>Math.max(t,n),0)))(y),M=L(t.length);return{aPosition:new(U(Math.max(512,m)))(d),indices:w,aPickingId:new M(f)}}function Rr(t,n,i){const e=t[3*n],r=t[3*n+1];return e<0||e>i||r<0||r>i}function $r(t,n,i){const e=Vr(t,i,n),r=[e.aPosition.buffer,e.indices.buffer,e.aPickingId.buffer],s=e.indices;return delete e.indices,{data:{data:e,indices:s},buffers:r}}class Wr{constructor(t,n,i,e,r){this.id=t,this.options=n,this.upload=i,this.ht(n.style),this.requests={},this.ut=0,this.lt=e,this.loadings=r}updateStyle(t,n){this.options.style=t,this.ht(t),this.ut++,n()}updateOptions(t,n){this.options=A(this.options,t),n()}loadTile(t,n){const i=this.loadings,e=t.tileInfo.url,r=this.options.debugTile;if(r){const{x:i,y:e,z:s}=t.tileInfo;if(s!==r.z||i!==r.x||e!==r.y)return void n()}if(this.lt.has(e)){const{features:r,layers:s}=this.lt.get(e),o=i[e];if(delete i[e],!r||!r.length)return this.ct(o),void n();if(o)for(let n=0;n<o.length;n++)this.ft.call(o[n].ref,t,o[n].callback,e,s,r);this.ft(t,n,e,s,r)}else i[e]?i[e].push({callback:n,ref:this}):(i[e]=[{callback:n,ref:this}],this.requests[e]=this.getTileFeatures(t.tileInfo,(n,r,s,o)=>{const a=i[e];if(delete i[e],this.checkIfCanceled(e))return delete this.requests[e],void this.ct(a,null,{canceled:!0});if(delete this.requests[e],this.options.debug&&r)for(let n=0;n<r.length;n++)r[n]._debug_info={index:n,tileId:t.tileInfo.id};if(n)return n.loading||this.lt.add(e,{features:[],layers:[]}),void this.ct(a,n);if(!r||!r.length)return this.lt.add(e,{features:[],layers:[]}),void this.ct(a);if(this.lt.add(e,{features:r,layers:s}),a)for(let n=0;n<a.length;n++)this.ft.call(a[n].ref,t,a[n].callback,e,s,r,o)}))}ft(t,n,i,e,r,s){this.dt(e,r,t).then(t=>{t.canceled?n(null,{canceled:!0}):(t.data.style=this.ut,s&&A(t.data,s),n(null,t.data,t.buffers))}).catch(t=>{n(t)})}abortTile(t,n){delete this.requests[t],this.yt(t),n()}yt(t){const n=this.loadings[t];if(n)for(let t=0;t<n.length;t++)n[t].callback(null,{canceled:!0});delete this.loadings[t]}ct(t,n,i){if(t)for(let e=0;e<t.length;e++)t[e].callback(n,i)}checkIfCanceled(t){return!this.requests[t]}fetchIconGlyphs(t,n,i){this.upload("fetchIconGlyphs",{icons:t,glyphs:n},null,i)}dt(t,n,{glScale:i,zScale:e,tileInfo:r}){if(!n.length)return Promise.resolve({data:null,buffers:[]});const s=!this.options.style.style.length&&!this.options.style.featureStyle.length;let o=this.pluginConfig.slice(0);s&&(o=this.vt(t)),this.featurePlugins&&I(o,this.featurePlugins);const a=n[0].extent,h=r.z,u={x:r.extent2d.xmin*i,y:r.extent2d.ymax*i},l=[],c=[],f=[],d=this.options,y=[],v={},p=[Promise.resolve(this.ut)];let m=0,g=-1;for(let t=0;t<o.length;t++){g++;const r=o[t];r.type!==m&&(g=0,m=r.type);const d=0===r.type?l:c;if(r.symbol&&!1===r.symbol.visible){d[g]=null;continue}const{tileFeatures:w,tileFeaIndexes:M}=this.pt(r.type,r.filter,n,v,t);if(!w.length){d[g]=null;continue}const b=T(M[M.length-1]);d[g]={styledFeatures:new b(M)},f.push({idx:t,typeIdx:g}),y.push(d[g].styledFeatures.buffer);let x=this.gt(w,r,{extent:a,tilePoint:u,glScale:i,zScale:e,zoom:h});s&&(x=x.then(t=>{if(!t)return null;if(t.data)t.data.layer=w[0].layer;else if(Array.isArray(t))for(let n=0;n<t.length;n++)t[n]&&t[n].data&&(t[n].data.layer=w[0].layer);return t})),p.push(x)}return Promise.all(p).then(([i,...e])=>{function r(t,n){if(void 0===t.data.ref&&(t.data.type=o[f[n].idx].renderPlugin.dataConfig.type,t.data.filter=o[f[n].idx].filter.def,t.buffers&&t.buffers.length))for(let n=0;n<t.buffers.length;n++)y.push(t.buffers[n])}if(i!==this.ut)return{canceled:!0};for(let t=0;t<e.length;t++){if(!e[t])continue;const n=e[t],i=0===o[f[t].idx].type?l:c;if(Array.isArray(n)){const e=[];for(let i=0;i<n.length;i++)n[i]&&(r(n[i],t),(void 0===n[i].data.ref||n[n[i].data.ref])&&e.push(n[i].data));e.length&&(i[f[t].typeIdx].data=e)}else r(n,t),i[f[t].typeIdx].data=n.data}const s={},h=t;if(d.features||d.schema){let t;for(let i=0,e=n.length;i<e;i++)if(t=n[i],h[t.layer].properties||(h[t.layer].properties=Gr(t.properties)),d.features&&t&&v[i])if("id"===d.features)s[i]=t.id;else{const n=A({},t);d.pickingGeometry||delete n.geometry,delete n.extent,delete n.properties.$layer,delete n.properties.$type,delete n.__index,s[i]=n}}return{data:{schema:h,data:l,featureData:c,extent:a,features:s},buffers:y}})}gt(t,n,i){const e=n.renderPlugin.dataConfig,r=n.symbol,s=this.options.tileSize[0],{extent:o,glScale:a,zScale:h,zoom:u,tilePoint:l}=i,c=o/s,f=e.type,d=this.options.debugTile&&this.options.debugTile.index;if("3d-extrusion"===f){const n=Jr(r);return n&&(e.uv=1,2===n&&(e.tangent=1)),Promise.all([Promise.resolve(Nr(t,e,o,l,a,h,this.options.tileSize[1]/o,r,u,d))])}if("3d-wireframe"===f)return Promise.all([Promise.resolve($r(t,e,o))]);if("point"===f){const n=A({},e,{EXTENT:o,requestor:this.fetchIconGlyphs.bind(this),zoom:u,debugIndex:d}),i=mr.splitPointSymbol(r);return mr.needMerge(i[0])&&(t=mr.mergeLineFeatures(t,i[0],u)),Promise.all(i.map(i=>new mr(t,i,n).load(c)))}if("native-point"===f){const n=A({},e,{EXTENT:o,zoom:u,debugIndex:d});return Xr(t,r,n,_r,o/s)}if("line"===f){const n=A({},e,{EXTENT:o,requestor:this.fetchIconGlyphs.bind(this),tileRatio:c,zoom:u,debugIndex:d});return Xr(t,r,n,Mr)}if("native-line"===f){const n=A({},e,{EXTENT:o,zoom:u,debugIndex:d});return Xr(t,r,n,Pr)}if("fill"===f){const n=A({},e,{EXTENT:o,requestor:this.fetchIconGlyphs.bind(this),zoom:u,debugIndex:d});return Xr(t,r,n,zr)}if("line-extrusion"===f){delete r.lineGradientProperty,r.lineJoin="miter",r.lineCap="butt";const n=Jr(r);n&&(e.uv=1,2===n&&(e.tangent=1));const i=A({},e,{EXTENT:o,tileSize:s,zScale:h,glScale:a,zoom:u,debugIndex:d});if(n){const n=[];if(!1!==e.top){const e=A({},i);e.side=!1,n.push(new Ar(t,r,e))}return!1!==e.side&&(i.side=!0,i.top=!1,n.push(new Ar(t,r,i))),Promise.all(n.map(t=>t.load()))}return Promise.all([new Ar(t,r,i).load()])}return Promise.resolve([])}pt(t,n,i,e){const r="__fea_idx".trim(),s=[],o=[],a=i.length;for(let h=0;h<a;h++)if((1===t||void 0===i[h].id||!this.styledFeatures[i[h].id])&&((!n.def||"default"===n.def)&&!e[h]||!0===n.def||Array.isArray(n.def)&&n(i[h]))){e[h]=1;const n=A({},i[h]);if(n[r]=h,o.push(n),s.push(h),1===t)break}return{tileFeatures:o,tileFeaIndexes:s}}ht(t){const{style:n,featureStyle:i}=t,e={};i.forEach(t=>{Array.isArray(t.id)?(t.id.forEach(t=>{e[t]=1}),t.filter=["in","$id",...t.id]):(e[t.id]=1,t.filter=["==","$id",t.id])});const r=z(n);for(let t=0;t<n.length;t++)r[t].filter&&(r[t].filter.def=n[t].filter?n[t].filter.value||n[t].filter:void 0),r[t].type=0;const s=[],o=z(i);for(let t=0;t<i.length;t++)o[t].type=1,o[t].filter.def=i[t].filter?i[t].filter.value||i[t].filter:void 0,o[t].renderPlugin&&s.push(o[t]);this.pluginConfig=r,this.featurePlugins=s,this.styledFeatures=e}vt(t){let n=this.wt;this.wt||(n=this.wt={});const e=["","Point","LineString","Polygon","MultiPoint","MultiLineString","MultiPolygon"],r=[];for(const s in t){const o=s;if(!n[s]){const r=[];for(let n=0;n<t[s].types.length;n++){const a=t[s].types[n],h=["all",["==","$layer",o],["==","$type",e[a]]],u={filter:i(h),renderPlugin:qr(a),symbol:Br(a)};u.filter.def=h,u.type=0,r.push(u)}n[o]=r}r.push(...n[o])}return r}}function qr(t){switch(t){case 1:return{type:"native-point",dataConfig:{type:"native-point",only2D:!0}};case 2:return{type:"native-line",dataConfig:{type:"native-line",only2D:!0}};case 3:return{type:"fill",dataConfig:{type:"fill",only2D:!0}}}return null}function Br(t){switch(t){case 1:return{markerFill:"#f00",markerSize:10};case 2:return{lineColor:"#fff"};case 3:return{polygonFill:"#00f",polygonOpacity:.4}}return null}function Gr(t){if(Array.isArray(t)||!_(t))return{};const n={};for(const i in t){const e=t[i];k(e)?n[i]="string":P(e)?n[i]="number":!0===e||!1===e?n[i]="boolean":Array.isArray(e)?n[i]="array":n[i]="object"}return n}function Jr(t){if(!t)return 0;let n=0;for(const i in t){if(("normalTexture"===i||"bumpTexture"===i)&&t[i])return 2;if(i.indexOf("Texture")>0&&t[i])n=1;else if(_(t[i])){const e=Jr(t[i]);if(2===e)return e;1===e&&(n=1)}}return n}function Xr(t,n,i,e,r){const s={},o=Array.isArray(n)?n:[n];let a=-1;for(let t=0;t<o.length;t++)s[t]=Zr(o[t]),!s[t]&&o[t]&&-1===a&&(a=t);const h=[];for(let n=0;n<o.length;n++)o[n]&&(o[n].index={index:n},s[n]||n===a?h.push(new e(t,o[n],i).load(r)):h.push({data:{ref:a,symbolIndex:{index:n}}}));return Promise.all(h)}function Zr(t){if(!t)return 0;for(const n in t)if(D(t[n]))return 1;return 0}function Yr(t,n){Kr(t.geometry,n)}function Kr(t,n){if(t)switch(t.type){case"Point":Qr(t.coordinates,n);break;case"MultiPoint":case"LineString":ts(t.coordinates,n);break;case"MultiLineString":case"Polygon":ns(t.coordinates,n);break;case"MultiPolygon":!function(t,n){for(let i=0;i<t.length;i++)ns(t[i],n)}(t.coordinates,n);break;case"GeometryCollection":for(let i=0;i<t.geometries.length;i++)Kr(t.geometries[i],n)}}function Qr(t,n){n[0]=Math.min(n[0],t[0]),n[1]=Math.min(n[1],t[1]),n[2]=Math.max(n[2],t[0]),n[3]=Math.max(n[3],t[1])}function ts(t,n){for(let i=0;i<t.length;i++)Qr(t[i],n)}function ns(t,n){for(let i=0;i<t.length;i++)ts(t[i],n)}class is extends Wr{constructor(t,n,i,e,r,s){super(t,n,i,e,r),(n=n||{}).extent||(n.extent=8192),this.zoomOffset=0,n.tileSize&&(this.zoomOffset=-function(t){if(Math.log2)return Math.log2(t);const n=Math.log(t)*Math.LOG2E,i=Math.round(n);return Math.abs(i-n)<1e-14?i:n}(n.tileSize[0]/256)),this.setData(n.data,s)}setData(t,n){if(delete this.index,!t)return void n();const i={maxZoom:24,tolerance:this.options.extent/this.options.tileSize[0]*1,extent:this.options.extent,buffer:this.options.tileBuffer||64,debug:0,lineMetrics:!0,indexMaxZoom:5,indexMaxPoints:1e5};if(k(t)&&"{"!=t.substring(0,1)||t.url)C.getJSON(t.url?t.url:t,t.url?t:{},(t,e)=>{if(t&&n(t),!e)return void n(null,{extent:null,idMap:{}});const r=e,{first1000:s,idMap:o}=this.Mt(r);this.bt(s,o,r,i,n)});else{"string"==typeof t&&(t=JSON.parse(t));const e=Array.isArray(t)?t:t.features;let r=e;e&&e.length>1e3&&(r=e.slice(0,1e3)),this.bt(r,null,t,i,n)}}bt(t,n,i,e,r){try{const s=t&&t.length?function(t){let n=[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY];switch(t.type){case"FeatureCollection":for(let i=0;i<t.features.length;i++)Yr(t.features[i],n);break;case"Feature":Yr(t,n);break;default:Kr(t,n)}return n}({type:"FeatureCollection",features:t}):null;this.index=function(t,n){return new ht(t,n)}(i,this.options.geojsonvt||e),r(null,{extent:s,idMap:n})}catch(t){console.warn(t),r({error:t.message})}}Mt(t){const n=[],i={};let e=0;function r(t){t&&("Feature"!==t.type||t.geometry)&&(void 0!==t.id&&null!==t.id||(t.id=e++),i[t.id]=A({},t),t.geometry?(i[t.id].geometry=A({},t.geometry),i[t.id].geometry.coordinates=null):t.coordinates&&(i[t.id].coordinates=null),n.length<1e3&&n.push(t))}return Array.isArray(t)?t.forEach(t=>{r(t)}):t.features&&t.features.forEach(t=>{r(t)}),{first1000:n,idMap:i}}getTileFeatures(t,n){const i=[];if(!this.index)return setTimeout((function(){n({loading:!0})}),1),1;const e=this.index.getTile(t.z+this.zoomOffset,t.x,t.y);if(!e||0===e.features.length)return setTimeout((function(){n(null,i,[])}),1),1;const r=[];for(let t=0,n=e.features.length;t<n;t++){const n=e.features[t];let s=n.layer;void 0===s&&(s="0"),r[s]={types:{}};r[s].types[n.type]=1,n.tags=n.tags||{},i.push({type:n.type,layer:s,id:n.id,geometry:n.geometry,properties:n.tags,extent:this.options.extent})}for(const t in r)r[t].types=Object.keys(r[t].types).map(t=>+t);return setTimeout((function(){n(null,i,r)}),1),1}onRemove(){delete this.index}}var es={\n/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */\nread:function(t,n,i,e,r){var s,o,a=8*r-e-1,h=(1<<a)-1,u=h>>1,l=-7,c=i?r-1:0,f=i?-1:1,d=t[n+c];for(c+=f,s=d&(1<<-l)-1,d>>=-l,l+=a;l>0;s=256*s+t[n+c],c+=f,l-=8);for(o=s&(1<<-l)-1,s>>=-l,l+=e;l>0;o=256*o+t[n+c],c+=f,l-=8);if(0===s)s=1-u;else{if(s===h)return o?NaN:1/0*(d?-1:1);o+=Math.pow(2,e),s-=u}return(d?-1:1)*o*Math.pow(2,s-e)},write:function(t,n,i,e,r,s){var o,a,h,u=8*s-r-1,l=(1<<u)-1,c=l>>1,f=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,d=e?0:s-1,y=e?1:-1,v=n<0||0===n&&1/n<0?1:0;for(n=Math.abs(n),isNaN(n)||n===1/0?(a=isNaN(n)?1:0,o=l):(o=Math.floor(Math.log(n)/Math.LN2),n*(h=Math.pow(2,-o))<1&&(o--,h*=2),(n+=o+c>=1?f/h:f*Math.pow(2,1-c))*h>=2&&(o++,h/=2),o+c>=l?(a=0,o=l):o+c>=1?(a=(n*h-1)*Math.pow(2,r),o+=c):(a=n*Math.pow(2,c-1)*Math.pow(2,r),o=0));r>=8;t[i+d]=255&a,d+=y,a/=256,r-=8);for(o=o<<r|a,u+=r;u>0;t[i+d]=255&o,d+=y,o/=256,u-=8);t[i+d-y]|=128*v}},rs=os,ss=es;function os(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}os.Varint=0,os.Fixed64=1,os.Bytes=2,os.Fixed32=5;var as="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function hs(t){return t.type===os.Bytes?t.readVarint()+t.pos:t.pos+1}function us(t,n,i){return i?4294967296*n+(t>>>0):4294967296*(n>>>0)+(t>>>0)}function ls(t,n,i){var e=n<=16383?1:n<=2097151?2:n<=268435455?3:Math.floor(Math.log(n)/(7*Math.LN2));i.realloc(e);for(var r=i.pos-1;r>=t;r--)i.buf[r+e]=i.buf[r]}function cs(t,n){for(var i=0;i<t.length;i++)n.writeVarint(t[i])}function fs(t,n){for(var i=0;i<t.length;i++)n.writeSVarint(t[i])}function ds(t,n){for(var i=0;i<t.length;i++)n.writeFloat(t[i])}function ys(t,n){for(var i=0;i<t.length;i++)n.writeDouble(t[i])}function vs(t,n){for(var i=0;i<t.length;i++)n.writeBoolean(t[i])}function ps(t,n){for(var i=0;i<t.length;i++)n.writeFixed32(t[i])}function ms(t,n){for(var i=0;i<t.length;i++)n.writeSFixed32(t[i])}function gs(t,n){for(var i=0;i<t.length;i++)n.writeFixed64(t[i])}function ws(t,n){for(var i=0;i<t.length;i++)n.writeSFixed64(t[i])}function Ms(t,n){return(t[n]|t[n+1]<<8|t[n+2]<<16)+16777216*t[n+3]}function bs(t,n,i){t[i]=n,t[i+1]=n>>>8,t[i+2]=n>>>16,t[i+3]=n>>>24}function xs(t,n){return(t[n]|t[n+1]<<8|t[n+2]<<16)+(t[n+3]<<24)}os.prototype={destroy:function(){this.buf=null},readFields:function(t,n,i){for(i=i||this.length;this.pos<i;){var e=this.readVarint(),r=e>>3,s=this.pos;this.type=7&e,t(r,n,this),this.pos===s&&this.skip(e)}return n},readMessage:function(t,n){return this.readFields(t,n,this.readVarint()+this.pos)},readFixed32:function(){var t=Ms(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=xs(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=Ms(this.buf,this.pos)+4294967296*Ms(this.buf,this.pos+4);return this.pos+=8,t},readSFixed64:function(){var t=Ms(this.buf,this.pos)+4294967296*xs(this.buf,this.pos+4);return this.pos+=8,t},readFloat:function(){var t=ss.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=ss.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var n,i,e=this.buf;return n=127&(i=e[this.pos++]),i<128?n:(n|=(127&(i=e[this.pos++]))<<7,i<128?n:(n|=(127&(i=e[this.pos++]))<<14,i<128?n:(n|=(127&(i=e[this.pos++]))<<21,i<128?n:function(t,n,i){var e,r,s=i.buf;if(r=s[i.pos++],e=(112&r)>>4,r<128)return us(t,e,n);if(r=s[i.pos++],e|=(127&r)<<3,r<128)return us(t,e,n);if(r=s[i.pos++],e|=(127&r)<<10,r<128)return us(t,e,n);if(r=s[i.pos++],e|=(127&r)<<17,r<128)return us(t,e,n);if(r=s[i.pos++],e|=(127&r)<<24,r<128)return us(t,e,n);if(r=s[i.pos++],e|=(1&r)<<31,r<128)return us(t,e,n);throw new Error("Expected varint not more than 10 bytes")}(n|=(15&(i=e[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,n=this.pos;return this.pos=t,t-n>=12&&as?function(t,n,i){return as.decode(t.subarray(n,i))}(this.buf,n,t):function(t,n,i){var e="",r=n;for(;r<i;){var s,o,a,h=t[r],u=null,l=h>239?4:h>223?3:h>191?2:1;if(r+l>i)break;1===l?h<128&&(u=h):2===l?128==(192&(s=t[r+1]))&&(u=(31&h)<<6|63&s)<=127&&(u=null):3===l?(s=t[r+1],o=t[r+2],128==(192&s)&&128==(192&o)&&((u=(15&h)<<12|(63&s)<<6|63&o)<=2047||u>=55296&&u<=57343)&&(u=null)):4===l&&(s=t[r+1],o=t[r+2],a=t[r+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&((u=(15&h)<<18|(63&s)<<12|(63&o)<<6|63&a)<=65535||u>=1114112)&&(u=null)),null===u?(u=65533,l=1):u>65535&&(u-=65536,e+=String.fromCharCode(u>>>10&1023|55296),u=56320|1023&u),e+=String.fromCharCode(u),r+=l}return e}(this.buf,n,t)},readBytes:function(){var t=this.readVarint()+this.pos,n=this.buf.subarray(this.pos,t);return this.pos=t,n},readPackedVarint:function(t,n){if(this.type!==os.Bytes)return t.push(this.readVarint(n));var i=hs(this);for(t=t||[];this.pos<i;)t.push(this.readVarint(n));return t},readPackedSVarint:function(t){if(this.type!==os.Bytes)return t.push(this.readSVarint());var n=hs(this);for(t=t||[];this.pos<n;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==os.Bytes)return t.push(this.readBoolean());var n=hs(this);for(t=t||[];this.pos<n;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==os.Bytes)return t.push(this.readFloat());var n=hs(this);for(t=t||[];this.pos<n;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==os.Bytes)return t.push(this.readDouble());var n=hs(this);for(t=t||[];this.pos<n;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==os.Bytes)return t.push(this.readFixed32());var n=hs(this);for(t=t||[];this.pos<n;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==os.Bytes)return t.push(this.readSFixed32());var n=hs(this);for(t=t||[];this.pos<n;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==os.Bytes)return t.push(this.readFixed64());var n=hs(this);for(t=t||[];this.pos<n;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==os.Bytes)return t.push(this.readSFixed64());var n=hs(this);for(t=t||[];this.pos<n;)t.push(this.readSFixed64());return t},skip:function(t){var n=7&t;if(n===os.Varint)for(;this.buf[this.pos++]>127;);else if(n===os.Bytes)this.pos=this.readVarint()+this.pos;else if(n===os.Fixed32)this.pos+=4;else{if(n!==os.Fixed64)throw new Error("Unimplemented type: "+n);this.pos+=8}},writeTag:function(t,n){this.writeVarint(t<<3|n)},realloc:function(t){for(var n=this.length||16;n<this.pos+t;)n*=2;if(n!==this.length){var i=new Uint8Array(n);i.set(this.buf),this.buf=i,this.length=n}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(t){this.realloc(4),bs(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),bs(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),bs(this.buf,-1&t,this.pos),bs(this.buf,Math.floor(t*(1/4294967296)),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),bs(this.buf,-1&t,this.pos),bs(this.buf,Math.floor(t*(1/4294967296)),this.pos+4),this.pos+=8},writeVarint:function(t){(t=+t||0)>268435455||t<0?function(t,n){var i,e;t>=0?(i=t%4294967296|0,e=t/4294967296|0):(e=~(-t/4294967296),4294967295^(i=~(-t%4294967296))?i=i+1|0:(i=0,e=e+1|0));if(t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn\'t fit into 10 bytes");n.realloc(10),function(t,n,i){i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos]=127&t}(i,0,n),function(t,n){var i=(7&t)<<4;if(n.buf[n.pos++]|=i|((t>>>=3)?128:0),!t)return;if(n.buf[n.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(n.buf[n.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(n.buf[n.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(n.buf[n.pos++]=127&t|((t>>>=7)?128:0),!t)return;n.buf[n.pos++]=127&t}(e,n)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var n=this.pos;this.pos=function(t,n,i){for(var e,r,s=0;s<n.length;s++){if((e=n.charCodeAt(s))>55295&&e<57344){if(!r){e>56319||s+1===n.length?(t[i++]=239,t[i++]=191,t[i++]=189):r=e;continue}if(e<56320){t[i++]=239,t[i++]=191,t[i++]=189,r=e;continue}e=r-55296<<10|e-56320|65536,r=null}else r&&(t[i++]=239,t[i++]=191,t[i++]=189,r=null);e<128?t[i++]=e:(e<2048?t[i++]=e>>6|192:(e<65536?t[i++]=e>>12|224:(t[i++]=e>>18|240,t[i++]=e>>12&63|128),t[i++]=e>>6&63|128),t[i++]=63&e|128)}return i}(this.buf,t,this.pos);var i=this.pos-n;i>=128&&ls(n,i,this),this.pos=n-1,this.writeVarint(i),this.pos+=i},writeFloat:function(t){this.realloc(4),ss.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),ss.write(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var n=t.length;this.writeVarint(n),this.realloc(n);for(var i=0;i<n;i++)this.buf[this.pos++]=t[i]},writeRawMessage:function(t,n){this.pos++;var i=this.pos;t(n,this);var e=this.pos-i;e>=128&&ls(i,e,this),this.pos=i-1,this.writeVarint(e),this.pos+=e},writeMessage:function(t,n,i){this.writeTag(t,os.Bytes),this.writeRawMessage(n,i)},writePackedVarint:function(t,n){n.length&&this.writeMessage(t,cs,n)},writePackedSVarint:function(t,n){n.length&&this.writeMessage(t,fs,n)},writePackedBoolean:function(t,n){n.length&&this.writeMessage(t,vs,n)},writePackedFloat:function(t,n){n.length&&this.writeMessage(t,ds,n)},writePackedDouble:function(t,n){n.length&&this.writeMessage(t,ys,n)},writePackedFixed32:function(t,n){n.length&&this.writeMessage(t,ps,n)},writePackedSFixed32:function(t,n){n.length&&this.writeMessage(t,ms,n)},writePackedFixed64:function(t,n){n.length&&this.writeMessage(t,gs,n)},writePackedSFixed64:function(t,n){n.length&&this.writeMessage(t,ws,n)},writeBytesField:function(t,n){this.writeTag(t,os.Bytes),this.writeBytes(n)},writeFixed32Field:function(t,n){this.writeTag(t,os.Fixed32),this.writeFixed32(n)},writeSFixed32Field:function(t,n){this.writeTag(t,os.Fixed32),this.writeSFixed32(n)},writeFixed64Field:function(t,n){this.writeTag(t,os.Fixed64),this.writeFixed64(n)},writeSFixed64Field:function(t,n){this.writeTag(t,os.Fixed64),this.writeSFixed64(n)},writeVarintField:function(t,n){this.writeTag(t,os.Varint),this.writeVarint(n)},writeSVarintField:function(t,n){this.writeTag(t,os.Varint),this.writeSVarint(n)},writeStringField:function(t,n){this.writeTag(t,os.Bytes),this.writeString(n)},writeFloatField:function(t,n){this.writeTag(t,os.Fixed32),this.writeFloat(n)},writeDoubleField:function(t,n){this.writeTag(t,os.Fixed64),this.writeDouble(n)},writeBooleanField:function(t,n){this.writeVarintField(t,Boolean(n))}};var Fs=Ht,As=ks;function ks(t,n,i,e,r){this.properties={},this.extent=i,this.type=0,this.xt=t,this.Ft=-1,this.At=e,this.kt=r,t.readFields(Ps,this,n)}function Ps(t,n,i){1==t?n.id=i.readVarint():2==t?function(t,n){var i=t.readVarint()+t.pos;for(;t.pos<i;){var e=n.At[t.readVarint()],r=n.kt[t.readVarint()];n.properties[e]=r}}(i,n):3==t?n.type=i.readVarint():4==t&&(n.Ft=i.pos)}function Ss(t){for(var n,i,e=0,r=0,s=t.length,o=s-1;r<s;o=r++)n=t[r],e+=((i=t[o]).x-n.x)*(n.y+i.y);return e}ks.types=["Unknown","Point","LineString","Polygon"],ks.prototype.loadGeometry=function(){var t=this.xt;t.pos=this.Ft;for(var n,i=t.readVarint()+t.pos,e=1,r=0,s=0,o=0,a=[];t.pos<i;){if(r<=0){var h=t.readVarint();e=7&h,r=h>>3}if(r--,1===e||2===e)s+=t.readSVarint(),o+=t.readSVarint(),1===e&&(n&&a.push(n),n=[]),n.push(new Fs(s,o));else{if(7!==e)throw new Error("unknown command "+e);n&&n.push(n[0].clone())}}return n&&a.push(n),a},ks.prototype.bbox=function(){var t=this.xt;t.pos=this.Ft;for(var n=t.readVarint()+t.pos,i=1,e=0,r=0,s=0,o=1/0,a=-1/0,h=1/0,u=-1/0;t.pos<n;){if(e<=0){var l=t.readVarint();i=7&l,e=l>>3}if(e--,1===i||2===i)(r+=t.readSVarint())<o&&(o=r),r>a&&(a=r),(s+=t.readSVarint())<h&&(h=s),s>u&&(u=s);else if(7!==i)throw new Error("unknown command "+i)}return[o,h,a,u]},ks.prototype.toGeoJSON=function(t,n,i){var e,r,s=this.extent*Math.pow(2,i),o=this.extent*t,a=this.extent*n,h=this.loadGeometry(),u=ks.types[this.type];function l(t){for(var n=0;n<t.length;n++){var i=t[n],e=180-360*(i.y+a)/s;t[n]=[360*(i.x+o)/s-180,360/Math.PI*Math.atan(Math.exp(e*Math.PI/180))-90]}}switch(this.type){case 1:var c=[];for(e=0;e<h.length;e++)c[e]=h[e][0];l(h=c);break;case 2:for(e=0;e<h.length;e++)l(h[e]);break;case 3:for(h=function(t){var n=t.length;if(n<=1)return[t];for(var i,e,r=[],s=0;s<n;s++){var o=Ss(t[s]);0!==o&&(void 0===e&&(e=o<0),e===o<0?(i&&r.push(i),i=[t[s]]):i.push(t[s]))}i&&r.push(i);return r}(h),e=0;e<h.length;e++)for(r=0;r<h[e].length;r++)l(h[e][r])}1===h.length?h=h[0]:u="Multi"+u;var f={type:"Feature",geometry:{type:u,coordinates:h},properties:this.properties};return"id"in this&&(f.id=this.id),f};var _s=As,Os=Is;function Is(t,n){this.version=1,this.name=null,this.extent=4096,this.length=0,this.xt=t,this.At=[],this.kt=[],this.Pt=[],t.readFields(Ts,this,n),this.length=this.Pt.length}function Ts(t,n,i){15===t?n.version=i.readVarint():1===t?n.name=i.readString():5===t?n.extent=i.readVarint():2===t?n.Pt.push(i.pos):3===t?n.At.push(i.readString()):4===t&&n.kt.push(function(t){var n=null,i=t.readVarint()+t.pos;for(;t.pos<i;){var e=t.readVarint()>>3;n=1===e?t.readString():2===e?t.readFloat():3===e?t.readDouble():4===e?t.readVarint64():5===e?t.readVarint():6===e?t.readSVarint():7===e?t.readBoolean():null}return n}(i))}Is.prototype.feature=function(t){if(t<0||t>=this.Pt.length)throw new Error("feature index out of bounds");this.xt.pos=this.Pt[t];var n=this.xt.readVarint()+this.xt.pos;return new _s(this.xt,n,this.extent,this.At,this.kt)};var Ls=Os;function Us(t,n,i){if(3===t){var e=new Ls(i,i.readVarint()+i.pos);e.length&&(n[e.name]=e)}}var zs=function(t,n){this.layers=t.readFields(Us,{},n)};class Ds extends Wr{constructor(t,n,i,e,r,s){super(t,n,i,e,r),n=n||{},s()}getTileFeatures(t,n){const i=t.url;return C.getArrayBuffer(i,(t,i)=>{if(t)return void n(t);const e=new zs(new rs(i.data)),r=[];if(!e.layers)return void n(null,r,[]);const s={};let o;for(const n in e.layers)if(a=e.layers,h=n,Object.prototype.hasOwnProperty.call(a,h)){s[n]={types:{}};const i=s[n].types;for(let s=0,a=e.layers[n].length;s<a;s++)try{o=e.layers[n].feature(s),i[o.type]=1,r.push({type:o.type,layer:n,geometry:o.loadGeometry(),properties:o.properties,extent:o.extent})}catch(t){console.warn("error when load vt geometry:",t)}}var a,h;for(const t in s)s[t].types=Object.keys(s[t].types).map(t=>+t);n(null,r,s,{byteLength:i.data.byteLength})})}abortTile(t,n){const i=this.requests[t];delete this.requests[t],i&&i.abort&&i.abort(),this.yt(t),n()}onRemove(){for(const t in this.requests)this.requests[t].abort();this.requests={}}}let Es=0;const Cs=new class{constructor(t){this.max=t,this.reset()}reset(){return this.data={},this.order=[],this}clear(){this.reset()}add(t,n){return this.has(t)?(this.order.splice(this.order.indexOf(t),1),this.data[t]=n,this.order.push(t)):(this.data[t]=n,this.order.push(t),this.order.length>this.max&&this.getAndRemove(this.order[0])),this}has(t){return t in this.data}keys(){return this.order}getAndRemove(t){if(!this.has(t))return null;const n=this.data[t];return delete this.data[t],this.order.splice(this.order.indexOf(t),1),n}get(t){return this.has(t)?this.data[t]:null}remove(t){return this.has(t)?(delete this.data[t],this.order.splice(this.order.indexOf(t),1),this):this}setMaxSize(t){for(this.max=t;this.order.length>this.max;)this.getAndRemove(this.order[0]);return this}}(128),js={};class Ns{constructor(t){this.St={},this._t={},this.workerId=t}addLayer({actorId:t,mapId:n,layerId:i,params:e},r){if(this.Ot(n,i))return;const s=this.It(n,i),o=e.type,a=e.options,h=this.send.bind(this,t);this.St[s]="GeoJSONVectorTileLayer"===o?new is(i,a,h,Cs,js,r):new Ds(i,a,h,Cs,js,r)}removeLayer({mapId:t,layerId:n},i){const e=this.Ot(t,n),r=this.It(t,n);delete this.St[r],e&&(e.onRemove(i),this.Tt())}loadTile({mapId:t,layerId:n,params:i},e){const r=this.Ot(t,n);r&&r.loadTile(i,e)}abortTile({mapId:t,layerId:n,params:i},e){const r=this.Ot(t,n);r&&r.abortTile&&r.abortTile(i.url,e)}removeTile({mapId:t,layerId:n,params:i},e){const r=this.Ot(t,n);r&&r.removeTile(i,e)}updateStyle({mapId:t,layerId:n,params:i},e){const r=this.Ot(t,n);r&&(r.updateStyle(i,e),this.Tt())}updateOptions({mapId:t,layerId:n,params:i},e){const r=this.Ot(t,n);r&&(r.updateOptions(i,e),this.Tt())}setData({mapId:t,layerId:n,params:i},e){const r=this.Ot(t,n);r&&(r.setData(i.data,e),this.Tt())}receive(t){const n=t.callback,i=this._t[n];delete this._t[n],i&&t.error?i(new Error(t.error)):i&&i(null,t.data)}send(t,n,i,e,r){const s=r?`${t}-${Es++}`:null;r&&(this._t[s]=r),postMessage({type:"<request>",workerId:this.workerId,actorId:t,command:n,params:i,callback:String(s)},e||[])}It(t,n){return`${t}-${n}`}Ot(t,n){const i=this.It(t,n);return this.St[i]}Tt(){const t=Object.keys(js);for(let n=0;n<t.length;n++)delete js[t[n]];Cs.reset()}}t.initialize=function(){},t.onmessage=function(t,n){const i=t.data;if(this.dispatcher||(this.dispatcher=new Ns(t.workerId)),"<response>"===t.type)this.dispatcher.workerId===t.workerId&&this.dispatcher.receive(t);else{const e=i.command;this.dispatcher[e]({actorId:t.actorId,mapId:i.mapId,layerId:i.layerId,params:i.params},(t,i,r)=>{t&&console.error(e,t),n(t,i,r)})}},Object.defineProperty(t,"Lt",{value:!0})}';
25
+ const o = 'function(t){\n/*!\n Feature Filter by\n\n (c) mapbox 2016 and maptalks 2018\n www.mapbox.com | www.maptalks.org\n License: MIT, header required.\n */\nconst n=["Unknown","Point","LineString","Polygon","MultiPoint","MultiLineString","MultiPolygon","GeometryCollection"];function i(t){return new Function("f","var p = (f && f.properties || {}); return "+e(t))}function e(t){if(!t)return"true";const n=t[0];if(t.length<=1)return"any"===n?"false":"true";return`(${"=="===n?s(t[1],t[2],"===",!1):"!="===n?s(t[1],t[2],"!==",!1):"<"===n||">"===n||"<="===n||">="===n?s(t[1],t[2],n,!0):"any"===n?o(t.slice(1),"||"):"all"===n?o(t.slice(1),"&&"):"none"===n?u(o(t.slice(1),"||")):"in"===n?a(t[1],t.slice(2)):"!in"===n?u(a(t[1],t.slice(2))):"has"===n?h(t[1]):"!has"===n?u(h(t[1])):"true"})`}function r(t){return"$"===t[0]?"f."+t.substring(1):"p["+JSON.stringify(t)+"]"}function s(t,i,e,s){const o=r(t),a="$type"===t?n.indexOf(i):JSON.stringify(i);return(s?`typeof ${o}=== typeof ${a}&&`:"")+o+e+a}function o(t,n){return t.map(e).join(n)}function a(t,i){"$type"===t&&(i=i.map(t=>n.indexOf(t)));const e=JSON.stringify(i.sort(l)),s=r(t);return i.length<=200?`${e}.indexOf(${s}) !== -1`:`function(v, a, i, j) {\\n while (i <= j) { var m = (i + j) >> 1;\\n if (a[m] === v) return true; if (a[m] > v) j = m - 1; else i = m + 1;\\n }\\n return false; }(${s}, ${e},0,${i.length-1})`}function h(t){return"$id"===t?\'"id" in f\':JSON.stringify(t)+" in p"}function u(t){return`!(${t})`}function l(t,n){return t<n?-1:t>n?1:0}function c(t){for(let n=1;n<arguments.length;n++){const i=arguments[n];for(const n in i)t[n]=i[n]}return t}function f(t,n){for(let i=0;i<t.stops.length;i++)if(n===t.stops[i][0])return t.stops[i][1];return t.default}function d(t,n){for(var i=0;i<t.stops.length&&!(n<t.stops[i][0]);i++);return t.stops[Math.max(i-1,0)][1]}function y(t,n){for(var i=void 0!==t.base?t.base:1,e=0;!(e>=t.stops.length||n<=t.stops[e][0]);)e++;return 0===e?t.stops[e][1]:e===t.stops.length?t.stops[e-1][1]:function t(n,i,e,r,s,o){return"function"==typeof s?function(){var a=s.apply(void 0,arguments),h=o.apply(void 0,arguments);return t(n,i,e,r,a,h)}:s.length?function(t,n,i,e,r,s){var o=[];for(let a=0;a<r.length;a++)o[a]=p(t,n,i,e,r[a],s[a]);return o}(n,i,e,r,s,o):p(n,i,e,r,s,o)}(n,i,t.stops[e-1][0],t.stops[e][0],t.stops[e-1][1],t.stops[e][1])}function v(t,n){return function(t,n,i){return void 0!==t?t:void 0!==n?n:void 0!==i?i:null}(n,t.default)}function p(t,n,i,e,r,s){var o,a=e-i,h=t-i;return r*(1-(o=1===n?h/a:(Math.pow(n,h)-1)/(Math.pow(n,a)-1)))+s*o}function m(t){return t&&"object"==typeof t&&(t.stops||t.property&&"identity"===t.type)}function g(t){return b(t,"exponential")}function w(t){return b(t,"interval")}function M(t,n){if(!t)return null;var i=!1;if(Array.isArray(t)){var e,r=[];for(let s=0;s<t.length;s++)(e=M(t[s],n))?(r.push(e),i=!0):r.push(t[s]);return i?r:t}var s,o={__fn_types_loaded:!0},a=[];for(s in t)t.hasOwnProperty(s)&&a.push(s);const h=function(t){Object.defineProperty(o,t,{get:function(){return this["__fn_"+t]||(this["__fn_"+t]=g(this["_"+t])),this["__fn_"+t].apply(this,n())},set:function(n){this["_"+t]=n},configurable:!0,enumerable:!0})};for(let n=0,e=a.length;n<e;n++)m(t[s=a[n]])?(i=!0,o["_"+s]=t[s],h(s)):o[s]=t[s];return i?o:t}function b(t,n){if(!m(t))return function(){return t};let i=!0,e=!0;const r=(t=JSON.parse(JSON.stringify(t))).stops;if(r)for(let t=0;t<r.length;t++)if(m(r[t][1])){const s=b(r[t][1],n);i=i&&s.isZoomConstant,e=e&&s.isFeatureConstant,r[t]=[r[t][0],s]}const s=function t(n,i){var e,r,s;if(m(n)){var o,a=n.stops&&"object"==typeof n.stops[0][0],h=a||void 0!==n.property,u=a||!h,l=n.type||i||"exponential";if("exponential"===l)o=y;else if("interval"===l)o=d;else if("categorical"===l)o=f;else{if("identity"!==l)throw new Error(\'Unknown function type "\'+l+\'"\');o=v}if(a){var c={},p=[];for(let t=0;t<n.stops.length;t++){var g=n.stops[t];void 0===c[g[0].zoom]&&(c[g[0].zoom]={zoom:g[0].zoom,type:n.type,property:n.property,default:n.default,stops:[]}),c[g[0].zoom].stops.push([g[0].value,g[1]])}for(let n in c)p.push([c[n].zoom,t(c[n])]);e=function(t,i){const e=y({stops:p,base:n.base},t)(t,i);return"function"==typeof e?e(t,i):e},r=!1,s=!1}else u?(e=function(t){const i=o(n,t);return"function"==typeof i?i(t):i},r=!0,s=!1):(e=function(t,i){const e=o(n,i?i[n.property]:null);return"function"==typeof e?e(t,i):e},r=!1,s=!0)}else e=function(){return n},r=!0,s=!0;return e.isZoomConstant=s,e.isFeatureConstant=r,e}(t,n);return s.isZoomConstant=i&&s.isZoomConstant,s.isFeatureConstant=e&&s.isFeatureConstant,s}let x=0;const F="function"==typeof Object.assign;function A(t,...n){if(F)return Object.assign(t,...n),t;for(let i=0;i<n.length;i++){const e=n[i];for(const n in e)t[n]=e[n]}return t}function k(t){return!O(t)&&("string"==typeof t||null!==t.constructor&&t.constructor===String)}function P(t){return"number"==typeof t&&!isNaN(t)}function S(t){return!O(t)&&("function"==typeof t||null!==t.constructor&&t.constructor===Function)}function _(t){return!Array.isArray(t)&&"object"==typeof t&&!!t}function O(t){return null==t}function I(t){for(let n=1;n<arguments.length;n++){const i=arguments[n];if(i)for(let n=0,e=i.length;n<e;n++)t.push(i[n])}return t.length}function T(t){return t<65536?Uint16Array:Uint32Array}function L(t){return t<256?Uint8Array:t<65536?Uint16Array:Uint32Array}function U(t){return(t=Math.abs(t))<128?Int8Array:t<32768?Int16Array:Float32Array}function z(t){return function t(n){if(!Array.isArray(n))return t([n]);const e=[];for(let t=0;t<n.length;t++){let r;r=!0===n[t].filter?function(){return!0}:i(n[t].filter),e.push(c({},n[t],{filter:r}))}return e}(t=t.map(t=>{const n=A({},t);return n.filter&&n.filter.value&&(n.filter=n.filter.value),n}))}function D(t){return m(t)&&t.property}const E="function"==typeof fetch&&"function"==typeof AbortController,C={jsonp:function(t,n){const i="_maptalks_jsonp_"+x++;t.match(/\\?/)?t+="&callback="+i:t+="?callback="+i;let e=document.createElement("script");return e.type="text/javascript",e.src=t,window[i]=function(t){n(null,t),document.getElementsByTagName("head")[0].removeChild(e),e=null,delete window[i]},document.getElementsByTagName("head")[0].appendChild(e),this},get:function(t,n,i){if(S(n)){const t=i;i=n,n=t}(n=n||{}).method&&(n.method=n.method.toUpperCase());const e="POST"===n.method;if(E){const r=new AbortController,s={signal:r.signal,method:n.method||"GET",referrerPolicy:"origin"};return e&&(O(n.body)||(s.body=JSON.stringify(n.body))),O(n.headers)||(s.headers=n.headers),O(n.credentials)||(s.credentials=n.credentials),fetch(t,s).then(t=>{const e=this.t(t,n.returnJSON,n.responseType);e.message?i(e):e.then(e=>{"arraybuffer"===n.responseType?i(null,{data:e,cacheControl:t.headers.get("Cache-Control"),expires:t.headers.get("Expires"),contentType:t.headers.get("Content-Type")}):i(null,e)}).catch(t=>{t.code&&t.code===DOMException.ABORT_ERR||(console.error(t),i(t))})}).catch(t=>{t.code&&t.code===DOMException.ABORT_ERR||(console.error(t),i(t))}),r}{const r=C.s(i);if(r.open(n.method||"GET",t,!0),n){for(const t in n.headers)r.setRequestHeader(t,n.headers[t]);r.withCredentials="include"===n.credentials,n.responseType&&(r.responseType=n.responseType)}return r.send(e?n.body:null),r}},t:(t,n,i)=>200!==t.status?{status:t.status,statusText:t.statusText,message:`incorrect http request with status code(${t.status}): ${t.statusText}`}:"arraybuffer"===i?t.arrayBuffer():n?t.json():t.text(),o:function(t,n){return function(){if(4===t.readyState)if(200===t.status)if("arraybuffer"===t.responseType){0===t.response.byteLength?n({status:200,statusText:t.statusText,message:"http status 200 returned without content."}):n(null,{data:t.response,cacheControl:t.getResponseHeader("Cache-Control"),expires:t.getResponseHeader("Expires"),contentType:t.getResponseHeader("Content-Type")})}else n(null,t.responseText);else n({status:t.status,statusText:t.statusText,message:`incorrect http request with status code(${t.status}): ${t.statusText}`})}},s:function(t){let n;try{n=new XMLHttpRequest}catch(t){try{n=new ActiveXObject("Msxml2.XMLHTTP")}catch(t){try{n=new ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}}return n.onreadystatechange=C.o(n,t),n},getArrayBuffer(t,n,i){if(S(n)){const t=i;i=n,n=t}return n||(n={}),n.responseType="arraybuffer",C.get(t,n,i)}};function j(t,n,i,e,r,s){var o=r-i,a=s-e;if(0!==o||0!==a){var h=((t-i)*o+(n-e)*a)/(o*o+a*a);h>1?(i=r,e=s):h>0&&(i+=o*h,e+=a*h)}return(o=t-i)*o+(a=n-e)*a}function N(t,n,i,e){var r={id:void 0===t?null:t,type:n,geometry:i,tags:e,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(t){var n=t.geometry,i=t.type;if("Point"===i||"MultiPoint"===i||"LineString"===i)H(t,n);else if("Polygon"===i||"MultiLineString"===i)for(var e=0;e<n.length;e++)H(t,n[e]);else if("MultiPolygon"===i)for(e=0;e<n.length;e++)for(var r=0;r<n[e].length;r++)H(t,n[e][r])}(r),r}function H(t,n){for(var i=0;i<n.length;i+=3)t.minX=Math.min(t.minX,n[i]),t.minY=Math.min(t.minY,n[i+1]),t.maxX=Math.max(t.maxX,n[i]),t.maxY=Math.max(t.maxY,n[i+1])}function V(t,n,i,e){if(n.geometry){var r=n.geometry.coordinates,s=n.geometry.type,o=Math.pow(i.tolerance/((1<<i.maxZoom)*i.extent),2),a=[],h=n.id;if(i.promoteId?h=n.properties[i.promoteId]:i.generateId&&(h=e||0),"Point"===s)R(r,a);else if("MultiPoint"===s)for(var u=0;u<r.length;u++)R(r[u],a);else if("LineString"===s)$(r,a,o,!1);else if("MultiLineString"===s){if(i.lineMetrics){for(u=0;u<r.length;u++)a=[],$(r[u],a,o,!1),t.push(N(h,"LineString",a,n.properties));return}W(r,a,o,!1)}else if("Polygon"===s)W(r,a,o,!0);else{if("MultiPolygon"!==s){if("GeometryCollection"===s){for(u=0;u<n.geometry.geometries.length;u++)V(t,{id:h,geometry:n.geometry.geometries[u],properties:n.properties},i,e);return}throw new Error("Input data is not a valid GeoJSON object.")}for(u=0;u<r.length;u++){var l=[];W(r[u],l,o,!0),a.push(l)}}t.push(N(h,s,a,n.properties))}}function R(t,n){n.push(q(t[0])),n.push(B(t[1])),n.push(0)}function $(t,n,i,e){for(var r,s,o=0,a=0;a<t.length;a++){var h=q(t[a][0]),u=B(t[a][1]);n.push(h),n.push(u),n.push(0),a>0&&(o+=e?(r*u-h*s)/2:Math.sqrt(Math.pow(h-r,2)+Math.pow(u-s,2))),r=h,s=u}var l=n.length-3;n[2]=1,function t(n,i,e,r){for(var s,o=r,a=e-i>>1,h=e-i,u=n[i],l=n[i+1],c=n[e],f=n[e+1],d=i+3;d<e;d+=3){var y=j(n[d],n[d+1],u,l,c,f);if(y>o)s=d,o=y;else if(y===o){var v=Math.abs(d-a);v<h&&(s=d,h=v)}}o>r&&(s-i>3&&t(n,i,s,r),n[s+2]=o,e-s>3&&t(n,s,e,r))}(n,0,l,i),n[l+2]=1,n.size=Math.abs(o),n.start=0,n.end=n.size}function W(t,n,i,e){for(var r=0;r<t.length;r++){var s=[];$(t[r],s,i,e),n.push(s)}}function q(t){return t/360+.5}function B(t){var n=Math.sin(t*Math.PI/180),i=.5-.25*Math.log((1+n)/(1-n))/Math.PI;return i<0?0:i>1?1:i}function G(t,n,i,e,r,s,o,a){if(e/=n,s>=(i/=n)&&o<e)return t;if(o<i||s>=e)return null;for(var h=[],u=0;u<t.length;u++){var l=t[u],c=l.geometry,f=l.type,d=0===r?l.minX:l.minY,y=0===r?l.maxX:l.maxY;if(d>=i&&y<e)h.push(l);else if(!(y<i||d>=e)){var v=[];if("Point"===f||"MultiPoint"===f)J(c,v,i,e,r);else if("LineString"===f)X(c,v,i,e,r,!1,a.lineMetrics);else if("MultiLineString"===f)Y(c,v,i,e,r,!1);else if("Polygon"===f)Y(c,v,i,e,r,!0);else if("MultiPolygon"===f)for(var p=0;p<c.length;p++){var m=[];Y(c[p],m,i,e,r,!0),m.length&&v.push(m)}if(v.length){if(a.lineMetrics&&"LineString"===f){for(p=0;p<v.length;p++)h.push(N(l.id,f,v[p],l.tags));continue}"LineString"!==f&&"MultiLineString"!==f||(1===v.length?(f="LineString",v=v[0]):f="MultiLineString"),"Point"!==f&&"MultiPoint"!==f||(f=3===v.length?"Point":"MultiPoint"),h.push(N(l.id,f,v,l.tags))}}}return h.length?h:null}function J(t,n,i,e,r){for(var s=0;s<t.length;s+=3){var o=t[s+r];o>=i&&o<=e&&(n.push(t[s]),n.push(t[s+1]),n.push(t[s+2]))}}function X(t,n,i,e,r,s,o){for(var a,h,u=Z(t),l=0===r?Q:tt,c=t.start,f=0;f<t.length-3;f+=3){var d=t[f],y=t[f+1],v=t[f+2],p=t[f+3],m=t[f+4],g=0===r?d:y,w=0===r?p:m,M=!1;o&&(a=Math.sqrt(Math.pow(d-p,2)+Math.pow(y-m,2))),g<i?w>i&&(h=l(u,d,y,p,m,i),o&&(u.start=c+a*h)):g>e?w<e&&(h=l(u,d,y,p,m,e),o&&(u.start=c+a*h)):K(u,d,y,v),w<i&&g>=i&&(h=l(u,d,y,p,m,i),M=!0),w>e&&g<=e&&(h=l(u,d,y,p,m,e),M=!0),!s&&M&&(o&&(u.end=c+a*h),n.push(u),u=Z(t)),o&&(c+=a)}var b=t.length-3;d=t[b],y=t[b+1],v=t[b+2],(g=0===r?d:y)>=i&&g<=e&&K(u,d,y,v),b=u.length-3,s&&b>=3&&(u[b]!==u[0]||u[b+1]!==u[1])&&K(u,u[0],u[1],u[2]),u.length&&n.push(u)}function Z(t){var n=[];return n.size=t.size,n.start=t.start,n.end=t.end,n}function Y(t,n,i,e,r,s){for(var o=0;o<t.length;o++)X(t[o],n,i,e,r,s,!1)}function K(t,n,i,e){t.push(n),t.push(i),t.push(e)}function Q(t,n,i,e,r,s){var o=(s-n)/(e-n);return t.push(s),t.push(i+(r-i)*o),t.push(1),o}function tt(t,n,i,e,r,s){var o=(s-i)/(r-i);return t.push(n+(e-n)*o),t.push(s),t.push(1),o}function nt(t,n){for(var i=[],e=0;e<t.length;e++){var r,s=t[e],o=s.type;if("Point"===o||"MultiPoint"===o||"LineString"===o)r=it(s.geometry,n);else if("MultiLineString"===o||"Polygon"===o){r=[];for(var a=0;a<s.geometry.length;a++)r.push(it(s.geometry[a],n))}else if("MultiPolygon"===o)for(r=[],a=0;a<s.geometry.length;a++){for(var h=[],u=0;u<s.geometry[a].length;u++)h.push(it(s.geometry[a][u],n));r.push(h)}i.push(N(s.id,o,r,s.tags))}return i}function it(t,n){var i=[];i.size=t.size,void 0!==t.start&&(i.start=t.start,i.end=t.end);for(var e=0;e<t.length;e+=3)i.push(t[e]+n,t[e+1],t[e+2]);return i}function et(t,n){if(t.transformed)return t;var i,e,r,s=1<<t.z,o=t.x,a=t.y;for(i=0;i<t.features.length;i++){var h=t.features[i],u=h.geometry,l=h.type;if(h.geometry=[],1===l)for(e=0;e<u.length;e+=2)h.geometry.push(rt(u[e],u[e+1],n,s,o,a));else for(e=0;e<u.length;e++){var c=[];for(r=0;r<u[e].length;r+=2)c.push(rt(u[e][r],u[e][r+1],n,s,o,a));h.geometry.push(c)}}return t.transformed=!0,t}function rt(t,n,i,e,r,s){return[Math.round(i*(t*e-r)),Math.round(i*(n*e-s))]}function st(t,n,i,e,r){for(var s=n===r.maxZoom?0:r.tolerance/((1<<n)*r.extent),o={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:i,y:e,z:n,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},a=0;a<t.length;a++){o.numFeatures++,ot(o,t[a],s,r);var h=t[a].minX,u=t[a].minY,l=t[a].maxX,c=t[a].maxY;h<o.minX&&(o.minX=h),u<o.minY&&(o.minY=u),l>o.maxX&&(o.maxX=l),c>o.maxY&&(o.maxY=c)}return o}function ot(t,n,i,e){var r=n.geometry,s=n.type,o=[];if("Point"===s||"MultiPoint"===s)for(var a=0;a<r.length;a+=3)o.push(r[a]),o.push(r[a+1]),t.numPoints++,t.numSimplified++;else if("LineString"===s)at(o,r,t,i,!1,!1);else if("MultiLineString"===s||"Polygon"===s)for(a=0;a<r.length;a++)at(o,r[a],t,i,"Polygon"===s,0===a);else if("MultiPolygon"===s)for(var h=0;h<r.length;h++){var u=r[h];for(a=0;a<u.length;a++)at(o,u[a],t,i,!0,0===a)}if(o.length){var l=n.tags||null;if("LineString"===s&&e.lineMetrics){for(var c in l={},n.tags)l[c]=n.tags[c];l.mapbox_clip_start=r.start/r.size,l.mapbox_clip_end=r.end/r.size}var f={geometry:o,type:"Polygon"===s||"MultiPolygon"===s?3:"LineString"===s||"MultiLineString"===s?2:1,tags:l};null!==n.id&&(f.id=n.id),t.features.push(f)}}function at(t,n,i,e,r,s){var o=e*e;if(e>0&&n.size<(r?o:e))i.numPoints+=n.length/3;else{for(var a=[],h=0;h<n.length;h+=3)(0===e||n[h+2]>o)&&(i.numSimplified++,a.push(n[h]),a.push(n[h+1])),i.numPoints++;r&&function(t,n){for(var i=0,e=0,r=t.length,s=r-2;e<r;s=e,e+=2)i+=(t[e]-t[s])*(t[e+1]+t[s+1]);if(i>0===n)for(e=0,r=t.length;e<r/2;e+=2){var o=t[e],a=t[e+1];t[e]=t[r-2-e],t[e+1]=t[r-1-e],t[r-2-e]=o,t[r-1-e]=a}}(a,s),t.push(a)}}function ht(t,n){var i=(n=this.options=function(t,n){for(var i in n)t[i]=n[i];return t}(Object.create(this.options),n)).debug;if(i&&console.time("preprocess data"),n.maxZoom<0||n.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(n.promoteId&&n.generateId)throw new Error("promoteId and generateId cannot be used together.");var e=function(t,n){var i=[];if("FeatureCollection"===t.type)for(var e=0;e<t.features.length;e++)V(i,t.features[e],n,e);else"Feature"===t.type?V(i,t,n):V(i,{geometry:t},n);return i}(t,n);this.tiles={},this.tileCoords=[],i&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",n.indexMaxZoom,n.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),(e=function(t,n){var i=n.buffer/n.extent,e=t,r=G(t,1,-1-i,i,0,-1,2,n),s=G(t,1,1-i,2+i,0,-1,2,n);return(r||s)&&(e=G(t,1,-i,1+i,0,-1,2,n)||[],r&&(e=nt(r,1).concat(e)),s&&(e=e.concat(nt(s,-1)))),e}(e,n)).length&&this.splitTile(e,0,0,0),i&&(e.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}function ut(t,n,i){return 32*((1<<t)*i+n)+t}function lt(t,n,i,e,r,s){const o=i&&Array.isArray(i[0]);for(let a=0,h=i.length;a<h;a++){t[n]=Math.round((o?i[a][0]:i[a].x)*e),t[n+1]=Math.round((o?i[a][1]:i[a].y)*e);let u=r||0;Array.isArray(r)&&(u=r[a]),u=u?Math.round(e*u):0,t[n+2]=u,n+=3,s&&0!==a&&a!==h-1&&(t[n]=t[n-3],t[n+1]=t[n-2],t[n+2]=t[n-1],n+=3)}return n}function ct(t,n,i,e){const r=t[3*n],s=t[3*n+1],o=t[3*i],a=t[3*i+1];return r===o&&(r<0||r>e)||s===a&&(s<0||s>e)}C.getJSON=function(t,n,i){if(S(n)){const t=i;i=n,n=t}const e=function(t,n){const e="string"==typeof n?JSON.parse(n):n||null;i(t,e)};return n&&n.jsonp?C.jsonp(t,e):((n=n||{}).returnJSON=!0,C.get(t,n,e))},ht.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},ht.prototype.splitTile=function(t,n,i,e,r,s,o){for(var a=[t,n,i,e],h=this.options,u=h.debug;a.length;){e=a.pop(),i=a.pop(),n=a.pop(),t=a.pop();var l=1<<n,c=ut(n,i,e),f=this.tiles[c];if(!f&&(u>1&&console.time("creation"),f=this.tiles[c]=st(t,n,i,e,h),this.tileCoords.push({z:n,x:i,y:e}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",n,i,e,f.numFeatures,f.numPoints,f.numSimplified),console.timeEnd("creation"));var d="z"+n;this.stats[d]=(this.stats[d]||0)+1,this.total++}if(f.source=t,r){if(n===h.maxZoom||n===r)continue;var y=1<<r-n;if(i!==Math.floor(s/y)||e!==Math.floor(o/y))continue}else if(n===h.indexMaxZoom||f.numPoints<=h.indexMaxPoints)continue;if(f.source=null,0!==t.length){u>1&&console.time("clipping");var v,p,m,g,w,M,b=.5*h.buffer/h.extent,x=.5-b,F=.5+b,A=1+b;v=p=m=g=null,w=G(t,l,i-b,i+F,0,f.minX,f.maxX,h),M=G(t,l,i+x,i+A,0,f.minX,f.maxX,h),t=null,w&&(v=G(w,l,e-b,e+F,1,f.minY,f.maxY,h),p=G(w,l,e+x,e+A,1,f.minY,f.maxY,h),w=null),M&&(m=G(M,l,e-b,e+F,1,f.minY,f.maxY,h),g=G(M,l,e+x,e+A,1,f.minY,f.maxY,h),M=null),u>1&&console.timeEnd("clipping"),a.push(v||[],n+1,2*i,2*e),a.push(p||[],n+1,2*i,2*e+1),a.push(m||[],n+1,2*i+1,2*e),a.push(g||[],n+1,2*i+1,2*e+1)}}},ht.prototype.getTile=function(t,n,i){var e=this.options,r=e.extent,s=e.debug;if(t<0||t>24)return null;var o=1<<t,a=ut(t,n=(n%o+o)%o,i);if(this.tiles[a])return et(this.tiles[a],r);s>1&&console.log("drilling down to z%d-%d-%d",t,n,i);for(var h,u=t,l=n,c=i;!h&&u>0;)u--,l=Math.floor(l/2),c=Math.floor(c/2),h=this.tiles[ut(u,l,c)];return h&&h.source?(s>1&&console.log("found parent tile z%d-%d-%d",u,l,c),s>1&&console.time("drilling down"),this.splitTile(h.source,u,l,c,t,n,i),s>1&&console.timeEnd("drilling down"),this.tiles[a]?et(this.tiles[a],r):null):null};class ft{constructor(t,n){this.x=t,this.y=n}clone(){return new ft(this.x,this.y)}normalize(){const t=this.length();this.x/=t,this.y/=t}negate(){this.x=-this.x,this.y=-this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}diff(t){return new ft(this.x-t.x,this.y-t.y)}distance(t){const n=this.x-t.x,i=this.y-t.y;return Math.sqrt(n*n+i*i)}dot(t){return this.x*t.x+this.y*t.y}equals(t){return this.x===t.x&&this.y===t.y}orthogonal(){return new ft(this.y,-this.x)}}function dt(t,n,i){const e=(n.x-t.x)*(i.y-t.y)-(n.y-t.y)*(i.x-t.x);return e>1e-5?1:e<-1e-5?2:0}function yt(t,n,i,e){const r=n.x*e.y-n.y*e.x,s=i.x-t.x,o=i.y-t.y,a=(s*e.y-o*e.x)/r;return new ft(t.x+a*n.x,t.y+a*n.y)}const vt=[];function pt(t,n,i){let e=0;const r=[];for(let s=n;s<i;s+=3)vt[e]?(vt[e].x=t[s],vt[e].y=t[s+1]):vt[e]=new ft(t[s],t[s+1]),r.push(vt[e]),e++;const s=function(t){let n;this.UpdateOmbb=function(t,i,e,r,s,o,a,h){const u=yt(t,i,s,o),l=yt(e,r,s,o),c=yt(a,h,t,i),f=yt(a,h,e,r),d=u.distance(l)*u.distance(c);d<this.BestObbArea&&(n=[u,c,f,l],this.BestObbArea=d)},this.BestObbArea=Number.MAX_VALUE;const i=[];for(let n=0;n<t.length;n++)i.push(t[(n+1)%t.length].diff(t[n])),i[n].normalize();const e=new ft(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),r=new ft(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);let s,o,a,h;for(let n=0;n<t.length;n++){const i=t[n];i.x<e.x&&(e.x=i.x,s=n),i.x>r.x&&(r.x=i.x,o=n),i.y<e.y&&(e.y=i.y,h=n),i.y>r.y&&(r.y=i.y,a=n)}let u=new ft(0,-1),l=new ft(0,1),c=new ft(-1,0),f=new ft(1,0);for(let n=0;n<t.length;n++){const n=[Math.acos(u.dot(i[s])),Math.acos(l.dot(i[o])),Math.acos(c.dot(i[a])),Math.acos(f.dot(i[h]))];switch(n.indexOf(Math.min.apply(Math,n))){case 0:u=i[s].clone(),l=u.clone(),l.negate(),c=u.orthogonal(),f=c.clone(),f.negate(),s=(s+1)%t.length;break;case 1:l=i[o].clone(),u=l.clone(),u.negate(),c=u.orthogonal(),f=c.clone(),f.negate(),o=(o+1)%t.length;break;case 2:c=i[a].clone(),f=c.clone(),f.negate(),u=f.orthogonal(),l=u.clone(),l.negate(),a=(a+1)%t.length;break;case 3:f=i[h].clone(),c=f.clone(),c.negate(),u=f.orthogonal(),l=u.clone(),l.negate(),h=(h+1)%t.length}this.UpdateOmbb(t[s],u,t[o],l,t[a],c,t[h],f)}return n}(function(t){if(t.length<3)return t;let n=t[0];const i=[];for(let i=1;i<t.length;i++)(t[i].x<n.x||Math.abs(t[i].x-n.x)<1e-5&&t[i].y<n.y)&&(n=t[i]);let e=t[0];do{i.unshift(n.clone());for(let i=1;i<t.length;i++){const r=dt(n,e,t[i]);(e.equals(n)||1===r||0===r&&n.distance(t[i])>n.distance(e))&&(e=t[i])}n=e}while(!e.equals(i[i.length-1]));return i}(r)),o=s[0].distance(s[1]),a=s[1].distance(s[2]),h=s.map(t=>[t.x,t.y]);return h.push(+(a>o)),h}var mt="undefined"!=typeof Float32Array?Float32Array:Array;function gt(){var t=new mt(3);return mt!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function wt(t,n,i){var e=new mt(3);return e[0]=t,e[1]=n,e[2]=i,e}function Mt(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t}function bt(t,n,i,e){return t[0]=n,t[1]=i,t[2]=e,t}function xt(t,n,i){return t[0]=n[0]+i[0],t[1]=n[1]+i[1],t[2]=n[2]+i[2],t}function Ft(t,n,i){return t[0]=n[0]/i[0],t[1]=n[1]/i[1],t[2]=n[2]/i[2],t}function At(t,n){var i=n[0],e=n[1],r=n[2],s=i*i+e*e+r*r;return s>0&&(s=1/Math.sqrt(s),t[0]=n[0]*s,t[1]=n[1]*s,t[2]=n[2]*s),t}function kt(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]}function Pt(t,n,i){var e=n[0],r=n[1],s=n[2],o=i[0],a=i[1],h=i[2];return t[0]=r*h-s*a,t[1]=s*o-e*h,t[2]=e*a-r*o,t}var St=function(t,n,i){return t[0]=n[0]-i[0],t[1]=n[1]-i[1],t[2]=n[2]-i[2],t};function _t(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t}function Ot(t,n,i,e,r){return t[0]=n,t[1]=i,t[2]=e,t[3]=r,t}function It(){var t=new mt(4);return mt!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function Tt(t,n){var i=n[0]+n[4]+n[8],e=void 0;if(i>0)e=Math.sqrt(i+1),t[3]=.5*e,e=.5/e,t[0]=(n[5]-n[7])*e,t[1]=(n[6]-n[2])*e,t[2]=(n[1]-n[3])*e;else{var r=0;n[4]>n[0]&&(r=1),n[8]>n[3*r+r]&&(r=2);var s=(r+1)%3,o=(r+2)%3;e=Math.sqrt(n[3*r+r]-n[3*s+s]-n[3*o+o]+1),t[r]=.5*e,e=.5/e,t[3]=(n[3*s+o]-n[3*o+s])*e,t[s]=(n[3*s+r]+n[3*r+s])*e,t[o]=(n[3*o+r]+n[3*r+o])*e}return t}gt(),function(){var t,n=(t=new mt(4),mt!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t)}();var Lt,Ut=function(t,n,i){return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=n[3]*i,t},zt=function(t,n){var i=n[0],e=n[1],r=n[2],s=n[3],o=i*i+e*e+r*r+s*s;return o>0&&(o=1/Math.sqrt(o),t[0]=i*o,t[1]=e*o,t[2]=r*o,t[3]=s*o),t};function Dt(t,n){var i=n[0]-t[0],e=n[1]-t[1];return Math.sqrt(i*i+e*e)}function Et(t,n,i,e,r,s,o,a,h,u){0===t?function(t,n,i,e,r,s,o,a,h){const u=[0,0];for(let r=t;r<n;r+=3){const t=r/3*2,n=e[r],l=e[r+1];i[t]=u[0]+n*s*o/a,i[t+1]=u[1]-l*s*o/h}}(n,i,e,r,0,o,a,h,u):1===t&&function(t,n,i,e){const r=pt(e,t,n),s=r[4],o=r[s],a=r[s+1],h=r[s+2],u=(a[1]-o[1])/(a[0]-o[0]),l=(h[1]-a[1])/(h[0]-a[0]),c=Dt(o,a),f=Dt(a,h);for(let r=t;r<n;r+=3){const t=r/3*2,n=e[r],s=e[r+1];i[t]=jt(n,s,o,u,c),i[t+1]=-jt(n,s,a,l,f)}}(n,i,e,r)}gt(),wt(1,0,0),wt(0,1,0),It(),It(),Lt=new mt(9),mt!=Float32Array&&(Lt[1]=0,Lt[2]=0,Lt[3]=0,Lt[5]=0,Lt[6]=0,Lt[7]=0),Lt[0]=1,Lt[4]=1,Lt[8]=1,function(){var t=function(){var t=new mt(2);return mt!=Float32Array&&(t[0]=0,t[1]=0),t}()}();const Ct=[];function jt(t,n,i,e,r){return Ct[0]=(e*e*i[0]+e*(n-i[1])+t)/(e*e+1),Ct[1]=e*(Ct[0]-i[0])+i[1],Dt(i,Ct)/r}function Nt(t,n,i,e,r){const s=3*n[i-1],o=3*n[i-1]+1,a=t[s],h=t[o];return u=e,l=r,c=a,f=h,Math.sqrt((c-u)*(c-u)+(f-l)*(f-l));var u,l,c,f}"undefined"!=typeof undefinedThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof undefined?global:"undefined"!=typeof self&&self;var Ht=Vt;function Vt(t,n){this.x=t,this.y=n}function Rt(t,n,i){i=i||{},this.w=t||64,this.h=n||64,this.autoResize=!!i.autoResize,this.shelves=[],this.freebins=[],this.stats={},this.bins={},this.maxId=0}function $t(t,n,i){this.x=0,this.y=t,this.w=this.free=n,this.h=i}function Wt(t,n,i,e,r,s,o){this.id=t,this.x=n,this.y=i,this.w=e,this.h=r,this.maxw=s||e,this.maxh=o||r,this.refcount=0}Vt.prototype={clone:function(){return new Vt(this.x,this.y)},add:function(t){return this.clone().u(t)},sub:function(t){return this.clone().v(t)},multByPoint:function(t){return this.clone().m(t)},divByPoint:function(t){return this.clone().M(t)},mult:function(t){return this.clone().F(t)},div:function(t){return this.clone().A(t)},rotate:function(t){return this.clone().k(t)},rotateAround:function(t,n){return this.clone().P(t,n)},matMult:function(t){return this.clone().S(t)},unit:function(){return this.clone()._()},perp:function(){return this.clone().O()},round:function(){return this.clone().I()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var n=t.x-this.x,i=t.y-this.y;return n*n+i*i},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,n){return Math.atan2(this.x*n-this.y*t,this.x*t+this.y*n)},S:function(t){var n=t[0]*this.x+t[1]*this.y,i=t[2]*this.x+t[3]*this.y;return this.x=n,this.y=i,this},u:function(t){return this.x+=t.x,this.y+=t.y,this},v:function(t){return this.x-=t.x,this.y-=t.y,this},F:function(t){return this.x*=t,this.y*=t,this},A:function(t){return this.x/=t,this.y/=t,this},m:function(t){return this.x*=t.x,this.y*=t.y,this},M:function(t){return this.x/=t.x,this.y/=t.y,this},_:function(){return this.A(this.mag()),this},O:function(){var t=this.y;return this.y=this.x,this.x=-t,this},k:function(t){var n=Math.cos(t),i=Math.sin(t),e=n*this.x-i*this.y,r=i*this.x+n*this.y;return this.x=e,this.y=r,this},P:function(t,n){var i=Math.cos(t),e=Math.sin(t),r=n.x+i*(this.x-n.x)-e*(this.y-n.y),s=n.y+e*(this.x-n.x)+i*(this.y-n.y);return this.x=r,this.y=s,this},I:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},Vt.convert=function(t){return t instanceof Vt?t:Array.isArray(t)?new Vt(t[0],t[1]):t},Rt.prototype.pack=function(t,n){t=[].concat(t),n=n||{};for(var i,e,r,s,o=[],a=0;a<t.length;a++)if(i=t[a].w||t[a].width,e=t[a].h||t[a].height,r=t[a].id,i&&e){if(!(s=this.packOne(i,e,r)))continue;n.inPlace&&(t[a].x=s.x,t[a].y=s.y,t[a].id=s.id),o.push(s)}return this.shrink(),o},Rt.prototype.packOne=function(t,n,i){var e,r,s,o,a,h,u,l,c={freebin:-1,shelf:-1,waste:1/0},f=0;if("string"==typeof i||"number"==typeof i){if(e=this.getBin(i))return this.ref(e),e;"number"==typeof i&&(this.maxId=Math.max(i,this.maxId))}else i=++this.maxId;for(o=0;o<this.freebins.length;o++){if(n===(e=this.freebins[o]).maxh&&t===e.maxw)return this.allocFreebin(o,t,n,i);n>e.maxh||t>e.maxw||n<=e.maxh&&t<=e.maxw&&(s=e.maxw*e.maxh-t*n)<c.waste&&(c.waste=s,c.freebin=o)}for(o=0;o<this.shelves.length;o++)if(f+=(r=this.shelves[o]).h,!(t>r.free)){if(n===r.h)return this.allocShelf(o,t,n,i);n>r.h||n<r.h&&(s=(r.h-n)*t)<c.waste&&(c.freebin=-1,c.waste=s,c.shelf=o)}return-1!==c.freebin?this.allocFreebin(c.freebin,t,n,i):-1!==c.shelf?this.allocShelf(c.shelf,t,n,i):n<=this.h-f&&t<=this.w?(r=new $t(f,this.w,n),this.allocShelf(this.shelves.push(r)-1,t,n,i)):this.autoResize?(a=h=this.h,((u=l=this.w)<=a||t>u)&&(l=2*Math.max(t,u)),(a<u||n>a)&&(h=2*Math.max(n,a)),this.resize(l,h),this.packOne(t,n,i)):null},Rt.prototype.allocFreebin=function(t,n,i,e){var r=this.freebins.splice(t,1)[0];return r.id=e,r.w=n,r.h=i,r.refcount=0,this.bins[e]=r,this.ref(r),r},Rt.prototype.allocShelf=function(t,n,i,e){var r=this.shelves[t].alloc(n,i,e);return this.bins[e]=r,this.ref(r),r},Rt.prototype.shrink=function(){if(this.shelves.length>0){for(var t=0,n=0,i=0;i<this.shelves.length;i++){var e=this.shelves[i];n+=e.h,t=Math.max(e.w-e.free,t)}this.resize(t,n)}},Rt.prototype.getBin=function(t){return this.bins[t]},Rt.prototype.ref=function(t){if(1==++t.refcount){var n=t.h;this.stats[n]=1+(0|this.stats[n])}return t.refcount},Rt.prototype.unref=function(t){return 0===t.refcount?0:(0==--t.refcount&&(this.stats[t.h]--,delete this.bins[t.id],this.freebins.push(t)),t.refcount)},Rt.prototype.clear=function(){this.shelves=[],this.freebins=[],this.stats={},this.bins={},this.maxId=0},Rt.prototype.resize=function(t,n){this.w=t,this.h=n;for(var i=0;i<this.shelves.length;i++)this.shelves[i].resize(t);return!0},$t.prototype.alloc=function(t,n,i){if(t>this.free||n>this.h)return null;var e=this.x;return this.x+=t,this.free-=t,new Wt(i,e,this.y,t,n,t,this.h)},$t.prototype.resize=function(t){return this.free+=t-this.w,this.w=t,!0};var qt={exports:{}};qt.exports=function(){function t(t,n,i){var e=t[n];t[n]=t[i],t[i]=e}function n(t,n){return t<n?-1:t>n?1:0}return function(i,e,r,s,o){!function n(i,e,r,s,o){for(;s>r;){if(s-r>600){var a=s-r+1,h=e-r+1,u=Math.log(a),l=.5*Math.exp(2*u/3),c=.5*Math.sqrt(u*l*(a-l)/a)*(h-a/2<0?-1:1),f=Math.max(r,Math.floor(e-h*l/a+c)),d=Math.min(s,Math.floor(e+(a-h)*l/a+c));n(i,e,f,d,o)}var y=i[e],v=r,p=s;for(t(i,r,e),o(i[s],y)>0&&t(i,r,s);v<p;){for(t(i,v,p),v++,p--;o(i[v],y)<0;)v++;for(;o(i[p],y)>0;)p--}0===o(i[r],y)?t(i,r,p):(p++,t(i,p,s)),p<=e&&(r=p+1),e<=p&&(s=p-1)}}(i,e,r||0,s||i.length-1,o||n)}}();var Bt=qt.exports,Gt={exports:{}};function Jt(t,n){if(!(this instanceof Jt))return new Jt(t,n);if(this.data=t||[],this.length=this.data.length,this.compare=n||Xt,this.length>0)for(var i=(this.length>>1)-1;i>=0;i--)this.T(i)}function Xt(t,n){return t<n?-1:t>n?1:0}Gt.exports=Jt,Gt.exports.default=Jt,Jt.prototype={push:function(t){this.data.push(t),this.length++,this.L(this.length-1)},pop:function(){if(0!==this.length){var t=this.data[0];return this.length--,this.length>0&&(this.data[0]=this.data[this.length],this.T(0)),this.data.pop(),t}},peek:function(){return this.data[0]},L:function(t){for(var n=this.data,i=this.compare,e=n[t];t>0;){var r=t-1>>1,s=n[r];if(i(e,s)>=0)break;n[t]=s,t=r}n[t]=e},T:function(t){for(var n=this.data,i=this.compare,e=this.length>>1,r=n[t];t<e;){var s=1+(t<<1),o=s+1,a=n[s];if(o<this.length&&i(n[o],a)<0&&(s=o,a=n[o]),i(a,r)>=0)break;n[t]=a,t=s}n[t]=r}};var Zt=Gt.exports,Yt={exports:{}},Kt={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},Qt={exports:{}},tn=function(t){return!(!t||"string"==typeof t)&&(t instanceof Array||Array.isArray(t)||t.length>=0&&(t.splice instanceof Function||Object.getOwnPropertyDescriptor(t,t.length-1)&&"String"!==t.constructor.name))},nn=Array.prototype.concat,en=Array.prototype.slice,rn=Qt.exports=function(t){for(var n=[],i=0,e=t.length;i<e;i++){var r=t[i];tn(r)?n=nn.call(n,en.call(r)):n.push(r)}return n};rn.wrap=function(t){return function(){return t(rn(arguments))}};var sn=Kt,on=Qt.exports,an=Object.hasOwnProperty,hn={};for(var un in sn)an.call(sn,un)&&(hn[sn[un]]=un);var ln=Yt.exports={to:{},get:{}};function cn(t,n,i){return Math.min(Math.max(n,t),i)}function fn(t){var n=Math.round(t).toString(16).toUpperCase();return n.length<2?"0"+n:n}ln.get=function(t){var n,i;switch(t.substring(0,3).toLowerCase()){case"hsl":n=ln.get.hsl(t),i="hsl";break;case"hwb":n=ln.get.hwb(t),i="hwb";break;default:n=ln.get.rgb(t),i="rgb"}return n?{model:i,value:n}:null},ln.get.rgb=function(t){if(!t)return null;var n,i,e,r=[0,0,0,1];if(n=t.match(/^#([a-f0-9]{6})([a-f0-9]{2})?$/i)){for(e=n[2],n=n[1],i=0;i<3;i++){var s=2*i;r[i]=parseInt(n.slice(s,s+2),16)}e&&(r[3]=parseInt(e,16)/255)}else if(n=t.match(/^#([a-f0-9]{3,4})$/i)){for(e=(n=n[1])[3],i=0;i<3;i++)r[i]=parseInt(n[i]+n[i],16);e&&(r[3]=parseInt(e+e,16)/255)}else if(n=t.match(/^rgba?\\(\\s*([+-]?\\d+)(?=[\\s,])\\s*(?:,\\s*)?([+-]?\\d+)(?=[\\s,])\\s*(?:,\\s*)?([+-]?\\d+)\\s*(?:[,|\\/]\\s*([+-]?[\\d\\.]+)(%?)\\s*)?\\)$/)){for(i=0;i<3;i++)r[i]=parseInt(n[i+1],0);n[4]&&(n[5]?r[3]=.01*parseFloat(n[4]):r[3]=parseFloat(n[4]))}else{if(!(n=t.match(/^rgba?\\(\\s*([+-]?[\\d\\.]+)\\%\\s*,?\\s*([+-]?[\\d\\.]+)\\%\\s*,?\\s*([+-]?[\\d\\.]+)\\%\\s*(?:[,|\\/]\\s*([+-]?[\\d\\.]+)(%?)\\s*)?\\)$/)))return(n=t.match(/^(\\w+)$/))?"transparent"===n[1]?[0,0,0,0]:an.call(sn,n[1])?((r=sn[n[1]])[3]=1,r):null:null;for(i=0;i<3;i++)r[i]=Math.round(2.55*parseFloat(n[i+1]));n[4]&&(n[5]?r[3]=.01*parseFloat(n[4]):r[3]=parseFloat(n[4]))}for(i=0;i<3;i++)r[i]=cn(r[i],0,255);return r[3]=cn(r[3],0,1),r},ln.get.hsl=function(t){if(!t)return null;var n=t.match(/^hsla?\\(\\s*([+-]?(?:\\d{0,3}\\.)?\\d+)(?:deg)?\\s*,?\\s*([+-]?[\\d\\.]+)%\\s*,?\\s*([+-]?[\\d\\.]+)%\\s*(?:[,|\\/]\\s*([+-]?(?=\\.\\d|\\d)(?:0|[1-9]\\d*)?(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)\\s*)?\\)$/);if(n){var i=parseFloat(n[4]);return[(parseFloat(n[1])%360+360)%360,cn(parseFloat(n[2]),0,100),cn(parseFloat(n[3]),0,100),cn(isNaN(i)?1:i,0,1)]}return null},ln.get.hwb=function(t){if(!t)return null;var n=t.match(/^hwb\\(\\s*([+-]?\\d{0,3}(?:\\.\\d+)?)(?:deg)?\\s*,\\s*([+-]?[\\d\\.]+)%\\s*,\\s*([+-]?[\\d\\.]+)%\\s*(?:,\\s*([+-]?(?=\\.\\d|\\d)(?:0|[1-9]\\d*)?(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)\\s*)?\\)$/);if(n){var i=parseFloat(n[4]);return[(parseFloat(n[1])%360+360)%360,cn(parseFloat(n[2]),0,100),cn(parseFloat(n[3]),0,100),cn(isNaN(i)?1:i,0,1)]}return null},ln.to.hex=function(){var t=on(arguments);return"#"+fn(t[0])+fn(t[1])+fn(t[2])+(t[3]<1?fn(Math.round(255*t[3])):"")},ln.to.rgb=function(){var t=on(arguments);return t.length<4||1===t[3]?"rgb("+Math.round(t[0])+", "+Math.round(t[1])+", "+Math.round(t[2])+")":"rgba("+Math.round(t[0])+", "+Math.round(t[1])+", "+Math.round(t[2])+", "+t[3]+")"},ln.to.rgb.percent=function(){var t=on(arguments),n=Math.round(t[0]/255*100),i=Math.round(t[1]/255*100),e=Math.round(t[2]/255*100);return t.length<4||1===t[3]?"rgb("+n+"%, "+i+"%, "+e+"%)":"rgba("+n+"%, "+i+"%, "+e+"%, "+t[3]+")"},ln.to.hsl=function(){var t=on(arguments);return t.length<4||1===t[3]?"hsl("+t[0]+", "+t[1]+"%, "+t[2]+"%)":"hsla("+t[0]+", "+t[1]+"%, "+t[2]+"%, "+t[3]+")"},ln.to.hwb=function(){var t=on(arguments),n="";return t.length>=4&&1!==t[3]&&(n=", "+t[3]),"hwb("+t[0]+", "+t[1]+"%, "+t[2]+"%"+n+")"},ln.to.keyword=function(t){return hn[t.slice(0,3)]};var dn={exports:{}},yn=Kt,vn={};for(var pn in yn)yn.hasOwnProperty(pn)&&(vn[yn[pn]]=pn);var mn=dn.exports={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};for(var gn in mn)if(mn.hasOwnProperty(gn)){if(!("channels"in mn[gn]))throw new Error("missing channels property: "+gn);if(!("labels"in mn[gn]))throw new Error("missing channel labels property: "+gn);if(mn[gn].labels.length!==mn[gn].channels)throw new Error("channel and label counts mismatch: "+gn);var wn=mn[gn].channels,Mn=mn[gn].labels;delete mn[gn].channels,delete mn[gn].labels,Object.defineProperty(mn[gn],"channels",{value:wn}),Object.defineProperty(mn[gn],"labels",{value:Mn})}function bn(t,n){return Math.pow(t[0]-n[0],2)+Math.pow(t[1]-n[1],2)+Math.pow(t[2]-n[2],2)}mn.rgb.hsl=function(t){var n,i,e=t[0]/255,r=t[1]/255,s=t[2]/255,o=Math.min(e,r,s),a=Math.max(e,r,s),h=a-o;return a===o?n=0:e===a?n=(r-s)/h:r===a?n=2+(s-e)/h:s===a&&(n=4+(e-r)/h),(n=Math.min(60*n,360))<0&&(n+=360),i=(o+a)/2,[n,100*(a===o?0:i<=.5?h/(a+o):h/(2-a-o)),100*i]},mn.rgb.hsv=function(t){var n,i,e,r,s,o=t[0]/255,a=t[1]/255,h=t[2]/255,u=Math.max(o,a,h),l=u-Math.min(o,a,h),c=function(t){return(u-t)/6/l+.5};return 0===l?r=s=0:(s=l/u,n=c(o),i=c(a),e=c(h),o===u?r=e-i:a===u?r=1/3+n-e:h===u&&(r=2/3+i-n),r<0?r+=1:r>1&&(r-=1)),[360*r,100*s,100*u]},mn.rgb.hwb=function(t){var n=t[0],i=t[1],e=t[2];return[mn.rgb.hsl(t)[0],100*(1/255*Math.min(n,Math.min(i,e))),100*(e=1-1/255*Math.max(n,Math.max(i,e)))]},mn.rgb.cmyk=function(t){var n,i=t[0]/255,e=t[1]/255,r=t[2]/255;return[100*((1-i-(n=Math.min(1-i,1-e,1-r)))/(1-n)||0),100*((1-e-n)/(1-n)||0),100*((1-r-n)/(1-n)||0),100*n]},mn.rgb.keyword=function(t){var n=vn[t];if(n)return n;var i,e=1/0;for(var r in yn)if(yn.hasOwnProperty(r)){var s=bn(t,yn[r]);s<e&&(e=s,i=r)}return i},mn.keyword.rgb=function(t){return yn[t]},mn.rgb.xyz=function(t){var n=t[0]/255,i=t[1]/255,e=t[2]/255;return[100*(.4124*(n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92)+.3576*(i=i>.04045?Math.pow((i+.055)/1.055,2.4):i/12.92)+.1805*(e=e>.04045?Math.pow((e+.055)/1.055,2.4):e/12.92)),100*(.2126*n+.7152*i+.0722*e),100*(.0193*n+.1192*i+.9505*e)]},mn.rgb.lab=function(t){var n=mn.rgb.xyz(t),i=n[0],e=n[1],r=n[2];return e/=100,r/=108.883,i=(i/=95.047)>.008856?Math.pow(i,1/3):7.787*i+16/116,[116*(e=e>.008856?Math.pow(e,1/3):7.787*e+16/116)-16,500*(i-e),200*(e-(r=r>.008856?Math.pow(r,1/3):7.787*r+16/116))]},mn.hsl.rgb=function(t){var n,i,e,r,s,o=t[0]/360,a=t[1]/100,h=t[2]/100;if(0===a)return[s=255*h,s,s];n=2*h-(i=h<.5?h*(1+a):h+a-h*a),r=[0,0,0];for(var u=0;u<3;u++)(e=o+1/3*-(u-1))<0&&e++,e>1&&e--,s=6*e<1?n+6*(i-n)*e:2*e<1?i:3*e<2?n+(i-n)*(2/3-e)*6:n,r[u]=255*s;return r},mn.hsl.hsv=function(t){var n=t[0],i=t[1]/100,e=t[2]/100,r=i,s=Math.max(e,.01);return i*=(e*=2)<=1?e:2-e,r*=s<=1?s:2-s,[n,100*(0===e?2*r/(s+r):2*i/(e+i)),100*((e+i)/2)]},mn.hsv.rgb=function(t){var n=t[0]/60,i=t[1]/100,e=t[2]/100,r=Math.floor(n)%6,s=n-Math.floor(n),o=255*e*(1-i),a=255*e*(1-i*s),h=255*e*(1-i*(1-s));switch(e*=255,r){case 0:return[e,h,o];case 1:return[a,e,o];case 2:return[o,e,h];case 3:return[o,a,e];case 4:return[h,o,e];case 5:return[e,o,a]}},mn.hsv.hsl=function(t){var n,i,e,r=t[0],s=t[1]/100,o=t[2]/100,a=Math.max(o,.01);return e=(2-s)*o,i=s*a,[r,100*(i=(i/=(n=(2-s)*a)<=1?n:2-n)||0),100*(e/=2)]},mn.hwb.rgb=function(t){var n,i,e,r,s,o,a,h=t[0]/360,u=t[1]/100,l=t[2]/100,c=u+l;switch(c>1&&(u/=c,l/=c),e=6*h-(n=Math.floor(6*h)),0!=(1&n)&&(e=1-e),r=u+e*((i=1-l)-u),n){default:case 6:case 0:s=i,o=r,a=u;break;case 1:s=r,o=i,a=u;break;case 2:s=u,o=i,a=r;break;case 3:s=u,o=r,a=i;break;case 4:s=r,o=u,a=i;break;case 5:s=i,o=u,a=r}return[255*s,255*o,255*a]},mn.cmyk.rgb=function(t){var n=t[0]/100,i=t[1]/100,e=t[2]/100,r=t[3]/100;return[255*(1-Math.min(1,n*(1-r)+r)),255*(1-Math.min(1,i*(1-r)+r)),255*(1-Math.min(1,e*(1-r)+r))]},mn.xyz.rgb=function(t){var n,i,e,r=t[0]/100,s=t[1]/100,o=t[2]/100;return i=-.9689*r+1.8758*s+.0415*o,e=.0557*r+-.204*s+1.057*o,n=(n=3.2406*r+-1.5372*s+-.4986*o)>.0031308?1.055*Math.pow(n,1/2.4)-.055:12.92*n,i=i>.0031308?1.055*Math.pow(i,1/2.4)-.055:12.92*i,e=e>.0031308?1.055*Math.pow(e,1/2.4)-.055:12.92*e,[255*(n=Math.min(Math.max(0,n),1)),255*(i=Math.min(Math.max(0,i),1)),255*(e=Math.min(Math.max(0,e),1))]},mn.xyz.lab=function(t){var n=t[0],i=t[1],e=t[2];return i/=100,e/=108.883,n=(n/=95.047)>.008856?Math.pow(n,1/3):7.787*n+16/116,[116*(i=i>.008856?Math.pow(i,1/3):7.787*i+16/116)-16,500*(n-i),200*(i-(e=e>.008856?Math.pow(e,1/3):7.787*e+16/116))]},mn.lab.xyz=function(t){var n,i,e,r=t[0];n=t[1]/500+(i=(r+16)/116),e=i-t[2]/200;var s=Math.pow(i,3),o=Math.pow(n,3),a=Math.pow(e,3);return i=s>.008856?s:(i-16/116)/7.787,n=o>.008856?o:(n-16/116)/7.787,e=a>.008856?a:(e-16/116)/7.787,[n*=95.047,i*=100,e*=108.883]},mn.lab.lch=function(t){var n,i=t[0],e=t[1],r=t[2];return(n=360*Math.atan2(r,e)/2/Math.PI)<0&&(n+=360),[i,Math.sqrt(e*e+r*r),n]},mn.lch.lab=function(t){var n,i=t[0],e=t[1];return n=t[2]/360*2*Math.PI,[i,e*Math.cos(n),e*Math.sin(n)]},mn.rgb.ansi16=function(t){var n=t[0],i=t[1],e=t[2],r=1 in arguments?arguments[1]:mn.rgb.hsv(t)[2];if(0===(r=Math.round(r/50)))return 30;var s=30+(Math.round(e/255)<<2|Math.round(i/255)<<1|Math.round(n/255));return 2===r&&(s+=60),s},mn.hsv.ansi16=function(t){return mn.rgb.ansi16(mn.hsv.rgb(t),t[2])},mn.rgb.ansi256=function(t){var n=t[0],i=t[1],e=t[2];return n===i&&i===e?n<8?16:n>248?231:Math.round((n-8)/247*24)+232:16+36*Math.round(n/255*5)+6*Math.round(i/255*5)+Math.round(e/255*5)},mn.ansi16.rgb=function(t){var n=t%10;if(0===n||7===n)return t>50&&(n+=3.5),[n=n/10.5*255,n,n];var i=.5*(1+~~(t>50));return[(1&n)*i*255,(n>>1&1)*i*255,(n>>2&1)*i*255]},mn.ansi256.rgb=function(t){if(t>=232){var n=10*(t-232)+8;return[n,n,n]}var i;return t-=16,[Math.floor(t/36)/5*255,Math.floor((i=t%36)/6)/5*255,i%6/5*255]},mn.rgb.hex=function(t){var n=(((255&Math.round(t[0]))<<16)+((255&Math.round(t[1]))<<8)+(255&Math.round(t[2]))).toString(16).toUpperCase();return"000000".substring(n.length)+n},mn.hex.rgb=function(t){var n=t.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!n)return[0,0,0];var i=n[0];3===n[0].length&&(i=i.split("").map((function(t){return t+t})).join(""));var e=parseInt(i,16);return[e>>16&255,e>>8&255,255&e]},mn.rgb.hcg=function(t){var n,i=t[0]/255,e=t[1]/255,r=t[2]/255,s=Math.max(Math.max(i,e),r),o=Math.min(Math.min(i,e),r),a=s-o;return n=a<=0?0:s===i?(e-r)/a%6:s===e?2+(r-i)/a:4+(i-e)/a+4,n/=6,[360*(n%=1),100*a,100*(a<1?o/(1-a):0)]},mn.hsl.hcg=function(t){var n=t[1]/100,i=t[2]/100,e=1,r=0;return(e=i<.5?2*n*i:2*n*(1-i))<1&&(r=(i-.5*e)/(1-e)),[t[0],100*e,100*r]},mn.hsv.hcg=function(t){var n=t[1]/100,i=t[2]/100,e=n*i,r=0;return e<1&&(r=(i-e)/(1-e)),[t[0],100*e,100*r]},mn.hcg.rgb=function(t){var n=t[0]/360,i=t[1]/100,e=t[2]/100;if(0===i)return[255*e,255*e,255*e];var r,s=[0,0,0],o=n%1*6,a=o%1,h=1-a;switch(Math.floor(o)){case 0:s[0]=1,s[1]=a,s[2]=0;break;case 1:s[0]=h,s[1]=1,s[2]=0;break;case 2:s[0]=0,s[1]=1,s[2]=a;break;case 3:s[0]=0,s[1]=h,s[2]=1;break;case 4:s[0]=a,s[1]=0,s[2]=1;break;default:s[0]=1,s[1]=0,s[2]=h}return r=(1-i)*e,[255*(i*s[0]+r),255*(i*s[1]+r),255*(i*s[2]+r)]},mn.hcg.hsv=function(t){var n=t[1]/100,i=n+t[2]/100*(1-n),e=0;return i>0&&(e=n/i),[t[0],100*e,100*i]},mn.hcg.hsl=function(t){var n=t[1]/100,i=t[2]/100*(1-n)+.5*n,e=0;return i>0&&i<.5?e=n/(2*i):i>=.5&&i<1&&(e=n/(2*(1-i))),[t[0],100*e,100*i]},mn.hcg.hwb=function(t){var n=t[1]/100,i=n+t[2]/100*(1-n);return[t[0],100*(i-n),100*(1-i)]},mn.hwb.hcg=function(t){var n=t[1]/100,i=1-t[2]/100,e=i-n,r=0;return e<1&&(r=(i-e)/(1-e)),[t[0],100*e,100*r]},mn.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]},mn.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]},mn.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]},mn.gray.hsl=mn.gray.hsv=function(t){return[0,0,t[0]]},mn.gray.hwb=function(t){return[0,100,t[0]]},mn.gray.cmyk=function(t){return[0,0,0,t[0]]},mn.gray.lab=function(t){return[t[0],0,0]},mn.gray.hex=function(t){var n=255&Math.round(t[0]/100*255),i=((n<<16)+(n<<8)+n).toString(16).toUpperCase();return"000000".substring(i.length)+i},mn.rgb.gray=function(t){return[(t[0]+t[1]+t[2])/3/255*100]};var xn=dn.exports;function Fn(t){var n=function(){for(var t={},n=Object.keys(xn),i=n.length,e=0;e<i;e++)t[n[e]]={distance:-1,parent:null};return t}(),i=[t];for(n[t].distance=0;i.length;)for(var e=i.pop(),r=Object.keys(xn[e]),s=r.length,o=0;o<s;o++){var a=r[o],h=n[a];-1===h.distance&&(h.distance=n[e].distance+1,h.parent=e,i.unshift(a))}return n}function An(t,n){return function(i){return n(t(i))}}function kn(t,n){for(var i=[n[t].parent,t],e=xn[n[t].parent][t],r=n[t].parent;n[r].parent;)i.unshift(n[r].parent),e=An(xn[n[r].parent][r],e),r=n[r].parent;return e.conversion=i,e}var Pn=dn.exports,Sn=function(t){for(var n=Fn(t),i={},e=Object.keys(n),r=e.length,s=0;s<r;s++){var o=e[s];null!==n[o].parent&&(i[o]=kn(o,n))}return i},_n={};Object.keys(Pn).forEach((function(t){_n[t]={},Object.defineProperty(_n[t],"channels",{value:Pn[t].channels}),Object.defineProperty(_n[t],"labels",{value:Pn[t].labels});var n=Sn(t);Object.keys(n).forEach((function(i){var e=n[i];_n[t][i]=function(t){var n=function(n){if(null==n)return n;arguments.length>1&&(n=Array.prototype.slice.call(arguments));var i=t(n);if("object"==typeof i)for(var e=i.length,r=0;r<e;r++)i[r]=Math.round(i[r]);return i};return"conversion"in t&&(n.conversion=t.conversion),n}(e),_n[t][i].raw=function(t){var n=function(n){return null==n?n:(arguments.length>1&&(n=Array.prototype.slice.call(arguments)),t(n))};return"conversion"in t&&(n.conversion=t.conversion),n}(e)}))}));var On=_n,In=Yt.exports,Tn=On,Ln=[].slice,Un=["keyword","gray","hex"],zn={};Object.keys(Tn).forEach((function(t){zn[Ln.call(Tn[t].labels).sort().join("")]=t}));var Dn={};function En(t,n){if(!(this instanceof En))return new En(t,n);if(n&&n in Un&&(n=null),n&&!(n in Tn))throw new Error("Unknown model: "+n);var i,e;if(null==t)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(t instanceof En)this.model=t.model,this.color=t.color.slice(),this.valpha=t.valpha;else if("string"==typeof t){var r=In.get(t);if(null===r)throw new Error("Unable to parse color from string: "+t);this.model=r.model,e=Tn[this.model].channels,this.color=r.value.slice(0,e),this.valpha="number"==typeof r.value[e]?r.value[e]:1}else if(t.length){this.model=n||"rgb",e=Tn[this.model].channels;var s=Ln.call(t,0,e);this.color=Hn(s,e),this.valpha="number"==typeof t[e]?t[e]:1}else if("number"==typeof t)t&=16777215,this.model="rgb",this.color=[t>>16&255,t>>8&255,255&t],this.valpha=1;else{this.valpha=1;var o=Object.keys(t);"alpha"in t&&(o.splice(o.indexOf("alpha"),1),this.valpha="number"==typeof t.alpha?t.alpha:0);var a=o.sort().join("");if(!(a in zn))throw new Error("Unable to parse color from object: "+JSON.stringify(t));this.model=zn[a];var h=Tn[this.model].labels,u=[];for(i=0;i<h.length;i++)u.push(t[h[i]]);this.color=Hn(u)}if(Dn[this.model])for(e=Tn[this.model].channels,i=0;i<e;i++){var l=Dn[this.model][i];l&&(this.color[i]=l(this.color[i]))}this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze&&Object.freeze(this)}function Cn(t,n,i){return(t=Array.isArray(t)?t:[t]).forEach((function(t){(Dn[t]||(Dn[t]=[]))[n]=i})),t=t[0],function(e){var r;return arguments.length?(i&&(e=i(e)),(r=this[t]()).color[n]=e,r):(r=this[t]().color[n],i&&(r=i(r)),r)}}function jn(t){return function(n){return Math.max(0,Math.min(t,n))}}function Nn(t){return Array.isArray(t)?t:[t]}function Hn(t,n){for(var i=0;i<n;i++)"number"!=typeof t[i]&&(t[i]=0);return t}En.prototype={toString:function(){return this.string()},toJSON:function(){return this[this.model]()},string:function(t){var n=this.model in In.to?this:this.rgb(),i=1===(n=n.round("number"==typeof t?t:1)).valpha?n.color:n.color.concat(this.valpha);return In.to[n.model](i)},percentString:function(t){var n=this.rgb().round("number"==typeof t?t:1),i=1===n.valpha?n.color:n.color.concat(this.valpha);return In.to.rgb.percent(i)},array:function(){return 1===this.valpha?this.color.slice():this.color.concat(this.valpha)},object:function(){for(var t={},n=Tn[this.model].channels,i=Tn[this.model].labels,e=0;e<n;e++)t[i[e]]=this.color[e];return 1!==this.valpha&&(t.alpha=this.valpha),t},unitArray:function(){var t=this.rgb().color;return t[0]/=255,t[1]/=255,t[2]/=255,1!==this.valpha&&t.push(this.valpha),t},unitObject:function(){var t=this.rgb().object();return t.r/=255,t.g/=255,t.b/=255,1!==this.valpha&&(t.alpha=this.valpha),t},round:function(t){return t=Math.max(t||0,0),new En(this.color.map(function(t){return function(n){return function(t,n){return Number(t.toFixed(n))}(n,t)}}(t)).concat(this.valpha),this.model)},alpha:function(t){return arguments.length?new En(this.color.concat(Math.max(0,Math.min(1,t))),this.model):this.valpha},red:Cn("rgb",0,jn(255)),green:Cn("rgb",1,jn(255)),blue:Cn("rgb",2,jn(255)),hue:Cn(["hsl","hsv","hsl","hwb","hcg"],0,(function(t){return(t%360+360)%360})),saturationl:Cn("hsl",1,jn(100)),lightness:Cn("hsl",2,jn(100)),saturationv:Cn("hsv",1,jn(100)),value:Cn("hsv",2,jn(100)),chroma:Cn("hcg",1,jn(100)),gray:Cn("hcg",2,jn(100)),white:Cn("hwb",1,jn(100)),wblack:Cn("hwb",2,jn(100)),cyan:Cn("cmyk",0,jn(100)),magenta:Cn("cmyk",1,jn(100)),yellow:Cn("cmyk",2,jn(100)),black:Cn("cmyk",3,jn(100)),x:Cn("xyz",0,jn(100)),y:Cn("xyz",1,jn(100)),z:Cn("xyz",2,jn(100)),l:Cn("lab",0,jn(100)),a:Cn("lab",1),b:Cn("lab",2),keyword:function(t){return arguments.length?new En(t):Tn[this.model].keyword(this.color)},hex:function(t){return arguments.length?new En(t):In.to.hex(this.rgb().round().color)},rgbNumber:function(){var t=this.rgb().color;return(255&t[0])<<16|(255&t[1])<<8|255&t[2]},luminosity:function(){for(var t=this.rgb().color,n=[],i=0;i<t.length;i++){var e=t[i]/255;n[i]=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4)}return.2126*n[0]+.7152*n[1]+.0722*n[2]},contrast:function(t){var n=this.luminosity(),i=t.luminosity();return n>i?(n+.05)/(i+.05):(i+.05)/(n+.05)},level:function(t){var n=this.contrast(t);return n>=7.1?"AAA":n>=4.5?"AA":""},isDark:function(){var t=this.rgb().color;return(299*t[0]+587*t[1]+114*t[2])/1e3<128},isLight:function(){return!this.isDark()},negate:function(){for(var t=this.rgb(),n=0;n<3;n++)t.color[n]=255-t.color[n];return t},lighten:function(t){var n=this.hsl();return n.color[2]+=n.color[2]*t,n},darken:function(t){var n=this.hsl();return n.color[2]-=n.color[2]*t,n},saturate:function(t){var n=this.hsl();return n.color[1]+=n.color[1]*t,n},desaturate:function(t){var n=this.hsl();return n.color[1]-=n.color[1]*t,n},whiten:function(t){var n=this.hwb();return n.color[1]+=n.color[1]*t,n},blacken:function(t){var n=this.hwb();return n.color[2]+=n.color[2]*t,n},grayscale:function(){var t=this.rgb().color,n=.3*t[0]+.59*t[1]+.11*t[2];return En.rgb(n,n,n)},fade:function(t){return this.alpha(this.valpha-this.valpha*t)},opaquer:function(t){return this.alpha(this.valpha+this.valpha*t)},rotate:function(t){var n=this.hsl(),i=n.color[0];return i=(i=(i+t)%360)<0?360+i:i,n.color[0]=i,n},mix:function(t,n){if(!t||!t.rgb)throw new Error(\'Argument to "mix" was not a Color instance, but rather an instance of \'+typeof t);var i=t.rgb(),e=this.rgb(),r=void 0===n?.5:n,s=2*r-1,o=i.alpha()-e.alpha(),a=((s*o==-1?s:(s+o)/(1+s*o))+1)/2,h=1-a;return En.rgb(a*i.red()+h*e.red(),a*i.green()+h*e.green(),a*i.blue()+h*e.blue(),i.alpha()*r+e.alpha()*(1-r))}},Object.keys(Tn).forEach((function(t){if(-1===Un.indexOf(t)){var n=Tn[t].channels;En.prototype[t]=function(){if(this.model===t)return new En(this);if(arguments.length)return new En(arguments,t);var i="number"==typeof arguments[n]?n:this.valpha;return new En(Nn(Tn[this.model][t].raw(this.color)).concat(i),t)},En[t]=function(i){return"number"==typeof i&&(i=Hn(Ln.call(arguments),n)),new En(i,t)}}}));var Vn=En;class Rn{constructor(t,n){this.position=t,this.index=n,this.faces=[],this.neighbors=[]}addUniqueNeighbor(t){-1===this.neighbors.indexOf(t)&&this.neighbors.push(t)}}class $n{constructor(t,n,i,e){this.a=e.a,this.b=e.b,this.c=e.c,this.v1=t,this.v2=n,this.v3=i,this.normal=[],this.computeNormal(),t.faces.push(this),t.addUniqueNeighbor(n),t.addUniqueNeighbor(i),n.faces.push(this),n.addUniqueNeighbor(t),n.addUniqueNeighbor(i),i.faces.push(this),i.addUniqueNeighbor(t),i.addUniqueNeighbor(n)}computeNormal(){const t=this.v1.position,n=this.v2.position,i=this.v3.position,e=Pt([],St([],i,n),St([],t,n));At(this.normal,e)}hasVertex(t){return t===this.v1||t===this.v2||t===this.v3}}\n/*!\n * Contains code from google filament\n * https://github.com/google/filament/\n * License Apache-2.0\n */const Wn=[],qn=[],Bn=[],Gn=[];function Jn(t,n,i){const e=Pt(qn,n,i);t=Tt(t,function(t,n,i,e,r,s,o,a,h,u){return t[0]=n,t[1]=i,t[2]=e,t[3]=r,t[4]=s,t[5]=o,t[6]=a,t[7]=h,t[8]=u,t}(Wn,i[0],i[1],i[2],...e,...n));if((t=function(t){return t[3]<0?Ut(t,t,-1):t}(t=zt(t,t)))[3]<1/32767){t[3]=1/32767;const n=Math.sqrt(.9999999990686206);t[0]*=n,t[1]*=n,t[2]*=n}const r=i[3]>0?Pt(Bn,i,n):Pt(Bn,n,i);return kt(Pt(Gn,i,n),r)<0&&Ut(t,t,-1),t}function Xn(t,n){const i=[],e=[];let r=0;for(r=0;r<t.length;r+=3){const n=new Rn([t[r],t[r+1],t[r+2]],r/3);i.push(n)}if(!n.length){const t=n;n=[];for(let i=0;i<t;i++)n.push(i)}for(r=0;r<n.length/3;r++){const t={a:n[3*r],b:n[3*r+1],c:n[3*r+2]};new $n(i[t.a],i[t.b],i[t.c],t)}const s=[],o=[0,0,0];for(r=0;r<i.length;r++){const t=i[r],n=t.index;bt(o,0,0,0);let a=t.faces.length;for(let n=0;n<a;n++)xt(o,o,t.faces[n].normal);a=a||1,bt(s,a,a,a),Ft(o,o,s),e[3*n]=o[0],e[3*n+1]=o[1],e[3*n+2]=o[2]}return e}\n/*!\n * Contains code from THREE.JS\n * https://github.com/mrdoob/three.js/\n * License MIT\n * \n * Generate tangents per vertex.\n */function Zn(t,n,i){return t[0]=n[i],t[1]=n[i+1],t[2]=n[i+2],t}function Yn(t,n,i){return t[0]=n[i],t[1]=n[i+1],t}var Kn={exports:{}};function Qn(t,n,i){i=i||2;var e,r,s,o,a,h,u,l=n&&n.length,c=l?n[0]*i:t.length,f=ti(t,0,c,i,!0),d=[];if(!f||f.next===f.prev)return d;if(l&&(f=function(t,n,i,e){var r,s,o,a,h,u=[];for(r=0,s=n.length;r<s;r++)o=n[r]*e,a=r<s-1?n[r+1]*e:t.length,(h=ti(t,o,a,e,!1))===h.next&&(h.steiner=!0),u.push(ci(h));for(u.sort(ai),r=0;r<u.length;r++)i=ni(i=hi(u[r],i),i.next);return i}(t,n,f,i)),t.length>80*i){e=s=t[0],r=o=t[1];for(var y=i;y<c;y+=i)(a=t[y])<e&&(e=a),(h=t[y+1])<r&&(r=h),a>s&&(s=a),h>o&&(o=h);u=0!==(u=Math.max(s-e,o-r))?1/u:0}return ii(f,d,i,e,r,u),d}function ti(t,n,i,e,r){var s,o;if(r===Ai(t,n,i,e)>0)for(s=n;s<i;s+=e)o=bi(s,t[s],t[s+1],o);else for(s=i-e;s>=n;s-=e)o=bi(s,t[s],t[s+1],o);return o&&vi(o,o.next)&&(xi(o),o=o.next),o}function ni(t,n){if(!t)return t;n||(n=t);var i,e=t;do{if(i=!1,e.steiner||!vi(e,e.next)&&0!==yi(e.prev,e,e.next))e=e.next;else{if(xi(e),(e=n=e.prev)===e.next)break;i=!0}}while(i||e!==n);return n}function ii(t,n,i,e,r,s,o){if(t){!o&&s&&function(t,n,i,e){var r=t;do{null===r.z&&(r.z=li(r.x,r.y,n,i,e)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){var n,i,e,r,s,o,a,h,u=1;do{for(i=t,t=null,s=null,o=0;i;){for(o++,e=i,a=0,n=0;n<u&&(a++,e=e.nextZ);n++);for(h=u;a>0||h>0&&e;)0!==a&&(0===h||!e||i.z<=e.z)?(r=i,i=i.nextZ,a--):(r=e,e=e.nextZ,h--),s?s.nextZ=r:t=r,r.prevZ=s,s=r;i=e}s.nextZ=null,u*=2}while(o>1)}(r)}(t,e,r,s);for(var a,h,u=t;t.prev!==t.next;)if(a=t.prev,h=t.next,s?ri(t,e,r,s):ei(t))n.push(a.i/i),n.push(t.i/i),n.push(h.i/i),xi(t),t=h.next,u=h.next;else if((t=h)===u){o?1===o?ii(t=si(ni(t),n,i),n,i,e,r,s,2):2===o&&oi(t,n,i,e,r,s):ii(ni(t),n,i,e,r,s,1);break}}}function ei(t){var n=t.prev,i=t,e=t.next;if(yi(n,i,e)>=0)return!1;for(var r=t.next.next;r!==t.prev;){if(fi(n.x,n.y,i.x,i.y,e.x,e.y,r.x,r.y)&&yi(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function ri(t,n,i,e){var r=t.prev,s=t,o=t.next;if(yi(r,s,o)>=0)return!1;for(var a=r.x<s.x?r.x<o.x?r.x:o.x:s.x<o.x?s.x:o.x,h=r.y<s.y?r.y<o.y?r.y:o.y:s.y<o.y?s.y:o.y,u=r.x>s.x?r.x>o.x?r.x:o.x:s.x>o.x?s.x:o.x,l=r.y>s.y?r.y>o.y?r.y:o.y:s.y>o.y?s.y:o.y,c=li(a,h,n,i,e),f=li(u,l,n,i,e),d=t.prevZ,y=t.nextZ;d&&d.z>=c&&y&&y.z<=f;){if(d!==t.prev&&d!==t.next&&fi(r.x,r.y,s.x,s.y,o.x,o.y,d.x,d.y)&&yi(d.prev,d,d.next)>=0)return!1;if(d=d.prevZ,y!==t.prev&&y!==t.next&&fi(r.x,r.y,s.x,s.y,o.x,o.y,y.x,y.y)&&yi(y.prev,y,y.next)>=0)return!1;y=y.nextZ}for(;d&&d.z>=c;){if(d!==t.prev&&d!==t.next&&fi(r.x,r.y,s.x,s.y,o.x,o.y,d.x,d.y)&&yi(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;y&&y.z<=f;){if(y!==t.prev&&y!==t.next&&fi(r.x,r.y,s.x,s.y,o.x,o.y,y.x,y.y)&&yi(y.prev,y,y.next)>=0)return!1;y=y.nextZ}return!0}function si(t,n,i){var e=t;do{var r=e.prev,s=e.next.next;!vi(r,s)&&pi(r,e,e.next,s)&&wi(r,s)&&wi(s,r)&&(n.push(r.i/i),n.push(e.i/i),n.push(s.i/i),xi(e),xi(e.next),e=t=s),e=e.next}while(e!==t);return ni(e)}function oi(t,n,i,e,r,s){var o=t;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&di(o,a)){var h=Mi(o,a);return o=ni(o,o.next),h=ni(h,h.next),ii(o,n,i,e,r,s),void ii(h,n,i,e,r,s)}a=a.next}o=o.next}while(o!==t)}function ai(t,n){return t.x-n.x}function hi(t,n){var i=function(t,n){var i,e=n,r=t.x,s=t.y,o=-1/0;do{if(s<=e.y&&s>=e.next.y&&e.next.y!==e.y){var a=e.x+(s-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(a<=r&&a>o){if(o=a,a===r){if(s===e.y)return e;if(s===e.next.y)return e.next}i=e.x<e.next.x?e:e.next}}e=e.next}while(e!==n);if(!i)return null;if(r===o)return i;var h,u=i,l=i.x,c=i.y,f=1/0;e=i;do{r>=e.x&&e.x>=l&&r!==e.x&&fi(s<c?r:o,s,l,c,s<c?o:r,s,e.x,e.y)&&(h=Math.abs(s-e.y)/(r-e.x),wi(e,t)&&(h<f||h===f&&(e.x>i.x||e.x===i.x&&ui(i,e)))&&(i=e,f=h)),e=e.next}while(e!==u);return i}(t,n);if(!i)return n;var e=Mi(i,t),r=ni(i,i.next);return ni(e,e.next),n===i?r:n}function ui(t,n){return yi(t.prev,t,n.prev)<0&&yi(n.next,t,t.next)<0}function li(t,n,i,e,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*r)|t<<8))|t<<4))|t<<2))|t<<1))|(n=1431655765&((n=858993459&((n=252645135&((n=16711935&((n=32767*(n-e)*r)|n<<8))|n<<4))|n<<2))|n<<1))<<1}function ci(t){var n=t,i=t;do{(n.x<i.x||n.x===i.x&&n.y<i.y)&&(i=n),n=n.next}while(n!==t);return i}function fi(t,n,i,e,r,s,o,a){return(r-o)*(n-a)-(t-o)*(s-a)>=0&&(t-o)*(e-a)-(i-o)*(n-a)>=0&&(i-o)*(s-a)-(r-o)*(e-a)>=0}function di(t,n){return t.next.i!==n.i&&t.prev.i!==n.i&&!function(t,n){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==n.i&&i.next.i!==n.i&&pi(i,i.next,t,n))return!0;i=i.next}while(i!==t);return!1}(t,n)&&(wi(t,n)&&wi(n,t)&&function(t,n){var i=t,e=!1,r=(t.x+n.x)/2,s=(t.y+n.y)/2;do{i.y>s!=i.next.y>s&&i.next.y!==i.y&&r<(i.next.x-i.x)*(s-i.y)/(i.next.y-i.y)+i.x&&(e=!e),i=i.next}while(i!==t);return e}(t,n)&&(yi(t.prev,t,n.prev)||yi(t,n.prev,n))||vi(t,n)&&yi(t.prev,t,t.next)>0&&yi(n.prev,n,n.next)>0)}function yi(t,n,i){return(n.y-t.y)*(i.x-n.x)-(n.x-t.x)*(i.y-n.y)}function vi(t,n){return t.x===n.x&&t.y===n.y}function pi(t,n,i,e){var r=gi(yi(t,n,i)),s=gi(yi(t,n,e)),o=gi(yi(i,e,t)),a=gi(yi(i,e,n));return r!==s&&o!==a||(!(0!==r||!mi(t,i,n))||(!(0!==s||!mi(t,e,n))||(!(0!==o||!mi(i,t,e))||!(0!==a||!mi(i,n,e)))))}function mi(t,n,i){return n.x<=Math.max(t.x,i.x)&&n.x>=Math.min(t.x,i.x)&&n.y<=Math.max(t.y,i.y)&&n.y>=Math.min(t.y,i.y)}function gi(t){return t>0?1:t<0?-1:0}function wi(t,n){return yi(t.prev,t,t.next)<0?yi(t,n,t.next)>=0&&yi(t,t.prev,n)>=0:yi(t,n,t.prev)<0||yi(t,t.next,n)<0}function Mi(t,n){var i=new Fi(t.i,t.x,t.y),e=new Fi(n.i,n.x,n.y),r=t.next,s=n.prev;return t.next=n,n.prev=t,i.next=r,r.prev=i,e.next=i,i.prev=e,s.next=e,e.prev=s,e}function bi(t,n,i,e){var r=new Fi(t,n,i);return e?(r.next=e.next,r.prev=e,e.next.prev=r,e.next=r):(r.prev=r,r.next=r),r}function xi(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Fi(t,n,i){this.i=t,this.x=n,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Ai(t,n,i,e){for(var r=0,s=n,o=i-e;s<i;s+=e)r+=(t[o]-t[s])*(t[s+1]+t[o+1]),o=s;return r}Kn.exports=Qn,Kn.exports.default=Qn,Qn.deviation=function(t,n,i,e){var r=n&&n.length,s=r?n[0]*i:t.length,o=Math.abs(Ai(t,0,s,i));if(r)for(var a=0,h=n.length;a<h;a++){var u=n[a]*i,l=a<h-1?n[a+1]*i:t.length;o-=Math.abs(Ai(t,u,l,i))}var c=0;for(a=0;a<e.length;a+=3){var f=e[a]*i,d=e[a+1]*i,y=e[a+2]*i;c+=Math.abs((t[f]-t[y])*(t[d+1]-t[f+1])-(t[f]-t[d])*(t[y+1]-t[f+1]))}return 0===o&&0===c?0:Math.abs((c-o)/o)},Qn.flatten=function(t){for(var n=t[0][0].length,i={vertices:[],holes:[],dimensions:n},e=0,r=0;r<t.length;r++){for(var s=0;s<t[r].length;s++)for(var o=0;o<n;o++)i.vertices.push(t[r][s][o]);r>0&&(e+=t[r-1].length,i.holes.push(e))}return i};var ki=Kn.exports;\n/*!\n * @maptalks/vector-packer v0.63.9\n * LICENSE : UNLICENSED\n * (c) 2016-2022 maptalks.com\n */const Pi={Point:1,LineString:2,Polygon:3,MultiPoint:4,MultiLineString:5,MultiPolygon:6};function Si(t,n={}){var i=[];if("FeatureCollection"===t.type)for(var e=0;e<t.features.length;e++)_i(i,t.features[e],n,e);else _i(i,"Feature"===t.type?t:{geometry:t},n);return i}function _i(t,n,i,e){if(n.geometry&&n.geometry.geometry){var r=n.geometry.coordinates,s=n.geometry.type,o=[],a=n.id;if(i.promoteId?a=n.properties[i.promoteId]:i.generateId&&(a=e||0),"Point"===s)Oi(r,o);else if("MultiPoint"===s)for(var h=0;h<r.length;h++)Oi(r[h],o);else if("LineString"===s)Ti([r],o);else if("MultiLineString"===s){if(i.lineMetrics){for(h=0;h<r.length;h++)Ii(r[h],o=[]),t.push(Li(a,"LineString",o,n.properties));return}Ti(r,o)}else if("Polygon"===s)Ti(r,o);else{if("MultiPolygon"!==s){if("GeometryCollection"===s){for(h=0;h<n.geometry.geometries.length;h++)_i(t,{id:a,geometry:n.geometry.geometries[h],properties:n.properties},i,e);return}return void console.warn(`Input data type(${s}) is not a valid GeoJSON geometry type.`)}for(h=0;h<r.length;h++){var u=[];Ti(r[h],u),o.push(u)}}t.push(Li(a,s,o,n.properties))}}function Oi(t,n){n.push([new Ht(t[0],t[1])])}function Ii(t,n){for(var i=0;i<t.length;i++)n.push(new Ht(t[i][0],t[i][1]))}function Ti(t,n,i,e){for(var r=0;r<t.length;r++){var s=[];Ii(t[r],s),n.push(s)}}function Li(t,n,i,e){return{id:void 0===t?null:t,type:Pi[n],geometry:i,properties:e}}\n/*!\n * Codes from mapbox-gl-js\n * github.com/mapbox/mapbox-gl-js\n * MIT License\n */function Ui(t,{width:n,height:i},e,r){if(r){if(r.length!==n*i*e)throw new RangeError("mismatched image size")}else r=new Uint8Array(n*i*e);return t.width=n,t.height=i,t.data=r,t}function zi(t,{width:n,height:i},e){if(n===t.width&&i===t.height)return;const r=Ui({},{width:n,height:i},e);Di(t,r,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,n),height:Math.min(t.height,i)},e),t.width=n,t.height=i,t.data=r.data}function Di(t,n,i,e,r,s){if(0===r.width||0===r.height)return n;if(r.width>t.width||r.height>t.height||i.x>t.width-r.width||i.y>t.height-r.height)throw new RangeError("out of range source coordinates for image copy");if(r.width>n.width||r.height>n.height||e.x>n.width-r.width||e.y>n.height-r.height)throw new RangeError("out of range destination coordinates for image copy");const o=t.data,a=n.data;if(o===a)return n;for(let h=0;h<r.height;h++){const u=((i.y+h)*t.width+i.x)*s,l=((e.y+h)*n.width+e.x)*s;for(let t=0;t<r.width*s;t++)a[l+t]=o[u+t]}return n}class Ei{constructor(t,n){Ui(this,t,1,n)}resize(t){zi(this,t,1)}clone(){return new Ei({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,n,i,e,r){Di(t,n,i,e,r,1)}}class Ci{constructor(t,n){Ui(this,t,4,n)}resize(t){zi(this,t,4)}clone(){return new Ci({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,n,i,e,r){Di(t,n,i,e,r,4)}}\n/*!\n * Codes from mapbox-gl-js\n * github.com/mapbox/mapbox-gl-js\n * MIT License\n */class ji{constructor(t,{pixelRatio:n}){this.paddedRect=t,this.pixelRatio=n||1}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}}class Ni{constructor(t){this.glyphMap=t,this.build()}build(){const t=this.glyphMap,n={},i=new Rt(0,0,{autoResize:!0}),e=[];for(const i in t){const r=t[i],s={x:0,y:0,w:r.data.width+2,h:r.data.height+2};e.push(s),n[i]=new ji(s,r)}if(i.pack(e,{inPlace:!0}),!Hi(i.w)||!Hi(i.h)){const t=Vi(i.w),n=Vi(i.h);i.resize(t,n)}const r=new Ci({width:i.w,height:i.h});for(const i in t){const e=t[i],s=n[i].paddedRect;Ci.copy(e.data,r,{x:0,y:0},{x:s.x+1,y:s.y+1},e.data)}this.image=r,this.positions=n}}function Hi(t){return 0==(t&t-1)&&0!==t}function Vi(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}\n/*!\n * Codes from mapbox-gl-js\n * github.com/mapbox/mapbox-gl-js\n * MIT License\n * TODO 升级为potpack\n */class Ri{constructor(t){this.glyphMap=t,this.build()}build(){const t=this.glyphMap,n={},i=new Rt(0,0,{autoResize:!0}),e=[];for(const i in t){const r=t[i],s=n[i]={};for(const t in r){const n=r[+t];if(!n||0===n.bitmap.width||0===n.bitmap.height)continue;const i={x:0,y:0,w:n.bitmap.width+2,h:n.bitmap.height+2};e.push(i),s[t]={rect:i,metrics:n.metrics}}}i.pack(e,{inPlace:!0});const r=new Ei({width:i.w,height:i.h});for(const i in t){const e=t[i];for(const t in e){const s=e[+t];if(!s||0===s.bitmap.width||0===s.bitmap.height)continue;const o=n[i][t].rect;Ei.copy(s.bitmap,r,{x:0,y:0},{x:o.x+1,y:o.y+1},s.bitmap)}}this.image=r,this.positions=n}}function $i(t){return t<65536?Uint16Array:Uint32Array}function Wi(t){return(t=Math.abs(t))<128?Int8Array:t<32768?Int16Array:Float32Array}function qi(t){return t<256?Uint8Array:t<65536?Uint16Array:Float32Array}function Bi(t){const n=t.type,i=[];if(1===n||4===n)for(let n=0;n<t.geometry.length;n++)Oi(t.geometry[n],i);else if(2===n)Ti(t.geometry,i);else if(3===n)Ti(t.geometry,i);else if(5===n)Ti(t.geometry,i);else if(6===n)for(let n=0;n<t.geometry.length;n++){const e=[];Ti(t.geometry[n],e),i.push(e)}return t.geometry=i,t}function Gi(t){for(let n=1;n<arguments.length;n++){const i=arguments[n];for(const n in i)t[n]=i[n]}return t}function Ji(t){return null==t}function Xi(t){return"number"==typeof t&&!isNaN(t)}function Zi(t){return"object"==typeof t&&!!t}function Yi(t){return!Ji(t)&&("string"==typeof t||null!==t.constructor&&t.constructor===String)}const Ki=Object.prototype.hasOwnProperty;function Qi(t,n){return Ki.call(t,n)}function te(t){return m(t)&&t.property}function ne(t){let n=0;for(let i,e,r=0,s=t.length,o=s-1;r<s;o=r++)i=t[r],e=t[o],n+=void 0!==i.x?(e.x-i.x)*(i.y+e.y):(e[0]-i[0])*(i[1]+e[1]);return n}function ie(t,n,i,e,r){const s=t[n*e],o=t[n*e+1],a=t[i*e],h=t[i*e+1];return s===a&&(s<0||s>r)&&o!==h||o===h&&(o<0||o>r)&&s!==a}function ee(t,n,i){let e=i;return n&&t&&(e=t[n]),void 0===e&&(e=i),10*(e||0)}function re(t,n,i,e,r,s,o){n||0===n||(n=1);const a=ee(t.properties,i,e),h=a*n;let u=a;return r?u=ee(t.properties,r,s):o&&(u=a-ee(t.properties,o,0)),u*=n,{altitude:h,height:u}}function se(t,n){return n<1/0&&(t.x<0||t.x>n||t.y<0||t.y>n)}function oe(t){return null==t}function ae(t,n,i){if(t===i||t===n)return t;const e=i-n;return((t-n)%e+e)%e+n}class he{constructor(t,n,i,e){this.feature=t,this.symbol=n,this.fnTypes=i,this.options=e}getPolygonResource(){let t=this.symbol.polygonPatternFile;const{polygonPatternFileFn:n}=this.fnTypes;return this.U(t,n)}getLineResource(){let t=this.symbol.linePatternFile;const{linePatternFileFn:n}=this.fnTypes;return this.U(t,n)}U(t,n){return n&&(t=n(this.options.zoom,this.feature.properties)),t}}const ue={lineWidth:1,lineStrokeWidth:1,lineDx:1,lineDy:1,lineOpacity:1,linePatternAnimSpeed:1,markerWidth:1,markerHeight:1,markerDx:1,markerDy:1,markerSpacing:1,markerOpacity:1,markerRotation:1,textWrapWidth:1,textSpacing:1,textSize:1,textHaloRadius:1,textHaloOpacity:1,textDx:1,textDy:1,textOpacity:1,textRotation:1,polygonOpacity:1};class le{static isAtlasLoaded(t,n={}){const{iconAtlas:i}=n;return!!(!t||i&&i.positions[t])}static genFnTypes(t){const n={};for(const i in t)if(te(t[i])){const e=(i+"_Fn_0").trim(),r=(i+"Fn").trim();ue[i]?(n[e]=g(t[i]),n[r]=(t,i)=>{const r=n[e](t,i);return te(r)?g(r)(t,i):r}):(n[e]=w(t[i]),n[r]=(t,i)=>{const r=n[e](t,i);return te(r)?w(r)(t,i):r})}return n}constructor(t,n,i){this.options=i,this.features=this.D(t),this.symbolDef=n,this.symbol=M(n,()=>[i.zoom]),this.styledVectors=[],this.properties={},this.C=le.genFnTypes(this.symbolDef),te(this.symbolDef.visible)&&(this.j=g(this.symbolDef.visible)),i.atlas&&(this.iconAtlas=i.atlas.iconAtlas,this.glyphAtlas=i.atlas.glyphAtlas)}D(t){if(!t.length)return t;const n="__fea_idx".trim();let e,r=0,s=t[r];for(;!s.geometry;)r++,s=t[r];if(Array.isArray(s.geometry)&&s.properties){let n=s.geometry[0];for(;Array.isArray(n);)n=n[0];n instanceof Ht&&(e=t)}if(!e)if(e=[],Array.isArray(s.geometry))for(let n=0;n<t.length;n++){const i=Gi({},t[n]);e.push(Bi(i))}else for(let i=0;i<t.length;i++){const r=t[i],s=Si(r);for(let t=0;t<s.length;t++){const i=s[t];i[n]=r[n],e.push(i)}}const o=this.options.order;if(o){const t=[];for(let n=0;n<o.length;n++)o[n]&&t.push(i(o[n]));e=e.sort((n,i)=>{const e=t.length;let r=e,s=e;for(let o=0;o<e&&(t[o](n)&&(r=o),t[o](i)&&(s=o),!(r<e&&s<e));o++);return r-s})}return e}load(t=1){const n="__fea_idx".trim(),i="_debug_info".trim(),e=this.C,r=this.styledVectors;this.count=0;const s=this.features;if(!s||!s.length)return Promise.resolve(null);const o={},a={},h={zoom:this.options.zoom},u=M(this.symbolDef,()=>[h.zoom]);let l=0,c=s.length;const f=this.options.debugIndex;try{for(;l<c;l++){const t=s[l];if(!t||!t.geometry)continue;if(void 0!==f&&t[i].index!==f)continue;t.properties||(t.properties={}),t.properties.$layer=t.layer,t.properties.$type=t.type;const c=this.createStyledVector(t,u,e,h,o,a);c&&c.feature.geometry&&(c.featureIdx=void 0===t[n]?l:t[n],this.count++,r.push(c))}}catch(t){return Promise.reject(t)}return this.options.atlas?Promise.resolve(this.pack(t)):this.loadAtlas(o,a).then(()=>this.pack(t))}loadAtlas(t,n){return new Promise((i,e)=>{this.fetchAtlas(t,n,(t,n)=>{if(t)e(t);else{if(n){const{icons:t,glyphs:i}=n;if(t&&Object.keys(t).length){for(const n in t){const i=t[n],{width:e,height:r,data:s}=i.data;i.data=new Ci({width:e,height:r},s)}this.iconAtlas=new Ni(t)}if(i&&Object.keys(i).length){for(const t in i){const n=i[t];for(const t in n){const i=n[t],{width:e,height:r,data:s}=i.bitmap;i.bitmap=new Ei({width:e,height:r},s)}}this.glyphAtlas=new Ri(i)}}i({glyphAtlas:this.glyphAtlas,iconAtlas:this.iconAtlas})}})})}fetchAtlas(t,n,i){Object.keys(t).length>0||Object.keys(n).length>0?this.options.requestor(t,n,i):i()}pack(t){if(!this.count)return null;if(null==t)throw new Error("layout scale is undefined");const n=this.createDataPack(this.styledVectors,t);if(!n)return null;n.properties=this.properties,this.empty&&(n.empty=!0);const i=n.buffers;delete n.buffers;const e={data:n,buffers:i};if(this.iconAtlas){const t=e.data.iconAtlas=ce(this.iconAtlas);if(t.glyphMap)for(const n in t.glyphMap)i.push(t.glyphMap[n].data.data.buffer);i.push(e.data.iconAtlas.image.data.buffer)}return this.glyphAtlas&&(e.data.glyphAtlas=ce(this.glyphAtlas),i.push(e.data.glyphAtlas.image.data.buffer)),e}createStyledVector(t,n,i,e){return new he(t,n,i,e)}createDataPack(t,n){if(!t||!t.length)return null;this.maxIndex=0,this.maxPos=0,this.maxAltitude=0;const i=this.data={};let e=this.elements=[];const r=this.getFormat(Array.isArray(t[0])?t[0][0].symbol:t[0].symbol);for(let t=0;t<r.length;t++)i[r[t].name]=[];let s=[],o=0;const a=[];let h=0,u=!1;for(let e=0,r=t.length;e<r;e++){if(!t[e].feature.geometry)continue;const r=Array.isArray(t[e])?t[e][0].feature.id:t[e].feature.id;Xi(r)&&(Math.abs(r)>h&&(h=Math.abs(r)),r<0&&(u=!0));const l=this.data.aPosition.length;if(Array.isArray(t[e]))for(let i=0;i<t[e].length;i++)this.N(t[e][i],n);else this.N(t[e],n);const c=(i.aPosition.length-l)/3;for(let n=0;n<c;n++)s.push(t[e].featureIdx),Xi(r)&&a.push(r);o=Math.max(o,t[e].featureIdx)}if(this.hasElements()&&!e.length)return null;s=new(qi(o))(s),r[0].type=this.options.positionType?this.options.positionType:Wi(Math.max(this.maxPos,this.maxAltitude));const l=this.options.center;if(l&&(l[0]||l[1])){const t=i.aPosition;for(let n=0;n<t.length;n+=3)t[n]-=l[0],t[n+1]-=l[1]}const c=function(t,n){const i={};for(let e=0;e<t.length;e++){const r=t[e],s=r.type,o=r.name;i[o]=s===Array?n[o]:new s(n[o])}return i}(r,i);c.aPickingId=s;const f=[];for(const t in c)f.push(c[t].buffer);e=new($i(this.maxIndex))(e),f.push(e.buffer);const d={data:c,indices:this.hasElements()?e:null,positionSize:3,\n//!this.maxAltitude ? 2 : 3,\nbuffers:f,symbolIndex:this.symbolDef.index||{index:0}};if(a.length){const t=u?Wi(h):qi(h);d.featureIds=new t(a),f.push(d.featureIds.buffer)}else d.featureIds=[];return d}N(t,n){this.j&&this.j.isZoomConstant&&!this.j(null,t.feature.properties)||this.placeVector(t,n,this.formatWidth)}addElements(...t){this.maxIndex=Math.max(this.maxIndex,...t),this.elements.push(...t)}hasElements(){return!0}getAltitude(t){const{altitudeProperty:n,defaultAltitude:i,altitudeScale:e}=this.options;let r=ee(t,n,i);return e&&(r*=e),this.maxAltitude=Math.max(this.maxAltitude,Math.abs(r)),r}getIconAtlasMaxValue(){const t=this.iconAtlas.positions;let n=0;for(const i in t)if(Qi(t,i)){const{tl:e,displaySize:r}=t[i],s=Math.max(e[0],e[1],r[0]-1,r[1]-1);s>n&&(n=s)}return n}}function ce(t){let n=t.positions,i=t.image&&t.image.format||"alpha";if(t instanceof Ni){n={};for(const i in t.positions){const e=t.positions[i];n[i]={paddedRect:e.paddedRect,pixelRatio:e.pixelRatio,tl:e.tl,br:e.br,displaySize:e.displaySize}}i="rgba"}const e=t.image;return{image:{width:e.width,height:e.height,data:e.data,format:i},glyphMap:t.glyphMap,positions:n}}function fe(t,n,i,e){const r="__fn_textSize".trim();let s=t.textSize;if(Ji(n.textSize))return[16,16];t[r]&&(s=t[r]);const o=[];var a;return o[0]=Ji(a=s)||"function"!=typeof a&&(null===a.constructor||a.constructor!==Function)?s:s(e,i),o[1]=o[0],o}function de(t){const n=t.stops;let i=-1/0;for(let t=0;t<n.length;t++){let e=n[t][1];Zi(n[t][1])&&(e=de(n[t][1])),e>i&&(i=e)}return i}const ye=/\\{([\\w_]+)\\}/g;function ve(t,n){return Yi(t)?t.replace(ye,(function(t,i){if(!n)return"";const e=n[i];return Ji(e)?"":Array.isArray(e)?e.join():e})):t}const pe=t=>t>=11904&&t<=12031,me=t=>t>=12032&&t<=12255,ge=t=>t>=12272&&t<=12287,we=t=>t>=12288&&t<=12351,Me=t=>t>=12352&&t<=12447,be=t=>t>=12448&&t<=12543,xe=t=>t>=12544&&t<=12591,Fe=t=>t>=12704&&t<=12735,Ae=t=>t>=12736&&t<=12783,ke=t=>t>=12784&&t<=12799,Pe=t=>t>=12800&&t<=13055,Se=t=>t>=13056&&t<=13311,_e=t=>t>=13312&&t<=19903,Oe=t=>t>=19968&&t<=40959,Ie=t=>t>=40960&&t<=42127,Te=t=>t>=42128&&t<=42191,Le=t=>t>=63744&&t<=64255,Ue=t=>t>=64336&&t<=65023,ze=t=>t>=65040&&t<=65055,De=t=>t>=65072&&t<=65103,Ee=t=>t>=65104&&t<=65135,Ce=t=>t>=65136&&t<=65279,je=t=>t>=65280&&t<=65519;function Ne(t){return!((t=>t>=1536&&t<=1791)(t)||(t=>t>=1872&&t<=1919)(t)||(t=>t>=2208&&t<=2303)(t)||Ue(t)||Ce(t))}function He(t){return!!(746===t||747===t||!(t<4352)&&(Fe(t)||xe(t)||De(t)&&!(t>=65097&&t<=65103)||Le(t)||Se(t)||pe(t)||Ae(t)||!(!we(t)||t>=12296&&t<=12305||t>=12308&&t<=12319||12336===t)||_e(t)||Oe(t)||Pe(t)||(t=>t>=12592&&t<=12687)(t)||(t=>t>=43360&&t<=43391)(t)||(t=>t>=55216&&t<=55295)(t)||(t=>t>=4352&&t<=4607)(t)||(t=>t>=44032&&t<=55215)(t)||Me(t)||ge(t)||(t=>t>=12688&&t<=12703)(t)||me(t)||ke(t)||be(t)&&12540!==t||!(!je(t)||65288===t||65289===t||65293===t||t>=65306&&t<=65310||65339===t||65341===t||65343===t||t>=65371&&t<=65503||65507===t||t>=65512&&t<=65519)||!(!Ee(t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||(t=>t>=5120&&t<=5759)(t)||(t=>t>=6320&&t<=6399)(t)||ze(t)||(t=>t>=19904&&t<=19967)(t)||Ie(t)||Te(t)))}function Ve(t){return!(He(t)||function(t){return!!((t=>t>=128&&t<=255)(t)&&(167===t||169===t||174===t||177===t||188===t||189===t||190===t||215===t||247===t)||(t=>t>=8192&&t<=8303)(t)&&(8214===t||8224===t||8225===t||8240===t||8241===t||8251===t||8252===t||8258===t||8263===t||8264===t||8265===t||8273===t)||(t=>t>=8448&&t<=8527)(t)||(t=>t>=8528&&t<=8591)(t)||(t=>t>=8960&&t<=9215)(t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||9003===t||t>=9085&&t<=9114||t>=9150&&t<=9165||9167===t||t>=9169&&t<=9179||t>=9186&&t<=9215)||(t=>t>=9216&&t<=9279)(t)&&9251!==t||(t=>t>=9280&&t<=9311)(t)||(t=>t>=9312&&t<=9471)(t)||(t=>t>=9632&&t<=9727)(t)||(t=>t>=9728&&t<=9983)(t)&&!(t>=9754&&t<=9759)||(t=>t>=11008&&t<=11263)(t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||we(t)||be(t)||(t=>t>=57344&&t<=63743)(t)||De(t)||Ee(t)||je(t)||8734===t||8756===t||8757===t||t>=9984&&t<=10087||t>=10102&&t<=10131||65532===t||65533===t)}(t))}function Re(t){return t>=1424&&t<=2303||Ue(t)||Ce(t)}const $e=[[9,9],[32,32],[5760,5760],[8192,8198],[8200,8202],[8287,12288],[6158,6158],[8203,8205]];function We(t){for(const n of $e)if(t>=n[0]&&t<=n[1])return!0;return!1}const qe={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\\\":"\","]":"﹈","^":"^",H:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};function Be(t,n,i,e,r,s,o,a,h,u){let l=t.trim();2===u&&(l=function(t){let n="";for(let i=0;i<t.length;i++){const e=t.charCodeAt(i+1)||null,r=t.charCodeAt(i-1)||null;n+=e&&Ve(e)&&!qe[t[i+1]]||r&&Ve(r)&&!qe[t[i-1]]||!qe[t[i]]?t[i]:qe[t[i]]}return n}(l));const c=[],f={positionedGlyphs:c,text:l,top:a[1],bottom:a[1],left:a[0],right:a[0],writingMode:u};let d;return d=function(t,n){const i=[];let e=0;for(let r=0;r<n.length;r++){const s=n[r];i.push(t.substring(e,s)),e=s}return e<t.length&&i.push(t.substring(e,t.length)),i}(l,function(t,n,i,e){if(!i)return[];if(!t)return[];const r=[],s=function(t,n,i,e){let r=0;for(let i=0;i<t.length;i++){const s=e[t.charCodeAt(i)];s&&(r+=s.metrics.advance+n)}return r/Math.max(1,Math.ceil(r/i))}(t,n,i,e);let o=0;for(let i=0;i<t.length;i++){const h=t.charCodeAt(i),u=e[h];u&&!Ge[h]&&(o+=u.metrics.advance+n),i<t.length-1&&(Je[h]||!((a=h)<11904)&&(Fe(a)||xe(a)||De(a)||Le(a)||Se(a)||pe(a)||Ae(a)||we(a)||_e(a)||Oe(a)||Pe(a)||je(a)||Me(a)||ge(a)||me(a)||ke(a)||be(a)||ze(a)||Te(a)||Ie(a)))&&r.push(Ye(i+1,o,s,r,Ze(h,t.charCodeAt(i+1)),!1))}var a;return function t(n){return n?t(n.priorBreak).concat(n.index):[]}(Ye(t.length,o,s,r,0,!0))}(l,o,i,n)),function(t,n,i,e,r,s,o,a,h){let u=0,l=8,c=0;const f=t.positionedGlyphs,d="right"===s?1:"left"===s?0:.5;for(let t=0;t<i.length;t++){let r=i[t];if(r=r.trim(),!r.length){l-=e;continue}const s=f.length;for(let t=0;t<r.length;t++){const i=r.charCodeAt(t),e=n[i];e&&(He(i)&&1!==o?(32!==i&&f.push({glyph:i,x:u,y:0,vertical:!0}),u+=h+a):(32!==i&&f.push({glyph:i,x:u,y:l,vertical:!1}),u+=e.metrics.advance+a))}f.length!==s&&(c=Math.max(u-a,c),Qe(f,n,s,f.length-1,d)),u=0,l-=e}const{horizontalAlign:y,verticalAlign:v}=Ke(r);!function(t,n,i,e,r,s,o){const a=(n-i)*r,h=-(-e*o+.5)*s;if(a||h)for(let n=0;n<t.length;n++)t[n].x+=a,t[n].y+=h}(f,d,y,v,c,e,i.length);const p=i.length*e;t.top+=-v*p,t.bottom=t.top+p,t.left+=-y*c,t.right=t.left+c}(f,n,d,e,r,s,u,o,h),!!c.length&&f}const Ge={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Je={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function Xe(t,n,i,e){const r=Math.pow(t-n,2);return e?t<n?r/2:2*r:r+Math.abs(i)*i}function Ze(t,n){let i=0;return 10===t&&(i-=1e4),40!==t&&65288!==t||(i+=50),41!==n&&65289!==n||(i+=50),i}function Ye(t,n,i,e,r,s){let o=null,a=Xe(n,i,r,s);for(let t=0;t<e.length;t++){const h=e[t],u=Xe(n-h.x,i,r,s)+h.badness;u<=a&&(o=h,a=u)}return{index:t,x:n,priorBreak:o,badness:a}}function Ke(t){let n=.5,i=.5;switch(t){case"right":case"top-right":case"bottom-right":n=1;break;case"left":case"top-left":case"bottom-left":n=0}switch(t){case"bottom":case"bottom-right":case"bottom-left":i=1;break;case"top":case"top-right":case"top-left":i=0}return{horizontalAlign:n,verticalAlign:i}}function Qe(t,n,i,e,r){if(!r)return;const s=n[t[e].glyph];if(s){const n=(t[e].x+s.metrics.advance)*r;if(!n)return;for(let r=i;r<=e;r++)t[r].x-=n}}function tr(t){if(!function(t){for(const n of t)if(Re(n.charCodeAt(0)))return!0;return!1}(t))return t;const n=[],i=[],e=[];let r=0,s=0,o=1,a=1;for(const h of t){const t=h.codePointAt(0);We(t)?(e.push(h),r++):(o=Re(t)?-1:1,a!==o?(s=r,i.length&&(a>0&&i.reverse(),n.push(...i)),e.length&&(n.splice(s,0,...e),e.length=0),a=o,i.length=0):e.length&&(i.push(...e),e.length=0),i.push(h),r++)}return e.length&&i.push(...e),i.length&&(a>0&&i.reverse(),n.push(...i)),n.reverse().join("")}const nr=/\\{ *([\\w_]+) *\\}/g;class ir{constructor(t,n,i,e,r){this.feature=t,this.symbolDef=n,this.symbol=i,this.options=r,this.V=this.R.bind(this),this.C=e}R(t,n){return this.feature.properties[n]||"default"}getShape(t,n){if(this.W)return this.W;const{textHorizontalAlignmentFn:i,textVerticalAlignmentFn:e,markerHorizontalAlignmentFn:r,markerVerticalAlignmentFn:s,textWrapWidthFn:o}=this.C;let a;const h=this.symbol,u=this.getIconAndGlyph(),l=this.feature.properties;if(u&&u.glyph){const{font:t,text:r}=u.glyph;if(""===r)return null;const s=this.size[0]/24,c=24,f=h.textKeepUpright,d="map"===h.textRotationAlignment&&"line"===h.textPlacement&&!h.isIconText,y=n.glyphMap[t],v=er(i?i(null,l):h.textHorizontalAlignment,e?e(null,l):h.textVerticalAlignment),p=1.2*c,m=function(t){for(let n=0;n<t.length;n++)if(!Ne(t.charAt(n).charCodeAt(0)))return!1;return!0}(r),g=m&&h.textLetterSpacing/s||0,w=[h.textDx/s||0,h.textDy/s||0],M=((o?o(null,l):h.textWrapWidth)||10*c)/s;a={},a.horizontal=Be(r,y,M,p,v,"center",g,w,c,1),m&&d&&f&&(a.vertical=Be(r,y,M,p,v,"center",g,w,c,2))}else if(u&&u.icon){if(!t.positions[u.icon.url])return null;const n=er(r?r(null,l):h.markerHorizontalAlignment,s?s(null,l):h.markerVerticalAlignment);a=function(t,n){const{horizontalAlign:i,verticalAlign:e}=Ke(n),r=-24*i,s=-24*e;return{image:t,top:s,bottom:s+24,left:r,right:r+24}}(t.positions[u.icon.url],n),this.size||(this.size=a.image.displaySize)}return this.W=a,a}getIconAndGlyph(){if(this.iconGlyph)return this.iconGlyph;const{markerFileFn:t,markerTypeFn:n,markerPathFn:i,markerWidthFn:e,markerHeightFn:r,markerFillFn:s,markerFillPatternFileFn:o,markerFillOpacityFn:a,markerTextFitFn:h,markerTextFitPaddingFn:u,markerLineColorFn:l,markerLineWidthFn:c,markerLineOpacityFn:f,markerLineDasharrayFn:d,markerLinePatternFileFn:y,markerPathWidthFn:v,markerPathHeightFn:p,textNameFn:w,textFaceNameFn:M,textStyleFn:b,textWeightFn:x}=this.C,{zoom:F}=this.options,A={},k=this.symbol,P=this.feature.properties,S=t?t(null,P):k.markerFile,_=n?n(null,P):k.markerType,O=S||_||k.markerPath,I=!Ji(this.symbolDef.textName);let T;if(O){T=function(t,n,i,e,r,s){if(Ji(n.markerWidth)&&Ji(n.markerHeight))return null;const o="__fn_markerWidth".trim(),a="__fn_markerHeight".trim();let h=n.markerWidth||0,u=n.markerHeight||0;return Zi(h)&&("identity"!==h.type?h=de(h):(h=t.markerWidth,t[o]&&(h=t[o](e,i)),Zi(h)&&(h="identity"===h.type?r(e,i):de(h)))),Zi(u)&&("identity"!==u.type?u=de(u):(u=t.markerHeight,t[a]&&(u=t[a](e,i)),Zi(u)&&(u="identity"===u.type?s(e,i):de(u)))),[h,u]}(k,this.symbolDef,P,F,e,r)||[0,0];let t=k.markerTextFit;if(h&&(t=h(F,P)),t&&t&&"none"!==t){const n=k.text.textSize;let i=k.text.textName;m(i)&&(i=g(i)(F,P));const e=ve(i,P);if(e){const i="__fn_textSize".trim(),r="__fn_textSize_0".trim();m(n)&&!k.text[i]&&(k.text[r]=g(n),k.text[i]=(t,n)=>{const i=k.text[r](t,n);return m(i)?g(i)(t,n):i});const s=fe(k.text,k.text,P,F);if("width"!==t&&"both"!==t||(T[0]=s[0]*e.length),"height"!==t&&"both"!==t||(T[1]=s[1]),s[0]&&s[1]){let t=k.markerTextFitPadding||[0,0,0,0];u&&(t=u(F,P)),T[0]+=t[1]+t[3],T[1]+=t[0]+t[2]}}else T[0]=T[1]=-1}}if(I&&(T=fe(k,this.symbolDef,P,F)),!T)return A;if(T[0]=Math.ceil(T[0]),T[1]=Math.ceil(T[1]),this.size=T,O&&T[0]>=0&&T[1]>=0){let t;if(_){const n={};if(n.markerType=_,"path"===_&&(n.markerPath=i?i(null,P):k.markerPath,n.markerPathWidth=v?v(null,P):k.markerPathWidth,n.markerPathHeight=p?p(null,P):k.markerPathHeight),e){const t=e(null,P);Ji(t)||(n.markerWidth=t)}else k.markerWidth>=0&&(n.markerWidth=k.markerWidth);if(r){const t=r(null,P);Ji(t)||(n.markerHeight=t)}else k.markerHeight>=0&&(n.markerHeight=k.markerHeight);if(s){const t=s(null,P);Ji(t)||(n.markerFill=t)}else k.markerFill&&(n.markerFill=k.markerFill);if(o){const t=o(null,P);Ji(t)||(n.markerFillPatternFile=t)}else k.markerFillPatternFile&&(n.markerFillPatternFile=k.markerFillPatternFile);if(a){const t=a(null,P);Ji(t)||(n.markerFillOpacity=t)}else k.markerFillOpacity>=0&&(n.markerFillOpacity=k.markerFillOpacity);if(l){const t=l(null,P);Ji(t)||(n.markerLineColor=t)}else k.markerLineColor&&(n.markerLineColor=k.markerLineColor);if(c){const t=c(null,P);Ji(t)||(n.markerLineWidth=t)}else k.markerLineWidth>=0&&(n.markerLineWidth=k.markerLineWidth);if(f){const t=f(null,P);Ji(t)||(n.markerLineOpacity=t)}else k.markerLineOpacity>=0&&(n.markerLineOpacity=k.markerLineOpacity);if(d){const t=d(null,P);Ji(t)||(n.markerLineDasharray=t)}else k.markerLineDasharray&&(n.markerLineDasharray=k.markerLineDasharray);if(y){const t=y(null,P);Ji(t)||(n.markerLinePatternFile=t)}else k.markerLinePatternFile&&(n.markerLinePatternFile=k.markerLinePatternFile);t="vector://"+JSON.stringify(n)}else t=S?S.replace(nr,this.V):k.markerPath?function(t,n,i){if(!t.markerPath)return null;let e=1;const r=function(t){const n={stroke:{stroke:t.markerLineColor,"stroke-width":t.markerLineWidth,"stroke-opacity":t.markerLineOpacity,"stroke-dasharray":null,"stroke-linecap":"butt","stroke-linejoin":"round"},fill:{fill:t.markerFill,"fill-opacity":t.markerFillOpacity}};return 0===n.stroke["stroke-width"]&&(n.stroke["stroke-opacity"]=0),n}(t);Xi(t.markerOpacity)&&(e=t.markerOpacity),Xi(t.opacity)&&(e*=t.opacity);const s={};if(r){for(const t in r.stroke)Qi(r.stroke,t)&&(Ji(r.stroke[t])||(s[t]=r.stroke[t]));for(const t in r.fill)Qi(r.fill,t)&&(Ji(r.fill[t])||(s[t]=r.fill[t]))}const o=Array.isArray(t.markerPath)?t.markerPath:[t.markerPath];let a;const h=[];for(let t=0;t<o.length;t++)a=Yi(o[t])?{path:o[t]}:o[t],a=Gi({},a,s),a.d=a.path,delete a.path,h.push(a);const u=[\'<svg version="1.1"\',\'xmlns="http://www.w3.org/2000/svg"\'];e<1&&u.push(\'opacity="\'+e+\'"\'),t.markerPathWidth&&t.markerPathHeight&&u.push(\'viewBox="0 0 \'+t.markerPathWidth+" "+t.markerPathHeight+\'"\'),u.push(\'preserveAspectRatio="none"\'),n&&u.push(\'width="\'+n+\'"\'),i&&u.push(\'height="\'+i+\'"\'),u.push("><defs></defs>");for(let t=0;t<h.length;t++){let n="<path ";for(const i in h[t])Qi(h[t],i)&&(n+=" "+i+\'="\'+h[t][i]+\'"\');n+="></path>",u.push(n)}return u.push("</svg>"),"data:image/svg+xml;base64,"+btoa(u.join(" "))}(k,T[0],T[1]):null;A.icon={url:t,size:T}}if(I){const t=w?w(null,P):k.textName;if(t||0===t){const n=function(t,n,i){return[n||"normal",i||"normal","24px",t||"monospace"].join(" ")}(M?M(null,P):k.textFaceName,b?b(null,P):k.textStyle,x?x(null,P):k.textWeight);let i=ve(t,P);i&&i.length&&(i=tr(i),A.glyph={font:n,text:i})}}return this.iconGlyph=A,A}}function er(t,n){n&&"middle"!==n||(n="center"),t&&"middle"!==t||(t="center");let i="center"!==n?n:"";return i+="center"!==t?(i.length?"-":"")+t:"",i\n/*!\n * From mapbox-gl-js\n * MIT License\n * https://github.com/mapbox/mapbox-gl-js\n */}function rr(t,n,i,e,r){const s=[];for(let o=0;o<t.length;o++){const a=t[o];let h;for(let t=0;t<a.length-1;t++){let o=a[t],u=a[t+1];o.x<n&&u.x<n||(o.x<n?o=new Ht(n,o.y+(n-o.x)/(u.x-o.x)*(u.y-o.y)).I():u.x<n&&(u=new Ht(n,o.y+(n-o.x)/(u.x-o.x)*(u.y-o.y)).I()),o.y<i&&u.y<i||(o.y<i?o=new Ht(o.x+(i-o.y)/(u.y-o.y)*(u.x-o.x),i).I():u.y<i&&(u=new Ht(o.x+(i-o.y)/(u.y-o.y)*(u.x-o.x),i).I()),o.x>=e&&u.x>=e||(o.x>=e?o=new Ht(e,o.y+(e-o.x)/(u.x-o.x)*(u.y-o.y)).I():u.x>=e&&(u=new Ht(e,o.y+(e-o.x)/(u.x-o.x)*(u.y-o.y)).I()),o.y>=r&&u.y>=r||(o.y>=r?o=new Ht(o.x+(r-o.y)/(u.y-o.y)*(u.x-o.x),r).I():u.y>=r&&(u=new Ht(o.x+(r-o.y)/(u.y-o.y)*(u.x-o.x),r).I()),h&&o.equals(h[h.length-1])||(h=[o],s.push(h)),h.push(u)))))}}return s}class sr extends Ht{constructor(t,n,i,e){super(t,n),this.angle=i,void 0!==e&&(this.segment=e)}clone(){return new sr(this.x,this.y,this.angle,this.segment)}}\n/*!\n * From mapbox-gl-js\n * MIT License\n * https://github.com/mapbox/mapbox-gl-js\n */function or(t,n,i,e,r){if(void 0===n.segment)return!0;let s=n,o=n.segment+1,a=0;for(;a>-i/2;){if(o--,o<0)return!1;a-=t[o].dist(s),s=t[o]}a+=t[o].dist(t[o+1]),o++;const h=[];let u=0;for(;a<i/2;){const n=t[o],i=t[o+1];if(!i)return!1;let s=t[o-1].angleTo(n)-n.angleTo(i);for(s=Math.abs((s+3*Math.PI)%(2*Math.PI)-Math.PI),h.push({distance:a,angleDelta:s}),u+=s;a-h[0].distance>e;)u-=h.shift().angleDelta;if(u>r)return!1;o++,a+=n.dist(i)}return!0}function ar(t,n,i,e,r,s,o,a,h){const u=function(t,n,i){return t?.6*n*i:0}(e,s,o),l=function(t,n){return Math.max(t?t.right-t.left:0,n?n.right-n.left:0)}(e,r),c=0===t[0].x||t[0].x===h||0===t[0].y||t[0].y===h;return n-l*o<n/4&&(n=l*o+n/4),function t(n,i,e,r,s,o,a,h,u){const l=o/2,c=function(t){let n=0;for(let i=0;i<t.length-1;i++)n+=t[i].dist(t[i+1]);return n}(n);let f=0,d=i-e,y=[];for(let t=0;t<n.length-1;t++){const i=n[t],a=n[t+1],h=i.dist(a),v=a.angleTo(i);for(;d+e<f+h;){d+=e;const p=(d-f)/h,m=hr(i.x,a.x,p),g=hr(i.y,a.y,p);if(m>=0&&m<u&&g>=0&&g<u&&d-l>=0&&d+l<=c){const i=new sr(m,g,v,t);i.line=n,i.I(),r&&!or(n,i,o,r,s)||y.push(i)}}f+=h}return h||y.length||a||(y=t(n,f/2,e,r,s,o,a,!0,u)),y}(t,c?n/2*a%n:(l/2+2*s)*o*a%n,n,u,i,l*o,c,!1,h)}function hr(t,n,i){return t*(1-i)+n*i}function ur(t,n){const i=t.length;if(i<=1)return[t];const e=[];let r,s;for(let n=0;n<i;n++){const i=ne(t[n]);0!==i&&(t[n].area=Math.abs(i),void 0===s&&(s=i<0),s===i<0?(r&&e.push(r),r=[t[n]]):r.push(t[n]))}if(r&&e.push(r),n>1)for(let t=0;t<e.length;t++)e[t].length<=n||(Bt(e[t],n,1,e[t].length-1,lr),e[t]=e[t].slice(0,n));return e}function lr(t,n){return n.area-t.area}function cr(t,n,i){const e=n.distSqr(i);if(0===e)return t.distSqr(n);const r=((t.x-n.x)*(i.x-n.x)+(t.y-n.y)*(i.y-n.y))/e;return t.distSqr(r<0?n:r>1?i:i.sub(n).F(r).u(n))}function fr(t,n=1,i=!1){let e=1/0,r=1/0,s=-1/0,o=-1/0;const a=t[0];for(let t=0;t<a.length;t++){const n=a[t];(!t||n.x<e)&&(e=n.x),(!t||n.y<r)&&(r=n.y),(!t||n.x>s)&&(s=n.x),(!t||n.y>o)&&(o=n.y)}const h=Math.min(s-e,o-r);let u=h/2;const l=new Zt(null,dr);if(0===h)return new Ht(e,r);for(let n=e;n<s;n+=h)for(let i=r;i<o;i+=h)l.push(new yr(n+u,i+u,u,t));let c=function(t){let n=0,i=0,e=0;const r=t[0];for(let t=0,s=r.length,o=s-1;t<s;o=t++){const s=r[t],a=r[o],h=s.x*a.y-a.x*s.y;i+=(s.x+a.x)*h,e+=(s.y+a.y)*h,n+=3*h}return new yr(i/n,e/n,0,t)}(t),f=l.length;for(;l.length;){const e=l.pop();(e.d>c.d||!c.d)&&(c=e,i&&console.log("found best %d after %d probes",Math.round(1e4*e.d)/1e4,f)),e.max-c.d<=n||(u=e.h/2,l.push(new yr(e.p.x-u,e.p.y-u,u,t)),l.push(new yr(e.p.x+u,e.p.y-u,u,t)),l.push(new yr(e.p.x-u,e.p.y+u,u,t)),l.push(new yr(e.p.x+u,e.p.y+u,u,t)),f+=4)}return i&&(console.log("num probes: "+f),console.log("best distance: "+c.d)),c.p}function dr(t,n){return n.max-t.max}function yr(t,n,i,e){this.p=new Ht(t,n),this.h=i,this.d=function(t,n){let i=!1,e=1/0;for(let r=0;r<n.length;r++){const s=n[r];for(let n=0,r=s.length,o=r-1;n<r;o=n++){const r=s[n],a=s[o];r.y>t.y!=a.y>t.y&&t.x<(a.x-r.x)*(t.y-r.y)/(a.y-r.y)+r.x&&(i=!i),e=Math.min(e,cr(t,r,a))}}return(i?1:-1)*Math.sqrt(e)}(this.p,e),this.max=this.d+this.h*Math.SQRT2}const vr=45*Math.PI/100;function pr(t,n){const i={},e={},r=[];let s=0;function o(n){r.push(t[n]),s++}function a(t,n,i){const s=e[t];return delete e[t],e[n]=s,r[s].geometry[0].pop(),r[s].geometry[0]=r[s].geometry[0].concat(i[0]),s}function h(t,n,e){const s=i[n];return delete i[n],i[t]=s,r[s].geometry[0].shift(),r[s].geometry[0]=e[0].concat(r[s].geometry[0]),s}function u(t,n,i){const e=i?n[0][n[0].length-1]:n[0][0];return`${t}:${e.x}:${e.y}`}for(let l=0;l<t.length;l++){const c=t[l],f=c.geometry;if(!f)continue;const d=c.properties[n]?c.properties[n].toString():null;if(!d){o(l);continue}const y=u(d,f),v=u(d,f,!0);if(y in e&&v in i&&e[y]!==i[v]){const t=h(y,v,f),n=a(y,v,r[t].geometry);delete i[y],delete e[v],e[u(d,r[n].geometry,!0)]=n,r[t].geometry=null}else y in e?a(y,v,f):v in i?h(y,v,f):(o(l),i[y]=s-1,e[v]=s-1)}return r.filter(t=>t.geometry)}class mr extends le{static needMerge(t){return t.mergeOnProperty&&("line"===t.textPlacement||"line"===t.markerPlacement)}static mergeLineFeatures(t,n,i){const e="__index".trim(),r=function(t,n,i){const e="__index".trim(),r=le.genFnTypes(n),{mergeOnPropertyFn:s}=r;if(!n.mergeOnProperty||"line"!==n.textPlacement&&"line"!==n.markerPlacement)return[];if(!(oe(o=n.mergeOnProperty)||"string"!=typeof o&&(null===o.constructor||o.constructor!==String)||"line"!==n.textPlacement&&"line"!==n.markerPlacement))return[{features:t,property:n.mergeOnProperty}];var o;const a=[],h={},u=[];for(let r=0;r<t.length;r++){t[r][e]=r;const o=t[r].properties=t[r].properties||{};o.$layer=t[r].layer,o.$type=t[r].type;let l=n.markerPlacement;"line"!==l&&(l=n.textPlacement);const c=s?s(i,o):n.mergeOnProperty;"line"!==l||oe(c)?u.push(t[r]):(void 0===h[c]&&(h[c]=a.length,a.push({features:[],property:c})),a[h[c]].features.push(t[r]))}return u.length&&a.push({features:u}),a}(t,n,i);if(r.length){const n=[];for(let i=0;i<r.length;i++)n.push(r[i].property?pr(r[i].features,r[i].property):t);if(1===n.length)return n[0];{let t=[];for(let i=0;i<n.length;i++)t=t.concat(n[i]);return t.sort((t,n)=>t[e]-n[e]),t}}}static splitPointSymbol(t,n=0){const i=[];if(Array.isArray(t)){const n=t;for(let t=0;t<n.length;t++)n[t]&&i.push(...mr.splitPointSymbol(n[t],t));return i}let e=null,r=null;for(const n in t)0===n.indexOf("marker")?(e=e||{},e[n]=t[n]):0===n.indexOf("text")&&(r=r||{},r[n]=t[n]);return e&&(e.isIconText=!0,t.mergeOnProperty&&(e.mergeOnProperty=t.mergeOnProperty),i.push(e)),r&&(e&&(r.textPlacement=e.markerPlacement,r.textSpacing=e.markerSpacing,r.isIconText=!0),t.mergeOnProperty&&(r.mergeOnProperty=t.mergeOnProperty),i.push(r)),void 0!==t.visible&&(e&&(e.visible=t.visible),r&&(r.visible=t.visible)),e&&(e.markerTextFit&&r&&(e.text={},e.text.textName=r.textName,e.text.textSize=r.textSize),e.index={index:n,type:0}),r&&(r.index={index:n,type:1}),i}static isAtlasLoaded(t,n){const{icon:i,glyph:e}=t,{iconAtlas:r,glyphAtlas:s}=n;if(i&&(!r||!r.positions[i.url]))return!1;if(e){if(!s||!s.positions[e.font])return!1;const t=s.positions[e.font],{text:n}=e;for(let i=0;i<n.length;i++)if(!t[n.charCodeAt(i)])return!1}return!0}constructor(t,n,i){super(t,n,i)}createStyledVector(t,n,i,e,r,s){const o=new ir(t,this.symbolDef,n,i,e),a=o.getIconAndGlyph();if(a.icon&&!this.options.atlas){const{url:t,size:n}=a.icon;r[t]||(r[t]=a.icon.size),r[t][0]<n[0]&&(r[t][0]=n[0]),r[t][1]<n[1]&&(r[t][1]=n[1])}if(a.glyph&&!this.options.atlas){const{font:t,text:i}=a.glyph,e=s[t]=s[t]||{};for(let t=0;t<i.length;t++)e[i.charCodeAt(t)]=1;"line"===n.textPlacement&&(s.options={isCharsCompact:!1})}return this.options.allowEmptyPack||a.icon||a.glyph?o:null}getFormat(t){const n=void 0!==t.textName,i=n?function(t){return"line"!==t.textPlacement||t.isIconText?[{type:Int16Array,width:3,name:"aPosition"},{type:Int16Array,width:2,name:"aShape"},{type:Uint16Array,width:2,name:"aTexCoord"},{type:Uint8Array,width:1,name:"aCount"}]:[{type:Int16Array,width:3,name:"aPosition"},{type:Int16Array,width:2,name:"aShape"},{type:Uint16Array,width:2,name:"aTexCoord"},{type:Uint8Array,width:1,name:"aCount"},{type:Int16Array,width:2,name:"aGlyphOffset"},{type:Uint16Array,width:3,name:"aSegment"},{type:Uint8Array,width:1,name:"aVertical"}]}(t):[{type:Int16Array,width:3,name:"aPosition"},{type:Int16Array,width:2,name:"aShape"},{type:Uint16Array,width:2,name:"aTexCoord"}];n?i.push(...this.q()):i.push(...this.B());const{markerOpacityFn:e,textOpacityFn:r,markerPitchAlignmentFn:s,textPitchAlignmentFn:o,markerRotationAlignmentFn:a,textRotationAlignmentFn:h,markerRotationFn:u,textRotationFn:l,markerAllowOverlapFn:c,textAllowOverlapFn:f,markerIgnorePlacementFn:d,textIgnorePlacementFn:y}=this.C;return(e||r)&&i.push({type:Uint8Array,width:1,name:"aColorOpacity"}),(s||o)&&i.push({type:Uint8Array,width:1,name:"aPitchAlign"}),(a||h)&&i.push({type:Uint8Array,width:1,name:"aRotationAlign"}),(u||l)&&i.push({type:Uint16Array,width:1,name:"aRotation"}),(c||f||d||y)&&i.push({type:Uint8Array,width:1,name:"aOverlap"}),i}q(){const{textFillFn:t,textSizeFn:n,textHaloFillFn:i,textHaloRadiusFn:e,textHaloOpacityFn:r,textDxFn:s,textDyFn:o}=this.C,a=[];return t&&a.push({type:Uint8Array,width:4,name:"aTextFill"}),n&&a.push({type:Uint8Array,width:1,name:"aTextSize"}),i&&a.push({type:Uint8Array,width:4,name:"aTextHaloFill"}),e&&a.push({type:Uint8Array,width:1,name:"aTextHaloRadius"}),r&&a.push({type:Uint8Array,width:1,name:"aTextHaloOpacity"}),s&&a.push({type:Int8Array,width:1,name:"aTextDx"}),o&&a.push({type:Int8Array,width:1,name:"aTextDy"}),a}B(){const{markerWidthFn:t,markerHeightFn:n,markerDxFn:i,markerDyFn:e}=this.C,r=[];return t&&r.push({type:Uint8Array,width:1,name:"aMarkerWidth"}),n&&r.push({type:Uint8Array,width:1,name:"aMarkerHeight"}),i&&r.push({type:Int8Array,width:1,name:"aMarkerDx"}),e&&r.push({type:Int8Array,width:1,name:"aMarkerDy"}),r}createDataPack(){if(!this.iconAtlas&&!this.glyphAtlas){if(!this.options.allowEmptyPack)return null;this.empty=!0}this.lineVertex=[];const t=super.createDataPack.apply(this,arguments);return t?(t.lineVertex=new Int16Array(this.lineVertex),t.buffers.push(t.lineVertex.buffer),t):null}placeVector(t,n){const i=t.getShape(this.iconAtlas,this.glyphAtlas);if(!this.options.allowEmptyPack&&!i)return;const e=this.G(t,i,n);if(0===e.length)return;const r=this.data;let s=this.data.aPosition.length/3;const o=t.symbol,a=t.feature.properties,h="line"===o.textPlacement&&!o.isIconText,u=void 0!==o.textName,l=u&&h&&function(t){let n=0;for(let i=0;i<t.length;i++)if(He(t.charAt(i).charCodeAt(0)))n=0;else if(n++,n>=1)return!1;return!0}(t.getIconAndGlyph().glyph.text)?1:0,{textFillFn:c,textSizeFn:f,textHaloFillFn:d,textHaloRadiusFn:y,textHaloOpacityFn:v,textDxFn:p,textDyFn:g,textPitchAlignmentFn:w,textRotationAlignmentFn:M,textRotationFn:b,textAllowOverlapFn:x,textIgnorePlacementFn:F,textOpacityFn:A,markerWidthFn:k,markerHeightFn:P,markerDxFn:S,markerDyFn:_,markerPitchAlignmentFn:O,markerRotationAlignmentFn:I,markerRotationFn:T,markerAllowOverlapFn:L,markerIgnorePlacementFn:U,markerOpacityFn:z}=this.C;let D,E,C,j,N,H,V,R,$,W,q,B,G,J,X,Z,Y;if(u){const n=t.getIconAndGlyph().glyph.font;D=function(t,n,i){const e=t.positionedGlyphs,r=[];for(let s=0;s<e.length;s++){const o=e[s],a=i[o.glyph];if(!a)continue;const h=a.rect;if(!h)continue;const u=4,l=a.metrics.advance/2,c=a.metrics.height/2,f=n?[o.x+l,0]:[0,0],d=n?[0,o.y-c]:[o.x+l,o.y-c],y=a.metrics.left-u-l+d[0],v=a.metrics.top-u+d[1],p=y+h.w,m=v+h.h,g=new Ht(y,v),w=new Ht(p,v),M=new Ht(y,m),b=new Ht(p,m);if(n&&o.vertical){const t=new Ht(-l,l),n=-Math.PI/2,i=new Ht(5,0);g.P(n,t).u(i),w.P(n,t).u(i),M.P(n,t).u(i),b.P(n,t).u(i)}r.push({tl:g,tr:w,bl:M,br:b,tex:h,writingMode:t.writingMode,glyphOffset:f})}return r}(i.horizontal,h,this.glyphAtlas.positions[n]),c&&(E=c(null,a),m(E)?E=[0,0,0,0]:(E=Array.isArray(E)?E.map(t=>255*t):Vn(E).array(),3===E.length&&E.push(255))),f&&(C=f(this.options.zoom,a),oe(C)&&(C=14)),d&&(j=d(null,a),j=Array.isArray(j)?j.map(t=>255*t):Vn(j).array(),3===j.length&&j.push(255)),y&&(N=y(null,a)),v&&(H=255*v(null,a)),p&&(V=p(null,a)||0),g&&(R=g(null,a)||0),w&&(G=+("map"===w(null,a))),M&&(J=+("map"===M(null,a))),b&&(X=ae(b(null,a),0,360)*Math.PI/180)}else D=i?function(t){const n=t.image,i=t.top-1/n.pixelRatio,e=t.left-1/n.pixelRatio,r=t.bottom+1/n.pixelRatio,s=t.right+1/n.pixelRatio;let o,a,h,u;return o=new Ht(e,i),a=new Ht(s,i),h=new Ht(s,r),u=new Ht(e,r),[{tl:o,tr:a,bl:u,br:h,tex:{x:n.tl[0],y:n.tl[1],w:n.displaySize[0],h:n.displaySize[1]},writingMode:void 0,glyphOffset:[0,0]}]}(i):function(){const t=new Ht(0,0),n=new Ht(0,0),i=new Ht(0,0);return[{tl:t,tr:n,bl:new Ht(0,0),br:i,tex:{x:0,y:0,w:0,h:0},writingMode:void 0,glyphOffset:[0,0]}]}(),k&&($=k(null,a)),P&&(W=P(null,a)),S&&(q=S(null,a)),_&&(B=_(null,a)),O&&(G=+("map"===O(null,a))),I&&(J=+("map"===I(null,a))),T&&(X=ae(T(null,a),0,360)*Math.PI/180);const K=L||x;K&&(Z=K(null,a)||0);const Q=U||F;let tt;Q&&(Y=Q(null,a)||0);const nt=A||z;nt&&(tt=255*nt(this.options.zoom,a));const it=this.options.EXTENT,et=D.length,rt=this.getAltitude(t.feature.properties);for(let t=0;t<e.length;t++){const n=e[t];if(it!==1/0&&se(n,it))continue;const i=n.x,o=n.y,a=D.length;for(let t=0;t<a;t++){const e=D[t],{tl:a,tr:c,bl:f,br:d,tex:y}=e;this.J(r,i,o,rt,10*a.x,10*a.y,y.x,y.y+y.h),u&&this.X(r,h,et,e.glyphOffset,n,l),this.Z(r,E,C,j,N,H,V,R,$,W,q,B,tt,G,J,X,Z,Y),this.J(r,i,o,rt,10*c.x,10*c.y,y.x+y.w,y.y+y.h),u&&this.X(r,h,et,e.glyphOffset,n,l),this.Z(r,E,C,j,N,H,V,R,$,W,q,B,tt,G,J,X,Z,Y),this.J(r,i,o,rt,10*f.x,10*f.y,y.x,y.y),u&&this.X(r,h,et,e.glyphOffset,n,l),this.Z(r,E,C,j,N,H,V,R,$,W,q,B,tt,G,J,X,Z,Y),this.J(r,i,o,rt,10*d.x,10*d.y,y.x+y.w,y.y),u&&this.X(r,h,et,e.glyphOffset,n,l),this.Z(r,E,C,j,N,H,V,R,$,W,q,B,tt,G,J,X,Z,Y),this.addElements(s,s+1,s+2),this.addElements(s+1,s+2,s+3),s+=4;const v=Math.max(Math.abs(i),Math.abs(o),Math.abs(rt));v>this.maxPos&&(this.maxPos=v)}}}J(t,n,i,e,r,s,o,a){t.aPosition.push(n,i,e),t.aShape.push(r,s),t.aTexCoord.push(o,a)}X(t,n,i,e,r,s){if(t.aCount.push(i),n){t.aGlyphOffset.push(e[0],e[1]);const n=r.startIndex;t.aSegment.push(r.segment+n,n,r.line.length),t.aVertical.push(s)}}Z(t,n,i,e,r,s,o,a,h,u,l,c,f,d,y,v,p,m){const{textFillFn:g,textSizeFn:w,textHaloFillFn:M,textHaloRadiusFn:b,textHaloOpacityFn:x,textDxFn:F,textDyFn:A,textPitchAlignmentFn:k,textRotationAlignmentFn:P,textRotationFn:S,textAllowOverlapFn:_,textIgnorePlacementFn:O,textOpacityFn:I,markerWidthFn:T,markerHeightFn:L,markerDxFn:U,markerDyFn:z,markerPitchAlignmentFn:D,markerRotationAlignmentFn:E,markerRotationFn:C,markerAllowOverlapFn:j,markerIgnorePlacementFn:N,markerOpacityFn:H}=this.C;g&&t.aTextFill.push(...n),w&&t.aTextSize.push(i),M&&t.aTextHaloFill.push(...e),b&&t.aTextHaloRadius.push(r),x&&t.aTextHaloOpacity.push(s),F&&t.aTextDx.push(o),A&&t.aTextDy.push(a),T&&t.aMarkerWidth.push(h),L&&t.aMarkerHeight.push(u),U&&t.aMarkerDx.push(l),z&&t.aMarkerDy.push(c),(H||I)&&t.aColorOpacity.push(f),(k||D)&&t.aPitchAlign.push(d),(E||P)&&t.aRotationAlign.push(y),(C||S)&&t.aRotation.push(9362*v);const V=j||_,R=N||O;(V||R)&&t.aOverlap.push((V?8:0)+4*p+((R?2:0)+m)),r>0&&(this.properties.hasHalo=1)}G(t,n,i){const{feature:e,symbol:r}=t,s=this.Y(t,r),o=e.properties,{markerSpacingFn:a,textSpacingFn:h}=this.C,u=((a?a(null,o):r.markerSpacing)||(h?h(null,o):r.textSpacing)||250)*i;return function(t,n,i,e,r,s,o){const{feature:a,size:h,symbol:u}=t,l=h?24:0,c=e*(h?h[0]/l:1),f=[];if("line"===s){let t=a.geometry;r&&(t=rr(a.geometry,0,0,r,r));for(let e=0;e<t.length;e++){const s=ar(t[e],o,vr,u.isIconText?null:i.vertical||i.horizontal||i,null,l,u.isIconText?1:c,1,r||1/0);if(u.textPlacement&&!u.isIconText)for(let t=0;t<s.length;t++)s[t].startIndex=n.length/3;if(f.push.apply(f,s),u.textPlacement&&!u.isIconText)for(let i=0;i<t[e].length;i++)n.push(t[e][i].x,t[e][i].y,0)}}else if(3===a.type){const t=ur(a.geometry,0);for(let n=0;n<t.length;n++){const i=t[n];if("vertex"===s)for(let t=0;t<i.length;t++){const n=i[t];for(let t=0;t<n.length;t++)se(n[t],r)||f.push(n[t])}else{const t=fr(i,16);se(t,r)||f.push(t)}}}else if(2===a.type)for(let t=0;t<a.geometry.length;t++){const n=a.geometry[t];if("vertex"===s)for(let t=0;t<n.length;t++)se(n[t],r)||f.push(n[t]);else se(n[0],r)||f.push(n[0])}else if(1===a.type)for(let t=0;t<a.geometry.length;t++){const n=a.geometry[t];for(let t=0;t<n.length;t++){const i=n[t];se(i,r)||f.push(i)}}return f}(t,this.lineVertex,n,i,this.options.EXTENT,s,u)}Y(t,n){return this.C.markerPlacementFn?this.C.markerPlacementFn(this.options.zoom,t.feature.properties):n.markerPlacement||n.textPlacement}}const gr=Math.cos(Math.PI/180*37.5),wr=Math.pow(2,16)/1;class Mr extends le{constructor(t,n,i){super(t,n,i);let e=!1;const{lineDasharrayFn:r,lineDashColorFn:s}=this.C;r&&(e=function(t,n,i){for(let e=0;e<t.length;e++)if(i(n,t[e].properties))return!0;return!1}(t,this.options.zoom,r),e&&(this.dasharrayFn=r)),(Fr(this.symbol.lineDasharray)||e)&&s&&(this.dashColorFn=s)}createStyledVector(t,n,i,e,r){const s=new he(t,n,i,e),o=s.getLineResource();return!this.options.atlas&&o&&(r[o]=[0,0]),s}getFormat(){const{lineWidthFn:t,lineStrokeWidthFn:n,lineStrokeColorFn:i,lineColorFn:e,lineOpacityFn:r,lineDxFn:s,lineDyFn:o,linePatternAnimSpeedFn:a,linePatternGapFn:h}=this.C,u=[{type:Int16Array,width:3,name:"aPosition"}];if(u.push(this.options.center||this.iconAtlas?{type:Int8Array,width:3,name:"aExtrude"}:{type:Int8Array,width:2,name:"aExtrude"}),u.push({type:Uint16Array,width:1,name:"aLinesofar"}),t&&u.push({type:Uint8Array,width:1,name:"aLineWidth"}),n&&u.push({type:Uint8Array,width:1,name:"aLineStrokeWidth"}),e&&u.push({type:Uint8Array,width:4,name:"aColor"}),i&&u.push({type:Uint8Array,width:4,name:"aStrokeColor"}),r&&u.push({type:Uint8Array,width:1,name:"aOpacity"}),this.symbol.lineOffset&&u.push({type:Int8Array,width:2,name:"aExtrudeOffset"}),this.dasharrayFn&&u.push({type:Uint8Array,width:4,name:"aDasharray"}),this.dashColorFn&&u.push({type:Uint8Array,width:4,name:"aDashColor"}),this.iconAtlas){const t=this.getIconAtlasMaxValue();u.push({type:t>255?Uint16Array:Uint8Array,width:4,name:"aTexInfo"})}return s&&u.push({type:Int8Array,width:1,name:"aLineDx"}),o&&u.push({type:Int8Array,width:1,name:"aLineDy"}),a&&u.push({type:Int8Array,width:1,name:"aLinePatternAnimSpeed"}),h&&u.push({type:Uint8Array,width:1,name:"aLinePatternGap"}),u}placeVector(t){const{lineJoinFn:n,lineCapFn:i,lineWidthFn:e,lineStrokeWidthFn:r,lineStrokeColorFn:s,lineColorFn:o,lineOpacityFn:a,lineJoinPatternModeFn:h,lineDxFn:u,lineDyFn:l,linePatternAnimSpeedFn:c,linePatternGapFn:f}=this.C,d=this.symbol,y=t.feature,v=3===y.type,p=y.properties,g=this.elements;v&&(this.elements=[]);let w=d.lineJoin||"miter",M=d.lineCap||"butt";if(n&&(w=n(this.options.zoom,p)||"miter"),i&&(M=i(this.options.zoom,p)||"butt"),e){let t=e(this.options.zoom,p);Ji(t)&&(t=4),this.feaLineWidth=t}else this.feaLineWidth=d.lineWidth;if(r){let t=r(this.options.zoom,p);Ji(t)&&(t=0),this.feaLineStrokeWidth=t}else this.feaLineStrokeWidth=d.lineStrokeWidth||0;if(o&&(this.feaColor=o(this.options.zoom,p)||[0,0,0,255],m(this.feaColor)?this.feaColor=[0,0,0,0]:(this.feaColor=Array.isArray(this.feaColor)?this.feaColor.map(t=>255*t):Vn(this.feaColor).array(),3===this.feaColor.length&&this.feaColor.push(255))),s&&(this.feaStrokeColor=s(this.options.zoom,p)||[0,0,0,255],m(this.feaStrokeColor)?this.feaStrokeColor=[0,0,0,0]:(this.feaStrokeColor=Array.isArray(this.feaStrokeColor)?this.feaStrokeColor.map(t=>255*t):Vn(this.feaStrokeColor).array(),3===this.feaStrokeColor.length&&this.feaStrokeColor.push(255))),a){let t=a(this.options.zoom,p);Ji(t)&&(t=1),this.feaOpacity=255*t}if(this.dasharrayFn){let t=this.dasharrayFn(this.options.zoom,p)||[0,0,0,0];if(t.length<4){const n=t;1===t.length?t=[n[0],n[0],n[0],n[0]]:2===t.length?t=[n[0],n[1],n[0],n[1]]:3===t.length&&(t=[n[0],n[1],n[2],n[2]])}this.feaDash=t}if(this.dashColorFn){let t=(this.dashColorFn?this.dashColorFn(this.options.zoom,p):this.symbol.lineDashColor)||[0,0,0,0];t=Array.isArray(t)?t.map(t=>255*t):Vn(t).array(),3===t.length&&t.push(255),this.feaDashColor=t}if(this.iconAtlas){const n=t.getLineResource(),i=this.iconAtlas.glyphMap[n];if(this.feaTexInfo=this.feaTexInfo||[0,0,0,0],i){const{tl:t,displaySize:i}=this.iconAtlas.positions[n];this.feaTexInfo[0]=t[0]+1,this.feaTexInfo[1]=t[1]+1,this.feaTexInfo[2]=i[0]-3,this.feaTexInfo[3]=i[1]-3}else this.feaTexInfo[0]=this.feaTexInfo[1]=this.feaTexInfo[2]=this.feaTexInfo[3]=0;this.feaJoinPatternMode=h?h(this.options.zoom,p)||0:d.lineJoinPatternMode||0}if(u){let t=u(this.options.zoom,p);Ji(t)&&(t=0),this.feaLineDx=t}if(l){let t=l(this.options.zoom,p);Ji(t)&&(t=0),this.feaLineDy=t}if(c){let t=c(this.options.zoom,p);Ji(t)&&(t=0),0!==t&&(this.properties.hasPatternAnim=1),this.feaPatternAnimSpeed=t}if(f){let t=f(this.options.zoom,p);Ji(t)&&(t=0),this.feaLinePatternGap=t}const b=this.options.EXTENT;let x=y.geometry;b!==1/0&&3!==y.type&&(x=rr(y.geometry,-1,-1,b+1,b+1));for(let t=0;t<x.length;t++)this.offset=this.data.aPosition.length/3,this.K(x[t],y,w,M,2,1.05),v&&(this.tt(g),this.elements=[]);v&&(this.elements=g)}nt(){return this.iconAtlas&&this.feaTexInfo[2]&&this.feaTexInfo[3]}K(t,n,i,e,r,s){const o=this.nt()||Fr(this.feaDash)||Fr(this.symbol.lineDasharray);this.overscaling=1;const a=this.options.EXTENT;if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.symbol.lineGradientProperty&&n.properties&&Qi(n.properties,"mapbox_clip_start")&&Qi(n.properties,"mapbox_clip_end")){this.clipStart=+n.properties.mapbox_clip_start,this.clipEnd=+n.properties.mapbox_clip_end;for(let n=0;n<t.length-1;n++)this.totalDistance+=t[n].dist(t[n+1]);this.updateScaledDistance()}const h=3===n.type;let u=t.length;for(;u>=2&&t[u-1].equals(t[u-2]);)u--;let l=0;for(;l<u-1&&t[l].equals(t[l+1]);)l++;if(u<(h?3:2))return;"bevel"===i&&(r=1.05);const c=this.overscaling<=16?15*a/(512*this.overscaling):0,f={vertexLength:0,primitiveLength:0};let d,y,v,p,m;this.e1=this.e2=-1,h&&(d=t[u-2],m=t[l].sub(d)._().O());for(let n=l;n<u;n++){if(v=n===u-1?h?t[l+1]:void 0:t[n+1],v&&t[n].equals(v))continue;m&&(p=m),d&&(y=d),d=t[n],m=v?v.sub(d)._().O():p,p=p||m;let a=p.add(m);0===a.x&&0===a.y||a._();const g=p.x*m.x+p.y*m.y,w=a.x*m.x+a.y*m.y,M=0!==w?1/w:1/0,b=2*Math.sqrt(2-2*w),x=w<gr&&y&&v,F=p.x*m.y-p.y*m.x>0;if(!o&&x&&n>l){const t=d.dist(y);if(t>2*c){const n=d.sub(d.sub(y).F(c/t).I());this.updateDistance(y,n),this.addCurrentVertex(n,p,0,0,f),y=n}}const A=y&&v;let k=A?i:h?"butt":e;if(A&&"round"===k&&(M<s?k="miter":M<=2&&(k="fakeround")),"miter"===k&&M>r&&(k="bevel"),"bevel"===k&&(M>2&&(k="flipbevel"),M<r&&(k="miter")),y&&this.updateDistance(y,d),(n>l&&n<u-1||h&&n===u-1)&&o){const t=this.feaJoinPatternMode?0:-p.mag()*w;this.addCurrentVertex(d,p,t,t,f),this.it=1}if("miter"===k)a.F(M),this.addCurrentVertex(d,a,0,0,f);else if("flipbevel"===k){if(M>100)a=m.mult(-1);else{const t=M*p.add(m).mag()/p.sub(m).mag();a.O().F(t*(F?-1:1))}this.addCurrentVertex(d,a,0,0,f),this.addCurrentVertex(d,a.mult(-1),0,0,f)}else if("bevel"===k||"fakeround"===k){const t=-Math.sqrt(M*M-1),n=F?t:0,i=F?0:t;if(y&&this.addCurrentVertex(d,p,n,i,f),"fakeround"===k){const t=Math.round(180*b/Math.PI/20);for(let n=1;n<t;n++){let i=n/t;if(.5!==i){const t=i-.5;i+=i*t*(i-1)*((1.0904+g*(g*(3.55645-1.43519*g)-3.2452))*t*t+(.848013+g*(.215638*g-1.06021)))}const e=m.sub(p).F(i).u(p)._().F(F?-1:1);this.addHalfVertex(d,e.x,e.y,!1,F,0,f)}}v&&this.addCurrentVertex(d,m,-n,-i,f)}else if("butt"===k)this.addCurrentVertex(d,a,0,0,f);else if("square"===k){const t=y?1:-1;this.addCurrentVertex(d,a,t,t,f)}else"round"===k&&(y&&(this.addCurrentVertex(d,p,0,0,f),this.addCurrentVertex(d,p,1,1,f,!0)),v&&(this.addCurrentVertex(d,m,-1,-1,f,!0),this.addCurrentVertex(d,m,0,0,f)));if(!o&&x&&n<u-1){const t=d.dist(v);if(t>2*c){const n=d.add(v.sub(d).F(c/t).I());this.updateDistance(d,n),this.addCurrentVertex(n,m,0,0,f),d=n}}if((n>l&&n<u-1||h&&n===l)&&o){delete this.it;const t=this.feaJoinPatternMode?0:m.mag()*w;this.addCurrentVertex(d,m,t,t,f)}}}addCurrentVertex(t,n,i,e,r,s=!1){const o=n.y*e-n.x,a=-n.y-n.x*e;this.addHalfVertex(t,n.x+n.y*i,n.y-n.x*i,s,!1,i,r),this.addHalfVertex(t,o,a,s,!0,-e,r),this.distance>wr/2&&0===this.totalDistance&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,n,i,e,r,s))}addHalfVertex({x:t,y:n},i,e,r,s,o,a){this.fillData(this.data,t,n,i,e,r,s,1*this.scaledDistance);const h=a.vertexLength++;this.e1>=0&&this.e2>=0&&(this.addElements(this.e1,this.e2,h),a.primitiveLength++),s?this.e2=h:this.e1=h}fillData(t,n,i,e,r,s,o,a){const{lineWidthFn:h,lineStrokeWidthFn:u,lineStrokeColorFn:l,lineColorFn:c,lineOpacityFn:f,lineDxFn:d,lineDyFn:y,linePatternAnimSpeedFn:v,linePatternGapFn:p}=this.C;if(this.options.center?t.aPosition.push(n,i,0):t.aPosition.push(n=(n<<1)+(s?1:0),i=(i<<1)+(o?1:0),0),t.aExtrude.push(63*e,63*r),this.options.center||this.iconAtlas){let n=0;this.options.center&&(n+=2*s+o),this.iconAtlas&&(n+=4*(this.it&&this.feaJoinPatternMode?1:0)),t.aExtrude.push(n)}t.aLinesofar.push(a),h&&t.aLineWidth.push(Math.round(2*this.feaLineWidth)),u&&t.aLineStrokeWidth.push(Math.round(2*this.feaLineStrokeWidth)),c&&t.aColor.push(...this.feaColor),l&&t.aStrokeColor.push(...this.feaStrokeColor),f&&t.aOpacity.push(this.feaOpacity),this.dasharrayFn&&t.aDasharray.push(...this.feaDash),this.dashColorFn&&t.aDashColor.push(...this.feaDashColor),this.iconAtlas&&t.aTexInfo.push(...this.feaTexInfo),d&&t.aLineDx.push(this.feaLineDx),y&&t.aLineDy.push(this.feaLineDy),v&&t.aLinePatternAnimSpeed.push(127*this.feaPatternAnimSpeed),p&&t.aLinePatternGap.push(10*this.feaLinePatternGap),this.maxPos=Math.max(this.maxPos,Math.abs(n)+1,Math.abs(i)+1)}addElements(t,n,i){super.addElements(this.offset+t,this.offset+n,this.offset+i)}tt(t){const n=this.options.EXTENT,i=this.elements;for(let e=0;e<i.length;e+=3)n!==1/0&&(xr(this.data.aPosition,i[e],i[e+1],3,n)||xr(this.data.aPosition,i[e+1],i[e+2],3,n))||t.push(i[e],i[e+1],i[e+2])}et(t){if(t.length<=1)return t;const n=[],i=this.options.EXTENT;let e,r=!0;for(e=0;e<t.length-1;e++){const s=br(t[e],t[e+1],i);s&&r||(n.push(t[e]),r=s)}return r||n.push(t[e]),n}updateDistance(t,n){this.distance+=t.dist(n),this.updateScaledDistance()}updateScaledDistance(){this.scaledDistance=this.totalDistance>0?(this.clipStart+(this.clipEnd-this.clipStart)*this.distance/this.totalDistance)*(wr-1):this.distance}}function br(t,n,i){return i!==1/0&&(t.x<0&&n.x<0||t.x>i&&n.x>i||t.y<0&&n.y<0||t.y>i&&n.y>i)}function xr(t,n,i,e,r){if(r===1/0)return!1;const s=Math.floor(.5*t[n*e]),o=Math.floor(.5*t[n*e+1]),a=Math.floor(.5*t[i*e]),h=Math.floor(.5*t[i*e+1]);return s===a&&(s<0||s>r)&&o!==h||o===h&&(o<0||o>r)&&s!==a}function Fr(t){if(!Array.isArray(t))return!1;for(let n=0;n<t.length;n++)if(t[n])return!0;return!1}class Ar extends Mr{constructor(t,n,i){super(t,n,i),this.rt=i.altitudeProperty}getFormat(){const{lineColorFn:t,lineWidthFn:n}=this.C,i=[{type:Int16Array,width:3,name:"aPosition"},{type:Uint16Array,width:1,name:"aLinesofar"},{type:Uint8Array,width:1,name:"aUp"},{type:Int16Array,width:3,name:"aExtrudedPosition"},{type:Int8Array,width:2,name:"aExtrude"}];return t&&i.push({type:Uint8Array,width:4,name:"aColor"}),n&&i.push({type:Uint8Array,width:1,name:"aLineWidth"}),this.rt&&i.push({type:Array,width:1,name:"aLineHeight"}),i}placeVector(t){const n=t.feature;if(this.rt){const{altitudeScale:t,altitudeProperty:i,defaultAltitude:e,heightProperty:r,defaultHeight:s,minHeightProperty:o}=this.options,{altitude:a,height:h}=re(n,t,i,e,r,s,o);this.feaAltitude=a,this.feaMinHeight=(a-h)/a*32767,a>this.maxAltitude&&(this.maxAltitude=a)}return super.placeVector(t)}K(t,n,i,e,r,s){const o=this.data.aPosition.length/3;super.K(t,n,i,e,r,s);const a=this.data.aPosition.length/3,h=this.data.aPosition.length/3-this.offset;if(3!==n.type&&h>0&&!1!==this.options.side){const t=!1!==this.options.top?1:0,n=t+4;let i=this.data.aPosition.length/3;for(const t in this.data){const n=this.data[t],e=n.length/i;for(let t=0;t<e;t++)n.push(n[o*e+3*e+t])}i=this.data.aPosition.length/3;for(const t in this.data){const e=this.data[t],r=e.length/i;for(let t=0;t<r;t++)e.push(e[o*r+r*n+t])}i=this.data.aPosition.length/3;for(const t in this.data){const e=this.data[t],r=e.length/i;for(let t=0;t<r;t++)e.push(e[o*r+r*(n+3)+t])}super.addElements(t+1,h+1,h),super.addElements(h,h+1,h+2);const e=this.data.aPosition.length/3-this.offset;i=this.data.aPosition.length/3;for(const t in this.data){const n=this.data[t],e=n.length/i;for(let t=0;t<e;t++)n.push(n[a*e-e+t])}i=this.data.aPosition.length/3;for(const t in this.data){const e=this.data[t],r=e.length/i;for(let t=0;t<r;t++)e.push(e[a*r-n*r-r+t])}i=this.data.aPosition.length/3;for(const t in this.data){const e=this.data[t],r=e.length/i;for(let t=0;t<r;t++)e.push(e[a*r-n*r-3*r+t])}super.addElements(e,h-3,e+1),super.addElements(h-3,e+2,e+1)}}fillData(t,n,i,e,r,s,o,a){const h=!1!==this.options.top,u=!1!==this.options.side,l=this.feaLineWidth||this.symbol.lineWidth/2*(this.options.EXTENT/this.options.tileSize),c=63*e,f=63*r,d=l*e+n,y=l*r+i;this.st(t,n,i,e,r,s,o,a,d,y,c,f),u&&(h&&this.st(t,n,i,e,r,s,o,a,d,y,c,f),this.st(t,n,i,e,r,s,o,a,d,y,c,f),this.ot(t,n,i,e,r,s,o,a,d,y,c,f),this.ot(t,n,i,e,r,s,o,a,d,y,c,f)),this.maxPos=Math.max(this.maxPos,Math.abs(n),Math.abs(i))}st(t,n,i,e,r,s,o,a,h,u,l,c){const{lineColorFn:f,lineWidthFn:d}=this.C;t.aPosition.push(n,i,32767),t.aLinesofar.push(a),t.aUp.push(+o),t.aExtrudedPosition.push(h,u,1),t.aExtrude.push(l,c),f&&t.aColor.push(...this.feaColor),d&&t.aLineWidth.push(Math.round(2*this.feaLineWidth)),this.rt&&t.aLineHeight.push(this.feaAltitude)}ot(t,n,i,e,r,s,o,a,h,u,l,c){const{lineColorFn:f,lineWidthFn:d}=this.C;t.aPosition.push(n,i,this.feaMinHeight||0),t.aLinesofar.push(a),t.aUp.push(+o),t.aExtrudedPosition.push(h,u,1),t.aExtrude.push(l,c),f&&t.aColor.push(...this.feaColor),d&&t.aLineWidth.push(Math.round(2*this.feaLineWidth)),this.rt&&t.aLineHeight.push(this.feaAltitude)}addElements(t,n,i){const e=!1!==this.options.top,r=!1!==this.options.side,s=(e?1:0)+(r?4:0);if(t*=s,n*=s,this.data.aUp[this.offset+(i*=s)+4]){if(e&&super.addElements(n,t,i),r){const t=e?1:0;super.addElements(n+t,i+t,i+t+2),super.addElements(n+t+1,i+t+1+2,n+t+1+2)}}else if(e&&super.addElements(t,i,n),r){const n=e?1:0;super.addElements(t+n,t+n+2,i+n),super.addElements(t+n+1+2,i+n+1+2,i+n+1)}}createDataPack(t,n){this.maxAltitude=0;const i=super.createDataPack(t,n);if(!i)return i;const{data:e,indices:r}=i;this.getFormat().reduce((t,n)=>(t[n.name]={size:n.width},t),{}).aPickingId={size:1};const{aExtrudedPosition:s,aPosition:o,aLinesofar:a,aUp:h,aExtrude:u,aColor:l,aLineHeight:c,aLineWidth:f}=e,d={},y=Xn(s,r);let v,p=!0;for(let t=0;t<y.length;t++)y[t]=-y[t],y[t]%1!=0&&(p=!1);if(!1!==this.options.top&&this.symbol.material&&function(t){for(const n in t)if(n.indexOf("Texture")>=0&&t[n])return!0;return!1}(this.symbol.material)&&(v=function(t,n,i){const e=[];for(let r=0;r<t.length;r+=3){const t=n[r/3];e.push(t/256,i[r/3]?1:0)}return e}(s,a,h)),d.aPosition=o,v&&(d.aTexCoord0=new Float32Array(v)),d.aNormal=p?new Int8Array(y):new Float32Array(y),d.aPickingId=e.aPickingId,d.aExtrude=u,l&&(d.aColor=l),f&&(d.aLineWidth=f),c){const t=Wi(this.maxAltitude);d.aLineHeight=new t(c)}const m=[];for(const t in d)m.push(d[t].buffer);return i.data=d,i.buffers=m,i}}const kr=Math.pow(2,16)/1;class Pr extends le{getFormat(){return[{type:Int16Array,width:3,name:"aPosition"}]}placeVector(t){const n=t.feature,i=3===n.type,e=n.geometry,r=this.elements;i&&(this.elements=[]);for(let t=0;t<e.length;t++)this.offset=this.data.aPosition.length/3,this.K(e[t],n),i&&(this.tt(r),this.elements=[]);i&&(this.elements=r)}K(t,n){const i=3===n.type;let e=t.length;for(;e>=2&&t[e-1].equals(t[e-2]);)e--;let r,s,o,a=0;for(;a<e-1&&t[a].equals(t[a+1]);)a++;if(!(e<(i?3:2))){this.distance=0,this.vertexLength=0,this.primitiveLength=0,this.e1=this.e2=this.e3=-1,i&&(r=t[e-2]);for(let n=a;n<e;n++)o=i&&n===e-1?t[a+1]:t[n+1],o&&t[n].equals(o)||(r&&(s=r),r=t[n],s&&(this.distance+=r.dist(s)),this.addCurrentVertex(r,this.distance))}}addCurrentVertex(t,n){const i=this.vertexLength++;this.addLineVertex(this.data,t,n),i>=1&&this.addElements(i-1,i),n>kr&&(this.distance=0,this.addCurrentVertex(t,this.distance))}addLineVertex(t,n){t.aPosition.push(n.x,n.y,0),this.maxPos=Math.max(this.maxPos,Math.abs(n.x),Math.abs(n.y))}addElements(t,n){super.addElements(this.offset+t,this.offset+n)}tt(t){const n=this.options.EXTENT,i=this.elements;for(let e=0;e<i.length;e+=2)ie(this.data.aPosition,i[e],i[e+1],3,n)||t.push(i[e],i[e+1])}}const Sr=45*Math.PI/100;class _r extends le{getFormat(){return[{type:Int16Array,width:3,name:"aPosition"}]}placeVector(t){const n=this.G(t,this.symbol.markerSpacing||250,this.symbol.markerPlacement||"point"),i=this.getAltitude(t.feature.properties);for(let t=0;t<n.length;t++){const e=n[t];this.data.aPosition.push(e.x,e.y),this.data.aPosition.push(i);const r=Math.max(Math.abs(e.x),Math.abs(e.y));r>this.maxPos&&(this.maxPos=r)}}G(t,n,i){const e=t.feature,r=t.feature.type,s=this.options.EXTENT,o=[];if("line"===i){let t=e.geometry;s&&(t=rr(e.geometry,0,0,s,s));for(let i=0;i<t.length;i++){const e=ar(t[i],n,Sr,null,null,24,1,1,s||1/0);o.push.apply(o,e)}}else if(3===r){const t=ur(e.geometry,0);for(let n=0;n<t.length;n++){const i=fr(t[n],16);se(i,s)||o.push(i)}}else if(2===e.type)for(let t=0;t<e.geometry.length;t++){const n=e.geometry[t];se(n[0],s)||o.push(n[0])}else if(1===e.type)for(let t=0;t<e.geometry.length;t++){const n=e.geometry[t];for(let t=0;t<n.length;t++){const i=n[t];se(i,s)||o.push(i)}}return o}hasElements(){return!1}}\n/*!\n * from @turf/bboxClip\n * https://github.com/Turfjs/turf\n * MIT LICENSE\n */const Or=[],Ir=[];function Tr(t,n){var i,e,r,s,o,a,h;for(e=1;e<=8;e*=2){for(i=[],s=!(Ur(r=t[t.length-1],n)&e),o=0;o<t.length;o++){if((h=!(Ur(a=t[o],n)&e))!==s){const t=Lr(r,a,e,n);i.push(void 0!==a.x?new Ht(t[0],t[1]):t)}h&&i.push(a),r=a,s=h}if(!(t=i).length)break}return i}function Lr(t,n,i,e){return Or[0]=void 0===t.x?t[0]:t.x,Or[1]=void 0===t.y?t[1]:t.y,t=Or,Ir[0]=void 0===n.x?n[0]:n.x,Ir[1]=void 0===n.y?n[1]:n.y,n=Ir,8&i?[t[0]+(n[0]-t[0])*(e[3]-t[1])/(n[1]-t[1]),e[3]]:4&i?[t[0]+(n[0]-t[0])*(e[1]-t[1])/(n[1]-t[1]),e[1]]:2&i?[e[2],t[1]+(n[1]-t[1])*(e[2]-t[0])/(n[0]-t[0])]:1&i?[e[0],t[1]+(n[1]-t[1])*(e[0]-t[0])/(n[0]-t[0])]:null}function Ur(t,n){Or[0]=void 0===t.x?t[0]:t.x,Or[1]=void 0===t.y?t[1]:t.y;var i=0;return(t=Or)[0]<n[0]?i|=1:t[0]>n[2]&&(i|=2),t[1]<n[1]?i|=4:t[1]>n[3]&&(i|=8),i}class zr extends le{constructor(...t){super(...t),this.lineElements=[]}createStyledVector(t,n,i,e,r){const s=new he(t,n,i,e),o=s.getPolygonResource();return!this.options.atlas&&o&&(r[o]=[0,0]),s}getFormat(){const t=[{type:Int16Array,width:3,name:"aPosition"}],{polygonFillFn:n,polygonOpacityFn:i,uvScaleFn:e,uvOffsetFn:r}=this.C;if(this.iconAtlas){const n=this.getIconAtlasMaxValue();t.push({type:n>255?Uint16Array:Uint8Array,width:4,name:"aTexInfo"})}return n&&t.push({type:Uint8Array,width:4,name:"aColor"}),i&&t.push({type:Uint8Array,width:1,name:"aOpacity"}),e&&t.push({type:Uint16Array,width:2,name:"aUVScale"}),r&&t.push({type:Uint8Array,width:2,name:"aUVOffset"}),t}createDataPack(...t){this.maxLineIndex=0,this.lineElements=[];const n=super.createDataPack(...t);if(!n)return n;let i=this.lineElements;return i=new($i(this.maxLineIndex))(this.lineElements),n.lineIndices=i,n.buffers.push(i.buffer),n}placeVector(t,n){const i=t.feature;this.at(i.geometry,i,n)}at(t,n){let i,e,r,s;const{polygonFillFn:o,polygonOpacityFn:a,uvScaleFn:h,uvOffsetFn:u}=this.C,l=n.properties;o&&(i=o(this.options.zoom,l)||[255,255,255,255],m(i)?i=[0,0,0,0]:(i=Array.isArray(i)?i.map(t=>255*t):Vn(i).array(),3===i.length&&i.push(255))),a&&(e=a(this.options.zoom,l),Ji(e)&&(e=1),e*=255),h&&(r=h(this.options.zoom,l),Ji(r)&&(r=[1,1]),r=[255*r[0],255*r[1]]),u&&(s=u(this.options.zoom,l),Ji(s)&&(s=[0,0]),s=[255*s[0],255*s[1]]);const c=!!this.iconAtlas,f=ur(t,500),d=this.getAltitude(l),y=[0,0],v=[0,0];if(c){const{polygonPatternFileFn:t}=this.C,n=t?t(null,l):this.symbol.polygonPatternFile;if(this.iconAtlas.glyphMap[n]){const t=this.iconAtlas.positions[n];y[0]=t.tl[0]+1,y[1]=t.tl[1]+1,v[0]=t.displaySize[0]-3,v[1]=t.displaySize[1]-3}}const p=[-1,-1,n.extent+1,n.extent+1];for(let t=0;t<f.length;t++){const n=f[t],o=this.data.aPosition.length/3,a=[],h=[];for(let t=0;t<n.length;t++){let o=n[t];if(this.options.EXTENT!==1/0&&(o=Tr(o,p)),0===o.length)continue;0!==t&&h.push(a.length/2);const u=this.lineElements.length;this.data.aPosition.push(o[0].x,o[0].y,d),c&&this.data.aTexInfo.push(...y,...v),void 0!==i&&this.data.aColor.push(...i),void 0!==e&&this.data.aOpacity.push(e),void 0!==r&&this.data.aUVScale.push(...r),void 0!==s&&this.data.aUVOffset.push(...s),this.maxPos=Math.max(this.maxPos,Math.abs(o[0].x),Math.abs(o[0].y)),this.addLineElements(u+o.length-1,u),a.push(o[0].x),a.push(o[0].y);for(let t=1;t<o.length;t++)this.data.aPosition.push(o[t].x,o[t].y,d),c&&this.data.aTexInfo.push(...y,...v),void 0!==i&&this.data.aColor.push(...i),void 0!==e&&this.data.aOpacity.push(e),void 0!==r&&this.data.aUVScale.push(...r),void 0!==s&&this.data.aUVOffset.push(...s),this.maxPos=Math.max(this.maxPos,Math.abs(o[t].x),Math.abs(o[t].y)),this.addLineElements(u+t-1,u+t),a.push(o[t].x),a.push(o[t].y)}const u=ki(a,h);for(let t=0;t<u.length;t+=3)this.addElements(o+u[t],o+u[t+1],o+u[t+2])}}addLineElements(...t){this.maxLineIndex=Math.max(this.maxLineIndex,...t),this.lineElements.push(...t)}}var Dr=Object.freeze({__proto__:null,clipPolygon:Tr,calculateSignedArea:ne,getFeaAltitudeAndHeight:re,convertRTLText:tr});const Er={polygonPatternFile:1,markerFile:1,markerPlacement:1,markerSpacing:1,textName:1,textStyle:1,textFaceName:1,textWeight:1,textPlacement:1,textSpacing:1,lineJoin:1,lineCap:1,linePatternFile:1};Object.assign({visible:1,textHorizontalAlignment:1,textVerticalAlignment:1,textWrapWidth:1,markerHorizontalAlignment:1,markerVerticalAlignment:1},Er),Object.assign({lineDasharray:1},Er);function Cr(t,n,i,e,r,s,o,a,h,u,l,c,f,d,y){const v=n.length,p=r/3;for(let i=2,e=v;i<e;i+=3)t[r+i-2]=n[i-2],t[r+i-1]=n[i-1],t[r+i-0]=n[i]-s;r+=v;for(let i=2,e=v;i<e;i+=3)t[r+i-2]=n[i-2],t[r+i-1]=n[i-1],t[r+i-0]=n[i]-o;r+=v;for(let i=2,e=v;i<e;i+=3)t[r+i-2]=n[i-2],t[r+i-1]=n[i-1],t[r+i-0]=n[i]-s;r+=v;for(let i=2,e=v;i<e;i+=3)t[r+i-2]=n[i-2],t[r+i-1]=n[i-1],t[r+i-0]=n[i]-o;r+=v,(i=i||[]).push(v/3);for(let n=0;n<i.length;n++){jr(p+(i[n-1]||0),p+i[n],t,v/3,a,e,h,u,l,c,f,d,y)}return r}function jr(t,n,i,e,r,s,o,a,h,u,l,c,f){const d=s.length;let y,v;for(let o=t,a=n;o<a-1;o++)y=o,v=o+1,ct(i,y,v,r)||((o-t)%2==1&&(y+=2*e,v+=2*e),s.push(y+e,y,v),s.push(v,v+e,y+e));o&&function(t,n,i,e,r,s,o,a,h){let u,l=0,c=0,f=0,d=0;for(let y=e.length-1;y>=0;y--){const v=3*e[y],p=3*e[y]+1,m=3*e[y]+2,g=i[v],w=i[p],M=i[m];l||c||(l=Math.max(i[m],i[3*e[y-2]+2]),c=Math.min(i[m],i[3*e[y-2]+2]),u=l-c);let b=f;const x=y%6;0===t?(5===x&&(d=Nt(i,e,y,g,w)),b=2===x||3===x||4===x?f:f+d):1===t&&(2===x||3===x||4===x?b=0:5===x?(d=Nt(i,e,y,g,w),b=d):b=d);const F=b*o*a/r,A=M===l?0:u*h/s;n[v/3*2]=F,n[v/3*2+1]=-A,0===x&&(f+=d)}}(a,h,i,s.slice(d,s.length),u[0],u[1],l,c,f)}function Nr(t,n,i,e,r,s,o,a,h,u){void 0===n.top&&(n.top=!0),void 0===n.side&&(n.side=!0);const{altitudeScale:l,altitudeProperty:c,defaultAltitude:f,heightProperty:d,minHeightProperty:y,defaultHeight:v,tangent:p,uv:m,uvScale:M,topUVMode:b,sideUVMode:x,top:F,side:A,topThickness:k}=n,S=function(t,n,{altitudeScale:i,altitudeProperty:e,defaultAltitude:r,heightProperty:s,minHeightProperty:o,defaultHeight:a},{side:h,top:u,topThickness:l,uvOrigin:c,uv:f,uvSize:d,topUVMode:y,sideUVMode:v,glScale:p,localScale:m,vScale:g},w){const M=n/t[0].extent,b=[],x=[],F=[],A=[],k=[],S=[],_=!!f,O=!!u,T=!!h,z=_?[]:null;function D(t,i,e,r){if(O){const r=ki(A,e,3);if(0===r.length)return i;let s;I(k,A),i+=A.length;for(let n=2,i=r.length;n<i;n+=3)s=r[n-1],r[n-1]=r[n]+t/3,r[n]=s+t/3,r[n-2]+=t/3;I(S,r),_&&Et(y||0,t,i,z,k,0,p,m,d[0],d[1]),l>0&&!T&&(i=Cr(k,A,e,S,i,0,l,n,_,v||0,z,d,p,m,g))}return T&&(O&&(l=0),i=Cr(k,A,e,S,i,l,r,n,_,v||0,z,d,p,m,g)),i}let E=0,C=0;const j=[-1,-1,n+1,n+1];let N=0,H=t.length;void 0!==w&&(N=w,H=w+1);let V=0,R=!1;for(;N<H;N++){const h=t[N],u=h.id;P(u)&&(Math.abs(u)>V&&(V=Math.abs(u)),u<0&&(R=!0));const l=h.geometry,{altitude:c,height:f}=Dr.getFeaAltitudeAndHeight(h,i,e,r,s,a,o);E=Math.max(Math.abs(c),E);const d=k.length;let y=C,v=[];A.length=0;for(let t=0,i=l.length;t<i;t++){const e=Dr.calculateSignedArea(l[t])<0;!e&&t>0&&(C=D(y,C,v,f*M),A.length=0,v=[],y=C);let r=l[t];if(n!==1/0&&(r=Dr.clipPolygon(r,j)),!r.length){t===i-1&&(C=D(y,C,v,f*M));continue}const s=r.length;Array.isArray(r[0])?r[0][0]===r[s-1][0]&&r[0][1]===r[s-1][1]||r.push([r[0][0],r[0][1]]):r[0].x===r[s-1].x&&r[0].y===r[s-1].y||r.push(r[0]),e&&v.push(A.length/3),lt(A,A.length,r,M,c),t===i-1&&(C=D(y,C,v,f*M))}const p=k.length-d,m="__fea_idx".trim();for(let t=0;t<p/3;t++)x.push(void 0===h[m]?N:h[m]),b.push(N),P(u)&&F.push(u)}const $=L(x.length?x[x.length-1]:0),W={maxAltitude:E,vertices:new(U(Math.max(512,E)))(k),indices:S,pickingIds:new $(x),featureIndexes:b};if(F.length){const t=R?U(V):L(V);W.featureIds=new t(F)}else W.featureIds=[];return z&&(z.length=k.length/3*2,W.uvs=z),W}(t,i,{altitudeScale:l,altitudeProperty:c,defaultAltitude:f||0,heightProperty:d,minHeightProperty:y,defaultHeight:v||0},{top:F,side:A,topThickness:10*k||0,uv:m||p,uvSize:M?[.5*M[0],.5*M[1]]:[.5,.5],uvOrigin:e,topUVMode:b,sideUVMode:x,glScale:r,localScale:o,vScale:s},u),_=[],O=new(T(S.vertices.length/3))(S.indices);delete S.indices,_.push(O.buffer,S.vertices.buffer,S.pickingIds.buffer);const z=Xn(S.vertices,O);let E=!0;for(let t=0;t<z.length;t++)z[t]=-z[t],z[t]%1!=0&&(E=!1);if(S.normals=z,p){let t=function(t,n,i,e){const r=t.length/3,s=new Array(4*r),o=[],a=[];for(let t=0;t<r;t++)o[t]=[0,0,0],a[t]=[0,0,0];const h=[0,0,0],u=[0,0,0],l=[0,0,0],c=[0,0],f=[0,0],d=[0,0],y=[0,0,0],v=[0,0,0];function p(n,e,r){Zn(h,t,3*n),Zn(u,t,3*e),Zn(l,t,3*r),Yn(c,i,2*n),Yn(f,i,2*e),Yn(d,i,2*r);const s=u[0]-h[0],p=l[0]-h[0],m=u[1]-h[1],g=l[1]-h[1],w=u[2]-h[2],M=l[2]-h[2],b=f[0]-c[0],x=d[0]-c[0],F=f[1]-c[1],A=d[1]-c[1],k=1/(b*A-x*F);bt(y,(A*s-F*p)*k,(A*m-F*g)*k,(A*w-F*M)*k),bt(v,(b*p-x*s)*k,(b*g-x*m)*k,(b*M-x*w)*k),xt(o[n],o[n],y),xt(o[e],o[e],y),xt(o[r],o[r],y),xt(a[n],a[n],v),xt(a[e],a[e],v),xt(a[r],a[r],v)}for(let t=0,n=e.length;t<n;t+=3)p(e[t+0],e[t+1],e[t+2]);const m=[],g=[],w=[],M=[];let b,x,F;function A(t){Zn(w,n,3*t),Mt(M,w),x=o[t],Mt(m,x),St(m,m,function(t,n,i){return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t}(w,w,kt(w,x))),At(m,m),Pt(g,M,x),F=kt(g,a[t]),b=F<0?-1:1,s[4*t]=m[0],s[4*t+1]=m[1],s[4*t+2]=m[2],s[4*t+3]=b}for(let t=0,n=e.length;t<n;t+=3)A(e[t+0]),A(e[t+1]),A(e[t+2]);return s}(S.vertices,S.normals,S.uvs,O);t=function(t,n){const i=new Float32Array(n.length),e=[],r=[],s=[];for(let o=0;o<n.length;o+=4){const a=o/4*3;bt(r,t[a]||0,t[a+1]||0,t[a+2]||0),Ot(e,n[o]||0,n[o+1]||0,n[o+2]||0,n[o+3]||0),Jn(s,r,e),_t(i.subarray(o,o+4),s)}return i}(S.normals,t),S.tangents=t,_.push(t.buffer),delete S.normals}if(S.normals&&(S.normals=E?new Int8Array(S.normals):new Float32Array(S.normals),_.push(S.normals.buffer)),S.uvs){const t=S.uvs;S.uvs=new Float32Array(t),_.push(S.uvs.buffer)}const C=function(t,n,i,e){const r={};if(D(n.polygonFill)){const s={},o=w(n.polygonFill),a=new Uint8Array(4*e.length);for(let n=0;n<e.length;n++){const r=t[e[n]],h=r.properties||{};h.$layer=r.layer,h.$type=r.type;let u=o(i,h);if(delete h.$layer,delete h.$type,Array.isArray(u)||(u=s[u]=s[u]||Vn(u).array()),Array.isArray(u)){for(let t=0;t<u.length;t++)Hr[t]=255*u[t];3===u.length&&(Hr[3]=255)}a[4*n]=Hr[0],a[4*n+1]=Hr[1],a[4*n+2]=Hr[2],a[4*n+3]=Hr[3]}r.aColor=a}if(D(n.polygonOpacity)){const s=g(n.polygonOpacity),o=new Uint8Array(e.length);for(let n=0;n<e.length;n++){const r=t[e[n]],a=r.properties||{};a.$layer=r.layer,a.$type=r.type;const h=s(i,a);delete a.$layer,delete a.$type,o[n]=255*h}r.aOpacity=o}return r}(t,a,h,S.featureIndexes),j={data:{data:{aPosition:S.vertices,aNormal:S.normals,aTexCoord0:S.uvs,aTangent:S.tangents,aPickingId:S.pickingIds},indices:O,properties:{maxAltitude:S.maxAltitude}},buffers:_};return S.featureIds.length?(j.data.featureIds=S.featureIds,_.push(j.data.featureIds.buffer)):j.data.featureIds=[],C.aColor&&(j.data.data.aColor=C.aColor,j.buffers.push(C.aColor.buffer)),C.aOpacity&&(j.data.data.aOpacity=C.aOpacity,j.buffers.push(C.aOpacity.buffer)),j}const Hr=[];function Vr(t,n,{altitudeScale:i,altitudeProperty:e,defaultAltitude:r,heightProperty:s,minHeightProperty:o,defaultHeight:a,bottom:h}){const u=h,l=n/t[0].extent,c=2*function(t,n){let i=0;for(let e=0,r=t.length;e<r;e++){const r=t[e];if(P(r.geometry[0][0])){const t=3*r.geometry.length;i+=n?2*t-6:t}else for(let t=0,e=r.geometry.length;t<e;t++){let e=3*r.geometry[t].length;3===r.type&&(e-=3),i+=n?2*e-6:e}}return i}(t)+3*t.length*2,f=[],d=new Int16Array(c),y=[];function v(t,i,e){const r=i-t,s=d.subarray(t,i),o=d.subarray(i,i+r);o.set(s);for(let t=2,n=o.length;t<n;t+=3)o[t]=s[t]-e;const a=t/3,h=r/3;let l,c;for(let t=a,i=h+a;t<i;t++)t<i-1?(l=t,c=t+1):(l=t,c=a),ct(d,l,c,n)||(y.push(l,c),u&&y.push(l+h,c+h),Rr(d,l,n)||y.push(l,l+h));return i+r}let p=0,m=0;const g="__fea_idx".trim();for(let n=0,h=t.length;n<h;n++){const h=t[n],u=h.geometry,{altitude:c,height:w}=Dr.getFeaAltitudeAndHeight(h,i,e,r,s,a,o);m=Math.max(Math.abs(c),m);let M=p;for(let t=0,n=u.length;t<n;t++){let n=u[t];const i=n.length;n[0][0]===n[i-1][0]&&n[0][1]===n[i-1][1]&&(n=n.slice(0,i-1)),p=lt(d,M,n,l,c),p=v(M,p,w*l),M=p}const b=y.length-f.length;for(let t=0;t<b;t++)f.push(h[g])}const w=new(T(y.reduce((t,n)=>Math.max(t,n),0)))(y),M=L(t.length);return{aPosition:new(U(Math.max(512,m)))(d),indices:w,aPickingId:new M(f)}}function Rr(t,n,i){const e=t[3*n],r=t[3*n+1];return e<0||e>i||r<0||r>i}function $r(t,n,i){const e=Vr(t,i,n),r=[e.aPosition.buffer,e.indices.buffer,e.aPickingId.buffer],s=e.indices;return delete e.indices,{data:{data:e,indices:s},buffers:r}}class Wr{constructor(t,n,i,e,r){this.id=t,this.options=n,this.upload=i,this.ht(n.style),this.requests={},this.ut=0,this.lt=e,this.loadings=r}updateStyle(t,n){this.options.style=t,this.ht(t),this.ut++,n()}updateOptions(t,n){this.options=A(this.options,t),n()}loadTile(t,n){const i=this.loadings,e=t.tileInfo.url,r=this.options.debugTile;if(r){const{x:i,y:e,z:s}=t.tileInfo;if(s!==r.z||i!==r.x||e!==r.y)return void n()}if(this.lt.has(e)){const{features:r,layers:s}=this.lt.get(e),o=i[e];if(delete i[e],!r||!r.length)return this.ct(o),void n();if(o)for(let n=0;n<o.length;n++)this.ft.call(o[n].ref,t,o[n].callback,e,s,r);this.ft(t,n,e,s,r)}else i[e]?i[e].push({callback:n,ref:this}):(i[e]=[{callback:n,ref:this}],this.requests[e]=this.getTileFeatures(t.tileInfo,(n,r,s,o)=>{const a=i[e];if(delete i[e],this.checkIfCanceled(e))return delete this.requests[e],void this.ct(a,null,{canceled:!0});if(delete this.requests[e],this.options.debug&&r)for(let n=0;n<r.length;n++)r[n]._debug_info={index:n,tileId:t.tileInfo.id};if(n)return n.loading||this.lt.add(e,{features:[],layers:[]}),void this.ct(a,n);if(!r||!r.length)return this.lt.add(e,{features:[],layers:[]}),void this.ct(a);if(this.lt.add(e,{features:r,layers:s}),a)for(let n=0;n<a.length;n++)this.ft.call(a[n].ref,t,a[n].callback,e,s,r,o)}))}ft(t,n,i,e,r,s){this.dt(e,r,t).then(t=>{t.canceled?n(null,{canceled:!0}):(t.data.style=this.ut,s&&A(t.data,s),n(null,t.data,t.buffers))}).catch(t=>{n(t)})}abortTile(t,n){delete this.requests[t],this.yt(t),n()}yt(t){const n=this.loadings[t];if(n)for(let t=0;t<n.length;t++)n[t].callback(null,{canceled:!0});delete this.loadings[t]}ct(t,n,i){if(t)for(let e=0;e<t.length;e++)t[e].callback(n,i)}checkIfCanceled(t){return!this.requests[t]}fetchIconGlyphs(t,n,i){this.upload("fetchIconGlyphs",{icons:t,glyphs:n},null,i)}dt(t,n,{glScale:i,zScale:e,tileInfo:r}){if(!n.length)return Promise.resolve({data:null,buffers:[]});const s=!this.options.style.style.length&&!this.options.style.featureStyle.length;let o=this.pluginConfig.slice(0);s&&(o=this.vt(t)),this.featurePlugins&&I(o,this.featurePlugins);const a=n[0].extent,h=r.z,u={x:r.extent2d.xmin*i,y:r.extent2d.ymax*i},l=[],c=[],f=[],d=this.options,y=[],v={},p=[Promise.resolve(this.ut)];let m=0,g=-1;for(let t=0;t<o.length;t++){g++;const r=o[t];r.type!==m&&(g=0,m=r.type);const d=0===r.type?l:c;if(r.symbol&&!1===r.symbol.visible){d[g]=null;continue}const{tileFeatures:w,tileFeaIndexes:M}=this.pt(r.type,r.filter,n,v,t);if(!w.length){d[g]=null;continue}const b=T(M[M.length-1]);d[g]={styledFeatures:new b(M)},f.push({idx:t,typeIdx:g}),y.push(d[g].styledFeatures.buffer);let x=this.gt(w,r,{extent:a,tilePoint:u,glScale:i,zScale:e,zoom:h});s&&(x=x.then(t=>{if(!t)return null;if(t.data)t.data.layer=w[0].layer;else if(Array.isArray(t))for(let n=0;n<t.length;n++)t[n]&&t[n].data&&(t[n].data.layer=w[0].layer);return t})),p.push(x)}return Promise.all(p).then(([i,...e])=>{function r(t,n){if(void 0===t.data.ref&&(t.data.type=o[f[n].idx].renderPlugin.dataConfig.type,t.data.filter=o[f[n].idx].filter.def,t.buffers&&t.buffers.length))for(let n=0;n<t.buffers.length;n++)y.push(t.buffers[n])}if(i!==this.ut)return{canceled:!0};for(let t=0;t<e.length;t++){if(!e[t])continue;const n=e[t],i=0===o[f[t].idx].type?l:c;if(Array.isArray(n)){const e=[];for(let i=0;i<n.length;i++)n[i]&&(r(n[i],t),(void 0===n[i].data.ref||n[n[i].data.ref])&&e.push(n[i].data));e.length&&(i[f[t].typeIdx].data=e)}else r(n,t),i[f[t].typeIdx].data=n.data}const s={},h=t;if(d.features||d.schema){let t;for(let i=0,e=n.length;i<e;i++)if(t=n[i],h[t.layer].properties||(h[t.layer].properties=Gr(t.properties)),d.features&&t&&v[i])if("id"===d.features)s[i]=t.id;else{const n=A({},t);d.pickingGeometry||delete n.geometry,delete n.extent,delete n.properties.$layer,delete n.properties.$type,delete n.__index,s[i]=n}}return{data:{schema:h,data:l,featureData:c,extent:a,features:s},buffers:y}})}gt(t,n,i){const e=n.renderPlugin.dataConfig,r=n.symbol,s=this.options.tileSize[0],{extent:o,glScale:a,zScale:h,zoom:u,tilePoint:l}=i,c=o/s,f=e.type,d=this.options.debugTile&&this.options.debugTile.index;if("3d-extrusion"===f){const n=Jr(r);return n&&(e.uv=1,2===n&&(e.tangent=1)),Promise.all([Promise.resolve(Nr(t,e,o,l,a,h,this.options.tileSize[1]/o,r,u,d))])}if("3d-wireframe"===f)return Promise.all([Promise.resolve($r(t,e,o))]);if("point"===f){const n=A({},e,{EXTENT:o,requestor:this.fetchIconGlyphs.bind(this),zoom:u,debugIndex:d}),i=mr.splitPointSymbol(r);return mr.needMerge(i[0])&&(t=mr.mergeLineFeatures(t,i[0],u)),Promise.all(i.map(i=>new mr(t,i,n).load(c)))}if("native-point"===f){const n=A({},e,{EXTENT:o,zoom:u,debugIndex:d});return Xr(t,r,n,_r,o/s)}if("line"===f){const n=A({},e,{EXTENT:o,requestor:this.fetchIconGlyphs.bind(this),tileRatio:c,zoom:u,debugIndex:d});return Xr(t,r,n,Mr)}if("native-line"===f){const n=A({},e,{EXTENT:o,zoom:u,debugIndex:d});return Xr(t,r,n,Pr)}if("fill"===f){const n=A({},e,{EXTENT:o,requestor:this.fetchIconGlyphs.bind(this),zoom:u,debugIndex:d});return Xr(t,r,n,zr)}if("line-extrusion"===f){delete r.lineGradientProperty,r.lineJoin="miter",r.lineCap="butt";const n=Jr(r);n&&(e.uv=1,2===n&&(e.tangent=1));const i=A({},e,{EXTENT:o,tileSize:s,zScale:h,glScale:a,zoom:u,debugIndex:d});if(n){const n=[];if(!1!==e.top){const e=A({},i);e.side=!1,n.push(new Ar(t,r,e))}return!1!==e.side&&(i.side=!0,i.top=!1,n.push(new Ar(t,r,i))),Promise.all(n.map(t=>t.load()))}return Promise.all([new Ar(t,r,i).load()])}return Promise.resolve([])}pt(t,n,i,e){const r="__fea_idx".trim(),s=[],o=[],a=i.length;for(let h=0;h<a;h++)if((1===t||void 0===i[h].id||!this.styledFeatures[i[h].id])&&((!n.def||"default"===n.def)&&!e[h]||!0===n.def||Array.isArray(n.def)&&n(i[h]))){e[h]=1;const n=A({},i[h]);if(n[r]=h,o.push(n),s.push(h),1===t)break}return{tileFeatures:o,tileFeaIndexes:s}}ht(t){const{style:n,featureStyle:i}=t,e={};i.forEach(t=>{Array.isArray(t.id)?(t.id.forEach(t=>{e[t]=1}),t.filter=["in","$id",...t.id]):(e[t.id]=1,t.filter=["==","$id",t.id])});const r=z(n);for(let t=0;t<n.length;t++)r[t].filter&&(r[t].filter.def=n[t].filter?n[t].filter.value||n[t].filter:void 0),r[t].type=0;const s=[],o=z(i);for(let t=0;t<i.length;t++)o[t].type=1,o[t].filter.def=i[t].filter?i[t].filter.value||i[t].filter:void 0,o[t].renderPlugin&&s.push(o[t]);this.pluginConfig=r,this.featurePlugins=s,this.styledFeatures=e}vt(t){let n=this.wt;this.wt||(n=this.wt={});const e=["","Point","LineString","Polygon","MultiPoint","MultiLineString","MultiPolygon"],r=[];for(const s in t){const o=s;if(!n[s]){const r=[];for(let n=0;n<t[s].types.length;n++){const a=t[s].types[n],h=["all",["==","$layer",o],["==","$type",e[a]]],u={filter:i(h),renderPlugin:qr(a),symbol:Br(a)};u.filter.def=h,u.type=0,r.push(u)}n[o]=r}r.push(...n[o])}return r}}function qr(t){switch(t){case 1:return{type:"native-point",dataConfig:{type:"native-point",only2D:!0}};case 2:return{type:"native-line",dataConfig:{type:"native-line",only2D:!0}};case 3:return{type:"fill",dataConfig:{type:"fill",only2D:!0}}}return null}function Br(t){switch(t){case 1:return{markerFill:"#f00",markerSize:10};case 2:return{lineColor:"#fff"};case 3:return{polygonFill:"#00f",polygonOpacity:.4}}return null}function Gr(t){if(Array.isArray(t)||!_(t))return{};const n={};for(const i in t){const e=t[i];k(e)?n[i]="string":P(e)?n[i]="number":!0===e||!1===e?n[i]="boolean":Array.isArray(e)?n[i]="array":n[i]="object"}return n}function Jr(t){if(!t)return 0;let n=0;for(const i in t){if(("normalTexture"===i||"bumpTexture"===i)&&t[i])return 2;if(i.indexOf("Texture")>0&&t[i])n=1;else if(_(t[i])){const e=Jr(t[i]);if(2===e)return e;1===e&&(n=1)}}return n}function Xr(t,n,i,e,r){const s={},o=Array.isArray(n)?n:[n];let a=-1;for(let t=0;t<o.length;t++)s[t]=Zr(o[t]),!s[t]&&o[t]&&-1===a&&(a=t);const h=[];for(let n=0;n<o.length;n++)o[n]&&(o[n].index={index:n},s[n]||n===a?h.push(new e(t,o[n],i).load(r)):h.push({data:{ref:a,symbolIndex:{index:n}}}));return Promise.all(h)}function Zr(t){if(!t)return 0;for(const n in t)if(D(t[n]))return 1;return 0}function Yr(t,n){Kr(t.geometry,n)}function Kr(t,n){if(t)switch(t.type){case"Point":Qr(t.coordinates,n);break;case"MultiPoint":case"LineString":ts(t.coordinates,n);break;case"MultiLineString":case"Polygon":ns(t.coordinates,n);break;case"MultiPolygon":!function(t,n){for(let i=0;i<t.length;i++)ns(t[i],n)}(t.coordinates,n);break;case"GeometryCollection":for(let i=0;i<t.geometries.length;i++)Kr(t.geometries[i],n)}}function Qr(t,n){n[0]=Math.min(n[0],t[0]),n[1]=Math.min(n[1],t[1]),n[2]=Math.max(n[2],t[0]),n[3]=Math.max(n[3],t[1])}function ts(t,n){for(let i=0;i<t.length;i++)Qr(t[i],n)}function ns(t,n){for(let i=0;i<t.length;i++)ts(t[i],n)}class is extends Wr{constructor(t,n,i,e,r,s){super(t,n,i,e,r),(n=n||{}).extent||(n.extent=8192),this.zoomOffset=0,n.tileSize&&(this.zoomOffset=-function(t){if(Math.log2)return Math.log2(t);const n=Math.log(t)*Math.LOG2E,i=Math.round(n);return Math.abs(i-n)<1e-14?i:n}(n.tileSize[0]/256)),this.setData(n.data,s)}setData(t,n){if(delete this.index,!t)return void n();const i={maxZoom:24,tolerance:this.options.extent/this.options.tileSize[0]*1,extent:this.options.extent,buffer:this.options.tileBuffer||64,debug:0,lineMetrics:!0,indexMaxZoom:5,indexMaxPoints:1e5};if(k(t)&&"{"!=t.substring(0,1)||t.url)C.getJSON(t.url?t.url:t,t.url?t:{},(t,e)=>{if(t&&n(t),!e)return void n(null,{extent:null,idMap:{}});const r=e,{first1000:s,idMap:o}=this.Mt(r);this.bt(s,o,r,i,n)});else{"string"==typeof t&&(t=JSON.parse(t));const e=Array.isArray(t)?t:t.features;let r=e;e&&e.length>1e3&&(r=e.slice(0,1e3)),this.bt(r,null,t,i,n)}}bt(t,n,i,e,r){try{const s=t&&t.length?function(t){let n=[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY];switch(t.type){case"FeatureCollection":for(let i=0;i<t.features.length;i++)Yr(t.features[i],n);break;case"Feature":Yr(t,n);break;default:Kr(t,n)}return n}({type:"FeatureCollection",features:t}):null;this.index=function(t,n){return new ht(t,n)}(i,this.options.geojsonvt||e),r(null,{extent:s,idMap:n})}catch(t){console.warn(t),r({error:t.message})}}Mt(t){const n=[],i={};let e=0;function r(t){t&&("Feature"!==t.type||t.geometry)&&(void 0!==t.id&&null!==t.id||(t.id=e++),i[t.id]=A({},t),t.geometry?(i[t.id].geometry=A({},t.geometry),i[t.id].geometry.coordinates=null):t.coordinates&&(i[t.id].coordinates=null),n.length<1e3&&n.push(t))}return Array.isArray(t)?t.forEach(t=>{r(t)}):t.features&&t.features.forEach(t=>{r(t)}),{first1000:n,idMap:i}}getTileFeatures(t,n){const i=[];if(!this.index)return setTimeout((function(){n({loading:!0})}),1),1;const e=this.index.getTile(t.z+this.zoomOffset,t.x,t.y);if(!e||0===e.features.length)return setTimeout((function(){n(null,i,[])}),1),1;const r=[];for(let t=0,n=e.features.length;t<n;t++){const n=e.features[t];let s=n.layer;void 0===s&&(s="0"),r[s]={types:{}};r[s].types[n.type]=1,n.tags=n.tags||{},i.push({type:n.type,layer:s,id:n.id,geometry:n.geometry,properties:n.tags,extent:this.options.extent})}for(const t in r)r[t].types=Object.keys(r[t].types).map(t=>+t);return setTimeout((function(){n(null,i,r)}),1),1}onRemove(){delete this.index}}var es={\n/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */\nread:function(t,n,i,e,r){var s,o,a=8*r-e-1,h=(1<<a)-1,u=h>>1,l=-7,c=i?r-1:0,f=i?-1:1,d=t[n+c];for(c+=f,s=d&(1<<-l)-1,d>>=-l,l+=a;l>0;s=256*s+t[n+c],c+=f,l-=8);for(o=s&(1<<-l)-1,s>>=-l,l+=e;l>0;o=256*o+t[n+c],c+=f,l-=8);if(0===s)s=1-u;else{if(s===h)return o?NaN:1/0*(d?-1:1);o+=Math.pow(2,e),s-=u}return(d?-1:1)*o*Math.pow(2,s-e)},write:function(t,n,i,e,r,s){var o,a,h,u=8*s-r-1,l=(1<<u)-1,c=l>>1,f=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,d=e?0:s-1,y=e?1:-1,v=n<0||0===n&&1/n<0?1:0;for(n=Math.abs(n),isNaN(n)||n===1/0?(a=isNaN(n)?1:0,o=l):(o=Math.floor(Math.log(n)/Math.LN2),n*(h=Math.pow(2,-o))<1&&(o--,h*=2),(n+=o+c>=1?f/h:f*Math.pow(2,1-c))*h>=2&&(o++,h/=2),o+c>=l?(a=0,o=l):o+c>=1?(a=(n*h-1)*Math.pow(2,r),o+=c):(a=n*Math.pow(2,c-1)*Math.pow(2,r),o=0));r>=8;t[i+d]=255&a,d+=y,a/=256,r-=8);for(o=o<<r|a,u+=r;u>0;t[i+d]=255&o,d+=y,o/=256,u-=8);t[i+d-y]|=128*v}},rs=os,ss=es;function os(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}os.Varint=0,os.Fixed64=1,os.Bytes=2,os.Fixed32=5;var as="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function hs(t){return t.type===os.Bytes?t.readVarint()+t.pos:t.pos+1}function us(t,n,i){return i?4294967296*n+(t>>>0):4294967296*(n>>>0)+(t>>>0)}function ls(t,n,i){var e=n<=16383?1:n<=2097151?2:n<=268435455?3:Math.floor(Math.log(n)/(7*Math.LN2));i.realloc(e);for(var r=i.pos-1;r>=t;r--)i.buf[r+e]=i.buf[r]}function cs(t,n){for(var i=0;i<t.length;i++)n.writeVarint(t[i])}function fs(t,n){for(var i=0;i<t.length;i++)n.writeSVarint(t[i])}function ds(t,n){for(var i=0;i<t.length;i++)n.writeFloat(t[i])}function ys(t,n){for(var i=0;i<t.length;i++)n.writeDouble(t[i])}function vs(t,n){for(var i=0;i<t.length;i++)n.writeBoolean(t[i])}function ps(t,n){for(var i=0;i<t.length;i++)n.writeFixed32(t[i])}function ms(t,n){for(var i=0;i<t.length;i++)n.writeSFixed32(t[i])}function gs(t,n){for(var i=0;i<t.length;i++)n.writeFixed64(t[i])}function ws(t,n){for(var i=0;i<t.length;i++)n.writeSFixed64(t[i])}function Ms(t,n){return(t[n]|t[n+1]<<8|t[n+2]<<16)+16777216*t[n+3]}function bs(t,n,i){t[i]=n,t[i+1]=n>>>8,t[i+2]=n>>>16,t[i+3]=n>>>24}function xs(t,n){return(t[n]|t[n+1]<<8|t[n+2]<<16)+(t[n+3]<<24)}os.prototype={destroy:function(){this.buf=null},readFields:function(t,n,i){for(i=i||this.length;this.pos<i;){var e=this.readVarint(),r=e>>3,s=this.pos;this.type=7&e,t(r,n,this),this.pos===s&&this.skip(e)}return n},readMessage:function(t,n){return this.readFields(t,n,this.readVarint()+this.pos)},readFixed32:function(){var t=Ms(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=xs(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=Ms(this.buf,this.pos)+4294967296*Ms(this.buf,this.pos+4);return this.pos+=8,t},readSFixed64:function(){var t=Ms(this.buf,this.pos)+4294967296*xs(this.buf,this.pos+4);return this.pos+=8,t},readFloat:function(){var t=ss.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=ss.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var n,i,e=this.buf;return n=127&(i=e[this.pos++]),i<128?n:(n|=(127&(i=e[this.pos++]))<<7,i<128?n:(n|=(127&(i=e[this.pos++]))<<14,i<128?n:(n|=(127&(i=e[this.pos++]))<<21,i<128?n:function(t,n,i){var e,r,s=i.buf;if(r=s[i.pos++],e=(112&r)>>4,r<128)return us(t,e,n);if(r=s[i.pos++],e|=(127&r)<<3,r<128)return us(t,e,n);if(r=s[i.pos++],e|=(127&r)<<10,r<128)return us(t,e,n);if(r=s[i.pos++],e|=(127&r)<<17,r<128)return us(t,e,n);if(r=s[i.pos++],e|=(127&r)<<24,r<128)return us(t,e,n);if(r=s[i.pos++],e|=(1&r)<<31,r<128)return us(t,e,n);throw new Error("Expected varint not more than 10 bytes")}(n|=(15&(i=e[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,n=this.pos;return this.pos=t,t-n>=12&&as?function(t,n,i){return as.decode(t.subarray(n,i))}(this.buf,n,t):function(t,n,i){var e="",r=n;for(;r<i;){var s,o,a,h=t[r],u=null,l=h>239?4:h>223?3:h>191?2:1;if(r+l>i)break;1===l?h<128&&(u=h):2===l?128==(192&(s=t[r+1]))&&(u=(31&h)<<6|63&s)<=127&&(u=null):3===l?(s=t[r+1],o=t[r+2],128==(192&s)&&128==(192&o)&&((u=(15&h)<<12|(63&s)<<6|63&o)<=2047||u>=55296&&u<=57343)&&(u=null)):4===l&&(s=t[r+1],o=t[r+2],a=t[r+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&((u=(15&h)<<18|(63&s)<<12|(63&o)<<6|63&a)<=65535||u>=1114112)&&(u=null)),null===u?(u=65533,l=1):u>65535&&(u-=65536,e+=String.fromCharCode(u>>>10&1023|55296),u=56320|1023&u),e+=String.fromCharCode(u),r+=l}return e}(this.buf,n,t)},readBytes:function(){var t=this.readVarint()+this.pos,n=this.buf.subarray(this.pos,t);return this.pos=t,n},readPackedVarint:function(t,n){if(this.type!==os.Bytes)return t.push(this.readVarint(n));var i=hs(this);for(t=t||[];this.pos<i;)t.push(this.readVarint(n));return t},readPackedSVarint:function(t){if(this.type!==os.Bytes)return t.push(this.readSVarint());var n=hs(this);for(t=t||[];this.pos<n;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==os.Bytes)return t.push(this.readBoolean());var n=hs(this);for(t=t||[];this.pos<n;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==os.Bytes)return t.push(this.readFloat());var n=hs(this);for(t=t||[];this.pos<n;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==os.Bytes)return t.push(this.readDouble());var n=hs(this);for(t=t||[];this.pos<n;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==os.Bytes)return t.push(this.readFixed32());var n=hs(this);for(t=t||[];this.pos<n;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==os.Bytes)return t.push(this.readSFixed32());var n=hs(this);for(t=t||[];this.pos<n;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==os.Bytes)return t.push(this.readFixed64());var n=hs(this);for(t=t||[];this.pos<n;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==os.Bytes)return t.push(this.readSFixed64());var n=hs(this);for(t=t||[];this.pos<n;)t.push(this.readSFixed64());return t},skip:function(t){var n=7&t;if(n===os.Varint)for(;this.buf[this.pos++]>127;);else if(n===os.Bytes)this.pos=this.readVarint()+this.pos;else if(n===os.Fixed32)this.pos+=4;else{if(n!==os.Fixed64)throw new Error("Unimplemented type: "+n);this.pos+=8}},writeTag:function(t,n){this.writeVarint(t<<3|n)},realloc:function(t){for(var n=this.length||16;n<this.pos+t;)n*=2;if(n!==this.length){var i=new Uint8Array(n);i.set(this.buf),this.buf=i,this.length=n}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(t){this.realloc(4),bs(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),bs(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),bs(this.buf,-1&t,this.pos),bs(this.buf,Math.floor(t*(1/4294967296)),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),bs(this.buf,-1&t,this.pos),bs(this.buf,Math.floor(t*(1/4294967296)),this.pos+4),this.pos+=8},writeVarint:function(t){(t=+t||0)>268435455||t<0?function(t,n){var i,e;t>=0?(i=t%4294967296|0,e=t/4294967296|0):(e=~(-t/4294967296),4294967295^(i=~(-t%4294967296))?i=i+1|0:(i=0,e=e+1|0));if(t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn\'t fit into 10 bytes");n.realloc(10),function(t,n,i){i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos]=127&t}(i,0,n),function(t,n){var i=(7&t)<<4;if(n.buf[n.pos++]|=i|((t>>>=3)?128:0),!t)return;if(n.buf[n.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(n.buf[n.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(n.buf[n.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(n.buf[n.pos++]=127&t|((t>>>=7)?128:0),!t)return;n.buf[n.pos++]=127&t}(e,n)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var n=this.pos;this.pos=function(t,n,i){for(var e,r,s=0;s<n.length;s++){if((e=n.charCodeAt(s))>55295&&e<57344){if(!r){e>56319||s+1===n.length?(t[i++]=239,t[i++]=191,t[i++]=189):r=e;continue}if(e<56320){t[i++]=239,t[i++]=191,t[i++]=189,r=e;continue}e=r-55296<<10|e-56320|65536,r=null}else r&&(t[i++]=239,t[i++]=191,t[i++]=189,r=null);e<128?t[i++]=e:(e<2048?t[i++]=e>>6|192:(e<65536?t[i++]=e>>12|224:(t[i++]=e>>18|240,t[i++]=e>>12&63|128),t[i++]=e>>6&63|128),t[i++]=63&e|128)}return i}(this.buf,t,this.pos);var i=this.pos-n;i>=128&&ls(n,i,this),this.pos=n-1,this.writeVarint(i),this.pos+=i},writeFloat:function(t){this.realloc(4),ss.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),ss.write(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var n=t.length;this.writeVarint(n),this.realloc(n);for(var i=0;i<n;i++)this.buf[this.pos++]=t[i]},writeRawMessage:function(t,n){this.pos++;var i=this.pos;t(n,this);var e=this.pos-i;e>=128&&ls(i,e,this),this.pos=i-1,this.writeVarint(e),this.pos+=e},writeMessage:function(t,n,i){this.writeTag(t,os.Bytes),this.writeRawMessage(n,i)},writePackedVarint:function(t,n){n.length&&this.writeMessage(t,cs,n)},writePackedSVarint:function(t,n){n.length&&this.writeMessage(t,fs,n)},writePackedBoolean:function(t,n){n.length&&this.writeMessage(t,vs,n)},writePackedFloat:function(t,n){n.length&&this.writeMessage(t,ds,n)},writePackedDouble:function(t,n){n.length&&this.writeMessage(t,ys,n)},writePackedFixed32:function(t,n){n.length&&this.writeMessage(t,ps,n)},writePackedSFixed32:function(t,n){n.length&&this.writeMessage(t,ms,n)},writePackedFixed64:function(t,n){n.length&&this.writeMessage(t,gs,n)},writePackedSFixed64:function(t,n){n.length&&this.writeMessage(t,ws,n)},writeBytesField:function(t,n){this.writeTag(t,os.Bytes),this.writeBytes(n)},writeFixed32Field:function(t,n){this.writeTag(t,os.Fixed32),this.writeFixed32(n)},writeSFixed32Field:function(t,n){this.writeTag(t,os.Fixed32),this.writeSFixed32(n)},writeFixed64Field:function(t,n){this.writeTag(t,os.Fixed64),this.writeFixed64(n)},writeSFixed64Field:function(t,n){this.writeTag(t,os.Fixed64),this.writeSFixed64(n)},writeVarintField:function(t,n){this.writeTag(t,os.Varint),this.writeVarint(n)},writeSVarintField:function(t,n){this.writeTag(t,os.Varint),this.writeSVarint(n)},writeStringField:function(t,n){this.writeTag(t,os.Bytes),this.writeString(n)},writeFloatField:function(t,n){this.writeTag(t,os.Fixed32),this.writeFloat(n)},writeDoubleField:function(t,n){this.writeTag(t,os.Fixed64),this.writeDouble(n)},writeBooleanField:function(t,n){this.writeVarintField(t,Boolean(n))}};var Fs=Ht,As=ks;function ks(t,n,i,e,r){this.properties={},this.extent=i,this.type=0,this.xt=t,this.Ft=-1,this.At=e,this.kt=r,t.readFields(Ps,this,n)}function Ps(t,n,i){1==t?n.id=i.readVarint():2==t?function(t,n){var i=t.readVarint()+t.pos;for(;t.pos<i;){var e=n.At[t.readVarint()],r=n.kt[t.readVarint()];n.properties[e]=r}}(i,n):3==t?n.type=i.readVarint():4==t&&(n.Ft=i.pos)}function Ss(t){for(var n,i,e=0,r=0,s=t.length,o=s-1;r<s;o=r++)n=t[r],e+=((i=t[o]).x-n.x)*(n.y+i.y);return e}ks.types=["Unknown","Point","LineString","Polygon"],ks.prototype.loadGeometry=function(){var t=this.xt;t.pos=this.Ft;for(var n,i=t.readVarint()+t.pos,e=1,r=0,s=0,o=0,a=[];t.pos<i;){if(r<=0){var h=t.readVarint();e=7&h,r=h>>3}if(r--,1===e||2===e)s+=t.readSVarint(),o+=t.readSVarint(),1===e&&(n&&a.push(n),n=[]),n.push(new Fs(s,o));else{if(7!==e)throw new Error("unknown command "+e);n&&n.push(n[0].clone())}}return n&&a.push(n),a},ks.prototype.bbox=function(){var t=this.xt;t.pos=this.Ft;for(var n=t.readVarint()+t.pos,i=1,e=0,r=0,s=0,o=1/0,a=-1/0,h=1/0,u=-1/0;t.pos<n;){if(e<=0){var l=t.readVarint();i=7&l,e=l>>3}if(e--,1===i||2===i)(r+=t.readSVarint())<o&&(o=r),r>a&&(a=r),(s+=t.readSVarint())<h&&(h=s),s>u&&(u=s);else if(7!==i)throw new Error("unknown command "+i)}return[o,h,a,u]},ks.prototype.toGeoJSON=function(t,n,i){var e,r,s=this.extent*Math.pow(2,i),o=this.extent*t,a=this.extent*n,h=this.loadGeometry(),u=ks.types[this.type];function l(t){for(var n=0;n<t.length;n++){var i=t[n],e=180-360*(i.y+a)/s;t[n]=[360*(i.x+o)/s-180,360/Math.PI*Math.atan(Math.exp(e*Math.PI/180))-90]}}switch(this.type){case 1:var c=[];for(e=0;e<h.length;e++)c[e]=h[e][0];l(h=c);break;case 2:for(e=0;e<h.length;e++)l(h[e]);break;case 3:for(h=function(t){var n=t.length;if(n<=1)return[t];for(var i,e,r=[],s=0;s<n;s++){var o=Ss(t[s]);0!==o&&(void 0===e&&(e=o<0),e===o<0?(i&&r.push(i),i=[t[s]]):i.push(t[s]))}i&&r.push(i);return r}(h),e=0;e<h.length;e++)for(r=0;r<h[e].length;r++)l(h[e][r])}1===h.length?h=h[0]:u="Multi"+u;var f={type:"Feature",geometry:{type:u,coordinates:h},properties:this.properties};return"id"in this&&(f.id=this.id),f};var _s=As,Os=Is;function Is(t,n){this.version=1,this.name=null,this.extent=4096,this.length=0,this.xt=t,this.At=[],this.kt=[],this.Pt=[],t.readFields(Ts,this,n),this.length=this.Pt.length}function Ts(t,n,i){15===t?n.version=i.readVarint():1===t?n.name=i.readString():5===t?n.extent=i.readVarint():2===t?n.Pt.push(i.pos):3===t?n.At.push(i.readString()):4===t&&n.kt.push(function(t){var n=null,i=t.readVarint()+t.pos;for(;t.pos<i;){var e=t.readVarint()>>3;n=1===e?t.readString():2===e?t.readFloat():3===e?t.readDouble():4===e?t.readVarint64():5===e?t.readVarint():6===e?t.readSVarint():7===e?t.readBoolean():null}return n}(i))}Is.prototype.feature=function(t){if(t<0||t>=this.Pt.length)throw new Error("feature index out of bounds");this.xt.pos=this.Pt[t];var n=this.xt.readVarint()+this.xt.pos;return new _s(this.xt,n,this.extent,this.At,this.kt)};var Ls=Os;function Us(t,n,i){if(3===t){var e=new Ls(i,i.readVarint()+i.pos);e.length&&(n[e.name]=e)}}var zs=function(t,n){this.layers=t.readFields(Us,{},n)};class Ds extends Wr{constructor(t,n,i,e,r,s){super(t,n,i,e,r),n=n||{},s()}getTileFeatures(t,n){const i=t.url;return C.getArrayBuffer(i,(t,i)=>{if(t)return void n(t);const e=new zs(new rs(i.data)),r=[];if(!e.layers)return void n(null,r,[]);const s={};let o;for(const n in e.layers)if(a=e.layers,h=n,Object.prototype.hasOwnProperty.call(a,h)){s[n]={types:{}};const i=s[n].types;for(let s=0,a=e.layers[n].length;s<a;s++)try{o=e.layers[n].feature(s),i[o.type]=1,r.push({type:o.type,layer:n,geometry:o.loadGeometry(),properties:o.properties,extent:o.extent})}catch(t){console.warn("error when load vt geometry:",t)}}var a,h;for(const t in s)s[t].types=Object.keys(s[t].types).map(t=>+t);n(null,r,s,{byteLength:i.data.byteLength})})}abortTile(t,n){const i=this.requests[t];delete this.requests[t],i&&i.abort&&i.abort(),this.yt(t),n()}onRemove(){for(const t in this.requests)this.requests[t].abort();this.requests={}}}let Es=0;const Cs=new class{constructor(t){this.max=t,this.reset()}reset(){return this.data={},this.order=[],this}clear(){this.reset()}add(t,n){return this.has(t)?(this.order.splice(this.order.indexOf(t),1),this.data[t]=n,this.order.push(t)):(this.data[t]=n,this.order.push(t),this.order.length>this.max&&this.getAndRemove(this.order[0])),this}has(t){return t in this.data}keys(){return this.order}getAndRemove(t){if(!this.has(t))return null;const n=this.data[t];return delete this.data[t],this.order.splice(this.order.indexOf(t),1),n}get(t){return this.has(t)?this.data[t]:null}remove(t){return this.has(t)?(delete this.data[t],this.order.splice(this.order.indexOf(t),1),this):this}setMaxSize(t){for(this.max=t;this.order.length>this.max;)this.getAndRemove(this.order[0]);return this}}(128),js={};class Ns{constructor(t){this.St={},this._t={},this.workerId=t}addLayer({actorId:t,mapId:n,layerId:i,params:e},r){if(this.Ot(n,i))return;const s=this.It(n,i),o=e.type,a=e.options,h=this.send.bind(this,t);this.St[s]="GeoJSONVectorTileLayer"===o?new is(i,a,h,Cs,js,r):new Ds(i,a,h,Cs,js,r)}removeLayer({mapId:t,layerId:n},i){const e=this.Ot(t,n),r=this.It(t,n);delete this.St[r],e&&(e.onRemove(i),this.Tt())}loadTile({mapId:t,layerId:n,params:i},e){const r=this.Ot(t,n);r&&r.loadTile(i,e)}abortTile({mapId:t,layerId:n,params:i},e){const r=this.Ot(t,n);r&&r.abortTile&&r.abortTile(i.url,e)}removeTile({mapId:t,layerId:n,params:i},e){const r=this.Ot(t,n);r&&r.removeTile(i,e)}updateStyle({mapId:t,layerId:n,params:i},e){const r=this.Ot(t,n);r&&(r.updateStyle(i,e),this.Tt())}updateOptions({mapId:t,layerId:n,params:i},e){const r=this.Ot(t,n);r&&(r.updateOptions(i,e),this.Tt())}setData({mapId:t,layerId:n,params:i},e){const r=this.Ot(t,n);r&&(r.setData(i.data,e),this.Tt())}receive(t){const n=t.callback,i=this._t[n];delete this._t[n],i&&t.error?i(new Error(t.error)):i&&i(null,t.data)}send(t,n,i,e,r){const s=r?`${t}-${Es++}`:null;r&&(this._t[s]=r),postMessage({type:"<request>",workerId:this.workerId,actorId:t,command:n,params:i,callback:String(s)},e||[])}It(t,n){return`${t}-${n}`}Ot(t,n){const i=this.It(t,n);return this.St[i]}Tt(){const t=Object.keys(js);for(let n=0;n<t.length;n++)delete js[t[n]];Cs.reset()}}t.initialize=function(){},t.onmessage=function(t,n){const i=t.data;if(this.dispatcher||(this.dispatcher=new Ns(t.workerId)),"<response>"===t.type)this.dispatcher.workerId===t.workerId&&this.dispatcher.receive(t);else{const e=i.command;this.dispatcher[e]({actorId:t.actorId,mapId:i.mapId,layerId:i.layerId,params:i.params},(t,i,r)=>{t&&console.error(e,t),n(t,i,r)})}},Object.defineProperty(t,"Lt",{value:!0})}';
26
26
  /*!
27
27
  Feature Filter by
28
28
 
@@ -220,12 +220,12 @@
220
220
  }
221
221
  return t.length;
222
222
  }
223
- function R(t) {
223
+ function L(t) {
224
224
  const e = {};
225
225
  for (const n in t) void 0 !== t[n] && null !== t[n] && (t[n].toJSON ? e[n] = t[n].toJSON() : e[n] = t[n]);
226
226
  return e;
227
227
  }
228
- function L(t) {
228
+ function R(t) {
229
229
  return function t(e) {
230
230
  if (!Array.isArray(e)) return t([ e ]);
231
231
  const n = [];
@@ -1183,12 +1183,12 @@
1183
1183
  n && (r = n(r)), r);
1184
1184
  };
1185
1185
  }
1186
- function Rt(t) {
1186
+ function Lt(t) {
1187
1187
  return function(e) {
1188
1188
  return Math.max(0, Math.min(t, e));
1189
1189
  };
1190
1190
  }
1191
- function Lt(t) {
1191
+ function Rt(t) {
1192
1192
  return Array.isArray(t) ? t : [ t ];
1193
1193
  }
1194
1194
  function Nt(t, e) {
@@ -1239,28 +1239,28 @@
1239
1239
  alpha: function(t) {
1240
1240
  return arguments.length ? new Ht(this.color.concat(Math.max(0, Math.min(1, t))), this.model) : this.valpha;
1241
1241
  },
1242
- red: Dt("rgb", 0, Rt(255)),
1243
- green: Dt("rgb", 1, Rt(255)),
1244
- blue: Dt("rgb", 2, Rt(255)),
1242
+ red: Dt("rgb", 0, Lt(255)),
1243
+ green: Dt("rgb", 1, Lt(255)),
1244
+ blue: Dt("rgb", 2, Lt(255)),
1245
1245
  hue: Dt([ "hsl", "hsv", "hsl", "hwb", "hcg" ], 0, (function(t) {
1246
1246
  return (t % 360 + 360) % 360;
1247
1247
  })),
1248
- saturationl: Dt("hsl", 1, Rt(100)),
1249
- lightness: Dt("hsl", 2, Rt(100)),
1250
- saturationv: Dt("hsv", 1, Rt(100)),
1251
- value: Dt("hsv", 2, Rt(100)),
1252
- chroma: Dt("hcg", 1, Rt(100)),
1253
- gray: Dt("hcg", 2, Rt(100)),
1254
- white: Dt("hwb", 1, Rt(100)),
1255
- wblack: Dt("hwb", 2, Rt(100)),
1256
- cyan: Dt("cmyk", 0, Rt(100)),
1257
- magenta: Dt("cmyk", 1, Rt(100)),
1258
- yellow: Dt("cmyk", 2, Rt(100)),
1259
- black: Dt("cmyk", 3, Rt(100)),
1260
- x: Dt("xyz", 0, Rt(100)),
1261
- y: Dt("xyz", 1, Rt(100)),
1262
- z: Dt("xyz", 2, Rt(100)),
1263
- l: Dt("lab", 0, Rt(100)),
1248
+ saturationl: Dt("hsl", 1, Lt(100)),
1249
+ lightness: Dt("hsl", 2, Lt(100)),
1250
+ saturationv: Dt("hsv", 1, Lt(100)),
1251
+ value: Dt("hsv", 2, Lt(100)),
1252
+ chroma: Dt("hcg", 1, Lt(100)),
1253
+ gray: Dt("hcg", 2, Lt(100)),
1254
+ white: Dt("hwb", 1, Lt(100)),
1255
+ wblack: Dt("hwb", 2, Lt(100)),
1256
+ cyan: Dt("cmyk", 0, Lt(100)),
1257
+ magenta: Dt("cmyk", 1, Lt(100)),
1258
+ yellow: Dt("cmyk", 2, Lt(100)),
1259
+ black: Dt("cmyk", 3, Lt(100)),
1260
+ x: Dt("xyz", 0, Lt(100)),
1261
+ y: Dt("xyz", 1, Lt(100)),
1262
+ z: Dt("xyz", 2, Lt(100)),
1263
+ l: Dt("lab", 0, Lt(100)),
1264
1264
  a: Dt("lab", 1),
1265
1265
  b: Dt("lab", 2),
1266
1266
  keyword: function(t) {
@@ -1349,7 +1349,7 @@
1349
1349
  if (this.model === t) return new Ht(this);
1350
1350
  if (arguments.length) return new Ht(arguments, t);
1351
1351
  var n = "number" == typeof arguments[e] ? e : this.valpha;
1352
- return new Ht(Lt(Ot[this.model][t].raw(this.color)).concat(n), t);
1352
+ return new Ht(Rt(Ot[this.model][t].raw(this.color)).concat(n), t);
1353
1353
  }, Ht[t] = function(n) {
1354
1354
  return "number" == typeof n && (n = Nt(Ft.call(arguments), e)), new Ht(n, t);
1355
1355
  };
@@ -1605,7 +1605,7 @@
1605
1605
  };
1606
1606
  var de = Vt.exports;
1607
1607
  /*!
1608
- * @maptalks/vector-packer v0.63.4
1608
+ * @maptalks/vector-packer v0.63.9
1609
1609
  * LICENSE : UNLICENSED
1610
1610
  * (c) 2016-2022 maptalks.com
1611
1611
  */ const pe = {
@@ -1889,17 +1889,17 @@
1889
1889
  }
1890
1890
  return t;
1891
1891
  }
1892
- function Re(t) {
1892
+ function Le(t) {
1893
1893
  return null == t;
1894
1894
  }
1895
- function Le(t) {
1895
+ function Re(t) {
1896
1896
  return "number" == typeof t && !isNaN(t);
1897
1897
  }
1898
1898
  function Ne(t) {
1899
1899
  return "object" == typeof t && !!t;
1900
1900
  }
1901
1901
  function ze(t) {
1902
- return !Re(t) && ("string" == typeof t || null !== t.constructor && t.constructor === String);
1902
+ return !Le(t) && ("string" == typeof t || null !== t.constructor && t.constructor === String);
1903
1903
  }
1904
1904
  const Ve = Object.prototype.hasOwnProperty;
1905
1905
  function je(t, e) {
@@ -1994,7 +1994,7 @@
1994
1994
  constructor(t, e, n) {
1995
1995
  this.options = n, this.features = this.H(t), this.symbolDef = e, this.symbol = k(e, () => [ n.zoom ]),
1996
1996
  this.styledVectors = [], this.properties = {}, this.D = $e.genFnTypes(this.symbolDef),
1997
- Ue(this.symbolDef.visible) && (this.R = M(this.symbolDef.visible)), n.atlas && (this.iconAtlas = n.atlas.iconAtlas,
1997
+ Ue(this.symbolDef.visible) && (this.L = M(this.symbolDef.visible)), n.atlas && (this.iconAtlas = n.atlas.iconAtlas,
1998
1998
  this.glyphAtlas = n.atlas.glyphAtlas);
1999
1999
  }
2000
2000
  H(t) {
@@ -2132,11 +2132,11 @@
2132
2132
  for (let i = 0, r = t.length; i < r; i++) {
2133
2133
  if (!t[i].feature.geometry) continue;
2134
2134
  const r = Array.isArray(t[i]) ? t[i][0].feature.id : t[i].feature.id;
2135
- Le(r) && (Math.abs(r) > l && (l = Math.abs(r)), r < 0 && (h = !0));
2135
+ Re(r) && (Math.abs(r) > l && (l = Math.abs(r)), r < 0 && (h = !0));
2136
2136
  const c = this.data.aPosition.length;
2137
- if (Array.isArray(t[i])) for (let n = 0; n < t[i].length; n++) this.L(t[i][n], e); else this.L(t[i], e);
2137
+ if (Array.isArray(t[i])) for (let n = 0; n < t[i].length; n++) this.R(t[i][n], e); else this.R(t[i], e);
2138
2138
  const u = (n.aPosition.length - c) / 3;
2139
- for (let e = 0; e < u; e++) s.push(t[i].featureIdx), Le(r) && a.push(r);
2139
+ for (let e = 0; e < u; e++) s.push(t[i].featureIdx), Re(r) && a.push(r);
2140
2140
  o = Math.max(o, t[i].featureIdx);
2141
2141
  }
2142
2142
  if (this.hasElements() && !i.length) return null;
@@ -2174,8 +2174,8 @@
2174
2174
  } else d.featureIds = [];
2175
2175
  return d;
2176
2176
  }
2177
- L(t, e) {
2178
- this.R && this.R.isZoomConstant && !this.R(null, t.feature.properties) || this.placeVector(t, e, this.formatWidth);
2177
+ R(t, e) {
2178
+ this.L && this.L.isZoomConstant && !this.L(null, t.feature.properties) || this.placeVector(t, e, this.formatWidth);
2179
2179
  }
2180
2180
  addElements(...t) {
2181
2181
  this.maxIndex = Math.max(this.maxIndex, ...t), this.elements.push(...t);
@@ -2230,11 +2230,11 @@
2230
2230
  function Ke(t, e, n, i) {
2231
2231
  const r = "__fn_textSize".trim();
2232
2232
  let s = t.textSize;
2233
- if (Re(e.textSize)) return [ 16, 16 ];
2233
+ if (Le(e.textSize)) return [ 16, 16 ];
2234
2234
  t[r] && (s = t[r]);
2235
2235
  const o = [];
2236
2236
  var a;
2237
- return o[0] = Re(a = s) || "function" != typeof a && (null === a.constructor || a.constructor !== Function) ? s : s(i, n),
2237
+ return o[0] = Le(a = s) || "function" != typeof a && (null === a.constructor || a.constructor !== Function) ? s : s(i, n),
2238
2238
  o[1] = o[0], o;
2239
2239
  }
2240
2240
  function Qe(t) {
@@ -2251,7 +2251,7 @@
2251
2251
  return ze(t) ? t.replace(tn, (function(t, n) {
2252
2252
  if (!e) return "";
2253
2253
  const i = e[n];
2254
- return Re(i) ? "" : Array.isArray(i) ? i.join() : i;
2254
+ return Le(i) ? "" : Array.isArray(i) ? i.join() : i;
2255
2255
  })) : t;
2256
2256
  }
2257
2257
  const nn = t => t >= 11904 && t <= 12031, rn = t => t >= 12032 && t <= 12255, sn = t => t >= 12272 && t <= 12287, on = t => t >= 12288 && t <= 12351, an = t => t >= 12352 && t <= 12447, ln = t => t >= 12448 && t <= 12543, hn = t => t >= 12544 && t <= 12591, cn = t => t >= 12704 && t <= 12735, un = t => t >= 12736 && t <= 12783, fn = t => t >= 12784 && t <= 12799, dn = t => t >= 12800 && t <= 13055, pn = t => t >= 13056 && t <= 13311, yn = t => t >= 13312 && t <= 19903, mn = t => t >= 19968 && t <= 40959, gn = t => t >= 40960 && t <= 42127, vn = t => t >= 42128 && t <= 42191, xn = t => t >= 63744 && t <= 64255, bn = t => t >= 64336 && t <= 65023, wn = t => t >= 65040 && t <= 65055, An = t => t >= 65072 && t <= 65103, _n = t => t >= 65104 && t <= 65135, Mn = t => t >= 65136 && t <= 65279, Sn = t => t >= 65280 && t <= 65519;
@@ -2401,7 +2401,7 @@
2401
2401
  let o = 0;
2402
2402
  for (let n = 0; n < t.length; n++) {
2403
2403
  const l = t.charCodeAt(n), h = i[l];
2404
- h && !Hn[l] && (o += h.metrics.advance + e), n < t.length - 1 && (Dn[l] || !((a = l) < 11904) && (cn(a) || hn(a) || An(a) || xn(a) || pn(a) || nn(a) || un(a) || on(a) || yn(a) || mn(a) || dn(a) || Sn(a) || an(a) || sn(a) || rn(a) || fn(a) || ln(a) || wn(a) || vn(a) || gn(a))) && r.push(Nn(n + 1, o, s, r, Ln(l, t.charCodeAt(n + 1)), !1));
2404
+ h && !Hn[l] && (o += h.metrics.advance + e), n < t.length - 1 && (Dn[l] || !((a = l) < 11904) && (cn(a) || hn(a) || An(a) || xn(a) || pn(a) || nn(a) || un(a) || on(a) || yn(a) || mn(a) || dn(a) || Sn(a) || an(a) || sn(a) || rn(a) || fn(a) || ln(a) || wn(a) || vn(a) || gn(a))) && r.push(Nn(n + 1, o, s, r, Rn(l, t.charCodeAt(n + 1)), !1));
2405
2405
  }
2406
2406
  var a;
2407
2407
  return function t(e) {
@@ -2466,19 +2466,19 @@
2466
2466
  8211: !0,
2467
2467
  8231: !0
2468
2468
  };
2469
- function Rn(t, e, n, i) {
2469
+ function Ln(t, e, n, i) {
2470
2470
  const r = Math.pow(t - e, 2);
2471
2471
  return i ? t < e ? r / 2 : 2 * r : r + Math.abs(n) * n;
2472
2472
  }
2473
- function Ln(t, e) {
2473
+ function Rn(t, e) {
2474
2474
  let n = 0;
2475
2475
  return 10 === t && (n -= 1e4), 40 !== t && 65288 !== t || (n += 50), 41 !== e && 65289 !== e || (n += 50),
2476
2476
  n;
2477
2477
  }
2478
2478
  function Nn(t, e, n, i, r, s) {
2479
- let o = null, a = Rn(e, n, r, s);
2479
+ let o = null, a = Ln(e, n, r, s);
2480
2480
  for (let t = 0; t < i.length; t++) {
2481
- const l = i[t], h = Rn(e - l.x, n, r, s) + l.badness;
2481
+ const l = i[t], h = Ln(e - l.x, n, r, s) + l.badness;
2482
2482
  h <= a && (o = l, a = h);
2483
2483
  }
2484
2484
  return {
@@ -2584,11 +2584,11 @@
2584
2584
  }
2585
2585
  getIconAndGlyph() {
2586
2586
  if (this.iconGlyph) return this.iconGlyph;
2587
- const {markerFileFn: t, markerTypeFn: e, markerPathFn: n, markerWidthFn: i, markerHeightFn: r, markerFillFn: s, markerFillPatternFileFn: o, markerFillOpacityFn: a, markerTextFitFn: l, markerTextFitPaddingFn: h, markerLineColorFn: c, markerLineWidthFn: u, markerLineOpacityFn: f, markerLineDasharrayFn: d, markerLinePatternFileFn: p, markerPathWidthFn: y, markerPathHeightFn: m, textNameFn: g, textFaceNameFn: v, textStyleFn: x, textWeightFn: b} = this.D, {zoom: w} = this.options, A = {}, S = this.symbol, k = this.feature.properties, P = t ? t(null, k) : S.markerFile, T = e ? e(null, k) : S.markerType, O = P || T || S.markerPath, F = !Re(this.symbolDef.textName);
2587
+ const {markerFileFn: t, markerTypeFn: e, markerPathFn: n, markerWidthFn: i, markerHeightFn: r, markerFillFn: s, markerFillPatternFileFn: o, markerFillOpacityFn: a, markerTextFitFn: l, markerTextFitPaddingFn: h, markerLineColorFn: c, markerLineWidthFn: u, markerLineOpacityFn: f, markerLineDasharrayFn: d, markerLinePatternFileFn: p, markerPathWidthFn: y, markerPathHeightFn: m, textNameFn: g, textFaceNameFn: v, textStyleFn: x, textWeightFn: b} = this.D, {zoom: w} = this.options, A = {}, S = this.symbol, k = this.feature.properties, P = t ? t(null, k) : S.markerFile, T = e ? e(null, k) : S.markerType, O = P || T || S.markerPath, F = !Le(this.symbolDef.textName);
2588
2588
  let I;
2589
2589
  if (O) {
2590
2590
  I = function(t, e, n, i, r, s) {
2591
- if (Re(e.markerWidth) && Re(e.markerHeight)) return null;
2591
+ if (Le(e.markerWidth) && Le(e.markerHeight)) return null;
2592
2592
  const o = "__fn_markerWidth".trim(), a = "__fn_markerHeight".trim();
2593
2593
  let l = e.markerWidth || 0, h = e.markerHeight || 0;
2594
2594
  return Ne(l) && ("identity" !== l.type ? l = Qe(l) : (l = t.markerWidth, t[o] && (l = t[o](i, n)),
@@ -2626,43 +2626,43 @@
2626
2626
  e.markerPathWidth = y ? y(null, k) : S.markerPathWidth, e.markerPathHeight = m ? m(null, k) : S.markerPathHeight),
2627
2627
  i) {
2628
2628
  const t = i(null, k);
2629
- Re(t) || (e.markerWidth = t);
2629
+ Le(t) || (e.markerWidth = t);
2630
2630
  } else S.markerWidth >= 0 && (e.markerWidth = S.markerWidth);
2631
2631
  if (r) {
2632
2632
  const t = r(null, k);
2633
- Re(t) || (e.markerHeight = t);
2633
+ Le(t) || (e.markerHeight = t);
2634
2634
  } else S.markerHeight >= 0 && (e.markerHeight = S.markerHeight);
2635
2635
  if (s) {
2636
2636
  const t = s(null, k);
2637
- Re(t) || (e.markerFill = t);
2637
+ Le(t) || (e.markerFill = t);
2638
2638
  } else S.markerFill && (e.markerFill = S.markerFill);
2639
2639
  if (o) {
2640
2640
  const t = o(null, k);
2641
- Re(t) || (e.markerFillPatternFile = t);
2641
+ Le(t) || (e.markerFillPatternFile = t);
2642
2642
  } else S.markerFillPatternFile && (e.markerFillPatternFile = S.markerFillPatternFile);
2643
2643
  if (a) {
2644
2644
  const t = a(null, k);
2645
- Re(t) || (e.markerFillOpacity = t);
2645
+ Le(t) || (e.markerFillOpacity = t);
2646
2646
  } else S.markerFillOpacity >= 0 && (e.markerFillOpacity = S.markerFillOpacity);
2647
2647
  if (c) {
2648
2648
  const t = c(null, k);
2649
- Re(t) || (e.markerLineColor = t);
2649
+ Le(t) || (e.markerLineColor = t);
2650
2650
  } else S.markerLineColor && (e.markerLineColor = S.markerLineColor);
2651
2651
  if (u) {
2652
2652
  const t = u(null, k);
2653
- Re(t) || (e.markerLineWidth = t);
2653
+ Le(t) || (e.markerLineWidth = t);
2654
2654
  } else S.markerLineWidth >= 0 && (e.markerLineWidth = S.markerLineWidth);
2655
2655
  if (f) {
2656
2656
  const t = f(null, k);
2657
- Re(t) || (e.markerLineOpacity = t);
2657
+ Le(t) || (e.markerLineOpacity = t);
2658
2658
  } else S.markerLineOpacity >= 0 && (e.markerLineOpacity = S.markerLineOpacity);
2659
2659
  if (d) {
2660
2660
  const t = d(null, k);
2661
- Re(t) || (e.markerLineDasharray = t);
2661
+ Le(t) || (e.markerLineDasharray = t);
2662
2662
  } else S.markerLineDasharray && (e.markerLineDasharray = S.markerLineDasharray);
2663
2663
  if (p) {
2664
2664
  const t = p(null, k);
2665
- Re(t) || (e.markerLinePatternFile = t);
2665
+ Le(t) || (e.markerLinePatternFile = t);
2666
2666
  } else S.markerLinePatternFile && (e.markerLinePatternFile = S.markerLinePatternFile);
2667
2667
  t = "vector://" + JSON.stringify(e);
2668
2668
  } else t = P ? P.replace(Un, this.V) : S.markerPath ? function(t, e, n) {
@@ -2685,11 +2685,11 @@
2685
2685
  };
2686
2686
  return 0 === e.stroke["stroke-width"] && (e.stroke["stroke-opacity"] = 0), e;
2687
2687
  }(t);
2688
- Le(t.markerOpacity) && (i = t.markerOpacity), Le(t.opacity) && (i *= t.opacity);
2688
+ Re(t.markerOpacity) && (i = t.markerOpacity), Re(t.opacity) && (i *= t.opacity);
2689
2689
  const s = {};
2690
2690
  if (r) {
2691
- for (const t in r.stroke) je(r.stroke, t) && (Re(r.stroke[t]) || (s[t] = r.stroke[t]));
2692
- for (const t in r.fill) je(r.fill, t) && (Re(r.fill[t]) || (s[t] = r.fill[t]));
2691
+ for (const t in r.stroke) je(r.stroke, t) && (Le(r.stroke[t]) || (s[t] = r.stroke[t]));
2692
+ for (const t in r.fill) je(r.fill, t) && (Le(r.fill[t]) || (s[t] = r.fill[t]));
2693
2693
  }
2694
2694
  const o = Array.isArray(t.markerPath) ? t.markerPath : [ t.markerPath ];
2695
2695
  let a;
@@ -3181,7 +3181,7 @@
3181
3181
  e >= 1) return !1;
3182
3182
  return !0;
3183
3183
  }(t.getIconAndGlyph().glyph.text) ? 1 : 0, {textFillFn: u, textSizeFn: f, textHaloFillFn: d, textHaloRadiusFn: p, textHaloOpacityFn: y, textDxFn: m, textDyFn: g, textPitchAlignmentFn: v, textRotationAlignmentFn: x, textRotationFn: b, textAllowOverlapFn: w, textIgnorePlacementFn: A, textOpacityFn: M, markerWidthFn: S, markerHeightFn: k, markerDxFn: P, markerDyFn: T, markerPitchAlignmentFn: O, markerRotationAlignmentFn: F, markerRotationFn: I, markerAllowOverlapFn: C, markerIgnorePlacementFn: E, markerOpacityFn: H} = this.D;
3184
- let D, R, L, N, V, j, U, G, W, B, X, q, J, Y, $, Z, K;
3184
+ let D, L, R, N, V, j, U, G, W, B, X, q, J, Y, $, Z, K;
3185
3185
  if (h) {
3186
3186
  const e = t.getIconAndGlyph().glyph.font;
3187
3187
  D = function(t, e, n) {
@@ -3207,8 +3207,8 @@
3207
3207
  });
3208
3208
  }
3209
3209
  return r;
3210
- }(n.horizontal, l, this.glyphAtlas.positions[e]), u && (R = u(null, a), _(R) ? R = [ 0, 0, 0, 0 ] : (R = Array.isArray(R) ? R.map(t => 255 * t) : zt(R).array(),
3211
- 3 === R.length && R.push(255))), f && (L = f(this.options.zoom, a), Xe(L) && (L = 14)),
3210
+ }(n.horizontal, l, this.glyphAtlas.positions[e]), u && (L = u(null, a), _(L) ? L = [ 0, 0, 0, 0 ] : (L = Array.isArray(L) ? L.map(t => 255 * t) : zt(L).array(),
3211
+ 3 === L.length && L.push(255))), f && (R = f(this.options.zoom, a), Xe(R) && (R = 14)),
3212
3212
  d && (N = d(null, a), N = Array.isArray(N) ? N.map(t => 255 * t) : zt(N).array(),
3213
3213
  3 === N.length && N.push(255)), p && (V = p(null, a)), y && (j = 255 * y(null, a)),
3214
3214
  m && (U = m(null, a) || 0), g && (G = g(null, a) || 0), v && (J = +("map" === v(null, a))),
@@ -3263,11 +3263,11 @@
3263
3263
  for (let t = 0; t < a; t++) {
3264
3264
  const i = D[t], {tl: a, tr: u, bl: f, br: d, tex: p} = i;
3265
3265
  this.X(r, n, o, st, 10 * a.x, 10 * a.y, p.x, p.y + p.h), h && this.q(r, l, rt, i.glyphOffset, e, c),
3266
- this.J(r, R, L, N, V, j, U, G, W, B, X, q, et, J, Y, $, Z, K), this.X(r, n, o, st, 10 * u.x, 10 * u.y, p.x + p.w, p.y + p.h),
3267
- h && this.q(r, l, rt, i.glyphOffset, e, c), this.J(r, R, L, N, V, j, U, G, W, B, X, q, et, J, Y, $, Z, K),
3266
+ this.J(r, L, R, N, V, j, U, G, W, B, X, q, et, J, Y, $, Z, K), this.X(r, n, o, st, 10 * u.x, 10 * u.y, p.x + p.w, p.y + p.h),
3267
+ h && this.q(r, l, rt, i.glyphOffset, e, c), this.J(r, L, R, N, V, j, U, G, W, B, X, q, et, J, Y, $, Z, K),
3268
3268
  this.X(r, n, o, st, 10 * f.x, 10 * f.y, p.x, p.y), h && this.q(r, l, rt, i.glyphOffset, e, c),
3269
- this.J(r, R, L, N, V, j, U, G, W, B, X, q, et, J, Y, $, Z, K), this.X(r, n, o, st, 10 * d.x, 10 * d.y, p.x + p.w, p.y),
3270
- h && this.q(r, l, rt, i.glyphOffset, e, c), this.J(r, R, L, N, V, j, U, G, W, B, X, q, et, J, Y, $, Z, K),
3269
+ this.J(r, L, R, N, V, j, U, G, W, B, X, q, et, J, Y, $, Z, K), this.X(r, n, o, st, 10 * d.x, 10 * d.y, p.x + p.w, p.y),
3270
+ h && this.q(r, l, rt, i.glyphOffset, e, c), this.J(r, L, R, N, V, j, U, G, W, B, X, q, et, J, Y, $, Z, K),
3271
3271
  this.addElements(s, s + 1, s + 2), this.addElements(s + 1, s + 2, s + 3), s += 4;
3272
3272
  const y = Math.max(Math.abs(n), Math.abs(o), Math.abs(st));
3273
3273
  y > this.maxPos && (this.maxPos = y);
@@ -3285,12 +3285,12 @@
3285
3285
  }
3286
3286
  }
3287
3287
  J(t, e, n, i, r, s, o, a, l, h, c, u, f, d, p, y, m, g) {
3288
- const {textFillFn: v, textSizeFn: x, textHaloFillFn: b, textHaloRadiusFn: w, textHaloOpacityFn: A, textDxFn: _, textDyFn: M, textPitchAlignmentFn: S, textRotationAlignmentFn: k, textRotationFn: P, textAllowOverlapFn: T, textIgnorePlacementFn: O, textOpacityFn: F, markerWidthFn: I, markerHeightFn: C, markerDxFn: E, markerDyFn: H, markerPitchAlignmentFn: D, markerRotationAlignmentFn: R, markerRotationFn: L, markerAllowOverlapFn: N, markerIgnorePlacementFn: z, markerOpacityFn: V} = this.D;
3288
+ const {textFillFn: v, textSizeFn: x, textHaloFillFn: b, textHaloRadiusFn: w, textHaloOpacityFn: A, textDxFn: _, textDyFn: M, textPitchAlignmentFn: S, textRotationAlignmentFn: k, textRotationFn: P, textAllowOverlapFn: T, textIgnorePlacementFn: O, textOpacityFn: F, markerWidthFn: I, markerHeightFn: C, markerDxFn: E, markerDyFn: H, markerPitchAlignmentFn: D, markerRotationAlignmentFn: L, markerRotationFn: R, markerAllowOverlapFn: N, markerIgnorePlacementFn: z, markerOpacityFn: V} = this.D;
3289
3289
  v && t.aTextFill.push(...e), x && t.aTextSize.push(n), b && t.aTextHaloFill.push(...i),
3290
3290
  w && t.aTextHaloRadius.push(r), A && t.aTextHaloOpacity.push(s), _ && t.aTextDx.push(o),
3291
3291
  M && t.aTextDy.push(a), I && t.aMarkerWidth.push(l), C && t.aMarkerHeight.push(h),
3292
3292
  E && t.aMarkerDx.push(c), H && t.aMarkerDy.push(u), (V || F) && t.aColorOpacity.push(f),
3293
- (S || D) && t.aPitchAlign.push(d), (R || k) && t.aRotationAlign.push(p), (L || P) && t.aRotation.push(9362 * y);
3293
+ (S || D) && t.aPitchAlign.push(d), (L || k) && t.aRotationAlign.push(p), (R || P) && t.aRotation.push(9362 * y);
3294
3294
  const j = N || T, U = z || O;
3295
3295
  (j || U) && t.aOverlap.push((j ? 8 : 0) + 4 * m + ((U ? 2 : 0) + g)), r > 0 && (this.properties.hasHalo = 1);
3296
3296
  }
@@ -3433,18 +3433,18 @@
3433
3433
  if (e && (v = e(this.options.zoom, m) || "miter"), n && (x = n(this.options.zoom, m) || "butt"),
3434
3434
  i) {
3435
3435
  let t = i(this.options.zoom, m);
3436
- Re(t) && (t = 4), this.feaLineWidth = t;
3436
+ Le(t) && (t = 4), this.feaLineWidth = t;
3437
3437
  } else this.feaLineWidth = d.lineWidth;
3438
3438
  if (r) {
3439
3439
  let t = r(this.options.zoom, m);
3440
- Re(t) && (t = 0), this.feaLineStrokeWidth = t;
3440
+ Le(t) && (t = 0), this.feaLineStrokeWidth = t;
3441
3441
  } else this.feaLineStrokeWidth = d.lineStrokeWidth || 0;
3442
3442
  if (o && (this.feaColor = o(this.options.zoom, m) || [ 0, 0, 0, 255 ], _(this.feaColor) ? this.feaColor = [ 0, 0, 0, 0 ] : (this.feaColor = Array.isArray(this.feaColor) ? this.feaColor.map(t => 255 * t) : zt(this.feaColor).array(),
3443
3443
  3 === this.feaColor.length && this.feaColor.push(255))), s && (this.feaStrokeColor = s(this.options.zoom, m) || [ 0, 0, 0, 255 ],
3444
3444
  _(this.feaStrokeColor) ? this.feaStrokeColor = [ 0, 0, 0, 0 ] : (this.feaStrokeColor = Array.isArray(this.feaStrokeColor) ? this.feaStrokeColor.map(t => 255 * t) : zt(this.feaStrokeColor).array(),
3445
3445
  3 === this.feaStrokeColor.length && this.feaStrokeColor.push(255))), a) {
3446
3446
  let t = a(this.options.zoom, m);
3447
- Re(t) && (t = 1), this.feaOpacity = 255 * t;
3447
+ Le(t) && (t = 1), this.feaOpacity = 255 * t;
3448
3448
  }
3449
3449
  if (this.dasharrayFn) {
3450
3450
  let t = this.dasharrayFn(this.options.zoom, m) || [ 0, 0, 0, 0 ];
@@ -3470,19 +3470,19 @@
3470
3470
  }
3471
3471
  if (h) {
3472
3472
  let t = h(this.options.zoom, m);
3473
- Re(t) && (t = 0), this.feaLineDx = t;
3473
+ Le(t) && (t = 0), this.feaLineDx = t;
3474
3474
  }
3475
3475
  if (c) {
3476
3476
  let t = c(this.options.zoom, m);
3477
- Re(t) && (t = 0), this.feaLineDy = t;
3477
+ Le(t) && (t = 0), this.feaLineDy = t;
3478
3478
  }
3479
3479
  if (u) {
3480
3480
  let t = u(this.options.zoom, m);
3481
- Re(t) && (t = 0), 0 !== t && (this.properties.hasPatternAnim = 1), this.feaPatternAnimSpeed = t;
3481
+ Le(t) && (t = 0), 0 !== t && (this.properties.hasPatternAnim = 1), this.feaPatternAnimSpeed = t;
3482
3482
  }
3483
3483
  if (f) {
3484
3484
  let t = f(this.options.zoom, m);
3485
- Re(t) && (t = 0), this.feaLinePatternGap = t;
3485
+ Le(t) && (t = 0), this.feaLinePatternGap = t;
3486
3486
  }
3487
3487
  const b = this.options.EXTENT;
3488
3488
  let w = p.geometry;
@@ -3728,9 +3728,9 @@
3728
3728
  let n, i, r, s;
3729
3729
  const {polygonFillFn: o, polygonOpacityFn: a, uvScaleFn: l, uvOffsetFn: h} = this.D, c = e.properties;
3730
3730
  o && (n = o(this.options.zoom, c) || [ 255, 255, 255, 255 ], _(n) ? n = [ 0, 0, 0, 0 ] : (n = Array.isArray(n) ? n.map(t => 255 * t) : zt(n).array(),
3731
- 3 === n.length && n.push(255))), a && (i = a(this.options.zoom, c), Re(i) && (i = 1),
3732
- i *= 255), l && (r = l(this.options.zoom, c), Re(r) && (r = [ 1, 1 ]), r = [ 255 * r[0], 255 * r[1] ]),
3733
- h && (s = h(this.options.zoom, c), Re(s) && (s = [ 0, 0 ]), s = [ 255 * s[0], 255 * s[1] ]);
3731
+ 3 === n.length && n.push(255))), a && (i = a(this.options.zoom, c), Le(i) && (i = 1),
3732
+ i *= 255), l && (r = l(this.options.zoom, c), Le(r) && (r = [ 1, 1 ]), r = [ 255 * r[0], 255 * r[1] ]),
3733
+ h && (s = h(this.options.zoom, c), Le(s) && (s = [ 0, 0 ]), s = [ 255 * s[0], 255 * s[1] ]);
3734
3734
  const u = !!this.iconAtlas, f = $n(t, 500), d = this.getAltitude(c), p = [ 0, 0 ], y = [ 0, 0 ];
3735
3735
  if (u) {
3736
3736
  const {polygonPatternFileFn: t} = this.D, e = t ? t(null, c) : this.symbol.polygonPatternFile;
@@ -4077,6 +4077,7 @@
4077
4077
  clipPolygon: di,
4078
4078
  calculateSignedArea: Ge,
4079
4079
  getFeaAltitudeAndHeight: function(t, e, n, i, r, s, o) {
4080
+ e || 0 === e || (e = 1);
4080
4081
  const a = We(t.properties, n, i), l = a * e;
4081
4082
  let h = a;
4082
4083
  return r ? h = We(t.properties, r, s) : o && (h = a - We(t.properties, o, 0)), h *= e,
@@ -4186,7 +4187,7 @@
4186
4187
  layerId: n,
4187
4188
  command: "loadTile",
4188
4189
  params: {
4189
- tileInfo: R(t.tileInfo),
4190
+ tileInfo: L(t.tileInfo),
4190
4191
  glScale: t.glScale,
4191
4192
  zScale: t.zScale
4192
4193
  }
@@ -4319,25 +4320,25 @@
4319
4320
  });
4320
4321
  }
4321
4322
  }
4322
- const Di = new Uint8Array([ 0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1 ]), Ri = [];
4323
- class Li {
4323
+ const Di = new Uint8Array([ 0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1 ]), Li = [];
4324
+ class Ri {
4324
4325
  constructor(t, e, i) {
4325
4326
  this.Mt = t;
4326
4327
  (this.Ht = new n.reshader.Geometry({
4327
4328
  aPosition: Di
4328
4329
  }, null, Di.length / 2, {
4329
4330
  positionSize: 2
4330
- })).generateBuffers(t), this.Dt = new n.reshader.Scene, this.Rt = [], this.Lt = 0,
4331
+ })).generateBuffers(t), this.Dt = new n.reshader.Scene, this.Lt = [], this.Rt = 0,
4331
4332
  this.Nt = e, this.St = i, this.Tt(t);
4332
4333
  }
4333
4334
  start() {
4334
- this.Lt = 0, this.Dt.clear();
4335
+ this.Rt = 0, this.Dt.clear();
4335
4336
  }
4336
4337
  add(t, e, i) {
4337
4338
  const r = this.zt(i);
4338
- r.setUniform("ref", t), n.vec3.set(Ri, e, e, 1);
4339
+ r.setUniform("ref", t), n.vec3.set(Li, e, e, 1);
4339
4340
  const s = r.localTransform;
4340
- n.mat4.fromScaling(s, Ri), n.mat4.mul(s, i, s), r.setLocalTransform(s), this.Dt.addMesh(r);
4341
+ n.mat4.fromScaling(s, Li), n.mat4.mul(s, i, s), r.setLocalTransform(s), this.Dt.addMesh(r);
4341
4342
  }
4342
4343
  render(t) {
4343
4344
  this.Vt.render(this.jt, {
@@ -4345,8 +4346,8 @@
4345
4346
  }, this.Dt, t);
4346
4347
  }
4347
4348
  zt() {
4348
- const t = this.Lt++;
4349
- return this.Rt[t] || (this.Rt[t] = new n.reshader.Mesh(this.Ht)), this.Rt[t];
4349
+ const t = this.Rt++;
4350
+ return this.Lt[t] || (this.Lt[t] = new n.reshader.Mesh(this.Ht)), this.Lt[t];
4350
4351
  }
4351
4352
  Tt(t) {
4352
4353
  const e = this.Nt, i = {
@@ -4393,8 +4394,8 @@
4393
4394
  }
4394
4395
  remove() {
4395
4396
  this.Ht.dispose();
4396
- for (let t = 0; t < this.Rt.length; t++) this.Rt[t].dispose();
4397
- this.Rt.length = 0, this.jt.dispose();
4397
+ for (let t = 0; t < this.Lt.length; t++) this.Lt[t].dispose();
4398
+ this.Lt.length = 0, this.jt.dispose();
4398
4399
  }
4399
4400
  }
4400
4401
  const Ni = [], zi = [ 0, 0, 0, 0 ], Vi = new r.Point(0, 0);
@@ -4788,10 +4789,10 @@
4788
4789
  }
4789
4790
  Ee(t) {
4790
4791
  const e = this.isEnableTileStencil(), n = this.getCurrentTileZoom();
4791
- let i = this.Re;
4792
- i || (i = this.Re = new Li(this.regl, this.canvas, this.getMap())), i.start();
4793
- const {tiles: r} = this.Le;
4794
- let {parentTiles: s, childTiles: o} = this.Le, a = 1;
4792
+ let i = this.Le;
4793
+ i || (i = this.Le = new Ri(this.regl, this.canvas, this.getMap())), i.start();
4794
+ const {tiles: r} = this.Re;
4795
+ let {parentTiles: s, childTiles: o} = this.Re, a = 1;
4795
4796
  o = o.sort(Gi);
4796
4797
  for (let t = 0; t < o.length; t++) this.Ne(o[t].info, e ? a : this.getTileLevelValue(o[t].info.z, n)),
4797
4798
  a++;
@@ -4805,7 +4806,7 @@
4805
4806
  }
4806
4807
  Ne(t, e) {
4807
4808
  const n = this.ze, i = Vi.set(t.extent2d.xmin, t.extent2d.ymax), r = t.transform = t.transform || this.calculateTileMatrix(i, t.z);
4808
- t.stencilRef = e, this.Re.add(e, n, r);
4809
+ t.stencilRef = e, this.Le.add(e, n, r);
4809
4810
  }
4810
4811
  onDrawTileStart(t) {
4811
4812
  super.onDrawTileStart(t);
@@ -4814,7 +4815,7 @@
4814
4815
  for (let t = 0; t < e.length; t++) this.be[e[t].info.id] = 1;
4815
4816
  for (let t = 0; t < n.length; t++) this.we[n[t].info.id] = 1;
4816
4817
  for (let t = 0; t < i.length; t++) this.we[i[t].info.id] = 1;
4817
- this.Le = t;
4818
+ this.Re = t;
4818
4819
  }
4819
4820
  isEnableTileStencil() {
4820
4821
  return this.layer.isOnly2D();
@@ -4925,7 +4926,7 @@
4925
4926
  }));
4926
4927
  }
4927
4928
  onRemove() {
4928
- this.Re && this.Re.remove(), this.qt && (this.qt.removeLayer(t => {
4929
+ this.Le && this.Le.remove(), this.qt && (this.qt.removeLayer(t => {
4929
4930
  if (t) throw t;
4930
4931
  }), this.qt.remove(), delete this.qt), this.pickingFBO && (this.canvas.pickingFBO || this.pickingFBO.destroy(),
4931
4932
  delete this.pickingFBO), this.ne && this.ne.delete(), super.onRemove && super.onRemove(),
@@ -5658,7 +5659,7 @@
5658
5659
  return t && "VectorTileLayer" === t.type ? new Qi(t.id, t.options) : null;
5659
5660
  }
5660
5661
  Se() {
5661
- this.Je && (this.sn = L(this.Je)), this.Xe && (this.an = L(this.Xe));
5662
+ this.Je && (this.sn = R(this.Je)), this.Xe && (this.an = R(this.Xe));
5662
5663
  }
5663
5664
  static registerPlugin(t) {
5664
5665
  Qi.plugins || (Qi.plugins = {}), Qi.plugins[t.type] = t;
@@ -6290,7 +6291,7 @@
6290
6291
  let br = new Float32Array(1);
6291
6292
  class wr extends r.renderer.CanvasRenderer {
6292
6293
  constructor(...t) {
6293
- super(...t), this.features = {}, this.vn = {}, this.Lt = 1, this.xn = {}, this.bn = {},
6294
+ super(...t), this.features = {}, this.vn = {}, this.Rt = 1, this.xn = {}, this.bn = {},
6294
6295
  this.wn = {}, this.An = {}, this._n = {}, this.Mn = !0, this.Sn = {
6295
6296
  id: 0,
6296
6297
  pickingId: 0
@@ -6314,7 +6315,7 @@
6314
6315
  const t = this.Dn;
6315
6316
  delete this.Dn, this.In(t), this.En = !1;
6316
6317
  }
6317
- if (!this.meshes && !this.Rn && !this.Ln) return void this.completeRender();
6318
+ if (!this.meshes && !this.Ln && !this.Rn) return void this.completeRender();
6318
6319
  this.Nn && (this.zn(), this.Nn = !1), this.Vn(), n.options.collision && n.clearCollisionIndex(),
6319
6320
  this.ae = t, this.ce = e || {};
6320
6321
  const i = this.jn();
@@ -6322,10 +6323,10 @@
6322
6323
  this.painter && this.meshes && (this.painter.startFrame(i), this.painter.addMesh(this.meshes, null, {
6323
6324
  bloom: 1
6324
6325
  }), this.painter.prepareRender(i), i.polygonOffsetIndex = r++, this.painter.render(i)),
6325
- this.Ln && (this.On.startFrame(i), this.On.addMesh(this.Ln, null, {
6326
+ this.Rn && (this.On.startFrame(i), this.On.addMesh(this.Rn, null, {
6326
6327
  bloom: 1
6327
- }), this.On.prepareRender(i), i.polygonOffsetIndex = r++, this.On.render(i)), this.Rn && (this.Tn.startFrame(i),
6328
- this.Tn.addMesh(this.Rn, null, {
6328
+ }), this.On.prepareRender(i), i.polygonOffsetIndex = r++, this.On.render(i)), this.Ln && (this.Tn.startFrame(i),
6329
+ this.Tn.addMesh(this.Ln, null, {
6329
6330
  bloom: 1
6330
6331
  }), this.Tn.prepareRender(i), n.options.collision && this.Tn.updateCollision(i),
6331
6332
  this.Tn.render(i)), this.completeRender(), this.layer.fire("canvasisdirty");
@@ -6369,8 +6370,8 @@
6369
6370
  } else s.visible || (this.Nn = !0), this.Wn(s.geometry, e), t.push(s);
6370
6371
  }
6371
6372
  return t.length || (this.meshes && this.painter && (this.painter.deleteMesh(this.meshes),
6372
- delete this.meshes), this.Rn && (this.Tn.deleteMesh(this.Rn), delete this.Rn), this.Ln && (this.On.deleteMesh(this.Ln),
6373
- delete this.Ln)), e[3] && (e[0] /= e[3], e[1] /= e[3]), {
6373
+ delete this.meshes), this.Ln && (this.Tn.deleteMesh(this.Ln), delete this.Ln), this.Rn && (this.On.deleteMesh(this.Rn),
6374
+ delete this.Rn)), e[3] && (e[0] /= e[3], e[1] /= e[3]), {
6374
6375
  features: t,
6375
6376
  center: e
6376
6377
  };
@@ -6467,22 +6468,22 @@
6467
6468
  }
6468
6469
  Fn(t) {
6469
6470
  const e = Object.keys(this.wn), i = Object.keys(this.An);
6470
- if (!e.length && !i.length) return void (this.Rn && (this.Tn.deleteMesh(this.Rn),
6471
- delete this.Rn));
6471
+ if (!e.length && !i.length) return void (this.Ln && (this.Tn.deleteMesh(this.Ln),
6472
+ delete this.Ln));
6472
6473
  const {features: r, center: s} = this.Gn(), o = [], a = [];
6473
6474
  for (let t = 0; t < r.length; t++) {
6474
6475
  const e = r[t][xr];
6475
6476
  this.wn[e] && o.push(r[t]), this.An[e] && a.push(r[t]);
6476
6477
  }
6477
- if (!o.length && !a.length) return void (this.Rn && (this.Tn.deleteMesh(this.Rn),
6478
- delete this.Rn));
6478
+ if (!o.length && !a.length) return void (this.Ln && (this.Tn.deleteMesh(this.Ln),
6479
+ delete this.Ln));
6479
6480
  const l = this.Nn;
6480
6481
  this.$n = s;
6481
6482
  const h = this.Zn(o, a, t, s);
6482
6483
  this.Hn = {};
6483
6484
  const c = [], u = [];
6484
6485
  this.Kn = !0, Promise.all(h).then(t => {
6485
- if (this.Rn && (this.Tn.deleteMesh(this.Rn), delete this.Rn), !t || !t.length) return void this.setToRedraw();
6486
+ if (this.Ln && (this.Tn.deleteMesh(this.Ln), delete this.Ln), !t || !t.length) return void this.setToRedraw();
6486
6487
  const e = this.Tn.createGeometries(t.map(t => t && t.data), this.xn);
6487
6488
  for (let n = 0; n < e.length; n++) this.Bn(e[n].geometry, t[n] && t[n].data);
6488
6489
  const i = t[0] && t[0].data.iconAtlas, r = t[0] && t[0].data.glyphAtlas || t[1] && t[1].data.glyphAtlas;
@@ -6492,11 +6493,11 @@
6492
6493
  const a = this.Tn.createMeshes(e, o);
6493
6494
  for (let t = 0; t < a.length; t++) a[t].geometry.properties.originElements = a[t].geometry.properties.elements.slice(),
6494
6495
  a[t].setUniform("level", 0), a[t].material.set("flipY", 1), a[t].properties.meshKey = gr++;
6495
- this.Rn = a, l && (this.Nn = !0), this.Kn = !1, this.setToRedraw();
6496
+ this.Ln = a, l && (this.Nn = !0), this.Kn = !1, this.setToRedraw();
6496
6497
  });
6497
6498
  }
6498
6499
  zn() {
6499
- if (this.Rn && (this.Qn(this.Rn[0], this.wn), this.Qn(this.Rn[1], this.An)), this.Ln) for (let t = 0; t < this.Ln.length; t++) this.Qn(this.Ln[t], this._n);
6500
+ if (this.Ln && (this.Qn(this.Ln[0], this.wn), this.Qn(this.Ln[1], this.An)), this.Rn) for (let t = 0; t < this.Rn.length; t++) this.Qn(this.Rn[t], this._n);
6500
6501
  if (this.meshes) for (let t = 0; t < this.meshes.length; t++) this.Qn(this.meshes[t], this.xn);
6501
6502
  }
6502
6503
  Qn(t, e) {
@@ -6528,7 +6529,7 @@
6528
6529
  const e = t._getInternalSymbol(), n = {
6529
6530
  zoom: this.getMap().getZoom()
6530
6531
  }, i = this.ei(t);
6531
- if (!this.Rn) return !1;
6532
+ if (!this.Ln) return !1;
6532
6533
  let r = this.features[i];
6533
6534
  Array.isArray(r) || (r = [ r ]);
6534
6535
  const s = [], o = [], a = this.getMap().getZoom();
@@ -6544,7 +6545,7 @@
6544
6545
  const e = r[t][xr];
6545
6546
  this.wn[e] && s.push(r[t]), this.An[e] && o.push(r[t]);
6546
6547
  }
6547
- const c = r[0].id, u = this.Zn(s, o, this.Hn, this.$n), f = this.Rn;
6548
+ const c = r[0].id, u = this.Zn(s, o, this.Hn, this.$n), f = this.Ln;
6548
6549
  return Promise.all(u).then(t => {
6549
6550
  for (let e = 0; e < t.length; e++) {
6550
6551
  if (!t[e]) continue;
@@ -6561,7 +6562,7 @@
6561
6562
  }), !0;
6562
6563
  }
6563
6564
  ii(t) {
6564
- return this.ri(t, this.Ln, this.Dn, this.si, this.On, ai, mr, this.oi);
6565
+ return this.ri(t, this.Rn, this.Dn, this.si, this.On, ai, mr, this.oi);
6565
6566
  }
6566
6567
  ri(t, e, n, i, r, s, o, a) {
6567
6568
  if (!e) return !1;
@@ -6617,15 +6618,15 @@
6617
6618
  }), !0;
6618
6619
  }
6619
6620
  In(t) {
6620
- if (!Object.keys(this._n).length) return void (this.Ln && (this.On.deleteMesh(this.Ln),
6621
- delete this.Ln));
6621
+ if (!Object.keys(this._n).length) return void (this.Rn && (this.On.deleteMesh(this.Rn),
6622
+ delete this.Rn));
6622
6623
  const {features: e, center: n} = this.Gn();
6623
6624
  if (!e.length) return;
6624
6625
  const i = this.Nn;
6625
6626
  this.si = n;
6626
6627
  const r = this.oi(e), s = F({}, mr), o = r.map((e, i) => this.createMesh(this.On, ai, s, e, t && t[i], n));
6627
6628
  this.ai = !0, Promise.all(o).then(t => {
6628
- this.Ln && this.On.deleteMesh(this.Ln);
6629
+ this.Rn && this.On.deleteMesh(this.Rn);
6629
6630
  const e = [], n = [];
6630
6631
  for (let i = 0; i < t.length; i++) {
6631
6632
  const r = t[i] && t[i].meshes;
@@ -6637,7 +6638,7 @@
6637
6638
  n[i] = t[i].atlas;
6638
6639
  }
6639
6640
  }
6640
- this.Ln = e, this.Dn = n, i && (this.Nn = i), this.ai = !1, this.setToRedraw();
6641
+ this.Rn = e, this.Dn = n, i && (this.Nn = i), this.ai = !1, this.setToRedraw();
6641
6642
  });
6642
6643
  }
6643
6644
  oi(t) {
@@ -6668,7 +6669,7 @@
6668
6669
  }
6669
6670
  }
6670
6671
  ei(t) {
6671
- t[fr] || (t[fr] = this.Lt++);
6672
+ t[fr] || (t[fr] = this.Rt++);
6672
6673
  const e = t[fr];
6673
6674
  this.features[e] && this.ci(e), this.features[e] = dr(t, this.Sn, this.features[e]);
6674
6675
  const n = this.features[e];
@@ -6776,7 +6777,7 @@
6776
6777
  for (let i = 0; i < e.length; i++) if (!t(e[0], n[0])) return !1;
6777
6778
  } else if (Array.isArray(e[0]) || Array.isArray(n[0])) return !1;
6778
6779
  return !0;
6779
- }(n, (Array.isArray(r) ? r[0] : r).geometry)) return this.Ln && (this.En = !0),
6780
+ }(n, (Array.isArray(r) ? r[0] : r).geometry)) return this.Rn && (this.En = !0),
6780
6781
  void this.onGeometryPositionChange(t);
6781
6782
  this.hi([ e ]), this.li(), Ar(this);
6782
6783
  }
@@ -6825,7 +6826,9 @@
6825
6826
  this.prepareRequestors(), this.pickingFBO = this.canvas.pickingFBO || this.regl.framebuffer(this.canvas.width, this.canvas.height),
6826
6827
  this.painter = this.createPainter();
6827
6828
  const e = cr.get3DPainterClass("icon"), n = F({}, pr, yr);
6828
- this.Tn = new e(this.regl, this.layer, n, this.layer.options.sceneConfig, 0);
6829
+ this.Tn = new e(this.regl, this.layer, n, this.layer.options.sceneConfig, 0), this.Tn.setTextShaderDefines({
6830
+ REVERSE_MAP_ROTATION_ON_PITCH: 1
6831
+ });
6829
6832
  const i = cr.get3DPainterClass("line"), r = F({}, mr);
6830
6833
  this.On = new i(this.regl, this.layer, r, this.layer.options.sceneConfig, 0), this.layer.getGeometries() && this.onGeometryAdd(this.layer.getGeometries());
6831
6834
  }
@@ -7071,7 +7074,7 @@
7071
7074
  * BSD License
7072
7075
  * https://github.com/gdsmith/jquery.easing/
7073
7076
  */
7074
- var Hr = Math.pow, Dr = Math.sqrt, Rr = Math.sin, Lr = Math.cos, Nr = Math.PI, zr = 1.70158, Vr = 1.525 * zr, jr = 2 * Nr / 3, Ur = 2 * Nr / 4.5;
7077
+ var Hr = Math.pow, Dr = Math.sqrt, Lr = Math.sin, Rr = Math.cos, Nr = Math.PI, zr = 1.70158, Vr = 1.525 * zr, jr = 2 * Nr / 3, Ur = 2 * Nr / 4.5;
7075
7078
  function Gr(t) {
7076
7079
  var e = 7.5625, n = 2.75;
7077
7080
  return t < 1 / n ? e * t * t : t < 2 / n ? e * (t -= 1.5 / n) * t + .75 : t < 2.5 / n ? e * (t -= 2.25 / n) * t + .9375 : e * (t -= 2.625 / n) * t + .984375;
@@ -7143,17 +7146,17 @@
7143
7146
 
7144
7147
  case "easeinsine":
7145
7148
  return function(t) {
7146
- return 1 - Lr(t * Nr / 2);
7149
+ return 1 - Rr(t * Nr / 2);
7147
7150
  }(e);
7148
7151
 
7149
7152
  case "easeoutsine":
7150
7153
  return function(t) {
7151
- return Rr(t * Nr / 2);
7154
+ return Lr(t * Nr / 2);
7152
7155
  }(e);
7153
7156
 
7154
7157
  case "easeinoutsine":
7155
7158
  return function(t) {
7156
- return -(Lr(Nr * t) - 1) / 2;
7159
+ return -(Rr(Nr * t) - 1) / 2;
7157
7160
  }(e);
7158
7161
 
7159
7162
  case "easeinexpo":
@@ -7188,17 +7191,17 @@
7188
7191
 
7189
7192
  case "easeinelastic":
7190
7193
  return function(t) {
7191
- return 0 === t ? 0 : 1 === t ? 1 : -Hr(2, 10 * t - 10) * Rr((10 * t - 10.75) * jr);
7194
+ return 0 === t ? 0 : 1 === t ? 1 : -Hr(2, 10 * t - 10) * Lr((10 * t - 10.75) * jr);
7192
7195
  }(e);
7193
7196
 
7194
7197
  case "easeoutelastic":
7195
7198
  return function(t) {
7196
- return 0 === t ? 0 : 1 === t ? 1 : Hr(2, -10 * t) * Rr((10 * t - .75) * jr) + 1;
7199
+ return 0 === t ? 0 : 1 === t ? 1 : Hr(2, -10 * t) * Lr((10 * t - .75) * jr) + 1;
7197
7200
  }(e);
7198
7201
 
7199
7202
  case "easeinoutelastic":
7200
7203
  return function(t) {
7201
- return 0 === t ? 0 : 1 === t ? 1 : t < .5 ? -Hr(2, 20 * t - 10) * Rr((20 * t - 11.125) * Ur) / 2 : Hr(2, -20 * t + 10) * Rr((20 * t - 11.125) * Ur) / 2 + 1;
7204
+ return 0 === t ? 0 : 1 === t ? 1 : t < .5 ? -Hr(2, 20 * t - 10) * Lr((20 * t - 11.125) * Ur) / 2 : Hr(2, -20 * t + 10) * Lr((20 * t - 11.125) * Ur) / 2 + 1;
7202
7205
  }(e);
7203
7206
 
7204
7207
  case "easeinback":
@@ -7784,13 +7787,13 @@
7784
7787
  function Os(t) {
7785
7788
  return t && _(t) && t.property;
7786
7789
  }
7787
- const {loginIBLResOnCanvas: Fs, logoutIBLResOnCanvas: Is, getIBLResOnCanvas: Cs} = n.reshader.pbr.PBRUtils, Es = [], Hs = [], Ds = t => 0 === t.getUniform("level"), Rs = t => t.getUniform("level") > 0;
7788
- class Ls {
7790
+ const {loginIBLResOnCanvas: Fs, logoutIBLResOnCanvas: Is, getIBLResOnCanvas: Cs} = n.reshader.pbr.PBRUtils, Es = [], Hs = [], Ds = t => 0 === t.getUniform("level"), Ls = t => t.getUniform("level") > 0;
7791
+ class Rs {
7789
7792
  constructor(t, e, i, r, s, o) {
7790
7793
  this.regl = t, this.layer = e, this.canvas = e.getRenderer().canvas, this.sceneConfig = r || {},
7791
7794
  this.dataConfig = o || {}, this.pluginIndex = s, this.scene = new n.reshader.Scene,
7792
7795
  this.pickingFBO = e.getRenderer().pickingFBO, this.Hi = new es, this.level0Filter = Ds,
7793
- this.levelNFilter = Rs, this.loginTextureCache(), this.symbolDef = Array.isArray(i) ? i.map(t => os(t)) : [ os(i) ],
7796
+ this.levelNFilter = Ls, this.loginTextureCache(), this.symbolDef = Array.isArray(i) ? i.map(t => os(t)) : [ os(i) ],
7794
7797
  this.Di(), this.pickingViewport = {
7795
7798
  x: 0,
7796
7799
  y: 0,
@@ -7806,7 +7809,7 @@
7806
7809
  return n.getTileLevelValue && n.getTileLevelValue(t, e) || 0;
7807
7810
  }
7808
7811
  isVisible() {
7809
- const t = this.R;
7812
+ const t = this.L;
7810
7813
  if (t.length) for (let e = 0; e < t.length; e++) if (t[e] && !t[e].isFeatureConstant) return !0;
7811
7814
  const e = this.getSymbols();
7812
7815
  for (let t = 0; t < e.length; t++) {
@@ -7818,7 +7821,7 @@
7818
7821
  isMeshVisible(t) {
7819
7822
  const e = t && t.properties && t.properties.symbolIndex;
7820
7823
  if (!e) return !1;
7821
- const n = this.R, i = e.index;
7824
+ const n = this.L, i = e.index;
7822
7825
  let r;
7823
7826
  if (n[i]) {
7824
7827
  if (!n[i].isFeatureConstant) return !0;
@@ -7827,7 +7830,7 @@
7827
7830
  return !1 !== r && 0 !== r;
7828
7831
  }
7829
7832
  needToRedraw() {
7830
- return this.Ri;
7833
+ return this.Li;
7831
7834
  }
7832
7835
  needToRetireFrames() {
7833
7836
  return this.$t;
@@ -7851,7 +7854,7 @@
7851
7854
  }) : n.push(null); else {
7852
7855
  const r = this.createGeometry(t[i], e, i);
7853
7856
  if (r && r.geometry) {
7854
- const {pickingIdMap: n, idPickingMap: s, hasFeaIds: o} = this.Li(t[i]), a = r.geometry.properties;
7857
+ const {pickingIdMap: n, idPickingMap: s, hasFeaIds: o} = this.Ri(t[i]), a = r.geometry.properties;
7855
7858
  a.symbolIndex = r.symbolIndex, a.features = e, o && (a.feaIdPickingMap = n, a.feaPickingIdMap = s);
7856
7859
  }
7857
7860
  this.postCreateGeometry(r, n), n.push(r);
@@ -7859,7 +7862,7 @@
7859
7862
  return n;
7860
7863
  }
7861
7864
  postCreateGeometry() {}
7862
- Li(t) {
7865
+ Ri(t) {
7863
7866
  if (!t) return {};
7864
7867
  if (Array.isArray(t) && !(t = t[0])) return {};
7865
7868
  const e = t.featureIds, n = {}, i = {}, r = e && e.length;
@@ -7924,11 +7927,11 @@
7924
7927
  this.Ni = t;
7925
7928
  const n = this.getUniformValues(e, t);
7926
7929
  return this.callShader(n, t), {
7927
- redraw: this.Ri
7930
+ redraw: this.Li
7928
7931
  };
7929
7932
  }
7930
7933
  setToRedraw(t) {
7931
- t && (this.$t = t), this.Ri = !0;
7934
+ t && (this.$t = t), this.Li = !0;
7932
7935
  }
7933
7936
  callShader(t, e) {
7934
7937
  this.callCurrentTileShader(t, e), this.callBackgroundTileShader(t, e);
@@ -8008,7 +8011,7 @@
8008
8011
  }
8009
8012
  }
8010
8013
  startFrame(t) {
8011
- this.zi || (this.init(t), this.zi = !0), this.se !== t.timestamp && (this.Ri = !1,
8014
+ this.zi || (this.init(t), this.zi = !0), this.se !== t.timestamp && (this.Li = !1,
8012
8015
  this.$t = !1), this.scene.clear();
8013
8016
  }
8014
8017
  resize() {}
@@ -8053,7 +8056,7 @@
8053
8056
  enumerable: !0
8054
8057
  }) : r[t] = o[t];
8055
8058
  }
8056
- return _(n.visible) && (this.R[t] = M(n.visible)), i;
8059
+ return _(n.visible) && (this.L[t] = M(n.visible)), i;
8057
8060
  }
8058
8061
  getSymbolDef(t) {
8059
8062
  return this.symbolDef[t.index];
@@ -8067,9 +8070,9 @@
8067
8070
  }
8068
8071
  Di() {
8069
8072
  const t = this.getMap(), e = () => [ t.getZoom() ];
8070
- this.Wi = [], this.R = [];
8073
+ this.Wi = [], this.L = [];
8071
8074
  for (let t = 0; t < this.symbolDef.length; t++) this.Wi[t] = k(ns({}, this.symbolDef[t]), e),
8072
- this.symbolDef[t] && _(this.symbolDef[t].visible) && (this.R[t] = M(this.symbolDef[t].visible));
8075
+ this.symbolDef[t] && _(this.symbolDef[t].visible) && (this.L[t] = M(this.symbolDef[t].visible));
8073
8076
  }
8074
8077
  getFnTypeConfig(t) {
8075
8078
  this.Ui || (this.Ui = []);
@@ -8267,7 +8270,7 @@
8267
8270
  function zs(t, e) {
8268
8271
  return t.properties.level - e.properties.level;
8269
8272
  }
8270
- class Vs extends Ls {
8273
+ class Vs extends Rs {
8271
8274
  constructor(t, e, n, i, r, s) {
8272
8275
  super(t, e, n, i, r, s);
8273
8276
  }
@@ -8904,13 +8907,13 @@
8904
8907
  }
8905
8908
  class Zs {
8906
8909
  constructor(t) {
8907
- this.Rt = t || [], this.properties = {};
8910
+ this.Lt = t || [], this.properties = {};
8908
8911
  }
8909
8912
  set meshes(t) {
8910
- this.Rt = t;
8913
+ this.Lt = t;
8911
8914
  }
8912
8915
  get meshes() {
8913
- return this.Rt;
8916
+ return this.Lt;
8914
8917
  }
8915
8918
  }
8916
8919
  const Ks = 224, Qs = 600, to = 100, eo = new Uint8Array(1), no = [], io = {
@@ -9076,7 +9079,7 @@
9076
9079
  return n - Math.abs(this.Tr(t)[e]) < i;
9077
9080
  }
9078
9081
  Pr(t, e, n, i, r, s, o) {
9079
- const a = this.getSymbol(t.properties.symbolIndex), l = this.Er(a, t, e[i]), h = this.Rr(a, t, e[i]);
9082
+ const a = this.getSymbol(t.properties.symbolIndex), l = this.Er(a, t, e[i]), h = this.Lr(a, t, e[i]);
9080
9083
  if (!1 === this.sceneConfig.collision || l && h) return io;
9081
9084
  const c = this.isBoxCollides(t, e, n, i, r, s, o);
9082
9085
  return h && (c.collides = 0, c.isAllowOverlap = 1), c;
@@ -9088,7 +9091,7 @@
9088
9091
  const r = i[n], s = r % 8;
9089
9092
  return r < 2 ? 1 == +t[this.propIgnorePlacement] : s % 2;
9090
9093
  }
9091
- Rr(t, e, n) {
9094
+ Lr(t, e, n) {
9092
9095
  if (!1 === this.sceneConfig.collision) return !0;
9093
9096
  const i = e.geometry.properties.aOverlap;
9094
9097
  if (!i) return 1 == +t[this.propAllowOverlap];
@@ -9113,15 +9116,15 @@
9113
9116
  h;
9114
9117
  }
9115
9118
  Tr(t) {
9116
- this.Lr || (this.Lr = {});
9119
+ this.Rr || (this.Rr = {});
9117
9120
  const {meshKey: e} = t.properties;
9118
- if (!this.Lr[e]) {
9121
+ if (!this.Rr[e]) {
9119
9122
  const {frameTimestamp: t} = this.ar;
9120
- this.Lr[e] = {
9123
+ this.Rr[e] = {
9121
9124
  timestamp: t
9122
9125
  };
9123
9126
  }
9124
- return this.Lr[e];
9127
+ return this.Rr[e];
9125
9128
  }
9126
9129
  Nr(t) {
9127
9130
  if (!this.zr) return void (this.zr = t);
@@ -9144,10 +9147,10 @@
9144
9147
  if (t) {
9145
9148
  if (Array.isArray(t)) for (let e = 0; e < t.length; e++) {
9146
9149
  const n = t[e].properties.meshKey;
9147
- this.pr && delete this.pr.tags[n], this.Lr && delete this.Lr[n];
9150
+ this.pr && delete this.pr.tags[n], this.Rr && delete this.Rr[n];
9148
9151
  } else {
9149
9152
  const e = t.properties.meshKey;
9150
- this.pr && delete this.pr.tags[e], this.Lr && delete this.Lr[e];
9153
+ this.pr && delete this.pr.tags[e], this.Rr && delete this.Rr[e];
9151
9154
  }
9152
9155
  super.deleteMesh(t, e);
9153
9156
  }
@@ -9436,10 +9439,10 @@
9436
9439
  ss(H) && (H = 15);
9437
9440
  const D = n.vec2.set(Oo, E / 24, H / 24);
9438
9441
  n.vec2.mul(O, O, D), n.vec2.mul(F, F, D), n.vec2.mul(I, I, D), n.vec2.mul(C, C, D);
9439
- let R = _ ? _[i] / 9362 : -(h.markerRotation || 0) * Math.PI / 180;
9440
- const L = s.getBearing() * Math.PI / 180;
9441
- if (L * P || R) {
9442
- const t = xo(Ao, R, L, P, k);
9442
+ let L = _ ? _[i] / 9362 : -(h.markerRotation || 0) * Math.PI / 180;
9443
+ const R = s.getBearing() * Math.PI / 180;
9444
+ if (R * P || L) {
9445
+ const t = xo(Ao, L, R, P, k);
9443
9446
  O = n.vec2.transformMat2(O, O, t), F = n.vec2.transformMat2(F, F, t), I = n.vec2.transformMat2(I, I, t),
9444
9447
  C = n.vec2.transformMat2(C, C, t);
9445
9448
  }
@@ -9447,24 +9450,24 @@
9447
9450
  n.vec2.multiply(F, F, To), n.vec2.multiply(I, I, To), n.vec2.multiply(C, C, To),
9448
9451
  vo(t, d, O, F, I, C, T, y)), t;
9449
9452
  }
9450
- const Io = [], Co = [], Eo = [], Ho = [], Do = [], Ro = [], Lo = [ 1, -1 ];
9453
+ const Io = [], Co = [], Eo = [], Ho = [], Do = [], Lo = [], Ro = [ 1, -1 ];
9451
9454
  function No(t, e, i, r, s, o, a, l, h) {
9452
9455
  const c = r.material.uniforms, u = h.cameraToCenterDistance, f = r.geometry.properties, d = this.getSymbol(f.symbolIndex), p = "line" === d.textPlacement && !ps(d), y = i[2];
9453
9456
  let m = 1;
9454
9457
  if (c.textPerspectiveRatio) {
9455
9458
  m = is(.5 + .5 * (1 - (1 - u / y) * c.textPerspectiveRatio), 0, 4);
9456
9459
  }
9457
- const {aTextDx: g, aTextDy: v, aPitchAlign: x, aRotationAlign: b, aRotation: w} = r.geometry.properties, A = g ? g[a] : d.textDx, _ = v ? v[a] : d.textDy, M = x ? x[a] : c.pitchWithMap, S = b ? b[a] : c.rotateWithMap, k = n.vec2.set(Ro, A || 0, -(_ || 0));
9460
+ const {aTextDx: g, aTextDy: v, aPitchAlign: x, aRotationAlign: b, aRotation: w} = r.geometry.properties, A = g ? g[a] : d.textDx, _ = v ? v[a] : d.textDy, M = x ? x[a] : c.pitchWithMap, S = b ? b[a] : c.rotateWithMap, k = n.vec2.set(Lo, A || 0, -(_ || 0));
9458
9461
  if (p) {
9459
9462
  const {aOffset: r} = f;
9460
9463
  let s = n.vec2.set(Co, r[2 * a] / 10, r[2 * a + 1] / 10), o = n.vec2.set(Eo, r[2 * a + 2] / 10, r[2 * a + 3] / 10), u = n.vec2.set(Ho, r[2 * a + 4] / 10, r[2 * a + 5] / 10), d = n.vec2.set(Do, r[2 * a + 6] / 10, r[2 * a + 7] / 10);
9461
- 1 === M ? go(t, e, s, o, u, d, l, k, c, h, y, m) : (n.vec2.multiply(s, s, Lo), n.vec2.multiply(o, o, Lo),
9462
- n.vec2.multiply(u, u, Lo), n.vec2.multiply(d, d, Lo), vo(t, i, s, o, u, d, k, m));
9464
+ 1 === M ? go(t, e, s, o, u, d, l, k, c, h, y, m) : (n.vec2.multiply(s, s, Ro), n.vec2.multiply(o, o, Ro),
9465
+ n.vec2.multiply(u, u, Ro), n.vec2.multiply(d, d, Ro), vo(t, i, s, o, u, d, k, m));
9463
9466
  } else {
9464
9467
  const {aShape: r} = f;
9465
9468
  let o = n.vec2.set(Co, r[2 * a] / 10, r[2 * a + 1] / 10), u = n.vec2.set(Eo, r[2 * a + 2] / 10, r[2 * a + 3] / 10), g = n.vec2.set(Ho, r[2 * a + 4] / 10, r[2 * a + 5] / 10), v = n.vec2.set(Do, r[2 * a + 6] / 10, r[2 * a + 7] / 10);
9466
- 0 === c.flipY && 1 === M && (n.vec2.multiply(o, o, Lo), n.vec2.multiply(u, u, Lo),
9467
- n.vec2.multiply(g, g, Lo), n.vec2.multiply(v, v, Lo));
9469
+ 0 === c.flipY && 1 === M && (n.vec2.multiply(o, o, Ro), n.vec2.multiply(u, u, Ro),
9470
+ n.vec2.multiply(g, g, Ro), n.vec2.multiply(v, v, Ro));
9468
9471
  let x = w ? -w[a] / 9362 : -(d.textRotation || 0) * Math.PI / 180;
9469
9472
  const b = p ? 0 : h.getBearing() * Math.PI / 180;
9470
9473
  if (x || b) {
@@ -9630,19 +9633,19 @@
9630
9633
  function Wo(t, e) {
9631
9634
  const i = t.getRenderer().canvas;
9632
9635
  return {
9633
- uniforms: [ "flipY", "textSize", "textDx", "textDy", "textRotation", "cameraToCenterDistance", {
9636
+ uniforms: [ {
9634
9637
  name: "projViewModelMatrix",
9635
9638
  type: "function",
9636
9639
  fn: function(t, e) {
9637
9640
  return n.mat4.multiply([], e.projViewMatrix, e.modelMatrix);
9638
9641
  }
9639
- }, "textPerspectiveRatio", "texSize", "canvasSize", "glyphSize", "pitchWithMap", "mapPitch", "texture", "gammaScale", "textFill", "textOpacity", "textHaloRadius", "textHaloFill", "textHaloBlur", "textHaloOpacity", "isHalo", {
9642
+ }, {
9640
9643
  name: "zoomScale",
9641
9644
  type: "function",
9642
9645
  fn: function(t, e) {
9643
9646
  return e.tileResolution / e.resolution;
9644
9647
  }
9645
- }, "rotateWithMap", "mapRotation", "tileRatio" ],
9648
+ } ],
9646
9649
  extraCommandProps: {
9647
9650
  viewport: {
9648
9651
  x: 0,
@@ -9861,7 +9864,7 @@
9861
9864
  }(t, e, i) : null;
9862
9865
  }
9863
9866
  const Ko = [], Qo = [];
9864
- var ta = "#define SHADER_NAME TEXT\n#define RAD 0.0174532925\nattribute vec3 aPosition;\nattribute vec2 aShape;\nattribute vec2 aTexCoord;\n#ifdef ENABLE_COLLISION\nattribute float aOpacity;\n#endif\n#ifdef HAS_OPACITY\nattribute float aColorOpacity;\n#endif\n#ifdef HAS_TEXT_SIZE\nattribute float aTextSize;\n#else\nuniform float textSize;\n#endif\n#ifdef HAS_TEXT_DX\nattribute float aTextDx;\n#else\nuniform float textDx;\n#endif\n#ifdef HAS_TEXT_DY\nattribute float aTextDy;\n#else\nuniform float textDy;\n#endif\n#if defined(HAS_PITCH_ALIGN)\nattribute float aPitchAlign;\n#else\nuniform float pitchWithMap;\n#endif\n#if defined(HAS_ROTATION_ALIGN)\nattribute float aRotationAlign;\n#else\nuniform float rotateWithMap;\n#endif\nuniform float flipY;\n#if defined(HAS_ROTATION)\nattribute float aRotation;\n#else\nuniform float textRotation;\n#endif\nuniform float cameraToCenterDistance;\nuniform mat4 projViewModelMatrix;\nuniform float textPerspectiveRatio;\nuniform vec2 texSize;\nuniform vec2 canvasSize;\nuniform float glyphSize;\nuniform float mapPitch;\nuniform float mapRotation;\nuniform float zoomScale;\nuniform float tileRatio;\nuniform float layerScale;\n#ifndef PICKING_MODE\nvarying vec2 vTexCoord;\nvarying float vGammaScale;\nvarying float vSize;\nvarying float vOpacity;\n#ifdef HAS_TEXT_FILL\nattribute vec4 aTextFill;\nvarying vec4 vTextFill;\n#endif\n#ifdef HAS_TEXT_HALO_FILL\nattribute vec4 aTextHaloFill;\nvarying vec4 vTextHaloFill;\n#endif\n#ifdef HAS_TEXT_HALO_RADIUS\nattribute float aTextHaloRadius;\nvarying float vTextHaloRadius;\n#endif\n#ifdef HAS_TEXT_HALO_OPACITY\nattribute float aTextHaloOpacity;\nvarying float vTextHaloOpacity;\n#endif\n#else\n#include <fbo_picking_vert>\n#endif\nvoid main() {\n vec3 c = aPosition;\n#ifdef HAS_TEXT_SIZE\nfloat d = aTextSize * layerScale;\n#else\nfloat d = textSize * layerScale;\n#endif\n#ifdef HAS_TEXT_DX\nfloat e = aTextDx;\n#else\nfloat e = textDx;\n#endif\n#ifdef HAS_TEXT_DY\nfloat f = aTextDy;\n#else\nfloat f = textDy;\n#endif\n#if defined(HAS_PITCH_ALIGN)\nfloat h = aPitchAlign;\n#else\nfloat h = pitchWithMap;\n#endif\n#if defined(HAS_ROTATION_ALIGN)\nfloat i = aRotationAlign;\n#else\nfloat i = rotateWithMap;\n#endif\nvec2 j = aShape / 10.0;\n if(h == 1. && flipY == .0) {\n j = j * vec2(1., -1.);\n }\n vec2 k = aTexCoord;\n gl_Position = projViewModelMatrix * vec4(c, 1.);\n float l = gl_Position.w;\n float m = (1. - cameraToCenterDistance / l) * textPerspectiveRatio;\n float n = clamp(.5 + .5 * (1. - m), .0, 4.);\n#ifdef HAS_ROTATION\nfloat o = aRotation / 9362. - mapRotation * i;\n#else\nfloat o = textRotation - mapRotation * i;\n#endif\nif(h == 1.) {\n o += mapRotation;\n }\n float u = sin(o);\n float v = cos(o);\n mat2 A = mat2(v, -1. * u, u, v);\n j = A * (j / glyphSize * d);\n float B = l / cameraToCenterDistance;\n if(h == .0) {\n vec2 C = j * 2. / canvasSize;\n gl_Position.xy += C * n * l;\n } else {\n vec2 C = j;\n gl_Position = projViewModelMatrix * vec4(c + vec3(C, .0) * tileRatio / zoomScale * B * n, 1.);\n }\n gl_Position.xy += vec2(e, -f) * 2. / canvasSize * l;\n#ifndef PICKING_MODE\nif(h == .0) {\n vGammaScale = mix(1., B, textPerspectiveRatio);\n } else {\n vGammaScale = B + mapPitch / 4.;\n }\n vTexCoord = k / texSize;\n vGammaScale = clamp(vGammaScale, .0, 1.);\n vSize = d;\n#ifdef ENABLE_COLLISION\nvOpacity = aOpacity / 255.;\n#else\nvOpacity = 1.;\n#endif\n#ifdef HAS_OPACITY\nvOpacity *= aColorOpacity / 255.;\n#endif\n#ifdef HAS_TEXT_FILL\nvTextFill = aTextFill / 255.;\n#endif\n#ifdef HAS_TEXT_HALO_FILL\nvTextHaloFill = aTextHaloFill / 255.;\n#endif\n#ifdef HAS_TEXT_HALO_RADIUS\nvTextHaloRadius = aTextHaloRadius;\n#endif\n#ifdef HAS_TEXT_HALO_OPACITY\nvTextHaloOpacity = aTextHaloOpacity;\n#endif\n#else\n#ifdef ENABLE_COLLISION\nbool D = aOpacity == 255.;\n#else\nbool D = true;\n#endif\nfbo_picking_setData(gl_Position.w, D);\n#endif\n}", ea = "#define SHADER_NAME TEXT\n#define SDF_PX 8.0\n#define DEVICE_PIXEL_RATIO 1.0\n#define EDGE_GAMMA 0.105 / DEVICE_PIXEL_RATIO\nprecision mediump float;\nuniform sampler2D texture;\nuniform float textOpacity;\nuniform highp float gammaScale;\nuniform int isHalo;\nuniform highp float textHaloBlur;\n#ifdef HAS_TEXT_HALO_OPACITY\nvarying float vTextHaloOpacity;\n#else\nuniform float textHaloOpacity;\n#endif\nvarying vec2 vTexCoord;\nvarying float vSize;\nvarying float vGammaScale;\nvarying float vOpacity;\n#ifdef HAS_TEXT_FILL\nvarying vec4 vTextFill;\n#else\nuniform vec4 textFill;\n#endif\n#ifdef HAS_TEXT_HALO_FILL\nvarying vec4 vTextHaloFill;\n#else\nuniform vec4 textHaloFill;\n#endif\n#ifdef HAS_TEXT_HALO_RADIUS\nvarying float vTextHaloRadius;\n#else\nuniform highp float textHaloRadius;\n#endif\nvoid main() {\n \n#ifdef HAS_TEXT_FILL\nvec4 c = vTextFill;\n#else\nvec4 c = textFill;\n#endif\nfloat d = vSize / 24.;\n lowp vec4 e = c;\n highp float f = EDGE_GAMMA / (d * gammaScale);\n lowp float h = 185. / 256.;\n if(isHalo == 1) {\n \n#ifdef HAS_TEXT_HALO_FILL\nvec4 i = vTextHaloFill;\n#else\nvec4 i = textHaloFill;\n#endif\n#ifdef HAS_TEXT_HALO_RADIUS\nfloat j = vTextHaloRadius;\n#else\nfloat j = textHaloRadius;\n#endif\ne = i;\n f = (textHaloBlur * 1.19 / SDF_PX + EDGE_GAMMA) / (d * gammaScale);\n h = (6. - j / d) / SDF_PX;\n#ifdef HAS_TEXT_HALO_OPACITY\nfloat k = vTextHaloOpacity / 255.;\n#else\nfloat k = textHaloOpacity;\n#endif\ne *= k * 1.25;\n }\n float l = texture2D(texture, vTexCoord).a;\n highp float m = f * vGammaScale * .7;\n float n = clamp(smoothstep(h - m, h + m, l), .0, 1.);\n gl_FragColor = e * (n * textOpacity * vOpacity);\n}";
9867
+ var ta = "#define SHADER_NAME TEXT\n#define RAD 0.0174532925\nattribute vec3 aPosition;\nattribute vec2 aShape;\nattribute vec2 aTexCoord;\n#ifdef ENABLE_COLLISION\nattribute float aOpacity;\n#endif\n#ifdef HAS_OPACITY\nattribute float aColorOpacity;\n#endif\n#ifdef HAS_TEXT_SIZE\nattribute float aTextSize;\n#else\nuniform float textSize;\n#endif\n#ifdef HAS_TEXT_DX\nattribute float aTextDx;\n#else\nuniform float textDx;\n#endif\n#ifdef HAS_TEXT_DY\nattribute float aTextDy;\n#else\nuniform float textDy;\n#endif\n#if defined(HAS_PITCH_ALIGN)\nattribute float aPitchAlign;\n#else\nuniform float pitchWithMap;\n#endif\n#if defined(HAS_ROTATION_ALIGN)\nattribute float aRotationAlign;\n#else\nuniform float rotateWithMap;\n#endif\nuniform float flipY;\n#if defined(HAS_ROTATION)\nattribute float aRotation;\n#else\nuniform float textRotation;\n#endif\nuniform float cameraToCenterDistance;\nuniform mat4 projViewModelMatrix;\nuniform float textPerspectiveRatio;\nuniform vec2 texSize;\nuniform vec2 canvasSize;\nuniform float glyphSize;\nuniform float mapPitch;\nuniform float mapRotation;\nuniform float zoomScale;\nuniform float tileRatio;\nuniform float layerScale;\n#ifndef PICKING_MODE\nvarying vec2 vTexCoord;\nvarying float vGammaScale;\nvarying float vSize;\nvarying float vOpacity;\n#ifdef HAS_TEXT_FILL\nattribute vec4 aTextFill;\nvarying vec4 vTextFill;\n#endif\n#ifdef HAS_TEXT_HALO_FILL\nattribute vec4 aTextHaloFill;\nvarying vec4 vTextHaloFill;\n#endif\n#ifdef HAS_TEXT_HALO_RADIUS\nattribute float aTextHaloRadius;\nvarying float vTextHaloRadius;\n#endif\n#ifdef HAS_TEXT_HALO_OPACITY\nattribute float aTextHaloOpacity;\nvarying float vTextHaloOpacity;\n#endif\n#else\n#include <fbo_picking_vert>\n#endif\nvoid main() {\n vec3 c = aPosition;\n#ifdef HAS_TEXT_SIZE\nfloat d = aTextSize * layerScale;\n#else\nfloat d = textSize * layerScale;\n#endif\n#ifdef HAS_TEXT_DX\nfloat e = aTextDx;\n#else\nfloat e = textDx;\n#endif\n#ifdef HAS_TEXT_DY\nfloat f = aTextDy;\n#else\nfloat f = textDy;\n#endif\n#if defined(HAS_PITCH_ALIGN)\nfloat h = aPitchAlign;\n#else\nfloat h = pitchWithMap;\n#endif\n#if defined(HAS_ROTATION_ALIGN)\nfloat i = aRotationAlign;\n#else\nfloat i = rotateWithMap;\n#endif\nvec2 j = aShape / 10.0;\n if(h == 1. && flipY == .0) {\n j = j * vec2(1., -1.);\n }\n vec2 k = aTexCoord;\n gl_Position = projViewModelMatrix * vec4(c, 1.);\n float l = gl_Position.w;\n float m = (1. - cameraToCenterDistance / l) * textPerspectiveRatio;\n float n = clamp(.5 + .5 * (1. - m), .0, 4.);\n#ifdef HAS_ROTATION\nfloat o = aRotation / 9362. - mapRotation * i;\n#else\nfloat o = textRotation - mapRotation * i;\n#endif\nif(h == 1.) {\n \n#ifdef REVERSE_MAP_ROTATION_ON_PITCH\no += mapRotation;\n#else\no -= mapRotation;\n#endif\n }\n float u = sin(o);\n float v = cos(o);\n mat2 A = mat2(v, -1. * u, u, v);\n j = A * (j / glyphSize * d);\n float B = l / cameraToCenterDistance;\n if(h == .0) {\n vec2 C = j * 2. / canvasSize;\n gl_Position.xy += C * n * l;\n } else {\n vec2 C = j;\n gl_Position = projViewModelMatrix * vec4(c + vec3(C, .0) * tileRatio / zoomScale * B * n, 1.);\n }\n gl_Position.xy += vec2(e, -f) * 2. / canvasSize * l;\n#ifndef PICKING_MODE\nif(h == .0) {\n vGammaScale = mix(1., B, textPerspectiveRatio);\n } else {\n vGammaScale = B + mapPitch / 4.;\n }\n vTexCoord = k / texSize;\n vGammaScale = clamp(vGammaScale, .0, 1.);\n vSize = d;\n#ifdef ENABLE_COLLISION\nvOpacity = aOpacity / 255.;\n#else\nvOpacity = 1.;\n#endif\n#ifdef HAS_OPACITY\nvOpacity *= aColorOpacity / 255.;\n#endif\n#ifdef HAS_TEXT_FILL\nvTextFill = aTextFill / 255.;\n#endif\n#ifdef HAS_TEXT_HALO_FILL\nvTextHaloFill = aTextHaloFill / 255.;\n#endif\n#ifdef HAS_TEXT_HALO_RADIUS\nvTextHaloRadius = aTextHaloRadius;\n#endif\n#ifdef HAS_TEXT_HALO_OPACITY\nvTextHaloOpacity = aTextHaloOpacity;\n#endif\n#else\n#ifdef ENABLE_COLLISION\nbool D = aOpacity == 255.;\n#else\nbool D = true;\n#endif\nfbo_picking_setData(gl_Position.w, D);\n#endif\n}", ea = "#define SHADER_NAME TEXT\n#define SDF_PX 8.0\n#define DEVICE_PIXEL_RATIO 1.0\n#define EDGE_GAMMA 0.105 / DEVICE_PIXEL_RATIO\nprecision mediump float;\nuniform sampler2D texture;\nuniform float textOpacity;\nuniform highp float gammaScale;\nuniform int isHalo;\nuniform highp float textHaloBlur;\n#ifdef HAS_TEXT_HALO_OPACITY\nvarying float vTextHaloOpacity;\n#else\nuniform float textHaloOpacity;\n#endif\nvarying vec2 vTexCoord;\nvarying float vSize;\nvarying float vGammaScale;\nvarying float vOpacity;\n#ifdef HAS_TEXT_FILL\nvarying vec4 vTextFill;\n#else\nuniform vec4 textFill;\n#endif\n#ifdef HAS_TEXT_HALO_FILL\nvarying vec4 vTextHaloFill;\n#else\nuniform vec4 textHaloFill;\n#endif\n#ifdef HAS_TEXT_HALO_RADIUS\nvarying float vTextHaloRadius;\n#else\nuniform highp float textHaloRadius;\n#endif\nvoid main() {\n \n#ifdef HAS_TEXT_FILL\nvec4 c = vTextFill;\n#else\nvec4 c = textFill;\n#endif\nfloat d = vSize / 24.;\n lowp vec4 e = c;\n highp float f = EDGE_GAMMA / (d * gammaScale);\n lowp float h = 185. / 256.;\n if(isHalo == 1) {\n \n#ifdef HAS_TEXT_HALO_FILL\nvec4 i = vTextHaloFill;\n#else\nvec4 i = textHaloFill;\n#endif\n#ifdef HAS_TEXT_HALO_RADIUS\nfloat j = vTextHaloRadius;\n#else\nfloat j = textHaloRadius;\n#endif\ne = i;\n f = (textHaloBlur * 1.19 / SDF_PX + EDGE_GAMMA) / (d * gammaScale);\n h = (6. - j / d) / SDF_PX;\n#ifdef HAS_TEXT_HALO_OPACITY\nfloat k = vTextHaloOpacity / 255.;\n#else\nfloat k = textHaloOpacity;\n#endif\ne *= k * 1.25;\n }\n float l = texture2D(texture, vTexCoord).a;\n highp float m = f * vGammaScale * .7;\n float n = clamp(smoothstep(h - m, h + m, l), .0, 1.);\n gl_FragColor = e * (n * textOpacity * vOpacity);\n}";
9865
9868
  const na = new Uint16Array(1), ia = new Int8Array(1);
9866
9869
  function ra(t, e, n) {
9867
9870
  xs(t, e, n), function(t) {
@@ -10205,6 +10208,9 @@
10205
10208
  this.Ui = {}, this.isLabelCollides = $o.bind(this), this.ds = ha.bind(this), this.ps = ca.bind(this),
10206
10209
  this.ys = ua.bind(this), this.ms = fa.bind(this), this.gs = [];
10207
10210
  }
10211
+ setTextShaderDefines(t) {
10212
+ this.vs = t;
10213
+ }
10208
10214
  createFnTypeConfig(t, e) {
10209
10215
  return {
10210
10216
  icon: sa.call(this, t, e),
@@ -10222,8 +10228,8 @@
10222
10228
  }
10223
10229
  postCreateGeometry(t, e) {
10224
10230
  const {geometry: n, symbolIndex: i} = t, r = this.getSymbolDef(i), s = this.getFnTypeConfig(i);
10225
- if (this.vs(n)) n.properties.iconAtlas ? this.drawDebugAtlas(n.properties.iconAtlas) : n.properties.isEmpty = !0,
10226
- ra(n, r, s.icon); else if (this.xs(n) && ps(r)) {
10231
+ if (this.xs(n)) n.properties.iconAtlas ? this.drawDebugAtlas(n.properties.iconAtlas) : n.properties.isEmpty = !0,
10232
+ ra(n, r, s.icon); else if (this.bs(n) && ps(r)) {
10227
10233
  const t = e[e.length - 1];
10228
10234
  if (t) {
10229
10235
  const {geometry: e, symbolIndex: s} = t;
@@ -10234,7 +10240,7 @@
10234
10240
  }
10235
10241
  }
10236
10242
  }
10237
- bs(t) {
10243
+ ws(t) {
10238
10244
  if (!this.layer.options.collision) return;
10239
10245
  const {collideIds: e, elements: n, aCount: i} = t.properties, r = e, s = {};
10240
10246
  if (!n) return void (t.properties.collideBoxIndex = s);
@@ -10248,7 +10254,7 @@
10248
10254
  const s = this.isEnableCollision(), o = this.layer, {geometry: a, symbolIndex: l} = t;
10249
10255
  a.properties.symbolIndex = l;
10250
10256
  const h = this.getSymbolDef(l), c = this.getSymbol(l), u = this.getFnTypeConfig(l), f = [];
10251
- if (this.vs(a)) {
10257
+ if (this.xs(a)) {
10252
10258
  const t = function(t, e, i, r, s, o, a, l, h) {
10253
10259
  if (e.isDisposed() || 0 === e.data.aPosition.length) return null;
10254
10260
  const c = e.properties.iconAtlas;
@@ -10291,25 +10297,25 @@
10291
10297
  d;
10292
10298
  }(this.regl, a, e, 0, c, u.icon, o.options.collision, !s, this.isEnableUniquePlacement());
10293
10299
  t && (delete t.geometry.properties.glyphAtlas, f.push(t));
10294
- } else if (this.xs(a)) {
10300
+ } else if (this.bs(a)) {
10295
10301
  const t = jo.call(this, this.regl, a, e, h, c, u.text, o.options.collision, !s, this.isEnableUniquePlacement());
10296
10302
  t.length && (t.forEach(t => {
10297
10303
  delete t.geometry.properties.iconAtlas;
10298
10304
  }), f.push(...t));
10299
10305
  }
10300
- return "line" === h.markerPlacement && this.ws(a, r), "line" !== h.markerPlacement && "line" !== h.textPlacement || f.forEach(t => t.properties.isLinePlacement = !0),
10301
- this.bs(a), f;
10306
+ return "line" === h.markerPlacement && this.As(a, r), "line" !== h.markerPlacement && "line" !== h.textPlacement || f.forEach(t => t.properties.isLinePlacement = !0),
10307
+ this.ws(a), f;
10302
10308
  }
10303
- ws(t, e) {
10309
+ As(t, e) {
10304
10310
  const {collideIds: n} = t.properties, i = new Uint16Array(n.length);
10305
- if (this.vs(t)) {
10311
+ if (this.xs(t)) {
10306
10312
  let r = 0;
10307
10313
  for (let t = 0; t < n.length; t += 4) i.fill(r++, t, t + 4);
10308
10314
  t.properties.collideIds = i, t.properties.uniqueCollideIds = ms(i), e.markerCollideMap = {
10309
10315
  old: n,
10310
10316
  new: i
10311
10317
  };
10312
- } else if (this.xs(t)) {
10318
+ } else if (this.bs(t)) {
10313
10319
  const {collideIds: n, aCount: i} = t.properties;
10314
10320
  if (!i) return;
10315
10321
  if (e.markerCollideMap) {
@@ -10359,31 +10365,31 @@
10359
10365
  if (!this.Br()) return;
10360
10366
  super.updateCollision(t);
10361
10367
  const e = this.scene.getMeshes();
10362
- e && e.length ? (this.As(t.timestamp), this.gs = [], this.wr()) : this.wr();
10368
+ e && e.length ? (this._s(t.timestamp), this.gs = [], this.wr()) : this.wr();
10363
10369
  }
10364
10370
  callCurrentTileShader(t, e) {
10365
10371
  this.shader.filter = e.sceneFilter ? [ this.ds, e.sceneFilter ] : this.ds, this.renderer.render(this.shader, t, this.scene, this.getRenderFBO(e)),
10366
- this._s.filter = e.sceneFilter ? [ this.ys, e.sceneFilter ] : this.ys, this.renderer.render(this._s, t, this.scene, this.getRenderFBO(e));
10372
+ this.Ms.filter = e.sceneFilter ? [ this.ys, e.sceneFilter ] : this.ys, this.renderer.render(this.Ms, t, this.scene, this.getRenderFBO(e));
10367
10373
  }
10368
10374
  callBackgroundTileShader(t, e) {
10369
10375
  this.shader.filter = e.sceneFilter ? [ this.ps, e.sceneFilter ] : this.ps, this.renderer.render(this.shader, t, this.scene, this.getRenderFBO(e)),
10370
- this._s.filter = e.sceneFilter ? [ this.ms, e.sceneFilter ] : this.ms, this.renderer.render(this._s, t, this.scene, this.getRenderFBO(e));
10376
+ this.Ms.filter = e.sceneFilter ? [ this.ms, e.sceneFilter ] : this.ms, this.renderer.render(this.Ms, t, this.scene, this.getRenderFBO(e));
10371
10377
  }
10372
10378
  isMeshIterable(t) {
10373
10379
  return t && t.geometry && !t.geometry.properties.isEmpty && t.material && !t.material.get("isHalo") && this.isMeshVisible(t) && !(this.shouldIgnoreBackground() && !this.layer.getRenderer().isForeground(t));
10374
10380
  }
10375
- As() {
10381
+ _s() {
10376
10382
  if (!this.Br()) return;
10377
10383
  let t = this.gs;
10378
- t && t.length && this.Ms(t);
10384
+ t && t.length && this.Ss(t);
10379
10385
  }
10380
- Ss(t, e, n, i) {
10386
+ ks(t, e, n, i) {
10381
10387
  return this.updateBoxCollisionFading(!0, t, e, n, i);
10382
10388
  }
10383
10389
  isEnableUniquePlacement() {
10384
10390
  return this.isEnableCollision() && !0 === this.sceneConfig.uniquePlacement;
10385
10391
  }
10386
- Ms(t) {
10392
+ Ss(t) {
10387
10393
  const e = this.layer.getRenderer();
10388
10394
  t = t.sort(ma);
10389
10395
  for (let n = 0; n < t.length; n++) {
@@ -10398,12 +10404,12 @@
10398
10404
  const s = e.isForeground(i.meshes[0]);
10399
10405
  if (this.shouldIgnoreBackground() && !s) continue;
10400
10406
  const o = i.properties.meshKey;
10401
- this.startMeshCollision(i), this.ks(i), this.forEachBox(i, this.Ss), this.Ps(i),
10407
+ this.startMeshCollision(i), this.Ps(i), this.forEachBox(i, this.ks), this.Ts(i),
10402
10408
  this.endMeshCollision(o);
10403
- for (let t = 0; t < i.meshes.length; t++) this.Ts(i.meshes[t]);
10409
+ for (let t = 0; t < i.meshes.length; t++) this.Os(i.meshes[t]);
10404
10410
  }
10405
10411
  }
10406
- Ts(t) {
10412
+ Os(t) {
10407
10413
  const e = t && t.geometry && t.geometry.properties.aOpacity;
10408
10414
  e && e.dirty && (t.geometry.updateData("aOpacity", e), e.dirty = !1);
10409
10415
  }
@@ -10413,11 +10419,11 @@
10413
10419
  const i = {
10414
10420
  boxIndex: 0
10415
10421
  }, r = n.length;
10416
- for (let s = 0; s < r; s++) this.Os(t, n[s], e, i);
10422
+ for (let s = 0; s < r; s++) this.Fs(t, n[s], e, i);
10417
10423
  }
10418
- Os(t, e, i, r) {
10424
+ Fs(t, e, i, r) {
10419
10425
  const s = this.getMap(), {collideBoxIndex: o} = t.meshes[0].geometry.properties;
10420
- if (!o[e]) return !1;
10426
+ if (!(o && o[e])) return !1;
10421
10427
  const a = n.mat4.multiply(da, s.projViewMatrix, t.meshes[0].localTransform);
10422
10428
  let l, h = !1;
10423
10429
  const c = t.meshes;
@@ -10444,16 +10450,16 @@
10444
10450
  f++;
10445
10451
  }
10446
10452
  if (!h) return !1;
10447
- return i.call(this, t, l, a, r.boxIndex++) && this.Fs(t, e), !0;
10453
+ return i.call(this, t, l, a, r.boxIndex++) && this.Is(t, e), !0;
10448
10454
  }
10449
- ks(t) {
10455
+ Ps(t) {
10450
10456
  const e = t.meshes;
10451
10457
  for (let t = 0; t < e.length; t++) {
10452
10458
  const n = e[t], i = n && n.geometry;
10453
10459
  i && (i.properties.visElemts.count = 0);
10454
10460
  }
10455
10461
  }
10456
- Fs(t, e) {
10462
+ Is(t, e) {
10457
10463
  const n = t.meshes;
10458
10464
  for (let t = 0; t < n.length; t++) {
10459
10465
  const i = n[t];
@@ -10468,7 +10474,7 @@
10468
10474
  a.count = u;
10469
10475
  }
10470
10476
  }
10471
- Ps(t) {
10477
+ Ts(t) {
10472
10478
  const e = t.meshes;
10473
10479
  for (let t = 0; t < e.length; t++) {
10474
10480
  const n = e[t], i = n && n.geometry;
@@ -10478,7 +10484,7 @@
10478
10484
  }
10479
10485
  }
10480
10486
  isBoxCollides(t, e, n, i, r, s) {
10481
- if (this.xs(t.geometry)) return $o.call(this, 0, t, e, n, i, r, s);
10487
+ if (this.bs(t.geometry)) return $o.call(this, 0, t, e, n, i, r, s);
10482
10488
  if (t.geometry.properties.isEmpty) return pa;
10483
10489
  const o = this.getMap(), {boxes: a, collision: l} = this.as(t, i);
10484
10490
  let h = 0, c = 0, u = 0;
@@ -10514,13 +10520,13 @@
10514
10520
  this.shader = new n.reshader.MeshShader({
10515
10521
  vert: ao,
10516
10522
  frag: "#define SHADER_NAME MARKER\nprecision mediump float;\nuniform sampler2D texture;\nuniform lowp float markerOpacity;\nuniform lowp float blendSrcIsOne;\nvarying vec2 vTexCoord;\nvarying float vOpacity;\nvoid main() {\n gl_FragColor = texture2D(texture, vTexCoord) * markerOpacity * vOpacity;\n if(blendSrcIsOne == 1.) {\n gl_FragColor *= gl_FragColor.a;\n }\n}",
10517
- uniforms: [ "flipY", "markerWidth", "markerHeight", "markerDx", "markerDy", "markerRotation", "cameraToCenterDistance", {
10523
+ uniforms: [ {
10518
10524
  name: "projViewModelMatrix",
10519
10525
  type: "function",
10520
10526
  fn: function(t, e) {
10521
10527
  return n.mat4.multiply([], e.projViewMatrix, e.modelMatrix);
10522
10528
  }
10523
- }, "texSize", "canvasSize", "iconSize", "pitchWithMap", "mapPitch", "markerPerspectiveRatio", "texture", "rotateWithMap", "mapRotation", "tileRatio", {
10529
+ }, {
10524
10530
  name: "zoomScale",
10525
10531
  type: "function",
10526
10532
  fn: function(t, e) {
@@ -10546,22 +10552,23 @@
10546
10552
  }
10547
10553
  }
10548
10554
  });
10549
- const {uniforms: r, extraCommandProps: s} = Wo.call(this, this.layer, this.sceneConfig);
10550
- if (this._s = new n.reshader.MeshShader({
10555
+ const {uniforms: r, extraCommandProps: s} = Wo.call(this, this.layer, this.sceneConfig), o = this.vs || {};
10556
+ if (this.Ms = new n.reshader.MeshShader({
10551
10557
  vert: ta,
10552
10558
  frag: ea,
10553
10559
  uniforms: r,
10554
- extraCommandProps: s
10560
+ extraCommandProps: s,
10561
+ defines: o
10555
10562
  }), this.pickingFBO) {
10556
10563
  const t = new n.reshader.FBORayPicking(this.renderer, {
10557
10564
  vert: "#define PICKING_MODE 1\n" + ao,
10558
- uniforms: [ "flipY", "markerWidth", "markerHeight", "markerDx", "markerDy", "markerRotation", "cameraToCenterDistance", {
10565
+ uniforms: [ {
10559
10566
  name: "projViewModelMatrix",
10560
10567
  type: "function",
10561
10568
  fn: function(t, e) {
10562
10569
  return n.mat4.multiply([], e.projViewMatrix, e.modelMatrix);
10563
10570
  }
10564
- }, "canvasSize", "iconSize", "pitchWithMap", "mapPitch", "markerPerspectiveRatio", "rotateWithMap", "mapRotation", "tileRatio", {
10571
+ }, {
10565
10572
  name: "zoomScale",
10566
10573
  type: "function",
10567
10574
  fn: function(t, e) {
@@ -10600,15 +10607,15 @@
10600
10607
  };
10601
10608
  }
10602
10609
  getUniqueEntryKey(t, e) {
10603
- if (!this.xs(t.geometry)) return null;
10610
+ if (!this.bs(t.geometry)) return null;
10604
10611
  const {elements: n} = t.geometry.properties;
10605
10612
  return Zo(t, n[e]);
10606
10613
  }
10607
- vs(t) {
10614
+ xs(t) {
10608
10615
  const {symbolIndex: e} = t.properties;
10609
10616
  return 0 === e.type;
10610
10617
  }
10611
- xs(t) {
10618
+ bs(t) {
10612
10619
  const {symbolIndex: e} = t.properties;
10613
10620
  return 1 === e.type;
10614
10621
  }
@@ -10661,14 +10668,14 @@
10661
10668
  }, Ta = function(t) {
10662
10669
  const e = this.layer.getRenderer(), n = this.getSymbol(t.properties.symbolIndex);
10663
10670
  return !this.cs(t) && !e.isForeground(t) && "line" === n.textPlacement;
10664
- }, Oa = [], Fa = [], Ia = [], Ca = [], Ea = [], Ha = [], Da = [], Ra = [], La = [], Na = [ 1, -1 ], za = new Int16Array(2), Va = [], ja = [];
10671
+ }, Oa = [], Fa = [], Ia = [], Ca = [], Ea = [], Ha = [], Da = [], La = [], Ra = [], Na = [ 1, -1 ], za = new Int16Array(2), Va = [], ja = [];
10665
10672
  class Ua extends ro {
10666
10673
  constructor(t, e, n, i, r) {
10667
10674
  super(t, e, n, i, r), this.propAllowOverlap = "textAllowOverlap", this.propIgnorePlacement = "textIgnorePlacement",
10668
- this.colorCache = {}, this.Is = Sa.bind(this), this.Cs = ka.bind(this), this.Es = Pa.bind(this),
10669
- this.Hs = Ta.bind(this), this.isLabelCollides = $o.bind(this), this.Ds();
10675
+ this.colorCache = {}, this.Cs = Sa.bind(this), this.Es = ka.bind(this), this.Hs = Pa.bind(this),
10676
+ this.Ds = Ta.bind(this), this.isLabelCollides = $o.bind(this), this.Ls();
10670
10677
  }
10671
- Ds() {
10678
+ Ls() {
10672
10679
  this.Rs = [];
10673
10680
  for (let t = 0; t < this.symbolDef.length; t++) {
10674
10681
  const e = this.symbolDef[t];
@@ -10677,7 +10684,7 @@
10677
10684
  }
10678
10685
  updateSymbol(...t) {
10679
10686
  const e = super.updateSymbol(...t);
10680
- return this.Ds(), e;
10687
+ return this.Ls(), e;
10681
10688
  }
10682
10689
  shouldDeleteMeshOnUpdateSymbol(t) {
10683
10690
  if (!Array.isArray(t)) return (0 === t.textHaloRadius || 0 === this.symbolDef[0].textHaloRadius) && t.textHaloRadius !== this.symbolDef[0].textHaloRadius;
@@ -10705,24 +10712,24 @@
10705
10712
  r.properties.symbolIndex = s;
10706
10713
  const o = this.getSymbol(s), a = this.getSymbolDef(s), l = this.getFnTypeConfig(s), h = jo.call(this, this.regl, r, e, a, o, l, this.layer.options.collision, !n, i);
10707
10714
  if (h.length) {
10708
- "line" === o.textPlacement ? this.Ls = !0 : this.Ns = !0;
10715
+ "line" === o.textPlacement ? this.Ns = !0 : this.zs = !0;
10709
10716
  }
10710
10717
  return h;
10711
10718
  }
10712
10719
  updateCollision(t) {
10713
10720
  super.updateCollision(t);
10714
10721
  const e = this.scene.getMeshes();
10715
- e && e.length ? (this.zs = {}, this.Vs(t.timestamp), this.wr()) : this.wr();
10722
+ e && e.length ? (this.Vs = {}, this.js(t.timestamp), this.wr()) : this.wr();
10716
10723
  }
10717
10724
  callCurrentTileShader(t, e) {
10718
- this.shader.filter = e.sceneFilter ? [ this.Is, e.sceneFilter ] : this.Is, this.renderer.render(this.shader, t, this.scene, this.getRenderFBO(e)),
10719
- this.js.filter = e.sceneFilter ? [ this.Es, e.sceneFilter ] : this.Es, this.renderer.render(this.js, t, this.scene, this.getRenderFBO(e));
10725
+ this.shader.filter = e.sceneFilter ? [ this.Cs, e.sceneFilter ] : this.Cs, this.renderer.render(this.shader, t, this.scene, this.getRenderFBO(e)),
10726
+ this.Us.filter = e.sceneFilter ? [ this.Hs, e.sceneFilter ] : this.Hs, this.renderer.render(this.Us, t, this.scene, this.getRenderFBO(e));
10720
10727
  }
10721
10728
  callBackgroundTileShader(t, e) {
10722
- this.shader.filter = e.sceneFilter ? [ this.Cs, e.sceneFilter ] : this.Cs, this.renderer.render(this.shader, t, this.scene, this.getRenderFBO(e)),
10723
- this.js.filter = e.sceneFilter ? [ this.Hs, e.sceneFilter ] : this.Hs, this.renderer.render(this.js, t, this.scene, this.getRenderFBO(e));
10729
+ this.shader.filter = e.sceneFilter ? [ this.Es, e.sceneFilter ] : this.Es, this.renderer.render(this.shader, t, this.scene, this.getRenderFBO(e)),
10730
+ this.Us.filter = e.sceneFilter ? [ this.Ds, e.sceneFilter ] : this.Ds, this.renderer.render(this.Us, t, this.scene, this.getRenderFBO(e));
10724
10731
  }
10725
- Vs() {
10732
+ js() {
10726
10733
  let t = this.scene.getMeshes();
10727
10734
  if (!t || !t.length) return;
10728
10735
  const e = -this.getMap().getBearing() * Math.PI / 180, i = n.mat2.fromRotation(Ia, e), r = (t, e, n, i) => {
@@ -10744,7 +10751,7 @@
10744
10751
  const c = n.properties.meshKey;
10745
10752
  if ("line" === h.textPlacement) {
10746
10753
  if (!l.properties.line) continue;
10747
- s && this.startMeshCollision(n), this.Us(n, i);
10754
+ s && this.startMeshCollision(n), this.Gs(n, i);
10748
10755
  const {aOffset: t, aOpacity: e} = l.properties;
10749
10756
  t.dirty && (l.updateData("aOffset", t), t.dirty = !1), e && e.dirty && (l.updateData("aOpacity", e),
10750
10757
  e.dirty = !1), s && this.endMeshCollision(c);
@@ -10769,7 +10776,7 @@
10769
10776
  getUniqueEntryKey(t, e) {
10770
10777
  return Zo(t, e);
10771
10778
  }
10772
- Us(t, e) {
10779
+ Gs(t, e) {
10773
10780
  const i = this.getMap(), r = t.geometry, s = r.properties, o = this.layer.getRenderer().isForeground(t);
10774
10781
  if (this.shouldIgnoreBackground() && !o) return;
10775
10782
  let a = s.line;
@@ -10777,12 +10784,12 @@
10777
10784
  const l = 1 === t.material.uniforms.pitchWithMap, h = s.elements;
10778
10785
  if (!l) {
10779
10786
  const e = n.mat4.multiply(Oa, i.projViewMatrix, t.localTransform), r = new Array(a.length);
10780
- a = this.Gs(r, a, e, i.width, i.height);
10787
+ a = this.Ws(r, a, e, i.width, i.height);
10781
10788
  }
10782
10789
  const c = this.Br(), u = r.properties.visElemts = r.properties.visElemts || new h.constructor(h.length);
10783
10790
  c && (u.count = 0), this.forEachBox(t, (t, n, i, r) => {
10784
10791
  const {start: s, end: o} = n[0];
10785
- let f = this.Ws(t, h, s, o, a, i, l ? e : null, r);
10792
+ let f = this.Bs(t, h, s, o, a, i, l ? e : null, r);
10786
10793
  if (c && (f = this.updateBoxCollisionFading(f, t, n, i, r), f)) {
10787
10794
  let t = u.count;
10788
10795
  for (let e = s; e < o; e++) u[t++] = h[e];
@@ -10790,16 +10797,16 @@
10790
10797
  }
10791
10798
  }), !c || u.count === h.length && r.count === u.count || r.setElements(u, u.count);
10792
10799
  }
10793
- Gs(t, e, i, r, s) {
10800
+ Ws(t, e, i, r, s) {
10794
10801
  const o = e.id + "-" + i.join();
10795
- if (this.zs[o]) return this.zs[o];
10802
+ if (this.Vs[o]) return this.Vs[o];
10796
10803
  const a = function(t, e, i, r, s) {
10797
10804
  const o = [];
10798
10805
  for (let a = 0; a < e.length; a += 3) n.vec4.set(o, e[a], e[a + 1], e[a + 2], 1),
10799
10806
  ho(o, o, i, r, s), t[a] = o[0], t[a + 1] = o[1], t[a + 2] = e[a + 2];
10800
10807
  return t;
10801
10808
  }(t, e, i, r, s);
10802
- return this.zs[o] = a, a;
10809
+ return this.Vs[o] = a, a;
10803
10810
  }
10804
10811
  forEachBox(t, e) {
10805
10812
  const i = this.getMap(), r = n.mat4.multiply(Oa, i.projViewMatrix, t.localTransform), {collideIds: s, aCount: o, features: a, elements: l} = t.geometry.properties, h = s, c = this.isEnableUniquePlacement(), u = this.ls(1);
@@ -10819,7 +10826,7 @@
10819
10826
  y = h[d], p = n;
10820
10827
  }
10821
10828
  }
10822
- Ws(t, e, i, r, s, o, a) {
10829
+ Bs(t, e, i, r, s, o, a) {
10823
10830
  const l = this.Br(), h = this.getMap(), c = t.geometry, u = c.desc.positionSize, {aShape: f, aOffset: d, aAnchor: p} = c.properties, y = c.properties.aTextSize, m = !a, g = e[i] * u;
10824
10831
  let v = n.vec3.set(Ca, p[g], p[g + 1], 2 === u ? 0 : p[g + 2]);
10825
10832
  const x = ho(Ea, v, o, h.width, h.height);
@@ -10828,7 +10835,7 @@
10828
10835
  m && (v = x);
10829
10836
  const b = m ? 1 : c.properties.tileExtent / this.layer.options.tileSize[0];
10830
10837
  let w = !0;
10831
- const A = e[i], _ = e[r - 1], M = y ? y[A] : t.properties.textSize, S = this.Bs(t, M, s, A, _, v, b, a);
10838
+ const A = e[i], _ = e[r - 1], M = y ? y[A] : t.properties.textSize, S = this.Xs(t, M, s, A, _, v, b, a);
10832
10839
  if (null === S) return Ba(d, e, i, r), !1;
10833
10840
  const k = _ - A <= 3, P = t.material.uniforms, T = 1 === P.pitchWithMap, O = Math.floor(S / 2), F = S % 2;
10834
10841
  for (let o = i; o < r; o += 6) {
@@ -10842,15 +10849,15 @@
10842
10849
  let c = h[2];
10843
10850
  F && (c -= Math.PI / 2);
10844
10851
  const u = xo(Da, c, 0, P.rotateWithMap, P.pitchWithMap);
10845
- for (let t = 0; t < 4; t++) n.vec2.set(Ra, f[2 * (a + t)] / 10, f[2 * (a + t) + 1] / 10),
10846
- n.vec2.scale(Ra, Ra, M / 24), n.vec2.transformMat2(Ra, Ra, u), T ? (n.vec2.multiply(Ra, Ra, Na),
10847
- n.vec2.add(La, Ra, h)) : (n.vec2.multiply(La, h, Na), n.vec2.add(La, Ra, La)), za[0] = 10 * La[0],
10848
- za[1] = 10 * La[1], d[2 * (a + t)] === za[0] && d[2 * (a + t) + 1] === za[1] || (d.dirty = !0,
10852
+ for (let t = 0; t < 4; t++) n.vec2.set(La, f[2 * (a + t)] / 10, f[2 * (a + t) + 1] / 10),
10853
+ n.vec2.scale(La, La, M / 24), n.vec2.transformMat2(La, La, u), T ? (n.vec2.multiply(La, La, Na),
10854
+ n.vec2.add(Ra, La, h)) : (n.vec2.multiply(Ra, h, Na), n.vec2.add(Ra, La, Ra)), za[0] = 10 * Ra[0],
10855
+ za[1] = 10 * Ra[1], d[2 * (a + t)] === za[0] && d[2 * (a + t) + 1] === za[1] || (d.dirty = !0,
10849
10856
  d[2 * (a + t)] = za[0], d[2 * (a + t) + 1] = za[1]);
10850
10857
  }
10851
10858
  return w;
10852
10859
  }
10853
- Bs(t, e, n, i, r, s, o, a) {
10860
+ Xs(t, e, n, i, r, s, o, a) {
10854
10861
  const l = r - i <= 3, h = this.getMap();
10855
10862
  return l ? 0 : _a.call(this, Va, ja, t, e, n, i, r, s, o, h.width / h.height, a);
10856
10863
  }
@@ -10863,7 +10870,7 @@
10863
10870
  }) : t.material && delete t.material.uniforms.texture), super.deleteMesh(t, e));
10864
10871
  }
10865
10872
  delete() {
10866
- super.delete(), this.js.dispose(), delete this.zs, this.Xs && this.Xs.dispose();
10873
+ super.delete(), this.Us.dispose(), delete this.Vs, this.qs && this.qs.dispose();
10867
10874
  }
10868
10875
  needClearStencil() {
10869
10876
  return !0;
@@ -10880,7 +10887,7 @@
10880
10887
  });
10881
10888
  let r = i;
10882
10889
  if (this.layer.getRenderer().isEnableWorkAround("win-intel-gpu-crash") && (r = ns({}, i),
10883
- r.stencil = ns({}, i.stencil), r.stencil.enable = !0), this.js = new n.reshader.MeshShader({
10890
+ r.stencil = ns({}, i.stencil), r.stencil.enable = !0), this.Us = new n.reshader.MeshShader({
10884
10891
  vert: Ma,
10885
10892
  frag: ea,
10886
10893
  uniforms: e,
@@ -11136,7 +11143,7 @@
11136
11143
  }
11137
11144
  }
11138
11145
  const Ka = [ 1, 1, 1 ], Qa = [ 1, 1, 1, 1 ], tl = [ 0, 0 ];
11139
- class el extends Ls {
11146
+ class el extends Rs {
11140
11147
  supportRenderMode(t) {
11141
11148
  return this.isAnimating() ? "fxaa" === t || "fxaaAfterTaa" === t : "taa" === t || "fxaa" === t;
11142
11149
  }
@@ -11199,7 +11206,7 @@
11199
11206
  enumerable: !0,
11200
11207
  get: () => {
11201
11208
  const t = this.getSymbol(o);
11202
- return s.properties.hasAlpha || t.polygonOpacity < 1;
11209
+ return s.properties.hasAlpha || t.polygonOpacity < 1 || t.lineOpacity < 1;
11203
11210
  }
11204
11211
  }), a.properties.symbolIndex = o, a;
11205
11212
  }
@@ -11213,10 +11220,10 @@
11213
11220
  r;
11214
11221
  }
11215
11222
  needPolygonOffset() {
11216
- return this.qs;
11223
+ return this.Js;
11217
11224
  }
11218
11225
  startFrame(...t) {
11219
- return delete this.qs, super.startFrame(...t);
11226
+ return delete this.Js, super.startFrame(...t);
11220
11227
  }
11221
11228
  addMesh(t, e) {
11222
11229
  t.forEach(t => {
@@ -11229,7 +11236,7 @@
11229
11236
  0 === e && (e = .01), Ka[2] = e, n.mat4.fromScaling(i, Ka), n.mat4.multiply(i, t.properties.tileTransform, i),
11230
11237
  t.setLocalTransform(i);
11231
11238
  } else t.setLocalTransform(t.properties.tileTransform);
11232
- t.material !== this.material && t.setMaterial(this.material), t.geometry.properties.maxAltitude <= 0 && (this.qs = !0),
11239
+ t.material !== this.material && t.setMaterial(this.material), t.geometry.properties.maxAltitude <= 0 && (this.Js = !0),
11233
11240
  this.getSymbol(t.properties.symbolIndex).ssr ? t.ssr = 1 : t.ssr = 0;
11234
11241
  }
11235
11242
  deleteMesh(t, e) {
@@ -11281,7 +11288,7 @@
11281
11288
  }
11282
11289
  updateSymbol(t, e) {
11283
11290
  const n = super.updateSymbol(t, e);
11284
- return t.material && this.Js(t.material), n;
11291
+ return t.material && this.Ys(t.material), n;
11285
11292
  }
11286
11293
  Gi(t, e) {
11287
11294
  return nl(t) !== nl(e);
@@ -11321,14 +11328,14 @@
11321
11328
  return this.shader;
11322
11329
  }
11323
11330
  delete(t) {
11324
- this.getMap().off("updatelights", this.Ys, this), super.delete(t), this.material.dispose();
11331
+ this.getMap().off("updatelights", this.$s, this), super.delete(t), this.material.dispose();
11325
11332
  }
11326
11333
  init() {
11327
- this.getMap().on("updatelights", this.Ys, this);
11334
+ this.getMap().on("updatelights", this.$s, this);
11328
11335
  const t = this.regl;
11329
11336
  this.renderer = new n.reshader.Renderer(t);
11330
11337
  const e = this.getShaderConfig();
11331
- this.shader = new n.reshader.PhongShader(e), this.Js();
11338
+ this.shader = new n.reshader.PhongShader(e), this.Ys();
11332
11339
  const i = {
11333
11340
  vert: this.getPickingVert(),
11334
11341
  uniforms: [ "projViewMatrix", "modelMatrix", "positionMatrix", {
@@ -11344,7 +11351,7 @@
11344
11351
  };
11345
11352
  this.picking = [ new n.reshader.FBORayPicking(this.renderer, i, this.layer.getRenderer().pickingFBO) ];
11346
11353
  }
11347
- Ys() {
11354
+ $s() {
11348
11355
  this.setToRedraw();
11349
11356
  }
11350
11357
  getShaderConfig() {
@@ -11393,14 +11400,14 @@
11393
11400
  }
11394
11401
  };
11395
11402
  }
11396
- Js() {
11403
+ Ys() {
11397
11404
  this.material && this.material.dispose();
11398
11405
  const t = this.getSymbols()[0].material, e = {};
11399
11406
  for (const n in t) ys(t, n) && (e[n] = t[n]);
11400
11407
  this.material = new n.reshader.PhongMaterial(e);
11401
11408
  }
11402
11409
  getUniformValues(t, e) {
11403
- const n = t.viewMatrix, i = t.projMatrix, r = t.cameraPosition, s = this.$s(), o = ns({
11410
+ const n = t.viewMatrix, i = t.projMatrix, r = t.cameraPosition, s = this.Zs(), o = ns({
11404
11411
  viewMatrix: n,
11405
11412
  projMatrix: i,
11406
11413
  cameraPosition: r,
@@ -11413,7 +11420,7 @@
11413
11420
  getPickingVert() {
11414
11421
  return "\n attribute vec3 aPosition;\n uniform mat4 projViewModelMatrix;\n uniform mat4 modelMatrix;\n uniform mat4 positionMatrix;\n //引入fbo picking的vert相关函数\n #include <fbo_picking_vert>\n #include <get_output>\n void main()\n {\n mat4 localPositionMatrix = getPositionMatrix();\n vec4 localPosition = getPosition(aPosition);\n\n gl_Position = projViewModelMatrix * localPositionMatrix * localPosition;\n //传入gl_Position的depth值\n fbo_picking_setData(gl_Position.w, true);\n }\n ";
11415
11422
  }
11416
- $s() {
11423
+ Zs() {
11417
11424
  const t = this.getMap().getLightManager(), e = t && t.getAmbientLight() || {}, n = t && t.getDirectionalLight() || {};
11418
11425
  return {
11419
11426
  ambientColor: e.color || [ .2, .2, .2 ],
@@ -11424,7 +11431,7 @@
11424
11431
  }
11425
11432
  }
11426
11433
  const rl = [ 1, 1, 1 ];
11427
- class sl extends Ls {
11434
+ class sl extends Rs {
11428
11435
  constructor(t, e, n, i, r) {
11429
11436
  if (super(t, e, n, i, r), _(this.symbolDef[0].lineColor)) {
11430
11437
  const t = e.getMap(), n = S(this.symbolDef.lineColor);
@@ -11481,7 +11488,7 @@
11481
11488
  const i = [];
11482
11489
  return n.mat4.multiply(i, e.projViewMatrix, e.modelMatrix), i;
11483
11490
  }
11484
- }, "outSize", "opacity" ],
11491
+ } ],
11485
11492
  extraCommandProps: {
11486
11493
  stencil: {
11487
11494
  enable: !0,
@@ -11517,20 +11524,20 @@
11517
11524
  const {getPBRUniforms: ol} = n.reshader.pbr.PBRUtils, al = [];
11518
11525
  class ll extends el {
11519
11526
  constructor(...t) {
11520
- super(...t), this.Zs = new n.reshader.ResourceLoader, this.scene.sortFunction = this.sortByCommandKey;
11527
+ super(...t), this.Ks = new n.reshader.ResourceLoader, this.scene.sortFunction = this.sortByCommandKey;
11521
11528
  }
11522
11529
  supportRenderMode(t) {
11523
11530
  return this.getSymbols()[0].ssr ? "fxaa" === t || "fxaaAfterTaa" === t : super.supportRenderMode(t);
11524
11531
  }
11525
11532
  isAnimating() {
11526
- const t = this.Ks();
11533
+ const t = this.Qs();
11527
11534
  if (t && (t[0] || t[1])) return !0;
11528
11535
  }
11529
11536
  needToRedraw() {
11530
- const t = this.Ks();
11537
+ const t = this.Qs();
11531
11538
  return !(!t || !t[0] && !t[1]) || super.needToRedraw();
11532
11539
  }
11533
- Ks() {
11540
+ Qs() {
11534
11541
  const t = this.getSymbols()[0];
11535
11542
  return t.material && t.material.uvOffsetAnim;
11536
11543
  }
@@ -11556,18 +11563,18 @@
11556
11563
  const e = ns({}, r, t.ssr.defines);
11557
11564
  i.shaderDefines = e;
11558
11565
  }
11559
- if (t.onlyUpdateDepthInTaa && (this.shader = this.Qs, !n && this.eo && (this.shader = i,
11566
+ if (t.onlyUpdateDepthInTaa && (this.shader = this.eo, !n && this.no && (this.shader = i,
11560
11567
  this.setToRedraw(!0))), this.updateIBLDefines(i), super.paint(t), void 0 !== this.shadowCount && e) {
11561
11568
  const t = this.scene.getMeshes().length;
11562
11569
  this.shadowCount !== t && this.setToRedraw();
11563
11570
  }
11564
11571
  this.shader = i, n && (i.shaderDefines = r), delete this.shadowCount;
11565
- const s = this.Ks();
11572
+ const s = this.Qs();
11566
11573
  if (s && (s[0] || s[1])) this.material.set("uvOffset", [ 0, 0 ]); else {
11567
11574
  const t = this.getUVOffset(s);
11568
11575
  this.material.set("uvOffset", t);
11569
11576
  }
11570
- this.eo = n;
11577
+ this.no = n;
11571
11578
  }
11572
11579
  getShadowMeshes() {
11573
11580
  if (!this.isVisible()) return al;
@@ -11583,15 +11590,15 @@
11583
11590
  ns(this.sceneConfig, t), this.setToRedraw();
11584
11591
  }
11585
11592
  delete() {
11586
- super.delete(), this.disposeIBLTextures(), this.material.dispose(), this.no && this.no.dispose(),
11587
- this.shader && (this.shader.dispose(), delete this.shader), this.Qs && (this.Qs.dispose(),
11588
- delete this.Qs);
11593
+ super.delete(), this.disposeIBLTextures(), this.material.dispose(), this.io && this.io.dispose(),
11594
+ this.shader && (this.shader.dispose(), delete this.shader), this.eo && (this.eo.dispose(),
11595
+ delete this.eo);
11589
11596
  }
11590
11597
  init(t) {
11591
- this.getMap().on("updatelights", this.io, this), this.createIBLTextures(), this.or = this.or || t;
11598
+ this.getMap().on("updatelights", this.ro, this), this.createIBLTextures(), this.or = this.or || t;
11592
11599
  const e = this.regl;
11593
- this.renderer = new n.reshader.Renderer(e), this.ro = this.so.bind(this), this.oo = this.disposeCachedTexture.bind(this),
11594
- this.ao = this.lo.bind(this), this.Js(), this.nr(t);
11600
+ this.renderer = new n.reshader.Renderer(e), this.so = this.oo.bind(this), this.ao = this.disposeCachedTexture.bind(this),
11601
+ this.lo = this.ho.bind(this), this.Ys(), this.nr(t);
11595
11602
  const i = {
11596
11603
  vert: "\n attribute vec3 aPosition;\n uniform mat4 projViewModelMatrix;\n uniform mat4 positionMatrix;\n //引入fbo picking的vert相关函数\n #include <line_extrusion_vert>\n #include <get_output>\n #include <fbo_picking_vert>\n void main() {\n mat4 localPositionMatrix = getPositionMatrix();\n #ifdef IS_LINE_EXTRUSION\n vec3 linePosition = getLineExtrudePosition(aPosition);\n vec4 localVertex = getPosition(linePosition);\n #else\n vec4 localVertex = getPosition(aPosition);\n #endif\n\n gl_Position = projViewModelMatrix * localPositionMatrix * localVertex;\n fbo_picking_setData(gl_Position.w, true);\n }\n ",
11597
11604
  uniforms: [ {
@@ -11647,20 +11654,20 @@
11647
11654
  polygonOffset: this.getPolygonOffset()
11648
11655
  }, o = {
11649
11656
  uniforms: r,
11650
- defines: this.ho(i),
11657
+ defines: this.co(i),
11651
11658
  extraCommandProps: s
11652
11659
  };
11653
11660
  this.shader = new n.reshader.pbr.StandardShader(o), o.frag = "\n precision mediump float;\n #include <gl2_frag>\n void main() {\n glFragColor = vec4(0.0);\n #if __VERSION__ == 100\n gl_FragColor = glFragColor;\n #endif\n }\n ",
11654
- this.Qs = new n.reshader.pbr.StandardShader(o);
11661
+ this.eo = new n.reshader.pbr.StandardShader(o);
11655
11662
  }
11656
- so({resources: t}) {
11663
+ oo({resources: t}) {
11657
11664
  for (let e = 0; e < t.length; e++) this.addCachedTexture(t[e].url, t[e].data);
11658
11665
  this.setToRedraw(!0);
11659
11666
  }
11660
- lo() {
11667
+ ho() {
11661
11668
  this.setToRedraw(!0);
11662
11669
  }
11663
- Js(t) {
11670
+ Ys(t) {
11664
11671
  const e = t || this.getSymbols()[0].material, i = {};
11665
11672
  let r = !1;
11666
11673
  for (const t in e) if (ys(e, t)) if (t.indexOf("Texture") > 0) {
@@ -11679,15 +11686,15 @@
11679
11686
  } : s.data = a : o === s && (s = {
11680
11687
  url: o,
11681
11688
  wrap: "repeat"
11682
- }), s.flipY = !0, i[t] = new n.reshader.Texture2D(s, this.Zs), i[t].once("complete", this.ro),
11683
- i[t].once("disposed", this.oo), i[t].promise && this.addCachedTexture(o, i[t].promise),
11689
+ }), s.flipY = !0, i[t] = new n.reshader.Texture2D(s, this.Ks), i[t].once("complete", this.so),
11690
+ i[t].once("disposed", this.ao), i[t].promise && this.addCachedTexture(o, i[t].promise),
11684
11691
  r = !0;
11685
11692
  } else i[t] = e[t];
11686
11693
  if (this.material) {
11687
11694
  for (let t in i) this.material.set(t, i[t]);
11688
11695
  this.setToRedraw(!0);
11689
- } else this.material = new n.reshader.pbr.StandardMaterial(i), this.material.once("complete", this.ao);
11690
- r || this.lo();
11696
+ } else this.material = new n.reshader.pbr.StandardMaterial(i), this.material.once("complete", this.lo);
11697
+ r || this.ho();
11691
11698
  }
11692
11699
  getShader() {
11693
11700
  return this.shader;
@@ -11696,29 +11703,29 @@
11696
11703
  const {iblTexes: n, dfgLUT: i} = this.getIBLRes(), r = ol(t, n, i, e && e.ssr, e && e.jitter);
11697
11704
  return this.setIncludeUniformValues(r, e), r;
11698
11705
  }
11699
- ho(t) {
11706
+ co(t) {
11700
11707
  return this.hasIBL() ? t.HAS_IBL_LIGHTING = 1 : delete t.HAS_IBL_LIGHTING, t;
11701
11708
  }
11702
- io() {
11709
+ ro() {
11703
11710
  if (!this.shader) return;
11704
11711
  const t = this.shader.shaderDefines;
11705
- this.ho(t), this.shader.shaderDefines = t;
11712
+ this.co(t), this.shader.shaderDefines = t;
11706
11713
  }
11707
11714
  }
11708
11715
  const hl = [], cl = [], ul = [ 0, 0, 0 ], fl = [ 0, 0, 0 ], dl = [ 1, 1, 1 ], pl = [], yl = [ 1, 1, 1, 1 ], ml = [], gl = t => class extends t {
11709
11716
  constructor(t, e, n, i, r) {
11710
- super(t, e, n, i, r), this.co = !1, this.scene.sortFunction = this.sortByCommandKey,
11711
- this.uo = [];
11717
+ super(t, e, n, i, r), this.uo = !1, this.scene.sortFunction = this.sortByCommandKey,
11718
+ this.fo = [];
11712
11719
  }
11713
11720
  isAnimating() {
11714
11721
  const t = this.getSymbols();
11715
11722
  for (let e = 0; e < t.length; e++) {
11716
- if (t[e] && this.fo[e] && this.do(e)) return !0;
11723
+ if (t[e] && this.do[e] && this.po(e)) return !0;
11717
11724
  }
11718
11725
  return !1;
11719
11726
  }
11720
11727
  createGeometry(t, e) {
11721
- if (this.po(), !this.co) return null;
11728
+ if (this.yo(), !this.uo) return null;
11722
11729
  const {data: n, positionSize: i} = t;
11723
11730
  return {
11724
11731
  geometry: {
@@ -11742,7 +11749,7 @@
11742
11749
  instance_vectorC: new Float32Array(4 * c),
11743
11750
  aPickingId: []
11744
11751
  };
11745
- this.yo(u, i, r, o.properties.z, h, a);
11752
+ this.mo(u, i, r, o.properties.z, h, a);
11746
11753
  const f = {};
11747
11754
  for (const t in u) f[t] = {
11748
11755
  buffer: this.regl.buffer({
@@ -11753,14 +11760,14 @@
11753
11760
  };
11754
11761
  const d = [], p = this.getSymbols();
11755
11762
  for (let t = 0; t < p.length; t++) {
11756
- const e = p[t], r = this.uo[t];
11763
+ const e = p[t], r = this.fo[t];
11757
11764
  if (!r) continue;
11758
- const {translation: o, rotation: a, scale: h, fixSizeOnZoom: y} = e, m = this.mo([], o, a, h);
11765
+ const {translation: o, rotation: a, scale: h, fixSizeOnZoom: y} = e, m = this.vo([], o, a, h);
11759
11766
  let g = 0;
11760
11767
  r.forEach(t => {
11761
11768
  const {geometry: i, nodeMatrix: r} = t, s = n.mat4.multiply(ml, m, r), o = i.boundingBox.copy();
11762
11769
  o.transform(s);
11763
- const a = this.vo(o, e);
11770
+ const a = this.xo(o, e);
11764
11771
  a > g && (g = a);
11765
11772
  });
11766
11773
  const v = [ 0, 0, g ], x = r.map(r => {
@@ -11796,7 +11803,7 @@
11796
11803
  positionSize: a
11797
11804
  }, d;
11798
11805
  }
11799
- vo(t, e) {
11806
+ xo(t, e) {
11800
11807
  const n = e.anchorZ || "bottom";
11801
11808
  let i = 0;
11802
11809
  return "bottom" === n ? i = -t.min[2] : "top" === n ? i = -t.max[2] : "center" === n && (i = -(t.min[2] + t.max[2]) / 2),
@@ -11807,7 +11814,7 @@
11807
11814
  if (t[0].properties.level > 2) return null;
11808
11815
  for (let e = 0; e < t.length; e++) {
11809
11816
  if (!t[e] || !t[e].geometry) continue;
11810
- const n = this.do(t[e].properties.symbolIndex.index);
11817
+ const n = this.po(t[e].properties.symbolIndex.index);
11811
11818
  t[e].setUniform("skinAnimation", +n);
11812
11819
  }
11813
11820
  return this.scene.addMesh(t), this;
@@ -11817,12 +11824,12 @@
11817
11824
  let n = !1;
11818
11825
  for (let i = 0; i < e.length; i++) {
11819
11826
  const r = e[i];
11820
- if (!r || !this.fo[i]) continue;
11821
- if (this.do(i) && this.fo[i]) {
11827
+ if (!r || !this.do[i]) continue;
11828
+ if (this.po(i) && this.do[i]) {
11822
11829
  n || (n = !0);
11823
11830
  let e = r.speed;
11824
11831
  const s = !!r.loop;
11825
- ss(e) && (e = 1), this.fo[i].updateAnimation(t.timestamp, s, e);
11832
+ ss(e) && (e = 1), this.do[i].updateAnimation(t.timestamp, s, e);
11826
11833
  }
11827
11834
  }
11828
11835
  n && this.setToRedraw(!0), super.prepareRender(t);
@@ -11832,11 +11839,11 @@
11832
11839
  this.shadowCount = this.scene.getMeshes().length;
11833
11840
  return this.scene.getMeshes().filter(t => 0 === t.getUniform("level"));
11834
11841
  }
11835
- do(t) {
11842
+ po(t) {
11836
11843
  const e = this.getSymbols()[t];
11837
- return e && e.animation && this.fo[t] && this.fo[t].hasSkinAnimation();
11844
+ return e && e.animation && this.do[t] && this.do[t].hasSkinAnimation();
11838
11845
  }
11839
- yo(t, e, i, r, s, o) {
11846
+ mo(t, e, i, r, s, o) {
11840
11847
  function a(e, n, i, r) {
11841
11848
  t[e][4 * n] = i[r], t[e][4 * n + 1] = i[r + 4], t[e][4 * n + 2] = i[r + 8], t[e][4 * n + 3] = i[r + 12];
11842
11849
  }
@@ -11852,26 +11859,26 @@
11852
11859
  return t.positionAttribute = "POSITION", t.normalAttribute = "NORMAL", t;
11853
11860
  }
11854
11861
  init(t) {
11855
- super.init(t), this.po();
11862
+ super.init(t), this.yo();
11856
11863
  }
11857
- po() {
11858
- if (this.fo) return;
11859
- this.fo = [];
11864
+ yo() {
11865
+ if (this.do) return;
11866
+ this.do = [];
11860
11867
  const t = this.layer.getRenderer(), e = this.getSymbols();
11861
- this.xo = 0;
11868
+ this.bo = 0;
11862
11869
  for (let i = 0; i < e.length; i++) {
11863
11870
  const r = e[i].url;
11864
11871
  if (t.isCachePlaced(r)) continue;
11865
11872
  const s = t.fetchCache(r);
11866
- s ? (this.fo[i] = [ s ], this.uo[i] = s.getMeshesInfo(), this.xo++, t.addToCache(r)) : (t.placeCache(r),
11873
+ s ? (this.do[i] = [ s ], this.fo[i] = s.getMeshesInfo(), this.bo++, t.addToCache(r)) : (t.placeCache(r),
11867
11874
  n.reshader.GLTFHelper.load(r).then(s => {
11868
11875
  const o = n.reshader.GLTFHelper.exportGLTFPack(s, this.regl);
11869
- this.fo[i] = [ o ], this.uo[i] = o.getMeshesInfo(), t.addToCache(r, o, t => {
11876
+ this.do[i] = [ o ], this.fo[i] = o.getMeshesInfo(), t.addToCache(r, o, t => {
11870
11877
  t.dispose();
11871
- }), this.xo++, this.xo >= e.length && (this.co = !0), this.setToRedraw(!0);
11878
+ }), this.bo++, this.bo >= e.length && (this.uo = !0), this.setToRedraw(!0);
11872
11879
  }));
11873
11880
  }
11874
- this.xo >= e.length && (this.co = !0);
11881
+ this.bo >= e.length && (this.uo = !0);
11875
11882
  }
11876
11883
  getPickingVert() {
11877
11884
  return "\n attribute vec3 aPosition;\n uniform mat4 projViewModelMatrix;\n uniform mat4 modelMatrix;\n uniform mat4 positionMatrix;\n //引入fbo picking的vert相关函数\n #include <fbo_picking_vert>\n #include <get_output>\n void main()\n {\n mat4 localPositionMatrix = getPositionMatrix();\n vec4 localPosition = getPosition(aPosition);\n\n gl_Position = projViewModelMatrix * localPositionMatrix * localPosition;\n //传入gl_Position的depth值\n fbo_picking_setData(gl_Position.w, true);\n }";
@@ -11885,15 +11892,15 @@
11885
11892
  delete() {
11886
11893
  super.delete();
11887
11894
  const t = this.getSymbols()[0].url;
11888
- if (this.layer.getRenderer().removeCache(t), this.uo) for (let t = 0; t < this.uo.length; t++) {
11889
- const e = this.uo[t];
11895
+ if (this.layer.getRenderer().removeCache(t), this.fo) for (let t = 0; t < this.fo.length; t++) {
11896
+ const e = this.fo[t];
11890
11897
  for (let n = 0; n < e.length; n++) {
11891
11898
  const n = e[t], {geometry: i, materialInfo: r} = n;
11892
11899
  if (i && i.dispose(), r) for (const t in r) r[t] && r[t].destroy && r[t].destroy();
11893
11900
  }
11894
11901
  }
11895
11902
  }
11896
- mo(t, e, i, r) {
11903
+ vo(t, e, i, r) {
11897
11904
  const s = n.vec3.set(hl, ...e || ul), o = i || fl, a = r || dl, l = n.quat.fromEuler(cl, o[0], o[1], o[2]);
11898
11905
  return n.mat4.fromRotationTranslationScale(t, l, s, a);
11899
11906
  }
@@ -11935,8 +11942,8 @@
11935
11942
  }
11936
11943
  callShader(t, e) {
11937
11944
  super.callShader(t, e), this.transformWater();
11938
- const n = this.bo(this.getMap(), e);
11939
- this.renderer.render(this.wo, n, this.Ao, this.getRenderFBO(e));
11945
+ const n = this.wo(this.getMap(), e);
11946
+ this.renderer.render(this.Ao, n, this._o, this.getRenderFBO(e));
11940
11947
  }
11941
11948
  addMesh(t, e) {
11942
11949
  this.sr(t, e), super.addMesh(...arguments);
@@ -11946,14 +11953,14 @@
11946
11953
  for (let n = 0; n < t.length; n++) t[n].ssr = e ? 1 : 0;
11947
11954
  }
11948
11955
  paint(t) {
11949
- t.states && t.states.includesChanged && (this.shader.dispose(), this.wo.dispose(),
11956
+ t.states && t.states.includesChanged && (this.shader.dispose(), this.Ao.dispose(),
11950
11957
  this.nr(t));
11951
- const e = !!t.ssr && this.getSymbol(wl).ssr, n = this.wo, i = n.shaderDefines;
11958
+ const e = !!t.ssr && this.getSymbol(wl).ssr, n = this.Ao, i = n.shaderDefines;
11952
11959
  if (e) {
11953
11960
  const e = ns({}, i, t.ssr.defines);
11954
11961
  n.shaderDefines = e;
11955
11962
  }
11956
- this.updateIBLDefines(n), this._o.ssr = e ? 1 : 0, super.paint(t), e && (n.shaderDefines = i);
11963
+ this.updateIBLDefines(n), this.Mo.ssr = e ? 1 : 0, super.paint(t), e && (n.shaderDefines = i);
11957
11964
  }
11958
11965
  init(t) {
11959
11966
  this.createIBLTextures();
@@ -11971,38 +11978,38 @@
11971
11978
  extraCommandProps: {
11972
11979
  viewport: this.pickingViewport
11973
11980
  }
11974
- }, this.pickingFBO) ]), this.Mo();
11981
+ }, this.pickingFBO) ]), this.So();
11975
11982
  }
11976
- Mo() {
11983
+ So() {
11977
11984
  const t = this.regl;
11978
- this.So = t.texture(2), this.ko = [ 2, 2 ];
11985
+ this.ko = t.texture(2), this.Po = [ 2, 2 ];
11979
11986
  const e = this.getSymbol({
11980
11987
  index: 0
11981
11988
  }), n = e.texWaveNormal, i = this.getCachedTexture(n), r = this;
11982
- if (i) i.loading || (this.Po = this.To(t, i)); else {
11989
+ if (i) i.loading || (this.To = this.Oo(t, i)); else {
11983
11990
  const e = new Image;
11984
11991
  e.loading = !0, e.onload = function() {
11985
- delete this.loading, r.Po = r.To(t, this), this.ko = [ this.width, this.height ],
11992
+ delete this.loading, r.To = r.Oo(t, this), this.Po = [ this.width, this.height ],
11986
11993
  r.setToRedraw();
11987
11994
  }, e.onerror = () => {
11988
11995
  console.error("invalid water wave normal texture:" + n);
11989
11996
  }, this.addCachedTexture(n, e), e.src = n;
11990
11997
  }
11991
11998
  const s = e.texWavePerturbation, o = this.getCachedTexture(s);
11992
- if (o) o.loading || (this.Oo = this.To(t, o)); else {
11999
+ if (o) o.loading || (this.Fo = this.Oo(t, o)); else {
11993
12000
  const e = new Image;
11994
12001
  e.loading = !0, e.onload = function() {
11995
- delete this.loading, r.Oo = r.To(t, this), this.ko = [ this.width, this.height ],
12002
+ delete this.loading, r.Fo = r.Oo(t, this), this.Po = [ this.width, this.height ],
11996
12003
  r.setToRedraw();
11997
12004
  }, e.onerror = () => {
11998
12005
  console.error("invalid water wave perturbation texture:" + s);
11999
12006
  }, this.addCachedTexture(s, e), e.src = s;
12000
12007
  }
12001
12008
  }
12002
- To(t, e) {
12003
- return this.So ? t.texture({
12004
- width: this.ko[0],
12005
- height: this.ko[1],
12009
+ Oo(t, e) {
12010
+ return this.ko ? t.texture({
12011
+ width: this.Po[0],
12012
+ height: this.Po[1],
12006
12013
  mag: "linear",
12007
12014
  min: "linear mipmap linear",
12008
12015
  wrapS: "repeat",
@@ -12099,7 +12106,7 @@
12099
12106
  enable: !1
12100
12107
  }
12101
12108
  };
12102
- i.push(...n.reshader.SsrPass.getUniformDeclares()), this.wo = new n.reshader.MeshShader({
12109
+ i.push(...n.reshader.SsrPass.getUniformDeclares()), this.Ao = new n.reshader.MeshShader({
12103
12110
  vert: "#define SHADER_NAME WATER\nuniform mat4 modelMatrix;\nuniform mat4 projViewModelMatrix;\nattribute vec3 aPosition;\nattribute vec2 aTexCoord;\nuniform vec2 uvOffset;\nuniform vec2 noiseUvOffset;\nuniform vec2 uvScale;\nvarying vec2 vUv;\nvarying vec2 vNoiseUv;\nvarying vec3 vPos;\nvarying mat3 vTbnMatrix;\n#ifdef HAS_SSR\nuniform mat4 modelViewMatrix;\nvarying vec4 vViewVertex;\n#endif\nmat3 c(in vec3 d) {\n vec3 t = normalize(cross(d, vec3(.0, 1., .0)));\n vec3 e = normalize(cross(d, t));\n return mat3(t, e, d);\n}\n#if defined(HAS_SHADOWING)\n#include <vsm_shadow_vert>\n#endif\nconst vec3 f = vec3(0., 0., 1.);\nvoid main(void) {\n vec4 h = vec4(aPosition, 1.);\n vec4 i = modelMatrix * h;\n vPos = i.xyz;\n vTbnMatrix = c(f);\n gl_Position = projViewModelMatrix * h;\n vUv = aTexCoord * uvScale + uvOffset;\n vNoiseUv = aTexCoord * uvScale * TIME_NOISE_TEXTURE_REPEAT + noiseUvOffset;\n#ifdef HAS_SSR\nvec4 j = modelViewMatrix * h;\n vViewVertex = j;\n#endif\n#if defined(HAS_SHADOWING)\nshadow_computeShadowPars(h);\n#endif\n}",
12104
12111
  frag: "#define SHADER_NAME WATER\nprecision highp float;\nprecision highp sampler2D;\n#include <hsv_frag>\nuniform vec3 hsv;\nuniform float contrast;\n#if defined(HAS_SHADOWING)\n#include <vsm_shadow_frag>\n#endif\n#if defined(HAS_IBL_LIGHTING)\nuniform vec3 hdrHsv;\nuniform samplerCube specularPBR;\nuniform float rgbmRange;\nuniform vec3 diffuseSPH[9];\n#else\nuniform vec3 ambientColor;\n#endif\nstruct PBRShadingWater {\n float NdotL;\n float NdotV;\n float NdotH;\n float VdotH;\n float LdotH;\n float VdotN;\n};\nvec3 c(const in vec4 d, const in float e) {\n if(e <= .0)\n return d.rgb;\n return e * d.rgb * d.a;\n}\n#ifdef HAS_SSR\nvarying vec4 vViewVertex;\nuniform mat3 modelViewNormalMatrix;\nuniform sampler2D TextureDepth;\nuniform highp vec2 outSize;\nuniform float ssrFactor;\nuniform float ssrQuality;\nuniform sampler2D TextureReflected;\nuniform highp mat4 projMatrix;\nuniform mat4 invProjMatrix;\nuniform vec4 outputFovInfo[2];\nuniform mat4 reprojViewProjMatrix;\nuniform vec2 cameraNearFar;\nfloat f(const in vec4 h) {\n return h.r + h.g / 255.;\n}\nfloat i(const in vec2 j, const in float k) {\n vec3 l = vec3(.06711056, .00583715, 52.9829189);\n return fract(l.z * fract(dot(j.xy + k * vec2(47., 17.) * .695, l.xy))) * .5;\n}\nvec3 m(const in float n, const in float o, const in vec2 u) {\n float v = min(o - .01, n);\n float A = floor(v);\n float B = min(o, A + 1.);\n float C = pow(2., B);\n vec2 D = 2. * C / u;\n if(v - A > .5)\n C *= 2.;\n return vec3(D, C);\n}\nvec2 E(const in vec2 F, const in vec3 G) {\n vec2 H = max(G.xy, min(1. - G.xy, F));\n return vec2(2. * H.x, G.z - 1. - H.y) / G.z;\n}\nvec3 I(const in mat4 J, const in vec3 K) {\n vec4 L = J * vec4(K, 1.);\n return vec3(.5 + .5 * L.xy / L.w, L.w);\n}\nvec3 M(const in float N, const in vec2 H) {\n return texture2D(TextureReflected, H).rgb;\n}\nfloat O(float P) {\n highp mat4 J = projMatrix;\n highp float z = P * 2. - 1.;\n return -J[3].z / (z + J[2].z);\n}\nfloat Q(const vec2 H) {\n float P = f(texture2D(TextureDepth, H));\n return P;\n}\nvec3 R(const in float k, const in vec3 S, const in vec3 T, const in vec3 U, const in vec3 V, const in float W) {\n vec2 X;\n X.x = i(gl_FragCoord.yx, k);\n X.y = fract(X.x * 52.9829189);\n X.y = mix(X.y, 1., .7);\n float Y = 2. * 3.14159 * X.x;\n float Z = pow(max(X.y, .000001), W / (2. - W));\n float ba = sqrt(1. - Z * Z);\n vec3 bb = vec3(ba * cos(Y), ba * sin(Y), Z);\n bb = bb.x * S + bb.y * T + bb.z * U;\n return normalize((2. * dot(V, bb)) * bb - V);\n}\nfloat bc(const in float k) {\n return (i(gl_FragCoord.xy, k) - .5);\n}\nvec3 bd(const in vec3 be, const in float bf, const in vec3 bg) {\n vec3 bh = I(projMatrix, vViewVertex.xyz + bg * bf);\n bh.z = 1. / bh.z;\n bh -= be;\n float bi = min(1., .99 * (1. - be.x) / max(1e-5, bh.x));\n float bj = min(1., .99 * (1. - be.y) / max(1e-5, bh.y));\n float bk = min(1., .99 * be.x / max(1e-5, -bh.x));\n float bl = min(1., .99 * be.y / max(1e-5, -bh.y));\n return bh * min(bi, bj) * min(bk, bl);\n}\nfloat bm(const in vec3 be, const in vec3 bh, inout float bn, inout float bo) {\n float bp = (bo + bn) * .5;\n vec3 bq = be + bh * bp;\n float z = Q(bq.xy);\n float P = O(z);\n float br = -1. / bq.z;\n bn = P > br ? bn : bp;\n bo = P > br ? bp : bo;\n return bp;\n}\nvec4 bs(const in vec3 be, const in float bf, in float bt, const in vec3 bg, const in float bu, const in float k) {\n const int bv = 20;\n float bw = 1. / float(bv);\n bt *= bw;\n vec3 bh = bd(be, bf, bg);\n float bx = bw;\n vec3 by = vec3(.0, bx, 1.);\n vec3 bq;\n float z, P, br, bz, bA, bB;\n bool bC;\n float bD = 1.;\n float bp;\n for(int bE = 0; bE < bv; bE++) {\n bq = be + bh * by.y;\n z = Q(bq.xy);\n P = O(z);\n br = -1. / bq.z;\n bz = br - P;\n bz *= clamp(sign(abs(bz) - bf * bw * bw), .0, 1.);\n bC = abs(bz + bt) < bt;\n bA = clamp(by.x / (by.x - bz), .0, 1.);\n bB = bC ? by.y + bA * bw - bw : 1.;\n by.z = min(by.z, bB);\n by.x = bz;\n if(bC) {\n float bn = by.y - bw;\n float bo = by.y;\n bp = bm(be, bh, bn, bo);\n bp = bm(be, bh, bn, bo);\n bp = bm(be, bh, bn, bo);\n bD = bp;\n break;\n }\n by.y += bw;\n }\n return vec4(be + bh * bD, 1. - bD);\n}\nvec3 bF(in vec4 bG, const in float bH, const in vec3 bI, const in vec3 bJ, const in float bu) {\n vec4 bK = mix(outputFovInfo[0], outputFovInfo[1], bG.x);\n bG.xyz = vec3(mix(bK.xy, bK.zw, bG.y), 1.) * -1. / bG.z;\n bG.xyz = (reprojViewProjMatrix * vec4(bG.xyz, 1.)).xyw;\n bG.xy /= bG.z;\n float bL = clamp(6. - 6. * max(abs(bG.x), abs(bG.y)), .0, 1.);\n bG.xy = .5 + .5 * bG.xy;\n return vec3(bG.xy, 1.);\n}\nvec3 ssr(const in vec3 bI, const in vec3 bJ, const in float bu, const in vec3 bM, const in vec3 V) {\n float bN = .0;\n vec4 bO = vec4(.0);\n float W = bu * bu;\n W = W * W;\n vec3 bP = abs(bM.z) < .999 ? vec3(.0, .0, 1.) : vec3(1., .0, .0);\n vec3 S = normalize(cross(bP, bM));\n vec3 T = cross(bM, S);\n float bH = ssrFactor * clamp(-4. * dot(V, bM) + 3.8, .0, 1.);\n bH *= clamp(4.7 - bu * 5., .0, 1.);\n vec3 be = I(projMatrix, vViewVertex.xyz);\n be.z = 1. / be.z;\n vec3 bg = R(bN, S, T, bM, V, W);\n float bf = mix(cameraNearFar.y + vViewVertex.z, -vViewVertex.z - cameraNearFar.x, bg.z * .5 + .5);\n float bt = .5 * bf;\n vec4 bG;\n if(dot(bg, bM) > .001 && bH > .0) {\n bG = bs(be, bf, bt, bg, bu, bN);\n if(bG.w > .0)\n return bF(bG, bH, bI, bJ, bu);\n \n }\n return vec3(.0);\n}\n#endif\nconst vec3 bQ = vec3(0., 0., 1.);\nuniform mat4 viewMatrix;\nuniform sampler2D normalTexture;\nuniform sampler2D heightTexture;\nuniform vec4 waveParams;\nuniform vec2 waterDir;\nuniform vec4 waterBaseColor;\nuniform vec3 lightDirection;\nuniform vec3 lightColor;\nuniform vec3 camPos;\nuniform float timeElapsed;\nvarying vec2 vUv;\nvarying vec2 vNoiseUv;\nvarying vec3 vPos;\nvarying mat3 vTbnMatrix;\nfloat bR(vec3 bS, float bT) {\n float bU = max(.015, bT);\n return max((bS.x + bS.y) * .3303545 / bU + .3303545, .0);\n}\nconst vec2 bV = vec2(6. / 25., 5. / 24.);\nvec2 bW(sampler2D bX, vec2 H) {\n return 2. * texture2D(bX, H).rg - 1.;\n}\nfloat bY(vec2 H) {\n return texture2D(heightTexture, H).b;\n}\nvec3 bZ(sampler2D bX, vec2 H) {\n return 2. * texture2D(bX, H).rgb - 1.;\n}\nfloat ca(vec2 H, float cb) {\n return fract(cb);\n}\nfloat cc(vec2 H, float cb) {\n float cd = ca(H, cb);\n return 1. - abs(1. - 2. * cd);\n}\nvec3 ce(sampler2D cf, vec2 H, float cb, float cg) {\n float ch = waveParams[2];\n float ci = waveParams[3];\n vec2 cj = bW(cf, H) * ch;\n float cd = ca(H, cb + cg);\n float ck = cc(H, cb + cg);\n vec2 bO = H;\n bO -= cj * (cd + ci);\n bO += cg;\n bO += (cb - cd) * bV;\n return vec3(bO, ck);\n}\nconst float cl = 7.77;\nvec3 cm(sampler2D cn, sampler2D co, vec2 cp, vec2 cq, float cb) {\n float bT = waveParams[0];\n vec2 cr = cb * -cq;\n float cs = bY(vNoiseUv) * cl;\n vec3 ct = ce(co, cp + cr, cb + cs, .0);\n vec3 cu = ce(co, cp + cr, cb + cs, .5);\n vec3 cv = bZ(cn, ct.xy) * ct.z;\n vec3 cw = bZ(cn, cu.xy) * cu.z;\n vec3 cx = normalize(cv + cw);\n cx.xy *= bT;\n cx.z = sqrt(1. - dot(cx.xy, cx.xy));\n return cx;\n}\nvec4 cy(vec2 cp, float cz) {\n float cA = waveParams[1];\n vec3 bM = cm(normalTexture, heightTexture, cp * cA, waterDir, cz);\n float cB = bR(bM, waveParams[0]);\n return vec4(bM, cB);\n}\nconst float cC = 3.141592653589793;\nconst float cD = 1. / cC;\nconst float cE = .3183098861837907;\nconst float cF = 1.570796326794897;\nconst float cG = .4;\nfloat cH = 2.2;\nvec3 cI(float cJ, vec3 cK, float cL) {\n return cK + (cL - cK) * pow(1. - cJ, 5.);\n}\nfloat cM(float cN, float bu) {\n float cO = bu * bu;\n float cP = cN * cN;\n float cQ = pow((cP * (cO - 1.) + 1.), cH) * cC;\n return cO / cQ;\n}\nfloat cR(float cS) {\n return .25 / (cS * cS);\n}\nvec3 cT(const vec3 x) {\n return (x * (2.51 * x + .03)) / (x * (2.43 * x + .59) + .14);\n}\nconst float cU = 2.2;\nconst float cV = .4545454545;\nvec4 cW(vec4 d) {\n return vec4(pow(d.rgb, vec3(cV)), d.w);\n}\nvec3 cX(vec3 d) {\n return pow(d, vec3(cU));\n}\nconst vec3 cY = vec3(.02, 1., 5.);\nconst vec2 cZ = vec2(.02, .1);\nconst float bu = .06;\nconst float da = 1.7;\nconst vec3 db = vec3(0, .6, .9);\nconst vec3 dc = vec3(.72, .92, 1.);\nconst float dd = .65;\nconst float de = 300000.0;\nconst float df = 500000.0;\nconst float dg = .775;\nconst float dh = .8;\nvec3 di(in vec3 bS, in vec3 dj) {\n \n#ifdef HAS_IBL_LIGHTING\nvec3 dk = reflect(-dj, bS);\n return c(textureCube(specularPBR, dk), rgbmRange);\n#else\nreturn ambientColor;\n#endif\n}\nPBRShadingWater dl;\nvec3 dm(in PBRShadingWater dn, float bu, vec3 dp, float dq) {\n vec3 dr = cI(dn.VdotH, dp, dq);\n float ds = cM(dn.NdotH, bu);\n float dt = cR(dn.LdotH);\n float du = mix(bu + .045, bu + .385, 1. - dn.VdotH);\n float dv = 1.2;\n float dw = cM(dn.NdotH, du) * dv;\n return ((ds + dw) * dt) * dr;\n}\nvec3 dx(float da, float dy, vec3 db, float dz) {\n return da * (.075 * db * pow(dy, 4.) + 50. * pow(dy, 23.)) * dz;\n}\nvec3 dA(in float Z, in vec3 dB, in vec3 dC) {\n float dD = pow((1. - Z), cY[2]);\n return mix(dC, dB, dD);\n}\nvec3 dE(in vec3 bS, in vec3 dj, in vec3 dF, vec3 d, in vec3 dG, in vec3 dH, in float dI, float dJ, vec3 dK) {\n float dL = 0.;\n vec3 dM = cX(d);\n vec3 bb = normalize(dF + dj);\n dl.NdotL = clamp(dot(bS, dF), .0, 1.);\n dl.NdotV = clamp(dot(bS, dj), .001, 1.);\n dl.VdotN = clamp(dot(dj, bS), .001, 1.);\n dl.NdotH = clamp(dot(bS, bb), .0, 1.);\n dl.VdotH = clamp(dot(dj, bb), .0, 1.);\n dl.LdotH = clamp(dot(dF, bb), .0, 1.);\n float dN = max(dot(dH, dj), .0);\n vec3 dO = cX(dc);\n vec3 dP = cX(db);\n vec3 dc = dA(dN, dO, dP);\n float dQ = max(dot(dH, dF), .0);\n float dR = .1 + dQ * .9;\n dc *= dR;\n float dS = clamp(dI, .8, 1.);\n vec3 dT = cI(dl.VdotN, vec3(cY[0]), cY[1]);\n vec3 dU = dT * dc * dS;\n vec3 dV = dM * mix(dc, dQ * dG * cD, 2. / 3.) * dS;\n vec3 dW = vec3(.0);\n if(dN > .0 && dQ > .0) {\n vec3 dX = dm(dl, bu, vec3(cZ[0]), cZ[1]);\n vec3 dY = dG * cD * dI;\n dW = dl.NdotL * dY * dX;\n }\n vec3 cB = vec3(.0);\n if(dN > .0) {\n cB = dx(da, dJ, db, dR);\n }\n vec3 dZ = vec3(.0);\n#ifdef HAS_SSR\nfloat ea = smoothstep(df, de, -dK.z);\n mat4 eb = viewMatrix;\n vec4 ec = vec4(dK.xyz, 1.);\n vec3 ed = normalize(ec.xyz);\n vec4 ee = eb * vec4(bS, .0);\n vec3 ef = normalize(ee.xyz);\n vec4 eg = eb * vec4(dH, .0);\n float eh = pow(max(dot(-ed, eg.xyz), .0), cG);\n vec3 ei = mix(eg.xyz, ef, eh);\n vec3 ej = ssr(vec3(.0), vec3(1.), bu, normalize(ei), -normalize(vViewVertex.xyz));\n if(ej.z > .0) {\n vec2 ek = smoothstep(.3, .6, abs(vec2(.5) - ej.xy));\n dL = dg * clamp(1. - 1.3 * ek.y, .0, 1.) * ea;\n vec3 el = M(.0, ej.xy);\n dZ = cX(el) * dL * dT.y * dd;\n }\n#endif\nfloat em = mix(dh, dh * .5, dL);\n return cT((1. - dL) * dU + dZ + dV * em + dW + cB);\n}\nvoid main() {\n vec3 dH = bQ;\n vec4 en = cy(vUv, timeElapsed);\n vec3 bS = normalize(vTbnMatrix * en.xyz);\n vec3 dj = -normalize(vPos - camPos);\n vec3 dF = normalize(-lightDirection);\n#if defined(HAS_SHADOWING)\nfloat dI = shadow_computeShadow();\n#else\nfloat dI = 1.;\n#endif\nvec4 eo = viewMatrix * vec4(vPos, 1.);\n vec4 ep = vec4(dE(bS, dj, dF, waterBaseColor.rgb, lightColor, dH, dI, en.w, eo.xyz), waterBaseColor.a);\n gl_FragColor = cW(ep);\n if(contrast != 1.) {\n gl_FragColor = contrastMatrix(contrast) * gl_FragColor;\n }\n if(length(hsv) > .0) {\n gl_FragColor = hsv_apply(gl_FragColor, hsv);\n }\n}",
12105
12112
  defines: r,
@@ -12120,10 +12127,10 @@
12120
12127
  };
12121
12128
  return this.setIncludeUniformValues(i, e), i;
12122
12129
  }
12123
- bo(t, e) {
12130
+ wo(t, e) {
12124
12131
  const {iblTexes: n} = this.getIBLRes(), i = t.projViewMatrix, r = t.getLightManager();
12125
12132
  let s = r && r.getDirectionalLight() || {};
12126
- const o = r && r.getAmbientLight() || {}, a = this.getSymbol(wl), l = this.Fo = this.Fo || [], h = {
12133
+ const o = r && r.getAmbientLight() || {}, a = this.getSymbol(wl), l = this.Io = this.Io || [], h = {
12127
12134
  hdrHsv: o.hsv || [ 0, 0, 0 ],
12128
12135
  specularPBR: n && n.prefilterMap,
12129
12136
  rgbmRange: n && n.rgbmRange,
@@ -12137,8 +12144,8 @@
12137
12144
  lightColor: s.color || bl.color,
12138
12145
  camPos: t.cameraPosition,
12139
12146
  timeElapsed: a.animation ? (this.layer.getRenderer().getFrameTimestamp() || 0) / (1 / (a.waterSpeed || 1) * 1e4) : 0,
12140
- normalTexture: this.Po || this.So,
12141
- heightTexture: this.Oo || this.So,
12147
+ normalTexture: this.To || this.ko,
12148
+ heightTexture: this.Fo || this.ko,
12142
12149
  waveParams: [ .09, a.uvScale || 3, .03, -.5 ],
12143
12150
  waterDir: Ml(l, a.waterDirection || 0),
12144
12151
  waterBaseColor: a.waterBaseColor || [ .1451, .2588, .4863, 1 ],
@@ -12149,24 +12156,24 @@
12149
12156
  h;
12150
12157
  }
12151
12158
  delete() {
12152
- super.delete(), this.So && (this.So.destroy(), delete this.So), this.Po && this.Po.destroy(),
12153
- this.Oo && this.Oo.destroy(), this.shader && this.shader.dispose(), this.wo && this.wo.dispose(),
12154
- this._o && (this._o.geometry.dispose(), this._o.material && this._o.material.dispose(),
12155
- this._o.dispose(), delete this._o), this.disposeIBLTextures();
12159
+ super.delete(), this.ko && (this.ko.destroy(), delete this.ko), this.To && this.To.destroy(),
12160
+ this.Fo && this.Fo.destroy(), this.shader && this.shader.dispose(), this.Ao && this.Ao.dispose(),
12161
+ this.Mo && (this.Mo.geometry.dispose(), this.Mo.material && this.Mo.material.dispose(),
12162
+ this.Mo.dispose(), delete this.Mo), this.disposeIBLTextures();
12156
12163
  }
12157
12164
  createGround() {
12158
12165
  const t = new n.reshader.Plane;
12159
12166
  t.data.aTexCoord = new Uint8Array([ 0, 1, 1, 1, 0, 0, 1, 0 ]), t.generateBuffers(this.renderer.regl),
12160
- this._o = new n.reshader.Mesh(t, null, {
12167
+ this.Mo = new n.reshader.Mesh(t, null, {
12161
12168
  castShadow: !1
12162
- }), this.Ao = new n.reshader.Scene([ this._o ]);
12169
+ }), this._o = new n.reshader.Scene([ this.Mo ]);
12163
12170
  }
12164
12171
  transformWater() {
12165
- const t = this.getMap(), e = n.GroundPainter.getGroundTransform(this._o.localTransform, t);
12166
- this._o.setLocalTransform(e);
12167
- const i = t._get2DExtentAtRes(t.getGLRes()), r = i.getWidth(), s = i.getHeight(), o = t.cameraLookAt, a = o[0] - r, l = o[1] + s, h = this.ko, c = a / h[0], u = l / h[1], f = c % 1, d = u % 1, p = .3737 * c % 1, y = .3737 * u % 1, m = i.getWidth() / h[0] * 2, g = i.getHeight() / h[1] * 2;
12168
- this._o.setUniform("uvOffset", [ f, d ]), this._o.setUniform("noiseUvOffset", [ p, y ]),
12169
- this._o.setUniform("uvScale", [ m, -g ]);
12172
+ const t = this.getMap(), e = n.GroundPainter.getGroundTransform(this.Mo.localTransform, t);
12173
+ this.Mo.setLocalTransform(e);
12174
+ const i = t._get2DExtentAtRes(t.getGLRes()), r = i.getWidth(), s = i.getHeight(), o = t.cameraLookAt, a = o[0] - r, l = o[1] + s, h = this.Po, c = a / h[0], u = l / h[1], f = c % 1, d = u % 1, p = .3737 * c % 1, y = .3737 * u % 1, m = i.getWidth() / h[0] * 2, g = i.getHeight() / h[1] * 2;
12175
+ this.Mo.setUniform("uvOffset", [ f, d ]), this.Mo.setUniform("noiseUvOffset", [ p, y ]),
12176
+ this.Mo.setUniform("uvScale", [ m, -g ]);
12170
12177
  }
12171
12178
  }
12172
12179
  function Ml(t, e) {
@@ -12197,7 +12204,7 @@
12197
12204
  Hl.registerAt(Qi);
12198
12205
  const Dl = ts("gltf-lit", xl);
12199
12206
  Dl.registerAt(Qi);
12200
- const Rl = ts("heatmap", class extends Vs {
12207
+ const Ll = ts("heatmap", class extends Vs {
12201
12208
  createFnTypeConfig(t, e) {
12202
12209
  const n = M(e.heatWeight), i = new Int16Array(1);
12203
12210
  return [ {
@@ -12238,7 +12245,7 @@
12238
12245
  o;
12239
12246
  }
12240
12247
  callRenderer(t, e) {
12241
- this.Io.render(this.scene, t, this.getRenderFBO(e));
12248
+ this.Co.render(this.scene, t, this.getRenderFBO(e));
12242
12249
  }
12243
12250
  getUniformValues(t) {
12244
12251
  const {projViewMatrix: e} = t;
@@ -12252,7 +12259,7 @@
12252
12259
  return this.scene.getMeshes();
12253
12260
  }
12254
12261
  delete() {
12255
- super.delete(...arguments), this.Io.dispose(), delete this.Io;
12262
+ super.delete(...arguments), this.Co.dispose(), delete this.Co;
12256
12263
  }
12257
12264
  init() {
12258
12265
  const t = this.regl;
@@ -12271,14 +12278,14 @@
12271
12278
  zpass: "replace"
12272
12279
  }
12273
12280
  }, r = this.getPolygonOffset(), s = this.getSymbols()[0];
12274
- this.Io = new n.HeatmapProcess(this.regl, this.sceneConfig, this.layer, s.heatmapColor, i, r);
12281
+ this.Co = new n.HeatmapProcess(this.regl, this.sceneConfig, this.layer, s.heatmapColor, i, r);
12275
12282
  }
12276
12283
  });
12277
- Rl.registerAt(Qi);
12278
- const Ll = ts("water", _l);
12279
- Ll.registerAt(Qi), cr.registerPainter("lit", ll), cr.registerPainter("icon", ya),
12284
+ Ll.registerAt(Qi);
12285
+ const Rl = ts("water", _l);
12286
+ Rl.registerAt(Qi), cr.registerPainter("lit", ll), cr.registerPainter("icon", ya),
12280
12287
  cr.registerPainter("fill", Ws), cr.registerPainter("line", Xs), cr.registerPainter("line-gradient", qs),
12281
- cr.registerPainter("water", _l), Qi.VERSION = "0.63.6", cr.VERSION = "0.63.6";
12288
+ cr.registerPainter("water", _l), Qi.VERSION = "0.63.9", cr.VERSION = "0.63.9";
12282
12289
  if (s.mat4.create(), s.transcoders) {
12283
12290
  const t = r.Map.VERSION;
12284
12291
  if (t.indexOf("1.0.0-beta") >= 0 || t.indexOf("1.0.0-alpha") >= 0) {
@@ -12289,14 +12296,14 @@
12289
12296
  }));
12290
12297
  } else r.registerWorkerAdapter("@maptalks/vt", o);
12291
12298
  t.FillPainter = Ws, t.FillPlugin = Sl, t.GLTFPhongPlugin = Hl, t.GLTFStandardPlugin = Dl,
12292
- t.GeoJSONVectorTileLayer = ar, t.HeatmapPlugin = Rl, t.IconPainter = ya, t.IconPlugin = Tl,
12299
+ t.GeoJSONVectorTileLayer = ar, t.HeatmapPlugin = Ll, t.IconPainter = ya, t.IconPlugin = Tl,
12293
12300
  t.LineGradientPlugin = Pl, t.LinePainter = Xs, t.LinePlugin = kl, t.LineStringLayer = Ir,
12294
12301
  t.LitPlugin = El, t.MapboxVectorTileLayer = sr, t.NativeLinePainter = Za, t.NativeLinePlugin = Fl,
12295
12302
  t.NativePointPainter = Ya, t.PackUtil = Pi, t.PhongPainter = il, t.PhongPlugin = Il,
12296
12303
  t.PointLayer = Fr, t.PolygonLayer = Cr, t.SYMBOLS_NEED_REBUILD_IN_VECTOR = Fi, t.SYMBOLS_NEED_REBUILD_IN_VT = Oi,
12297
12304
  t.TextPainter = Ua, t.TextPlugin = Ol, t.Vector3DLayer = cr, t.VectorTileLayer = Qi,
12298
- t.VectorTileLayerRenderer = ji, t.WaterPlugin = Ll, t.WireframePainter = sl, t.WireframePlugin = Cl,
12305
+ t.VectorTileLayerRenderer = ji, t.WaterPlugin = Rl, t.WireframePainter = sl, t.WireframePlugin = Cl,
12299
12306
  Object.defineProperty(t, "t", {
12300
12307
  value: !0
12301
- }), "undefined" != typeof console && console.log("@maptalks/vt v0.63.6");
12308
+ }), "undefined" != typeof console && console.log("@maptalks/vt v0.63.9");
12302
12309
  }));