@xweather/mapsgl 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/mapsgl.js ADDED
@@ -0,0 +1,19 @@
1
+ /*!
2
+ *
3
+ * @xweather/mapsgl - 1.8.0
4
+ * (c) 2025 Vaisala Xweather
5
+ * License: BSD
6
+ * https://www.xweather.com
7
+ *
8
+ */
9
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).mapsgl=t()}(this,(function(){"use strict";var e,t,i=0;function r(r){if(e){var a="self.onerror = function() { console.error('[AerisGL] An error occurred while parsing a WebWorker bundle.'); }; ("+r+")(); self.onerror = null;",s=window.URL.createObjectURL(new Blob([a],{type:"text/javascript"}));"undefined"!=typeof window&&window&&window.URL&&window.URL.createObjectURL&&(0===i?t.workers.addWorker("encoded",s):1===i&&t.workers.addWorker("vector",s)),i+=1}else e=r,t=r()}return r((()=>(()=>{var e,t,i={8642:(e,t,i)=>{i.d(t,{i:()=>s});var r=i(2133),a=i(6476);const s=e=>{if((0,a.g)(e))return;let t=0,i=0,s=0;if((0,r.K)(e)){const r=e.replace(/^#/,""),a=r.length;3===a?(t=Number.parseInt(r.charAt(0)+r.charAt(0),16),i=Number.parseInt(r.charAt(1)+r.charAt(1),16),s=Number.parseInt(r.charAt(2)+r.charAt(2),16)):6===a&&(t=Number.parseInt(r.charAt(0)+r.charAt(1),16),i=Number.parseInt(r.charAt(2)+r.charAt(3),16),s=Number.parseInt(r.charAt(4)+r.charAt(5),16))}else{const r=Math.floor(e);t=r>>16&255,i=r>>8&255,s=255&r}return{r:t,g:i,b:s,a:1}}},6424:(e,t,i)=>{i.d(t,{Q:()=>n});var r=i(3009),a=i(8799);const s=(e,t,i)=>(i<0&&(i+=1),i>1&&(i-=1),i<1/6?e+6*(t-e)*i:i<.5?t:i<2/3?e+(t-e)*(2/3-i)*6:e),n=e=>{if(!(0,r.eA)(e))return;let t,i,n,{h:o,s:l,l:h,a:c}=e;if(o=(0,a.S)(o,0,360),l=(0,a.S)(l,0,100),h=(0,a.S)(h,0,100),c=c||1,0===l)t=i=n=h;else{const e=h<.5?h*(1+l):h+l-h*l,r=2*h-e;t=s(r,e,o+1/3),i=s(r,e,o),n=s(r,e,o-1/3)}return{r:Math.round(255*t),g:Math.round(255*i),b:Math.round(255*n),a:c}}},7226:(e,t,i)=>{i.d(t,{E:()=>s});var r=i(3009),a=i(8799);const s=e=>{if(!(0,r.S9)(e))return;let{h:t,s:i,v:s,a:n}=e;t=6*(0,a.S)(t,0,360),i=(0,a.S)(i,0,100),s=(0,a.S)(s,0,100),n=n||1;const o=Math.floor(t),l=t-o,h=s*(1-i),c=s*(1-l*i),d=s*(1-(1-l)*i),u=o%6,p=[d,s,s,c,h,h][u],f=[h,h,d,s,s,c][u];return{r:Math.round(255*[s,c,h,h,d,s][u]),g:Math.round(255*p),b:Math.round(255*f),a:n}}},3009:(e,t,i)=>{i.d(t,{IB:()=>a,S9:()=>n,eA:()=>s});var r=i(2717);const a=e=>(0,r.x)(e,["r","g","b"]),s=e=>(0,r.x)(e,["h","s","l"]),n=e=>(0,r.x)(e,["h","s","v"])},681:(e,t,i)=>{i.d(t,{$:()=>u});var r=i(2527),a=i(2133),s=i(6476),n=i(8642),o=i(6424),l=i(7226),h=i(3009),c=i(7847),d=i(8377);const u=e=>{if((0,h.IB)(e))return e;if((0,h.eA)(e))return(0,o.Q)(e);if((0,h.S9)(e))return(0,l.E)(e);if((0,a.K)(e)){const t=/^(rgb|hsl|hsv)a?\((\d+),\s*([\d%]+),\s*([\d%]+)(?:,\s*(\d+(?:\.\d+)?))?\)$/.exec(`${e}`);if(t&&t.length>=5){const e=t[1],i=(0,s.n)(t[5])?Number.parseFloat(t[5]):1,a=t.slice(2,5).map((e=>(0,c.fp)(e)?e:Number.parseInt(e,10)));if("rgb"===e||"rgba"===e)return{r:(0,r.q)(a[0],0,255),g:(0,r.q)(a[1],0,255),b:(0,r.q)(a[2],0,255),a:i};if("hsl"===e)return(0,o.Q)({h:a[0],s:a[1],l:a[2],a:i});if("hsv"===e)return(0,l.E)({h:a[0],s:a[1],v:a[2],a:i})}else if(/^#?([\dA-Fa-f]+)$/.test(e))return(0,n.i)(e)}return(0,d.E)(e)?(0,n.i)(e):void 0}},9003:(e,t,i)=>{i.d(t,{A:()=>a});var r=i(2661);const a=class{constructor(e,t){this.type=e,t=Object.assign({},t),(0,r.H)(t).forEach((e=>{this[e]=t[e]}))}}},4818:(e,t,i)=>{i.d(t,{A:()=>n});var r=i(2133),a=i(9003);const s=e=>"object"==typeof e&&"type"in e,n=class{constructor({validEventTypes:e=[/.*/],triggerLastEvent:t=!1}={}){this.callbacks={},this.lastEvents={},this.validEventTypes=e,this.triggerLastEvent=t,this.callbackContext=this}setCallbackContext(e){return this.callbackContext=e,this}on(e,t,i,a){if((0,r.K)(e)&&/\s+/.test(e))return e.split(" ").forEach((e=>{this.on(e,t,i,a)})),this;if(this.validateEventType(e),this.hasListener(e)||(this.callbacks[e]=new Set),this.callbacks[e].add({callback:t,context:a}),(null==i?void 0:i.triggerLastEvent)||this.triggerLastEvent){const i=this.lastEvents[e];i&&t.call(a||this.callbackContext||this,i)}return this}once(e,t,i,a){if((0,r.K)(e)&&/\s+/.test(e))return e.split(" ").forEach((e=>{this.once(e,t,i,a)})),this;this.validateEventType(e);const s=i=>(this.off(e,s),t.call(a||this.callbackContext||this,i));return this.on(e,s,i,a)}off(e,t){if((0,r.K)(e)&&/\s+/.test(e))return e.split(" ").forEach((e=>{this.off(e,t)})),this;if(this.validateEventType(e),!this.hasCallbacks(e))return this;if(!t)return delete this.callbacks[e],this;for(const i of this.callbacks[e])if(i.callback===t){this.callbacks[e].delete(i);break}return this}trigger(e,t){const i=s(e)?e:new a.A(e,t||{}),r=s(e)?e.type:e;i.target=this,this.validateEventType(r),this.lastEvents[r]=i;const n=this.callbacksForEvent(r);if(n)return[...n].map((({callback:e,context:t})=>e.call(t||this.callbackContext||this,i)))}hasListener(e){return e in this.callbacks}clearListeners(){return this.callbacks={},this}addEventListener(e,t,i,r){return this.on(e,t,i)}removeEventListener(e,t,i){return this.off(e,t)}dispatchEvent(e,t){return this.trigger(e,t)}validateEventType(e){if(!this.isValidEvent(e)){const t=this.validEventTypes.join("|");throw new Error(`Invalid event type {${e}}.\nEvent type should be any of: ${t}.`)}}isValidEvent(e){const t=Array.isArray(e)?e:[e];let i=0;for(const r of t)for(const a of this.validEventTypes)if((a instanceof RegExp?a.test(r):e===a)&&(i+=1,i===t.length))return!0;return!1}hasCallbacks(e){return e in this.callbacks}callbacksForEvent(e){return this.callbacks[e]}}},2527:(e,t,i)=>{i.d(t,{q:()=>r});const r=(e,t,i)=>Math.min(Math.max(e,t),i)},7411:(e,t,i)=>{i.d(t,{C:()=>r});const r=(e,t,i)=>(1-i)*e+i*t},8799:(e,t,i)=>{i.d(t,{S:()=>s});var r=i(2527),a=i(7847);const s=(e,t,i)=>{const s=(0,a.fp)(e),n=i-t;return e=(0,r.q)(Number.parseFloat(`${e}`),t,i),s&&(e=Number.parseInt(""+e*i,10)/100),Math.abs(e-i)<1e-6?1:e%n/n}},1798:(e,t,i)=>{i.d(t,{H:()=>a,p:()=>r});const r=e=>e*(Math.PI/180),a=e=>e*(180/Math.PI)},5711:(e,t,i)=>{i.d(t,{$:()=>s});const r=e=>e&&"object"==typeof e,a=(e,t)=>(Object.keys(t).forEach((i=>{const s=e[i],n=t[i];e[i]=Array.isArray(s)&&Array.isArray(n)?[...s,...n]:r(s)&&r(n)?a(Object.assign({},s),n):n})),e),s=(...e)=>{if(e.length<2)throw new Error("deepMerge: this function expects at least 2 objects to be provided");if(e.some((e=>!r(e))))throw new Error('deepMerge: all values should be of type "object"');const t=e.shift();let i;for(;i=e.shift();)a(t,i);return t}},1045:(e,t,i)=>{i.d(t,{J:()=>n});var r=i(7922),a=i(6476),s=i(2133);const n=(e,t,i)=>{if(null==e||(0,a.g)(t)||!(0,s.K)(t))return i;const n=t.split(/["'.[\]]{1,2}/),o=n.length;for(let t=0;t<o;t+=1)if(!(0,r.I)(n[t])&&null==(e=e[n[t]]))return i;return null==e?i:e}},2717:(e,t,i)=>{i.d(t,{x:()=>n});var r=i(2123),a=i(1739),s=i(6232);const n=(e,t)=>{if(!(0,r.c)(t)||(0,s.E)(e)||!(0,a.G)(e))return!1;let i=!0;return t.forEach((t=>{!1===e.hasOwnProperty(t)&&(i=!1)})),i}},2661:(e,t,i)=>{i.d(t,{H:()=>s});var r=i(5096),a=i(6476);const s=e=>(0,a.n)(e)&&"object"===(0,r.N)(e)?Object.getOwnPropertyNames(e):[]},8385:(e,t,i)=>{i.d(t,{h:()=>a});var r=i(6476);const a=(e,t,i)=>{if((0,r.g)(t))return e;const a=t.split("."),s=a.length-1;let n;for(n=0;n<s;n+=1)e[a[n]]=e[a[n]]||{},e=e[a[n]];return e[a[n]]=i,e}},7847:(e,t,i)=>{i.d(t,{fp:()=>a});var r=i(2133);const a=e=>(0,r.K)(e)&&e.includes("%")},6694:(e,t,i)=>{i.d(t,{C:()=>s});var r=i(2133),a=i(6232);const s=e=>(0,a.Z)(e)&&(0,r.K)(e)?e.replace(/(?:^|\s)\S/g,(e=>e.toUpperCase())):""},2123:(e,t,i)=>{i.d(t,{c:()=>a});var r=i(5096);const a=e=>"array"===(0,r.N)(e)},9688:(e,t,i)=>{i.d(t,{$:()=>a});var r=i(5096);const a=e=>"date"===(0,r.N)(e)},8377:(e,t,i)=>{i.d(t,{E:()=>a});var r=i(5096);const a=e=>"number"===(0,r.N)(e)},1739:(e,t,i)=>{i.d(t,{G:()=>a});var r=i(5096);const a=e=>"object"===(0,r.N)(e)},2133:(e,t,i)=>{i.d(t,{K:()=>a});var r=i(5096);const a=e=>"string"===(0,r.N)(e)},5096:(e,t,i)=>{i.d(t,{N:()=>r});const r=e=>Array.isArray(e)?"array":e instanceof Date?"date":typeof e},7028:(e,t,i)=>{i.d(t,{s:()=>r});const r=(e,t,i=!1)=>{let r;return function(...a){const s=this,n=i&&void 0===r;void 0!==r&&clearTimeout(r),r=setTimeout((()=>{r=void 0,i||e.apply(s,a)}),t),n&&e.apply(s,a)}}},7922:(e,t,i)=>{i.d(t,{I:()=>a,h:()=>s});var r=i(5096);const a=e=>{switch((0,r.N)(e)){case"array":case"string":return 0===e.length;case"date":case"boolean":case"number":case"function":case"symbol":return!1;case"object":return 0===Object.keys(e).length;default:return!0}},s=e=>!a(e)},6476:(e,t,i)=>{i.d(t,{g:()=>r,n:()=>a});const r=e=>null==e,a=e=>!r(e)},6232:(e,t,i)=>{i.d(t,{E:()=>s,Z:()=>n});var r=i(7922),a=i(6476);const s=e=>(0,a.g)(e)||(0,r.I)(e),n=e=>!s(e)},6570:e=>{function t(e,t,r){r=r||2;var s,n,o,l,d,u,f,m=t&&t.length,g=m?t[0]*r:e.length,v=i(e,0,g,r,!0),y=[];if(!v||v.next===v.prev)return y;if(m&&(v=function(e,t,r,a){var s,n,o,l=[];for(s=0,n=t.length;s<n;s++)(o=i(e,t[s]*a,s<n-1?t[s+1]*a:e.length,a,!1))===o.next&&(o.steiner=!0),l.push(p(o));for(l.sort(h),s=0;s<l.length;s++)r=c(l[s],r);return r}(e,t,v,r)),e.length>80*r){s=o=e[0],n=l=e[1];for(var x=r;x<g;x+=r)(d=e[x])<s&&(s=d),(u=e[x+1])<n&&(n=u),d>o&&(o=d),u>l&&(l=u);f=0!==(f=Math.max(o-s,l-n))?32767/f:0}return a(v,y,r,s,n,f,0),y}function i(e,t,i,r,a){var s,n;if(a===E(e,t,i,r)>0)for(s=t;s<i;s+=r)n=A(s,e[s],e[s+1],n);else for(s=i-r;s>=t;s-=r)n=A(s,e[s],e[s+1],n);return n&&v(n,n.next)&&(M(n),n=n.next),n}function r(e,t){if(!e)return e;t||(t=e);var i,r=e;do{if(i=!1,r.steiner||!v(r,r.next)&&0!==g(r.prev,r,r.next))r=r.next;else{if(M(r),(r=t=r.prev)===r.next)break;i=!0}}while(i||r!==t);return t}function a(e,t,i,h,c,d,p){if(e){!p&&d&&function(e,t,i,r){var a=e;do{0===a.z&&(a.z=u(a.x,a.y,t,i,r)),a.prevZ=a.prev,a.nextZ=a.next,a=a.next}while(a!==e);a.prevZ.nextZ=null,a.prevZ=null,function(e){var t,i,r,a,s,n,o,l,h=1;do{for(i=e,e=null,s=null,n=0;i;){for(n++,r=i,o=0,t=0;t<h&&(o++,r=r.nextZ);t++);for(l=h;o>0||l>0&&r;)0!==o&&(0===l||!r||i.z<=r.z)?(a=i,i=i.nextZ,o--):(a=r,r=r.nextZ,l--),s?s.nextZ=a:e=a,a.prevZ=s,s=a;i=r}s.nextZ=null,h*=2}while(n>1)}(a)}(e,h,c,d);for(var f,m,g=e;e.prev!==e.next;)if(f=e.prev,m=e.next,d?n(e,h,c,d):s(e))t.push(f.i/i|0),t.push(e.i/i|0),t.push(m.i/i|0),M(e),e=m.next,g=m.next;else if((e=m)===g){p?1===p?a(e=o(r(e),t,i),t,i,h,c,d,2):2===p&&l(e,t,i,h,c,d):a(r(e),t,i,h,c,d,1);break}}}function s(e){var t=e.prev,i=e,r=e.next;if(g(t,i,r)>=0)return!1;for(var a=t.x,s=i.x,n=r.x,o=t.y,l=i.y,h=r.y,c=a<s?a<n?a:n:s<n?s:n,d=o<l?o<h?o:h:l<h?l:h,u=a>s?a>n?a:n:s>n?s:n,p=o>l?o>h?o:h:l>h?l:h,m=r.next;m!==t;){if(m.x>=c&&m.x<=u&&m.y>=d&&m.y<=p&&f(a,o,s,l,n,h,m.x,m.y)&&g(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function n(e,t,i,r){var a=e.prev,s=e,n=e.next;if(g(a,s,n)>=0)return!1;for(var o=a.x,l=s.x,h=n.x,c=a.y,d=s.y,p=n.y,m=o<l?o<h?o:h:l<h?l:h,v=c<d?c<p?c:p:d<p?d:p,y=o>l?o>h?o:h:l>h?l:h,x=c>d?c>p?c:p:d>p?d:p,b=u(m,v,t,i,r),w=u(y,x,t,i,r),_=e.prevZ,A=e.nextZ;_&&_.z>=b&&A&&A.z<=w;){if(_.x>=m&&_.x<=y&&_.y>=v&&_.y<=x&&_!==a&&_!==n&&f(o,c,l,d,h,p,_.x,_.y)&&g(_.prev,_,_.next)>=0)return!1;if(_=_.prevZ,A.x>=m&&A.x<=y&&A.y>=v&&A.y<=x&&A!==a&&A!==n&&f(o,c,l,d,h,p,A.x,A.y)&&g(A.prev,A,A.next)>=0)return!1;A=A.nextZ}for(;_&&_.z>=b;){if(_.x>=m&&_.x<=y&&_.y>=v&&_.y<=x&&_!==a&&_!==n&&f(o,c,l,d,h,p,_.x,_.y)&&g(_.prev,_,_.next)>=0)return!1;_=_.prevZ}for(;A&&A.z<=w;){if(A.x>=m&&A.x<=y&&A.y>=v&&A.y<=x&&A!==a&&A!==n&&f(o,c,l,d,h,p,A.x,A.y)&&g(A.prev,A,A.next)>=0)return!1;A=A.nextZ}return!0}function o(e,t,i){var a=e;do{var s=a.prev,n=a.next.next;!v(s,n)&&y(s,a,a.next,n)&&w(s,n)&&w(n,s)&&(t.push(s.i/i|0),t.push(a.i/i|0),t.push(n.i/i|0),M(a),M(a.next),a=e=n),a=a.next}while(a!==e);return r(a)}function l(e,t,i,s,n,o){var l=e;do{for(var h=l.next.next;h!==l.prev;){if(l.i!==h.i&&m(l,h)){var c=_(l,h);return l=r(l,l.next),c=r(c,c.next),a(l,t,i,s,n,o,0),void a(c,t,i,s,n,o,0)}h=h.next}l=l.next}while(l!==e)}function h(e,t){return e.x-t.x}function c(e,t){var i=function(e,t){var i,r=t,a=e.x,s=e.y,n=-1/0;do{if(s<=r.y&&s>=r.next.y&&r.next.y!==r.y){var o=r.x+(s-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(o<=a&&o>n&&(n=o,i=r.x<r.next.x?r:r.next,o===a))return i}r=r.next}while(r!==t);if(!i)return null;var l,h=i,c=i.x,u=i.y,p=1/0;r=i;do{a>=r.x&&r.x>=c&&a!==r.x&&f(s<u?a:n,s,c,u,s<u?n:a,s,r.x,r.y)&&(l=Math.abs(s-r.y)/(a-r.x),w(r,e)&&(l<p||l===p&&(r.x>i.x||r.x===i.x&&d(i,r)))&&(i=r,p=l)),r=r.next}while(r!==h);return i}(e,t);if(!i)return t;var a=_(i,e);return r(a,a.next),r(i,i.next)}function d(e,t){return g(e.prev,e,t.prev)<0&&g(t.next,e,e.next)<0}function u(e,t,i,r,a){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-i)*a|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-r)*a|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function p(e){var t=e,i=e;do{(t.x<i.x||t.x===i.x&&t.y<i.y)&&(i=t),t=t.next}while(t!==e);return i}function f(e,t,i,r,a,s,n,o){return(a-n)*(t-o)>=(e-n)*(s-o)&&(e-n)*(r-o)>=(i-n)*(t-o)&&(i-n)*(s-o)>=(a-n)*(r-o)}function m(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var i=e;do{if(i.i!==e.i&&i.next.i!==e.i&&i.i!==t.i&&i.next.i!==t.i&&y(i,i.next,e,t))return!0;i=i.next}while(i!==e);return!1}(e,t)&&(w(e,t)&&w(t,e)&&function(e,t){var i=e,r=!1,a=(e.x+t.x)/2,s=(e.y+t.y)/2;do{i.y>s!=i.next.y>s&&i.next.y!==i.y&&a<(i.next.x-i.x)*(s-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next}while(i!==e);return r}(e,t)&&(g(e.prev,e,t.prev)||g(e,t.prev,t))||v(e,t)&&g(e.prev,e,e.next)>0&&g(t.prev,t,t.next)>0)}function g(e,t,i){return(t.y-e.y)*(i.x-t.x)-(t.x-e.x)*(i.y-t.y)}function v(e,t){return e.x===t.x&&e.y===t.y}function y(e,t,i,r){var a=b(g(e,t,i)),s=b(g(e,t,r)),n=b(g(i,r,e)),o=b(g(i,r,t));return a!==s&&n!==o||!(0!==a||!x(e,i,t))||!(0!==s||!x(e,r,t))||!(0!==n||!x(i,e,r))||!(0!==o||!x(i,t,r))}function x(e,t,i){return t.x<=Math.max(e.x,i.x)&&t.x>=Math.min(e.x,i.x)&&t.y<=Math.max(e.y,i.y)&&t.y>=Math.min(e.y,i.y)}function b(e){return e>0?1:e<0?-1:0}function w(e,t){return g(e.prev,e,e.next)<0?g(e,t,e.next)>=0&&g(e,e.prev,t)>=0:g(e,t,e.prev)<0||g(e,e.next,t)<0}function _(e,t){var i=new T(e.i,e.x,e.y),r=new T(t.i,t.x,t.y),a=e.next,s=t.prev;return e.next=t,t.prev=e,i.next=a,a.prev=i,r.next=i,i.prev=r,s.next=r,r.prev=s,r}function A(e,t,i,r){var a=new T(e,t,i);return r?(a.next=r.next,a.prev=r,r.next.prev=a,r.next=a):(a.prev=a,a.next=a),a}function M(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function T(e,t,i){this.i=e,this.x=t,this.y=i,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function E(e,t,i,r){for(var a=0,s=t,n=i-r;s<i;s+=r)a+=(e[n]-e[s])*(e[s+1]+e[n+1]),n=s;return a}e.exports=t,e.exports.default=t,t.deviation=function(e,t,i,r){var a=t&&t.length,s=Math.abs(E(e,0,a?t[0]*i:e.length,i));if(a)for(var n=0,o=t.length;n<o;n++)s-=Math.abs(E(e,t[n]*i,n<o-1?t[n+1]*i:e.length,i));var l=0;for(n=0;n<r.length;n+=3){var h=r[n]*i,c=r[n+1]*i,d=r[n+2]*i;l+=Math.abs((e[h]-e[d])*(e[c+1]-e[h+1])-(e[h]-e[c])*(e[d+1]-e[h+1]))}return 0===s&&0===l?0:Math.abs((l-s)/s)},t.flatten=function(e){for(var t=e[0][0].length,i={vertices:[],holes:[],dimensions:t},r=0,a=0;a<e.length;a++){for(var s=0;s<e[a].length;s++)for(var n=0;n<t;n++)i.vertices.push(e[a][s][n]);a>0&&i.holes.push(r+=e[a-1].length)}return i}},7823:(e,t,i)=>{i.d(t,{p8:()=>r,tb:()=>a});var r=1e-6,a="undefined"!=typeof Float32Array?Float32Array:Array;Math,Math,Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)})},1409:(e,t,i)=>{i.d(t,{B8:()=>l,D_:()=>n,Ge:()=>f,Ny:()=>g,Tl:()=>d,a4:()=>h,aI:()=>v,e$:()=>u,gx:()=>m,hZ:()=>s,hs:()=>p,lw:()=>c,mg:()=>o,vt:()=>a});var r=i(7823);function a(){var e=new r.tb(9);return r.tb!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function s(e,t,i,r,a,s,n,o,l,h){return e[0]=t,e[1]=i,e[2]=r,e[3]=a,e[4]=s,e[5]=n,e[6]=o,e[7]=l,e[8]=h,e}function n(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function o(e,t){if(e===t){var i=t[1],r=t[2],a=t[5];e[1]=t[3],e[2]=t[6],e[3]=i,e[5]=t[7],e[6]=r,e[7]=a}else e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8];return e}function l(e,t){var i=t[0],r=t[1],a=t[2],s=t[3],n=t[4],o=t[5],l=t[6],h=t[7],c=t[8],d=c*n-o*h,u=-c*s+o*l,p=h*s-n*l,f=i*d+r*u+a*p;return f?(e[0]=d*(f=1/f),e[1]=(-c*r+a*h)*f,e[2]=(o*r-a*n)*f,e[3]=u*f,e[4]=(c*i-a*l)*f,e[5]=(-o*i+a*s)*f,e[6]=p*f,e[7]=(-h*i+r*l)*f,e[8]=(n*i-r*s)*f,e):null}function h(e){var t=e[3],i=e[4],r=e[5],a=e[6],s=e[7],n=e[8];return e[0]*(n*i-r*s)+e[1]*(-n*t+r*a)+e[2]*(s*t-i*a)}function c(e,t,i){var r=t[0],a=t[1],s=t[2],n=t[3],o=t[4],l=t[5],h=t[6],c=t[7],d=t[8],u=i[0],p=i[1],f=i[2],m=i[3],g=i[4],v=i[5],y=i[6],x=i[7],b=i[8];return e[0]=u*r+p*n+f*h,e[1]=u*a+p*o+f*c,e[2]=u*s+p*l+f*d,e[3]=m*r+g*n+v*h,e[4]=m*a+g*o+v*c,e[5]=m*s+g*l+v*d,e[6]=y*r+x*n+b*h,e[7]=y*a+x*o+b*c,e[8]=y*s+x*l+b*d,e}function d(e,t,i){var r=t[0],a=t[1],s=t[2],n=t[3],o=t[4],l=t[5],h=t[6],c=t[7],d=t[8],u=i[0],p=i[1];return e[0]=r,e[1]=a,e[2]=s,e[3]=n,e[4]=o,e[5]=l,e[6]=u*r+p*n+h,e[7]=u*a+p*o+c,e[8]=u*s+p*l+d,e}function u(e,t,i){var r=t[0],a=t[1],s=t[2],n=t[3],o=t[4],l=t[5],h=t[6],c=t[7],d=t[8],u=Math.sin(i),p=Math.cos(i);return e[0]=p*r+u*n,e[1]=p*a+u*o,e[2]=p*s+u*l,e[3]=p*n-u*r,e[4]=p*o-u*a,e[5]=p*l-u*s,e[6]=h,e[7]=c,e[8]=d,e}function p(e,t,i){var r=i[0],a=i[1];return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=a*t[3],e[4]=a*t[4],e[5]=a*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function f(e,t){var i=t[0],r=t[1],a=t[2],s=t[3],n=t[4],o=t[5],l=t[6],h=t[7],c=t[8],d=t[9],u=t[10],p=t[11],f=t[12],m=t[13],g=t[14],v=t[15],y=i*o-r*n,x=i*l-a*n,b=i*h-s*n,w=r*l-a*o,_=r*h-s*o,A=a*h-s*l,M=c*m-d*f,T=c*g-u*f,E=c*v-p*f,S=d*g-u*m,C=d*v-p*m,O=u*v-p*g,R=y*O-x*C+b*S+w*E-_*T+A*M;return R?(e[0]=(o*O-l*C+h*S)*(R=1/R),e[1]=(l*E-n*O-h*T)*R,e[2]=(n*C-o*E+h*M)*R,e[3]=(a*C-r*O-s*S)*R,e[4]=(i*O-a*E+s*T)*R,e[5]=(r*E-i*C-s*M)*R,e[6]=(m*A-g*_+v*w)*R,e[7]=(g*b-f*A-v*x)*R,e[8]=(f*_-m*b+v*y)*R,e):null}function m(e){return"mat3("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+")"}function g(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e[4]=t[4]*i,e[5]=t[5]*i,e[6]=t[6]*i,e[7]=t[7]*i,e[8]=t[8]*i,e}function v(e,t){var i=e[0],a=e[1],s=e[2],n=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=t[0],p=t[1],f=t[2],m=t[3],g=t[4],v=t[5],y=t[6],x=t[7],b=t[8];return Math.abs(i-u)<=r.p8*Math.max(1,Math.abs(i),Math.abs(u))&&Math.abs(a-p)<=r.p8*Math.max(1,Math.abs(a),Math.abs(p))&&Math.abs(s-f)<=r.p8*Math.max(1,Math.abs(s),Math.abs(f))&&Math.abs(n-m)<=r.p8*Math.max(1,Math.abs(n),Math.abs(m))&&Math.abs(o-g)<=r.p8*Math.max(1,Math.abs(o),Math.abs(g))&&Math.abs(l-v)<=r.p8*Math.max(1,Math.abs(l),Math.abs(v))&&Math.abs(h-y)<=r.p8*Math.max(1,Math.abs(h),Math.abs(y))&&Math.abs(c-x)<=r.p8*Math.max(1,Math.abs(c),Math.abs(x))&&Math.abs(d-b)<=r.p8*Math.max(1,Math.abs(d),Math.abs(b))}},7684:(e,t,i)=>{i.d(t,{$h:()=>T,B8:()=>o,CV:()=>g,D_:()=>s,I0:()=>M,IL:()=>w,N9:()=>x,Ny:()=>I,Qr:()=>f,Tl:()=>c,Z8:()=>p,a4:()=>l,aI:()=>P,eL:()=>u,fN:()=>E,gx:()=>R,hM:()=>v,hs:()=>d,i1:()=>y,kN:()=>m,l:()=>_,lw:()=>h,mg:()=>n,o1:()=>A,sC:()=>b,t5:()=>C,v3:()=>S,vt:()=>a,xI:()=>O});var r=i(7823);function a(){var e=new r.tb(16);return r.tb!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function s(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function n(e,t){if(e===t){var i=t[1],r=t[2],a=t[3],s=t[6],n=t[7],o=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=i,e[6]=t[9],e[7]=t[13],e[8]=r,e[9]=s,e[11]=t[14],e[12]=a,e[13]=n,e[14]=o}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e}function o(e,t){var i=t[0],r=t[1],a=t[2],s=t[3],n=t[4],o=t[5],l=t[6],h=t[7],c=t[8],d=t[9],u=t[10],p=t[11],f=t[12],m=t[13],g=t[14],v=t[15],y=i*o-r*n,x=i*l-a*n,b=i*h-s*n,w=r*l-a*o,_=r*h-s*o,A=a*h-s*l,M=c*m-d*f,T=c*g-u*f,E=c*v-p*f,S=d*g-u*m,C=d*v-p*m,O=u*v-p*g,R=y*O-x*C+b*S+w*E-_*T+A*M;return R?(e[0]=(o*O-l*C+h*S)*(R=1/R),e[1]=(a*C-r*O-s*S)*R,e[2]=(m*A-g*_+v*w)*R,e[3]=(u*_-d*A-p*w)*R,e[4]=(l*E-n*O-h*T)*R,e[5]=(i*O-a*E+s*T)*R,e[6]=(g*b-f*A-v*x)*R,e[7]=(c*A-u*b+p*x)*R,e[8]=(n*C-o*E+h*M)*R,e[9]=(r*E-i*C-s*M)*R,e[10]=(f*_-m*b+v*y)*R,e[11]=(d*b-c*_-p*y)*R,e[12]=(o*T-n*S-l*M)*R,e[13]=(i*S-r*T+a*M)*R,e[14]=(m*x-f*w-g*y)*R,e[15]=(c*w-d*x+u*y)*R,e):null}function l(e){var t=e[0],i=e[1],r=e[2],a=e[3],s=e[4],n=e[5],o=e[6],l=e[7],h=e[8],c=e[9],d=e[10],u=e[11],p=e[12],f=e[13],m=e[14],g=e[15];return(t*n-i*s)*(d*g-u*m)-(t*o-r*s)*(c*g-u*f)+(t*l-a*s)*(c*m-d*f)+(i*o-r*n)*(h*g-u*p)-(i*l-a*n)*(h*m-d*p)+(r*l-a*o)*(h*f-c*p)}function h(e,t,i){var r=t[0],a=t[1],s=t[2],n=t[3],o=t[4],l=t[5],h=t[6],c=t[7],d=t[8],u=t[9],p=t[10],f=t[11],m=t[12],g=t[13],v=t[14],y=t[15],x=i[0],b=i[1],w=i[2],_=i[3];return e[0]=x*r+b*o+w*d+_*m,e[1]=x*a+b*l+w*u+_*g,e[2]=x*s+b*h+w*p+_*v,e[3]=x*n+b*c+w*f+_*y,e[4]=(x=i[4])*r+(b=i[5])*o+(w=i[6])*d+(_=i[7])*m,e[5]=x*a+b*l+w*u+_*g,e[6]=x*s+b*h+w*p+_*v,e[7]=x*n+b*c+w*f+_*y,e[8]=(x=i[8])*r+(b=i[9])*o+(w=i[10])*d+(_=i[11])*m,e[9]=x*a+b*l+w*u+_*g,e[10]=x*s+b*h+w*p+_*v,e[11]=x*n+b*c+w*f+_*y,e[12]=(x=i[12])*r+(b=i[13])*o+(w=i[14])*d+(_=i[15])*m,e[13]=x*a+b*l+w*u+_*g,e[14]=x*s+b*h+w*p+_*v,e[15]=x*n+b*c+w*f+_*y,e}function c(e,t,i){var r,a,s,n,o,l,h,c,d,u,p,f,m=i[0],g=i[1],v=i[2];return t===e?(e[12]=t[0]*m+t[4]*g+t[8]*v+t[12],e[13]=t[1]*m+t[5]*g+t[9]*v+t[13],e[14]=t[2]*m+t[6]*g+t[10]*v+t[14],e[15]=t[3]*m+t[7]*g+t[11]*v+t[15]):(a=t[1],s=t[2],n=t[3],o=t[4],l=t[5],h=t[6],c=t[7],d=t[8],u=t[9],p=t[10],f=t[11],e[0]=r=t[0],e[1]=a,e[2]=s,e[3]=n,e[4]=o,e[5]=l,e[6]=h,e[7]=c,e[8]=d,e[9]=u,e[10]=p,e[11]=f,e[12]=r*m+o*g+d*v+t[12],e[13]=a*m+l*g+u*v+t[13],e[14]=s*m+h*g+p*v+t[14],e[15]=n*m+c*g+f*v+t[15]),e}function d(e,t,i){var r=i[0],a=i[1],s=i[2];return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*a,e[5]=t[5]*a,e[6]=t[6]*a,e[7]=t[7]*a,e[8]=t[8]*s,e[9]=t[9]*s,e[10]=t[10]*s,e[11]=t[11]*s,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function u(e,t,i){var r=Math.sin(i),a=Math.cos(i),s=t[4],n=t[5],o=t[6],l=t[7],h=t[8],c=t[9],d=t[10],u=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=s*a+h*r,e[5]=n*a+c*r,e[6]=o*a+d*r,e[7]=l*a+u*r,e[8]=h*a-s*r,e[9]=c*a-n*r,e[10]=d*a-o*r,e[11]=u*a-l*r,e}function p(e,t,i){var r=Math.sin(i),a=Math.cos(i),s=t[0],n=t[1],o=t[2],l=t[3],h=t[8],c=t[9],d=t[10],u=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=s*a-h*r,e[1]=n*a-c*r,e[2]=o*a-d*r,e[3]=l*a-u*r,e[8]=s*r+h*a,e[9]=n*r+c*a,e[10]=o*r+d*a,e[11]=l*r+u*a,e}function f(e,t,i){var r=Math.sin(i),a=Math.cos(i),s=t[0],n=t[1],o=t[2],l=t[3],h=t[4],c=t[5],d=t[6],u=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=s*a+h*r,e[1]=n*a+c*r,e[2]=o*a+d*r,e[3]=l*a+u*r,e[4]=h*a-s*r,e[5]=c*a-n*r,e[6]=d*a-o*r,e[7]=u*a-l*r,e}function m(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=t[0],e[13]=t[1],e[14]=t[2],e[15]=1,e}function g(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function v(e,t){var i=Math.sin(t),r=Math.cos(t);return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=r,e[6]=i,e[7]=0,e[8]=0,e[9]=-i,e[10]=r,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function y(e,t){var i=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=0,e[2]=-i,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=i,e[9]=0,e[10]=r,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function x(e,t){var i=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=i,e[2]=0,e[3]=0,e[4]=-i,e[5]=r,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function b(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}function w(e,t){var i=t[4],r=t[5],a=t[6],s=t[8],n=t[9],o=t[10];return e[0]=Math.hypot(t[0],t[1],t[2]),e[1]=Math.hypot(i,r,a),e[2]=Math.hypot(s,n,o),e}function _(e,t){var i=new r.tb(3);w(i,t);var a=1/i[0],s=1/i[1],n=1/i[2],o=t[0]*a,l=t[1]*s,h=t[2]*n,c=t[4]*a,d=t[5]*s,u=t[6]*n,p=t[8]*a,f=t[9]*s,m=t[10]*n,g=o+d+m,v=0;return g>0?(v=2*Math.sqrt(g+1),e[3]=.25*v,e[0]=(u-f)/v,e[1]=(p-h)/v,e[2]=(l-c)/v):o>d&&o>m?(v=2*Math.sqrt(1+o-d-m),e[3]=(u-f)/v,e[0]=.25*v,e[1]=(l+c)/v,e[2]=(p+h)/v):d>m?(v=2*Math.sqrt(1+d-o-m),e[3]=(p-h)/v,e[0]=(l+c)/v,e[1]=.25*v,e[2]=(u+f)/v):(v=2*Math.sqrt(1+m-o-d),e[3]=(l-c)/v,e[0]=(p+h)/v,e[1]=(u+f)/v,e[2]=.25*v),e}function A(e,t,i,r){var a=t[0],s=t[1],n=t[2],o=t[3],l=a+a,h=s+s,c=n+n,d=a*l,u=a*h,p=a*c,f=s*h,m=s*c,g=n*c,v=o*l,y=o*h,x=o*c,b=r[0],w=r[1],_=r[2];return e[0]=(1-(f+g))*b,e[1]=(u+x)*b,e[2]=(p-y)*b,e[3]=0,e[4]=(u-x)*w,e[5]=(1-(d+g))*w,e[6]=(m+v)*w,e[7]=0,e[8]=(p+y)*_,e[9]=(m-v)*_,e[10]=(1-(d+f))*_,e[11]=0,e[12]=i[0],e[13]=i[1],e[14]=i[2],e[15]=1,e}function M(e,t){var i=t[0],r=t[1],a=t[2],s=t[3],n=i+i,o=r+r,l=a+a,h=i*n,c=r*n,d=r*o,u=a*n,p=a*o,f=a*l,m=s*n,g=s*o,v=s*l;return e[0]=1-d-f,e[1]=c+v,e[2]=u-g,e[3]=0,e[4]=c-v,e[5]=1-h-f,e[6]=p+m,e[7]=0,e[8]=u+g,e[9]=p-m,e[10]=1-h-d,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function T(e,t,i,r,a,s,n){var o=1/(i-t),l=1/(a-r),h=1/(s-n);return e[0]=2*s*o,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=2*s*l,e[6]=0,e[7]=0,e[8]=(i+t)*o,e[9]=(a+r)*l,e[10]=(n+s)*h,e[11]=-1,e[12]=0,e[13]=0,e[14]=n*s*2*h,e[15]=0,e}var E=function(e,t,i,r,a){var s,n=1/Math.tan(t/2);return e[0]=n/i,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=n,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=a&&a!==1/0?(e[10]=(a+r)*(s=1/(r-a)),e[14]=2*a*r*s):(e[10]=-1,e[14]=-2*r),e},S=function(e,t,i,r,a,s,n){var o=1/(t-i),l=1/(r-a),h=1/(s-n);return e[0]=-2*o,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*h,e[11]=0,e[12]=(t+i)*o,e[13]=(a+r)*l,e[14]=(n+s)*h,e[15]=1,e};function C(e,t,i,a){var n,o,l,h,c,d,u,p,f,m,g=t[0],v=t[1],y=t[2],x=a[0],b=a[1],w=a[2],_=i[0],A=i[1],M=i[2];return Math.abs(g-_)<r.p8&&Math.abs(v-A)<r.p8&&Math.abs(y-M)<r.p8?s(e):(u=g-_,p=v-A,f=y-M,n=b*(f*=m=1/Math.hypot(u,p,f))-w*(p*=m),o=w*(u*=m)-x*f,l=x*p-b*u,(m=Math.hypot(n,o,l))?(n*=m=1/m,o*=m,l*=m):(n=0,o=0,l=0),h=p*l-f*o,c=f*n-u*l,d=u*o-p*n,(m=Math.hypot(h,c,d))?(h*=m=1/m,c*=m,d*=m):(h=0,c=0,d=0),e[0]=n,e[1]=h,e[2]=u,e[3]=0,e[4]=o,e[5]=c,e[6]=p,e[7]=0,e[8]=l,e[9]=d,e[10]=f,e[11]=0,e[12]=-(n*g+o*v+l*y),e[13]=-(h*g+c*v+d*y),e[14]=-(u*g+p*v+f*y),e[15]=1,e)}function O(e,t,i,r){var a=t[0],s=t[1],n=t[2],o=r[0],l=r[1],h=r[2],c=a-i[0],d=s-i[1],u=n-i[2],p=c*c+d*d+u*u;p>0&&(c*=p=1/Math.sqrt(p),d*=p,u*=p);var f=l*u-h*d,m=h*c-o*u,g=o*d-l*c;return(p=f*f+m*m+g*g)>0&&(f*=p=1/Math.sqrt(p),m*=p,g*=p),e[0]=f,e[1]=m,e[2]=g,e[3]=0,e[4]=d*g-u*m,e[5]=u*f-c*g,e[6]=c*m-d*f,e[7]=0,e[8]=c,e[9]=d,e[10]=u,e[11]=0,e[12]=a,e[13]=s,e[14]=n,e[15]=1,e}function R(e){return"mat4("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+", "+e[9]+", "+e[10]+", "+e[11]+", "+e[12]+", "+e[13]+", "+e[14]+", "+e[15]+")"}function I(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e[4]=t[4]*i,e[5]=t[5]*i,e[6]=t[6]*i,e[7]=t[7]*i,e[8]=t[8]*i,e[9]=t[9]*i,e[10]=t[10]*i,e[11]=t[11]*i,e[12]=t[12]*i,e[13]=t[13]*i,e[14]=t[14]*i,e[15]=t[15]*i,e}function P(e,t){var i=e[0],a=e[1],s=e[2],n=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],f=e[11],m=e[12],g=e[13],v=e[14],y=e[15],x=t[0],b=t[1],w=t[2],_=t[3],A=t[4],M=t[5],T=t[6],E=t[7],S=t[8],C=t[9],O=t[10],R=t[11],I=t[12],P=t[13],D=t[14],z=t[15];return Math.abs(i-x)<=r.p8*Math.max(1,Math.abs(i),Math.abs(x))&&Math.abs(a-b)<=r.p8*Math.max(1,Math.abs(a),Math.abs(b))&&Math.abs(s-w)<=r.p8*Math.max(1,Math.abs(s),Math.abs(w))&&Math.abs(n-_)<=r.p8*Math.max(1,Math.abs(n),Math.abs(_))&&Math.abs(o-A)<=r.p8*Math.max(1,Math.abs(o),Math.abs(A))&&Math.abs(l-M)<=r.p8*Math.max(1,Math.abs(l),Math.abs(M))&&Math.abs(h-T)<=r.p8*Math.max(1,Math.abs(h),Math.abs(T))&&Math.abs(c-E)<=r.p8*Math.max(1,Math.abs(c),Math.abs(E))&&Math.abs(d-S)<=r.p8*Math.max(1,Math.abs(d),Math.abs(S))&&Math.abs(u-C)<=r.p8*Math.max(1,Math.abs(u),Math.abs(C))&&Math.abs(p-O)<=r.p8*Math.max(1,Math.abs(p),Math.abs(O))&&Math.abs(f-R)<=r.p8*Math.max(1,Math.abs(f),Math.abs(R))&&Math.abs(m-I)<=r.p8*Math.max(1,Math.abs(m),Math.abs(I))&&Math.abs(g-P)<=r.p8*Math.max(1,Math.abs(g),Math.abs(P))&&Math.abs(v-D)<=r.p8*Math.max(1,Math.abs(v),Math.abs(D))&&Math.abs(y-z)<=r.p8*Math.max(1,Math.abs(y),Math.abs(z))}},2221:(e,t,i)=>{i.d(t,{A6:()=>g,B8:()=>f,Bw:()=>x,D_:()=>l,Om:()=>y,Qr:()=>p,S8:()=>b,Xr:()=>m,Z8:()=>u,_H:()=>c,aI:()=>w,eL:()=>d,fA:()=>v,x8:()=>h});var r=i(7823),a=i(1409),s=i(329),n=i(4796);function o(){var e=new r.tb(4);return r.tb!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function l(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function h(e,t,i){i*=.5;var r=Math.sin(i);return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=Math.cos(i),e}function c(e,t){var i=y(e,t);return Math.acos(2*i*i-1)}function d(e,t,i){i*=.5;var r=t[0],a=t[1],s=t[2],n=t[3],o=Math.sin(i),l=Math.cos(i);return e[0]=r*l+n*o,e[1]=a*l+s*o,e[2]=s*l-a*o,e[3]=n*l-r*o,e}function u(e,t,i){i*=.5;var r=t[0],a=t[1],s=t[2],n=t[3],o=Math.sin(i),l=Math.cos(i);return e[0]=r*l-s*o,e[1]=a*l+n*o,e[2]=s*l+r*o,e[3]=n*l-a*o,e}function p(e,t,i){i*=.5;var r=t[0],a=t[1],s=t[2],n=t[3],o=Math.sin(i),l=Math.cos(i);return e[0]=r*l+a*o,e[1]=a*l-r*o,e[2]=s*l+n*o,e[3]=n*l-s*o,e}function f(e,t){var i=t[0],r=t[1],a=t[2],s=t[3],n=i*i+r*r+a*a+s*s,o=n?1/n:0;return e[0]=-i*o,e[1]=-r*o,e[2]=-a*o,e[3]=s*o,e}function m(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}function g(e,t,i,r){var a=.5*Math.PI/180;t*=a,i*=a,r*=a;var s=Math.sin(t),n=Math.cos(t),o=Math.sin(i),l=Math.cos(i),h=Math.sin(r),c=Math.cos(r);return e[0]=s*l*c-n*o*h,e[1]=n*o*c+s*l*h,e[2]=n*l*h-s*o*c,e[3]=n*l*c+s*o*h,e}var v=n.fA,y=n.Om,x=n.Bw,b=n.S8,w=n.aI;s.vt(),s.fA(1,0,0),s.fA(0,1,0),o(),o(),a.vt()},329:(e,t,i)=>{i.d(t,{$A:()=>m,Bw:()=>s,Cc:()=>g,Il:()=>S,Io:()=>u,Om:()=>f,Qr:()=>c,Re:()=>l,S8:()=>p,WQ:()=>o,Z0:()=>v,Z8:()=>w,aI:()=>M,eL:()=>b,ei:()=>y,fA:()=>n,g7:()=>A,gL:()=>x,hs:()=>d,jb:()=>T,lo:()=>E,lw:()=>h,vt:()=>a,x6:()=>_});var r=i(7823);function a(){var e=new r.tb(3);return r.tb!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function s(e){return Math.hypot(e[0],e[1],e[2])}function n(e,t,i){var a=new r.tb(3);return a[0]=e,a[1]=t,a[2]=i,a}function o(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e[2]=t[2]+i[2],e}function l(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e[2]=t[2]-i[2],e}function h(e,t,i){return e[0]=t[0]*i[0],e[1]=t[1]*i[1],e[2]=t[2]*i[2],e}function c(e,t,i){return e[0]=t[0]/i[0],e[1]=t[1]/i[1],e[2]=t[2]/i[2],e}function d(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e}function u(e,t){return Math.hypot(t[0]-e[0],t[1]-e[1],t[2]-e[2])}function p(e,t){var i=t[0],r=t[1],a=t[2],s=i*i+r*r+a*a;return s>0&&(s=1/Math.sqrt(s)),e[0]=t[0]*s,e[1]=t[1]*s,e[2]=t[2]*s,e}function f(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function m(e,t,i){var r=t[0],a=t[1],s=t[2],n=i[0],o=i[1],l=i[2];return e[0]=a*l-s*o,e[1]=s*n-r*l,e[2]=r*o-a*n,e}function g(e,t,i,r){var a=t[0],s=t[1],n=t[2];return e[0]=a+r*(i[0]-a),e[1]=s+r*(i[1]-s),e[2]=n+r*(i[2]-n),e}function v(e,t,i){var r=t[0],a=t[1],s=t[2],n=i[3]*r+i[7]*a+i[11]*s+i[15];return e[0]=(i[0]*r+i[4]*a+i[8]*s+i[12])/(n=n||1),e[1]=(i[1]*r+i[5]*a+i[9]*s+i[13])/n,e[2]=(i[2]*r+i[6]*a+i[10]*s+i[14])/n,e}function y(e,t,i){var r=t[0],a=t[1],s=t[2];return e[0]=r*i[0]+a*i[3]+s*i[6],e[1]=r*i[1]+a*i[4]+s*i[7],e[2]=r*i[2]+a*i[5]+s*i[8],e}function x(e,t,i){var r=i[0],a=i[1],s=i[2],n=t[0],o=t[1],l=t[2],h=a*l-s*o,c=s*n-r*l,d=r*o-a*n,u=a*d-s*c,p=s*h-r*d,f=r*c-a*h,m=2*i[3];return c*=m,d*=m,p*=2,f*=2,e[0]=n+(h*=m)+(u*=2),e[1]=o+c+p,e[2]=l+d+f,e}function b(e,t,i,r){var a=[],s=[];return a[0]=t[0]-i[0],a[1]=t[1]-i[1],a[2]=t[2]-i[2],s[0]=a[0],s[1]=a[1]*Math.cos(r)-a[2]*Math.sin(r),s[2]=a[1]*Math.sin(r)+a[2]*Math.cos(r),e[0]=s[0]+i[0],e[1]=s[1]+i[1],e[2]=s[2]+i[2],e}function w(e,t,i,r){var a=[],s=[];return a[0]=t[0]-i[0],a[1]=t[1]-i[1],a[2]=t[2]-i[2],s[0]=a[2]*Math.sin(r)+a[0]*Math.cos(r),s[1]=a[1],s[2]=a[2]*Math.cos(r)-a[0]*Math.sin(r),e[0]=s[0]+i[0],e[1]=s[1]+i[1],e[2]=s[2]+i[2],e}function _(e,t,i,r){var a=[],s=[];return a[0]=t[0]-i[0],a[1]=t[1]-i[1],a[2]=t[2]-i[2],s[0]=a[0]*Math.cos(r)-a[1]*Math.sin(r),s[1]=a[0]*Math.sin(r)+a[1]*Math.cos(r),s[2]=a[2],e[0]=s[0]+i[0],e[1]=s[1]+i[1],e[2]=s[2]+i[2],e}function A(e,t){var i=e[0],r=e[1],a=e[2],s=t[0],n=t[1],o=t[2],l=Math.sqrt(i*i+r*r+a*a)*Math.sqrt(s*s+n*n+o*o),h=l&&f(e,t)/l;return Math.acos(Math.min(Math.max(h,-1),1))}function M(e,t){var i=e[0],a=e[1],s=e[2],n=t[0],o=t[1],l=t[2];return Math.abs(i-n)<=r.p8*Math.max(1,Math.abs(i),Math.abs(n))&&Math.abs(a-o)<=r.p8*Math.max(1,Math.abs(a),Math.abs(o))&&Math.abs(s-l)<=r.p8*Math.max(1,Math.abs(s),Math.abs(l))}var T=l,E=function(e,t){var i=t[0]-e[0],r=t[1]-e[1],a=t[2]-e[2];return i*i+r*r+a*a},S=s;a()},4796:(e,t,i)=>{i.d(t,{Bw:()=>m,C:()=>o,Cc:()=>x,Io:()=>f,Om:()=>y,Qr:()=>u,Re:()=>c,S8:()=>v,WQ:()=>h,Z0:()=>b,aI:()=>_,fA:()=>n,hZ:()=>l,hs:()=>p,lw:()=>d,m3:()=>g,o8:()=>s,t2:()=>w});var r,a=i(7823);function s(e){var t=new a.tb(4);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function n(e,t,i,r){var s=new a.tb(4);return s[0]=e,s[1]=t,s[2]=i,s[3]=r,s}function o(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function l(e,t,i,r,a){return e[0]=t,e[1]=i,e[2]=r,e[3]=a,e}function h(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e[2]=t[2]+i[2],e[3]=t[3]+i[3],e}function c(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e[2]=t[2]-i[2],e[3]=t[3]-i[3],e}function d(e,t,i){return e[0]=t[0]*i[0],e[1]=t[1]*i[1],e[2]=t[2]*i[2],e[3]=t[3]*i[3],e}function u(e,t,i){return e[0]=t[0]/i[0],e[1]=t[1]/i[1],e[2]=t[2]/i[2],e[3]=t[3]/i[3],e}function p(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e}function f(e,t){return Math.hypot(t[0]-e[0],t[1]-e[1],t[2]-e[2],t[3]-e[3])}function m(e){return Math.hypot(e[0],e[1],e[2],e[3])}function g(e){var t=e[0],i=e[1],r=e[2],a=e[3];return t*t+i*i+r*r+a*a}function v(e,t){var i=t[0],r=t[1],a=t[2],s=t[3],n=i*i+r*r+a*a+s*s;return n>0&&(n=1/Math.sqrt(n)),e[0]=i*n,e[1]=r*n,e[2]=a*n,e[3]=s*n,e}function y(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function x(e,t,i,r){var a=t[0],s=t[1],n=t[2],o=t[3];return e[0]=a+r*(i[0]-a),e[1]=s+r*(i[1]-s),e[2]=n+r*(i[2]-n),e[3]=o+r*(i[3]-o),e}function b(e,t,i){var r=t[0],a=t[1],s=t[2],n=t[3];return e[0]=i[0]*r+i[4]*a+i[8]*s+i[12]*n,e[1]=i[1]*r+i[5]*a+i[9]*s+i[13]*n,e[2]=i[2]*r+i[6]*a+i[10]*s+i[14]*n,e[3]=i[3]*r+i[7]*a+i[11]*s+i[15]*n,e}function w(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]}function _(e,t){var i=e[0],r=e[1],s=e[2],n=e[3],o=t[0],l=t[1],h=t[2],c=t[3];return Math.abs(i-o)<=a.p8*Math.max(1,Math.abs(i),Math.abs(o))&&Math.abs(r-l)<=a.p8*Math.max(1,Math.abs(r),Math.abs(l))&&Math.abs(s-h)<=a.p8*Math.max(1,Math.abs(s),Math.abs(h))&&Math.abs(n-c)<=a.p8*Math.max(1,Math.abs(n),Math.abs(c))}r=new a.tb(4),a.tb!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0,r[3]=0)},3841:e=>{e.exports=function(e,t,i,r){var a=e[0],s=e[1],n=!1;void 0===i&&(i=0),void 0===r&&(r=t.length);for(var o=(r-i)/2,l=0,h=o-1;l<o;h=l++){var c=t[i+2*l+0],d=t[i+2*l+1],u=t[i+2*h+1];d>s!=u>s&&a<(t[i+2*h+0]-c)*(s-d)/(u-d)+c&&(n=!n)}return n}},1476:(e,t,i)=>{var r=i(3841),a=i(1137);e.exports=function(e,t,i,s){return t.length>0&&Array.isArray(t[0])?a(e,t,i,s):r(e,t,i,s)},e.exports.nested=a,e.exports.flat=r},1137:e=>{e.exports=function(e,t,i,r){var a=e[0],s=e[1],n=!1;void 0===i&&(i=0),void 0===r&&(r=t.length);for(var o=r-i,l=0,h=o-1;l<o;h=l++){var c=t[l+i][0],d=t[l+i][1],u=t[h+i][1];d>s!=u>s&&a<(t[h+i][0]-c)*(s-d)/(u-d)+c&&(n=!n)}return n}},5341:function(e){e.exports=function(){function e(e,r,a,s,n){!function e(i,r,a,s,n){for(;s>a;){if(s-a>600){var o=s-a+1,l=r-a+1,h=Math.log(o),c=.5*Math.exp(2*h/3),d=.5*Math.sqrt(h*c*(o-c)/o)*(l-o/2<0?-1:1);e(i,r,Math.max(a,Math.floor(r-l*c/o+d)),Math.min(s,Math.floor(r+(o-l)*c/o+d)),n)}var u=i[r],p=a,f=s;for(t(i,a,r),n(i[s],u)>0&&t(i,a,s);p<f;){for(t(i,p,f),p++,f--;n(i[p],u)<0;)p++;for(;n(i[f],u)>0;)f--}0===n(i[a],u)?t(i,a,f):t(i,++f,s),f<=r&&(a=f+1),r<=f&&(s=f-1)}}(e,r,a||0,s||e.length-1,n||i)}function t(e,t,i){var r=e[t];e[t]=e[i],e[i]=r}function i(e,t){return e<t?-1:e>t?1:0}var r=function(e){void 0===e&&(e=9),this._maxEntries=Math.max(4,e),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function a(e,t,i){if(!i)return t.indexOf(e);for(var r=0;r<t.length;r++)if(i(e,t[r]))return r;return-1}function s(e,t){n(e,0,e.children.length,t,e)}function n(e,t,i,r,a){a||(a=f(null)),a.minX=1/0,a.minY=1/0,a.maxX=-1/0,a.maxY=-1/0;for(var s=t;s<i;s++){var n=e.children[s];o(a,e.leaf?r(n):n)}return a}function o(e,t){return e.minX=Math.min(e.minX,t.minX),e.minY=Math.min(e.minY,t.minY),e.maxX=Math.max(e.maxX,t.maxX),e.maxY=Math.max(e.maxY,t.maxY),e}function l(e,t){return e.minX-t.minX}function h(e,t){return e.minY-t.minY}function c(e){return(e.maxX-e.minX)*(e.maxY-e.minY)}function d(e){return e.maxX-e.minX+(e.maxY-e.minY)}function u(e,t){return e.minX<=t.minX&&e.minY<=t.minY&&t.maxX<=e.maxX&&t.maxY<=e.maxY}function p(e,t){return t.minX<=e.maxX&&t.minY<=e.maxY&&t.maxX>=e.minX&&t.maxY>=e.minY}function f(e){return{children:e,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function m(t,i,r,a,s){for(var n=[i,r];n.length;)if(!((r=n.pop())-(i=n.pop())<=a)){var o=i+Math.ceil((r-i)/a/2)*a;e(t,o,i,r,s),n.push(i,o,o,r)}}return r.prototype.all=function(){return this._all(this.data,[])},r.prototype.search=function(e){var t=this.data,i=[];if(!p(e,t))return i;for(var r=this.toBBox,a=[];t;){for(var s=0;s<t.children.length;s++){var n=t.children[s],o=t.leaf?r(n):n;p(e,o)&&(t.leaf?i.push(n):u(e,o)?this._all(n,i):a.push(n))}t=a.pop()}return i},r.prototype.collides=function(e){var t=this.data;if(!p(e,t))return!1;for(var i=[];t;){for(var r=0;r<t.children.length;r++){var a=t.children[r],s=t.leaf?this.toBBox(a):a;if(p(e,s)){if(t.leaf||u(e,s))return!0;i.push(a)}}t=i.pop()}return!1},r.prototype.load=function(e){if(!e||!e.length)return this;if(e.length<this._minEntries){for(var t=0;t<e.length;t++)this.insert(e[t]);return this}var i=this._build(e.slice(),0,e.length-1,0);if(this.data.children.length)if(this.data.height===i.height)this._splitRoot(this.data,i);else{if(this.data.height<i.height){var r=this.data;this.data=i,i=r}this._insert(i,this.data.height-i.height-1,!0)}else this.data=i;return this},r.prototype.insert=function(e){return e&&this._insert(e,this.data.height-1),this},r.prototype.clear=function(){return this.data=f([]),this},r.prototype.remove=function(e,t){if(!e)return this;for(var i,r,s,n=this.data,o=this.toBBox(e),l=[],h=[];n||l.length;){if(n||(n=l.pop(),r=l[l.length-1],i=h.pop(),s=!0),n.leaf){var c=a(e,n.children,t);if(-1!==c)return n.children.splice(c,1),l.push(n),this._condense(l),this}s||n.leaf||!u(n,o)?r?(i++,n=r.children[i],s=!1):n=null:(l.push(n),h.push(i),i=0,r=n,n=n.children[0])}return this},r.prototype.toBBox=function(e){return e},r.prototype.compareMinX=function(e,t){return e.minX-t.minX},r.prototype.compareMinY=function(e,t){return e.minY-t.minY},r.prototype.toJSON=function(){return this.data},r.prototype.fromJSON=function(e){return this.data=e,this},r.prototype._all=function(e,t){for(var i=[];e;)e.leaf?t.push.apply(t,e.children):i.push.apply(i,e.children),e=i.pop();return t},r.prototype._build=function(e,t,i,r){var a,n=i-t+1,o=this._maxEntries;if(n<=o)return s(a=f(e.slice(t,i+1)),this.toBBox),a;r||(r=Math.ceil(Math.log(n)/Math.log(o)),o=Math.ceil(n/Math.pow(o,r-1))),(a=f([])).leaf=!1,a.height=r;var l=Math.ceil(n/o),h=l*Math.ceil(Math.sqrt(o));m(e,t,i,h,this.compareMinX);for(var c=t;c<=i;c+=h){var d=Math.min(c+h-1,i);m(e,c,d,l,this.compareMinY);for(var u=c;u<=d;u+=l){var p=Math.min(u+l-1,d);a.children.push(this._build(e,u,p,r-1))}}return s(a,this.toBBox),a},r.prototype._chooseSubtree=function(e,t,i,r){for(;r.push(t),!t.leaf&&r.length-1!==i;){for(var a=1/0,s=1/0,n=void 0,o=0;o<t.children.length;o++){var l=t.children[o],h=c(l),d=(u=e,p=l,(Math.max(p.maxX,u.maxX)-Math.min(p.minX,u.minX))*(Math.max(p.maxY,u.maxY)-Math.min(p.minY,u.minY))-h);d<s?(s=d,a=h<a?h:a,n=l):d===s&&h<a&&(a=h,n=l)}t=n||t.children[0]}var u,p;return t},r.prototype._insert=function(e,t,i){var r=i?e:this.toBBox(e),a=[],s=this._chooseSubtree(r,this.data,t,a);for(s.children.push(e),o(s,r);t>=0&&a[t].children.length>this._maxEntries;)this._split(a,t),t--;this._adjustParentBBoxes(r,a,t)},r.prototype._split=function(e,t){var i=e[t],r=i.children.length,a=this._minEntries;this._chooseSplitAxis(i,a,r);var n=this._chooseSplitIndex(i,a,r),o=f(i.children.splice(n,i.children.length-n));o.height=i.height,o.leaf=i.leaf,s(i,this.toBBox),s(o,this.toBBox),t?e[t-1].children.push(o):this._splitRoot(i,o)},r.prototype._splitRoot=function(e,t){this.data=f([e,t]),this.data.height=e.height+1,this.data.leaf=!1,s(this.data,this.toBBox)},r.prototype._chooseSplitIndex=function(e,t,i){for(var r,a,s,o,l,h,d,u=1/0,p=1/0,f=t;f<=i-t;f++){var m=n(e,0,f,this.toBBox),g=n(e,f,i,this.toBBox),v=(a=m,s=g,o=Math.max(a.minX,s.minX),l=Math.max(a.minY,s.minY),h=Math.min(a.maxX,s.maxX),d=Math.min(a.maxY,s.maxY),Math.max(0,h-o)*Math.max(0,d-l)),y=c(m)+c(g);v<u?(u=v,r=f,p=y<p?y:p):v===u&&y<p&&(p=y,r=f)}return r||i-t},r.prototype._chooseSplitAxis=function(e,t,i){var r=e.leaf?this.compareMinX:l,a=e.leaf?this.compareMinY:h;this._allDistMargin(e,t,i,r)<this._allDistMargin(e,t,i,a)&&e.children.sort(r)},r.prototype._allDistMargin=function(e,t,i,r){e.children.sort(r);for(var a=this.toBBox,s=n(e,0,t,a),l=n(e,i-t,i,a),h=d(s)+d(l),c=t;c<i-t;c++){var u=e.children[c];o(s,e.leaf?a(u):u),h+=d(s)}for(var p=i-t-1;p>=t;p--){var f=e.children[p];o(l,e.leaf?a(f):f),h+=d(l)}return h},r.prototype._adjustParentBBoxes=function(e,t,i){for(var r=i;r>=0;r--)o(t[r],e)},r.prototype._condense=function(e){for(var t=e.length-1,i=void 0;t>=0;t--)0===e[t].children.length?t>0?(i=e[t-1].children).splice(i.indexOf(e[t]),1):this.clear():s(e[t],this.toBBox)},r}()},816:(e,t,i)=>{i.d(t,{A:()=>u});var r=i(4818),a=i(6476),s=i(2527),n=i(7290);const o=new class{constructor(){this._animations=new Set,this._loop=new n.A(this._tick.bind(this))}add(e){this._animations.has(e)||(this._animations.add(e),this._loop.start())}remove(e){this._animations.has(e)&&this._animations.delete(e),0===this._animations.size&&this._loop.stop()}_tick(e){this._animations.forEach((t=>{t.tick(e)}))}};var l=i(1884),h=i(6068),c=i(9589);const d={id:void 0,enabled:!0,autoplay:!1,duration:1,delay:0,endDelay:0,timeScale:1,repeat:!0,manualAdvance:!1,alwaysPlayFromBeginning:!1},u=class extends r.A{get id(){return this._config.value.id}get config(){return this._config}get state(){return this._state}get enabled(){return this._enabled}get duration(){return this._config.value.duration}set duration(e){this._config.setState({duration:e})}get delay(){return this._config.value.delay}set delay(e){this._config.setState({delay:e})}get endDelay(){return this._config.value.endDelay}set endDelay(e){this._config.setState({endDelay:e})}get timeScale(){return this._config.value.timeScale}set timeScale(e){if(e<=0)throw new Error("[MapsGL] Animation time scale must be greater than zero.");this._config.setState({timeScale:Math.max(0,e)})}get totalDuration(){return this.delay+this.duration+this.endDelay}get elapsedTime(){return this._elapsed}get position(){return this._elapsed<this.delay?0:this._elapsed>=this.delay+this.duration?1:Math.max(0,Math.min(1,(this._elapsed-this.delay)/this.duration))}get totalPosition(){return Math.max(0,Math.min(1,this._elapsed/this.totalDuration))}get alwaysPlayFromBeginning(){return this._config.value.alwaysPlayFromBeginning}get isAnimating(){return this._state===c.o.playing}get isPaused(){return this._state===c.o.paused}get isActive(){return this.isAnimating||this.isPaused}constructor(e={}){super(),this._state=c.o.initial,this._active=!1,this._enabled=!0,this._elapsed=0,this._clampedRange={min:0,max:1},this._lastElapsed=-1,this._startPosition=0,this._config=new h.A(Object.assign(Object.assign({},d),e)),this._enabled=this._config.value.enabled,e.autoplay&&setTimeout((()=>{this.play()}),1e3)}play(e){!this.isActive&&this.enabled&&((0,a.g)(e)&&(e=this.alwaysPlayFromBeginning?0:this.position),e=(0,s.q)(e,0,1),this._active=!0,this._state=c.o.playing,this._startPosition=e,this.timeline||!0===this.config.value.manualAdvance||o.add(this),this.advance(e,1===e),this.trigger(l.A.PLAY,this.eventPayload()))}pause(){this._state===c.o.playing&&(this._state=c.o.paused,this.trigger(l.A.PAUSE,this.eventPayload()))}resume(){this._state===c.o.paused&&(this._state=c.o.playing,this.trigger(l.A.RESUME,this.eventPayload()))}stop(){this.isActive&&(this._active=!1,this._state=c.o.stopped,this.advanceToStopPosition(),this.timeline||o.remove(this),this.trigger(l.A.STOP,this.eventPayload()))}restart(){this._elapsed=0,this.timeline||o.add(this),this.trigger(l.A.RESTART)}reset(){this._state===c.o.playing?this.stop():this.advanceToStopPosition(),this.trigger(l.A.RESET)}toggle(){this._active&&(this.isAnimating?this.pause():this.resume())}enable(){this._enabled=!0}disable(){this._enabled=!1}goTo(e){this.advance(e,arguments.length>1&&void 0!==arguments[1]&&arguments[1])}clampRange(e,t){if(this._clampedRange={min:(0,s.q)(e,0,1),max:(0,s.q)(t,0,1)},this._clampedRange.min>this._clampedRange.max)throw new Error("[MapsGL] Animation clamped range min must be less than max.");if(this._clampedRange.min===this._clampedRange.max)throw new Error("[MapsGL] Animation clamped range min and max cannot be equal.");this.position<this._clampedRange.min?this.advance(this._clampedRange.min,!1):this.position>this._clampedRange.max&&this.advance(this._clampedRange.max,!1)}proxyEvents(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];[l.A.PLAY,l.A.STOP,l.A.PAUSE,l.A.RESUME,l.A.RESTART,l.A.RESET,l.A.ADVANCE].filter((e=>!t.includes(e))).forEach((t=>this.on(t,(i=>{e.trigger(t,i)}))))}tick(e){this._lastElapsed<0&&(this._lastElapsed=e);const t=this._lastElapsed;if(this._lastElapsed=e,this._state!==c.o.playing)return;this._elapsed+=(e-t)*this.timeScale,this._elapsed=Math.min(this._elapsed,this.totalDuration);const i=this.position,r=this.totalPosition;1===i&&this.trigger(l.A.END,this.eventPayload());const a=this._clampedRange;a.min>0&&i<=a.min||a.max<1&&i>=a.max?this.advance(this._clampedRange.min,!1):1===r?(this.advance(r),this._config.value.repeat?this.restart():this.stop()):this.advance(r)}advance(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=(0,s.q)(e,0,1);this._elapsed=t?this.totalDuration*i:this.delay+this.duration*i,this.trigger(l.A.ADVANCE,this.eventPayload())}eventPayload(){return{position:this.position,totalPosition:this.totalPosition}}advanceToStopPosition(){this.advance(0)}}},9589:(e,t,i)=>{i.d(t,{o:()=>r});const r={initial:"initial",loading:"loading",ready:"ready",playing:"playing",paused:"paused",stopped:"stopped",completed:"completed"}},3905:(e,t,i)=>{i.d(t,{A:()=>l});var r=i(2133),a=i(816),s=i(2208),n=i(1884),o=i(9589);const l=class extends a.A{get startDate(){return this._startDate}set startDate(e){if(!(e instanceof Date)||Number.isNaN(e.getTime()))throw new TypeError("[MapsGL] Invalid date provided for startDate");this._startDate=e,this.trigger(n.A.RANGE_CHANGE,{start:this.startDate,end:this.endDate})}get endDate(){return this._endDate}set endDate(e){if(!(e instanceof Date)||Number.isNaN(e.getTime()))throw new TypeError("[MapsGL] Invalid date provided for endDate");this._endDate=e,this.trigger(n.A.RANGE_CHANGE,{start:this.startDate,end:this.endDate})}get currentDate(){const e=this.deltaTime*this.position;return new Date(this.startDate.getTime()+e)}get referenceDate(){return this.timeline?this.timeline.referenceDate:this._now}get containsPast(){return this.startDate.getTime()-this.referenceDate.getTime()<-1e3}get containsFuture(){return this.endDate.getTime()-this.referenceDate.getTime()>1e3}get isPast(){return!1===this.containsFuture}get isFuture(){return!1===this.containsPast}get deltaTime(){return this.endDate.getTime()-this.startDate.getTime()}get info(){return{isActive:this.isActive,currentDate:this.currentDate,startDate:this.startDate,endDate:this.endDate,deltaTime:this.deltaTime}}constructor(e){var{start:t=new Date,end:i=new Date,alwaysStopAtStart:a=!1}=e;super(function(e,t){var i={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(i[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(i[r[a]]=e[r[a]])}return i}(e,["start","end","alwaysStopAtStart"])),this.alwaysStopAtStart=!1,(0,r.K)(t)&&(t=(0,s.VI)(new Date,t)),(0,r.K)(i)&&(i=(0,s.VI)(new Date,i)),this._startDate=t,this._endDate=i,this._now=new Date,this.alwaysStopAtStart=a,this.on(n.A.RANGE_CHANGE,(()=>{this.stop(),this.state===o.o.stopped&&this.advanceToStopPosition()}))}setStartDateUsingOffset(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Date;this.startDate=new Date(t.getTime()+e)}setStartDateUsingRelativeTime(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Date;this.startDate=(0,s.VI)(t,e)}setEndDateUsingOffset(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Date;this.endDate=new Date(t.getTime()+e)}setEndDateUsingRelativeTime(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Date;this.endDate=(0,s.VI)(t,e)}playFromDate(e){const t=this.getPositionFromDate(e);this.play(t)}goToDate(e){const t=this.getPositionFromDate(e);this.goTo(t)}goToOffset(e){this.goToDate(new Date(this.startDate.getTime()+e))}getPositionFromDate(e){return e.getTime()<this.startDate.getTime()?e=this.startDate:e.getTime()>this.endDate.getTime()&&(e=this.endDate),(e.getTime()-this.startDate.getTime())/this.deltaTime}clampDateRange(e,t){this.clampRange((e.getTime()-this.startDate.getTime())/this.deltaTime,(t.getTime()-this.startDate.getTime())/this.deltaTime)}eventPayload(){return{position:this.position,date:this.currentDate}}advanceToStopPosition(){this.timeline||this.advance(this.alwaysStopAtStart?0:this.isPast?1:0)}}},6068:(e,t,i)=>{i.d(t,{A:()=>d});var r,a=i(4818),s=i(1045),n=i(8385),o=i(5711),l=function(e,t,i,r){if("a"===i&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?r:"a"===i?r.call(e):r?r.value:t.get(e)},h=function(e,t,i,r,a){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?a.call(e,i):a?a.value=i:t.set(e,i),i};class c extends a.A{get value(){return l(this,r,"f")}constructor(e){super(),r.set(this,void 0),h(this,r,Object.assign({},e),"f")}get(e,t){return(0,s.J)(l(this,r,"f"),e,t)}setState(e,t){if("string"==typeof e){const i=e;(0,n.h)(l(this,r,"f"),i,t),this.trigger(c.Events.UPDATE_KEY,{key:e,value:t})}else h(this,r,(0,o.$)({},l(this,r,"f"),e),"f");this.trigger(c.Events.UPDATE,Object.assign({},l(this,r,"f")))}}r=new WeakMap,c.Events={UPDATE:"update",UPDATE_KEY:"key:update"};const d=c},5752:(e,t,i)=>{i.d(t,{A:()=>o});var r=i(6476),a=i(8631),s=i(9037),n=i(8937);const o=class{get count(){return this.series.count}get validCount(){return this.series.validCount}get validIntervals(){return this._validIntervals}constructor(e,t,i){this.interval={current:void 0,next:void 0},this.textures={current:void 0,next:void 0},this.renderTargets={current:void 0,next:void 0},this.useLinearTextureFilter=!1,Object.keys(e).forEach((t=>{if(e[t]instanceof n.Ay==0)throw new TypeError(`[MapsGL] Invalid data type for time series data interval ${t}`)})),this.series=new a.A(e),this.size=t,this.setValidIntervals(i)}setValidIntervals(e){this._validIntervals=[...e].sort()}getData(e){return this.series.dataForTimeInterval(e)}setData(e,t){if(t instanceof n.Ay==0)throw new TypeError("[MapsGL] Invalid data type for time series data");this.series.setDataForInterval(e,t,!0)}purgeData(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1;this.series.intervals.forEach(((t,i)=>{var r;if(t!==e){const e=this.series.dataForTimeInterval(t);e&&(null===(r=e.texture)||void 0===r||r.dispose(),e.texture=void 0),this.series.setDataForInterval(t,void 0)}}))}dataAtIndex(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=this.validIntervals;if(e<0||e>=i.length)return;let a=this.series.dataForInterval(i[e]);if((0,r.n)(a)||!t)return{data:a,index:e};let s=-1;return i.forEach(((t,i)=>{const n=this.series.dataForInterval(t);(0,r.n)(n)&&(s<0||Math.abs(i-e)<Math.abs(s-e))&&(a=n,s=i)})),{data:a,index:s}}prepareTextures(e){const t=e.gl;this.series.intervals.forEach(((i,r)=>{const a=this.series.dataForInterval(i);if((null==a?void 0:a.image)&&!a.texture){const i=a.image,r=this.useLinearTextureFilter?t.LINEAR:t.NEAREST;a.texture=e.createTexture({image:i instanceof s.A?i.rawData:i,size:{width:i.width,height:i.height},minFilter:r,magFilter:r,generateMipmaps:!1})}}))}updateTextures(e,t){var i,r,a,s;this.prepareTextures(e);const{index:n,interval:o,nextIndex:l,nextInterval:h}=t;let c=!1;if(o!==this.interval.current){const e=this.dataAtIndex(n,!0);if(e){const{data:t,index:r}=e,a=this.validIntervals[r];a!==this.interval.current&&((null===(i=null==t?void 0:t.texture)||void 0===i?void 0:i.image)?(this.textures.current=t.texture,this.interval.current=a,c=!0):(this.textures.current=void 0,this.interval.current=void 0))}else this.textures.current=void 0,this.interval.current=void 0}if(h!==this.interval.next){const e=this.dataAtIndex(l,!0);if(e){const{data:t,index:i}=e,a=this.validIntervals[i];a!==this.interval.next&&((null===(r=null==t?void 0:t.texture)||void 0===r?void 0:r.image)?(this.textures.next=t.texture,this.interval.next=a,c=!0):(this.textures.next=void 0,this.interval.next=void 0))}else this.textures.next=void 0,this.interval.next=void 0}this.interval.current&&!(null===(a=this.textures.current)||void 0===a?void 0:a.image)&&(this.textures.current=void 0,this.textures.next=void 0,this.interval.current=void 0,this.interval.next=void 0),(null===(s=this.textures.next)||void 0===s?void 0:s.image)||(this.textures.next=this.textures.current,this.interval.next=this.interval.current)}dispose(){this.series.intervals.forEach((e=>{const t=this.series.dataForInterval(e);null==t||t.dispose()})),this.series.invalidate(),this.textures.current=void 0,this.textures.next=void 0}}},1989:(e,t,i)=>{i.d(t,{A:()=>h});var r=i(6476),a=i(6232),s=i(9037),n=i(5752),o=i(8937);class l extends n.A{constructor(){super(...arguments),this.padding=s.d}getPixel(e,t,i){var r;const a=null===(r=this.series.dataForTimeInterval(e))||void 0===r?void 0:r.image;if(a)return a.get(t,i)}backfillEdge(e,t,i){Object.keys(this.series.data).forEach((r=>{const a=this.series.dataForInterval(Number(r)),s=e.series.dataForInterval(Number(r));(null==a?void 0:a.image)&&(null==s?void 0:s.image)&&(a.image.backfillEdge(s.image,t,i),a.texture&&(a.texture.needsUpdate=!0))}))}serialized(){return{series:this.series.intervals.reduce(((e,t)=>{var i;return e[t]=null===(i=this.series.dataForInterval(t))||void 0===i?void 0:i.image,e}),Object.create(null)),validIntervals:this.validIntervals,size:this.size,padding:this.padding,metadata:void 0}}static fromSerialized(e){if((0,r.g)(e))return void console.warn("[MapsGL] Cannot create EncodedTileData from invalid serialized data.");const t=Object.keys(e.series).reduce(((t,i)=>{const n=e.series[i];if((0,r.n)(null==n?void 0:n.rawData)){const{rawData:e,dimension:r,pad:l}=n;if((0,a.Z)(e)){const a=new s.A(e,r,l);t[i]=new o.AI(a)}}return t}),Object.create(null));return new l(t,e.size,e.validIntervals)}}const h=l},8631:(e,t,i)=>{i.d(t,{A:()=>h});var r=i(4818),a=i(6476),s=i(7922),n=i(6232),o=i(924);class l{constructor(e){this.index=-1,this.current=-1,this.next=-1,this.data=e}}const h=class extends r.A{get intervals(){return[...this._intervals].sort(((e,t)=>e-t))}get count(){return Object.keys(this.data).length}get validCount(){return Object.values(this.data).filter((e=>(0,a.n)(e.data))).length}get timeRange(){if((0,s.I)(this.intervals))return{start:void 0,end:void 0};const e=this.intervals[0],t=this.intervals.at(-1);return{start:new Date(e),end:new Date(t)}}get data(){return this._data}constructor(e){super(),this._data=Object.create(null),this._intervals=[],this.setData(e)}setData(e){this._data=(0,a.n)(e)?Object.keys(e).reduce(((t,i)=>(t[i]=new l(e[i]),t)),Object.create(null)):Object.create(null),this._generateIntervalsFromData(),this.trigger(o.A.DATA_CHANGE)}appendData(e){Object.keys(e).sort().forEach((t=>{this._data[t]=e[t]})),this._generateIntervalsFromData(),this.trigger(o.A.DATA_CHANGE)}setDataForInterval(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const r=this.data[e];r?r.data=t:i?this.appendData({[e]:new l(t)}):console.warn(`[MapsGL] Cannot set time series data for interval ${e} because it does not exist and \`createIfMissing\` is false.`),this.trigger(o.A.DATA_CHANGE)}hasDataForInterval(e){return!(0,n.E)(this.data)&&(0,a.n)(this.dataForInterval(e))}entryForInterval(e){return this.data[e]}dataForInterval(e){return this.dataForTimeInterval(e)}dataForTimeInterval(e){var t;return null===(t=this.data[e])||void 0===t?void 0:t.data}dataAtIndex(e){var t;const i=Object.keys(this.data);if(e>-1&&e<i.length)return null===(t=this.data[i[e]])||void 0===t?void 0:t.data}intervalAtIndex(e){if(e>-1&&e<this.intervals.length)return this.intervals[e]}intervalsInRange(e,t){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return this.intervals.filter((r=>i?r>=e.getTime()&&r<=t.getTime():r>e.getTime()&&r<t.getTime()))}closestInterval(e){if(0===this.intervals.length)return{interval:void 0,index:-1};const t=e.getTime();let i=this.intervals[0],r=0,a=Math.abs(t-i);return this.intervals.forEach(((e,s)=>{const n=t-e;n>=0&&n<=a&&(a=n,i=e,r=s)})),{interval:i,index:r}}intervalsNeedingData(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.intervals).filter((e=>!this.hasDataForInterval(e))).sort(((e,t)=>e-t))}removeInterval(e){delete this._data[e],this._generateIntervalsFromData()}invalidate(){this.trigger(o.A.INVALIDATE),this._data=Object.create(null)}_generateIntervalsFromData(){const e=Object.keys(this._data).map(Number).sort(((e,t)=>e-t));e.length===this._intervals.length&&e.every(((e,t)=>e===this._intervals[t]))||this.trigger(o.A.INTERVALS_CHANGE,{previous:[...this._intervals],current:[...e]}),this._intervals=e}}},3606:(e,t,i)=>{i.d(t,{Ay:()=>y,Gp:()=>g,MH:()=>v});var r=i(4818),a=i(7028),s=i(6476),n=i(6232),o=i(7922),l=i(3564),h=i(1884),c=i(924),d=i(3905),u=i(1989),p=i(9589),f=i(5752),m=i(5975);const g={none:"none",any:"any",interval:"interval",range:"range"},v={none:"none",past:"past",future:"future",range:"range"},y=class extends r.A{constructor(e,t,i={}){super(),this.enabled=!0,this.clamp=v.none,this._debouncedLoadData=(0,a.s)((e=>{var t;null===(t=this._provider)||void 0===t||t.loadData(e)}),100),this._handleAdvanceDebounced=(0,a.s)((()=>{this._handleAdvance()}),10),this._updateEntriesStateDebounced=(0,a.s)((()=>{this._updateEntriesState()}),10),(0,l.vA)((0,s.n)(e),"[MapsGL] Time series animator was not initialized with a valid time series"),this.series=e,this.series.on(c.A.INTERVALS_CHANGE,(e=>{var t;null===(t=this.provider)||void 0===t||t.setSeriesIntervals(e.current)}));const{mode:r=v.none,animation:n}=i,o=function(e,t){var i={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(i[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(i[r[a]]=e[r[a]])}return i}(i,["mode","animation"]);this.clamp=r,this._animation=n||new d.A(o),this._provider=t;const h=this.animation.startDate.getTime();this._intervalState={time:{current:{interval:h,index:-1},next:{interval:h,index:-1}},data:{current:{interval:h,index:-1},next:{interval:h,index:-1}}},this._setupEvents()}get id(){return this.animation.id}get state(){if(this.provider){if(this.provider.isLoading)return p.o.loading;if(this.animation.state===p.o.initial&&this.hasData)return p.o.ready}return this.animation.state}get position(){return this.animation.position}get relativePosition(){var e,t;const{current:{interval:i,index:r},next:{index:a}}=this._intervalState.data,n=this.series.intervals,o=n[0],l=n[a],h=null===(e=this.series.dataForInterval(n[r]))||void 0===e?void 0:e.valid,c=null===(t=this.series.dataForInterval(l))||void 0===t?void 0:t.valid;if(r===a||(0,s.g)(l)||!1===c)return 0;if(!h&&c)return 1;if(h&&!c)return 0;if(this.animation.currentDate.getTime()<o)return 0;const d=(this.animation.currentDate.getTime()-i)/(l-i);return Math.max(0,Math.min(1,d))}get animation(){return this._animation}get provider(){return this._provider}get currentInterval(){return Object.assign({},this._intervalState.time.current)}get totalIntervals(){return this.series.intervals.length}get timeRange(){return(0,n.Z)(this._timeRange)?this._timeRange:this.series.timeRange}set timeRange(e){this._timeRange=Object.assign({},e)}get info(){return this._eventPayload()}get hasData(){return(0,o.h)(this.series.data)}get needsData(){var e,t;return null!==(t=null===(e=this.provider)||void 0===e?void 0:e.missingDataForIntervals(this.series.intervals))&&void 0!==t&&t}get isEnabled(){return this.enabled}get isReady(){return this.state===p.o.ready}get isAnimating(){return this.animation.isAnimating}get isPaused(){return this.animation.isPaused}get isActive(){return this.isAnimating||this.isPaused}canShowForDate(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.animation.currentDate;var t;if(this.animation instanceof d.A){const i=this.animation.referenceDate.getTime(),r=e.getTime(),a=this.clamp;if(!a||a===v.none)return!0;if(a===v.range){if((0,n.E)(this._timeRange)&&0===(null===(t=this.series.intervals)||void 0===t?void 0:t.length))return!1;const{start:e,end:i}=this.timeRange;return r>=e.getTime()&&r<=i.getTime()}return(a!==v.past||!1!==this.animation.containsPast)&&(a!==v.future||!1!==this.animation.containsFuture)&&(a===v.past&&r<=i||a===v.future&&r>i)}return!0}hasDataForCurrentInterval(){return this.hasDataForInterval(this._intervalState.data.current.interval,!0)}hasDataForDate(e,t){var i;return void 0===t&&(t=null===(i=this.animation)||void 0===i?void 0:i.isActive),this.hasDataForInterval(e.getTime(),t)}hasDataForInterval(e,t){var i;if(void 0===t&&(t=null===(i=this.animation)||void 0===i?void 0:i.isActive),(0,n.E)(this.series.data))return!1;const r=this.series.dataForInterval(e);return t?Boolean(null==r?void 0:r.valid):(0,s.n)(r)}needsDataForDate(e){const t=Date.now(),i=e.getTime(),{start:r,end:a}=this.timeRange,n=this.clamp;return!(n===v.range&&((0,s.g)(r)||(0,s.g)(a)||i<r.getTime()||i>a.getTime())||n===v.past&&i>t||n===v.future&&i<t||!1!==this.hasDataForDate(e))}positionForTime(e){return(e.getTime()-this.animation.startDate.getTime())/this.animation.deltaTime}loadData(){this.loadDataIfNeeded(!1,!0)}loadDataIfNeeded(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i,r,a,s,o,l;if(!this.animation)return void console.warn("[MapsGL] TimeSeriesAnimator: No animation instance available to load data for");const h=null!==(s=null===(a=null===(r=null===(i=this._provider)||void 0===i?void 0:i.layer.source.spec.timeSeries)||void 0===r?void 0:r.operation)||void 0===a?void 0:a.type)&&void 0!==s?s:"none";if((0,n.Z)(h)&&"none"!==h)return;const c=this.animation,d=new Date(c.startDate),u=new Date(c.endDate),p=this.series.intervalsInRange(d,u),f=(null===(o=this.series.closestInterval(c.currentDate))||void 0===o?void 0:o.interval)||c.currentDate.getTime();let m=c.isActive||t?p:[f];if(this.provider&&!1===this.provider.interleaveRequests&&c.isAnimating){const e=c.currentDate.getTime(),t=m.filter((t=>t>=e)),i=m.filter((t=>t<e));m=[...t,...i]}e?this._debouncedLoadData(m):null===(l=this._provider)||void 0===l||l.loadData(m)}loadDataForIntervals(e){var t;null===(t=this.provider)||void 0===t||t.setNeedsUpdate(),this._debouncedLoadData(e)}updateEntryState(){this._updateEntriesStateDebounced()}invalidate(){var e;null===(e=this.provider)||void 0===e||e.invalidate()}play(){this.enabled&&this.animation.play()}stop(){this.animation.stop()}pause(){this.animation.pause()}resume(){this.enabled&&this.animation.resume()}_setupEvents(){const e=this.series,t=this.animation,i=this.provider,r=null==i?void 0:i.layer.source;e.on(c.A.DATA_CHANGE,(()=>{this.invalidate()})),r&&r.on(m.A.TILE_LOAD,(()=>{this._updateEntriesStateDebounced()})),i&&(i.on(c.A.LOAD_START,(i=>{let{intervals:r}=i;t.disable(),r.forEach((t=>{const i=e.dataForInterval(t);i&&(i.loading=!0)}))})),i.on(c.A.LOAD_PROGRESS,(e=>{let{progress:t}=e;this.trigger(c.A.LOAD_PROGRESS,Object.assign(Object.assign({layerId:this.id},t),{progress:t.completed/t.total}))})),i.on(c.A.LOAD_INTERVAL,(t=>{let{intervals:i}=t;i.forEach((t=>{const i=e.dataForInterval(t);i&&(i.loading=!1)})),this._updateEntriesStateDebounced()})),i.on(c.A.LOAD_COMPLETE,(()=>{this._updateEntriesStateDebounced()})),i.on(c.A.DATA_READY,(()=>{t.enable()})),i.on(c.A.DATA_REMOVE,(i=>{let{tile:r}=i;const a=null==r?void 0:r.data,s=t.currentDate,{interval:n}=e.closestInterval(s);n&&(a instanceof u.A||a instanceof f.A)&&(null==a||a.purgeData(n))}))),this.on(c.A.DATA_CHANGE,(()=>{this._handleAdvanceDebounced()})),t.proxyEvents(this,[h.A.ADVANCE,h.A.PLAY,h.A.STOP]),t.on(h.A.PLAY,(()=>{this.loadDataIfNeeded(),this.trigger(c.A.PLAY,this._eventPayload())})).on(h.A.STOP,(()=>{this.trigger(c.A.STOP,this._eventPayload())})).on(h.A.ADVANCE,(e=>{this._handleAdvance()}))}_handleAdvance(){const{interval:e}=this._intervalState.time.current,{interval:t,index:i}=this.series.closestInterval(this.animation.currentDate);if(this.animation.currentDate.getTime()!==this._lastAdvanceTime&&(this.trigger(c.A.ADVANCE,this._eventPayload()),this._lastAdvanceTime=this.animation.currentDate.getTime()),!(0,n.E)(this.series.data)&&(e&&t===e||(this._intervalState.time.current={interval:t,index:i},this.trigger(c.A.INTERVAL_ADVANCE,this._eventPayload())),this.hasDataForInterval(t))){const e=this.series.entryForInterval(t),i=null==e?void 0:e.next,r=this.series.intervalAtIndex(i);(t!==this._intervalState.data.current.interval||-1===this._intervalState.data.next.index&&(0,s.n)(i))&&(this._intervalState.data.current=Object.assign({},this._intervalState.time.current),this._intervalState.data.next={interval:r,index:i},this.trigger(c.A.DATA_ADVANCE,this._eventPayload()))}}_updateEntriesState(){if((0,n.E)(this.series.intervals))return;const e=this.series.intervals,t=this.series.data||Object.create(null);if(this.provider){const i=this.provider.dataStateForIntervals(e);Object.keys(i).forEach((e=>{t[Number(e)].data.valid=!0===i[e]}))}e.forEach(((i,r)=>{var a;const s=t[i];if(s.index=r,null===(a=s.data)||void 0===a?void 0:a.valid){s.current=r;for(let t=e.length-1;t>r;t--)this.hasDataForInterval(e[t],!0)&&(s.next=t);(-1===s.next||s.next<s.current)&&(s.next=s.current)}else s.current=-1,s.next=-1})),this._handleAdvance()}_eventPayload(){const{interval:e,index:t}=this._intervalState.time.current,i=Math.min(this.totalIntervals-1,t+1);return{animator:this,position:this.position,date:this.animation.currentDate,interval:e,nextInterval:this.series.intervals[i],dataInterval:this._intervalState.data.current.interval,nextDataInterval:this._intervalState.data.next.interval,index:t,nextIndex:i,dataIndex:this._intervalState.data.current.index,nextDataIndex:this._intervalState.data.next.index,totalIntervals:this.totalIntervals,intervalPosition:this.relativePosition,data:this.series.dataForInterval(e)}}dispose(){var e;this.animation.off(h.A.PLAY),this.animation.off(h.A.STOP),this.animation.off(h.A.ADVANCE),null===(e=this.provider)||void 0===e||e.dispose()}}},7318:(e,t,i)=>{i.d(t,{D_:()=>r,Zb:()=>s,tF:()=>a});class r extends Error{}Error,Error;class a extends Error{constructor(e,t){super(e),this.response=t}}class s extends Error{}},1884:(e,t,i)=>{i.d(t,{A:()=>r});const r={PLAY:"play",PAUSE:"pause",RESUME:"resume",STOP:"stop",END:"end",RESTART:"restart",RESET:"reset",ADVANCE:"advance",RANGE_CHANGE:"range:change",TIMELINE_CHANGE:"timeline:change"}},5975:(e,t,i)=>{i.d(t,{A:()=>r});const r={METADATA_RANGE:"metadata:range",METADATA_LOAD_START:"metadata:load:start",METADATA_LOAD:"metadata:load",METADATA_ERROR:"metadata:error",METADATA_LAYOUT:"metadata:layout",DATA_CHANGE:"data:change",DATA_STALE:"data:stale",TILE_ADD:"tile:add",TILE_REMOVE:"tile:remove",TILE_REQUEST:"tile:request",TILE_LOAD:"tile:load",TILE_LOAD_START:"tile:load:start",TILE_LOAD_COMPLETE:"tile:load:complete",TILE_ERROR:"tile:error",TILE_DISCARD:"tile:discard",LOAD_START:"load:start",LOAD_COMPLETE:"load:complete"}},924:(e,t,i)=>{i.d(t,{A:()=>r});const r={PLAY:"play",STOP:"stop",ADVANCE:"advance",INTERVAL_ADVANCE:"interval:advance",DATA_ADVANCE:"data:advance",DATA_CHANGE:"data:change",DATA_REQUEST:"data:request",DATA_READY:"data:ready",DATA_REMOVE:"data:remove",LOAD_START:"load:start",LOAD_COMPLETE:"load:complete",LOAD_INTERVAL:"load:interval",LOAD_PROGRESS:"load:progress",INTERVALS_CHANGE:"intervals:change",INVALIDATE:"invalidate"}},4789:(e,t,i)=>{i.r(t),i.d(t,{Account:()=>de,AerisMapController:()=>Wd,Animation:()=>Sa.A,AnimationState:()=>lr.o,DataQuality:()=>tr.E,DataSourceType:()=>Re.o,Easing:()=>Uh.G,EncodedTileSource:()=>Xi,GeoJSONSource:()=>Ea,GoogleMapController:()=>xu,ImageTileSource:()=>cr,InterpolationMode:()=>rr.uN,LayerType:()=>tr.m,LeafletMapController:()=>ou,LegendControl:()=>Xh,LineCap:()=>or.$,LineJoin:()=>or.p,MapboxMapController:()=>ru,MaplibreMapController:()=>su,ParticleDensity:()=>nr.j,SampleExpression:()=>rr.BG,TileState:()=>ze,TimeAnimation:()=>Ca.A,TimeClampMode:()=>hr.MH,TimeSeriesMode:()=>hr.Gp,Timeline:()=>Ia,VectorSourceType:()=>Re.V,VectorTileSource:()=>Aa,styles:()=>wu,units:()=>Mu,utils:()=>_u,version:()=>bu,weather:()=>Au,workers:()=>Gi});var r={};i.r(r),i.d(r,{color_lookup:()=>Ls,decode_float_rgba:()=>$s,encode_float_rgba:()=>Us,encoding:()=>Gs,fbm:()=>Zs,get_data_value:()=>Ks,get_texel:()=>Xs,interpolate_bicubic:()=>Ns,interpolate_bilinear:()=>js,interpolate_biquadratic:()=>Vs,interpolated_texel:()=>Bs,project:()=>Ys,project_vertex:()=>en,sample_color_value:()=>ks,sdf_arrows:()=>Hs,sdf_draw:()=>Ws,skip_nodata:()=>Qs,symbol_uniforms:()=>tn,symbol_vert_position:()=>Js,texture_lookup_3x3:()=>Fs,transform:()=>qs});var a={};i.r(a),i.d(a,{fragmentShader:()=>sn,uniforms:()=>nn,vertexShader:()=>an});var s={};i.r(s),i.d(s,{fragmentShader:()=>ln,uniforms:()=>hn,vertexShader:()=>on});var n={};i.r(n),i.d(n,{fragmentShader:()=>un,uniforms:()=>pn,vertexShader:()=>dn});var o={};i.r(o),i.d(o,{fragmentShader:()=>mn,uniforms:()=>pn,vertexShader:()=>fn});var l={};i.r(l),i.d(l,{fragmentShader:()=>vn,uniforms:()=>pn,vertexShader:()=>gn});var h={};i.r(h),i.d(h,{fragmentShader:()=>xn,uniforms:()=>bn,vertexShader:()=>yn});var c={};i.r(c),i.d(c,{fragmentShader:()=>_n,uniforms:()=>An,vertexShader:()=>wn});var d={};i.r(d),i.d(d,{fragmentShader:()=>Tn,uniforms:()=>En,vertexShader:()=>Mn});var u={};i.r(u),i.d(u,{fragmentShader:()=>Cn,uniforms:()=>On,vertexShader:()=>Sn});var p={};i.r(p),i.d(p,{fragmentShader:()=>Pn,uniforms:()=>Dn,vertexShader:()=>In});var f={};i.r(f),i.d(f,{fragmentShader:()=>kn,uniforms:()=>Fn,vertexShader:()=>Ln});var m={};i.r(m),i.d(m,{fragmentShader:()=>jn,uniforms:()=>Nn,vertexShader:()=>on});var g={};i.r(g),i.d(g,{fragmentShader:()=>Bn,uniforms:()=>Un,vertexShader:()=>Vn});var v={};i.r(v),i.d(v,{fragmentShader:()=>Bn,uniforms:()=>Un,vertexShader:()=>$n});var y={};i.r(y),i.d(y,{fragmentShader:()=>Bn,uniforms:()=>Un,vertexShader:()=>Gn});var x={};i.r(x),i.d(x,{fragmentShader:()=>Bn,uniforms:()=>Un,vertexShader:()=>qn});var b={};i.r(b),i.d(b,{fragmentShader:()=>Hn,uniforms:()=>Zn,vertexShader:()=>Wn});var w={};i.r(w),i.d(w,{fragmentShader:()=>Xn,uniforms:()=>Qn,vertexShader:()=>Yn});var _={};i.r(_),i.d(_,{fragmentShader:()=>Jn,uniforms:()=>eo,vertexShader:()=>Kn});var A={};i.r(A),i.d(A,{fragmentShader:()=>io,uniforms:()=>ro,vertexShader:()=>to});var M={};i.r(M),i.d(M,{fragmentShader:()=>so,uniforms:()=>no,vertexShader:()=>ao});var T={};i.r(T),i.d(T,{fragmentShader:()=>lo,uniforms:()=>ho,vertexShader:()=>oo});var E={};i.r(E),i.d(E,{fragmentShader:()=>uo,uniforms:()=>po,vertexShader:()=>co});var S={};i.r(S),i.d(S,{fragmentShader:()=>mo,uniforms:()=>go,vertexShader:()=>fo});var C=i(6081),O=i(2957),R=i(6476);const I=((null===navigator||void 0===navigator?void 0:navigator.userAgent)||"").toLowerCase(),P=((null===navigator||void 0===navigator?void 0:navigator.vendor)||"").toLowerCase(),D=()=>{const e=navigator.userAgent;if(/edge?\//i.test(navigator.userAgent))return{name:"edge/edgehtml",version:void 0,mobile:!1};if(/google/i.test(navigator.vendor))return{name:"chrome/blink",version:void 0,mobile:!1};if(/apple/i.test(navigator.vendor)){const t=e.match(/Version\/([\d.]+) .*Safari/);return{name:"safari/webkit",version:t?t[1]:void 0,mobile:/Mobile\//.test(e)}}return/firefox\//i.test(navigator.userAgent)?{name:"firefox/gecko",version:e.replace(/^.+Firefox\//,""),mobile:!1}:/trident\//i.test(navigator.userAgent)||/msie\//i.test(navigator.userAgent)?{name:"ie/trident",version:void 0,mobile:!1}:{name:`${navigator.userAgent}\n${navigator.vendor}`,version:void 0,mobile:!1}},z=e=>{const t=(()=>{const e=window.document;return e.fullscreenElement||e.mozFullscreenElement||e.webkitFullscreenElement||e.msFullscreenElement})();return(0,R.n)(t)&&(t===e||t.contains(e))},k={firefox:!!I.match(/(?:firefox|fxios)\/(\d+)/),chrome:!!(/google inc/.test(P)?I.match(/(?:chrome|crios)\/(\d+)/):void 0),safari:!!function(){const{name:e}=D();return"safari/webkit"===e}(),version:function(){const{version:e}=D();return Number.parseFloat(e)}(),info:D()};var F=i(8464),j=i(5711),N=i(4818),V=i(1045);const B=class extends N.A{constructor(e){super(),this.loading=!1,this.account=e,this.get()}get(){return new Promise(((e,t)=>{this.hasLoaded()?e((0,j.$)({},this.permissions)):this.loading?this.on("load:done",(()=>{e((0,j.$)({},this.permissions))})):(this.loading=!0,this.trigger("load:start"),this.account.api().endpoint("oauth2/permissions").get().then((t=>{this.loading=!1,t.data&&(this.permissions=t.data,this.cached=new Date),e((0,j.$)({},this.permissions)),this.trigger("load:done")})))}))}isLoading(){return this.loading}hasLoaded(){return null!=this.permissions}canAccess(e){const t=(0,V.J)(this.permissions,e);return!!t&&t.allow}};var U=i(8385),$=i(2133),G=i(8377),q=i(9688),W=i(7922);const H=class{constructor(e,t,i,r=null){let a=null;if(i){const{code:e}=i||{};(null==e?void 0:e.startsWith("warn_"))&&(a=i)}this.response=e,this.data=t,this.error=(0,R.n)(a)?null:i,this.warning=a,this.params=r}headers(){return this.response?this.response.headers:void 0}},Z=class{constructor(e=[]){this._conditions=e||[]}addCondition(e){return this._conditions.push(e),this}removeCondition(e){const t=this._conditions.indexOf(e);return-1!==t&&this._conditions.splice(t,1),this}removeAllConditions(){return this._conditions=[],this}toString(){const e=this._conditions.length-1;return this._conditions.reduce(((t,i,r)=>t+`${i.toString()}${r<e?i.nextOperator:""}`),"")}};var Y=i(8708),X=i(2050),Q=i(2208),K=function(e,t,i,r){return new(i||(i=Promise))((function(a,s){function n(e){try{l(r.next(e))}catch(e){s(e)}}function o(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?a(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(n,o)}l((r=r.apply(e,t||[])).next())}))};class J{get requests(){return this._requests}constructor(e,t){this.config={server:"https://api.aerisapi.com",client:{id:void 0,secret:void 0}},this._params={endpoint:void 0},this._requests=[],this._paramKeys=["p","limit","radius","filter","fields","query","sort","skip","from","to","plimit","psort","pskip","callback","metric","requests","lang","format","mindist","pfilter","lod","mindist"],this._requestKeys=[],this.config=(0,j.$)({},this.config,e),this._range={},t&&this.setParams(t)}param(e,t){return(0,R.n)(t)?(this._paramKeys.includes(e)&&(0,U.h)(this._params,e,t),this):(0,V.J)(this._params,e)}getParams(){return(0,j.$)({},this._params)}setParams(e){if((0,R.g)(e))return this;const t=Object.keys(e).filter((e=>this._paramKeys.includes(e))).reduce(((t,i)=>(t[i]=e[i],t)),{});return this._params=(0,j.$)({},this._params,t),this}resetParams(){return this._params={endpoint:this._endpoint},this}endpoint(e){return this._endpoint=e,this.param("endpoint",e),this}getEndpoint(){return this._endpoint}action(e){return this._action=e,this}getAction(){return this._action}place(e){return this.param("p",e),this}p(e){return this.place(e)}bounds(e){if((0,$.K)(e)){const t=e;if(/,/.test(t)){const i=t.split(",").map((e=>Number.parseFloat(e)));4===i.length&&(e={north:i[0],west:i[1],south:i[2],east:i[3]})}}return this.place((0,X.iW)(e))}limit(e){return this.param("limit",e),this}lod(e){return this.param("lod",e),this}mindist(e){return(0,G.E)(e)&&(e=`${e}mi`),this.param("mindist",e),this}radius(e){return this.param("radius",e),this}filter(e){return this.param("filter",e),this}fields(e){return this.param("fields",e),this}query(e){return e instanceof Z&&(e=e.toString()),this.param("query",e),this}sort(e){return this.param("sort",e),this}skip(e){return this.param("skip",e),this}from(e){if((0,q.$)(e)){const t=e;if(Math.abs(t.getTime()-Date.now())<6e4)return this.param("from","now"),this;e=(0,Q.GG)(t,!0),this._range.from=t}return this.param("from",e),this}to(e){if((0,q.$)(e)){const t=e;if(Math.abs(t.getTime()-Date.now())<6e4)return this.param("to","now"),this;e=(0,Q.GG)(t,!0),this._range.to=t}return this.param("to",e),this}plimit(e){return this.param("plimit",e),this}psort(e){return this.param("psort",e),this}pskip(e){return this.param("pskip",e),this}format(e){return this.param("format",e),this}route(e){return this._route=e,this}addRequest(e){const t=e.url();let i=!this._requests.includes(e);return i&&this._requestKeys.forEach((e=>{t===e&&(i=!1)})),i&&(this._requestKeys.push(t),this._requests.push(e)),this}removeRequest(e){const t=this._requests.indexOf(e);return t>=0&&this._requests.splice(t,1),this}removeAllRequests(){this._requests=[]}get(e){return new Promise(((t,i)=>K(this,void 0,void 0,(function*(){var i;try{null===(i=this._request)||void 0===i||i.abort(),this._request=new AbortController;const r=this._action===Y.Fu.route?"POST":"GET",a={},s=yield fetch(this.url(),{method:r,body:this._action===Y.Fu.route?JSON.stringify(this._route):void 0,headers:a,signal:this._request.signal}).then((e=>K(this,void 0,void 0,(function*(){const t=yield e.json();return{status:e.status,data:t}}))));if(s){const i=(e=>{const t=e&&e.data?e.data:{};let i=t.error;return!i||"warn_no_data"!==i.code&&"warn_invalid_param"!==i.code&&"invalid_location"!==i.code||(i=null),new H(e,t.response||t,i,null)})(s);e&&e(i),t(i)}}catch(e){console.error("ApiRequest Error",e),t(new H(null,null,e,null))}}))))}cancel(){var e;null===(e=this._request)||void 0===e||e.abort()}url(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=e?"":this.config.server;const i=(0,j.$)({},(0,X.fN)(this._params,(e=>!(0,W.I)(e))),e?{}:{client_id:this.config.client.id,client_secret:this.config.client.secret});if(this._requests.length>0){t+="/batch";const e=[];this._requests.forEach((t=>{e.push(t.url(!0))})),i.requests=e.join(",")}else{if(!this._endpoint)throw new Error("Invalid ApiRequest - No endpoint specified");t+=`/${this._endpoint}`,this._action&&this._action!==Y.Fu.id&&this._action!==Y.Fu.all?t+=`/${this._action}`:i.p&&(t+=`/${encodeURIComponent(i.p)}`,delete i.p)}const r=Object.keys(i).filter((e=>"endpoint"!==e)).map((e=>`${encodeURIComponent(e)}=${encodeURIComponent(i[e])}`)).join("&");return r.length>0&&(t+=`?${r}`),t}clone(){const e=new J(this.config);return e.setParams(this._params),e}}const ee=J;var te=i(1739);const ie=class{constructor(e){let t,i,r,a;(0,te.G)(e)&&(t=e["x-aeris-valid-date"],i=e["x-aeris-min-valid-date"],r=e["x-aeris-max-valid-date"],a=e["x-aeris-run-date"]),t&&(this.validDate=new Date(t)),i&&(this.minValidDate=new Date(i)),r&&(this.maxValidDate=new Date(r)),a&&(this.runDate=new Date(a))}},re=class{constructor(e,t,i,r=null){this.response=e,this.image=t,this.error=i,this.params=r,e&&e.headers&&(this.metadata=new ie(e.headers))}headers(){return this.response?this.response.headers:void 0}},ae=class{constructor(e){this._opts={alpha:100,darkStyle:!1,text:!1,largeText:!1,metric:!1,blendMode:void 0,blur:0,filters:[],mask:void 0,includeText:!1},this._opts.darkStyle=/-dk/.test(e),this._opts.text=/-text/.test(e),this._opts.largeText=/-lg/.test(e),this.code=e.replace(/-(dk|text|lg)/,"").replace(/:.+$/,"")}opt(e,t){return t?((0,U.h)(this._opts,e,t),this):(0,V.J)(this._opts,e)}options(e){return e&&(this._opts=e),this._opts}alpha(e){return this.opt("alpha",e),this}darkStyle(e){return this.opt("darkStyle",e),this}text(e){return this.opt("text",e),this}includeText(e){return this.opt("includeText",e),this}largeText(e){return this.opt("largeText",e),this}metric(e){return this.opt("metric",e),this}blendMode(e){return this.opt("blendMode",e),this}blur(e){return this.opt("blur",e),this}mask(e){return this.opt("mask",e),this}addFilter(e){return this._opts.filters.push(e),this}removeFilter(e){const t=this._opts.filters.indexOf(e);return-1!==t&&this._opts.filters.splice(t,1),this}removeAllFilters(){return this._opts.filters=[],this}toString(){const e=this._opts;let t,i=this.code;return(e.includeText||e.text)&&(t=`${i}-text`,e.metric&&(t=`${t}-metric`),e.largeText&&(t=`${t}-lg`),e.text&&(i=t)),e.darkStyle&&(i=`${i}-dk`),e.alpha<100&&(i=`${i}:${e.alpha}`),e.blur>0&&(i=`${i}:blur(${e.blur})`),e.blendMode&&(i=`${i}:blend(${e.blendMode})`),e.filters.length>0&&(i=`${i}:${e.filters.join(":")})`),e.includeText&&t&&(i=`${i},${t}`),i}},se=e=>(e||"").replace(/\s/,"").split(","),ne=e=>(0,W.I)(e)?[]:Array.isArray(e)?e.map((e=>e instanceof ae?e.toString():e)):se(e),oe=e=>(Object.keys(e).forEach((t=>{const i=e[t];if("layers"===t)(0,te.G)(i)?Object.keys(i).forEach((e=>{i[e]=ne(i[e])})):e[t]=ne(i);else if("p"===t&&(0,te.G)(e[t])){const{lat:i,lon:r}=e[t];i&&r&&(e[t]=`${i},${r}`)}})),e);class le{constructor(e,t){this.config={server:"https://maps.aerisapi.com",client:{id:void 0,secret:void 0}},this._params={type:Y.e1.image,layers:{base:void 0,data:void 0,overlays:void 0,text:void 0},p:void 0,zoom:3,bounds:void 0,size:{width:void 0,height:void 0},offset:"0",metric:!1,format:"png"},this._serverRange=[1,2,3,4],this._paramKeys=["type","layers","layers.base","layers.data","layers.overlays","layers.text","p","center","zoom","bounds","size","size.width","size.height","offset","metric","format","suffix"],this.config=(0,j.$)(this.config,e),t&&this.setParams(t)}param(e,t){return t?(this._paramKeys.includes(e)&&((0,U.h)(this._params,e,t),e.startsWith("layers")&&(this._params=oe(this._params))),this):(0,V.J)(this._params,e)}setParams(e){return this._params=oe((0,j.$)(this._params,e)),this}type(e){return this.param("type",e),this}base(e){return this.param("layers.base",ne(e)),this}data(e){return this.param("layers.data",ne(e)),this}overlays(e){return this.param("layers.overlays",ne(e)),this}text(e){return this.param("layers.text",ne(e)),this}layers(e){return this.param("layers",ne(e)),this}place(e){return this.param("p",e),this}center(e){if((0,te.G)(e)){const{lat:t,lon:i}=e;t&&i&&(e=`${t},${i}`)}return this.param("p",e),this}zoom(e){return this.param("zoom",e),this}bounds(e){return this.param("bounds",e),this}size(e,t){return this.param("size",{width:e,height:t}),this}offset(e){return this.param("offset",`${e}`),this}suffix(e){return this.param("suffix",e),this}date(e){e=new Date(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes());const t=new Date(e.getTime()+60*e.getTimezoneOffset()*1e3),i=[`${t.getFullYear()}`,`${t.getMonth()+1}`.padStart(2,"0"),`${t.getDate()}`.padStart(2,"0"),`${t.getHours()}`.padStart(2,"0"),`${t.getMinutes()}`.padStart(2,"0"),"00"].join("");return this.offset(i)}metric(e){return e?(this.param("metric",e),this):this.param("metric")}range(e){return e?(this._serverRange=[...e],this):this._serverRange}get(e){return t=this,r=function*(){try{const t=this.url();if(!t){const t=new re(null,null,new Error("Invalid map url"),this._params);return e&&e(t),t}const i=yield fetch(t,{method:"GET",signal:this._request.signal}).then((e=>{const t=e.json();return{status:e.status,data:t}}));let r,a;i.status>=400?(a=(yield i.data).error,!a||"warn_no_data"!==a.code&&"warn_invalid_param"!==a.code&&"invalid_location"!==a.code||(a=null)):(r=new Image,r.src=t.includes(this.config.server)?t:`${this.config.server}/${t}`);const s=new re(i,r,a,this._params);return e&&e(s),s}catch(e){console.error("MapRequest Error",e)}return null},new((i=void 0)||(i=Promise))((function(e,a){function s(e){try{o(r.next(e))}catch(e){a(e)}}function n(e){try{o(r.throw(e))}catch(e){a(e)}}function o(t){var r;t.done?e(t.value):(r=t.value,r instanceof i?r:new i((function(e){e(r)}))).then(s,n)}o((r=r.apply(t,[])).next())}));var t,i,r}url(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=this.config.server;const i=(0,j.$)({},(0,X.fN)(this._params,(e=>!(0,W.I)(e))),{layers:[]});(0,$.K)(i.p)&&(i.p=i.p.replace(/\+/,"%20"));const r=this._params.layers;if((0,te.G)(r)){const t=r;e=(0,W.I)(e)?Object.keys(t):e,(0,W.I)(e)||e.forEach((e=>{let r=t[e];(0,W.I)(r)||(Array.isArray(r)||(r=se(r)),i.layers=[...i.layers,...r])}))}else Array.isArray(r)&&(i.layers=r);if(!(0,W.I)(i.layers)){if(i.offset=i.offset||"{time}",i.type===Y.e1.tile)(0,W.I)(this._serverRange)||(t=t.replace(/maps\./,"maps{s}.")),t+=`/${this.config.client.id}_${this.config.client.secret}/${i.layers}/{z}/{x}/{y}/${i.offset}${i.suffix||""}.${i.format}`;else{if(((0,W.I)(i.p)||":auto"===i.p)&&(0,W.I)(i.bounds))return void console.warn(`No valid location or bounds provided for the map - p: ${i.p}; bounds: ${i.bounds}`);const e=i.bounds;i.loc=(0,W.I)(e)?`${i.p},${i.zoom}`:`${e.south},${e.west},${e.north},${e.east}`,t+=`/${this.config.client.id}_${this.config.client.secret}/${i.layers}/${i.size.width}x${i.size.height}/${i.loc}/${i.offset}${i.suffix||""}.${i.format}`}return t}e.length>1&&console.warn(`No map layers specified - layers: ${i.layers}; groups: ${e.join(",")}`)}clone(){const e=new le(this.config);return e.setParams(this._params),e}}const he=le,ce={api:"https://data.api.xweather.com",maps:"https://maps.api.xweather.com"},de=class{constructor(e,t,i={}){this.id=e,this.secret=t,this.servers=Object.assign(Object.assign({},ce),i),this._permissions=new B(this)}credentials(){return{id:this.id,secret:this.secret}}permissions(){return this._permissions}canAccess(e){return this.permissions().canAccess(e)}api(){return new ee((0,j.$)({},{server:this.servers.api,client:{id:this.id,secret:this.secret}},arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}))}map(){return new he((0,j.$)({},{server:this.servers.maps,client:{id:this.id,secret:this.secret}},arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}))}};var ue=i(3564),pe=i(6232),fe=i(5096);const me=e=>"function"===(0,fe.N)(e);var ge=i(2436);const ve=(e,t)=>t?t.reduce(((t,i)=>(t[i]=e[i],t)),{}):{};var ye=i(5975);const xe=class extends N.A{constructor(e,t){super(),this.maxValidTimeIntervals=0,this._isLoading=!1,this._hasLoaded=!1,this.url=e,this._data=Object.assign({startDate:new Date,endDate:new Date},t),this._transformer=e=>e,this.data.maxValidTimes>0&&(this.maxValidTimeIntervals=this.data.maxValidTimes)}get data(){return this._data}get minZoom(){var e;return(null===(e=this.data)||void 0===e?void 0:e.minZoom)||0}get maxZoom(){var e;return(null===(e=this.data)||void 0===e?void 0:e.maxZoom)||21}get bounds(){var e;return null===(e=this.data)||void 0===e?void 0:e.bounds}get projection(){var e;return null===(e=this.data)||void 0===e?void 0:e.projection}get datasets(){var e;return null===(e=this.data)||void 0===e?void 0:e.datasets}get isLoading(){return this._isLoading}get hasLoaded(){return this._hasLoaded}get hasValidTimes(){var e;return(0,pe.Z)(null===(e=this.data)||void 0===e?void 0:e.validTimes)}getAllValidTimes(){return this.getValidTimes(0,0)}getValidTimes(){return this.getDatasetValidTimesAtIndex(arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.maxValidTimeIntervals)}getValidTimeForTime(e){const t=this.getValidTimes(arguments.length>1&&void 0!==arguments[1]?arguments[1]:0),i=e.getTime();if(0===t.length)return;let r=t[0],a=Math.abs(i-r.getTime());return t.forEach(((e,t)=>{const s=e.getTime(),n=i-s;n>=0&&n<=a&&(a=n,r=e)})),r}setValidTimeRange(e){this.data.startDate=e.start,this.data.endDate=e.end,this.trigger(ye.A.METADATA_RANGE,{startDate:e.start,endDate:e.end})}getDatasetAtIndex(e){var t;return((null===(t=this.data)||void 0===t?void 0:t.datasets)||[])[e]}getDatasetValidTimesAtIndex(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.maxValidTimeIntervals;var i;const r=null===(i=this.data)||void 0===i?void 0:i.validTimes;if((0,R.g)(r))return[];const a=Array.isArray(r[0])?r[e]:r;let s=a;return t>0&&a.length>t&&(s=(0,Q.y$)(s,this.data.startDate,this.data.endDate,t)),s||[]}setTransformer(e){this._transformer=e}setRequestTransformer(e){this._requestTransformer=e}load(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new Promise(((t,i)=>{if((0,R.g)(this.url))return(0,R.g)(this._data)&&(this._data={}),void t(this._data);if(this.isLoading)return void this.once(ye.A.METADATA_LOAD,(()=>{t(this._data)}));if(this._hasLoaded&&(0,W.h)(this._data)&&!0!==e.reload)return void t(this._data);this._isLoading=!0,this.trigger(ye.A.METADATA_LOAD_START);let r=Object.assign({url:this.url,params:{startDate:(0,Q.GG)(this.data.startDate,!0),endDate:(0,Q.GG)(this.data.endDate,!0)}},e);this._requestTransformer&&(r=this._requestTransformer(r));const a=r.params,s=(0,X.mN)(r.url,a);this._lastRequestOptions=Object.assign({},r),fetch(s,ve(r,["headers","params"])).then((e=>(e?e.status>=400&&i(new Error(`[MapsGL] An error occurred while requesting metadata; url: ${s}, status: ${e.status}`)):i(new Error(`[MapsGL] No response for metadata request: ${s}`)),e.json()))).then((e=>this.processMetadata(e))).then((e=>{const i={};(0,pe.Z)(null==a?void 0:a.startDate)&&(0,pe.Z)(null==a?void 0:a.endDate)&&(i.range={start:new Date(a.startDate),end:new Date(a.endDate)}),this._data=Object.assign(Object.assign({},this.data),this._transformer(e,i)),this._isLoading=!1,this._hasLoaded=!0,t(this._data),this.trigger(ye.A.METADATA_LOAD,{metadata:this.data})})).catch((e=>{this._isLoading=!1,i(e),this.trigger(ye.A.METADATA_ERROR,{error:e})}))}))}processMetadata(e){return e}};class be extends N.A{get type(){}get isReady(){return!0}constructor(e,t){if(super(),this.consumingLayers=[],(0,pe.E)(e))throw new Error("[MapsGL] Invalid value provided for the 'id' argument for the data source.");if((0,pe.E)(t))throw new Error(`[MapsGL] Invalid configuration for data source {${e}}`);this.id=e,this.spec=Object.freeze(t);const i=ve(t,["minZoom","maxZoom","projection","bounds","datasets"]);this.metadata=new xe(t.metadataUrl,Object.assign(Object.assign({},i),t.timeSeries)),this.metadata.on(ye.A.METADATA_RANGE,(()=>{this.getMetadata({reload:!0})})),me(t.transformMetadataRequest)&&this.metadata.setRequestTransformer((e=>t.transformMetadataRequest(this,e))),me(t.transformMetadata)&&this.metadata.setTransformer(((e,i)=>t.transformMetadata(this,e,i)))}getMetadata(e){return Promise.resolve({})}addConsumer(e){this.consumingLayers.find((t=>t.layerId===e.layerId))||this.consumingLayers.push(e)}removeConsumer(e){this.consumingLayers=this.consumingLayers.filter((t=>t.layerId!==e.layerId))}removeConsumerForLayerId(e){const t=this.consumingLayers.find((t=>t.layerId===e));t&&this.removeConsumer(t)}reload(){}dispose(){}}class we extends be{}const _e=be,Ae="undefined"!=typeof navigator&&/iphone|ipad|ipod|android/i.test(navigator.userAgent),Me=("undefined"!=typeof window&&window.matchMedia("(max-width: 767px)"),!("object"==typeof process&&"[object process]"===String(process)&&!process.browser)&&"undefined"!=typeof document),Te=Me&&Ae;let Ee=Me&&"complete"===document.readyState;const Se=Me?new Promise(((e,t)=>{Ee?e(document):window.addEventListener("load",(()=>{Ee=!0,e(document)}))})):Promise.resolve({}),Ce=function(){let{width:e=800,height:t=600,dpi:i=window.devicePixelRatio||1,id:r="gl-canvas",insert:a=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const s=document.createElement("canvas");return s.id=r,s.width=e*i,s.height=t*i,s.style.width=Number.isFinite(e)?`${e}px`:"100%",s.style.height=Number.isFinite(t)?`${t}px`:"100%",a&&Se.then((e=>{const t=e.body;t.insertBefore(s,t.firstChild)})),s},Oe=e=>("undefined"==typeof window?1:window.devicePixelRatio)/(e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1);var Re=i(4229),Ie=i(8346);const Pe=class extends N.A{constructor(e,t){super(),this._isAuthorizing=!1,this._requireToken=!0,this.account=e,this._server=t||e.servers.mapsgl||Ie.di}get credentials(){return this._token}get headers(){return this.isSessionValid?{Authorization:this.credentials?`Bearer ${this.credentials.accessToken}`:void 0}:{}}get isSessionValid(){var e,t;return!(0,R.g)(null===(e=this.credentials)||void 0===e?void 0:e.accessToken)&&!(0,R.g)(null===(t=this.credentials)||void 0===t?void 0:t.expires)&&this.credentials.expires.getTime()>=Date.now()}authenticate(){return this.getAccessToken().then((()=>this.headers))}getAccessToken(){if(!this._requireToken)return Promise.resolve();if(this.isSessionValid)return new Promise((e=>{e()}));if(this._isAuthorizing)return new Promise((e=>{this.once("token",(()=>e()))}));this._isAuthorizing=!0;const e=(0,X.mN)(`${this._server}/auth/token`),t=this.account,i=`${t.id}:${t.secret}`;return fetch(e.replace(/api-key=[^&]+$/,""),{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Authorization:`Basic ${window.btoa(i)}`},body:"grant_type=client_credentials"}).then((e=>{if(401===e.status)throw console.error("[MapsGL] Invalid Xweather access keys provided."),new Error("[MapsGL] Invalid Xweather access keys provided.");return e.json()})).then((e=>{const t=new Date(e.expires);this._isAuthorizing=!1,this._token={accessToken:e.access_token,expires:new Date(t.getTime()+60*-t.getTimezoneOffset()*1e3),tokenType:e.token_type},this.trigger("token",{token:this.credentials})}))}};var De=i(1989);const ze={initial:"initial",loading:"loading",reloading:"reloading",processing:"processing",ready:"ready",expired:"expired",failed:"failed",upsampled:"upsampled"};var Le=i(2527),ke=i(1798);const Fe=2*Math.PI*6371008.8,je=Fe/2;var Ne=i(1832),Ve=i(1181);const Be="mercator",Ue="globe";var $e=i(6570),Ge=i.n($e),qe=function(e,t){this.x=e,this.y=t},We=function(){function e(e,t,i,r,a){for(this.reader=e,this.extent=a,this.type=0,this.properties={},this.geometryOffset=0;e.pos<t;){var s=e.tag(),n=s[0],o=s[1];if(1==n)this.id=e.int64().toString();else if(2==n)for(var l=e.uint32()+e.pos;e.pos<l;){var h=i[e.uint32()],c=r[e.uint32()];this.properties[h]=c}else 3==n?this.type=e.uint32():4==n&&(this.geometryOffset=e.pos,e.skip(o))}}var t=e.prototype;return t.loadGeometry=function(){this.reader.pos=this.geometryOffset;for(var e=this.reader.uint32()+this.reader.pos,t=1,i=0,r=0,a=0,s=[],n=null;this.reader.pos<e;){if(i<=0){var o=this.reader.uint32();t=7&o,i=o>>>3}var l;--i,1==t||2==t?(r+=this.reader.sint32(),a+=this.reader.sint32(),1==t&&(n&&s.push(n),n=[]),null==(l=n)||l.push(new qe(r,a))):7==t&&n&&n.push(new qe(n[0].x,n[0].y))}return n&&s.push(n),s},t.bbox=function(){this.reader.pos=this.geometryOffset;for(var e=this.reader.uint32()+this.reader.pos,t=0,i=0,r=0,a=0,s=Number.MAX_SAFE_INTEGER,n=Number.MIN_SAFE_INTEGER,o=Number.MAX_SAFE_INTEGER,l=Number.MIN_SAFE_INTEGER;this.reader.pos<e;){if(i<=0){var h=this.reader.uint32();t=7&h,i=h>>>3}--i,1!=t&&2!=t||(r+=this.reader.sint32(),a+=this.reader.sint32(),n=Math.max(r,n),s=Math.min(r,s),l=Math.max(a,l),o=Math.min(a,o))}return[s,o,n,l]},t.toGeoJSON=function(e,t,i){var r,a=this.extent*Math.pow(2,i),s=this.extent*e,n=this.extent*t,o="",l=function(e){return e.map((function(e){return[360*(e.x+s)/a-180,360/Math.PI*Math.atan(Math.exp((180-360*(e.y+n)/a)*Math.PI/180))-90]}))};switch(this.type){case 1:o="Point",r=l(this.asPoints());break;case 2:o="LineString",r=this.asLines().map((function(e){return l(e)}));break;case 3:o="Polygon",(r=this.asPolygons()).forEach((function(e,t){e.forEach((function(e,i){r[t][i]=l(e)}))}))}1==r.length?r=r[0]:o="Multi"+o;var h={type:"Feature",geometry:{type:o,coordinates:r},properties:this.properties};return null!=this.id&&(h.id=this.id),h},t.asPoints=function(){var e=this.loadGeometry().map((function(e){return e[0]}));return 1==this.type?e:null},t.asLines=function(){return 2==this.type?this.loadGeometry():null},t.asPolygons=function(){return 3==this.type?function(e){var t=e.length;if(t<=1)return[e];for(var i=[],r=null,a=0;a<t;a++){var s,n=He(e[a]);0!=n&&(n>0?(r&&i.push(r),r=[e[a]]):null==(s=r)||s.push(e[a]))}return r&&i.push(r),i}(this.loadGeometry()):null},e}();function He(e){for(var t=0,i=0,r=e.length,a=r-1;i<r;a=i++){var s=e[i],n=e[a];t+=(n.x-s.x)*(s.y+n.y)}return t}var Ze=i(5341),Ye=i.n(Ze),Xe=i(1476),Qe=i.n(Xe);const Ke=e=>it/Mt*e,Je=function(e,t,i){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(3===e)return((e,t)=>{const i={minX:Number.POSITIVE_INFINITY,minY:Number.POSITIVE_INFINITY,maxX:Number.NEGATIVE_INFINITY,maxY:Number.NEGATIVE_INFINITY};for(let t=0;t<e.length;t++){const r=e[t][0];for(let e=0;e<r.length;e++){const t=r[e];i.minX=Math.min(i.minX,t.x),i.minY=Math.min(i.minY,t.y),i.maxX=Math.max(i.maxX,t.x),i.maxY=Math.max(i.maxY,t.y)}}if(i.minX<it&&i.minY<it&&i.maxX>=0&&i.maxY>=0)return Object.assign(Object.assign({},i),{key:t})})(t,i);if(2===e);else if(1===e)return(0,pe.Z)(r.collisionBox)?((e,t,i)=>{const r=e[0];return{minX:r.x+i.x1,minY:r.y+i.y1,maxX:r.x+i.x2,maxY:r.y+i.y2,key:t}})(t,i,r.collisionBox):function(e,t){const i=e[0],r=Ke(arguments.length>2&&void 0!==arguments[2]?arguments[2]:5);return{minX:i.x-r,minY:i.y-r,maxX:i.x+r,maxY:i.y+r,key:t}}(t,i,r.radius)},et=(e,t,i)=>{const r=i[0].map((e=>[e.x,e.y]));if(Qe()([e,t],r)){if(i.length>1)for(let r=1;r<i.length;r++){const a=i[r].map((e=>[e.x,e.y]));if(Qe()([e,t],a))return!1}return!0}return!1},tt=class{constructor(){this.tree=new(Ye())}populate(e){const t=e.map(((e,t)=>{let{type:i,geometry:r,properties:a}=e;return Je(i,r,t,a)})).filter((e=>(0,R.n)(e)));this.tree.load(t)}insert(e,t,i){if(!t)return;const r=Je(e,t,i);r&&this.tree.insert(r)}query(e,t,i,r){const a=this.within({minX:e,minY:t,maxX:e,maxY:t}).filter((a=>{const s=r.features[a.key];if(s.geometry){if(3===s.type){for(let i=0;i<s.geometry.length;i++)if(et(e,t,s.geometry[i]))return!0;return!1}if(1===s.type){const r=s.geometry,a=1-i%1*.5,n=(0,pe.Z)(s.properties.collisionBox)?function(e,t,i,r){let a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;return e>=i.x+r.x1*a&&e<=i.x+r.x2*a&&t>=i.y+r.y1*a&&t<=i.y+r.y2*a}(e,t,r[0],s.properties.collisionBox,a):function(e,t,i){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;const a=Ke(arguments.length>3&&void 0!==arguments[3]?arguments[3]:5)*r;return Math.hypot(i.x-e,i.y-t)<=a}(e,t,r[0],s.properties.radius,a);return!!n}}return!0}));return a}within(e){return this.tree.search(e)}collides(e){return this.tree.collides(e)}},it=8192,rt=class{get type(){throw new Error("Subclasses of VectorStore must override `type`")}get isEmpty(){return!1}get featureIndex(){return this._featureIndex}constructor(e){this.features=[],this.options=Object.freeze(e)}populate(e,t,i){let r=[];const a={},s={},n={};let o=0;for(let t=0;t<e.length;t++){const i=e[t],a=i.properties||{};Object.keys(a).forEach((e=>{(0,$.K)(a[e])&&/^([[{])/.test(a[e])&&(a[e]=JSON.parse(a[e]))})),a.zoom=this.options.zoom,r.push(i instanceof We?{type:i.type,featureIndex:o++,feature:i,sourceId:void 0,sourceLayerIndex:0,properties:a}:i)}(null==i?void 0:i.paint)&&(r=this.sortFeatures(r,i.paint));for(let e=0;e<r.length;e++){const o=this.addFeature(r[e],Object.assign(Object.assign({},this.options),i));if(o){const{dependencies:e}=o;this.features.push(o),(null==e?void 0:e.glyphs)&&Object.assign(a,e.glyphs),(null==e?void 0:e.icons)&&Object.assign(s,e.icons),(null==e?void 0:e.patterns)&&Object.assign(n,e.patterns),t&&t.insert(o.type,o.geometry,o.featureIndex)}}}sortFeatures(e,t){return e}addFeature(e,t){throw new Error("Subclasses of VectorStore must override `addFeature`")}trim(){throw new Error("Subclasses of VectorStore must override `trim`")}query(e,t,i){this._featureIndex||(this._featureIndex=new tt,this._featureIndex.populate(this.features)),(e<1||t<1)&&(e=Math.round(e*it),t=Math.round(t*it));const r=this.featureIndex.query(e,t,i,this);if(r.length>0)return r.map((e=>this.features[e.key].properties))}serialize(){return{type:this.type,id:this.id,options:Object.assign({},this.options),layoutVertexArray:void 0,indexArray:void 0,features:[...this.features]}}static from(e){throw new Error("Subclasses of VectorStore must override `VectorStore.from`")}};class at{constructor(e,t){if(t>e)throw new Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=e,this._minGranularity=t}getGranularityForZoomLevel(e){return Math.max(Math.floor(this._baseZoomGranularity/(1<<e)),this._minGranularity,1)}}class st{constructor(e){this.fill=new at(e.fill.base,e.fill.min),this.line=new at(e.line.base,e.line.min),this.tile=new at(e.tile.base,e.tile.min),this.stencil=new at(e.stencil.base,e.stencil.min),this.circle=e.circle}}st.noSubdivision={fill:{base:0,min:0},line:{base:0,min:0},tile:{base:0,min:0},stencil:{base:0,min:0},circle:1},st.globeSubdivision={fill:{base:128,min:2},line:{base:512,min:0},tile:{base:128,min:32},stencil:{base:128,min:1},circle:3};class nt{constructor(e,t){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._coord=e,this._granularity=t,this._granularityCellSize=it/t}subdividePolygonInternal(e,t){if(this._used)throw new Error("Subdivision: multiple use not allowed.");this._used=!0;const{flattened:i,holeIndices:r}=function(e){const t=[],i=[];for(const r of e)if(0!==r.length){r!==e[0]&&t.push(i.length/2);for(let e=0;e<r.length;e++)i.push(r[e].x,r[e].y)}return{flattened:i,holeIndices:t}}(e);let a;this._initializeVertices(i);try{const e=Ge()(i,r),t=this._convertIndices(i,e);a=this._subdivideTrianglesScanline(t)}catch(e){console.error(e)}let s=[];return t&&(s=this._generateOutline(e)),{verticesFlattened:this._vertexBuffer,indicesTriangles:a,indicesLineList:s}}_getKey(e,t){return(e+=32768)<<16|Math.trunc(t+=32768)}_vertexToIndex(e,t){const i=Math.trunc(e),r=Math.trunc(t),a=this._getKey(i,r);if(this._vertexDictionary.has(a))return this._vertexDictionary.get(a);const s=this._vertexBuffer.length/2;return this._vertexDictionary.set(a,s),this._vertexBuffer.push(i,r),s}_initializeVertices(e){for(let t=0;t<e.length;t+=2)this._vertexToIndex(e[t],e[t+1])}_convertIndices(e,t){const i=[];for(let r=0;r<t.length;r++)i.push(this._vertexToIndex(e[2*t[r]],e[2*t[r]+1]));return i}_subdivideTrianglesScanline(e){if(this._granularity<2)return function(e,t){const i=[];for(let r=0;r<t.length;r+=3){const a=t[r],s=t[r+1],n=t[r+2],o=e[2*a],l=e[2*a+1];(e[2*s]-o)*(e[2*n+1]-l)-(e[2*s+1]-l)*(e[2*n]-o)>0?i.push(a,n,s):i.push(a,s,n)}return i}(this._vertexBuffer,e);const t=[],i=e.length;for(let r=0;r<i;r+=3){const i=[e[r+0],e[r+1],e[r+2]],a=[this._vertexBuffer[2*e[r+0]+0],this._vertexBuffer[2*e[r+0]+1],this._vertexBuffer[2*e[r+1]+0],this._vertexBuffer[2*e[r+1]+1],this._vertexBuffer[2*e[r+2]+0],this._vertexBuffer[2*e[r+2]+1]];let s=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,l=Number.NEGATIVE_INFINITY;for(let e=0;e<3;e++){const t=a[2*e],i=a[2*e+1];s=Math.min(s,t),o=Math.max(o,t),n=Math.min(n,i),l=Math.max(l,i)}if(s===o||n===l)continue;const h=Math.floor(s/this._granularityCellSize),c=Math.ceil(o/this._granularityCellSize),d=Math.floor(n/this._granularityCellSize),u=Math.ceil(l/this._granularityCellSize);if(h!==c||d!==u)for(let e=d;e<u;e++){const r=this._scanlineGenerateVertexRingForCellRow(e,a,i);ht(this._vertexBuffer,r,t)}else t.push(...i)}return t}_scanlineGenerateVertexRingForCellRow(e,t,i){const r=e*this._granularityCellSize,a=r+this._granularityCellSize,s=[];for(let e=0;e<3;e++){const n=t[2*e],o=t[2*e+1],l=t[2*(e+1)%6],h=t[(2*(e+1)+1)%6],c=t[2*(e+2)%6],d=t[(2*(e+2)+1)%6],u=l-n,p=h-o,f=0===u,m=0===p,g=(r-o)/p,v=(a-o)/p,y=Math.min(g,v),x=Math.max(g,v);if(!m&&(y>=1||x<=0)||m&&(o<r||o>a)){h>=r&&h<=a&&s.push(i[(e+1)%3]);continue}!m&&y>0&&s.push(this._vertexToIndex(n+u*y,o+p*y));const b=n+u*Math.max(y,0),w=n+u*Math.min(x,1);f||this._generateIntraEdgeVertices(s,n,o,l,h,b,w),!m&&x<1&&s.push(this._vertexToIndex(n+u*x,o+p*x)),(m||h>=r&&h<=a)&&s.push(i[(e+1)%3]),!m&&(h<=r||h>=a)&&this._generateInterEdgeVertices(s,n,o,l,h,c,d,w,r,a)}return s}_generateIntraEdgeVertices(e,t,i,r,a,s,n){const o=r-t,l=a-i,h=0===l,c=h?Math.min(t,r):Math.min(s,n),d=h?Math.max(t,r):Math.max(s,n),u=Math.floor(c/this._granularityCellSize)+1,p=Math.ceil(d/this._granularityCellSize)-1;if(h?t<r:s<n)for(let r=u;r<=p;r++){const a=r*this._granularityCellSize;e.push(this._vertexToIndex(a,i+l*(a-t)/o))}else for(let r=p;r>=u;r--){const a=r*this._granularityCellSize;e.push(this._vertexToIndex(a,i+l*(a-t)/o))}}_generateInterEdgeVertices(e,t,i,r,a,s,n,o,l,h){const c=a-i,d=s-r,u=n-a,p=(l-a)/u,f=(h-a)/u,m=Math.min(p,f),g=Math.max(p,f),v=r+d*m;let y=Math.floor(Math.min(v,o)/this._granularityCellSize)+1,x=Math.ceil(Math.max(v,o)/this._granularityCellSize)-1,b=o<v;const w=0===u;if(w&&(n===l||n===h))return;if(w||m>=1||g<=0){const e=i-n,r=s+(t-s)*Math.min((l-n)/e,(h-n)/e);y=Math.floor(Math.min(r,o)/this._granularityCellSize)+1,x=Math.ceil(Math.max(r,o)/this._granularityCellSize)-1,b=o<r}const _=c>0?h:l;if(b)for(let t=y;t<=x;t++)e.push(this._vertexToIndex(t*this._granularityCellSize,_));else for(let t=x;t>=y;t--)e.push(this._vertexToIndex(t*this._granularityCellSize,_))}_generateOutline(e){const t=[];for(const i of e){const e=lt(i,this._granularity,!0),r=this._pointArrayToIndices(e),a=[];for(let e=1;e<r.length;e++)a.push(r[e-1],r[e]);t.push(a)}return t}_pointArrayToIndices(e){const t=[];for(let i=0;i<e.length;i++){const r=e[i];t.push(this._vertexToIndex(r.x,r.y))}return t}}function ot(e,t,i){let r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];return new nt(t,i).subdividePolygonInternal(e,r)}function lt(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!e||0===e.length)return[];if(e.length<2)return[];const r=e[0],a=e.at(-1),s=i&&(r.x!==a.x||r.y!==a.y);if(t<2)return s?[...e,e[0]]:[...e];const n=Math.floor(it/t),o=[];o.push({x:e[0].x,y:e[0].y});const l=e.length,h=s?l:l-1;for(let t=0;t<h;t++){const i=e[t],r=t<l-1?e[t+1]:e[0],a=i.x,s=i.y,h=r.x,c=r.y,d=a!==h,u=s!==c;if(!d&&!u)continue;const p=h-a,f=c-s,m=Math.abs(p),g=Math.abs(f);let v=a,y=s;for(;;){const e=p>0?(Math.floor(v/n)+1)*n:(Math.ceil(v/n)-1)*n,t=f>0?(Math.floor(y/n)+1)*n:(Math.ceil(y/n)-1)*n,i=Math.abs(v-e),r=Math.abs(y-t),a=Math.abs(v-h),s=Math.abs(y-c),l=d?i/m:Number.POSITIVE_INFINITY,x=u?r/g:Number.POSITIVE_INFINITY;if((a<=i||!d)&&(s<=r||!u))break;if(l<x&&d||!u){v=e,y+=f*l;const t={x:v,y:y};o.at(-1).x===t.x&&o.at(-1).y===t.y||o.push(t)}else{v+=p*x,y=t;const e={x:v,y:y};o.at(-1).x===e.x&&o.at(-1).y===e.y||o.push(e)}}const x={x:h,y:c};o.at(-1).x===x.x&&o.at(-1).y===x.y||o.push(x)}return o}function ht(e,t,i){if(0===t.length)throw new Error("Subdivision vertex ring is empty.");let r=0,a=e[2*t[0]];for(let i=1;i<t.length;i++){const s=e[2*t[i]];s<a&&(a=s,r=i)}const s=t.length;let n=r,o=(n+1)%s;for(;;){const r=n-1>=0?n-1:s-1,a=(o+1)%s,l=e[2*t[r]],h=e[2*t[a]],c=e[2*t[n]],d=e[2*t[n]+1],u=e[2*t[o]+1];let p=!1;if(l<h)p=!0;else if(l>h)p=!1;else{const i=u-d,s=-(e[2*t[o]]-c),n=d<u?1:-1;((l-c)*i+(e[2*t[r]+1]-d)*s)*n>((h-c)*i+(e[2*t[a]+1]-d)*s)*n&&(p=!0)}if(p){const e=t[r],a=t[n],l=t[o];e!==a&&e!==l&&a!==l&&i.push(l,a,e),n-=1,n<0&&(n=s-1)}else{const e=t[a],r=t[n],l=t[o];e!==r&&e!==l&&r!==l&&i.push(l,r,e),o+=1,o>=s&&(o=0)}if(r===a)break}}const ct=85.0511287798,dt=e=>(180+e)/360,ut=e=>(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360,pt=e=>360*e-180,ft=e=>360/Math.PI*Math.atan(Math.exp((180-360*e)*Math.PI/180))-90,mt=(e,t)=>e/(e=>Fe*Math.cos(e*Math.PI/180))(t),gt=class{constructor(){this.range=null}get type(){return Be}get zAxisUnit(){return"meters"}get subdivisionGranularity(){return new st(st.noSubdivision)}project(e,t){return e=(0,Le.q)(e,-85.0511287798,ct),{x:dt(t),y:ut(e),z:0}}unproject(e,t){const i=pt(e);return{lat:ft(t),lon:i}}projectTileCoordinates(e,t,i,r){const a=r.calculateTilePos(i).matrix,s=new Ne.A(e,t,0,1).applyMatrix4(a);return{point:{x:s.x,y:s.y,z:0},signedDistanceFromCamera:s.w,isOccluded:!1}}projectTilePoint(e,t){return{x:e,y:t}}pixelsPerMeter(e,t){return mt(1,e)*t}pixelSpaceConversion(e,t,i){return 1}metersPerPixel(e,t){const i=(0,Le.q)(t,0,25.5);return(e=>Math.cos((0,ke.p)((0,Le.q)(e,-85.0511287798,ct))))(e)*Fe/(512*Math.pow(2,i))}upVector(e){return new Ve.A(0,0,1)}upVectorScale(e,t,i){return{metersToTile:1,metersToLabelSpace:1}}},vt=e=>Fe*Math.cos(e*Math.PI/180),yt=e=>(180+e)/360,xt=e=>(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360,bt=e=>360*e-180,wt=e=>360/Math.PI*Math.atan(Math.exp((180-360*e)*Math.PI/180))-90;class _t{constructor(e,t,i=0){this.x=0,this.y=0,this.z=0,this.x=e,this.y=t,this.z=i}static fromCoordinate(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return new _t(yt(e.lon),xt(e.lat),((e,t)=>e/vt(t))(t,e.lat))}toCoordinate(){return{lon:bt(this.x),lat:wt(this.y)}}toAltitude(){return this.z*vt(wt(this.y))}meterInMercatorCoordinateUnits(e){const t=xt(e);return 1/Fe*(e=>1/Math.cos(e*Math.PI/180))(wt(t))}}const At=_t,Mt=512,Tt=(Math,Math,e=>Math.pow(2,e)),Et=function(e){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:Mt)*Tt(e)},St=function(e){return 1/Tt(e)},Ct=(e,t,i)=>({x:e*Fe/Math.pow(2,i)-je,y:-(t*Fe/Math.pow(2,i)-je)}),Ot=e=>{const{x:t,y:i,z:r}=e,a=Math.pow(2,r),s=t/a*360-180,n=Math.PI-2*Math.PI*i/a;return{lat:180/Math.PI*Math.atan(.5*(Math.exp(n)-Math.exp(-n))),lon:s}},Rt=(e,t,i)=>{const r=it*Math.pow(2,i.z);return kt({x:(i.x*it+e)/r,y:(i.y*it+t)/r})},It=e=>{const t=Ot({x:e.x,y:e.y,z:e.z}),i=Ot({x:e.x+1,y:e.y+1,z:e.z});return{north:t.lat,south:i.lat,west:t.lon,east:i.lon}},Pt=e=>{const t=1/Math.pow(2,e.z);return{x:t*e.x,y:t*e.y}},Dt=(e,t)=>{const{lat:i,lon:r}=e,a=Math.floor(t),s=(0,Le.q)(i,-85.0511287798,ct),n=(0,ke.p)(s);return{x:Math.floor((r+180)/360*Math.pow(2,a)),y:Math.floor((1-Math.log(Math.tan(n)+1/Math.cos(n))/Math.PI)/2*Math.pow(2,a)),z:a}},zt=(e,t)=>{const i=kt(e);return Dt(i,t)},Lt=e=>({x:yt(e.lon),y:xt(e.lat)}),kt=e=>({lat:wt(e.y),lon:bt(e.x)}),Ft=function(e,t){return arguments.length>2&&void 0!==arguments[2]&&!arguments[2]?e.lat<t.north&&e.lat>t.south&&e.lon>t.west&&e.lon<t.east:e.lat<=t.north&&e.lat>=t.south&&e.lon>=t.west&&e.lon<=t.east},jt=(e,t)=>(e%t+t)%t;class Nt{get hash(){return`${this.wrap}:${this.z}/${this.x}/${this.y}`}get wrap(){const e=Math.pow(2,this.z);return Math.floor(this.x/e)}get isRoot(){return 0===this.z}constructor(e,t,i){this.x=t,this.y=i,this.z=e}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}normalize(){const e=Math.pow(2,this.z);return new Nt(this.z,jt(this.x,e),jt(this.y,e))}getAncestor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;const t=Math.pow(2,e);return new Nt(this.z-e,Math.floor(this.x/t),Math.floor(this.y/t))}getDescendants(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;const t=Math.pow(2,e),i=Array.from({length:t*t});for(let r=0;r<t;r++){const a=r*t;for(let s=0;s<t;s++)i[a+s]=new Nt(this.z+e,this.x*t+r,this.y*t+s)}return i}getNeighbor(e,t){const{x:i,y:r,z:a,wrap:s}=this,n=Math.pow(2,a);let o=0,l=0,h=0;return 0===a?(o=i,h=s+e):(o=i+e,l=r+t,h=i+e<0?s-1:i+e>n?s+1:s),l<0||l>=n?null:new Nt(a,o,l)}getNeighbors(){const[e,t,i,r,a,s]=[-1,0,1,-1,0,1];return{tl:this.getNeighbor(e,r),tc:this.getNeighbor(t,r),tr:this.getNeighbor(i,r),ml:this.getNeighbor(e,a),mc:this,mr:this.getNeighbor(i,a),bl:this.getNeighbor(e,s),bc:this.getNeighbor(t,s),br:this.getNeighbor(i,s)}}getQuadrant(){return[this.x%2,this.y%2]}isAncestorOf(e){if(this.z>=e.z)return!1;const t=Math.pow(2,e.z-this.z),i=Math.floor(e.x/t),r=Math.floor(e.y/t);return this.x===i&&this.y===r}isDescendantOf(e){return e.isAncestorOf(this)}getPosition(){const e=Tt(this.z);return{x:this.x/e,y:this.y/e}}getCenter(){const e=Tt(this.z);return{x:(this.x+.5)/e,y:(this.y+.5)/e}}toString(){return`TileCoord: ${this.z}/${this.x}/${this.y}, wrap: ${this.wrap}`}toInfo(){return{z:this.z,x:this.x,y:this.y}}static fromHash(e){const t=(e||"").replace(/^\d+:/,"").split("/").map((e=>Number.parseInt(e,10)));return new Nt(t[0],t[1],t[2])}}const Vt=Nt;var Bt=i(5752);class Ut{get coord(){return this._coord}get span(){return this._span}get bounds(){return this._bounds}get state(){return this._state}set state(e){this._state=e}get data(){return this._data}set data(e){this._data=e}get size(){const e=this.data;let t={width:Mt,height:Mt};if(e instanceof HTMLImageElement)t.width=e.width,t.height=e.height;else if(e instanceof Bt.A)t=e.size;else if(Array.isArray(e)){const i=e[0];i instanceof Bt.A&&(t=i.size)}return t}constructor(e){this.uid=(0,X.NF)(),this._coord=e;const t=e.x,i=e.y,r=e.z,a=Ct(t,i,r),s=Ct(t+1,i+1,r);this._span={x:s.x-a.x,y:-(s.y-a.y)},this._bounds={nw:{x:a.x,y:s.y},se:{x:s.x,y:a.y}},this._state=ze.initial}clone(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=this.coord;0!==e&&(t=new Vt(t.z,t.x+e*Math.pow(2,t.z),t.y));const i=new Ut(t);return i.state=this.state,i.data=this.data,i}dispose(){const e=this.data;me(null==e?void 0:e.dispose)&&e.dispose()}toString(){return`Tile: ${this.coord.toString()}`}}const $t=Ut;var Gt=i(2717);class qt{constructor(e,t,i,r){this.value=e,this.list=r,t?(t.next=this,this.prev=t):this.prev=void 0,i?(i.prev=this,this.next=i):this.next=void 0}}const Wt=class{constructor(){this._head=void 0,this._tail=void 0}*items(){let e=this._head||this._tail;for(;e;)yield e,e=e.next}get size(){let e=0;return this.forEach((t=>e+=1)),e}get head(){return this._head}get tail(){return this._tail}push(e){const t=new qt(e,this._tail,void 0,this);return this._tail=t,this._head||(this._head=t),t}unshift(e){const t=new qt(e,void 0,this._head,this);return this._head=t,this._tail||(this._tail=t),t}pop(){if(!this._tail)return;const e=this._tail;return this._tail=e.prev,this._tail?this._tail.next=void 0:this._head=void 0,e.value}shift(){if(!this._head)return;const e=this._head;return this._head=e.next,this._head?this._head.prev=void 0:this._tail=void 0,e.value}find(e){if(this.isEmpty())return;let t=this._head;for(;t;){if(e(t.value))return t;t=t.next}}isEmpty(){return!this._head}forEach(e){let t=this._head||this._tail;for(let i=0;null!==t;i++)e(t.value,i),t=t.next}pushNode(e){if(e===this._tail)return;e.list&&e.list.removeNode(e);const t=this._tail;e.list=this,e.prev=t,t&&(t.next=e),this._tail=e,this._head||(this._head=e)}unshiftNode(e){if(e===this._head)return;e.list&&e.list.removeNode(e);const t=this._head;e.list=this,e.next=t,t&&(t.prev=e),this._head=e,this._tail||(this._tail=e)}removeNode(e){if(e.list!==this)throw new Error("Removing list node which does not belong to this list.");const t=e.next,i=e.prev;t&&(t.prev=i),i&&(i.next=t),e===this._head&&(this._head=t),e===this._tail&&(this._tail=i),this._head&&(this._head.prev=void 0),this._tail&&(this._tail.next=void 0),e.next=void 0,e.prev=void 0,e.list=void 0}delete(e){let t=!1;for(;this._head&&this._head.value===e;)t=!0,this._head=this._head.next;return t}clear(){this._head=void 0,this._tail=void 0}},Ht=class{get size(){return this._cache.size}get cache(){return this._cache}get first(){return this._list.head.value.val}get last(){return this._list.tail.value.val}*keys(){for(const e of this._list.items())yield e.value.key}*values(){for(const e of this._list.items())yield e.value.val}*entries(){for(const e of this._list.items()){const t={key:e.value.key,val:e.value.val};yield t}}constructor({capacity:e=200,ttl:t=0,onRemove:i=(()=>{})}={}){this.capacity=20,this._ttl=0,this._cache=new Map,this._list=new Wt,this.capacity=Math.max(1,e||256),this._ttl=t,this._onRemove=i}has(e){return this._cache.has(e)}get(e){const t=this._cache.get(e);if(t){if(!this._isExpired(t.value))return this._bumpAge(t.value),t.value.val;this.delete(t.value.key)}}peek(e){const t=this._cache.get(e);if(t)return t.value.val}set(e,t){const i=this._cache.get(e);if(i){const e=i.value;return e.val!==t&&(this._onRemove(e.key,e.val),e.val=t),void this._bumpAge(e)}const r={key:e,val:t,exp:Date.now()+this._ttl,node:void 0},a=this._list.unshift(r);if(this._cache.set(e,a),r.node=a,this._cache.size>this.capacity){const e=this._list.pop();this.delete(e.key)}}delete(e){const t=this._cache.get(e);if(!t)return;const i=t.value;return this._onRemove(i.key,i.val),this._cache.delete(e),this._list.removeNode(t),i.val}clear(){this.forEach((e=>{this._onRemove(e.key,e.val)})),this._cache.clear(),this._list.clear()}forEach(e){if(me(e))for(const[t,i]of this._cache)e(i.value)}_bumpAge(e){e.exp=Date.now()+this._ttl,this._list.unshiftNode(e.node)}_isExpired(e){return this._ttl>0&&e.exp<Date.now()}},Zt=e=>Math.log2(e)%1==0,Yt=class{get identifier(){return this._identifier}set identifier(e){this._identifier=e}get context(){return this._context}set context(e){this._context=e}get gl(){return this.context.gl}constructor(e){this._context=e}},Xt="[AerisGL] Resource subclass must define virtual methods";let Qt=1;const Kt=new Set,Jt=class extends Yt{get handle(){return this._handle}static get resourceCount(){return Kt.size}constructor(e,t={}){super(e);const{name:i}=t||{};this.id=Qt,this.name=i,this.opts=Object.assign({},t),Qt+=1,void 0===this.handle&&(this._handle=this.createHandle())}dispose(){throw new Error(`${this.constructor.name} - ${Xt}`)}getParameter(e){throw new Error(`${this.constructor.name} - ${Xt}`)}setParameter(e,t){throw new Error(`${this.constructor.name} - ${Xt}`)}createHandle(){throw new Error(`${this.constructor.name} - ${Xt}`)}deleteHandle(){throw new Error(`${this.constructor.name} - ${Xt}`)}getOptsFromHandle(e){throw new Error(`${this.constructor.name} - ${Xt}`)}incrementResourceCount(){Kt.has(this.id)||Kt.add(this.id)}decrementResourceCount(){Kt.delete(this.id)}toString(){return`${this.constructor.name}(${this.id})`}},ei=class extends Jt{get version(){return this._state.version}constructor(e,t={}){super(e,Object.assign(((e,t)=>({type:e.UNSIGNED_BYTE,format:e.RGBA,internalFormat:t.format||e.RGBA,wrapS:e.CLAMP_TO_EDGE,wrapT:e.CLAMP_TO_EDGE,generateMipmaps:!0,minFilter:t.generateMipmaps?e.LINEAR_MIPMAP_LINEAR:e.LINEAR,magFilter:e.LINEAR,premultiplyAlpha:!1,unpackAlignment:4,flipY:!1,anisotropy:0,level:0}))(e.gl,t),t)),this.size={width:0,height:0},this.needsUpdate=!1,this.textureUnit=0,this.image=this.opts.image,this.type=this.opts.type,this.format=this.opts.format,this.internalFormat=this.opts.internalFormat,this.wrapS=this.opts.wrapS,this.wrapT=this.opts.wrapT,this.minFilter=this.opts.minFilter,this.magFilter=this.opts.magFilter,this.generateMipmaps=this.opts.generateMipmaps,this.premultiplyAlpha=this.opts.premultiplyAlpha,this.unpackAlignment=this.opts.unpackAlignment,this.flipY=this.opts.flipY,(0,R.n)(this.opts.size)&&this.opts.size.width>0&&this.opts.size.height>0&&(this.size=this.opts.size),this._state={},this._state.version=-1,this.needsUpdate=!0,this.update()}updateImage(e,t,i,r,a){const s=this.gl;this.bind(),this.updateContextState(),ArrayBuffer.isView(e)?s.texSubImage2D(s.TEXTURE_2D,0,t,i,r,a,this.format,this.type,e):(e=>e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap)(e)&&s.texSubImage2D(s.TEXTURE_2D,0,t,i,this.format,this.type,e)}update(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const t=this.gl,i=!(this.image===this._state.image&&!this.needsUpdate);if((i||this.context.state.textureUnits[e]!==this.id||this.context.state.activeTextureUnit!==e)&&(this.context.state.setActiveTexture(e),this.bind(e)),!i)return;this.needsUpdate=!1,this.wrapS!==this._state.wrapS&&(t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,this.wrapS),this._state.wrapS=this.wrapS),this.wrapT!==this._state.wrapT&&(t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,this.wrapT),this._state.wrapT=this.wrapT),this.minFilter!==this._state.minFilter&&(t.texParameteri(t.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.minFilter),this._state.minFilter=this.minFilter),this.magFilter!==this._state.magFilter&&(t.texParameteri(t.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.magFilter),this._state.magFilter=this.magFilter),this.updateContextState();const r=this.image;r?(r.width&&(this.size={width:r.width,height:r.height}),ArrayBuffer.isView(r)?t.texImage2D(t.TEXTURE_2D,0,this.internalFormat,this.size.width,this.size.height,0,this.format,this.type,r):t.texImage2D(t.TEXTURE_2D,0,this.internalFormat,this.format,this.type,r),this.generateMipmaps&&(this.context.isWebGL2||Zt(r.width)&&Zt(r.height)?this.gl.generateMipmap(t.TEXTURE_2D):(this.generateMipmaps=!1,this.wrapS=this.wrapT=this.gl.CLAMP_TO_EDGE,this.minFilter=this.gl.LINEAR)),this.onUpdate&&this.onUpdate()):this.size.width>0?t.texImage2D(t.TEXTURE_2D,0,this.internalFormat,this.size.width,this.size.height,0,this.format,this.type,null):t.texImage2D(t.TEXTURE_2D,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,new Uint8Array(4)),this._state.image=this.image,this._state.version+=1}bind(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.textureUnit;const t=this.gl;this.textureUnit=e,this.context.state.textureUnits[e]=this.id,t.bindTexture(t.TEXTURE_2D,this.handle)}unbind(){(0,ue.vA)((0,R.n)(this.textureUnit),"[AerisGL] Texture.unbind: must specify texture unit");const e=this.gl;e.activeTexture(e.TEXTURE0+this.textureUnit),e.bindTexture(e.TEXTURE_2D,null),delete this.context.state.textureUnits[this.textureUnit]}updateContextState(){this.context.state.setPixelStoreFlipY(this.flipY),this.context.state.setPixelStoreUnpackPremultiplyAlpha(this.premultiplyAlpha),this.context.state.setPixelStoreUnpackAlignment(this.unpackAlignment)}createHandle(){return this.incrementResourceCount(),this.gl.createTexture()}deleteHandle(){this.handle&&(this.gl.deleteTexture(this.handle),this.decrementResourceCount()),this._handle=void 0}dispose(){this.unbind(),this.deleteHandle(),this.image=void 0,this._state.image=void 0}toString(){return`${this.constructor.name}:${this.id} - size: ${this.size.width}x${this.size.height}`}},ti=class{get available(){return this._available.length}get used(){return this._used.size}constructor(e,t={}){const{capacity:i=256,size:r={width:256,height:256}}=t,a=function(e,t){var i={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(i[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(i[r[a]]=e[r[a]])}return i}(t,["capacity","size"]);this.context=e,this._available=Array.from({length:i}),this._used=new Map,this._textureOpts=Object.assign({},a),this._blank=new ei(e,Object.assign({size:r},a)),this.resize(r)}resize(e){this._size=e;const t=this._available.length+this._used.size;this._used=new Map;for(let i=0;i<t;i++)this._available[i]={data:void 0,texture:new ei(this.context,Object.assign({size:e},this._textureOpts))}}has(e){return this._used.has(e)}get(e){return this._used.get(e)}set(e,t,i,r){let a=this.get(e);if(a&&!0!==i)return a;if(0===this._available.length)return void console.error("[MapsGL] No available texture chunks in array");a||(a=this._available.pop());const s=(e=>{let t=e;return Array.isArray(t)&&(t=t[0]),t})(t);return a.data=t,a.texture.image=s,(0,R.n)(r)&&r.width>0&&r.height>0&&(a.texture.size=r),this._used.set(e,a),a}delete(e){if(!this.has(e))return{texture:this._blank};const t=this._used.get(e);t.texture.image=void 0,this._used.delete(e),this._available.push(t)}clear(){const e=this._available.length+this._used.size;this._available.forEach((e=>{var t;null===(t=e.texture)||void 0===t||t.dispose()})),this._used=new Map;for(let t=0;t<e;t++)this._available[t]={data:void 0,texture:new ei(this.context,Object.assign({size:this._size},this._textureOpts))}}dispose(){this._blank.dispose(),this._available.forEach((e=>{var t;null===(t=e.texture)||void 0===t||t.dispose()})),this._used=new Map,this._available=[]}},ii=class{get capacity(){return this._tiles.capacity+1/3*(Math.pow(4,this._persistantLevels)-1)}get keys(){return[...this._tiles.cache.keys()]}get levels(){return this._levels}get total(){return this._tiles.size}get totalPending(){return this._pending.size}get totalStale(){return this._stale.size}get textures(){return this._textures}constructor(e=128){this._persistantLevels=0,this._removeCallbacks=[],this._tiles=new Ht({capacity:e,onRemove:(e,t)=>{this.remove(t)}}),this._textureDataProvider=e=>e,this._levels=new Map,this._persistants=new Map,this._pending=new Map,this._stale=new Map,this._persistantLevels=1}has(e){return e.z<this._persistantLevels?this._persistants.has(e.hash):this._tiles.has(e.hash)}get(e){return(0,pe.E)(e)?null:e.z<this._persistantLevels?this._persistants.get(e.hash):this._tiles.get(e.hash)}add(e,t){if(!(0,pe.E)(e)&&(e.coord.z<this._persistantLevels?this._persistants.set(e.coord.hash,e):this._tiles.set(e.coord.hash,e),this._levels.has(e.coord.z)||this._levels.set(e.coord.z,[]),this._levels.get(e.coord.z).push(e),this.textures)){const i=this._textureDataProvider(e.data);(0,R.n)(i)&&this.textures.set(e.coord.hash,i,!0,t)}}remove(e){e.coord.z<this._persistantLevels&&this._persistants.delete(e.coord.hash);const t=this._levels.get(e.coord.z);t&&(t.splice(t.indexOf(e),1),0===t.length&&this._levels.delete(e.coord.z)),this.textures&&this.textures.delete(e.coord.hash),(0,Gt.x)(e.data,["dispose"])&&e.data.dispose(),this._removeCallbacks.forEach((t=>t(e)))}isPending(e){return this._pending.has(e.hash)}isStale(e){return this._stale.has(e.coord.hash)}setPending(e,t){t?this._pending.set(e.coord.hash,e):this._pending.delete(e.coord.hash)}setStale(e,t){t?this._stale.set(e.coord.hash,!0):this._stale.delete(e.coord.hash)}setTextureDataProvider(e){this._textureDataProvider=e}clearPending(){this._pending.forEach((e=>{this._stale.set(e.coord.hash,!0)})),this._pending=new Map}clear(){var e;this.clearPending(),this._persistants.forEach((e=>{this.remove(e)})),this._persistants.clear(),this._tiles.clear(),this._stale.clear(),this._levels.clear(),null===(e=this._textures)||void 0===e||e.clear()}forEach(e){this._persistants.forEach((t=>e(t))),this._tiles.forEach((t=>e(t.val)))}prepareTextureArray(e,t){this._textures||(this._textures=new ti(e,t))}onRemove(e){this._removeCallbacks.push(e)}dispose(){var e;this.clear(),null===(e=this._textures)||void 0===e||e.dispose()}},ri=class{constructor(){this.pending=new Map}get size(){let e=0;return this.pending.forEach((t=>{e+=t.size})),e}isPending(e,t){const i=this.pending.get(e.hash);return!!i&&i.has(t)}setPending(e,t,i){let r=this.pending.get(e.hash);r||(r=new Set,this.pending.set(e.hash,r)),(0,R.n)(t)&&t.forEach(i?e=>r.add(e):e=>r.delete(e)),0===r.size&&this.pending.delete(e.hash)}get(e){return this.pending.get(e.hash)}delete(e,t){(0,R.n)(t)?this.setPending(e,t,!1):this.pending.delete(e.hash)}clear(){this.pending.clear()}};function ai(e,t){return`${e.hash}::${t}`}const si=class{get pending(){return this._pending}get totalPending(){return Object.keys(this._requests).length}constructor(e,t){this._pending=new ri,this._state=new Map,this._requests={},this._pendingCallbacks={},this._retries=new Map,this._source=e,this._tileFetcher=me(t)?t:function(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{method:r="GET",body:a,headers:s,signal:n}=i;return fetch(t,{method:r,headers:s,body:"POST"===r&&(0,pe.Z)(a)?JSON.stringify(a):void 0,signal:n}).then(X.M4)}}setTileFetcher(e){this._tileFetcher=e}loadTile(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{authenticator:i,params:r,intervals:a}=t,s=this._source.getTileUrl(e,r);let n;if((0,R.n)(a)&&Array.isArray(a)&&(n=a.filter((t=>!1===this.pending.isPending(e,t.getTime()))).map((e=>e.getTime())),0===n.length)){const t=(0,pe.Z)(a)?a[0].getTime():0,i=ai(e,t),r=this._requests[i];return r?r.task:Promise.resolve({data:null,headers:null})}this.abortTile(e);const o=new AbortController,l=new Promise(((r,a)=>{var l;n&&this.pending.setPending(e,n,!0),t.authenticator&&(t.headers=Object.assign(Object.assign({},t.headers),{Authorization:(null===(l=t.authenticator.credentials)||void 0===l?void 0:l.accessToken)?`Bearer ${t.authenticator.credentials.accessToken}`:void 0})),this.fetchTile(e,s,Object.assign({signal:o.signal},t)).then((s=>{return o=this,h=function*(){if(n&&this.pending.setPending(e,n,!1),n?n.forEach((t=>{const i=ai(e,t);delete this._requests[i]})):delete this._requests[e.hash],s){if(i&&401===s.status)return i.authenticate().then((()=>this.loadTile(e,t)));{const e=s instanceof Response?yield s.blob():s;r({data:e,headers:s.headers})}}else a(new Error("[MapsGL] No response for tile request"))},new((l=void 0)||(l=Promise))((function(e,t){function i(e){try{a(h.next(e))}catch(e){t(e)}}function r(e){try{a(h.throw(e))}catch(e){t(e)}}function a(t){var a;t.done?e(t.value):(a=t.value,a instanceof l?a:new l((function(e){e(a)}))).then(i,r)}a((h=h.apply(o,[])).next())}));var o,l,h})).catch((i=>{const o=n?ai(e,n[0]):e.hash,l=this._requests[o];if((null==l?void 0:l.abortController.signal.aborted)&&n&&this.pending.setPending(e,n,!1),!l||!0!==(null==l?void 0:l.abortController.signal.aborted)){n&&this.pending.setPending(e,n,!1);let l=this._retries.get(o);(0,R.g)(l)&&(l=0),l<1?setTimeout((()=>{l+=1,console.warn(`[MapsGL] Retrying failed tile request, attempt ${l} of 1; url: ${s}`),this._retries.set(o,l),r(this.loadTile(e,t))}),100):(console.error(`[MapsGL] - Tile request failed; url: ${s}, error:`,i),a(i))}}))}));return n?n.forEach((t=>{const i=ai(e,t);this._requests[i]={task:l,abortController:o}})):this._requests[e.hash]={task:l,abortController:o},l}fetchTile(e,t,i){if(this._source.spec.transformRequest){const e=this._source.spec.transformRequest(this._source,{url:t,options:i});t=e.url,i=e.options}return this._tileFetcher(e,t,i)}abortTile(e){const t=e.hash;Object.keys(this._requests).forEach((e=>{if(e.startsWith(`${t}::`)||e===t){const t=this._requests[e];t&&t.abortController.abort(),delete this._requests[e]}}))}},ni=class{get credentials(){}get headers(){return{}}authenticate(){return Promise.resolve({})}};var oi=i(7318),li=function(e,t,i,r){return new(i||(i=Promise))((function(a,s){function n(e){try{l(r.next(e))}catch(e){s(e)}}function o(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?a(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(n,o)}l((r=r.apply(e,t||[])).next())}))},hi=function(e,t){var i={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(i[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(i[r[a]]=e[r[a]])}return i};const ci=class extends _e{get tileUrl(){return this._url}get tileSize(){return"number"==typeof this.spec.tileSize?{width:this.spec.tileSize,height:this.spec.tileSize}:this.spec.tileSize}get tileManager(){return this._tileManager}get tiles(){return this._tiles}get bounds(){var e;return null===(e=this.metadata)||void 0===e?void 0:e.bounds}get isReady(){return!this.needsMetadata||this.metadata.hasLoaded}get isLoading(){return Object.keys(this._requests).length>0}get needsMetadata(){return(0,pe.Z)(this.spec.metadataUrl)}constructor(e,t){super(e,Object.assign({tileSize:Mt},t)),this.minZoom=0,this.maxZoom=21,this._requests={},this._tileRetries=new Map,this._triggerLoadCompleteEvent=!1,this._isDisposed=!1,this.shouldTriggerLoadEvents=!0,this.authenticator=this.spec.authenticator||new ni,this._url=this.spec.url,this.minZoom=(0,R.n)(t.minZoom)?t.minZoom:0,this.maxZoom=(0,R.n)(t.maxZoom)?t.maxZoom:21,this.metadata.on(ye.A.METADATA_LOAD_START,(e=>{this.trigger(ye.A.METADATA_LOAD_START,Object.assign({},e))})),this.metadata.on(ye.A.METADATA_LOAD,(e=>{this.trigger(ye.A.METADATA_LOAD,Object.assign({},e))})),this.metadata.on(ye.A.METADATA_ERROR,(e=>{this.trigger(ye.A.METADATA_ERROR,Object.assign({},e))})),this._tileManager=new si(this),this._tiles=new ii,this.tiles.onRemove((e=>{const t=this._requests[e.coord.hash];t&&t.abort(),e.dispose(),this.trigger(ye.A.TILE_REMOVE,{sourceId:this.id,tile:e})})),this.metadata.setTransformer(((e,i)=>{me(t.transformMetadata)&&(e=t.transformMetadata(this,e,i));const r=Object.assign(Object.assign({},this.metadata.data),e);return r.maxZoom=(0,R.n)(e.maxZoom)?e.maxZoom:this.maxZoom,r.validTimes=(0,Q.Or)(r.validTimes),r})),t.loadTile&&this.tileManager.setTileFetcher(((e,i,r)=>t.loadTile(e,i,r)))}generateTile(e){return new $t(e)}setTileUrl(e){this._url=e,this.trigger(ye.A.DATA_STALE,{source:this})}getTileUrl(e,t){return(0,X.mN)(this.tileUrl,Object.assign(Object.assign({},t),{x:e.x,y:e.y,z:e.z,s:Math.abs(e.x+e.y)%4+1,size:this.tileSize.width,width:this.tileSize.width,height:this.tileSize.height,startDate:this.metadata.data.startDate,endDate:this.metadata.data.endDate}))}hasTile(e,t){return(0,R.n)(this.tiles.get(e))}hasTileData(e,t){const i=this.tiles.get(e);return!!i&&(0,R.n)(i.data)&&i.state!==ze.expired}getTileData(e){const t=this.tiles.get(e);return null==t?void 0:t.data}getTileDataSize(e){return this.tileSize}shouldRequestTile(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=this.tiles.get(e.coord);return!i||i.state===ze.initial||i.state===ze.expired||!0!==(i||this.tiles.isPending(e.coord)||i.state===ze.failed&&!t)}reload(){this.expireAllTiles(),this.tiles.forEach((e=>{this.requestTile(e.coord,{reload:!0})}))}requestTile(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const i=t||{},{reload:r=!1,checkPending:a=!0}=i,s=hi(i,["reload","checkPending","body"]),{time:n}=s.params||{};if(this._isDisposed)return;this.shouldTriggerLoadEvents&&0===this.tiles.totalPending&&(this.trigger(ye.A.LOAD_START,{sourceId:this.id}),this._triggerLoadCompleteEvent=!0);const o=this.getOrCreateTile(e);if(!this.shouldRequestTile(o,r)&&a)return new Promise((e=>{e(null)}));if(o.state===ze.expired&&(t.reload=!0),this.metadata.getValidTimes().length>0){const e=this.metadata.getValidTimeForTime(n||new Date);if(n&&!e)return void console.warn(`[MapsGL] No data interval available for time ${null==n?void 0:n.toString()}`);(0,R.n)(e)&&(s.params=Object.assign(Object.assign({},s.params),{time:e}),t.intervals||(t.intervals=[e]))}return!1===this.tiles.isPending(o.coord)&&this.trigger(ye.A.TILE_LOAD_START,{sourceId:this.id,tile:o}),this.tiles.setPending(o,!0),this.getMetadata().then((()=>this.loadTile(o,t)))}getOrCreateTile(e){let t=this.tiles.get(e);return t||(t=this.generateTile(e),this.tiles.isStale(t)&&(t.state=ze.expired),this.tiles.add(t)),t}loadTile(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const i=t||{},{reload:r=!1,checkPending:a=!0,body:s,intervals:n}=i,o=hi(i,["reload","checkPending","body","intervals"]);return new Promise(((i,a)=>{e.state=ze.loading,this._tileManager.loadTile(e.coord,Object.assign({headers:Object.assign({},this.authenticator.headers),body:s,intervals:n,reload:r},o)).then((t=>li(this,[t],void 0,(function*(t){let{data:r,headers:a}=t;if(!this._isDisposed&&(0,R.n)(r)){const t=yield this.parseTile(e,r,a);this.onTileLoaded(e,t),i(t)}})))).catch((r=>li(this,void 0,void 0,(function*(){if((r instanceof oi.tF&&401===r.response.status||r instanceof oi.D_)&&this.authenticator){const r=yield this.authenticator.authenticate().then((()=>this.requestTile(e.coord,t)));i(r)}else this.onTileError(e,r),a(r)}))))}))}getMetadata(e){return this.authenticator.authenticate().then((()=>this.metadata.load(Object.assign(Object.assign({},e),{headers:this.authenticator.headers})))).then((()=>((0,R.n)(this.metadata.minZoom)&&(this.minZoom=Math.max(this.minZoom,this.metadata.minZoom)),(0,R.n)(this.metadata.maxZoom)&&(this.maxZoom=Math.min(this.maxZoom,this.metadata.maxZoom)),this.metadata))).catch((e=>{throw console.error("[MapsGL] Failed to load metadata",e),new Error(`[MapsGL] Failed to load metadata - error: ${e.message}`)}))}removeConsumer(e){super.removeConsumer(e),0===this.consumingLayers.length&&this.cancelAllRequests()}abortTile(e){const t=e.coord.normalize(),i=this._requests[t.hash];i&&i.abort()}parseTile(e,t,i){return Promise.resolve(t)}handleTileResponse(e){}onTileLoaded(e,t){if(!this._isDisposed){e.data=t,e.state=ze.ready,this.tiles.setPending(e,!1),this.tiles.setStale(e,!1);try{this.tiles.add(e,this.getTileDataSize(t))}catch(e){console.error("[MapsGL] Failed adding tile to cache",e)}this.trigger(ye.A.TILE_ADD,{tile:e}),this.trigger(ye.A.TILE_LOAD,{sourceId:this.id,tile:e,pending:this.tiles.totalPending}),this.trigger(ye.A.TILE_LOAD_COMPLETE,{sourceId:this.id,tile:e}),this.trigger(ye.A.DATA_CHANGE,{source:this}),0===this.tiles.totalPending&&this._triggerLoadCompleteEvent&&(this.trigger(ye.A.LOAD_COMPLETE,{sourceId:this.id}),this._triggerLoadCompleteEvent=!1)}}onTileError(e,t){this._isDisposed||(this.tiles.setPending(e,!1),e.state=ze.failed,this.trigger(ye.A.TILE_ERROR,{sourceId:this.id,tile:e,error:t}),0===this.tiles.totalPending&&this._triggerLoadCompleteEvent&&(this.trigger(ye.A.LOAD_COMPLETE,{sourceId:this.id}),this._triggerLoadCompleteEvent=!1))}cancelAllRequests(){this.tiles.clearPending(),Object.values(this._requests).forEach((e=>e.abort()))}expireAllTiles(){this.tiles.forEach((e=>{e.state===ze.ready&&(e.state=ze.expired),this.tiles.setStale(e,!0)}))}dispose(){super.dispose(),this._isDisposed=!0,this.cancelAllRequests(),this._tileRetries.clear(),this._tiles.dispose()}};var di=i(9037),ui=i(7411),pi=i(7823);function fi(e,t){var i=new pi.tb(2);return i[0]=e,i[1]=t,i}function mi(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e}function gi(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e}function vi(e,t,i){return e[0]=t[0]*i[0],e[1]=t[1]*i[1],e}function yi(e,t,i){return e[0]=t[0]/i[0],e[1]=t[1]/i[1],e}xi=new pi.tb(2),pi.tb!=Float32Array&&(xi[0]=0,xi[1]=0);var xi,bi=i(9814);class wi extends bi.A{get value(){return this._value}get elements(){return this.value.length}get x(){return this.value[0]}set x(e){this.value[0]=e}get y(){return this.value[1]}set y(e){this.value[1]=e}constructor(e=0,t=0){super(),this._value=fi(e,t)}fromArray(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x=e[t],this.y=e[t+1],this}toArray(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.x,e[t+1]=this.y,e}fromObject(e){let{x:t,y:i}=e;return void 0!==t&&(this.x=t),void 0!==i&&(this.y=i),this}toObject(){return{x:this.x,y:this.y}}set(e,t){return this._value=fi(e,t),this}setScalar(e){return this.set(e,e)}length(){return e=this.value,Math.hypot(e[0],e[1]);var e}angle(){const e=fi(1,0);return r=(t=this.value)[0],a=t[1],s=(i=e)[0],n=i[1],o=Math.sqrt(r*r+a*a)*Math.sqrt(s*s+n*n),Math.acos(Math.min(Math.max(o&&(r*s+a*n)/o,-1),1));var t,i,r,a,s,n,o}copy(e){return this.x=e.x,this.y=e.y,this}clone(){return new wi(this.x,this.y)}add(e){return mi(this.value,this.value,e.value),this}addScalar(e){return mi(this.value,this.value,fi(e,e)),this}subtract(e){return gi(this.value,this.value,e.value),this}subtractScalar(e){return gi(this.value,this.value,fi(e,e)),this}multiply(e){return vi(this.value,this.value,e.value),this}multiplyScalar(e){return vi(this.value,this.value,fi(e,e)),this}divide(e){return yi(this.value,this.value,e.value),this}divideScalar(e){return yi(this.value,this.value,fi(e,e)),this}distanceTo(e){return t=this.value,i=e.value,Math.hypot(i[0]-t[0],i[1]-t[1]);var t,i}dot(e){return(t=this.value)[0]*(i=e.value)[0]+t[1]*i[1];var t,i}equals(e){return r=(t=this.value)[0],a=t[1],s=(i=e.value)[0],n=i[1],Math.abs(r-s)<=pi.p8*Math.max(1,Math.abs(r),Math.abs(s))&&Math.abs(a-n)<=pi.p8*Math.max(1,Math.abs(a),Math.abs(n));var t,i,r,a,s,n}lerp(e,t){return function(e,t,i,r){var a=t[0],s=t[1];e[0]=a+r*(i[0]-a),e[1]=s+r*(i[1]-s)}(this.value,this.value,e.value,t),this}normalize(){return function(e,t){var i=t[0],r=t[1],a=i*i+r*r;a>0&&(a=1/Math.sqrt(a)),e[0]=t[0]*a,e[1]=t[1]*a}(this.value,this.value),this}scale(e){return function(e,t,i){e[0]=t[0]*i,e[1]=t[1]*i}(this.value,this.value,e),this}applyMatrix3(e){return function(e,t,i){var r=t[0],a=t[1];e[0]=i[0]*r+i[3]*a+i[6],e[1]=i[1]*r+i[4]*a+i[7]}(this.value,this.value,e.value),this}applyMatrix4(e){return function(e,t,i){var r=t[0],a=t[1];e[0]=i[0]*r+i[4]*a+i[12],e[1]=i[1]*r+i[5]*a+i[13]}(this.value,this.value,e.value),this}}const _i=wi;var Ai=i(3406);function Mi(e,t,i){let r=t/(2*Math.PI);return"maplibre"===e&&(r/=Math.cos((0,ke.p)(i))),r}function Ti(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const r=it/(2*Math.PI);let a=Mi(e,t,0)/r;return"maplibre"===e&&(a/=Math.cos((0,ke.p)(i))),a}function Ei(e,t){if(t.projection.type!==Ue)return!1;const i=t.camera.position.clone().scale(t.worldSize),r=t.globeMatrix.clone().invert(),a=new Ne.A(i.x,i.y,i.z,1).applyMatrix4(r),s=new Ve.A(a.x,a.y,a.z);return!(e.clone().subtract(s).dot(e)<0)}const Si=it/(2*Math.PI),Ci=class{constructor(){this.range=[3,5]}get type(){return Ue}get zAxisUnit(){return"pixels"}get subdivisionGranularity(){return new st(st.globeSubdivision)}project(e,t){return e=(0,Le.q)(e,-85.0511287798,ct),{x:dt(t),y:ut(e),z:0}}unproject(e,t){const i=pt(e);return{lat:ft(t),lon:i}}projectTileCoordinates(e,t,i,r){const a=Ri(e,t,i),s=r.globeToMercatorTransition(r.state.zoom);let n;const o=new Ne.A(a.x,a.y,a.z,1).applyMatrix4(r.globeMatrix);if(s>0){const a=Rt(e,t,i),h=Lt(a),c=new _i(dt(r.state.center.lon),ut(r.state.center.lat)),d=o,u=new Ne.A((l=h.x-c.x,((l- -.5)%1+1)%1-.5),h.y-c.y,0,1).applyMatrix4(r.mercatorMatrix);n=new Ne.A((0,ui.C)(d.x,u.x,s),(0,ui.C)(d.y,u.y,s),(0,ui.C)(d.z,u.z,s),(0,ui.C)(d.w,u.w,s))}else n=o;var l;return n=n.applyMatrix4(r.projGlobeMatrix),{point:{x:n.x,y:n.y,z:n.z},signedDistanceFromCamera:n.w,isOccluded:Ei(a,r)}}projectTilePoint(e,t){return{x:e,y:t}}pixelSpaceConversion(e,t,i){const r=mt(1,e)*t,a=mt(1,45)*t,s=(0,ui.C)(a,r,i);return this.pixelsPerMeter(0,t)/s}pixelsPerMeter(e,t){return mt(1,e)*t}metersPerPixel(e,t){return 1/(this.pixelsPerMeter(e,1)*Tt(t))}},Oi=(e,t,i,r)=>i*(it/(t*Math.pow(2,r-e.z))),Ri=(e,t,i,r)=>{const a=Tt(i.z),s=(e/it+i.x)/a,n=wt((t/it+i.y)/a),o=bt(s);return Ii(n,o,r)},Ii=(e,t,i)=>Pi((0,ke.p)(e),(0,ke.p)(t),i),Pi=function(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Si;const r=Math.cos(e),a=r*Math.sin(t)*i,s=-Math.sin(e)*i,n=r*Math.cos(t)*i;return new Ve.A(a,s,n)};var Di,zi,Li,ki,Fi=i(8937),ji=function(e,t,i,r,a){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?a.call(e,i):a?a.value=i:t.set(e,i),i},Ni=function(e,t,i,r){if("a"===i&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?r:"a"===i?r.call(e):r?r.value:t.get(e)};Di=new WeakMap,zi=new WeakMap,Li=new WeakMap,ki=new WeakMap;const Vi=class{constructor(e){Di.set(this,void 0),zi.set(this,void 0),Li.set(this,!1),ki.set(this,[]),ji(this,zi,e,"f")}get(){return new Promise(((e,t)=>{if(Ni(this,Di,"f"))return void e(Ni(this,Di,"f"));if(Ni(this,Li,"f"))return void Ni(this,ki,"f").push((()=>e(Ni(this,Di,"f"))));const i=Ni(this,zi,"f")instanceof URL?Ni(this,zi,"f").toString():Ni(this,zi,"f");ji(this,Li,!0,"f"),fetch(i).then((e=>e.text())).then((t=>{ji(this,Di,new Worker(window.URL.createObjectURL(new Blob([t],{type:"text/javascript"}))),"f"),ji(this,Li,!1,"f"),Ni(this,ki,"f").forEach((e=>e())),ji(this,ki,[],"f"),e(Ni(this,Di,"f"))})).catch((e=>{t(e)}))}))}terminate(){Ni(this,Di,"f")&&Ni(this,Di,"f").terminate()}};var Bi,Ui=function(e,t,i,r){if("a"===i&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?r:"a"===i?r.call(e):r?r.value:t.get(e)};Bi=new WeakMap;const $i=class{constructor(e){Bi.set(this,{}),this._messageHandlers={},e instanceof Vi?this.worker=e:(this.worker="string"==typeof e?new Worker(e):e,this.worker.onmessage=this.receive.bind(this))}registerMessageHandler(e,t){this._messageHandlers[e]=t}send(e){var{type:t,action:i}=e,r=function(e,t){var i={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(i[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(i[r[a]]=e[r[a]])}return i}(e,["type","action"]);const a=Math.round(1e18*Math.random()).toString(36).slice(0,10);return new Promise(((e,s)=>{Ui(this,Bi,"f")[a]=t=>{let{data:i,error:r,status:a}=t;var n,o;if(r){let e=new oi.Zb(null!==(n=null==r?void 0:r.message)&&void 0!==n?n:null==a?void 0:a.message);if((null==a?void 0:a.code)>0){const t=new Response(void 0,{status:a.code,statusText:a.message});e=new oi.tF(`${null!==(o=a.message)&&void 0!==o?o:r}`,t)}s(e)}else e(i)},this.worker instanceof Vi?this.worker.get().then((e=>{e.onmessage||(e.onmessage=this.receive.bind(this)),e.postMessage({id:a,type:t,action:i,data:r})})).catch((e=>{s(e)})):this.worker.postMessage({id:a,type:t,data:r})}))}receive(e){const{id:t,type:i,data:r,error:a,status:s}=e.data||{},n=Ui(this,Bi,"f")[t];if(i){const e=this._messageHandlers[i];if(me(e)){const a=e(r);return void(a instanceof Promise?a:Promise.resolve(a)).then((e=>{this.worker instanceof Vi?this.worker.get().then((r=>{r.onmessage||(r.onmessage=this.receive.bind(this)),r.postMessage({id:t,type:i,data:e})})):this.worker.postMessage({id:t,type:i,data:e})}))}}me(n)&&(n({data:r,error:a,status:s}),delete Ui(this,Bi,"f")[t])}abort(){this.worker.terminate()}},Gi=new class{constructor(){this.urls={}}addWorker(e,t){this.urls[e]=t}getWorker(e){return this.urls[e]}},qi=e=>{let t=e.toString().replaceAll("://",":\\/\\/").replaceAll(/\/{2}.*/g,"").replaceAll("\n","").replaceAll("\t","").replaceAll(/\s+/g," ");return e.name&&new RegExp(`^\\s*${e.name}\\s*([(])`).test(t)&&(t=`function ${t}`),JSON.stringify(`_FUNC${t}`)},Wi=(e,t)=>t.startsWith("_FUNC")?(t=t.replace(/^_FUNC/,""),new Function(`return (${t}).apply(this, arguments);`)):t,Hi=(e,t)=>{Object.keys(t).forEach((i=>{Array.isArray(t[i])?e[i]=t[i].map((e=>{if((0,te.G)(e)){const t={};return Hi(t,e),t}return me(e)?qi(e):e})):(0,te.G)(t[i])?(e[i]={},Hi(e[i],t[i])):me(t[i])?["value","transform","key","rank","size","factor","offset","image","pattern"].includes(i)&&(e[i]=qi(t[i])):e[i]=t[i]}))},Zi=(e,t)=>{if((0,R.g)(t))throw new Error("[MapsGL] Serialized style is null or undefined");Object.keys(t).forEach((i=>{if(Array.isArray(t[i]))e[i]=t[i].map((e=>{if((0,te.G)(e)){const t={};return Zi(t,e),t}return/_FUNC/.test(e)?JSON.parse(e,Wi):e}));else if((0,te.G)(t[i]))e[i]={},Zi(e[i],t[i]);else if(/_FUNC/.test(t[i]))try{e[i]=JSON.parse(t[i],Wi)}catch(e){console.error(`[MapsGL] Failed to deserialize function '${i}':`,e)}else e[i]=t[i]}))},Yi=(e,t,i,r)=>{var a;const s=t.height,n=Math.floor(t.width/e.width),o=(Math.floor(s/e.height),{}),l="undefined"!=typeof OffscreenCanvas;if((null==i?void 0:i.length)===n){const s=l?new OffscreenCanvas(e.width,e.height):window.document.createElement("canvas");s.width=e.width,s.height=e.height;const h=s.getContext("2d",{alpha:!1,willReadFrequently:!0});h.imageSmoothingEnabled=!1;for(let l=0;l<n;l++){const n=i[l].getTime();h.drawImage(t,l*e.width,0,e.width,e.height,0,0,s.width,s.height);const c=null===(a=h.getImageData(0,0,s.width,s.height))||void 0===a?void 0:a.data,d=new di.A(c,s.width,di.d);me(r)&&r(d),o[n]={rawData:d.rawData,dimension:d.dimension,padding:d.padding}}}return{data:o}},Xi=class extends ci{get type(){return Re.o.encoded}constructor(e,t){var i,r,a,s;(0,ue.vA)((0,pe.Z)(t.datasets)||(0,pe.Z)(t.metadataUrl),"[MapsGL] Invalid encoded data source specification, `datasets` or `metadataUrl` must be provided."),(0,R.g)(null===(r=t.timeSeries)||void 0===r?void 0:r.validTimes)&&(null===(a=t.datasets)||void 0===a?void 0:a.length)>0&&(t.timeSeries=Object.assign(Object.assign({},t.timeSeries),{validTimes:t.datasets[0].validTimes})),super(e,Object.assign(Object.assign({},t),{datasets:null===(s=t.datasets)||void 0===s?void 0:s.filter((e=>(0,R.n)(e.id)))})),i=this,this.shouldUseTimesFromMetadata=!1,this.maxTextureSize=Number.POSITIVE_INFINITY,this._activeTileRequests=new Set,this.tiles.setTextureDataProvider((e=>null)),this.tileManager.setTileFetcher((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var a,s,n;const{body:o}=r,l=i.tiles.get(e);let h;return"none"!==(null===(s=null===(a=i.spec.timeSeries)||void 0===a?void 0:a.operation)||void 0===s?void 0:s.type)&&(h=i.metadata.getAllValidTimes()),i.worker.send({command:"loadTile",source:{datasets:[...i.metadata.datasets],validTimes:i.metadata.getValidTimes(),operation:null===(n=i.spec.timeSeries)||void 0===n?void 0:n.operation,transformer:me(i.spec.transformTileData)?qi(i.spec.transformTileData):void 0},tile:{uid:l.uid,info:{x:e.x,y:e.y,z:e.z,size:i.tileSize}},request:{url:i.getTileUrl(e,r.params),method:r.method,body:(0,pe.Z)(o)?JSON.stringify(o):void 0,headers:r.headers,intervals:h,params:r.params}})}))}get worker(){if(!this._worker){let e=Gi.getWorker("encoded");(0,R.g)(e)&&(e="mapsgl.encoded.worker.js",Gi.addWorker("encoded",e));const t=new Vi(e);this._worker=new $i(t)}return this._worker}getMetadataForBand(e){const t=["r","g","b","a"];let i;return[...e].forEach((e=>{const r=t.indexOf(e),a=this.metadata.getDatasetAtIndex(r);a&&!i&&(i=a)})),i}getDataRange(e){if(!this.hasValidDatasets())return;const t=["r","g","b","a"],i=[...e],r={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return i.forEach((e=>{const i=t.indexOf(e),a=this.metadata.getDatasetAtIndex(i);if(!a)throw new Error(`[MapsGL] Dataset index ${i} is out of bounds for data source {${this.id}}, total datasets is ${this.metadata.datasets.length}`);i>=0&&(r.min=Math.min(a.dataMin,r.min),r.max=Math.max(a.dataMax,r.max))})),r}parseTile(e,t,i){return new Promise(((r,a)=>{if(t instanceof Blob){const r=new Image;return r.addEventListener("load",(()=>{let t=[];const a=null==i?void 0:i.get("x-data-set-locs");if(a){const e=((e,t)=>{const i=JSON.parse(e);return{layout:{columns:0,rows:0,size:{width:0,height:0}},datasets:null==t?void 0:t.map(((e,t)=>{const{id:r,dataMin:a,dataMax:s,outputMin:n=0,outputMax:o=255,outputNoDataValue:l}=e,{animDir:h,x:c=0,y:d=0,b:u=0,validTimes:p}=i[t]||{};return{id:r,dataMin:a,dataMax:s,outputMin:n,outputMax:o,outputNoDataValue:l,maxZoom:-1,degreesPerPixel:{x:-1,y:-1},column:c,row:d,band:u,layout:"H"===h?"horizontal":"vertical",validTimes:null==p?void 0:p.map((e=>new Date(e)))}}))}})(a,this.spec.datasets);t=(0,Q.Or)(e.datasets[0].validTimes)}Yi(e.size,r,t)})),r.addEventListener("error",(()=>{a(r)})),r.crossOrigin="anonymous",void(r.src=URL.createObjectURL(t))}let s=e.data;this.tiles.isStale(e)&&(null==s||s.dispose(),s=void 0);const n=this.metadata.getValidTimes().map((e=>e.getTime()));(0,R.g)(s)?(s=new De.A({},this.tileSize,n),s.id=e.coord.hash,this.tiles.setStale(e,!1)):([...s.series.intervals].forEach((e=>{n.includes(e)||s.series.removeInterval(e)})),s.setValidIntervals(n));const{image:o,validTimes:l}=t;let h=null==t?void 0:t.data;if((0,pe.E)(h)){const t=Yi(e.size,o,l);h=null==t?void 0:t.data}(0,R.n)(h)&&((0,W.I)(h)?console.warn(`[MapsGL] Encoded tile data for ${e.coord.hash} is empty.`):Object.keys(h).filter((e=>n.includes(Number(e)))).forEach((t=>{const{rawData:i,dimension:r,padding:a}=h[t];if((0,R.n)(i)){const e=new di.A(i,r,a);null==s||s.setData(Number(t),new Fi.AI(e))}else console.warn(`[MapsGL] Encoded raster tile data for ${e.coord.hash} at time ${t} is empty.`)})),r(s))}))}onTileLoaded(e,t){super.onTileLoaded(e,t);const i=e.coord.getNeighbors();if(e&&i){const t=(t,i)=>{let r=i.coord.x-t.coord.x;const a=i.coord.y-t.coord.y,s=Math.pow(2,e.coord.z);0!==r||0!==a?Math.abs(a)>1||(Math.abs(r)>1&&(1===Math.abs(r+s)?r+=s:1===Math.abs(r-s)&&(r-=s)),i.data&&t.data&&t.data.backfillEdge(i.data,r,a)):0===t.coord.z&&(t.data.backfillEdge(i.data,-1,0),t.data.backfillEdge(i.data,1,0))};Object.keys(i).forEach((r=>{const a=i[r];if(a){const i=this.tiles.get(a.normalize());if(i){const r=new $t(a);r.data=null==i?void 0:i.data,t(e,r),t(r,e)}}}))}}processMetadata(e){const t=Object.assign({},e);return t.datasets&&(t.datasets=(e=>e.map((e=>(e.row=e.row||0,e.column=e.column||0,e.layout=e.layout||"horizontal",e.validTimes=(0,Q.Or)(e.validTimes,!0),e))))(t.datasets)),t}hasValidDatasets(){if((0,pe.E)(this.metadata.datasets))throw new Error(`[MapsGL] Cannot request tiles for encoded data source "${this.id}", empty or invalid value for "datasets". Check the source configuration and/or its metadata.`);return!0}};var Qi=i(7658),Ki=i(2102);const Ji=Te?20:40,er=class{constructor(e){this.account=e,this.authenticator=new Pe(e)}getEncodedSourceConfig(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=t||this.account.servers.mapsgl||Ie.di;return Object.assign({type:Re.o.encoded,url:`${r}/tile/{z}/{x}/{y}/{width}x{height}/{time::iso}.png`,metadataUrl:`${r}/tile?details=true&{datasets}&begin={startDate}&end={endDate}`,tileSize:512,authenticator:this.authenticator,transformMetadataRequest:(e,t)=>(e instanceof Xi&&(t.params=Object.assign(Object.assign({},t.params),{datasets:e.spec.datasets.map((e=>`data-set-ids=${e.id}`)).join("&")})),t),transformMetadata:(e,t)=>{var i,r;const a=e.metadata,s=Object.assign({},a.data);s.minZoom=0,s.maxZoom=e instanceof ci?e.maxZoom:a.maxZoom,Object.values(t).forEach((e=>{e.maxZoom>0&&(s.maxZoom=Math.min(a.maxZoom,e.maxZoom))}));const n=Object.keys(t);s.validTimes=(0,Q.Or)(t[n[0]].validTimes);const o=Qi.Jg.code,l=Qi.lw.code;if(n.includes(o)&&n.includes(l)){const e=(0,Q.Or)(t[o].validTimes),i=(0,Q.Or)(t[l].validTimes),r=new Date;s.validTimes=[...e,...i.filter((e=>e>r))]}const h=a.datasets[0];return(null===(i=h.animation)||void 0===i?void 0:i.interval)>0&&(a.maxValidTimeIntervals=null===(r=h.animation)||void 0===r?void 0:r.interval),s},transformRequest:(e,t)=>(t.options.method="POST",t.options.headers=Object.assign(Object.assign({},t.options.headers),{"Content-Type":"application/json","Access-Control-Request-Headers":"x-data-set-locs"}),e instanceof Xi&&(t.options.body=(0,Ki.ge)(e.spec.datasets,t.options.intervals)),t),timeSeries:{maxValidTimes:Ji},datasets:e.formattedForRequest()},i)}getVectorTileSourceConfig(e,t){const i=t||this.account.servers.mapsgl||Ie.di;return Object.assign({type:Re.o.vector,url:`${i}/vector/${e}/{time::iso}/{z}/{x}/{y}.pbf`,metadataUrl:`${i}/vector/?details=true&products=${e}&begin={startDate}&end={endDate}`,authenticator:this.authenticator,transformMetadata:(e,t)=>{const i=Object.assign({},e.metadata.data);if((0,te.G)(t)){const e=t[Object.keys(t)[0]];e&&(i.maxZoom=e.layers[0].maxZoom,i.validTimes=(0,Q.Or)(e.validTimes))}return i.minZoom=0,i}},arguments.length>2&&void 0!==arguments[2]?arguments[2]:{})}getVectorSourceConfig(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Date;return{type:Re.o.vector,url:this.getTileUrl(e,t,"pbf")}}getGeoJSONSourceConfig(e,t,i,r){var a;(0,R.g)(t)&&(t=Y.Fu.search);const s=null===(a=this.account)||void 0===a?void 0:a.api().endpoint(e).action(t);if(s.format("geojson"),i){const e=function(e,t){var i={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(i[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(i[r[a]]=e[r[a]])}return i}(i,["from","to"]);s.setParams(e)}let n=s.url();return n=n.includes("?")?`${n}&`:`${n}?`,n+="&from={startDate::iso}&to={endDate::iso}",Object.assign({type:Re.o.geojson,url:n},r)}getRasterSourceConfig(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Date;const i=this.account,r=`${i.id}_${i.secret}`;return{type:Re.o.raster,url:this.getTileUrl(e,t),metadataUrl:`https://maps.aerisapi.com/${r}/${e}.json`,transformMetadata:(e,t,i)=>{const r=Object.assign({},e.metadata.data);return Array.isArray(t.files)&&(r.validTimes=t.files.map((e=>new Date(1e3*e.timestamp))).sort(((e,t)=>e.getTime()-t.getTime()))),r},timeSeries:{maxValidTimes:Ji/2}}}getTileUrl(e){arguments.length>1&&void 0!==arguments[1]||new Date;let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"png";var i;const r=null===(i=this.account)||void 0===i?void 0:i.map().type(Y.e1.tile).layers(e).offset("{time::utc:format[yyyyMMddhhmm00]}");return"png"===t&&r.suffix("@3x"),r.url().replace(/\.png/,`.${t}`)}};var tr=i(6219);const ir=e=>{switch(e){case"circle":return tr.m.circle;case"symbol":case"text":return tr.m.symbol;case"fill":return tr.m.fill;case"line":return tr.m.line;case"query":return tr.m.query;case"sample":return tr.m.sample;case"grid":return tr.m.grid;case"heatmap":return tr.m.heatmap;case"contour":return tr.m.contour;case"particle":return tr.m.particle;case"voronoi":return tr.m.voronoi;case"debug":return tr.m.debug;case"data":return tr.m.data;case"none":return"composite";default:return tr.m.raster}};var rr=i(9147);const ar=Object.assign({"lightning-strike-heat":"lightning-strikes-heat"},["temperatures","temperatures-contour","wind-speeds","wind-speeds-contour","wind-dir","wind-barbs","wind-particles","feels-like","wind-chill","heat-index","dew-points","humidity","pressure-msl","pressure-msl-contour","visibility","cloud-cover","precip","radar"].reduce(((e,t)=>(e[`f${t}`]=t,e)),{})),sr=class{constructor(e){this.service=new er(e)}initialize(e,t){return Promise.all([i.e("weather").then(i.bind(i,6445)).then((t=>t.default(e,this.service))),this.loadStyles(t)]).then((e=>{let[t]=e;this.layers=t.layers,this.sources=t.sources}))}isWeatherLayer(e){return(0,pe.Z)(this.layers[e])||(0,pe.Z)(this.getLayerAlias(e))}isDeprecated(e){return!!this.getLayerAlias(e)}getLayerAlias(e){return ar[e]}getLayerMetadata(){return fetch(Ie.bG).then((e=>e.json())).then((e=>e.layers.map((e=>({id:e.id,title:e.title,description:e.description,style:ir(e.type||e.style),animatable:e.animatable,categories:e.categories,dataRange:e.dataRange,timeRange:e.dataRange,dataCoverage:e.dataCoverage,updateInterval:e.updateInterval}))).filter((e=>(0,R.n)(this.layers[e.id]))).map((e=>{var t,i,r;const a=this.getConfig(e.id);if(!1===Array.isArray(a)&&(null===(t=null==a?void 0:a.layer)||void 0===t?void 0:t.source)){const t=this.getSourceConfig(a.layer.source);if("encoded"===t.type&&(null===(i=a.layer.paint.sample)||void 0===i?void 0:i.channel)){const i=null===(r=a.layer.paint.sample)||void 0===r?void 0:r.channel,s=Array.isArray(i)?i[0]:[...i][0],n=rr.o3.indexOf(s),o=t.datasets[n];Object.keys(Qi.N0).forEach((t=>{const i=Qi.N0[t];i.code===o.id&&(e.valueMeasurement=Object.assign({},i.measurement),e.valueRange={min:i.dataRange.min,max:i.dataRange.max})}))}}return e}))))}getWeatherLayerConfig(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var i,r,a,s,n,o,l,h,c,d,u,p,f,m,g,v,y;let x=this.getConfig(e);if((0,ue.vA)((0,pe.Z)(x),`[MapsGL] No weather configuration found for '${e}'`),Array.isArray(x))return x;if((0,ue.vA)((0,pe.Z)(x.layer),`[MapsGL] No weather layer specification found for '${e}'`),x.ref){const e=this.getConfig(x.ref);(0,ue.vA)((0,pe.Z)(e),`[MapsGL] No weather configuration found for base reference layer '${x.ref}'`),x=(0,j.$)({},e,x)}(0,R.n)(t.type)&&(x.layer.type=t.type),(0,pe.Z)(t.filter)&&(x.layer.filter=t.filter),x.source=this.getSourceConfig(x.layer.source,{timeline:t.timeline},Object.assign(Object.assign({},t),{timing:(0,j.$)({},t.timing||{},{operation:x.operation||{}})})),(0,ue.vA)((0,pe.Z)(x.source),`[MapsGL] No weather source configuration found for '${e}'`),"string"==typeof x.layer.source&&(x.source.id=x.layer.source);const b=null===(i=(x.source instanceof _e?x.source.spec:x.source).timeSeries)||void 0===i?void 0:i.operation;(0,pe.Z)(b)&&"none"!==b.type&&(x.source.id+=`-${b.type}`,"none"!==b.period&&(x.source.id+=`-${b.period}`),b.aggregate&&(x.source.id+="-aggregate")),(0,pe.Z)(null===(r=t.timing)||void 0===r?void 0:r.intervals)&&(x.source.timeSeries.maxValidTimes=t.timing.intervals),(0,pe.Z)(null===(a=t.data)||void 0===a?void 0:a.quality)&&(x.layer.quality=t.data.quality);let w=null===(s=x.layer.paint.sample)||void 0===s?void 0:s.colorscale;const _=null===(o=null===(n=t.paint)||void 0===n?void 0:n.sample)||void 0===o?void 0:o.colorscale;if((0,pe.Z)(w)){if((0,pe.Z)(null==w?void 0:w.masks)&&((0,pe.Z)(null==_?void 0:_.masks)?(w.masks=w.masks.map(((e,t)=>{const i=_.masks[t];return(0,pe.Z)(i)?Object.assign(Object.assign({},e),i):e})),delete _.masks):(0,pe.Z)(null==_?void 0:_.stops)&&(w=(0,j.$)({},w,_),delete w.masks)),(0,R.n)(t.paint)&&(x.layer.paint=me(x.layer.paint)?t.paint:(0,j.$)({},Object.assign({},x.layer.paint),t.paint),"object"==typeof(null===(l=t.paint.sample)||void 0===l?void 0:l.colorscale)&&(null===(c=null===(h=t.paint.sample)||void 0===h?void 0:h.colorscale)||void 0===c?void 0:c.stops)&&(0,U.h)(x.layer.paint,"sample.colorscale.stops",null===(u=null===(d=t.paint.sample)||void 0===d?void 0:d.colorscale)||void 0===u?void 0:u.stops)),(0,pe.Z)(w))if(w.normalized=w.normalized||!1,(0,pe.Z)(null===(m=null===(f=null===(p=t.paint)||void 0===p?void 0:p.sample)||void 0===f?void 0:f.colorscale)||void 0===m?void 0:m.stops)&&delete w.masks,w.masks)w.masks.forEach((e=>{e.colorscale&&(e.colorscale.normalized=e.colorscale.normalized||!1)}));else if((0,pe.E)(w.range)&&(0,pe.Z)(null===(g=x.source)||void 0===g?void 0:g.datasets)){const e=x.layer.paint.sample.channel,t=Array.isArray(e)?e[0]:[...e][0],i=x.source.datasets[rr.o3.indexOf(t)],r=x.layer.paint.sample.dataRange;w.range={min:(0,pe.Z)(null==r?void 0:r.min)?r.min:i.dataMin,max:(0,pe.Z)(null==r?void 0:r.max)?r.max:i.dataMax}}x.layer.paint.sample.colorscale=w}if((0,R.n)(t.timing)&&(x.layer.timeSeries=(0,j.$)({},Object.assign({},x.layer.timeSeries),t.timing)),!1===t.legend)delete x.legend;else if((0,R.n)(x.legend)&&(0,R.n)(t.legend)){x.legend=(0,j.$)({},Object.assign({},x.legend),t.legend);const e=null===(v=t.legend.points)||void 0===v?void 0:v.values;e&&(0,U.h)(x.legend,"points.values",e)}if(x.legend&&(x.legend=this.configureLegendForPaint(x.legend,x.layer.paint)),(0,pe.Z)(null===(y=t.data)||void 0===y?void 0:y.evaluator)&&(x.evaluator=(0,j.$)({},x.evaluator||{},t.data.evaluator)),(0,pe.Z)(x.query)){const e=x.query;x.query="string"==typeof e?{layerId:e}:e}if((0,pe.Z)(t.mask)){const e=t.mask;x.mask="string"==typeof e?this.getMaskConfig(e):e}return x}getWeatherLayerLegendId(e){const t=this.getConfig(e);if(!1===Array.isArray(t)&&(null==t?void 0:t.legend))return t.legend.id}loadStyles(e){const t=Math.min(3,Math.ceil(window.devicePixelRatio));return Promise.all([e.loadSprite("mapsgl",`https://cdn.aerisapi.com/sdk/js/mapsgl/assets/sprite@${t}x.json`),e.loadSprite("mapsgl",`https://cdn.aerisapi.com/sdk/js/mapsgl/assets/sprite-sdf@${t}x.json`)]).then((()=>{}))}getConfig(e){const t=this.layers[e];if(t){if(Array.isArray(t))return t;const e=(0,j.$)({},t);return e.layer=(0,j.$)({},e.layer),(0,X.mg)(e)}}getSourceConfig(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var r;if("string"!=typeof e)return e;{const a=this.sources[e];if(a){const e=(0,j.$)({timeSeries:{operation:{type:"none",period:"none",aggregate:!1}}},me(a)?a(t):a,{timeSeries:Object.assign({},null==i?void 0:i.timing)});return(0,pe.Z)(null===(r=i.timing)||void 0===r?void 0:r.intervals)&&(e.timeSeries.maxValidTimes=i.timing.intervals),e}}}getMaskConfig(e){switch(e){case"water":return ge.E;case"land":return ge.S;default:return{layerId:e,overrides:void 0}}}configureLegendForPaint(e,t){var i;const r=null===(i=null==t?void 0:t.sample)||void 0===i?void 0:i.colorscale;if(r&&"object"==typeof r){const t=(e,t)=>{(0,pe.Z)(e.stops)&&(t.stops=e.stops),(0,R.n)(e.interval)&&(t.interval=e.interval),(0,pe.Z)(e.range)&&(t.range=Object.assign(Object.assign({},e.range),t.range)),(0,R.n)(e.interpolate)&&(t.interpolate=e.interpolate),(0,R.n)(e.normalized)&&(t.normalized=e.normalized),t.normalized&&(t.range={min:0,max:1})};if(Array.isArray(e.bar))if(r.masks){const i=e.bar;r.masks.forEach(((e,r)=>{e.colorscale.stops&&i[r]&&t(e.colorscale,i[r].colorscale)}))}else e.bar=e.bar[0],t(r,e.bar.colorscale);else(0,pe.Z)(e.bar)&&(e.bar=e.bar||{},t(r,e.bar.colorscale))}return e}};var nr=i(2291),or=i(5661),lr=i(9589),hr=i(3606);const cr=class extends ci{get type(){return Re.o.raster}parseTile(e,t,i){const r=this.metadata.getValidTimes();return new Promise(((a,s)=>{const n=new Image;n.addEventListener("load",(()=>{var t;if(r.length>0){let s=e.data,o=[];const l=null==i?void 0:i.get("x-aeris-valid-date");if((0,pe.Z)(l)&&(o=(0,Q.Or)([l],!1)),(0,R.g)(s)){const t=r.map((e=>e.getTime()));s=new Bt.A({},{width:n.width,height:n.height},t),s.id=e.coord.hash,s.useLinearTextureFilter=!0,this.tiles.setStale(e,!1)}const h=null===(t=o[0])||void 0===t?void 0:t.getTime();(0,R.g)(h)?console.warn(`[MapsGL] No valid time found for time series data for tile ${e.coord.hash}`):null==s||s.setData(h,new Fi.AF(n)),a(s)}else a(n)})),n.addEventListener("error",(()=>{s(n)})),n.crossOrigin="anonymous",n.src=URL.createObjectURL(t)}))}};var dr=i(681),ur=i(8642),pr=i(6424),fr=i(7226),mr=i(8799),gr=i(3009);const vr=e=>{if((0,gr.IB)(e))return`#${[e.r,e.g,e.b].map((e=>{const t=e.toString(16);return 1===t.length?`0${t}`:t})).join("")}`},yr={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},xr=e=>(0,G.E)(e)||(0,$.K)(e)?new wr(e):e instanceof wr?e:(0,te.G)(e)&&(0,R.n)(e.r)&&(0,R.n)(e.g)&&(0,R.n)(e.b)&&(0,R.n)(e.a)?new wr(e.r,e.g,e.b,e.a):null,br={};class wr{constructor(e=0,t,i,r=1){if(this.r=0,this.g=0,this.b=0,this.a=1,void 0===t&&void 0===i)if((0,G.E)(e)&&e<=255)this.setRGB(e,e,e);else if((0,$.K)(e)&&yr[e])this.fromHex(yr[e]);else{const t=(0,dr.$)(e);if(t){const{r:e,g:i,b:r,a:a}=t;this.setRGBA(e,i,r,a)}}else this.setRGBA(e,t,i,r)}fromHex(e){let t=br[e];return t||(t=(0,ur.i)(e),br[e]=t),this.setRGBA(t.r,t.g,t.b,t.a)}fromHSL(e,t,i){const r=(0,pr.Q)({h:e,s:t,l:i,a:arguments.length>3&&void 0!==arguments[3]?arguments[3]:1});return this.setRGBA(r.r,r.g,r.b,r.a)}fromHSV(e,t,i){const r=(0,fr.E)({h:e,s:t,v:i,a:arguments.length>3&&void 0!==arguments[3]?arguments[3]:1});return this.setRGBA(r.r,r.g,r.b,r.a)}setRGB(e,t,i){return this.setRGBA(e,t,i,this.a),this}setRGBA(e,t,i,r){let a=arguments.length>4&&void 0!==arguments[4]&&arguments[4];return this.r=a?e:(0,mr.S)(e,0,255),this.g=a?t:(0,mr.S)(t,0,255),this.b=a?i:(0,mr.S)(i,0,255),this.setAlpha(r),this}setAlpha(e){return this.a=e>1?(0,mr.S)(e,0,255):e,this}lighter(e){const t=e<1?e:e/100;let i=this.toHSL().l;return i+=i*t,i=Math.min(1,i),this}darker(e){const t=e<1?e:e/100;let i=this.toHSL().l;return i-=i*t,i=Math.max(0,i),this}equals(e){return this.r===e.r&&this.g===e.g&&this.b===e.b&&this.a===e.a}toHex(){return vr(this.toObject(!1))}toHSL(){return(e=>{if(!(0,gr.IB)(e))return;let{r:t,g:i,b:r}=e;t=(0,mr.S)(t,0,255),i=(0,mr.S)(i,0,255),r=(0,mr.S)(r,0,255);const a=Math.min(t,i,r),s=Math.max(t,i,r);let n,o;const l=(s+a)/2;if(s===a)n=0,o=0;else{const e=s-a;switch(o=l>.5?e/(2-s-a):e/(s+a),s){case t:n=(i-r)/e+(i<r?6:0);break;case i:n=(r-t)/e+2;break;case r:n=(t-i)/e+4}n/=6}return{h:n,s:o,l:l}})(this.toObject(!1))}toHSV(){return(e=>{if(!(0,gr.IB)(e))return;let{r:t,g:i,b:r}=e;t=(0,mr.S)(t,0,255),i=(0,mr.S)(i,0,255),r=(0,mr.S)(r,0,255);const a=Math.max(t,i,r),s=Math.min(t,i,r);let n;const o=a,l=a-s,h=0===a?0:l/a;if(a===s)n=0;else{switch(a){case t:n=(i-r)/l+(i<r?6:0);break;case i:n=(r-t)/l+2;break;case r:n=(t-i)/l+4}n/=6}return{h:n,s:h,v:o}})(this.toObject(!1))}toObject(){const e=arguments.length>0&&void 0!==arguments[0]&&!arguments[0]?255:1;return{r:this.r*e,g:this.g*e,b:this.b*e,a:this.a}}toArray(){return[this.r,this.g,this.b,this.a]}toVector(){return(new Ne.A).fromArray(this.toArray())}toString(){return`${this.constructor.name}(${this.r}, ${this.g}, ${this.b}, ${this.a}})`}}const _r=wr;class Ar{get bytesPerElement(){throw new Error("Subclasses of StructArray must override `bytesPerElement`")}constructor(e=1,t=0){this.capacity=-1,this.length=0,this.stride=1,this.stride=e,this.resize(t)}resize(e){e=Math.ceil(e),this.length=e,this.reserve(e)}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.buffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const t=this.data;this.refresh(),t&&this.data.set(t)}}emplace(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=this.length;this.resize(i+1),this.emplaceAt(i,e,t)}emplaceAt(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const r=Array.isArray(t)?t:[t],a=e*this.stride;if(i&&console.warn("emplaceAt",e,t,r,this.length,this.data),r.length!==this.stride)throw new Error(`Element length (${r.length}) does not match the stride for the StructArray ${this.stride}`);r.forEach(((e,t)=>{this.data[a+t]=r[t]}))}get(e){const t=e*this.stride;return this.data.slice(t,t+this.stride)}refresh(){throw new Error("Subclasses of StructArray must override `refresh`")}trim(){this.length!==this.capacity&&(this.capacity=this.length,this.buffer=this.buffer.slice(0,this.length*this.bytesPerElement),this.refresh())}clear(){this.length=0}serialize(){return this.trim(),{capacity:this.capacity,length:this.length,stride:this.stride,buffer:this.buffer}}static from(e){const t=Object.create(this.prototype);return t.stride=e.stride,t.buffer=e.buffer,t.length=e.length,t.capacity=e.length,t.refresh(),t}}class Mr extends Ar{get bytesPerElement(){return 2*this.stride}refresh(){this.data=new Int16Array(this.buffer)}}class Tr extends Ar{get bytesPerElement(){return 2*this.stride}refresh(){this.data=new Uint16Array(this.buffer)}}class Er extends Ar{get bytesPerElement(){return 4*this.stride}refresh(){this.data=new Float32Array(this.buffer)}}const Sr=(e,t)=>256*(e=(0,Le.q)(Math.floor(e),0,255))+(0,Le.q)(Math.floor(t),0,255),Cr=e=>[Sr(255*e.r,255*e.g),Sr(255*e.b,255*e.a)],Or=Math.pow(2,16)-1,Rr=function(e){const t=it/(arguments.length>1&&void 0!==arguments[1]?arguments[1]:it);return{x:Math.round(e.x*t),y:Math.round(e.y*t)}},Ir=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=[],r=[],a=[];for(const s of e){if(0===s.length)continue;s!==e[0]&&i.push(r.length/2);const n=[];for(let e=0;e<s.length;e++){const t=r.length/2;r.push(s[e].x,s[e].y),n.push(t)}t&&n.push(n[0]),a.push(n)}return{flattened:r,holeIndices:i,lineList:a}},Pr=function(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,a=(0,W.I)(e)?void 0:e.at(-1);return(!a||a.vertex.length+t>Or)&&(a={vertex:{offset:i,length:0},index:{offset:r,length:0}},e.push(a)),a},Dr=(e,t)=>{const i=t.offset*e.stride;return e.data.subarray(i,i+t.length*e.stride)},zr=(e,t,i)=>{const r=i.offset*t.stride,a=i.length*t.stride;(0,ue.vA)(e.length>=i.length*t.stride,"[MapsGL] Destination array is too small");for(let i=0;i<a;i++)e[i]=t.data[r+i];return e},Lr=(e,t)=>{var i;let r;if("string"==typeof e)r=e;else if(e.property){const a=e.property;if(Array.isArray(a)){let e;a.forEach((i=>{e||(e=(0,V.J)(t,i))})),r=e}else r=(0,V.J)(t,a);if((0,R.n)(r)&&me(e.transform)){const t=e.transform(r,null===(i=e.measurement)||void 0===i?void 0:i.units);(0,R.n)(t)&&(r=`${t}`)}}return(0,R.n)(r)?`${r}`:void 0},kr=(e,t)=>{const i={x:0,y:0};return["x","y"].forEach((r=>{const a=e[r];if("number"==typeof a)i[r]=a;else if("object"==typeof a){const{target:e,offset:s}=a;if(e&&/^text-\d+-(\w+)$/.test(e)){const a=Number.parseInt(e.split("-")[1],10),n=e.split("-")[2],o=t[a];if(o)if("x"===r)switch(n){case"left":i.x=o.x1+s;break;case"right":i.x=o.x2+s;break;case"center":i.x=o.x1+(o.x2-o.x1)/2+s}else switch(n){case"top":i.y=o.y1+s;break;case"bottom":i.y=o.y2+s;break;case"middle":i.y=o.y1+(o.y2-o.y1)/2+s}}}})),i},Fr=(e,t)=>t instanceof Float32Array?e.FLOAT:t instanceof Uint16Array?e.UNSIGNED_SHORT:e.UNSIGNED_INT,jr=class{constructor(e,t,i,r=!0,a=0,s=0,n=0){if(this.size=1,this.dynamic=!1,this.instanced=!1,this.stride=0,this.offset=0,this.divisor=0,this.needsUpdate=!1,Array.isArray(t))throw new TypeError("[Aeris GL] BufferAttribute: array should be a typed array");let o=0;void 0!==t&&(o=a?t.byteLength/a:t.length/i),this.data=t,this.size=i,this.type=Fr(e,t),this.normalized=!0===r,this.stride=a,this.offset=s,this.divisor=n,this.instanced=n>0,this.count=o}};var Nr,Vr=function(e,t,i,r){if("a"===i&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?r:"a"===i?r.call(e):r?r.value:t.get(e)};Nr=new WeakMap;const Br=class{get type(){return Vr(this,Nr,"f").type}get data(){return Vr(this,Nr,"f").data}set data(e){Vr(this,Nr,"f").data=e}get count(){return Vr(this,Nr,"f").count}get buffer(){return Vr(this,Nr,"f").buffer}set buffer(e){Vr(this,Nr,"f").buffer=e}constructor(e,t,i=!0,r=0,a=0,s){this.size=1,this.dynamic=!1,this.instanced=!1,this.stride=0,this.offset=0,this.divisor=0,this.needsUpdate=!1,Nr.set(this,void 0),function(e,t,i,r,a){if("function"==typeof t||!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");t.set(e,i)}(this,Nr,e),this.size=t,this.normalized=!0===i,this.stride=(0,R.g)(s)?e.stride:s,this.offset=r,this.divisor=a,this.instanced=a>0}};let Ur=1,$r=1;const Gr=new Ve.A;class qr extends Yt{get id(){return this._id}get attributes(){return this._attributes}get index(){return this.attributes.get("index")}get bounds(){return this._bounds}constructor(e,t={}){super(e),this.drawRange={start:0,count:0},this.instancedCount=0,this.isInstanced=!1,this._attributes=new Map,this._VAOs={};const i=e.gl;i||console.error("[Aeris GL] GL context not passed as first argument to Geometry"),this._id=Ur,this.drawMode=e.gl.TRIANGLES,Ur+=1,e.bindVertexArray(null),e.state.setActiveGeometry(null),Object.keys(t).forEach((e=>{const r=t[e];if(r instanceof jr||r instanceof Br)"index"===e?this.setIndex(r):this.addAttribute(e,r);else{const{size:t,data:a,normalized:s,stride:n,offset:o,divisor:l}=r;if(t&&a){const r=new jr(i,a,t,s,n,o,l);"index"===e?this.setIndex(r):this.addAttribute(e,r)}}}))}addAttribute(e,t){const i=this.context.gl;if(t.id=$r,t.target="index"===e?i.ELEMENT_ARRAY_BUFFER:i.ARRAY_BUFFER,t.divisor=t.divisor||0,t.needsUpdate=!1,this.attributes.set(e,t),$r+=1,t.buffer||(t.buffer=i.createBuffer(),this.updateAttribute(t)),t.divisor){if(this.isInstanced=!0,this.instancedCount&&this.instancedCount!==t.count*t.divisor)return console.warn(`[Aeris GL] Geometry has multiple instanced buffers of different length - instancedCount: ${this.instancedCount}, count: ${t.count}, divisor: ${t.divisor}, attribute: ${e}`),this.instancedCount=Math.min(this.instancedCount,t.count*t.divisor),this.instancedCount;this.instancedCount=t.count*t.divisor}else"index"===e?this.drawRange.count=t.count:this.index||(this.drawRange.count=Math.max(this.drawRange.count,t.count))}getAttribute(e){return this.attributes.get(e)}setAttributeData(e,t){const i=this.getAttribute(e);i&&(i.data=t,i.needsUpdate=!0)}updateAttribute(e){const t=this.context.gl;t.bindBuffer(e.target,e.buffer),t.bufferData(e.target,e.data,t.STATIC_DRAW),e.needsUpdate=!1}removeAttribute(e){this.attributes.delete(e)}setIndex(e){if(Array.isArray(e)){const t=e.length>65535?new Uint32Array(e):new Uint16Array(e),i=new jr(this.context.gl,t,1);this.addAttribute("index",i)}else e.size=1,this.addAttribute("index",e);this.drawRange.count=this.index.count}setVertices(e){const t=[];for(let i=0,r=e.length;i<r;i+=1){const r=e[i];t.push(r[0],r[1],r[2])}this.addAttribute("position",new jr(this.context.gl,new Float32Array(t),3))}setNormals(e){this.addAttribute("normal",new jr(this.context.gl,new Float32Array(e),2))}setUVs(e){this.addAttribute("uv",new jr(this.context.gl,new Float32Array(e),2))}setColors(e){const t=[];for(let i=0,r=e.length;i<r;i+=1){let r=e[i];r instanceof _r&&(r=r.toVector().toArray()),t.push(r[0],r[1],r[2],r[3])}this.addAttribute("color",new jr(this.context.gl,new Float32Array(t),4))}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}setInstancedCount(e){this.instancedCount=e}createVAO(e){const t=e.attributeOrder,i=this.context.createVertexArray();this.context.bindVertexArray(i),this._VAOs[t]=i,this.bindAttributes(e),this.context.bindVertexArray(null)}bindAttributes(e){const t=this.context.gl;Object.keys(e.attributes).forEach((i=>{const r=this.attributes.get(i);if(!r)return;const a=e.attributes[i];t.bindBuffer(r.target,r.buffer),this.context.state.opts.boundBuffer=r.buffer;let s=1;35674===r.type&&(s=2),35675===r.type&&(s=3),35676===r.type&&(s=4);for(let e=0;e<s;e++)t.vertexAttribPointer(a+e,r.size,r.type,r.normalized,r.stride,r.offset),t.enableVertexAttribArray(a+e),this.context.vertexAttribDivisor(a+e,r.divisor)}));const i=this.attributes.get("index");i&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,i.buffer)}computeBoundingBox(){const{data:e,offset:t=0,stride:i,size:r}=this.attributes.get("position");this.bounds||(this._bounds={min:new Ve.A,max:new Ve.A,center:new Ve.A,scale:new Ve.A,radius:Number.POSITIVE_INFINITY});const a=this.bounds,s=a.min,n=a.max,o=a.center,l=a.scale;s.setScalar(+Number.POSITIVE_INFINITY),n.setScalar(Number.NEGATIVE_INFINITY);const h=i||r;for(let i=t,r=e.length;i<r;i+=h){const t=e[i+0],r=e[i+1],a=e[i+2];s.x=Math.min(t,s.x),s.y=Math.min(r,s.y),s.z=Math.min(a,s.z),n.x=Math.max(t,n.x),n.y=Math.max(r,n.y),n.z=Math.max(a,n.z)}return l.subVectors(n,s),o.add(s).add(n).divideScalar(2),a}computeBoundingSphere(){const{data:e,offset:t=0,stride:i,size:r}=this.attributes.get("position");this.bounds||this.computeBoundingBox();let a=0;const s=i||r;for(let i=t,r=e.length;i<r;i+=s)Gr.fromArray([...e],i),a=Math.max(a,this.bounds.center.distanceToSquared(Gr));this.bounds.radius=Math.sqrt(a)}draw(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.drawMode;const i=this.context.gl,{start:r,count:a}=this.drawRange,s=`${this.id}_${e.attributeOrder}`;this.context.state.activeGeometryId!==s&&(this._VAOs[e.attributeOrder]||this.createVAO(e),e.context.bindVertexArray(this._VAOs[e.attributeOrder]),this.context.state.setActiveGeometry(s)),Object.keys(e.attributes).forEach((e=>{const t=this.getAttribute(e);t&&t.needsUpdate&&this.updateAttribute(t)})),this.isInstanced?this.index?this.context.drawElementsInstanced(t,a,this.index.type,this.index.offset+2*r,this.instancedCount):this.context.drawArraysInstanced(t,r,a,this.instancedCount):this.index?i.drawElements(t,a,this.index.type,this.index.offset+2*r):i.drawArrays(t,r,a)}clone(){const e={};this.attributes.forEach(((t,i)=>{e[i]=t}));const t=new qr(this.context,e);return t.drawMode=this.drawMode,t}dispose(){Object.keys(this._VAOs).forEach((e=>{this.context.deleteVertexArray(this._VAOs[e]),delete this._VAOs[e]})),this.attributes.forEach((e=>{this.gl.deleteBuffer(e.buffer)})),this.attributes.clear()}}const Wr=qr,Hr=class{constructor(){this.layoutVertexArray=new Er(2),this.colorVertexArray=new Er(2),this.patternVertexArray=new Er(4),this.pixelRatioArray=new Er(1),this.indexArray=new Tr(3),this.indexArray2=new Tr(2),this.segments={line:[],triangle:[]},this._geometry={fill:null,stroke:null}}get geometry(){return this._geometry}prepareGeometry(e,t){if(t&&this._geometry.stroke||!t&&this._geometry.fill)return;const i=t?this.segments.line:this.segments.triangle,r=t?this.indexArray2:this.indexArray,a=[];for(let t=0;t<i.length;t++){const s=i[t],{vertex:n,index:o}=s,l=Dr(this.layoutVertexArray,n),h=Dr(this.colorVertexArray,n),c=Dr(this.patternVertexArray,n),d=Dr(this.pixelRatioArray,n),u=zr(new Uint16Array(o.length*r.stride),r,o),p=new Wr(e,{position:{size:2,data:l},color:{size:2,data:h},pattern:{size:4,data:c},pixelRatio:{size:1,data:d},index:{size:1,data:u}});a.push(p)}t?this._geometry.stroke=a:this._geometry.fill=a}addVertex(e,t){this.layoutVertexArray.emplace([e,t])}trim(){this.layoutVertexArray.trim(),this.indexArray.trim(),this.indexArray2.trim(),this.colorVertexArray.trim(),this.patternVertexArray.trim(),this.pixelRatioArray.trim()}updateColorArray(e,t,i){const r=Cr(i||new _r("#000"));for(let i=e;i<t;i++)this.colorVertexArray.emplaceAt(i,r)}updatePatternArray(e,t,i,r){for(let a=e;a<t;a++)this.patternVertexArray.emplaceAt(a,i),this.pixelRatioArray.emplaceAt(a,r)}};class Zr extends rt{constructor(){super(...arguments),this.buffers=new Hr}get type(){return"fill"}sortFeatures(e,t){const i=t.fillSort();return i?e.filter((e=>(0,pe.Z)((0,V.J)(e.properties,i.property)))).sort(((e,t)=>{const r=(0,V.J)(e.properties,i.property),a=(0,V.J)(t.properties,i.property);return"desc"===i.direction?a-r:r-a})):e}addFeature(e,t){var i,r,a,s,n,o;const l=e.feature.asPolygons(),h=e.feature.extent,c=this.buffers,d=null!==(i=null==t?void 0:t.tileCoord)&&void 0!==i?i:new Vt(0,0,0),u=null===(r=null==t?void 0:t.paint)||void 0===r?void 0:r.config,p=null==t?void 0:t.patternDependencies,f=c.layoutVertexArray,m=c.indexArray,g=c.indexArray2,v=c.layoutVertexArray.length;if(!l)return;const y=null!==(s=null===(a=null==t?void 0:t.subdivisionGranularity)||void 0===a?void 0:a.fill.getGranularityForZoomLevel(d.z))&&void 0!==s?s:1;for(let e=0;e<l.length;e++){const t=l[e];for(let e=0;e<t.length;e++){const i=t[e];if(0!==i.length)for(let e=0;e<i.length;e++){const t=Rr({x:i[e].x,y:i[e].y},h);i[e]=t}}const i=ot(t,d,y),r=i.verticesFlattened,a=i.indicesTriangles,s=i.indicesLineList,n=r.length/2,o=Pr(c.segments.triangle,n,f.length,m.length),u=o.vertex.length;if(a.length%3!=0)throw new Error("Invalid indices count");for(let e=0;e<a.length;e+=3)c.indexArray.emplace([u+a[e+0],u+a[e+1],u+a[e+2]]);o.vertex.length+=n,o.index.length+=a.length/3;const p=Pr(c.segments.line,n,f.length,g.length),v=p.vertex.length;p.vertex.length+=n;for(let e=0;e<r.length;e+=2)c.addVertex(r[e],r[e+1]);for(let e=0;e<s.length;e++){const t=s[e],i=[];for(let e=1;e<t.length;e++)i.push(t[e-1],t[e]);for(let e=1;e<i.length;e+=2)g.emplace([v+i[e-1],v+i[e]]);p.index.length+=i.length/2}}const x=Cr(new _r("#000"));for(let e=c.colorVertexArray.length;e<c.layoutVertexArray.length;e++)c.colorVertexArray.emplace(x);for(let e=c.patternVertexArray.length;e<c.layoutVertexArray.length;e++)c.patternVertexArray.emplace([0,0,1,1]),c.pixelRatioArray.emplace([1]);let b,w=null===(n=u.fill)||void 0===n?void 0:n.pattern;return me(w)&&(w=w(e.properties)),w&&(0,pe.Z)(w)&&(b="string"==typeof w?w:w.id,(0,ue.vA)((0,pe.Z)(b),`[MapsGL] Icon image id was not provided for pattern: ${JSON.stringify(w)}`),p[b]="string"==typeof w||Object.assign(Object.assign({},w),{pixelRatio:null!==(o=w.pixelRatio)&&void 0!==o?o:1,pattern:!0})),{type:e.type,featureIndex:e.featureIndex,sourceId:e.sourceId,sourceLayerIndex:e.sourceLayerIndex,geometry:l,properties:e.properties,pattern:{id:b},vertexRange:{start:v,end:c.layoutVertexArray.length},dependencies:{patterns:p}}}trim(){this.buffers.trim()}serialize(){const e=this.buffers,t=super.serialize();return Object.assign(Object.assign({},t),{layoutVertexArray:e.layoutVertexArray.serialize(),colorVertexArray:e.colorVertexArray.serialize(),patternVertexArray:e.patternVertexArray.serialize(),pixelRatioArray:e.pixelRatioArray.serialize(),indexArray:e.indexArray.serialize(),index2Array:e.indexArray2.serialize(),segments:{line:e.segments.line,triangle:e.segments.triangle}})}static from(e){const t=new Zr(e.options);return(0,W.I)(e)?console.warn("[MapsGL] Cannot create FillStore from invalid serialized data."):(t.features=e.features,t.buffers.segments.line=e.segments.line,t.buffers.segments.triangle=e.segments.triangle,t.buffers.layoutVertexArray=Er.from(e.layoutVertexArray),t.buffers.colorVertexArray=Er.from(e.colorVertexArray),t.buffers.patternVertexArray=Er.from(e.patternVertexArray),t.buffers.pixelRatioArray=Er.from(e.pixelRatioArray),t.buffers.indexArray=Tr.from(e.indexArray),t.buffers.indexArray2=Tr.from(e.index2Array)),t}}const Yr=Zr,Xr=[0,1,2,0,2,3],Qr=new Float32Array([0,-.5,1,-.5,1,.5,0,.5]),Kr=class{constructor(){this.layoutVertexArray=new Er(2),this.colorVertexArray=new Er(2),this.indexArray=new Tr(2),this.uvArray=new Er(2),this.previousVertexArray=new Er(2),this.nextVertexArray=new Er(2),this.sideArray=new Mr(1),this.widthArray=new Er(1),this.lengthArray=new Er(1),this.terminalArray=new Er(1),this.countersArray=new Er(1),this.segments={line:[]}}get geometry(){return this._geometry}prepareGeometry(e,t,i){if(this._geometry)return;const r=!1;let a=0;for(let e=0;e<t.length;e++){const{start:i,end:r}=t[e];a=Math.max(a,r-i)}const s=function(e,t,i,r){let a=arguments.length>4&&void 0!==arguments[4]&&arguments[4],s=0;for(let e=0;e<i.length;e++){const{start:t,end:r}=i[e];s=Math.max(s,(r-t)/2)}const n=(new Float32Array).BYTES_PER_ELEMENT,o=t.layoutVertexArray.data,l=4*n,h={position:{size:2,data:Qr},color:{size:2,data:t.colorVertexArray.data,stride:4*n,divisor:1},segments:{size:1,data:t.lengthArray.data,divisor:1},terminal:{size:1,data:t.terminalArray.data,divisor:1}};let c=1===s?i.length:t.layoutVertexArray.length/2;if(a&&s>1){const e=1===s?[0,0,2,2]:[0,4,6,10];h.pA={size:2,data:o,stride:l,offset:e[0]*n,divisor:1},h.pB={size:2,data:o,stride:l,offset:e[1]*n,divisor:1},h.pC={size:2,data:o,stride:l,offset:e[2]*n,divisor:1},h.pD={size:2,data:o,stride:l,offset:e[3]*n,divisor:1},c=(t.layoutVertexArray.length-4)/2}else h.pA={size:2,data:o,stride:l,offset:0*n,divisor:1},h.pB={size:2,data:o,stride:l,offset:2*n,divisor:1};const d=new Wr(e,h);return d.setIndex(Xr),d.setInstancedCount(c),d}(e,this,t,i,r),n=function(e,t,i,r){const a=t.layoutVertexArray.data,s=t.colorVertexArray.data,n=[],o=[];for(let e=0;e<i.length;e++){const{start:t,end:r}=i[e];if(r-t>2){let e=0;for(;e<3;){const i=t+2*e;n.push(a[i+0],a[i+1]),o.push(s[i+0],s[i+1]),e+=1}for(e=1;e<=3;){const t=r-2*e;n.push(a[t+0],a[t+1]),o.push(s[t+0],s[t+1]),e+=1}}}if(0===n.length)return;const l=new Float32Array(n),h=(new Float32Array).BYTES_PER_ELEMENT,c=new Wr(e,{position:{size:2,data:new Float32Array([0,-.5,1,-.5,1,.5,0,.5])},color:{size:2,data:new Float32Array(o),stride:4*h,divisor:1},pA:{size:2,data:l,stride:4*h,offset:0*h,divisor:1},pB:{size:2,data:l,stride:4*h,offset:2*h,divisor:1},pC:{size:2,data:l,stride:4*h,offset:3*h,divisor:1}});return c.setInstancedCount(l.length/16),c.setIndex([0,1,2,0,2,3]),c}(e,this,t),o=a>2?function(e,t,i,r){let a=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const s=r.strokeLineJoin(),n=function(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const r={[or.p.Bevel]:{size:3,position:i?[1,0,0,0,1,0,0,0,1]:[0,0,0,1,0,0,0,1,0],index:void 0,id:void 0},[or.p.Miter]:{size:4,position:i?[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]:[0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,1,0],index:[0,1,2,0,2,3],id:void 0},[or.p.Round]:{size:2,position:Array.from({length:t}).reduce(((e,i,r)=>{const a=2*Math.PI*r/t;return e.push(.5*Math.cos(a),.5*Math.sin(a)),e}),[0,0]),index:Array.from({length:t}).reduce(((e,t,i)=>(e.push(0,i+1,i+2),e)),[]),id:Array.from({length:t+2}).reduce(((e,t,i)=>(e.push(i),e)),[])}};return r[e]}(s,12),o=(new Float32Array).BYTES_PER_ELEMENT,l=2*o,h=t.layoutVertexArray.data,c=t.colorVertexArray.data,d={position:{size:n.size,data:new Float32Array(n.position)},color:{size:2,data:c,stride:l,divisor:1},pA:{size:2,data:h,stride:l,offset:0*o,divisor:1},pB:{size:2,data:h,stride:l,offset:4*o,divisor:1},pC:{size:2,data:h,stride:l,offset:8*o,divisor:1}};a&&s===or.p.Round&&(d.id={size:1,data:new Float32Array(n.id)});const u=new Wr(e,d);return u.setInstancedCount(t.layoutVertexArray.length-4),a&&n.index&&u.setIndex(n.index),u}(e,this,t,i,r):void 0,l=function(e,t,i,r){const a=r.strokeLineCap(),s=function(e,t){return{butt:{},square:{size:2,position:[0,.5,0,-.5,.5,-.5,.5,.5],index:[0,1,2,0,2,3]},round:{size:2,position:(e=>{const t=[0,0];for(let e=0;e<=12;e++){const i=-.5*Math.PI+Math.PI*e/12;t.push(.5*Math.cos(i),.5*Math.sin(i))}return t})(),index:(e=>{const t=[];for(let e=0;e<12;e++)t.push(0,e+1,e+2);return t})()}}[e]}(a);if(a===or.$.Butt)return;const n=t.layoutVertexArray.data,o=t.colorVertexArray.data,l=[],h=[];for(let e=0;e<i.length;e++){const{start:t,end:r}=i[e];let a=0;for(;a<2;){const e=2*t+2*a;l.push(n[e+0],n[e+1]),h.push(o[e+0],o[e+1]),a+=1}for(a=1;a<=2;){const e=2*r-2*a;l.push(n[e+0],n[e+1]),h.push(o[e+0],o[e+1]),a+=1}}const c=(new Float32Array).BYTES_PER_ELEMENT,d=4*c,u=new Wr(e,{position:{size:s.size,data:new Float32Array(s.position)},color:{size:2,data:new Float32Array(h),stride:d,divisor:1},pA:{size:2,data:new Float32Array(l),stride:d,offset:0*c,divisor:1},pB:{size:2,data:new Float32Array(l),stride:d,offset:2*c,divisor:1}});return u.setIndex(s.index),u}(e,this,t,i);this._geometry={segments:[s],terminals:[n],joins:[o],caps:[l]}}addVertex(e,t){this.layoutVertexArray.emplace([e,t])}trim(){this.layoutVertexArray.trim(),this.indexArray.trim(),this.colorVertexArray.trim(),this.uvArray.trim(),this.previousVertexArray.trim(),this.nextVertexArray.trim(),this.sideArray.trim(),this.widthArray.trim(),this.lengthArray.trim(),this.terminalArray.trim(),this.countersArray.trim()}updateColorArray(e,t,i){const r=Cr(i||new _r("#000"));for(let i=e;i<t;i++)this.colorVertexArray.emplaceAt(i,r)}};class Jr{constructor(e,t,i=0){this.x=e,this.y=t,this.z=i}equals(e){return this.x===e.x&&this.y===e.y&&this.z===e.z}}class ea extends rt{constructor(){super(...arguments),this.buffers=new Kr}get type(){return"line"}addFeature(e,t){const i=this.buffers.layoutVertexArray,r=this.buffers.colorVertexArray,a=i.length;let s;if(2===e.type?s=this.addLines(e,t):3===e.type&&(s=this.addPolygons(e)),i.length===a)return;const n=Cr(new _r("#000"));for(let e=r.length;e<i.length;e++)r.emplace(n);const o=(i.length-a)/2;for(let e=0;e<o;e++)this.buffers.lengthArray.emplace(o);return{type:e.type,featureIndex:e.featureIndex,sourceId:e.sourceId,sourceLayerIndex:e.sourceLayerIndex,geometry:s,properties:e.properties,vertexRange:{start:a,end:i.length}}}addLines(e,t){var i,r,a;const s=null!==(i=null==t?void 0:t.tileCoord)&&void 0!==i?i:new Vt(0,0,0),n=e.feature.asLines(),o=e.feature.extent,l=null!==(a=null===(r=null==t?void 0:t.subdivisionGranularity)||void 0===r?void 0:r.line.getGranularityForZoomLevel(s.z))&&void 0!==a?a:1;for(let t=0;t<n.length;t++){let i=n[t].map((e=>Rr(e,o)));i=lt(i,l);const r=i.map((e=>new Jr(e.x,e.y)));this.addLine(r,e,or.p.Miter,or.$.Butt,0,0)}return n}addPolygons(e){const t=this.buffers,i=e.feature.asPolygons(),r=t.layoutVertexArray,a=t.indexArray;for(let s=0;s<i.length;s++){const n=i[s];for(let t=0;t<n.length;t++){const i=n[t];if(0!==i.length)for(let t=0;t<i.length;t++){const r=Rr({x:i[t].x,y:i[t].y},e.feature.extent);i[t]=r}}const{flattened:o,lineList:l}=Ir(n),h=o.length/2,c=r.length;Pr(t.segments.line,h,r.length,a.length).vertex.length+=h;for(let e=0;e<l.length;e++){const i=l[e];for(let e=0;e<i.length;e++){const r=i[e],a=o[2*r+0],s=o[2*r+1];t.addVertex(a,s),e>0&&e<i.length-1&&t.addVertex(a,s)}}const d=(r.length-c)/2;for(let e=0;e<d;e++){let i=0;0===e?i=1:e===d-1&&(i=2),t.terminalArray.emplace(i)}}return i}addLine(e,t,i,r,a,s){const n=this.buffers,o=3===t.feature.type;let l=e.length;for(;l>=2&&e[l-1].equals(e[l-2]);)l-=1;let h=0;for(;h<l-1&&e[h].equals(e[h+1]);)h+=1;if(l<(o?3:2))return;const c=Pr(n.segments.line,10*l,n.layoutVertexArray.length,n.indexArray.length),d=n.layoutVertexArray.length;for(let t=h;t<l;t++){const i=e[t];let r,a;t<l-1&&(r=e[t-1]),t>0&&(a=e[t+1]),this.addVertex(c,t,i,r,a,l),t>h&&t<l-1&&this.addVertex(c,t,i,r,a,l)}c.vertex.length+=e.length,c.index.length+=e.length;const u=(n.layoutVertexArray.length-d)/2;for(let e=0;e<u;e++){let t=0;1===u?t=3:0===e?t=1:e===u-1&&(t=2),n.terminalArray.emplace(t)}}addVertex(e,t,i,r,a,s){this.buffers.layoutVertexArray.emplace([i.x,i.y]),e.vertex.length+=1,e.index.length+=1}serialize(){const e=this.buffers,t=super.serialize();return Object.assign(Object.assign({},t),{layoutVertexArray:e.layoutVertexArray.serialize(),colorVertexArray:e.colorVertexArray.serialize(),indexArray:e.indexArray.serialize(),uvArray:e.uvArray.serialize(),previousVertexArray:e.previousVertexArray.serialize(),nextVertexArray:e.nextVertexArray.serialize(),sideArray:e.sideArray.serialize(),widthArray:e.widthArray.serialize(),lengthArray:e.lengthArray.serialize(),terminalArray:e.terminalArray.serialize(),countersArray:e.countersArray.serialize(),segments:{line:e.segments.line}})}static from(e){const t=new ea(e.options);return(0,W.I)(e)?console.warn("[MapsGL] Cannot create LineStore from invalid serialized data."):(t.features=e.features,t.buffers.segments.line=e.segments.line,t.buffers.layoutVertexArray=Er.from(e.layoutVertexArray),t.buffers.colorVertexArray=Er.from(e.colorVertexArray),t.buffers.indexArray=Tr.from(e.indexArray),t.buffers.uvArray=Er.from(e.uvArray),t.buffers.previousVertexArray=Er.from(e.previousVertexArray),t.buffers.nextVertexArray=Er.from(e.nextVertexArray),t.buffers.sideArray=Mr.from(e.sideArray),t.buffers.widthArray=Er.from(e.widthArray),t.buffers.lengthArray=Er.from(e.lengthArray),t.buffers.terminalArray=Er.from(e.terminalArray),t.buffers.countersArray=Er.from(e.countersArray)),t}}const ta=ea,ia=class{constructor(e,t,i){if(Array.isArray(t))throw new TypeError("[Aeris GL] InterleavedBuffer: data should be a typed array");let r=0;void 0!==t&&(r=t.byteLength/i),this.data=t,this.type=Fr(e,t),this.stride=i,this.count=r}},ra=class{constructor(){this.layoutVertexArray=new Er(2),this.colorVertexArray=new Er(2),this.indexArray=new Tr(3),this.radiusArray=new Er(1),this.strokeWidthArray=new Er(1),this.segments={point:[]}}get geometry(){return this._geometry}prepareGeometry(e){if(this._geometry)return;const t=(new Float32Array).BYTES_PER_ELEMENT,i=new ia(e.gl,this.layoutVertexArray.data,2*t),r=new ia(e.gl,this.colorVertexArray.data,4*t),a=new ia(e.gl,this.radiusArray.data,1*t),s=new ia(e.gl,this.strokeWidthArray.data,1*t),n=new Wr(e,{position:{size:2,data:new Float32Array([0,1,0,0,1,0,1,1])},uv:{size:2,data:new Float32Array([0,1,0,0,1,0,1,1])},anchor:new Br(i,2,!1,0,1),fillColor:new Br(r,2,!1,0,1),strokeColor:new Br(r,2,!1,2*t,1),strokeWidth:new Br(s,1,!1,0,1,1*t),radius:new Br(a,1,!1,0,1,1*t)});n.setIndex([0,1,2,0,2,3]),this._geometry=n}trim(){this.layoutVertexArray.trim(),this.indexArray.trim(),this.colorVertexArray.trim(),this.radiusArray.trim(),this.strokeWidthArray.trim()}updateColorArray(e,t,i){const r=Cr(i||new _r("#000"));for(let i=e;i<t;i++)this.colorVertexArray.emplaceAt(i,r)}updateRadiusArray(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10;for(let r=e;r<t;r++)this.radiusArray.emplaceAt(r,i)}updateStrokeWidthArray(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;for(let r=e;r<t;r++)this.strokeWidthArray.emplaceAt(r,i)}};class aa extends rt{constructor(){super(...arguments),this.buffers=new ra}get type(){return"circle"}addFeature(e,t){const i=this.buffers,r=e.feature.asPoints(),a=e.feature.extent;if(!r)return;const s=i.layoutVertexArray.length;for(let e=0;e<r.length;e++){const t=r[e],s=Rr({x:t.x,y:t.y},a);if(r[e]=s,s.x<0||s.x>=it||s.y<0||s.y>=it)continue;const n=Pr(i.segments.point,2,i.layoutVertexArray.length,i.indexArray.length);i.layoutVertexArray.emplace([s.x,s.y]),n.vertex.length+=2,n.index.length+=1}if(i.layoutVertexArray.length===s)return;const n=Cr(new _r("#000"));for(let e=i.colorVertexArray.length;e<2*i.layoutVertexArray.length;e++)i.colorVertexArray.emplace(n);for(let e=s;e<i.layoutVertexArray.length;e++)i.radiusArray.emplace(10),i.strokeWidthArray.emplace(1);return{type:e.type,featureIndex:e.featureIndex,sourceId:e.sourceId,sourceLayerIndex:e.sourceLayerIndex,geometry:r,properties:e.properties,vertexRange:{start:s,end:i.layoutVertexArray.length},radius:10,strokeWidth:1}}trim(){this.buffers.trim()}serialize(){const e=this.buffers,t=super.serialize();return Object.assign(Object.assign({},t),{layoutVertexArray:e.layoutVertexArray.serialize(),colorVertexArray:e.colorVertexArray.serialize(),indexArray:e.indexArray.serialize(),radiusArray:e.radiusArray.serialize(),strokeWidthArray:e.strokeWidthArray.serialize(),segments:{point:e.segments.point}})}static from(e){const t=new aa(e.options);return(0,W.I)(e)?console.warn("[MapsGL] Cannot create CircleStore from invalid serialized data."):(t.features=e.features,t.buffers.segments.point=e.segments.point,t.buffers.layoutVertexArray=Er.from(e.layoutVertexArray),t.buffers.colorVertexArray=Er.from(e.colorVertexArray),t.buffers.indexArray=Tr.from(e.indexArray),t.buffers.radiusArray=Er.from(e.radiusArray),t.buffers.strokeWidthArray=Er.from(e.strokeWidthArray)),t}}const sa=aa,na=(e,t,i)=>{for(let r=0;r<e.kernings[r];r++){const a=e.kernings[r];if(!(a.first<t||a.second<i))return a.first>t||a.first===t&&a.second>i?0:a.amount}return 0},oa=class{get font(){return this._config.font}constructor(e={}){this._config=Object.freeze(Object.assign({width:Number.POSITIVE_INFINITY,size:1,align:"left",letterSpacing:0,lineHeight:1.4,wordSpacing:0,wordBreak:!1},e))}generateLayout(e){const t=this.font,i=t.common.base,r=this._config.size,a=this._config.lineHeight,s=e.replaceAll(/[\n ]/g,"").length,n={position:{size:3,data:new Float32Array(4*s*3)},uv:{size:2,data:new Float32Array(4*s*2)},id:{size:4,data:new Float32Array(4*s)},index:{size:6,data:new Float32Array(6*s)}},o={position:[],uv:[],id:[],index:[],layout:[]};for(let e=0;e<s;e++)n.id.data[e]=e,n.index.data.set([4*e,4*e+2,4*e+1,4*e+1,4*e+2,4*e+3],6*e),o.id.push(e),o.index.push([4*e,4*e+2,4*e+1,4*e+1,4*e+2,4*e+3]);const l=r/i,h=t.chars.reduce(((e,t)=>(e[t.char]=t,e)),{}),c=[];let d=0,u=0,p=0;const f=()=>{const e={width:0,glyphs:[]};return c.push(e),u=d,p=0,e};let m=f();const g=/\s/,v=/\n/;let y=0;for(;d<e.length&&y<100;){y+=1;const i=e[d];if(!m.width&&g.test(i)){d+=1,u=d,p=0;continue}if(v.test(i)){d+=1,m=f();continue}const a=h[i]||h[" "];if(m.glyphs.length>0){const e=m.glyphs.at(-1)[0],i=na(t,a.id,e.id)*l;m.width+=i,p+=i}m.glyphs.push([a,m.width]);let s=0;if(g.test(i)?(u=d,p=0,s+=this._config.wordSpacing*r):s+=this._config.letterSpacing*r,s+=a.xadvance*l,m.width+=s,p+=s,m.width>this._config.width){if(this._config.wordBreak&&m.glyphs.length>1){m.width-=s,m.glyphs.pop(),m=f();continue}if(!this._config.wordBreak&&p!==m.width){const e=d-u+1;m.glyphs.splice(-e,e),d=u,m.width-=p,m=f();continue}}d+=1,y=0}m.width||c.pop();const x={width:Math.max(...c.map((e=>e.width))),height:c.length*r*this._config.lineHeight},{positions:b,uvs:w,layout:_}=this._populateBuffers(n,c,r,a,l,x);return o.position=b,o.uv=w,o.layout=_,{text:e,buffers:n,data:o,layout:_,numChars:s,numLines:c.length,size:x}}_populateBuffers(e,t,i,r,a,s){const n=this.font,o=n.common.scaleW,l=n.common.scaleH,h=this._config.align,c=/\s/,d=[],u=[],p=[];let f=.14*i,m=0;switch(h){case"bottom-left":case"bottom":case"bottom-right":f+=s.height;break;case"left":case"center":case"right":f+=.5*s.height}for(let s=0;s<t.length;s++){const n=t[s];let g=f;for(let t=0;t<n.glyphs.length;t++){const i=n.glyphs[t][0],r={anchor:null,offset:null,uv:null};let s=n.glyphs[t][1];switch(h){case"right":case"top-right":case"bottom-right":s-=n.width;break;case"center":case"top":case"bottom":s-=.5*n.width}if(c.test(i.char))continue;s+=i.xoffset*a,g-=i.yoffset*a;const v=i.width*a,y=i.height*a;e.position.data.set([s,g-y,0,s,g,0,s+v,g-y,0,s+v,g,0],4*m*3),d.push([s,g-y,0,s,g,0,s+v,g-y,0,s+v,g,0]),r.anchor=[s,1-g],r.offset=[v,y];const x=i.x/o,b=i.width/o,w=1-i.y/l,_=i.height/l;e.uv.data.set([x,w-_,x,w,x+b,w-_,x+b,w],4*m*2),u.push([x,w-_,x,w,x+b,w-_,x+b,w]),r.uv=[x,1-w,b,_],g=f,m+=1,p.push(r)}f-=i*r}return{positions:d,uvs:u,layout:p}}},la=e=>{const t={x:0,y:0};switch(e){case"right":case"top-right":case"bottom-right":t.x=-.5;break;case"left":case"top-left":case"bottom-left":t.x=.5}switch(e){case"bottom":case"bottom-right":case"bottom-left":t.y=-.5;break;case"top":case"top-right":case"top-left":t.y=.5}return new _i(t.x,t.y)},ha=class{constructor(){this.layoutVertexArray=new Er(13),this.indexArray=new Tr(3),this.opacityVertexArray=new Er(1),this.styleVertexArray=new Er(10),this.segments=[]}get geometry(){return this._geometry}prepareGeometry(e){if(this._geometry)return;const t=this.layoutVertexArray,i=this.opacityVertexArray,r=this.styleVertexArray,a=(new Float32Array).BYTES_PER_ELEMENT,s=new ia(e.gl,t.data,t.stride*a),n=new ia(e.gl,i.data,i.stride*a),o=new ia(e.gl,r.data,r.stride*a),l=new Wr(e,{position:{size:2,data:new Float32Array([0,1,0,0,1,0,1,1])},uv:{size:2,data:new Float32Array([0,1,0,0,1,0,1,1])},anchor:new Br(s,2,!1,0,1),glyph:new Br(s,4,!1,2*a,1),texCoordOffset:new Br(s,4,!1,6*a,1),reference:new Br(s,1,!1,10*a,1),gridPosition:new Br(s,2,!1,11*a,1),fillColor:new Br(o,2,!1,0,1),strokeColor:new Br(o,2,!1,2*a,1),strokeWidth:new Br(o,1,!1,4*a,1),size:new Br(o,1,!1,5*a,1),rotation:new Br(o,1,!1,6*a,1),factor:new Br(o,1,!1,7*a,1),random:new Br(o,1,!1,8*a,1),atlasIndex:new Br(o,1,!1,9*a,1),opacity:new Br(n,1,!1,0,1)});l.setIndex([0,1,2,0,2,3]),this._geometry=l}trim(){this.layoutVertexArray.trim(),this.indexArray.trim(),this.opacityVertexArray.trim(),this.styleVertexArray.trim()}updateTexturePositionArray(e,t,i){for(let r=e;r<t;r++){const e=r*this.layoutVertexArray.stride+6;for(let t=0;t<4;t++)this.layoutVertexArray.data[e+t]=i[t]}}updateOpacityArray(e,t,i){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];var a;for(let r=e;r<t;r++)this.opacityVertexArray.emplaceAt(r,i);r&&(null===(a=this.geometry)||void 0===a||a.setAttributeData("opacity",this.opacityVertexArray.data))}updateStyleArray(e,t,i,r,a,s,n,o,l,h){const c=Cr(i||new _r(0,0,0,1)),d=Cr(r||new _r(0,0,0,0));for(let i=e;i<t;i++)this.styleVertexArray.emplaceAt(i,[...c,...d,a,s,n,o,l,h])}};class ca extends rt{get type(){return"symbol"}constructor(e){super(e),this.includesSDFIcons=!1,this.text=new ha,this.icon=new ha,this.collisionArrays=[]}addFeature(e,t){var i,r;t=Object.assign({glyphDependencies:{},iconDependencies:{}},t);const a=e.feature.asPoints(),s=e.feature.extent,n=null==t?void 0:t.paint,o=null===(i=null==t?void 0:t.paint)||void 0===i?void 0:i.config,l=[];let h;const c=null===(r=null==o?void 0:o.icon)||void 0===r?void 0:r.shader,d=null==n?void 0:n.textLineCount();for(let t=0;t<d;t++){const i=null==n?void 0:n.textValue(e.properties,t);i&&l.push(Lr(i,e.properties))}if((null==o?void 0:o.icon)&&(h=o.icon.type||o.icon.image||o.icon.shader||o.icon.atlas,me(h)&&(h=h(e.properties))),!a||!0!==t.includeEmptySymbolData&&0===(null==l?void 0:l.length)&&!h&&!c)return;let u,p,f;const m=t.glyphDependencies,g=t.iconDependencies;for(let i=0;i<a.length;i++){const r=a[i],n=Rr({x:r.x,y:r.y},s);if(a[i]=n,n.x<0||n.x>=it||n.y<0||n.y>=it)continue;f={x:n.x,y:n.y};const o=this.features.find((e=>{var t;return e.anchor.x===f.x&&e.anchor.y===f.y&&(null===(t=e.text)||void 0===t?void 0:t.length)>0&&e.text[0].value===l[0]}));if((null==l?void 0:l.length)>0&&!o){const{symbol:i,glyphDependencies:r}=this.addSymbolAtAnchor(f,Object.assign(Object.assign({},e),{anchor:f,geometry:a,paint:t.paint,text:l.map(((e,t)=>({value:e,index:t,anchor:f,padding:[0,0],offset:[0,0],vertexRange:void 0,atlasIndex:void 0,collisionBox:void 0}))),icon:null}),t);u=i.text,r&&Object.assign(m,r)}if((0,pe.Z)(h)){const{symbol:i,iconDependencies:r}=this.addSymbolAtAnchor(f,Object.assign(Object.assign({},e),{anchor:f,geometry:a,paint:t.paint,text:void 0,icon:{image:h,anchor:f,padding:[0,0],offset:[0,0],vertexRange:void 0,atlasIndex:void 0,collisionBox:void 0},collisionBox:void 0}),t);p=i.icon,r&&Object.assign(g,r)}}return!0===t.includeEmptySymbolData||u||p?{key:n.symbolKey(e.properties),type:e.type,featureIndex:e.featureIndex,sourceId:e.sourceId,sourceLayerIndex:e.sourceLayerIndex,geometry:a,anchor:f,properties:e.properties,vertexRange:void 0,paint:t.paint,text:u,icon:p,dependencies:{glyphs:m,icons:g}}:void 0}addSymbolAtAnchor(e,t,i){if(!(e.x<0||e.x>=it||e.y<0||e.y>=it))return t.icon?this.addIcon(e,t,i.iconDependencies):t.text?this.addText(e,t,i.glyphDependencies):void 0}addSymbols(e,t,i,r,a,s){const n=t.layoutVertexArray,o=t.opacityVertexArray,l=t.styleVertexArray,h=Pr(t.segments,4*i.length,n.length,t.indexArray.length);for(let t=0;t<i.length;t++){const{offset:c,texture:d,style:u}=i[t],{strokeWidth:p,size:f,opacity:m,rotation:g,factor:v}=u;n.emplace([e.x,e.y,c.x,c.y,c.w,c.h,d.x,d.y,d.w,d.h,r,a,s]),o.emplace(m),l.emplace([0,0,0,0,p,f,g,v,Math.random(),u.atlasIndex]),h.vertex.length+=2,h.index.length+=1}}addIcon(e,t,i){var r;const a=t.properties,s=t.paint,n=s.iconImage(a),o=s.iconShader(a);if((0,pe.Z)(n)){const e="string"==typeof n?n:n.id;(0,ue.vA)((0,pe.Z)(e),`[MapsGL] Icon image id was not provided for symbol: ${JSON.stringify(n)}`),i[e]="string"==typeof n||Object.assign(Object.assign({},n),{pixelRatio:null!==(r=n.pixelRatio)&&void 0!==r?r:1}),t.icon.image=e}return t.icon.vertexRange={start:0,end:0},(0,pe.Z)(o)&&this.layoutIcon(t,{}),{symbol:t,iconDependencies:i}}addText(e,t,i){const r=t.properties,a=t.paint;for(let e=0;e<t.text.length;e++){const s=t.text[e].value||"",n=a.textFont(r,e)||"Inter-Regular",o=a.textTransform(r,e)||"none";let l=s;"none"!==o&&("uppercase"===o?l=l.toUpperCase():"lowercase"===o?l=l.toLowerCase():"capitalize"===o&&(l=l.replaceAll(/\b\w/g,(e=>e.toUpperCase())))),void 0===i[n]&&(i[n]=[]);const h=i[n];for(let e=0;e<l.length;e++)s.charAt(e),h.push(s.charCodeAt(e));t.text[e].value=l,t.text[e].vertexRange={start:0,end:0}}return{symbol:t,glyphDependencies:i}}layoutSymbols(e,t){for(let i=0;i<this.features.length;i++){const r=this.features[i],a=r.text,s=r.icon,n={x1:Number.POSITIVE_INFINITY,y1:Number.POSITIVE_INFINITY,x2:Number.NEGATIVE_INFINITY,y2:Number.NEGATIVE_INFINITY,anchorPointX:r.anchor.x,anchorPointY:r.anchor.y};if(a){this.layoutText(r,t);for(let e=0;e<a.length;e++){const t=a[e];t.collisionBox&&(n.x1=Math.min(n.x1,t.collisionBox.x1),n.y1=Math.min(n.y1,t.collisionBox.y1),n.x2=Math.max(n.x2,t.collisionBox.x2),n.y2=Math.max(n.y2,t.collisionBox.y2))}}((null==s?void 0:s.image)||(null==s?void 0:s.shader))&&(this.layoutIcon(r,e),s.collisionBox&&(n.x1=Math.min(n.x1,s.collisionBox.x1),n.y1=Math.min(n.y1,s.collisionBox.y1),n.x2=Math.max(n.x2,s.collisionBox.x2),n.y2=Math.max(n.y2,s.collisionBox.y2))),r.collisionBox=n}}layoutText(e,t){var i;const r=e.properties,a=this.text,s=[];for(let n=0;n<e.text.length;n++){const o=e.text[n].value,l=e.paint,h=e.text[n].anchor,c=it/Mt,d=l.textFont(r,n)||"Inter-Regular",u=l.textSize(r,n)||12,p=l.textAlign(r,n)||"center",f=la(l.textAnchor(r,n)||"center"),m=l.textLineHeight(r,n)||1,g=l.textLetterSpacing(r,n)||0,v=l.textMaxWidth(r,n)||100,y=l.textOffset(r,n),x=l.textRotation(r,n)||0,b=l.symbolAllowOverlap()||!1,w=(l.symbolFadeOpacity(r),l.iconFactor(r)),_={x:0,y:0};if(y){const{x:e,y:t}=kr(y,s);_.x=e,_.y=t}const A=t[d].ranges[0];if((0,pe.E)(A))return;const M=A.spec;if(!M)throw new Error(`[MapsGL] Missing font spec for font "${d}"`);const T=new oa({font:M,size:u,width:v,align:p,lineHeight:Math.max(0,m),letterSpacing:g}).generateLayout(`${o}`),{position:E,layout:S}=T.data,C=[],O={x1:Number.POSITIVE_INFINITY,y1:Number.POSITIVE_INFINITY,x2:Number.NEGATIVE_INFINITY,y2:Number.NEGATIVE_INFINITY,anchorPointX:h.x,anchorPointY:h.y};for(let e=0;e<E.length;e++){const t=S[e],i={box:{tl:{x:t.anchor[0],y:t.anchor[1]},tr:{x:t.anchor[0]+t.offset[0],y:t.anchor[1]},bl:{x:t.anchor[0],y:t.anchor[1]+t.offset[1]},br:{x:t.anchor[0]+t.offset[0],y:t.anchor[1]+t.offset[1]}},offset:{x:t.anchor[0]+_.x,y:t.anchor[1]+_.y,w:t.offset[0],h:t.offset[1]},texture:{x:t.uv[0],y:t.uv[1],w:t.uv[2],h:t.uv[3]},style:{fillColor:l.fillColor(r)||new _r("#000"),strokeColor:l.strokeColor(r)||new _r("#000"),strokeWidth:l.strokeThickness(r)||0,size:u,opacity:b?1:0,rotation:x||0,factor:(0,R.n)(w)?w:0,atlasIndex:0}};O.x1=Math.min(O.x1,t.anchor[0]),O.y1=Math.min(O.y1,t.anchor[1]),O.x2=Math.max(O.x2,t.anchor[0]+t.offset[0]),O.y2=Math.max(O.y2,t.anchor[1]+t.offset[1]),C.push(i)}const I=O.x2-O.x1,P=O.y2-O.y1;C.forEach((e=>{e.offset.x+=I*f.x,e.offset.y+=P*f.y,O.x1=Math.min(O.x1,e.offset.x),O.y1=Math.min(O.y1,e.offset.y),O.x2=Math.max(O.x2,e.offset.x+e.offset.w),O.y2=Math.max(O.y2,e.offset.y+e.offset.h)}));const D=a.layoutVertexArray.length;this.addSymbols(h,a,C,e.featureIndex,0,0),e.text[n].vertexRange={start:D,end:a.layoutVertexArray.length},e.text[n].atlasIndex=null===(i=A.atlas)||void 0===i?void 0:i.index,s.push(Object.assign({},O)),O.x1*=c,O.y1*=c,O.x2*=c,O.y2*=c,e.text[n].collisionBox=O}this.collisionArrays.push({textBox:e.text[0].collisionBox,textFeatureIndex:e.featureIndex})}layoutIcon(e,t){var i,r;const a=e.properties,s=this.icon,n=t[e.icon.image]||{size:{width:20,height:20},position:{x:0,y:0,w:1,h:1},pixelRatio:1,sdf:!1},o=it/Mt,l=n.pixelRatio||1,h=e.paint,c=e.icon.anchor,d=h.iconSize(a)||{width:n.size.width/l,height:n.size.height/l},u=h.iconRotation(a),p=h.iconOffset(a),f=la(h.iconAnchor(a)||"center"),m=h.iconFactor(a),g=[],v=d.width,y=d.height,x=d.width/(n.size.width/l),b={x1:Number.POSITIVE_INFINITY,y1:Number.POSITIVE_INFINITY,x2:Number.NEGATIVE_INFINITY,y2:Number.NEGATIVE_INFINITY,anchorPointX:c.x,anchorPointY:c.y};n.position||console.warn("[MapsGL] Missing icon position for icon:",e.icon.image,t),n.sdf&&(this.includesSDFIcons=!0);const w={box:{tl:{x:c.x,y:c.y},tr:{x:c.x+v,y:c.y},bl:{x:c.x,y:c.y+y},br:{x:c.x+v,y:c.y+y}},offset:{x:-v/2+p.x,y:-y/2+p.y,w:v,h:y},texture:n.position?{x:n.position.x,y:n.position.y,w:n.position.w,h:n.position.h}:{x:0,y:0,w:1,h:1},style:{fillColor:h.fillColor(a)||new _r("#000"),strokeColor:h.strokeColor(a)||new _r("#000"),strokeWidth:h.strokeThickness(a)||0,size:x,opacity:1,rotation:u||0,factor:(0,R.n)(m)?m:0,atlasIndex:0}};w.offset.x+=v*f.x,w.offset.y+=y*f.y,g.push(w),b.x1=Math.min(b.x1,w.offset.x),b.y1=Math.min(b.y1,w.offset.y),b.x2=Math.max(b.x2,w.offset.x+w.offset.w),b.y2=Math.max(b.y2,w.offset.y+w.offset.h);const _=null!==(i=e.properties.gridRow)&&void 0!==i?i:0,A=null!==(r=e.properties.gridCol)&&void 0!==r?r:0,M=s.layoutVertexArray.length;this.addSymbols(c,s,g,e.featureIndex,_,A),e.icon.vertexRange={start:M,end:s.layoutVertexArray.length},b.x1*=o,b.y1*=o,b.x2*=o,b.y2*=o,e.icon.collisionBox=b,this.collisionArrays.push({iconBox:b,iconFeatureIndex:e.featureIndex})}trim(){this.text.trim(),this.icon.trim()}serialize(){const e=super.serialize();return Object.assign({features:this.features.map((e=>(e.paint=void 0,e))),text:{layoutVertexArray:this.text.layoutVertexArray.serialize(),indexArray:this.text.indexArray.serialize(),opacityVertexArray:this.text.opacityVertexArray.serialize(),styleVertexArray:this.text.styleVertexArray.serialize(),segments:[...this.text.segments]},icon:{layoutVertexArray:this.icon.layoutVertexArray.serialize(),indexArray:this.icon.indexArray.serialize(),opacityVertexArray:this.icon.opacityVertexArray.serialize(),styleVertexArray:this.icon.styleVertexArray.serialize(),segments:[...this.icon.segments]},collisionArrays:[...this.collisionArrays],includesSDFIcons:this.includesSDFIcons},e)}static from(e){const t=new ca(e.options);if(t.id=e.id,t.includesSDFIcons=e.includesSDFIcons,(0,W.I)(e))console.warn("[MapsGL] Cannot create SymbolStore from invalid serialized data.");else{const i=new ha;i.layoutVertexArray=Er.from(e.text.layoutVertexArray),i.indexArray=Tr.from(e.text.indexArray),i.opacityVertexArray=Er.from(e.text.opacityVertexArray),i.styleVertexArray=Er.from(e.text.styleVertexArray),i.segments=e.text.segments,t.text=i;const r=new ha;r.layoutVertexArray=Er.from(e.icon.layoutVertexArray),r.indexArray=Tr.from(e.icon.indexArray),r.opacityVertexArray=Er.from(e.icon.opacityVertexArray),r.styleVertexArray=Er.from(e.icon.styleVertexArray),r.segments=e.icon.segments,t.icon=r,t.collisionArrays=e.collisionArrays,t.features=e.features}return t}}const da=ca,ua=class{get size(){return{width:this.right-this.left,height:this.bottom-this.top}}get center(){const e=this.size;return{x:this.left+e.width/2,y:this.top+e.height/2}}constructor(e,t,i,r){this.left=0,this.right=0,this.top=0,this.bottom=0,this.left=e,this.right=t,this.top=i,this.bottom=r}},pa=class{constructor(e){this.boxes={},this.circles={},this._debug=!0,this._debugInfo=[],this.transform=e,this.tree=new(Ye()),this.screenBounds=new ua(0,0,e.state.size.width+0,e.state.size.height+0)}insertBox(e,t,i,r,a,s,n){const o=Mt/it,l=this.projectAndGetPerspectiveRatio(e,t.anchorPointX,t.anchorPointY),h=o*l.perspectiveRatio;if(l.occluded)return!1;const c=`${n}-${s}-${r}`,d=Math.ceil(t.x1*h+l.point.x-i[0]),u=Math.ceil(t.y1*h+l.point.y-i[1]),p=Math.ceil(t.x2*h+l.point.x+i[0]),f=Math.ceil(t.y2*h+l.point.y+i[1]),m={key:c,minX:d,minY:u,maxX:p,maxY:f},g=this.tree.collides(m);return g||(this.tree.insert(m),this.boxes[c]=m),this._debug&&this._debugInfo.push({key:c,bbox:{x1:d,y1:u,x2:p,y2:f},hidden:g}),!g}insertCircle(e,t,i,r){const a=`${i}-${r}-${t}`,s={key:a,x:e.x,y:e.y,radius:e.radius};return this.tree.insert(s),this.circles[a]=s,!0}collides(e){return this.tree.collides(e)}clear(){this.tree.clear(),this.boxes={},this.circles={},this._debugInfo=[]}debugBody(e,t){t.strokeStyle=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"black",t.lineWidth=1,t.beginPath(),t.rect(e.minX,e.minY,e.maxX-e.minX,e.maxY-e.minY),t.stroke()}debug(e){this._debug&&this._debugInfo.forEach((t=>{e.strokeStyle=t.hidden?"rgba(255,0,0,0.3)":"green",e.lineWidth=1,e.beginPath(),e.rect(t.bbox.x1,t.bbox.y1,t.bbox.x2-t.bbox.x1,t.bbox.y2-t.bbox.y1),e.stroke()}))}projectAndGetPerspectiveRatio(e,t,i){const{point:r,signedDistanceFromCamera:a,isOccluded:s}=this.transform.projection.projectTileCoordinates(t,i,e,this.transform),n=this.transform.state.size;return{point:{x:(r.x/a+1)/2*n.width+0,y:(-r.y/a+1)/2*n.height+0},perspectiveRatio:Math.min(.5+this.transform.cameraToCenterDistance/a*.5,1.5),occluded:s}}},fa=class{get isHidden(){return 0===this.opacity&&!this.placed}constructor(e,t,i,r){this.opacity=e?r?i?1:0:Math.max(0,Math.min(1,e.opacity+(e.placed?t:-t))):r&&i?1:0,this.placed=i}increment(e){this.opacity=Math.max(0,Math.min(1,this.opacity+e*(arguments.length>1&&void 0!==arguments[1]?arguments[1]:1)))}};function ma(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=0,a=null;return function(){for(var s=arguments.length,n=new Array(s),o=0;o<s;o++)n[o]=arguments[o];if(i){const i=Date.now();i-r>t&&(e.apply(this,n),r=i)}else a||(a=setTimeout((()=>{a=null,e.apply(this,n)}),t))}}const ga=(e,t,i)=>{const r=Tt(e.z)*it,a=(0,pe.Z)(i)?`-${i.replaceAll(/\s/g,"_")}`:"",s={x:(e.x*it+t.anchorPointX)/r*it,y:(e.y*it+t.anchorPointY)/r*it};return s.x=Math.floor(s.x),s.y=Math.floor(s.y),`${s.x}-${s.y}${a}`},va=e=>{var t,i;const r=(null===(t=e.text)||void 0===t?void 0:t.length)>0?e.text[0].value:null===(i=e.icon)||void 0===i?void 0:i.image;return e.key||r},ya=class{get transform(){return this._transform}constructor(e){if(this.fadeDuration=250,this.isDirty=!1,this.opacityState={},this.symbolsByLayer={},this.collisionIndexByLayer={},this.commitTime={},this.fadeDurationByLayer={},this.debug=!1,this.placeSymbolsThrottled=ma((e=>{this.placeSymbols(e)}),20),this._transform=e,this.collisionIndex=new pa(e),this.debug){const e=document.createElement("canvas");e.style.position="absolute",e.style.top="0",e.style.left="0",e.style.width="100%",e.style.height="100%",e.style.pointerEvents="none",e.style.zIndex="1000",document.body.append(e),this.debugCanvas=e}}setTransform(e){this._transform=e,this.collisionIndex=new pa(e)}getOpacityState(e){return this.opacityState[e]}placeSymbols(e){let t=!1;this.collisionIndex.clear(),e.forEach((e=>{this.placeLayerSymbols(e.id,e.tiles,e.paint)&&(t=!0)})),this.collisionIndex.clear(),this.isDirty=t}placeLayerSymbols(e,t,i){var r;let a;this.debugCanvas&&(a=this.debugCanvas.getContext("2d"),this.debugCanvas.width=window.innerWidth,this.debugCanvas.height=window.innerHeight,a.clearRect(0,0,this.debugCanvas.width,this.debugCanvas.height)),this.collisionIndexByLayer[e]||(this.collisionIndexByLayer[e]=new pa(this.transform)),this.collisionIndexByLayer[e].clear(),this.opacityState[e]||(this.opacityState[e]={}),this.symbolsByLayer[e]||(this.symbolsByLayer[e]={});let s=!1;const n=i.symbolRank(),o="object"==typeof n?n.property:n,l="object"==typeof n?n.direction:"asc",h=[],c={};for(const i of t){const t=null===(r=i.data)||void 0===r?void 0:r.getStore("symbol",e);if(t instanceof da){const r=i.coord.normalize(),a=this.transform.calculateTilePos(i.coord).matrix,s=Oi(i.coord,Mt,1,this.transform.state.zoom);t.features.forEach(((n,l)=>{const d=n.collisionBox;if((0,pe.E)(d))return;const u=va(n),p=ga(r,d,u),f=(0,pe.Z)(o)?(0,V.J)(n.properties,o):-1,m={crossTileId:p,tileCoord:i.coord,feature:n,featureIndex:n.featureIndex,rank:f,store:t,posMatrix:a,pixelsToTiles:s};this.symbolsByLayer[e][p]={zoom:i.coord.z,symbol:m},c[p]||(h.push(m),c[p]=!0)}))}}const d=h.sort(((e,t)=>"desc"===l?t.rank-e.rank:e.rank-t.rank));return d.length>0&&(s=this.placeSymbolFeatures(e,d,i)),this.debugCanvas&&(Object.values(this.collisionIndexByLayer).forEach((e=>{e.debug(a)})),this.collisionIndex.debug(a)),s}placeSymbolFeatures(e,t,i){let r=!1;const a=i.symbolAllowOverlap(),s=(i.symbolRotateWithMap(),i.symbolPitchWithMap(),i.textPadding()||[6,6]),n=i.symbolFadeOpacity(),o=(null===performance||void 0===performance?void 0:performance.now)?performance.now():Date.now(),l=this.opacityState[e],h="layer"===i.symbolOverlapMode()?this.collisionIndexByLayer[e]:this.collisionIndex,c=new fa(null,0,!0),d={};this.fadeDurationByLayer[e]=!0===i.symbolFadeOpacity()?this.fadeDuration:0;for(let e=0;e<t.length;e++){const i=t[e],o=i.feature,u=i.crossTileId,{tileCoord:p,store:f,posMatrix:m}=t[e],g=o.collisionBox;if(g){const e=l[u];let t=!0;a||(t=h.insertBox(p,g,s,"never",m,u,f.id)),e||(r=!0),l[u]=new fa(e||c,0,t,!n),d[u]=!0}}return n||Object.keys(d).forEach((t=>{const i=this.symbolsByLayer[e][t],r=l[t];i&&r&&this.updateSymbolOpacityBuffer(i.symbol,r.opacity,!0)})),Object.keys(l).forEach((t=>{if(!0!==d[t]){delete l[t];const i=this.symbolsByLayer[e][t];i&&this.updateSymbolOpacityBuffer(i.symbol,0,!0)}})),this.commitTime[e]=o,this.prevZoomAdjustment=this.zoomAdjustment(this.transform.state.zoom),r}updateLayerOpacities(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];var r;const a=(null===performance||void 0===performance?void 0:performance.now)?performance.now():Date.now(),s=this.symbolFadeChange(e,a),n=this.opacityState[e];let o=!1;if(!n)return!1;for(const a of t){const t=null===(r=a.data)||void 0===r?void 0:r.getStore("symbol",e);if(t instanceof da){const r=a.coord.normalize();for(const a of t.features){const t=a.collisionBox;if((0,pe.E)(t))continue;const l=va(a),h=ga(r,t,l),c=n[h],d=this.symbolsByLayer[e][h];if(c){const e=c.placed,t=c.opacity;i?c.increment(1,-1):(e&&t<1||!1===e&&t>0)&&(c.increment(s,c.placed?1:-1),o=!0),this.updateSymbolOpacityBuffer(d.symbol,c.opacity)}}}}return o&&this.commit(e,t),this.commitTime[e]=a,this.prevZoomAdjustment=this.zoomAdjustment(this.transform.state.zoom),o}updateSymbolOpacityBuffer(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const r=e.store;if((0,pe.Z)(e.feature.text))for(const a of e.feature.text){const{start:e,end:s}=a.vertexRange;r.text.updateOpacityArray(e,s,t,i)}if((0,pe.Z)(e.feature.icon)){const{start:a,end:s}=e.feature.icon.vertexRange;r.icon.updateOpacityArray(a,s,t,i)}}commit(e,t){var i,r,a;for(const s of t){const t=null===(i=s.data)||void 0===i?void 0:i.getStore("symbol",e);t instanceof da&&(null===(r=t.text.geometry)||void 0===r||r.setAttributeData("opacity",t.text.opacityVertexArray.data),null===(a=t.icon.geometry)||void 0===a||a.setAttributeData("opacity",t.icon.opacityVertexArray.data))}}symbolFadeChange(e,t){const i=this.fadeDurationByLayer[e];return 0===i?1:(t-this.commitTime[e])/(i+this.prevZoomAdjustment)}zoomAdjustment(e){return Math.max(0,(this.transform.state.zoom-e)/1.5)}};class xa extends rt{get type(){return"data"}addFeature(e,t){const i=e.feature.asPoints(),r=(e.feature.asPolygons(),e.feature.extent);for(let e=0;e<i.length;e++){const t=i[e],a=Rr({x:t.x,y:t.y},r);i[e]=a}return{type:e.type,featureIndex:e.featureIndex,sourceId:e.sourceId,sourceLayerIndex:e.sourceLayerIndex,geometry:i,properties:e.properties,vertexRange:{start:null,end:null}}}static from(e){const t=new xa(e.options);return(0,W.I)(e)?console.warn("[MapsGL] Cannot create FeatureStore from invalid serialized data."):t.features=e.features,t}}const ba=xa,wa=class{constructor(e){this.stores={},this.drawData={},this.dependencies={glyphs:{},icons:{}},this.stale=!1,this.id=Math.round(1e18*Math.random()).toString(36).slice(0,10),this.addStores(e)}addStores(e,t){Object.keys(e).forEach((t=>{const i=e[t];i instanceof rt?this.stores[t]=i:"fill"===i.type?this.stores[t]=Yr.from(i):"line"===i.type?this.stores[t]=ta.from(i):"circle"===i.type?this.stores[t]=sa.from(i):"symbol"===i.type?this.stores[t]=da.from(i):"data"===i.type&&(this.stores[t]=ba.from(i));const r=`${t}::${i.type}`;this.drawData[r]&&delete this.drawData[r]}))}getStore(e,t){return this.stores[t]}updateSymbolOpacity(e,t,i){var r;const a=this.stores[e];if(a&&!t.symbolAllowOverlap()&&a instanceof da){const e=a.options.tile,s=new Vt(e.z,e.x,e.y);for(let e=0;e<a.features.length;e++){const n=a.features[e];if((0,pe.Z)(n.text))for(let e=0;e<n.text.length;e++){const o=n.text[e],{start:l,end:h}=o.vertexRange,c=t.symbolAllowOverlap()||!1;t.symbolFadeOpacity();let d=c?1:0;if(i){const e=o.collisionBox;if(e){const t=va(n);d=(null===(r=i[ga(s,e,t)])||void 0===r?void 0:r.opacity)||0,a.text.updateOpacityArray(l,h,d,!0)}}}}}}getDrawData(e,t,i,r){var a,s,n,o,l,h;const c=`${i}::${t}`,d=this.stores[i],u=this.drawData[c],{paint:p,opacityState:f}=r;if(u)return u;if(!d||!e)return;const m=d.options.tile,g=new Vt(m.z,m.x,m.y),v=Object.keys(this.dependencies.icons);if(v.length>0&&(this.imageAtlas=r.mapStyle.createImageAtlas(v)),"fill"===t||"fill-outline"===t){if(d instanceof Yr){const i=d.buffers;if(0===d.buffers.layoutVertexArray.length)return;const o="fill-outline"===t,l=o?i.segments.line:i.segments.triangle;for(let e=0;e<d.features.length;e++){const t=d.features[e],l=t.properties,{start:h,end:c}=t.vertexRange,u=o?p.strokeColor(l):p.fillColor(l);if(u&&(u.a*=o?p.strokeOpacity(l):p.fillOpacity(l)),i.updateColorArray(h,c,u),null===(a=t.pattern)||void 0===a?void 0:a.id){const e=null===(s=this.imageAtlas)||void 0===s?void 0:s.texturePosition(t.pattern.id),i=null!==(n=r.mapStyle.imageManager.getImage(t.pattern.id).pixelRatio)&&void 0!==n?n:1;e&&d.buffers.updatePatternArray(h,c,[e.x,e.y,e.x+e.w,e.y+e.h],i)}}i.layoutVertexArray.length>0&&i.prepareGeometry(e,o),this.drawData[c]={primary:{store:d,geometry:o?i.geometry.stroke:i.geometry.fill,segments:l,size:o?2:3}}}}else if("line"===t){if(d instanceof ta){const t=d.buffers;if(0===d.buffers.layoutVertexArray.length)return;const i=d.features.map((e=>e.vertexRange));for(let e=0;e<d.features.length;e++){const t=d.features[e],i=t.properties,{start:r,end:a}=t.vertexRange,s=p.strokeColor(i);d.buffers.updateColorArray(r,a,s)}t.layoutVertexArray.length>0&&t.prepareGeometry(e,i,p),this.drawData[c]={primary:{store:d,geometry:t.geometry.segments,segments:void 0,size:2},terminals:{store:d,geometry:t.geometry.terminals,segments:void 0,size:2},joins:{store:d,geometry:t.geometry.joins,segments:void 0,size:2},caps:{store:d,geometry:t.geometry.caps,segments:void 0,size:2}}}}else if("circle"===t||"point"===t){if(d instanceof sa){if(0===d.buffers.layoutVertexArray.length)return;if(p)for(let e=0;e<d.features.length;e++){const t=d.features[e],i=t.properties||{},{start:r}=t.vertexRange,a=p.fillColor(i),s=p.strokeColor(i),n=p.strokeThickness(i),o=p.radius(i)||60,l=2*r,h=l+1;d.buffers.updateColorArray(l,l+1,a),d.buffers.updateColorArray(h,h+1,s),d.buffers.updateStrokeWidthArray(e,e+1,n),d.buffers.updateRadiusArray(e,e+1,o),i.radius=o,t.properties=i}d.buffers.layoutVertexArray.length>0&&d.buffers.prepareGeometry(e),this.drawData[c]={primary:{store:d,geometry:[d.buffers.geometry],segments:void 0,size:2}}}}else if(("symbol"===t||"text"===t)&&d instanceof da){if(0===d.text.layoutVertexArray.length&&0===d.icon.layoutVertexArray.length)return;if(d.text.layoutVertexArray.length>0){for(let e=0;e<d.features.length;e++){const t=d.features[e],i=t.properties;if(t.text){for(let e=0;e<t.text.length;e++){const r=t.text[e],{start:a,end:s}=r.vertexRange,n=p.textSize(i,e),l=p.textColor(i,e),h=p.textOutlineColor(i,e),c=p.textRotation(i,e);let u=p.symbolAllowOverlap()?1:0;if(f){const e=t.collisionBox;if(e){const i=va(t);u=(null===(o=f[ga(g,e,i)])||void 0===o?void 0:o.opacity)||0}}d.text.updateStyleArray(a,s,l,h,0,n,(0,ke.p)(c),0,0,r.atlasIndex),d.text.updateOpacityArray(a,s,u)}i.collisionBox=t.collisionBox}}d.text.prepareGeometry(e)}if(d.icon.layoutVertexArray.length>0){for(let e=0;e<d.features.length;e++){const t=d.features[e],i=t.properties;if(!t.icon)continue;const r=t.icon,{start:a,end:s}=r.vertexRange,n=(p.iconSize(i),p.fillColor(i)),o=p.strokeColor(i),c=p.strokeThickness(i),u=p.iconRotation(i),m=p.iconFactor(i);let v=p.symbolAllowOverlap()?1:0;if(f){const e=t.collisionBox;if(e){const i=va(t);v=(null===(l=f[ga(g,e,i)])||void 0===l?void 0:l.opacity)||0}}const y=null===(h=this.imageAtlas)||void 0===h?void 0:h.texturePosition(r.image);y&&d.icon.updateTexturePositionArray(a,s,[y.x,y.y,y.w,y.h]);const x=d.icon.styleVertexArray.get(a);d.icon.updateStyleArray(a,s,n,o,c,x[5],(0,ke.p)(u),m,0,r.atlasIndex||0),d.icon.updateOpacityArray(a,s,v),i.collisionBox=t.collisionBox}d.icon.prepareGeometry(e)}this.drawData[c]={primary:{store:d,geometry:void 0,buffer:{icon:d.icon.geometry,text:d.text.geometry},segments:void 0,size:2}}}return this.drawData[c]}clear(){Object.keys(this.drawData).forEach((e=>{delete this.drawData[e]})),Object.keys(this.stores).forEach((e=>{delete this.stores[e]}))}};var _a=function(e,t,i,r){return new(i||(i=Promise))((function(a,s){function n(e){try{l(r.next(e))}catch(e){s(e)}}function o(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?a(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(n,o)}l((r=r.apply(e,t||[])).next())}))};const Aa=class extends ci{get type(){return Re.o.vector}get worker(){if(!this._worker){let e=Gi.getWorker("vector");(0,R.g)(e)&&(e="mapsgl.vector.worker.js",Gi.addWorker("vector",e));const t=new Vi(e);this._worker=new $i(t),this._worker.registerMessageHandler("getGlyphs",(e=>_a(this,void 0,void 0,(function*(){return this.style.getGlyphs(e)})))),this._worker.registerMessageHandler("getImages",(e=>_a(this,void 0,void 0,(function*(){return this.style.getImages(Object.keys(e))})))),this._worker.registerMessageHandler("loadImages",(e=>_a(this,void 0,void 0,(function*(){return this.style.loadImages(e)}))))}return this._worker}constructor(e,t){super(e,t),this.tileManager.setTileFetcher(((e,t,i)=>{var r;const{body:a,headers:s,params:n}=i;let o=null!==(r=i.reload)&&void 0!==r&&r,l=[...this.consumingLayers];const h=this.getOrCreateTile(e);this.tiles.isStale(h)&&(o=!0);const c=null==h?void 0:h.data;if(c&&!0!==c.stale){const e=Object.keys(c.stores);l=l.filter((t=>!1===e.includes(t.layerId)))}return this.worker.send({id:this.id,layers:l.map((e=>Object.assign(Object.assign({},e),{paint:e.paint.serialized()}))),tile:{uid:h.uid,info:{x:h.coord.x,y:h.coord.y,z:h.coord.z}},request:{url:this.getTileUrl(h.coord,i.params),body:a,headers:s,params:n,reload:o},granularity:st.globeSubdivision})}))}hasTile(e,t){var i;const r=this.tiles.get(e);return!(!r||!(null===(i=r.data)||void 0===i?void 0:i.stores[t]))}hasTileData(e,t){var i;const r=this.tiles.get(e);if(r){if((0,pe.E)(r.data)||r.state===ze.expired)return!1;if(null===(i=r.data)||void 0===i?void 0:i.stores[t])return!0}return!1}expireAllTiles(){super.expireAllTiles(),this.tiles.forEach((e=>{this.expireTile(e)}))}expireTile(e){const t=e.data;t&&(t.stale=!0)}refreshAllTileData(){this.tiles.forEach((e=>{this.expireTile(e),this.refreshTileData(e)}))}refreshTileData(e){if(!(0,pe.E)(e.data))return this.worker.send({id:this.id,action:"reloadTile",layers:this.consumingLayers.map((e=>Object.assign(Object.assign({},e),{paint:e.paint.serialized()}))),tile:{uid:e.uid,info:{x:e.coord.x,y:e.coord.y,z:e.coord.z}},granularity:st.globeSubdivision}).then((t=>{this.parseTile(e,t),this.trigger(ye.A.DATA_CHANGE,{source:this})}))}parseTile(e,t,i){return new Promise((i=>{const r=this.tiles.get(e.coord);if(!r)return;r.state=ze.processing;let a=r.data;a?(a.stale&&a.clear(),a.stale=!1,a.addStores(t.stores,this.consumingLayers)):a=new wa(t.stores),t.dependencies&&(a.dependencies=Object.assign(Object.assign({},a.dependencies),t.dependencies)),i(a)}))}};var Ma=i(7028),Ta=function(e,t,i,r){return new(i||(i=Promise))((function(a,s){function n(e){try{l(r.next(e))}catch(e){s(e)}}function o(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?a(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(n,o)}l((r=r.apply(e,t||[])).next())}))};const Ea=class extends Aa{get type(){return Re.o.geojson}get url(){return this.tileUrl}get data(){return this._data}constructor(e,t){super(e,Object.assign({},t)),this.coalesce=!1,this.pendingLoad=null,this.setUrl=(0,Ma.s)((e=>{e!==this.tileUrl&&(this._data=void 0,this.setTileUrl(e))}),250);let i=Gi.getWorker("vector");(0,R.g)(i)&&(i="mapsgl.vector.worker.js",Gi.addWorker("vector",i));const r=new Vi(i);this._worker=new $i(r),this._worker.registerMessageHandler("getGlyphs",(e=>Ta(this,void 0,void 0,(function*(){var t;return null===(t=this.style)||void 0===t?void 0:t.getGlyphs(e)})))),this._worker.registerMessageHandler("getImages",(e=>Ta(this,void 0,void 0,(function*(){var t;return null===(t=this.style)||void 0===t?void 0:t.getImages(Object.keys(e))})))),this._worker.registerMessageHandler("loadImages",(e=>Ta(this,void 0,void 0,(function*(){var t;return null===(t=this.style)||void 0===t?void 0:t.loadImages(e)})))),this._worker.registerMessageHandler("transformGeoJSON",(e=>(e.data&&me(t.transformGeoJSON)&&(e.data=t.transformGeoJSON(this,e.data)),e.data))),this.shouldTriggerLoadEvents=!1,this.tileManager.setTileFetcher(((e,t,i)=>{const{body:r,headers:a,reload:s}=i,n=this.getTileUrl(e,i.params);let o=[...this.consumingLayers];const l=this.tiles.get(e);if((null==l?void 0:l.data)&&!1===s){const e=Object.keys(l.data.stores);o=o.filter((t=>!1===e.includes(t.layerId)))}let h=!1;return(0,R.g)(this.data)&&(0,pe.Z)(n)&&(this.trigger(ye.A.LOAD_START,{sourceId:this.id}),h=!0),this._worker.send({id:this.id,type:"geojson",action:"reloadTile",layers:o.map((e=>Object.assign(Object.assign({},e),{paint:e.paint.serialized()}))),tile:{uid:null==l?void 0:l.uid,info:{x:e.x,y:e.y,z:e.z}},request:{url:n,body:r,headers:a,reload:s},granularity:st.globeSubdivision}).then((e=>(this.data||(this._data=e.geojson,h&&this.trigger(ye.A.LOAD_COMPLETE,{sourceId:this.id})),e)))})),!1===(0,$.K)(t.data)&&this.setData(t.data)}getUrl(e){return(0,X.mN)(this.tileUrl,e)}setData(e){this._data=e,this.updateWorkerData()}expireAllTiles(){super.expireAllTiles(),this.setData(void 0)}reload(){this.expireAllTiles()}updateWorkerData(){super.expireAllTiles(),this.pendingLoad?this.coalesce=!0:this.pendingLoad=this._worker.send({type:"geojson",action:"setData",data:this.data}).then((e=>{this.pendingLoad=null,this.trigger(ye.A.DATA_CHANGE,{source:this}),this.trigger(ye.A.DATA_STALE,{source:this}),this.coalesce&&(this.updateWorkerData(),this.coalesce=!1)}))}};var Sa=i(816),Ca=i(3905),Oa=i(6068),Ra=i(1884);const Ia=class extends Ca.A{get animations(){return this._animations}get info(){return{isActive:this.isActive,currentDate:this.currentDate,startDate:this.startDate,endDate:this.endDate,deltaTime:this.deltaTime}}constructor(e){super(e),this._animations=[],this.config.on(Oa.A.Events.UPDATE,(()=>{this._each((e=>{e.delay=this.delay,e.duration=this.duration,e.endDelay=this.endDelay}))})),this.on(Ra.A.RANGE_CHANGE,(e=>{let{start:t,end:i}=e;this._each((e=>{e instanceof Ca.A&&(e.startDate=t,e.endDate=i)}))})),this.advanceToStopPosition()}add(e){e&&(this.animations.includes(e)||(e.timeline=this,e.delay=this.delay,e.duration=this.duration,e.endDelay=this.endDelay,e instanceof Ca.A&&(e.startDate=this.startDate,e.endDate=this.endDate,e.goTo(this.position)),e.config.setState({manualAdvance:this.config.value.manualAdvance}),this.animations.push(e),e.trigger(Ra.A.TIMELINE_CHANGE),this.isActive&&!1===this.config.value.manualAdvance&&e.play()))}remove(e){if(!e)return;const t=this.animations.indexOf(e);t>=0&&(e.timeline=void 0,this._animations.splice(t,1),e.trigger(Ra.A.TIMELINE_CHANGE))}removeById(e){const t=this.animations.filter((t=>t.id===e));t.length>0&&this.remove(t[0])}clear(){this.stop(),this._animations=[]}play(e){this._each((t=>t.play(e))),super.play(e)}pause(){this._each((e=>e.pause())),super.pause()}resume(){this._each((e=>e.resume())),super.resume()}stop(){this._each((e=>e.stop())),super.stop(),this.advanceToStopPosition()}restart(){this._each((e=>e.restart())),super.restart()}advance(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this._each((i=>i.advance(e,t))),super.advance(e,t)}goToDate(e){this._each((t=>{t instanceof Ca.A&&t.goToDate(e)})),super.goToDate(e)}goTo(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._each((i=>i.goTo(e,t))),super.goTo(e,t)}_each(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this._animations.filter((e=>!1===t||t&&e.enabled)).forEach((t=>e(t)))}advanceToStopPosition(){this.alwaysStopAtStart?this.advance(0):this.startDate.getTime()<this.referenceDate.getTime()&&this.endDate.getTime()>this.referenceDate.getTime()?this.goToDate(this.referenceDate):this.advance(this.isPast?1:0)}},Pa=new class{get fps(){return this._fps}get running(){return this._running}constructor(){this._frame=0,this._fps=0,this._running=!1,this._time=Date.now(),this._frame=0}start(e,t){this._running||(this._running=!0,this.tick(),e>0&&(this._timeout=setTimeout((()=>{this.stop(),null==t||t(this._fps)}),e)))}stop(){this._running=!1,this._handle&&window.cancelAnimationFrame(this._handle),this._timeout&&clearTimeout(this._timeout)}tick(){const e=Date.now();this._frame+=1,e-this._time>1e3&&(this._fps=this._frame/((e-this._time)/1e3),this._time=e,this._frame=0),this._handle=window.requestAnimationFrame(this.tick.bind(this))}},Da=class{constructor(e){this.map=e}query(e){const t=this.map.layers.filter((e=>e.enabled&&e.visible)),i={};let r=!1;for(let a=0;a<t.length;a++){const s=t[a],n=s.queryFeatures(e,this.map.getZoom(),!0);n&&(i[s.id]=n,r=!0)}return r?i:void 0}queryPromise(e){return new Promise((t=>{const i=this.map.layers.filter((e=>e.enabled&&e.visible)),r={},a=[];for(let t=0;t<i.length;t++){const s=i[t],n=s.queryFeaturesPromise(e,this.map.getZoom(),!0).then((e=>{e&&(r[s.id]=e)})).catch((e=>{console.error(`[MapsGL] Failed to query features for layer '${s.id}'`,e)}));a.push(n)}Promise.all(a).then((()=>{t((0,W.I)(r)?void 0:r)})).catch((e=>{console.error(e)}))}))}};class za{get width(){return this.right-this.left+1}get height(){return this.top-this.bottom+1}get center(){return{x:this.left+this.width/2,y:this.bottom+this.height/2}}get info(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}constructor(e,t,i,r){this.top=i,this.bottom=r,this.left=e,this.right=t}equals(e){return this.left===e.left&&this.right===e.right&&this.top===e.top&&this.bottom===e.bottom}overlaps(e){return!(this.left>e.right||this.right<e.left||this.top<e.bottom||this.bottom>e.top)}intersection(e){if(this.overlaps(e))return new za(Math.max(this.left,e.left),Math.min(this.right,e.right),Math.max(this.bottom,e.bottom),Math.min(this.top,e.top))}contains(e){return e.x>=this.left&&e.x<=this.right&&e.y>=this.bottom&&e.y<=this.top}clone(){return new za(this.left,this.right,this.top,this.bottom)}static fromCoords(e){let t=Number.POSITIVE_INFINITY,i=-Number.POSITIVE_INFINITY,r=-Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY;return e.forEach((e=>{t=Math.min(t,e.x),i=Math.max(i,e.x),r=Math.max(r,e.y),a=Math.min(a,e.y)})),new za(t,i,r,a)}}const La=za;var ka=i(8854);class Fa{constructor(){this.renderWorldCopies=!0,this._zoom=0,this.center={x:.5,y:.5,z:0},this.size={width:1,height:1},this.pitchRange={min:0,max:60}}getPosition(){return this.getCenterOffset()}getCenter(){return this.center}getCenterOffset(){const e=this.getCenter(),t=this.getSize();return{x:e.x-t.width/2,y:e.y-t.height/2,z:0}}getSize(){return this.size}getBounds(){const e=this.getCenter(),t=this.getSize(),i=new ua(e.x-t.width/2,e.x+t.width/2,e.y-t.height/2,e.y+t.height/2);return i.top<0&&(i.bottom+=Math.abs(i.top),i.top=0),i.bottom>1&&(i.top-=Math.abs(i.bottom-1),i.bottom=1),i}getVisibleTileBounds(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._zoom,t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=Math.floor(e),r=this.getBounds(),a=Tt(i)-1,s=zt({x:r.left,y:r.top},e),n=zt({x:r.right,y:r.bottom},e),o=new La(s.x,n.x,s.y,n.y),l=t?o.left:Math.max(0,o.left),h=t?o.right:Math.min(a,o.right),c=Math.max(0,o.top),d=Math.min(a,o.bottom);return new La(l,h,c,d)}getVisibleTileCoords(){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const t=Math.floor(arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._zoom),i=this.getVisibleTileBounds(t,e),r=[];if(!i)return[];for(let e=i.left;e<=i.right;e++)for(let a=i.top;a<=i.bottom;a++)r.push(new Vt(t,e,a));return r}getVisibleTileOffset(){const e=Math.floor(this._zoom),t=this.getVisibleTileBounds();return Pt({x:t.left,y:t.top,z:e})}isTileCoordInView(e){const t=this.getVisibleTileBounds(this._zoom,!(arguments.length>1&&void 0!==arguments[1])||arguments[1]);if(!t)return!1;const i=Tt(e.z);return(0,ka.XM)(t.left,t.right,i,e.x)&&(0,ka.XM)(t.top,t.bottom,i,e.y)}updateFromMapViewState(e,t){const i=t.projection,r=e.bounds,{lat:a,lon:s}=e.center,n=i.project(a,s);this._zoom=e.zoom;const o=i.project(r.north,r.west),l=i.project(r.south,r.east);this.center.x=n.x,this.center.y=n.y,this.size.width=l.x-o.x,this.size.height=l.y-o.y}getNormalizedOffset(){const e=Math.floor(this._zoom),t=this.getVisibleTileBounds(),{x:i,y:r}=Pt({x:t.left,y:t.top,z:e});return{x:i,y:r,z:0}}centerOn(e){this.center.x=e.x,this.center.y=e.y}zoomedTo(e,t,i){let r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];const a=Math.pow(2,t-e),s=new Fa;return s.centerOn({x:i.x-(i.x-this.center.x)/a,y:i.y-(i.y-this.center.y)/a}),s.size={width:this.size.width/a,height:this.size.height/a},r||s.centerOn(i),s}apply(e){this.center=Object.assign({},e.center),this.size=Object.assign({},e.size)}copy(){const e=new Fa;return e.center=Object.assign({},this.center),e.size=Object.assign({},this.size),e}}const ja=Fa,Na="ready",Va="show",Ba="hide",Ua="tile:load",$a="load:start",Ga="load:progress",qa="load:complete",Wa="paint:change",Ha="tile:bounds:change";var Za=i(8631),Ya=i(924);const Xa="click",Qa="mouseout",Ka="mousemove",Ja="move",es="move:start",ts="move:end",is="tilebounds:change",rs="units:change",as=class extends N.A{get context(){return this._context}get gl(){return this.context.gl}get viewport(){var e;return null===(e=this.map)||void 0===e?void 0:e.viewport}get paint(){return this._renderer.paint}get renderer(){return this._renderer}get animator(){return this._animator}set animator(e){this._animator=e}get mask(){return this._layerMask}set mask(e){this._layerMask=e,this.onMaskLayerChange()}get visible(){return this._visible}get enabled(){return this._enabled}set enabled(e){var t;e!==this._enabled&&(this._enabled=e,null===(t=this.map)||void 0===t||t.redraw())}get metadata(){return{layerId:this.id,type:this.type,sourceLayerId:void 0,sourceLayerType:void 0,filter:void 0,paint:void 0,options:void 0}}get isDirty(){return this._isDirty}constructor(e,{source:t,renderer:i}){if(super(),this.isLayerMask=!1,this.invertMaskLayer=!1,this._needsSetup=!0,this._isDirty=!1,this._visible=!0,this._enabled=!1,this._sourceEventHandlers=[],!t)throw new Error(`[MapsGL] No source provided for layer {${e}}`);if(t instanceof _e==0)throw new TypeError(`[MapsGL] Invalid source provided for layer {${e}}`);if(!i)throw new Error(`[MapsGL] No renderer provided for layer {${e}}`);this.id=e,this.source=t,this._renderer=i,i.layer=this,this.timing={mode:hr.Gp.none,clamp:hr.MH.none,range:void 0,intervals:void 0,interleaved:!0,operation:void 0}}show(){!1===this._visible&&(this._visible=!0,this.onVisible(),this.trigger(Va))}hide(){!0===this._visible&&(this._visible=!1,this.onHidden(),this.trigger(Ba))}setNeedsUpdate(){var e,t;(this.visible||arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&(this._isDirty=!0,null===(e=this._renderer)||void 0===e||e.setNeedsUpdate(),null===(t=this.map)||void 0===t||t.redraw())}prerender(){this.visible&&this._renderer.prerender(arguments.length>0&&void 0!==arguments[0]?arguments[0]:0)}render(e,t){this.visible&&this.enabled&&(this._isDirty=!1,this._renderer.draw(e||0))}setPaintProperty(e,t){if((0,R.g)(e))throw new Error("[MapsGL] Invalid paint property provided.");(0,R.n)(t)&&(this.paint.setProperty(e,t),this.trigger(Wa,{property:e,value:t}),this.setNeedsUpdate())}queryFeatures(e,t,i){}queryFeaturesPromise(e,t,i){return new Promise((e=>{e(null)}))}refresh(){}createTimeSeriesDataProvider(){}_setTimeSeriesFromMetadata(){const e=this.source.metadata.getValidTimes();if((0,pe.Z)(e)&&this.timeSeries){const t=e.reduce(((e,t)=>{const i=t.getTime(),r=this.timeSeries.dataForTimeInterval(i);return e[i]=r||{loading:!1,valid:!1},e}),Object.create(null));this.timeSeries.setData(t)}}_setupTimeSeriesAnimator(){const{clamp:e,range:t,interleaved:i}=this.timing,r=this.createTimeSeriesDataProvider();r&&(r.interleaveRequests=i);const a=new hr.Ay(this.timeSeries,r,{id:this.id,mode:e});a.on(Ya.A.LOAD_PROGRESS,this.onAnimatorLoadProgress.bind(this)),this.animator=a,(0,pe.Z)(t)&&(a.timeRange=t),this.source instanceof ci&&this.addSourceEventHandler(ye.A.TILE_LOAD,(()=>{var e;null===(e=this.animator)||void 0===e||e.updateEntryState()})),[Ya.A.DATA_ADVANCE,Ya.A.LOAD_COMPLETE].forEach((e=>{a.on(e,(()=>{this.visible&&this.setNeedsUpdate()}))})),a.on(Ya.A.ADVANCE,(e=>{this.visible&&(this.enabled=this.animator.canShowForDate(e.date),this.setNeedsUpdate())})),this.timing.mode===hr.Gp.interval?(a.on(Ya.A.ADVANCE,(e=>{a.provider?a.isActive&&a.loadDataIfNeeded():this.refresh(!0)})),a.on(Ya.A.INTERVAL_ADVANCE,(e=>{!1===a.isActive&&a.loadDataForIntervals([e.interval])}))):this.timing.mode===hr.Gp.any&&a.on(Ya.A.ADVANCE,(e=>{this.refresh(!0)}))}addSourceEventHandler(e,t){arguments.length>2&&void 0!==arguments[2]&&arguments[2]?this.source.once(e,t,void 0,this):this.source.on(e,t,void 0,this),this._sourceEventHandlers.push({event:e,handler:t})}onSourceMetadata(){this.timeSeries&&this._setTimeSeriesFromMetadata()}onReady(){var e,t;this.animator&&-1===(null===(e=this.animator)||void 0===e?void 0:e.currentInterval.index)?null===(t=this.animator)||void 0===t||t.once(Ya.A.DATA_ADVANCE,(()=>{this.trigger(Na)})):this.trigger(Na)}onAdd(e){var t,i;if(this._context=e,this._needsSetup){const r=this.source;this.addSourceEventHandler(ye.A.METADATA_LOAD,this.onSourceMetadata),r.isReady?(this.onSourceMetadata(),this.onReady()):this.addSourceEventHandler(ye.A.METADATA_LOAD,(()=>{this.onAdd(e),this.onReady()}),!0),this.timing.mode===hr.Gp.range?null===(t=this.map)||void 0===t||t.timeline.on(Ra.A.RANGE_CHANGE,this.onTimelineRangeChange,void 0,this):this.timing.mode!==hr.Gp.none&&(this.timeSeries=new Za.A,this._setupTimeSeriesAnimator(),null===(i=this.map)||void 0===i||i.on(is,this.onTileBoundsChange,void 0,this)),this._renderer.onAdd(this),this._needsSetup=!1}this._setTimeSeriesFromMetadata(),this.enabled=!0}onRemove(){var e,t;this.enabled=!1,null===(e=this._renderer)||void 0===e||e.onRemove(this),null===(t=this.map)||void 0===t||t.off(is,this.onTileBoundsChange)}onMove(){}onMoveStart(){var e;null===(e=this._renderer)||void 0===e||e.onMoveStart(this)}onMoveEnd(){var e;null===(e=this._renderer)||void 0===e||e.onMoveEnd(this)}onZoom(){}onZoomStart(){var e;null===(e=this._renderer)||void 0===e||e.onZoomStart(this)}onZoomEnd(){var e;null===(e=this._renderer)||void 0===e||e.onZoomEnd(this)}onResize(){var e;null===(e=this._renderer)||void 0===e||e.onResize(this)}onClick(e){}onMouseMove(e){}onVisible(){var e;null===(e=this.animator)||void 0===e||e.animation.enable(),this.setNeedsUpdate()}onHidden(){var e;null===(e=this.animator)||void 0===e||e.animation.disable(),this.setNeedsUpdate(!0)}onTileBoundsChange(){var e;null===(e=this._animator)||void 0===e||e.loadDataIfNeeded(!0)}onTimelineRangeChange(e){this.refresh(!0)}onMaskLayerChange(){}onAnimatorLoadProgress(e){this.trigger(Ga,Object.assign(Object.assign({},this.eventPayload()),{progress:e.progress}))}eventPayload(){return{layer:this,layerId:this.id}}dispose(){var e,t;this._sourceEventHandlers.forEach((e=>{let{event:t,handler:i}=e;this.source.off(t,i)})),this._sourceEventHandlers=[],this._animator&&(this._animator.off(Ya.A.LOAD_PROGRESS,this.onAnimatorLoadProgress),this._animator.animation.timeline&&this._animator.animation.timeline.remove(this._animator.animation)),null===(e=this._renderer)||void 0===e||e.dispose(),null===(t=this._animator)||void 0===t||t.dispose(),this._animator=void 0,this._renderer=void 0,this._context=void 0}},ss="remove",ns={[Re.o.raster]:cr,[Re.o.vector]:Aa,[Re.o.geojson]:Ea,[Re.o.encoded]:Xi},os=class extends N.A{constructor(){super(...arguments),this.cache=new Map}get count(){return this.cache.size}has(e){return(0,R.n)(this.get(e))}get(e){return this.cache.get(e)}find(e){let t;return this.each((i=>{t||i.id!==e&&!new RegExp(e).test(i.id)||(t=i)})),t}add(e,t){let i;if((0,R.g)(t))throw new Error("[MapsGL] Cannot add data source, an invalid source configuration was provided");if(t instanceof _e?(i=t,e=i.id):t=Object.assign({},t),this.has(e))throw new Error(`[MapsGL] A data source with id ${e} already exists.`);if((0,R.g)(i)){if((0,R.g)(t.type))throw new Error("[MapsGL] A data source type must be provided.");i=((e,t)=>{if("debug"===t.type)return new we(e,t);if((0,R.g)(ns[t.type]))throw new Error(`[MapsGL] Invalid source type ${t.type} specified. Type must be one of the \n following: ${Object.keys(ns)}`);const i=new ns[t.type](e,t);if(i.id!==e)throw new Error(`[MapsGL] Expected source ID to be ${e} but got ${i.id} instead.`);return i})(e,Object.assign({},t))}return this.cache.set(e,i),this.trigger("add",{source:i}),i}remove(e){const t=this.get(e);return t&&(t.dispose(),this.cache.delete(e),this.trigger(ss,{source:t})),t}each(e){this.cache.forEach(((t,i)=>{e(t)}))}},ls=(e,t)=>{let i="";for(let r=0;r<t.length;r++)if((e[r+3]||e[r+2]||e[r+1])&&(i+=`${t[r]}\n`,e[r+1])){const t=e[r+1],a=t.split(":",3),s=a[0],n=Number.parseInt(a[1],10)||0,o=t.slice(Math.max(0,a.join(":").length+1)).trim();i+=cs(`^^^ ${s}: ${o}\n\n`,n)}return i},hs=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:": ";const r=e.split(/\r?\n/),a=String(r.length+t-1).length;return r.map(((e,r)=>{const s=r+t,n=String(s).length;return cs(String(s),a-n)+i+e}))},cs=(e,t)=>{let i="";for(let e=0;e<t;++e)i+=" ";return`${i}${e}`};var ds,us,ps=function(e,t,i,r){if("a"===i&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?r:"a"===i?r.call(e):r?r.value:t.get(e)},fs=function(e,t,i,r,a){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?a.call(e,i):a?a.value=i:t.set(e,i),i};ds=new WeakMap,us=new WeakMap;const ms=class extends Jt{get size(){return ps(this,ds,"f")}constructor(e,t){super(e,Object.assign({format:e.gl.DEPTH_COMPONENT16,size:{width:0,height:0}},t)),ds.set(this,void 0),us.set(this,void 0),(0,ue.vA)(t.size.width>0&&t.size.height>0,"[Aeris] Renderbuffer object requires valid width and height greater than zero"),fs(this,ds,t.size,"f"),fs(this,us,t.format,"f");const i=e.gl;this.bind(),i.renderbufferStorage(i.RENDERBUFFER,ps(this,us,"f"),ps(this,ds,"f").width,ps(this,ds,"f").height)}resize(e,t){if(e===ps(this,ds,"f").width&&t===ps(this,ds,"f").height)return;const i=this.gl;fs(this,ds,{width:e,height:t},"f"),this.bind(),i.renderbufferStorage(i.RENDERBUFFER,ps(this,us,"f"),e,t),this.unbind()}bind(){const e=this.gl;e.bindRenderbuffer(e.RENDERBUFFER,this.handle)}unbind(){const e=this.gl;e.bindRenderbuffer(e.RENDERBUFFER,null)}createHandle(){return this.incrementResourceCount(),this.gl.createRenderbuffer()}deleteHandle(){this.handle&&(this.gl.deleteRenderbuffer(this.handle),this.decrementResourceCount()),this._handle=void 0}dispose(){this.unbind(),this.deleteHandle()}},gs=class extends ei{constructor(e,t,i,r,a={}){super(e,Object.assign(Object.assign({},a),{image:t,size:{width:i,height:r},premultiplyAlpha:!0,flipY:!1,unpackAlignment:1})),this.needsUpdate=!0}},vs=class extends Jt{get size(){return this._size}get texture(){return this._texturesByAttachment.values().next().value}get depth(){return this.opts.depth}constructor(e,t={}){super(e,Object.assign({color:1,depth:!0,depthTexture:!1,stencil:!1},t)),this._texturesByAttachment=new Map,this._buffersByAttachment=new Map,this.drawBuffers=new Array,this.drawBuffersChanged=!1,this._size=(0,R.n)(t.size)?t.size:{width:1,height:1},this.viewport=new Ne.A(0,0,this.size.width,this.size.height),this.name=t.name;const i=this.gl,r=t.attachments||[];if((0,W.I)(r)){for(let a=0;a<this.opts.color;a++){const s=Object.assign(Object.assign({wrapS:i.CLAMP_TO_EDGE,wrapT:i.CLAMP_TO_EDGE,minFilter:i.LINEAR,magFilter:i.LINEAR,type:i.UNSIGNED_BYTE,format:i.RGBA},t),{size:this.size});let n;if(s.data){const{width:t,height:i}=s.size;n=new gs(e,s.data,t,i,s)}else n=new ei(e,s);r.push([i.COLOR_ATTACHMENT0+a,n])}if(t.depthTexture&&(e.isWebGL2||e.renderer.getExtension("WEBGL_depth_texture"))){const t=new ei(e,{size:this.size,minFilter:this.gl.NEAREST,magFilter:this.gl.NEAREST,format:this.gl.DEPTH_COMPONENT,internalFormat:e.isWebGL2?i.DEPTH_COMPONENT16:i.DEPTH_COMPONENT,type:this.gl.UNSIGNED_INT});r.push([i.DEPTH_ATTACHMENT,t])}else{const{depth:a,stencil:s}=t,{width:n,height:o}=this.size;if(a&&!s){const t=new ms(e,{format:i.DEPTH_COMPONENT16,size:{width:n,height:o}});r.push([i.DEPTH_ATTACHMENT,t])}else if(s&&!a){const t=new ms(e,{format:i.STENCIL_INDEX8,size:{width:n,height:o}});r.push([i.STENCIL_ATTACHMENT,t])}else if(a&&s){const t=new ms(e,{format:i.DEPTH_STENCIL,size:{width:n,height:o}});r.push([i.DEPTH_STENCIL_ATTACHMENT,t])}}}this.create(r)}create(e){const t=this.gl;this.clearColors=[],this.clearDepth=1,this.clearStencil=0;for(let i=0;i<e.length;i++){const[r,a]=e[i];a instanceof ms?this._buffersByAttachment.set(r,a):a instanceof ei&&this._texturesByAttachment.set(r,a),this.drawBuffers.push(r),this.clearColors[r-t.COLOR_ATTACHMENT0]=[0,0,0,0]}this.drawBuffersChanged=!0,this.bind(),this._buffersByAttachment.forEach(((e,i)=>{t.framebufferRenderbuffer(t.FRAMEBUFFER,i,t.RENDERBUFFER,e.handle)})),this._texturesByAttachment.forEach(((e,i)=>{t.framebufferTexture2D(t.FRAMEBUFFER,i,t.TEXTURE_2D,e.handle,0)})),this.unbind();const i=t.checkFramebufferStatus(t.FRAMEBUFFER);return i!==t.FRAMEBUFFER_COMPLETE&&console.warn(`[Aeris] ${((e,t)=>{switch(t){case e.FRAMEBUFFER_COMPLETE:return"Framebuffer is ready to display (COMPLETE)";case e.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:return"Attachment types are mismatched or not all framebuffer attachment points are \n framebuffer attachment complete (INCOMPLETE_ATTACHMENT)";case e.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:return"There is no attachment (INCOMPLETE_MISSING_ATTACHMENT)";case e.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:return"The height and width of the attachment are not the same (INCOMPLETE_DIMENSIONS)";case e.FRAMEBUFFER_UNSUPPORTED:return"Format of the attachment is not supported or if depth and stencil attachments \n are not the same renderbuffer (UNSUPPORTED)";case e.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE:return"Values of gl.RENDERBUFFER_SAMPLES are different among attached renderbuffers, \n or are non-zero if the attached images are a mix of renderbuffers and textures (INCOMPLETE_MULTISAMPLE)";default:return(0,ue.vA)(!1,`Expected known framebuffer status, given ${t}`),""}})(t,i)}`),this.handle}clear(e){const t=this.gl,i=(0,ue.aF)(e,t.DEPTH_BUFFER_BIT),r=(0,ue.aF)(e,t.STENCIL_BUFFER_BIT),a=(0,ue.aF)(e,t.COLOR_BUFFER_BIT);if(a||i||r){if(this.bind(),a&&void 0!==this.clearColors[0]){const e=this.clearColors[0];t.clearColor(e[0],e[1],e[2],e[3])}i&&void 0!==this.clearDepth&&t.clearDepth(this.clearDepth),r&&void 0!==this.clearStencil&&t.clearStencil(this.clearStencil),t.clear(e),this.unbind()}}getTexture(e){return this._texturesByAttachment.get(e)}resize(e,t){this.size.width===e&&this.size.height===t||(this._size={width:e,height:t},this._texturesByAttachment.forEach((i=>{i.size.width===e&&i.size.height===t||(i.size={width:e,height:t},i.needsUpdate=!0,i.update())})),this._buffersByAttachment.forEach((i=>{i.resize(e,t)})),this.viewport.set(0,0,e,t))}bind(){this.context.state.bindFramebuffer({target:arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.gl.FRAMEBUFFER,buffer:this.handle})}unbind(){this.context.state.bindFramebuffer({target:arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.gl.FRAMEBUFFER,buffer:null})}createHandle(){return this.incrementResourceCount(),this.gl.createFramebuffer()}deleteHandle(){this.handle&&(this.gl.deleteFramebuffer(this.handle),this.decrementResourceCount()),this._handle=void 0}dispose(){this._texturesByAttachment.forEach((e=>{e.dispose()})),this._buffersByAttachment.forEach((e=>{e.dispose()})),this._texturesByAttachment.clear(),this._buffersByAttachment.clear(),this.deleteHandle()}toString(){return`${this.constructor.name}:${this.name} (${this.id})`}};var ys=i(6694);const xs=(e,t,i,r)=>{let a=r;if(i=i||{},(0,R.g)(t))return a;if((0,te.G)(t)){if("object"===e||"any"===e)return t;if("color"===e&&t instanceof _r)return t;if(t.property)if(t.mapping){const e=(0,V.J)(i,t.property);a=t.mapping[e]}else a=(0,V.J)(i,t.property)}else a=me(t)?t(i):t;return"color"===e&&(a=xr(a)),a},bs=(e,t)=>{if(null==e?void 0:e.text)return Array.isArray(e.text)?e.text[t]:e.text},ws=e=>(null==e?void 0:e.icon)||(null==e?void 0:e.symbol);class _s{constructor(e={}){if(this._cachedSerialized=null,e.symbol){const t=new Set(["key","rank","fadeOpacity","pitchWithMap","rotateWithMap","scaleWithMap","sizeAttenuation","allowOverlap"]),i=Object.keys(e.symbol);e.icon||(e.icon={}),i.forEach((i=>{!0!==t.has(i)&&("icon"!==i&&(e.icon[i]=e.symbol[i]),delete e.symbol[i])}))}this.config=e}opacity(e){const t=xs("number",this.provider(e).opacity,e,1);return(0,R.g)(t)?1:t}animated(e){return xs("boolean",this.provider(e).animated,e,!1)}rasterMeld(e){var t;return xs("boolean",null===(t=this.provider(e).raster)||void 0===t?void 0:t.meld,e,!1)}rasterOpacity(e){var t;const i=xs("number",null===(t=this.provider(e).raster)||void 0===t?void 0:t.opacity,e);return(0,R.g)(i)?this.opacity(e):i}fillColor(e){var t;const i=this.fillPattern(e);let r=xs("color",null===(t=this.provider(e).fill)||void 0===t?void 0:t.color,e);return i&&(r=new _r(0,0,0,1)),r&&(r.a*=this.fillOpacity(e)),r}fillPattern(e){var t;const i=null===(t=this.provider(e).fill)||void 0===t?void 0:t.pattern,r="function"==typeof i?i(e):i;if("string"==typeof r&&/^https?:\/\//.test(r))throw new Error(`[MapsGL] Remote icon images must contain a unique id and provided as { id: string; url: string; }, not ${r}.`);return r}fillOpacity(e){var t;const i=xs("number",null===(t=this.provider(e).fill)||void 0===t?void 0:t.opacity,e,1);return(0,R.g)(i)?1:i}fillSort(e){var t;const i=null===(t=this.provider(e).fill)||void 0===t?void 0:t.sort;return"string"==typeof i?{property:i}:i}strokeColor(e){var t;const i=xs("color",null===(t=this.provider(e).stroke)||void 0===t?void 0:t.color,e);return i&&(i.a=this.strokeOpacity(e)),i}strokeOpacity(e){var t;const i=xs("number",null===(t=this.provider(e).stroke)||void 0===t?void 0:t.opacity,e,1);return(0,R.g)(i)?1:i}strokeThickness(e){var t;const i=xs("number",null===(t=this.provider(e).stroke)||void 0===t?void 0:t.thickness,e);return(0,R.g)(i)?0:i}strokeLineJoin(e){var t;const i=xs("string",null===(t=this.provider(e).stroke)||void 0===t?void 0:t.lineJoin,e);return(0,R.g)(i)?or.p.Round:i}strokeLineCap(e){var t;const i=xs("string",null===(t=this.provider(e).stroke)||void 0===t?void 0:t.lineCap,e);return(0,R.g)(i)?or.$.Round:i}radius(e){var t,i;const r=(null===(t=this.provider(e).circle)||void 0===t?void 0:t.radius)||(null===(i=this.provider(e).heatmap)||void 0===i?void 0:i.radius);return xs("number",r,e,10)}sampleExpression(e){var t;const i=null===(t=this.provider(e).sample)||void 0===t?void 0:t.expression;return xs("string",i,e,rr.BG.number)}sampleExpressionOperation(e){var t;return xs("object",null===(t=this.provider(e).sample)||void 0===t?void 0:t.expressionOperation,e)}sampleChannel(e){var t;return xs("string",null===(t=this.provider(e).sample)||void 0===t?void 0:t.channel,e)}sampleColorScale(e){var t;return xs("object",null===(t=this.provider(e).sample)||void 0===t?void 0:t.colorscale,e)}sampleInterpolation(e){var t;const i=null===(t=this.provider(e).sample)||void 0===t?void 0:t.interpolation;return xs("string",i,e)}sampleOpacity(e){return console.warn("[MapsGL] `sample.opacity` is deprecated. Use `opacity` instead."),1}sampleSmoothing(e){var t;return xs("number",null===(t=this.provider(e).sample)||void 0===t?void 0:t.smoothing,e,0)}sampleOffset(e){var t;return xs("number",null===(t=this.provider(e).sample)||void 0===t?void 0:t.offset,e,0)}sampleMeld(e){var t;return xs("boolean",null===(t=this.provider(e).sample)||void 0===t?void 0:t.meld,e,!0)}sampleDataRange(e){var t;return xs("object",null===(t=this.provider(e).sample)||void 0===t?void 0:t.dataRange,e)}sampleDrawRange(e){var t;return xs("object",null===(t=this.provider(e).sample)||void 0===t?void 0:t.drawRange,e)}gridSpacing(e){var t;return xs("number",null===(t=this.provider(e).grid)||void 0===t?void 0:t.spacing,e,30)}particleType(e){var t;return xs("string",null===(t=this.provider(e).particle)||void 0===t?void 0:t.type,e)}particleCount(e){var t;return xs("number",null===(t=this.provider(e).particle)||void 0===t?void 0:t.count,e)}particleDensity(e){var t;return xs("number",null===(t=this.provider(e).particle)||void 0===t?void 0:t.density,e,0)}particleSpeed(e){var t,i;const r=(null===(t=this.provider(e).particle)||void 0===t?void 0:t.speedFactor)||(null===(i=this.provider(e).particle)||void 0===i?void 0:i.speed);return xs("number",r,e,1)}particleSize(e){var t,i,r;if((0,G.E)(null===(t=this.config.particle)||void 0===t?void 0:t.size)){const t=xs("number",null===(i=this.provider(e).particle)||void 0===i?void 0:i.size,e,0);return{width:t,height:t}}return xs("object",null===(r=this.provider(e).particle)||void 0===r?void 0:r.size,e,{width:2,height:2})}particleTrails(e){var t;return xs("boolean",null===(t=this.provider(e).particle)||void 0===t?void 0:t.trails,e)}particleTrailsFade(e){var t,i;const r=(null===(t=this.provider(e).particle)||void 0===t?void 0:t.trailsFadeFactor)||(null===(i=this.provider(e).particle)||void 0===i?void 0:i.trailsFade);return xs("number",r,e)}particleDropRate(e){var t;return xs("number",null===(t=this.provider(e).particle)||void 0===t?void 0:t.dropRate,e)}particleDropRateBump(e){var t;return xs("number",null===(t=this.provider(e).particle)||void 0===t?void 0:t.dropRateBump,e)}heatmapColor(e){var t;return xs("colorscale",null===(t=this.provider(e).heatmap)||void 0===t?void 0:t.color,e)}heatmapRadius(e){var t;return xs("number",null===(t=this.provider(e).heatmap)||void 0===t?void 0:t.radius,e,10)}heatmapBlur(e){var t;return xs("number",null===(t=this.provider(e).heatmap)||void 0===t?void 0:t.blur,e,1)}heatmapIntensity(e){var t;return xs("number",null===(t=this.provider(e).heatmap)||void 0===t?void 0:t.intensity,e)}heatmapWeight(e){var t;return xs("number",null===(t=this.provider(e).heatmap)||void 0===t?void 0:t.weight,e,1)}heatmapOpacity(e){return console.warn("[MapsGL] `heatmap.opacity` is deprecated. Use `opacity` instead."),1}contourInterval(e){var t;return xs("number",null===(t=this.provider(e).contour)||void 0===t?void 0:t.interval,e,1)}contourMajorInterval(e){var t;return xs("number",null===(t=this.provider(e).contour)||void 0===t?void 0:t.majorInterval,e,0)}contourWidth(e){var t;return xs("number",null===(t=this.provider(e).contour)||void 0===t?void 0:t.width,e,1)}contourMajorWidth(e){var t;return xs("number",null===(t=this.provider(e).contour)||void 0===t?void 0:t.majorWidth,e,3)}contourScale(e){var t;return xs("number",null===(t=this.provider(e).contour)||void 0===t?void 0:t.scale,e,1)}contourOffset(e){var t;return xs("number",null===(t=this.provider(e).contour)||void 0===t?void 0:t.offset,e,0)}symbolKey(e){var t;return xs("string",null===(t=this.provider(e).symbol)||void 0===t?void 0:t.key,e)}symbolRank(e){var t;return null===(t=this.provider(e).symbol)||void 0===t?void 0:t.rank}symbolRotateWithMap(e){var t;return xs("boolean",null===(t=this.provider(e).symbol)||void 0===t?void 0:t.rotateWithMap,e,!0)}symbolPitchWithMap(e){var t;return xs("boolean",null===(t=this.provider(e).symbol)||void 0===t?void 0:t.pitchWithMap,e,!0)}symbolScaleWithMap(e){var t;return xs("boolean",null===(t=this.provider(e).symbol)||void 0===t?void 0:t.scaleWithMap,e,!1)}symbolSizeAttenuation(e){var t;return xs("boolean",null===(t=this.provider(e).symbol)||void 0===t?void 0:t.sizeAttenuation,e,!1)}symbolAllowOverlap(e){var t;return xs("boolean",null===(t=this.provider(e).symbol)||void 0===t?void 0:t.allowOverlap,e,!0)}symbolOverlapMode(e){var t;return xs("string",null===(t=this.provider(e).symbol)||void 0===t?void 0:t.overlapMode,e,"layer")}symbolFadeOpacity(e){var t;return xs("boolean",null===(t=this.provider(e).symbol)||void 0===t?void 0:t.fadeOpacity,e,!0)}iconType(e){var t;return xs("string",null===(t=ws(this.provider(e)))||void 0===t?void 0:t.type,e)}iconImage(e){var t,i;const r=null===(t=this.provider(e).icon)||void 0===t?void 0:t.image,a="function"==typeof r?r(e):r;if("string"==typeof a&&/^https?:\/\//.test(a))throw new Error(`[MapsGL] Remote icon images must contain a unique id and provided as { id: string; url: string; }, not ${a}.`);const s=this.iconAtlas(e);return!a&&(null===(i=null==s?void 0:s.ids)||void 0===i?void 0:i.length)>0?s.ids[0]:a}iconShader(e){var t;return xs("string",null===(t=ws(this.provider(e)))||void 0===t?void 0:t.shader,e)}iconUniforms(e){var t;return xs("object",null===(t=ws(this.provider(e)))||void 0===t?void 0:t.uniforms,e)}iconSize(e){var t;return xs("object",null===(t=ws(this.provider(e)))||void 0===t?void 0:t.size,e)}iconAnchor(e){var t;return xs("string",null===(t=ws(this.provider(e)))||void 0===t?void 0:t.anchor,e,"center")}iconOffset(e){var t;return xs("object",null===(t=ws(this.provider(e)))||void 0===t?void 0:t.offset,e,{x:0,y:0})}iconPadding(e){var t;const i=xs("object",null===(t=ws(this.provider(e)))||void 0===t?void 0:t.padding,e,6);return Array.isArray(i)?i:[i,i]}iconRotation(e){var t;return xs("number",null===(t=ws(this.provider(e)))||void 0===t?void 0:t.rotation,e,0)}iconBlending(e){var t;return xs("number",null===(t=ws(this.provider(e)))||void 0===t?void 0:t.blending,e)}iconAnimated(e){var t;return xs("boolean",null===(t=ws(this.provider(e)))||void 0===t?void 0:t.animated,e,!1)}iconFactor(e){var t;return xs("number",null===(t=ws(this.provider(e)))||void 0===t?void 0:t.factor,e,1)}iconAtlas(e){var t;return xs("object",null===(t=ws(this.provider(e)))||void 0===t?void 0:t.atlas,e)}textValue(e){var t;const i=null===(t=bs(this.config,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0))||void 0===t?void 0:t.value;return"function"==typeof i?i(e):i}textTransform(e){var t;return xs("string",null===(t=bs(this.config,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0))||void 0===t?void 0:t.transform,e,"none")}textFont(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var i,r;const a=xs("string",null===(i=bs(this.config,t))||void 0===i?void 0:i.font,e,"Inter");let s=xs("string",null===(r=bs(this.config,t))||void 0===r?void 0:r.weight,e,"normal");return"normal"===s&&(s="regular"),`${(0,ys.C)(a)}-${(0,ys.C)(s)}`}textSize(e){var t;return xs("object",null===(t=bs(this.config,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0))||void 0===t?void 0:t.size,e,12)}textColor(e){var t;const i=xs("color",null===(t=bs(this.config,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0))||void 0===t?void 0:t.color,e,new _r("#000"));return i&&(i.a=this.textOpacity(e)),i}textOutlineColor(e){var t;const i=xs("color",null===(t=bs(this.config,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0))||void 0===t?void 0:t.outlineColor,e);return i&&(i.a=this.textOpacity(e)),i}textOpacity(e){var t;const i=xs("number",null===(t=bs(this.config,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0))||void 0===t?void 0:t.opacity,e,1);return(0,R.g)(i)?1:i}textAlign(e){var t;return xs("string",null===(t=bs(this.config,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0))||void 0===t?void 0:t.align,e,"center")}textAnchor(e){var t;return xs("string",null===(t=bs(this.config,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0))||void 0===t?void 0:t.anchor,e,"center")}textOffset(e){var t;return xs("object",null===(t=bs(this.config,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0))||void 0===t?void 0:t.offset,e,{x:0,y:0})}textPadding(e){var t;const i=xs("object",null===(t=bs(this.config,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0))||void 0===t?void 0:t.padding,e,6);return Array.isArray(i)?i:[i,i]}textRotation(e){var t;return xs("number",null===(t=bs(this.config,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0))||void 0===t?void 0:t.rotation,e,0)}textLetterSpacing(e){var t;return xs("number",null===(t=bs(this.config,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0))||void 0===t?void 0:t.letterSpacing,e,0)}textLineHeight(e){var t;return xs("number",null===(t=bs(this.config,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0))||void 0===t?void 0:t.lineHeight,e,1)}textMaxWidth(e){var t;return xs("number",null===(t=bs(this.config,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0))||void 0===t?void 0:t.maxWidth,e,140)}textLineCount(e){var t;const i=null===(t=this.config)||void 0===t?void 0:t.text;return i?Array.isArray(i)?i.length:1:0}getProperty(e){return(0,V.J)(this.config,e)}setProperty(e,t){const i=e.match(/\[\d+]/);if((null==i?void 0:i.length)>0){const r=Number.parseInt(i[0].replaceAll(/\D/g,""),10),a=e.split(i[0]),s=(0,V.J)(this.config,a[0]),n=a[1].replace(/^\./,"");Array.isArray(s)&&(0,U.h)(s[r],n,t)}else(0,U.h)(this.config,e,t);this._cachedSerialized=null}serialized(){if(this._cachedSerialized)return this._cachedSerialized;const e={};return Hi(e,this.config),this._cachedSerialized=e,e}provider(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return(me(this.config)?this.config(e):this.config)||{}}static fromSerialized(e){const t={};return Zi(t,e),new _s(t)}}const As=_s;var Ms=i(7684);const Ts=class extends Ai.A{frustum(e,t,i,r,a,s){return Ms.$h(this.value,e,t,r,i,a,s),this}orthographic(e,t,i,r,a,s){return Ms.v3(this.value,e,t,r,i,a,s),this}perspective(e,t,i,r){return Ms.fN(this.value,e,t,i,r),this}lookAt(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Ve.A(0,0,0),i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Ve.A(0,1,0);return Ms.xI(this.value,e.value,t.value,i.value),this}};class Es{get hash(){return this.tile.coord.hash}constructor(e,t,i,r=[0,0,1,1]){this.partialScale=1,this.tile=e,this.scale=new Ve.A(t.x,t.y,1),this.offset=new Ve.A(i.x,i.y,0),this.uvOffset=r}getViewMatrix(){const e=new Ts;return e.scale(this.scale),e.translate(this.offset),e}static fromTile(e,t){const i=St(t.z),r=Pt(t.normalize()),a=new Es(e,{x:i,y:i},{x:r.x+t.wrap,y:r.y});return a.coord=t,a}static fromAncestorPartial(e,t){const i=e.tile,r=e.target,a=St(r.z),s=Pt(r),n=new Es(i,{x:a,y:a},s,((e,t)=>{const i=1/Math.pow(2,t.z-e.z);return[t.x*i-e.x,t.y*i-e.y,i,i]})(i.coord,r.normalize()));return n.partialScale=1/Math.pow(2,i.coord.z-r.z),n.coord=t,n}static fromDescendantPartial(e,t){const i=e.tile,r=e.target,a=St(i.coord.z),s=Pt(i.coord),n=new Es(i,{x:a,y:a},s,[0,0,1,1]);return n.partialScale=1/Math.pow(2,i.coord.z-r.z),n.coord=t,n}}const Ss=Es;class Cs{get span(){return{x:this.bounds.right-this.bounds.left+1,y:this.bounds.bottom-this.bounds.top+1}}get offset(){return Pt({x:this.bounds.left,y:this.bounds.top,z:this.zoom})}get scale(){const e=Math.pow(2,this.zoom);return{x:e/this.clampedSpan().x,y:e/this.clampedSpan().y}}get offsetNormalized(){const e=this.topLeftCoord(!0);return{x:e.x,y:e.y}}get spanNormalized(){const e=this.topLeftCoord(!0),t=this.bottomRightCoord(!0);return{x:t.x-e.x,y:t.y-e.y}}constructor(e,t){this.zoom=e,this.bounds=t}resolution(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Mt;const t=arguments.length>1&&void 0!==arguments[1]&&arguments[1]?this.clampedSpan():this.span;return{width:t.x*e,height:t.y*e}}clampedSpan(){return{x:Math.max(1,Math.abs(this.span.x)),y:Math.max(1,Math.abs(this.span.y))}}topLeftCoord(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const t=new Vt(this.zoom,this.bounds.left,this.bounds.top);return e?Pt(t):t}bottomRightCoord(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const t=new Vt(this.zoom,this.bounds.right+1,this.bounds.bottom+1);return e?Pt(t):t}visibleTileRegion(){return arguments.length>0&&void 0!==arguments[0]&&arguments[0]?{offset:this.offsetNormalized,scale:this.spanNormalized}:{offset:this.offset,scale:this.span}}equals(e){const t=this.bounds,i=e.bounds;return e.zoom===this.zoom&&i.left===t.left&&i.right===t.right&&i.top===t.top&&i.bottom===t.bottom}convertedToZoom(e){if(e===this.zoom)return this;const t=Math.pow(2,e-this.zoom),i=Math.floor(this.bounds.left*t),r=Math.floor(this.bounds.top*t),a=Math.floor(i+this.span.x*t-1),s=Math.floor(r+this.span.y*t-1);return new Cs(e,new La(i,Math.max(0,a),r,Math.max(0,s)))}}const Os=Cs;class Rs extends N.A{constructor(){super(...arguments),this.elapsedTime=0,this._renderRegion={offset:{x:0,y:0},scale:{x:1,y:1},diff:{offset:{x:0,y:0},scale:{x:1,y:1}}},this._tileLayout={size:{width:Mt,height:Mt},columns:1,rows:1},this._renderedTiles=new Set,this._renderables=[],this._glState={},this._mapState={},this._isMapMoving=!1}get dataRegion(){return this._dataTileRegion}get visibleRegion(){return this._mapTileRegion}get renderRegion(){return this._renderRegion}get tileLayout(){return this._tileLayout}get renderables(){return this._renderables}get renderedTiles(){return[...this._renderedTiles.values()]}get gl(){return this._glState}updateRenderables(e){this._renderables=e}updateState(e){var t,i;const{map:r,data:a,layout:s,renderables:n,elapsedTime:o,gl:l}=e;let h=!1;if((0,R.n)(o)&&(this.elapsedTime=o),r){const e=this._mapState;if(null==e?void 0:e.center){const t=r.center.lat!==e.center.lat||r.center.lon!==e.center.lon||r.bearing!==e.bearing||r.pitch!==e.pitch||r.zoom!==e.zoom;t&&!this._isMapMoving?(this._isMapMoving=!0,this.trigger(Rs.Events.MAP_MOVE_START)):!t&&this._isMapMoving&&(this._isMapMoving=!1,this.trigger(Rs.Events.MAP_MOVE_END))}this._mapState=Object.assign({},r)}if(s){const e=s.columns!==(null===(t=this.tileLayout)||void 0===t?void 0:t.columns)||s.rows!==(null===(i=this.tileLayout)||void 0===i?void 0:i.rows);this._tileLayout=Object.assign({},s),e&&this.trigger(Rs.Events.LAYOUT_CHANGE,{layout:s})}if(l&&(this._glState=Object.assign(Object.assign({},this._glState),l)),!a||!r)return;this._renderables=n;const c=new Os(a.zoom,a.bounds),d=new Os(r.zoom,r.bounds);if(this._dataTileRegion?this._dataTileRegion.equals(c)||(this._dataTileRegion=c,this._renderedTiles.clear(),h=!0):(this._dataTileRegion=c,h=!0),h||!this._mapTileRegion||!this._mapTileRegion.equals(d)){this._mapTileRegion=d;const e=d.offsetNormalized,t=d.spanNormalized,i=this.dataRegion.visibleTileRegion(!0);this._renderRegion={offset:e,scale:t,diff:{offset:{x:(e.x-i.offset.x)/i.scale.x,y:(e.y-i.offset.y)/i.scale.y},scale:{x:t.x/i.scale.x,y:t.y/i.scale.y}}},h=!0}h&&this.trigger(Rs.Events.DIRTY)}}Rs.Events={DIRTY:"dirty",MAP_MOVE_START:"map:move:start",MAP_MOVE_END:"map:move:end",LAYOUT_CHANGE:"layout:change"};const Is=Rs,Ps=new _r(0,0,0,1),Ds=class{get passes(){return this._passes}get count(){return this.passes.length}constructor(e,t={}){this.enabled=!0,this._passes=[],this.context=e,this.drawContext=t,this._size=e.size}setSize(e,t){const i=this.context.renderer.dpr,r=e*i,a=t*i;this._size={width:e,height:t};for(let e=0,t=this._passes.length;e<t;e++)this._passes[e].setSize(r,a)}addPass(e){this.prepareDrawContext(e),this._passes.push(e)}insertPass(e,t){this.prepareDrawContext(e),this._passes.splice(t,0,e)}removePass(e){const t=this._passes.indexOf(e);-1!==t&&(this._passes.splice(t,1),e.dispose())}removeAllPasses(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this._passes.filter((t=>!t.id||!1===e.includes(t.id))).forEach((e=>{e.dispose()})),this._passes=[]}getPass(e){let t;return this._passes.forEach((i=>{i.id===e&&(t=i)})),t}enablePass(e,t){const i=this.getPass(e);i&&(i.enabled=t)}withPass(e,t){const i=this.getPass(e);i&&t(i)}setMask(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._mask=i=>{const r=this.context,a=r.gl;r.state.setCullEnabled(!0),r.state.setStencilTest(!0),r.state.setStencilMask(255),r.state.setStencilFunc(a.ALWAYS,1,255),r.state.setStencilOp(a.KEEP,a.KEEP,a.REPLACE),r.state.setColorMask(!1,!1,!1,!1),r.state.clear(!1,!1,!0),e(),r.state.setStencilTest(!0),r.state.setStencilFunc(t?a.NOTEQUAL:a.EQUAL,1,255),r.state.setStencilOp(a.KEEP,a.KEEP,a.KEEP),r.state.setColorMask(!0,!0,!0,!0),i(),r.state.setStencilTest(!1),r.state.setStencilMask(0),r.state.setStencilFunc(a.ALWAYS,0,255),r.state.setStencilOp(a.KEEP,a.KEEP,a.KEEP)}}prerender(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const i=this.context,r=Object.assign(Object.assign({},this.drawContext),e),a=this._passes.filter((e=>e.enabled&&(!0===e.prerender||this.drawContext.renderTarget)));if(0!==a.length){for(let e=0,s=a.length;e<s;e++){const s=e===a.length-1,n=a[e],o=r.renderTarget;s&&o&&(o.bind(),i.state.clear(!0)),n.render(r,t),s&&o&&o.unbind()}this.resetState()}}render(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const i=this.context,r=this._passes.filter((e=>e.enabled&&!0!==e.prerender)),a=Object.assign(Object.assign({},this.drawContext),e);if(0!==r.length){for(let e=0,s=r.length;e<s;e++){const s=e===r.length-1,n=r[e],o=a.renderTarget;s&&o&&(o.bind(),i.state.clear(!0)),this._mask&&s?this._mask((()=>{n.render(a,t)})):n.render(a,t)}this.resetState()}}prepareDrawContext(e){e.drawContext=Object.assign(Object.assign({},this.drawContext),e.drawContext)}resetState(){const e=this.context,t=e.gl;e.state.opts.currentProgram=-1,e.state.opts.activeTextureUnit=-1,e.state.opts.premultiplyAlpha=!1,e.state.opts.flipY=!1,e.state.setActiveGeometry(null),e.state.bindFramebuffer({buffer:null}),e.state.setClearColor(Ps),e.state.setViewport(e.resolution.width,e.resolution.height),e.state.setCullEnabled(!1),e.state.setCullFace(t.BACK),e.state.setDepthTest(!1),e.state.setDepthMask(!1),e.state.setStencilTest(!1),e.state.setStencilMask(0),e.state.setStencilFunc(t.ALWAYS,0,255),e.state.setStencilOp(t.KEEP,t.KEEP,t.KEEP)}dispose(){this.passes.forEach((e=>e.dispose()))}},zs=e=>{let t="",i={};if("string"==typeof e)t=e;else{const{sourceCode:r,uniforms:a}=e;t=r,i=a}return(0,W.h)(i)&&Object.keys(i).forEach((e=>{const r=new RegExp(`([^\\w\\d\\.])${i[e].variableName}([,\\.;\\)\\*\\+\\-\\/\\[=])`,"g");t=t.replace(r,`$1${e}$2`)})),t=t.replaceAll("<\n","\n<"),t=t.replaceAll(/#endif\s*}/g,"#endif\n}"),t=t.replaceAll(/#else\s*([\\w])/g,"#else\n$1"),t},Ls=zs("vec4 colorLookup(float value,float size,sampler2D ramp){float x=value;float s=1./size;x=value+0.001;return texture2D(ramp,vec2(x,0.5));}"),ks=zs("struct ValueRange{float min;float max;};float sampleColorValue(vec4 color,float channel){float value=color.r;if(channel==1.){value=color.g;}else if(channel==2.){value=color.b;}else if(channel==3.){value=color.a;}else if(channel==4.){value=(color.r+color.g)/2.;}else if(channel==5.){value=(color.g+color.b)/2.;}else if(channel==6.){value=(color.r+color.b)/2.;}else if(channel==7.){value=(color.r+color.a)/2.;}else if(channel==8.){value=(color.g+color.a)/2.;}else if(channel==9.){value=(color.b+color.a)/2.;}else if(channel==10.){value=(color.r+color.g+color.b)/3.;}else if(channel==11.){value=(color.g+color.b+color.a)/3.;}else if(channel==12.){value=(color.r+color.g+color.b+color.a)/4.;}return clamp(value,0.,1.);}float sampleDataValue(ValueRange dataRange,float p){return dataRange.min+(dataRange.max-dataRange.min)*p;}"),Fs=zs("uniform sampler2D tDataTL;uniform sampler2D tDataTC;uniform sampler2D tDataTR;uniform sampler2D tDataML;uniform sampler2D tDataMC;uniform sampler2D tDataMR;uniform sampler2D tDataBL;uniform sampler2D tDataBC;uniform sampler2D tDataBR;vec4 textureLookup(const vec2 uv){if(uv.x>1.&&uv.y>1.){return texture2D(tDataBR,uv-vec2(1.,1.));}else if(uv.x>0.&&uv.y>1.){return texture2D(tDataBC,uv-vec2(0.,1.));}else if(uv.y>1.){return texture2D(tDataBL,uv-vec2(-1.,1.));}else if(uv.x>1.&&uv.y>0.){return texture2D(tDataMR,uv-vec2(1.,0.));}else if(uv.x>0.&&uv.y>0.){return texture2D(tDataMC,uv-vec2(0.,0.));}else if(uv.y>0.){return texture2D(tDataML,uv-vec2(-1.,0.));}else if(uv.x>1.){return texture2D(tDataTR,uv-vec2(1.,-1.));}else if(uv.x>0.){return texture2D(tDataTC,uv-vec2(0.,-1.));}else{return texture2D(tDataTL,uv-vec2(-1.,-1.));}}"),js=zs("vec4 bilinear(sampler2D tex,vec2 uv,vec2 res){vec2 tuv=uv*res-0.5;vec2 f=fract(tuv);vec2 i=floor(tuv);\n#define S_BL(x,y)SAM2(tex,x,y,res,i)\nvec4 tl=S_BL(0,0);vec4 tr=S_BL(1,0);vec4 bl=S_BL(0,1);vec4 br=S_BL(1,1);vec4 top=mix(tl,tr,f.x);vec4 bottom=mix(bl,br,f.x);return mix(top,bottom,f.y);}vec4 bilinear_nodata(sampler2D tex,vec2 uv,vec2 res,float nodata){vec2 tuv=uv*res-0.5;vec2 f=fract(tuv);vec2 i=floor(tuv);float channel=dataChannel[0];\n#define S_BL_ND(x,y,w)SAM2_nodata(tex,x,y,res,i,w,channel,nodata)\nfloat wTL,wTR,wBL,wBR;vec4 tl=S_BL_ND(0,0,wTL);vec4 tr=S_BL_ND(1,0,wTR);vec4 bl=S_BL_ND(0,1,wBL);vec4 br=S_BL_ND(1,1,wBR);float totalTopWeight=wTL+wTR;float totalBottomWeight=wBL+wBR;float totalWeight=totalTopWeight+totalBottomWeight;if(totalTopWeight>0.){tl/=max(wTL,1e-5);tr/=max(wTR,1e-5);}if(totalBottomWeight>0.){bl/=max(wBL,1e-5);br/=max(wBR,1e-5);}vec4 top=mix(tl,tr,f.x);vec4 bottom=mix(bl,br,f.x);return(totalWeight>0.)?mix(top,bottom,f.y):vec4(0.);}"),Ns=zs("const vec4 BS_A=vec4(3.,-6.,0.,4.)/6.;const vec4 BS_B=vec4(-1.,6.,-12.,8.)/6.;const vec4 RE_A=vec4(21.,-36.,0.,16.)/18.;const vec4 RE_B=vec4(-7.,36.,-60.,32.)/18.;const vec4 CR_A=vec4(3.,-5.,0.,2.)/2.;const vec4 CR_B=vec4(-1.,5.,-8.,4.)/2.;const vec4 CA=BS_A;const vec4 CB=BS_B;vec4 powers(float x){return vec4(x*x*x,x*x,x,1.);}vec4 spline(float x,vec4 c0,vec4 c1,vec4 c2,vec4 c3){return c0*dot(CB,powers(x+1.))+c1*dot(CA,powers(x))+c2*dot(CA,powers(1.-x))+c3*dot(CB,powers(2.-x));}vec4 spline_weighted(float x,vec4 c0,vec4 c1,vec4 c2,vec4 c3,float w0,float w1,float w2,float w3){vec4 num=c0*dot(CB,powers(x+1.))*w0+c1*dot(CA,powers(x))*w1+c2*dot(CA,powers(1.-x))*w2+c3*dot(CB,powers(2.-x))*w3;float denom=w0*dot(CB,powers(x+1.))+w1*dot(CA,powers(x))+w2*dot(CA,powers(1.-x))+w3*dot(CB,powers(2.-x));return(denom>0.)?(num/denom):vec4(0.);}vec4 bicubic(sampler2D tex,vec2 uv,vec2 res){vec2 tuv=uv*res-0.5;vec2 f=fract(tuv);vec2 i=floor(tuv);\n#define S_BC(x,y)SAM2(tex,x,y,res,i)\nvec4 row1=spline(f.x,S_BC(-1,-1),S_BC(0,-1),S_BC(1,-1),S_BC(2,-1));vec4 row2=spline(f.x,S_BC(-1,0),S_BC(0,0),S_BC(1,0),S_BC(2,0));vec4 row3=spline(f.x,S_BC(-1,1),S_BC(0,1),S_BC(1,1),S_BC(2,1));vec4 row4=spline(f.x,S_BC(-1,2),S_BC(0,2),S_BC(1,2),S_BC(2,2));return spline(f.y,row1,row2,row3,row4);\n#undef S\n}vec4 bicubic_nodata(sampler2D tex,vec2 uv,vec2 res,float nodata){vec2 tuv=uv*res-0.5;vec2 f=fract(tuv);vec2 i=floor(tuv);float channel=dataChannel[0];\n#define S_BC_ND(x,y,w)SAM2_nodata(tex,x,y,res,i,w,channel,nodata)\nfloat w1,w2,w3,w4;vec4 s11=S_BC_ND(-1,-1,w1);vec4 s01=S_BC_ND(0,-1,w2);vec4 s21=S_BC_ND(1,-1,w3);vec4 s31=S_BC_ND(2,-1,w4);float weight1=w1+w2+w3+w4;vec4 row1=spline_weighted(f.x,s11,s01,s21,s31,w1,w2,w3,w4);vec4 s10=S_BC_ND(-1,0,w1);vec4 s00=S_BC_ND(0,0,w2);vec4 s20=S_BC_ND(1,0,w3);vec4 s30=S_BC_ND(2,0,w4);float weight2=w1+w2+w3+w4;vec4 row2=spline_weighted(f.x,s10,s00,s20,s30,w1,w2,w3,w4);vec4 s12=S_BC_ND(-1,1,w1);vec4 s02=S_BC_ND(0,1,w2);vec4 s22=S_BC_ND(1,1,w3);vec4 s32=S_BC_ND(2,1,w4);float weight3=w1+w2+w3+w4;vec4 row3=spline_weighted(f.x,s12,s02,s22,s32,w1,w2,w3,w4);vec4 s13=S_BC_ND(-1,2,w1);vec4 s03=S_BC_ND(0,2,w2);vec4 s23=S_BC_ND(1,2,w3);vec4 s33=S_BC_ND(2,2,w4);float weight4=w1+w2+w3+w4;vec4 row4=spline_weighted(f.x,s13,s03,s23,s33,w1,w2,w3,w4);float totalWeight=weight1+weight2+weight3+weight4;vec4 num=row1*dot(CB,powers(f.y+1.))*weight1+row2*dot(CA,powers(f.y))*weight2+row3*dot(CA,powers(1.-f.y))*weight3+row4*dot(CB,powers(2.-f.y))*weight4;float denom=weight1*dot(CB,powers(f.y+1.))+weight2*dot(CA,powers(f.y))+weight3*dot(CA,powers(1.-f.y))+weight4*dot(CB,powers(2.-f.y));return(denom>0.)?(num/denom):vec4(0.);}"),Vs=zs("vec4 biquadratic(sampler2D tex,vec2 uv,vec2 res){float texSize=max(res.x,res.y);vec2 p=uv;\n#if 0\np=p*texSize;vec2 i=floor(p);vec2 f=fract(p);p=i+f*0.5;p=p/texSize;float w=0.5/texSize;return mix(mix(texture2D(tex,p+vec2(0,0)),texture2D(tex,p+vec2(w,0)),f.x),mix(texture2D(tex,p+vec2(0,w)),texture2D(tex,p+vec2(w,w)),f.x),f.y);\n#else\nvec2 f=fract(p*texSize);vec2 c=(f*(f-1.)+0.5)/texSize;vec2 w0=p-c;vec2 w1=p+c;return(texture2D(tex,vec2(w0.x,w0.y))+texture2D(tex,vec2(w0.x,w1.y))+texture2D(tex,vec2(w1.x,w1.y))+texture2D(tex,vec2(w1.x,w0.y)))/4.;\n#endif \n}"),Bs=zs("#include <sample_color_value>\nfloat isEdge(sampler2D tex,vec2 uv,vec2 res,float nodata,float channel){vec2 px=1./res;vec2 vc=floor(uv*res)*px;float a=0.;vec2 offsets[4];offsets[0]=vec2(0.,-px.y);offsets[1]=vec2(0.,px.y);offsets[2]=vec2(-px.x,0.);offsets[3]=vec2(px.x,0.);for(int i=0;i<4;i++){vec4 s=texture2D(tex,vc+offsets[i]);a+=float(sampleColorValue(s,channel)==nodata);}return float(a>0.&&a<4.);}vec4 SAM2(sampler2D tex,int a,int b,vec2 res,vec2 i){return texture2D(tex,(i+vec2(a,b)+0.5)/res);}float CHANNEL(vec4 texel,float channel){return(channel==0.)?texel.r:(channel==1.)?texel.g:(channel==2.)?texel.b:texel.a;}vec4 SAM2_nodata(sampler2D tex,int a,int b,vec2 res,vec2 i,out float w,float channel,float nodata){vec4 texel=texture2D(tex,(i+vec2(a,b)+0.5)/res);float channelValue=(channel==0.)?texel.r:(channel==1.)?texel.g:(channel==2.)?texel.b:texel.a;w=1.;if(channelValue==nodata){int offset=1;w=0.;\n#ifdef NODATA_BACKFILL\nvec4 ltx=SAM2(tex,a-1,b,res,i);float lv=CHANNEL(ltx,channel);if(lv!=nodata){w=1.;return ltx;}vec4 rtx=SAM2(tex,a+1,b,res,i);float rv=CHANNEL(rtx,channel);if(rv!=nodata){w=1.;return rtx;}vec4 ttx=SAM2(tex,a,b-1,res,i);float tv=CHANNEL(ttx,channel);if(tv!=nodata){w=1.;return ttx;}vec4 btx=SAM2(tex,a,b+1,res,i);float bv=CHANNEL(btx,channel);if(bv!=nodata){w=1.;return btx;}\n#endif\nreturn vec4(0.);}return texel*w;}\n#include <interpolate_bilinear>\n#include <interpolate_bicubic>\n#include <interpolate_biquadratic>\nvec4 interpolatedTexel(int type,sampler2D tex,vec2 uv,vec2 res){if(type==1)return bilinear(tex,uv,res);else if(type==2)return bicubic(tex,uv,res);else if(type==3)return biquadratic(tex,uv,res);return texture2D(tex,uv);}vec4 interpolatedNoDataTexel(int type,sampler2D tex,vec2 uv,vec2 res,float nodata){if(type==1)return bilinear_nodata(tex,uv,res,nodata);else if(type==2)return bicubic_nodata(tex,uv,res,nodata);else if(type==3)return biquadratic(tex,uv,res);return texture2D(tex,uv);}vec4 interpolatedScaledTexel(int type,sampler2D tex,vec2 uv,vec2 res,float scale){return interpolatedTexel(type,tex,uv,res*scale);}vec4 interpolatedScaledNoDataTexel(int type,sampler2D tex,vec2 uv,vec2 res,float scale,float nodata){return interpolatedNoDataTexel(type,tex,uv,res*scale,nodata);}"),Us=zs("vec4 encodeFloatRGBA(highp float val){if(val==0.){return vec4(0.,0.,0.,0.);}float mag=abs(val);float exponent=floor(log2(mag));exponent+=float(exp2(exponent)<=mag/2.);exponent-=float(exp2(exponent)>mag);float mantissa;if(exponent>100.){mantissa=mag/1024./exp2(exponent-10.)-1.;}else{mantissa=mag/float(exp2(exponent))-1.;}float a=exponent+127.;mantissa*=256.;float b=floor(mantissa);mantissa-=b;mantissa*=256.;float c=floor(mantissa);mantissa-=c;mantissa*=128.;float d=floor(mantissa)*2.+float(val<0.);return vec4(a,b,c,d)/255.;}"),$s=zs("highp float decodeFloatRGBA(vec4 v){float a=floor(v.r*255.+0.5);float b=floor(v.g*255.+0.5);float c=floor(v.b*255.+0.5);float d=floor(v.a*255.+0.5);float exponent=a-127.;float sign=1.-mod(d,2.)*2.;float mantissa=float(a>0.)+b/256.+c/65536.+floor(d/2.)/8388608.;return sign*mantissa*exp2(exponent);}"),Gs=zs("vec2 unpack_float(const float value){int packedIntValue=int(value);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec4 decode_color(const vec2 value){return vec4(unpack_float(value[0])/255.,unpack_float(value[1])/255.);}"),qs=zs("mat3 scale(vec2 v){return mat3(1./v.x,0.,0.,0.,1./v.y,0.,0.,0.,1.);}mat3 translate(vec2 v){return mat3(1.,0.,v.x,0.,1.,v.y,0.,0.,1.);}vec2 rotate(vec2 v,float a){float s=sin(a);float c=cos(a);mat2 m=mat2(c,-s,s,c);return m*v;}vec3 rotateX(vec3 v,float angle){float s=sin(angle);float c=cos(angle);mat3 m=mat3(1.,0.,0.,0.,c,s,0.,-s,c);return m*v;}vec3 rotateY(vec3 v,float angle){float s=sin(angle);float c=cos(angle);mat3 m=mat3(c,0.,-s,0.,1.,0.,s,0.,c);return m*v;}"),Ws=zs("vec4 stroked(float dist,float linewidth,float antialias,vec4 stroke){float t=linewidth/2.-antialias;float sdist=dist;float borderDist=abs(sdist)-t;float alpha=borderDist/antialias;alpha=exp(-alpha*alpha);if(borderDist<0.){return stroke;}return vec4(stroke.rgb,stroke.a*alpha);}vec4 filled(float dist,float linewidth,float antialias,vec4 fill){float t=linewidth/2.-antialias;float sdist=dist;float borderDist=abs(sdist)-t;float alpha=borderDist/antialias;alpha=exp(-alpha*alpha);if(borderDist<0.){return fill;}else if(sdist<0.){return fill;}return vec4(0.);}vec4 outline(float dist,float linewidth,float antialias,vec4 fill,vec4 stroke){float t=linewidth/2.-antialias;float sdist=dist;float borderDist=abs(sdist)-t;float alpha=borderDist/antialias;alpha=exp(-alpha*alpha);if(borderDist<0.){return stroke;}else if(sdist<0.){return mix(fill,stroke,sqrt(alpha));}return vec4(stroke.rgb,stroke.a*alpha);}float disc(vec2 pos,float size){return length(pos)-size/2.;}"),Hs=zs("float line_distance(vec2 p,vec2 p1,vec2 p2){vec2 center=(p1+p2)*0.5;float len=length(p2-p1);vec2 dir=(p2-p1)/len;vec2 rel_p=p-center;return dot(rel_p,vec2(dir.y,-dir.x));}float segment_distance(vec2 p,vec2 p1,vec2 p2){vec2 center=(p1+p2)*0.5;float len=length(p2-p1);vec2 dir=(p2-p1)/len;vec2 rel_p=p-center;float dist1=abs(dot(rel_p,vec2(dir.y,-dir.x)));float dist2=abs(dot(rel_p,dir))-0.5*len;return max(dist1,dist2);}float arrow_stealth(vec2 texcoord,float body,float head,float height,float linewidth,float antialias){vec2 start=vec2(0.,0.);vec2 end=vec2(body-0.005,0.);float d1=line_distance(texcoord,end-head*vec2(1.,-height),end);float d2=line_distance(texcoord,end-head*vec2(1.,-height),end-vec2(3.*head/4.,0.));float d3=line_distance(texcoord,end-head*vec2(1.,height),end);float d4=line_distance(texcoord,end-head*vec2(1.,height),end-vec2(3.*head/4.,0.));float d5=segment_distance(texcoord,start,end-vec2(linewidth,0.));return min(d5,max(max(-d1,d3),-max(-d2,d4)));}float arrow_triangle(vec2 texcoord,float body,float head,float height,float linewidth,float antialias){vec2 start=-vec2(body/2.,0.);vec2 end=vec2(body/2.,0.);float d1=line_distance(texcoord,end,end-head*vec2(1.,-height));float d2=line_distance(texcoord,end-head*vec2(1.,height),end);float d3=texcoord.x-end.x+head;float d4=segment_distance(texcoord,start,end-vec2(linewidth,0.));float d=min(max(max(d1,d2),-d3),d4);return d;}float arrow_triangle_30(vec2 texcoord,float body,float head,float height,float linewidth,float antialias){return arrow_triangle(texcoord,body,head,0.25,linewidth,antialias);}float arrow_triangle_60(vec2 texcoord,float body,float head,float height,float linewidth,float antialias){return arrow_triangle(texcoord,body,head,0.5,linewidth,antialias);}float arrow_triangle_90(vec2 texcoord,float body,float head,float height,float linewidth,float antialias){return arrow_triangle(texcoord,body,head,1.,linewidth,antialias);}float arrow_angle(vec2 texcoord,float body,float head,float height,float linewidth,float antialias){float d;float w=linewidth/2.+antialias;vec2 start=-vec2(body/2.,0.);vec2 end=vec2(body/2.,0.);if(texcoord.x>body/2.){float d1=line_distance(texcoord,end,end-head*vec2(1.,-height));float d2=line_distance(texcoord,end-head*vec2(1.,height),end);float d3=end.x-texcoord.x;d=max(max(d1,d2),d3);}else{float d1=segment_distance(texcoord,end-head*vec2(1.,-height),end);float d2=segment_distance(texcoord,end-head*vec2(1.,height),end);float d3=segment_distance(texcoord,start,end-vec2(linewidth,0.));d=min(min(d1,d2),d3);}return d;}float arrow_angle_30(vec2 texcoord,float body,float head,float height,float linewidth,float antialias){return arrow_angle(texcoord,body,head,0.25,linewidth,antialias);}float arrow_angle_60(vec2 texcoord,float body,float head,float height,float linewidth,float antialias){return arrow_angle(texcoord,body,head,0.5,linewidth,antialias);}float arrow_angle_90(vec2 texcoord,float body,float head,float height,float linewidth,float antialias){return arrow_angle(texcoord,body,head,1.,linewidth,antialias);}"),Zs=zs("vec2 hash(vec2 p){p=vec2(dot(p,vec2(127.1,311.7)),dot(p,vec2(269.5,183.3)));return-1.+2.*fract(sin(p)*43758.5453123);}float noise(in vec2 p){const float K1=0.366025404;const float K2=0.211324865;vec2 i=floor(p+(p.x+p.y)*K1);vec2 a=p-i+(i.x+i.y)*K2;vec2 o=(a.x>a.y)?vec2(1.,0.):vec2(0.,1.);vec2 b=a-o+K2;vec2 c=a-1.+2.*K2;vec3 h=max(0.5-vec3(dot(a,a),dot(b,b),dot(c,c)),0.);vec3 n=h*h*h*h*vec3(dot(a,hash(i+0.)),dot(b,hash(i+o)),dot(c,hash(i+1.)));return dot(n,vec3(70.));}float fbm(vec2 uv){float f;mat2 m=mat2(1.6,1.2,-1.2,1.6);f=0.5000*noise(uv);uv=m*uv;f+=0.2500*noise(uv);uv=m*uv;f+=0.1250*noise(uv);uv=m*uv;f+=0.0625*noise(uv);uv=m*uv;f=0.5+0.5*f;return f;}"),Ys=zs("vec4 projectPosition(vec4 position){vec4 worldPosition=modelMatrix*position;return projectionMatrix*viewMatrix*worldPosition;}vec2 projectPixelSizeToClipspace(vec2 pixels){vec2 offset=((pixels/viewportSize)*dpr)*2.;return offset;}vec2 projectPixelSize(vec2 pixels){return pixels*pixelToUnit;}"),Xs=zs("float scale=1.-(0.8*smoothing);vec4 texel1;vec4 texel2;\n#ifdef NODATA\ntexel1=interpolatedScaledNoDataTexel(interpolation,dataTexture,tuv,dataResolution,scale,noData);texel2=interpolatedScaledNoDataTexel(interpolation,dataTextureNext,tuv2,dataResolution,scale,noData);\n#else\ntexel1=interpolatedScaledTexel(interpolation,dataTexture,tuv,dataResolution,scale);texel2=interpolatedScaledTexel(interpolation,dataTextureNext,tuv2,dataResolution,scale);\n#endif\nvec4 texel=mix(texel1,texel2,dataMeld);"),Qs=zs("#ifdef NODATA\nvec4 tex=texture2D(dataTexture,tuv);float dd=sampleColorValue(tex,dataChannel[0]);if(dd==noData)discard;\n#endif\n"),Ks=zs("float value;vec2 velocity=vec2(0.);float angle=0.;\n#ifdef EXPRESSION_VECTOR\nfloat valueU=sampleColorValue(texel,dataChannel[0]);float valueV=sampleColorValue(texel,dataChannel[1]);vec2 vector=vec2(valueU,valueV);velocity=mix(vec2(dataRange.x),vec2(dataRange.y),vector);value=length(velocity)/dataRange.y;\n#ifdef IS_SYMBOL\nangle=atan(velocity.x,velocity.y);\n#else\nangle=atan(velocity.x,-velocity.y);\n#endif\nangle-=PI/2.;if(angle<0.)angle+=PI*2.;\n#else\n#ifdef EXPRESSION_ANGLE \nfloat deg=sampleColorValue(texel,dataChannel[0])*360.-180.;if(deg<0.)deg+=360.;float rad=deg*(PI/180.);float valueU=sin(rad);float valueV=cos(rad);vec2 vector=vec2(valueU,valueV);velocity=vector;value=0.1;\n#ifdef IS_SYMBOL\nangle=atan(velocity.x,velocity.y);\n#else\nangle=atan(velocity.x,-velocity.y);\n#endif\nangle-=PI/2.;if(angle<0.)angle+=PI*2.;\n#else\nvalue=sampleColorValue(texel,dataChannel[0]);\n#endif\n#endif\n#ifdef EXPRESSION_SUM\nfloat value2=sampleColorValue(texel,dataChannel[1]);float delta=(value+value2)*colorRangeFactor;value=delta+colorSampleOffset;\n#endif\n#ifdef EXPRESSION_DIFF\nfloat value2=sampleColorValue(texel,dataChannel[1]);float delta=(value-value2)*colorRangeFactor;value=delta+colorSampleOffset;\n#endif\n#ifdef NODATA\nvec2 mapFrom=outputRange;vec2 mapTo=vec2(0.,1.);\n#endif\n"),Js=zs("vec2 latLon=tileToLatLon(anchor.xy,tileCoord.z);float cameraToAnchorDistance=projectedAnchor.w;float distanceRatio=1.;\n#ifdef PITCH_WITH_MAP\ndistanceRatio=cameraToAnchorDistance/cameraToCenterDistance;\n#else\ndistanceRatio=cameraToCenterDistance/cameraToAnchorDistance;\n#endif\nfloat perspectiveRatio=clamp(0.5+0.5*distanceRatio,0.,4.);symbolScale*=perspectiveRatio;\n#ifdef SCALE_WITH_MAP\nsymbolScale*=mapPixelRatio;\n#endif\nvec2 glyphOffset=(glyph.xy+(position.xy-vec2(0.))*glyph.zw)*symbolScale;highp float symbolRotation=0.;\n#ifndef GLOBE\n#ifdef ROTATE_WITH_MAP\nvec4 offsetProjectedAnchor=projectionMatrix*modelViewMatrix*vec4(adjustedAnchor.xy+vec2(1.,0.),0.,1.);vec2 a=projectedAnchor.xy/projectedAnchor.w;vec2 b=offsetProjectedAnchor.xy/offsetProjectedAnchor.w;float aspectRatio=resolution.x/resolution.y;aspectRatio=mix(1.,aspectRatio,PI*0.333-pitch);symbolRotation=atan((b.y-a.y)/aspectRatio,b.x-a.x)*-1.;\n#endif \n#endif \nhighp float angleSin=sin(symbolAngle+symbolRotation);highp float angleCos=cos(symbolAngle+symbolRotation);mat2 rotationMatrix=mat2(angleCos,-angleSin,angleSin,angleCos);highp vec4 projectedPosition;\n#ifdef PITCH_WITH_MAP\nprojectedPosition=labelPlaneMatrix*vec4(anchor.xy+vec2(0.,0.),0.,1.);\n#else\nprojectedPosition=labelPlaneMatrix*projectedAnchor;\n#endif\nfloat z=0.;vec3 pointPosition=vec3(glyphOffset,0.);pointPosition.xy*=rotationMatrix;const vec4 AWAY=vec4(-1000.,-1000.,-1000.,1);float hidden=float(projectedAnchor.w>farZCutoff);float projectionScaling=1.;vec4 finalPosition;\n#ifdef GLOBE\n#if defined(ROTATE_WITH_MAP) || defined(PITCH_WITH_MAP)\nvec3 spherePosition=tileToECEF(anchor.xy,tileCoord,1.).xyz;float lat=asin(clamp(spherePosition.y,-1.,1.));float latScale=1./cos(lat);projectionScaling=mix(latScale*pitchedScale,projectionScaling,zoomTransition);\n#endif \nfinalPosition=mix(glCoordMatrix*vec4((projectedPosition.xyz/projectedPosition.w+pointPosition*projectionScaling),1.),AWAY,hidden);\n#else\nfinalPosition=mix(glCoordMatrix*vec4((projectedPosition.xy/projectedPosition.w+pointPosition.xy),z,1.),AWAY,hidden);\n#endif \n#ifdef PITCH_WITH_MAP\nfinalPosition=projectVertex(finalPosition.xy,tileCoord);\n#endif\ngl_Position=finalPosition;"),en=zs("uniform vec3 tileCoord;uniform vec3 dataCoord;uniform mat4 globeMatrix;uniform mat4 projMatrix;uniform mat3 gridMatrix;uniform mat4 tileMatrix;uniform mat4 mercatorMatrix;uniform vec2 mercatorCenter;uniform vec2 mapCenter;uniform float zoomTransition;uniform vec4 cutoffParams;uniform vec4 clippingPlane;uniform vec3 cameraPosition;uniform vec3 cameraUp;uniform float pixelRatio;float wrap(float n,float min,float max){float d=max-min;float w=mod(mod(n-min,d)+d,d)+min;return(w==min)?max:w;}float mercatorXfromLon(float lng){return(180.+lng)/360.;}float mercatorYfromLat(float lat){return(180.-(RAD_TO_DEG*log(tan(PI/4.+lat/2.*DEG_TO_RAD))))/360.;}float lonFromMercatorX(float x){return(x*360.)-180.;}float latFromMercatorY(float y){return atan(0.5*(exp(PI*(1.-2.*y))-exp(-PI*(1.-2.*y))))*180./PI;}float latitudeScale(vec2 latLon){float latitude=radians(latLon.y);float scale=1./cos(latitude);return clamp(scale,1.,4.);}float globeComputeClippingZ(vec3 spherePos){return(1.-(dot(spherePos,clippingPlane.xyz)+clippingPlane.w));}vec3 latLonToECEF(vec2 latLon,float radius){float lat=radians(latLon.y);float lon=radians(latLon.x);float cosLat=cos(lat);float sinLat=sin(lat);float cosLng=cos(lon);float sinLng=sin(lon);float sx=cosLat*sinLng*radius;float sy=sinLat*radius;float sz=cosLat*cosLng*radius;return vec3(sx,sy,sz);}vec2 tileToLatLon(vec2 tilePos,float zoom){float n=pow(2.,zoom);float lon=lonFromMercatorX(tilePos.x/n);float lat=latFromMercatorY(tilePos.y/n);return vec2(lon,lat);}vec3 tileToECEF(vec2 pos,vec3 tileCoord,float radius){vec2 tilePos=(pos.xy/EXTENT+tileCoord.xy);vec2 latLon=tileToLatLon(tilePos,tileCoord.z);return latLonToECEF(latLon.xy,radius);}vec3 tileToGlobePosition(vec2 pos,vec3 tileCoord){vec3 globePos=tileToECEF(pos,tileCoord,GLOBE_RADIUS);globePos.y*=-1.;globePos+=normalize(globePos)*GLOBE_UPSCALE;return globePos;}vec2 tileToMercatorPosition(vec2 pos,vec3 tileCoord){vec2 tilePos=(pos.xy/EXTENT+tileCoord.xy);vec2 latLon=tileToLatLon(tilePos,tileCoord.z);float mercatorY=mercatorYfromLat(latLon.y);float mercatorX=mercatorXfromLon(latLon.x);vec2 mercatorPos=vec2(mercatorX,mercatorY);return mercatorPos;}vec4 tileToWorldPosition(vec2 pos,vec3 tileCoord){vec4 worldPos;vec4 mercatorWorldPos=vec4(0.);\n#ifdef GLOBE\nvec3 globePos=tileToGlobePosition(pos,tileCoord);vec4 globeWorldPos=globeMatrix*vec4(globePos,1.);float w=1.;if(zoomTransition>0.){vec2 mercatorPos=tileToMercatorPosition(pos,tileCoord);mercatorWorldPos=vec4(mercatorPos,0.,1.);mercatorWorldPos.xy-=mercatorCenter;mercatorWorldPos.x=wrap(mercatorWorldPos.x,-0.5,0.5);mercatorWorldPos=mercatorMatrix*mercatorWorldPos;}vec4 interpolatedPos=vec4(mix(globeWorldPos.xyz,mercatorWorldPos.xyz,zoomTransition)*w,w);worldPos=projMatrix*interpolatedPos;\n#else\nvec2 mercatorPos=tileToMercatorPosition(pos,tileCoord);mercatorWorldPos=vec4(mercatorPos,0.,1.);mercatorWorldPos.xy-=mercatorCenter;mercatorWorldPos=mercatorMatrix*mercatorWorldPos;worldPos=projMatrix*vec4(mercatorWorldPos.xy,0.,1.);\n#endif\nreturn worldPos;}vec4 projectVertex(vec2 pos,vec3 tileCoord){vec4 viewPos=tileToWorldPosition(pos,tileCoord);\n#ifdef GLOBE\nvec3 globePos=tileToGlobePosition(pos,tileCoord);float clipZ=globeComputeClippingZ(normalize(globePos.xyz));viewPos.z=clipZ*viewPos.w;\n#endif\nreturn viewPos;}"),tn=zs("uniform mat4 modelViewMatrix;uniform mat4 viewMatrix;uniform mat4 modelMatrix;uniform mat4 worldMatrix;uniform mat4 projectionMatrix;uniform mat4 inverseViewMatrix;uniform mat4 labelPlaneMatrix;uniform mat4 glCoordMatrix;uniform float cameraToCenterDistance;uniform vec2 viewportSize;uniform float dpr;uniform float worldScale;uniform float fontSize;uniform float pixelToUnit;uniform float tilePixelRatio;uniform float mapPixelRatio;uniform float zoom;uniform float pitch;uniform float pitchedScale;uniform vec4 tileCoordOffset;uniform float farZCutoff;uniform vec2 resolution;"),rn="precision mediump float;<\n#defines>\n<\n#includes>\nattribute vec2 position;attribute vec2 uv;uniform mat4 modelViewMatrix;uniform mat4 viewMatrix;uniform mat4 modelMatrix;uniform mat4 projectionMatrix;varying vec2 vUv;\n#include <project_vertex>\nvoid main(){vUv=uv;\n#ifdef GLOBE\ngl_Position=projectVertex(position.xy*EXTENT,tileCoord);\n#else\ngl_Position=projectionMatrix*modelViewMatrix*vec4(position.xy,0.,1.);\n#endif\n}",an=zs(rn),sn=zs("precision mediump float;uniform float opacity;uniform sampler2D tOutput;varying vec2 vUv;void main(){vec4 color=texture2D(tOutput,vUv);gl_FragColor=vec4(floor(255.*color*opacity)/255.);}"),nn={dataTexture:{value:void 0}},on=zs("precision mediump float;<\n#defines>\n<\n#includes>\nattribute vec2 position;attribute vec2 uv;attribute vec2 anchor;attribute highp float radius;attribute highp vec2 fillColor;attribute highp vec2 strokeColor;attribute highp float strokeWidth;\n#include <symbol_uniforms>\nvarying vec2 vUv;varying vec2 vPosition;varying float vRadius;varying vec4 vFillColor;varying vec4 vStrokeColor;varying float vStrokeWidth;\n#include <encoding>\n#include <transform>\n#include <project_vertex>\nvec2 transform(const vec2 pos,const vec4 unitSize){vec2 scale=vec2(1./unitSize.z,1./unitSize.w);return vec2((pos.x*scale.x)-unitSize.x*scale.x,(pos.y*scale.y)-unitSize.y*scale.y);}void main(){highp vec2 adjustedAnchor=transform(anchor.xy,tileCoordOffset);vec4 projectedAnchor=projectVertex(anchor.xy,tileCoord);vec4 glyph=vec4(-radius*0.5,-radius*0.5,radius,radius);float symbolAngle=0.;float symbolScale=dpr*worldScale;vUv=uv;vRadius=radius;vFillColor=decode_color(fillColor);vStrokeColor=decode_color(strokeColor);vStrokeWidth=strokeWidth;vUv=vec2(uv.x,1.-uv.y);\n#include <symbol_vert_position>\n}"),ln=zs("#extension GL_OES_standard_derivatives : enable\nprecision mediump float;<\n#defines>\n<\n#includes>\nuniform vec2 resolution;uniform float dpr;uniform vec2 dataResolution;varying vec2 vUv;varying vec2 vPosition;varying float vRadius;varying vec4 vFillColor;varying vec4 vStrokeColor;varying float vStrokeWidth;void main(){vec2 pos=vUv;vec2 px=1./resolution;float ratio=px.x;if(pos.x<0.)discard;if(pos.y<0.)discard;if(pos.x>1.)discard;if(pos.y>1.)discard;float dist=length(2.*pos-1.);float aaf=0.008;float delta=fwidth(dist);float alpha=smoothstep(1.-delta,1.,dist);float inner=1.-(vRadius-vStrokeWidth)/vRadius;vec4 color=mix(vStrokeColor,vFillColor,smoothstep(inner-aaf,inner+aaf,1.-dist));color.a-=alpha;color.a=max(0.,color.a);color=mix(color,vec4(0.),alpha);vec4 preMultipliedColor=vec4(color.rgb*color.a,color.a);gl_FragColor=preMultipliedColor;}"),hn={},cn="precision mediump float;<\n#defines>\n<\n#includes>\nattribute vec3 position;attribute vec2 uv;uniform mat4 modelViewMatrix;uniform mat4 viewMatrix;uniform mat4 modelMatrix;uniform mat4 projectionMatrix;uniform vec4 dataCoordOffset;varying vec2 vUv;\n#include <project_vertex>\nvoid main(){vUv=uv;vUv=vec2(dataCoordOffset.x+(uv.x*dataCoordOffset.z),dataCoordOffset.y+(uv.y*dataCoordOffset.w));\n#ifdef GLOBE\nvec2 pos=position.xy*EXTENT;gl_Position=projectVertex(pos,tileCoord);\n#else\ngl_Position=projectionMatrix*modelViewMatrix*vec4(position,1.);\n#endif\n}",dn=zs(cn),un=zs("precision highp float;<\n#defines>\n<\n#includes>\nuniform int interpolation;uniform float smoothing;uniform float dataChannel[2];uniform vec2 dataResolution;uniform float dataMeld;uniform vec2 dataRange;uniform vec2 drawRange;uniform vec2 sampleDataRange;uniform vec2 outputRange;uniform float noData;uniform float colorScaleRes;uniform float colorRangeFactor;uniform float colorSampleOffset;uniform float opacity;uniform float edgePad;uniform float farZCutoff;uniform sampler2D dataTexture;uniform sampler2D dataTextureNext;uniform sampler2D colorScale;varying vec2 vUv;\n#include <color_lookup>\n#include <interpolated_texel>\nuniform ValueRange valueRange[VALUE_RANGE_COUNT];void main(){vec2 pos=vUv;vec2 px=1./dataResolution;vec2 tuv=vUv;vec2 tuv2=vUv;\n#include <skip_nodata>\n#include <get_texel>\n#include <get_data_value>\n#ifdef EXPRESSION_CUSTOM\nfloat value1=value;float value2=sampleColorValue(texel,dataChannel[1]);float dataValue1=sampleDataValue(valueRange[0],value1);float dataValue2=sampleDataValue(valueRange[1],value2);\n#include <custom_expression>\n#endif\nfloat dataValue=mix(sampleDataRange.x,sampleDataRange.y,value);\n#ifdef COLOR_LOOKUP\nif(dataValue<drawRange.x||dataValue>drawRange.y)discard;vec4 color=colorLookup(value,colorScaleRes,colorScale);\n#else\nvec4 color=vec4(dataValue,0.,0.,1.);\n#endif\ncolor.a*=opacity;\n#ifdef DEBUG_EDGE\ncolor=texture2D(dataTexture,vUv);float pad=edgePad;vec2 edgeCheck=step(px*pad,tuv)*step(tuv,1.-px*pad);color.a*=edgeCheck.x*edgeCheck.y*0.9+0.1;\n#endif\n#ifdef GLOBE\ncolor*=1.-step(farZCutoff,1./gl_FragCoord.w);\n#endif\ngl_FragColor=color;gl_FragColor.rgb*=gl_FragColor.a;}"),pn={dataTexture:{value:void 0},dataChannel:{value:0},interpolation:{value:0},smoothing:{value:0},opacity:{value:1}},fn=zs(cn),mn=zs("#extension GL_OES_standard_derivatives : enable\nprecision highp float;<\n#defines>\n<\n#includes>\nuniform int interpolation;uniform float smoothing;uniform float dataChannel[4];uniform vec2 dataResolution;uniform float dataMeld;uniform vec2 dataRange[4];uniform vec2 drawRange[4];uniform float colorScaleRes[4];uniform float colorMaskChannel[4];uniform float colorMaskValue[4];uniform float opacity;uniform float edgePad;uniform float farZCutoff;uniform sampler2D dataTexture;uniform sampler2D dataTextureNext;uniform sampler2D colorScale[4];varying vec2 vUv;\n#include <color_lookup>\n#include <interpolated_texel>\nfloat interval(float v,float i){return floor(((v+i/2.)/i)+0.5)*i;}void main(){vec2 tuv=vUv;vec2 tuv2=vUv;\n#include <skip_nodata>\n#include <get_texel>\n#include <get_data_value>\nvec4 color=vec4(0.);\n#if defined(COLOR_LOOKUP)\nvec4 mask=texel;float mask1=mask.r;float mask2=mask.g;float mask3=mask.b;float t=0.01;if(mask3>t){color=colorLookup(value,colorScaleRes[2],colorScale[2]);}else if(mask2>t){color=colorLookup(value,colorScaleRes[1],colorScale[1]);}else{color=colorLookup(value,colorScaleRes[0],colorScale[0]);}\n#else\ncolor=vec4(value,0.,0.,1.);\n#endif\n#ifdef GLOBE\ncolor*=1.-step(farZCutoff,1./gl_FragCoord.w);\n#endif\ncolor.a*=opacity;gl_FragColor=color;gl_FragColor.rgb*=gl_FragColor.a;}"),gn=zs(cn),vn=zs("precision mediump float;<\n#defines>\n<\n#includes>\nuniform float dataChannel[4];uniform float colorMaskChannel[4];uniform float colorMaskValue[4];uniform sampler2D dataTexture;varying vec2 vUv;\n#include <sample_color_value>\nvoid main(){vec4 texel=texture2D(dataTexture,vUv);float value=sampleColorValue(texel,dataChannel[0]);float mask1=sampleColorValue(texel,colorMaskChannel[0]);float mask2=sampleColorValue(texel,colorMaskChannel[1]);float mask3=sampleColorValue(texel,colorMaskChannel[2]);vec4 color=vec4(0.,0.,0.,value);if(mask1==colorMaskValue[0]){color.r=1.;}else if(mask2==colorMaskValue[1]){color.g=1.;}else if(mask3==colorMaskValue[2]){color.b=1.;}gl_FragColor=color;}"),yn=zs("precision mediump float;<\n#defines>\n<\n#includes>\nattribute vec3 position;attribute vec2 uv;uniform mat4 modelViewMatrix;uniform mat4 viewMatrix;uniform mat4 modelMatrix;uniform mat4 projectionMatrix;uniform vec4 dataCoordOffset;varying vec2 vUv;\n#include <project_vertex>\nvoid main(){vUv=uv;vUv=vec2(dataCoordOffset.x+(uv.x*dataCoordOffset.z),dataCoordOffset.y+(uv.y*dataCoordOffset.w));\n#ifdef GLOBE\nvec2 pos=position.xy*EXTENT;gl_Position=projectVertex(pos,tileCoord);\n#else\ngl_Position=projectionMatrix*modelViewMatrix*vec4(position,1.);\n#endif\n}"),xn=zs("#extension GL_OES_standard_derivatives : enable\nprecision highp float;<\n#defines>\n<\n#includes>\nuniform float opacity;uniform vec2 resolution;uniform int interpolation;uniform float smoothing;uniform vec2 dataResolution;uniform float dataMeld;uniform vec2 dataRange;uniform vec2 drawRange;uniform vec2 outputRange;uniform float noData;uniform float dataChannel[2];uniform float colorScaleRes;uniform float valueInterval;uniform float majorValueInterval;uniform float width;uniform float majorWidth;uniform float valueScale;uniform float valueOffset;uniform float farZCutoff;uniform sampler2D dataTexture;uniform sampler2D dataTextureNext;uniform sampler2D colorScale;varying vec2 vUv;\n#include <color_lookup>\n#include <interpolated_texel>\nfloat contourFunction(float parameter,float lineWidth,float lineFeather){float f=parameter*2.;float w1=lineWidth-lineFeather*0.5;float d=length(vec2(dFdx(f),dFdy(f)));float looped=0.5-abs(mod(f,1.)-0.5);return smoothstep(d*w1,d*(w1+lineFeather),looped);}void main(){vec2 pos=vUv;vec4 color=vec4(vec3(0.),1.);float dmin=dataRange.x;float dmax=dataRange.y;float drange=abs(dmax-dmin);vec2 uv=vUv;vec2 px=1./resolution.xy;vec2 tuv=vUv;vec2 tuv2=vUv;\n#include <skip_nodata>\n#include <get_texel>\n#include <get_data_value>\n#ifdef EXPRESSION_VECTOR\ndmin=0.;drange=dmax;\n#endif\nvec4 pallete=vec4(vec3(0.),1.);\n#ifdef COLOR_LOOKUP\npallete=colorLookup(value,colorScaleRes,colorScale);\n#endif\nfloat dataValue=value;float contourInterval=valueInterval;float majorContourInterval=majorValueInterval;float lineThickness=width;float majorLineThickness=majorWidth;float lineFeather=1.;float valueRange=dmax-dmin;float normalizedValue=dataValue;float normalizedContourInterval=contourInterval/valueRange;float normalizedMajorInterval=majorContourInterval/valueRange;float offset=mod(dmin,contourInterval)/valueRange;float correctedValue=normalizedValue-offset;int stepIndex=int(correctedValue/normalizedContourInterval);float exactContourValue=float(stepIndex)*normalizedContourInterval;float distanceToExactContour=abs(correctedValue-exactContourValue);bool isMajorContour=mod(float(stepIndex)*contourInterval,majorContourInterval)<0.5&&distanceToExactContour<0.001;float thickness=isMajorContour?majorLineThickness:lineThickness;float contourMask=contourFunction(correctedValue/normalizedContourInterval,thickness,lineFeather);color=mix(vec4(0.),pallete,1.-contourMask);\n#ifdef GLOBE\ncolor*=1.-step(farZCutoff,1./gl_FragCoord.w);\n#endif\ngl_FragColor=color*opacity;}"),bn={opacity:{value:1}},wn=zs(rn),_n=zs("precision mediump float;<\n#defines>\n<\n#includes>\nuniform vec4 color;uniform float farZCutoff;uniform sampler2D tOutput;uniform sampler2D tMask;varying vec2 vUv;void main(){vec4 c=color;\n#ifdef GLOBE\nc*=1.-step(farZCutoff,1./gl_FragCoord.w);\n#endif\ngl_FragColor=c;}"),An={},Mn=zs("precision highp float;<\n#defines>\n<\n#includes>\nattribute vec2 position;attribute vec2 uv;attribute vec2 color;uniform mat4 modelViewMatrix;uniform mat4 viewMatrix;uniform mat4 modelMatrix;uniform mat4 projectionMatrix;uniform vec2 resolution;uniform vec4 tileCoordOffset;varying vec2 vPosition;varying vec4 vColor;varying vec2 vPos;\n#include <encoding>\n#include <project_vertex>\nvec2 transform(const vec2 pos,const vec4 offset){vec2 scale=vec2(1./offset.z,1./offset.w);return vec2((pos.x*scale.x)-offset.x*scale.x,(pos.y*scale.y)-offset.y*scale.y);}void main(){vec2 pos=position/EXTENT;\n#ifdef GLOBE\ngl_Position=projectVertex(pos*EXTENT,tileCoord);\n#else\npos=transform(position/EXTENT,tileCoordOffset);gl_Position=projectionMatrix*modelViewMatrix*vec4(pos.xy,0.,1.);\n#endif\nvPosition=pos;vColor=decode_color(color);vPos=(gl_Position.xy/gl_Position.w+1.)/2.*resolution*gl_Position.w;}"),Tn=zs("#ifdef GL_OES_standard_derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nprecision highp float;<\n#defines>\n<\n#includes>\nuniform vec4 dataCoordOffset;uniform float farZCutoff;varying vec2 vPosition;varying vec4 vColor;varying vec2 vPos;void main(){vec2 pos=vPosition;vec2 min=vec2(dataCoordOffset.x,dataCoordOffset.y);vec2 max=vec2(min.x+pos.x*dataCoordOffset.z,min.y+pos.y*dataCoordOffset.w);if(pos.x<0.)discard;if(pos.y<0.)discard;if(pos.x>1.)discard;if(pos.y>1.)discard;vec4 color=vColor;\n#ifdef GLOBE\ncolor*=1.-step(farZCutoff,1./gl_FragCoord.w);\n#endif\nvec4 preMultipliedColor=vec4(color.rgb*color.a,color.a);gl_FragColor=preMultipliedColor;}"),En={},Sn=zs("precision mediump float;<\n#defines>\n<\n#includes>\nattribute vec2 position;attribute vec2 uv;attribute vec2 anchor;attribute vec4 glyph;attribute float reference;attribute vec2 gridPosition;attribute highp vec2 fillColor;attribute highp vec2 strokeColor;attribute highp float strokeWidth;attribute vec4 texCoordOffset;attribute float size;attribute float opacity;attribute float rotation;\n#include <symbol_uniforms>\nuniform int interpolation;uniform float smoothing;uniform float dataChannel[2];uniform vec2 dataResolution;uniform vec4 dataCoordOffset;uniform float dataMeld;uniform vec2 dataRange;uniform vec2 outputRange;uniform float noData;uniform sampler2D dataTexture;uniform sampler2D dataTextureNext;\n#ifdef USE_ATLAS\nuniform sampler2D tAtlas;uniform vec2 atlasRes;uniform float atlasColumns;uniform float atlasRows;uniform float atlasInterval;uniform vec2 atlasGlyphSize;\n#endif\nvarying vec2 vUv;varying vec2 vPosition;varying vec4 vColor;varying vec4 vStrokeColor;varying float vStrokeWidth;varying float vOpacity;varying float vSpeed;varying float vSpeedRatio;varying float vSize;varying float vRotation;varying vec2 vTuv;varying vec2 vData;\n#include <encoding>\n#include <transform>\n#include <interpolated_texel>\n#include <project_vertex>\nvec2 transform(const vec2 pos,const vec4 unitSize){vec2 scale=vec2(1./unitSize.z,1./unitSize.w);return vec2((pos.x*scale.x)-unitSize.x*scale.x,(pos.y*scale.y)-unitSize.y*scale.y);}vec2 transform2(const vec2 uv,const vec4 offset){return vec2(offset.x+(uv.x*offset.z),offset.y+(uv.y*offset.w));}\n#define MAX_SKIP 2.0\nvoid main(){vec2 adjustedAnchor=transform(anchor.xy/EXTENT,tileCoordOffset);vec4 projectedAnchor=projectionMatrix*modelViewMatrix*vec4(adjustedAnchor.xy,0.,1.);\n#ifdef GLOBE\nprojectedAnchor=projectVertex(anchor.xy,tileCoord);\n#endif\nfloat symbolScale=worldScale;vec2 tuv=vec2(dataCoordOffset.x+(adjustedAnchor.x*dataCoordOffset.z),dataCoordOffset.y+(adjustedAnchor.y*dataCoordOffset.w));vec2 tuv2=tuv;\n#include <get_texel>\n#include <get_data_value>\nangle+=rotation;float symbolAngle=angle;vUv=vec2(texCoordOffset.x+(uv.x*texCoordOffset.z),texCoordOffset.y+(uv.y*texCoordOffset.w));vRotation=angle;vSpeed=length(dataRange.y)*value;vSpeedRatio=value;vSize=value*0.5;vTuv=tuv;vColor=decode_color(fillColor);vStrokeColor=decode_color(strokeColor);vStrokeWidth=strokeWidth;vOpacity=opacity;vPosition=position;\n#ifdef NODATA\nvec4 tex=texture2D(dataTexture,tuv);float dd=sampleColorValue(tex,dataChannel[0]);float edge=isEdge(dataTexture,tuv,dataResolution,noData,dataChannel[0]);if(dd==noData)vSpeed=-1.;if(edge==1.)vSpeed=-1.;\n#endif\n#ifdef USE_ATLAS\nvec2 glyphSize=vec2(1./atlasColumns,1./atlasRows);float v=length(dataRange.y)*value;float vi=floor(v/atlasInterval);float gc=fract(vi/atlasColumns)*atlasColumns;float gr=floor(vi/atlasColumns);vec2 atlasPos=vec2(gc*glyphSize.x,gr*glyphSize.y);vUv=transform2(uv,vec4(atlasPos.x,atlasPos.y,glyphSize.x,glyphSize.y));\n#endif\n#include <symbol_vert_position>\nfloat gammaScale=finalPosition.w;vData=vec2(gammaScale,size);}"),Cn=zs("precision mediump float;<\n#defines>\n<\n#includes>\nuniform float dpr;\n#ifdef COLOR_LOOKUP\nuniform sampler2D colorScale;uniform float colorScaleRes;\n#else\nuniform vec4 fillColor;uniform vec4 strokeColor;\n#endif\nvarying vec2 vUv;varying float vSpeed;varying float vSpeedRatio;varying float vSize;varying float vRotation;varying float vOpacity;varying vec2 vTuv;\n#include <color_lookup>\n#include <sdf_draw>\n#include <sdf_arrows>\nvoid main(){if(vSpeed<0.)discard;vec2 pos=vUv-vec2(0.,0.5);float bodySize=mix(0.3,2.,vSize);float headSize=0.1;float lineWidth=mix(0.18,0.12,vSize);float height=1.;vec4 fill=vec4(1.);vec4 stroke=vec4(0.,0.,0.,1.);vec4 color;\n#ifdef COLOR_LOOKUP\nfill=colorLookup(vSpeedRatio,colorScaleRes,colorScale);\n#else\nfill=fillColor;stroke=strokeColor;\n#endif\nif(vSpeed>=1.){float d=arrow_stealth(pos.xy,bodySize,headSize,height,lineWidth,1.);color=filled(d,0.15,0.01,fill);}else{float d=disc(pos,0.15);color=filled(d,0.01,0.01,fill);}gl_FragColor=color;gl_FragColor.a=vOpacity*color.a;gl_FragColor.rgb*=gl_FragColor.a;}"),On={dimensions:{value:new _i(10,10)}},Rn="precision mediump float;<\n#defines>\n<\n#includes>\nattribute vec2 position;attribute vec2 uv;attribute vec2 anchor;attribute vec4 glyph;attribute highp vec2 fillColor;attribute highp vec2 strokeColor;attribute highp float strokeWidth;attribute vec4 texCoordOffset;attribute float opacity;attribute float size;attribute float rotation;attribute float factor;attribute float random;\n#include <symbol_uniforms>\nuniform float time;varying vec2 vUv;varying vec2 vPosition;varying vec4 vColor;varying vec4 vStrokeColor;varying float vStrokeWidth;varying float vSize;varying float vOpacity;varying float vFactor;varying float vRandom;varying vec2 vData;\n#include <encoding>\n#include <transform>\n#include <project_vertex>\nvec2 transform(const vec2 pos,const vec4 unitSize){vec2 scale=vec2(1./unitSize.z,1./unitSize.w);return vec2((pos.x*scale.x)-unitSize.x*scale.x,(pos.y*scale.y)-unitSize.y*scale.y);}void main(){highp vec2 adjustedAnchor=transform(anchor.xy/EXTENT,tileCoordOffset);highp vec4 projectedAnchor=projectionMatrix*modelViewMatrix*vec4(adjustedAnchor.xy,0.,1.);\n#ifdef GLOBE\nprojectedAnchor=projectVertex(anchor.xy,tileCoord);\n#endif\nfloat symbolAngle=rotation;float symbolScale=worldScale;vUv=vec2(texCoordOffset.x+(uv.x*texCoordOffset.z),texCoordOffset.y+(uv.y*texCoordOffset.w));vOpacity=opacity;vSize=size;vFactor=factor;vRandom=random;vColor=decode_color(fillColor);vStrokeColor=decode_color(strokeColor);vStrokeWidth=strokeWidth;\n#include <symbol_vert_position>\nfloat gammaScale=finalPosition.w;vData=vec2(gammaScale,size);}",In=zs(Rn),Pn=zs("precision mediump float;<\n#defines>\n<\n#includes>\n#define SDF_RADIUS_PX 8.0\n#define SDF_THRESHOLD 192.0 / 256.0\nuniform sampler2D tAtlas;uniform float dpr;uniform bool isHalo;\n#ifdef COLOR_LOOKUP\nuniform sampler2D colorScale;uniform float colorScaleRes;\n#endif\nvarying vec2 vUv;varying vec4 vColor;varying vec4 vStrokeColor;varying float vSize;varying float vStrokeWidth;varying float vSpeedRatio;varying float vOpacity;varying vec2 vData;varying vec2 vPosition;\n#include <color_lookup>\nvoid main(){float haloWidth=vStrokeWidth;float haloBlur=0.;float EDGE_GAMMA=0.105/dpr;float gammaScale=vData.x;float scale=vData.y*dpr;float dist=texture2D(tAtlas,vUv).r;float aa=fwidth(dist);float innerEdge=0.8;float gamma=EDGE_GAMMA/(scale*gammaScale);float gammaScaled=gamma*gammaScale;vec4 color=vColor;\n#ifdef COLOR_LOOKUP\nif(!isHalo){color=colorLookup(vSpeedRatio,colorScaleRes,colorScale);}\n#endif\nfloat alpha=0.;if(isHalo){color=vStrokeColor;float haloEdge=(6.-haloWidth/scale)/SDF_RADIUS_PX;float alphaHalo=smoothstep(haloEdge-aa,haloEdge+aa,dist);float alphaInner=smoothstep(innerEdge-aa,innerEdge+aa,dist);alpha=min(alphaHalo,1.-alphaInner);}else{alpha=smoothstep(innerEdge-aa,innerEdge+aa,dist);}color*=(alpha*vOpacity);gl_FragColor=color;}"),Dn={},zn=Object.assign(Object.assign({},u),{fragmentShader:Pn}),Ln=zs("precision mediump float;attribute vec3 position;attribute vec2 uv;uniform mat4 modelViewMatrix;uniform mat4 viewMatrix;uniform mat4 modelMatrix;uniform mat4 projectionMatrix;varying vec2 vUv;void main(){vUv=uv;gl_Position=projectionMatrix*modelViewMatrix*vec4(position,1.);}"),kn=zs("precision mediump float;<\n#defines>\n<\n#includes>\nuniform sampler2D dataTexture;uniform sampler2D colorScale;uniform float colorScaleRes;uniform float opacity;varying vec2 vUv;\n#include <color_lookup>\nvoid main(){vec4 texel=texture2D(dataTexture,vUv);vec4 color=colorLookup(texel.a,colorScaleRes,colorScale);gl_FragColor=color;gl_FragColor=vec4(floor(255.*color*opacity)/255.);}"),Fn={opacity:{value:1}},jn=zs("#extension GL_OES_standard_derivatives : enable\nprecision mediump float;<\n#defines>\n<\n#includes>\nuniform float intensity;uniform float blur;uniform float weight;uniform vec4 tileCoordOffset;varying vec2 vUv;varying vec2 vPosition;void main(){vec2 pos=vUv;float dist=length(2.*pos-1.);vec2 maxPosition=vec2(tileCoordOffset.x+(vPosition.x*tileCoordOffset.z),tileCoordOffset.y+(vPosition.y*tileCoordOffset.w));if(vPosition.x<maxPosition.x||vPosition.y<maxPosition.y)discard;if(dist>=1.)discard;float alpha=(intensity*weight)*blur*(1.-sqrt(dist));vec4 color=vec4(0.,0.,0.,alpha);gl_FragColor=color;gl_FragColor.rgb*=gl_FragColor.a;}"),Nn={pointSize:{value:20},intensity:{value:10},blur:{value:1},weight:{value:20}},Vn=zs("precision highp float;<\n#defines>\n<\n#includes>\nattribute vec2 position;attribute vec2 pA,pB,pC,pD;attribute vec2 uv;attribute vec2 color;attribute float segments;attribute float terminal;uniform mat4 modelViewMatrix;uniform mat4 projectionMatrix;uniform mat4 viewMatrix;uniform mat3 normalMatrix;uniform vec2 resolution;uniform vec4 tileCoordOffset;uniform float dpr;uniform float pixelToUnitScaled;uniform float lineWidth;uniform float opacity;uniform float sizeAttenuation;varying vec2 vUV;varying vec2 vPosition;varying vec4 vColor;\n#include <encoding>\n#include <project_vertex>\nvec2 transform(const vec2 pos,const vec4 offset){vec2 scale=vec2(1./offset.z,1./offset.w);return vec2((pos.x*scale.x)-offset.x*scale.x,(pos.y*scale.y)-offset.y*scale.y);}void main(){float scale=tileCoordOffset.z;float aspect=resolution.x/resolution.y;float width=lineWidth*pixelToUnitScaled;vec2 finalPosition=position;vColor=decode_color(color);vec2 p0=pA/EXTENT;vec2 p1=pA/EXTENT;vec2 p2=pB/EXTENT;vec2 p3=pB/EXTENT;\n#ifdef LINE_ALPHA\np0=pA;p1=pB;p2=pC;vec2 pos=position;if(position.x==1.){p0=pD;p1=pC;p2=pB;pos=vec2(1.-position.x,-position.y);}vec2 tangent=normalize(normalize(p2-p1)+normalize(p1-p0));vec2 normal=vec2(-tangent.y,tangent.x);vec2 p01=p1-p0;vec2 p21=p1-p2;vec2 p01Norm=normalize(vec2(-p01.y,p01.x));float sigma=sign(dot(p01+p21,normal));if(sign(pos.y)==-sigma&&segments>1.){float dist01=distance(p1,p0);float adjustedWidth=min(width,dist01);vec2 point=0.5*normal*-sigma*adjustedWidth/dot(normal,p01Norm);finalPosition=p1+point;}else{vec2 xBasis=p2-p1;vec2 yBasis=normalize(vec2(-xBasis.y,xBasis.x));vec2 point=p1+xBasis*pos.x+yBasis*width*pos.y;finalPosition=point;}\n#else\nvec2 xBasis=p2-p1;vec2 yBasis=normalize(vec2(-xBasis.y,xBasis.x));vec2 point=p1+xBasis*position.x+yBasis*width*position.y;finalPosition=point;\n#endif\nif(p2.x==p1.x&&(p1.x<0.||p1.x>1.))finalPosition.x=p1.x;if(p2.y==p1.y&&(p1.y<0.||p1.y>1.))finalPosition.y=p1.y;\n#ifdef GLOBE\ngl_Position=projectVertex(finalPosition*EXTENT,tileCoord);\n#else\nfinalPosition=transform(finalPosition,tileCoordOffset);gl_Position=projectionMatrix*modelViewMatrix*vec4(finalPosition.xy,0.,1.);\n#endif\nvPosition=finalPosition;}"),Bn=zs("precision highp float;<\n#defines>\n<\n#includes>\nuniform sampler2D map;uniform sampler2D alphaMap;uniform float opacity;uniform float useMap;uniform float useAlphaMap;uniform float useDash;uniform float dashArray;uniform float dashOffset;uniform float dashRatio;uniform float visibility;uniform float alphaTest;uniform vec2 repeat;uniform float farZCutoff;varying vec2 vUV;varying vec2 vPosition;varying vec4 vColor;void main(){vec4 color=vColor;vec2 pos=vPosition;if(pos.x<0.||pos.y<0.||pos.x>1.||pos.y>1.)discard;color.a*=opacity;\n#ifdef GLOBE\ncolor*=1.-step(farZCutoff,1./gl_FragCoord.w);\n#endif\ngl_FragColor=color;gl_FragColor.rgb*=gl_FragColor.a;}"),Un={lineWidth:{value:2},useMap:{value:0},useAlphaMap:{value:0},color:{value:xr("#000000")},opacity:{value:1},sizeAttenuation:{value:0},dashArray:{value:0},dashOffset:{value:0},dashRatio:{value:0},useDash:{value:0},visibility:{value:1},alphaTest:{value:0},repeat:{value:new _i(1,1)}},$n=zs("precision highp float;<\n#defines>\n<\n#includes>\nattribute vec4 position;attribute vec2 pA,pB;attribute vec2 uv;attribute vec2 color;uniform mat4 modelViewMatrix;uniform mat4 projectionMatrix;uniform mat4 viewMatrix;uniform mat3 normalMatrix;uniform vec2 resolution;uniform vec4 tileCoordOffset;uniform float dpr;uniform float pixelToUnitScaled;uniform float lineWidth;uniform float opacity;uniform float sizeAttenuation;varying vec2 vUV;varying vec2 vPosition;varying vec4 vColor;varying float vCounters;\n#include <encoding>\n#include <project_vertex>\nvec2 transform(const vec2 pos,const vec4 offset){vec2 scale=vec2(1./offset.z,1./offset.w);return vec2((pos.x*scale.x)-offset.x*scale.x,(pos.y*scale.y)-offset.y*scale.y);}void main(){float scale=tileCoordOffset.z;float width=lineWidth*pixelToUnitScaled;vec2 p0=pA/EXTENT;vec2 p1=pB/EXTENT;vec2 xBasis=normalize(p0-p1);vec2 yBasis=vec2(-xBasis.y,xBasis.x);vec2 finalPosition=p0+xBasis*width*position.x+yBasis*width*position.y;\n#ifdef GLOBE\ngl_Position=projectVertex(finalPosition*EXTENT,tileCoord);\n#else\nfinalPosition=transform(finalPosition,tileCoordOffset);gl_Position=projectionMatrix*modelViewMatrix*vec4(finalPosition.xy,0.,1.);\n#endif\nvColor=decode_color(color);vPosition=finalPosition;}"),Gn=zs("precision highp float;<\n#defines>\n<\n#includes>\nattribute vec4 position;attribute float id;attribute vec2 pA,pB,pC;attribute vec2 uv;attribute vec2 color;uniform mat4 modelViewMatrix;uniform mat4 projectionMatrix;uniform mat4 viewMatrix;uniform mat3 normalMatrix;uniform vec2 resolution;uniform vec4 tileCoordOffset;uniform float dpr;uniform float pixelToUnitScaled;uniform float lineWidth;uniform float opacity;uniform float sizeAttenuation;varying vec2 vUV;varying vec2 vPosition;varying vec4 vColor;varying float vCounters;\n#include <encoding>\n#include <project_vertex>\nvec2 transform(const vec2 pos,const vec4 offset){vec2 scale=vec2(1./offset.z,1./offset.w);return vec2((pos.x*scale.x)-offset.x*scale.x,(pos.y*scale.y)-offset.y*scale.y);}void main(){float scale=tileCoordOffset.z;float joinResolution=12.;float width=lineWidth*pixelToUnitScaled;vec2 p0=pA/EXTENT;vec2 p1=pB/EXTENT;vec2 p2=pC/EXTENT;vec2 p3;vColor=vec4(0.,1.,0.,1.);vColor=decode_color(color);vec2 xBasis=normalize(normalize(p2-p1)+normalize(p1-p0));vec2 yBasis=vec2(-xBasis.y,xBasis.x);vec2 tangent=normalize(normalize(p2-p1)+normalize(p1-p0));vec2 normal=vec2(-tangent.y,tangent.x);vec2 ab=p1-p0;vec2 cb=p1-p2;vec2 abNorm=normalize(vec2(-ab.y,ab.x));vec2 cbNorm=-normalize(vec2(-cb.y,cb.x));float sigma=sign(dot(ab+cb,normal));vec2 finalPosition;\n#ifdef LINE_ALPHA\n#ifdef JOIN_MITER\np0=0.5*width*sigma*(sigma<0.?abNorm:cbNorm);p1=0.5*normal*sigma*width/dot(normal,abNorm);p2=0.5*width*sigma*(sigma<0.?cbNorm:abNorm);p3=-0.5*normal*sigma*width/dot(normal,abNorm);finalPosition=p1+position.x*p0+position.y*p1+position.z*p2+position.w*p3;\n#else \n#ifdef JOIN_ROUND\nif(id==0.){finalPosition=p1+-0.5*yBasis*sigma*width/dot(yBasis,abNorm);}else{float theta=acos(dot(abNorm,cbNorm));sigma=sign(dot(ab+cb,yBasis));theta=(sigma*0.5*${Math.PI})+-0.5*theta+theta*(id-1.)/joinResolution;vec2 pos=0.5*width*vec2(cos(theta),sin(theta));finalPosition=p1+xBasis*pos.x+yBasis*pos.y;}\n#else \np0=0.5*width*sigma*(sigma<0.?abNorm:cbNorm);p1=0.5*width*sigma*(sigma<0.?cbNorm:abNorm);p2=-0.5*normal*sigma*width/dot(normal,abNorm);finalPosition=p1+position.x*p0+position.y*p1+position.z*p2;\n#endif\n#endif\n#else \n#ifdef JOIN_MITER\np0=0.5*width*sigma*(sigma<0.?abNorm:cbNorm);p1=0.5*normal*sigma*width/dot(normal,abNorm);p2=0.5*width*sigma*(sigma<0.?cbNorm:abNorm);float miterLength=1./dot(normal,abNorm);float miterLimit=2.;if(miterLength>miterLimit){p1=0.5*width*sigma*(sigma<0.?cbNorm:abNorm);p2=p1;}finalPosition=p1+position.x*p0+position.y*p1+position.z*p2;\n#else\n#ifdef JOIN_ROUND\nfinalPosition=width*position.xy+p0;\n#else\np0=0.5*width*sigma*(sigma<0.?abNorm:cbNorm);p1=0.5*width*sigma*(sigma<0.?cbNorm:abNorm);p2=-0.5*normal*sigma*width/dot(normal,abNorm);finalPosition=p1+position.x*p0+position.y*p1+position.z*p2;\n#endif \n#endif \n#endif \n#ifdef GLOBE\ngl_Position=projectVertex(finalPosition*EXTENT,tileCoord);\n#else\nfinalPosition=transform(finalPosition,tileCoordOffset);gl_Position=projectionMatrix*modelViewMatrix*vec4(finalPosition.xy,0.,1.);\n#endif\nvPosition=finalPosition;}"),qn=zs("precision highp float;<\n#defines>\n<\n#includes>\nattribute vec2 position;attribute vec2 pA,pB,pC;attribute vec2 uv;attribute vec2 color;uniform mat4 modelViewMatrix;uniform mat4 projectionMatrix;uniform mat4 viewMatrix;uniform mat3 normalMatrix;uniform vec2 resolution;uniform vec4 tileCoordOffset;uniform float dpr;uniform float pixelToUnitScaled;uniform float lineWidth;uniform float opacity;uniform float sizeAttenuation;varying vec2 vUV;varying vec2 vPosition;varying vec4 vColor;varying float vCounters;\n#include <encoding>\n#include <project_vertex>\nvec2 transform(const vec2 pos,const vec4 offset){vec2 scale=vec2(1./offset.z,1./offset.w);return vec2((pos.x*scale.x)-offset.x*scale.x,(pos.y*scale.y)-offset.y*scale.y);}void main(){float scale=tileCoordOffset.z;float width=lineWidth*pixelToUnitScaled;vec2 p0=pA/EXTENT;vec2 p1=pB/EXTENT;vec2 p2=pC/EXTENT;vColor=vec4(1.,0.,0.,1.);if(position.x==0.){vec2 xBasis=p1-p0;vec2 yBasis=normalize(vec2(-xBasis.y,xBasis.x));vec2 finalPosition=p0+xBasis*position.x+yBasis*width*position.y;finalPosition=transform(finalPosition,tileCoordOffset);gl_Position=projectionMatrix*modelViewMatrix*vec4(finalPosition.xy,0.,1.);return;}vec2 tangent=normalize(normalize(p2-p1)+normalize(p1-p0));vec2 normal=vec2(-tangent.y,tangent.x);vec2 ab=p1-p0;vec2 cb=p1-p2;vec2 abNorm=normalize(vec2(-ab.y,ab.x));float sigma=sign(dot(ab+cb,normal));vec2 finalPosition;if(sign(position.y)==-sigma){vec2 position=0.5*normal*-sigma*width/dot(normal,abNorm);finalPosition=p1+position;}else{vec2 xBasis=p1-p0;vec2 yBasis=normalize(vec2(-xBasis.y,xBasis.x));vec2 point=p0+xBasis*position.x+yBasis*width*position.y;finalPosition=point;}\n#ifdef GLOBE\ngl_Position=projectVertex(finalPosition*EXTENT,tileCoord);\n#else\nfinalPosition=transform(finalPosition,tileCoordOffset);gl_Position=projectionMatrix*modelViewMatrix*vec4(finalPosition.xy,0.,1.);\n#endif\nvPosition=finalPosition;}"),Wn=zs("precision highp float;<\n#defines>\n<\n#includes>\nattribute vec2 position;attribute vec2 uv;attribute float particleIndex;attribute vec2 reference;attribute float random;uniform sampler2D particles;uniform sampler2D tPositionX;uniform sampler2D tPositionY;uniform sampler2D tAlpha;uniform vec2 particleSize;uniform mat4 dataMatrix;\n#include <symbol_uniforms>\nvarying vec2 vUv;varying vec2 vParticlePos;varying vec4 vColor;varying float vAlpha;varying float vRotation;varying float vSpeed;varying float vDegrees;varying float vDepth;vec2 transformData(vec2 pos,mat4 matrix){vec4 transformed=matrix*vec4(pos.xy,1.,1.);return transformed.xy/transformed.w;}\n#include <decode_float_rgba>\n#include <transform>\n#include <project_vertex>\nvoid main(){vec2 fuv=reference;vec2 anchor=vec2(decodeFloatRGBA(texture2D(tPositionX,fuv)),decodeFloatRGBA(texture2D(tPositionY,fuv)));anchor=transformData(anchor,dataMatrix);vec2 pos=anchor;vec4 state=texture2D(tAlpha,fuv);highp vec2 adjustedAnchor=anchor;highp vec4 projectedAnchor=projectionMatrix*modelViewMatrix*vec4(anchor,0.,1.);anchor*=EXTENT;\n#ifdef GLOBE\nprojectedAnchor=projectVertex(anchor.xy,tileCoord);\n#endif\nvec2 size=particleSize;vec4 glyph=vec4(-size.x*0.5,-size.y*0.5,size.x,size.y);float angle=0.;float deg=state.g*360.;float rad=deg*(PI/180.);float valueU=sin(rad);float valueV=cos(rad);vec2 vector=vec2(valueU,valueV);vec2 velocity=vector;\n#ifdef EXPRESSION_ANGLE\nangle=atan(velocity.x,-velocity.y);\n#else\nangle=atan(velocity.x,-velocity.y);\n#endif\nangle-=PI/2.;\n#ifdef STYLE_ARROW\nangle-=PI/2.;\n#endif\nif(angle<0.)angle+=PI*2.;float symbolScale=1.;float symbolAngle=angle;\n#include <symbol_vert_position>\n#ifdef GLOBE\nvec2 tilePos=(pos.xy+tileCoord.xy);vec2 posLatLon=tileToLatLon(tilePos,tileCoord.z);float latAbs=abs(posLatLon.y);float densityScale=1.;float threshold=50.;if(latAbs>threshold){float normLat=(latAbs-threshold)/(90.-threshold);float latRad=normLat*(PI/2.);densityScale=clamp(pow(cos(latRad),3.),0.,1.);densityScale=mix(densityScale,1.,zoomTransition);if(random>densityScale){gl_Position.z=-10000.;}}\n#endif\nvUv=uv;vAlpha=state.r;vRotation=state.g;vSpeed=state.a==0.?-1.:state.b;vParticlePos=pos;vDegrees=deg;vDepth=projectedAnchor.w;}"),Hn=zs("precision highp float;<\n#defines>\n<\n#includes>\nuniform float opacity;uniform int interpolation;uniform float smoothing;uniform float dataChannel[2];uniform vec2 dataResolution;uniform vec4 dataCoordOffset;uniform mat4 dataMatrix;uniform float dataMeld;uniform vec2 dataMin;uniform vec2 dataMax;uniform vec2 dataRange;uniform vec2 drawRange;uniform vec2 sampleDataRange;uniform vec2 outputRange;uniform float noData;uniform float colorScaleRes;uniform float farZCutoff;uniform sampler2D dataTexture;uniform sampler2D dataTextureNext;uniform sampler2D colorScale;varying vec2 vUv;varying vec2 vParticlePos;varying float vAlpha;varying float vRotation;varying float vSpeed;varying float vDegrees;varying float vDepth;\n#include <texture_lookup_3x3>\n#include <color_lookup>\n#include <interpolated_texel>\n#include <transform>\n#include <sdf_draw>\n#include <sdf_arrows>\n#include <project_vertex>\nvec2 transformData(vec2 pos,mat4 matrix){vec4 transformed=matrix*vec4(pos.xy,1.,1.);return transformed.xy/transformed.w;}void main(){vec2 pos=vParticlePos;vec2 uv=pos;uv=vec2(dataCoordOffset.x+(uv.x*dataCoordOffset.z),dataCoordOffset.y+(uv.y*dataCoordOffset.w));if(vSpeed<0.)discard;vec2 tuv=uv;vec2 tuv2=uv;\n#include <skip_nodata>\n#if defined(TEXTURE_3X3_LOOKUP)\nvec4 texel1=textureLookup(tuv);vec4 texel2=textureLookup(tuv2);vec4 texel=mix(texel1,texel2,dataMeld);\n#else\n#include <get_texel>\n#endif\nif(texel.a<1.)discard;\n#include <get_data_value>\nvalue=vSpeed;float dataValue=sampleDataRange.x+(sampleDataRange.y-sampleDataRange.x)*value;if(dataValue<drawRange.x)discard;if(dataValue>drawRange.y)discard;vec4 color=colorLookup(value,colorScaleRes,colorScale);float alpha=1.;\n#ifdef STYLE_BAR\n#endif\n#ifdef STYLE_ARROW\nfloat size=0.3;pos=vUv-vec2(0.,0.5);float bodySize=mix(0.3,2.,size);float headSize=0.1;float lineWidth=mix(0.18,0.12,size);float height=1.;vec4 fill=vec4(1.);float d=arrow_stealth(pos.xy,bodySize,headSize,height,lineWidth,1.);color=filled(d,0.15,0.01,color);\n#endif\n#ifdef STYLE_POINT\nfloat distance=length(2.*vUv-1.);if(distance>1.)discard;\n#endif\nalpha*=vAlpha;alpha*=opacity;gl_FragColor=color;gl_FragColor.a=alpha*color.a;gl_FragColor.rgb*=gl_FragColor.a;}"),Zn={},Yn=zs("precision highp float;attribute vec2 position;attribute vec2 uv;uniform mat4 modelViewMatrix;uniform mat4 viewMatrix;uniform mat4 modelMatrix;uniform mat4 projectionMatrix;varying vec2 vUv;void main(){vUv=uv;gl_Position=projectionMatrix*modelViewMatrix*vec4(position.xy,0.,1.);}"),Xn=zs("precision highp float;uniform float opacity;uniform sampler2D tOutput;varying vec2 vUv;void main(){vec4 color=texture2D(tOutput,vUv);gl_FragColor=vec4(floor(255.*color*opacity)/255.);}"),Qn={opacity:{value:1}},Kn=zs("precision highp float;attribute vec2 position;attribute vec2 uv;uniform mat4 modelViewMatrix;uniform mat4 viewMatrix;uniform mat4 modelMatrix;uniform mat4 projectionMatrix;varying vec2 vUv;void main(){vUv=position;gl_Position=projectionMatrix*modelViewMatrix*vec4(position.xy,0.,1.);}"),Jn=zs("precision highp float;<\n#defines>\n<\n#includes>\nuniform int interpolation;uniform float smoothing;uniform vec2 resolution;uniform float dataChannel[2];uniform vec2 dataResolution;uniform vec4 dataCoordOffset;uniform mat4 dataMatrix;uniform float dataMeld;uniform vec2 dataMin;uniform vec2 dataMax;uniform vec2 dataRange;uniform vec2 drawRange;uniform vec2 outputRange;uniform float noData;uniform float colorScaleRes;uniform bool initialize;uniform float speedFactor;uniform float fadeInIncrement;uniform float randomSeed;uniform float dropRate;uniform float dropRateBump;uniform int positionOutCoord;uniform sampler2D dataTexture;uniform sampler2D dataTextureNext;uniform sampler2D tPositionX;uniform sampler2D tPositionY;uniform sampler2D tAlpha;varying vec2 vUv;\n#include <texture_lookup_3x3>\n#include <color_lookup>\n#include <interpolated_texel>\n#include <decode_float_rgba>\n#include <encode_float_rgba>\n#include <project_vertex>\nfloat rand(const vec2 co){float t=dot(vec2(12.9898,78.233),co);return fract(sin(t)*(4375.85453+t));}vec2 transformData(vec2 pos,mat4 matrix){vec4 transformed=matrix*vec4(pos.xy,1.,1.);return transformed.xy/transformed.w;}void update(inout vec2 pos,inout vec4 state){float alpha=state.r;float rotation=state.g;vec2 uv=pos;uv=transformData(uv,dataMatrix);uv=vec2(dataCoordOffset.x+(uv.x*dataCoordOffset.z),dataCoordOffset.y+(uv.y*dataCoordOffset.w));vec2 tuv=uv;vec2 tuv2=uv;\n#include <get_texel>\n#include <get_data_value>\nif(texel.a<1.)state.a=0.;float speed=value;rotation=angle;float distortion=cos(radians(pos.y*180.-90.));float speedRatio=speedFactor;\n#ifdef GLOBE\nvec2 tilePos=(pos.xy+tileCoord.xy);vec2 latLon=tileToLatLon(tilePos,tileCoord.z);float latScale=1./cos(radians(latLon.y));distortion=cos(radians(latLon.y))*2.;\n#endif\nvec2 offset=vec2(velocity.x/distortion,-velocity.y)*0.0001*speedRatio;pos+=offset;vec2 seed=(pos+vUv)*randomSeed;float rate=dropRate+speed*dropRateBump;rate+=smoothstep(0.24,0.5,length(pos-vec2(0.5,0.5))*0.7);float drop=step(1.-rate,rand(seed));vec2 randomPos=vec2(0.5*rand(seed+1.3)+0.25,0.5*rand(seed+2.1)+0.25);alpha+=fadeInIncrement;alpha=mix(min(alpha,1.),0.,drop);vec2 nextPos=mix(pos,randomPos,drop);pos.x=nextPos.x;pos.y=nextPos.y;state.r=alpha;state.g=rotation;state.b=speed;}void main(){vec2 pos=vec2(decodeFloatRGBA(texture2D(tPositionX,vUv)),decodeFloatRGBA(texture2D(tPositionY,vUv)));vec4 state=texture2D(tAlpha,vUv);state.b=0.;state.a=1.;update(pos,state);if(initialize){for(int i=0;i<100;i++){update(pos,state);}}if(positionOutCoord==0){gl_FragColor=vec4(encodeFloatRGBA(pos.x));}else if(positionOutCoord==1){gl_FragColor=vec4(encodeFloatRGBA(pos.y));}else if(positionOutCoord==2){gl_FragColor=vec4(state.r,state.g/(PI*2.),state.b,state.a);}}"),eo={},to=zs("precision mediump float;<\n#defines>\n<\n#includes>\nattribute vec3 position;attribute vec2 uv;uniform mat4 modelViewMatrix;uniform mat4 viewMatrix;uniform mat4 modelMatrix;uniform mat4 projectionMatrix;uniform vec4 dataCoordOffset;varying vec2 vUv;varying vec2 vRef;varying float vDepth;\n#include <project_vertex>\nvoid main(){vUv=uv;vUv=vec2(dataCoordOffset.x+(uv.x*dataCoordOffset.z),dataCoordOffset.y+(uv.y*dataCoordOffset.w));\n#ifdef GLOBE\nvec2 pos=position.xy*EXTENT;gl_Position=projectVertex(pos,tileCoord);\n#else\ngl_Position=projectionMatrix*modelViewMatrix*vec4(position,1.);\n#endif\nvDepth=gl_Position.z;}"),io=zs("precision mediump float;<\n#defines>\n<\n#includes>\nuniform sampler2D dataTexture;uniform sampler2D dataTextureNext;uniform vec2 dataResolution;uniform float dataMeld;uniform float opacity;uniform float farZCutoff;varying vec2 vUv;varying vec2 vUvNext;varying float vDepth;void main(){vec2 pos=vUv;vec4 texel=texture2D(dataTexture,vUv);vec4 texel2=texture2D(dataTextureNext,vUv);vec4 color=mix(texel,texel2,dataMeld);color.a*=opacity;\n#ifdef GLOBE\ncolor*=1.-step(farZCutoff,1./gl_FragCoord.w);\n#endif\ngl_FragColor=color;gl_FragColor.rgb*=gl_FragColor.a;}"),ro={dataTexture:{value:void 0},opacity:{value:1}},ao=zs("precision mediump float;<\n#defines>\n<\n#includes>\nattribute vec3 position;attribute vec2 uv;attribute vec3 normal;varying vec2 vUv;void main(){vUv=uv;gl_Position=vec4(position.xy*2.-1.,position.z,1.);}"),so=zs("precision mediump float;<\n#defines>\n<\n#includes>\nuniform sampler2D tOutput;uniform sampler2D tMask;uniform float opacity;varying vec2 vUv;void main(){vec4 color=texture2D(tOutput,vUv);\n#ifdef USE_MASK\nfloat alpha=1.;vec4 mask=texture2D(tMask,vUv);alpha=mask.r;\n#ifdef INVERT_MASK\nalpha=clamp(1.-alpha,0.,1.);\n#endif\n#ifdef DEBUG_MASK\ncolor=vec4(vec3(alpha),1.);\n#else\nif(alpha<1.||color.a==0.)discard;\n#endif\n#endif\n#ifdef PREMULTIPLIED_ALPHA\nvec4 preMultipliedColor=vec4(color.rgb*color.a,color.a);color=preMultipliedColor;\n#endif\ngl_FragColor=vec4(floor(255.*color*opacity)/255.);}"),no={opacity:{value:1},tOutput:{value:void 0},tMask:{value:void 0}},oo=zs(Rn),lo=zs("precision mediump float;<\n#defines>\n<\n#includes>\n#ifdef USE_ATLAS\nuniform sampler2D tAtlas;\n#endif\nvarying vec2 vUv;varying vec2 vPosition;varying float vOpacity;void main(){vec4 color=vec4(vUv.x,vUv.y,0.,1.);\n#ifdef USE_ATLAS\ncolor=texture2D(tAtlas,vUv);\n#endif\ncolor.a*=vOpacity;gl_FragColor=color;}"),ho={},co=zs("precision mediump float;<\n#defines>\n<\n#includes>\nattribute vec2 position;attribute vec2 uv;attribute vec2 anchor;attribute vec4 glyph;attribute highp vec2 fillColor;attribute highp vec2 strokeColor;attribute highp float strokeWidth;attribute vec4 texCoordOffset;attribute float opacity;attribute float rotation;attribute float size;attribute float atlasIndex;\n#include <symbol_uniforms>\nvarying vec2 vUv;varying float vAtlasIndex;varying vec2 vPosition;varying float vSizeScale;varying vec4 vColor;varying vec4 vStrokeColor;varying float vOpacity;\n#include <encoding>\n#include <transform>\n#include <project_vertex>\nvec2 transform(const vec2 pos,const vec4 unitSize){vec2 scale=vec2(1./unitSize.z,1./unitSize.w);return vec2((pos.x*scale.x)-unitSize.x*scale.x,(pos.y*scale.y)-unitSize.y*scale.y);}void main(){highp vec2 adjustedAnchor=transform(anchor.xy/EXTENT,tileCoordOffset);highp vec4 projectedAnchor=projectionMatrix*modelViewMatrix*vec4(adjustedAnchor.xy,0.,1.);\n#ifdef GLOBE\nprojectedAnchor=projectVertex(anchor.xy,tileCoord);\n#endif\nfloat symbolAngle=rotation;float symbolScale=1.;vUv=vec2(texCoordOffset.x+(uv.x*texCoordOffset.z),texCoordOffset.y+(uv.y*texCoordOffset.w));vAtlasIndex=atlasIndex;vOpacity=opacity;vColor=decode_color(fillColor);vStrokeColor=decode_color(strokeColor);vSizeScale=size/24.;\n#include <symbol_vert_position>\n}"),uo=zs("#extension GL_OES_standard_derivatives : enable\nprecision mediump float;\n#define SDF_PX 8.0\n<\n#defines>\n<\n#includes>\nuniform sampler2D tFont[4];uniform float dpr;uniform bool isHalo;varying vec2 vUv;varying float vAtlasIndex;varying vec4 vColor;varying vec4 vStrokeColor;varying float vSizeScale;varying float vOpacity;\n#define GLYPH_EDGE 0.5\nconst float outlineEdgeWidth=0.5;const float shadowBlur=0.8;const vec4 shadowColor=vec4(0.,0.,0.,0.5);float median(float r,float g,float b){return max(min(r,g),min(max(r,g),b));}float screenPxRange(){float sdf_dist_range=6.;vec2 u_unit_range=vec2(sdf_dist_range/512.,sdf_dist_range/256.);vec2 screenTexSize=vec2(1.)/fwidth(vUv);return max(0.5*dot(u_unit_range,screenTexSize),1.);}void main(){vec4 tex;if(vAtlasIndex==0.){tex=texture2D(tFont[0],vUv);}else if(vAtlasIndex==1.){tex=texture2D(tFont[1],vUv);}else if(vAtlasIndex==2.){tex=texture2D(tFont[2],vUv);}else if(vAtlasIndex==3.){tex=texture2D(tFont[3],vUv);}float edge=0.5;if(isHalo){edge=0.01;}float d_msdf=median(tex.r,tex.g,tex.b);float d_sdf=tex.a;float dist=min(d_msdf,d_sdf+0.1);float width=fwidth(dist);float alpha=smoothstep(-width,width,dist);float outerEdge=GLYPH_EDGE;vec4 color=vColor;if(isHalo){color=vStrokeColor;}alpha=clamp(smoothstep(outerEdge-width,outerEdge+width,dist),0.,1.);color=vec4(color.rgb,color.a*alpha);if(isHalo){float outlineScale=vSizeScale;vec4 outlineColor=vStrokeColor;float adjustedWidth=mix(outlineEdgeWidth*1.,outlineEdgeWidth*0.5,vSizeScale);outerEdge-=clamp(adjustedWidth,0.,0.5);float outlineOuterAlpha=clamp(smoothstep(outerEdge-width,outerEdge+width,dist),0.,1.);float outlineAlpha=outlineOuterAlpha-alpha;color.rgb=mix(outlineColor.rgb,color.rgb,alpha);color.a=max(color.a,outlineColor.a*outlineOuterAlpha);float shadowAlpha=clamp(smoothstep(max(outerEdge-shadowBlur,0.05),outerEdge+shadowBlur,dist),0.,1.);vec4 shadow=shadowColor*shadowAlpha;}gl_FragColor=vec4(color.rgb,color.a*vOpacity);gl_FragColor.rgb*=gl_FragColor.a;}"),po={tMap:{value:void 0}},fo=zs("precision mediump float;<\n#defines>\n<\n#includes>\nattribute vec3 position;attribute vec2 anchor;attribute vec4 color;\n#include <symbol_uniforms>\nvarying vec4 vColor;\n#include <encoding>\n#include <transform>\n#include <project_vertex>\nvec2 transform(const vec2 pos,const vec4 unitSize){vec2 scale=vec2(1./unitSize.z,1./unitSize.w);return vec2((pos.x*scale.x)-unitSize.x*scale.x,(pos.y*scale.y)-unitSize.y*scale.y);}vec4 projectPosition(vec4 position){vec4 worldPosition=modelMatrix*position;return projectionMatrix*viewMatrix*worldPosition;}void main(){highp vec2 adjustedAnchor=transform(anchor.xy/EXTENT,tileCoordOffset);highp vec4 projectedAnchor=projectionMatrix*modelViewMatrix*vec4(adjustedAnchor.xy,0.,1.);float radius=0.1;vec4 glyph=vec4(-radius*0.5,-radius*0.5,radius,radius);\n#ifdef GLOBE\nprojectedAnchor=projectVertex(anchor.xy,tileCoord);\n#endif\nfloat symbolAngle=0.;float symbolScale=dpr;vColor=color;\n#include <symbol_vert_position>\ngl_Position.z=position.z;}"),mo=zs("precision mediump float;<\n#defines>\n<\n#includes>\nvarying vec4 vColor;void main(){vec4 color=vColor;gl_FragColor=color;gl_FragColor.rgb*=gl_FragColor.a;}"),go={},vo=class extends N.A{get context(){return this.layer.context}get layer(){return this._layer}set layer(e){this._layer=e}get isActive(){return this._isActive}get progress(){var e;return(null===(e=this.layer.animator)||void 0===e?void 0:e.relativePosition)||0}get passes(){return this._passes}get timeState(){return Object.assign({},this._timeState)}get renderState(){return this._renderState}constructor(e={}){super(),this.isAnimated=!1,this.cachesTextures=!0,this.eventHandlers={},this._isActive=!0,this._renderState=new Is,this._timeState={position:0,index:0,nextIndex:0},this.config=Object.assign({},e),this.paint=new As(e.paint),this._renderState.on(Is.Events.DIRTY,(()=>{this.onDirty()}))}setNeedsUpdate(){this.onDirty()}onAdd(e){if(!e)throw new Error("[MapsGL] Invalid layer provided to `onAdd`.");const t=e.context.gl;this._layer=e,this._passes=new Ds(this.context,{configurator:this}),this.passes.drawContext.renderTarget=this.renderTarget,this.layer.mask&&this.passes.setMask((()=>{this.layer.mask.layer.render()}),this.layer.mask.inverted),this.setup(),this.prepareDrawPasses(),this.setupEvents(),this.cachesTextures&&e.source instanceof ci&&e.source.tiles.prepareTextureArray(e.context,{capacity:e.source.tiles.capacity,size:{width:e.source.tileSize.width,height:e.source.tileSize.height},minFilter:t.LINEAR,magFilter:t.LINEAR,generateMipmaps:!1}),this.prerender(0),this.draw(0)}onRemove(e){if(!e)throw new Error("[MapsGL] Invalid layer provided to `onRemove`.")}onMoveStart(e){}onMoveEnd(e){}onZoomStart(e){}onZoomEnd(e){}onResize(e){}onDirty(){const e=this.getRenderablesLOD();this.renderState.updateRenderables(e)}onDocumentVisibilityChange(){this._isActive=!document.hidden,this.isAnimated&&this.isActive&&this.layer.setNeedsUpdate()}setup(){}setupEvents(){const e=this.layer.source,t=this.layer.animator;if(e instanceof ci&&this.addEventHandler(e,ye.A.TILE_LOAD,(e=>{this.onDirty()})),document.addEventListener("visibilitychange",this.onDocumentVisibilityChange.bind(this)),t){const{position:e,dataInterval:i,nextDataInterval:r,dataIndex:a,nextDataIndex:s}=t.info;this._timeState=Object.freeze({position:e,index:a,nextIndex:s,interval:i,nextInterval:r}),t.on([Ra.A.PLAY,Ra.A.STOP,Ya.A.DATA_ADVANCE].join(" "),(e=>{const{position:t,dataInterval:i,nextDataInterval:r,dataIndex:a,nextDataIndex:s}=e;this._timeState=Object.freeze({position:t,index:a,nextIndex:s,interval:i,nextInterval:r})}))}}addEventHandler(e,t,i){this.eventHandlers[t]={target:e,handler:i},e.on(t,i)}prepareRenderState(){const e=this.renderState.renderables,t=this.layer,i=t.getDataZoom(),r=t.viewport.getVisibleTileBounds(i),a=Math.floor(t.map.getZoom()),s=t.viewport.getVisibleTileBounds(a);this.renderState.updateState({data:{zoom:i,bounds:r},map:{zoom:a,bounds:s,center:this.layer.map.getCenter(),bearing:this.layer.map.getBearing(),pitch:this.layer.map.getPitch()},renderables:e,gl:{}}),this.passes.drawContext.renderTarget=this.renderTarget,this.isAnimated=this.isAnimated||this.paint.animated()}prerender(e){var t;this.passes&&(null===(t=this.context)||void 0===t?void 0:t.gl)&&(this.prepareRenderState(),this.renderState.updateState({elapsedTime:e}),this.passes.prerender({scene:this.layer.scene,defines:this.getProgramDefines()},{gl:this.renderState.gl}))}draw(e){var t;this.passes&&!this.renderTarget&&(null===(t=this.context)||void 0===t?void 0:t.gl)&&0!==this.renderState.renderables.length&&(this.renderState.updateState({elapsedTime:e}),this.passes.render({scene:this.layer.scene,defines:this.getProgramDefines()},{gl:this.renderState.gl}),this.isAnimated&&this.isActive&&this.layer.setNeedsUpdate())}prepareDrawPasses(){}stateForDrawPass(e,t){var i,r,a,s;const n=this.layer.map.getBounds();return Math.pow(2,this.layer.map.getZoom()),Lt({lat:n.north,lon:n.west}),{timeState:this.timeState,dataRegion:this.renderState.dataRegion,visibleRegion:this.renderState.visibleRegion,renderRegion:this.renderState.renderRegion,maskTexture:null===(s=null===(a=null===(r=null===(i=this.layer.mask)||void 0===i?void 0:i.layer)||void 0===r?void 0:r.renderer)||void 0===a?void 0:a.renderTarget)||void 0===s?void 0:s.texture,projection:this.layer.map.transform.projection.type,subdivisionGranularity:this.layer.map.transform.projection.subdivisionGranularity,globiness:this.layer.map.transform.globiness,isGlobe:this.layer.map.transform.isGlobe}}prepareDrawPass(e,t){var i;const r=null===(i=e.mesh)||void 0===i?void 0:i.program;if(!r)return;const a=this.layer.map.getCenter();r.setUniform("mapCenter",new _i(a.lon,a.lat)),r.setUniform("mercatorCenter",new _i(yt(a.lon),xt(a.lat))),r.setUniform("cameraPosition",this.layer.map.transform.camera.position),r.setUniform("clippingPlane",this.layer.map.transform.clippingPlane),r.setUniform("globeMatrix",this.layer.map.transform.globeMatrix),r.setUniform("mercatorMatrix",this.layer.map.transform.mercatorMatrix),r.setUniform("projMatrix",this.layer.map.transform.projGlobeMatrix),r.setUniform("zoomTransition",this.layer.map.transform.globeToMercatorTransition(this.layer.map.getZoom())),r.setUniform("cutoffParams",this.layer.map.transform.cutoffParams),r.setUniform("farZCutoff",this.layer.map.transform.farZ),r.setUniform("pixelRatio",this.layer.map.transform.pixelsPerMercatorPixelRatio)}prepareForOffscreenRender(){const e=this.context,t=e.gl;this.renderTarget||(this.renderTarget=new vs(e,{size:{width:e.resolution.width,height:e.resolution.height},minFilter:t.LINEAR,magFilter:t.LINEAR,format:t.RGBA}),e.on("resize",(e=>{let{width:t,height:i}=e;this.renderTarget.resize(t,i)})),this.passes.passes.forEach((e=>{e.prerender=!0})))}getProgramDefines(){return function(){const e=["EPSILON 0.0000001","PI 3.141592653589793",`EXTENT ${it}.0`,`TILE_SIZE ${Mt}.0`,"GLOBE_RADIUS EXTENT / PI / 2.0","GLOBE_UPSCALE GLOBE_RADIUS / 6371008.8","HALF_PI PI/2.0","QUARTER_PI PI/4.0","RAD_TO_DEG 180.0/PI","DEG_TO_RAD PI/180.0"];return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:Be)===Ue&&e.push("GLOBE"),e}(this.layer.map.transform.projection.type)}getInfoForStyles(){return{zoom:this.layer.map.getZoom(),time:this.renderState.elapsedTime}}getVisibleTiles(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.layer.map.getZoom();const t=this.layer.viewport.getVisibleTileCoords(e),i=[];for(let e=0,r=t.length;e<r;e++)i.push(new $t(t[e]));return i}getRenderables(){const e=this.layer.getDataZoom(),t=this.layer.viewport.getVisibleTileCoords(e),i=[];for(let e=0,r=t.length;e<r;e++){const r=t[e],a=r.normalize(),s=this.layer.pyramid.get(a);if(s){const e=Ss.fromTile(s,r);i.push(e)}}return i}getRenderablesLOD(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.layer.getDataZoom();const t=this.layer.viewport.getVisibleTileCoords(e);let i=[];for(let e=0,r=t.length;e<r;e++){const r=this.getRenderablesForTile(t[e]);i=[...i,...r]}return i}getRenderablesForTile(e){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.layer.map.transform.tileSize;const i=[];t=t||Mt;const r=this.layer.pyramid.getAvailableLOD(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:Number.POSITIVE_INFINITY);if(r)for(let t=0,a=r.length;t<a;t++){const a=r[t];let s;s=a.tile.coord.z===e.z?Ss.fromTile(a.tile,e):a.tile.coord.z<e.z?Ss.fromAncestorPartial(a,e):Ss.fromDescendantPartial(a,e),i.push(s)}return i}dispose(){this.passes.dispose(),Object.keys(this.eventHandlers).forEach((e=>{const{target:t,handler:i}=this.eventHandlers[e];t.off(e,i)})),document.removeEventListener("visibilitychange",this.onDocumentVisibilityChange)}};var yo=i(1409),xo=i(464);const bo=Object.freeze([1,0,0,0,1,0,0,0,1]),wo=Object.freeze([0,0,0,0,0,0,0,0,0]);class _o extends xo.A{constructor(){super(...arguments),this._value=yo.vt()}get value(){return this._value}get elements(){return this.value.length}static get identity(){return(new _o).fromArray([...bo])}static get zero(){return(new _o).fromArray([...wo])}fromArray(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=0;for(;i<this.elements;)this.value[i]=e[t+i],i+=1;return this}toArray(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=0;for(;i<this.elements;)e[t+i]=this.value[i],i+=1;return e}clone(){return(new _o).copy(this)}copy(e){let t=0;for(;t<this.value.length;)this.value[t]=e.value[t],t+=1;return this}set(e,t,i,r,a,s,n,o,l){return yo.hZ(this.value,e,t,i,r,a,s,n,o,l),this}determinant(){return yo.a4(this.value)}equals(e){return yo.aI(this.value,e.value)}getNormalMatrix(e){yo.Ge(this.value,e.value)}identity(){return yo.D_(this.value),this}invert(){return yo.B8(this.value,this.value),this}inverse(e){return yo.B8(this.value,e.value),this}rotate(e){return yo.e$(this.value,this.value,e),this}scale(e){return yo.hs(this.value,this.value,e.value),this}scaleScalar(e){return yo.hs(this.value,this.value,fi(e,e)),this}translate(e){return yo.Tl(this.value,this.value,e.value),this}transpose(){return yo.mg(this.value,this.value),this}multiply(e){return yo.lw(this.value,this.value,e.value),this}multiplyScalar(e){return yo.Ny(this.value,this.value,e),this}toString(){return yo.gx(this.value)}}const Ao=_o;var Mo,To,Eo,So,Co,Oo,Ro,Io=function(e,t,i,r){if("a"===i&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?r:"a"===i?r.call(e):r?r.value:t.get(e)},Po=function(e,t,i,r,a){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?a.call(e,i):a?a.value=i:t.set(e,i),i};class Do extends Jt{get source(){return Io(this,Eo,"f")}get type(){return Io(this,To,"f")}constructor(e,t,i,r={}){super(e,{name:(0,ue.N_)(t)||(0,ue.Ld)((0,ue.Ng)(e.gl,ko(e.gl,i)))}),Mo.add(this),To.set(this,void 0),Eo.set(this,void 0),So.set(this,void 0),(0,ue.vA)("string"==typeof t,"Shader: GLSL source code must be a JavaScript string"),Po(this,To,ko(e.gl,i),"f"),Po(this,So,Object.assign(r),"f"),t=Io(this,Mo,"m",Oo).call(this,t,Io(this,So,"f")||{}).replaceAll(/\n\n+/gm,"\n\n"),Po(this,Eo,t,"f"),Io(this,Mo,"m",Co).call(this,t)}getSource(){return this.gl.getShaderSource(this.handle)}setSource(e){const t=(0,ue.N_)(e);t&&(this.name=(0,ue.Ld)(t)),Io(this,Mo,"m",Co).call(this,e)}createHandle(){return this.incrementResourceCount(),this.gl.createShader(this.type)}deleteHandle(){this.handle&&(this.gl.deleteShader(this.handle),this.decrementResourceCount()),this._handle=void 0}dispose(){this.deleteHandle()}toString(){return`${(0,ue.Ng)(this.gl,this.type)}:${this.id}`}}To=new WeakMap,Eo=new WeakMap,So=new WeakMap,Mo=new WeakSet,Co=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.source;if(Po(this,Eo,e,"f"),e=e.replaceAll("#include <","#glsl_include <"),e=Io(this,Mo,"m",Oo).call(this,e,Io(this,So,"f")||{}).replaceAll(/\n\n+/gm,"\n\n"),this.context.isWebGL2&&(e=Io(this,Mo,"m",Ro).call(this,e)),this.gl.shaderSource(this.handle,e),this.gl.compileShader(this.handle),!this.gl.getShaderParameter(this.handle,this.gl.COMPILE_STATUS)){const t=this.gl.getShaderInfoLog(this.handle),{name:i,errors:r,warnings:a}=((e,t,i,r)=>{const a=t.split(/\r?\n/),s={},n={},o=(0,ue.N_)(i)||"(unnamed)",l=`${(0,ue.Ng)(e,r)} shader ${o}`;for(let e=0;e<a.length;e++){const i=a[e];if(i.length<=1)continue;const r=i.split(":"),o=r[0],h=Number.parseInt(r[2],10);if(Number.isNaN(h))throw new TypeError(`GLSL compilation error in ${l}: ${t}`);"WARNING"===o?n[h]=i:s[h]=i}const h=hs(i);return{name:l,errors:ls(s,h),warnings:ls(n,h)}})(this.gl,t,this.source,this.type);if(r){const t=hs(e).join("\n");console.error(`GLSL compilation errors in ${i}\n${r}\n----------------------\n${t}`)}throw a&&console.warn(`GLSL compilation warnings in ${i}\n${a}`),new Error(`GLSL compilation errors in ${i}`)}},Oo=function e(t){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.replaceAll(/^[\t ]*#glsl_include +<([\w.]+)>/gm,((t,r)=>{let a=i[r];if(void 0===a)throw new Error(`Cannot resolve #include <${r}>`);return a=a.replaceAll("#include <","#glsl_include <"),Io(this,Mo,"m",e).call(this,a,i)}))},Ro=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.source;const t=this.context.gl;if(this.context.isWebGL2){const i=["GL_OES_standard_derivatives","GL_EXT_frag_depth","GL_EXT_draw_buffers","GL_EXT_shader_texture_lod"];!1===e.startsWith("#version 300 es")&&(e=`#version 300 es\n\n${e}`),i.forEach((t=>{e=e.replaceAll(new RegExp(`#extension ${t}.+\n`,"g"),"")})),e=e.replaceAll(/texture(2D|Cube|EXT)/g,"texture"),this.type===t.VERTEX_SHADER?(e=e.replaceAll("attribute ","in "),e=e.replaceAll("varying ","out ")):(e=e.replaceAll("varying ","in "),e=e.replaceAll(/void main\(\)\s*{\s*/g,"out vec4 outColor;\n\nvoid main() {"),e=e.replaceAll("gl_FragColor","outColor"))}return e};class zo extends Do{constructor(e,t,i={}){super(e,t,"vertex",i)}get type(){return this.gl.VERTEX_SHADER}}class Lo extends Do{constructor(e,t,i={}){super(e,t,"fragment",i)}get type(){return this.gl.FRAGMENT_SHADER}}const ko=(e,t)=>{switch(t){case"vertex":return e.VERTEX_SHADER;case"fragment":return e.FRAGMENT_SHADER;default:return}};var Fo;!function(e){e[e.None=0]="None",e[e.Normal=1]="Normal",e[e.Additive=2]="Additive",e[e.Subtractive=3]="Subtractive",e[e.Multiply=4]="Multiply"}(Fo||(Fo={}));const jo=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{viewport:{width:null,height:null},transparent:!1,colorMask:[!0,!0,!0,!0],cullEnabled:!1,cullFace:void 0,frontFace:e.CCW,depthTest:!1,depthWrite:!0,depthMask:!0,depthFunc:e.LESS,depthRange:[0,1],stencilTest:!1,stencilMask:255,stencilFunc:e.ALWAYS,stencilRef:0,stencilFuncMask:255,stencilOp:e.KEEP,stencilFail:e.KEEP,stencilDepthFail:e.KEEP,stencilDepthPass:e.KEEP,blending:Fo.Normal,blendEnabled:!0,blendFunc:{src:e.ONE,dst:e.ZERO},blendEquation:{modeRGB:e.FUNC_ADD},premultiplyAlpha:!1,unpackAlignment:4,flipY:!1,clearAlpha:1,clearColor:new _r(0),framebuffer:null,boundBuffer:null,currentProgram:null,textureUnits:[],activeTextureUnit:-1,currentRenderTarget:null,activeGeometryId:null}},No=class{get gl(){return this._gl}get opts(){return this._state}get textureUnits(){return this.opts.textureUnits}get activeTextureUnit(){return this.opts.activeTextureUnit}get activeGeometryId(){return this.opts.activeGeometryId}constructor(e,t){this._gl=e,this._state={},this.apply(t||jo(e))}apply(e){const t=this.gl;if(e.blending)this.setBlending(e.blending);else{if(e.blendFunc){const{src:i,dst:r,srcAlpha:a,dstAlpha:s}=e.blendFunc;(0,R.n)(i)&&(0,R.n)(r)&&(this.setBlendFunc(i,r,a,s),this.enable(t.BLEND))}else this.disable(t.BLEND);if(e.blendEquation){const{modeRGB:t,modeAlpha:i}=e.blendEquation;(0,R.n)(t)&&this.setBlendEquation(t,i)}}this.setCullFace(e.cullFace),(0,R.n)(e.frontFace)&&this.setFrontFace(e.frontFace),e.depthTest?this.enable(t.DEPTH_TEST):this.disable(t.DEPTH_TEST),(0,R.n)(e.depthMask)&&this.setDepthMask(e.depthMask),e.depthFunc&&this.setDepthFunc(e.depthFunc),this._state=Object.assign(Object.assign({},this._state),e)}enable(e){const t=this.opts;!0!==t[e]&&(this.gl.enable(e),t[e]=!0)}disable(e){const t=this.opts;!1!==t[e]&&(this.gl.disable(e),t[e]=!1)}clear(){const e=this.gl;e.clear((arguments.length>0&&void 0!==arguments[0]&&!arguments[0]?0:e.COLOR_BUFFER_BIT)|(arguments.length>1&&void 0!==arguments[1]&&!arguments[1]?0:e.DEPTH_BUFFER_BIT)|(arguments.length>2&&void 0!==arguments[2]&&!arguments[2]?0:e.STENCIL_BUFFER_BIT))}setBlendEnabled(e){this.opts.blendEnabled!==e&&(e?this.enable(this.gl.BLEND):this.disable(this.gl.BLEND),this.opts.blendEnabled=e)}setBlending(e){const t=this.gl,i=this.opts.premultiplyAlpha;if(this.opts.blending!==e)switch(this.opts.blending=e,this.setBlendEnabled(e!==Fo.None),e){case Fo.Additive:i?(this.setBlendEquation(t.FUNC_ADD,t.FUNC_ADD),this.setBlendFunc(t.ONE,t.ONE,t.ONE,t.ONE)):(this.setBlendEquation(t.FUNC_ADD),this.setBlendFunc(t.SRC_ALPHA,t.ONE));break;case Fo.Subtractive:i?(this.setBlendEquation(t.FUNC_ADD,t.FUNC_ADD),this.setBlendFunc(t.ZERO,t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ONE_MINUS_SRC_ALPHA)):(this.setBlendEquation(t.FUNC_ADD),this.setBlendFunc(t.ZERO,t.ONE_MINUS_SRC_COLOR));break;case Fo.Multiply:i?(this.setBlendEquation(t.FUNC_ADD,t.FUNC_ADD),this.setBlendFunc(t.ZERO,t.SRC_COLOR,t.ZERO,t.SRC_ALPHA)):(this.setBlendEquation(t.FUNC_ADD),this.setBlendFunc(t.ZERO,t.SRC_COLOR));break;default:i?(this.setBlendEquation(t.FUNC_ADD,t.FUNC_ADD),this.setBlendFunc(t.ONE,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA)):(this.setBlendEquation(t.FUNC_ADD,t.FUNC_ADD),this.setBlendFunc(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA))}}setBlendFunc(e,t,i,r){var a,s,n,o;(null===(a=this.opts.blendFunc)||void 0===a?void 0:a.src)===e&&(null===(s=this.opts.blendFunc)||void 0===s?void 0:s.dst)===t&&(null===(n=this.opts.blendFunc)||void 0===n?void 0:n.srcAlpha)===i&&(null===(o=this.opts.blendFunc)||void 0===o?void 0:o.dstAlpha)===r||(this.opts.blendFunc={src:e,dst:t,srcAlpha:i,dstAlpha:r},void 0===i?this.gl.blendFunc(e,t):this.gl.blendFuncSeparate(e,t,i,r))}setBlendEquation(e,t){var i,r;(null===(i=this.opts.blendEquation)||void 0===i?void 0:i.modeRGB)===e&&(null===(r=this.opts.blendEquation)||void 0===r?void 0:r.modeAlpha)===t||(this.opts.blendEquation={modeRGB:e,modeAlpha:t},void 0===t?this.gl.blendEquation(e):this.gl.blendEquationSeparate(e,t))}setClearAlpha(e){this.opts.clearAlpha=e}setClearColor(e,t){var i;const r=t||e.a;(null===(i=this.opts.clearColor)||void 0===i?void 0:i.equals(e))&&this.opts.clearAlpha===r||(this.opts.clearColor=e,this.opts.clearAlpha=r,this.gl.clearColor(e.r,e.g,e.b,r))}setColorMask(e,t,i,r){this.opts.colorMask[0]===e&&this.opts.colorMask[1]===t&&this.opts.colorMask[2]===i&&this.opts.colorMask[3]===r||(this.opts.colorMask=[e,t,i,r],this.gl.colorMask(e,t,i,r))}setCullEnabled(e){this.opts.cullEnabled!==e&&(this.opts.cullEnabled=e,e?this.gl.enable(this.gl.CULL_FACE):this.gl.disable(this.gl.CULL_FACE))}setCullFace(e){this.opts.cullFace!==e&&(this.opts.cullFace=e,this.gl.cullFace(e))}setFrontFace(e){this.opts.frontFace!==e&&(this.opts.frontFace=e,this.gl.frontFace(e))}setDepthMask(e){this.opts.depthMask!==e&&(this.opts.depthMask=e,this.gl.depthMask(e))}setDepthFunc(e){this.opts.depthFunc!==e&&(this.opts.depthFunc=e,this.gl.depthFunc(e))}setDepthRange(e,t){this.opts.depthRange[0]===e&&this.opts.depthRange[1]===t||(this.opts.depthRange=[e,t],this.gl.depthRange(e,t))}setDepthTest(e){this.opts.depthTest!==e&&(this.opts.depthTest=e,e?this.enable(this.gl.DEPTH_TEST):this.disable(this.gl.DEPTH_TEST))}setStencilTest(e){this.opts.stencilTest!==e&&(this.opts.stencilTest=e,e?this.enable(this.gl.STENCIL_TEST):this.disable(this.gl.STENCIL_TEST))}setStencilMask(e){this.opts.stencilMask!==e&&(this.opts.stencilMask=e,this.gl.stencilMask(e))}setStencilFunc(e,t,i){this.opts.stencilFunc===e&&this.opts.stencilRef===t&&this.opts.stencilFuncMask===i||(this.opts.stencilFunc=e,this.opts.stencilRef=t,this.opts.stencilFuncMask=i,this.gl.stencilFunc(e,t,i))}setStencilOp(e,t,i){this.opts.stencilFail===e&&this.opts.stencilDepthFail===t&&this.opts.stencilDepthPass===i||(this.opts.stencilFail=e,this.opts.stencilDepthFail=t,this.opts.stencilDepthPass=i,this.gl.stencilOp(e,t,i))}setPixelStoreUnpackAlignment(e){this.opts.unpackAlignment!==e&&(this.opts.unpackAlignment=e,this.gl.pixelStorei(this.gl.UNPACK_ALIGNMENT,e))}setPixelStoreUnpackPremultiplyAlpha(e){this.opts.premultiplyAlpha!==e&&(this.opts.premultiplyAlpha=e,this.gl.pixelStorei(this.gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e))}setPixelStoreFlipY(e){this.opts.flipY!==e&&(this.opts.flipY=e,this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,e))}setActiveTexture(e){this.opts.activeTextureUnit!==e&&(this.opts.activeTextureUnit=e,this.gl.activeTexture(this.gl.TEXTURE0+e))}bindFramebuffer(){let{target:e=this.gl.FRAMEBUFFER,buffer:t=null}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.opts.framebuffer!==t&&(this.opts.framebuffer=t,this.gl.bindFramebuffer(e,t))}setActiveGeometry(e){this.opts.activeGeometryId=e}setRenderTarget(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;this.opts.framebuffer!==(null==e?void 0:e.handle)&&(e?(this.bindFramebuffer({target:this.gl.FRAMEBUFFER,buffer:e.handle}),this.setViewport(e.size.width,e.size.height)):(this.bindFramebuffer({target:this.gl.FRAMEBUFFER,buffer:null}),this.setViewport(this.gl.canvas.width,this.gl.canvas.height)))}setViewport(e,t){this.opts.viewport.width===e&&this.opts.viewport.height===t||(this.opts.viewport={width:e,height:t},this.gl.viewport(0,0,e,t))}reset(){const e=this.gl;if(e.disable(e.BLEND),e.disable(e.CULL_FACE),e.disable(e.DEPTH_TEST),e.disable(e.POLYGON_OFFSET_FILL),e.disable(e.SCISSOR_TEST),e.disable(e.STENCIL_TEST),e.disable(e.SAMPLE_ALPHA_TO_COVERAGE),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ZERO),e.blendFuncSeparate(e.ONE,e.ZERO,e.ONE,e.ZERO),e.colorMask(!0,!0,!0,!0),e.clearColor(0,0,0,0),e.depthMask(!0),e.depthFunc(e.LESS),e.clearDepth(1),e.stencilMask(4294967295),e.stencilFunc(e.ALWAYS,0,4294967295),e.stencilOp(e.KEEP,e.KEEP,e.KEEP),e.clearStencil(0),e.cullFace(e.BACK),e.frontFace(e.CCW),e.polygonOffset(0,0),e.activeTexture(e.TEXTURE0),e.bindFramebuffer(e.FRAMEBUFFER,null),!0===(0,ue.C6)(e)){const t=e;(0,R.n)(t.DRAW_FRAMEBUFFER)&&(e.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),e.bindFramebuffer(t.READ_FRAMEBUFFER,null))}e.useProgram(null),e.lineWidth(1),e.scissor(0,0,e.canvas.width,e.canvas.height),e.viewport(0,0,e.canvas.width,e.canvas.height),this.apply(jo(e))}},Vo=(e,t)=>(0,te.G)(e)?(0,R.n)(e.value)&&((0,R.g)(t)||e.value===t):(0,R.n)(e)&&((0,R.g)(t)||e===t),Bo=e=>{const t=[];return Vo(e.color)&&t.push("USE_COLOR"),Vo(e.map)&&t.push("USE_MAP"),Vo(e.bumpMap)&&t.push("USE_BUMPMAP"),Vo(e.specularMap)&&t.push("USE_SPECULARMAP"),Vo(e.sizeAttenuation,!0)&&t.push("USE_SIZEATTENUATION"),t.map((e=>`#define ${e}`))},Uo=(e,t,i,r,a)=>{if(r=r.length>0?qo(r):r,a){const e=a.get(i);if(r.length>0)if(void 0===e)a.set(i,[...r]);else{if(Wo(e,r))return;e.set?e.set(r):Ho(e,r),a.set(i,e)}else{if(e===r)return;a.set(i,r)}}switch(t){case 5126:return r.length>0?e.uniform1fv(i,r):e.uniform1f(i,r);case 35664:return e.uniform2fv(i,r);case 35665:return e.uniform3fv(i,r);case 35666:return e.uniform4fv(i,r);case 35670:case 5124:case 35678:case 35680:return r.length>0?e.uniform1iv(i,r):e.uniform1i(i,r);case 35671:case 35667:return e.uniform2iv(i,r);case 35672:case 35668:return e.uniform3iv(i,r);case 35673:case 35669:return e.uniform4iv(i,r);case 35674:return e.uniformMatrix2fv(i,!1,r);case 35675:return e.uniformMatrix3fv(i,!1,r);case 35676:return e.uniformMatrix4fv(i,!1,r);default:throw new Error(`[AerisGL] Program::setUniform: Unknown uniform type ${t}`)}},$o=function(e){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return(e=e.replace(/<#defines>/,(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[]).join("\n"))).replace(/<#includes>/,t.join("\n"))},Go={},qo=e=>{const t=e.length,i=e[0].length;if(void 0===i)return e;const r=t*i;let a=Go[r];a||(Go[r]=a=new Float32Array(r));for(let r=0;r<t;r++)a.set(e[r],r*i);return a},Wo=(e,t)=>{if(e.length!==t.length)return!1;for(let i=0,r=e.length;i<r;i++)if(e[i]!==t[i])return!1;return!0},Ho=(e,t)=>{for(let i=0,r=e.length;i<r;i++)e[i]=t[i]},Zo=class extends Jt{get defines(){return this._defines}get uniforms(){return this._uniforms}get attributes(){return this._attributes}get vertexShader(){return this._vs}get fragmentShader(){return this._fs}get renderState(){return this._renderState}constructor(e,t={}){super(e,t),this._textureBindings={};const{vertexShader:i,fragmentShader:r,uniforms:a={},transparent:s=!1,defines:n=new Array,includes:o={}}=t;this._uniforms={},this._attributes={},this._renderState=new No(e.gl),this._uniformState=new Map;const l=[...Bo(Object.assign(Object.assign({},t),a)),...n].map((e=>!1===e.startsWith("#define ")?`#define ${e}`:e));this._defines=l;const h=this.gl;let c=i,d=r;if("string"==typeof c&&"string"==typeof d&&me(t.onBeforeCompile)){const e={vertex:c,fragment:d};t.onBeforeCompile(e),c=e.vertex,d=e.fragment}if(this._vs="string"==typeof c?new zo(e,$o(c,l),o):c,this._fs="string"==typeof d?new Lo(e,$o(d,l),o):d,(0,ue.vA)(this.vertexShader instanceof zo,`[AerisGL] Program::${this.id}: bad vertex shader`),(0,ue.vA)(this.fragmentShader instanceof Lo,`[AerisGL] Program::${this.id}: bad fragment shader`),h.attachShader(this.handle,this.vertexShader.handle),h.attachShader(this.handle,this.fragmentShader.handle),h.linkProgram(this.handle),!h.getProgramParameter(this.handle,h.LINK_STATUS))throw new Error(`[AerisGL] Program::${this.id}: Error linking ${h.getProgramInfoLog(this.handle)}`);this.vertexShader.dispose(),this.fragmentShader.dispose(),this._assignAttributes(),this._assignUniforms(a),this.attributeOrder=Object.values(this.attributes).join(""),s&&(this.renderState.opts.transparent=!0,this.renderState.setBlendFunc(h.SRC_ALPHA,h.ONE_MINUS_SRC_ALPHA),this.renderState.setBlendEquation(h.FUNC_ADD),this.renderState.setDepthMask(!1))}use(){const e=this.gl;let t=-1;this.context.state.opts.currentProgram===this.id||(this.bind(),this.context.state.opts.currentProgram=this.id,this._textureBindings={}),Object.keys(this.uniforms).forEach((i=>{const r=this.uniforms[i];if(!r)return void console.warn(`[AerisGL] Program::${this.id}: Active uniform ${i} has not been supplied`);if(r&&(0,R.g)(r.value))return void console.warn(`[AerisGL] Program::${this.id}: Uniform ${i} is missing a value parameter`);const{type:a,location:s}=r;let n=r.value;if(n instanceof ei)return t+=1,this._textureBindings[t]=n.id,n.update(t),Uo(e,a,s,t,this._uniformState);if(n instanceof bi.A||n instanceof xo.A?n=n.value:n instanceof _r&&(n=n.toVector().toArray()),(0,R.n)(n)&&n.length>0&&n[0]instanceof ei){const i=[];for(let e=0,r=n.length;e<r;e++)t+=1,n[e].update(t),i.push(t);return Uo(e,a,s,i,this._uniformState)}Uo(e,a,s,n,this._uniformState)}))}setUniform(e,t){(0,R.n)(this.uniforms[e])&&(this.uniforms[e].value=t)}bind(){this.gl.useProgram(this.handle)}unbind(){this.gl.useProgram(null)}createHandle(){return this.incrementResourceCount(),this.gl.createProgram()}deleteHandle(){this.handle&&(this.gl.deleteProgram(this.handle),this.decrementResourceCount()),this._handle=void 0}_assignUniforms(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var t;const i=this.gl,r=i.getProgramParameter(this.handle,i.ACTIVE_UNIFORMS);for(let a=0;a<r;a++){const r=i.getActiveUniform(this.handle,a),s=r.name,n={location:this.gl.getUniformLocation(this.handle,s),type:r.type},o=r.name.match(/(\w+)/g);n.name=o[0],3===o.length?(n.isStructArray=!0,n.structIndex=Number(o[1]),n.structProperty=o[2]):2===o.length&&Number.isNaN(Number(o[1]))&&(n.isStruct=!0,n.structProperty=o[1]),(0,R.n)(null===(t=e[s])||void 0===t?void 0:t.value)&&(n.value=e[s].value),this.uniforms[s]=n}}_assignAttributes(){const e=this.gl,t=e.getProgramParameter(this.handle,e.ACTIVE_ATTRIBUTES);for(let i=0;i<t;i++){const t=e.getActiveAttrib(this.handle,i).name,r=this.gl.getAttribLocation(this.handle,t);this.attributes[t]=r}}dispose(){this.unbind(),this.deleteHandle(),this._vs.dispose(),this._fs.dispose()}},Yo=class extends Zo{get color(){return this.uniforms.color.value}set color(e){const t="string"==typeof e?new _r(e):e;this.uniforms.color.value=t}get map(){return this.opts.map}set map(e){this.opts.map=e}get wireframe(){return this.opts.wireframe}set wireframe(e){this.opts.wireframe=e}constructor(e,t={}){(t=Object.assign({color:new _r(255,255,255,1)},t)).uniforms=Object.assign({color:{value:xr(t.color)},map:{value:t.map}},t.uniforms),super(e,Object.assign(Object.assign({},t),{vertexShader:t.vertexShader||"\nprecision mediump float;\n\n<#defines>\n<#includes>\n\nattribute vec3 position;\nattribute vec2 uv;\nattribute vec3 normal;\n\nuniform mat4 modelMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat3 normalMatrix;\n\nvarying vec2 vUv;\nvarying vec3 vNormal;\nvarying vec3 vSurfaceToLight;\nvarying vec3 vSurfaceToView;\n\nvoid main() {\n vUv = uv;\n vNormal = normal;\n\n // compute the world position of the surface\n vec3 surfaceWorldPosition = mat3(modelMatrix) * position;\n // vector from the surface to the light\n\n\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n",fragmentShader:t.fragmentShader||"\nprecision mediump float;\n\n<#defines>\n<#includes>\n\nuniform vec4 color;\n#ifdef USE_MAP\n uniform sampler2D map;\n#endif\n#ifdef USE_SPECULARMAP\nuniform sampler2D specularMap;\n#endif\n\nvarying vec2 vUv;\n\nvoid main() {\n vec4 outputColor = color;\n\n#ifdef USE_MAP\n outputColor = texture2D(map, vUv);\n#endif\n\n float specularStrength;\n#ifdef USE_SPECULARMAP\n vec4 texelSpecular = texture2D(specularMap, vUv);\n specularStrength = texelSpecular.r;\n#else\n specularStrength = 1.;\n#endif\n\n gl_FragColor = outputColor;\n}\n"}))}};var Xo,Qo=i(4796),Ko=i(1025);!function(e){e[e.ZYX=0]="ZYX",e[e.YXZ=1]="YXZ",e[e.XZY=2]="XZY",e[e.ZXY=3]="ZXY",e[e.YZX=4]="YZX",e[e.XYZ=5]="XYZ",e[e.RollPitchYaw=0]="RollPitchYaw"}(Xo||(Xo={}));const Jo=Xo.ZYX,el=.99999;class tl{get x(){return this._value[0]}set x(e){this._value[0]=e,this.triggerChange()}get y(){return this._value[1]}set y(e){this._value[1]=e,this.triggerChange()}get z(){return this._value[2]}set z(e){this._value[2]=e,this.triggerChange()}get order(){return this._value[3]}set order(e){this._value[3]=e,this.triggerChange()}get roll(){return this.x}set roll(e){this.x=e}get pitch(){return this.y}set pitch(e){this.y=e}get yaw(){return this.z}set yaw(e){this.z=e}get value(){return this._value}get elements(){return this.value.length}constructor(e=0,t=0,i=0,r=0){this._changeCallbacks=[],this._value=Qo.fA(e,t,i,r)}fromArray(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x=e[t+0],this.y=e[t+1],this.z=e[t+2],this.order=e[t+3],this.triggerChange(),this}toArray(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t+0]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.order,e}fromObject(e){let{x:t,y:i,z:r,order:a}=e;return void 0!==t&&(this.x=t),void 0!==i&&(this.y=i),void 0!==r&&(this.z=r),void 0!==a&&(this.order=a),this.triggerChange(),this}toObject(){return{x:this.x,y:this.y,z:this.z,order:this.order}}fromRotationMatrix(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Jo;const i=e.toArray(),r=i[0],a=i[4],s=i[8],n=i[1],o=i[5],l=i[9],h=i[2],c=i[6],d=i[10];switch(t=t||this.order,t){case Xo.XYZ:this.y=Math.asin((0,Le.q)(s,-1,1)),Math.abs(s)<el?(this.x=Math.atan2(-l,d),this.z=Math.atan2(-a,r)):(this.x=Math.atan2(c,o),this.z=0);break;case Xo.YXZ:this.x=Math.asin(-(0,Le.q)(l,-1,1)),Math.abs(l)<el?(this.y=Math.atan2(s,d),this.z=Math.atan2(n,o)):(this.y=Math.atan2(-h,r),this.z=0);break;case Xo.ZXY:this.x=Math.asin((0,Le.q)(c,-1,1)),Math.abs(c)<el?(this.y=Math.atan2(-h,d),this.z=Math.atan2(-a,o)):(this.y=0,this.z=Math.atan2(n,r));break;case Xo.ZYX:this.y=Math.asin(-(0,Le.q)(h,-1,1)),Math.abs(h)<el?(this.x=Math.atan2(c,d),this.z=Math.atan2(n,r)):(this.x=0,this.z=Math.atan2(-a,o));break;case Xo.YZX:this.z=Math.asin((0,Le.q)(n,-1,1)),Math.abs(n)<el?(this.x=Math.atan2(-l,o),this.y=Math.atan2(-h,r)):(this.x=0,this.y=Math.atan2(s,d));break;case Xo.XZY:this.z=Math.asin(-(0,Le.q)(a,-1,1)),Math.abs(a)<el?(this.x=Math.atan2(c,o),this.y=Math.atan2(s,r)):(this.x=Math.atan2(-l,d),this.y=0);break;default:throw new Error("Unknown Euler angle order")}return this.triggerChange(),this}fromQuaternion(e){const[t,i,r,a]=e.toArray(),s=i*i,n=-2*(s+r*r)+1,o=2*(t*i+a*r);let l=-2*(t*r-a*i);l=l>1?1:l,l=l<-1?-1:l;const h=Math.atan2(2*(i*r+a*t),-2*(t*t+s)+1),c=Math.asin(l),d=Math.atan2(o,n);return new tl(h,c,d,Xo.RollPitchYaw)}toQuaternion(){const e=Math.cos(.5*this.yaw),t=Math.sin(.5*this.yaw),i=Math.cos(.5*this.roll),r=Math.sin(.5*this.roll),a=Math.cos(.5*this.pitch),s=Math.sin(.5*this.pitch);return new Ko.A(e*r*a-t*i*s,e*i*s+t*r*a,t*i*a-e*r*s,e*i*a+t*r*s)}fromVector3(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.order;return this.set(e.x,e.y,e.z,Number.isFinite(t)?t:this.order)}toVector3(){return new Ve.A(this.x,this.y,this.z)}set(e,t,i){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this.order;return this._value=Qo.fA(e,t,i,Number.isFinite(r)?r:this.order),this.triggerChange(),this}clone(){return(new tl).copy(this)}copy(e){let t=0;for(;t<this.value.length;)this.value[t]=e.value[t],t+=1;return this.triggerChange(),this}equals(e){return Qo.aI(this.value,e.value)}onChange(e){this._changeCallbacks.includes(e)||this._changeCallbacks.push(e)}triggerChange(){this._changeCallbacks.forEach((e=>e()))}}const il=tl;class rl extends Yt{get parent(){return this._parent}get children(){return this._children}constructor(e){super(e),this.visible=!0,this.localMatrix=new Ts,this.worldMatrix=new Ts,this.matrixAutoUpdate=!0,this.position=new Ve.A,this.scale=new Ve.A(1,1,1),this.rotation=new il,this.quaternion=new Ko.A,this.up=new Ve.A(0,1,0),this._parent=null,this._children=[],this._worldMatrixNeedsUpdate=!1,this.rotation.onChange((()=>{this.quaternion.fromEuler(this.rotation)})),this.quaternion.onChange((()=>{this.rotation.fromQuaternion(this.quaternion)}))}add(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];!1===this.contains(e)&&this.children.push(e),t&&e.setParent(this,!1)}remove(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];!0===this.contains(e)&&this.children.splice(this.children.indexOf(e),1),t&&e.setParent(null,!1)}contains(e){return this.children.includes(e)}setParent(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];t&&this.parent&&e!==this.parent&&this.parent.remove(this,!1),this._parent=e,t&&e&&e.add(this,!1)}traverse(e){if(!e(this))for(let t=0,i=this.children.length;t<i;t++)this.children[t].traverse(e)}lookAt(e){arguments.length>1&&void 0!==arguments[1]&&arguments[1]?this.localMatrix.lookAt(this.position,e,this.up):this.localMatrix.lookAt(e,this.position,this.up),this.quaternion=this.localMatrix.getRotation(),this.rotation.fromQuaternion(this.quaternion)}updateMatrixWorld(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.matrixAutoUpdate&&this.updateMatrix(),(this._worldMatrixNeedsUpdate||e)&&(null===this.parent?this.worldMatrix.copy(this.localMatrix):this.worldMatrix.multiply(this.parent.worldMatrix,this.localMatrix),this._worldMatrixNeedsUpdate=!1,e=!0);for(let t=0,i=this.children.length;t<i;t++)this.children[t].updateMatrixWorld(e)}updateMatrix(){this.localMatrix.compose(this.position,this.quaternion,this.scale),this._worldMatrixNeedsUpdate=!0}decompose(){this.localMatrix.getTranslation(this.position),this.localMatrix.getRotation(this.quaternion),this.localMatrix.getScale(this.scale),this.rotation.fromQuaternion(this.quaternion)}clone(){return new rl(this.context).copy(this)}copy(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.visible=e.visible,this.position.copy(e.position),this.scale.copy(e.scale),this.rotation.copy(e.rotation),this.quaternion.copy(e.quaternion),this.up.copy(e.up),this.localMatrix.copy(e.localMatrix),this.worldMatrix.copy(e.worldMatrix),this.matrixAutoUpdate=e.matrixAutoUpdate,!0===t)for(let t=0,i=e.children.length;t<i;t++)this.add(e.children[t].clone());return this}}class al extends rl{}const sl=rl;let nl=1;class ol extends sl{get id(){return this._id}get geometry(){return this._geometry}get program(){return this._program}set program(e){this._program=e}set wireframe(e){this.drawMode=e?this.gl.LINE_STRIP:this.gl.TRIANGLES}constructor(e,t,i){super(e),this.modelViewMatrix=new Ai.A,this.normalMatrix=new Ao,this.renderOrder=0,this.zDepth=0,this._id=nl,this._geometry=t,this._program=i,this.drawMode=e.gl.TRIANGLES,nl+=1}draw(){let{renderer:e,camera:t,target:i}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const r=this.program,a={};let s=this.drawMode;r instanceof Yo&&r.wireframe&&(s=this.gl.LINE_STRIP),e&&e.state.apply(r.renderState.opts),t?(Object.assign(a,{projectionMatrix:t.projectionMatrix,cameraPosition:t.worldPosition,viewMatrix:t.viewMatrix}),this.modelViewMatrix.multiply(t.viewMatrix,this.worldMatrix),this.normalMatrix.getNormalMatrix(this.modelViewMatrix)):this.modelViewMatrix.copy(this.worldMatrix),Object.assign(a,Object.assign(Object.assign({},this.getDrawUniforms()),{resolution:new _i(this.context.canvas.width,this.context.canvas.height),modelMatrix:this.worldMatrix,modelViewMatrix:this.modelViewMatrix,normalMatrix:this.normalMatrix})),Object.keys(a).forEach((e=>{r.uniforms[e]&&(r.uniforms[e].value=a[e])})),i&&i.bind(),r.use(),this.geometry.draw(r,s),i&&i.unbind()}updateGeometry(e){var t;arguments.length>1&&void 0!==arguments[1]&&arguments[1]&&(null===(t=this._geometry)||void 0===t||t.dispose()),this._geometry=e}dispose(){this.program.dispose(),this.geometry.dispose()}clone(){return new ol(this.context,this.geometry,this.program).copy(this)}copy(e){return super.copy(e,!(arguments.length>1&&void 0!==arguments[1])||arguments[1]),this.modelViewMatrix.copy(e.modelViewMatrix),this.normalMatrix.copy(e.normalMatrix),this.drawMode=e.drawMode,this.renderOrder=e.renderOrder,this.zDepth=e.zDepth,this}getDrawUniforms(){return{}}}const ll=ol,hl=class{get renderTarget(){return this._renderTarget}set renderTarget(e){var t;null===(t=this._renderTarget)||void 0===t||t.dispose(),this._renderTarget=e}constructor(e,t={}){this.enabled=!0,this.clear=!1,this.clearColor=new _r(0,0,0,0),this.enableBlend=!1,this.fullscreen=!1,this.offscreen=!1,this.prerender=!1,this.shouldUpdateViewport=!0,this.phase="render",this.needsSwap=!0,this._enableBlendAfterRender=!1,this.context=e,this.drawContext=t}setSize(e,t){}configureRenderTarget(e){var t;this.offscreen=!0,null===(t=this._renderTarget)||void 0===t||t.dispose();const i=this.context,r=i.gl;this._renderTarget=i.createFramebuffer(Object.assign({size:{width:i.resolution.width,height:i.resolution.height},minFilter:r.NEAREST,magFilter:r.NEAREST,format:r.RGBA},e)),i.on("resize",(e=>{let{width:t,height:i}=e;var r;null===(r=this.renderTarget)||void 0===r||r.resize(t,i)}))}draw(e){throw new Error("[MapsGL] Pass subclass must implement render()")}render(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var i,r;const a=Object.assign(Object.assign({},this.drawContext),e),{scene:s}=a;s&&(a.scene=s);const n=null===(i=a.configurator)||void 0===i?void 0:i.stateForDrawPass(this,a);a.state=Object.assign(Object.assign(Object.assign({},this.drawContext.state),t),n),this.beforeRender(a),null===(r=a.configurator)||void 0===r||r.prepareDrawPass(this,a),this.draw(a),this.afterRender(a)}getProgram(e,t){return((e,t,i)=>{const{cacheKey:C,defines:O,includes:R}=i;let I,P=[...O];switch(t){case"basic":I=a;break;case"circle":I=s;break;case"colorize":I=n;break;case"colorizeMultiband":I=o;break;case"colorMask":I=l,P=P.filter((e=>"GLOBE"!==e));break;case"contour":I=h;break;case"debug":I=c;break;case"fill":I=d;break;case"grid":I=u;break;case"gridSdf":I=zn;break;case"heatmapColorize":I=f;break;case"heatmapDraw":I=m;break;case"line":I=g;break;case"lineCap":I=v;break;case"lineJoin":I=y;break;case"lineTerminal":I=x;break;case"particleDraw":I=b;break;case"particleScreen":I=w;break;case"particleUpdate":I=_;break;case"raster":I=A;break;case"screen":I=M,P=[];break;case"symbol":I=T;break;case"symbolSdf":I=p;break;case"text":I=E;break;case"texture":I=a,P=P.filter((e=>"GLOBE"!==e));break;case"voronoi":I=S}const D=null==I?void 0:I.vertexShader;let z=null==I?void 0:I.fragmentShader;const L=null==I?void 0:I.uniforms;if(i.fragmentShader&&(z=i.fragmentShader),!D||!z)throw new Error(`Program "${t}" is invalid`);return e.cache.getOrCreateProgram(null!=C?C:t,{vertexShader:D,fragmentShader:z,defines:P,uniforms:L,includes:Object.assign(Object.assign({},r),R),onBeforeCompile:i.onBeforeCompile})})(this.context,e,Object.assign({defines:[...t.defines]},arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}))}beforeRender(e){var t;const i=this.context,r=null===(t=e.state.gl)||void 0===t?void 0:t.blendingEnabled;if(this._previousRenderTarget=i.state.opts.framebuffer,this.renderTarget){const e=this.renderTarget;this.renderTarget.bind(),i.state.setViewport(e.viewport.z,e.viewport.w)}else if(this.shouldUpdateViewport){const e=this.context.resolution;i.state.setViewport(e.width,e.height)}i.state.setBlendEnabled(this.enableBlend),this.clear&&(i.state.setClearColor(this.clearColor),i.state.clear(!0,!1,!1)),this._enableBlendAfterRender=r}afterRender(e){var t;null===(t=this.renderTarget)||void 0===t||t.unbind(),this.context.state.setBlendEnabled(!0)}dispose(){var e;const t=null===(e=this.mesh)||void 0===e?void 0:e.program;t&&!this.context.cache.hasProgram(t)&&t.dispose()}};class cl{constructor(){this.scale={x:1,y:1,z:1},this.offset={x:0,y:0,z:0},this.uvOffset=[0,0,1,1],this.partialScale=1}static fromTileRenderable(e,t){let i=e.offset.toObject(),r=e.scale.toObject();if(t){const a=t.scale,s=t.offset;i={x:(e.offset.x-s.x)*a.x,y:(e.offset.y-s.y)*a.y,z:0},r={x:e.scale.x*a.x,y:e.scale.y*a.y,z:1}}const a=new cl;if(a.scale=Object.assign(Object.assign({},r),{z:1}),a.offset=Object.assign(Object.assign({},i),{z:0}),a.uvOffset=[...e.uvOffset],a.partialScale=e.partialScale,e.tile.data instanceof De.A){const t=e.tile.data,i=a.uvOffset,r=((e,t,i)=>{const r=1/t.width*i,a=1/t.height*i,s=1-2*r,n=1-2*a;return[(0,ka._b)(e[0],0,1,r,r+s),(0,ka._b)(e[1],0,1,a,a+n),(0,ka._b)(e[2],0,1,0,s),(0,ka._b)(e[3],0,1,0,n)]})(i,{width:t.size.width+2*t.padding,height:t.size.height+2*t.padding},t.padding||0);i[0]=r[0],i[1]=r[1],i[2]=r[2],i[3]=r[3]}return a}}const dl=cl,ul=(e,t)=>{const i=e.context,r=t>1?pl(i,t):i.cache.getFullscreenQuad().geometry;e.updateGeometry(r)},pl=(e,t)=>{const i=`subdivided-quad-${t}`;let r=e.cache.geometry.get(i);if(r)return r;const a=[],s=[],n=[];return function(e,t,i,r,a,s,n){let o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:1,l=arguments.length>8&&void 0!==arguments[8]?arguments[8]:1,h=arguments.length>9&&void 0!==arguments[9]?arguments[9]:0,c=arguments.length>10&&void 0!==arguments[10]?arguments[10]:0;const d=h,u=r/s,p=a/n;for(let r=0;r<=n;r++){const a=r*p;for(let p=0;p<=s;p++,h++){if(e[2*h+0]=p*u*o,e[2*h+1]=a*l,t[2*h+0]=p/s,t[2*h+1]=r/n,r===n||p===s)continue;const f=d+p+(r+1)*(s+1),m=d+(p+1)+(r+1)*(s+1),g=d+(p+1)+r*(s+1);i[6*c+0]=d+p+r*(s+1),i[6*c+1]=f,i[6*c+2]=g,i[6*c+3]=f,i[6*c+4]=m,i[6*c+5]=g,c+=1}}}(a,s,n,1,1,t,t),r=new Wr(e,{position:{size:2,data:new Float32Array(a)},uv:{size:2,data:new Float32Array(s)},index:{data:new Uint16Array(n)}}),r.setIndex(n),e.cache.geometry.set(i,r),r},fl=class extends hl{constructor(e,t,i=[]){super(e),this._tileCache=t}beforeRender(e){super.beforeRender(e);const{visibleRegion:t,dataRegion:i,subdivisionGranularity:r,isGlobe:a}=e.state;this.mesh||(this.mesh=new ll(this.context,this.context.cache.getFullscreenQuad().geometry,null));const s=r.tile.getGranularityForZoomLevel(t.zoom),n=a?s*Math.max(1,t.zoom-i.zoom):1;ul(this.mesh,n);const o=this.getProgram("raster",e);this.mesh.program=o}draw(e){const{renderables:t,timeState:i}=e.state;for(let r=0,a=t.length;r<a;r++){const a=t[r],s=a.tile;let n={current:null,next:null};if(s.data instanceof Bt.A)s.data.updateTextures(this.context,i),n=s.data.textures;else if(s.data instanceof HTMLImageElement){const e=this._tileCache.textures.get(s.coord.hash);n.current=null==e?void 0:e.texture,n.next=n.current}this.canDrawTile(s)&&this.drawTile(e,a,n)}}canDrawTile(e){var t,i;if((null==e?void 0:e.data)instanceof Bt.A)return(0,R.n)(null===(i=null===(t=e.data)||void 0===t?void 0:t.textures.current)||void 0===i?void 0:i.image);if((null==e?void 0:e.data)instanceof HTMLImageElement){const t=this._tileCache.textures.get(e.coord.hash);return(0,R.n)(null==t?void 0:t.texture)}return!1}drawTile(e,t,i){var r;const a=this.context,{region:s}=(null===(r=e.configurator)||void 0===r?void 0:r.stateForDrawPass(this,e))||{},n=this.mesh,o=n.program,l=e.renderTarget?a.cache.getFullscreenQuad().camera:void 0,h=dl.fromTileRenderable(t,l?s:void 0),c=h.scale,d=h.offset,u=h.uvOffset,p=a.resolution,f=i.current,m=i.next,g=t.partialScale>1?t.coord:t.tile.coord;o.setUniform("resolution",new _i(p.width,p.height)),o.setUniform("dataResolution",new _i(f.size.width,f.size.height)),o.setUniform("dataTextureCoordOffset",(new Ne.A).fromArray(u)),o.setUniform("dataCoordOffset",(new Ne.A).fromArray(u)),o.setUniform("dataTexture",f),o.setUniform("dataTextureNext",m),o.setUniform("tileCoord",new Ve.A(g.x,g.y,g.z)),n.scale.set(c.x,c.y,1),n.position.set(d.x,d.y,0),e.scene&&!e.renderTarget?e.scene.render(n,l):(n.updateMatrixWorld(),n.draw({camera:l}))}},ml=class extends vo{prepareDrawPasses(){const e=new fl(this.context,this.layer.source.tiles);e.id="draw-tiles",e.enableBlend=!0,this.passes.addPass(e)}stateForDrawPass(e,t){const i=super.stateForDrawPass(e,t),r=this.renderState.renderables;return Object.assign(Object.assign({},i),{renderables:r})}prepareDrawPass(e,t){var i;super.prepareDrawPass(e,t);const r=null===(i=e.mesh)||void 0===i?void 0:i.program;r&&e instanceof fl&&(r.setUniform("opacity",this.paint.rasterOpacity()),r.setUniform("dataMeld",this.paint.rasterMeld()?this.progress:0))}};class gl{constructor(e,t){this.target=e,this.tile=t}static fromTile(e){return new gl(e.coord,e)}static fromAncestor(e,t){return new gl(e,t)}static fromDescendant(e,t){return new gl(e,t)}}const vl=gl,yl=class{get source(){return this.layer.source}get tiles(){return this.layer.source.tiles}get keys(){return this.tiles.keys}constructor(e,t={}){if(!e)throw new Error("[MapsGL] `layer` parameter is invalid.");this.layer=e}has(e){return this.source.hasTileData(e,this.layer.id)}get(e){return this.tiles.get(e)}clear(){this.tiles.clear()}getAncestor(e,t){const i=e.getAncestor(t);return this.get(i)}getDescendants(e,t){const i=e.getDescendants(t);let r=!1;for(let e=0,t=i.length;e<t;e++)if(this.has(i[e])){r=!0;break}if(r){const e=Array.from({length:i.length});for(let t=0,r=i.length;t<r;t++){const r=i[t];e[t]=this.get(r)||r}return e}}forEach(e){this.tiles.forEach((t=>e(t)))}isPending(e){return this.tiles.isPending(e)}filterTiles(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=e.map((e=>({coord:e,ncoord:e.normalize()})));return i=(e=>{const t=new Map;return e.filter((e=>{const i=e.ncoord.hash;return!t.has(i)&&t.set(i,!0)}))})(i),t&&(i=((e,t)=>t.filter((t=>!e.has(t.ncoord)&&!e.isPending(t.ncoord))))(this,i)),(0,pe.Z)(this.source.bounds)&&(i=((e,t)=>t.filter((t=>{const i=It(t.ncoord);return!(i.east<e.west||i.west>e.east||i.south>e.north||i.north<e.south)})))(this.source.bounds,i)),i=((e,t)=>(t.sort(((t,i)=>{const r=t.coord.getCenter(),a=i.coord.getCenter(),s=e.x-r.x,n=e.y-r.y,o=e.x-a.x,l=e.y-a.y;return s*s+n*n-(o*o+l*l)})),t))(this.layer.viewport.getCenter(),i),i.length<e.length&&this.layer.setNeedsUpdate(),i.map((e=>e.ncoord))}requestTiles(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{reload:i=!1}=t,r=this.filterTiles(e,!0!==i).map((e=>({coord:e,ncoord:e.normalize()}))).map((e=>e.ncoord)).map((e=>this.source.requestTile(e,t)));return Promise.all(r).then((()=>{}))}getAvailableLOD(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Number.POSITIVE_INFINITY;const i=e.normalize(),r=this.get(i);if(null==r?void 0:r.data)return[vl.fromTile(r.clone(e.wrap))];const a=i.z,s=[];this.tiles.levels.forEach(((e,t)=>{t!==a&&s.push(t)})),s.sort(((e,t)=>(e>a?e-a:a-e-.5)-(t>a?t-a:a-t-.5)));const n=[],o=[];let l=i,h=s.shift();for(;void 0!==l&&void 0!==h;){if(h<l.z){const i=this.getAncestor(l,l.z-h);if((null==i?void 0:i.data)&&h<=t){n.push(vl.fromAncestor(e,i)),l=o.shift();continue}}else if(h-a<4){const t=this.getDescendants(l,h-l.z);if(t){for(let i=0;i<t.length;i++){const r=t[i];r instanceof $t?n.push(vl.fromDescendant(e,r)):r instanceof Vt&&o.push(r)}l=o.shift()}}h=s.shift()}return n.length>0?n:void 0}};class xl{constructor(){this._total=0,this._completed=0,this._failed=0}get total(){return this._total}get completed(){return this._completed}get failed(){return this._failed}get progress(){return 0===this._total?0:(this._completed+this._failed)/this._total}get isComplete(){return 1===this.progress}get isFailed(){return this._failed>0}incrementTotal(){this._total+=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1}incrementCompleted(){this._completed+=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1}incrementFailed(){this._failed+=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1}reset(){this._completed=0,this._failed=0,this._total=0}serialized(){return{total:this._total,completed:this._completed,failed:this._failed,progress:this.progress}}static from(e){return e.reduce(((e,t)=>(e.incrementTotal(t.total),e.incrementCompleted(t.completed),e.incrementFailed(t.failed),e)),new xl)}}const bl=xl,wl={[tr.E.exact]:1,[tr.E.high]:.75,[tr.E.medium]:.5,[tr.E.low]:.25};class _l extends as{get quality(){return this.dataQuality}set quality(e){e!==this.quality&&(this.dataQuality=e,this.map&&this.requestVisibleTiles())}constructor(e,t){var i,{quality:r=tr.E.exact}=t,a=function(e,t){var i={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(i[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(i[r[a]]=e[r[a]])}return i}(t,["quality"]);super(e,a),i=this,this.zoomOffset=0,this.dataQuality=tr.E.exact,this.upgradeDataQuality=!1,this.tileLoadProgress=new bl,this._refresh=(0,Ma.s)((function(){arguments.length>0&&void 0!==arguments[0]&&arguments[0]&&i.source.expireAllTiles(),i.requestVisibleTiles(!0)}),100),this.onDataStale=()=>{this.requestVisibleTiles(!0)},this.onDataChange=()=>{this.setNeedsUpdate()},this.onTileLoadStart=e=>{this.tileLoadProgress.incrementTotal()},this.onTileLoadComplete=e=>{this.tileLoadProgress.incrementCompleted(),this.onLoadProgress(e)},this.onTileLoad=e=>{this.trigger(Ua,Object.assign(Object.assign({},this.eventPayload()),{tile:e.tile})),this.setNeedsUpdate()},this.onTileError=e=>{this.trigger("tile:error",Object.assign(Object.assign({},this.eventPayload()),{tile:e.tile})),this.tileLoadProgress.incrementFailed()},this.onLoadStart=e=>{this.trigger($a,this.eventPayload()),this.onLoadProgress(e)},this.onLoadProgress=e=>{var t;!0!==(null===(t=this.animator)||void 0===t?void 0:t.isActive)&&this.trigger(Ga,Object.assign(Object.assign({},this.eventPayload()),{progress:this.tileLoadProgress.serialized()}))},this.onLoadComplete=e=>{this.trigger(qa,this.eventPayload()),this.tileLoadProgress.reset()},this.addSourceEventHandler(ye.A.DATA_CHANGE,this.onDataChange),this.addSourceEventHandler(ye.A.DATA_STALE,this.onDataStale),this.addSourceEventHandler(ye.A.LOAD_START,this.onLoadStart),this.addSourceEventHandler(ye.A.LOAD_COMPLETE,this.onLoadComplete),this.addSourceEventHandler(ye.A.TILE_LOAD_START,this.onTileLoadStart),this.addSourceEventHandler(ye.A.TILE_LOAD_COMPLETE,this.onTileLoadComplete),this.addSourceEventHandler(ye.A.TILE_LOAD,this.onTileLoad),this.addSourceEventHandler(ye.A.TILE_ERROR,this.onTileError),this.pyramid=new yl(this),this.dataQuality=r,this.zoomOffset=(0,R.n)(a.zoomOffset)?a.zoomOffset:0}refresh(){this._refresh(arguments.length>0&&void 0!==arguments[0]&&arguments[0])}getDataZoom(e,t){var i,r;void 0===e&&(e=null!==(r=null===(i=this.map)||void 0===i?void 0:i.getZoom())&&void 0!==r?r:0),void 0===t&&(t=!1);const a=e+this.zoomOffset-(1/this.map.transform.worldSizeScale-1),s=Math.min(Math.floor(a),22);let n=this.dataQuality;n===tr.E.normal?n=tr.E.medium:n===tr.E.minimal&&(n=tr.E.low);const o=Math.floor(a*wl[n]*(t?.5:1));return n===tr.E.exact?Math.max(Math.min(this.source.maxZoom,s),this.source.minZoom):Math.max(Math.min(this.source.maxZoom,o),this.source.minZoom)}preloadWorldTile(){const e=()=>{const e=this.viewport.getVisibleTileCoords(0,!0);this.requestTiles(e,!1)};this.source.metadata.hasLoaded?e():this.addSourceEventHandler(ye.A.METADATA_LOAD,(()=>{e()}))}getTile(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.getDataZoom(),i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const r={lat:e.lat,lon:(a=e.lon,(a%360+360+180)%360-180)};var a;if(this.source instanceof ci){const a=Dt(e,t);let s=new Vt(a.z,a.x,a.y),n=this.source.tiles.get(s.normalize());if(!n&&this.renderer instanceof vo&&i){const e=this.renderer.getRenderablesForTile(s);for(let t=0;t<e.length;t++){const i=e[t],a=i.tile.coord,o=It({x:a.x,y:a.y,z:a.z});Ft(r,o)&&(s=i.tile.coord,n=this.source.tiles.get(s.normalize()))}}const o=s.normalize();if(n&&n.data){const e=Pt({x:o.x,y:o.y,z:o.z}),t=Pt({x:o.x+1,y:o.y+1,z:o.z}),i=Lt(r);return{tile:n,position:{x:(i.x-e.x)/(t.x-e.x),y:(i.y-e.y)/(t.y-e.y)}}}}}getVisibleTileCoords(){const e=this.viewport.getVisibleTileCoords(this.getDataZoom());return this.pyramid.filterTiles(e,!1)}requestVisibleTiles(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this.visible||!this.map)return;const t=this.getDataZoom(),i=this.viewport.getVisibleTileBounds(t);return this.source.getMetadata().then((()=>{const r=this.source;if((0,R.g)(this.viewport))return;if(t<r.minZoom||t>r.maxZoom)return this.requestVisibleTiles(e);const a=!this.tileBounds||!1===this.tileBounds.equals(i);if(a&&this.trigger(Ha,{bounds:i}),e||a){const r=this.viewport.getVisibleTileCoords(t);return this.tileBounds=i,this.requestTiles(r,e).catch((e=>{console.error(e)}))}}))}requestTiles(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i;const r=null===(i=this.animator)||void 0===i?void 0:i.animation.currentDate;let a;return this.timing.mode===hr.Gp.interval?a=this.source.metadata.getValidTimeForTime(r):this.timing.mode===hr.Gp.any&&(a=r),this.pyramid.requestTiles(e,{intervals:a?[a]:void 0,params:{time:null!=a?a:r},reload:t})}onAdd(e){var t;super.onAdd(e),this.onMove(),(null===(t=this.mask)||void 0===t?void 0:t.layer)instanceof _l&&this.mask.layer.preloadWorldTile()}onMove(){super.onMove(),this.map&&(this.setNeedsUpdate(),this.requestVisibleTiles())}onVisible(){super.onVisible(),(!this.lastHiddenTime||Date.now()-this.lastHiddenTime>1e3)&&this.refresh()}onHidden(){super.onHidden(),this.lastHiddenTime=Date.now()}onSourceMetadata(){super.onSourceMetadata(),this.timing.mode===hr.Gp.interval&&(this.source.cancelAllRequests(),this.onDataStale())}onMaskLayerChange(){var e;(null===(e=this.mask)||void 0===e?void 0:e.layer)instanceof _l&&this.mask.layer.preloadWorldTile()}dispose(){var e;super.dispose(),null===(e=this.animator)||void 0===e||e.dispose()}}const Al=_l,Ml=class extends N.A{get isLoading(){return this._loading}get hasLoaded(){return this._loaded}get isReady(){return this._isReady}get isDirty(){return this._isDirty}constructor(e){super(),this.maxIntervalsPerRequest=1,this.interleaveRequests=!0,this.triggerReadyOnComplete=!0,this._isDirty=!0,this._isReady=!1,this._seriesIntervals=[],this._loading=!1,this._loaded=!1,this.layer=e}setSeriesIntervals(e){this._seriesIntervals=e}setNeedsUpdate(){this._isDirty=!0,this._isReady=!1}dataStateForIntervals(e){throw new Error("Subclasses of TimeSeriesDataProvider must implement `dataStateForIntervals`.")}missingDataForIntervals(e){throw new Error("Subclasses of TimeSeriesDataProvider must implement `missingDataForIntervals`.")}loadData(){throw new Error("Subclasses of TimeSeriesDataProvider must implement `loadData`.")}invalidate(){this._isDirty=!1,this._loading=!1,this._loaded=!1,this._isReady=!1}getLoadingProgress(){return new bl}onLoadStart(e){this._loading=!0,this.trigger(Ya.A.LOAD_START,{intervals:e})}onLoadProgress(e){this.trigger(Ya.A.LOAD_PROGRESS,{progress:e.serialized()})}onLoadData(e){this.trigger(Ya.A.LOAD_INTERVAL,{intervals:e})}onLoadComplete(){this._loading=!1,this._loaded=!0,this.trigger(Ya.A.LOAD_COMPLETE)}onReady(){this._isDirty=!1,this._isReady&&this.trigger(Ya.A.DATA_READY)}dispose(){}};var Tl=i(9003);class El extends Tl.A{constructor(e,t={}){super(e,t)}}const Sl=class extends N.A{constructor({concurrency:e=Number.POSITIVE_INFINITY,autostart:t=!1}={}){super(),this.tasks=[],this.concurrency=Number.POSITIVE_INFINITY,this.autostart=!1,this.running=!1,this.pending=0,this.index=-1,this.concurrency=e,this.autostart=t,this.progress=new bl}get length(){return this.tasks.length}get isRunning(){return this.running}get currentIndex(){return this.index}get currentTask(){return this.tasks[this.currentIndex]}get last(){return this.peek()}enqueue(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return this.tasks.push(...t),this.progress.incrementTotal(),this.autostart&&this.start(),this}dequeue(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];const r=t[0];if("number"==typeof r)return this.dequeueByIndex(r);if("function"==typeof r||!r)return this.dequeueByTask(r);throw new TypeError("Argument's type must either by number, function or undefined.")}peek(){return this.tasks.at(-1)}start(){this.running||this.run()}pause(){this.stop()}resume(){this.start()}stop(){this.running=!1}cancel(){const e=this.running;this.clear(),e&&this.trigger(new El("cancel"))}clear(){this.stop(),this.pending=0,this.index=-1,this.tasks.splice(0),this.progress.reset()}dequeueByIndex(e){if(e>-1&&this.tasks[e]){const t=this.tasks[e];return this.tasks.splice(e,1),t}}dequeueByTask(e){const t=e?this.tasks.indexOf(e):this.length-1;return this.dequeueByIndex(t)}run(){const e=!this.running;if(this.pending>=this.concurrency)return;if(0===this.length)return void(this.isRunning&&0===this.pending&&this.done());this.running=!0,e&&this.trigger(new El("start"));const t=this.tasks.shift(),i=(e,i)=>{this.pending-=1,e?(this.progress.incrementFailed(),this.trigger(new El("error",{error:e,task:t}))):(this.progress.incrementCompleted(),this.trigger(new El("task:complete",{result:i,task:t}))),0===this.pending&&0===this.length?this.done():this.running&&this.run()};this.pending+=1,this.trigger(new El("task:start",{task:t})),t().then((e=>{this.isRunning&&i(void 0,e)}),(e=>{console.error("[MapsGL] Queue task failed",e),i(e||new Error("Queue task failed"))})),this.running&&this.length>0&&this.run()}done(){this.running&&(this.running=!1,this.trigger(new El("complete")))}},Cl=class extends N.A{constructor(){super(),this.queues=[],this.running=!1,this._index=-1,this.progress=new bl}get length(){return this.queues.length}get totalLength(){return this.queues.reduce(((e,t)=>e+t.length),0)}get isRunning(){return this.running}push(e){this.queues.push(e),this.progress.incrementTotal(e.progress.total)}unshift(e){this.queues.unshift(e)}start(){this.running||this.run()}pause(){this.running=!1}resume(){this.start()}stop(){this.pause()}cancel(){const e=this.running;this.clear(),e&&this.trigger(new El("cancel"))}clear(){this._index=-1,this.stop(),this.queues.forEach((e=>{e.clear()})),this.queues.splice(0),this.progress.reset()}run(){const e=!this.running;if(this.running=!0,0===this.queues.length)return void this.done();this._index+=1,e&&this.trigger(new El("start",{index:this._index}));const t=this.queues.shift();t.on("start",this.onQueueStart,null,this),t.on("task:complete",this.onQueueTaskComplete,null,this),t.on("complete",this.onQueueComplete,null,this),t.on("error",this.onQueueError,null,this),t.start()}onQueueStart(e){this.trigger(new El("queue:start",{queue:e.target,index:this._index}))}onQueueTaskComplete(e){const t=e.target;this.progress.incrementCompleted(),this.trigger(new El("queue:task:complete",{queue:t,index:this._index}))}onQueueComplete(e){if(!this.running)return;const t=e.target;t.off("start",this.onQueueStart),t.off("task:complete",this.onQueueTaskComplete),t.off("complete",this.onQueueComplete),t.off("error",this.onQueueError),this.trigger(new El("queue:complete",{queue:t,index:this._index})),this.next()}onQueueError(e){const t=e.target;this.progress.incrementFailed(),this.trigger(new El("queue:error",{queue:t,index:this._index}))}next(){0===this.queues.length?this.done():this.running&&this.run()}done(){this.stop(),this.trigger(new El("complete"))}},Ol=class extends Ml{constructor(e){super(e),this._visibleTileCoords=[],this._lastIntervals=[],this.waitingOn=new Set,this.queues={primary:new Sl,background:new Cl},this._enqueueTileRequestIfNeeded=(e,t,i)=>{const r=i;r.length>0&&e.enqueue((()=>this.layer.source.requestTile(t,{intervals:r.map((e=>new Date(e))),checkPending:!1,params:{time:1===i.length?(0,Q.ay)(i[0]):void 0}}).then((()=>{this.onLoadData(r.map((e=>new Date(e))))}))))},this.triggerReadyOnComplete=!1,this.queues.background.on("queue:task:complete",this.onQueueTaskComplete,void 0,this),this.queues.background.on("complete",(()=>{this.triggerReadyOnComplete&&this.onReady(),this.onLoadComplete()}));const t=e.source;t.on(ye.A.LOAD_START,this.onSourceLoadStart,void 0,this),t.on(ye.A.LOAD_COMPLETE,this.onSourceLoadComplete,void 0,this),t.on(ye.A.TILE_LOAD_START,this.onSourceTileLoadStart,void 0,this),t.on(ye.A.TILE_LOAD,this.onSourceTileLoad,void 0,this)}dataStateForIntervals(e){const t=this._visibleTileCoords,i={};return t.length>0&&e.forEach((e=>{let r=!1;t.forEach((t=>{var i;const a=this.layer.source.getTileData(t);(a instanceof De.A||a instanceof Bt.A)&&!0!==(null===(i=a.series)||void 0===i?void 0:i.hasDataForInterval(e))&&(r=!0)})),i[e]=!r})),i}missingDataForIntervals(e){if((0,pe.E)(e)||0===this._visibleTileCoords.length)return!1;const t=this.dataStateForIntervals(e);return Object.values(t).includes(!1)}loadData(e){if((0,pe.E)(e)||0===this._visibleTileCoords.length)return;if((e.length!==this._lastIntervals.length||e.some((e=>!this._lastIntervals.includes(e)))||this._lastIntervals.some((t=>!e.includes(t))))&&this.setNeedsUpdate(),!this.isDirty||(0,pe.E)(e))return;this._updateVisibleTileCoordsState(),this._lastIntervals=[...e],this.waitingOn.clear();const t=this.interleaveRequests?function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(0===e.length)return[];const t=e.map(((e,t)=>t)),i=[t[0],t.at(-1)],r=e=>{const t=[...e].sort(((e,t)=>e-t)),i=t.length;for(let r=0;r<i-1;r++){const i=Math.floor((0,ui.C)(t[r]+(r>0?1:0),t[r+1],.5));!1===e.includes(i)&&e.push(i)}};for(;i.length<t.length;)r(i);return i.map((t=>e[t]))}(e):e,i=this._calculateMissingTileIntervals(t);if(0===i.length)return void(!1===this.isLoading&&this.onReady());this.trigger(Ya.A.DATA_REQUEST,{intervals:e}),this.invalidate(),this._isDirty=!1;const r=((e,t)=>{const i=[];return e.forEach((e=>{let{coord:r,intervals:a}=e;const s=t||a.length,n=[];if(Math.ceil(a.length/s)>1){let e=[];for(let t=0;t<a.length;t++)e.push(a[t]),e.length!==s&&t!==a.length-1||(n.push(e),e=[])}else n.push([...a]);n.forEach(((e,t)=>{i[t]||(i[t]=[]),i[t].push({coord:r,intervals:e.sort(((e,t)=>e-t))})}))})),i})(i,this.maxIntervalsPerRequest);0!==r.length&&(r.forEach(((e,t)=>{const i=new Sl;e.forEach((e=>{let{coord:t,intervals:r}=e;this._enqueueTileRequestIfNeeded(i,t,r)})),0===t&&(i.on("start",(()=>{this.onLoadStart([]),this.onLoadProgress(this.getTotalQueueProgress())})),!1===this.triggerReadyOnComplete&&i.on("complete",(()=>{this.onReady()}))),i.length>0&&this.queues.background.push(i)})),this.queues.background.length>0&&this.queues.background.start())}invalidate(){super.invalidate(),this.queues.background.cancel()}getLoadingProgress(){return this.getTotalQueueProgress()}_updateVisibleTileCoordsState(){this._visibleTileCoords=this.layer.getVisibleTileCoords().map((e=>e.normalize())),this._visibleTileBounds=La.fromCoords(this._visibleTileCoords)}_calculateMissingTileIntervals(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];const t=this.layer.source,i=[...new Set(e)],r=this._visibleTileCoords,a=[];return r.forEach((s=>{const n=this.layer.source.getTileData(s);if(this._intervalTileCache||this.setupCache(1.25*r.length),this._intervalTileCache.get(s.hash),(0,R.g)(n))a.push({coord:s,intervals:i});else if("series"in n){const e=n.series.intervalsNeedingData(i),r=i.filter((i=>!(!e.includes(i)||t.tileManager.pending.isPending(s,i))));if(r.length>0){const e=new Set(r);a.push({coord:s,intervals:[...e]})}}else{const t=new Set(e.map((e=>e)));a.push({coord:s,intervals:[...t]})}})),a}setupCache(e){this._intervalTileCache=new Ht({capacity:Math.ceil(e),onRemove:(e,t)=>{this._visibleTileBounds&&!1===this._visibleTileBounds.contains(t.coord)&&this.trigger(Ya.A.DATA_REMOVE,{tile:t})}})}getTotalQueueProgress(){return bl.from([this.queues.background.progress])}onReady(){this._isReady=!this.triggerReadyOnComplete||!0!==this.missingDataForIntervals(this._lastIntervals),super.onReady()}onQueueTaskComplete(){this.onLoadProgress(this.getTotalQueueProgress())}onSourceLoadStart(){}onSourceLoadComplete(){}onSourceTileLoadStart(e){let{tile:t}=e;var i;this._visibleTileBounds||this._updateVisibleTileCoordsState(),this._intervalTileCache||this.setupCache(1.25*this._visibleTileCoords.length),(null===(i=this._visibleTileBounds)||void 0===i?void 0:i.contains(t.coord))&&this._intervalTileCache.set(t.coord.hash,t)}onSourceTileLoad(e){}dispose(){this.invalidate();const e=this.layer.source;e.off(ye.A.LOAD_START,this.onSourceLoadStart),e.off(ye.A.LOAD_COMPLETE,this.onSourceLoadComplete),e.off(ye.A.TILE_LOAD_START,this.onSourceTileLoadStart),e.off(ye.A.TILE_LOAD,this.onSourceTileLoad)}},Rl=class extends Al{get filter(){return this._filter}constructor(e,t){super(e,Object.assign({quality:tr.E.exact,zoomOffset:0},t)),this.sourceType=t.sourceType,this.sourceLayer=t.sourceLayer,this._filter=t.filter}get metadata(){return{layerId:this.id,type:this.type,sourceLayerId:this.sourceLayer,sourceLayerType:this.sourceType,filter:this._filter,paint:this.paint}}setFilter(e){this._filter=e;const t=this.source;t&&(t.removeConsumer(this.metadata),t.addConsumer(this.metadata),t.refreshAllTileData())}getVisibleFeatures(){const e=this.getVisibleTileCoords().reduce(((e,t)=>{var i;const r=null===(i=this.source.getTileData(t))||void 0===i?void 0:i.stores;return r&&Object.values(r).forEach((t=>{e=[...e,...t.features]})),e}),[]);return e}queryFeatures(e,t,i){const{tile:r,position:a}=this.getTile(e,t,i)||{};if(r&&r.data instanceof wa){let e=[];const i=Object.keys(r.data.stores);for(let s=0;s<i.length;s++){const n=r.data.stores[i[s]].query(a.x,a.y,t);(null==n?void 0:n.length)>0&&(e=n)}return{value:e,nodata:!1}}}queryFeaturesPromise(e,t,i){return new Promise((r=>{r(this.queryFeatures(e,t,i))}))}},Il=(e,t,i)=>{const r=Math.max(0,Math.min(1,(i-e)/(t-e)));return r*r*(3-2*r)},Pl=(e,t,i,r)=>{if(e)return e[Math.trunc(i)%t.width+Math.trunc(r)%t.height*t.height]},Dl=(e,t,i,r)=>{if(!e)return;const a=t.width,s=t.height;i-=.5,r-=.5,i=Math.max(0,i),r=Math.max(0,r);const n=Math.floor(i),o=Math.floor(r),l=i-n,h=r-o,c=n%a,d=Math.min(c+1,a-1),u=o%s,p=Math.min(u+1,s-1),f=e[u*s+c],m=e[u*s+d],g=e[p*s+c],v=e[p*s+d];if(f===Ie.V5||m===Ie.V5||g===Ie.V5||v===Ie.V5)return Ie.V5;const y=Il(0,1,l),x=Il(0,1,h),b=(0,ui.C)(f,m,y),w=(0,ui.C)(g,v,y);return(0,ui.C)(b,w,x)},zl=class{get values(){return this._values}get size(){return this._size}constructor(e){this.padding=0,this._values={},this._evaluator=e}initialize(e,t){return this._values=e||{},this._size=t,this}setValueExpression(e){this._expression=e}query(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:rr.uN.none;const r=Object.assign({},this.size);let a=t.position||0;const s=this.values[t.current.timestamp],n=this.values[t.next.timestamp];if((0,R.g)(s))return;a>0&&(0,R.g)(n)&&(a=0);let o=e.x*r.width;const l=e.y*r.height;let h;o<0&&(o+=r.width);const c=i===rr.uN.none?Pl:Dl,d=this._expression;if(s instanceof Float32Array==0){const e=s,t=n;if(h=Object.keys(e).reduce(((i,s)=>{if(Pl(e[s],r,o,l)===Ie.V5)i[s]=void 0;else if(i[s]=c(e[s],r,o,l),a>0&&(0,R.n)(t)){const e=i[s],n=c(t[s],r,o,l);i[s]=(0,ui.C)(e,n,a)}return i}),{}),d)return d(h);(0,R.g)(h.value)&&(h=void 0)}else{const e=s,t=n;if((0,R.n)(e)){if(h=c(e,r,o,l),a>0){const e=h,i=c(t,r,o,l);h=(0,ui.C)(e,i,a)}h===Ie.V5&&(h=void 0)}}return h}},Ll=class{get min(){return this.range.min}get max(){return this.range.max}get delta(){return this.range.max-this.range.min}constructor(e){this.range=e}getRange(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=Math.max(this.range.min,e.min),r=Math.min(this.range.max,e.max);return t?{min:this.position(i),max:this.position(r)}:{min:i,max:r}}position(e){return(e-this.range.min)/this.delta}},kl=class{get scale(){return this._scale}get texture(){return this._texture}constructor(e){var t,i,r;this.interval=0,this.interpolate=!1,this.normalized=!1,this._getBreaks=()=>[],this._stops=[...e.stops],this.interval=null!==(t=e.interval)&&void 0!==t?t:0,this.interpolate=null===(i=e.interpolate)||void 0===i||i,this.normalized=null!==(r=e.normalized)&&void 0!==r&&r,this.range=e.range,e.breaks&&(this._getBreaks=Array.isArray(e.breaks)?()=>e.breaks:e.breaks)}setColorStops(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.range,r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];this._stops=[...e],this.interval=t,this.normalized=r,this.range=i,this._updateScale(),this._texture&&this.createLookupTexture(this._texture.context)}setValueRange(e){this.range&&this.range.min===e.min&&this.range.max===e.max||(this.range=e,this._updateScale())}createLookupTexture(e){const t=e.gl,i=this.interval,r=this._getBreaks(this.range.min,this.range.max,i),a=0===this.interval&&this.interpolate&&(0,pe.E)(r),s=a?t.LINEAR:t.NEAREST;this.scale||this._updateScale(),a||this.scale.setBreaks(this.scale.domain);const n=this.scale.getRamp({range:this.range,totalColors:this.interval>0?500:256,interval:i,breaks:r,interpolate:this.interpolate,normalize:this.normalized}).stops.map((e=>e.color)),o=new Uint8Array(4*n.length);for(let e=0,t=n.length;e<t;e++){const{r:t,g:i,b:r,a:a}=n[e];o[4*e+0]=t,o[4*e+1]=i,o[4*e+2]=r,o[4*e+3]=Math.round(255*a)}this._texture?(this.texture.image=o,this.texture.size={width:o.length/4,height:1},this.texture.minFilter=s,this.texture.magFilter=s,this.texture.needsUpdate=!0):this._texture=new ei(e,{image:o,size:{width:o.length/4,height:1},minFilter:s,magFilter:s})}_updateScale(){this._scale=(0,F.R7)(this._stops,this.range,this.normalized)}_debug(e,t,i){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;const a=Ce({width:t,height:i});a.width=t*r,a.height=i*r,a.style.width=`${t}px`,a.style.height=`${i}px`,a.style.position="absolute",a.style.bottom="5px",a.style.left="5px",a.style.zIndex="1000";const s=a.getContext("2d",{alpha:!0});s.scale(r,r);let n=0;const o=t/e.length;for(let t=0;t<e.length;t++){const r=e[t],a={r:Math.round(r.r),g:Math.round(r.g),b:Math.round(r.b),a:r.a},l=vr(a);s.beginPath(),s.fillStyle=l,s.globalAlpha=a.a,s.rect(Math.floor(n),Math.floor(0),Math.ceil(o),i),s.fill(),s.closePath(),n+=o}document.body.append(a)}dispose(){var e;null===(e=this.texture)||void 0===e||e.dispose(),this._texture=void 0}};var Fl=function(e,t){var i={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(i[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(i[r[a]]=e[r[a]])}return i};const jl=class extends vo{get channel(){return this._channel}get interpolation(){const e=this.paint.sampleInterpolation()||rr.uN.bilinear;return Object.values(rr.uN).indexOf(e)}get smoothing(){return this.paint.sampleSmoothing()||0}get drawRange(){var e;return Object.assign(Object.assign({},this.dataRange),null===(e=this.paint)||void 0===e?void 0:e.sampleDrawRange())}get dataRange(){return Object.assign({},this._dataRange.range)}get valueRanges(){return this._memoizedValueRange()}get outputRange(){return Object.assign({},this._outputRange)}get noDataValue(){var e;const t=null===(e=this.sourceMetadata)||void 0===e?void 0:e.noData;return(0,R.n)(t)?this.sourceMetadata.noData:-1}get colorValueRange(){return this._memoizedColorValueRange()}get colorLookupTables(){return this._colorLookupTables}constructor(e={}){super((0,j.$)({channel:"r",interpolation:rr.uN.none,smoothing:0,drawRange:void 0,paint:{sample:{expression:rr.BG.number}}},e)),this.sourceMetadata={},this._colorLookupTables=[],this._dataRange=new Ll({min:0,max:1}),this._debugEnabled=!1,this._memoizedValueRange=(0,X.Bj)((()=>{const e=this.layer.source;let t=[];return e instanceof Xi&&(0,$.K)(this.channel)&&(t=[...this.channel].map((t=>e.getDataRange(t)))),t})),this._memoizedColorValueRange=(0,X.Bj)((()=>{const e=Array.isArray(this.config.channel)?this.config.channel:[...this.config.channel],t=this.getColorLookupTable(e.join(""));return t?t.range:this.drawRange})),this.cachesTextures=!1}onAdd(e){super.onAdd(e)}setup(){const e=this.context,t=this.paint.sampleColorScale(),i=this.paint.sampleChannel();this._channel=i,e.gl.getExtension("OES_standard_derivatives"),this.createColorLookupTables(t||{range:{min:0,max:1},stops:[0,"#000",1,"#ff0000"],interval:1});const r=this.layer.source,a={min:0,max:255};let s,n;const o=this.paint.sampleDataRange();if(o&&(s=o),r instanceof Xi){if((0,$.K)(this.channel)){const e=this.channel;n=r.getMetadataForBand(e),(0,R.g)(s)&&(s=r.getDataRange(e)),(0,R.n)(null==n?void 0:n.noData)&&(a.min=n.noData+1)}this.colorLookupTables.forEach((t=>{var i;const a=t.channel,n=null===(i=this.paint.sampleExpressionOperation())||void 0===i?void 0:i.dataRange,o=n||r.getDataRange(a);((0,R.g)(s)||(0,R.n)(n))&&(s=o),t.range||t.setValueRange({min:s.min,max:s.max}),t.createLookupTexture(e)}))}this._outputRange=a,this._dataRange=new Ll(s),this.sourceMetadata=(0,j.$)({noData:-1},n||{})}setupEvents(){super.setupEvents(),this.layer.on(Wa,(e=>{let{property:t}=e;if(t.includes("sample.colorscale")){const e=this.paint.sampleColorScale();if(e)if(e.masks){const{masks:t}=e,i=Fl(e,["masks"]);t.forEach(((e,t)=>{const r=Object.assign(Object.assign({},e.colorscale),i),a=this.colorLookupTables[t];if(a&&e.colorscale){const e=(0,R.n)(r.interval)?r.interval:a.interval;a.setColorStops(r.stops,e,r.range,r.normalized)}}))}else Object.values(this.colorLookupTables).forEach((t=>{const i=(0,R.n)(e.interval)?e.interval:t.interval;t.setColorStops(e.stops,i,e.range,e.normalized)}))}}))}prepareDrawPasses(){}stateForDrawPass(e,t){var i,r,a;const s=this.renderState.renderables,n=(null===(i=s[0])||void 0===i?void 0:i.tile.size)||{width:Mt,height:Mt};return{renderables:s,interpolation:this.interpolation,timeState:this.timeState,progress:this.progress,sampleType:this.paint.sampleExpression(),dataRange:this.dataRange,drawRange:this.drawRange,tileSize:{width:n.width,height:n.height},tileSpan:{x:null===(r=this.renderState.dataRegion)||void 0===r?void 0:r.clampedSpan().x,y:null===(a=this.renderState.dataRegion)||void 0===a?void 0:a.clampedSpan().y},dataRegion:this.renderState.dataRegion,renderRegion:this.renderState.renderRegion,visibleRegion:this.renderState.visibleRegion,subdivisionGranularity:this.layer.map.transform.projection.subdivisionGranularity,globiness:this.layer.map.transform.globiness,isGlobe:this.layer.map.transform.isGlobe}}setColorScaleUniforms(e){if(!e)return;const t=this.paint.sampleExpression(),i=Array.isArray(this.channel)?this.channel[0]:this.channel,r=this.getChannels(t),a=this.getColorLookupTable(i),s=this.colorLookupTables,n=this.dataRange,o=this.drawRange,l=Object.assign({},n);let h=1;if(this.colorLookupTables.length>0){const e=this.colorLookupTables[0];l.min=e.range.min,l.max=e.range.max}if(this.colorLookupTables.length>1)e.setUniform("colorScale[0]",s.map((e=>e.texture))),e.setUniform("colorScaleRes[0]",s.map((e=>e.texture.size.width))),e.setUniform("colorMaskValue[0]",s.map((e=>e.value/255))),e.setUniform("colorMaskChannel[0]",s.map((e=>rr.lX.indexOf(e.channel))));else if(a){const t=a.scale;h=(this.dataRange.max-this.dataRange.min)/(t.range.max-t.range.min),e.setUniform("colorScale",a.texture),e.setUniform("colorScaleRes",a.texture.size.width)}e.setUniform("colorRangeFactor",h),e.setUniform("colorSampleOffset",this.paint.sampleOffset()),e.setUniform("dataChannel[0]",r.map((e=>rr.lX.indexOf(e)))),e.setUniform("interpolation",this.interpolation),e.setUniform("smoothing",this.paint.sampleSmoothing()),e.setUniform("dataMeld",!1===this.paint.sampleMeld()?0:this.progress),e.setUniform("outputRange",new _i(this.outputRange.min/255,this.outputRange.max/255)),e.setUniform("dataRange",new _i(n.min,n.max)),e.setUniform("dataMin",new _i(n.min,n.min)),e.setUniform("dataMax",new _i(n.max,n.max)),e.setUniform("sampleDataRange",new _i(l.min,l.max)),e.setUniform("drawRange",new _i(o.min,o.max)),e.setUniform("noData",this.noDataValue/255)}getProgramDefines(){const e=super.getProgramDefines(),t=this.config.channel;return this.noDataValue>=0&&e.push("NODATA",`NO_DATA_VALUE ${this.noDataValue}`),(0,$.K)(t)&&("r"===t?e.push("BAND_R"):"g"===t?e.push("BAND_G"):"b"===t?e.push("BAND_B"):"a"===t?e.push("BAND_A"):"rg"===t?e.push("BAND_RG"):"gb"===t?e.push("BAND_GB"):"rb"===t?e.push("BAND_RB"):"ra"===t?e.push("BAND_RA"):"ga"===t?e.push("BAND_GA"):"ba"===t?e.push("BAND_BA"):"rgb"===t?e.push("BAND_RGB"):"gba"===t?e.push("BAND_GBA"):"rgba"===t&&e.push("BAND_RGBA")),e}getChannels(e){const t=this.channel;return Array.isArray(t)?t:e!==rr.BG.number?[...t]:[t]}getColorLookupTable(e){return this.colorLookupTables.find((t=>t.channel===e))}createColorLookupTables(e){this._colorLookupTables=[];const t=this.channel;if(Array.isArray(t)){const t=[...Object.keys(e)].filter((e=>!1===rr.lX.includes(e)));if(t.length>0)throw new Error(`[MapsGL] Invalid sample colorscale configuration for {${this.layer.id}}. Value for \n 'colorscale' must be an object keyed by each value in 'channel' but found the following invalid\n key(s): ${t.join(", ")}`);Object.keys(e).forEach((t=>{if(!1===rr.lX.includes(t))throw new Error(`[MapsGL] Color channel ${t} is invalid, must be one of \n ${rr.lX.join(", ")}`);const i=new kl(e[t]);i.channel=t,this._colorLookupTables.push(i)}))}else{if(!rr.lX.includes(t))throw new Error(`[MapsGL] Invalid sample channel '${t}' defined for layer {${this.layer.id}}. Sample \n channel value must be one of ${rr.lX.join(", ")} or an array of valid channel \n values.`);{const{masks:i}=e,r=Fl(e,["masks"]);if(i&&Array.isArray(i))i.forEach((e=>{const t=e.channel;if(!1===rr.lX.includes(t))throw new Error(`[MapsGL] Color channel ${t} is invalid, must be one of \n ${rr.lX.join(", ")}`);const i=new kl(Object.assign(Object.assign({},r),e.colorscale));i.channel=t,i.value=e.value,this._colorLookupTables.push(i)}));else{const e=new kl(r);e.channel=t,this._colorLookupTables.push(e)}}}}removeColorLookupTables(){this.colorLookupTables.forEach((e=>{e.dispose()})),this._colorLookupTables=[]}dispose(){var e,t;this.removeColorLookupTables(),null===(t=null===(e=this.layer)||void 0===e?void 0:e.animator)||void 0===t||t.clearListeners(),super.dispose()}},Nl=class extends Al{constructor(e,t){t.zoomOffset=(0,R.n)(t.zoomOffset)?t.zoomOffset:-1,super(e,Object.assign({quality:tr.E.exact},t)),this.prepareTileFeatures=e=>{const t=e.tile;t&&!this.processing[t.coord.hash]&&this.prepareTileFeature(t.coord)},this.processing={}}onAdd(e){super.onAdd(e),this.addSourceEventHandler(ye.A.TILE_LOAD,this.prepareTileFeatures)}queryFeaturesPromise(e,t,i){return new Promise(((r,a)=>{const{tile:s,position:n}=this.getTile(e,t,i)||{},o=Array.isArray(null==s?void 0:s.data)?null==s?void 0:s.data[0]:null==s?void 0:s.data;o instanceof De.A?this.getTileFeature(s.coord,o,(e=>{if(e){const t=this.interpolateValue(e,n);(0,pe.Z)(t)?r({value:t,nodata:t===Ie.V5}):r(null)}else a()})):r(null)}))}queryFeatures(e,t,i){const{tile:r,position:a}=this.getTile(e,t,i)||{},s=Array.isArray(null==r?void 0:r.data)?null==r?void 0:r.data[0]:null==r?void 0:r.data;if(s instanceof De.A){const e=this.getTileFeature(r.coord,s);if(e){const t=this.interpolateValue(e,a);if((0,pe.Z)(t))return{value:t,nodata:t===Ie.V5}}}}createTimeSeriesDataProvider(){const e=new Ol(this),t=this.source;return t instanceof Xi&&(e.maxIntervalsPerRequest=Math.min(6,Math.floor(t.maxTextureSize/t.tileSize.width))),e}prepareTileFeature(e){const t=this.source.tiles.get(e),i=Array.isArray(null==t?void 0:t.data)?null==t?void 0:t.data[0]:null==t?void 0:t.data;i instanceof De.A&&this.getTileFeature(t.coord,i)}getTileFeature(e,t,i){let r;if(t instanceof De.A){const a=t.validCount,s=e.hash;if(this.renderer instanceof jl)return this.features||(this.features=new Ht({capacity:30})),r=this.features.get(s),r&&Object.keys(r.values||{}).length===a?i&&i(r):(0,R.n)(this.processing[s])?i&&this.processing[s].push(i):(this.processing[s]=i?[i]:[],this.createFeature(s,t,this.renderer).then((e=>{this.processing[s].forEach((t=>t(e))),delete this.processing[s]}))),r}}interpolateValue(e,t){const i=this.renderer,r=this.paint.sampleInterpolation()||rr.uN.bilinear,{min:a,max:s}=i.dataRange,{min:n,max:o}=i.drawRange,l={current:{column:i.timeState.index,row:0,timestamp:i.timeState.interval},next:{column:i.timeState.nextIndex,row:0,timestamp:i.timeState.nextInterval},position:i.paint.sampleMeld()?i.progress:0},h=e.query(t,l,r);let c=(0,te.G)(h)?h.value:h;return c=(0,Le.q)(c,a,s),c<n||c>o?Ie.V5:h}createFeature(e,t,i){if(!this.worker){let e=Gi.getWorker("encoded");(0,R.g)(e)&&(e="mapsgl.encoded.worker.js",Gi.addWorker("encoded",e));const t=new Vi(e);this.worker=new $i(t)}let r=-1;return this.renderer instanceof jl&&(r=this.renderer.noDataValue),this.worker.send({command:"getValues",encoded:t.serialized(),config:{expression:this.paint.sampleExpression(),channels:Array.isArray(i.channel)?i.channel:[...i.channel],dataRange:i.dataRange,drawRange:i.colorValueRange,valueRanges:i.valueRanges,sampleOffset:this.paint.sampleOffset(),noDataValue:r}}).then((i=>{let{values:r,size:a}=i;var s;if(!this.renderer)return;const n=(new zl).initialize(r,a),o=null===(s=this.paint.sampleExpressionOperation())||void 0===s?void 0:s.value;return me(o)&&n.setValueExpression((e=>o(e))),n.padding=t.padding,this.features.set(e,n),n}))}},Vl=e=>{const t=Lt(e);return`${Math.round(t.x*it)}_${Math.round(t.y*it)}`},Bl=class extends Rl{constructor(e,t){const i=t.source instanceof Ea?t.source:new Ea(`${e}-geojson`,{data:{type:"FeatureCollection",features:[]}}),r=Object.assign({},t);delete t.sourceLayer;const a=t.source;t.source=i,super(e,Object.assign({quality:tr.E.exact,zoomOffset:0},t)),this._aggregatedFeatures=[],this._currentIndex=0,this._seriesDataByCoord={},this.aggregateVectorTileFeatures=(0,Ma.s)((()=>{if(!this.map||!this.valuePropertyName||!this._aggregator)return;const e=this._aggregator.source,t=this._aggregator.layer,i=this.valuePropertyName,r=this.getVisibleTileCoords(),a=[];r.forEach((r=>{const s=e.getTileData(r),n=null==s?void 0:s.stores[t.id];n instanceof ba&&(n.features||[]).forEach((e=>{const t=e.geometry[0],s=Rt(t.x,t.y,r),n=Vl(s),o=this._seriesDataByCoord[n];(0,pe.Z)(null==o?void 0:o.values[this._currentIndex])&&(e.properties[i]={value:o.values[this._currentIndex]}),a.push({type:"Feature",geometry:{type:"Point",coordinates:[s.lon,s.lat]},properties:e.properties})}))})),this._aggregatedFeatures=a,this._throttleUpdate()}),100),this._throttleUpdate=ma((()=>{this.update()}),150),this._origConfig=Object.freeze(r),a.type===Re.o.vector&&a instanceof Aa&&(this._aggregator={source:a,layer:null})}get geojsonSource(){return this.source}get queryLayer(){return this._queryLayer}set queryLayer(e){this._queryLayer&&(this._queryLayer.off(Ua,this.onNeedsDataUpdate),this._queryLayer.off(Ha,this.onNeedsDataUpdate)),this._queryLayer=e}get valuePropertyName(){var e;return null===(e=this.queryLayer)||void 0===e?void 0:e.id.replaceAll(".","-")}onAdd(e){var t,i,r,a,s;if((0,ue.vA)(this.source instanceof Ea,"[MapsGL] DataQueryTileLayer requires a GeoJSONSource"),(0,ue.vA)((0,pe.Z)(this.queryLayer),"[MapsGL] DataQueryTileLayer requires a query layer"),null===(t=this._aggregator)||void 0===t?void 0:t.source){this.map.hasSource(this.source.id)||this.map.addSource(this.source.id,this.source),this._aggregator.source.on(ye.A.TILE_LOAD,this.aggregateVectorTileFeatures,null,this);const e=this._origConfig,t=this.map.addLayer(`${this.id}::data-points`,{type:tr.m.data,source:this._aggregator.source,sourceLayer:e.sourceLayer,sourceType:e.sourceType,filter:e.filter,zoomOffset:e.zoomOffset,paint:this.paint.config});t instanceof Rl&&(this._aggregator.layer=t,this.map.on(Ja,this.aggregateVectorTileFeatures,null,this)),this.aggregateVectorTileFeatures()}else this.map.on(Ja,this._throttleUpdate,null,this);this.map.on(rs,this.onMapUnitsChange,null,this),this.on(Wa,(e=>{let{property:t}=e;/^text.*\.value/.test(t)&&this.update(!0)})),this.enableQueryLayerAnimation(),this.queryLayer.on(Ba,this.enableQueryLayerAnimation,null,this),this.queryLayer.on(Ua,this.onNeedsDataUpdate,null,this),this.queryLayer.on(Ha,this.onNeedsDataUpdate,null,this),null===(r=null===(i=this.queryLayer.animator)||void 0===i?void 0:i.animation)||void 0===r||r.on(Ra.A.ADVANCE,this._throttleUpdate,null,this),null===(s=null===(a=this.queryLayer.animator)||void 0===a?void 0:a.animation)||void 0===s||s.on(Ra.A.END,this.onNeedsDataUpdate,null,this);for(let e=0;e<this.paint.textLineCount();e++){const t=this.paint.textValue(null,e);"string"!=typeof t&&"{dataProp}"===(null==t?void 0:t.property)&&(t.property=`${this.valuePropertyName}.value`)}this.onMapUnitsChange();const n=this.source;n instanceof Ea&&((0,pe.E)(n.data)?n.once(ye.A.LOAD_COMPLETE,(()=>{this.updateFeaturesFromGeoJSONSource(),this.setNeedsUpdate()})):(n.on(ye.A.DATA_CHANGE,this.updateFeaturesFromGeoJSONSource,null,this),this.setNeedsUpdate())),super.onAdd(e)}onRemove(){var e,t,i,r,a;if(super.onRemove(),this.map.off(rs,this.onMapUnitsChange),this.queryLayer&&(!1===this.queryLayer.visible&&(null===(e=this.queryLayer.animator)||void 0===e||e.animation.disable()),this.queryLayer.off(Ba,this.enableQueryLayerAnimation),this.queryLayer.off(Ua,this.onNeedsDataUpdate),this.queryLayer.off(Ha,this.onNeedsDataUpdate),null===(i=null===(t=this.queryLayer.animator)||void 0===t?void 0:t.animation)||void 0===i||i.off(Ra.A.ADVANCE,this._throttleUpdate),null===(a=null===(r=this.queryLayer.animator)||void 0===r?void 0:r.animation)||void 0===a||a.off(Ra.A.END,this.onNeedsDataUpdate)),this.queryLayer=null,this._aggregator){const e=this._aggregator.source,t=this._aggregator.layer;this.map.off(Ja,this.aggregateVectorTileFeatures),this.map.hasSource(this.source.id)&&this.map.removeSource(this.source.id),e&&e.off(ye.A.TILE_LOAD,this.aggregateVectorTileFeatures),t&&this.map.hasLayer(t.id)&&this.map.removeLayer(t.id)}else this.source.off(ye.A.DATA_CHANGE,this.updateFeaturesFromGeoJSONSource),this.map.off(Ja,this._throttleUpdate)}enableQueryLayerAnimation(){var e,t;null===(t=null===(e=this.queryLayer.animator)||void 0===e?void 0:e.animation)||void 0===t||t.enable()}onNeedsDataUpdate(){this.update()}onMapUnitsChange(){var e;if(!this.map)return;const t=this.map.getUnits();for(let i=0;i<this.paint.textLineCount();i++){const r=this.paint.textValue(null,i);if("string"!=typeof r){const a=null===(e=null==r?void 0:r.measurement)||void 0===e?void 0:e.type;(0,pe.Z)(a)&&t[a]&&(Array.isArray(this.paint.config.text)?this.setPaintProperty(`text[${i}].value.measurement.units`,t[a]):this.setPaintProperty("text.value.measurement.units",t[a]))}}}updateFeaturesFromGeoJSONSource(){var e;this.source instanceof Ea&&(this._aggregatedFeatures=(null===(e=this.source.data)||void 0===e?void 0:e.features)||[])}update(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];var t,i,r,a,s;if((0,pe.E)(this.valuePropertyName))return;const n=this.geojsonSource,o=this.valuePropertyName,l={current:0,next:0};let h=e,c=!1;if(!(null===(t=this.queryLayer)||void 0===t?void 0:t.map))throw new Error(`[MapsGL] Required data query layer associated with '${this.id}' does not exist on the map.`);if(this.queryLayer.animator){const e=this.queryLayer.animator.info;l.current=e.dataIndex,l.next=e.nextDataIndex}if(n instanceof Ea){const e=n.data;if(!e)return void console.warn("No GeoJSON data to update");const t=this._aggregatedFeatures||[];let d=this.map.getZoom();const u=this.map.getBounds(),p=(null===(r=null===(i=this.queryLayer.animator)||void 0===i?void 0:i.animation)||void 0===r?void 0:r.position)||0,f=(null===(s=null===(a=this.queryLayer.animator)||void 0===a?void 0:a.animation)||void 0===s?void 0:s.duration)||0,m=Math.floor(1e3*f/200),g=Math.floor(p*m);this._currentIndex=g;const v=new Set([]);this.queryLayer instanceof Al&&(d=this.queryLayer.getDataZoom()),t.forEach((e=>{var t,i,r,a,s;if("Point"===(null===(t=e.geometry)||void 0===t?void 0:t.type)&&(0,pe.Z)(null===(i=e.geometry)||void 0===i?void 0:i.coordinates)){const t={lat:e.geometry.coordinates[1],lon:e.geometry.coordinates[0]},i=Vl(t);if(e.properties||(e.properties={}),((e,t)=>{let i=e.lon;return t.west<-180&&i>t.east?i-=360:t.east>180&&i<t.west&&(i+=360),e.lat<=t.north&&e.lat>=t.south&&i>=t.west&&i<=t.east})(t,u)){const n=this._seriesDataByCoord[i]||{zoom:d,values:[],index:Object.assign({},l)};(0,pe.E)(n.values)&&(n.values=[].fill(m,null)),e.properties[o]||(e.properties[o]={value:null});const u=n.index.current!==l.current||n.index.next!==l.next;if((0,R.g)(n.values[g])||d>n.zoom||u){const i=this.queryLayer.queryFeatures(t,d,!1);if((0,pe.Z)(i)){if(n.zoom=d,n.index=Object.assign({},l),!1===Array.isArray(i)){const{value:t,nodata:a}=i;!1===a?"number"==typeof t?n.values[g]=t:(0,R.n)(t.value)&&(n.values[g]=t.value):n.values[g]=Ie.V5,v.has(null===(r=e.properties)||void 0===r?void 0:r.place.name)}}else c=!0}const p=n.values[g],f=null===(a=e.properties[o])||void 0===a?void 0:a.value;let y=(0,pe.Z)(p)&&p!==f;if((0,pe.Z)(f)&&(0,pe.Z)(p)&&(y=Math.abs(f-p)>1e-5),v.has(null===(s=e.properties)||void 0===s?void 0:s.place.name),y||p===Ie.V5){const t=!(Number.isNaN(p)||p===Ie.V5);e.properties[o].value=t?p:void 0,h=!0}this._seriesDataByCoord[i]=n}}})),t.length!==e.features.length&&(h=!0),h&&(t.filter((e=>v.has(e.properties.place.name))).forEach((e=>{})),n.setData({type:"FeatureCollection",features:t})),c&&this._throttleUpdate()}}},Ul=class extends hl{constructor(e,t){super(e),this.id="draw-vector-tiles",this.enableBlend=!0}canDrawTile(e,t){var i;return(null===(i=null==e?void 0:e.tile)||void 0===i?void 0:i.data)instanceof wa}beforeRender(e){e.renderTarget&&(this.clear=!0),super.beforeRender(e)}draw(e){const{renderables:t,mapZoom:i}=e.state,r=Math.floor(i);this._lastZoom!==r&&(this.onZoomChange(r,e),this._lastZoom=r);for(let i=0,r=t.length;i<r;i++){const r=t[i],a=r.tile;this.canDrawTile(r,e)&&this.drawTile(e,r,a.data)}}drawTile(e,t,i){throw new Error("[MapsGL] Subclasses must override `drawTile`")}prepareTile(e,t,i){var r;const a=this.context,s=i.program,n=e.state.style,{elapsedTime:o,transform:l}=e.state,h=t.tile,c=dl.fromTileRenderable(t,void 0),d=c.scale,u=c.offset,p=c.uvOffset,f=a.resolution,m=(new Ai.A).inverse(i.worldMatrix),{matrix:g}=l.calculateTilePos(t.coord),v=h.coord,y=Oi(h.coord,Mt,1,l.state.zoom);null===(r=e.configurator)||void 0===r||r.prepareDrawPass(this,e);const x=n.symbolPitchWithMap(),b=n.symbolRotateWithMap(),w=l.calculateGlobeCameraUp(),_=l.getPixelsToClipSpaceMatrix(x,b,y),A=l.getClipSpaceToPixelsMatrix(x,b,y),M=1/l.worldSizeScale;s.setUniform("time",o),s.setUniform("zoom",l.state.zoom),s.setUniform("resolution",new _i(f.width,f.height)),s.setUniform("viewportSize",new _i(f.width,f.height)),s.setUniform("dpr",this.context.dpr),s.setUniform("worldScale",M),s.setUniform("dataResolution",new _i(h.size.width,h.size.height)),s.setUniform("dataScale",p[2]),s.setUniform("tileCoordOffset",(new Ne.A).fromArray(p)),s.setUniform("inverseWorldMatrix",m),s.setUniform("labelPlaneMatrix",A),s.setUniform("glCoordMatrix",_),s.setUniform("tileMatrix",g),s.setUniform("tileCoord",new Ve.A(v.x,v.y,v.z)),s.setUniform("pitch",(0,ke.p)(l.state.pitch)),s.setUniform("pitchedScale",l.circleRadiusCorrection),s.setUniform("cameraToCenterDistance",l.cameraToCenterDistance),s.setUniform("cameraPosition",l.cameraPosition),s.setUniform("cameraUp",w);const T=1/Tt(l.state.zoom-h.coord.z);s.setUniform("pixelToUnitScaled",1/h.size.width/a.dpr*T*(1/(l.tileSize/512))),s.setUniform("tilePixelRatio",it/Mt*T),s.setUniform("mapPixelRatio",it/Mt*Tt(l.state.zoom)),i.scale.set(d.x,d.y,1),i.position.set(u.x,u.y,0)}drawMesh(e,t,i,r,a,s,n,o){if(this.prepareTile(e,t,i),a)if(i.updateGeometry(a),i.drawMode=n,o)for(let t=0;t<o.length;t++){const n=o[t];a.drawRange.count=n.index.length*s,a.drawRange.start=n.index.offset*s,e.scene?e.scene.render(i,r):(i.updateMatrixWorld(),i.draw({camera:r}))}else e.scene?e.scene.render(i,r):(i.updateMatrixWorld(),i.draw({camera:r}))}onZoomChange(e,t){}},$l=class extends Ul{constructor(e,t={}){super(e),this._pattern=t.pattern}beforeRender(e){super.beforeRender(e);const t=this.getProgram(this._pattern?"fillPattern":"fill",e);this.mesh||(this.mesh=new ll(this.context,this.context.cache.getFullscreenQuad().geometry,t)),this.mesh.program=t}drawTile(e,t,i){var r,a;const{style:s}=e.state;this._drawTile(e,"fill",t,i),(null===(a=null===(r=s.config)||void 0===r?void 0:r.stroke)||void 0===a?void 0:a.color)&&this._drawTile(e,"fill-outline",t,i)}_drawTile(e,t,i,r){const a=this.context,s=a.gl,{layerId:n,style:o,mapStyle:l}=e.state,h=r.getDrawData(this.context,t,n,{paint:o,mapStyle:l}),{geometry:c,size:d}=(null==h?void 0:h.primary)||{},u=i.tile;if(!c)return;const p=this.mesh,f=e.renderTarget?a.cache.getFullscreenQuad().camera:void 0,m="fill-outline"===t?s.LINES:s.TRIANGLES,g=p.program;if("fill"===t&&this._pattern){const t=Math.floor(e.state.transform.state.zoom),i=Math.pow(2,u.coord.z),s=r.imageAtlas,n=1/Oi(u.coord,Mt,1,t),o=Mt*Math.pow(2,t)/i,l=o*(u.coord.x+u.coord.wrap*i),h=o*u.coord.y;g.setUniform("pixelToUnit",n),g.setUniform("pixelCoordUpper",new _i(l>>16,h>>16)),g.setUniform("pixelCoordLower",new _i(65535&l,65535&h)),s&&(s.patchUpdatedImages(e.state.mapStyle.imageManager),s.prepareTexture(a),g.setUniform("tAtlas",s.texture),g.setUniform("atlasResolution",new _i(s.size.width,s.size.height)))}c.forEach(((t,r)=>{p.updateGeometry(t),this.drawMesh(e,i,p,f,t,d,m,null)}))}dispose(){var e;super.dispose(),null===(e=this.mesh.geometry)||void 0===e||e.dispose()}},Gl=class extends Ul{constructor(){super(...arguments),this.enableAlpha=!1}draw(e){const t=this.getProgram("line",e);this.mesh||(this.mesh=new ll(this.context,this.context.cache.getFullscreenQuad().geometry,t)),this.mesh.program=t,super.draw(e)}drawTile(e,t,i){var r,a,s,n,o,l;const h=this.context,c=h.gl,{layerId:d,style:u,mapStyle:p}=e.state,f=i.getDrawData(this.context,"line",d,{paint:u,mapStyle:p});if(!f)return;const m=e.renderTarget?h.cache.getFullscreenQuad().camera:void 0,{segments:g,size:v}=(null==f?void 0:f.primary)||{},y=this.mesh;if(h.state.setCullFace(c.FRONT),null===(r=f.joins)||void 0===r?void 0:r.geometry){const i=null===(a=f.joins)||void 0===a?void 0:a.geometry,r=this.enableAlpha?c.TRIANGLES:c.TRIANGLE_FAN;y.program=this.getProgram("lineJoin",e),i.forEach(((i,a)=>{this.drawMesh(e,t,y,m,i,v,r,g)}))}if(null===(s=f.caps)||void 0===s?void 0:s.geometry){const i=null===(n=f.caps)||void 0===n?void 0:n.geometry;y.program=this.getProgram("lineCap",e),i.forEach(((i,r)=>{this.drawMesh(e,t,y,m,i,v,c.TRIANGLES,g)}))}if(null===(o=f.primary)||void 0===o?void 0:o.geometry){const i=null===(l=f.primary)||void 0===l?void 0:l.geometry;y.program=this.getProgram("line",e),i.forEach(((i,r)=>{this.drawMesh(e,t,y,m,i,v,c.TRIANGLES,g)}))}}prepareTile(e,t,i){super.prepareTile(e,t,i);const r=i.program,{style:a}=e.state;r.setUniform("lineWidth",(a.strokeThickness({zoom:t.coord.z})||2)*this.context.dpr),r.setUniform("opacity",a.strokeOpacity())}dispose(){var e,t;super.dispose(),null===(t=null===(e=this.mesh)||void 0===e?void 0:e.geometry)||void 0===t||t.dispose()}},ql=class extends Ul{beforeRender(e){super.beforeRender(e);const t=this.getProgram(this.getProgramName(),e);this.mesh||(this.mesh=new ll(this.context,this.context.cache.getFullscreenQuad().geometry,t)),this.mesh.program=t}drawTile(e,t,i){const r=this.context,a=r.gl,{layerId:s,style:n,mapStyle:o}=e.state,l=i.getDrawData(this.context,"circle",s,{paint:n,mapStyle:o}),{geometry:h,segments:c,size:d}=(null==l?void 0:l.primary)||{};if(!h)return;const u=this.mesh,p=e.renderTarget?r.cache.getFullscreenQuad().camera:void 0;h.forEach(((i,r)=>{u.updateGeometry(i),this.drawMesh(e,t,u,p,i,d,a.TRIANGLES,c)}))}getProgramName(){return"circle"}},Wl=e=>("string"!=typeof e&&(e=JSON.stringify(e.toString()).replaceAll(/\s+/g," ")),window.btoa(e)),Hl=class extends Ul{constructor(e,t={}){super(e),this._usesCustomShader=!1,this.options=Object.freeze(t),this._usesCustomShader=(0,pe.Z)(t.fragmentShader)}beforeRender(e){super.beforeRender(e);const t=e.state.style;this._restoreBlending=this.context.state.opts.blending;const i=t.iconBlending()||this._restoreBlending;this.context.state.setBlending(i)}afterRender(e){super.afterRender(e),this.context.state.setBlending(this._restoreBlending)}draw(e){this.mesh||(this.mesh=new ll(this.context,this.context.cache.getFullscreenQuad().geometry,null)),super.draw(e)}drawTile(e,t,i){const r=this.context,a=r.gl,{layerId:s}=e.state,n=e.state.style,o=i.getStore("symbol",s),l=i.getDrawData(this.context,"symbol",s,{paint:n,mapStyle:e.state.mapStyle,opacityState:e.state.opacityState}),{buffer:h,segments:c,size:d}=(null==l?void 0:l.primary)||{},u=null==h?void 0:h.icon;if(!u||o instanceof da==0)return;const p=o.includesSDFIcons&&!this._usesCustomShader,f=e.renderTarget?r.cache.getFullscreenQuad().camera:void 0,m=this.mesh;let g;(0,pe.Z)(this.options.onBeforeCompile)?g=`draw-symbol-${Wl(this.options.onBeforeCompile)}`:(0,pe.Z)(this.options.fragmentShader)&&(g=`draw-symbol-${Wl(this.options.fragmentShader)}`),p&&(g=null==g?void 0:g.replace("-symbol","-sdf-symbol"));const v=this.getProgram(this.getProgramName(p),e,{cacheKey:g,fragmentShader:this.options.fragmentShader,onBeforeCompile:this.options.onBeforeCompile,defines:[...e.defines]});if(m.program=v,m.updateGeometry(u),i.imageAtlas){i.imageAtlas.patchUpdatedImages(e.state.mapStyle.imageManager),i.imageAtlas.prepareTexture(r),v.setUniform("tAtlas",i.imageAtlas.texture);const t=n.iconAtlas();if(t){const e=i.imageAtlas.image,r=i.imageAtlas.iconPositions[t.ids[0]],a=e.height/r.h;v.setUniform("atlasColumns",Math.floor(e.width/r.w)),v.setUniform("atlasRows",Math.floor(a)),v.setUniform("atlasInterval",t.interval),v.setUniform("atlasRes",new _i(i.imageAtlas.size.width,i.imageAtlas.size.height))}}p&&n.strokeThickness()>0&&(v.setUniform("isHalo",!0),this.drawMesh(e,t,m,f,u,d,a.TRIANGLES,c)),v.setUniform("isHalo",!1),this.drawMesh(e,t,m,f,u,d,a.TRIANGLES,c)}prepareTile(e,t,i){super.prepareTile(e,t,i),i.program.setUniform("rotation",e.state.style.iconRotation())}getProgramName(e){return e?"symbolSdf":"symbol"}},Zl={autoResize:!0},Yl=class extends hl{constructor(e,t,i=Zl){super(e),this._passes=[],this.id="save",this._passes=t,t.forEach((e=>{e.prerender=!0}));const r=e.gl,a=new vs(e,Object.assign({size:e.resolution,minFilter:r.LINEAR,magFilter:r.LINEAR,format:r.RGBA},i));a.name="SavePass.rt",i.autoResize&&e.on("resize",(e=>{let{width:t,height:i}=e;a.resize(t,i)})),this.renderTarget=a,this.needsSwap=!1}setSize(e,t){this.renderTarget.resize(e,t)}getPass(e){let t;return this._passes.forEach((i=>{i.id===e&&(t=i)})),t}enablePass(e,t){const i=this.getPass(e);i&&(i.enabled=t)}draw(e){const t=this.context,i=this._passes.filter((e=>e.enabled)),r=this.renderTarget;for(let a=0;a<i.length;a++){const s=i[a];s.shouldUpdateViewport=!1,s.renderTarget||(r.bind(),t.state.setViewport(r.viewport.z,r.viewport.w)),s.render(e)}r.unbind()}dispose(){var e;super.dispose(),null===(e=this.renderTarget)||void 0===e||e.dispose()}},Xl=class extends hl{constructor(){super(...arguments),this.textureId="dataTexture",this.needsSwap=!1}get renderTarget(){if(this.fbo&&this.offscreen)return this.fbo.write}beforeRender(e){super.beforeRender(e);const t=this.getProgram(this.programName||(this.fullscreen?"screen":"texture"),Object.assign({},e));this.mesh||(this.mesh=new ll(this.context,this.context.cache.getFullscreenQuad().geometry,t)),this.mesh.program=t}draw(e){const t=this.mesh,i=t.program;if(!i)return;const r=this.fbo?this.fbo.read.texture:this.texture,a=e.renderTarget||this.fullscreen?this.context.cache.getFullscreenQuad().camera:e.camera;r?(i.setUniform(this.textureId,r),i.setUniform("dataResolution",new _i(r.size.width,r.size.height)),e.scene&&!this.fullscreen?e.scene.render(t,a):t.draw({camera:a}),this.needsSwap&&this.fbo.swap()):console.warn(`[MapsGL] No texture resource provided for TexturePass with textureId '${this.textureId}' in draw pass '${this.id}'`)}dispose(){super.dispose(),this.texture=void 0,this.fbo=void 0}},Ql=class extends Ul{draw(e){const t=this.getProgram("text",e);this.mesh||(this.mesh=new ll(this.context,this.context.cache.getFullscreenQuad().geometry,t)),this.mesh.program=t,super.draw(e)}drawTile(e,t,i){const r=this.context,a=r.gl,{layerId:s}=e.state,n=i.getDrawData(this.context,"symbol",s,{paint:e.state.style,mapStyle:e.state.mapStyle,opacityState:e.state.opacityState}),{buffer:o,segments:l,size:h}=(null==n?void 0:n.primary)||{},c=null==o?void 0:o.text;if(!c)return;const d=this.mesh,u=e.renderTarget?r.cache.getFullscreenQuad().camera:void 0,p=d.program;p.setUniform("isHalo",!0),this.drawMesh(e,t,d,u,c,h,a.TRIANGLES,l),p.setUniform("isHalo",!1),this.drawMesh(e,t,d,u,c,h,a.TRIANGLES,l)}prepareTile(e,t,i){super.prepareTile(e,t,i);const r=i.program,a=(new Ai.A).inverse(i.worldMatrix);r.setUniform("inverseWorldMatrix",a),r.setUniform("inverseViewMatrix",(new Ai.A).inverse(i.worldMatrix))}onZoomChange(e,t){const{layerId:i,renderables:r,style:a,opacityState:s}=t.state;for(let e=0,t=r.length;e<t;e++){const t=r[e].tile;(null==t?void 0:t.data)instanceof wa&&t.data.updateSymbolOpacity(i,a,s)}}dispose(){var e;super.dispose(),null===(e=this.mesh.geometry)||void 0===e||e.dispose()}};let Kl;const Jl=class extends vo{constructor(e={}){super(Object.assign({type:"fill"},e)),this.enableAlpha=!1,this.cachesTextures=!1}prepareDrawPasses(){var e;this.context.gl.getExtension("OES_standard_derivatives");const t=[];switch(this.config.type){case"fill":{const e=this.paint.fillPattern(),i=new $l(this.context,{pattern:!!e});t.push(i);break}case"line":{const e=new Gl(this.context);t.push(e);break}case"circle":{const e=new ql(this.context);t.push(e);break}case"text":case"symbol":{const i=new Hl(this.context,{onBeforeCompile:null===(e=this.paint.config.icon)||void 0===e?void 0:e.shaderOnBeforeCompile,fragmentShader:this.paint.iconShader()});t.push(i);const r=new Ql(this.context);t.push(r),this.isAnimated=this.paint.iconAnimated()||this.paint.animated();break}}if(this.layer.isLayerMask)t.forEach((e=>{this.passes.addPass(e)}));else{const e=new Yl(this.context,t);e.clear=!0,e.prerender=!0,this.passes.addPass(e);const i=new Xl(this.context);i.id="screen",i.fullscreen=!0,i.texture=e.renderTarget.texture,i.textureId="tOutput",i.enableBlend=!0,this.passes.addPass(i)}}stateForDrawPass(e,t){const i=Object.assign(Object.assign({},super.stateForDrawPass(e,t)),{renderables:this.renderState.renderables,layerId:this.layer.id,style:this.paint,mapStyle:this.layer.map.style,elapsedTime:this.renderState.elapsedTime,transform:this.layer.map.transform});return e instanceof Ql&&(i.opacityState=this.layer.map.placement.getOpacityState(this.layer.id)),i}prepareDrawPass(e,t){var i;super.prepareDrawPass(e,t);const r=null===(i=e.mesh)||void 0===i?void 0:i.program;if(r)if(e instanceof Xl)r.setUniform("opacity",this.paint.opacity(this.getInfoForStyles()));else if(e instanceof Hl);else if(e instanceof Ql){const e=this.layer.map.style.getFontTextures(this.context);(null==e?void 0:e.length)>0?r.setUniform("tFont[0]",e):(Kl||(Kl=new ei(this.context)),r.setUniform("tFont[0]",Kl))}}getProgramDefines(){const e=super.getProgramDefines(),t=this.config.type,i=this.paint.symbolPitchWithMap(),r=this.paint.symbolRotateWithMap(),a=this.paint.symbolScaleWithMap(),s=this.paint.symbolSizeAttenuation();if((0,W.h)(this.paint.iconAtlas()),"line"===t){const t=this.paint.strokeLineJoin(),i=this.paint.strokeLineCap();t===or.p.Bevel?e.push("JOIN_BEVEL"):t===or.p.Miter?e.push("JOIN_MITER"):t===or.p.Round&&e.push("JOIN_ROUND"),i===or.$.Butt?e.push("CAP_BUTT"):i===or.$.Square?e.push("CAP_SQUARE"):i===or.$.Round&&e.push("CAP_ROUND"),this.enableAlpha&&e.push("LINE_ALPHA")}return("symbol"===t&&(0,pe.E)(this.paint.iconShader())||"text"===t)&&e.push("USE_ATLAS"),i&&e.push("PITCH_WITH_MAP"),r&&e.push("ROTATE_WITH_MAP"),a&&e.push("SCALE_WITH_MAP"),s&&e.push("SIZE_ATTENUATION"),e}},eh=function(e,t,i){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[0,0,1,1];const a={x:1/e,y:1/t};return((e,t,i)=>[e.x+t.x*i[0],e.y+t.y*i[1],t.x*i[2],t.y*i[3]])({x:a.x*Math.min(i,e),y:0},a,r)},th=class extends hl{constructor(e,t={}){super(e),this.multichannel=!1,this.options=Object.freeze(t)}beforeRender(e){super.beforeRender(e);const{visibleRegion:t,dataRegion:i,subdivisionGranularity:r,isGlobe:a}=e.state;this.mesh||(this.mesh=new ll(this.context,this.context.cache.getFullscreenQuad().geometry,null));const s=r.tile.getGranularityForZoomLevel(t.zoom),n=a?s*Math.max(1,t.zoom-i.zoom):1;ul(this.mesh,n);const o=this.getProgram(this.getProgramName(),e,{includes:{custom_expression:this.options.shaderChunk}});this.mesh.program=o}draw(e){var t,i;const{renderables:r,timeState:a}=e.state;for(let s=0,n=r.length;s<n;s++){const n=r[s],o=n.tile,l=o.data;l instanceof De.A&&(l.updateTextures(this.context,a),this.canDrawTile(o)&&this.drawTile(e,n,{current:(null===(t=l.renderTargets.current)||void 0===t?void 0:t.texture)||l.textures.current,next:(null===(i=l.renderTargets.next)||void 0===i?void 0:i.texture)||l.textures.next}))}}canDrawTile(e){var t,i;return(null==e?void 0:e.data)instanceof De.A&&(0,R.n)(null===(i=null===(t=e.data)||void 0===t?void 0:t.textures.current)||void 0===i?void 0:i.image)}drawTile(e,t,i){const r=i.current,a=i.next,s=this.mesh,n=s.program,o=void 0,l=t.tile,h=dl.fromTileRenderable(t,void 0),c=h.scale,d=h.offset,u=[...h.uvOffset],p=l.data instanceof De.A?l.data.padding:0,f=t.partialScale>1?t.coord:t.tile.coord,m=eh(1,1,0,u);n.setUniform("dataResolution",new _i(r.size.width,r.size.height)),n.setUniform("dataCoordOffset",(new Ne.A).fromArray(m)),n.setUniform("dataTextureCoordOffset",(new Ne.A).fromArray(m)),n.setUniform("dataTexture",r),n.setUniform("dataTextureNext",a),n.setUniform("edgePad",p),n.setUniform("tileCoord",new Ve.A(f.x,f.y,f.z)),s.scale.set(c.x,c.y,1),s.position.set(d.x,d.y,0),e.scene?e.scene.render(s,o):(s.updateMatrixWorld(),s.draw({camera:o}))}getProgramName(){return this.multichannel?"colorizeMultiband":"colorize"}},ih=class extends hl{beforeRender(e){super.beforeRender(e);const t=this.getProgram("colorMask",e);this.mesh||(this.mesh=new ll(this.context,this.context.cache.getFullscreenQuad().geometry,t)),this.mesh.program=t}draw(e){const{renderables:t,timeState:i}=e.state;for(let r=0,a=t.length;r<a;r++){const a=t[r],s=a.tile,n=s.data;n instanceof De.A&&(n.updateTextures(this.context,i),this.canDrawTile(s)&&this.drawTile(e,a,n.textures))}}canDrawTile(e){var t,i;return(null==e?void 0:e.data)instanceof De.A&&(0,R.n)(null===(i=null===(t=e.data)||void 0===t?void 0:t.textures.current)||void 0===i?void 0:i.image)}drawTile(e,t,i){const r=t.tile.data;if(r instanceof De.A){r.renderTargets.current||(r.renderTargets.current=this.createRenderTarget()),r.renderTargets.next||(r.renderTargets.next=this.createRenderTarget());const e=new dl;this.drawToRenderTarget(this.mesh,i.current,r.renderTargets.current,r.textures.current.size,e),this.drawToRenderTarget(this.mesh,i.next,r.renderTargets.next,r.textures.next.size,e)}}createRenderTarget(){return this.context.createFramebuffer({size:{width:Mt,height:Mt},minFilter:this.context.gl.NEAREST,magFilter:this.context.gl.NEAREST})}drawToRenderTarget(e,t,i,r,a){const s=this.context.cache.getFullscreenQuad().camera,n=a.scale,o=a.offset;i.resize(r.width,r.height),i.bind(),this.context.state.setViewport(r.width,r.height),e.program.setUniform("dataCoordOffset",(new Ne.A).fromArray([0,0,1,1])),e.program.setUniform("dataTexture",t),e.program.setUniform("dataResolution",new _i(t.size.width,t.size.height)),e.scale.set(n.x,n.y,1),e.position.set(o.x,o.y,0),e.updateMatrixWorld(),e.draw({camera:s})}},rh=class extends jl{prepareDrawPasses(){super.prepareDrawPasses();const e=Object.keys(this.colorLookupTables).length>1;if(e){const e=new ih(this.context);e.prerender=!0,this.passes.addPass(e)}const t=new th(this.context,{shaderChunk:this.getCustomExpressionChunk()});t.id="colorize-tile",t.enableBlend=!0,t.channel=Array.isArray(this.channel)?this.channel[0]:this.channel,t.multichannel=e,this.passes.addPass(t)}prepareDrawPass(e,t){var i;super.prepareDrawPass(e,t);const r=Object.keys(this.colorLookupTables).length>1,a=null===(i=e.mesh)||void 0===i?void 0:i.program;a&&(this.setColorScaleUniforms(a),e instanceof th&&(a.setUniform("opacity",this.paint.opacity()),this.valueRanges.forEach(((e,t)=>{a.setUniform(`valueRange[${t}].min`,e.min),a.setUniform(`valueRange[${t}].max`,e.max)})),r&&(a.setUniform("dataChannel[0]",rr.lX.indexOf("a")),a.setUniform("colorMaskChannel[0]",["r","g","b"].map((e=>rr.lX.indexOf(e)))))))}getProgramDefines(){const e=Object.keys(this.colorLookupTables).length>1,t=super.getProgramDefines();return t.push("COLOR_LOOKUP","NODATA_BACKFILL",`VALUE_RANGE_COUNT ${this.valueRanges.length}`),e&&t.push("COLOR_MASK_LOOKUP"),(0,$.K)(this.config.channel)&&t.push(...this.addExpressionDefines()),t}addExpressionDefines(){const e=[],t=this.paint.sampleExpression(),i={[rr.BG.custom]:"EXPRESSION_CUSTOM",[rr.BG.vector]:"EXPRESSION_VECTOR",[rr.BG.sum]:"EXPRESSION_SUM",[rr.BG.difference]:"EXPRESSION_DIFF",[rr.BG.angle]:"EXPRESSION_ANGLE",[rr.BG.number]:"EXPRESSION_VALUE"};return t in i&&e.push(i[t]),e}getCustomExpressionChunk(){var e;return this.paint.sampleExpression()===rr.BG.custom&&(null===(e=this.paint.sampleExpressionOperation())||void 0===e?void 0:e.chunk)||""}},ah=class extends Hl{constructor(){super(...arguments),this.useSDFArrows=!1}canDrawTile(e,t){var i,r;const{dataRenderables:a={},timeState:s}=t.state,n=e.tile,{renderable:o}=a[n.coord.hash]||{},l=null==o?void 0:o.tile;return!!l&&(l.data.updateTextures(this.context,s),(0,R.n)(null===(r=null===(i=l.data)||void 0===i?void 0:i.textures.current)||void 0===r?void 0:r.image))}onDrawTile(e){this._drawTileCallback=e}prepareTile(e,t,i){var r,a,s;super.prepareTile(e,t,i);const n=i.program,o=t.tile,{dataRenderables:l={},timeState:h}=e.state,{renderable:c,textures:d}=l[o.coord.hash]||{};if(c&&d){const e=c.tile;e.data.updateTextures(this.context,h);const t=c.uvOffset;let i=c.uvOffset,o=c.uvOffset;if(e.data){const a=Array.isArray(e.data)?e.data[0]:e.data,{columns:s,rows:n}=(null===(r=a.metadata)||void 0===r?void 0:r.layout)||{};i=eh(s,n,h.index.current,t),o=eh(s,n,h.index.next,t)}i=eh(1,1,0,t),o=eh(1,1,0,t),n.setUniform("dataTexture",null===(a=e.data)||void 0===a?void 0:a.textures.current),n.setUniform("dataTextureNext",null===(s=e.data)||void 0===s?void 0:s.textures.next),n.setUniform("dataCoordOffset",(new Ne.A).fromArray(i)),n.setUniform("dataCoordOffsetNext",(new Ne.A).fromArray(o))}}getProgramName(e){return e?"gridSdf":"grid"}},sh=class extends Xl{constructor(e,t={},i={}){super(e,i),this.id="mask",this.options=t}beforeRender(e){super.beforeRender(e);const t=[...e.defines];this.options.invert&&t.push("INVERT_MASK"),this.options.debug&&t.push("DEBUG_MASK");const i=this.getProgram("basic",Object.assign(Object.assign({},e),{defines:t}));this.mesh||(this.mesh=new ll(this.context,this.context.cache.getFullscreenQuad().geometry,i)),this.mesh.program=i}draw(e){const t=this.mesh.program;t&&(t.setUniform("tMask",this.mask),super.draw(e))}};class nh{constructor(e){this.extent=it,this.type=1,this._points=[],this._points=e}asPoints(){return this._points}asLines(){throw new Error("Method not implemented.")}asPolygons(){throw new Error("Method not implemented.")}}const oh=class extends ql{getProgramName(){return"heatmapDraw"}},lh=class extends th{getProgramName(){return"contour"}},hh=(e,t,i)=>{if(0==e)return t[i+0]=0,t[i+1]=0,t[i+2]=0,void(t[i+3]=0);const r=Math.abs(e);let a,s=Math.floor(Math.log2(r));s+=ch(s)<=r/2?1:0,s-=ch(s)>r?1:0,a=s>100?r/1024/ch(s-10)-1:r/ch(s)-1;const n=s+127;a*=256;const o=Math.floor(a);a-=o,a*=256;const l=Math.floor(a);a-=l,a*=128;const h=2*Math.floor(a)+(e<0?1:0);t[i+0]=n,t[i+1]=o,t[i+2]=l,t[i+3]=h},ch=e=>Math.exp(e*Math.LN2),dh=class extends Yt{get read(){return this._read}get write(){return this._write}constructor(e,t={}){super(e),this._onSwap=t.onSwap||(()=>{}),this.reset(t)}setSize(e,t){this.read.resize(e,t),this.write.resize(e,t)}render(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.write.bind(),e(this.read,this.write),this.write.unbind(),t&&this.swap()}swap(){const e=this._read;this._read=this._write,this._write=e,this._onSwap(this.read,this.write)}clear(){const e=this.context.gl;this.read.clear(e.COLOR_BUFFER_BIT),this.write.clear(e.COLOR_BUFFER_BIT)}reset(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.dispose(),this._read=new vs(this.context,e),this._write=new vs(this.context,e),this._read.name="FBO.a",this._write.name="FBO.b"}dispose(){var e,t;null===(e=this.read)||void 0===e||e.dispose(),null===(t=this.write)||void 0===t||t.dispose()}};let uh=null;const ph=function(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(uh&&uh.count===e)return uh.data;const i={x:new Uint8Array(4*e),y:new Uint8Array(4*e),a:new Uint8Array(4*e)};for(let r=0;r<e;r++)hh(Math.random(),i.x,4*r),hh(Math.random(),i.y,4*r),i.a[4*r+0]=Math.round(255*(t?Math.random():1)),i.a[4*r+1]=0,i.a[4*r+2]=0,i.a[4*r+3]=0;return uh={data:i,count:e},i},fh=class{get resolution(){return Math.sqrt(this.count)}get isValid(){return(0,R.n)(this.x)&&(0,R.n)(this.y)&&(0,R.n)(this.a)}constructor(e={}){this.needsInitialize=!1,this.needsUpdate=!0,this._opts=Object.assign({},e)}initialize(e,t){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.count=t,this.renderCount=t;const r=e.gl,a=ph(t,i),s=Object.assign({size:{width:this.resolution,height:this.resolution},minFilter:r.NEAREST,magFilter:r.NEAREST},this._opts);this.x&&this.x.dispose(),this.y&&this.y.dispose(),this.a&&this.a.dispose(),this.x=new dh(e,Object.assign({data:a.x},s)),this.y=new dh(e,Object.assign({data:a.y},s)),this.a=new dh(e,Object.assign({data:a.a},s))}reset(){const e=ph(arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.count,!(arguments.length>1&&void 0!==arguments[1])||arguments[1]);this.x.reset({data:e.x}),this.y.reset({data:e.y}),this.a.reset({data:e.a})}each(e){[this.x,this.y,this.a].forEach(((t,i)=>e(t,i)))}dispose(){this.x.dispose(),this.y.dispose(),this.a.dispose()}},mh=class extends hl{constructor(){super(...arguments),this.dataTextures=[]}draw(e){throw new Error("[MapsGL] Subclasses must override `draw`")}setDataUniforms(e,t){const i=this.mesh.program,r=t.uvOffset,a=t.uvOffset,s=t.partialScale>1?t.coord:t.tile.coord;i.setUniform("dataCoordOffset",(new Ne.A).fromArray(r)),i.setUniform("dataCoordOffsetNext",(new Ne.A).fromArray(a)),i.setUniform("tileCoord",new Ve.A(s.x,s.y,s.z));for(let e=0;e<this.dataTextures.length;e++){const{id:t,texture:r}=this.dataTextures[e];i.setUniform(t,r),i.setUniform("dataResolution",new _i(r.size.width,r.size.height))}}dispose(){super.dispose(),this.dataTextures.forEach((e=>{let{texture:t}=e;return t.dispose()}))}},gh=class extends mh{constructor(){super(...arguments),this.dataMatrix=new Ai.A}beforeRender(e){super.beforeRender(e);const t=this.getProgram("particleUpdate",e);this.mesh||(this.mesh=new ll(this.context,this.context.cache.getFullscreenQuad().geometry,t)),this.mesh.program=t}draw(e){const t=this.context,{renderables:i,dataRange:r}=e.state,a=this.mesh,s=a.program;if(s)for(let n=0,o=i.length;n<o;n++){const o=i[n],l=o.tile.data;if(!l||l instanceof fh==0)return void console.warn("[MapsGL] Invalid particle state");if(!0!==l.needsUpdate||!l.isValid)continue;this.setDataUniforms(e,o),s.setUniform("dataMin",new _i(r.min,r.min)),s.setUniform("dataMax",new _i(r.max,r.max)),s.setUniform("dataMatrix",this.dataMatrix),s.setUniform("initialize",+l.needsInitialize),s.setUniform("tPositionX",l.x.read.texture),s.setUniform("tPositionY",l.y.read.texture),s.setUniform("tAlpha",l.a.read.texture);const h=l.resolution;t.state.setViewport(h,h),l.each(((e,i)=>{s.setUniform("positionOutCoord",i),e.write.bind(),a.draw({camera:t.cache.getFullscreenQuad().camera}),e.swap()})),l.needsInitialize=!1,l.needsUpdate=!1}}},vh=class extends mh{get fbo(){return this._fbo}get renderTarget(){if(this.fbo&&this.offscreen)return this.fbo.write}constructor(e,t,i=[]){super(e),this.dataMatrix=new Ai.A;const r=e.gl,{interleaved:a}=this.generateParticleData(t),s=(new Float32Array).BYTES_PER_ELEMENT,n=new ia(e.gl,a,3*s),o=new Wr(e,{position:{size:2,data:new Float32Array([0,1,0,0,1,0,1,1])},uv:{size:2,data:new Float32Array([0,1,0,0,1,0,1,1])},particleIndex:new Br(n,1,!1,0,1),reference:new Br(n,2,!1,1*s,1),random:new Br(n,1,!1,3*s,1)});o.setIndex([0,1,2,0,2,3]),this.mesh=new ll(e,o,null),this.mesh.drawMode=e.gl.TRIANGLES,this._fbo=new dh(e,{size:e.resolution,minFilter:r.LINEAR,magFilter:r.LINEAR}),e.on("resize",(e=>{let{width:t,height:i}=e;this._fbo.read.resize(t,i),this._fbo.write.resize(t,i)}))}beforeRender(e){super.beforeRender(e);const t=this.getProgram("particleDraw",e);this.mesh||(this.mesh=new ll(this.context,this.context.cache.getFullscreenQuad().geometry,t)),this.mesh.program=t}draw(e){const t=this.context,{renderables:i,dataRange:r,drawRange:a,transform:s}=e.state,n=this.mesh,o=n.program,l=e.renderTarget?t.cache.getFullscreenQuad().camera:void 0,h=t.resolution,c=e.state.style,d=c.symbolPitchWithMap(),u=c.symbolRotateWithMap(),p=s.calculateGlobeCameraUp();o.setUniform("resolution",new _i(h.width,h.height)),o.setUniform("zoom",s.state.zoom),o.setUniform("dataMatrix",this.dataMatrix),o.setUniform("dataMin",new _i(r.min,r.min)),o.setUniform("dataMax",new _i(r.max,r.max)),o.setUniform("drawRange",new _i(a.min,a.max)),o.setUniform("mapPixelRatio",it/Mt*Tt(s.state.zoom)),o.setUniform("pitch",(0,ke.p)(s.state.pitch)),o.setUniform("pitchedScale",s.circleRadiusCorrection),o.setUniform("cameraUp",p);for(let r=0,a=i.length;r<a;r++){const a=i[r],h=a.tile.data;if(!h||h instanceof fh==0||!h.isValid)return;const c=dl.fromTileRenderable(a),p=c.scale,f=c.offset;this.setDataUniforms(e,a),o.setUniform("tPositionX",h.x.read.texture),o.setUniform("tPositionY",h.y.read.texture),o.setUniform("tAlpha",h.a.read.texture);const{matrix:m}=s.calculateTilePos(a.tile.coord);o.setUniform("tileMatrix",m);const g=Oi(a.tile.coord,Mt,1,s.state.zoom),v=s.getPixelsToClipSpaceMatrix(d,u,g),y=s.getClipSpaceToPixelsMatrix(d,u,g);o.setUniform("labelPlaneMatrix",y),o.setUniform("glCoordMatrix",v);const x=1/Tt(s.state.zoom-a.tile.coord.z);o.setUniform("pixelToUnit",1/a.tile.size.width/t.dpr*x*(1/(s.tileSize/512))),o.setUniform("tilePixelRatio",it/Mt*x),n.scale.set(p.x,p.y,1),n.position.set(f.x,f.y,0),n.geometry.instancedCount=Math.min(h.renderCount,h.count),e.scene&&!e.renderTarget?e.scene.render(n,l):(n.updateMatrixWorld(),n.draw({camera:l}))}}resetParticles(){this.fbo.clear()}dispose(){var e;super.dispose(),this._fbo.dispose(),null===(e=this.mesh.geometry)||void 0===e||e.dispose()}generateParticleData(e){const t=Math.sqrt(e),i=new Float32Array(e),r=new Float32Array(2*e),a=new Float32Array(4*e);for(let s=0;s<e;s++){const e=s%t/t,n=Math.trunc(s/t)/t,o=Math.random();r.set([e,n],2*s),i[s]=s,a.set([s,e,n,o],4*s)}return{indexes:i,references:r,interleaved:a}}},yh=class extends fl{constructor(e,t,i){super(e,t,i),this.renderTargets={};const r={size:{width:Mt,height:Mt},minFilter:e.gl.NEAREST,magFilter:e.gl.NEAREST};this.renderTargets.current=new vs(e,r),this.renderTargets.next=new vs(e,r)}beforeRender(e){super.beforeRender(e),this.mesh||(this.mesh=new ll(this.context,this.context.cache.getFullscreenQuad().geometry,null));const t=e.defines.filter((e=>"GLOBE"!==e)),i=this.getProgram("raster",Object.assign(Object.assign({},e),{defines:t}));this.mesh.program=i}draw(e){var t;const{renderables:i,timeState:r}=e.state;this.renderTargets.current.clear(this.context.gl.COLOR_BUFFER_BIT),this.renderTargets.next.clear(this.context.gl.COLOR_BUFFER_BIT);for(let a=0,s=i.length;a<s;a++){const s=i[a],n=s.tile;if(n.data instanceof De.A)n.data&&n.data.updateTextures(this.context,r),this.canDrawTile(n)&&this.drawEncodedTile(e,s,n.data.textures);else{const i=null===(t=this._tileCache.textures)||void 0===t?void 0:t.get(n.coord.hash);i&&this.drawTile(e,s,{current:i.texture,next:void 0})}}}canDrawTile(e){var t,i;return(null==e?void 0:e.data)instanceof De.A?(0,R.n)(null===(i=null===(t=e.data)||void 0===t?void 0:t.textures.current)||void 0===i?void 0:i.image):super.canDrawTile(e)}drawEncodedTile(e,t,i){var r;let a=t.tile.coord;const{tileSize:s,tileSpan:n,dataRegion:o}=(null===(r=e.configurator)||void 0===r?void 0:r.stateForDrawPass(this,e))||{},l=this.mesh,h=l.program,c=e.renderTarget?this.context.cache.getFullscreenQuad().camera:void 0,d=dl.fromTileRenderable(t,c?o:void 0),u=d.scale,p=d.offset,f=[...d.uvOffset];t.partialScale>1&&(a=t.coord);let m=f,g=f;m=eh(1,1,0,f),g=eh(1,1,0,f),h.setUniform("dataResolution",new _i(i.current.size.width,i.current.size.height)),h.setUniform("dataCoordOffset",(new Ne.A).fromArray(m)),h.setUniform("dataTextureCoordOffset",(new Ne.A).fromArray(m)),h.setUniform("dataTexture",i.current),h.setUniform("dataTextureNext",i.next);const v={width:s.width*n.x,height:s.width*n.y},y=new dl;y.scale={x:u.x,y:u.y,z:1},y.offset={x:p.x,y:p.y,z:0};const x=new dl;x.scale={x:o.scale.x,y:o.scale.y,z:1},x.offset={x:o.offset.x,y:o.offset.y,z:0};const b=((e,t)=>{const i=t.scale,r=t.offset,a={x:(e.offset.x-r.x)*i.x,y:(e.offset.y-r.y)*i.y,z:0},s={x:e.scale.x*i.x,y:e.scale.y*i.y,z:1},n=new dl;return n.offset=a,n.scale=s,n.uvOffset=e.uvOffset,n})(y,x);h.setUniform("dataTexture",i.current),this.drawTileToRenderTarget(l,this.renderTargets.current,v,m,b,!1),h.setUniform("dataTexture",i.next),this.drawTileToRenderTarget(l,this.renderTargets.next,v,g,b,!1)}drawTileToRenderTarget(e,t,i,r,a){let s=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];const n=this.context,o=a.scale,l=a.offset;e.program.setUniform("dataCoordOffset",(new Ne.A).fromArray(r)),e.program.setUniform("dataTextureCoordOffset",(new Ne.A).fromArray(r)),t.resize(i.width,i.height),t.bind(),s&&n.state.clear(!0),n.state.setViewport(i.width,i.height),e.scale.set(o.x,o.y,1),e.position.set(l.x,l.y,0),e.updateMatrixWorld(),e.draw({camera:this.context.cache.getFullscreenQuad().camera}),t.unbind()}calculateTextureCoordOffset(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var i;const r=e.tile;let a=e.uvOffset;if(r.data){const e=Array.isArray(r.data)?r.data[0]:r.data,{columns:s,rows:n}=(null===(i=e.metadata)||void 0===i?void 0:i.layout)||{};a=eh(s,n,t,a)}return a}dispose(){super.dispose(),this.context.cache.hasProgram(this.mesh.program)||this.mesh.program.dispose(),Object.values(this.renderTargets).forEach((e=>e.dispose()))}},xh=class extends jl{constructor(e={}){super((0,j.$)({paint:{particle:{count:0,density:nr.j.normal,size:2,speed:1,trails:!0,trailsFade:.97,dropRate:.01,dropRateBump:.01}}},e)),this._particleZoomOffset=-2,this._renderTrails=!1,this._memoizedTotalParticles=new Map,this._fpsParticleCountFactor=1,this._isMapMoving=!1,this.updateParticleDrawPassesDebounced=(0,Ma.s)((e=>{this._isMapMoving||this.updateParticleDrawPasses(e)}),20),this.paint.particleCount()>0&&this.paint.setProperty("particle.density",nr.j.count),this._renderTrails=this.paint.particleTrails()}onRemove(e){super.onRemove(e);const t=this.passes.getPass("draw-particles");t&&t.resetParticles()}setNeedsUpdate(){}setup(){super.setup(),this._particleState=new Ht({capacity:50,onRemove:(e,t)=>{}}),this.isAnimated=!0}prepareRenderState(){super.prepareRenderState();const e=Pa.fps;if(e>0&&e<45&&this._fpsParticleCountFactor>.75){const e=this._fpsParticleCountFactor;1===e?this._fpsParticleCountFactor=.75:.75===e?this._fpsParticleCountFactor=.5:.5===e&&(this._fpsParticleCountFactor=.25)}const t=this.layer.map.transform.projection.type;t!==this._lastProjection&&(this._lastProjection=t,this._clearTrails())}prepareDrawPasses(){const e=this.context,t=this.layer.source;this.passes.removeAllPasses();const i=new yh(e,t.tiles);i.id="draw-tiles",i.prerender=!0,this.passes.addPass(i);const r=new Ai.A;r.translate(new Ve.A(-.5,-.5,0)),r.scale(new Ve.A(2,2,1));const a=new gh(e);a.id="update-particles",a.prerender=!0,a.dataMatrix=r,this.passes.addPass(a);const s=Math.pow(256,2),n=new vh(e,s);n.id="draw-particles",n.prerender=this._renderTrails,n.enableBlend=!0,n.dataMatrix=r,this._renderTrails&&n.configureRenderTarget(),i.configureRenderTarget(),i.prerender=!0,a.dataTextures=[{id:"dataTexture",texture:i.renderTargets.current.texture},{id:"dataTextureNext",texture:i.renderTargets.next.texture}],n.dataTextures=[{id:"dataTexture",texture:i.renderTargets.current.texture},{id:"dataTextureNext",texture:i.renderTargets.next.texture}];const o=new Xl(e);o.id="draw-trails",o.fullscreen=!0,o.offscreen=!0,o.prerender=!0,o.textureId="tOutput",o.fbo=n.fbo,this.passes.addPass(o),this.passes.addPass(n);const l=new Xl(e);l.id="draw-screen",l.fullscreen=!0,l.textureId="tOutput",l.enableBlend=!0,l.fbo=n.fbo,l.needsSwap=!0,this.passes.addPass(l)}updateParticleDrawPasses(e){this._renderTrails=e,this.passes.withPass("draw-particles",(t=>{t.prerender=e,t.offscreen=e,e||t.fbo.clear()})),this.passes.enablePass("draw-trails",e),this.passes.enablePass("draw-screen",e)}stateForDrawPass(e,t){return"draw-tiles"===e.id?super.stateForDrawPass(e,t):{renderables:this.renderState.renderables.length>0?this._getParticleRenderables():[],dataRange:this.dataRange,drawRange:this.drawRange,dataRegion:this.renderState.dataRegion,renderRegion:this.renderState.renderRegion,gridded:!1,timeState:this.timeState,layerId:this.layer.id,style:this.paint,elapsedTime:this.renderState.elapsedTime,mapZoom:this.layer.map.getZoom(),transform:this.layer.map.transform}}prepareDrawPass(e,t){var i;super.prepareDrawPass(e,t);const r=null===(i=e.mesh)||void 0===i?void 0:i.program;if(!r)return;const a=this.context,s=a.resolution,n=this.layer.map.getZoom(),o=Math.min(1,60/this.layer.map.fps),l=1/this.layer.map.transform.worldSizeScale;if(this.setColorScaleUniforms(r),e instanceof vh){const e=this.paint.particleSize();r.setUniform("cameraToCenterDistance",this.layer.map.transform.cameraToCenterDistance),r.setUniform("particleSize",[e.width*l,e.height*l]),r.setUniform("noData",this.noDataValue/255),r.setUniform("opacity",this._renderTrails?1:this.paint.opacity())}else if(e instanceof gh){const e=1-n%1*.5,t=a.dpr/2*(1/this.layer.map.transform.worldSizeScale);let i=this.paint.particleSpeed()*e*t;const l=Math.floor(this.layer.map.getZoom()),h=Math.floor(this._getParticleZoom());i/=Math.abs(l-h)+1,i*=.5,i*=Math.min(1,.3+n/3*.5),r.setUniform("resolution",new _i(s.width,s.height)),r.setUniform("speedFactor",i*o),r.setUniform("fadeInIncrement",.01*o),r.setUniform("fpsFactor",o),r.setUniform("randomSeed",Math.random()),r.setUniform("dropRate",this.paint.particleDropRate()*o),r.setUniform("dropRateBump",this.paint.particleDropRateBump()*o)}else if(e instanceof Xl){let t=this.paint.opacity();"draw-trails"===e.id&&(t=1-(1-this.paint.particleTrailsFade())*o),r.setUniform("opacity",t)}}getProgramDefines(){const e=super.getProgramDefines(),t=this.paint.sampleExpression(),i=this.paint.particleType();return e.push(t===rr.BG.angle?"EXPRESSION_ANGLE":"EXPRESSION_VECTOR"),e.push("bar"===i?"STYLE_BAR":"arrow"===i?"STYLE_ARROW":"STYLE_POINT"),this.paint.symbolSizeAttenuation()&&e.push("SIZE_ATTENUATION"),this.paint.symbolRotateWithMap()&&e.push("ROTATE_WITH_MAP"),this.paint.symbolPitchWithMap()&&e.push("PITCH_WITH_MAP"),this.paint.symbolScaleWithMap()&&e.push("SCALE_WITH_MAP"),e}_clearTrails(){this._renderTrails&&this.passes.withPass("draw-particles",(e=>{e.fbo.clear()}))}_getParticleZoom(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.layer.map.getZoom();const t=this.layer.getDataZoom(),i=Math.floor(e+this._particleZoomOffset);return Math.max(i,t)}_getParticleRenderables(){const e=this._getParticleZoom(),t=this.renderState.dataRegion.convertedToZoom(Math.floor(e)),i=this.getVisibleTiles(e),r=[],a=Tt(Math.floor(e)),s=t.span.x>a;for(let e=0;e<i.length;e++){const n=i[e],o=n.coord.normalize(),l=n.coord.z,h=this.layer.map.getZoom(),c=Math.max(1,Math.floor(Math.abs(h-l))),d=this._memoizedTotalParticles.get(n.coord.z);(null==d?void 0:d.zoomDelta)!==c&&this._memoizedTotalParticles.delete(n.coord.z);const u=this._calculateTotalParticles(n.coord.z),p=this.getRenderablesForTile(n.coord,this.layer.getDataZoom());if(0===p.length)continue;if(p.some((e=>e.tile.coord.z>n.coord.z))){const e=Math.pow(2,p[0].tile.coord.z-n.coord.z);if(p.length<e)continue}let f=this._particleState.get(o.hash);f&&f.count===u||(f=new fh,f.initialize(this.context,u),f.needsInitialize=!0,this._particleState.set(o.hash,f));const m=1/Math.pow(2,c);f.renderCount=Math.floor(f.count*Math.min(1,m+h%c*m)),f.needsUpdate=!0,n.data=f;const g=Ss.fromTile(n,n.coord),v=this._calculateUVOffset(n,t,s,a);g.uvOffset=v,r.push(g)}return r}_calculateUVOffset(e,t,i,r){let a=e.coord;return 0===t.zoom?a=e.coord.normalize():i&&(a=e.coord.x<0||e.coord.x>r?e.coord:e.coord.normalize()),[(a.x-t.bounds.left)/t.span.x,(a.y-t.bounds.top)/t.span.y,1/t.span.x,1/t.span.y]}_calculateTotalParticles(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.layer.map.getZoom();const t=Math.floor(e);if(!this._memoizedTotalParticles.has(t)){let e=this.paint.particleCount();const i=this.paint.particleDensity();i>0&&(e=2*i);const r=Math.floor(this.layer.map.getZoom()),a=Math.abs(r-t);e*=Math.max(1,a+1),e*=this.layer.map.transform.tileSize/512,e=Math.min(Math.pow(256,2),Math.pow(e,2)),this._memoizedTotalParticles.set(t,{count:e,zoomDelta:a})}return this._memoizedTotalParticles.get(t).count}setupEvents(){var e;super.setupEvents(),this.renderState.on(Is.Events.MAP_MOVE_START,(()=>{this._isMapMoving=!0,this.updateParticleDrawPasses(!1)})),this.renderState.on(Is.Events.MAP_MOVE_END,(()=>{this._isMapMoving=!1,this.updateParticleDrawPassesDebounced(this.paint.particleTrails())})),this.layer.on(Wa,(e=>{let{property:t,value:i}=e;(t.includes("particle.density")||t.includes("particle.count"))&&(t.includes("particle.count")&&i>0&&this.paint.setProperty("particle.density",nr.j.count),this._memoizedTotalParticles.clear())})),null===(e=this.layer.animator)||void 0===e||e.on([Ra.A.RESTART,Ra.A.STOP].join(" "),(()=>{this._clearTrails(),this.onDirty()}))}dispose(){this._particleState.clear(),super.dispose()}},bh=class extends Ul{canDrawTile(e,t){var i,r;return(0,R.n)(null===(r=null===(i=null==e?void 0:e.tile)||void 0===i?void 0:i.data)||void 0===r?void 0:r.geometry)}beforeRender(e){super.beforeRender(e);const t=this.context,i=this.getProgram("voronoi",e);this.mesh||(this.mesh=new ll(t,t.cache.getFullscreenQuad().geometry,i),this.mesh.drawMode=t.gl.TRIANGLE_FAN),this.mesh.program=i}draw(e){const t=this.context,i=t.gl;if(!this.mesh.program)return;const r=i.getParameter(i.DEPTH_RANGE);t.state.setDepthTest(!0),t.state.setDepthMask(!0),t.state.setDepthFunc(i.LESS),t.state.setDepthRange(0,1),t.state.clear(!1,!0,!1),super.draw(e),t.state.setDepthRange(r[0],r[1]),t.state.setDepthTest(!1)}drawTile(e,t,i){const r=this.context,a=r.gl,s=i.geometry;if(!s)return;const n=this.mesh,o=e.renderTarget?r.cache.getFullscreenQuad().camera:void 0;n.updateGeometry(s),this.drawMesh(e,t,n,o,s,1,a.TRIANGLE_FAN)}};class wh extends ci{}let _h=null;const Ah=class extends hl{beforeRender(e){super.beforeRender(e);const t=this.getProgram("debug",e);if(!this.mesh){const e=pl(this.context,1);this.mesh=new ll(this.context,e,t)}this.mesh.program=t}draw(e){const{renderables:t}=e.state;for(let i=0,r=t.length;i<r;i++)this.drawTile(e,t[i])}drawTile(e,t){var i;const r=this.context,{region:a,subdivisionGranularity:s,globiness:n}=(null===(i=e.configurator)||void 0===i?void 0:i.stateForDrawPass(this,e))||{},o=this.mesh,l=o.program,h=e.renderTarget?r.cache.getFullscreenQuad().camera:void 0,c=dl.fromTileRenderable(t,h?a:void 0),d=c.scale,u=c.offset,p=r.resolution,f=t.tile,m=n>0?s.tile.getGranularityForZoomLevel(f.coord.z):1,g=pl(this.context,m);o.updateGeometry(g),l.setUniform("resolution",new _i(p.width,p.height)),l.setUniform("tileCoord",new Ve.A(f.coord.x,f.coord.y,f.coord.z)),o.scale.set(d.x,d.y,1),o.position.set(u.x,u.y,0),o.wireframe=!0,e.scene&&!e.renderTarget?e.scene.render(o,h):(o.updateMatrixWorld(),o.draw({camera:h}))}},Mh={raster:class extends Al{constructor(e,t){super(e,Object.assign({quality:tr.E.exact,renderer:t.renderer||new ml},t))}createTimeSeriesDataProvider(){return new Ol(this)}},circle:Rl,symbol:Rl,fill:Rl,line:Rl,text:Rl,query:Bl,sample:Nl,grid:Nl,heatmap:Rl,contour:Nl,particle:Nl,voronoi:Rl,debug:class extends Al{constructor(e,t){_h||(_h=new wh("debug",{type:"debug",id:"debug"})),super(e,Object.assign(Object.assign({},t),{source:_h}))}onMove(){}},data:Rl},Th={raster:ml,circle:Jl,symbol:Jl,fill:Jl,line:Jl,text:Jl,query:Jl,sample:rh,grid:class extends jl{constructor(e={}){super((0,j.$)({paint:{fill:{color:new _r("#fff")},stroke:{color:new _r(0,0,0,0)},icon:{size:{width:40,height:40}},grid:{size:60,spacing:30}}},e))}setup(){super.setup(),this.paint.sampleColorScale()||this.removeColorLookupTables()}setupEvents(){super.setupEvents(),this.layer.on(Wa,(e=>{let{property:t}=e;(t.includes("grid.spacing")||t.includes("symbol.size"))&&this.updateVectorData()}))}prepareDrawPasses(){const e=this.context;this.updateVectorData();let t=Cn;(0,W.h)(this.paint.iconAtlas())&&(t=void 0);const i=new ah(e,{fragmentShader:t}),r=new Yl(this.context,[i]);r.clear=!0,this.passes.addPass(r);const a=new Xl(e);a.id="screen",a.fullscreen=!0,a.texture=r.renderTarget.texture,a.textureId="tOutput",a.enableBlend=!0,this.passes.addPass(a)}stateForDrawPass(e,t){if(e instanceof Hl){this.layer.map.getZoom();const e=this.getVisibleTiles(),t=[],i={};for(let r=0;r<e.length;r++){const a=e[r];a.data=this._vectorData,t.push(Ss.fromTile(a,a.coord));const s=this.getRenderablesForTile(a.coord,this.layer.getDataZoom());if(s.length>0){const e=s[0];i[a.coord.hash]={renderable:e,textures:e.tile.data.textures}}}return{renderables:t,dataRenderables:i,timeState:this.timeState,progress:this.progress,layerId:this.layer.id,style:this.paint,mapStyle:this.layer.map.style,elapsedTime:this.renderState.elapsedTime,transform:this.layer.map.transform}}return super.stateForDrawPass(e,t)}prepareDrawPass(e,t){var i;super.prepareDrawPass(e,t);const r=null===(i=e.mesh)||void 0===i?void 0:i.program;if(r)if(e instanceof Hl){this.setColorScaleUniforms(r);const e=this.paint.iconAtlas();if((0,pe.Z)(e)&&!this._symbolAtlas&&(this._symbolAtlas=this.layer.map.style.createImageAtlas(e.ids)),this._symbolAtlas){const e=this._vectorData.stores[this.layer.id];e instanceof da&&(e.includesSDFIcons=this._symbolAtlas.includesSDFImages),this._vectorData.imageAtlas=this._symbolAtlas}}else(e instanceof Xl||e instanceof sh)&&r.setUniform("opacity",this.paint.opacity())}getProgramDefines(){const e=Array.isArray(this.channel)?this.channel[0]:this.channel,t=this.paint.sampleExpression(),i=this.paint.symbolPitchWithMap(),r=this.paint.symbolRotateWithMap(),a=this.paint.symbolSizeAttenuation(),s=[...super.getProgramDefines(),"IS_SYMBOL"];return i&&s.push("PITCH_WITH_MAP"),r&&s.push("ROTATE_WITH_MAP"),a&&s.push("SIZE_ATTENUATION"),this.paint.symbolPitchWithMap()&&s.push("PITCH_WITH_MAP"),this.paint.symbolRotateWithMap()&&s.push("ROTATE_WITH_MAP"),this.paint.symbolScaleWithMap()&&s.push("SCALE_WITH_MAP"),this.getColorLookupTable(e)&&s.push("COLOR_LOOKUP"),(0,W.h)(this.paint.iconAtlas())&&s.push("USE_ATLAS"),t===rr.BG.vector?s.push("EXPRESSION_VECTOR"):t===rr.BG.angle&&s.push("EXPRESSION_ANGLE"),s}updateVectorData(){this._vectorData=new wa({[this.layer.id]:this.generateVectorStore(this.paint.gridSpacing()||100)})}generateVectorStore(){const e=Math.round((arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.layer.map.transform.tileSize)/(arguments.length>0&&void 0!==arguments[0]?arguments[0]:50)),t=1/e,i=t/2,r=t/2,a=[];let s=0;for(let n=0;n<e;n++)for(let o=0;o<e;o++)a.push({featureIndex:s,sourceId:"",sourceLayerIndex:0,type:1,feature:new nh([{x:it*(i+o*t),y:it*(r+n*t)}]),properties:{gridRow:n,gridCol:o}}),s+=1;let n={};const o=this.paint.iconAtlas();(null==o?void 0:o.ids)&&(n=this.layer.map.style.imageManager.getImages(o.ids));const l=new da({tile:{x:0,y:0,z:0},sourceId:this.layer.source.id,sourceLayerIndex:0,zoom:0});return l.populate(a,void 0,{paint:this.paint,tileCoord:new Vt(0,0,0)}),l.layoutSymbols(n,{}),l.trim(),this.debugGrid(a),l}debugGrid(e){}},heatmap:class extends Jl{setup(){super.setup(),this._generateColorTable()}setupEvents(){super.setupEvents(),this.layer.on(Wa,(e=>{let{property:t}=e;t.includes("heatmap.color")&&(this._generateColorTable(),this.layer.setNeedsUpdate())}))}prepareDrawPasses(){const e=this.context;e.gl.getExtension("OES_standard_derivatives");const t=new oh(e);t.id="draw-data",t.clear=!0,t.prerender=!0;const i=new Yl(e,[t]);i.prerender=!0,this.passes.addPass(i);const r=new Xl(e);r.programName="heatmapColorize",r.id="heatmap",r.fullscreen=!0,r.texture=i.renderTarget.texture,r.textureId="dataTexture",r.enableBlend=!0,this.passes.addPass(r)}stateForDrawPass(e,t){const i=super.stateForDrawPass(e,t),r=this.getInfoForStyles();return Object.assign(Object.assign({},i),{pointSize:this.paint.heatmapRadius(r)*this.context.dpr,intensity:this.paint.heatmapIntensity(r),weight:this.paint.heatmapWeight(r)||20})}prepareDrawPass(e,t){var i;super.prepareDrawPass(e,t);const r=null===(i=e.mesh)||void 0===i?void 0:i.program;if(!r)return;const a=this.getInfoForStyles();e instanceof ql?(r.setUniform("intensity",this.paint.heatmapIntensity(a)||1),r.setUniform("weight",this.paint.heatmapWeight(a)||1),r.setUniform("blur",this.paint.heatmapBlur(a)||1)):e instanceof Xl&&(r.setUniform("colorScale",this._colorLookup.texture),r.setUniform("colorScaleRes",this._colorLookup.texture.size.width),r.setUniform("opacity",this.paint.opacity(a)))}_generateColorTable(){const e=this.paint.heatmapColor()||[0,"rgba(0, 0, 0, 0)",.2,"rgba(0, 0, 255, 0.2)",.45,"rgba(0, 255, 0, 0.5)",.85,"rgba(255, 255, 0, 1)",1,"rgba(255, 0, 0, 1)"];this._colorLookup=new kl({stops:e,range:{min:0,max:1},interval:.01}),this._colorLookup.createLookupTexture(this.context)}},contour:class extends rh{prepareDrawPasses(){this.context.gl.getExtension("OES_standard_derivatives");const e=new lh(this.context);e.id="contour-pass",e.enableBlend=!0,e.channel=Array.isArray(this.channel)?this.channel[0]:this.channel,this.passes.addPass(e)}prepareDrawPass(e,t){var i;super.prepareDrawPass(e,t);const r=null===(i=e.mesh)||void 0===i?void 0:i.program;if(r&&(this.setColorScaleUniforms(r),e instanceof th)){const e=this.paint.contourInterval();r.setUniform("valueInterval",e),r.setUniform("majorValueInterval",this.paint.contourMajorInterval()),r.setUniform("width",this.paint.contourWidth()),r.setUniform("majorWidth",this.paint.contourMajorWidth()),r.setUniform("valueScale",this.paint.contourScale()),r.setUniform("valueOffset",this.paint.contourOffset()),r.setUniform("colorInterval",e),r.setUniform("noData",this.noDataValue/255),r.setUniform("opacity",this.paint.opacity())}}getProgramDefines(){const e=super.getProgramDefines();return e.push("COLOR_LOOKUP","USE_FWIDTH"),this.paint.sampleExpression()===rr.BG.vector&&e.push("EXPRESSION_VECTOR"),this.noDataValue>=0&&e.push("NODATA"),e}},particle:xh,voronoi:class extends Jl{constructor(e={}){super(Object.assign({type:"circle"},e)),this._coneVertices=[]}setup(){super.setup();const e=[];e.push(0,0,-.95);for(let t=0;t<=40;t++){const i=t/40*Math.PI*2,r=1*Math.cos(i),a=1*Math.sin(i);e.push(r,a,1)}this._coneVertices=e,this._voronoiTileCache=new Ht({capacity:100,onRemove(e,t){var i,r;null===(r=null===(i=t.data)||void 0===i?void 0:i.geometry)||void 0===r||r.dispose()}})}setupEvents(){super.setupEvents(),this.addEventHandler(this.layer.source,ye.A.TILE_LOAD_COMPLETE,(e=>{let{tile:t}=e;this.updateGeometryForTile(t)}))}prepareDrawPasses(){const e=new bh(this.context);e.id="draw-voronoi",e.enableBlend=!0,this.passes.addPass(e)}stateForDrawPass(e,t){const i=super.stateForDrawPass(e,t);return"draw-voronoi"===e.id&&(i.renderables=this.renderState.renderables.map((e=>{const t=this._voronoiTileCache.get(e.tile.coord.hash);return t?Ss.fromTile(t,t.coord):null})).filter(Boolean)),i}prepareDrawPass(e,t){var i,r;if(super.prepareDrawPass(e,t),"mask"===e.id&&e instanceof sh){const t=this.layer.mask;e.mask=t?null===(r=null===(i=t.layer)||void 0===i?void 0:i.renderer.renderTarget)||void 0===r?void 0:r.texture:new ei(this.context)}super.prepareDrawPass(e,t)}getProgramDefines(){const e=super.getProgramDefines(),t=this.paint.symbolPitchWithMap(),i=this.paint.symbolRotateWithMap(),r=this.paint.symbolScaleWithMap(),a=this.paint.symbolSizeAttenuation();return t&&e.push("PITCH_WITH_MAP"),i&&e.push("ROTATE_WITH_MAP"),r&&e.push("SCALE_WITH_MAP"),a&&e.push("SIZE_ATTENUATION"),e}updateGeometryForTile(e){var t,i;const r=e.coord,a=this.layer.source.tiles.get(r.normalize()),s=null==a?void 0:a.data;if(s instanceof wa){const e=null==s?void 0:s.getDrawData(this.context,"circle",this.layer.id,{paint:this.paint,mapStyle:this.layer.map.style});if(e){const a=null===(t=null==s?void 0:s.getStore("circle",this.layer.id))||void 0===t?void 0:t.features,n=null===(i=e.primary)||void 0===i?void 0:i.geometry;if((null==n?void 0:n.length)>0){const e=n[0].getAttribute("anchor");if(e){const t=[...e.data],i=[];for(let e=0;e<t.length/2;e++)i.push({x:t[2*e+0],y:t[2*e+1],color:this.paint.fillColor(a[e].properties)});let s=this._voronoiTileCache.get(r.hash);s||(s=new $t(r),this._voronoiTileCache.set(r.hash,s));const n=this.generateGeometryForPoints(i);s.data={points:i,geometry:n},this.layer.map.redraw()}}}}}generateGeometryForPoints(e){const t=this.context;if(!t.gl)return null;const i=new Float32Array(2*e.length),r=new Float32Array(4*e.length);for(let t=0;t<e.length;t++){const{x:a,y:s,color:n}=e[t],[o,l,h,c]=n.toArray();i[2*t+0]=a,i[2*t+1]=s,r[4*t+0]=o,r[4*t+1]=l,r[4*t+2]=h,r[4*t+3]=c}const a=(new Float32Array).BYTES_PER_ELEMENT,s=new ia(t.gl,i,2*a),n=new ia(t.gl,r,4*a);return new Wr(t,{position:{size:3,data:new Float32Array(this._coneVertices)},anchor:new Br(s,2,!1,0,1),color:new Br(n,4,!1,0,1)})}},debug:class extends vo{constructor(e={}){super((0,j.$)({paint:{stroke:{color:"#ff0000"}}},e))}prepareDrawPasses(){const e=new Ah(this.context);e.id="debug-tiles",e.enableBlend=!0,this.passes.addPass(e)}stateForDrawPass(e,t){const i=super.stateForDrawPass(e,t),r=this.renderState.renderables;return Object.assign(Object.assign({},i),{renderables:r})}prepareDrawPass(e,t){var i;super.prepareDrawPass(e,t);const r=null===(i=e.mesh)||void 0===i?void 0:i.program;r&&r.setUniform("color",this.paint.strokeColor().toArray())}getRenderablesLOD(e){const t=this.layer.viewport.getVisibleTileCoords(e||this.layer.getDataZoom()),i=[];for(let e=0,r=t.length;e<r;e++){const r=t[e],a=new $t(r),s=St(r.z),n=Pt(r.normalize()),o=new Ss(a,{x:s,y:s},{x:n.x+r.wrap,y:n.y});o.coord=r,i.push(o)}return i}},data:class{constructor(e={}){this.paint=new As(e.paint)}onAdd(e){}onRemove(e){}onMoveStart(e){}onMoveEnd(e){}onZoomStart(e){}onZoomEnd(e){}onResize(e){}setNeedsUpdate(){}prerender(e){}draw(e){}prepareForOffscreenRender(){}dispose(){}}},Eh=new Set([tr.m.sample,tr.m.grid,tr.m.particles,tr.m.particle,tr.m.contour]),Sh=new Set([tr.m.circle,tr.m.fill,tr.m.line,tr.m.symbol,tr.m.text,tr.m.voronoi,tr.m.data]),Ch=new Set([tr.m.circle,tr.m.heatmap,tr.m.symbol,tr.m.text]),Oh=e=>Eh.has(e),Rh=e=>Sh.has(e),Ih=class extends N.A{constructor(e){super(),this.cache=new Map,this.order=[],this.layerIdsBySource={},this.datasources=e}get count(){return this.cache.size}has(e){return(0,R.n)(this.get(e))}get(e){return this.cache.get(e)}find(e){let t;return this.each((i=>{t||i.id!==e&&!new RegExp(e).test(i.id)||(t=i)})),t}orderedLayers(){return this.order.map((e=>this.cache.get(e)))}getIndex(e){return this.order.indexOf(e)}add(e,t,i){return this.insertAt(this.order.length,e,t,i)}insertAt(e,t,i,r){var a;let s,n;if((0,R.g)(i))throw new Error("[MapsGL] Cannot add layer, an invalid layer configuration was provided");if(i instanceof as?(s=i,n=s.source,t=s.id):i=Object.assign({},i),!this.has(t)){if((0,R.g)(s)){const e=i,{mask:r}=e,o=function(e,t){var i={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(i[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(i[r[a]]=e[r[a]])}return i}(e,["mask"]);if((0,$.K)(null==i?void 0:i.source)?n=this.datasources.get(i.source):i.source instanceof _e&&(n=i.source),o.source=n,(0,R.g)(null==o?void 0:o.type))throw new Error("[MapsGL] A layer type must be provided.");if(Ch.has(o.type)&&(o.sourceType=Re.V.point),s=((e,t)=>{var i;if(t.type===tr.m.particles&&(t.type=tr.m.particle),(0,R.g)(Mh[t.type]))throw new Error(`[MapsGL] Invalid layer type '${t.type}' specified for layer {${e}}. Type must be one \n of the following: ${Object.keys(Mh).join(", ")}.`);if((0,R.g)(t.source)&&t.type!==tr.m.debug)throw new Error(`[MapsGL] Layer {${e}} configuration is missing a value for 'source'.`);const r=t.paint||{};let a={paint:r},s={source:t.source};if(["raster","debug"].includes(n=t.type)||Oh(n)||Rh(n)){const e=s;if(e.zoomOffset=t.zoomOffset,e.quality=t.quality||tr.E.exact,s=e,Rh(t.type)){const e=s;e.sourceType=t.sourceType,e.sourceLayer=t.sourceLayer,e.filter=t.filter,a.type=t.type,s=e}}var n;if(t.type===tr.m.query&&(a.type="symbol"),Oh(t.type)){const e=a;e.channel=(null===(i=r.sample)||void 0===i?void 0:i.channel)||"r",a=e}const o=new Th[t.type](a),l=new Mh[t.type](e,Object.assign(Object.assign({},s),{renderer:o}));if(l.id!==e)throw new Error(`[MapsGL] Expected layer ID to be ${e} but got ${l.id} instead.`);if(l.type=t.type,l.type===tr.m.query&&(l.type=t.queryType||tr.m.symbol),(0,R.n)(t.timeSeries)){const{mode:e,clamp:i,range:r,intervals:a,interleaved:s}=t.timeSeries;(0,R.n)(e)&&(l.timing.mode=e),(0,R.n)(i)&&(l.timing.clamp=i),(0,R.n)(r)&&(l.timing.range=r),(0,R.n)(a)&&(l.timing.intervals=a),"boolean"===(0,fe.N)(s)&&(l.timing.interleaved=s)}return l})(t,o),n=s.source,s instanceof Bl){const e="string"==typeof o.queryLayer?o.queryLayer:null===(a=o.queryLayer)||void 0===a?void 0:a.id;(0,pe.Z)(e)&&(s.queryLayer=this.get(e))}if((0,pe.Z)(r)){const e="string"==typeof r?{id:r}:r;s.mask={layer:this.get(e.id),inverted:Boolean(e.invert)}}}return this.layerIdsBySource[n.id]||(this.layerIdsBySource[n.id]=[]),this.layerIdsBySource[n.id].push(s.metadata),s.source.addConsumer(s.metadata),s.scene=r,this.cache.set(t,s),this.order.splice(e,0,t),this.trigger("add",{layer:s}),s}console.warn(`[MapsGL] A layer with ID ${t} already exists.`)}move(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;const i=this.order.indexOf(e);if(i>=0){const e=this.order.splice(i,1)[0];-1===t?this.order.push(e):this.order.splice(t,0,e)}}remove(e){const t=this.get(e);if(t){const i=this.order.indexOf(e);t.scene=void 0;const r=t.source.id;this.layerIdsBySource[r]&&(this.layerIdsBySource[r]=this.layerIdsBySource[r].filter((t=>t.layerId!==e))),t.source.removeConsumerForLayerId(e),t.onRemove(),this.cache.delete(e),i>=0&&this.order.splice(i,1),this.trigger(ss,{layer:t})}return t}each(e){this.cache.forEach(((t,i)=>{e(t)}))}};var Ph;!function(e){e[e.orthographic=0]="orthographic",e[e.perspective=1]="perspective"}(Ph||(Ph={}));class Dh extends sl{constructor({near:e=1,far:t=1e3,fov:i=45,aspect:r=1,bounds:a,zoom:s=1}={}){super(),this.type=Ph.perspective,this.projectionMatrix=new Ts,this.viewMatrix=new Ai.A,this.projectionViewMatrix=new Ts,this.worldPosition=new Ve.A,this.near=e,this.far=t,this.fov=i,this.aspect=r,this.bounds=a,this.zoom=s;const{left:n,right:o,top:l,bottom:h}=a||{};this.type=n||o?Ph.orthographic:Ph.perspective,this.type===Ph.orthographic?this.orthographic(n,o,l,h,e,t,s):this.perspective(i,r,e,t)}perspective(e,t,i,r){this.fov=e,this.aspect=t,this.near=i,this.far=r,this.projectionMatrix.fromPerspective(e,t,i,r),this.type=Ph.perspective}orthographic(e,t,i,r,a,s){let n=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1;this.bounds={left:e,right:t,top:i,bottom:r},this.near=a,this.far=s,this.projectionMatrix.orthographic(e/n,t/n,i/n,r/n,a,s),this.type=Ph.orthographic}lookAt(e){return super.lookAt(e,!0),this}updateMatrixWorld(){return super.updateMatrixWorld(),this.viewMatrix.inverse(this.worldMatrix),this.worldMatrix.getTranslation(this.worldPosition),this.projectionViewMatrix.multiply(this.projectionMatrix,this.viewMatrix),this}updateProjectionMatrix(){}}class zh extends Dh{constructor(e,t,i,r,a,s,n=1){super({bounds:{left:e,right:t,top:i,bottom:r},near:a,far:s,zoom:n})}updateProjectionMatrix(){const{left:e,right:t,top:i,bottom:r}=this.bounds,a=this.zoom;this.projectionMatrix.orthographic(e/a,t/a,i/a,r/a,this.near,this.far)}}class Lh extends Dh{constructor(e,t,i,r){super({fov:e,aspect:t,near:i,far:r})}updateProjectionMatrix(){this.projectionMatrix.fromPerspective(this.fov,this.aspect,this.near,this.far)}}const kh=class{constructor(e){const{camera:t,map:i}=e;this.scene=new al;const{width:r,height:a}=i.size,s=i.fov;this.camera="orthographic"===t?new zh(-r/2,r/2,a/2,-a/2,.1,1e21):new Lh(s,r/a,.1,1e21),this.camera.matrixAutoUpdate=!1,this.camera.position.z=600}add(e){this.scene.add(e)}remove(e){this.scene.remove(e)}render(e,t){this.scene.add(e),e.updateMatrixWorld(),e.draw({camera:this.camera}),this.scene.remove(e)}},Fh="update",jh="empty",Nh="units:change",Vh={width:200,insets:4,points:{radius:4,margin:[3,4]},text:{family:"Helvetica",color:"#000000",size:10,style:"normal",weight:"normal"}},Bh=class extends N.A{get measurement(){var e,t,i;const r=this.options.bar;return Array.isArray(r)?null===(t=null===(e=r[0])||void 0===e?void 0:e.measurement)||void 0===t?void 0:t.type:(0,te.G)(r)?null===(i=r.measurement)||void 0===i?void 0:i.type:void 0}get size(){return{width:this._layout.size.width,height:this._layout.size.height}}get canvas(){return this._canvas}get layout(){return this._layout}constructor(e,t){super(),this.options={},this._rendered=!1,this.update=(0,Ma.s)(((e,t)=>{this._update(e,t)}),100),this.id=e,this.options=Object.freeze((0,j.$)({},Vh,t)),this.state=new Oa.A({units:void 0}),this._canvas=Ce({width:40,height:40})}setUnits(e){this.state.setState({units:e}),this._rendered&&this.render()}render(){this._prepare(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).then((()=>{const e=this.options.text.family,t=this.options.text.size,i=this.options.text.style,r=this.options.text.weight;this._prepareCanvas();const a=this.canvas.getContext("2d");a.font=`${i} ${r} ${t}px ${e}`,a.textAlign="left",a.textBaseline="bottom",a.clearRect(0,0,this.canvas.width,this.canvas.height),this._render(a),this._rendered=!0,this.trigger(Fh)}))}_prepare(){throw new Error("Method not implemented.")}_render(e){throw new Error("Method not implemented.")}_update(e){throw new Error("Method not implemented.")}_calculateLayout(e,t){throw new Error("Method not implemented")}_prepareCanvas(){const e=window.devicePixelRatio||1;this._layout=this._calculateLayout(this.options.width,this.options.insets);const t=this._layout.size.width,i=this._layout.size.height;this.canvas.width=t*e,this.canvas.height=i*e,this.canvas.style.width=`${t}px`,this.canvas.style.height=`${i}px`,this.canvas.getContext("2d").scale(e,e)}};var Uh=i(9369);const $h=100,Gh={height:10,rounded:!1,labels:{margin:[6,4]}},qh=(e,t)=>{var i,r;const a=(0,j.$)({},e,t);return a.colorscale.stops=(null===(i=t.colorscale)||void 0===i?void 0:i.stops)||(null===(r=e.colorscale)||void 0===r?void 0:r.stops),(0,X.mg)(a)},Wh=class extends Bh{constructor(e,t){var i;super(e,t),this._bars=[];const r=Array.isArray(this.options.bar)?this.options.bar[0]:this.options.bar;let a;r&&(a=null===(i=r.measurement)||void 0===i?void 0:i.units),this.state.setState("units",a)}_prepare(e){const t=this.options,i=Array.isArray(t.bar)?t.bar:[t.bar];return this._bars=i.map((e=>{const t=e.colorscale,i=(0,F.R7)(t.stops,t.range,t.normalized);return t.positions&&i.setPositions(t.positions),{config:(0,j.$)({},Gh,e),scale:i}})),Promise.resolve()}_render(e){const{bounds:t,rowHeight:i}=this.layout,r=t.left;let a=t.top;this._bars.forEach(((t,s)=>{((e,t,i,r,a,s)=>{var n,o,l;const{config:h,scale:c}=t,{labels:d,colorscale:u}=h,p=u.range,f=null===(n=h.measurement)||void 0===n?void 0:n.units,m=a.units||f,g=(e=>{var t;return(null===(t=e.measurement)||void 0===t?void 0:t.converter)?e.measurement.converter:(e,t,i)=>e})(h),v=new Ll(p),y=c.getRamp({range:v,totalColors:Math.min(s.colWidth,500),interval:u.interval,interpolate:u.interpolate,normalize:u.normalized,breaks:Array.isArray(u.breaks)?u.breaks:me(u.breaks)?u.breaks(p.min,p.max,u.interval):void 0,easing:u.resample?"function"==typeof u.resample?u.resample:Uh.G[u.resample]:void 0}),x={options:t.config,legendOptions:r,state:a,layout:s,pos:i,ramp:y,unitsConverter:g,fromUnits:f,toUnits:m};if(((e,t)=>{let{options:i,layout:r,ramp:a,pos:s}=t;const{rounded:n}=i,{colWidth:o}=r;let l=a.stops.map((e=>e.color));const h=l.findIndex((e=>e.a>0)),c=[...l].reverse().findIndex((e=>e.a>0));l=l.slice(h,l.length-c);let d=s.x,u=s.y;const p={width:Math.max(1,o/l.length),height:i.height};p.width=Math.floor(p.width*$h)/$h,p.height=Math.floor(p.height),e.save(),n&&(((e,t,i,r,a,s)=>{const n=Math.PI/180;r-t-2*s<0&&(s=(r-t)/2),a-i-2*s<0&&(s=(a-i)/2),e.beginPath(),e.moveTo(t+s,i),e.lineTo(r-s,i),e.arc(r-s,i+s,s,270*n,360*n,!1),e.lineTo(r,a-s),e.arc(r-s,a-s,s,0*n,90*n,!1),e.lineTo(t+s,a),e.arc(t+s,a-s,s,90*n,180*n,!1),e.lineTo(t,i+s),e.arc(t+s,i+s,s,180*n,270*n,!1),e.closePath()})(e,d,u,d+o,u+p.height,p.height/2),e.clip());const f=o-p.width*l.length,m=f>1?Math.floor((l.length-1)/f):0;for(let t=0;t<l.length;t++){const i=l[t],r={r:Math.round(i.r),g:Math.round(i.g),b:Math.round(i.b),a:i.a},a=t>0?1:0,s=vr(r),n=p.width+(m>1&&t%m==0?1:0);d=Math.floor(d*$h)/$h,u=Math.floor(u*$h)/$h;const o=n+a;e.save(),r.a<1&&(e.globalAlpha=r.a),e.beginPath(),e.fillStyle=s,e.rect(Math.floor(d),Math.floor(u),Math.ceil(o),p.height),e.fill(),e.closePath(),e.restore(),d+=n}e.restore()})(e,x),d){const t=null!==(l=null===(o=x.options.labels)||void 0===o?void 0:o.normalized)&&void 0!==l&&l,i=(e=>{let{options:t,ramp:i,unitsConverter:r,fromUnits:a,toUnits:s}=e;const{values:n,every:o,everyStep:l}=t.labels,{interpolate:h,stops:c,normalized:d}=t.colorscale,u=new Ll(t.colorscale.range),p="function"==typeof o?o(s):o,f=l||0;let m="function"==typeof n?n(s).map((e=>"number"==typeof e?r(e,s,a):Object.assign(Object.assign({},e),{value:r(e.value,s,a)}))):n;if((0,R.g)(m))if(!1===h)m=c.filter(((e,t)=>t%2==0)).map((e=>{const t=d?u.min+u.delta*Number.parseFloat(`${e}`):Number.parseFloat(`${e}`);return r(t,a,s)}));else if(f>0)m=Array.from({length:Math.floor(1/l)+1},((e,t)=>i.getValue(l*t)));else if(p>0){const e=[],t=r(u.min,a,s),i=r(u.max,a,s);let n=(0,ka.PL)(t,p);for(;n<=i;)e.push(n),n+=p;m=e.map((e=>r(e,s,a)))}return m})(x);if((null==i?void 0:i.length)>0){const r=t?0:p.min,a=t?1:p.max,s=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:(e,t,i)=>`${e}`,{options:i,state:r,ramp:a,unitsConverter:s,fromUnits:n,toUnits:o}=arguments.length>2?arguments[2]:void 0;const{labels:l}=i,h=new Ll(i.colorscale.range);return e.map(((e,i)=>{if((0,te.G)(e)){const t=Object.assign({},e);return!0===l.normalized&&(t.value=(0,ui.C)(h.min,h.max,t.value)),t}let c=(0,$.K)(e)?Number.parseFloat(`${e}`):e;!0===l.normalized&&(c=(0,ui.C)(h.min,h.max,c));const d=s(c,n,o),u=t(d,i,r);let p=0;const f=a.stops;for(let e=0;e<f.length;e++){const t=f[e],i=f[e+1];if(e===f.length-1)p=t.position;else if(c>=t.value&&i&&c<i.value){p=(0,ui.C)(t.position,i.position,(c-t.value)/(i.value-t.value));break}}return{value:c,label:null==u?void 0:u.replace(/%%units%%/,o),position:p}}))}(i.filter((e=>"number"==typeof e?e>=r&&e<=a:e.value>=r&&e.value<=a)),d.formatter,x);((e,t,i)=>{let{options:r,legendOptions:a,layout:s,pos:n}=i;const{labels:o}=r,{text:{size:l,color:h,offset:c,stroke:d,shadow:u}}=a,p=o.placement||"bottom",f=o.marks||"point",m=Object.assign({x:0,y:0},c),g=new Ll(r.colorscale.range),v=Array.isArray(o.margin)?o.margin:[o.margin,o.margin],y=Object.assign({},s.bounds);y.left+=v[0],y.right-=v[0],y.top+=v[1],y.bottom-=v[1];const x=n.x+v[0],b=n.y,w=r.height-2*v[1],_=y.right-y.left;let A=y.top;"middle"===p?A=b+w/2+l/2:"bottom"===p&&(A=b+w+l+v[1]),A+=v[1],A+=m.y;const M=[],T=e=>M.some((t=>e.left<t.right&&e.right>t.left)),E=[t[0],t.at(-1),...t.slice(1,-1)].filter(Boolean);e.save();for(const{value:t,label:i,position:r}of E){const a=(0,R.n)(r)?r:(t-g.min)/(g.max-g.min),s=e.measureText(i).width,n=0,o={x:y.left+_*a,y:b},c={left:o.x-s/2-v[0],right:o.x+s/2+v[0],top:A-l,bottom:A};if(a<0||a>1)continue;let p=o.x;if(c.left<x?(p=x+n,c.left=x,c.right=p+s,e.textAlign="left"):c.right>x+_?(p=x+_-n,c.left=p-s,c.right=p,e.textAlign="right"):e.textAlign="center",!1===T(c)){if("none"!==f&&(e.beginPath(),"line"===f?(e.strokeStyle=h,e.lineWidth=1,e.moveTo(o.x,o.y+w-4),e.lineTo(o.x,o.y+w+4),e.stroke()):(e.fillStyle=h,e.arc(o.x,o.y+w,2,0,2*Math.PI),e.fill()),e.closePath()),(0,R.n)(u)){const{color:t,blur:i=4,offset:r={x:0,y:0}}=u;e.shadowOffsetX=r.x,e.shadowOffsetY=r.y,e.shadowColor=t,e.shadowBlur=i}if((0,R.n)(d)){const{color:t,width:r=1}=d;t&&(e.strokeStyle=t,e.lineWidth=r,e.strokeText(i,p,A))}e.fillStyle=h,e.fillText(i,p,A),M.push(c)}}e.restore()})(e,s,x)}}})(e,t,{x:r,y:a},this.options,this.state.value,this.layout),a+=i+4}))}_update(e,t){let i=(0,j.$)({},this.options,e);const r=e.bar,a=this.options.bar;r&&a&&(i.bar=Array.isArray(a)?Array.isArray(r)?r.map(((e,t)=>qh(a[t],e))):qh(a[0],r):Array.isArray(r)?r.map((e=>qh(a,e))):qh(a,r),this.options.onBeforeUpdate&&(i=this.options.onBeforeUpdate(i))),this.options=Object.freeze(i),this.render(t)}_calculateLayout(e,t){Array.isArray(t)||(t=[t,t,t,t]),2===t.length&&(t=[t[0],t[1],t[0],t[1]]);const i=this.options.text.size,[r,a,s,n]=t,o=new ua(n,e-a,r,0),l=Ce().getContext("2d");l.font=`bold ${i}px Helvetica`,l.textAlign="left",l.textBaseline="bottom";const h=e;let c=0,d=1,u=0,p=0;return this._bars.forEach(((e,t)=>{let{config:r}=e;var a;const{margin:s}=r.labels,n=Array.isArray(s)?s:[s,s],o=(null===(a=r.labels)||void 0===a?void 0:a.placement)||"bottom";c+=r.height,"middle"!==o&&(c+=i+n[1]),t>0?c+=4:p=c})),d=this._bars.length,u=o.size.width,o.bottom=o.top+c,{size:{width:h,height:r+s+c},bounds:o,cols:d,rows:1,colWidth:u,rowHeight:p}}},Hh=class extends Bh{constructor(){super(...arguments),this._items=[]}get items(){return(0,X.mg)(this._items)}_prepare(e){if((0,pe.E)(this.options.points))throw new Error("[MapsGL] Invalid or missing `points` configuration for PointLegend");return this._preparePointItems(this.options.points.values,e).then((e=>{this._items=e}))}_preparePointItems(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return me(e)?e(t):Array.isArray(e)?new Promise((t=>{t(e)})):void 0}_render(e){((e,t,i,r,a,s)=>{const{radius:n,margin:o}=r.points,{size:l,color:h}=r.text,{bounds:c,cols:d,rows:u,colWidth:p}=s,f=Array.isArray(o)?o:[o,o];let m=c.left+i.x,g=c.top+i.y;const v=n,y=Math.max(2*n,l);let x=0,b=c.left;for(let i=0;i<d;i++){m=Math.round(c.left+p*i+n),g=Math.round(c.top+v);for(let i=0;i<u&&!(x>=t.length);i++){const{color:i,label:r}=t[x];1===u&&(m=b+n),e.beginPath(),e.fillStyle=i,e.arc(m,g,n,0,2*Math.PI),e.fill(),e.closePath();const a=e.measureText(r),s=m+n+f[0],o=g+l/2+1;e.fillStyle=h,e.fillText(r,s,o),b+=2*n+f[0]+a.width+2*n,g+=y+f[1],x+=1}}})(e,this._items,{x:0,y:0},this.options,0,this.layout),0===this._items.length&&this.trigger(jh)}_update(e,t){var i,r;const a=(0,j.$)({},this.options,e);(null===(i=e.points)||void 0===i?void 0:i.values)&&(a.points.values=null===(r=e.points)||void 0===r?void 0:r.values),this.options=Object.freeze(a),this.render(t)}_calculateLayout(e,t){Array.isArray(t)||(t=[t,t,t,t]),2===t.length&&(t=[t[0],t[1],t[0],t[1]]);const i=this.options.text.size,[r,a,s,n]=t,o=new ua(n,e-a,r,0),l=Ce().getContext("2d");l.font=`bold ${i}px Helvetica`,l.textAlign="left",l.textBaseline="bottom";let h=e,c=0,d=1,u=1,p=0,f=0;const{radius:m,margin:g}=this.options.points,v=Array.isArray(g)?g:[g,g];let y=0;const x=Math.max(2*m,i);return this._items.forEach((e=>{let{label:t}=e;const i=l.measureText(t);y=Math.max(y,i.width)})),p=y+2*m+2*v[0],d=Math.floor(o.size.width/p),u=Math.ceil(this._items.length/d),p=Math.max(o.size.width/d,p),f=x,c=u*x+(u-1)*v[1],h=d*p,o.bottom=o.top+c,{size:{width:h,height:r+s+c},bounds:o,cols:d,rows:u,colWidth:p,rowHeight:f}}},Zh={width:400,insets:4,system:O.UnitSystem.metric,units:O.defaultUnits.metric,toggleOnClick:!0};class Yh extends N.A{constructor(e,t){super(),this.ref=0,this.index=0,this._elements={},this._maxHeight=100,this.hide=()=>{this.element.remove()},this.remove=()=>{this.element.remove(),this.dispose()},this._onEmpty=()=>{this.hide()},this._onUpdate=()=>{this.show()},this._updateFade=e=>{null==e||e.stopPropagation();const t=this.legend.size.height,i=this._elements.container,r=this._elements.topOverlay,a=this._elements.bottomOverlay,s=t-this._maxHeight;t>this._maxHeight?(r.style.opacity=i.scrollTop<=0?"0":"1",a.style.opacity=i.scrollTop>=s?"0":"1"):(r.style.opacity="0",a.style.opacity="0")};const i=document.createElement("div");if(i.classList.add("awxgl-legend-container"),this.element=i,this.legend=e,t){const e=document.createElement("div");e.classList.add("awxgl-legend-title"),e.innerHTML=t,i.append(e)}const r=document.createElement("div");r.classList.add("awxgl-legend-item-wrapper"),r.style.position="relative",i.append(r),this._elements.wrapper=r;const a=document.createElement("div");a.classList.add("awxgl-legend-item"),a.style.display="flex",a.style.maxHeight=`${this._maxHeight}px`,a.style.overflowY="auto",a.append(e.canvas),r.append(a),this._elements.container=a;const s=document.createElement("div");s.classList.add("awxgl-legend-item-fade","awxgl-legend-item-fade-top"),this._elements.topOverlay=s;const n=document.createElement("div");n.classList.add("awxgl-legend-item-fade","awxgl-legend-item-fade-bottom"),this._elements.bottomOverlay=n,[s,n].forEach(((e,t)=>{e.style.position="absolute",e.style.left="0",e.style.right="0",1===t?e.style.bottom="0":e.style.top="0",r.append(e)})),e.on(Fh,(()=>{this._updateFade(),this.trigger(Fh)})),this.observe(),a.addEventListener("scroll",this._updateFade)}show(){var e;const t=null===(e=this.parent)||void 0===e?void 0:e.childNodes;t&&!this.element.parentElement&&(this.index>=t.length?this.parent.append(this.element):this.parent.insertBefore(this.element,t[this.index]))}observe(){this.legend.on(jh,this._onEmpty),this.legend.on(Fh,this._onUpdate)}dispose(){this.legend.off(jh,this._onEmpty),this.legend.off(Fh,this._onUpdate)}}const Xh=class extends N.A{get container(){return this._container}get metric(){return this._state.value.system===O.UnitSystem.metric}set metric(e){this._state.setState("system",e?O.UnitSystem.metric:O.UnitSystem.imperial)}constructor(e={}){if(super(),this.options={},this.legends=new Map,this._handleClick=e=>{null==e||e.stopImmediatePropagation(),this.toggleUnits()},this._handleLegendItemUpdate=()=>{this.trigger(Fh)},this._handleUnitsChange=()=>{this.legends.forEach((e=>{const t=e.legend.measurement;t&&e.legend.setUnits(this._state.value.units[t])})),this.trigger(Fh)},(0,R.n)(e.width)){const t=!1===Number.isNaN(e.width)&&"number"==typeof e.width;(0,ue.vA)(t,"[MapsGL] LegendControl: width must be a number or string"),e.width=Math.max(140,e.width)}this.options=Object.freeze((0,j.$)({},Zh,e));const t=Object.assign(Object.assign({},O.defaultUnits.metric),this.options.units);this._state=new Oa.A({units:t,system:(0,O.getSystemForUnits)(t)}),this._state.on(Oa.A.Events.UPDATE_KEY,(e=>{let{key:t,value:i}=e;if("system"===t)i!==O.UnitSystem.custom&&this.setUnits((0,O.getDefaultUnitsForSystem)(i));else if(/^units\.?(.*)$/.test(t)){const e=(0,O.getSystemForUnits)(i);e!==this._state.value.system&&this._state.setState("system",e),this._handleUnitsChange()}}))}setUnits(e){this._state.setState("units",e),this.trigger(Nh,{units:e,system:this._state.value.system})}addTo(e){if(e){let t;t=(0,$.K)(e)?document.querySelector(e):e;const i=document.createElement("div");i.classList.add("awxgl-control-legend"),this._container=i,t.append(i);const r=t.lastChild;r&&this.options.toggleOnClick&&r.addEventListener("click",this._handleClick)}}remove(){var e;null===(e=this._container)||void 0===e||e.remove()}update(e){this.legends.forEach((t=>{t.legend.update({},e)}))}hasLegend(e){return this.legends.has(e)}getLegend(e){var t;return null===(t=this.legends.get(e))||void 0===t?void 0:t.legend}addLegend(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(this.hasLegend(e)){const t=this.legends.get(e);return t.ref+=1,t.show(),t.legend}const r=Object.assign(Object.assign({},t),{width:this.options.width,insets:this.options.insets});let a;switch(t.type){case"bar":a=new Wh(e,r);break;case"point":a=new Hh(e,r);break;default:throw new Error(`[MapsGL] LegendControl: unknown legend type: ${t.type}`)}a.setUnits(this._state.value.units[a.measurement]),a.render(i);const s=new Yh(a,null==t?void 0:t.title);return s.element.setAttribute("id",`awxgl-legend-${e}`),s.ref+=1,s.parent=this.container,s.index=this.legends.size,s.on(Fh,this._handleLegendItemUpdate),this.container.append(s.element),this.legends.set(e,s),this.trigger("add",{id:e,legend:a}),this.trigger(Fh),a}removeLegend(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=this.legends.get(e);i&&(i.ref-=1,(i.ref<=0||t)&&(i.remove(),i.off(Fh,this._handleLegendItemUpdate),this.legends.delete(e),this.trigger("remove",{id:e}),this.trigger(Fh)))}showLegend(e){const t=this.legends.get(e);t&&t.show()}hideLegend(e){const t=this.legends.get(e);t&&t.hide()}toggleUnits(){const e=this._state.value.system;e!==O.UnitSystem.custom?(this._state.setState("system",e===O.UnitSystem.metric?O.UnitSystem.imperial:O.UnitSystem.metric),this.trigger(Fh)):console.warn("[MapsGL] LegendControl: cannot toggle units for custom unit system, use `setUnits` instead")}};function Qh(e){if(null==e)return window;if("[object Window]"!==e.toString()){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function Kh(e){return e instanceof Qh(e).Element||e instanceof Element}function Jh(e){return e instanceof Qh(e).HTMLElement||e instanceof HTMLElement}function ec(e){return"undefined"!=typeof ShadowRoot&&(e instanceof Qh(e).ShadowRoot||e instanceof ShadowRoot)}var tc=Math.max,ic=Math.min,rc=Math.round;function ac(){var e=navigator.userAgentData;return null!=e&&e.brands&&Array.isArray(e.brands)?e.brands.map((function(e){return e.brand+"/"+e.version})).join(" "):navigator.userAgent}function sc(){return!/^((?!chrome|android).)*safari/i.test(ac())}function nc(e,t,i){void 0===t&&(t=!1),void 0===i&&(i=!1);var r=e.getBoundingClientRect(),a=1,s=1;t&&Jh(e)&&(a=e.offsetWidth>0&&rc(r.width)/e.offsetWidth||1,s=e.offsetHeight>0&&rc(r.height)/e.offsetHeight||1);var n=(Kh(e)?Qh(e):window).visualViewport,o=!sc()&&i,l=(r.left+(o&&n?n.offsetLeft:0))/a,h=(r.top+(o&&n?n.offsetTop:0))/s,c=r.width/a,d=r.height/s;return{width:c,height:d,top:h,right:l+c,bottom:h+d,left:l,x:l,y:h}}function oc(e){var t=Qh(e);return{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function lc(e){return e?(e.nodeName||"").toLowerCase():null}function hc(e){return((Kh(e)?e.ownerDocument:e.document)||window.document).documentElement}function cc(e){return nc(hc(e)).left+oc(e).scrollLeft}function dc(e){return Qh(e).getComputedStyle(e)}function uc(e){var t=dc(e);return/auto|scroll|overlay|hidden/.test(t.overflow+t.overflowY+t.overflowX)}function pc(e,t,i){void 0===i&&(i=!1);var r,a,s=Jh(t),n=Jh(t)&&function(e){var t=e.getBoundingClientRect(),i=rc(t.width)/e.offsetWidth||1,r=rc(t.height)/e.offsetHeight||1;return 1!==i||1!==r}(t),o=hc(t),l=nc(e,n,i),h={scrollLeft:0,scrollTop:0},c={x:0,y:0};return(s||!s&&!i)&&(("body"!==lc(t)||uc(o))&&(h=(r=t)!==Qh(r)&&Jh(r)?{scrollLeft:(a=r).scrollLeft,scrollTop:a.scrollTop}:oc(r)),Jh(t)?((c=nc(t,!0)).x+=t.clientLeft,c.y+=t.clientTop):o&&(c.x=cc(o))),{x:l.left+h.scrollLeft-c.x,y:l.top+h.scrollTop-c.y,width:l.width,height:l.height}}function fc(e){var t=nc(e),i=e.offsetWidth,r=e.offsetHeight;return Math.abs(t.width-i)<=1&&(i=t.width),Math.abs(t.height-r)<=1&&(r=t.height),{x:e.offsetLeft,y:e.offsetTop,width:i,height:r}}function mc(e){return"html"===lc(e)?e:e.assignedSlot||e.parentNode||(ec(e)?e.host:null)||hc(e)}function gc(e){return["html","body","#document"].indexOf(lc(e))>=0?e.ownerDocument.body:Jh(e)&&uc(e)?e:gc(mc(e))}function vc(e,t){var i;void 0===t&&(t=[]);var r=gc(e),a=r===(null==(i=e.ownerDocument)?void 0:i.body),s=Qh(r),n=a?[s].concat(s.visualViewport||[],uc(r)?r:[]):r,o=t.concat(n);return a?o:o.concat(vc(mc(n)))}function yc(e){return["table","td","th"].indexOf(lc(e))>=0}function xc(e){return Jh(e)&&"fixed"!==dc(e).position?e.offsetParent:null}function bc(e){for(var t=Qh(e),i=xc(e);i&&yc(i)&&"static"===dc(i).position;)i=xc(i);return i&&("html"===lc(i)||"body"===lc(i)&&"static"===dc(i).position)?t:i||function(e){var t=/firefox/i.test(ac());if(/Trident/i.test(ac())&&Jh(e)&&"fixed"===dc(e).position)return null;var i=mc(e);for(ec(i)&&(i=i.host);Jh(i)&&["html","body"].indexOf(lc(i))<0;){var r=dc(i);if("none"!==r.transform||"none"!==r.perspective||"paint"===r.contain||-1!==["transform","perspective"].indexOf(r.willChange)||t&&"filter"===r.willChange||t&&r.filter&&"none"!==r.filter)return i;i=i.parentNode}return null}(e)||t}var wc="top",_c="bottom",Ac="right",Mc="left",Tc="auto",Ec=[wc,_c,Ac,Mc],Sc="start",Cc="end",Oc="viewport",Rc="popper",Ic=Ec.reduce((function(e,t){return e.concat([t+"-"+Sc,t+"-"+Cc])}),[]),Pc=[].concat(Ec,[Tc]).reduce((function(e,t){return e.concat([t,t+"-"+Sc,t+"-"+Cc])}),[]),Dc=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function zc(e){var t=new Map,i=new Set,r=[];function a(e){i.add(e.name),[].concat(e.requires||[],e.requiresIfExists||[]).forEach((function(e){if(!i.has(e)){var r=t.get(e);r&&a(r)}})),r.push(e)}return e.forEach((function(e){t.set(e.name,e)})),e.forEach((function(e){i.has(e.name)||a(e)})),r}var Lc={placement:"bottom",modifiers:[],strategy:"absolute"};function kc(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return!t.some((function(e){return!(e&&"function"==typeof e.getBoundingClientRect)}))}var Fc={passive:!0};const jc={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:function(e){var t=e.state,i=e.instance,r=e.options,a=r.scroll,s=void 0===a||a,n=r.resize,o=void 0===n||n,l=Qh(t.elements.popper),h=[].concat(t.scrollParents.reference,t.scrollParents.popper);return s&&h.forEach((function(e){e.addEventListener("scroll",i.update,Fc)})),o&&l.addEventListener("resize",i.update,Fc),function(){s&&h.forEach((function(e){e.removeEventListener("scroll",i.update,Fc)})),o&&l.removeEventListener("resize",i.update,Fc)}},data:{}};function Nc(e){return e.split("-")[0]}function Vc(e){return e.split("-")[1]}function Bc(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function Uc(e){var t,i=e.reference,r=e.element,a=e.placement,s=a?Nc(a):null,n=a?Vc(a):null,o=i.x+i.width/2-r.width/2,l=i.y+i.height/2-r.height/2;switch(s){case wc:t={x:o,y:i.y-r.height};break;case _c:t={x:o,y:i.y+i.height};break;case Ac:t={x:i.x+i.width,y:l};break;case Mc:t={x:i.x-r.width,y:l};break;default:t={x:i.x,y:i.y}}var h=s?Bc(s):null;if(null!=h){var c="y"===h?"height":"width";switch(n){case Sc:t[h]=t[h]-(i[c]/2-r[c]/2);break;case Cc:t[h]=t[h]+(i[c]/2-r[c]/2)}}return t}var $c={top:"auto",right:"auto",bottom:"auto",left:"auto"};function Gc(e){var t,i=e.popper,r=e.popperRect,a=e.placement,s=e.variation,n=e.offsets,o=e.position,l=e.gpuAcceleration,h=e.adaptive,c=e.roundOffsets,d=e.isFixed,u=n.x,p=void 0===u?0:u,f=n.y,m=void 0===f?0:f,g="function"==typeof c?c({x:p,y:m}):{x:p,y:m};p=g.x,m=g.y;var v=n.hasOwnProperty("x"),y=n.hasOwnProperty("y"),x=Mc,b=wc,w=window;if(h){var _=bc(i),A="clientHeight",M="clientWidth";_===Qh(i)&&"static"!==dc(_=hc(i)).position&&"absolute"===o&&(A="scrollHeight",M="scrollWidth"),(a===wc||(a===Mc||a===Ac)&&s===Cc)&&(b=_c,m-=(d&&_===w&&w.visualViewport?w.visualViewport.height:_[A])-r.height,m*=l?1:-1),a!==Mc&&(a!==wc&&a!==_c||s!==Cc)||(x=Ac,p-=(d&&_===w&&w.visualViewport?w.visualViewport.width:_[M])-r.width,p*=l?1:-1)}var T,E=Object.assign({position:o},h&&$c),S=!0===c?function(e,t){var i=e.y,r=t.devicePixelRatio||1;return{x:rc(e.x*r)/r||0,y:rc(i*r)/r||0}}({x:p,y:m},Qh(i)):{x:p,y:m};return p=S.x,m=S.y,Object.assign({},E,l?((T={})[b]=y?"0":"",T[x]=v?"0":"",T.transform=(w.devicePixelRatio||1)<=1?"translate("+p+"px, "+m+"px)":"translate3d("+p+"px, "+m+"px, 0)",T):((t={})[b]=y?m+"px":"",t[x]=v?p+"px":"",t.transform="",t))}var qc={left:"right",right:"left",bottom:"top",top:"bottom"};function Wc(e){return e.replace(/left|right|bottom|top/g,(function(e){return qc[e]}))}var Hc={start:"end",end:"start"};function Zc(e){return e.replace(/start|end/g,(function(e){return Hc[e]}))}function Yc(e,t){var i=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(i&&ec(i)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function Xc(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function Qc(e,t,i){return t===Oc?Xc(function(e,t){var i=Qh(e),r=hc(e),a=i.visualViewport,s=r.clientWidth,n=r.clientHeight,o=0,l=0;if(a){s=a.width,n=a.height;var h=sc();(h||!h&&"fixed"===t)&&(o=a.offsetLeft,l=a.offsetTop)}return{width:s,height:n,x:o+cc(e),y:l}}(e,i)):Kh(t)?function(e,t){var i=nc(e,!1,"fixed"===t);return i.top=i.top+e.clientTop,i.left=i.left+e.clientLeft,i.bottom=i.top+e.clientHeight,i.right=i.left+e.clientWidth,i.width=e.clientWidth,i.height=e.clientHeight,i.x=i.left,i.y=i.top,i}(t,i):Xc(function(e){var t,i=hc(e),r=oc(e),a=null==(t=e.ownerDocument)?void 0:t.body,s=tc(i.scrollWidth,i.clientWidth,a?a.scrollWidth:0,a?a.clientWidth:0),n=tc(i.scrollHeight,i.clientHeight,a?a.scrollHeight:0,a?a.clientHeight:0),o=-r.scrollLeft+cc(e),l=-r.scrollTop;return"rtl"===dc(a||i).direction&&(o+=tc(i.clientWidth,a?a.clientWidth:0)-s),{width:s,height:n,x:o,y:l}}(hc(e)))}function Kc(e){return Object.assign({},{top:0,right:0,bottom:0,left:0},e)}function Jc(e,t){return t.reduce((function(t,i){return t[i]=e,t}),{})}function ed(e,t){void 0===t&&(t={});var i=t.placement,r=void 0===i?e.placement:i,a=t.strategy,s=void 0===a?e.strategy:a,n=t.boundary,o=void 0===n?"clippingParents":n,l=t.rootBoundary,h=void 0===l?Oc:l,c=t.elementContext,d=void 0===c?Rc:c,u=t.altBoundary,p=void 0!==u&&u,f=t.padding,m=void 0===f?0:f,g=Kc("number"!=typeof m?m:Jc(m,Ec)),v=e.rects.popper,y=e.elements[p?d===Rc?"reference":Rc:d],x=function(e,t,i,r){var a="clippingParents"===t?function(e){var t=vc(mc(e)),i=["absolute","fixed"].indexOf(dc(e).position)>=0&&Jh(e)?bc(e):e;return Kh(i)?t.filter((function(e){return Kh(e)&&Yc(e,i)&&"body"!==lc(e)})):[]}(e):[].concat(t),s=[].concat(a,[i]),n=s.reduce((function(t,i){var a=Qc(e,i,r);return t.top=tc(a.top,t.top),t.right=ic(a.right,t.right),t.bottom=ic(a.bottom,t.bottom),t.left=tc(a.left,t.left),t}),Qc(e,s[0],r));return n.width=n.right-n.left,n.height=n.bottom-n.top,n.x=n.left,n.y=n.top,n}(Kh(y)?y:y.contextElement||hc(e.elements.popper),o,h,s),b=nc(e.elements.reference),w=Uc({reference:b,element:v,strategy:"absolute",placement:r}),_=Xc(Object.assign({},v,w)),A=d===Rc?_:b,M={top:x.top-A.top+g.top,bottom:A.bottom-x.bottom+g.bottom,left:x.left-A.left+g.left,right:A.right-x.right+g.right},T=e.modifiersData.offset;if(d===Rc&&T){var E=T[r];Object.keys(M).forEach((function(e){var t=[Ac,_c].indexOf(e)>=0?1:-1,i=[wc,_c].indexOf(e)>=0?"y":"x";M[e]+=E[i]*t}))}return M}function td(e,t,i){return tc(e,ic(t,i))}function id(e,t,i){return void 0===i&&(i={x:0,y:0}),{top:e.top-t.height-i.y,right:e.right-t.width+i.x,bottom:e.bottom-t.height+i.y,left:e.left-t.width-i.x}}function rd(e){return[wc,Ac,_c,Mc].some((function(t){return e[t]>=0}))}var ad=function(e){void 0===e&&(e={});var t=e.defaultModifiers,i=void 0===t?[]:t,r=e.defaultOptions,a=void 0===r?Lc:r;return function(e,t,r){void 0===r&&(r=a);var s,n,o={placement:"bottom",orderedModifiers:[],options:Object.assign({},Lc,a),modifiersData:{},elements:{reference:e,popper:t},attributes:{},styles:{}},l=[],h=!1,c={state:o,setOptions:function(r){var s="function"==typeof r?r(o.options):r;d(),o.options=Object.assign({},a,o.options,s),o.scrollParents={reference:Kh(e)?vc(e):e.contextElement?vc(e.contextElement):[],popper:vc(t)};var n,h,u=function(e){var t=zc(e);return Dc.reduce((function(e,i){return e.concat(t.filter((function(e){return e.phase===i})))}),[])}((n=[].concat(i,o.options.modifiers),h=n.reduce((function(e,t){var i=e[t.name];return e[t.name]=i?Object.assign({},i,t,{options:Object.assign({},i.options,t.options),data:Object.assign({},i.data,t.data)}):t,e}),{}),Object.keys(h).map((function(e){return h[e]}))));return o.orderedModifiers=u.filter((function(e){return e.enabled})),o.orderedModifiers.forEach((function(e){var t=e.options,i=e.effect;if("function"==typeof i){var r=i({state:o,name:e.name,instance:c,options:void 0===t?{}:t});l.push(r||function(){})}})),c.update()},forceUpdate:function(){if(!h){var e=o.elements,t=e.reference,i=e.popper;if(kc(t,i)){o.rects={reference:pc(t,bc(i),"fixed"===o.options.strategy),popper:fc(i)},o.reset=!1,o.placement=o.options.placement,o.orderedModifiers.forEach((function(e){return o.modifiersData[e.name]=Object.assign({},e.data)}));for(var r=0;r<o.orderedModifiers.length;r++)if(!0!==o.reset){var a=o.orderedModifiers[r],s=a.fn,n=a.options;"function"==typeof s&&(o=s({state:o,options:void 0===n?{}:n,name:a.name,instance:c})||o)}else o.reset=!1,r=-1}}},update:(s=function(){return new Promise((function(e){c.forceUpdate(),e(o)}))},function(){return n||(n=new Promise((function(e){Promise.resolve().then((function(){n=void 0,e(s())}))}))),n}),destroy:function(){d(),h=!0}};if(!kc(e,t))return c;function d(){l.forEach((function(e){return e()})),l=[]}return c.setOptions(r).then((function(e){!h&&r.onFirstUpdate&&r.onFirstUpdate(e)})),c}}({defaultModifiers:[jc,{name:"popperOffsets",enabled:!0,phase:"read",fn:function(e){var t=e.state;t.modifiersData[e.name]=Uc({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})},data:{}},{name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(e){var t=e.state,i=e.options,r=i.gpuAcceleration,a=void 0===r||r,s=i.adaptive,n=void 0===s||s,o=i.roundOffsets,l=void 0===o||o,h={placement:Nc(t.placement),variation:Vc(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:a,isFixed:"fixed"===t.options.strategy};null!=t.modifiersData.popperOffsets&&(t.styles.popper=Object.assign({},t.styles.popper,Gc(Object.assign({},h,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:n,roundOffsets:l})))),null!=t.modifiersData.arrow&&(t.styles.arrow=Object.assign({},t.styles.arrow,Gc(Object.assign({},h,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})},data:{}},{name:"applyStyles",enabled:!0,phase:"write",fn:function(e){var t=e.state;Object.keys(t.elements).forEach((function(e){var i=t.styles[e]||{},r=t.attributes[e]||{},a=t.elements[e];Jh(a)&&lc(a)&&(Object.assign(a.style,i),Object.keys(r).forEach((function(e){var t=r[e];!1===t?a.removeAttribute(e):a.setAttribute(e,!0===t?"":t)})))}))},effect:function(e){var t=e.state,i={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,i.popper),t.styles=i,t.elements.arrow&&Object.assign(t.elements.arrow.style,i.arrow),function(){Object.keys(t.elements).forEach((function(e){var r=t.elements[e],a=t.attributes[e]||{},s=Object.keys(t.styles.hasOwnProperty(e)?t.styles[e]:i[e]).reduce((function(e,t){return e[t]="",e}),{});Jh(r)&&lc(r)&&(Object.assign(r.style,s),Object.keys(a).forEach((function(e){r.removeAttribute(e)})))}))}},requires:["computeStyles"]},{name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(e){var t=e.state,i=e.name,r=e.options.offset,a=void 0===r?[0,0]:r,s=Pc.reduce((function(e,i){return e[i]=function(e,t,i){var r=Nc(e),a=[Mc,wc].indexOf(r)>=0?-1:1,s="function"==typeof i?i(Object.assign({},t,{placement:e})):i,n=s[0],o=s[1];return n=n||0,o=(o||0)*a,[Mc,Ac].indexOf(r)>=0?{x:o,y:n}:{x:n,y:o}}(i,t.rects,a),e}),{}),n=s[t.placement],o=n.y;null!=t.modifiersData.popperOffsets&&(t.modifiersData.popperOffsets.x+=n.x,t.modifiersData.popperOffsets.y+=o),t.modifiersData[i]=s}},{name:"flip",enabled:!0,phase:"main",fn:function(e){var t=e.state,i=e.options,r=e.name;if(!t.modifiersData[r]._skip){for(var a=i.mainAxis,s=void 0===a||a,n=i.altAxis,o=void 0===n||n,l=i.fallbackPlacements,h=i.padding,c=i.boundary,d=i.rootBoundary,u=i.altBoundary,p=i.flipVariations,f=void 0===p||p,m=i.allowedAutoPlacements,g=t.options.placement,v=Nc(g),y=l||(v!==g&&f?function(e){if(Nc(e)===Tc)return[];var t=Wc(e);return[Zc(e),t,Zc(t)]}(g):[Wc(g)]),x=[g].concat(y).reduce((function(e,i){return e.concat(Nc(i)===Tc?function(e,t){void 0===t&&(t={});var i=t.boundary,r=t.rootBoundary,a=t.padding,s=t.flipVariations,n=t.allowedAutoPlacements,o=void 0===n?Pc:n,l=Vc(t.placement),h=l?s?Ic:Ic.filter((function(e){return Vc(e)===l})):Ec,c=h.filter((function(e){return o.indexOf(e)>=0}));0===c.length&&(c=h);var d=c.reduce((function(t,s){return t[s]=ed(e,{placement:s,boundary:i,rootBoundary:r,padding:a})[Nc(s)],t}),{});return Object.keys(d).sort((function(e,t){return d[e]-d[t]}))}(t,{placement:i,boundary:c,rootBoundary:d,padding:h,flipVariations:f,allowedAutoPlacements:m}):i)}),[]),b=t.rects.reference,w=t.rects.popper,_=new Map,A=!0,M=x[0],T=0;T<x.length;T++){var E=x[T],S=Nc(E),C=Vc(E)===Sc,O=[wc,_c].indexOf(S)>=0,R=O?"width":"height",I=ed(t,{placement:E,boundary:c,rootBoundary:d,altBoundary:u,padding:h}),P=O?C?Ac:Mc:C?_c:wc;b[R]>w[R]&&(P=Wc(P));var D=Wc(P),z=[];if(s&&z.push(I[S]<=0),o&&z.push(I[P]<=0,I[D]<=0),z.every((function(e){return e}))){M=E,A=!1;break}_.set(E,z)}if(A)for(var L=function(e){var t=x.find((function(t){var i=_.get(t);if(i)return i.slice(0,e).every((function(e){return e}))}));if(t)return M=t,"break"},k=f?3:1;k>0&&"break"!==L(k);k--);t.placement!==M&&(t.modifiersData[r]._skip=!0,t.placement=M,t.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}},{name:"preventOverflow",enabled:!0,phase:"main",fn:function(e){var t=e.state,i=e.options,r=e.name,a=i.mainAxis,s=void 0===a||a,n=i.altAxis,o=void 0!==n&&n,l=i.tether,h=void 0===l||l,c=i.tetherOffset,d=void 0===c?0:c,u=ed(t,{boundary:i.boundary,rootBoundary:i.rootBoundary,padding:i.padding,altBoundary:i.altBoundary}),p=Nc(t.placement),f=Vc(t.placement),m=!f,g=Bc(p),v="x"===g?"y":"x",y=t.modifiersData.popperOffsets,x=t.rects.reference,b=t.rects.popper,w="function"==typeof d?d(Object.assign({},t.rects,{placement:t.placement})):d,_="number"==typeof w?{mainAxis:w,altAxis:w}:Object.assign({mainAxis:0,altAxis:0},w),A=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,M={x:0,y:0};if(y){if(s){var T,E="y"===g?wc:Mc,S="y"===g?_c:Ac,C="y"===g?"height":"width",O=y[g],R=O+u[E],I=O-u[S],P=h?-b[C]/2:0,D=f===Sc?x[C]:b[C],z=f===Sc?-b[C]:-x[C],L=t.elements.arrow,k=h&&L?fc(L):{width:0,height:0},F=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},j=F[E],N=F[S],V=td(0,x[C],k[C]),B=m?x[C]/2-P-V-j-_.mainAxis:D-V-j-_.mainAxis,U=m?-x[C]/2+P+V+N+_.mainAxis:z+V+N+_.mainAxis,$=t.elements.arrow&&bc(t.elements.arrow),G=null!=(T=null==A?void 0:A[g])?T:0,q=O+U-G,W=td(h?ic(R,O+B-G-($?"y"===g?$.clientTop||0:$.clientLeft||0:0)):R,O,h?tc(I,q):I);y[g]=W,M[g]=W-O}if(o){var H,Z=y[v],Y="y"===v?"height":"width",X=Z+u["x"===g?wc:Mc],Q=Z-u["x"===g?_c:Ac],K=-1!==[wc,Mc].indexOf(p),J=null!=(H=null==A?void 0:A[v])?H:0,ee=K?X:Z-x[Y]-b[Y]-J+_.altAxis,te=K?Z+x[Y]+b[Y]-J-_.altAxis:Q,ie=h&&K?function(e,t,i){var r=td(e,t,i);return r>i?i:r}(ee,Z,te):td(h?ee:X,Z,h?te:Q);y[v]=ie,M[v]=ie-Z}t.modifiersData[r]=M}},requiresIfExists:["offset"]},{name:"arrow",enabled:!0,phase:"main",fn:function(e){var t,i=e.state,r=e.name,a=e.options,s=i.elements.arrow,n=i.modifiersData.popperOffsets,o=Nc(i.placement),l=Bc(o),h=[Mc,Ac].indexOf(o)>=0?"height":"width";if(s&&n){var c=function(e,t){return Kc("number"!=typeof(e="function"==typeof e?e(Object.assign({},t.rects,{placement:t.placement})):e)?e:Jc(e,Ec))}(a.padding,i),d=fc(s),u="y"===l?wc:Mc,p="y"===l?_c:Ac,f=i.rects.reference[h]+i.rects.reference[l]-n[l]-i.rects.popper[h],m=n[l]-i.rects.reference[l],g=bc(s),v=g?"y"===l?g.clientHeight||0:g.clientWidth||0:0,y=v/2-d[h]/2+(f/2-m/2),x=td(c[u],y,v-d[h]-c[p]);i.modifiersData[r]=((t={})[l]=x,t.centerOffset=x-y,t)}},effect:function(e){var t=e.state,i=e.options.element,r=void 0===i?"[data-popper-arrow]":i;null!=r&&("string"!=typeof r||(r=t.elements.popper.querySelector(r)))&&Yc(t.elements.popper,r)&&(t.elements.arrow=r)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]},{name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(e){var t=e.state,i=e.name,r=t.rects.reference,a=t.rects.popper,s=t.modifiersData.preventOverflow,n=ed(t,{elementContext:"reference"}),o=ed(t,{altBoundary:!0}),l=id(n,r),h=id(o,a,s),c=rd(l),d=rd(h);t.modifiersData[i]={referenceClippingOffsets:l,popperEscapeOffsets:h,isReferenceHidden:c,hasPopperEscaped:d},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":c,"data-popper-escaped":d})}}]});const sd=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return()=>({width:0,height:0,top:t,right:e,bottom:t,left:e})},nd={getBoundingClientRect:sd()};let od=0;const ld=class{constructor(e){this.id=`tooltip-${e}-${++od}`,this._tooltip=document.createElement("div"),this._tooltip.setAttribute("id",this.id),this._tooltip.setAttribute("role","tooltip"),this._tooltip.classList.add("awxgl-tooltip"),this._tooltip.innerHTML=`\n <div class="awxgl-tooltip-content"></div>\n <div id="${this.id}-arrow" class="awxgl-tooltip-arrow data-popper-arrow"></div>\n `,document.body.append(this._tooltip),this._instance=ad(nd,this._tooltip,{placement:"top",modifiers:[{name:"arrow",options:{element:document.querySelector(`#${this.id}-arrow`)}},{name:"offset",options:{offset:[0,15]}}]})}append(e){const t=(0,$.K)(e)?document.querySelector(e):e;t.append(this._tooltip),this._target=t}show(e,t,i){var r;i&&this.setContent(i);const a=(null===(r=this._target)||void 0===r?void 0:r.getBoundingClientRect())||{left:0,top:0};nd.getBoundingClientRect=sd(a.left+e,a.top+t),this._tooltip.dataset.show="",this._tooltip.style.display="block",this._instance.update()}hide(){delete this._tooltip.dataset.show,this._tooltip.style.display="none"}setContent(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this._content||(this._content=document.querySelector(`#${this.id} .awxgl-tooltip-content`),this._instance.update()),this._content.innerHTML=e,t&&this._instance.update().catch((e=>{}))}setHasData(e){e?this._tooltip.classList.add("awxgl-tooltip-has-data"):this._tooltip.classList.remove("awxgl-tooltip-has-data")}},hd={event:"click",stream:!0,tooltip:{}},cd=class{get isEnabled(){return this._enabled}constructor(e,t={}){this._evaluators={},this._enabled=!0,this.update=()=>{this._coord&&this._queryFeatures(this._coord)},this.handleMapClickEvent=e=>{this.isEnabled&&e.point&&e.coord&&(this._coord=Object.assign({},e.coord),this._queryFeaturesAsync(e.coord).then((()=>{this.show(e.point)})))},this.handleMapMoveEvent=e=>{this.hide()},this.handleMouseMoveEvent=e=>{this.isEnabled&&e.point&&e.coord&&(this._coord=Object.assign({},e.coord),this._queryFeatures(e.coord),this.show(e.point))},this.handleMouseOutEvent=e=>{this._tooltip.hide()},this._queryFeatures=ma((e=>{const t=this._inspector.query(e);this._setFeatures(e,t)}),50),this._queryFeaturesAsync=e=>this._inspector.queryPromise(e).then((t=>{this._setFeatures(e,t)})).catch((e=>{console.error(e)})),this.options=Object.freeze((0,j.$)({},hd,t)),this._inspector=e,this._tooltip=new ld("data")}addTo(e){e&&this._tooltip.append(e)}remove(){}show(e,t){this.isEnabled&&(this._position=e,t?(this._coord=Object.assign({},t),this._queryFeaturesAsync(t).then((()=>{this.show(this._position)}))):this._tooltip.show(e.x,e.y))}hide(){this._tooltip.hide()}enable(){this._enabled=!0}disable(){this.hide(),this._enabled=!1}setEvaluator(e,t){this._evaluators[e]=t}_setFeatures(e,t){const i=`${e.lat.toFixed(3)}, ${e.lon.toFixed(3)}`;let r="";const a=[],s=[];t&&(Object.keys(t).forEach((e=>{var i,r;const n=null===(i=t[e])||void 0===i?void 0:i.nodata,o=null===(r=t[e])||void 0===r?void 0:r.value,l=e,h=this._evaluators[l];if(h&&!(0,W.I)(h)){const e=h.title||l.replace(/:.+$/,""),t=me(e)?e(o):e,i=h.alwaysShow||!1===s.includes(t),r=(0,R.n)(h.fn)?h.fn(o):`${o}`;r&&""!==r&&i&&!1===n&&(s.push(t),a.push(`<span class="awxgl-data-title">${t}</span> ${r}`))}})),r=a.map((e=>`<div class="awxgl-data-row">${e}</div>`)).join("")),this._tooltip.setHasData(a.length>0),this._tooltip.setContent(`\n <div class="awxgl-data-coord">${i}</div>\n <div class="awxgl-data-rows">${r}</div>\n `)}},dd=class extends N.A{get animators(){return[...this._layers.values()].map((e=>e.visible?e.animator:null)).filter((e=>(0,R.n)(e)))}get loadingProgress(){const e=this._getLoadingAnimators().map((e=>(null==e?void 0:e.provider.getLoadingProgress())||null)).filter(Boolean);return bl.from(e)}get isPausedForLoading(){return this._pausedForLoading}constructor(e){super(),this.pauseWhileLoading=!1,this.shouldResumeAfterLoading=!0,this._layers=new Map,this._pausedForLoading=!1,this._handleTimelinePlayback=(0,Ma.s)((()=>{const e=this.timeline;e.isActive&&this.pauseWhileLoading&&(this._getLoadingAnimators().length>0?(this._pausedForLoading=!0,e.pause()):this._pausedForLoading&&this.shouldResumeAfterLoading&&(this._pausedForLoading=!1,e.isPaused?e.resume():e.play()))}),10),this.timeline=e,e.on(Ra.A.RANGE_CHANGE,(()=>{[...this._layers.values()].reduce(((e,t)=>(!1===e.includes(t.source)&&e.push(t.source),e)),[]).forEach((e=>{e instanceof ci&&e.getMetadata()})),this.setNeedsUpdate()})),e.on(Ra.A.PLAY,(()=>{this.pauseWhileLoading&&this._handleTimelinePlayback()}))}add(e){if(!this._layers.get(e.id)){this._layers.set(e.id,e);const t=e.animator.provider;t&&t.on(Ya.A.LOAD_START,(()=>{this.shouldResumeAfterLoading=!1===this.timeline.isPaused,this._handleTimelinePlayback()})).on(Ya.A.LOAD_COMPLETE,(()=>{this._handleTimelinePlayback()}))}}remove(e){this._layers.delete(e.id)}setNeedsUpdate(){this._layers.forEach((e=>{var t,i;null===(i=null===(t=e.animator)||void 0===t?void 0:t.provider)||void 0===i||i.setNeedsUpdate()}))}preloadData(){return new Promise((e=>{let t=[];const i=()=>{0===t.length&&e()};this._layers.forEach((e=>{var r;const a=null===(r=e.animator)||void 0===r?void 0:r.provider;e.visible&&a&&(e.animator.needsData&&(a.triggerReadyOnComplete=!0,a.once(Ya.A.DATA_READY,(()=>{t=t.filter((t=>t!==e.id)),i()})),t.push(e.id)),e.animator.loadDataIfNeeded(!1,!0))})),t.length>0&&this.timeline.stop(),i()}))}_getAnimators(){return[...this._layers].map((e=>{let[t,i]=e;return i.visible?i.animator:null})).filter((e=>(0,R.n)(e)))}_getLoadingAnimators(){return this._getAnimators().filter((e=>{var t;return!(null===(t=e.provider)||void 0===t?void 0:t.isReady)}))}},ud=(e,t)=>function(e,t){return i=this,a=function*(){const i=new Request(e.url,{method:e.method||"GET",headers:e.headers,body:e.body,signal:null==t?void 0:t.signal}),r=e.type||"string";"json"===r&&i.headers.set("Accept","application/json");const a=yield fetch(i);if(!a.ok)throw new Error(`[MapsGL] Request failed: ${a.status} ${a.statusText}`);let s;switch(r){case"json":s=yield a.json();break;case"arrayBuffer":case"image":s=yield a.arrayBuffer();break;default:s=yield a.text()}if(null==t?void 0:t.signal.aborted)throw new Error("[MapsGL] Request was aborted");return{response:a,data:s}},new((r=void 0)||(r=Promise))((function(e,t){function s(e){try{o(a.next(e))}catch(e){t(e)}}function n(e){try{o(a.throw(e))}catch(e){t(e)}}function o(t){var i;t.done?e(t.value):(i=t.value,i instanceof r?i:new r((function(e){e(i)}))).then(s,n)}o((a=a.apply(i,[])).next())}));var i,r,a}(Object.assign(Object.assign({},e),{type:"json"}),t);var pd=function(e,t,i,r){return new(i||(i=Promise))((function(a,s){function n(e){try{l(r.next(e))}catch(e){s(e)}}function o(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?a(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(n,o)}l((r=r.apply(e,t||[])).next())}))};new Set(["inter-bold"]);const fd=[{start:0,end:255},{start:256,end:383},{start:384,end:591}],md=e=>{const t={start:e,end:e+255};return fd.forEach((i=>{i.start===e&&(t.end=i.end)})),t};class gd{constructor(e){this.glyphs={},this.textures=[],this._atlasCount=0,this.url=e.url}getRangeForChar(e){return this.getRangeForCodePoint(e.codePointAt(0))}getRangeForCodePoint(e){let t=null;return fd.forEach((i=>{e>=i.start&&e<=i.end&&(t=i)})),t}getRanges(e){var t;const i=null===(t=this.glyphs[e])||void 0===t?void 0:t.ranges;return i?Object.values(i):[]}getAtlasTextures(e){const t=[];return Object.values(this.glyphs).forEach((e=>{Object.values(e.ranges).forEach((e=>{var i;(null===(i=e.atlas)||void 0===i?void 0:i.bitmap)&&t.push(e.atlas)}))})),t.sort(((e,t)=>e.index-t.index)).forEach((t=>{if(!this.textures[t.index]){const i=new ei(e,{image:t.bitmap,size:t.size});this.textures[t.index]=i}})),this.textures}loadGlyphs(e){return pd(this,void 0,void 0,(function*(){const t=[];return Object.keys(e).forEach((i=>{this.glyphs[i]||(this.glyphs[i]={ranges:{},requests:{}});const r=e[i];e[i]=[...new Set(r.filter((e=>"number"==typeof e)))],r.forEach((e=>{const r=this.getRangeForCodePoint(e);if(r){const e=this.glyphs[i],a=e.ranges[r.start],s=e.requests[r.start];if(s)t.push(s);else if(!a){const a=this.loadGlyphRange(i,r.start).then((()=>{delete e.requests[r.start]}));this.glyphs[i].requests[r.start]=a,t.push(a)}}}))})),Promise.all(t)}))}loadBitmaps(){return pd(this,void 0,void 0,(function*(){const e=[];return Object.keys(this.glyphs).forEach((t=>{const i=this.glyphs[t].ranges;Object.keys(i).forEach((r=>{const a=Number.parseInt(r,10),s=i[a];s.spec&&!s.atlas&&e.push(this.loadFontAtlas(t,a,s.spec.pages[0]))}))})),Promise.all(e)}))}loadGlyphRange(e,t){return pd(this,void 0,void 0,(function*(){const{start:i,end:r}=md(t),a=yield this.loadFontSpec(e,t);if(!a)throw new Error(`[MapsGL] Failed to load font glyph range ${t}: ${e}:${i}-${r}`);return this.glyphs[e].ranges[t]={start:i,end:r,spec:a,atlas:null},a.pages&&Array.isArray(a.pages)?yield this.loadFontAtlas(e,t,a.pages[0]):console.error("[MapsGL] Invalid font metadata",a),this.glyphs[e].ranges[t]}))}loadFontSpec(e,t){return pd(this,void 0,void 0,(function*(){const{start:i,end:r}=md(t),a=(0,X.mN)(this.url,{name:e,start:i,end:r}),s=new AbortController,{data:n}=yield ud({url:a},s);return n}))}loadFontAtlas(e,t,i){return pd(this,void 0,void 0,(function*(){const r=(0,X.mN)(this.url,{}).replace(/\/[^/]+\.json$/,`/${i}`),a=yield(e=>new Promise(((t,i)=>{const r=new Image;r.addEventListener("load",(()=>{const e=document.createElement("canvas");e.width=r.width,e.height=r.height;const i=e.getContext("2d");i.drawImage(r,0,0);const a=i.getImageData(0,0,r.width,r.height).data;t({size:{width:r.width,height:r.height},data:new Uint8Array(a.buffer)})})),r.addEventListener("error",(()=>{i(r)})),r.crossOrigin="anonymous",r.src=e})))(r);this.glyphs[e].ranges[t].atlas={index:this._atlasCount,size:a.size,bitmap:a.data},this._atlasCount+=1}))}serialize(){return{url:this.url,glyphs:Object.assign({},this.glyphs)}}merge(e){this.glyphs=(0,j.$)(this.glyphs,e.glyphs)}static deserialize(e){const t=new gd({url:e.url});return t.glyphs=Object.keys(e.glyphs).reduce(((t,i)=>(t[i]={ranges:e.glyphs[i].ranges,requests:{}},t)),Object.create(null)),t}}const vd=gd;var yd=function(e,t,i,r){return new(i||(i=Promise))((function(a,s){function n(e){try{l(r.next(e))}catch(e){s(e)}}function o(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?a(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(n,o)}l((r=r.apply(e,t||[])).next())}))};let xd=[],bd=0;const wd=(e,t)=>new Promise(((i,r)=>{e.type="image",xd.push({request:e,state:"pending",abortController:t,onSuccess:e=>i(e),onError:e=>r(e)}),Md()})),_d=e=>yd(void 0,void 0,void 0,(function*(){e.state="loading",bd+=1;const t=Ad(e.request,e.abortController);try{const i=yield t;if(delete e.abortController,e.state="completed",i.data instanceof HTMLImageElement)e.onSuccess(i);else if(i.data){const t=yield createImageBitmap(i.data);e.onSuccess({response:null,data:t})}}catch(t){delete e.abortController,e.onError(t)}finally{bd-=1,Md()}})),Ad=(e,t)=>yd(void 0,void 0,void 0,(function*(){return new Promise(((i,r)=>{const a=new Image;a.crossOrigin="anonymous",t.signal.addEventListener("abort",(()=>{a.src="",r(new Error("[MapsGL] Image request was aborted"))})),a.addEventListener("load",(()=>{i({response:null,data:a})})),a.addEventListener("error",(()=>{t.signal.aborted||r(new Error(`[MapsGL] Failed to load image - url: ${e.url}`))})),a.src=e.url}))})),Md=()=>{for(let e=bd;e<12;e++){const e=xd.shift();if(e){if(e.abortController.signal.aborted){bd-=1;continue}_d(e)}}};var Td=i(1379);const Ed=class{get size(){return{width:this.image.width,height:this.image.height}}constructor(e={}){this.iconPositions={},this.includesSDFImages=!1,this._dirty=!1,this.id=Math.round(1e18*Math.random()).toString(36).slice(0,10),this.update(e)}update(e){const t={},i=[];this._addImages(e,i,t),i.forEach((e=>{e.w+=2,e.h+=2}));const{w:r,h:a}=function(e){let t=0,i=0;for(const r of e)t+=r.w*r.h,i=Math.max(i,r.w);e.sort(((e,t)=>t.h-e.h));const r=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),i),h:1/0}];let a=0,s=0;for(const t of e)for(let e=r.length-1;e>=0;e--){const i=r[e];if(!(t.w>i.w||t.h>i.h)){if(t.x=i.x,t.y=i.y,s=Math.max(s,t.y+t.h),a=Math.max(a,t.x+t.w),t.w===i.w&&t.h===i.h){const t=r.pop();e<r.length&&(r[e]=t)}else t.h===i.h?(i.x+=t.w,i.w-=t.w):t.w===i.w?(i.y+=t.h,i.h-=t.h):(r.push({x:i.x+t.w,y:i.y,w:i.w-t.w,h:t.h}),i.y+=t.h,i.h-=t.h);break}}return{w:a,h:s,fill:t/(a*s)||0}}(i),s=(0,Td.mF)({width:r,height:a},4);Object.keys(e).forEach((i=>{const r=e[i],a=t[i],n={data:r.data,width:r.size.width,height:r.size.height},o=a.x+1,l=a.y+1,h=a.w-2,c=a.h-2;(0,Td.L1)(n,s,0,0,o,l,{width:h,height:c}),r.pattern&&((0,Td.L1)(n,s,0,c-1,o,l-1,{width:h,height:1}),(0,Td.L1)(n,s,0,0,o,l+c,{width:h,height:1}),(0,Td.L1)(n,s,h-1,0,o-1,l,{width:1,height:c}),(0,Td.L1)(n,s,0,0,o+h,l,{width:1,height:c}))})),this.image=s,this.iconPositions=Object.keys(t).reduce(((e,i)=>{const r=t[i];return e[i]={x:r.x+1,y:r.y+1,w:r.w-2,h:r.h-2},e}),{})}texturePosition(e){const t=this.iconPositions[e];if(t)return{x:t.x/this.image.width,y:t.y/this.image.height,w:t.w/this.image.width,h:t.h/this.image.height}}prepareTexture(e){this.image&&(this.texture?this._dirty&&(this._dirty=!1):this.texture=new ei(e,{image:this.image.data,size:this.size,premultiplyAlpha:!0}))}patchUpdatedImages(e){Object.keys(e.updatedImages).forEach((t=>{this.updateImage(t,e.getImage(t))}))}updateImage(e,t){const i=this.iconPositions[e];this.texture&&i&&(this.texture.updateImage(t.data,i.x+1,i.y+1,i.w-2,i.h-2),this._dirty=!0)}_addImages(e,t,i){Object.keys(e).forEach((r=>{const a=e[r],s={x:0,y:0,w:a.stretchX||a.size.width,h:a.stretchY||a.size.height};!0===a.sdf&&(this.includesSDFImages=!0),t.push(s),i[r]=s,this._dirty=!0}))}},Sd=class{get texture(){var e;return null===(e=this._atlas)||void 0===e?void 0:e.texture}get updatedImages(){return this._updatedImages}constructor(){this.images={},this._dirty=!1,this._updatedImages={},this._requests={},this._renderCallbacks=[],this._atlas=new Ed}getImage(e){return this.images[e]}getImages(e){return this._getImages(e)}addImage(e,t){if(this.images[e])throw new Error(`[MapsGL] Image with id '${e}' already exists, use updateImage instead.`);(0,ue.vA)((0,pe.Z)(e),"[MapsGL] Image 'id' was not provided."),(0,ue.vA)((0,R.n)(t.data),"[MapsGL] Image 'data' was not provided."),t.version=t.version||1,this.images[e]=t;const i=t.renderer;i&&(i.initialize&&i.initialize(t.data,t.size),i.draw&&this._renderCallbacks.push(e)),this._atlas.update(this.images),this._dirty=!0}updateImage(e,t){const i=this.images[e];if(i.size.width!==t.size.width||i.size.height!==t.size.height)throw new Error(`[MapsGL] Cannot update image with id '${e}', dimensions do not match.`);t.version=i.version+1,this.images[e]=t,this._updatedImages[e]=!0,this._dirty=!0}removeImage(e){var t;const i=this.images[e];delete this.images[e],(null===(t=i.renderer)||void 0===t?void 0:t.dispose)&&i.renderer.dispose()}loadSprite(e,t){return i=this,a=function*(){let i,r;const a=new AbortController,s=[ud({url:t}),wd({url:t.replace(".json",".png")},a)];return Promise.all(s).then((a=>{let[s,n]=a;if(!(null==n?void 0:n.data)||!(null==s?void 0:s.data))throw new Error(`[MapsGL] Failed to load sprite from '${t}'.`);i=s.data,r=n.data;const o=Ce({width:n.data.width,height:n.data.height}).getContext("2d",{willReadFrequently:!0});o.drawImage(r,0,0),Object.keys(i).forEach((t=>{const{x:r,y:a,width:s,height:n,pixelRatio:l}=i[t],h=`${e}:${t}`.replace(/-sdf$/,""),c=t.endsWith("-sdf"),d=t.endsWith("-pattern");this.getImage(h)?this.updateImage(h,{data:o.getImageData(r,a,s,n).data,size:{width:s,height:n},sdf:c,pattern:d,pixelRatio:l}):this.addImage(h,{data:o.getImageData(r,a,s,n).data,size:{width:s,height:n},sdf:c,pattern:d,pixelRatio:l})}))}))},new((r=void 0)||(r=Promise))((function(e,t){function s(e){try{o(a.next(e))}catch(e){t(e)}}function n(e){try{o(a.throw(e))}catch(e){t(e)}}function o(t){var i;t.done?e(t.value):(i=t.value,i instanceof r?i:new r((function(e){e(i)}))).then(s,n)}o((a=a.apply(i,[])).next())}));var i,r,a}loadImages(e){return new Promise(((t,i)=>{const r=e.map((e=>{let{id:t,url:i,pixelRatio:r=1,sdf:a=!1,pattern:s=!1}=e;return this.getImage(t)?Promise.resolve():this._requests[i]?this._requests[i].task:this.loadImage(t,i,{sdf:a,pattern:s,pixelRatio:r})}));Promise.all(r).then((()=>{t()})).catch(i)}))}loadImage(e,t,i){if(this._requests[t])return this._requests[t].task;(0,ue.vA)((0,pe.Z)(t),`[MapsGL] Image 'url' was not provided for '${e}'.`),(0,ue.vA)((0,pe.Z)(e),`[MapsGL] Image 'id' was not provided for '${t}'.`);const r=new AbortController,a=wd({url:t},r).then((e=>(delete this._requests[t],e.data))).then((t=>{const r=Ce({width:t.width,height:t.height}).getContext("2d");return r.drawImage(t,0,0),this.addImage(e,Object.assign(Object.assign({},i),{data:r.getImageData(0,0,t.width,t.height).data,size:{width:t.width,height:t.height}})),this.getImage(e)}));return this._requests[t]={task:a,abortController:r},a}prepare(e){var t;null===(t=this._atlas)||void 0===t||t.prepareTexture(e)}createAtlas(e){const t=new Ed;return t.update(this._getImages(e)),t}triggerFrame(){this._renderCallbacks.forEach((e=>{var t;const i=this.getImage(e);if((null===(t=null==i?void 0:i.renderer)||void 0===t?void 0:t.draw)&&!0===i.used){const t=i.renderer.draw(i.data,i.size);t instanceof Uint8ClampedArray?(i.data=t,this.updateImage(e,i)):delete this._updatedImages[e]}}))}triggerImageUpdates(){Object.keys(this._updatedImages).forEach((e=>{const t=this.getImage(e);t&&this._atlas.updateImage(e,t)})),this._updatedImages={}}_getImages(e){var t;const i={},r=(null===(t=this._atlas)||void 0===t?void 0:t.size)||{width:1,height:1};return e.forEach((e=>{var t;const a=this.images[e];if(a){const s=null===(t=this._atlas)||void 0===t?void 0:t.iconPositions[e];i[e]={data:a.data,size:a.size,pixelRatio:a.pixelRatio,sdf:a.sdf,pattern:a.pattern,position:{x:s.x/r.width,y:s.y/r.height,w:s.w/r.width,h:s.h/r.height},stretchX:a.stretchX,stretchY:a.stretchY,version:a.version},a.used=!0}else(0,X.mc)(`[MapsGL] Image with id '${e}' not found. Make sure the image has been added with controller.style.addImage().`)})),i}},Cd=class{constructor(e){this.glyphManager=new vd({url:e.fontUrl}),this.imageManager=new Sd}getGlyphs(e){return this.glyphManager.loadGlyphs(e).then((()=>this.getFonts()))}getFonts(){const e=this.glyphManager.glyphs;return Object.keys(this.glyphManager.glyphs).reduce(((t,i)=>(t[i]={ranges:e[i].ranges},t)),Object.create(null))}getFontTextures(e){return this.glyphManager.getAtlasTextures(e)}loadSprite(e,t){return this.imageManager.loadSprite(e,t)}loadImages(e){return this.imageManager.loadImages(e)}loadImage(e,t,i){return this.imageManager.loadImage(e,t,i)}getImages(e){return Promise.resolve(this.imageManager.getImages(e))}getImage(e){return this.imageManager.getImage(e)}addImage(e,t){this.getImage(e)||this.imageManager.addImage(e,t)}updateImage(e,t){this.imageManager.updateImage(e,t)}removeImage(e){this.getImage(e)&&this.imageManager.removeImage(e)}createImageAtlas(e){return this.imageManager.createAtlas(e)}};class Od{constructor(e,t){this.origin=e.clone(),this.direction=t.clone().normalize()}at(e){return this.origin.clone().add(this.direction.clone().scale(e))}intersectSphere(e,t){const i=this.direction,r=this.origin.clone().subtract(e),a=i.x*i.x+i.y*i.y+i.z*i.z,s=2*(r.x*i.x+r.y*i.y+r.z*i.z),n=s*s-4*a*(r.x*r.x+r.y*r.y+r.z*r.z-t*t);if(n<0)return null;const o=Math.sqrt(n),l=(-s-o)/(2*a),h=(-s+o)/(2*a),c=Math.min(l,h),d=Math.max(l,h);return{tMin:r.clone().add(i.clone().scale(c)),tMax:r.clone().add(i.clone().scale(d))}}intersectPlane(e,t){const i=t.dot(this.direction);if(Math.abs(i)<1e-6)return null;const r=e.clone().subtract(this.origin).dot(t)/i;return r>=0?r:null}closestPointOnSphere(e,t){const i=this.intersectSphere(e,t);if(i)return i.tMin;const r=e.clone().subtract(this.origin),a=this.direction.dot(r),s=this.at(a).clone().subtract(e).normalize();return e.clone().add(s.scale(t))}}const Rd=class{constructor(){this._transform=(new Ai.A).identity(),this._orientation=new Ko.A}get position(){const e=this._transform.getColumn(3);return new Ve.A(e.x,e.y,e.z)}set position(e){e&&this._transform.setColumn(3,new Ne.A(e.x,e.y,e.z,1))}get orientation(){return this._orientation}set orientation(e){this._orientation=e||new Ko.A;const t=this._transform.getColumn(3);this._transform.fromQuaternion(this._orientation),this._transform.setColumn(3,t)}get forward(){const e=this._transform.getColumn(2);return new Ve.A(-e.x,-e.y,-e.z)}get right(){const e=this._transform.getColumn(0);return new Ve.A(e.x,e.y,e.z)}get up(){const e=this._transform.getColumn(1);return new Ve.A(-e.x,-e.y,-e.z)}setPitchBearing(e,t){const i=this.calculateCameraOrientation(-t,e);this.orientation=i}worldToCameraMatrix(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const i=this.orientation.clone();i.conjugate();const r=this.position.clone();r.scale(-e);const a=(new Ai.A).fromQuaternion(i).translate(r);return a.value[1]*=-1,a.value[5]*=-1,a.value[9]*=-1,a.value[13]*=-1,a.value[8]*=t,a.value[9]*=t,a.value[10]*=t,a.value[11]*=t,a}calculateCameraOrientation(e,t){const i=(new Ko.A).fromArray([0,0,0,1]);return i.rotateX((0,ke.p)(-t)),i.rotateZ((0,ke.p)(-e)),i}},Id=180*Math.atan(3/4)/Math.PI,Pd=class{get projection(){return this._projection}get point(){return this.projection.project(this.state.center.lat,this.state.center.lon)}get zoomScale(){return Tt(this.state.zoom)}get pixelsPerMeter(){return this.projection.pixelsPerMeter(this.state.center.lat,this.worldSize)}get worldSize(){return Et(this.state.zoom,this.tileSize)}get isGlobe(){return this.projection.type===Ue}get globiness(){return this.isGlobe?1-this.globeToMercatorTransition(this.state.zoom):0}get circleRadiusCorrection(){if(this.isGlobe){if("maplibre"===this.state.id)return Math.cos((0,ke.p)(this.state.center.lat));const e=this.projection.pixelSpaceConversion(this.state.center.lat,this.worldSize,0);return e*(this.pixelsPerMercatorPixelRatio/e)}return 1}constructor(e,t){this.tileSize=Mt,this.worldSizeScale=1,this.nearZ=1,this.farZ=1e21,this.cutoffParams=[0,0,0,0],this.clippingPlane=new Ne.A,this.globeMatrix=new Ai.A,this.mercatorMatrix=new Ai.A,this.pixelsPerMercatorPixelRatio=1,this.projGlobeMatrix=new Ai.A,this.worldToCameraMatrix=new Ai.A,this.cameraToWorldMatrix=new Ai.A,this.updateOnMapViewChange=!0,this.projectionMatrix=new Ai.A,this.scene=t,this.camera=new Rd,this.setProjection(e)}setProjection(e){((0,R.g)(this._projection)||this.projection.type!==e)&&(this._projection=e===Ue?new Ci:new gt,(0,pe.Z)(this.state)&&this.update(this.state))}update(e){var t,i,r,a;this.state=Object.assign(Object.assign(Object.assign({},this.state),e),{elevation:0});const s=Object.freeze(this.state),n=this.scene.camera,{width:o,height:l}=s.size,h=s.center,c=s.zoom,d=s.pitch,u=s.bearing,p=this.globeToMercatorTransition(c),f=s.fov?(x=(0,ke.p)(s.fov),.5/Math.tan(.5*(0,ke.p)(x))):1.5,m=s.fov?(0,ke.p)(s.fov):(e=>(0,ke.H)(2*Math.atan(.5/e)))(f),g=m/2,v=Math.cos(Math.PI/2-s.pitch),y=l/50;var x;let b=.5*l/Math.tan(g);if("mapbox"===this.state.id){const e=function(e,t,i,r){const a=e.range;if(!a)return 0;const s=Math.min(arguments.length>4&&void 0!==arguments[4]?arguments[4]:Number.POSITIVE_INFINITY,Math.max(i,r)),n=Math.log2(s/1024);return Il(a[0]+n,a[1]+n,t)}(this.projection,c,o,l,1024),t=p<1?this.projection.pixelSpaceConversion(h.lat,this.worldSize,e):1;b*=t,this.pixelsPerMercatorPixelRatio=t}this.cameraToCenterDistance=b,this.updateCameraState();const{nearZ:w,farZ:_}=this.calculateNearFarZ(b,v,new _i(0,0)),A=null!==(t=s.nearZMultiplier)&&void 0!==t?t:.5,M=null!==(i=s.farZMultiplier)&&void 0!==i?i:1,T=null!==(r=s.nearZ)&&void 0!==r?r:w,E=null!==(a=s.farZ)&&void 0!==a?a:_;this.nearZ=null!=T?T:Math.max(y*v,y)*A,this.farZ=null!=E?E:1e21*M,this.worldToCameraMatrix=this.calculateWorldToCameraMatrix(),this.cameraToWorldMatrix=(new Ai.A).inverse(this.worldToCameraMatrix);const S=this.worldSize,C=this.projection.project(h.lat,h.lon),O=(Math.pow(2,c),C.x*S),R=C.y*S;this.projectionMatrix=n instanceof zh?(new Ts).orthographic(-o/2,o/2,l/2,-l/2,T,E):(new Ts).perspective(m,o/l,T,E),n.projectionMatrix.copy(this.projectionMatrix);const I=(new Ai.A).fromTranslation(new Ve.A(0,0,this.cameraToCenterDistance)),P=(new Ai.A).premultiply(I).premultiply((new Ai.A).fromRotationX((0,ke.p)(d))).premultiply((new Ai.A).fromRotationZ(-(0,ke.p)(u)));n.worldMatrix.copy(P),n.updateMatrixWorld();const D=(new Ai.A).fromRotationZ(Math.PI),z=(new Ai.A).fromScale(new Ve.A(-S,S,1)),L=(new Ai.A).fromTranslation(new Ve.A(-O,R,0));this.scene.scene.worldMatrix=(new Ts).premultiply(D).premultiply(z).premultiply(L),this.updateMatrices()}getClipSpaceToPixelsMatrix(e,t,i){if(e){const e=new Ai.A;return t||e.rotateZ((0,ke.p)(this.state.bearing)),e.scale(new Ve.A(1/i,1/i,1)),e}return this.clipSpaceToPixelsMatrix}getPixelsToClipSpaceMatrix(e,t,i){if(e){const e=new Ai.A;return t||e.rotateZ(-(0,ke.p)(this.state.bearing)),e.scale(new Ve.A(i,i,1)),e}return this.pixelsToClipSpaceMatrix}locationToPoint(e){if(this.projection.type===Be){const t=this.projection.project(e.lat,e.lon),i=this.worldSize,r=new Ne.A(t.x*i,t.y*i,0,1).clone().applyMatrix4(this.projMatrix);r.divideScalar(r.w);const a=r.clone().applyMatrix4(this.clipSpaceToPixelsMatrix);return{x:a.x,y:a.y,z:0}}const t=(0,ke.p)(e.lat),i=(0,ke.p)(e.lon),r=Pi(t,i),a=new Ne.A(r.x,r.y,r.z,1);return a.applyMatrix4(this.globeMatrix),a.applyMatrix4(this.projGlobeMatrix),a.x/=a.w,a.y/=a.w,{x:(.5*a.x+.5)*this.state.size.width,y:(.5*-a.y+.5)*this.state.size.height,z:0}}pointToLocation(e){if(this.projection.type===Be){const t=0,i=new Ne.A(e.x,e.y,0,1),r=new Ne.A(e.x,e.y,1,1);i.applyMatrix4(this.pixelsToWorldMatrix),r.applyMatrix4(this.pixelsToWorldMatrix);const a=i.w,s=r.w,n=i.y/a,o=r.y/s,l=i.z/a,h=r.z/s,c=l===h?0:(t-l)/(h-l),d=(0,ui.C)(i.x/a,r.x/s,c)/this.worldSize,u=(0,ui.C)(n,o,c)/this.worldSize,p=this.projection.unproject(d,u);return Math.abs(p.lat)>ct?null:p}const t=this.camera.position.clone().scale(this.worldSize),i=this.getRayDirectionFromPixel(e),r=this.rayPlanetIntersection(t,i);if(r){const e=this.globeMatrix,t=e.getColumn(0),i=e.getColumn(1),a=e.getColumn(2),s=new Ve.A(t.x,t.y,t.z).normalize(),n=new Ve.A(i.x,i.y,i.z).normalize(),o=new Ve.A(a.x,a.y,a.z).normalize(),l=r.clone().dot(s),h=r.clone().dot(n),c=r.clone().dot(o),d=this.getGlobeRadiusPixels(this.worldSize,this.state.center.lat),u=(0,ke.H)(Math.asin(-h/d)),p=(0,ke.H)(Math.atan2(l,c));return Number.isNaN(u)||Number.isNaN(p)?null:{lat:u,lon:p}}return null}locationToCoordinate(e){return At.fromCoordinate(e)}coordinateToLocation(e){return e.toCoordinate()}getPerspectiveRatio(e,t){return.5+e/t*.5}updateCameraState(){var e,t;if(this.camera.position=null!==(t=null===(e=this.state.cameraPosition)||void 0===e?void 0:e.clone())&&void 0!==t?t:new Ve.A,"mapbox"!==this.state.id){const e=Et(this.state.zoom,Mt),t=this.projection.pixelsPerMeter(this.state.center.lat,e);this.camera.position=this.calculateCameraPosition(t)}const i=function(e,t){const i=(new Ko.A).fromArray([0,0,0,1]);return i.rotateZ((0,ke.p)(-e)),i.rotateX((0,ke.p)(-t)),i}(-this.state.bearing,this.state.pitch);this.camera.orientation=i}calculateCameraPosition(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.pixelsPerMeter;const t=this.state.zoom,i=this.projection.project(this.state.center.lat,this.state.center.lon),r=e/this.pixelsPerMeter,a=((e,t)=>this.cameraToCenterDistance/Et(e))(t)*r,s=a-e/this.worldSize*0,n=this.camera.orientation,o=new Ve.A(0,0,-1).applyQuaternion(n).normalize();return new Ve.A(i.x,i.y,0).clone().subtract(o.clone().scale(s))}getCameraAltitude(){return Math.cos((0,ke.p)(this.state.pitch))*this.cameraToCenterDistance/this.pixelsPerMeter+this.state.elevation}calculateWorldToCameraMatrix(){return this.camera.worldToCameraMatrix(this.worldSize,"meters"===this.projection.zAxisUnit?this.pixelsPerMeter:1).clone()}calculateNearFarZ(e,t,i){const{width:r,height:a}=this.state.size,{pitch:s,fov:n,elevation:o}=this.state,l=Math.min(o,0,this.getCameraAltitude()-100),h=e-l*this.pixelsPerMeter/Math.cos(t),c=l<0?h:e,d=Math.PI/2+(0,ke.p)(s),u=(0,ke.p)(n)*(Math.abs(Math.cos((0,ke.p)(0)))*a+Math.abs(Math.sin((0,ke.p)(0)))*r)/a*(.5+i.y/a),p=Math.sin(u)*c/Math.sin((0,Le.q)(Math.PI-d-u,.01,Math.PI-.01)),f=function(e,t){return t*Math.min(.85*Math.tan((0,ke.p)(90-e)),Math.tan((0,ke.p)(89.25-e)))}(s,this.cameraToCenterDistance),m=Math.atan(f/this.cameraToCenterDistance),g=(0,ke.p)(.75),v=m>g?2*m*(.5+i.y/(2*f)):g,y=Math.sin(v)*c/Math.sin((0,Le.q)(Math.PI-d-v,.01,Math.PI-.01)),x=Math.min(p,y);return{nearZ:a/50,farZ:1.01*(Math.cos(Math.PI/2-t)*x+c)}}calculateTilePos(e){const t=e.normalize(),i=this.tileSize*this.zoomScale/Tt(e.z),r=t.x+Math.pow(2,e.z)*e.wrap,a=new Ve.A(r*i,e.y*i,0),s=new Ve.A(i/it,i/it,1),n=this.projMatrix.clone();return n.translate(a),n.scale(s),{translation:a,scale:s,matrix:n}}globeToMercatorTransition(){return void 0!==this.state.globiness?this.state.globiness:Il(5,6,arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state.zoom)}getGlobeRadiusPixels(e,t){return Mi(this.state.id,e,t)}calculateGlobeCameraUp(){if(this.globeToMercatorTransition(this.state.zoom)>=1)return new Ve.A(0,1,0);const e=this.worldToCameraMatrix.clone().clone().multiply(this.globeMatrix).invert(),t=new Ne.A(0,1,0,0).applyMatrix4(e);return new Ve.A(t.x,t.y,t.z).normalize()}updateMatrices(){const{width:e,height:t}=this.state.size,i=this.state.center,r=this.state.zoom,a=this.state.bearing,s=this.state.pitch,n=(this.projection.project(i.lat,i.lon),this.isGlobe),o=this.globeToMercatorTransition(r),l=this.worldSize,h=.7*this.projection.pixelsPerMeter(i.lat,l);let c;this.mercatorCoordToClipSpaceMatrix=(new Ai.A).scale(new Ve.A(l,l,l/h)),this.pixelsToGLUnits=[2/e,-2/t],c=new Ai.A,c.scale(new Ve.A(e/2,-t/2,1)),c.translate(new Ve.A(1,-1,0)),this.clipSpaceToPixelsMatrix=c.clone(),c=new Ai.A,c.scale(new Ve.A(1,-1,1)),c.translate(new Ve.A(-1,-1,0)),c.scale(new Ve.A(2/e,2/t,1)),this.pixelsToClipSpaceMatrix=c.clone(),c=this.projectionMatrix.clone(),c.scale(new Ve.A(1,-1,1)),c.translate(new Ve.A(0,0,-this.cameraToCenterDistance)),c.rotateX((0,ke.p)(s)),c.rotateZ((0,ke.p)(-a));const d=function(e,t){return(180+e)/360*((arguments.length>2&&void 0!==arguments[2]?arguments[2]:Mt)*Tt(t))}(i.lon,r,this.tileSize),u=function(e,t){const i=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:Mt)*Tt(t);return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360*i}(i.lat,r,this.tileSize),p=l/(2*Math.PI*6378137*Math.abs(Math.cos((0,ke.p)(i.lat)))),f=this.getGlobeRadiusPixels(l,i.lat),m=Ti(this.state.id,l,i.lat);this.clippingPlane=this.computeClippingPlane(f);const g=this.worldToCameraMatrix.clone(),v=this.projectionMatrix.clone(),y=new _i(0,0);v.value[8]=2*-y.x/e,v.value[9]=2*y.y/t;const x=(new Ai.A).multiply(v,this.worldToCameraMatrix);if(this.mercatorMatrix=function(e){const t=e.projection.pixelsPerMeter(e.projection.type!==Ue||e.state.zoom>=6?e.state.center.lat:0,e.worldSize),i=t/mt(1,e.state.center.lat),r=e.point;r.x*=e.worldSize,r.y*=e.worldSize;const a=new Ai.A;return a.translate(new Ve.A(r.x,r.y,0)),a.scale(new Ve.A(i,i,t)),a}(this),n){this.globeMatrix=function(e,t,i,r,a){const s=Ti(e,r,a.lat),n="maplibre"===e?Mi(e,r,a.lat):r/(2*Math.PI),o=new Ve.A(t,i,-n),l=new Ai.A;return l.translate(o),l.scaleScalar(s),l.rotateX((0,ke.p)(-a.lat)),l.rotateY((0,ke.p)(-a.lon)),l}(this.state.id,d,u,l,i);const e=c.clone();e.scaleScalar(m),e.rotateX((0,ke.p)(-i.lat)),e.rotateY((0,ke.p)(-i.lon));const t=c.clone();t.translate(new Ve.A(-d,-u,0)),t.scale(new Ve.A(1,1,p)),c=0===o?e.clone():1===o?t.clone():(0,ka.Jx)(e,t,o),this.projGlobeMatrix=(new Ai.A).multiply(v,g),this.worldToPixelsMatrix=x.clone().premultiply(this.clipSpaceToPixelsMatrix)}else c.translate(new Ve.A(-d,-u,0)),c.scale(new Ve.A(1,1,p)),this.projGlobeMatrix=(new Ai.A).multiply(v,g),this.worldToPixelsMatrix=x.clone().premultiply(this.clipSpaceToPixelsMatrix);this.projMatrix=c.clone(),this.pixelsToWorldMatrix=this.worldToPixelsMatrix.clone().invert()}getRayDirectionFromPixel(e){const t=this.camera.position.clone().scale(this.worldSize),i=new Ne.A(e.x,e.y,1,1);return i.applyMatrix4(this.pixelsToWorldMatrix),i.scale(1/i.w),new Ve.A(i.x,i.y,i.z).subtract(t).normalize()}rayPlanetIntersection(e,t){const i=this.globeMatrix.value,r=new Ve.A(i[12],i[13],i[14]),a=this.getGlobeRadiusPixels(this.worldSize,this.state.center.lat);return new Od(e,t).closestPointOnSphere(r,a)}computeClippingPlane(e){const t=(0,ke.p)(-this.state.pitch),i=this.cameraToCenterDistance/e,r=Math.sin(t)*i,a=Math.cos(t)*i+1,s=1/Math.hypot(r,a)*1;let n=-r,o=a;const l=Math.hypot(n,o);n/=l,o/=l;const h=new Ve.A(0,n,o);h.rotateZ((0,ke.p)(this.state.bearing)),h.rotateX((0,ke.p)(this.state.center.lat)),h.rotateY((0,ke.p)(this.state.center.lon));const c=1/h.length();return h.scale(c),new Ne.A(h.x,h.y,h.z,-s*c)}},Dd=class{get id(){var e;return null===(e=this.layer)||void 0===e?void 0:e.id}get layer(){return this._layer}get isMask(){return!0===/::mask/.test(this.id)}constructor(e,t){this.active=!1,this.refs=new Map,this.code=e,this.config=Object.assign({},t)}addConsumer(e,t){this.refs.set(e,{hidden:t})}removeConsumer(e){this.refs.delete(e)}addTo(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var r,a,s,n,o,l,h,c,d,u,p,f,m,g,v,y;const x=this.config,b=x.source.id,w=i.id||x.id;e.hasSource(b)||(x.source instanceof _e==0&&((null===(r=i.data)||void 0===r?void 0:r.bounds)&&(x.source.bounds=i.data.bounds),(0,R.n)(null===(a=i.data)||void 0===a?void 0:a.minZoom)&&(x.source.minZoom=i.data.minZoom),(0,R.n)(null===(s=i.data)||void 0===s?void 0:s.maxZoom)&&(x.source.maxZoom=i.data.maxZoom)),e.addSource(b,x.source)),x.layer.source=b;const _=Object.assign({},x.layer);if((0,pe.Z)(i.paint)){_.paint=(0,j.$)({},_.paint,i.paint),(0,pe.Z)(null===(o=null===(n=_.paint.sample)||void 0===n?void 0:n.colorscale)||void 0===o?void 0:o.stops)&&((0,pe.Z)(null===(c=null===(h=null===(l=null==i?void 0:i.paint)||void 0===l?void 0:l.sample)||void 0===h?void 0:h.colorscale)||void 0===c?void 0:c.stops)&&(_.paint.sample.colorscale.stops=i.paint.sample.colorscale.stops),delete _.paint.sample.colorscale.masks);const e=null===(d=i.paint.sample)||void 0===d?void 0:d.colorscale,t=null===(u=x.legend)||void 0===u?void 0:u.bar;if((0,pe.Z)(t)&&(0,pe.Z)(null==e?void 0:e.stops)){const i=Array.isArray(t)?t[0]:t;x.legend.bar=Object.assign(Object.assign({},i),{colorscale:Object.assign(Object.assign({},i.colorscale),{stops:e.stops,range:i.colorscale.range,interval:e.interval||i.colorscale.interval})})}}if(((e,t)=>{if((0,R.n)(t)){const{clamp:i,range:r,interleaved:a}=t,s=Object.assign({},e.timeSeries);i&&(s.clamp=i),r&&(s.clamp=hr.MH.range,s.range=r),"boolean"===(0,fe.N)(a)&&(s.interleaved=a),e.timeSeries=s}})(_,null==i?void 0:i.timing),_.type===tr.m.query&&Array.isArray(null===(p=_.paint)||void 0===p?void 0:p.text)&&!1===(null===(f=null==i?void 0:i.data)||void 0===f?void 0:f.cities)&&(_.paint.text=_.paint.text.slice(0,-1)),(0,pe.Z)(null===(m=x.query)||void 0===m?void 0:m.layerId)){_.queryLayer=this._setupQueryLayer(e,x.query),this._queryLayerInfo=_.queryLayer;const t=e.getWeatherElement(x.query.layerId);t&&t.addConsumer(w,x.query.hidden)}if((0,pe.Z)(null===(g=x.mask)||void 0===g?void 0:g.layerId)){let t=x.mask.layerId;if((0,pe.Z)(t)&&e.weatherProvider.isWeatherLayer(t)){t=`${t}::mask`;const e=Object.assign(Object.assign({},x.mask.overrides),null===(v=i.mask)||void 0===v?void 0:v.overrides);(null==e?void 0:e.filter)&&(t+=`-${window.btoa(JSON.stringify(e.filter))}`),x.mask.id=t}_.mask=this._setupMaskLayer(e,x.mask)}else delete _.mask;if(this.config.legend){const e=null===(y=this.config.legend)||void 0===y?void 0:y.bar,t=Array.isArray(e)?e:[e];this.legendId=this.config.legend.id,t.forEach((e=>{var t,i;(null===(i=null===(t=_.paint.sample)||void 0===t?void 0:t.colorscale)||void 0===i?void 0:i.breaks)&&e.colorscale&&(e.colorscale.breaks=_.paint.sample.colorscale.breaks)}))}return this._layer=e.addLayer(w,_,t),this.active=!0,i.hidden&&this.layer.hide(),this.layer}remove(e){var t,i,r,a;if(null===(t=this.config.query)||void 0===t?void 0:t.layerId){const t=e.getWeatherElement(this.config.query.layerId);t&&t.removeConsumer(this.id)}if((null===(i=this.refs)||void 0===i?void 0:i.size)>0){this.active=!1;let e=!0;return this.refs.forEach((t=>{!1===t.hidden&&(e=!1)})),e&&this.layer.hide(),!1}if(e.removeLayer(this.id),this._layer=null,null===(r=this._queryLayerInfo)||void 0===r?void 0:r.id){const t=e.getLayer(this._queryLayerInfo.id);t&&!0!==t.visible&&e.removeWeatherLayer(null===(a=this.config.query)||void 0===a?void 0:a.layerId)}return!0}_setupMaskLayer(e,t){const i=t.id||t.layerId;let r=e.getLayer(i);if(!r){let a=t.layerId;"water"!==a&&"land"!==a||("land"===a&&(t.invert=!0,a="water"),t.overrides=Object.assign(Object.assign({},ge.E.overrides),t.overrides));const s=e.addWeatherLayer(a,Object.assign(Object.assign({},t.overrides),{id:i}));r=Array.isArray(s)?s[0]:s}if(r)return{id:r.id,invert:t.invert}}_setupQueryLayer(e,t){var i;let r=e.getWeatherLayer(t.layerId);if(Array.isArray(r))return void console.warn(`[MapsGL] Query layer cannot use multiple layers: ${t.layerId}`);let a=e.getLayer(null==r?void 0:r.id);return a||(r=e.addWeatherLayer(t.layerId,{hidden:t.hidden},null===(i=t.overrides)||void 0===i?void 0:i.beforeId),a=Array.isArray(r)?r[0]:r),a?{id:a.id,hidden:t.hidden}:void 0}};
10
+ /*!
11
+ * MarchingSquaresJS
12
+ * version 1.3.3
13
+ * https://github.com/RaumZeit/MarchingSquares.js
14
+ *
15
+ * @license GNU Affero General Public License.
16
+ * Copyright (c) 2015-2019 Ronny Lorenz <ronny@tbi.univie.ac.at>
17
+ */function zd(e,t,i){return e<t?(i-e)/(t-e):(e-i)/(e-t)}function Ld(){this.successCallback=null,this.verbose=!1,this.polygons=!1,this.polygons_full=!1,this.linearRing=!0,this.noQuadTree=!1,this.noFrame=!1}function kd(e,t,i,r){var a=[];return e.polygons.forEach((function(e){e.forEach((function(e){e[0]+=t,e[1]+=i})),r.linearRing&&e.push(e[0]),a.push(e)})),a}function Fd(e,t,i,r){return 0===i?(e+=1,t+=r[0][1]):1===i?e+=r[0][0]:2===i?t+=r[0][1]:3===i&&(e+=r[0][0],t+=1),[e,t]}function jd(e,t,i){return 0===i?e++:1===i||(2===i?t++:3===i&&(e++,t++)),[e,t]}function Nd(e,t,i,r,a){var s=r,n=a,o=0,l=0;if(this.x=t,this.y=i,this.lowerBound=null,this.upperBound=null,this.childA=null,this.childB=null,this.childC=null,this.childD=null,1===r&&1===a)this.lowerBound=Math.min(e[i][t],e[i][t+1],e[i+1][t+1],e[i+1][t]),this.upperBound=Math.max(e[i][t],e[i][t+1],e[i+1][t+1],e[i+1][t]);else{if(r>1){for(;0!==s;)s>>=1,o++;r===1<<o-1&&o--,s=1<<o-1}if(a>1){for(;0!==n;)n>>=1,l++;a===1<<l-1&&l--,n=1<<l-1}this.childA=new Nd(e,t,i,s,n),this.lowerBound=this.childA.lowerBound,this.upperBound=this.childA.upperBound,r-s>0&&(this.childB=new Nd(e,t+s,i,r-s,n),this.lowerBound=Math.min(this.lowerBound,this.childB.lowerBound),this.upperBound=Math.max(this.upperBound,this.childB.upperBound),a-n>0&&(this.childC=new Nd(e,t+s,i+n,r-s,a-n),this.lowerBound=Math.min(this.lowerBound,this.childC.lowerBound),this.upperBound=Math.max(this.upperBound,this.childC.upperBound))),a-n>0&&(this.childD=new Nd(e,t,i+n,s,a-n),this.lowerBound=Math.min(this.lowerBound,this.childD.lowerBound),this.upperBound=Math.max(this.upperBound,this.childD.upperBound))}}function Vd(e){var t,i;if(!e)throw new Error("data is required");if(!Array.isArray(e)||!Array.isArray(e[0]))throw new Error("data must be scalar field, i.e. array of arrays");if(e.length<2)throw new Error("data must contain at least two rows");if((i=e[0].length)<2)throw new Error("data must contain at least two columns");for(t=1;t<e.length;t++){if(!Array.isArray(e[t]))throw new Error("Row "+t+" is not an array");if(e[t].length!=i)throw new Error("unequal row lengths detected, please provide a regular grid")}this.data=e,this.root=new Nd(e,0,0,e[0].length-1,e.length-1)}function Bd(e,t,i,r){var a,s,n,o,l,h,c=0,d=e[i+1][t],u=e[i+1][t+1],p=e[i][t+1],f=e[i][t],m=r.threshold;if(!(isNaN(f)||isNaN(p)||isNaN(u)||isNaN(d))){switch(c|=d>=m?8:0,c|=u>=m?4:0,c|=p>=m?2:0,h={cval:c=+(c|=f>=m?1:0),polygons:[],edges:{},x0:f,x1:p,x2:u,x3:d},c){case 0:r.polygons&&h.polygons.push([[0,0],[0,1],[1,1],[1,0]]);break;case 15:break;case 14:a=r.interpolate(f,d,m),o=r.interpolate(f,p,m),r.polygons_full&&(h.edges.left={path:[[0,a],[o,0]],move:{x:0,y:-1,enter:"top"}}),r.polygons&&h.polygons.push([[0,0],[0,a],[o,0]]);break;case 13:o=r.interpolate(f,p,m),s=r.interpolate(p,u,m),r.polygons_full&&(h.edges.bottom={path:[[o,0],[1,s]],move:{x:1,y:0,enter:"left"}}),r.polygons&&h.polygons.push([[o,0],[1,s],[1,0]]);break;case 11:s=r.interpolate(p,u,m),n=r.interpolate(d,u,m),r.polygons_full&&(h.edges.right={path:[[1,s],[n,1]],move:{x:0,y:1,enter:"bottom"}}),r.polygons&&h.polygons.push([[1,s],[n,1],[1,1]]);break;case 7:a=r.interpolate(f,d,m),n=r.interpolate(d,u,m),r.polygons_full&&(h.edges.top={path:[[n,1],[0,a]],move:{x:-1,y:0,enter:"right"}}),r.polygons&&h.polygons.push([[n,1],[0,a],[0,1]]);break;case 1:a=r.interpolate(f,d,m),o=r.interpolate(f,p,m),r.polygons_full&&(h.edges.bottom={path:[[o,0],[0,a]],move:{x:-1,y:0,enter:"right"}}),r.polygons&&h.polygons.push([[o,0],[0,a],[0,1],[1,1],[1,0]]);break;case 2:o=r.interpolate(f,p,m),s=r.interpolate(p,u,m),r.polygons_full&&(h.edges.right={path:[[1,s],[o,0]],move:{x:0,y:-1,enter:"top"}}),r.polygons&&h.polygons.push([[0,0],[0,1],[1,1],[1,s],[o,0]]);break;case 4:s=r.interpolate(p,u,m),n=r.interpolate(d,u,m),r.polygons_full&&(h.edges.top={path:[[n,1],[1,s]],move:{x:1,y:0,enter:"left"}}),r.polygons&&h.polygons.push([[0,0],[0,1],[n,1],[1,s],[1,0]]);break;case 8:a=r.interpolate(f,d,m),n=r.interpolate(d,u,m),r.polygons_full&&(h.edges.left={path:[[0,a],[n,1]],move:{x:0,y:1,enter:"bottom"}}),r.polygons&&h.polygons.push([[0,0],[0,a],[n,1],[1,1],[1,0]]);break;case 12:a=r.interpolate(f,d,m),s=r.interpolate(p,u,m),r.polygons_full&&(h.edges.left={path:[[0,a],[1,s]],move:{x:1,y:0,enter:"left"}}),r.polygons&&h.polygons.push([[0,0],[0,a],[1,s],[1,0]]);break;case 9:o=r.interpolate(f,p,m),n=r.interpolate(d,u,m),r.polygons_full&&(h.edges.bottom={path:[[o,0],[n,1]],move:{x:0,y:1,enter:"bottom"}}),r.polygons&&h.polygons.push([[o,0],[n,1],[1,1],[1,0]]);break;case 3:a=r.interpolate(f,d,m),s=r.interpolate(p,u,m),r.polygons_full&&(h.edges.right={path:[[1,s],[0,a]],move:{x:-1,y:0,enter:"right"}}),r.polygons&&h.polygons.push([[0,a],[0,1],[1,1],[1,s]]);break;case 6:o=r.interpolate(f,p,m),n=r.interpolate(d,u,m),r.polygons_full&&(h.edges.top={path:[[n,1],[o,0]],move:{x:0,y:-1,enter:"top"}}),r.polygons&&h.polygons.push([[0,0],[0,1],[n,1],[o,0]]);break;case 10:a=r.interpolate(f,d,m),s=r.interpolate(p,u,m),o=r.interpolate(f,p,m),n=r.interpolate(d,u,m),l=(f+p+u+d)/4,r.polygons_full&&(l<m?(h.edges.left={path:[[0,a],[n,1]],move:{x:0,y:1,enter:"bottom"}},h.edges.right={path:[[1,s],[o,0]],move:{x:0,y:-1,enter:"top"}}):(h.edges.right={path:[[1,s],[n,1]],move:{x:0,y:1,enter:"bottom"}},h.edges.left={path:[[0,a],[o,0]],move:{x:0,y:-1,enter:"top"}})),r.polygons&&(l<m?h.polygons.push([[0,0],[0,a],[n,1],[1,1],[1,s],[o,0]]):(h.polygons.push([[0,0],[0,a],[o,0]]),h.polygons.push([[n,1],[1,1],[1,s]])));break;case 5:a=r.interpolate(f,d,m),s=r.interpolate(p,u,m),o=r.interpolate(f,p,m),n=r.interpolate(d,u,m),l=(f+p+u+d)/4,r.polygons_full&&(l<m?(h.edges.bottom={path:[[o,0],[0,a]],move:{x:-1,y:0,enter:"right"}},h.edges.top={path:[[n,1],[1,s]],move:{x:1,y:0,enter:"left"}}):(h.edges.top={path:[[n,1],[0,a]],move:{x:-1,y:0,enter:"right"}},h.edges.bottom={path:[[o,0],[1,s]],move:{x:1,y:0,enter:"left"}})),r.polygons&&(l<m?h.polygons.push([[0,a],[0,1],[n,1],[1,s],[1,0],[o,0]]):(h.polygons.push([[0,a],[0,1],[n,1]]),h.polygons.push([[o,0],[1,s],[1,0]])))}return h}}function Ud(e,t,i){const r=e.getTime()/864e5+2440587.5-2451545,a=(357.529+.98560028*r)%360,s=((280.459+.98564736*r)%360+1.915*Math.sin((0,ke.p)(a))+.02*Math.sin(2*(0,ke.p)(a)))%360,n=23.439-36e-8*r,o=(0,ke.H)(Math.atan2(Math.cos((0,ke.p)(n))*Math.sin((0,ke.p)(s)),Math.cos((0,ke.p)(s)))),l=(0,ke.H)(Math.asin(Math.sin((0,ke.p)(n))*Math.sin((0,ke.p)(s)))),h=((100.46+.985647*r+i+15*(e.getUTCHours()+e.getUTCMinutes()/60+e.getUTCSeconds()/3600))%360-o+360)%360;return(0,ke.H)(Math.asin(Math.sin((0,ke.p)(t))*Math.sin((0,ke.p)(l))+Math.cos((0,ke.p)(t))*Math.cos((0,ke.p)(l))*Math.cos((0,ke.p)(h))))}function $d(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;const r=[];return function(e,t,i){var r,a,s,n=!1,o=!1,l=null,h=null,c=null,d=null,u=null,p=[];if(!e)throw new Error("data is required");if(null==t)throw new Error("threshold is required");if(i&&"object"!=typeof i)throw new Error("options must be an object");if(r=function(e){var t,i,r,a,s;for(a=new Ld,e=e||{},s=Object.keys(a),t=0;t<s.length;t++)null!=(r=e[i=s[t]])&&(a[i]=r);return a.polygons_full=!a.polygons,a.interpolate=zd,a}(i),e instanceof Vd)l=e,h=e.root,c=e.data,r.noQuadTree||(n=!0);else{if(!Array.isArray(e)||!Array.isArray(e[0]))throw new Error("input is neither array of arrays nor object retrieved from 'QuadTree()'");c=e}if(Array.isArray(t)){for(o=!0,r.noQuadTree||(n=!0),a=0;a<t.length;a++)if(isNaN(+t[a]))throw new Error("threshold["+a+"] is not a number")}else{if(isNaN(+t))throw new Error("threshold must be a number or array of numbers");t=[t]}n&&!h&&(l=new Vd(c),h=l.root,c=l.data),t.forEach((function(e,t){if(u=[],r.threshold=e,r.polygons)if(n)h.cellsBelowThreshold(r.threshold,!0).forEach((function(e){u=u.concat(kd(Bd(c,e.x,e.y,r),e.x,e.y,r))}));else for(s=0;s<c.length-1;++s)for(t=0;t<c[0].length-1;++t)u=u.concat(kd(Bd(c,t,s,r),t,s,r));else{for(d=[],t=0;t<c[0].length-1;++t)d[t]=[];if(n)h.cellsBelowThreshold(r.threshold,!1).forEach((function(e){d[e.x][e.y]=Bd(c,e.x,e.y,r)}));else for(t=0;t<c[0].length-1;++t)for(s=0;s<c.length-1;++s)d[t][s]=Bd(c,t,s,r);u=function(e,t,i){var r,a,s,n,o,l,h,c,d,u,p,f,m,g,v,y=[],x=e.length-1,b=e[0].length-1,w=["right","bottom","left","top"],_=[0,-1,0,1],A=[-1,0,1,0],M={bottom:1,left:2,top:3,right:0};return i.noFrame||function(e,t){var i,r,a,s,n;for(i=!0,r=e[0].length,a=e.length,n=0;n<a;n++)if(e[n][0]>=t||e[n][r-1]>=t){i=!1;break}if(i&&(e[a-1][0]>=t||e[a-1][r-1]>=t)&&(i=!1),i)for(s=0;s<r-1;s++)if(e[0][s]>=t||e[a-1][s]>t){i=!1;break}return i}(e,i.threshold)&&y.push(i.linearRing?[[0,0],[0,x],[b,x],[b,0],[0,0]]:[[0,0],[0,x],[b,x],[b,0]]),t.forEach((function(e,T){e.forEach((function(e,E){for(r=null,a=0;a<4;a++)if("object"==typeof e.edges[r=w[a]]){for(l=r,h=T,c=E,d=!1,(o=[]).push(u=[T+(s=e.edges[r]).path[0][0],E+s.path[0][1]]);!d&&"object"==typeof(n=t[h][c]).edges[l];)if(s=n.edges[l],delete n.edges[l],(p=s.path[1])[0]+=h,p[1]+=c,o.push(p),l=s.move.enter,c+=s.move.y,void 0===t[h+=s.move.x]||void 0===t[h][c]){if(!i.linearRing)break;if(f=0,m=0,h===b?(h--,f=0):h<0?(h++,f=2):c===x?(c--,f=3):c<0&&(c++,f=1),h===T&&c===E&&f===M[r]){d=!0,l=r;break}for(;;){if(g=!1,m>4)throw new Error("Direction change counter overflow! This should never happen!");if(void 0!==t[h]&&void 0!==t[h][c]&&"object"==typeof(n=t[h][c]).edges[v=w[f]]){o.push(Fd(h,c,f,(s=n.edges[v]).path)),l=v,g=!0;break}if(g)break;if(o.push(jd(h,c,f)),c+=A[f],void 0!==t[h+=_[f]]&&void 0!==t[h][c]||(0===f&&c<0||1===f&&h<0||2===f&&c===x||3===f&&h===b)&&(h-=_[f],c-=A[f],f=(f+1)%4,m++),h===T&&c===E&&f===M[r]){d=!0,l=r;break}}}!i.linearRing||o[o.length-1][0]===u[0]&&o[o.length-1][1]===u[1]||o.push(u),y.push(o)}}))})),y}(c,d,r)}o?p.push(u):p=u,"function"==typeof r.successCallback&&r.successCallback(p,e)}))}(e,[t],{successCallback:e=>{const t=Array.isArray(e[0])?e[0]:e;for(const e of t){const t=e.map((e=>{let[t,r]=e;return[t*i-180,90-r*i]}));t.length>2&&(t[0][0]!==t.at(-1)[0]||t[0][1]!==t.at(-1)[1])&&t.push(t[0]),r.push(t)}}}),r.length>0?r:null}Nd.prototype.cellsInBand=function(e,t,i){var r=[];return i=void 0===i||i,this.lowerBound>t||this.upperBound<e||(this.childA||this.childB||this.childC||this.childD?(this.childA&&(r=r.concat(this.childA.cellsInBand(e,t,i))),this.childB&&(r=r.concat(this.childB.cellsInBand(e,t,i))),this.childD&&(r=r.concat(this.childD.cellsInBand(e,t,i))),this.childC&&(r=r.concat(this.childC.cellsInBand(e,t,i)))):(i||this.lowerBound<=e||this.upperBound>=t)&&r.push({x:this.x,y:this.y})),r},Nd.prototype.cellsBelowThreshold=function(e,t){var i=[];return t=void 0===t||t,this.lowerBound>e||(this.childA||this.childB||this.childC||this.childD?(this.childA&&(i=i.concat(this.childA.cellsBelowThreshold(e,t))),this.childB&&(i=i.concat(this.childB.cellsBelowThreshold(e,t))),this.childD&&(i=i.concat(this.childD.cellsBelowThreshold(e,t))),this.childC&&(i=i.concat(this.childC.cellsBelowThreshold(e,t)))):(t||this.upperBound>=e)&&i.push({x:this.x,y:this.y})),i};const Gd=class{constructor(e){this.date=e}update(e){this.date=e;const t=function(e){const t=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const i=[];Math.floor(180/t),Math.floor(360/t);let r=90;for(;r>=-90;){const a=[];let s=-180;for(;s<=180;){const i=Ud(e,r,s);a.push(i),s+=t}i.push(a),r-=t}return i}(e,2),i=$d(t,0,2),r=$d(t,-6,2),a=$d(t,-12,2),s=$d(t,-18,2),n={type:"FeatureCollection",features:[]};return i&&n.features.push({type:"Feature",geometry:{type:"Polygon",coordinates:i},properties:{level:"civil"}}),r&&n.features.push({type:"Feature",geometry:{type:"Polygon",coordinates:r},properties:{level:"nautical"}}),a&&n.features.push({type:"Feature",geometry:{type:"Polygon",coordinates:a},properties:{level:"astronomical"}}),n.features.push({type:"Feature",geometry:{type:"Polygon",coordinates:s},properties:{level:"night"}}),n}(this.date);this.source.setData(t)}addToMap(e){const t={id:"mapsgl::daynight",type:Re.o.geojson,url:void 0,data:{type:"FeatureCollection",features:[]},metadataUrl:void 0,timeSeries:void 0},i={type:tr.m.fill,source:t.id,paint:{fill:{color:e=>"rgba(0, 0, 0, 0.25)"}}},r=e.addSource(t.id,t);r instanceof Ea&&(this.source=r);const a=e.addLayer("mapsgl::daynight",i);a instanceof as&&(this.layer=a),this.update(e.timeline.currentDate),e.timeline.on(Ra.A.ADVANCE,this.handleTimelineAdvance,null,this)}removeFromMap(e){e.timeline.off(Ra.A.ADVANCE,this.handleTimelineAdvance),this.source&&e.removeSource(this.source.id),this.layer&&e.removeLayer(this.layer.id)}handleTimelineAdvance(e){this.update(e.date)}},qd=class extends N.A{get needsViewportUpdate(){return this._needsViewportUpdate}get container(){}get context(){return this._context}set context(e){this._context=e,this.store.source.each((t=>{if(t instanceof Xi){const i=e.gl;t.maxTextureSize=i.getParameter(i.MAX_TEXTURE_SIZE)}}))}get isReady(){return this._isReady}get fps(){return this._fps.fps}get sources(){return[...this.store.source.cache.values()]}get layers(){return[...this.store.layer.orderedLayers()]}get controls(){return this._controls}get sourceIds(){return[...this.store.source.cache.keys()]}get layerIds(){return[...this.store.layer.cache.keys()]}get weatherLayerIds(){return[...this._weatherElements.keys()]}get libraryInfo(){return{name:void 0,version:{current:0,min:0}}}constructor(e,t){var i,r,a;if(super(),this.store={source:void 0,layer:void 0,overlay:void 0},this.state=new Oa.A({fullscreen:!1,tileBounds:void 0,units:Object.assign({},O.defaultUnits.imperial)}),this._loadingSources=new Set,this._weatherElements=new Map,this._controls={legend:void 0,dataInspector:void 0},this._eventHandlers={},this._resumeAnimationOnMoveEnd=!0,this._resumeAnimation=!1,this._dataEvaluatorsByLayer={},this.needsRedraw=!1,this._needsViewportUpdate=!0,this.isFadingSymbols=!1,this._isReady=!1,this.updateSymbolPlacement=ma((()=>{const e=this.getSymbolLayers();e.length>0&&this.placement.placeSymbols(e),this.isFadingSymbols=e.length>0||this.placement.isDirty,this.isFadingSymbols&&this.fadeSymbolsIfNeeded()}),150),this._handleFullScreenChange=e=>{const t=z(this.container);this.state.setState({fullscreen:t}),this.trigger("fullscreenchange")},this._handleSourceLoadEvent=e=>{const{type:t,sourceId:i}=e;t===ye.A.METADATA_LOAD_START?this.trigger(ye.A.LOAD_START):t===ye.A.LOAD_START?(0===this._loadingSources.size&&this.trigger(ye.A.LOAD_START),this._loadingSources.has(i)||this._loadingSources.add(i)):t===ye.A.LOAD_COMPLETE&&(this._loadingSources.delete(i),0===this._loadingSources.size&&this.trigger(ye.A.LOAD_COMPLETE)),this.updateSymbolPlacement()},this._handleLayerLoadEvent=e=>{const{type:t,layerId:i}=e,r=this.getLayer(i);r&&(t===Ga?this.trigger("layer:load:progress",{layer:r,progress:e.progress}):t===$a?this.trigger("layer:load:start",{layer:r}):t===qa&&this.trigger("layer:load:complete",{layer:r}))},this._handleLayerShow=e=>{this.trigger("layer:show",{layer:e.target}),this._handleLayerVisibilityChange(e)},this._handleLayerHide=e=>{this.trigger("layer:hide",{layer:e.target}),this._handleLayerVisibilityChange(e)},this._handleLayerVisibilityChange=e=>{var t;if(this.updateSymbolPlacement(),null===(t=e.target)||void 0===t?void 0:t.id){const t=e.target.id;[...this._weatherElements.values()].forEach((e=>{var i;(null===(i=e.layer)||void 0===i?void 0:i.id)===t&&this.controls.legend&&e.legendId&&(e.layer.visible?this.controls.legend.addLegend(e.legendId,e.config.legend,{bounds:this.getBounds()}):this.controls.legend.removeLegend(e.legendId))}))}},this._handleLegendUnitsChange=e=>{const t=e.units;(0,O.equalUnits)(this.state.get("units"),t)||this.setUnits(t)},this._updateLegendsForMap=e=>{const t=this.controls.legend;null==t||t.legends.forEach((e=>{var t,i;if(null===(t=e.legend.options.points)||void 0===t?void 0:t.requiresMapBounds)e.legend.update({},{time:this.timeline.currentDate,bounds:this.getBounds()});else if(null===(i=e.legend.options.points)||void 0===i?void 0:i.layerId){const t=this.getWeatherLayer(["alerts","alerts-outline","alerts-short-fuse"].find((e=>this.hasWeatherLayer(e))));if(t instanceof Rl){const i=t.getVisibleFeatures();e.legend.update({},{features:i})}}}))},this._handleMouseMoveEvent=e=>{const t=this.transform.pointToLocation(e.point),i=this.controls.dataInspector;i&&i.isEnabled&&((0,pe.Z)(t)?i.show(e.point,t):i.hide())},!t.account)throw new Error("[MapsGL] Map controller must include a valid account configuration.");this._fps=Pa,this._fps.start(2e4),window.addEventListener("focus",(()=>{this._fps.fps<50&&this._fps.start(2e4)})),this.account=t.account,this.weatherProvider=new sr(this.account),this.map=e,this.store.source=new os,this.store.layer=new Ih(this.store.source),this.store.overlay={},this.style=new Cd({fontUrl:"https://cdn.aerisapi.com/sdk/js/mapsgl/fonts/{name}_{start}-{end}.json"}),this.scene=new kh({camera:"perspective",map:{size:this.getSize(),fov:this.getFov()}}),this.transform=this.getTransform(e),this.viewport=new ja,this.viewport.renderWorldCopies=!1===this.transform.isGlobe,this.updateViewport(),this.placement=new ya(this.transform),this.checkVersion(),t.units&&this.state.setState({units:Object.assign(Object.assign({},this.state.get("units")),t.units)}),this.timeline=new Ia(Object.assign({id:"map-timeline",start:new Date(Date.now()-864e5),end:new Date,duration:4,endDelay:2},t.animation)),this._animatorSync=new dd(this.timeline),this._animatorSync.pauseWhileLoading=(null===(i=t.animation)||void 0===i?void 0:i.pauseWhileLoading)||!1,this.on(is,(()=>{this._animatorSync.setNeedsUpdate()})),this._resumeAnimationOnMoveEnd=null===(a=null===(r=t.animation)||void 0===r?void 0:r.resumeOnMoveEnd)||void 0===a||a,this.inspector=new Da(this),this.on(Ja,(()=>{this.setNeedsViewportUpdate()})),this.on(es,(()=>{this.timeline.isPaused?!0!==this._animatorSync.isPausedForLoading&&(this._animatorSync.shouldResumeAfterLoading=!1):(this.timeline.pause(),this._resumeAnimation=this._resumeAnimationOnMoveEnd)})),this.on(ts,(()=>{this.setNeedsViewportUpdate(),this.timeline.isPaused&&this._resumeAnimation&&(this._animatorSync.shouldResumeAfterLoading=this._resumeAnimationOnMoveEnd,!1===this._animatorSync.isPausedForLoading&&this.timeline.resume()),this._resumeAnimation=!1}))}initialize(){return this.setNeedsViewportUpdate(),this.weatherProvider.initialize(this.account,this.style).then((()=>{this._isReady=!0,this.trigger("load")}))}checkVersion(){const{name:e,version:{current:t,min:i}}=this.libraryInfo;(0,R.n)(t)&&(0,ue.vA)(t>=i,`[MapsGL] Version for the ${e} library must be ${i} or higher, but version ${t} is being used.`)}getSize(){throw new Error("Subclasses must override `getSize`")}setSize(e){throw new Error("Subclasses must override `setSize`")}setContainerSize(e){let{width:t,height:i}=e;const r=this.container;r&&(r.style.width="string"==typeof t?t:`${t}px`,r.style.height="string"==typeof i?i:`${i}px`,this.resize())}getCenter(){throw new Error("Subclasses must override `getCenter`")}setCenter(e){throw new Error("Subclasses must override `setCenter`")}getBounds(){throw new Error("Subclasses must override `getBounds`")}getZoom(){throw new Error("Subclasses must override `getZoom`")}setZoom(e){throw new Error("Subclasses must override `setZoom`")}getBearing(){throw new Error("Subclasses must override `getBearing`")}getPitch(){throw new Error("Subclasses must override `getPitch`")}getFov(){throw new Error("Subclasses must override `getFov`")}getUnits(){return Object.assign({},this.state.get("units"))}setUnits(e){var t;this.state.setState({units:Object.assign(Object.assign({},this.state.get("units")),e)}),null===(t=this.controls.legend)||void 0===t||t.setUnits(this.state.get("units")),this.trigger(rs,{units:this.state.get("units")})}setUnitsForSystem(e){this.setUnits((0,O.getDefaultUnitsForSystem)(e))}redraw(){throw new Error("Subclasses must override `redraw`")}resize(){const e=this.getSize();this.context.size.width===e.width&&this.context.size.height===e.height||this.invalidateMapSize()}toggleFullscreen(){const e=this.container,t=this.state.get("fullscreen"),i=document;t?(i.exitFullscreen?i.exitFullscreen():i.mozCancelFullScreen?i.mozCancelFullScreen():i.webkitCancelFullScreen?i.webkitCancelFullScreen():i.msExitFullscreen&&i.msExitFullscreen(),this.state.setState({fullscreen:!1})):(e.requestFullscreen?e.requestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.webkitRequestFullscreen?e.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT):e.msRequestFullscreen?e.msRequestFullscreen():e.webkitEnterFullscreen&&e.webkitEnterFullscreen(),this.state.setState({fullscreen:!0}))}setPaintProperty(e,t,i){const r=this.getLayer(e);r&&r.setPaintProperty(t,i)}addLegendControl(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.controls.legend)return;if((0,R.g)(e))throw new Error("[MapsGL] DOM target not provided for `addLegendControl`");const i=new Xh(Object.assign({units:this.state.get("units")},t));return i.addTo(e),this._controls.legend=i,this.on(ts,this._updateLegendsForMap,null,this),i.on("add",this._updateLegendsForMap,null,this),i.on(Nh,this._handleLegendUnitsChange,null,this),this.timeline.on(Ra.A.ADVANCE,this._updateLegendsForMap,null,this),[...this._weatherElements.values()].filter((e=>e.active&&e.layer.visible)).forEach((e=>{const t=e.config.legend;t&&i.addLegend(t.id,t,{bounds:this.getBounds()})})),i}addDataInspectorControl(){if(this.controls.dataInspector)return;const e=this.container||document.body,t=new cd(this.inspector,arguments.length>0&&void 0!==arguments[0]?arguments[0]:{});return t.addTo(e),this._controls.dataInspector=t,[...this._weatherElements.values()].forEach((e=>{const i=this._dataEvaluatorsByLayer[e.id];i&&t.setEvaluator(e.id,i)})),"move"===t.options.event?(this.on(Ka,this._handleMouseMoveEvent),this.on(Qa,t.handleMouseOutEvent)):this.on(Xa,t.handleMapClickEvent),t.options.stream&&this.timeline.on(Ra.A.ADVANCE,t.update),this.on(es,t.handleMapMoveEvent),t}removeLegendControl(){const e=this._controls.legend;e&&(e.remove(),e.off(Nh,this._handleLegendUnitsChange)),this.off(ts,this._updateLegendsForMap),this.off(Ra.A.ADVANCE,this._updateLegendsForMap),delete this._controls.legend}removeDataInspectorControl(){const e=this._controls.dataInspector;e&&(e.remove(),this.off(Ka,this._handleMouseMoveEvent),this.off(Qa,e.handleMouseOutEvent),this.off(Xa,e.handleMapClickEvent),this.off(es,e.handleMapMoveEvent),this.timeline.off(Ra.A.ADVANCE,e.update))}addDayNightOverlay(){(0,pe.E)(this.store.overlay.daynight)&&(this.store.overlay.daynight=new Gd(this.timeline.currentDate)),this.store.overlay.daynight.addToMap(this)}removeDayNightOverlay(){(0,pe.Z)(this.store.overlay.daynight)&&(this.store.overlay.daynight.removeFromMap(this),delete this.store.overlay.daynight)}hasWeatherLayer(e){var t;const i=(null===(t=this.getWeatherElement(e))||void 0===t?void 0:t.id)||e,r=this.weatherProvider.getWeatherLayerConfig(e);return!!this.hasLayer(i)||!!Array.isArray(r)&&r.filter((e=>this.hasWeatherLayer(e))).length===r.length}getWeatherLayer(e){var t;const i=this.weatherProvider.getWeatherLayerConfig(e);return Array.isArray(i)?i.map((e=>{const t=this.getWeatherLayer(e);return!1===Array.isArray(t)?t:null})).filter(Boolean):null===(t=this.getWeatherElement(e))||void 0===t?void 0:t.layer}setWeatherLayerVisibility(e,t){const i=this.weatherProvider.getWeatherLayerConfig(e);if(!i)return void console.warn(`[MapsGL] No weather layer configuration for the id '${e}'`);if(Array.isArray(i))return void i.forEach((e=>this.setWeatherLayerVisibility(e,t)));const r=this.getWeatherElement(e);if(!r)return;const a=this.getLayer(r.id);a&&(t?a.show():a.hide())}getWeatherElement(e){return this._weatherElements.get(e)}addWeatherLayer(e,t,i){var r,a,s,n;const o=null!==(r=null==(t=t||{})?void 0:t.id)&&void 0!==r?r:e,l=this.getWeatherElement(o);if(l){if(!1===l.active)return l.active=!0,l.layer.show(),l.layer;if((0,W.I)(t))return void console.warn(`[MapsGL] Weather layer with id '${e}' already exists on the map`)}const h=this.weatherProvider.getLayerAlias(e);if(h)return console.warn(`[MapsGL] Attempting to use deprecated weather layer id '${e}'. Using '${h}' instead.`),this.hasWeatherLayer(h)?void 0:this.addWeatherLayer(h,t,i);const c=this.weatherProvider.getWeatherLayerConfig(e,Object.assign(Object.assign({},t),{timeline:{from:this.timeline.startDate,to:this.timeline.endDate,current:this.timeline.currentDate}}));if((0,pe.E)(c))return void console.warn(`[MapsGL] No weather layer configuration for the id '${e}'`);if(Array.isArray(c)){delete t.id;let e=i;const r=(null==t?void 0:t.childLayers)||{},a=c.reduce(((t,a)=>{if(this.hasWeatherLayer(a))t.push(this.getWeatherLayer(a));else{const s=this.addWeatherLayer(a,r[a],i);s instanceof as&&(e=s.id,t.push(s))}return t}),[]);return a.length>0?a:void 0}const d=new Dd(e,c);if(d.addTo(this,i,t),(0,pe.E)(d.layer))return void console.error(`[MapsGL] No layer created for weather layer with id '${e}'`);d.isMask||this._weatherElements.set(o,d);const u=d.config.legend;if(this.controls.legend&&(0,pe.Z)(u)&&!0!==(null==t?void 0:t.hidden)){const e=this.controls.legend.addLegend(u.id,u,{bounds:this.getBounds()});e&&(d.legendId=e.id,d.layer.on(Wa,(t=>{let{property:i,value:r}=t;if("sample.colorscale"===i)(0,R.n)(r.masks)?e.update({bar:r.masks.map((e=>e))}):e.update({bar:{colorscale:r}});else if(/^sample\.colorscale\.\w+/.test(i)){const t=i.replace(/^sample\.colorscale\./,""),a=e.options.bar;Array.isArray(a)?a.forEach((e=>(0,U.h)(e.colorscale,t,r))):(0,U.h)(a.colorscale,t,r),e.update({bar:a})}}))),(null===(a=u.points)||void 0===a?void 0:a.layerId)&&(null===(s=this.getSource(d.config.source.id))||void 0===s||s.on(ye.A.DATA_CHANGE,this._updateLegendsForMap))}return this._dataEvaluatorsByLayer[d.id]=d.config.evaluator,null===(n=this.controls.dataInspector)||void 0===n||n.setEvaluator(d.id,d.config.evaluator),d.layer}removeWeatherLayer(e){var t,i,r;const a=this.weatherProvider.getWeatherLayerConfig(e);if(!a)return void console.warn(`[MapsGL] No weather layer configuration for the id '${e}'`);if(Array.isArray(a))return void a.forEach((e=>this.removeWeatherLayer(e)));const s=this.getWeatherElement(e);if(s&&this.getLayer(s.id)&&(s.legendId&&(null===(t=this.controls.legend)||void 0===t||t.removeLegend(s.legendId)),s.remove(this))){this._weatherElements.delete(e);const t=s.config.source.id;this.hasSource(t)&&0===(null===(r=null===(i=this.getSource(t))||void 0===i?void 0:i.consumingLayers)||void 0===r?void 0:r.length)&&this.removeSource(t)}}hasSource(e){return this.store.source.has(e)}hasLayer(e){return this.store.layer.has(e)}getSource(e){return this.store.source.get(e)}getLayer(e){return this.store.layer.get(e)}findLayer(e){return this.store.layer.find(e)}addSource(e,t){const i=this.store.source.add(e,t);if(i){if(i.style=this.style,i.on(ye.A.LOAD_START,this._handleSourceLoadEvent.bind(this)),i.on(ye.A.TILE_LOAD,this._handleSourceLoadEvent.bind(this)),i.on(ye.A.LOAD_COMPLETE,this._handleSourceLoadEvent.bind(this)),i instanceof ci){const e=()=>{i.metadata.setValidTimeRange({start:this.timeline.startDate,end:this.timeline.endDate})};this.timeline.on(Ra.A.RANGE_CHANGE,(()=>{e()})),e()}return this.trigger("source:add",{source:i}),i}}addLayer(e,t,i){var r;let a=this.store.layer.count;i&&(a=Math.max(0,this.store.layer.getIndex(i)-1)),"debug"===t.type&&!1===this.hasSource("debug")&&(this.addSource("debug",{type:"debug"}),t.source="debug");const s=this.store.layer.insertAt(a,e,t,this.scene);return/::mask-?/.test(e)&&(s.isLayerMask=!0),(0,R.g)(s)&&this.hasLayer(e)?this.getLayer(e):(s&&(s.on(Va,this._handleLayerShow,null,this),s.on(Ba,this._handleLayerHide,null,this),s.on($a,this._handleLayerLoadEvent,null,this),s.on(Ga,this._handleLayerLoadEvent,null,this),s.on(qa,this._handleLayerLoadEvent,null,this),this.add(s,i),s.animator&&(this._animatorSync.add(s),null===(r=this.timeline)||void 0===r||r.add(s.animator.animation),s.enabled=s.animator.canShowForDate()),this.triggerRedraw(),this.trigger("layer:add",{layer:s}),this._handleLayerVisibilityChange({layer:s})),s)}moveLayer(e,t){const i=(0,R.g)(t)?-1:Math.max(0,this.store.layer.getIndex(t))-1;this.store.layer.move(e,i)}removeSource(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=this.getSource(e);i?(this.store.source.remove(e),i.style=void 0,i.off(ye.A.LOAD_START,this._handleSourceLoadEvent),i.off(ye.A.TILE_LOAD,this._handleSourceLoadEvent),i.off(ye.A.LOAD_COMPLETE,this._handleSourceLoadEvent),this.trigger("source:remove",{source:i}),t&&i.dispose()):console.warn(`[MapsGL] Source does not exist for identifier '${e}'`)}removeLayer(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];var i,r;const a=this.store.layer.remove(e);a?(a.off(Va,this._handleLayerShow),a.off(Ba,this._handleLayerHide),a.off($a,this._handleLayerLoadEvent),a.off(Ga,this._handleLayerLoadEvent),a.off(qa,this._handleLayerLoadEvent),a.animator&&(this._animatorSync.remove(a),null===(i=this.timeline)||void 0===i||i.remove(a.animator.animation)),a.mask=void 0,this.remove(a),this.triggerRedraw(),this.trigger("layer:remove",{layer:a}),this._handleLayerVisibilityChange({layer:a}),t&&(a.mask&&(null===(r=a.mask.layer)||void 0===r||r.dispose()),a.dispose())):console.warn(`[MapsGL] Layer does not exist for identifier '${e}'`)}query(e){return this.inspector.query(e)}queryPromise(e){return this.inspector.queryPromise(e)}setRefreshInterval(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this._refreshInterval&&clearInterval(this._refreshInterval),0===e)return void(this._refreshInterval=void 0);const i=60*Math.max(e,1)*1e3;i>0&&(this._refreshInterval=setInterval((()=>{const e=this.timeline.startDate,r=this.timeline.endDate,a=t?new Date:this.timeline.currentDate;this.timeline.startDate=new Date(e.getTime()+i),this.timeline.endDate=new Date(r.getTime()+i),this.timeline.goToDate(a)}),i))}preloadAnimationData(){return this._animatorSync.preloadData()}triggerRedraw(){this.needsRedraw=!0,this.redraw()}getTransform(e){return new Pd(arguments.length>1&&void 0!==arguments[1]?arguments[1]:Be,this.scene)}getProjection(){return this.transform.projection.type}setProjection(e){this.transform.setProjection(e)}add(e,t){e.map=this}remove(e){e.map=void 0}invalidateMapSize(){throw new Error("Subclasses must override `invalidateMapSize`")}getViewportState(){return{id:"base",size:this.getSize(),center:this.getCenter(),zoom:this.getZoom(),bounds:this.getBounds(),pitch:this.getPitch(),bearing:this.getBearing(),fov:this.getFov(),elevation:0}}updateViewport(){if(!1===this.needsViewportUpdate)return;this.getProjection()!==this.transform.projection.type&&this.transform.setProjection(this.getProjection());const e=this.getViewportState();this.viewport.updateFromMapViewState(e,this.transform),this.transform.updateOnMapViewChange&&this.transform.update(e),this.updateSymbolPlacement();const t=this.viewport.getVisibleTileBounds(),i=this.state.get("tileBounds");((0,R.g)(i)||!1===(null==i?void 0:i.equals(t)))&&(this.state.setState("tileBounds",t),this.trigger(is,{tileBounds:t.info})),this._needsViewportUpdate=!1}setNeedsViewportUpdate(){this._needsViewportUpdate=!0}getSymbolLayers(){const e=[];return this.layers.filter((e=>e.visible)).forEach((t=>{const i="symbol"===t.type||"text"===t.type,r=t.paint.symbolAllowOverlap()&&"map"!==t.paint.symbolOverlapMode();if(t instanceof Al&&i&&!1===r){const i=this.viewport.getVisibleTileCoords(t.getDataZoom()).map((e=>{const i=e.normalize();let r=t.source.tiles.get(i);return(0,R.n)(r)&&(r=r.clone(e.wrap)),r})).filter((e=>(0,R.n)(e)));e.push({id:t.id,tiles:i,paint:t.paint})}})),e}fadeSymbolsIfNeeded(){let e=!1;this.getSymbolLayers().forEach((t=>{if(this.placement.updateLayerOpacities(t.id,t.tiles)){const i=this.getLayer(t.id);null==i||i.setNeedsUpdate(),e=!0}})),this.isFadingSymbols=e,this.triggerRedraw()}setupEvents(e){const t=this.map;let i="on";t.addEventListener?i="addEventListener":t.addListener&&(i="addListener"),"function"==typeof t[i]&&Object.keys(e).forEach((t=>{this._eventHandlers[i]=(i=>{const r=this.dataForMapEvent(t,i);this.shouldTriggerMapEvent(t)&&this.trigger(e[t],r)}).bind(this),this.map[i](t,this._eventHandlers[i])})),["","moz","webkit","ms"].forEach((e=>{document.addEventListener(`${e}fullscreenchange`,this._handleFullScreenChange.bind(this))}))}_tick(e){this.style.imageManager.triggerFrame(),this.isFadingSymbols&&this.fadeSymbolsIfNeeded()}shouldTriggerMapEvent(e){return!0}dataForMapEvent(e,t){}dispose(){var e;this.timeline.clear(),this.store.layer.each((e=>{this.hasLayer(e.id)&&this.removeLayer(e.id,!0)})),this.store.source.each((e=>{this.hasSource(e.id)&&this.removeSource(e.id,!0)})),null===(e=this.context)||void 0===e||e.dispose();const t=this.map;let i="off";t.addEventListener?i="addEventListener":t.addListener&&(i="addListener"),"function"==typeof t[i]&&(Object.keys(this._eventHandlers).forEach((e=>{this.map[i](e,this._eventHandlers[i])})),this._eventHandlers={})}},Wd=class extends qd{get context(){return this.map.context}constructor(e,t){super(e,t),this.setupEvents({load:"load",unload:"unload",resize:"resize",click:"click",dblclick:"dblclick",mousedown:"mousedown",mouseup:"mouseup",mouseover:"mouseover",mouseout:"mouseout",mousemove:"mousemove",zoom:"zoom",zoomstart:"zoom:start",zoomend:"zoom:end",move:"move",movestart:"move:start",moveend:"move:end",popupopen:"popupopen",popupclose:"popupclose"}),this.initialize()}getSize(){return this.map.getSize()}getCenter(){return this.map.getCenter()}setCenter(e){this.map.setCenter(e)}getZoom(){return this.map.getZoom()}setZoom(e){this.map.setZoom(e)}getBounds(){return this.map.getBounds()}fitBounds(){}getBearing(){return 0}getPitch(){return 0}getFov(){return Id}redraw(){this.map.redraw()}add(e,t){super.add(e,t),e.map=this,this.map.addLayer(e)}remove(e){super.remove(e),this.map.removeLayer(e),e.map=void 0}updateViewport(){super.updateViewport(),this.map.transform.state=this.transform.state}project(e){const t=this.transform.projection.project(e.lat,e.lon);return{x:t.x*this.map.container.offsetWidth,y:t.y*this.map.container.offsetHeight}}unproject(e){const t={x:e.x/this.map.container.offsetWidth,y:e.y/this.map.container.offsetHeight,z:0};return this.transform.projection.unproject(t.x,t.y)}dataForMapEvent(e,t){if(!t)return;let i;switch(e){case"click":case"dblclick":case"mousemove":i={coord:{lat:t.latlng.lat,lon:t.latlng.lng},point:{x:t.containerPoint.x,y:t.containerPoint.y}}}return i}};var Hd=i(7290),Zd=i(6339);const Yd=class{constructor(){this.cache=new Map}get(e){return this.cache.get(e)}set(e,t){this.cache.set(e,t)}has(e){return this.cache.has(e)}exists(e){const t=[...this.cache.values()];return e instanceof Jt?t.some((t=>t.id===e.id)):t.includes(e)}delete(e){const t=this.get(e);t instanceof Jt&&t.dispose(),this.cache.delete(e)}dispose(){this.cache.forEach(((e,t)=>{this.delete(t)})),this.cache.clear()}},Xd=class{constructor(e){this.textures=new Yd,this.programs=new Yd,this.geometry=new Yd,this.objects=new Yd,this.context=e}getProgram(e,t,i){const r=function(e){let t=e;return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[]).forEach((e=>{t+=`/${e}`})),t}(e,t);let a=this.programs.get(r);return a||(a=i(this.context),this.programs.set(r,a)),a}getOrCreateProgram(e,t){return this.getProgram(e,t.defines||[],(e=>new Zo(e,Object.assign(Object.assign({},t),{uniforms:t.uniforms||{}}))))}hasProgram(e){return this.programs.exists(e)}generateSubdividedQuad(e){const t=`subdivided-quad-${e}`;let i=this.geometry.get(t);if(!i){const r=e+1,a=r*r,s=new Float32Array(2*a),n=new Float32Array(2*a),o=new Uint16Array(e*e*6);let l=0,h=0,c=0;for(let t=0;t<=e;t++)for(let i=0;i<=e;i++){const a=i/e,d=t/e;if(s[l++]=a,s[l++]=d,n[h++]=a,n[h++]=d,i<e&&t<e){const e=t*r+i,a=e+1,s=(t+1)*r+i,n=s+1;o[c++]=e,o[c++]=s,o[c++]=a,o[c++]=a,o[c++]=s,o[c++]=n}}i=new Wr(this.context,{position:{size:2,data:s},uv:{size:2,data:n},index:{data:o}}),this.geometry.set(t,i)}return i}getFullscreenQuad(){let e=this.geometry.get("quad"),t=this.objects.get("camera:quad");return e||(e=new Wr(this.context,{position:{size:2,data:new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1])},uv:{size:2,data:new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1])}}),this.geometry.set("quad",e)),t||(t=new zh(0,1,1,0,0,1),this.objects.set("camera:quad",t)),{geometry:e,camera:t}}dispose(){this.textures.dispose(),this.programs.dispose(),this.geometry.dispose(),this.objects.dispose()}};var Qd;const Kd=!!(null===(Qd=null===document||void 0===document?void 0:document.createElement("canvas"))||void 0===Qd?void 0:Qd.getContext("webgl2")),Jd=()=>Kd&&"undefined"!=typeof WebGL2RenderingContext;let eu=1;const tu=class extends N.A{constructor(e,t={}){var i,r,a;super(),this.dpr=1,this._extensions={},this._ownsCanvas=!1,this.id=eu++,this.cache=new Xd(this),e||((null===(i=t.context)||void 0===i?void 0:i.canvas)?e=t.context.canvas:(e=Ce(),this._ownsCanvas=!0)),this._canvas=e,this._gl=t.context?t.context:Jd()&&"webgl"!==t.type?e.getContext("webgl2",Object.assign({antialias:!0},t)):e.getContext("webgl",Object.assign({antialias:!0},t)),this._state=new No(this.gl),this.vertexAttribDivisor=this.getExtension("ANGLE_instanced_arrays","vertexAttribDivisor","vertexAttribDivisorANGLE"),this.drawArraysInstanced=this.getExtension("ANGLE_instanced_arrays","drawArraysInstanced","drawArraysInstancedANGLE"),this.drawElementsInstanced=this.getExtension("ANGLE_instanced_arrays","drawElementsInstanced","drawElementsInstancedANGLE"),this.createVertexArray=this.getExtension("OES_vertex_array_object","createVertexArray","createVertexArrayOES"),this.bindVertexArray=this.getExtension("OES_vertex_array_object","bindVertexArray","bindVertexArrayOES"),this.deleteVertexArray=this.getExtension("OES_vertex_array_object","deleteVertexArray","deleteVertexArrayOES"),this._contextSize={width:(null===(r=this.canvas)||void 0===r?void 0:r.clientWidth)||this.canvas.width,height:(null===(a=this.canvas)||void 0===a?void 0:a.clientHeight)||this.canvas.height},this._handleResizeBind=this._handleResize.bind(this),window.addEventListener("resize",this._handleResizeBind,!1),window.addEventListener("orientationchange",this._handleResizeBind,!1),window.addEventListener("webkitfullscreenchange",this._handleResizeBind,!1),this._canvas.addEventListener("webglcontextlost",this._handleContextLost,!1)}get canvas(){return this._canvas}get gl(){return this._gl}get size(){const e=this.dpr;return{width:this.canvas.clientWidth||this.canvas.width/e,height:this.canvas.clientHeight||this.canvas.height/e}}get resolution(){return{width:this.canvas.width,height:this.canvas.height}}get state(){return this._state}get isWebGL(){const e=this.gl;return Boolean(e&&(e instanceof WebGLRenderingContext||e.ARRAY_BUFFER===Zd.A.ARRAY_BUFFER))}get isWebGL2(){const e=this.gl;return Boolean(e&&Jd()&&(e instanceof WebGL2RenderingContext||e.ARRAY_BUFFER===Zd.A.TEXTURE_BINDING_3D))}getExtension(e,t,i){const r=this.gl[t];if(t&&r)return r.bind(this.gl);this._extensions[e]||(this._extensions[e]=this.gl.getExtension(e));const a=this._extensions[e];return t?a?a[i].bind(a):null:a}resetState(){this.state.reset(),this.bindVertexArray(null)}resize(e,t){const i=this.canvas,r=this.dpr;i.width===e&&i.height===t||(i.width=e*r,i.height=t*r,i.style.width=`${e}px`,i.style.height=`${t}px`,this._handleResize())}dispose(){var e,t;if(window.removeEventListener("resize",this._handleResizeBind),null===(e=this._canvas)||void 0===e||e.removeEventListener("webglcontextlost",this._handleContextLost,!1),this.cache.dispose(),this._ownsCanvas){this.canvas.width=1,this.canvas.height=1;const e=null===(t=this.gl)||void 0===t?void 0:t.getExtension("WEBGL_lose_context");e&&e.loseContext()}this._gl=void 0,this._canvas=void 0,this._state.reset()}invalidateSize(){this._handleResize()}createTexture(){return new ei(this,arguments.length>0&&void 0!==arguments[0]?arguments[0]:{})}createFramebuffer(){return new vs(this,arguments.length>0&&void 0!==arguments[0]?arguments[0]:{})}createVertexShader(e){return new zo(this,e)}createFragmentShader(e){return new Lo(this,e)}createProgram(e){return new Zo(this,e)}createMesh(e,t){return new ll(this,e,t)}_handleResize(){this._resizeTimeout&&window.clearTimeout(this._resizeTimeout);const e=Oe(this.gl),t=this.canvas.width,i=this.canvas.height;t===this._contextSize.width&&i===this._contextSize.height&&e===this.dpr||(this._contextSize.width=t,this._contextSize.height=i,this.dpr=e,this.trigger("resize",this._contextSize))}_handleContextLost(){console.warn("[MapsGL] WebGL context lost"),this.trigger("contextlost")}},iu=class{constructor(e){this.id=e.id,this.glLayer=e,this.type="custom",this.renderingMode="2d"}onAdd(e,t){const i=this.glLayer.map;i.context||(i.context=new tu(t.canvas,{context:t}),i.context.dpr=Oe(i.context.gl));const r=i.context;this._lastContextSize={width:r.resolution.width,height:r.resolution.height},this.glLayer.onAdd(i.context);const a=this.glLayer;this._eventHandlers={move:a.onMove.bind(a),zoom:a.onZoom.bind(a),click:a.onClick.bind(a),mousemove:a.onMouseMove.bind(a),movestart:a.onMoveStart.bind(a),moveend:a.onMoveEnd.bind(a),resize:a.onResize.bind(a)},Object.keys(this._eventHandlers).forEach((t=>{e.on(t,this._eventHandlers[t])}))}onRemove(e,t){this.glLayer.onRemove(),this.renderLoop=void 0,e&&this._eventHandlers&&Object.keys(this._eventHandlers).forEach((t=>{e.off(t,this._eventHandlers[t])}))}prerender(e,t){var i;const r=this.glLayer.map,a=this.glLayer.map.context,s=this._lastContextSize,n=a.resolution;r.transform.cutoffParams=function(e){var t,i,r,a;const s=null!==(t=e.nearZ)&&void 0!==t?t:e._nearZ,n=null!==(a=null!==(r=null===(i=e.projection)||void 0===i?void 0:i.farthestPixelDistance(e))&&void 0!==r?r:e.farZ)&&void 0!==a?a:e._farZ,o=n-s,l=.2*e.height,h=s+l;return[s,n,(h-l-s)/o,(h-s)/o]}(r.map.transform),r.needsViewportUpdate&&r.updateViewport(),!s||s.width===n.width&&s.height===n.height||(a.invalidateSize(),this._lastContextSize={width:n.width,height:n.height}),a.gl.enable(a.gl.DEPTH_TEST),a.gl.depthFunc(a.gl.LEQUAL),a.gl.depthRange(0,.9669),this.glLayer.prerender(null===(i=this.renderLoop)||void 0===i?void 0:i.elapsedTime)}render(e,t){var i;!0!==this.glLayer.isLayerMask&&this.glLayer.render(null===(i=this.renderLoop)||void 0===i?void 0:i.elapsedTime)}},ru=class extends qd{get container(){return this.map.getContainer()}get libraryInfo(){var e;const t=this.map.version||(null===(e=null===window||void 0===window?void 0:window.mapboxgl)||void 0===e?void 0:e.version);return{name:"mapbox",version:{current:void 0===t?void 0:Number.parseFloat(t.replace(/-.+$/,"")),min:2}}}constructor(e,t){super(e,t),this._mapboxLayers=new Map,this._mapEventHandlers={},this._loop=new Hd.A(this._tick.bind(this)),this.setupEvents({remove:"unload",resize:"resize",click:"click",dblclick:"dblclick",mousedown:"mousedown",mouseup:"mouseup",mouseover:"mouseover",mouseout:"mouseout",mousemove:"mousemove",zoom:"zoom",zoomstart:"zoom:start",zoomend:"zoom:end",move:"move",movestart:"move:start",moveend:"move:end"}),e.isStyleLoaded()?this.initialize():(this._mapEventHandlers.load=this.initialize.bind(this),this._mapEventHandlers.remove=this.dispose.bind(this),this._mapEventHandlers.resize=this._resize.bind(this),e.on("load",this._mapEventHandlers.load),e.on("remove",this._mapEventHandlers.remove),e.on("resize",this._mapEventHandlers.resize)),this._mapEventHandlers["style.load"]=()=>{setTimeout((()=>{this._mapboxLayers.forEach((t=>{let{layer:i,beforeId:r}=t;e.getLayer(i.id)||e.addLayer(i,r)}))}),500)},this._mapEventHandlers.renderstart=()=>{this.getProjection()!==this.transform.projection.type&&(this.setNeedsViewportUpdate(),this.updateViewport())},e.on("style.load",this._mapEventHandlers["style.load"]),e.on("renderstart",this._mapEventHandlers.renderstart)}getSize(){const e=this.map.getContainer();return z(this.container)?{width:window.innerWidth,height:window.innerHeight}:{width:e.offsetWidth,height:e.offsetHeight}}setSize(e){this.setContainerSize(e)}getCenter(){const e=this.map.getCenter();return{lat:e.lat,lon:e.lng}}setCenter(e){this.map.setCenter({lat:e.lat,lng:e.lon})}getBounds(){const e=this.map.getBounds();return{north:e.getNorth(),south:e.getSouth(),west:e.getWest(),east:e.getEast()}}getZoom(){return this.map.getZoom()}setZoom(e){this.map.setZoom(e)}getBearing(){return this.map.getBearing()}getPitch(){return this.map.getPitch()}getFov(){return(0,ke.H)(this.map.transform._fov)}redraw(){this.map.triggerRepaint()}moveLayer(e,t){super.moveLayer(e,t),this.map.moveLayer(e,t)}add(e,t){var i;if(super.add(e,t),!(null===(i=this.map)||void 0===i?void 0:i.getStyle()))return;const r=new iu(e);this.map.getLayer(e.id)||this._mapboxLayers.get(e.id)?console.warn(`[MapsGL] A WebGLLayer with id {${e.id}} already exists on the map`):(this._mapboxLayers.set(e.id,{layer:r,beforeId:t}),r.renderLoop=this._loop,this.map.addLayer(r,t),this._loop.start())}remove(e){var t;if(null===(t=this.map)||void 0===t?void 0:t.getStyle()){const t=this.map.getLayer(e.id);this.map&&t&&this.map.removeLayer(e.id)}this._mapboxLayers.delete(e.id),0===this._mapboxLayers.size&&this._loop.stop(),super.remove(e)}getTransform(e){return new Pd(this.getProjection(),this.scene)}getProjection(){var e;const t=this.map;return void 0!==t.getProjection&&"globe"===(null===(e=t.getProjection())||void 0===e?void 0:e.name)?Ue:Be}setProjection(e){this.map.setProjection(e===Ue?{name:"globe"}:{name:"mercator"})}getViewportState(){var e,t;const i=super.getViewportState(),r=this.map.transform;i.id="mapbox",i.nearZ=r._nearZ,i.farZ=null!==(t=null===(e=r.projection)||void 0===e?void 0:e.farthestPixelDistance(r))&&void 0!==t?t:r._farZ;const a=r._camera;return(null==a?void 0:a.position)&&(i.cameraPosition=(new Ve.A).fromArray(a.position)),i}_tick(e){super._tick(e)}_resize(){var e;null===(e=this.context)||void 0===e||e.invalidateSize()}invalidateMapSize(){this.map.resize()}dataForMapEvent(e,t){if(!t)return;let i;switch(e){case"click":case"dblclick":case"mousemove":i={target:this,originalEvent:t,coord:{lat:t.lngLat.lat,lon:t.lngLat.lng},point:{x:t.point.x,y:t.point.y}}}return i}dispose(e){this._loop.dispose(),Object.keys(this._mapEventHandlers).forEach((e=>{this.map.off(e,this._mapEventHandlers[e])})),super.dispose(e)}},au=(e,t)=>{e.setProjection(t===Ue?{type:"globe"}:{type:"mercator"})},su=class extends ru{get libraryInfo(){var e;const t=this.map.version||(null===(e=null===window||void 0===window?void 0:window.maplibregl)||void 0===e?void 0:e.version);return{name:"maplibre",version:{current:void 0===t?void 0:Number.parseFloat(t),min:2.3}}}constructor(e,t){super(e,t),this.projection=Be,e.on("projectiontransition",(t=>{if(this.projection="globe"===t.newProjection?Ue:Be,this.projection!==this.transform.projection.type){if(this.transform=this.getTransform(e),this.transform.updateOnMapViewChange){const e=this.getViewportState();this.transform.update(e)}this.placement.setTransform(this.transform)}})),this.on("fullscreenchange",(()=>{this.map.resize()}))}getFov(){return this.map.transform.fov}getTransform(e){return new Pd(this.getProjection(),this.scene)}getViewportState(){var e,t;const i=super.getViewportState(),r=this.map.transform,a=null!==(e=r.nearZ)&&void 0!==e?e:r._nearZ,s=null!==(t=r.farZ)&&void 0!==t?t:r._farZ;return Number.isFinite(a)&&(i.nearZ=a,i.farZ=s),i.id="maplibre",i.globiness=(0,R.n)(r._globeness)?1-r._globeness:0,i}getProjection(){return this.projection}setProjection(e){const t=this.map;t.isStyleLoaded()?au(t,e):t.on("style.load",(()=>{au(t,e)}))}},nu=class{get libraryInfo(){return{name:"leaflet",version:{current:0,min:0}}}constructor(e){this.id=e.id,this.glLayer=e,this.type="custom",this.renderingMode="2d"}onAdd(e,t){this.glLayer.onAdd(this.glLayer.map.context);const i=this.glLayer;this._eventHandlers={move:i.onMove.bind(i),zoom:i.onZoom.bind(i),click:i.onClick.bind(i),mousemove:i.onMouseMove.bind(i),movestart:i.onMoveStart.bind(i),moveend:i.onMoveEnd.bind(i),resize:i.onResize.bind(i)},Object.keys(this._eventHandlers).forEach((t=>{e.on(t,this._eventHandlers[t])}))}onRemove(e,t){this.renderLoop=void 0,this.glLayer.onRemove(),e&&this._eventHandlers&&Object.keys(this._eventHandlers).forEach((t=>{e.off(t,this._eventHandlers[t])}))}prerender(e,t){var i;this.glLayer.prerender(null===(i=this.renderLoop)||void 0===i?void 0:i.elapsedTime)}render(e){var t;!0!==this.glLayer.isLayerMask&&this.glLayer.render(null===(t=this.renderLoop)||void 0===t?void 0:t.elapsedTime)}},ou=class extends qd{get container(){return this.map.getContainer()}constructor(e,t){super(e,t),this._glLayers=new Map,this._canvasTransform={x:0,y:0,scale:1},this._isMoving=!1,this._isZooming=!1,this._mapEventHandlers={},this.context=new tu(void 0,{premultipliedAlpha:!0,depth:!0,antialias:!(k.safari&&k.version>=15.4&&k.version<16),alpha:!0,stencil:!0}),this.context.dpr=Oe(this.context.gl),this._loop=new Hd.A(this._tick.bind(this));const i=e.options.zoomAnimation,r=this.context.canvas;r.style.position="absolute",r.className="leaflet-zoom-"+(i?"animated":"hide"),e._panes.overlayPane.append(r),this._mapEventHandlers.resize=this._resize.bind(this),e.on("resize",this._mapEventHandlers.resize),this._resize(),this.setupEvents({load:"load",unload:"unload",resize:"resize",click:"click",dblclick:"dblclick",mousedown:"mousedown",mouseup:"mouseup",mouseover:"mouseover",mouseout:"mouseout",mousemove:"mousemove",zoom:"zoom",zoomstart:"zoom:start",zoomend:"zoom:end",move:"move",movestart:"move:start",moveend:"move:end",popupopen:"popupopen",popupclose:"popupclose"}),i&&(this._mapEventHandlers.zoomanim=this._animateZoom.bind(this),e.on("zoomanim",this._mapEventHandlers.zoomanim)),setTimeout((()=>this.initialize()),250)}getSize(){const e=this.container;return z(e)?{width:window.innerWidth,height:window.innerHeight}:{width:e.offsetWidth,height:e.offsetHeight}}setSize(e){this.setContainerSize(e)}getCenter(){const e=this.map.getCenter();return{lat:e.lat,lon:e.lng}}setCenter(e){this.map.setView({lat:e.lat,lng:e.lon},this.getZoom())}getBounds(){const e=this.map.getBounds();return{north:e.getNorth(),west:e.getWest(),south:e.getSouth(),east:e.getEast()}}getZoom(){return this.map.getZoom()-1}setZoom(e){this.map.setZoom(e+1)}getBearing(){return 0}getPitch(){return 0}getFov(){return Id}setProjection(e){e!==Ue?super.setProjection(Be):console.warn("[MapsGL] Globe projection is not supported in Leaflet")}redraw(){this.needsRedraw=!0}add(e,t){super.add(e,t);const i=new nu(e);i.renderLoop=this._loop,this._glLayers.set(e.id,i),i.onAdd(this.map,this.context.gl)}remove(e){e.onRemove();const t=this._glLayers.get(e.id);t&&(t.onRemove(this.map,this.context.gl),this._glLayers.delete(t.id),this.redraw())}getViewportState(){const e=super.getViewportState();return e.id="leaflet",e}invalidateMapSize(){this.map.invalidateSize(!0),this._resize()}_resize(){const e=this.map.getSize(),t=this.context.canvas,i=this.context.dpr;t.width/i===e.x&&t.height/i===e.y||this.context.resize(e.x,e.y),this._resetCanvas()}_tick(e){super._tick(e);const t=this.context,i=t.gl;this._isMoving&&!this._isZooming?this._moveCanvas():!this._isZooming&&this._canvasNeedsReset()&&this._resetCanvas(),(this.needsRedraw||this.store.layer.orderedLayers().some((e=>e.isDirty)))&&(t.state.setBlendFunc(i.ONE,i.ONE_MINUS_SRC_ALPHA),this.store.layer.each((t=>{t.prerender(e)})),t.state.bindFramebuffer({buffer:null}),t.state.setViewport(this.context.resolution.width,this.context.resolution.height),t.state.setClearColor(new _r(0,0,0,0)),t.state.clear(!0),this.store.layer.each((t=>{!1===t.isLayerMask&&t.render(e)})),t.bindVertexArray(null),t.state.setBlendFunc(i.ONE,i.ZERO))}setupEvents(e){super.setupEvents(e),this.on(Ja,(()=>{this.setNeedsViewportUpdate(),this.updateViewport()})),this.on(es,(()=>{this._isMoving=!0})),this.on(ts,(()=>{this._isMoving=!1})),this.on("zoom:start",(()=>{this._isZooming=!0})),this.on("zoom:end",(()=>{this._isZooming=!1,this._resetCanvas()})),this.on("fullscreenchange",(()=>{this.map.invalidateSize(!0),setTimeout((()=>{this._resetCanvas()}),300)}))}dataForMapEvent(e,t){if(!t)return;let i;switch(e){case"click":case"dblclick":case"mousemove":i={coord:{lat:t.latlng.lat,lon:t.latlng.lng},point:{x:t.containerPoint.x,y:t.containerPoint.y}}}return i}_moveCanvas(){const e=this.map.containerPointToLayerPoint([0,0]);this._transformCanvas({x:e.x,y:e.y})}_resetCanvas(){const e=this.map.containerPointToLayerPoint([0,0]);this._transformCanvas({x:e.x,y:e.y}),this._canvasTransform={x:0,y:0,scale:1},this.setNeedsViewportUpdate(),this.updateViewport()}_transformCanvas(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const i=this.context.canvas;let r=`translate(${(e=e||{x:0,y:0}).x}px, ${e.y}px)`;r+=` scale(${t})`,this._canvasTransform={x:e.x,y:e.y,scale:t},i&&(i.style.transform=r)}_animateZoom(e){const t=this.map,i=t.getZoomScale(e.zoom,t.getZoom()),r=this._unclampedLatLngBoundsToNewLayerBounds(t.getBounds(),e.zoom,e.center).min;this._transformCanvas(r,i)}_animateZoomNoLayer(e){const t=this.map,i=t.getZoomScale(e.zoom,t.getZoom()),r=t._getCenterOffset(e.center).multiplyBy(-i).subtract(t._getMapPanePos());this._transformCanvas(r,i)}_unclampedProject(e,t,i){var r;const{crs:a}=this.map.options,{R:s}=a.projection,n=Math.sin(t*(Math.PI/180)),o=new L.Point(s*(e*(Math.PI/180)),s*Math.log((1+n)/(1-n))/2),l=null!==(r=a.scale(i))&&void 0!==r?r:0;return a.transformation._transform(o,l)}_unclampedLatLngBoundsToNewLayerBounds(e,t,i){const r=this.map._getNewPixelOrigin(i,t),a=e.getNorth(),s=e.getSouth(),n=e.getWest(),o=e.getEast();return new L.Bounds([this._unclampedProject(n,s,t).subtract(r),this._unclampedProject(n,a,t).subtract(r),this._unclampedProject(o,s,t).subtract(r),this._unclampedProject(o,a,t).subtract(r)])}_canvasNeedsReset(){const e=this._canvasTransform;return 0!==e.x||0!==e.y||1!==e.scale}dispose(e){Object.keys(this._mapEventHandlers).forEach((e=>{this.map.off(e,this._mapEventHandlers[e])})),this._loop.stop(),super.dispose(e)}},lu=("undefined"!=typeof navigator&&/iphone|ipad|ipod|android/i.test(navigator.userAgent),"undefined"!=typeof window&&window.matchMedia("(max-width: 767px)"),!("object"==typeof process&&"[object process]"===String(process)&&!process.browser)&&"undefined"!=typeof document);let hu=lu&&"complete"===document.readyState;lu?new Promise(((e,t)=>{hu?e(document):window.addEventListener("load",(()=>{hu=!0,e(document)}))})):Promise.resolve({});var cu,du=function(e,t,i,r){if("a"===i&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?r:"a"===i?r.call(e):r?r.value:t.get(e)};cu=new WeakMap;const uu=class{constructor(e){cu.set(this,void 0),this.id=e.id,this.glLayer=e}onAdd(e,t){this.glLayer.onAdd(this.glLayer.map.context);const i=this.glLayer;(function(e,t,i,r,a){if("function"==typeof t||!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");t.set(e,i)})(this,cu,{zoom_changed:i.onZoom.bind(i),click:i.onClick.bind(i),mousemove:i.onMouseMove.bind(i),resize:i.onResize.bind(i)}),Object.keys(du(this,cu,"f")).forEach((t=>{e.addListener(t,du(this,cu,"f")[t])}))}onRemove(e,t){this.renderLoop=void 0,this.glLayer.onRemove(),e&&du(this,cu,"f")&&Object.keys(du(this,cu,"f")).forEach((e=>{}))}prerender(e,t){var i;this.glLayer.prerender(null===(i=this.renderLoop)||void 0===i?void 0:i.elapsedTime)}render(e){var t;!0!==this.glLayer.isLayerMask&&this.glLayer.render(null===(t=this.renderLoop)||void 0===t?void 0:t.elapsedTime)}},pu=85.05113,fu=e=>{const t=e.getDiv().firstChild;return{width:t.offsetWidth,height:t.offsetHeight}},mu=(e,t)=>{const i=t?e/t:1;return(new Ts).perspective((0,ke.p)(25),i,.75,3e14)},gu=(e,t,i)=>{const r=new google.maps.Point(t,i),a=e.fromContainerPixelToLatLng(r);return[a.lng(),a.lat()]};function vu(){}const yu=class extends N.A{constructor(e,t){super(),this._triggerContextEvent=!0,this._needsRedraw=!1,this._elapsedTime=0,this.controller=e,this.options=Object.freeze(t),this.setMap(e.map)}getViewCenter(){var e;return null===(e=this._viewState)||void 0===e?void 0:e.center}getViewZoom(){var e;return null===(e=this._viewState)||void 0===e?void 0:e.zoom}getViewBounds(){var e;const t=null===(e=this._dummyOverlay)||void 0===e?void 0:e.getProjection();if(t){const e=this.controller.map,i=e.getBounds(),r=null==i?void 0:i.getNorthEast(),a=null==i?void 0:i.getSouthWest(),s=e.getDiv().firstChild,n=e.getCenter(),o=t.getWorldWidth(),l=s.clientWidth/o*360;return{north:null==r?void 0:r.lat(),west:n.lng()-l/2,south:null==a?void 0:a.lat(),east:n.lng()+l/2}}return null}setMap(e){var t;if(e!==this._map&&(this._map&&(null===(t=this._overlay)||void 0===t||t.setMap(null),this._map=null),e)){this._map=e;const{UNINITIALIZED:t}=google.maps.RenderingType;e.getRenderingType()===t?e.addListener("renderingtype_changed",(()=>{this._createOverlay(e)})):this._createOverlay(e)}}redraw(){this._overlay instanceof google.maps.WebGLOverlayView?this._overlay.requestRedraw():this._needsRedraw=!0}onAdd(){const e=this.controller.map;if(this._overlay instanceof google.maps.OverlayView){const e=this._overlay.getPanes(),t=document.createElement("div");t.style.position="absolute",t.append(this.controller.context.canvas),this._overlayContainer=t,e.overlayLayer.append(this._overlayContainer)}else!1===this.options.interleaved&&this._mapContext&&this._mapContext.canvas.parentElement.append(this.controller.context.canvas);setTimeout((()=>{const t=e.getZoom();e.setZoom(t+.01),setTimeout((()=>e.setZoom(t)),1)}),1)}onContextRestored(e){const{gl:t}=e,i=this.controller;this._mapContext=t,i.context||(i.context=new tu(t.canvas,{context:t}),i.context.dpr=Math.min(2,Oe(t)),i.context.on("resize",(()=>{this._lastContextSize=i.context.resolution,this.onResize()})),this._lastContextSize=i.context.resolution);const{width:r,height:a}=t.canvas;t.viewport(0,0,r,a)}onStateUpdate(e){}onContextLost(){console.warn("[MapsGL] Google Maps context lost")}onRemove(){}onResize(){this._overlay instanceof google.maps.WebGLOverlayView?this._overlay.requestRedraw():this._onDrawRaster()}tick(e){if(this._elapsedTime=e,this.controller.context&&this.controller.map){if(!this.options.interleaved)return this._redraw(this.controller.context.gl),void(this._needsRedraw=!1);this.controller.layers.forEach((e=>{if(e.renderer instanceof xh){const t=e.renderer.passes.getPass("update-particles");t&&(t.enabled=!0),e.prerender(),t&&(t.enabled=!1)}})),this.controller.context.resetState()}}_createOverlay(e){const{VECTOR:t,UNINITIALIZED:i}=google.maps.RenderingType,r=e.getRenderingType();if(r===i)return;const a=new(r===t&&google.maps.WebGLOverlayView?google.maps.WebGLOverlayView:google.maps.OverlayView);google.maps.WebGLOverlayView&&a instanceof google.maps.WebGLOverlayView?(this.options.interleaved?(a.onContextRestored=this.onContextRestored.bind(this),a.onStateUpdate=this.onStateUpdate.bind(this),a.onDraw=this._onDrawVectorInterleaved.bind(this)):(a.onContextRestored=vu,a.onStateUpdate=this.onStateUpdate.bind(this),a.onDraw=this._onDrawVectorOverlay.bind(this)),a.onContextLost=this.onContextLost.bind(this)):a instanceof google.maps.OverlayView&&(a.draw=this._onDrawRaster.bind(this)),a.onAdd=this.onAdd.bind(this),a.onRemove=this.onRemove.bind(this),this._overlay=a,this._overlay.setMap(e);const s=new google.maps.OverlayView;s.onAdd=vu,s.draw=vu,s.onRemove=vu,s.setMap(e),this._dummyOverlay=s}_prepareDrawWithTransformer(e){const t=((e,t)=>{const{width:i,height:r}=fu(e),{center:a,heading:s,tilt:n,zoom:o}=t.getCameraParams(),l=mu(i,r);return{size:{width:i,height:r},viewState:{altitude:.5*l.value[5],bearing:s,center:{lat:a.lat(),lon:a.lng()},pitch:n,projectionMatrix:l,repeat:!0,zoom:o}}})(this.controller.map,e);this._prepareDraw(t)}_prepareDraw(e){const t=this.controller;this._checkContext(),this._viewState=e.viewState,t.transform.update({size:t.getSize(),center:e.viewState.center,zoom:e.viewState.zoom-1,bounds:t.getBounds(),pitch:e.viewState.pitch,bearing:e.viewState.bearing,fov:t.getFov()})}_onDrawVectorInterleaved(e){let{gl:t,transformer:i}=e;if(!this.controller.map)return;const r=this._overlay;this._prepareDrawWithTransformer(i),this._redraw(t),r.requestRedraw()}_onDrawVectorOverlay(e){let{transformer:t}=e;this.controller.map&&(this._prepareDrawWithTransformer(t),this._redraw(this.controller.context.gl))}_onDrawRaster(){if(!this.controller.map)return;const e=this._overlay;if(!e.getProjection())return;const t=this.controller,i=((e,t)=>{const{width:i,height:r}=fu(e),a=t.getProjection(),s=e.getBounds();if(!s)return{size:{width:i,height:r},position:{x:0,y:0}};const n=s.getNorthEast(),o=s.getSouthWest(),l=a.fromLatLngToDivPixel(n),h=a.fromLatLngToDivPixel(o),c=gu(a,i/2,r/2),d=new google.maps.LatLng(0,c[0]),u=a.fromLatLngToContainerPixel(d),p=a.fromLatLngToDivPixel(d);if(!(l&&h&&p&&u))return{size:{width:i,height:r},position:{x:0,y:0}};const f=Math.round(p.x-u.x);let m=p.y-u.y;const g=gu(a,i/2,0),v=gu(a,i/2,r);let y=c[1];const x=c[0];if(Math.abs(y)>pu){y=y>0?pu:-85.05113;const e=new google.maps.LatLng(y,x);m+=a.fromLatLngToContainerPixel(e).y-r/2}m=Math.round(m);const b=(new _i).fromArray(g).subtract((new _i).fromArray(v));let w=180*Math.atan2(b.x,b.y)/Math.PI;w<0&&(w+=360);const _=e.getHeading()||0;let A=e.getZoom(),M=1;if(0===w)M=r?Math.round(h.y-l.y)/r:1;else if(w===_){const e=new _i(l.x,l.y).subtract(new _i(h.x,h.y)).length(),t=new _i(i,-r).length();M=t?e/t:1}A+=Math.log2(M||1);const T=mu(i,r);return{size:{width:i,height:r},position:{x:f,y:m},viewState:{altitude:1e4,bearing:w,center:{lat:y,lon:x},pitch:e.getTilt(),projectionMatrix:T,repeat:!0,zoom:A}}})(t.map,e),{position:r}=i,a=t.context.canvas.parentElement.style;a.left=`${r.x}px`,a.top=`${r.y}px`,this._prepareDraw(i),this._redraw(t.context.gl)}_checkContext(){void 0===this._viewState&&this._triggerContextEvent&&(this._triggerContextEvent=!1,this.trigger("context:ready"))}_redraw(e){const t=this.controller.context,i=this._lastContextSize,r=t.resolution;!i||i.width===r.width&&i.height===r.height||(t.invalidateSize(),this._lastContextSize={width:r.width,height:r.height}),t.bindVertexArray(null),t.state.setBlendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA),this.controller.layers.forEach((e=>{e.prerender(this._elapsedTime)})),t.state.setViewport(t.resolution.width,t.resolution.height),t.state.bindFramebuffer({buffer:null}),this.options.interleaved||(e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT)),this.controller.layers.forEach(((e,t)=>{!1===e.isLayerMask&&e.render(this._elapsedTime)})),t.bindVertexArray(null),t.state.setBlendFunc(e.ONE,e.ZERO)}dispose(){const e=this._overlay;null==e||e.setMap(null),this._map=null,this._overlay=void 0,e instanceof google.maps.WebGLOverlayView?(e.onContextRestored=vu,e.onStateUpdate=vu,e.onDraw=vu,e.onContextLost=vu):e instanceof google.maps.OverlayView&&(e.draw=vu)}},xu=class extends qd{get container(){return this.map.getDiv()}get googleLayers(){return[...this._googleLayers.values()]}get renderLoop(){return this._loop}get libraryInfo(){return{name:"google",version:{current:Number.parseFloat(google.maps.version.replaceAll(/[^\d.]/g,"")),min:3.48}}}isVector(){return this.map.getRenderingType()===google.maps.RenderingType.VECTOR}constructor(e,t){t=(0,j.$)({interleaved:!0},t),super(e,t),this._googleLayers=new Map,this._mapEventHandlers={},this._eventState={lastZoom:0,isIdle:!0},this._loop=new Hd.A(this._tick.bind(this)),this.transform.updateOnMapViewChange=!1,this.setupEvents({load:"load",remove:"unload",resize:"resize",click:"click",dblclick:"dblclick",mousedown:"mousedown",mouseup:"mouseup",mouseover:"mouseover",mouseout:"mouseout",mousemove:"mousemove",zoomstart:"zoom:start",zoom_changed:"zoom:end",bounds_changed:"move",dragstart:"move:start",dragend:"move:end"});const i=e=>{var i;(e===r||!t.interleaved||this.libraryInfo.version.current<3.48)&&(t.interleaved=!1,this.context=new tu(void 0,{premultipliedAlpha:!0,depth:!0,antialias:!(k.safari&&k.version>=15.4),alpha:!0}),this.context.dpr=(i=this.context.gl,("undefined"==typeof window?1:window.devicePixelRatio)/(i.webkitBackingStorePixelRatio||i.mozBackingStorePixelRatio||i.msBackingStorePixelRatio||i.oBackingStorePixelRatio||i.backingStorePixelRatio||1)),this._resizeHandler=this._resize.bind(this),window.addEventListener("resize",this._resizeHandler),this._resize()),this._renderer=new yu(this,{interleaved:t.interleaved}),this._renderer.on("context:ready",(()=>{this.initialize()}))},{RASTER:r,UNINITIALIZED:a}=google.maps.RenderingType,s=e.getRenderingType();s===a?this._mapEventHandlers.renderTypeChange=e.addListener("renderingtype_changed",(()=>{i(e.getRenderingType())})):i(s)}getSize(){const e=this.map.getDiv();return z(this.container.firstChild)?{width:window.innerWidth,height:window.innerHeight}:{width:e.offsetWidth,height:e.offsetHeight}}setSize(e){this.setContainerSize(e)}getCenter(){var e;let t=null===(e=this._renderer)||void 0===e?void 0:e.getViewCenter();if(!t){const e=this.map.getCenter();t={lat:e.lat(),lon:e.lng()}}return t}setCenter(e){this.map.setCenter({lat:e.lat,lng:e.lon})}getBounds(){var e;const t=this.map.getBounds(),i=null==t?void 0:t.getNorthEast(),r=null==t?void 0:t.getSouthWest();let a=null==r?void 0:r.lng(),s=null==i?void 0:i.lng();a>s&&(a-=360);const n=null===(e=this._renderer)||void 0===e?void 0:e.getViewBounds();return n&&(a=n.west,s=n.east),{north:null==i?void 0:i.lat(),west:a,south:null==r?void 0:r.lat(),east:s}}getZoom(){var e;let t=null===(e=this._renderer)||void 0===e?void 0:e.getViewZoom();return("number"!=typeof t||Number.isNaN(t))&&(t=this.map.getZoom()),t-1}setZoom(e){this.map.setZoom(e+1)}getBearing(){return this.map.getHeading()||0}getPitch(){return this.map.getTilt()||0}getFov(){return 25}setProjection(e){e!==Ue?super.setProjection(Be):console.warn("[MapsGL] Globe projection is not supported in Google Maps")}redraw(){var e;null===(e=this._renderer)||void 0===e||e.redraw()}add(e,t){if(super.add(e,t),this._googleLayers.get(e.id))console.warn(`[MapsGL] A WebGLLayer with id {${e.id}} already exists on the map`);else{const t=new uu(e);t.renderLoop=this._loop,t.onAdd(this.map,this.context.gl),this._googleLayers.set(e.id,t),this._loop.start()}}remove(e){super.remove(e),e.onRemove();const t=this._googleLayers.get(e.id);this.map&&t&&(t.onRemove(this.map,this.context.gl),this._googleLayers.delete(e.id)),0===this._googleLayers.size&&(this._tick(this._loop.elapsedTime),this._loop.stop())}getViewportState(){const e=super.getViewportState();return e.id="google",e}invalidateMapSize(){this._resize()}_resize(){var e;if(!this.context)return;const t=this.getSize(),i=this.context.dpr,r=this.context.canvas;t.width===r.width/i&&t.height===r.height/i||(this.context.resize(t.width,t.height),null===(e=this._renderer)||void 0===e||e.onResize())}_tick(e){var t;super._tick(e),this.setNeedsViewportUpdate(),this.updateViewport(),null===(t=this._renderer)||void 0===t||t.tick(e)}_onIdle(){this._eventState.isIdle||(this.trigger("move:end"),this.layers.forEach((e=>{e.onMove(),e.onMoveEnd()}))),this._eventState.isIdle=!0}_onMove(){this._eventState.isIdle&&(this.trigger("move:start"),this.layers.forEach((e=>e.onMoveStart()))),this.trigger("move"),this.layers.forEach((e=>e.onMove())),this._eventState.isIdle=!1}setupEvents(e){super.setupEvents(e),this._mapEventHandlers.onMove=this.map.addListener("bounds_changed",this._onMove.bind(this)),this._mapEventHandlers.onIdle=this.map.addListener("idle",this._onIdle.bind(this)),this.isVector||this.on("fullscreenchange",this._resize.bind(this))}dataForMapEvent(e,t){if(!t)return;let i,r=t.pixel;switch(!r&&t.domEvent&&(r={x:t.domEvent.screenX,y:t.domEvent.screenY}),e){case"click":case"dblclick":case"mousemove":i={target:this,originalEvent:t,coord:{lat:t.latLng.lat(),lon:t.latLng.lng()},point:r}}return i}dispose(e){this._loop.stop(),this._renderer.dispose(),Object.keys(this._mapEventHandlers).forEach((e=>{google.maps.event.removeListener(this._mapEventHandlers[e])})),window.removeEventListener("resize",this._resizeHandler),super.dispose(e)}},bu=`${i(8330).version}`,wu={datasets:{},colorscales:Object.assign({},C),getColorScaleNames:F.WY,getColorScale:F.yw},_u={browser:k},Au={getWeatherSourceSpec:function(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};console.warn("`getWeatherSourceSpec` is deprecated and will be removed in a future release. Use `MapController#weatherProvider.getWeatherLayerConfig` instead");const r=new sr(t).getWeatherLayerConfig(e,i);if(!1===Array.isArray(r))return r.source},getWeatherLayerConfig:function(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return console.warn("`getWeatherLayerConfig` is deprecated and will be removed in a future release. Use `MapController#weatherProvider.getWeatherLayerConfig` instead"),new sr(t).getWeatherLayerConfig(e,i)},getWeatherLayerAlias:e=>(console.warn("`getWeatherLayerAlias` is deprecated and will be removed in a future release. Use `MapController#weatherProvider.getLayerAlias` instead"),new sr(new de("null","null")).getLayerAlias(e))},Mu=Object.assign({},O)},4918:(e,t,i)=>{i.d(t,{A:()=>A});const r=.95047,a=1.08883,s=.137931034,n=.12841855,o=e=>{const{x:t,y:i,z:r}=c(e),a=116*i-16;return{l:a<0?0:a,a:500*(t-i),b:200*(i-r)}},l=e=>(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4),h=e=>e>.008856452?Math.pow(e,1/3):e/n+s,c=e=>{let{r:t,g:i,b:s}=e;return t=l(t),i=l(i),s=l(s),{x:h((.4124564*t+.3575761*i+.1804375*s)/r),y:h((.2126729*t+.7151522*i+.072175*s)/1),z:h((.0193339*t+.119192*i+.9503041*s)/a)}},d=e=>255*(e<=.00304?12.92*e:1.055*Math.pow(e,1/2.4)-.055),u=e=>e>.206896552?e*e*e:n*(e-s);var p,f=i(681),m=i(7411),g=i(2527),v=i(6476),y=i(6232),x=i(9369),b=i(8854);const w={rgb:(e,t,i,r)=>({r:e.r+(t.r-e.r)*i,g:e.g+(t.g-e.g)*i,b:e.b+(t.b-e.b)*i,a:e.a+(t.a-e.a)*i}),lrgb:(e,t,i,r)=>({r:Math.sqrt(Math.pow(e.r,2)*(1-i)+Math.pow(t.r,2)*i),g:Math.sqrt(Math.pow(e.g,2)*(1-i)+Math.pow(t.g,2)*i),b:Math.sqrt(Math.pow(e.b,2)*(1-i)+Math.pow(t.b,2)*i),a:e.a+(t.a-e.a)*i}),lab:(e,t,i,s)=>{const n=o(e),l=o(t);return((e,t=1)=>{const{l:i,a:s,b:n}=e;let o,l,h;return l=(i+16)/116,o=Number.isNaN(s)?l:l+s/500,h=Number.isNaN(n)?l:l-n/200,l=1*u(l),o=r*u(o),h=a*u(h),{r:d(3.2404542*o-1.5371385*l-.4985314*h),g:d(-.969266*o+1.8760108*l+.041556*h),b:d(.0556434*o-.2040259*l+1.0572252*h),a:t}})({l:n.l+(l.l-n.l)*i,a:n.a+(l.a-n.a)*i,b:n.b+(l.b-n.b)*i},e.a+(t.a-e.a)*i)},hsl:(e,t,i,r)=>{}};class _{get colors(){return this._colors}get domain(){return this._domain}get positions(){return this._pos}get breaks(){return this._breaks}get range(){return Object.assign({},this._range)}constructor(e=[]){p.add(this),this.mode="rgb",this._range={min:0,max:1},this._domain=[0,1],this._colors=[],this._pos=[],this._cache=new Map,this._correctLightness=!1,this.setColors(e)}setColors(e){if(e=(null==e?void 0:e.length)?[...e]:["#fff","#000"],this._pos.length>0&&e.length!==this._pos.length)throw new Error(`[MapsGL] Invalid color length for color scale ${e.length}, must match current positions ${this._pos.length}`);if(Array.isArray(e)){1===e.length&&(e=[e[0],e[0]]);const t=(e=e.splice(0)).map((e=>(0,f.$)(e)));this._pos=t.map(((e,i)=>i/(t.length-1))),this._colors=t}}setDomain(e){if(!1===Array.isArray(e))throw new TypeError("invalid domain");if(this._range=Object.freeze({min:e[0],max:e.at(-1)}),this._domain=[...e],2===e.length)this._pos=this._colors.map(((e,t)=>t/(this._colors.length-1)));else{if(e.length!==this._colors.length)throw new Error(`[MapsGL] Invalid color scale domain ${e}`);this._pos=e.map((e=>(0,b.Fp)(this._range.min,this._range.max,e)))}}setBreaks(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"e";if(Array.isArray(e))this._breaks=e,this._range={min:e[0],max:e.at(-1)};else{if(e%1!=0||e<1)throw new Error(`[MapsGL] Invalid color scale breaks param ${e}`);this._breaks=(0,b.Fy)(this._domain,t,e)}this._cache.clear()}setPositions(e){if(e.length!==this._colors.length)throw new Error(`[MapsGL] Invalid position length for color scale, total positions (${e.length}) must match total colors (${this._colors.length})`);this._pos=[...e],this._cache.clear()}getColors(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:x.G.linear;var i;let r=[];if(1===e)r=[this.getColor(.5)];else if(e>1){const i=this._range.min,a=this._range.max;r=Array.from({length:e},((r,s)=>{const n=t(s/(e-1));return this.getColor((0,m.C)(i,a,n))}))}else r=((null===(i=this._breaks)||void 0===i?void 0:i.length)>2?this._breaks:this._domain).map((e=>this.getColor(e)));return r}getColor(e){let t,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t=i?e:this.getPosition(e,i),t=(0,g.q)(t,0,1);const r=t,a=this._cache&&this._cache.get(r);if(a)return a;let s;for(let e=0;e<this._pos.length;e++){const i=this._pos[e];if(t<=i){s=this._colors[e];break}if(t>=i&&e===this._pos.length-1){s=this._colors[e];break}if(t>i&&t<this._pos[e+1]){s=w[n=this.mode](this._colors[e],this._colors[e+1],(t-i)/(this._pos[e+1]-i),n);break}}var n;return s&&(s.r=Math.floor(s.r),s.g=Math.floor(s.g),s.b=Math.floor(s.b),this._cache.set(r,s)),s}getColorRelative(e){return this.getColor(e,!0)}getBreak(e){if((0,v.n)(this._breaks)){if(e>this._breaks.at(-1))return this._breaks.length-1;const t=this._breaks.indexOf(e);return t>-1?t:this._breaks.findIndex((t=>e<=t))-1}return 0}getPosition(e){const t=this._range.min,i=this._range.max;let r=e;if(arguments.length>1&&void 0!==arguments[1]&&arguments[1])r=e;else if(this._breaks&&this._breaks.length>2){const t=this.getBreak(e);r=this._breaks[t]}else i===t&&(r=i);r=(0,g.q)(r,t,i);let a=0;for(let e=0;e<this._domain.length;e++){const t=this._domain[e];if(r<=t){a=this._pos[e];break}if(r>=t&&e===this._domain.length-1){a=this._pos[e];break}if(r>t&&r<this._domain[e+1]){a=(0,m.C)(this._pos[e],this._pos[e+1],(r-t)/(this._domain[e+1]-t));break}}return a}scale(e,t){const i=this._domain.map((i=>(0,m.C)(e,t,(0,b.Fp)(this.range.min,this.range.max,i))));this.setDomain(i)}correctLightness(e){this._correctLightness=e}clone(){const e=new _(this.colors);return e.setDomain(this.domain),this._breaks&&e.setBreaks([...this.breaks]),e.setPositions([...this._pos]),e}getRamp(e){var t,i,r;const a=null==e?void 0:e.totalColors,s=null!==(t=null==e?void 0:e.easing)&&void 0!==t?t:x.G.linear,n=null!==(i=null==e?void 0:e.interval)&&void 0!==i?i:0,o=null===(r=null==e?void 0:e.interpolate)||void 0===r||r,l=null==e?void 0:e.range,h=this.clone(),{min:c,max:d}=null!=l?l:h.range,u=[];let p=[];if(!1===o)p=this.domain;else if(n>0||(0,y.Z)(null==e?void 0:e.breaks)){if((0,y.Z)(null==e?void 0:e.breaks))p=e.breaks;else{let e=(0,b.SG)(c,n,!0);for(c<e&&p.push(c);e<=d;)p.push(e),e+=n;p.at(-1)<d&&p.push(d)}p=p.map((e=>(0,b.SG)(e,.001)))}if(p.length>0&&h.setBreaks(p),a>1)for(let e=0;e<a;e++){const t=e/(a-1),i=p.length>0?t:s(t),r=(0,m.C)(c,d,i),n=h.getColor(r);u.push({value:r,color:n,position:t})}else(p.length>2?h.breaks:h.domain).forEach((e=>{u.push({value:e,color:h.getColor(e),position:h.getPosition(e)})}));return{stops:u.filter((e=>e.value>=c&&e.value<=d)),getValue:e=>{const t=s(e);return(0,m.C)(c,d,t)},getPosition:e=>this.getPosition(e)}}}p=new WeakSet;const A=_},8464:(e,t,i)=>{i.d(t,{R7:()=>d,WY:()=>h,yw:()=>c});var r=i(6232),a=i(6476),s=i(7411),n=i(4918),o=i(8854);const l=Object.assign(Object.assign({},{Viridis:["#440154","#482777","#3f4a8a","#31678e","#26838f","#1f9d8a","#6cce5a","#b6de2b","#fee825"],Inferno:["#000004","#160b39","#420a68","#6a176e","#932667","#ba3655","#ec6149","#f0882c","#f6a625"],Plasma:["#0d0887","#46039f","#7201a8","#9c179e","#bd3786","#d8576b","#ed7953","#fb9f3a","#fdca26"],Magma:["#000004","#1b0c41","#4a0c6b","#781c6d","#a52c60","#cf4446","#f1642e","#fca636","#f0f921"],Cividis:["#002350","#193B6E","#50566C","#787877","#A29A76","#D6C363","#FFE945"],Mako:["#12070B","#352446","#414283","#3579A3","#36A6AC","#79D5AF","#DBF4E3"],Rocket:["#06061C","#3D1942","#771F59","#C71F51","#EE5740","#F7A67C","#FAE9D9"],Turbo:["#331646","#4682F8","#1BD6CB","#86FA4F","#F6C339","#E74C0C","#881001"]}),{OrRd:["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#b30000","#7f0000"],PuBu:["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#045a8d","#023858"],BuPu:["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#810f7c","#4d004b"],Oranges:["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"],BuGn:["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#006d2c","#00441b"],YlOrBr:["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#993404","#662506"],YlGn:["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"],Reds:["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"],RdPu:["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177","#49006a"],Greens:["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"],YlGnBu:["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"],Purples:["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"],GnBu:["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"],Greys:["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"],YlOrRd:["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#bd0026","#800026"],PuRd:["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#980043","#67001f"],Blues:["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"],PuBuGn:["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016c59","#014636"],Spectral:["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],RdYlGn:["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"],RdBu:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"],PiYG:["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],PRGn:["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],RdYlBu:["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],BrBG:["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],RdGy:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"],PuOr:["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"],Set2:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494","#b3b3b3"],Accent:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17","#666666"],Set1:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999"],Set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],Dark2:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d","#666666"],Paired:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99","#b15928"],Pastel2:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc","#cccccc"],Pastel1:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec","#f2f2f2"],Rainbow:["#800026","#e31a1c","#fd8d3c","#feb24c","#fed976","#ffeda0","#ffffcc","#ffffe5"],Sinebow:["#0000ff","#00ff00","#ff0000","#ff00ff","#0000ff"],White:["#ffffff","#ffffff"],Black:["#000000","#000000"]}),h=()=>Object.keys(l),c=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const a=(e=>l[e])(e);if((0,r.E)(a))throw new Error(`[MapsGL] Invalid colorscale name: ${e}`);const s=[...t,...a],n=i?1e-6:0,o=(1-n)/(s.length-1),h=[];i&&h.push(0,"rgba(0, 0, 0, 0)");for(let e=0;e<s.length;e++)h.push(n+e*o,s[e]);return{stops:h,normalized:!0}},d=function(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const r=[],l=[],h=e.reduce(((e,t,i)=>(i%2==0&&e.push(Number.parseFloat(t.toString())),e)),[]),c=e.reduce(((e,t,i)=>(i%2==1&&e.push(`${t}`.replaceAll(/^\s+|\s+$/g,"")),e)),[]),d=(0,a.n)(null==t?void 0:t.min)?t.min:Number.NEGATIVE_INFINITY,u=(0,a.n)(null==t?void 0:t.max)?t.max:Number.POSITIVE_INFINITY,p=(e,t)=>{r.push(`${t}`.replaceAll(/^\s+|\s+$/g,"")),l.push(e)};if(d!==Number.NEGATIVE_INFINITY&&!h.includes(d)){let e;for(let t=0,i=h.length;t<i;t+=1)h[t]<d&&(e=c[t]);(0,a.n)(e)&&p(d,e)}let f,m;for(let t=0,r=e.length;t<r;t+=2)f=e[t],m=`${e[t+1]}`.replaceAll(/^\s+|\s+$/g,""),i&&(f=(0,s.C)(d,u,f)),f<d||f>u||((0,o.zW)(f,d)||(0,o.zW)(f,u)||f>=d&&f<=u)&&p(f,m);f<u&&u!==Number.POSITIVE_INFINITY&&p(u,r.at(-1));const g=new n.A(r);return g.setDomain(l),g}},2291:(e,t,i)=>{i.d(t,{j:()=>r});const r={count:0,minimal:8,low:24,normal:48,high:76,extreme:128}},9147:(e,t,i)=>{i.d(t,{BG:()=>n,lX:()=>r,o3:()=>a,uN:()=>s});const r=["r","g","b","a","rg","gb","rb","ra","ga","ba","rgb","gba","rgba"],a=["r","g","b","a"],s={none:"none",bilinear:"bilinear",bicubic:"bicubic",biquadratic:"biquadratic"},n={number:"number",vector:"vector",sum:"sum",difference:"diff",angle:"angle",custom:"custom"}},5661:(e,t,i)=>{i.d(t,{$:()=>a,p:()=>r});const r={Bevel:"bevel",Round:"round",Miter:"miter"},a={Butt:"butt",Round:"round",Square:"square"}},6219:(e,t,i)=>{i.d(t,{E:()=>a,m:()=>r});const r={raster:"raster",circle:"circle",fill:"fill",line:"line",sample:"sample",grid:"grid",heatmap:"heatmap",contour:"contour",particle:"particle",particles:"particles",symbol:"symbol",text:"text",query:"query",voronoi:"voronoi",data:"data",debug:"debug"},a={exact:"exact",high:"high",medium:"medium",normal:"normal",low:"low",minimal:"minimal"}},8708:(e,t,i)=>{i.d(t,{Fu:()=>r,e1:()=>a});const r={affects:"affects",all:":all",closest:"closest",contains:"contains",id:":id",route:"route",search:"search",within:"within"},a={image:"image",tile:"tile"}},4229:(e,t,i)=>{i.d(t,{V:()=>r,o:()=>a});const r={point:"point",line:"line",polygon:"polygon",symbol:"symbol"},a={raster:"raster",vector:"vector",geojson:"geojson",encoded:"encoded",debug:"debug"}},8937:(e,t,i)=>{i.d(t,{AF:()=>a,AI:()=>s,Ay:()=>n});class r{constructor(e){this.image=e}dispose(){var e;null===(e=this.texture)||void 0===e||e.dispose(),this.texture=void 0}}class a extends r{}class s extends r{}const n=r},9037:(e,t,i)=>{i.d(t,{A:()=>n,d:()=>s});var r=i(3564),a=i(1379);const s=2,n=class{get width(){return this.dimension+2*this.padding}get height(){return this.dimension+2*this.padding}constructor(e,t,i=0){this.stride=4,this.padding=0,this._backfilledEdges=new Set,this.padding=i,this.dimension=t;const r=Math.sqrt(e.length/this.stride),s=t+2*i;if(i>0&&r===t){const t={width:r,height:r,data:e},n=(0,a.mF)({width:s,height:s},this.stride);(0,a.L1)(t,n,0,0,i,i,{width:r,height:r}),(0,a.L1)(t,n,0,0,0,i,{width:i,height:r}),(0,a.L1)(t,n,r-i,0,i+r,i,{width:i,height:r}),(0,a.L1)(t,n,0,0,i,0,{width:r,height:i}),(0,a.L1)(t,n,0,r-i,i,i+r,{width:r,height:i}),(0,a.L1)(t,n,0,0,0,0,{width:i,height:i}),(0,a.L1)(t,n,r-i,0,i+r,0,{width:i,height:i}),(0,a.L1)(t,n,0,r-i,0,i+r,{width:i,height:i}),(0,a.L1)(t,n,r-i,r-i,i+r,i+r,{width:i,height:i}),this.rawData=n.data}else this.rawData=e}get(e,t){const i=this.rawData,r=this._idx(e,t);return{r:i[r],g:i[r+1],b:i[r+2],a:i[r+3]}}backfillEdge(e,t,i){(0,r.vA)(e.dimension===this.dimension,`EncodedData mismatch - neighbor data must have the same dimension as instance data, ${this.dimension} does not equal ${e.dimension}`);const s=`${t},${i}`;if(this._backfilledEdges.has(s))return;const n=this.padding,o=this.dimension+2*n;this._backfilledEdges.add(s);let l=n,h=n,c=n,d=n,u=n,p=n;const f=o-n;-1===t?(l=f-n,c=0):1===t&&(c=f),-1===i?(h=f-n,d=0):1===i&&(d=f),0===t&&(u=o-2*n),0===i&&(p=o-2*n),(0,a.L1)({width:o,height:o,data:e.rawData},{width:o,height:o,data:this.rawData},l,h,c,d,{width:u,height:p}),this._backfilledEdges.add(s)}_idx(e,t){if(e<-1||e>=this.dimension+1||t<-1||t>=this.dimension+1)throw new RangeError("[MapsGL] Out of range source coordinates for image bitmap");return 4*(t*(this.dimension+2*this.padding)+e)}}},2208:(e,t,i)=>{i.d(t,{GG:()=>g,Or:()=>u,VI:()=>m,Yq:()=>f,ay:()=>d,y$:()=>p});var r=i(2133),a=i(8377),s=i(9688),n=i(6476);const o={second:1,minute:60,hour:3600,day:86400,week:604800,month:2592e3,year:31536e3},l={a:e=>e.getHours()<12?"am":"pm",yyyy:e=>`${e.getFullYear()}`,MMM:e=>`${e.toLocaleString("default",{month:"short"})}`,MM:e=>`${e.getMonth()+1}`.padStart(2,"0"),M:e=>`${e.getMonth()+1}`,dd:e=>`${e.getDate()}`.padStart(2,"0"),d:e=>`${e.getDate()}`,H:e=>`${e.getHours()>12?e.getHours()-12:e.getHours()}`,HH:e=>`${e.getHours()>12?e.getHours()-12:e.getHours()}`.padStart(2,"0"),hh:e=>`${e.getHours()}`.padStart(2,"0"),h:e=>`${e.getHours()}`,mm:e=>`${e.getMinutes()}`.padStart(2,"0")},h=e=>new Date(e.getTime()+60*e.getTimezoneOffset()*1e3),c=/^\d{4}-(?:0[1-9]|1[0-2])-(?:[0-2][1-9]|[1-3]0|3[01])T(?:[01]\d|2[0-3])(?::[0-6]\d){1,2}(?:\.\d{3})?(?:[+-][0-2]\d:[0-5]\d|Z)?$/,d=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if((0,r.K)(e)&&c.test(e))return(e=>{const t=e.split(/\D+/),i=e.includes("+")?-1:1;return new Date(Date.UTC(+t[0],+t[1]-1,+t[2],+t[3]+i*(+t[7]||0),+t[4]+i*(+t[8]||0),+t[5],+t[6]||0))})(e);if((0,r.K)(e)||(0,a.E)(e)){const i=new Date(e);return t?h(i):i}return(0,s.$)(e)?e:null},u=function(){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],t=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const i=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).map((t=>d(t,e)));return t?i.sort(((e,t)=>e.getTime()<t.getTime()?-1:1)).filter(Boolean):i.filter(Boolean)},p=(e,t,i,r)=>{if((0,n.g)(t)||(0,n.g)(i))return[];const a=e.filter((e=>e>=t&&e<=i));if(a.length<=r)return a;const s=a.length/(r-1),o=[];for(let e=0;e<r;e++){const t=Math.min(Math.floor(e*s),a.length-1);o.push(a[t])}return o},f=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=e;if(t.endsWith("iso"))return i.toISOString();if(t.startsWith("utc:")&&(i=h(e),t=t.replace(/^utc:/,"")),"epoch"===t)return`${i.getTime()}`;const r=t.match(/^format\[([\w ,/:-]+)]/g);if(r&&r.length>0){let e=r[0].replace(/^format\[/,"").replace(/]$/,"");const a=[];let s=t;return Object.keys(l).forEach((e=>{s.includes(e)&&(a.push(e),s=s.replaceAll(e,""))})),a.forEach((t=>{const r=l[t];e=e.replace(new RegExp(t),r(i))})),e}return e.toString()},m=(e,t)=>{if("now"===t)return e;const i=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=0;if((0,a.E)(e))return t;const i=e.match(/[\d.-]+\s*\w+/g);return i&&i.length>0&&i.forEach((e=>{const i=e.match(/^([\d.-]+)\s*(\w+)$/);if(i&&i.length>=3){const e=Number.parseFloat(i[1]),r=(i[2]||"").replace(/s$/,"");t+=e*(o[r]||0)}})),t}(t),r=e.getTime()+1e3*i;return new Date(r)},g=function(e){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?e.toISOString().replace("+","%2B"):e.toISOString()}},9369:(e,t,i)=>{i.d(t,{A:()=>a,G:()=>r});const r={linear:e=>e,quadratic:e=>e*(-e*e*e+4*e*e-6*e+4),cubic:e=>e*(4*e*e-9*e+6),elastic:e=>e*(33*e*e*e*e-106*e*e*e+126*e*e-67*e+15),inQuad:e=>e*e,outQuad:e=>e*(2-e),inOutQuad:e=>e<.5?2*e*e:(4-2*e)*e-1,inCubic:e=>e*e*e,outCubic:e=>--e*e*e+1,inOutCubic:e=>e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1,inQuart:e=>e*e*e*e,outQuart:e=>1- --e*e*e*e,inOutQuart:e=>e<.5?8*e*e*e*e:1-8*--e*e*e*e,inQuint:e=>e*e*e*e*e,outQuint:e=>1+--e*e*e*e*e,inOutQuint:e=>e<.5?16*e*e*e*e*e:1+16*--e*e*e*e*e,inSine:e=>1-Math.cos(e*(Math.PI/2)),outSine:e=>Math.sin(e*(Math.PI/2)),inOutSine:e=>-(Math.cos(Math.PI*e)-1)/2,inExpo:e=>Math.pow(2,10*(e-1)),outExpo:e=>1-Math.pow(2,-10*e),inOutExpo:e=>(e/=.5)<1?Math.pow(2,10*(e-1))/2:(e--,(2-Math.pow(2,-10*e))/2),inCirc:e=>1-Math.sqrt(1-e*e),outCirc:e=>Math.sqrt(1-(e-=1)*e),inOutCirc:e=>(e/=.5)<1?-(Math.sqrt(1-e*e)-1)/2:(e-=2,(Math.sqrt(1-e*e)+1)/2),inSquare:e=>Math.pow(e,2),outSquare:e=>1-Math.pow(1-e,2),inOutSquare:e=>e<.5?2*e*e:(4-2*e)*e-1,inSqrt:e=>1-Math.pow(1-e,.5),outSqrt:e=>Math.pow(e,.5),inOutSqrt:e=>e<.5?(1-Math.pow(1-2*e,.5))/2:(Math.pow(2*e-1,.5)+1)/2},a=(e,t,i,r)=>{const a=Number.isNaN;(a(e)||a(t)||a(i)||a(r))&&console.warn(`Cubic bezier need to have 4 numbers, example: "0.25, 0, 0.25, 1", and not [${e}, ${t}, ${i}, ${r}]`),(e<0||e>1||i<0||i>1)&&console.warn(`Cubic bezier can not have horizontals Number < 0 or > 1, but you have ${e} and ${i}`),e=Math.min(Math.max(e,0),1),i=Math.min(Math.max(i,0),1);const s=(e,t)=>1-3*t+3*e,n=(e,t)=>3*t-6*e,o=e=>3*e,l=(e,t,i)=>((s(t,i)*e+n(t,i))*e+o(t))*e;return a=>e===t&&i===r?a:l((t=>{let r=t;for(let d=0;d<4;++d){const d=(a=r,3*s(h=e,c=i)*a*a+2*n(h,c)*a+o(h));if(0===d)return r;r-=(l(r,e,i)-t)/d}var a,h,c;return r})(a),t,r)}},1379:(e,t,i)=>{function r(e,t,i){const{width:r,height:a}=e;if(i){if(i instanceof Uint8ClampedArray)i=new Uint8Array(i.buffer);else if(i.length!==r*a*t)throw new RangeError(`mismatched image size. expected: ${i.length} but got: ${r*a*t}`)}else i=new Uint8Array(r*a*t);return{width:r,height:a,data:i}}function a(e,t,i,r,a,s,n){let o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:4;if(0===n.width||0===n.height)return t;if(n.width>e.width||n.height>e.height||i>e.width-n.width||r>e.height-n.height)throw new RangeError("[MapsGL] Out of range source coordinates for image copy");if(n.width>t.width||n.height>t.height||a>t.width-n.width||s>t.height-n.height)throw new RangeError("[MapsGL] Out of range destination coordinates for image copy");const l=e.data,h=t.data;for(let c=0;c<n.height;c++){const d=((r+c)*e.width+i)*o,u=((s+c)*t.width+a)*o;for(let e=0;e<n.width*o;e++)h[u+e]=l[d+e]}return t}i.d(t,{L1:()=>a,mF:()=>r})},2050:(e,t,i)=>{i.d(t,{Bj:()=>o,M4:()=>c,NF:()=>n,fN:()=>u,iW:()=>d,mN:()=>h,mc:()=>f,mg:()=>l});var r=i(7318),a=i(2208);let s=1;const n=()=>s++,o=e=>{const t=new Map;return function(){for(var i=arguments.length,r=new Array(i),a=0;a<i;a++)r[a]=arguments[a];const s=r.map((e=>`${e}_${typeof e}`)).join("|");if(t.has(s))return t.get(s);const n=e(...r);return t.set(s,n),n}};function l(e){let t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new WeakMap;if(null===e||"object"!=typeof e)return e;if(i.has(e))return i.get(e);if(e instanceof Date)t=new Date(e.getTime());else if(Array.isArray(e)){t=[],i.set(e,t);for(let r=0;r<e.length;r++)t[r]=l(e[r],i)}else if(e instanceof Map)t=new Map,i.set(e,t),e.forEach(((e,r)=>{t.set(l(r,i),l(e,i))}));else if(e instanceof Set)t=new Set,i.set(e,t),e.forEach((e=>{t.add(l(e,i))}));else{t=Object.create(Object.getPrototypeOf(e)),i.set(e,t);for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=l(e[r],i))}return t}const h=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e=e.replace(/{s::([^}]+)}/,((e,t)=>{const i=t.split(",");return i[Math.round(Math.random()*(i.length-1))]})),e=e.replaceAll(/{(time|startDate|endDate)::([^}]+)}/g,((e,i,r)=>{var s;const n=null!==(s=t[i])&&void 0!==s?s:new Date;if(n instanceof Date==0)throw new TypeError("[MapsGL] Time must be a Date object");return(0,a.Yq)(n,r)})),Object.keys(t).forEach((i=>{e=e.replaceAll(new RegExp(`{${i}}`,"g"),`${t[i]}`)})),e=e.replaceAll(/{[^}]+}/g,""),e},c=e=>{if(e.status>=200&&e.status<=299)return e;if(401===e.status)throw new r.D_(e.statusText);if(404!==e.status){if(e.status>=500)throw new Error(e.statusText);return e}},d=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;if(!e||0===Object.keys(e).length)return null;const i=Object.assign({},e);return i.north=Math.min(90,Math.max(-90,i.north)),i.south=Math.min(90,Math.max(-90,i.south)),(i.west<-180||i.west>180)&&(i.west-=360*Math.floor(i.west/360)),(i.east<-180||i.east>180)&&(i.east-=360*Math.ceil(i.east/360)),`${i.north.toFixed(t)},${i.west.toFixed(t)},${i.south.toFixed(t)},${i.east.toFixed(t)}`},u=(e,t)=>Object.keys(e).filter((i=>t(e[i],i))).reduce(((t,i)=>(t[i]=e[i],t)),{}),p=new Set,f=e=>{p.has(e)||(console.warn(e),p.add(e))}},8854:(e,t,i)=>{i.d(t,{Fp:()=>u,Fy:()=>n,Jx:()=>p,NT:()=>s,PL:()=>l,SG:()=>o,XM:()=>d,_b:()=>c,zW:()=>h});var r=i(7411),a=i(3406);const s=(e,t)=>{if(t<0){const i=Math.pow(10,t);return Math.round(e*i)/i}return+`${Math.round(Number(`${e}e+${t}`))}e-${t}`},n=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"e",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:7;const a=Array.isArray(e)?(e=>{const t={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY,sum:0,values:[],count:0};return e.forEach((e=>(e=>{void 0===e||Number.isNaN(e)||(t.values.push(e),t.sum+=e,e<t.min&&(t.min=e),e>t.max&&(t.max=e),t.count+=1)})(e))),t.domain=[t.min,t.max],t.limits=(t,i)=>n(e,t,i),t})(e):e,{min:s,max:o,values:l}=a;if(l.sort(((e,t)=>e-t)),1===i)return[s,o];if(t.startsWith("c"))return[s,o];if(t.startsWith("e"))return Array.from({length:i+1},((e,t)=>(0,r.C)(s,o,t/i)));if(t.startsWith("l")){if(s<=0)throw new Error("Logarithmic scales are only possible for values > 0");const e=Math.log10(s),t=Math.log10(o);return Array.from({length:i+1},((a,s)=>Math.pow(10,(0,r.C)(e,t,s/i))))}return t.startsWith("q")?Array.from({length:i+1},((e,t)=>{const a=(l.length-1)*t/i,s=Math.floor(a);return s===a?l[s]:(0,r.C)(l[s],l[s+1],a-s)})):void 0},o=function(e,t){return arguments.length>2&&void 0!==arguments[2]&&arguments[2]?Math.ceil((e+t/2)/t)*t:Math.floor((e+t/2)/t)*t},l=(e,t)=>e%t==0?e:Math.round((e+t/2)/t)*t,h=function(e,t){const i=10*(arguments.length>2&&void 0!==arguments[2]?arguments[2]:4);return Math.round(e*i)===Math.round(t*i)},c=(e,t,i,r,a)=>(e-t)*(a-r)/(i-t)+r,d=(e,t,i,r)=>e<=r&&r<=t||(e>r?r+Math.ceil((e-r)/i)*i<=t:r-Math.ceil((r-t)/i)*i>=e),u=(e,t,i)=>(i-e)/(t-e),p=(e,t,i)=>{const s=new a.A;for(let a=0;a<16;a++)s.value[a]=(0,r.C)(e.value[a],t.value[a],i);return s}},2957:(e,t,i)=>{i.r(t),i.d(t,{CtoF:()=>u,CtoFUnit:()=>k,FtoC:()=>d,FtoCUnit:()=>F,UnitSystem:()=>r,Units:()=>a,convert:()=>U,dbzToMMRate:()=>V,defaultUnits:()=>s,degToDir:()=>B,equalUnits:()=>h,ftToM:()=>C,getDefaultUnit:()=>n,getDefaultUnitsForSystem:()=>o,getMeasurementType:()=>$,getSystemForUnits:()=>c,hgToMb:()=>_,inToM:()=>D,inToMM:()=>P,inToMMRate:()=>z,kmToM:()=>S,kmToMi:()=>O,kphToMph:()=>m,kphToMs:()=>g,mToFt:()=>M,mToIn:()=>T,mToKm:()=>A,mToMi:()=>E,mbToHg:()=>b,mbToPa:()=>x,miToM:()=>R,mmToIn:()=>I,mmToMMRate:()=>L,mphToKph:()=>p,mphToMs:()=>f,mphToMsUnit:()=>j,msToKph:()=>v,msToMph:()=>y,msToMphUnit:()=>N,paToMb:()=>w});const r={metric:"metric",imperial:"imperial",custom:"custom"},a={temperature:{C:"C",F:"F"},speed:{kmh:"km/h",mph:"mph",ms:"m/s",kts:"kts"},pressure:{mb:"mb",pa:"Pa",hPa:"hPa",hg:"inHg"},distance:{m:"m",km:"km",ft:"ft",mi:"mi"},precipitation:{mm:"mm",cm:"cm",in:"in",m:"m",ft:"ft"},direction:{deg:"°"},time:{hr:"hr",min:"min",sec:"sec",ms:"ms"},rate:{mmhr:"mm/hr",inhr:"in/hr",mms:"mm/sec",dbz:"dBZ"},concentration:{ppm:"ppm",ugm3:"ug/m^3"},ratio:{percent:"%"}},s={metric:{temperature:a.temperature.C,speed:a.speed.kmh,pressure:a.pressure.mb,distance:a.distance.km,height:a.distance.m,precipitation:a.precipitation.mm,snowfall:a.precipitation.cm,direction:a.direction.deg,time:a.time.hr,rate:a.rate.mmhr,intensity:a.rate.dbz,concentration:a.concentration.ugm3,ratio:a.ratio.percent},imperial:{temperature:a.temperature.F,speed:a.speed.mph,pressure:a.pressure.hg,distance:a.distance.mi,height:a.distance.ft,precipitation:a.precipitation.in,snowfall:a.precipitation.in,direction:a.direction.deg,time:a.time.hr,rate:a.rate.inhr,intensity:a.rate.dbz,concentration:a.concentration.ugm3,ratio:a.ratio.percent}},n=(e,t)=>t===r.metric?s.metric[e]:s.imperial[e],o=e=>e===r.metric?s.metric:s.imperial,l=(e,t)=>t!==r.custom&&Object.keys(e).every((i=>s[t][i]===e[i])),h=(e,t)=>Object.keys(e).every((i=>e[i]===t[i])),c=e=>l(e,r.metric)?r.metric:l(e,r.imperial)?r.imperial:r.custom,d=e=>5/9*(e-32),u=e=>1.8*e+32,p=e=>1.609344*e,f=e=>.45*e,m=e=>.6213712*e,g=e=>.2777777778*e,v=e=>3.6*e,y=e=>2.236936*e,x=e=>100*e,b=e=>.029529983071445*e,w=e=>.01*e,_=e=>33.86389*e,A=e=>.001*e,M=e=>3.280839895*e,T=e=>12*M(e),E=e=>62e-5*e,S=e=>1e3*e,C=e=>.3048*e,O=e=>.62*e,R=e=>1609.34*e,I=e=>.03937*e,P=e=>25.4*e,D=e=>.0254*e,z=e=>P(e)/3600,L=e=>e/3600,k=e=>1.8*e,F=e=>.555*e,j=e=>.45*e,N=e=>2.24*e,V=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=0;return i=Math.pow(Math.pow(10,e/10)/200,5/8),t?i/3600:i},B=e=>{e<0?e+=360:e>360&&(e-=360);const t=["↓ N","↓ NNE","↙ NE","← ENE","← E","← ESE","↖ SE","↑ SSE","↑ S","↑ SSW","↗ SW","→ WSW","→ W","→ WNW","↘ NW","↓ NNW"],i=t.length;return t[Math.floor(e/(360/i))%i]},U=(e,t,i,r)=>{switch(e){case"temperature":if("C"===i&&"F"===r)return u(t);if("F"===i&&"C"===r)return d(t);break;case"temperature-change":if("C"===i&&"F"===r)return k(t);if("F"===i&&"C"===r)return F(t);break;case"speed":if("km/h"===i&&"mph"===r)return m(t);if("mph"===i&&"km/h"===r)return p(t);if("m/s"===i&&"mph"===r)return y(t);if("m/s"===i&&"km/h"===r)return v(t);if("mph"===i&&"m/s"===r)return f(t);if("km/h"===i&&"m/s"===r)return g(t);break;case"pressure":if("mb"===i&&"hPa"===r)return x(t);if("mb"===i&&"inHg"===r)return b(t);if("hPa"===i&&"mb"===r)return w(t);if("inHg"===i&&"mb"===r)return _(t);break;case"distance":if("m"===i&&"km"===r)return A(t);if("m"===i&&"ft"===r)return M(t);if("m"===i&&"in"===r)return T(t);if("m"===i&&"mi"===r)return E(t);if("km"===i&&"m"===r)return S(t);if("ft"===i&&"m"===r)return C(t);if("km"===i&&"mi"===r)return O(t);if("mi"===i&&"m"===r)return R(t);break;case"precipitation":if("mm/sec"===i)return U(e,3600*t,"mm",r);if("in"===i&&"mm"===r)return P(t);if("in"===i&&"m"===r)return D(t);if("in"===i&&"mm/sec"===r)return z(t);if("m"===i&&"in"===r)return T(t);if("m"===i&&"cm"===r)return 100*t;if("cm"===i&&"m"===r)return t/100;if("cm"===i&&"mm"===r)return 10*t;if("mm"===i&&"mm/sec"===r)return L(t);if("mm"===i&&"in"===r)return I(t);break;case"time":if("hr"===i&&"min"===r)return 60*t;if("hr"===i&&"sec"===r)return 3600*t;if("hr"===i&&"ms"===r)return 36e5*t;if("min"===i&&"hr"===r)return t/60;if("min"===i&&"sec"===r)return 60*t;if("min"===i&&"ms"===r)return 6e4*t;if("sec"===i&&"hr"===r)return t/3600;if("sec"===i&&"min"===r)return t/60;if("sec"===i&&"ms"===r)return 1e3*t;if("ms"===i&&"hr"===r)return t/36e5;if("ms"===i&&"min"===r)return t/6e4;if("ms"===i&&"sec"===r)return t/1e3;break;case"rate":if("mm/hr"===i&&"mm/sec"===r)return t/3600;if("mm/sec"===i&&"mm/hr"===r)return 3600*t;if("dbz"===i&&"mm/hr"===r)return V(t);if("dbz"===i&&"mm/sec"===r)return V(t,!0)}return t},$=e=>(e=e.replaceAll(/\s+/g,"-").replaceAll("_","-").toLowerCase(),/^(temp(erature)?|dew-?point|wind-?chill|heat-?index|feels-?like)/i.test(e)?"temperature":/^(wind-?speed|wind-?gust)/i.test(e)?"speed":/^(pressure)/i.test(e)?"pressure":/^(visibility|snow-depth)/i.test(e)?"distance":/^(precip|rain|snow(fall)?)/i.test(e)?"precipitation":/^(cloud-?cover|humidity)/i.test(e)?"ratio":void 0)},6081:(e,t,i)=>{i.r(t),i.d(t,{dewpoint:()=>h,freeze:()=>s,heatmap:()=>w,humidity:()=>c,mslp:()=>d,prate:()=>v,precip_accum:()=>y,radar:()=>x,radarRate:()=>b,sky:()=>p,snowdepth:()=>f,tempChange1Hour:()=>o,tempChange24Hour:()=>n,temperature:()=>a,uvi:()=>m,uvi_categories:()=>g,visibility:()=>u,windspeed:()=>l});var r=i(2957);const a=[-90,"#bef7ff",-84.44,"#00c7fb",-78.89,"#0075b6",-73.33,"#1B0084",-67.78,"#6100FF",-62.22,"#D592FF",-56.67,"#D150FF",-51.111111111111,"#8f00ca",-45.555555555556,"#630078",-40,"#a50099",-34.444444444444,"#ed00dc",-28.888888888889,"#f671ff",-23.333333333333,"#dcc1ed",-17.777777777778,"#1b007b",-12.222222222222,"#6e51ff",-6.6666666666667,"#9bb6ff",-1.1111111111111,"#18a5fc",4.4444444444444,"#0900e7",10,"#14b000",15.555555555556,"#f5d508",21.111111111111,"#e17200",26.666666666667,"#f33300",32.222222222222,"#d00000",37.777777777778,"#720000",43.333333333333,"#ce0046",48.888888888889,"#ff4b98",54.44,"#ffadad",60,"#9f0000",65.56,"#ca4931",71.11,"#e9a696"],s=[-90,"#992BFF",-2.22,"#0046FF",0,"#73DAFC",2.22,"#73DAFC"],n=[.555*-60,"#EF90FF",.555*-50,"#D741DA",.555*-40,"#8B21DA",.555*-30,"#0013CA",.555*-20,"#0070F1",.555*-10,"#8ED4F9",-.555,"rgba(142,212,249,0)",0,"rgba(0,0,0,0)",.555,"rgba(255,217,42,0)",10*.555,"#FFD92A",20*.555,"#FF932A",30*.555,"#E2330B",40*.555,"#9D0000",50*.555,"#D00071",60*.555,"#FF698C"],o=[.555*-40,"#EF90FF",.555*-25,"#D741DA",.555*-15,"#8B21DA",.555*-10,"#0070F1",.555*-5,"#8ED4F9",-.555,"rgba(142,212,249,0)",0,"rgba(0,0,0,0)",.555,"rgba(255,217,42,0)",5*.555,"#FFD92A",10*.555,"#FF932A",15*.555,"#E2330B",19.425,"#9D0000",40*.555,"#D00071"],l=[0,"rgba(0,0,0,0)",1.1176,"#0050ff",3.3528,"#1bd3ff",4.4704,"#34ff87",5.588,"#72ff09",6.7056,"#b4ff08",7.8232,"#efff0b",8.9408,"#fee20a",11.176,"#f0b90a",13.4112,"#ed9909",15.6464,"#fd8609",17.8816,"#fd5d08",20,"#fb3706",22.352,"#c71506",26.8224,"#731005",33.081,"#D01DC7",42.91584,"#FFB1FB",49.62144,"#C8F0F4",53.64,"#36E2F4",57.65856,"#00626C"],h=[-84.44,"#fde3ff",-78.89,"#e0b6ec",-73.33,"#c38ad9",-67.78,"#a75ec6",-62.22,"#8f46b3",-56.67,"#782ea0",-51.11,"#61178e",-45.56,"#5d2d9d",-40,"#5943ac",-34.44,"#5559bc",-30.28,"#7f86dd",-26.11,"#aab4fe",-21.94,"#7f84a9",-17.78,"#555555",-13.61,"#62594f",-9.44,"#705e49",-5.28,"#816b57",-1.11,"#927865",3.06,"#a0938a",7.22,"#afafaf",10,"#5ee243",15.56,"#14b300",21.11,"#0e5e00",26.67,"#93a600",32.22,"#fff800"],c=[0,"#4b2b18",10,"#634a3b",20,"#7c695e",30,"#958881",40,"#aea7a4",50,"#c7c7c7",60,"#6aea55",70,"#18d200",80,"#14ab00",90,"#118400",100,"#0e5e00"],d=[950,"#D08AFF",960,"#9A00FF",970,"#6401FF",980,"#0300B8",990,"#084ADA",1e3,"#01CDFF",1010,"#23DC02",1020,"#FEF90B",1030,"#FE7B00",1040,"#FA0107",1050,"#970100",1060,"#DB5C5F"],u=[0,"#ffb400",(0,r.miToM)(2.5),"#ffea00",(0,r.miToM)(5),"rgba(255, 255, 173, 0.5)",(0,r.miToM)(10),"rgba(162, 162, 162, 0)"],p=[0,"rgba(50, 50, 50, 0)",50,"rgba(100, 100, 100, 0.4)",100,"rgba(242, 242, 242, 1)"],f=[0,"rgba(96,96,96,0)",(0,r.inToM)(.01),"rgba(96,96,96,0)",(0,r.inToM)(.1),"rgba(96,96,96,0.5)",(0,r.inToM)(1),"#576066",(0,r.inToM)(3),"#85D3FF",(0,r.inToM)(6),"#25B4FF",(0,r.inToM)(12),"#012DFF",(0,r.inToM)(18),"#7000D9",(0,r.inToM)(24),"#FF49C4",(0,r.inToM)(48),"#FFECF7",(0,r.inToM)(72),"#36E2F4",(0,r.inToM)(120),"#007682",(0,r.inToM)(168),"#C38EF2",(0,r.inToM)(240),"#A34AF2",(0,r.inToM)(300),"#7100FF"],m=[0,"rgba(0,0,0,0)",1,"#409F3F",3,"#FBFF00",6,"#DF8000",8,"#DF4000",12,"#C05FC0"],g={minimal:"#409F3F",low:"#FBFF00",moderate:"#DF8000",high:"#DF4000",very_high:"#C05FC0"},v=[0,"rgba(0,0,0,0)",(0,r.dbzToMMRate)(5.9,!0),"rgba(113,255,194,0)",(0,r.dbzToMMRate)(6,!0),"#71ffc2",(0,r.dbzToMMRate)(10,!0),"#49eb3a",(0,r.dbzToMMRate)(33,!0),"#114c00",(0,r.dbzToMMRate)(40,!0),"#e4c700",(0,r.dbzToMMRate)(50,!0),"#da0000",(0,r.dbzToMMRate)(60,!0),"#7a0009",(0,r.dbzToMMRate)(65,!0),"#9e0570"],y=[0,"rgba(198,247,199,0)",(0,r.inToMMRate)(.001),"rgba(198,247,199,0.5)",(0,r.inToMMRate)(.01),"#C6F7C7",(0,r.inToMMRate)(.1),"#B8FF9C",(0,r.inToMMRate)(.5),"#30D72F",(0,r.inToMMRate)(1),"#006C00",(0,r.inToMMRate)(2),"#FFFC0B",(0,r.inToMMRate)(4),"#DF1400",(0,r.inToMMRate)(6),"#860000",(0,r.inToMMRate)(8),"#4D014B",(0,r.inToMMRate)(10),"#E501E5",(0,r.inToMMRate)(12),"#FF91FF",(0,r.inToMMRate)(14),"#D6F1F4",(0,r.inToMMRate)(16),"#36E2F4",(0,r.inToMMRate)(20),"#00626C",(0,r.inToMMRate)(25),"#F1CCC2",(0,r.inToMMRate)(30),"#9F5F51"],x={rain:[0,"rgba(0,0,0,0)",5.99,"rgba(0,0,0,0)",6,"#8CF482",10,"#49eb3a",33,"#114c00",40,"#e4c700",50,"#da0000",60,"#7a0009",65,"#9e0570",70,"#dc42b1",80,"#dea8ff",87,"#faf3ff"],mix:[0,"rgba(0,0,0,0)",5.9,"rgba(255,163,249,0)",6,"#ffa3f9",25,"#d518be",58,"#58003c",87,"#58003c"],snow:[0,"rgba(0,0,0,0)",5.9,"rgba(124,255,255,0)",6,"#7cffff",7,"#00e8ff",25,"#0061ea",45,"#0000af",58,"#5c00f5",87,"#5c00f5"]},b={rain:[(0,r.dbzToMMRate)(0,!0),"rgba(0,0,0,0)",(0,r.dbzToMMRate)(5.99,!0),"rgba(0,0,0,0)",(0,r.dbzToMMRate)(6,!0),"#8CF482",(0,r.dbzToMMRate)(10,!0),"#49eb3a",(0,r.dbzToMMRate)(33,!0),"#114c00",(0,r.dbzToMMRate)(40,!0),"#e4c700",(0,r.dbzToMMRate)(50,!0),"#da0000",(0,r.dbzToMMRate)(60,!0),"#7a0009",(0,r.dbzToMMRate)(65,!0),"#9e0570",(0,r.dbzToMMRate)(70,!0),"#dc42b1",(0,r.dbzToMMRate)(80,!0),"#dea8ff",(0,r.dbzToMMRate)(87,!0),"#faf3ff"],mix:[(0,r.dbzToMMRate)(0,!0),"rgba(0,0,0,0)",(0,r.dbzToMMRate)(5.9,!0),"rgba(255,163,249,0)",(0,r.dbzToMMRate)(6,!0),"#ffa3f9",(0,r.dbzToMMRate)(25,!0),"#d518be",(0,r.dbzToMMRate)(58,!0),"#58003c",(0,r.dbzToMMRate)(87,!0),"#58003c"],snow:[(0,r.dbzToMMRate)(0,!0),"rgba(0,0,0,0)",(0,r.dbzToMMRate)(5.9,!0),"rgba(124,255,255,0)",(0,r.dbzToMMRate)(6,!0),"#7cffff",(0,r.dbzToMMRate)(7,!0),"#00e8ff",(0,r.dbzToMMRate)(25,!0),"#0061ea",(0,r.dbzToMMRate)(45,!0),"#0000af",(0,r.dbzToMMRate)(58,!0),"#5c00f5",(0,r.dbzToMMRate)(87,!0),"#5c00f5"]},w=[0,"rgba(0, 0, 0, 0)",.2,"rgba(0, 0, 255, 0.2)",.45,"rgba(0, 255, 0, 0.5)",.85,"rgba(255, 255, 0, 1)",1,"rgba(255, 0, 0, 1)"]},2436:(e,t,i)=>{i.d(t,{E:()=>r,S:()=>a});const r={layerId:"water",overrides:{paint:{fill:{color:"#fff"}}}},a=Object.assign(Object.assign({},r),{invert:!0})},8346:(e,t,i)=>{i.d(t,{V5:()=>s,bG:()=>a,di:()=>r,wi:()=>n});const r="https://{s::a-,b-,c-,d-}prod.v1.mapsgl.api.xweather.com",a="https://www.xweather.com/docs/mapsgl/api/layers",s=9999,n={us:{north:57,west:-127,south:24,east:-59},europe:{north:72,west:-11,south:23,east:46},japan:{north:46,west:122,south:24,east:149},australia:{north:-9,west:114,south:-44,east:154},new_zealand:{north:-34,west:166,south:-47,east:179}}},7658:(e,t,i)=>{i.d(t,{$W:()=>h,BA:()=>I,DP:()=>y,Jg:()=>x,Kn:()=>m,LO:()=>o,MF:()=>l,N0:()=>z,R$:()=>P,RX:()=>v,TX:()=>d,VJ:()=>D,Wc:()=>S,X1:()=>n,XD:()=>p,Yh:()=>g,c1:()=>c,h4:()=>f,lw:()=>T,q_:()=>C,rv:()=>u,xj:()=>R});var r=i(6694),a=i(2957),s=i(3760);const n={code:"weather-surface_TMP_2-HTGL",measurement:{type:"temperature",units:a.Units.temperature.C},dataRange:{min:-62.22,max:54.44}},o={code:{u:"weather-surface_UGRD_10-HTGL",v:"weather-surface_VGRD_10-HTGL"},measurement:{type:"speed",units:a.Units.speed.ms},dataRange:{min:-53.64,max:53.64}},l=Object.assign(Object.assign({},o),{code:"weather-surface_GUST_10-HTGL",dataRange:{min:0,max:53.64}}),h={code:"weather-surface_DPT_2-HTGL",measurement:{type:"temperature",units:a.Units.temperature.C},dataRange:{min:-84.44,max:32.22}},c={code:"weather-surface_RH_2-HTGL",measurement:{type:"ratio",units:a.Units.ratio.percent},dataRange:{min:0,max:100}},d=Object.assign(Object.assign({},n),{code:"weather-surface_APTMP_2-HTGL"}),u={code:"weather-surface_PRMSL_0-MSL",measurement:{type:"pressure",units:a.Units.pressure.mb},dataRange:{min:950,max:1060}},p={code:"weather-surface_VIS_0-SFC",measurement:{type:"distance",units:a.Units.distance.m},dataRange:{min:0,max:(0,a.miToM)(10)}},f={code:"weather-surface_TCDC_0-SFC",measurement:{type:"ratio",units:a.Units.ratio.percent},dataRange:{min:0,max:100}},m={code:"weather-surface_PTYPE_0-SFC",measurement:void 0,dataRange:{min:0,max:255}},g={code:"weather-surface_PRATE_0-SFC",measurement:{type:"rate",units:a.Units.rate.mms},dataRange:{min:0,max:(0,a.inToMMRate)(30)}},v={code:"forecast_SNOD_0-SFC",measurement:{type:"snowfall",units:a.Units.distance.m},dataRange:{min:0,max:7.9248}},y={code:"conditions_UVI_0-SFC",measurement:void 0,dataRange:{min:0,max:12}},x={code:"radar-composite_REFC_0-SFC",measurement:{type:"intensity",units:a.Units.rate.dbz},dataRange:{min:0,max:87}},b={code:"radar-composite_PRATE_0-SFC",measurement:{type:"rate",units:a.Units.rate.mms},dataRange:{min:0,max:(0,a.inToMMRate)(30)}},w={code:"radar-composite_PTYPESMPL_0-SFC",measurement:void 0,dataRange:{min:0,max:255}},_=Object.assign(Object.assign({},x),{code:"nowcast-composite_REFC_0-SFC"}),A=Object.assign(Object.assign({},b),{code:"nowcast-composite_PRATE_0-SFC"}),M=Object.assign(Object.assign({},w),{code:"nowcast-composite_PTYPESMPL_0-SFC"}),T=Object.assign(Object.assign({},x),{code:"precip_REFC_0-SFC"}),E=Object.assign(Object.assign({},b),{code:"precip_PRATE_0-SFC"}),S=Object.assign(Object.assign({},w),{code:"precip_PTYPESMPL_0-SFC"}),C={aqiAirNow:{code:"air-quality_AQI-AirNow_0-SFC",measurement:void 0,dataRange:{min:0,max:500}},aqiHealthIndex:{code:"air-quality_AQHI-Canada_0-SFC",measurement:void 0,dataRange:{min:0,max:20}},aqiChina:{code:"air-quality_AQI-China_0-SFC",measurement:void 0,dataRange:{min:0,max:500}},aqiIndia:{code:"air-quality_AQI-India_0-SFC",measurement:void 0,dataRange:{min:0,max:500}},aqiEAQI:{code:"air-quality_AQI-EAQI_0-SFC",measurement:void 0,dataRange:{min:0,max:150}},aqiCAI:{code:"air-quality_AQI-CAI_0-SFC",measurement:void 0,dataRange:{min:0,max:500}},aqiCAQI:{code:"air-quality_AQI-CAQI_0-SFC",measurement:void 0,dataRange:{min:0,max:200}},aqiUbaDAQI:{code:"air-quality_AQI-UBA-DAQI_0-SFC",measurement:void 0,dataRange:{min:0,max:125}},aqiUkDAQI:{code:"air-quality_AQI-UK-DAQI_0-SFC",measurement:void 0,dataRange:{min:0,max:10}},co:{code:"air-quality_CO_0-SFC",measurement:{type:"concentration",units:a.Units.concentration.ugm3},dataRange:{min:0,max:1e3}},no:{code:"air-quality_NO_0-SFC",measurement:{type:"concentration",units:a.Units.concentration.ugm3},dataRange:{min:0,max:100}},no2:{code:"air-quality_NO2_0-SFC",measurement:{type:"concentration",units:a.Units.concentration.ugm3},dataRange:{min:0,max:100}},o3:{code:"air-quality_O3_0-SFC",measurement:{type:"concentration",units:a.Units.concentration.ugm3},dataRange:{min:0,max:300}},pm2p5:{code:"air-quality_PM2P5_0-SFC",measurement:{type:"concentration",units:a.Units.concentration.ugm3},dataRange:{min:0,max:300}},pm10:{code:"air-quality_PM10_0-SFC",measurement:{type:"concentration",units:a.Units.concentration.ugm3},dataRange:{min:0,max:1e3}},so2:{code:"air-quality_SO2_0-SFC",measurement:{type:"concentration",units:a.Units.concentration.ugm3},dataRange:{min:0,max:100}}},O={height:{measurement:{type:"height",units:a.Units.distance.m},dataRange:{min:0,max:15},noData:0},direction:{measurement:{type:"direction",units:a.Units.direction.deg},dataRange:{min:0,max:359},noData:0},period:{measurement:{type:"time",units:a.Units.time.sec},dataRange:{min:0,max:24},noData:0}},R={waveHeight:Object.assign({code:"marine_HTSGW_0-SFC"},O.height),waveDir:Object.assign({code:"marine_DIRPW_0-SFC"},O.direction),wavePeriod:Object.assign({code:"marine_PERPW_0-SFC"},O.period),swellHeightPrimary:Object.assign({code:"marine_SWELL_1-SEQ"},O.height),swellPeriodPrimary:Object.assign({code:"marine_SWPER_1-SEQ"},O.period),swellDirPrimary:Object.assign({code:"marine_SWDIR_1-SEQ"},O.direction),swellHeightSecondary:Object.assign({code:"marine_SWELL_2-SEQ"},O.height),swellPeriodSecondary:Object.assign({code:"marine_SWPER_2-SEQ"},O.period),swellDirSecondary:Object.assign({code:"marine_SWDIR_2-SEQ"},O.direction),swellHeightTertiary:Object.assign({code:"marine_SWELL_3-SEQ"},O.height),swellPeriodTertiary:Object.assign({code:"marine_SWPER_3-SEQ"},O.period),swellDirTertiary:Object.assign({code:"marine_SWDIR_3-SEQ"},O.direction),current:{code:{u:"marine_UOGRD_0-SFC",v:"marine_VOGRD_0-SFC"},measurement:{type:"speed",units:a.Units.speed.ms},dataRange:{min:-3.0864,max:3.0864},noData:0},sst:{code:"marine_WTMP_0-SFC",measurement:{type:"temperature",units:a.Units.temperature.C},dataRange:{min:-100,max:100},noData:0},surge:{code:"marine_SURGE_0-SFC",measurement:{type:"height",units:a.Units.distance.m},dataRange:{min:0,max:5},noData:0},tide:{code:"marine_TIDE_0-SFC",measurement:{type:"height",units:a.Units.distance.m},dataRange:{min:-12.192,max:12.192},noData:0}},I={summary:{code:"roadSeverity_0-SFC",measurement:void 0,dataRange:{min:0,max:0}},surface:{code:"roadCondition_0-SFC",measurement:void 0,dataRange:{min:0,max:0}},temperature:{code:"roadTemperature_0-SFC",measurement:{type:"temperature",units:a.Units.temperature.C},dataRange:{min:-62.22,max:54.44}},temperatureFreeze:{code:"roadTemperature_0-SFC",measurement:{type:"temperature",units:a.Units.temperature.C},dataRange:{min:-62.22,max:54.44}},riskRollover:{code:"roadRiskRollover_0-SFC",measurement:void 0,dataRange:{min:0,max:0}},riskHydroplane:{code:"hydroplaneRisk_0-SFC",measurement:void 0,dataRange:{min:0,max:0}},riskLowVizSnow:{code:"roadRiskSnow_0-SFC",measurement:void 0,dataRange:{min:0,max:0}},riskLowVizFog:{code:"roadRiskFog_0-SFC",measurement:void 0,dataRange:{min:0,max:0}}},P={size:e=>({code:`hail-threats-archive-${e}_MESH_0-SFC`,measurement:{type:"precipitation",units:a.Units.precipitation.mm},dataRange:{min:0,max:(0,a.inToMM)(4)}}),posh:e=>({code:`hail-threats-archive-${e}_POSH_0-SFC`,measurement:{type:"ratio",units:a.Units.ratio.percent},dataRange:{min:0,max:100}})},D={cg:e=>({code:`lightning-density-archive-${e}_LIGHTNING-STRIKES-CG_0-SFC`,measurement:void 0,dataRange:{min:0,max:10}}),ic:e=>({code:`lightning-density-archive-${e}_LIGHTNING-STRIKES-IC_0-EATM`,measurement:void 0,dataRange:{min:0,max:10}})},z=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({temperature:n,wind:o,windGust:l,dewpoint:h,humidity:c,feelsLike:d,mslp:u,visibility:p,cloudCover:f,precipType:m,precipRate:g,snowDepth:v,uvi:y,radarArchiveDbz:x,radarArchivePrecipRate:b,radarArchivePrecipType:w,radarNowcastDbz:_,radarNowcastPrecipRate:A,radarNowcastPrecipType:M,radarDbz:T,radarPrecipRate:E,radarPrecipType:S},Object.entries(C).reduce(((e,t)=>{let[i,r]=t;return e[i]=r,e}),{})),Object.entries(R).reduce(((e,t)=>{let[i,r]=t;return e[i]=r,e}),{})),Object.entries(I).reduce(((e,t)=>{let[i,a]=t;return e[`road${(0,r.C)(i)}`]=a,e}),{})),Object.entries(D).reduce(((e,t)=>{let[i,a]=t;return s.Q0.forEach((t=>{let s=i.replace(/^cg/,"CloudToGround");s=s.replace(/^ic/,"IntraCloud"),e[`lightning${(0,r.C)(s)}${(0,r.C)(t).replace(/^us/i,"US")}`]=a(t)})),e}),{})),Object.entries(P).reduce(((e,t)=>{let[i,a]=t;return s.ot.forEach((t=>{e[`hail${(0,r.C)(i)}${(0,r.C)(t).replace(/^us/i,"US")}`]=a(t)})),e}),{}))},3760:(e,t,i)=>{i.d(t,{Q0:()=>a,oh:()=>s,ot:()=>r});const r=["us","europe","japan","australia"],a=["us","europe","japan","australia"],s=e=>{var t,i;if(!(null==e?void 0:e.details)||!(null==e?void 0:e.period))return 0;const r=new Date(e.details.issuedDateTimeISO),a=new Date(null!==(i=null===(t=e.period.range)||void 0===t?void 0:t.minDateTimeISO)&&void 0!==i?i:e.details.issuedDateTimeISO);return Math.floor((a.getTime()-r.getTime())/1e3/60)}},2102:(e,t,i)=>{i.d(t,{Af:()=>p,BH:()=>f,Qf:()=>c,RC:()=>d,T9:()=>u,Z:()=>m,ge:()=>g});var r=i(6232),a=i(5711),s=i(6476),n=i(6219),o=i(4229),l=i(3606),h=i(9147);const c="",d=e=>{if((0,r.E)(e))throw new Error(`[MapsGL] Invalid weather layer id: ${e}`);return e.startsWith(c)?e:`${c}${e}`},u=(e,t)=>{const{dataRange:i}=e,r=(i.max-i.min)/t;return Array.from({length:t}).map(((t,a)=>Object.assign(Object.assign({},e),{dataRange:{min:i.min+r*a,max:i.min+r*(a+1)}})))},p=function(e){return(0,a.$)({type:n.m.sample,source:e,quality:n.E.high,zoomOffset:-1,timeSeries:{mode:l.Gp.interval},paint:{sample:{interpolation:h.uN.bicubic,colorscale:{interval:0}}}},arguments.length>1&&void 0!==arguments[1]?arguments[1]:{})},f=function(e){return(0,a.$)({type:n.m.raster,source:e,timeSeries:{mode:l.Gp.interval,intervals:10,interleaved:!1},paint:{raster:{meld:!1}}},arguments.length>1&&void 0!==arguments[1]?arguments[1]:{})},m=function(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r={type:n.m.query,source:e,sourceType:o.V.point,sourceLayer:"cities",paint:{text:[{value:Object.assign({property:"{dataProp}",transform:e=>Math.round(e)},t),size:20,color:"#fff",outlineColor:"#000",weight:"bold",anchor:"center",offset:{x:0,y:-4}},{value:{property:"place.name"},size:11,color:"#fff",outlineColor:"#444",weight:"bold",anchor:"top",offset:{x:0,y:8}}],symbol:{key:e=>e.place.name,rank:{property:"profile.rankScore",direction:"desc"},fadeOpacity:!1,pitchWithMap:!1,rotateWithMap:!1,scaleWithMap:!1,allowOverlap:!1}}};return(0,a.$)({},r,i)},g=(e,t)=>e.map((e=>{const{id:i,dataMin:r,dataMax:a,outputMin:n=0,outputMax:o=255,timeOffset:l=0}=e,h={dataSetId:i,dataMin:r,dataMax:a,outputMin:n,outputMax:o,outputNoDataValue:void 0,validTimes:null==t?void 0:t.map((e=>new Date(e.getTime()+1e3*l).toISOString()))};return Object.keys(h).reduce(((e,t)=>{const i=h[t];return(0,s.n)(i)&&(e[t]=i),e}),{})}))},6339:(e,t,i)=>{i.d(t,{A:()=>r});const r={ARRAY_BUFFER:34962,TEXTURE_BINDING_3D:32874}},7290:(e,t,i)=>{i.d(t,{A:()=>u});var r,a,s,n,o,l=function(e,t,i,r,a){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?a.call(e,i):a?a.value=i:t.set(e,i),i},h=function(e,t,i,r){if("a"===i&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?r:"a"===i?r.call(e):r?r.value:t.get(e)};const c=()=>("undefined"==typeof performance?Date:performance).now();r=new WeakMap,a=new WeakMap,s=new WeakMap,n=new WeakMap,o=new WeakMap;const d=class{constructor(e=!0){r.set(this,0),a.set(this,0),s.set(this,0),n.set(this,!1),o.set(this,!1),l(this,o,e,"f")}start(){h(this,n,"f")||(this.reset(),l(this,n,!0,"f"))}stop(){this.getElapsedTime(),l(this,n,!1,"f"),l(this,o,!1,"f")}reset(){l(this,r,c(),"f"),l(this,a,h(this,r,"f"),"f"),l(this,s,0,"f")}getElapsedTime(){return this.getDelta(),h(this,s,"f")}getDelta(){let e=0;if(h(this,o,"f")&&!h(this,n,"f"))return this.start(),0;if(h(this,n,"f")){const t=c();e=(t-h(this,a,"f"))/1e3,l(this,a,t,"f"),l(this,s,h(this,s,"f")+e,"f")}return e}},u=class{get elapsedTime(){return this._clock.getElapsedTime()}constructor(e,t=!0){this._clock=new d,this._running=!1,this._callback=()=>{const t=this._clock.getElapsedTime();e&&e(t)},t&&this.start()}start(){this.stop(),this._running=!0,this._clock.start(),this.tick()}stop(){this._running=!1,this._clock.stop(),this._handle>=0&&cancelAnimationFrame(this._handle),this._handle=-1}dispose(){this.stop(),this._callback=void 0}tick(){this._handle=requestAnimationFrame((()=>{this._running&&this.tick()})),this._callback&&this._callback()}}},464:(e,t,i)=>{i.d(t,{A:()=>r});const r=class{get value(){return null}fromArray(e){return this}toArray(){return[]}}},3406:(e,t,i)=>{i.d(t,{A:()=>u});var r=i(7684),a=i(329),s=i(464),n=i(1025),o=i(1181),l=i(1832);const h=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),c=Object.freeze([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);class d extends s.A{constructor(){super(...arguments),this._value=r.vt()}get value(){return this._value}get elements(){return this.value.length}get x(){return this.value[12]}get y(){return this.value[13]}get z(){return this.value[14]}get w(){return this.value[15]}static get identity(){return(new d).fromArray([...h])}static get zero(){return(new d).fromArray([...c])}fromArray(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=0;for(;i<this.elements;)this.value[i]=e[t+i],i+=1;return this}toArray(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=0;for(;i<this.elements;)e[t+i]=this.value[i],i+=1;return e}fromRotationX(e){return r.hM(this.value,e),this}fromRotationY(e){return r.i1(this.value,e),this}fromRotationZ(e){return r.N9(this.value,e),this}fromScale(e){return r.CV(this.value,e.value),this}fromTranslation(e){return r.kN(this.value,e.value),this}fromPerspective(e,t,i,a){return r.fN(this.value,e,t,i,a),this}fromOrthogonal(e,t,i,a,s,n){return r.v3(this.value,e,t,a,i,s,n),this}fromQuaternion(e){return r.I0(this.value,e.value),this}clone(){return(new d).copy(this)}copy(e){let t=0;for(;t<this.value.length;)this.value[t]=e.value[t],t+=1;return this}determinant(){return r.a4(this.value)}equals(e){return r.aI(this.value,e.value)}getColumn(e){const t=this.value;return new l.A(t[4*e+0],t[4*e+1],t[4*e+2],t[4*e+3])}setColumn(e,t){return this.value[4*e+0]=t.x,this.value[4*e+1]=t.y,this.value[4*e+2]=t.z,this.value[4*e+3]=t.w,this}getRotation(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new n.A;return r.l(e.value,this.value),e}getScale(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new o.A;return r.IL(e.value,this.value),e}getTranslation(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new o.A;return r.sC(e.value,this.value),e}identity(){return r.D_(this.value),this}invert(){return r.B8(this.value,this.value),this}inverse(e){return r.B8(this.value,e.value),this}transpose(){return r.mg(this.value,this.value),this}lookAt(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new o.A(0,0,0),i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new o.A(0,1,0);return r.t5(this.value,e.value,t.value,i.value),this}multiply(e,t){return t?r.lw(this.value,e.value,t.value):r.lw(this.value,this.value,e.value),this}multiplyScalar(e){return r.Ny(this.value,this.value,e),this}premultiply(e){return r.lw(this.value,e.value,this.value),this}rotateX(e){return r.eL(this.value,this.value,e),this}rotateY(e){return r.Z8(this.value,this.value,e),this}rotateZ(e){return r.Qr(this.value,this.value,e),this}scale(e){return r.hs(this.value,this.value,e.value),this}scaleScalar(e){return r.hs(this.value,this.value,a.fA(e,e,e)),this}translate(e){return r.Tl(this.value,this.value,e.value),this}compose(e,t,i){return r.o1(this.value,t.value,e.value,i.value),this}decompose(){return{rotation:this.getRotation(),scale:this.getScale(),translation:this.getTranslation()}}toString(){return r.gx(this.value)}}const u=d},1025:(e,t,i)=>{i.d(t,{A:()=>n});var r=i(2221),a=i(1798);class s{get x(){return this._value[0]}set x(e){this._value[0]=e,this.triggerChange()}get y(){return this._value[1]}set y(e){this._value[1]=e,this.triggerChange()}get z(){return this._value[2]}set z(e){this._value[2]=e,this.triggerChange()}get w(){return this._value[3]}set w(e){this._value[3]=e,this.triggerChange()}get value(){return this._value}get elements(){return this.value.length}constructor(e=0,t=0,i=0,a=0){this._changeCallbacks=[],this._value=r.fA(e,t,i,a)}fromArray(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this.triggerChange(),this}toArray(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromObject(e){let{x:t,y:i,z:r,w:a}=e;return void 0!==t&&(this.x=t),void 0!==i&&(this.y=i),void 0!==r&&(this.z=r),void 0!==a&&(this.w=a),this.triggerChange(),this}toObject(){return{x:this.x,y:this.y}}fromAxisAngle(e,t){return r.x8(this.value,e.value,t),this.triggerChange(),this}fromEuler(e){return r.A6(this.value,(0,a.H)(e.x),(0,a.H)(e.y),(0,a.H)(e.z)),this.triggerChange(),this}fromRotationMatrix(){return this}set(e,t,i,a){return this._value=r.fA(e,t,i,a),this.triggerChange(),this}length(){return r.Bw(this.value)}clone(){return(new s).copy(this)}copy(e){let t=0;for(;t<this.value.length;)this.value[t]=e.value[t],t+=1;return this.triggerChange(),this}equals(e){return r.aI(this.value,e.value)}identity(){return r.D_(this.value),this.triggerChange(),this}invert(){return r.B8(this.value,this.value),this.triggerChange(),this}conjugate(){return r.Xr(this.value,this.value),this.triggerChange(),this}normalize(){return r.S8(this.value,this.value),this.triggerChange(),this}rotateX(e){return r.eL(this.value,this.value,e),this.triggerChange(),this}rotateY(e){return r.Z8(this.value,this.value,e),this.triggerChange(),this}rotateZ(e){return r.Qr(this.value,this.value,e),this.triggerChange(),this}dot(e){return r.Om(this.value,e.value)}angleTo(e){return r._H(this.value,e.value)}onChange(e){this._changeCallbacks.includes(e)||this._changeCallbacks.push(e)}triggerChange(){this._changeCallbacks.forEach((e=>e()))}}const n=s},9814:(e,t,i)=>{i.d(t,{A:()=>r});const r=class{get value(){return null}fromArray(e){return this}toArray(){return[]}}},1181:(e,t,i)=>{i.d(t,{A:()=>l});var r=i(329),a=i(1025),s=i(9814);const n=r.vt();class o extends s.A{get value(){return this._value}get x(){return this.value[0]}set x(e){this.value[0]=e}get y(){return this.value[1]}set y(e){this.value[1]=e}get z(){return this.value[2]}set z(e){this.value[2]=e}get elements(){return this.value.length}constructor(e=0,t=0,i=0){super(),this._value=r.fA(e,t,i)}fromArray(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x=e[t+0],this.y=e[t+1],this.z=e[t+2],this}toArray(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t+0]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromObject(e){let{x:t,y:i,z:r}=e;return void 0!==t&&(this.x=t),void 0!==i&&(this.y=i),void 0!==r&&(this.z=r),this}toObject(){return{x:this.x,y:this.y,z:this.z}}set(e,t,i){return this._value=r.fA(e,t,i),this}setScalar(e){return this.set(e,e,e)}length(){return r.Bw(this.value)}distanceToSquared(e){return r.lo(this.value,e.value)}angle(){const e=r.fA(1,0,0);return r.g7(this.value,e)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}clone(){return new o(this.x,this.y,this.z)}add(e){return r.WQ(this.value,this.value,e.value),this}addScalar(e){return r.WQ(this.value,this.value,r.fA(e,e,e)),this}subtract(e){return r.Re(this.value,this.value,e.value),this}subtractScalar(e){return r.Re(this.value,this.value,r.fA(e,e,e)),this}subVectors(e,t){return r.jb(this.value,e.value,t.value),this}multiply(e){return r.lw(this.value,this.value,e.value),this}multiplyScalar(e){return r.lw(this.value,this.value,r.fA(e,e,e)),this}divide(e){return r.Qr(this.value,this.value,e.value),this}divideScalar(e){return r.Qr(this.value,this.value,r.fA(e,e,e)),this}distanceTo(e){return r.Io(this.value,e.value)}angleTo(e){return r.g7(this.value,e.value)}dot(e){return r.Om(this.value,e.value)}equals(e){return r.aI(this.value,e.value)}lerp(e,t){return r.Cc(this.value,this.value,e.value,t),this}normalize(){return r.S8(this.value,this.value),this}scale(e){return r.hs(this.value,this.value,e),this}rotateX(e){return r.eL(this.value,this.value,n,e),this}rotateY(e){return r.Z8(this.value,this.value,n,e),this}rotateZ(e){return r.x6(this.value,this.value,n,e),this}applyEuler(e){const t=(new a.A).fromEuler(e);return this.applyQuaternion(t)}applyMatrix3(e){return r.ei(this.value,this.value,e.value),this}applyMatrix4(e){return r.Z0(this.value,this.value,e.value),this}applyQuaternion(e){return r.gL(this.value,this.value,e.value),this}negate(){for(let e=0;e<this.elements;++e)this.value[e]=-this.value[e];return this}}const l=o},1832:(e,t,i)=>{i.d(t,{A:()=>n});var r=i(4796),a=i(9814);class s extends a.A{get value(){return this._value}get x(){return this.value[0]}set x(e){this.value[0]=e}get y(){return this.value[1]}set y(e){this.value[1]=e}get z(){return this.value[2]}set z(e){this.value[2]=e}get w(){return this.value[3]}set w(e){this.value[3]=e}get elements(){return this.value.length}constructor(e=0,t=0,i=0,a=0){super(),this._value=r.fA(e,t,i,a)}fromArray(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x=e[t+0],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t+0]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromObject(e){let{x:t,y:i,z:r,w:a}=e;return void 0!==t&&(this.x=t),void 0!==i&&(this.y=i),void 0!==r&&(this.z=r),void 0!==a&&(this.w=a),this}toObject(){return{x:this.x,y:this.y,z:this.z,w:this.w}}set(e,t,i,a){return this._value=r.fA(e,t,i,a),this}setScalar(e){return this.set(e,e,e,e)}length(){return r.Bw(this.value)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w,this}clone(){return new s(this.x,this.y,this.z,this.w)}add(e){return r.WQ(this.value,this.value,e.value),this}addScalar(e){return r.WQ(this.value,this.value,r.fA(e,e,e,e)),this}subtract(e){return r.Re(this.value,this.value,e.value),this}subtractScalar(e){return r.Re(this.value,this.value,r.fA(e,e,e,e)),this}multiply(e){return r.lw(this.value,this.value,e.value),this}multiplyScalar(e){return r.lw(this.value,this.value,r.fA(e,e,e,e)),this}divide(e){return r.Qr(this.value,this.value,e.value),this}divideScalar(e){return r.Qr(this.value,this.value,r.fA(e,e,e,e)),this}distanceTo(e){return r.Io(this.value,e.value)}dot(e){return r.Om(this.value,e.value)}equals(e){return r.aI(this.value,e.value)}lerp(e,t){return r.Cc(this.value,this.value,e.value,t),this}normalize(){return r.S8(this.value,this.value),this}scale(e){return r.hs(this.value,this.value,e),this}applyMatrix4(e){return r.Z0(this.value,this.value,e.value),this}}const n=s},3564:(e,t,i)=>{i.d(t,{C6:()=>o,Ld:()=>s,N_:()=>l,Ng:()=>h,aF:()=>c,vA:()=>n});var r=i(6339);const a={},s=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"id";a[e]=a[e]||1;const t=a[e];return a[e]+=1,`${e}-${t}`},n=function(e){if(!e)throw new Error(`Assert failed: ${(arguments.length>1&&void 0!==arguments[1]?arguments[1]:null)||""}`)},o=e=>Boolean(e&&(e instanceof WebGLRenderingContext||e.ARRAY_BUFFER===r.A.ARRAY_BUFFER)),l=e=>{const t=e.match(/#define[\s*]SHADER_NAME[\s*]([\w-]+)[\s*]/);return t?t[1]:"unnamed"},h=(e,t)=>{switch(t){case e.FRAGMENT_SHADER:return"fragment";case e.VERTEX_SHADER:return"vertex";default:return"unknown type"}},c=(e,t)=>void 0!==t&&(e&t)===t},8330:e=>{e.exports=JSON.parse('{"name":"@xweather/mapsgl-sdk","version":"1.8.0","description":"An easy-to-use, highly customizable Javascript library for visualizing both weather and custom data on a variety of web mapping platforms for WebGL.","author":"Vaisala Xweather","homepage":"https://www.xweather.com","license":"BSD","private":true,"workspaces":["packages/*"],"scripts":{"postinstall":"husky install","clean":"rm -fr dist/*","clean:bundle":"rm -fr packages/main/dist/*; rm -fr packages/main/build/types/*;","dev":"yarn clean; DEPLOY_PATH=\'/dist/\' NODE_ENV=\'development\' webpack serve --config webpack.dev.js","transpile":"swc ./packages/webgl-maps/src -d output","build":"rm -fr dist; tsc --sourceMap false --outDir dist; babel --config-file ./babel-nodejs.config.js dist --out-dir dist","build:dev":"DEPLOY_PATH=\'/dist/\' webpack --config webpack.dev.js","build:prod":"yarn clean; DEPLOY_PATH=\'https://cdn.aerisapi.com/sdk/js/mapsgl/%%version%%/\' NODE_ENV=\'production\' webpack --env production --config webpack.prod.js","build:bundle":"yarn clean:bundle; NODE_ENV=\'production\' webpack --env production --config webpack.bundle.js; node scripts/buildBundle.js","build:dts":"sh scripts/build-dts.sh","build:dts-rollup":"rm -fr packages/main/build/types/*; rollup -c rollup.config.js --environment BUILD:production,MINIFY:true; node scripts/buildDts.js","build:sprite":"node assets/scripts/buildSprites.js","glsl:chunks":"node scripts/chunkNames.js","test":"jest --maxWorkers=50%","test:watch":"jest --maxWorkers=25% --watch --onlyChanged","test:ci":"jest --color --runInBand --ci","test:cypress":"yarn run cypress open","test:clear":"jest --clearCache","lint":"yarn lint:eslint","lint:all":"concurrently yarn:lint:*","lint:eslint":"eslint --ext .ts,.tsx --config .eslintrc.js \\"packages/**/src/**/*.ts\\"","lint:types":"tsc --noEmit --skipLibCheck","lint:fix":"yarn lint:eslint --fix","commit":"git-cz","changelog":"cz changelog --dry-run","changelog:gen":"ts-node scripts/changelog-generate.ts","changelog:write":"ts-node scripts/changelog-write.ts","changelog:commit":"git add CHANGELOG.md && git commit -am \'docs: add changelog\' && git push","changelog:format":"node scripts/changelog-format.js","release":"standard-version","release:version":"standard-version --release-as 1.8.0","release:beta":"standard-version --prerelease beta","release:rc":"standard-version --prerelease rc","docs:code":"cd packages/webgl-core && yarn docs:code; cd ../webgl-maps && yarn docs:code","deploy":"yarn run build:prod; sh scripts/deploy.sh dist/","deploy-staging":"DEPLOY_ENV=\'staging\' yarn run build:prod; sh scripts/deploy.sh dist/","deploy-latest":"DEPLOY_VERSION=\'latest\' yarn run build:prod; sh scripts/deploy.sh dist/ --version latest","test-npm":"sh scripts/npmPublish.sh --test","deploy-npm":"sh scripts/npmPublish.sh","deploy-npm-beta":"sh scripts/npmPublish.sh --tag beta","strip-keys":"node scripts/stripKeys.js"},"lint-staged":{"*.{js,ts,tsx}":["yarn lint:fix"],"*.(md|html)":["yarn run strip-keys","yarn changelog:format"]},"devDependencies":{"@aerisweather/eslint-plugin":"^1.0.4","@babel/cli":"^7.24.0","@babel/core":"^7.24.0","@babel/plugin-transform-runtime":"^7.24.0","@babel/preset-env":"^7.24.0","@babel/preset-typescript":"^7.24.0","@babel/runtime":"^7.24.0","@changesets/cli":"^2.23.0","@commitlint/cli":"^17.0.2","@commitlint/config-conventional":"^17.0.2","@jutaz/spritezero":"^9.0.0","@rollup/plugin-commonjs":"^24.0.0","@rollup/plugin-json":"^6.0.0","@rollup/plugin-typescript":"^10.0.1","@stylistic/eslint-plugin":"^4.2.0","@swc/cli":"^0.3.10","@swc/core":"^1.4.11","@types/gl":"^4.1.0","@types/jest":"^27.0.0","@types/jest-image-snapshot":"^4.3.1","@types/jsdom-screenshot":"^3.2.1","@types/pngjs":"^6.0.1","@types/stats.js":"^0.17.0","@typescript-eslint/eslint-plugin":"^5.25.0","@typescript-eslint/parser":"^5.25.0","babel-eslint":"^10.1.0","babel-jest":"^27.0.6","babel-loader":"^8.2.2","babel-plugin-add-module-exports":"^1.0.4","babel-plugin-transform-import-meta":"^2.1.1","circular-dependency-plugin":"^5.2.2","clean-webpack-plugin":"^3.0.0","commitizen":"^4.2.4","concat":"^1.0.3","core-js":"^3.15.1","css-loader":"^6.7.1","cz-conventional-changelog":"^3.3.0","dotenv-webpack":"^7.1.0","eslint":"^8.57.0","eslint-config-airbnb":"^19.0.4","eslint-plugin-import":"^2.29.0","eslint-plugin-unicorn":"^51.0.0","fast-glob":"^3.2.11","file-loader":"^6.2.0","html-webpack-harddisk-plugin":"^2.0.0","html-webpack-plugin":"^5.3.2","husky":"^6.0.0","jest":"^27.0.5","jest-canvas-mock":"^2.5.0","jest-fetch-mock":"^3.0.3","jest-image-snapshot":"^6.2.1","jest-transform-stub":"^2.0.0","jest-webgl-canvas-mock":"^0.2.3","js-beautify":"^1.14.0","lint-staged":"^13.0.2","mini-css-extract-plugin":"^2.6.1","msdf-bmfont-xml":"^2.7.0","node-pandoc":"^0.3.0","pngjs":"^6.0.0","rollup":"^3.9.1","rollup-plugin-dts":"^5.1.0","rollup-plugin-terser":"^7.0.2","sass":"^1.52.3","sass-loader":"^13.0.0","sharp":"^0.34.2","standard-version":"^9.5.0","stats.js":"^0.17.0","swc-loader":"^0.2.3","terser-webpack-plugin":"^5.1.4","ts-jest":"^29.1.0","ts-loader":"^9.2.3","ts-node":"^10.9.0","ts-shader-loader":"^2.0.2","typedoc":"^0.27.0","typedoc-plugin-merge-modules":"^3.0.1","typedoc-plugin-rename-defaults":"^0.3.0","types-webpack-bundler":"^1.0.2","typescript":"^5.4.0","webpack":"^5.70.0","webpack-bundle-analyzer":"^4.4.2","webpack-cli":"^4.9.0","webpack-dev-server":"^4.0.0","webpack-glsl-minify":"^1.5.0","webpack-merge":"^5.8.0"},"packageManager":"yarn@1.22.19"}')}},r={};function a(e){var t=r[e];if(void 0!==t)return t.exports;var s=r[e]={exports:{}};return i[e].call(s.exports,s,s.exports,a),s.exports}return a.m=i,a.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},a.d=(e,t)=>{for(var i in t)a.o(t,i)&&!a.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},a.f={},a.e=e=>Promise.all(Object.keys(a.f).reduce(((t,i)=>(a.f[i](e,t),t)),[])),a.u=e=>e+".js",a.miniCssF=e=>{},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),e={},t="@xweather/mapsgl-sdk:",a.l=(i,r,s,n)=>{if(e[i])e[i].push(r);else{var o,l;if(void 0!==s)for(var h=document.getElementsByTagName("script"),c=0;c<h.length;c++){var d=h[c];if(d.getAttribute("src")==i||d.getAttribute("data-webpack")==t+s){o=d;break}}o||(l=!0,(o=document.createElement("script")).charset="utf-8",o.timeout=120,a.nc&&o.setAttribute("nonce",a.nc),o.setAttribute("data-webpack",t+s),o.src=i),e[i]=[r];var u=(t,r)=>{o.onerror=o.onload=null,clearTimeout(p);var a=e[i];if(delete e[i],o.parentNode&&o.parentNode.removeChild(o),a&&a.forEach((e=>e(r))),t)return t(r)},p=setTimeout(u.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=u.bind(null,o.onerror),o.onload=u.bind(null,o.onload),l&&document.head.appendChild(o)}},a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.p='"1.8.0"',(()=>{var e={main:0};a.f.j=(t,i)=>{var r=a.o(e,t)?e[t]:void 0;if(0!==r)if(r)i.push(r[2]);else{var s=new Promise(((i,a)=>r=e[t]=[i,a]));i.push(r[2]=s);var n=a.p+a.u(t),o=new Error;a.l(n,(i=>{if(a.o(e,t)&&(0!==(r=e[t])&&(e[t]=void 0),r)){var s=i&&("load"===i.type?"missing":i.type),n=i&&i.target&&i.target.src;o.message="Loading chunk "+t+" failed.\n("+s+": "+n+")",o.name="ChunkLoadError",o.type=s,o.request=n,r[1](o)}}),"chunk-"+t,t)}};var t=(t,i)=>{var r,s,[n,o,l]=i,h=0;if(n.some((t=>0!==e[t]))){for(r in o)a.o(o,r)&&(a.m[r]=o[r]);l&&l(a)}for(t&&t(i);h<n.length;h++)a.o(e,s=n[h])&&e[s]&&e[s][0](),e[s]=0},i=self.webpackChunk_xweather_mapsgl_sdk=self.webpackChunk_xweather_mapsgl_sdk||[];i.forEach(t.bind(null,0)),i.push=t.bind(null,i.push.bind(i))})(),a(4789)})())),r((()=>(()=>{var e,t={};e=t,"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0});const i=e=>Array.isArray(e)?"array":e instanceof Date?"date":typeof e,r=e=>{switch(i(e)){case"array":case"string":return 0===e.length;case"date":case"boolean":case"number":case"function":case"symbol":return!1;case"object":return 0===Object.keys(e).length;default:return!0}},a=e=>null==e,s=e=>!a(e),n=e=>a(e)||r(e),o=e=>!n(e);function l(e,t,i){const{width:r,height:a}=e;if(i){if(i instanceof Uint8ClampedArray)i=new Uint8Array(i.buffer);else if(i.length!==r*a*t)throw new RangeError(`mismatched image size. expected: ${i.length} but got: ${r*a*t}`)}else i=new Uint8Array(r*a*t);return{width:r,height:a,data:i}}function h(e,t,i,r,a,s,n){let o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:4;if(0===n.width||0===n.height)return t;if(n.width>e.width||n.height>e.height||i>e.width-n.width||r>e.height-n.height)throw new RangeError("[MapsGL] Out of range source coordinates for image copy");if(n.width>t.width||n.height>t.height||a>t.width-n.width||s>t.height-n.height)throw new RangeError("[MapsGL] Out of range destination coordinates for image copy");const l=e.data,h=t.data;for(let c=0;c<n.height;c++){const d=((r+c)*e.width+i)*o,u=((s+c)*t.width+a)*o;for(let e=0;e<n.width*o;e++)h[u+e]=l[d+e]}return t}const c=class{get width(){return this.dimension+2*this.padding}get height(){return this.dimension+2*this.padding}constructor(e,t,i=0){this.stride=4,this.padding=0,this._backfilledEdges=new Set,this.padding=i,this.dimension=t;const r=Math.sqrt(e.length/this.stride),a=t+2*i;if(i>0&&r===t){const t={width:r,height:r,data:e},s=l({width:a,height:a},this.stride);h(t,s,0,0,i,i,{width:r,height:r}),h(t,s,0,0,0,i,{width:i,height:r}),h(t,s,r-i,0,i+r,i,{width:i,height:r}),h(t,s,0,0,i,0,{width:r,height:i}),h(t,s,0,r-i,i,i+r,{width:r,height:i}),h(t,s,0,0,0,0,{width:i,height:i}),h(t,s,r-i,0,i+r,0,{width:i,height:i}),h(t,s,0,r-i,0,i+r,{width:i,height:i}),h(t,s,r-i,r-i,i+r,i+r,{width:i,height:i}),this.rawData=s.data}else this.rawData=e}get(e,t){const i=this.rawData,r=this._idx(e,t);return{r:i[r],g:i[r+1],b:i[r+2],a:i[r+3]}}backfillEdge(e,t,i){!function(e){if(!e)throw new Error(`Assert failed: ${(arguments.length>1&&void 0!==arguments[1]?arguments[1]:null)||""}`)}(e.dimension===this.dimension,`EncodedData mismatch - neighbor data must have the same dimension as instance data, ${this.dimension} does not equal ${e.dimension}`);const r=`${t},${i}`;if(this._backfilledEdges.has(r))return;const a=this.padding,s=this.dimension+2*a;this._backfilledEdges.add(r);let n=a,o=a,l=a,c=a,d=a,u=a;const p=s-a;-1===t?(n=p-a,l=0):1===t&&(l=p),-1===i?(o=p-a,c=0):1===i&&(c=p),0===t&&(d=s-2*a),0===i&&(u=s-2*a),h({width:s,height:s,data:e.rawData},{width:s,height:s,data:this.rawData},n,o,l,c,{width:d,height:u}),this._backfilledEdges.add(r)}_idx(e,t){if(e<-1||e>=this.dimension+1||t<-1||t>=this.dimension+1)throw new RangeError("[MapsGL] Out of range source coordinates for image bitmap");return 4*(t*(this.dimension+2*this.padding)+e)}},d=e=>"string"===i(e),u=class{constructor(e,t){this.type=e,(e=>s(e)&&"object"===i(e)?Object.getOwnPropertyNames(e):[])(t=Object.assign({},t)).forEach((e=>{this[e]=t[e]}))}},p=e=>"object"==typeof e&&"type"in e,f=class{constructor({validEventTypes:e=[/.*/],triggerLastEvent:t=!1}={}){this.callbacks={},this.lastEvents={},this.validEventTypes=e,this.triggerLastEvent=t,this.callbackContext=this}setCallbackContext(e){return this.callbackContext=e,this}on(e,t,i,r){if(d(e)&&/\s+/.test(e))return e.split(" ").forEach((e=>{this.on(e,t,i,r)})),this;if(this.validateEventType(e),this.hasListener(e)||(this.callbacks[e]=new Set),this.callbacks[e].add({callback:t,context:r}),(null==i?void 0:i.triggerLastEvent)||this.triggerLastEvent){const i=this.lastEvents[e];i&&t.call(r||this.callbackContext||this,i)}return this}once(e,t,i,r){if(d(e)&&/\s+/.test(e))return e.split(" ").forEach((e=>{this.once(e,t,i,r)})),this;this.validateEventType(e);const a=i=>(this.off(e,a),t.call(r||this.callbackContext||this,i));return this.on(e,a,i,r)}off(e,t){if(d(e)&&/\s+/.test(e))return e.split(" ").forEach((e=>{this.off(e,t)})),this;if(this.validateEventType(e),!this.hasCallbacks(e))return this;if(!t)return delete this.callbacks[e],this;for(const i of this.callbacks[e])if(i.callback===t){this.callbacks[e].delete(i);break}return this}trigger(e,t){const i=p(e)?e:new u(e,t||{}),r=p(e)?e.type:e;i.target=this,this.validateEventType(r),this.lastEvents[r]=i;const a=this.callbacksForEvent(r);if(a)return[...a].map((({callback:e,context:t})=>e.call(t||this.callbackContext||this,i)))}hasListener(e){return e in this.callbacks}clearListeners(){return this.callbacks={},this}addEventListener(e,t,i,r){return this.on(e,t,i)}removeEventListener(e,t,i){return this.off(e,t)}dispatchEvent(e,t){return this.trigger(e,t)}validateEventType(e){if(!this.isValidEvent(e)){const t=this.validEventTypes.join("|");throw new Error(`Invalid event type {${e}}.\nEvent type should be any of: ${t}.`)}}isValidEvent(e){const t=Array.isArray(e)?e:[e];let i=0;for(const r of t)for(const a of this.validEventTypes)if((a instanceof RegExp?a.test(r):e===a)&&(i+=1,i===t.length))return!0;return!1}hasCallbacks(e){return e in this.callbacks}callbacksForEvent(e){return this.callbacks[e]}},m="data:change";class g{constructor(e){this.index=-1,this.current=-1,this.next=-1,this.data=e}}const v=class extends f{get intervals(){return[...this._intervals].sort(((e,t)=>e-t))}get count(){return Object.keys(this.data).length}get validCount(){return Object.values(this.data).filter((e=>s(e.data))).length}get timeRange(){if(r(this.intervals))return{start:void 0,end:void 0};const e=this.intervals[0],t=this.intervals.at(-1);return{start:new Date(e),end:new Date(t)}}get data(){return this._data}constructor(e){super(),this._data=Object.create(null),this._intervals=[],this.setData(e)}setData(e){this._data=s(e)?Object.keys(e).reduce(((t,i)=>(t[i]=new g(e[i]),t)),Object.create(null)):Object.create(null),this._generateIntervalsFromData(),this.trigger(m)}appendData(e){Object.keys(e).sort().forEach((t=>{this._data[t]=e[t]})),this._generateIntervalsFromData(),this.trigger(m)}setDataForInterval(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const r=this.data[e];r?r.data=t:i?this.appendData({[e]:new g(t)}):console.warn(`[MapsGL] Cannot set time series data for interval ${e} because it does not exist and \`createIfMissing\` is false.`),this.trigger(m)}hasDataForInterval(e){return!n(this.data)&&s(this.dataForInterval(e))}entryForInterval(e){return this.data[e]}dataForInterval(e){return this.dataForTimeInterval(e)}dataForTimeInterval(e){var t;return null===(t=this.data[e])||void 0===t?void 0:t.data}dataAtIndex(e){var t;const i=Object.keys(this.data);if(e>-1&&e<i.length)return null===(t=this.data[i[e]])||void 0===t?void 0:t.data}intervalAtIndex(e){if(e>-1&&e<this.intervals.length)return this.intervals[e]}intervalsInRange(e,t){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return this.intervals.filter((r=>i?r>=e.getTime()&&r<=t.getTime():r>e.getTime()&&r<t.getTime()))}closestInterval(e){if(0===this.intervals.length)return{interval:void 0,index:-1};const t=e.getTime();let i=this.intervals[0],r=0,a=Math.abs(t-i);return this.intervals.forEach(((e,s)=>{const n=t-e;n>=0&&n<=a&&(a=n,i=e,r=s)})),{interval:i,index:r}}intervalsNeedingData(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.intervals).filter((e=>!this.hasDataForInterval(e))).sort(((e,t)=>e-t))}removeInterval(e){delete this._data[e],this._generateIntervalsFromData()}invalidate(){this.trigger("invalidate"),this._data=Object.create(null)}_generateIntervalsFromData(){const e=Object.keys(this._data).map(Number).sort(((e,t)=>e-t));e.length===this._intervals.length&&e.every(((e,t)=>e===this._intervals[t]))||this.trigger("intervals:change",{previous:[...this._intervals],current:[...e]}),this._intervals=e}};class y{constructor(e){this.image=e}dispose(){var e;null===(e=this.texture)||void 0===e||e.dispose(),this.texture=void 0}}class x extends y{}const b=y,w=class{get count(){return this.series.count}get validCount(){return this.series.validCount}get validIntervals(){return this._validIntervals}constructor(e,t,i){this.interval={current:void 0,next:void 0},this.textures={current:void 0,next:void 0},this.renderTargets={current:void 0,next:void 0},this.useLinearTextureFilter=!1,Object.keys(e).forEach((t=>{if(e[t]instanceof b==0)throw new TypeError(`[MapsGL] Invalid data type for time series data interval ${t}`)})),this.series=new v(e),this.size=t,this.setValidIntervals(i)}setValidIntervals(e){this._validIntervals=[...e].sort()}getData(e){return this.series.dataForTimeInterval(e)}setData(e,t){if(t instanceof b==0)throw new TypeError("[MapsGL] Invalid data type for time series data");this.series.setDataForInterval(e,t,!0)}purgeData(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1;this.series.intervals.forEach(((t,i)=>{var r;if(t!==e){const e=this.series.dataForTimeInterval(t);e&&(null===(r=e.texture)||void 0===r||r.dispose(),e.texture=void 0),this.series.setDataForInterval(t,void 0)}}))}dataAtIndex(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=this.validIntervals;if(e<0||e>=i.length)return;let r=this.series.dataForInterval(i[e]);if(s(r)||!t)return{data:r,index:e};let a=-1;return i.forEach(((t,i)=>{const n=this.series.dataForInterval(t);s(n)&&(a<0||Math.abs(i-e)<Math.abs(a-e))&&(r=n,a=i)})),{data:r,index:a}}prepareTextures(e){const t=e.gl;this.series.intervals.forEach(((i,r)=>{const a=this.series.dataForInterval(i);if((null==a?void 0:a.image)&&!a.texture){const i=a.image,r=this.useLinearTextureFilter?t.LINEAR:t.NEAREST;a.texture=e.createTexture({image:i instanceof c?i.rawData:i,size:{width:i.width,height:i.height},minFilter:r,magFilter:r,generateMipmaps:!1})}}))}updateTextures(e,t){var i,r,a,s;this.prepareTextures(e);const{index:n,interval:o,nextIndex:l,nextInterval:h}=t;let c=!1;if(o!==this.interval.current){const e=this.dataAtIndex(n,!0);if(e){const{data:t,index:r}=e,a=this.validIntervals[r];a!==this.interval.current&&((null===(i=null==t?void 0:t.texture)||void 0===i?void 0:i.image)?(this.textures.current=t.texture,this.interval.current=a,c=!0):(this.textures.current=void 0,this.interval.current=void 0))}else this.textures.current=void 0,this.interval.current=void 0}if(h!==this.interval.next){const e=this.dataAtIndex(l,!0);if(e){const{data:t,index:i}=e,a=this.validIntervals[i];a!==this.interval.next&&((null===(r=null==t?void 0:t.texture)||void 0===r?void 0:r.image)?(this.textures.next=t.texture,this.interval.next=a,c=!0):(this.textures.next=void 0,this.interval.next=void 0))}else this.textures.next=void 0,this.interval.next=void 0}this.interval.current&&!(null===(a=this.textures.current)||void 0===a?void 0:a.image)&&(this.textures.current=void 0,this.textures.next=void 0,this.interval.current=void 0,this.interval.next=void 0),(null===(s=this.textures.next)||void 0===s?void 0:s.image)||(this.textures.next=this.textures.current,this.interval.next=this.interval.current)}dispose(){this.series.intervals.forEach((e=>{const t=this.series.dataForInterval(e);null==t||t.dispose()})),this.series.invalidate(),this.textures.current=void 0,this.textures.next=void 0}};class _ extends w{constructor(){super(...arguments),this.padding=2}getPixel(e,t,i){var r;const a=null===(r=this.series.dataForTimeInterval(e))||void 0===r?void 0:r.image;if(a)return a.get(t,i)}backfillEdge(e,t,i){Object.keys(this.series.data).forEach((r=>{const a=this.series.dataForInterval(Number(r)),s=e.series.dataForInterval(Number(r));(null==a?void 0:a.image)&&(null==s?void 0:s.image)&&(a.image.backfillEdge(s.image,t,i),a.texture&&(a.texture.needsUpdate=!0))}))}serialized(){return{series:this.series.intervals.reduce(((e,t)=>{var i;return e[t]=null===(i=this.series.dataForInterval(t))||void 0===i?void 0:i.image,e}),Object.create(null)),validIntervals:this.validIntervals,size:this.size,padding:this.padding,metadata:void 0}}static fromSerialized(e){if(a(e))return void console.warn("[MapsGL] Cannot create EncodedTileData from invalid serialized data.");const t=Object.keys(e.series).reduce(((t,i)=>{const r=e.series[i];if(s(null==r?void 0:r.rawData)){const{rawData:e,dimension:a,pad:s}=r;if(o(e)){const r=new c(e,a,s);t[i]=new x(r)}}return t}),Object.create(null));return new _(t,e.size,e.validIntervals)}}const A=_;class M extends Error{}Error,Error;class T extends Error{constructor(e,t){super(e),this.response=t}}const E=e=>"object"===i(e),S=function(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if((e=>null==e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||e instanceof Date||e instanceof RegExp)(e))return e;if((r=e)&&"undefined"!=typeof ArrayBuffer&&r instanceof ArrayBuffer)return t&&!t.includes(e)&&t.push(e),e;var r;if(ArrayBuffer.isView(e)){const i=e;return t&&!t.includes(i.buffer)&&t.push(i.buffer),i}if(e instanceof ImageData)return t&&!t.includes(e.data.buffer)&&t.push(e.data.buffer),e;if(e instanceof ImageBitmap)return t&&!t.includes(e)&&t.push(e),e;if(Array.isArray(e)){const i=[];for(let r=0;r<e.length;r++)i.push(S(e[r],t));return i}if(E(e))return Object.keys(e).reduce(((r,a)=>{const s=0===i.length||i.length>0&&(i.includes(a)||((e,t)=>{let i=!1;return t.forEach((t=>{new RegExp(t).test(e)&&(i=!0)})),i})(a,i));return r[a]=s?S(e[a],t,i):e[a],r}),{});throw new Error("[MapsGL] Can't serialize object of type "+typeof e)},C=e=>"function"===i(e),O=e=>e&&"object"==typeof e,R=(e,t)=>(Object.keys(t).forEach((i=>{const r=e[i],a=t[i];e[i]=Array.isArray(r)&&Array.isArray(a)?[...r,...a]:O(r)&&O(a)?R(Object.assign({},r),a):a})),e),I=(e,t,i)=>(1-i)*e+i*t,P=e=>{if(e.status>=200&&e.status<=299)return e;if(401===e.status)throw new M(e.statusText);if(404!==e.status){if(e.status>=500)throw new Error(e.statusText);return e}},D=(e,t,i,r)=>{const a=Math.hypot(i,r),s=(Math.atan2(i,r),Math.cos(-Math.PI/2),a*Math.sin(-Math.PI/2));e[t+0]=a,e[t+1]=0,e[t+2]=s},z=(new Set,e=>"number"===i(e)),L=/^\d{4}-(?:0[1-9]|1[0-2])-(?:[0-2][1-9]|[1-3]0|3[01])T(?:[01]\d|2[0-3])(?::[0-6]\d){1,2}(?:\.\d{3})?(?:[+-][0-2]\d:[0-5]\d|Z)?$/,k=["r","g","b","a"],F=e=>k.indexOf(e),j="vector",N="diff",V="custom",B=(e,t)=>t.startsWith("_FUNC")?(t=t.replace(/^_FUNC/,""),new Function(`return (${t}).apply(this, arguments);`)):t,U=9999,$=(e,t,i,r)=>{if(E(t)){const a=Object.keys(t),s=r;a.forEach((r=>{s[r]||(s[r]=new Float32Array(e)),s[r][i]=t[r]}))}else z(t)&&(r[i]=t)},G=function(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const{expression:r,channels:a,dataRange:s,drawRange:n,valueRanges:o,sampleOffset:l,noDataValue:h}=t,{min:c,max:d}=s;let u,p=0,f=0;if(r===j&&2===a.length){const t=e[a[0]],i=e[a[1]];if(h>=0&&t===h)return{value:U,angle:U};const r=I(c,d,t/255),s=I(c,d,i/255),n=Math.hypot(r,s);let o=Math.atan2(r/n,s/n)*(180/Math.PI);o<0?o+=360:o>360&&(o-=360),u={speed:n,value:n,angle:o}}else if("sum"===r||r===N){const t=e[a[0]],i=e[a[1]];let o=0;if(h>=0&&t===h)return U;o=r===N?t-i:t+i,u=I(n.min,n.max,(o*((s.max-s.min)/(n.max-n.min))+255*l)/255)}else{if("angle"===r){const t=e[a[0]];return h>=0&&t===h?U:t/255*360}if(r===V)u=a.reduce(((t,i,r)=>{const{min:a,max:s}=o[r],n=I(a,s,e[i]/255);return t[`value${r}`]=n,h>=0&&n===h&&(t[`value${r}`]=U),t}),{});else if(Array.isArray(a)){if(h>=0&&e[a[0]]===h)return U;a.forEach((t=>{f+=255,p+=e[t]}));const r=p/f;u=c+(d-c)*r,i&&console.warn(e,t,p,f,r,u)}}return u},q=e=>`0:${e.z}/${e.x}/${e.y}`;var W=function(e,t){var i={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(i[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(i[r[a]]=e[r[a]])}return i};const H=class{constructor(e){this._requests={},this._tileLoader=e||((e,t,i)=>fetch(e,Object.assign({signal:null==i?void 0:i.signal},i)).then(P))}loadTile(e,t){const{tile:{info:i}}=e,r=e.request,{url:a}=r,s=W(r,["url"]);return q(i),this._tileLoader(a,i,s).then((e=>{return t=this,r=function*(){return{blob:e instanceof Response?yield e.blob():e,headers:e.headers}},new((i=void 0)||(i=Promise))((function(e,a){function s(e){try{o(r.next(e))}catch(e){a(e)}}function n(e){try{o(r.throw(e))}catch(e){a(e)}}function o(t){var r;t.done?e(t.value):(r=t.value,r instanceof i?r:new i((function(e){e(r)}))).then(s,n)}o((r=r.apply(t,[])).next())}));var t,i,r})).then((t=>{let{blob:r,headers:a}=t;return this.parseTile(e.source,i,r,a)}))}parseTile(e,t,r,a){return createImageBitmap(r).then((r=>{let s=[];const n=null==a?void 0:a.get("x-data-set-locs");if(n){const t=((e,t)=>{const i=JSON.parse(e);return{layout:{columns:0,rows:0,size:{width:0,height:0}},datasets:null==t?void 0:t.map(((e,t)=>{const{id:r,dataMin:a,dataMax:s,outputMin:n=0,outputMax:o=255,outputNoDataValue:l}=e,{animDir:h,x:c=0,y:d=0,b:u=0,validTimes:p}=i[t]||{};return{id:r,dataMin:a,dataMax:s,outputMin:n,outputMax:o,outputNoDataValue:l,maxZoom:-1,degreesPerPixel:{x:-1,y:-1},column:c,row:d,band:u,layout:"H"===h?"horizontal":"vertical",validTimes:null==p?void 0:p.map((e=>new Date(e)))}}))}})(n,e.datasets);(null==t?void 0:t.datasets)&&(s=function(){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],t=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const r=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).map((t=>function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(d(e)&&L.test(e))return(e=>{const t=e.split(/\D+/),i=e.includes("+")?-1:1;return new Date(Date.UTC(+t[0],+t[1]-1,+t[2],+t[3]+i*(+t[7]||0),+t[4]+i*(+t[8]||0),+t[5],+t[6]||0))})(e);if(d(e)||z(e)){const i=new Date(e);return t?(r=i,new Date(r.getTime()+60*r.getTimezoneOffset()*1e3)):i}var r;return(e=>"date"===i(e))(e)?e:null}(t,e)));return t?r.sort(((e,t)=>e.getTime()<t.getTime()?-1:1)).filter(Boolean):r.filter(Boolean)}(t.datasets[0].validTimes,!0,!1))}if("undefined"==typeof OffscreenCanvas)return{image:r,validTimes:s};let o;if(e.transformer){const t=JSON.parse(e.transformer,B);C(t)&&(o=i=>t(i,e.datasets))}const l=((e,t,i,r)=>{var a;const s=t.height,n=Math.floor(t.width/e.width),o=(Math.floor(s/e.height),{}),l="undefined"!=typeof OffscreenCanvas;if((null==i?void 0:i.length)===n){const s=l?new OffscreenCanvas(e.width,e.height):window.document.createElement("canvas");s.width=e.width,s.height=e.height;const h=s.getContext("2d",{alpha:!1,willReadFrequently:!0});h.imageSmoothingEnabled=!1;for(let l=0;l<n;l++){const n=i[l].getTime();h.drawImage(t,l*e.width,0,e.width,e.height,0,0,s.width,s.height);const d=null===(a=h.getImageData(0,0,s.width,s.height))||void 0===a?void 0:a.data,u=new c(d,s.width,2);C(r)&&r(u),o[n]={rawData:u.rawData,dimension:u.dimension,padding:u.padding}}}return{data:o}})(t.size,r,s,o);return l})).catch((e=>{console.error(`[MapsGL] Error parsing encoded raster tile - ${null==e?void 0:e.message}`)}))}abortTile(e){return new Promise((t=>{const i=q(e),r=this._requests[i];r&&(r.forEach((e=>e.abort())),delete this._requests[i]),t()}))}aggregate(e,t,i){var r,n;const{type:o,period:l,aggregate:h,bands:c=["r","g","b"]}=e,{tile:{},source:{validTimes:d,datasets:u}}=t,p=t.request,{intervals:f}=p,m=(W(p,["url","intervals"]),JSON.parse(t.request.body||"")),g=[],v=[];null===(r=t.source)||void 0===r||r.datasets.forEach(((e,i)=>{var r;const a=k[i%k.length];i>0&&e.id===(null===(r=t.source)||void 0===r?void 0:r.datasets[i-1].id)?v.push(v.at(-1)):v.push(a)}));const y=c.map(((e,t)=>{const i=u[t];if(i)return{band:F(e),scaleValue:/RATE/.test(i.id)}})).filter((e=>void 0!==e)),x=f.sort(((e,t)=>e.getTime()-t.getTime())),b=new Set(d.map((e=>e.getTime())));(function(e,t){const i=[];if(Math.ceil(e.length/7)>1){let t=0;for(let r=0;r<e.length;r++)i[t]||(i[t]=[]),i[t].push(e[r]),7===i[t].length&&(t+=1)}else i.push([...e]);return i})(x).forEach((e=>{Array.isArray(m)&&m.forEach((t=>{t.validTimes=null==e?void 0:e.map((e=>new Date(e.getTime()+1e3).toISOString()))})),g.push(this.loadTile(((...e)=>{if(e.length<2)throw new Error("deepMerge: this function expects at least 2 objects to be provided");if(e.some((e=>!O(e))))throw new Error('deepMerge: all values should be of type "object"');const t=e.shift();let i;for(;i=e.shift();)R(t,i);return t})({},t,{request:{body:JSON.stringify(m)}}),i))}));const w=function(){const e=[],t={u:-1,v:-1,base:127.5};return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).forEach(((e,i)=>{const{id:r,dataMin:a,dataMax:s}=e;var n;/UGRD/.test(r)?(t.u=i,t.base=255*(I(a,s,.5)-(n=a))/(s-n)+0):/VGRD/.test(r)&&(t.v=i)})),t.u>=0&&t.v>=0&&e.push(t),e}(null===(n=t.source)||void 0===n?void 0:n.datasets);return Promise.all(g).then((e=>{const t=e.reduce(((e,t)=>{const{data:i}=t;return i&&Object.keys(i).forEach((t=>{e[t]=i[t]})),e}),{}),i=[];if("none"===l)i.push(x.map((e=>e.getTime())));else{let e=[],t=null;x.forEach(((r,a)=>{const s=r.getTime(),n=function(e,t){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];switch(e){case"hour":return i?t.getUTCHours():t.getHours();case"day":return i?t.getUTCDate():t.getDate();case"week":return i?t.getUTCDay():t.getDay();case"month":return i?t.getUTCMonth():t.getMonth();case"year":return i?t.getUTCFullYear():t.getFullYear()}}(l,new Date(s));null!==t&&n===t&&a!==x.length-1||(t=n,e.length>0&&i.push(e),e=[]),e.push(s)}))}return i.forEach((e=>{const i=e.reduce(((e,i)=>{var r;return e[i]=null===(r=t[i])||void 0===r?void 0:r.rawData,e}),{});!function(e,t,i,r,n){let o=arguments.length>5&&void 0!==arguments[5]&&arguments[5];const l=Object.keys(t).map(Number).sort();let h,c,d=null,u=0,p=1;for(let f=0;f<l.length;f++){const m=l[f],g=t[m];if(f>0&&(u=m-l[f-1],p=u/3600/1e3),c||(c=new Float32Array(g.length/4*3)),s(g)){if(d&&!1!==o||(d="avg"===e?new Uint16Array(g.length):new Uint8Array(g.length)),h){if(a(g)||a(h))return;let t=!1,s=0,o=0;for(let a=0;a<g.length;a++){const l=a%4,u=Math.floor(a/4),f=u%516,v=Math.floor(u/516),y=i.find((e=>e.band===l));!1===(null==y?void 0:y.scaleValue)&&(p=1),l<r.length-1&&r[l]===r[l+1]&&(t=!0),0!==l&&!0===t||(s=0),0!==l&&t||(o=0);const x=n.find((e=>e.u===l||e.v===l));if(y)if(x){const{v:t,base:i}=x;if(l===t)continue;const r=g[a]-i,s=g[a+1]-i,n=Math.hypot(r,s),o=3*u,p=c[o+0];switch(e){case"sum":case"avg":d[a]=g[a]+h[a];break;case"max":n>p&&D(c,o,r,s);break;case"min":n<p&&D(c,o,r,s)}d[a]=c[o+1]+i,d[a+1]=c[o+2]+i}else{const i=g[a]*p,r=h[a];switch(e){case"sum":case"avg":{const n=r+i+s;s=n>255&&t?n-255:0,d[a]="avg"===e?n:Math.min(n,255),o+=d[a],-1===f&&-1===v&&console.warn(new Date(Number(m)).toISOString(),{band:l,c1:i,value:d[a],valueMultiplier:p,pixelValue:o,overflow:s});break}case"max":d[a]=Math.max(i,r);break;case"min":d[a]=Math.min(i,r)}}else d[a]=g[a];"avg"!==e&&(d[a]=Math.min(d[a],255))}h=d}else{for(let e=0;e<g.length;e++){const t=e%4,i=Math.floor(e/4),r=i%516,a=Math.floor(i/516),s=n.find((e=>e.u===t||e.v===t));if(s){const{v:r,base:a}=s;if(t===r)continue;const n=3*i;D(c,n,g[e]-a,g[e+1]-a),d[e]=c[n+1]+a,d[e+1]=c[n+2]+a}else d[e]=g[e],-1===r&&-1===a&&console.warn(new Date(Number(m)).toISOString(),{band:t,c1:g[e],value:d[e],valueMultiplier:p})}h=d}t[m]=d}else console.warn("[MapsGL] Time series operation, no data found for interval",m)}if("avg"===e){for(let e=0;e<d.length;e++)d[e]=Math.round(d[e]/l.length);const e=d instanceof Uint8Array?d:new Uint8Array(d);for(let i=0;i<l.length;i++)t[l[i]]=e}}(o,i,y,v,w,h),e.forEach((e=>{t[e].rawData=i[e]}))})),{data:Object.keys(t).filter((e=>b.has(Number(e)))).reduce(((e,i)=>(e[i]=t[i],e)),{})}}))}getValues(e,t){const i=t.expression,r=e.size,a=e.padding,s={width:r.width+2*a,height:r.height+2*a},n=r.width*r.height,o=i===j||i===V,c={};return e.series.intervals.forEach(((i,d)=>{const u=o?{}:new Float32Array(n);let p=0;const f=e.getData(i);if(f){const e={data:f.image.rawData,width:s.width,height:s.height},n=a>0?function(e,t,i,r,a){if(r.width>e.width||r.height>e.height)throw new RangeError("[MapsGL] Image is too small to crop");const s=l(r,4);return h(e,s,t,i,0,0,r,4),s}(e,a,a,r):e,o=n.data;for(let e=0;e<r.height;e++)for(let i=0;i<r.width;i++){const a=4*(e*r.width+i),s=G({r:o[a],g:o[a+1],b:o[a+2],a:o[a+3]},t);$(r.width*r.height,s,p,u),p+=1}c[i]=u}})),c}};let Z;const Y=new class{constructor(e){this._resolveRejects={},this.worker=e}send(e){const t=Math.round(1e18*Math.random()).toString(36).slice(0,10);return new Promise(((i,r)=>{this._resolveRejects[t]={resolve:i,reject:r},this.worker.addEventListener("message",this.receive.bind(this)),this.worker.postMessage(Object.assign({id:t},e))}))}receive(e){const{id:t,data:i,error:r}=e.data,a=this._resolveRejects[t];a&&(r?a.reject(r):a.resolve(i),delete this._resolveRejects[t])}abort(){this.worker.terminate()}}(self);return onmessage=e=>{var t;const i=e.data||{},{id:r,data:a}=i;if(a)if(Z||(Z=new H),"getValues"===a.command){if(null==a?void 0:a.encoded){const e=A.fromSerialized(a.encoded),t=Z.getValues(e,a.config);postMessage({id:r,data:{values:t,size:e.size}})}}else if("loadTile"===a.command){const e=null===(t=a.source)||void 0===t?void 0:t.operation;(null==a?void 0:a.tile)&&(o(e)&&"none"!==e.type?Z.aggregate(e,a,Y):Z.loadTile(a,Y)).then((e=>{const t=[],i=S(e,t);postMessage({id:r,data:i},void 0,t)})).catch((e=>{var t;let i=null!==(t=null==e?void 0:e.name)&&void 0!==t?t:"EncodedTileWorkerError";const a={code:0,message:void 0};e instanceof T?(i="InvalidResponseError",a.code=e.response.status,a.message=e.response.statusText):e instanceof M&&(i="UnauthorizedError",a.code=401,a.message="Unauthorized"),postMessage({id:r,status:a,error:`${i}: ${null==e?void 0:e.message}`})}))}else"abortTile"===a.command&&(null==a?void 0:a.tile)&&Z.abortTile(a.tile.info)},t})())),r((()=>(()=>{var e={4748:e=>{function t(e,t){this.x=e,this.y=t}e.exports=t,t.prototype={clone:function(){return new t(this.x,this.y)},add:function(e){return this.clone()._add(e)},sub:function(e){return this.clone()._sub(e)},multByPoint:function(e){return this.clone()._multByPoint(e)},divByPoint:function(e){return this.clone()._divByPoint(e)},mult:function(e){return this.clone()._mult(e)},div:function(e){return this.clone()._div(e)},rotate:function(e){return this.clone()._rotate(e)},rotateAround:function(e,t){return this.clone()._rotateAround(e,t)},matMult:function(e){return this.clone()._matMult(e)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(e){return this.x===e.x&&this.y===e.y},dist:function(e){return Math.sqrt(this.distSqr(e))},distSqr:function(e){var t=e.x-this.x,i=e.y-this.y;return t*t+i*i},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith:function(e){return this.angleWithSep(e.x,e.y)},angleWithSep:function(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult:function(e){var t=e[2]*this.x+e[3]*this.y;return this.x=e[0]*this.x+e[1]*this.y,this.y=t,this},_add:function(e){return this.x+=e.x,this.y+=e.y,this},_sub:function(e){return this.x-=e.x,this.y-=e.y,this},_mult:function(e){return this.x*=e,this.y*=e,this},_div:function(e){return this.x/=e,this.y/=e,this},_multByPoint:function(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint:function(e){return this.x/=e.x,this.y/=e.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var e=this.y;return this.y=this.x,this.x=-e,this},_rotate:function(e){var t=Math.cos(e),i=Math.sin(e),r=i*this.x+t*this.y;return this.x=t*this.x-i*this.y,this.y=r,this},_rotateAround:function(e,t){var i=Math.cos(e),r=Math.sin(e),a=t.y+r*(this.x-t.x)+i*(this.y-t.y);return this.x=t.x+i*(this.x-t.x)-r*(this.y-t.y),this.y=a,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},t.convert=function(e){return e instanceof t?e:Array.isArray(e)?new t(e[0],e[1]):e}},4537:(e,t,i)=>{i(7054),e.exports.VectorTileFeature=i(1110),i(6241)},7054:(e,t,i)=>{var r=i(6241);function a(e,t,i){if(3===e){var a=new r(i,i.readVarint()+i.pos);a.length&&(t[a.name]=a)}}e.exports=function(e,t){this.layers=e.readFields(a,{},t)}},1110:(e,t,i)=>{var r=i(4748);function a(e,t,i,r,a){this.properties={},this.extent=i,this.type=0,this._pbf=e,this._geometry=-1,this._keys=r,this._values=a,e.readFields(s,this,t)}function s(e,t,i){1==e?t.id=i.readVarint():2==e?function(e,t){for(var i=e.readVarint()+e.pos;e.pos<i;){var r=t._keys[e.readVarint()],a=t._values[e.readVarint()];t.properties[r]=a}}(i,t):3==e?t.type=i.readVarint():4==e&&(t._geometry=i.pos)}function n(e){for(var t,i,r=0,a=0,s=e.length,n=s-1;a<s;n=a++)r+=((i=e[n]).x-(t=e[a]).x)*(t.y+i.y);return r}e.exports=a,a.types=["Unknown","Point","LineString","Polygon"],a.prototype.loadGeometry=function(){var e=this._pbf;e.pos=this._geometry;for(var t,i=e.readVarint()+e.pos,a=1,s=0,n=0,o=0,l=[];e.pos<i;){if(s<=0){var h=e.readVarint();a=7&h,s=h>>3}if(s--,1===a||2===a)n+=e.readSVarint(),o+=e.readSVarint(),1===a&&(t&&l.push(t),t=[]),t.push(new r(n,o));else{if(7!==a)throw new Error("unknown command "+a);t&&t.push(t[0].clone())}}return t&&l.push(t),l},a.prototype.bbox=function(){var e=this._pbf;e.pos=this._geometry;for(var t=e.readVarint()+e.pos,i=1,r=0,a=0,s=0,n=1/0,o=-1/0,l=1/0,h=-1/0;e.pos<t;){if(r<=0){var c=e.readVarint();i=7&c,r=c>>3}if(r--,1===i||2===i)(a+=e.readSVarint())<n&&(n=a),a>o&&(o=a),(s+=e.readSVarint())<l&&(l=s),s>h&&(h=s);else if(7!==i)throw new Error("unknown command "+i)}return[n,l,o,h]},a.prototype.toGeoJSON=function(e,t,i){var r,s,o=this.extent*Math.pow(2,i),l=this.extent*e,h=this.extent*t,c=this.loadGeometry(),d=a.types[this.type];function u(e){for(var t=0;t<e.length;t++){var i=e[t];e[t]=[360*(i.x+l)/o-180,360/Math.PI*Math.atan(Math.exp((180-360*(i.y+h)/o)*Math.PI/180))-90]}}switch(this.type){case 1:var p=[];for(r=0;r<c.length;r++)p[r]=c[r][0];u(c=p);break;case 2:for(r=0;r<c.length;r++)u(c[r]);break;case 3:for(c=function(e){var t=e.length;if(t<=1)return[e];for(var i,r,a=[],s=0;s<t;s++){var o=n(e[s]);0!==o&&(void 0===r&&(r=o<0),r===o<0?(i&&a.push(i),i=[e[s]]):i.push(e[s]))}return i&&a.push(i),a}(c),r=0;r<c.length;r++)for(s=0;s<c[r].length;s++)u(c[r][s])}1===c.length?c=c[0]:d="Multi"+d;var f={type:"Feature",geometry:{type:d,coordinates:c},properties:this.properties};return"id"in this&&(f.id=this.id),f}},6241:(e,t,i)=>{var r=i(1110);function a(e,t){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(s,this,t),this.length=this._features.length}function s(e,t,i){15===e?t.version=i.readVarint():1===e?t.name=i.readString():5===e?t.extent=i.readVarint():2===e?t._features.push(i.pos):3===e?t._keys.push(i.readString()):4===e&&t._values.push(function(e){for(var t=null,i=e.readVarint()+e.pos;e.pos<i;){var r=e.readVarint()>>3;t=1===r?e.readString():2===r?e.readFloat():3===r?e.readDouble():4===r?e.readVarint64():5===r?e.readVarint():6===r?e.readSVarint():7===r?e.readBoolean():null}return t}(i))}e.exports=a,a.prototype.feature=function(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];var t=this._pbf.readVarint()+this._pbf.pos;return new r(this._pbf,t,this.extent,this._keys,this._values)}},6570:e=>{function t(e,t,r){r=r||2;var s,n,o,l,d,u,f,m=t&&t.length,g=m?t[0]*r:e.length,v=i(e,0,g,r,!0),y=[];if(!v||v.next===v.prev)return y;if(m&&(v=function(e,t,r,a){var s,n,o,l=[];for(s=0,n=t.length;s<n;s++)(o=i(e,t[s]*a,s<n-1?t[s+1]*a:e.length,a,!1))===o.next&&(o.steiner=!0),l.push(p(o));for(l.sort(h),s=0;s<l.length;s++)r=c(l[s],r);return r}(e,t,v,r)),e.length>80*r){s=o=e[0],n=l=e[1];for(var x=r;x<g;x+=r)(d=e[x])<s&&(s=d),(u=e[x+1])<n&&(n=u),d>o&&(o=d),u>l&&(l=u);f=0!==(f=Math.max(o-s,l-n))?32767/f:0}return a(v,y,r,s,n,f,0),y}function i(e,t,i,r,a){var s,n;if(a===E(e,t,i,r)>0)for(s=t;s<i;s+=r)n=A(s,e[s],e[s+1],n);else for(s=i-r;s>=t;s-=r)n=A(s,e[s],e[s+1],n);return n&&v(n,n.next)&&(M(n),n=n.next),n}function r(e,t){if(!e)return e;t||(t=e);var i,r=e;do{if(i=!1,r.steiner||!v(r,r.next)&&0!==g(r.prev,r,r.next))r=r.next;else{if(M(r),(r=t=r.prev)===r.next)break;i=!0}}while(i||r!==t);return t}function a(e,t,i,h,c,d,p){if(e){!p&&d&&function(e,t,i,r){var a=e;do{0===a.z&&(a.z=u(a.x,a.y,t,i,r)),a.prevZ=a.prev,a.nextZ=a.next,a=a.next}while(a!==e);a.prevZ.nextZ=null,a.prevZ=null,function(e){var t,i,r,a,s,n,o,l,h=1;do{for(i=e,e=null,s=null,n=0;i;){for(n++,r=i,o=0,t=0;t<h&&(o++,r=r.nextZ);t++);for(l=h;o>0||l>0&&r;)0!==o&&(0===l||!r||i.z<=r.z)?(a=i,i=i.nextZ,o--):(a=r,r=r.nextZ,l--),s?s.nextZ=a:e=a,a.prevZ=s,s=a;i=r}s.nextZ=null,h*=2}while(n>1)}(a)}(e,h,c,d);for(var f,m,g=e;e.prev!==e.next;)if(f=e.prev,m=e.next,d?n(e,h,c,d):s(e))t.push(f.i/i|0),t.push(e.i/i|0),t.push(m.i/i|0),M(e),e=m.next,g=m.next;else if((e=m)===g){p?1===p?a(e=o(r(e),t,i),t,i,h,c,d,2):2===p&&l(e,t,i,h,c,d):a(r(e),t,i,h,c,d,1);break}}}function s(e){var t=e.prev,i=e,r=e.next;if(g(t,i,r)>=0)return!1;for(var a=t.x,s=i.x,n=r.x,o=t.y,l=i.y,h=r.y,c=a<s?a<n?a:n:s<n?s:n,d=o<l?o<h?o:h:l<h?l:h,u=a>s?a>n?a:n:s>n?s:n,p=o>l?o>h?o:h:l>h?l:h,m=r.next;m!==t;){if(m.x>=c&&m.x<=u&&m.y>=d&&m.y<=p&&f(a,o,s,l,n,h,m.x,m.y)&&g(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function n(e,t,i,r){var a=e.prev,s=e,n=e.next;if(g(a,s,n)>=0)return!1;for(var o=a.x,l=s.x,h=n.x,c=a.y,d=s.y,p=n.y,m=o<l?o<h?o:h:l<h?l:h,v=c<d?c<p?c:p:d<p?d:p,y=o>l?o>h?o:h:l>h?l:h,x=c>d?c>p?c:p:d>p?d:p,b=u(m,v,t,i,r),w=u(y,x,t,i,r),_=e.prevZ,A=e.nextZ;_&&_.z>=b&&A&&A.z<=w;){if(_.x>=m&&_.x<=y&&_.y>=v&&_.y<=x&&_!==a&&_!==n&&f(o,c,l,d,h,p,_.x,_.y)&&g(_.prev,_,_.next)>=0)return!1;if(_=_.prevZ,A.x>=m&&A.x<=y&&A.y>=v&&A.y<=x&&A!==a&&A!==n&&f(o,c,l,d,h,p,A.x,A.y)&&g(A.prev,A,A.next)>=0)return!1;A=A.nextZ}for(;_&&_.z>=b;){if(_.x>=m&&_.x<=y&&_.y>=v&&_.y<=x&&_!==a&&_!==n&&f(o,c,l,d,h,p,_.x,_.y)&&g(_.prev,_,_.next)>=0)return!1;_=_.prevZ}for(;A&&A.z<=w;){if(A.x>=m&&A.x<=y&&A.y>=v&&A.y<=x&&A!==a&&A!==n&&f(o,c,l,d,h,p,A.x,A.y)&&g(A.prev,A,A.next)>=0)return!1;A=A.nextZ}return!0}function o(e,t,i){var a=e;do{var s=a.prev,n=a.next.next;!v(s,n)&&y(s,a,a.next,n)&&w(s,n)&&w(n,s)&&(t.push(s.i/i|0),t.push(a.i/i|0),t.push(n.i/i|0),M(a),M(a.next),a=e=n),a=a.next}while(a!==e);return r(a)}function l(e,t,i,s,n,o){var l=e;do{for(var h=l.next.next;h!==l.prev;){if(l.i!==h.i&&m(l,h)){var c=_(l,h);return l=r(l,l.next),c=r(c,c.next),a(l,t,i,s,n,o,0),void a(c,t,i,s,n,o,0)}h=h.next}l=l.next}while(l!==e)}function h(e,t){return e.x-t.x}function c(e,t){var i=function(e,t){var i,r=t,a=e.x,s=e.y,n=-1/0;do{if(s<=r.y&&s>=r.next.y&&r.next.y!==r.y){var o=r.x+(s-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(o<=a&&o>n&&(n=o,i=r.x<r.next.x?r:r.next,o===a))return i}r=r.next}while(r!==t);if(!i)return null;var l,h=i,c=i.x,u=i.y,p=1/0;r=i;do{a>=r.x&&r.x>=c&&a!==r.x&&f(s<u?a:n,s,c,u,s<u?n:a,s,r.x,r.y)&&(l=Math.abs(s-r.y)/(a-r.x),w(r,e)&&(l<p||l===p&&(r.x>i.x||r.x===i.x&&d(i,r)))&&(i=r,p=l)),r=r.next}while(r!==h);return i}(e,t);if(!i)return t;var a=_(i,e);return r(a,a.next),r(i,i.next)}function d(e,t){return g(e.prev,e,t.prev)<0&&g(t.next,e,e.next)<0}function u(e,t,i,r,a){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-i)*a|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-r)*a|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function p(e){var t=e,i=e;do{(t.x<i.x||t.x===i.x&&t.y<i.y)&&(i=t),t=t.next}while(t!==e);return i}function f(e,t,i,r,a,s,n,o){return(a-n)*(t-o)>=(e-n)*(s-o)&&(e-n)*(r-o)>=(i-n)*(t-o)&&(i-n)*(s-o)>=(a-n)*(r-o)}function m(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var i=e;do{if(i.i!==e.i&&i.next.i!==e.i&&i.i!==t.i&&i.next.i!==t.i&&y(i,i.next,e,t))return!0;i=i.next}while(i!==e);return!1}(e,t)&&(w(e,t)&&w(t,e)&&function(e,t){var i=e,r=!1,a=(e.x+t.x)/2,s=(e.y+t.y)/2;do{i.y>s!=i.next.y>s&&i.next.y!==i.y&&a<(i.next.x-i.x)*(s-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next}while(i!==e);return r}(e,t)&&(g(e.prev,e,t.prev)||g(e,t.prev,t))||v(e,t)&&g(e.prev,e,e.next)>0&&g(t.prev,t,t.next)>0)}function g(e,t,i){return(t.y-e.y)*(i.x-t.x)-(t.x-e.x)*(i.y-t.y)}function v(e,t){return e.x===t.x&&e.y===t.y}function y(e,t,i,r){var a=b(g(e,t,i)),s=b(g(e,t,r)),n=b(g(i,r,e)),o=b(g(i,r,t));return a!==s&&n!==o||!(0!==a||!x(e,i,t))||!(0!==s||!x(e,r,t))||!(0!==n||!x(i,e,r))||!(0!==o||!x(i,t,r))}function x(e,t,i){return t.x<=Math.max(e.x,i.x)&&t.x>=Math.min(e.x,i.x)&&t.y<=Math.max(e.y,i.y)&&t.y>=Math.min(e.y,i.y)}function b(e){return e>0?1:e<0?-1:0}function w(e,t){return g(e.prev,e,e.next)<0?g(e,t,e.next)>=0&&g(e,e.prev,t)>=0:g(e,t,e.prev)<0||g(e,e.next,t)<0}function _(e,t){var i=new T(e.i,e.x,e.y),r=new T(t.i,t.x,t.y),a=e.next,s=t.prev;return e.next=t,t.prev=e,i.next=a,a.prev=i,r.next=i,i.prev=r,s.next=r,r.prev=s,r}function A(e,t,i,r){var a=new T(e,t,i);return r?(a.next=r.next,a.prev=r,r.next.prev=a,r.next=a):(a.prev=a,a.next=a),a}function M(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function T(e,t,i){this.i=e,this.x=t,this.y=i,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function E(e,t,i,r){for(var a=0,s=t,n=i-r;s<i;s+=r)a+=(e[n]-e[s])*(e[s+1]+e[n+1]),n=s;return a}e.exports=t,e.exports.default=t,t.deviation=function(e,t,i,r){var a=t&&t.length,s=Math.abs(E(e,0,a?t[0]*i:e.length,i));if(a)for(var n=0,o=t.length;n<o;n++)s-=Math.abs(E(e,t[n]*i,n<o-1?t[n+1]*i:e.length,i));var l=0;for(n=0;n<r.length;n+=3){var h=r[n]*i,c=r[n+1]*i,d=r[n+2]*i;l+=Math.abs((e[h]-e[d])*(e[c+1]-e[h+1])-(e[h]-e[c])*(e[d+1]-e[h+1]))}return 0===s&&0===l?0:Math.abs((l-s)/s)},t.flatten=function(e){for(var t=e[0][0].length,i={vertices:[],holes:[],dimensions:t},r=0,a=0;a<e.length;a++){for(var s=0;s<e[a].length;s++)for(var n=0;n<t;n++)i.vertices.push(e[a][s][n]);a>0&&i.holes.push(r+=e[a-1].length)}return i}},251:(e,t)=>{
18
+ /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
19
+ t.read=function(e,t,i,r,a){var s,n,o=8*a-r-1,l=(1<<o)-1,h=l>>1,c=-7,d=i?a-1:0,u=i?-1:1,p=e[t+d];for(d+=u,s=p&(1<<-c)-1,p>>=-c,c+=o;c>0;s=256*s+e[t+d],d+=u,c-=8);for(n=s&(1<<-c)-1,s>>=-c,c+=r;c>0;n=256*n+e[t+d],d+=u,c-=8);if(0===s)s=1-h;else{if(s===l)return n?NaN:1/0*(p?-1:1);n+=Math.pow(2,r),s-=h}return(p?-1:1)*n*Math.pow(2,s-r)},t.write=function(e,t,i,r,a,s){var n,o,l,h=8*s-a-1,c=(1<<h)-1,d=c>>1,u=23===a?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:s-1,f=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(o=isNaN(t)?1:0,n=c):(n=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-n))<1&&(n--,l*=2),(t+=n+d>=1?u/l:u*Math.pow(2,1-d))*l>=2&&(n++,l/=2),n+d>=c?(o=0,n=c):n+d>=1?(o=(t*l-1)*Math.pow(2,a),n+=d):(o=t*Math.pow(2,d-1)*Math.pow(2,a),n=0));a>=8;e[i+p]=255&o,p+=f,o/=256,a-=8);for(n=n<<a|o,h+=a;h>0;e[i+p]=255&n,p+=f,n/=256,h-=8);e[i+p-f]|=128*m}},5335:(e,t,i)=>{e.exports=a;var r=i(251);function a(e){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(e)?e:new Uint8Array(e||0),this.pos=0,this.type=0,this.length=this.buf.length}a.Varint=0,a.Fixed64=1,a.Bytes=2,a.Fixed32=5;var s=4294967296,n=1/s,o="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function l(e){return e.type===a.Bytes?e.readVarint()+e.pos:e.pos+1}function h(e,t,i){return i?4294967296*t+(e>>>0):4294967296*(t>>>0)+(e>>>0)}function c(e,t,i){var r=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(7*Math.LN2));i.realloc(r);for(var a=i.pos-1;a>=e;a--)i.buf[a+r]=i.buf[a]}function d(e,t){for(var i=0;i<e.length;i++)t.writeVarint(e[i])}function u(e,t){for(var i=0;i<e.length;i++)t.writeSVarint(e[i])}function p(e,t){for(var i=0;i<e.length;i++)t.writeFloat(e[i])}function f(e,t){for(var i=0;i<e.length;i++)t.writeDouble(e[i])}function m(e,t){for(var i=0;i<e.length;i++)t.writeBoolean(e[i])}function g(e,t){for(var i=0;i<e.length;i++)t.writeFixed32(e[i])}function v(e,t){for(var i=0;i<e.length;i++)t.writeSFixed32(e[i])}function y(e,t){for(var i=0;i<e.length;i++)t.writeFixed64(e[i])}function x(e,t){for(var i=0;i<e.length;i++)t.writeSFixed64(e[i])}function b(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+16777216*e[t+3]}function w(e,t,i){e[i]=t,e[i+1]=t>>>8,e[i+2]=t>>>16,e[i+3]=t>>>24}function _(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}a.prototype={destroy:function(){this.buf=null},readFields:function(e,t,i){for(i=i||this.length;this.pos<i;){var r=this.readVarint(),a=r>>3,s=this.pos;this.type=7&r,e(a,t,this),this.pos===s&&this.skip(r)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=b(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=_(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=b(this.buf,this.pos)+b(this.buf,this.pos+4)*s;return this.pos+=8,e},readSFixed64:function(){var e=b(this.buf,this.pos)+_(this.buf,this.pos+4)*s;return this.pos+=8,e},readFloat:function(){var e=r.read(this.buf,this.pos,!0,23,4);return this.pos+=4,e},readDouble:function(){var e=r.read(this.buf,this.pos,!0,52,8);return this.pos+=8,e},readVarint:function(e){var t,i,r=this.buf;return t=127&(i=r[this.pos++]),i<128?t:(t|=(127&(i=r[this.pos++]))<<7,i<128?t:(t|=(127&(i=r[this.pos++]))<<14,i<128?t:(t|=(127&(i=r[this.pos++]))<<21,i<128?t:function(e,t,i){var r,a,s=i.buf;if(r=(112&(a=s[i.pos++]))>>4,a<128)return h(e,r,t);if(r|=(127&(a=s[i.pos++]))<<3,a<128)return h(e,r,t);if(r|=(127&(a=s[i.pos++]))<<10,a<128)return h(e,r,t);if(r|=(127&(a=s[i.pos++]))<<17,a<128)return h(e,r,t);if(r|=(127&(a=s[i.pos++]))<<24,a<128)return h(e,r,t);if(r|=(1&(a=s[i.pos++]))<<31,a<128)return h(e,r,t);throw new Error("Expected varint not more than 10 bytes")}(t|=(15&(i=r[this.pos]))<<28,e,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var e=this.readVarint();return e%2==1?(e+1)/-2:e/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=12&&o?function(e,t,i){return o.decode(e.subarray(t,i))}(this.buf,t,e):function(e,t,i){for(var r="",a=t;a<i;){var s,n,o,l=e[a],h=null,c=l>239?4:l>223?3:l>191?2:1;if(a+c>i)break;1===c?l<128&&(h=l):2===c?128==(192&(s=e[a+1]))&&(h=(31&l)<<6|63&s)<=127&&(h=null):3===c?(n=e[a+2],128==(192&(s=e[a+1]))&&128==(192&n)&&((h=(15&l)<<12|(63&s)<<6|63&n)<=2047||h>=55296&&h<=57343)&&(h=null)):4===c&&(n=e[a+2],o=e[a+3],128==(192&(s=e[a+1]))&&128==(192&n)&&128==(192&o)&&((h=(15&l)<<18|(63&s)<<12|(63&n)<<6|63&o)<=65535||h>=1114112)&&(h=null)),null===h?(h=65533,c=1):h>65535&&(h-=65536,r+=String.fromCharCode(h>>>10&1023|55296),h=56320|1023&h),r+=String.fromCharCode(h),a+=c}return r}(this.buf,t,e)},readBytes:function(){var e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t},readPackedVarint:function(e,t){if(this.type!==a.Bytes)return e.push(this.readVarint(t));var i=l(this);for(e=e||[];this.pos<i;)e.push(this.readVarint(t));return e},readPackedSVarint:function(e){if(this.type!==a.Bytes)return e.push(this.readSVarint());var t=l(this);for(e=e||[];this.pos<t;)e.push(this.readSVarint());return e},readPackedBoolean:function(e){if(this.type!==a.Bytes)return e.push(this.readBoolean());var t=l(this);for(e=e||[];this.pos<t;)e.push(this.readBoolean());return e},readPackedFloat:function(e){if(this.type!==a.Bytes)return e.push(this.readFloat());var t=l(this);for(e=e||[];this.pos<t;)e.push(this.readFloat());return e},readPackedDouble:function(e){if(this.type!==a.Bytes)return e.push(this.readDouble());var t=l(this);for(e=e||[];this.pos<t;)e.push(this.readDouble());return e},readPackedFixed32:function(e){if(this.type!==a.Bytes)return e.push(this.readFixed32());var t=l(this);for(e=e||[];this.pos<t;)e.push(this.readFixed32());return e},readPackedSFixed32:function(e){if(this.type!==a.Bytes)return e.push(this.readSFixed32());var t=l(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed32());return e},readPackedFixed64:function(e){if(this.type!==a.Bytes)return e.push(this.readFixed64());var t=l(this);for(e=e||[];this.pos<t;)e.push(this.readFixed64());return e},readPackedSFixed64:function(e){if(this.type!==a.Bytes)return e.push(this.readSFixed64());var t=l(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed64());return e},skip:function(e){var t=7&e;if(t===a.Varint)for(;this.buf[this.pos++]>127;);else if(t===a.Bytes)this.pos=this.readVarint()+this.pos;else if(t===a.Fixed32)this.pos+=4;else{if(t!==a.Fixed64)throw new Error("Unimplemented type: "+t);this.pos+=8}},writeTag:function(e,t){this.writeVarint(e<<3|t)},realloc:function(e){for(var t=this.length||16;t<this.pos+e;)t*=2;if(t!==this.length){var i=new Uint8Array(t);i.set(this.buf),this.buf=i,this.length=t}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(e){this.realloc(4),w(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),w(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),w(this.buf,-1&e,this.pos),w(this.buf,Math.floor(e*n),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),w(this.buf,-1&e,this.pos),w(this.buf,Math.floor(e*n),this.pos+4),this.pos+=8},writeVarint:function(e){(e=+e||0)>268435455||e<0?function(e,t){var i,r;if(e>=0?(i=e%4294967296|0,r=e/4294967296|0):(r=~(-e/4294967296),4294967295^(i=~(-e%4294967296))?i=i+1|0:(i=0,r=r+1|0)),e>=0x10000000000000000||e<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),function(e,t,i){i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,i.buf[i.pos]=127&(e>>>=7)}(i,0,t),function(e,t){var i=(7&e)<<4;t.buf[t.pos++]|=i|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e)))))}(r,t)}(e,this):(this.realloc(4),this.buf[this.pos++]=127&e|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=e>>>7&127))))},writeSVarint:function(e){this.writeVarint(e<0?2*-e-1:2*e)},writeBoolean:function(e){this.writeVarint(Boolean(e))},writeString:function(e){e=String(e),this.realloc(4*e.length),this.pos++;var t=this.pos;this.pos=function(e,t,i){for(var r,a,s=0;s<t.length;s++){if((r=t.charCodeAt(s))>55295&&r<57344){if(!a){r>56319||s+1===t.length?(e[i++]=239,e[i++]=191,e[i++]=189):a=r;continue}if(r<56320){e[i++]=239,e[i++]=191,e[i++]=189,a=r;continue}r=a-55296<<10|r-56320|65536,a=null}else a&&(e[i++]=239,e[i++]=191,e[i++]=189,a=null);r<128?e[i++]=r:(r<2048?e[i++]=r>>6|192:(r<65536?e[i++]=r>>12|224:(e[i++]=r>>18|240,e[i++]=r>>12&63|128),e[i++]=r>>6&63|128),e[i++]=63&r|128)}return i}(this.buf,e,this.pos);var i=this.pos-t;i>=128&&c(t,i,this),this.pos=t-1,this.writeVarint(i),this.pos+=i},writeFloat:function(e){this.realloc(4),r.write(this.buf,e,this.pos,!0,23,4),this.pos+=4},writeDouble:function(e){this.realloc(8),r.write(this.buf,e,this.pos,!0,52,8),this.pos+=8},writeBytes:function(e){var t=e.length;this.writeVarint(t),this.realloc(t);for(var i=0;i<t;i++)this.buf[this.pos++]=e[i]},writeRawMessage:function(e,t){this.pos++;var i=this.pos;e(t,this);var r=this.pos-i;r>=128&&c(i,r,this),this.pos=i-1,this.writeVarint(r),this.pos+=r},writeMessage:function(e,t,i){this.writeTag(e,a.Bytes),this.writeRawMessage(t,i)},writePackedVarint:function(e,t){t.length&&this.writeMessage(e,d,t)},writePackedSVarint:function(e,t){t.length&&this.writeMessage(e,u,t)},writePackedBoolean:function(e,t){t.length&&this.writeMessage(e,m,t)},writePackedFloat:function(e,t){t.length&&this.writeMessage(e,p,t)},writePackedDouble:function(e,t){t.length&&this.writeMessage(e,f,t)},writePackedFixed32:function(e,t){t.length&&this.writeMessage(e,g,t)},writePackedSFixed32:function(e,t){t.length&&this.writeMessage(e,v,t)},writePackedFixed64:function(e,t){t.length&&this.writeMessage(e,y,t)},writePackedSFixed64:function(e,t){t.length&&this.writeMessage(e,x,t)},writeBytesField:function(e,t){this.writeTag(e,a.Bytes),this.writeBytes(t)},writeFixed32Field:function(e,t){this.writeTag(e,a.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(e,t){this.writeTag(e,a.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(e,t){this.writeTag(e,a.Fixed64),this.writeFixed64(t)},writeSFixed64Field:function(e,t){this.writeTag(e,a.Fixed64),this.writeSFixed64(t)},writeVarintField:function(e,t){this.writeTag(e,a.Varint),this.writeVarint(t)},writeSVarintField:function(e,t){this.writeTag(e,a.Varint),this.writeSVarint(t)},writeStringField:function(e,t){this.writeTag(e,a.Bytes),this.writeString(t)},writeFloatField:function(e,t){this.writeTag(e,a.Fixed32),this.writeFloat(t)},writeDoubleField:function(e,t){this.writeTag(e,a.Fixed64),this.writeDouble(t)},writeBooleanField:function(e,t){this.writeVarintField(e,Boolean(t))}}},3841:e=>{e.exports=function(e,t,i,r){var a=e[0],s=e[1],n=!1;void 0===i&&(i=0),void 0===r&&(r=t.length);for(var o=(r-i)/2,l=0,h=o-1;l<o;h=l++){var c=t[i+2*l+0],d=t[i+2*l+1],u=t[i+2*h+1];d>s!=u>s&&a<(t[i+2*h+0]-c)*(s-d)/(u-d)+c&&(n=!n)}return n}},1476:(e,t,i)=>{var r=i(3841),a=i(1137);e.exports=function(e,t,i,s){return t.length>0&&Array.isArray(t[0])?a(e,t,i,s):r(e,t,i,s)},e.exports.nested=a,e.exports.flat=r},1137:e=>{e.exports=function(e,t,i,r){var a=e[0],s=e[1],n=!1;void 0===i&&(i=0),void 0===r&&(r=t.length);for(var o=r-i,l=0,h=o-1;l<o;h=l++){var c=t[l+i][0],d=t[l+i][1],u=t[h+i][1];d>s!=u>s&&a<(t[h+i][0]-c)*(s-d)/(u-d)+c&&(n=!n)}return n}},5341:function(e){e.exports=function(){function e(e,r,a,s,n){!function e(i,r,a,s,n){for(;s>a;){if(s-a>600){var o=s-a+1,l=r-a+1,h=Math.log(o),c=.5*Math.exp(2*h/3),d=.5*Math.sqrt(h*c*(o-c)/o)*(l-o/2<0?-1:1);e(i,r,Math.max(a,Math.floor(r-l*c/o+d)),Math.min(s,Math.floor(r+(o-l)*c/o+d)),n)}var u=i[r],p=a,f=s;for(t(i,a,r),n(i[s],u)>0&&t(i,a,s);p<f;){for(t(i,p,f),p++,f--;n(i[p],u)<0;)p++;for(;n(i[f],u)>0;)f--}0===n(i[a],u)?t(i,a,f):t(i,++f,s),f<=r&&(a=f+1),r<=f&&(s=f-1)}}(e,r,a||0,s||e.length-1,n||i)}function t(e,t,i){var r=e[t];e[t]=e[i],e[i]=r}function i(e,t){return e<t?-1:e>t?1:0}var r=function(e){void 0===e&&(e=9),this._maxEntries=Math.max(4,e),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function a(e,t,i){if(!i)return t.indexOf(e);for(var r=0;r<t.length;r++)if(i(e,t[r]))return r;return-1}function s(e,t){n(e,0,e.children.length,t,e)}function n(e,t,i,r,a){a||(a=f(null)),a.minX=1/0,a.minY=1/0,a.maxX=-1/0,a.maxY=-1/0;for(var s=t;s<i;s++){var n=e.children[s];o(a,e.leaf?r(n):n)}return a}function o(e,t){return e.minX=Math.min(e.minX,t.minX),e.minY=Math.min(e.minY,t.minY),e.maxX=Math.max(e.maxX,t.maxX),e.maxY=Math.max(e.maxY,t.maxY),e}function l(e,t){return e.minX-t.minX}function h(e,t){return e.minY-t.minY}function c(e){return(e.maxX-e.minX)*(e.maxY-e.minY)}function d(e){return e.maxX-e.minX+(e.maxY-e.minY)}function u(e,t){return e.minX<=t.minX&&e.minY<=t.minY&&t.maxX<=e.maxX&&t.maxY<=e.maxY}function p(e,t){return t.minX<=e.maxX&&t.minY<=e.maxY&&t.maxX>=e.minX&&t.maxY>=e.minY}function f(e){return{children:e,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function m(t,i,r,a,s){for(var n=[i,r];n.length;)if(!((r=n.pop())-(i=n.pop())<=a)){var o=i+Math.ceil((r-i)/a/2)*a;e(t,o,i,r,s),n.push(i,o,o,r)}}return r.prototype.all=function(){return this._all(this.data,[])},r.prototype.search=function(e){var t=this.data,i=[];if(!p(e,t))return i;for(var r=this.toBBox,a=[];t;){for(var s=0;s<t.children.length;s++){var n=t.children[s],o=t.leaf?r(n):n;p(e,o)&&(t.leaf?i.push(n):u(e,o)?this._all(n,i):a.push(n))}t=a.pop()}return i},r.prototype.collides=function(e){var t=this.data;if(!p(e,t))return!1;for(var i=[];t;){for(var r=0;r<t.children.length;r++){var a=t.children[r],s=t.leaf?this.toBBox(a):a;if(p(e,s)){if(t.leaf||u(e,s))return!0;i.push(a)}}t=i.pop()}return!1},r.prototype.load=function(e){if(!e||!e.length)return this;if(e.length<this._minEntries){for(var t=0;t<e.length;t++)this.insert(e[t]);return this}var i=this._build(e.slice(),0,e.length-1,0);if(this.data.children.length)if(this.data.height===i.height)this._splitRoot(this.data,i);else{if(this.data.height<i.height){var r=this.data;this.data=i,i=r}this._insert(i,this.data.height-i.height-1,!0)}else this.data=i;return this},r.prototype.insert=function(e){return e&&this._insert(e,this.data.height-1),this},r.prototype.clear=function(){return this.data=f([]),this},r.prototype.remove=function(e,t){if(!e)return this;for(var i,r,s,n=this.data,o=this.toBBox(e),l=[],h=[];n||l.length;){if(n||(n=l.pop(),r=l[l.length-1],i=h.pop(),s=!0),n.leaf){var c=a(e,n.children,t);if(-1!==c)return n.children.splice(c,1),l.push(n),this._condense(l),this}s||n.leaf||!u(n,o)?r?(i++,n=r.children[i],s=!1):n=null:(l.push(n),h.push(i),i=0,r=n,n=n.children[0])}return this},r.prototype.toBBox=function(e){return e},r.prototype.compareMinX=function(e,t){return e.minX-t.minX},r.prototype.compareMinY=function(e,t){return e.minY-t.minY},r.prototype.toJSON=function(){return this.data},r.prototype.fromJSON=function(e){return this.data=e,this},r.prototype._all=function(e,t){for(var i=[];e;)e.leaf?t.push.apply(t,e.children):i.push.apply(i,e.children),e=i.pop();return t},r.prototype._build=function(e,t,i,r){var a,n=i-t+1,o=this._maxEntries;if(n<=o)return s(a=f(e.slice(t,i+1)),this.toBBox),a;r||(r=Math.ceil(Math.log(n)/Math.log(o)),o=Math.ceil(n/Math.pow(o,r-1))),(a=f([])).leaf=!1,a.height=r;var l=Math.ceil(n/o),h=l*Math.ceil(Math.sqrt(o));m(e,t,i,h,this.compareMinX);for(var c=t;c<=i;c+=h){var d=Math.min(c+h-1,i);m(e,c,d,l,this.compareMinY);for(var u=c;u<=d;u+=l){var p=Math.min(u+l-1,d);a.children.push(this._build(e,u,p,r-1))}}return s(a,this.toBBox),a},r.prototype._chooseSubtree=function(e,t,i,r){for(;r.push(t),!t.leaf&&r.length-1!==i;){for(var a=1/0,s=1/0,n=void 0,o=0;o<t.children.length;o++){var l=t.children[o],h=c(l),d=(u=e,p=l,(Math.max(p.maxX,u.maxX)-Math.min(p.minX,u.minX))*(Math.max(p.maxY,u.maxY)-Math.min(p.minY,u.minY))-h);d<s?(s=d,a=h<a?h:a,n=l):d===s&&h<a&&(a=h,n=l)}t=n||t.children[0]}var u,p;return t},r.prototype._insert=function(e,t,i){var r=i?e:this.toBBox(e),a=[],s=this._chooseSubtree(r,this.data,t,a);for(s.children.push(e),o(s,r);t>=0&&a[t].children.length>this._maxEntries;)this._split(a,t),t--;this._adjustParentBBoxes(r,a,t)},r.prototype._split=function(e,t){var i=e[t],r=i.children.length,a=this._minEntries;this._chooseSplitAxis(i,a,r);var n=this._chooseSplitIndex(i,a,r),o=f(i.children.splice(n,i.children.length-n));o.height=i.height,o.leaf=i.leaf,s(i,this.toBBox),s(o,this.toBBox),t?e[t-1].children.push(o):this._splitRoot(i,o)},r.prototype._splitRoot=function(e,t){this.data=f([e,t]),this.data.height=e.height+1,this.data.leaf=!1,s(this.data,this.toBBox)},r.prototype._chooseSplitIndex=function(e,t,i){for(var r,a,s,o,l,h,d,u=1/0,p=1/0,f=t;f<=i-t;f++){var m=n(e,0,f,this.toBBox),g=n(e,f,i,this.toBBox),v=(a=m,s=g,o=Math.max(a.minX,s.minX),l=Math.max(a.minY,s.minY),h=Math.min(a.maxX,s.maxX),d=Math.min(a.maxY,s.maxY),Math.max(0,h-o)*Math.max(0,d-l)),y=c(m)+c(g);v<u?(u=v,r=f,p=y<p?y:p):v===u&&y<p&&(p=y,r=f)}return r||i-t},r.prototype._chooseSplitAxis=function(e,t,i){var r=e.leaf?this.compareMinX:l,a=e.leaf?this.compareMinY:h;this._allDistMargin(e,t,i,r)<this._allDistMargin(e,t,i,a)&&e.children.sort(r)},r.prototype._allDistMargin=function(e,t,i,r){e.children.sort(r);for(var a=this.toBBox,s=n(e,0,t,a),l=n(e,i-t,i,a),h=d(s)+d(l),c=t;c<i-t;c++){var u=e.children[c];o(s,e.leaf?a(u):u),h+=d(s)}for(var p=i-t-1;p>=t;p--){var f=e.children[p];o(l,e.leaf?a(f):f),h+=d(l)}return h},r.prototype._adjustParentBBoxes=function(e,t,i){for(var r=i;r>=0;r--)o(t[r],e)},r.prototype._condense=function(e){for(var t=e.length-1,i=void 0;t>=0;t--)0===e[t].children.length?t>0?(i=e[t-1].children).splice(i.indexOf(e[t]),1):this.clear():s(e[t],this.toBBox)},r}()},3886:(e,t,i)=>{var r=i(5335),a=i(3562);function s(e){var t=new r;return function(e,t){for(var i in e.layers)t.writeMessage(3,n,e.layers[i])}(e,t),t.finish()}function n(e,t){var i;t.writeVarintField(15,e.version||1),t.writeStringField(1,e.name||""),t.writeVarintField(5,e.extent||4096);var r={keys:[],values:[],keycache:{},valuecache:{}};for(i=0;i<e.length;i++)r.feature=e.feature(i),t.writeMessage(2,o,r);var a=r.keys;for(i=0;i<a.length;i++)t.writeStringField(3,a[i]);var s=r.values;for(i=0;i<s.length;i++)t.writeMessage(4,u,s[i])}function o(e,t){var i=e.feature;void 0!==i.id&&t.writeVarintField(1,i.id),t.writeMessage(2,l,e),t.writeVarintField(3,i.type),t.writeMessage(4,d,i)}function l(e,t){var i=e.feature,r=e.keys,a=e.values,s=e.keycache,n=e.valuecache;for(var o in i.properties){var l=i.properties[o],h=s[o];if(null!==l){void 0===h&&(r.push(o),s[o]=h=r.length-1),t.writeVarint(h);var c=typeof l;"string"!==c&&"boolean"!==c&&"number"!==c&&(l=JSON.stringify(l));var d=c+":"+l,u=n[d];void 0===u&&(a.push(l),n[d]=u=a.length-1),t.writeVarint(u)}}}function h(e,t){return(t<<3)+(7&e)}function c(e){return e<<1^e>>31}function d(e,t){for(var i=e.loadGeometry(),r=e.type,a=0,s=0,n=i.length,o=0;o<n;o++){var l=i[o],d=1;1===r&&(d=l.length),t.writeVarint(h(1,d));for(var u=3===r?l.length-1:l.length,p=0;p<u;p++){1===p&&1!==r&&t.writeVarint(h(2,u-1));var f=l[p].x-a,m=l[p].y-s;t.writeVarint(c(f)),t.writeVarint(c(m)),a+=f,s+=m}3===r&&t.writeVarint(h(7,1))}}function u(e,t){var i=typeof e;"string"===i?t.writeStringField(1,e):"boolean"===i?t.writeBooleanField(7,e):"number"===i&&(e%1!=0?t.writeDoubleField(3,e):e<0?t.writeSVarintField(6,e):t.writeVarintField(5,e))}e.exports=s,e.exports.fromVectorTileJs=s,e.exports.fromGeojsonVt=function(e,t){t=t||{};var i={};for(var r in e)i[r]=new a(e[r].features,t),i[r].name=r,i[r].version=t.version,i[r].extent=t.extent;return s({layers:i})},e.exports.GeoJSONWrapper=a},3562:(e,t,i)=>{var r=i(4748),a=i(4537).VectorTileFeature;function s(e,t){this.options=t||{},this.features=e,this.length=e.length}function n(e,t){this.id="number"==typeof e.id?e.id:void 0,this.type=e.type,this.rawGeometry=1===e.type?[e.geometry]:e.geometry,this.properties=e.tags,this.extent=t||4096}e.exports=s,s.prototype.feature=function(e){return new n(this.features[e],this.options.extent)},n.prototype.loadGeometry=function(){var e=this.rawGeometry;this.geometry=[];for(var t=0;t<e.length;t++){for(var i=e[t],a=[],s=0;s<i.length;s++)a.push(new r(i[s][0],i[s][1]));this.geometry.push(a)}return this.geometry},n.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var e=this.geometry,t=1/0,i=-1/0,r=1/0,a=-1/0,s=0;s<e.length;s++)for(var n=e[s],o=0;o<n.length;o++){var l=n[o];t=Math.min(t,l.x),i=Math.max(i,l.x),r=Math.min(r,l.y),a=Math.max(a,l.y)}return[t,r,i,a]},n.prototype.toGeoJSON=a.prototype.toGeoJSON}},t={};function i(r){var a=t[r];if(void 0!==a)return a.exports;var s=t[r]={exports:{}};return e[r].call(s.exports,s,s.exports,i),s.exports}i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};return(()=>{i.r(r);class e extends Error{}Error,Error;class t extends Error{constructor(e,t){super(e),this.response=t}}const a=e=>Array.isArray(e)?"array":e instanceof Date?"date":typeof e,s=e=>"object"===a(e),n=function(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if((e=>null==e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||e instanceof Date||e instanceof RegExp)(e))return e;if((r=e)&&"undefined"!=typeof ArrayBuffer&&r instanceof ArrayBuffer)return t&&!t.includes(e)&&t.push(e),e;var r;if(ArrayBuffer.isView(e)){const i=e;return t&&!t.includes(i.buffer)&&t.push(i.buffer),i}if(e instanceof ImageData)return t&&!t.includes(e.data.buffer)&&t.push(e.data.buffer),e;if(e instanceof ImageBitmap)return t&&!t.includes(e)&&t.push(e),e;if(Array.isArray(e)){const i=[];for(let r=0;r<e.length;r++)i.push(n(e[r],t));return i}if(s(e))return Object.keys(e).reduce(((r,a)=>{const s=0===i.length||i.length>0&&(i.includes(a)||((e,t)=>{let i=!1;return t.forEach((t=>{new RegExp(t).test(e)&&(i=!0)})),i})(a,i));return r[a]=s?n(e[a],t,i):e[a],r}),{});throw new Error("[MapsGL] Can't serialize object of type "+typeof e)};function o(){let e=0,t=0;for(let i=0;i<28;i+=7){let r=this.buf[this.pos++];if(e|=(127&r)<<i,!(128&r))return this.assertBounds(),[e,t]}let i=this.buf[this.pos++];if(e|=(15&i)<<28,t=(112&i)>>4,!(128&i))return this.assertBounds(),[e,t];for(let i=3;i<=31;i+=7){let r=this.buf[this.pos++];if(t|=(127&r)<<i,!(128&r))return this.assertBounds(),[e,t]}throw new Error("invalid varint")}const l=4294967296;function h(e){let t="-"==e[0];t&&(e=e.slice(1));const i=1e6;let r=0,a=0;function s(t,s){const n=Number(e.slice(t,s));a*=i,r=r*i+n,r>=l&&(a+=r/l|0,r%=l)}return s(-24,-18),s(-18,-12),s(-12,-6),s(-6),[t,r,a]}function c(e,t){if(t<=2097151)return""+(l*t+e);let i=(e>>>24|t<<8)>>>0&16777215,r=t>>16&65535,a=(16777215&e)+6777216*i+6710656*r,s=i+8147497*r,n=2*r,o=1e7;function h(e,t){let i=e?String(e):"";return t?"0000000".slice(i.length)+i:i}return a>=o&&(s+=Math.floor(a/o),a%=o),s>=o&&(n+=Math.floor(s/o),s%=o),h(n,0)+h(s,n)+h(a,1)}function d(){let e=this.buf[this.pos++],t=127&e;if(!(128&e))return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(127&e)<<7,!(128&e))return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(127&e)<<14,!(128&e))return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(127&e)<<21,!(128&e))return this.assertBounds(),t;e=this.buf[this.pos++],t|=(15&e)<<28;for(let t=5;128&e&&t<10;t++)e=this.buf[this.pos++];if(128&e)throw new Error("invalid varint");return this.assertBounds(),t>>>0}const u=function(){const e=new DataView(new ArrayBuffer(8));return void 0!==globalThis.BigInt&&"function"==typeof e.getBigInt64&&"function"==typeof e.getBigUint64&&"function"==typeof e.setBigInt64&&"function"==typeof e.setBigUint64?{MIN:BigInt("-9223372036854775808"),MAX:BigInt("9223372036854775807"),UMIN:BigInt("0"),UMAX:BigInt("18446744073709551615"),C:BigInt,V:e}:void 0}();function p(e){if(!e)throw new Error("BigInt unavailable, see https://github.com/timostamm/protobuf-ts/blob/v1.0.8/MANUAL.md#bigint-support")}const f=/^-?[0-9]+$/,m=4294967296;class g{constructor(e,t){this.lo=0|e,this.hi=0|t}isZero(){return 0==this.lo&&0==this.hi}toNumber(){let e=this.hi*m+(this.lo>>>0);if(!Number.isSafeInteger(e))throw new Error("cannot convert to safe number");return e}}class v extends g{static from(e){if(u)switch(typeof e){case"string":if("0"==e)return this.ZERO;if(""==e)throw new Error("string is no integer");e=u.C(e);case"number":if(0===e)return this.ZERO;e=u.C(e);case"bigint":if(!e)return this.ZERO;if(e<u.UMIN)throw new Error("signed value for ulong");if(e>u.UMAX)throw new Error("ulong too large");return u.V.setBigUint64(0,e,!0),new v(u.V.getInt32(0,!0),u.V.getInt32(4,!0))}else switch(typeof e){case"string":if("0"==e)return this.ZERO;if(e=e.trim(),!f.test(e))throw new Error("string is no integer");let[t,i,r]=h(e);if(t)throw new Error("signed value");return new v(i,r);case"number":if(0==e)return this.ZERO;if(!Number.isSafeInteger(e))throw new Error("number is no integer");if(e<0)throw new Error("signed value for ulong");return new v(e,e/m)}throw new Error("unknown value "+typeof e)}toString(){return u?this.toBigInt().toString():c(this.lo,this.hi)}toBigInt(){return p(u),u.V.setInt32(0,this.lo,!0),u.V.setInt32(4,this.hi,!0),u.V.getBigUint64(0,!0)}}v.ZERO=new v(0,0);class y extends g{static from(e){if(u)switch(typeof e){case"string":if("0"==e)return this.ZERO;if(""==e)throw new Error("string is no integer");e=u.C(e);case"number":if(0===e)return this.ZERO;e=u.C(e);case"bigint":if(!e)return this.ZERO;if(e<u.MIN)throw new Error("ulong too small");if(e>u.MAX)throw new Error("ulong too large");return u.V.setBigInt64(0,e,!0),new y(u.V.getInt32(0,!0),u.V.getInt32(4,!0))}else switch(typeof e){case"string":if("0"==e)return this.ZERO;if(e=e.trim(),!f.test(e))throw new Error("string is no integer");let[t,i,r]=h(e),a=new y(i,r);return t?a.negate():a;case"number":if(0==e)return this.ZERO;if(!Number.isSafeInteger(e))throw new Error("number is no integer");return e>0?new y(e,e/m):new y(-e,-e/m).negate()}throw new Error("unknown value "+typeof e)}isNegative(){return!!(2147483648&this.hi)}negate(){let e=~this.hi,t=this.lo;return t?t=1+~t:e+=1,new y(t,e)}toString(){if(u)return this.toBigInt().toString();if(this.isNegative()){let e=this.negate();return"-"+c(e.lo,e.hi)}return c(this.lo,this.hi)}toBigInt(){return p(u),u.V.setInt32(0,this.lo,!0),u.V.setInt32(4,this.hi,!0),u.V.getBigInt64(0,!0)}}var x,b;y.ZERO=new y(0,0),function(e){e.symbol=Symbol("protobuf-ts/unknown"),e.onRead=(i,r,a,s,n)=>{(t(r)?r[e.symbol]:r[e.symbol]=[]).push({no:a,wireType:s,data:n})},e.onWrite=(t,i,r)=>{for(let{no:t,wireType:a,data:s}of e.list(i))r.tag(t,a).raw(s)},e.list=(i,r)=>{if(t(i)){let t=i[e.symbol];return r?t.filter((e=>e.no==r)):t}return[]},e.last=(t,i)=>e.list(t,i).slice(-1)[0];const t=t=>t&&Array.isArray(t[e.symbol])}(x||(x={})),function(e){e[e.Varint=0]="Varint",e[e.Bit64=1]="Bit64",e[e.LengthDelimited=2]="LengthDelimited",e[e.StartGroup=3]="StartGroup",e[e.EndGroup=4]="EndGroup",e[e.Bit32=5]="Bit32"}(b||(b={}));const w=e=>String.fromCharCode.apply(String,e);class _{constructor(e){this.varint64=o,this.uint32=d,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength)}tag(){let e=this.uint32(),t=e>>>3,i=7&e;if(t<=0||i<0||i>5)throw new Error("illegal tag: field no "+t+" wire type "+i);return[t,i]}skip(e){let t=this.pos;switch(e){case b.Bit64:this.pos+=4;case b.Bit32:this.pos+=4;break;case b.LengthDelimited:let e=this.uint32();this.pos+=e;break;case b.Varint:for(;128&this.buf[this.pos++];);}return this.assertBounds(),this.buf.slice(t,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return 0|this.uint32()}sint32(){let e=this.uint32();return e>>>1^-(1&e)}int64(){return new y(...this.varint64())}uint64(){return new v(...this.varint64())}sint64(){let[e,t]=this.varint64(),i=-(1&e);return e=(e>>>1|(1&t)<<31)^i,t=t>>>1^i,new y(e,t)}bool(){let[e,t]=this.varint64();return 0!==e||0!==t}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return new v(this.sfixed32(),this.sfixed32())}sfixed64(){return new y(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let e=this.uint32(),t=this.pos;return this.pos+=e,this.assertBounds(),this.buf.slice(t,this.pos)}string(){return function(e){if(e.length<1)return"";let t,i=0,r=[],a=[],s=0,n=e.length;for(;i<n;)t=e[i++],t<128?a[s++]=t:t>191&&t<224?a[s++]=(31&t)<<6|63&e[i++]:t>239&&t<365?(t=((7&t)<<18|(63&e[i++])<<12|(63&e[i++])<<6|63&e[i++])-65536,a[s++]=55296+(t>>10),a[s++]=56320+(1023&t)):a[s++]=(15&t)<<12|(63&e[i++])<<6|63&e[i++],s>8191&&(r.push(w(a)),s=0);return r.length?(s&&r.push(w(a.slice(0,s))),r.join("")):w(a.slice(0,s))}(this.bytes())}}var A=function(e,t){this.x=e,this.y=t},M=function(e,t){void 0===t&&(t="number"),this.longType=t,this.layers={},this.reader=new _(e);for(var i=this.reader.len;this.reader.pos<i;){this.reader.uint32();var r=new T(this.reader,this.reader.uint32()+this.reader.pos,this.longType);r.length&&(this.layers[r.name]=r)}},T=function(){function e(e,t,i){for(this.reader=e,this.longType=i,this.name="",this.version=0,this.extent=0,this.featureOffsets=[],this.keys=[],this.values=[];e.pos<t;){var r=e.tag(),a=r[0],s=r[1];15==a?this.version=e.uint32():1==a?this.name=e.string():5==a?this.extent=e.uint32():2==a?(this.featureOffsets.push(e.pos),e.skip(s)):3==a?this.keys.push(e.string()):4==a&&this.values.push(this.decodeValue())}this.length=this.featureOffsets.length}var t=e.prototype;return t.feature=function(e){if(e<0||e>=this.featureOffsets.length)throw new Error("out of bounds");this.reader.pos=this.featureOffsets[e];var t=this.reader.uint32()+this.reader.pos;return new E(this.reader,t,this.keys,this.values,this.extent)},t.decodeValue=function(){for(var e=this.reader,t=e.uint32()+e.pos,i=null;e.pos<t;){var r=e.tag()[0];i=1==r?e.string():2==r?e.float():3==r?e.double():4==r?this.convertLong(e.int64()):5==r?this.convertLong(e.uint64()):6==r?this.convertLong(e.sint64()):7==r?e.bool():null}return i},t.convertLong=function(e){switch(this.longType){case"number":return e.toNumber();case"string":return e.toString();case"bigint":return e.toBigInt()}},e}(),E=function(){function e(e,t,i,r,a){for(this.reader=e,this.extent=a,this.type=0,this.properties={},this.geometryOffset=0;e.pos<t;){var s=e.tag(),n=s[0],o=s[1];if(1==n)this.id=e.int64().toString();else if(2==n)for(var l=e.uint32()+e.pos;e.pos<l;){var h=i[e.uint32()],c=r[e.uint32()];this.properties[h]=c}else 3==n?this.type=e.uint32():4==n&&(this.geometryOffset=e.pos,e.skip(o))}}var t=e.prototype;return t.loadGeometry=function(){this.reader.pos=this.geometryOffset;for(var e=this.reader.uint32()+this.reader.pos,t=1,i=0,r=0,a=0,s=[],n=null;this.reader.pos<e;){if(i<=0){var o=this.reader.uint32();t=7&o,i=o>>>3}var l;--i,1==t||2==t?(r+=this.reader.sint32(),a+=this.reader.sint32(),1==t&&(n&&s.push(n),n=[]),null==(l=n)||l.push(new A(r,a))):7==t&&n&&n.push(new A(n[0].x,n[0].y))}return n&&s.push(n),s},t.bbox=function(){this.reader.pos=this.geometryOffset;for(var e=this.reader.uint32()+this.reader.pos,t=0,i=0,r=0,a=0,s=Number.MAX_SAFE_INTEGER,n=Number.MIN_SAFE_INTEGER,o=Number.MAX_SAFE_INTEGER,l=Number.MIN_SAFE_INTEGER;this.reader.pos<e;){if(i<=0){var h=this.reader.uint32();t=7&h,i=h>>>3}--i,1!=t&&2!=t||(r+=this.reader.sint32(),a+=this.reader.sint32(),n=Math.max(r,n),s=Math.min(r,s),l=Math.max(a,l),o=Math.min(a,o))}return[s,o,n,l]},t.toGeoJSON=function(e,t,i){var r,a=this.extent*Math.pow(2,i),s=this.extent*e,n=this.extent*t,o="",l=function(e){return e.map((function(e){return[360*(e.x+s)/a-180,360/Math.PI*Math.atan(Math.exp((180-360*(e.y+n)/a)*Math.PI/180))-90]}))};switch(this.type){case 1:o="Point",r=l(this.asPoints());break;case 2:o="LineString",r=this.asLines().map((function(e){return l(e)}));break;case 3:o="Polygon",(r=this.asPolygons()).forEach((function(e,t){e.forEach((function(e,i){r[t][i]=l(e)}))}))}1==r.length?r=r[0]:o="Multi"+o;var h={type:"Feature",geometry:{type:o,coordinates:r},properties:this.properties};return null!=this.id&&(h.id=this.id),h},t.asPoints=function(){var e=this.loadGeometry().map((function(e){return e[0]}));return 1==this.type?e:null},t.asLines=function(){return 2==this.type?this.loadGeometry():null},t.asPolygons=function(){return 3==this.type?function(e){var t=e.length;if(t<=1)return[e];for(var i=[],r=null,a=0;a<t;a++){var s,n=S(e[a]);0!=n&&(n>0?(r&&i.push(r),r=[e[a]]):null==(s=r)||s.push(e[a]))}return r&&i.push(r),i}(this.loadGeometry()):null},e}();function S(e){for(var t=0,i=0,r=e.length,a=r-1;i<r;a=i++){var s=e[i],n=e[a];t+=(n.x-s.x)*(s.y+n.y)}return t}function C(e,t,i,r){for(var a,s=r,n=i-t>>1,o=i-t,l=e[t],h=e[t+1],c=e[i],d=e[i+1],u=t+3;u<i;u+=3){var p=O(e[u],e[u+1],l,h,c,d);if(p>s)a=u,s=p;else if(p===s){var f=Math.abs(u-n);f<o&&(a=u,o=f)}}s>r&&(a-t>3&&C(e,t,a,r),e[a+2]=s,i-a>3&&C(e,a,i,r))}function O(e,t,i,r,a,s){var n=a-i,o=s-r;if(0!==n||0!==o){var l=((e-i)*n+(t-r)*o)/(n*n+o*o);l>1?(i=a,r=s):l>0&&(i+=n*l,r+=o*l)}return(n=e-i)*n+(o=t-r)*o}function R(e,t,i,r){var a={id:void 0===e?null:e,type:t,geometry:i,tags:r,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(e){var t=e.geometry,i=e.type;if("Point"===i||"MultiPoint"===i||"LineString"===i)I(e,t);else if("Polygon"===i||"MultiLineString"===i)for(var r=0;r<t.length;r++)I(e,t[r]);else if("MultiPolygon"===i)for(r=0;r<t.length;r++)for(var a=0;a<t[r].length;a++)I(e,t[r][a])}(a),a}function I(e,t){for(var i=0;i<t.length;i+=3)e.minX=Math.min(e.minX,t[i]),e.minY=Math.min(e.minY,t[i+1]),e.maxX=Math.max(e.maxX,t[i]),e.maxY=Math.max(e.maxY,t[i+1])}function P(e,t,i,r){if(t.geometry){var a=t.geometry.coordinates,s=t.geometry.type,n=Math.pow(i.tolerance/((1<<i.maxZoom)*i.extent),2),o=[],l=t.id;if(i.promoteId?l=t.properties[i.promoteId]:i.generateId&&(l=r||0),"Point"===s)D(a,o);else if("MultiPoint"===s)for(var h=0;h<a.length;h++)D(a[h],o);else if("LineString"===s)z(a,o,n,!1);else if("MultiLineString"===s){if(i.lineMetrics){for(h=0;h<a.length;h++)z(a[h],o=[],n,!1),e.push(R(l,"LineString",o,t.properties));return}L(a,o,n,!1)}else if("Polygon"===s)L(a,o,n,!0);else{if("MultiPolygon"!==s){if("GeometryCollection"===s){for(h=0;h<t.geometry.geometries.length;h++)P(e,{id:l,geometry:t.geometry.geometries[h],properties:t.properties},i,r);return}throw new Error("Input data is not a valid GeoJSON object.")}for(h=0;h<a.length;h++){var c=[];L(a[h],c,n,!0),o.push(c)}}e.push(R(l,s,o,t.properties))}}function D(e,t){t.push(k(e[0])),t.push(F(e[1])),t.push(0)}function z(e,t,i,r){for(var a,s,n=0,o=0;o<e.length;o++){var l=k(e[o][0]),h=F(e[o][1]);t.push(l),t.push(h),t.push(0),o>0&&(n+=r?(a*h-l*s)/2:Math.sqrt(Math.pow(l-a,2)+Math.pow(h-s,2))),a=l,s=h}var c=t.length-3;t[2]=1,C(t,0,c,i),t[c+2]=1,t.size=Math.abs(n),t.start=0,t.end=t.size}function L(e,t,i,r){for(var a=0;a<e.length;a++){var s=[];z(e[a],s,i,r),t.push(s)}}function k(e){return e/360+.5}function F(e){var t=Math.sin(e*Math.PI/180),i=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return i<0?0:i>1?1:i}function j(e,t,i,r,a,s,n,o){if(r/=t,s>=(i/=t)&&n<r)return e;if(n<i||s>=r)return null;for(var l=[],h=0;h<e.length;h++){var c=e[h],d=c.geometry,u=c.type,p=0===a?c.minX:c.minY,f=0===a?c.maxX:c.maxY;if(p>=i&&f<r)l.push(c);else if(!(f<i||p>=r)){var m=[];if("Point"===u||"MultiPoint"===u)N(d,m,i,r,a);else if("LineString"===u)V(d,m,i,r,a,!1,o.lineMetrics);else if("MultiLineString"===u)U(d,m,i,r,a,!1);else if("Polygon"===u)U(d,m,i,r,a,!0);else if("MultiPolygon"===u)for(var g=0;g<d.length;g++){var v=[];U(d[g],v,i,r,a,!0),v.length&&m.push(v)}if(m.length){if(o.lineMetrics&&"LineString"===u){for(g=0;g<m.length;g++)l.push(R(c.id,u,m[g],c.tags));continue}"LineString"!==u&&"MultiLineString"!==u||(1===m.length?(u="LineString",m=m[0]):u="MultiLineString"),"Point"!==u&&"MultiPoint"!==u||(u=3===m.length?"Point":"MultiPoint"),l.push(R(c.id,u,m,c.tags))}}}return l.length?l:null}function N(e,t,i,r,a){for(var s=0;s<e.length;s+=3){var n=e[s+a];n>=i&&n<=r&&(t.push(e[s]),t.push(e[s+1]),t.push(e[s+2]))}}function V(e,t,i,r,a,s,n){for(var o,l,h=B(e),c=0===a?G:q,d=e.start,u=0;u<e.length-3;u+=3){var p=e[u],f=e[u+1],m=e[u+2],g=e[u+3],v=e[u+4],y=0===a?p:f,x=0===a?g:v,b=!1;n&&(o=Math.sqrt(Math.pow(p-g,2)+Math.pow(f-v,2))),y<i?x>i&&(l=c(h,p,f,g,v,i),n&&(h.start=d+o*l)):y>r?x<r&&(l=c(h,p,f,g,v,r),n&&(h.start=d+o*l)):$(h,p,f,m),x<i&&y>=i&&(l=c(h,p,f,g,v,i),b=!0),x>r&&y<=r&&(l=c(h,p,f,g,v,r),b=!0),!s&&b&&(n&&(h.end=d+o*l),t.push(h),h=B(e)),n&&(d+=o)}var w=e.length-3;p=e[w],f=e[w+1],m=e[w+2],(y=0===a?p:f)>=i&&y<=r&&$(h,p,f,m),w=h.length-3,s&&w>=3&&(h[w]!==h[0]||h[w+1]!==h[1])&&$(h,h[0],h[1],h[2]),h.length&&t.push(h)}function B(e){var t=[];return t.size=e.size,t.start=e.start,t.end=e.end,t}function U(e,t,i,r,a,s){for(var n=0;n<e.length;n++)V(e[n],t,i,r,a,s,!1)}function $(e,t,i,r){e.push(t),e.push(i),e.push(r)}function G(e,t,i,r,a,s){var n=(s-t)/(r-t);return e.push(s),e.push(i+(a-i)*n),e.push(1),n}function q(e,t,i,r,a,s){var n=(s-i)/(a-i);return e.push(t+(r-t)*n),e.push(s),e.push(1),n}function W(e,t){for(var i=[],r=0;r<e.length;r++){var a,s=e[r],n=s.type;if("Point"===n||"MultiPoint"===n||"LineString"===n)a=H(s.geometry,t);else if("MultiLineString"===n||"Polygon"===n){a=[];for(var o=0;o<s.geometry.length;o++)a.push(H(s.geometry[o],t))}else if("MultiPolygon"===n)for(a=[],o=0;o<s.geometry.length;o++){for(var l=[],h=0;h<s.geometry[o].length;h++)l.push(H(s.geometry[o][h],t));a.push(l)}i.push(R(s.id,n,a,s.tags))}return i}function H(e,t){var i=[];i.size=e.size,void 0!==e.start&&(i.start=e.start,i.end=e.end);for(var r=0;r<e.length;r+=3)i.push(e[r]+t,e[r+1],e[r+2]);return i}function Z(e,t){if(e.transformed)return e;var i,r,a,s=1<<e.z,n=e.x,o=e.y;for(i=0;i<e.features.length;i++){var l=e.features[i],h=l.geometry,c=l.type;if(l.geometry=[],1===c)for(r=0;r<h.length;r+=2)l.geometry.push(Y(h[r],h[r+1],t,s,n,o));else for(r=0;r<h.length;r++){var d=[];for(a=0;a<h[r].length;a+=2)d.push(Y(h[r][a],h[r][a+1],t,s,n,o));l.geometry.push(d)}}return e.transformed=!0,e}function Y(e,t,i,r,a,s){return[Math.round(i*(e*r-a)),Math.round(i*(t*r-s))]}function X(e,t,i,r,a){for(var s=t===a.maxZoom?0:a.tolerance/((1<<t)*a.extent),n={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:i,y:r,z:t,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},o=0;o<e.length;o++){n.numFeatures++,Q(n,e[o],s,a);var l=e[o].minX,h=e[o].minY,c=e[o].maxX,d=e[o].maxY;l<n.minX&&(n.minX=l),h<n.minY&&(n.minY=h),c>n.maxX&&(n.maxX=c),d>n.maxY&&(n.maxY=d)}return n}function Q(e,t,i,r){var a=t.geometry,s=t.type,n=[];if("Point"===s||"MultiPoint"===s)for(var o=0;o<a.length;o+=3)n.push(a[o]),n.push(a[o+1]),e.numPoints++,e.numSimplified++;else if("LineString"===s)K(n,a,e,i,!1,!1);else if("MultiLineString"===s||"Polygon"===s)for(o=0;o<a.length;o++)K(n,a[o],e,i,"Polygon"===s,0===o);else if("MultiPolygon"===s)for(var l=0;l<a.length;l++){var h=a[l];for(o=0;o<h.length;o++)K(n,h[o],e,i,!0,0===o)}if(n.length){var c=t.tags||null;if("LineString"===s&&r.lineMetrics){for(var d in c={},t.tags)c[d]=t.tags[d];c.mapbox_clip_start=a.start/a.size,c.mapbox_clip_end=a.end/a.size}var u={geometry:n,type:"Polygon"===s||"MultiPolygon"===s?3:"LineString"===s||"MultiLineString"===s?2:1,tags:c};null!==t.id&&(u.id=t.id),e.features.push(u)}}function K(e,t,i,r,a,s){var n=r*r;if(r>0&&t.size<(a?n:r))i.numPoints+=t.length/3;else{for(var o=[],l=0;l<t.length;l+=3)(0===r||t[l+2]>n)&&(i.numSimplified++,o.push(t[l]),o.push(t[l+1])),i.numPoints++;a&&function(e,t){for(var i=0,r=0,a=e.length,s=a-2;r<a;s=r,r+=2)i+=(e[r]-e[s])*(e[r+1]+e[s+1]);if(i>0===t)for(r=0,a=e.length;r<a/2;r+=2){var n=e[r],o=e[r+1];e[r]=e[a-2-r],e[r+1]=e[a-1-r],e[a-2-r]=n,e[a-1-r]=o}}(o,s),e.push(o)}}function J(e,t){var i=(t=this.options=function(e,t){for(var i in t)e[i]=t[i];return e}(Object.create(this.options),t)).debug;if(i&&console.time("preprocess data"),t.maxZoom<0||t.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(t.promoteId&&t.generateId)throw new Error("promoteId and generateId cannot be used together.");var r=function(e,t){var i=[];if("FeatureCollection"===e.type)for(var r=0;r<e.features.length;r++)P(i,e.features[r],t,r);else P(i,"Feature"===e.type?e:{geometry:e},t);return i}(e,t);this.tiles={},this.tileCoords=[],i&&(console.timeEnd("preprocess data"),console.time("generate tiles"),this.stats={},this.total=0),r=function(e,t){var i=t.buffer/t.extent,r=e,a=j(e,1,-1-i,i,0,-1,2,t),s=j(e,1,1-i,2+i,0,-1,2,t);return(a||s)&&(r=j(e,1,-i,1+i,0,-1,2,t)||[],a&&(r=W(a,1).concat(r)),s&&(r=r.concat(W(s,-1)))),r}(r,t),r.length&&this.splitTile(r,0,0,0),i&&(console.timeEnd("generate tiles"),JSON.stringify(this.stats))}function ee(e,t,i){return 32*((1<<e)*i+t)+e}J.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},J.prototype.splitTile=function(e,t,i,r,a,s,n){for(var o=[e,t,i,r],l=this.options,h=l.debug;o.length;){r=o.pop(),i=o.pop(),t=o.pop(),e=o.pop();var c=1<<t,d=ee(t,i,r),u=this.tiles[d];if(!u&&(h>1&&console.time("creation"),u=this.tiles[d]=X(e,t,i,r,l),this.tileCoords.push({z:t,x:i,y:r}),h)){h>1&&console.timeEnd("creation");var p="z"+t;this.stats[p]=(this.stats[p]||0)+1,this.total++}if(u.source=e,a){if(t===l.maxZoom||t===a)continue;var f=1<<a-t;if(i!==Math.floor(s/f)||r!==Math.floor(n/f))continue}else if(t===l.indexMaxZoom||u.numPoints<=l.indexMaxPoints)continue;if(u.source=null,0!==e.length){h>1&&console.time("clipping");var m,g,v,y,x,b,w=.5*l.buffer/l.extent,_=.5-w,A=.5+w,M=1+w;m=g=v=y=null,x=j(e,c,i-w,i+A,0,u.minX,u.maxX,l),b=j(e,c,i+_,i+M,0,u.minX,u.maxX,l),e=null,x&&(m=j(x,c,r-w,r+A,1,u.minY,u.maxY,l),g=j(x,c,r+_,r+M,1,u.minY,u.maxY,l),x=null),b&&(v=j(b,c,r-w,r+A,1,u.minY,u.maxY,l),y=j(b,c,r+_,r+M,1,u.minY,u.maxY,l),b=null),h>1&&console.timeEnd("clipping"),o.push(m||[],t+1,2*i,2*r),o.push(g||[],t+1,2*i,2*r+1),o.push(v||[],t+1,2*i+1,2*r),o.push(y||[],t+1,2*i+1,2*r+1)}}},J.prototype.getTile=function(e,t,i){var r=this.options,a=r.extent,s=r.debug;if(e<0||e>24)return null;var n=1<<e,o=ee(e,t=(t%n+n)%n,i);if(this.tiles[o])return Z(this.tiles[o],a);for(var l,h=e,c=t,d=i;!l&&h>0;)h--,c=Math.floor(c/2),d=Math.floor(d/2),l=this.tiles[ee(h,c,d)];return l&&l.source?(s>1&&console.time("drilling down"),this.splitTile(l.source,h,c,d,e,t,i),s>1&&console.timeEnd("drilling down"),this.tiles[o]?Z(this.tiles[o],a):null):null};var te=i(3886),ie=i.n(te);const re=e=>null==e,ae=e=>!re(e),se=e=>{switch(a(e)){case"array":case"string":return 0===e.length;case"date":case"boolean":case"number":case"function":case"symbol":return!1;case"object":return 0===Object.keys(e).length;default:return!0}},ne=e=>re(e)||se(e),oe=e=>!ne(e),le=function(e){if(!e)throw new Error(`Assert failed: ${(arguments.length>1&&void 0!==arguments[1]?arguments[1]:null)||""}`)},he=(Math,512),ce=(Math,Math,e=>Math.pow(2,e)),de=(e,t,i,r)=>`${r}:${i}/${e}/${t}`,ue=(e,t)=>(e%t+t)%t;class pe{get hash(){return de(this.x,this.y,this.z,this.wrap)}get wrap(){const e=Math.pow(2,this.z);return Math.floor(this.x/e)}get isRoot(){return 0===this.z}constructor(e,t,i){this.x=t,this.y=i,this.z=e}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}normalize(){const e=Math.pow(2,this.z);return new pe(this.z,ue(this.x,e),ue(this.y,e))}getAncestor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;const t=Math.pow(2,e);return new pe(this.z-e,Math.floor(this.x/t),Math.floor(this.y/t))}getDescendants(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;const t=Math.pow(2,e),i=Array.from({length:t*t});for(let r=0;r<t;r++){const a=r*t;for(let s=0;s<t;s++)i[a+s]=new pe(this.z+e,this.x*t+r,this.y*t+s)}return i}getNeighbor(e,t){const{x:i,y:r,z:a,wrap:s}=this,n=Math.pow(2,a);let o=0,l=0,h=0;return 0===a?(o=i,h=s+e):(o=i+e,l=r+t,h=i+e<0?s-1:i+e>n?s+1:s),l<0||l>=n?null:new pe(a,o,l)}getNeighbors(){const[e,t,i,r,a,s]=[-1,0,1,-1,0,1];return{tl:this.getNeighbor(e,r),tc:this.getNeighbor(t,r),tr:this.getNeighbor(i,r),ml:this.getNeighbor(e,a),mc:this,mr:this.getNeighbor(i,a),bl:this.getNeighbor(e,s),bc:this.getNeighbor(t,s),br:this.getNeighbor(i,s)}}getQuadrant(){return[this.x%2,this.y%2]}isAncestorOf(e){if(this.z>=e.z)return!1;const t=Math.pow(2,e.z-this.z),i=Math.floor(e.x/t),r=Math.floor(e.y/t);return this.x===i&&this.y===r}isDescendantOf(e){return e.isAncestorOf(this)}getPosition(){const e=ce(this.z);return{x:this.x/e,y:this.y/e}}getCenter(){const e=ce(this.z);return{x:(this.x+.5)/e,y:(this.y+.5)/e}}toString(){return`TileCoord: ${this.z}/${this.x}/${this.y}, wrap: ${this.wrap}`}toInfo(){return{z:this.z,x:this.x,y:this.y}}static fromHash(e){const t=(e||"").replace(/^\d+:/,"").split("/").map((e=>Number.parseInt(e,10)));return new pe(t[0],t[1],t[2])}}const fe=pe,me=t=>{if(t.status>=200&&t.status<=299)return t;if(401===t.status)throw new e(t.statusText);if(404!==t.status){if(t.status>=500)throw new Error(t.statusText);return t}};new Set;const ge=e=>"string"===a(e),ve=(e,t,i)=>{if(re(t))return e;const r=t.split("."),a=r.length-1;let s;for(s=0;s<a;s+=1)e[r[s]]=e[r[s]]||{},e=e[r[s]];return e[r[s]]=i,e},ye=(e,t)=>{if("array"!==a(t)||ne(e)||!s(e))return!1;let i=!0;return t.forEach((t=>{!1===e.hasOwnProperty(t)&&(i=!1)})),i},xe=e=>"number"===a(e),be=(e,t,i)=>Math.min(Math.max(e,t),i),we=e=>{if(re(e))return;let t=0,i=0,r=0;if(ge(e)){const a=e.replace(/^#/,""),s=a.length;3===s?(t=Number.parseInt(a.charAt(0)+a.charAt(0),16),i=Number.parseInt(a.charAt(1)+a.charAt(1),16),r=Number.parseInt(a.charAt(2)+a.charAt(2),16)):6===s&&(t=Number.parseInt(a.charAt(0)+a.charAt(1),16),i=Number.parseInt(a.charAt(2)+a.charAt(3),16),r=Number.parseInt(a.charAt(4)+a.charAt(5),16))}else{const a=Math.floor(e);t=a>>16&255,i=a>>8&255,r=255&a}return{r:t,g:i,b:r,a:1}},_e=e=>ye(e,["r","g","b"]),Ae=e=>ye(e,["h","s","l"]),Me=e=>ye(e,["h","s","v"]),Te=e=>ge(e)&&e.includes("%"),Ee=(e,t,i)=>{const r=Te(e),a=i-t;return e=be(Number.parseFloat(`${e}`),t,i),r&&(e=Number.parseInt(""+e*i,10)/100),Math.abs(e-i)<1e-6?1:e%a/a},Se=(e,t,i)=>(i<0&&(i+=1),i>1&&(i-=1),i<1/6?e+6*(t-e)*i:i<.5?t:i<2/3?e+(t-e)*(2/3-i)*6:e),Ce=e=>{if(!Ae(e))return;let t,i,r,{h:a,s:s,l:n,a:o}=e;if(a=Ee(a,0,360),s=Ee(s,0,100),n=Ee(n,0,100),o=o||1,0===s)t=i=r=n;else{const e=n<.5?n*(1+s):n+s-n*s,o=2*n-e;t=Se(o,e,a+1/3),i=Se(o,e,a),r=Se(o,e,a-1/3)}return{r:Math.round(255*t),g:Math.round(255*i),b:Math.round(255*r),a:o}},Oe=e=>{if(!Me(e))return;let{h:t,s:i,v:r,a:a}=e;t=6*Ee(t,0,360),i=Ee(i,0,100),r=Ee(r,0,100),a=a||1;const s=Math.floor(t),n=t-s,o=r*(1-i),l=r*(1-n*i),h=r*(1-(1-n)*i),c=s%6,d=[h,r,r,l,o,o][c],u=[o,o,h,r,r,l][c];return{r:Math.round(255*[r,l,o,o,h,r][c]),g:Math.round(255*d),b:Math.round(255*u),a:a}};var Re,Ie=1e-6,Pe="undefined"!=typeof Float32Array?Float32Array:Array;function De(e,t,i,r){var a=new Pe(4);return a[0]=e,a[1]=t,a[2]=i,a[3]=r,a}function ze(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e[2]=t[2]+i[2],e[3]=t[3]+i[3],e}function Le(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e[2]=t[2]-i[2],e[3]=t[3]-i[3],e}function ke(e,t,i){return e[0]=t[0]*i[0],e[1]=t[1]*i[1],e[2]=t[2]*i[2],e[3]=t[3]*i[3],e}function Fe(e,t,i){return e[0]=t[0]/i[0],e[1]=t[1]/i[1],e[2]=t[2]/i[2],e[3]=t[3]/i[3],e}function je(e){return Math.hypot(e[0],e[1],e[2],e[3])}function Ne(e,t){var i=t[0],r=t[1],a=t[2],s=t[3],n=i*i+r*r+a*a+s*s;return n>0&&(n=1/Math.sqrt(n)),e[0]=i*n,e[1]=r*n,e[2]=a*n,e[3]=s*n,e}function Ve(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function Be(e,t){var i=e[0],r=e[1],a=e[2],s=e[3],n=t[0],o=t[1],l=t[2],h=t[3];return Math.abs(i-n)<=Ie*Math.max(1,Math.abs(i),Math.abs(n))&&Math.abs(r-o)<=Ie*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(a-l)<=Ie*Math.max(1,Math.abs(a),Math.abs(l))&&Math.abs(s-h)<=Ie*Math.max(1,Math.abs(s),Math.abs(h))}Math,Math,Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)}),Re=new Pe(4),Pe!=Float32Array&&(Re[0]=0,Re[1]=0,Re[2]=0,Re[3]=0);const Ue=class{get value(){return null}fromArray(e){return this}toArray(){return[]}};class $e extends Ue{get value(){return this._value}get x(){return this.value[0]}set x(e){this.value[0]=e}get y(){return this.value[1]}set y(e){this.value[1]=e}get z(){return this.value[2]}set z(e){this.value[2]=e}get w(){return this.value[3]}set w(e){this.value[3]=e}get elements(){return this.value.length}constructor(e=0,t=0,i=0,r=0){super(),this._value=De(e,t,i,r)}fromArray(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x=e[t+0],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t+0]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromObject(e){let{x:t,y:i,z:r,w:a}=e;return void 0!==t&&(this.x=t),void 0!==i&&(this.y=i),void 0!==r&&(this.z=r),void 0!==a&&(this.w=a),this}toObject(){return{x:this.x,y:this.y,z:this.z,w:this.w}}set(e,t,i,r){return this._value=De(e,t,i,r),this}setScalar(e){return this.set(e,e,e,e)}length(){return je(this.value)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w,this}clone(){return new $e(this.x,this.y,this.z,this.w)}add(e){return ze(this.value,this.value,e.value),this}addScalar(e){return ze(this.value,this.value,De(e,e,e,e)),this}subtract(e){return Le(this.value,this.value,e.value),this}subtractScalar(e){return Le(this.value,this.value,De(e,e,e,e)),this}multiply(e){return ke(this.value,this.value,e.value),this}multiplyScalar(e){return ke(this.value,this.value,De(e,e,e,e)),this}divide(e){return Fe(this.value,this.value,e.value),this}divideScalar(e){return Fe(this.value,this.value,De(e,e,e,e)),this}distanceTo(e){return t=this.value,i=e.value,Math.hypot(i[0]-t[0],i[1]-t[1],i[2]-t[2],i[3]-t[3]);var t,i}dot(e){return Ve(this.value,e.value)}equals(e){return Be(this.value,e.value)}lerp(e,t){return function(e,t,i,r){var a=t[0],s=t[1],n=t[2],o=t[3];e[0]=a+r*(i[0]-a),e[1]=s+r*(i[1]-s),e[2]=n+r*(i[2]-n),e[3]=o+r*(i[3]-o)}(this.value,this.value,e.value,t),this}normalize(){return Ne(this.value,this.value),this}scale(e){return function(e,t,i){e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i}(this.value,this.value,e),this}applyMatrix4(e){return function(e,t,i){var r=t[0],a=t[1],s=t[2],n=t[3];e[0]=i[0]*r+i[4]*a+i[8]*s+i[12]*n,e[1]=i[1]*r+i[5]*a+i[9]*s+i[13]*n,e[2]=i[2]*r+i[6]*a+i[10]*s+i[14]*n,e[3]=i[3]*r+i[7]*a+i[11]*s+i[15]*n}(this.value,this.value,e.value),this}}const Ge=$e,qe={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},We={};class He{constructor(e=0,t,i,r=1){if(this.r=0,this.g=0,this.b=0,this.a=1,void 0===t&&void 0===i)if(xe(e)&&e<=255)this.setRGB(e,e,e);else if(ge(e)&&qe[e])this.fromHex(qe[e]);else{const t=(e=>{if(_e(e))return e;if(Ae(e))return Ce(e);if(Me(e))return Oe(e);if(ge(e)){const t=/^(rgb|hsl|hsv)a?\((\d+),\s*([\d%]+),\s*([\d%]+)(?:,\s*(\d+(?:\.\d+)?))?\)$/.exec(`${e}`);if(t&&t.length>=5){const e=t[1],i=ae(t[5])?Number.parseFloat(t[5]):1,r=t.slice(2,5).map((e=>Te(e)?e:Number.parseInt(e,10)));if("rgb"===e||"rgba"===e)return{r:be(r[0],0,255),g:be(r[1],0,255),b:be(r[2],0,255),a:i};if("hsl"===e)return Ce({h:r[0],s:r[1],l:r[2],a:i});if("hsv"===e)return Oe({h:r[0],s:r[1],v:r[2],a:i})}else if(/^#?([\dA-Fa-f]+)$/.test(e))return we(e)}return xe(e)?we(e):void 0})(e);if(t){const{r:e,g:i,b:r,a:a}=t;this.setRGBA(e,i,r,a)}}else this.setRGBA(e,t,i,r)}fromHex(e){let t=We[e];return t||(t=we(e),We[e]=t),this.setRGBA(t.r,t.g,t.b,t.a)}fromHSL(e,t,i){const r=Ce({h:e,s:t,l:i,a:arguments.length>3&&void 0!==arguments[3]?arguments[3]:1});return this.setRGBA(r.r,r.g,r.b,r.a)}fromHSV(e,t,i){const r=Oe({h:e,s:t,v:i,a:arguments.length>3&&void 0!==arguments[3]?arguments[3]:1});return this.setRGBA(r.r,r.g,r.b,r.a)}setRGB(e,t,i){return this.setRGBA(e,t,i,this.a),this}setRGBA(e,t,i,r){let a=arguments.length>4&&void 0!==arguments[4]&&arguments[4];return this.r=a?e:Ee(e,0,255),this.g=a?t:Ee(t,0,255),this.b=a?i:Ee(i,0,255),this.setAlpha(r),this}setAlpha(e){return this.a=e>1?Ee(e,0,255):e,this}lighter(e){const t=e<1?e:e/100;let i=this.toHSL().l;return i+=i*t,i=Math.min(1,i),this}darker(e){const t=e<1?e:e/100;let i=this.toHSL().l;return i-=i*t,i=Math.max(0,i),this}equals(e){return this.r===e.r&&this.g===e.g&&this.b===e.b&&this.a===e.a}toHex(){return(e=>{if(_e(e))return`#${[e.r,e.g,e.b].map((e=>{const t=e.toString(16);return 1===t.length?`0${t}`:t})).join("")}`})(this.toObject(!1))}toHSL(){return(e=>{if(!_e(e))return;let{r:t,g:i,b:r}=e;t=Ee(t,0,255),i=Ee(i,0,255),r=Ee(r,0,255);const a=Math.min(t,i,r),s=Math.max(t,i,r);let n,o;const l=(s+a)/2;if(s===a)n=0,o=0;else{const e=s-a;switch(o=l>.5?e/(2-s-a):e/(s+a),s){case t:n=(i-r)/e+(i<r?6:0);break;case i:n=(r-t)/e+2;break;case r:n=(t-i)/e+4}n/=6}return{h:n,s:o,l:l}})(this.toObject(!1))}toHSV(){return(e=>{if(!_e(e))return;let{r:t,g:i,b:r}=e;t=Ee(t,0,255),i=Ee(i,0,255),r=Ee(r,0,255);const a=Math.max(t,i,r),s=Math.min(t,i,r);let n;const o=a,l=a-s,h=0===a?0:l/a;if(a===s)n=0;else{switch(a){case t:n=(i-r)/l+(i<r?6:0);break;case i:n=(r-t)/l+2;break;case r:n=(t-i)/l+4}n/=6}return{h:n,s:h,v:o}})(this.toObject(!1))}toObject(){const e=arguments.length>0&&void 0!==arguments[0]&&!arguments[0]?255:1;return{r:this.r*e,g:this.g*e,b:this.b*e,a:this.a}}toArray(){return[this.r,this.g,this.b,this.a]}toVector(){return(new Ge).fromArray(this.toArray())}toString(){return`${this.constructor.name}(${this.r}, ${this.g}, ${this.b}, ${this.a}})`}}const Ze=He,Ye=(e,t)=>256*(e=be(Math.floor(e),0,255))+be(Math.floor(t),0,255),Xe=e=>[Ye(255*e.r,255*e.g),Ye(255*e.b,255*e.a)];class Qe{get bytesPerElement(){throw new Error("Subclasses of StructArray must override `bytesPerElement`")}constructor(e=1,t=0){this.capacity=-1,this.length=0,this.stride=1,this.stride=e,this.resize(t)}resize(e){e=Math.ceil(e),this.length=e,this.reserve(e)}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.buffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const t=this.data;this.refresh(),t&&this.data.set(t)}}emplace(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=this.length;this.resize(i+1),this.emplaceAt(i,e,t)}emplaceAt(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const r=Array.isArray(t)?t:[t],a=e*this.stride;if(i&&console.warn("emplaceAt",e,t,r,this.length,this.data),r.length!==this.stride)throw new Error(`Element length (${r.length}) does not match the stride for the StructArray ${this.stride}`);r.forEach(((e,t)=>{this.data[a+t]=r[t]}))}get(e){const t=e*this.stride;return this.data.slice(t,t+this.stride)}refresh(){throw new Error("Subclasses of StructArray must override `refresh`")}trim(){this.length!==this.capacity&&(this.capacity=this.length,this.buffer=this.buffer.slice(0,this.length*this.bytesPerElement),this.refresh())}clear(){this.length=0}serialize(){return this.trim(),{capacity:this.capacity,length:this.length,stride:this.stride,buffer:this.buffer}}static from(e){const t=Object.create(this.prototype);return t.stride=e.stride,t.buffer=e.buffer,t.length=e.length,t.capacity=e.length,t.refresh(),t}}class Ke extends Qe{get bytesPerElement(){return 2*this.stride}refresh(){this.data=new Int16Array(this.buffer)}}class Je extends Qe{get bytesPerElement(){return 2*this.stride}refresh(){this.data=new Uint16Array(this.buffer)}}class et extends Qe{get bytesPerElement(){return 4*this.stride}refresh(){this.data=new Float32Array(this.buffer)}}var tt=i(5341),it=i.n(tt),rt=i(1476),at=i.n(rt);const st=e=>ht/he*e,nt=function(e,t,i){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(3===e)return((e,t)=>{const i={minX:Number.POSITIVE_INFINITY,minY:Number.POSITIVE_INFINITY,maxX:Number.NEGATIVE_INFINITY,maxY:Number.NEGATIVE_INFINITY};for(let t=0;t<e.length;t++){const r=e[t][0];for(let e=0;e<r.length;e++){const t=r[e];i.minX=Math.min(i.minX,t.x),i.minY=Math.min(i.minY,t.y),i.maxX=Math.max(i.maxX,t.x),i.maxY=Math.max(i.maxY,t.y)}}if(i.minX<ht&&i.minY<ht&&i.maxX>=0&&i.maxY>=0)return Object.assign(Object.assign({},i),{key:t})})(t,i);if(2===e);else if(1===e)return oe(r.collisionBox)?((e,t,i)=>{const r=e[0];return{minX:r.x+i.x1,minY:r.y+i.y1,maxX:r.x+i.x2,maxY:r.y+i.y2,key:t}})(t,i,r.collisionBox):function(e,t){const i=e[0],r=st(arguments.length>2&&void 0!==arguments[2]?arguments[2]:5);return{minX:i.x-r,minY:i.y-r,maxX:i.x+r,maxY:i.y+r,key:t}}(t,i,r.radius)},ot=(e,t,i)=>{const r=i[0].map((e=>[e.x,e.y]));if(at()([e,t],r)){if(i.length>1)for(let r=1;r<i.length;r++){const a=i[r].map((e=>[e.x,e.y]));if(at()([e,t],a))return!1}return!0}return!1},lt=class{constructor(){this.tree=new(it())}populate(e){const t=e.map(((e,t)=>{let{type:i,geometry:r,properties:a}=e;return nt(i,r,t,a)})).filter((e=>ae(e)));this.tree.load(t)}insert(e,t,i){if(!t)return;const r=nt(e,t,i);r&&this.tree.insert(r)}query(e,t,i,r){const a=this.within({minX:e,minY:t,maxX:e,maxY:t}).filter((a=>{const s=r.features[a.key];if(s.geometry){if(3===s.type){for(let i=0;i<s.geometry.length;i++)if(ot(e,t,s.geometry[i]))return!0;return!1}if(1===s.type){const r=s.geometry,a=1-i%1*.5,n=oe(s.properties.collisionBox)?function(e,t,i,r){let a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;return e>=i.x+r.x1*a&&e<=i.x+r.x2*a&&t>=i.y+r.y1*a&&t<=i.y+r.y2*a}(e,t,r[0],s.properties.collisionBox,a):function(e,t,i){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;const a=st(arguments.length>3&&void 0!==arguments[3]?arguments[3]:5)*r;return Math.hypot(i.x-e,i.y-t)<=a}(e,t,r[0],s.properties.radius,a);return!!n}}return!0}));return a}within(e){return this.tree.search(e)}collides(e){return this.tree.collides(e)}},ht=8192,ct=class{get type(){throw new Error("Subclasses of VectorStore must override `type`")}get isEmpty(){return!1}get featureIndex(){return this._featureIndex}constructor(e){this.features=[],this.options=Object.freeze(e)}populate(e,t,i){let r=[];const a={},s={},n={};let o=0;for(let t=0;t<e.length;t++){const i=e[t],a=i.properties||{};Object.keys(a).forEach((e=>{ge(a[e])&&/^([[{])/.test(a[e])&&(a[e]=JSON.parse(a[e]))})),a.zoom=this.options.zoom,r.push(i instanceof E?{type:i.type,featureIndex:o++,feature:i,sourceId:void 0,sourceLayerIndex:0,properties:a}:i)}(null==i?void 0:i.paint)&&(r=this.sortFeatures(r,i.paint));for(let e=0;e<r.length;e++){const o=this.addFeature(r[e],Object.assign(Object.assign({},this.options),i));if(o){const{dependencies:e}=o;this.features.push(o),(null==e?void 0:e.glyphs)&&Object.assign(a,e.glyphs),(null==e?void 0:e.icons)&&Object.assign(s,e.icons),(null==e?void 0:e.patterns)&&Object.assign(n,e.patterns),t&&t.insert(o.type,o.geometry,o.featureIndex)}}}sortFeatures(e,t){return e}addFeature(e,t){throw new Error("Subclasses of VectorStore must override `addFeature`")}trim(){throw new Error("Subclasses of VectorStore must override `trim`")}query(e,t,i){this._featureIndex||(this._featureIndex=new lt,this._featureIndex.populate(this.features)),(e<1||t<1)&&(e=Math.round(e*ht),t=Math.round(t*ht));const r=this.featureIndex.query(e,t,i,this);if(r.length>0)return r.map((e=>this.features[e.key].properties))}serialize(){return{type:this.type,id:this.id,options:Object.assign({},this.options),layoutVertexArray:void 0,indexArray:void 0,features:[...this.features]}}static from(e){throw new Error("Subclasses of VectorStore must override `VectorStore.from`")}},dt=(e,t,i)=>{if(null==e||re(t)||!ge(t))return i;const r=t.split(/["'.[\]]{1,2}/),a=r.length;for(let t=0;t<a;t+=1)if(!se(r[t])&&null==(e=e[r[t]]))return i;return null==e?i:e},ut=e=>"function"===a(e),pt=Math.pow(2,16)-1,ft=function(e){const t=ht/(arguments.length>1&&void 0!==arguments[1]?arguments[1]:ht);return{x:Math.round(e.x*t),y:Math.round(e.y*t)}},mt=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=[],r=[],a=[];for(const s of e){if(0===s.length)continue;s!==e[0]&&i.push(r.length/2);const n=[];for(let e=0;e<s.length;e++){const t=r.length/2;r.push(s[e].x,s[e].y),n.push(t)}t&&n.push(n[0]),a.push(n)}return{flattened:r,holeIndices:i,lineList:a}},gt=function(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,a=se(e)?void 0:e.at(-1);return(!a||a.vertex.length+t>pt)&&(a={vertex:{offset:i,length:0},index:{offset:r,length:0}},e.push(a)),a},vt=(e,t)=>{const i=t.offset*e.stride;return e.data.subarray(i,i+t.length*e.stride)},yt=(e,t,i)=>{const r=i.offset*t.stride,a=i.length*t.stride;le(e.length>=i.length*t.stride,"[MapsGL] Destination array is too small");for(let i=0;i<a;i++)e[i]=t.data[r+i];return e},xt=(e,t)=>{var i;let r;if("string"==typeof e)r=e;else if(e.property){const a=e.property;if(Array.isArray(a)){let e;a.forEach((i=>{e||(e=dt(t,i))})),r=e}else r=dt(t,a);if(ae(r)&&ut(e.transform)){const t=e.transform(r,null===(i=e.measurement)||void 0===i?void 0:i.units);ae(t)&&(r=`${t}`)}}return ae(r)?`${r}`:void 0},bt=(e,t)=>{const i={x:0,y:0};return["x","y"].forEach((r=>{const a=e[r];if("number"==typeof a)i[r]=a;else if("object"==typeof a){const{target:e,offset:s}=a;if(e&&/^text-\d+-(\w+)$/.test(e)){const a=Number.parseInt(e.split("-")[1],10),n=e.split("-")[2],o=t[a];if(o)if("x"===r)switch(n){case"left":i.x=o.x1+s;break;case"right":i.x=o.x2+s;break;case"center":i.x=o.x1+(o.x2-o.x1)/2+s}else switch(n){case"top":i.y=o.y1+s;break;case"bottom":i.y=o.y2+s;break;case"middle":i.y=o.y1+(o.y2-o.y1)/2+s}}}})),i},wt=(e,t)=>t instanceof Float32Array?e.FLOAT:t instanceof Uint16Array?e.UNSIGNED_SHORT:e.UNSIGNED_INT,_t=class{constructor(e,t,i,r=!0,a=0,s=0,n=0){if(this.size=1,this.dynamic=!1,this.instanced=!1,this.stride=0,this.offset=0,this.divisor=0,this.needsUpdate=!1,Array.isArray(t))throw new TypeError("[Aeris GL] BufferAttribute: array should be a typed array");let o=0;void 0!==t&&(o=a?t.byteLength/a:t.length/i),this.data=t,this.size=i,this.type=wt(e,t),this.normalized=!0===r,this.stride=a,this.offset=s,this.divisor=n,this.instanced=n>0,this.count=o}},At=class{constructor(e,t,i){if(Array.isArray(t))throw new TypeError("[Aeris GL] InterleavedBuffer: data should be a typed array");let r=0;void 0!==t&&(r=t.byteLength/i),this.data=t,this.type=wt(e,t),this.stride=i,this.count=r}},Mt=class{get identifier(){return this._identifier}set identifier(e){this._identifier=e}get context(){return this._context}set context(e){this._context=e}get gl(){return this.context.gl}constructor(e){this._context=e}};function Tt(){var e=new Pe(3);return Pe!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function Et(e,t,i){var r=new Pe(3);return r[0]=e,r[1]=t,r[2]=i,r}function St(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e[2]=t[2]+i[2],e}function Ct(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e[2]=t[2]-i[2],e}function Ot(e,t,i){return e[0]=t[0]*i[0],e[1]=t[1]*i[1],e[2]=t[2]*i[2],e}function Rt(e,t,i){return e[0]=t[0]/i[0],e[1]=t[1]/i[1],e[2]=t[2]/i[2],e}function It(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Pt(e,t){var i=e[0],r=e[1],a=e[2],s=t[0],n=t[1],o=t[2],l=Math.sqrt(i*i+r*r+a*a)*Math.sqrt(s*s+n*n+o*o),h=l&&It(e,t)/l;return Math.acos(Math.min(Math.max(h,-1),1))}var Dt=Ct;function zt(){var e=new Pe(4);return Pe!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}Tt();var Lt=De,kt=Ve,Ft=je,jt=Ne,Nt=Be;Tt(),Et(1,0,0),Et(0,1,0),zt(),zt(),function(){var e=new Pe(9);Pe!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1}();const Vt=e=>e*(180/Math.PI);class Bt{get x(){return this._value[0]}set x(e){this._value[0]=e,this.triggerChange()}get y(){return this._value[1]}set y(e){this._value[1]=e,this.triggerChange()}get z(){return this._value[2]}set z(e){this._value[2]=e,this.triggerChange()}get w(){return this._value[3]}set w(e){this._value[3]=e,this.triggerChange()}get value(){return this._value}get elements(){return this.value.length}constructor(e=0,t=0,i=0,r=0){this._changeCallbacks=[],this._value=Lt(e,t,i,r)}fromArray(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this.triggerChange(),this}toArray(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromObject(e){let{x:t,y:i,z:r,w:a}=e;return void 0!==t&&(this.x=t),void 0!==i&&(this.y=i),void 0!==r&&(this.z=r),void 0!==a&&(this.w=a),this.triggerChange(),this}toObject(){return{x:this.x,y:this.y}}fromAxisAngle(e,t){return function(e,t,i){i*=.5;var r=Math.sin(i);e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=Math.cos(i)}(this.value,e.value,t),this.triggerChange(),this}fromEuler(e){return function(e,t,i,r){var a=.5*Math.PI/180;t*=a,i*=a,r*=a;var s=Math.sin(t),n=Math.cos(t),o=Math.sin(i),l=Math.cos(i),h=Math.sin(r),c=Math.cos(r);e[0]=s*l*c-n*o*h,e[1]=n*o*c+s*l*h,e[2]=n*l*h-s*o*c,e[3]=n*l*c+s*o*h}(this.value,Vt(e.x),Vt(e.y),Vt(e.z)),this.triggerChange(),this}fromRotationMatrix(){return this}set(e,t,i,r){return this._value=Lt(e,t,i,r),this.triggerChange(),this}length(){return Ft(this.value)}clone(){return(new Bt).copy(this)}copy(e){let t=0;for(;t<this.value.length;)this.value[t]=e.value[t],t+=1;return this.triggerChange(),this}equals(e){return Nt(this.value,e.value)}identity(){return function(e){e[0]=0,e[1]=0,e[2]=0,e[3]=1}(this.value),this.triggerChange(),this}invert(){return function(e,t){var i=t[0],r=t[1],a=t[2],s=t[3],n=i*i+r*r+a*a+s*s,o=n?1/n:0;e[0]=-i*o,e[1]=-r*o,e[2]=-a*o,e[3]=s*o}(this.value,this.value),this.triggerChange(),this}conjugate(){return function(e,t){e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3]}(this.value,this.value),this.triggerChange(),this}normalize(){return jt(this.value,this.value),this.triggerChange(),this}rotateX(e){return function(e,t,i){i*=.5;var r=t[0],a=t[1],s=t[2],n=t[3],o=Math.sin(i),l=Math.cos(i);e[0]=r*l+n*o,e[1]=a*l+s*o,e[2]=s*l-a*o,e[3]=n*l-r*o}(this.value,this.value,e),this.triggerChange(),this}rotateY(e){return function(e,t,i){i*=.5;var r=t[0],a=t[1],s=t[2],n=t[3],o=Math.sin(i),l=Math.cos(i);e[0]=r*l-s*o,e[1]=a*l+n*o,e[2]=s*l+r*o,e[3]=n*l-a*o}(this.value,this.value,e),this.triggerChange(),this}rotateZ(e){return function(e,t,i){i*=.5;var r=t[0],a=t[1],s=t[2],n=t[3],o=Math.sin(i),l=Math.cos(i);e[0]=r*l+a*o,e[1]=a*l-r*o,e[2]=s*l+n*o,e[3]=n*l-s*o}(this.value,this.value,e),this.triggerChange(),this}dot(e){return kt(this.value,e.value)}angleTo(e){return t=kt(this.value,e.value),Math.acos(2*t*t-1);var t}onChange(e){this._changeCallbacks.includes(e)||this._changeCallbacks.push(e)}triggerChange(){this._changeCallbacks.forEach((e=>e()))}}const Ut=Bt,$t=Tt();class Gt extends Ue{get value(){return this._value}get x(){return this.value[0]}set x(e){this.value[0]=e}get y(){return this.value[1]}set y(e){this.value[1]=e}get z(){return this.value[2]}set z(e){this.value[2]=e}get elements(){return this.value.length}constructor(e=0,t=0,i=0){super(),this._value=Et(e,t,i)}fromArray(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x=e[t+0],this.y=e[t+1],this.z=e[t+2],this}toArray(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t+0]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromObject(e){let{x:t,y:i,z:r}=e;return void 0!==t&&(this.x=t),void 0!==i&&(this.y=i),void 0!==r&&(this.z=r),this}toObject(){return{x:this.x,y:this.y,z:this.z}}set(e,t,i){return this._value=Et(e,t,i),this}setScalar(e){return this.set(e,e,e)}length(){return e=this.value,Math.hypot(e[0],e[1],e[2]);var e}distanceToSquared(e){return(r=(i=e.value)[0]-(t=this.value)[0])*r+(a=i[1]-t[1])*a+(s=i[2]-t[2])*s;var t,i,r,a,s}angle(){const e=Et(1,0,0);return Pt(this.value,e)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}clone(){return new Gt(this.x,this.y,this.z)}add(e){return St(this.value,this.value,e.value),this}addScalar(e){return St(this.value,this.value,Et(e,e,e)),this}subtract(e){return Ct(this.value,this.value,e.value),this}subtractScalar(e){return Ct(this.value,this.value,Et(e,e,e)),this}subVectors(e,t){return Dt(this.value,e.value,t.value),this}multiply(e){return Ot(this.value,this.value,e.value),this}multiplyScalar(e){return Ot(this.value,this.value,Et(e,e,e)),this}divide(e){return Rt(this.value,this.value,e.value),this}divideScalar(e){return Rt(this.value,this.value,Et(e,e,e)),this}distanceTo(e){return t=this.value,i=e.value,Math.hypot(i[0]-t[0],i[1]-t[1],i[2]-t[2]);var t,i}angleTo(e){return Pt(this.value,e.value)}dot(e){return It(this.value,e.value)}equals(e){return r=(t=this.value)[0],a=t[1],s=t[2],n=(i=e.value)[0],o=i[1],l=i[2],Math.abs(r-n)<=Ie*Math.max(1,Math.abs(r),Math.abs(n))&&Math.abs(a-o)<=Ie*Math.max(1,Math.abs(a),Math.abs(o))&&Math.abs(s-l)<=Ie*Math.max(1,Math.abs(s),Math.abs(l));var t,i,r,a,s,n,o,l}lerp(e,t){return function(e,t,i,r){var a=t[0],s=t[1],n=t[2];e[0]=a+r*(i[0]-a),e[1]=s+r*(i[1]-s),e[2]=n+r*(i[2]-n)}(this.value,this.value,e.value,t),this}normalize(){return function(e,t){var i=t[0],r=t[1],a=t[2],s=i*i+r*r+a*a;s>0&&(s=1/Math.sqrt(s)),e[0]=t[0]*s,e[1]=t[1]*s,e[2]=t[2]*s}(this.value,this.value),this}scale(e){return function(e,t,i){e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i}(this.value,this.value,e),this}rotateX(e){return function(e,t,i,r){var a=[],s=[];a[0]=t[0]-i[0],a[1]=t[1]-i[1],a[2]=t[2]-i[2],s[0]=a[0],s[1]=a[1]*Math.cos(r)-a[2]*Math.sin(r),s[2]=a[1]*Math.sin(r)+a[2]*Math.cos(r),e[0]=s[0]+i[0],e[1]=s[1]+i[1],e[2]=s[2]+i[2]}(this.value,this.value,$t,e),this}rotateY(e){return function(e,t,i,r){var a=[],s=[];a[0]=t[0]-i[0],a[1]=t[1]-i[1],a[2]=t[2]-i[2],s[0]=a[2]*Math.sin(r)+a[0]*Math.cos(r),s[1]=a[1],s[2]=a[2]*Math.cos(r)-a[0]*Math.sin(r),e[0]=s[0]+i[0],e[1]=s[1]+i[1],e[2]=s[2]+i[2]}(this.value,this.value,$t,e),this}rotateZ(e){return function(e,t,i,r){var a=[],s=[];a[0]=t[0]-i[0],a[1]=t[1]-i[1],a[2]=t[2]-i[2],s[0]=a[0]*Math.cos(r)-a[1]*Math.sin(r),s[1]=a[0]*Math.sin(r)+a[1]*Math.cos(r),s[2]=a[2],e[0]=s[0]+i[0],e[1]=s[1]+i[1],e[2]=s[2]+i[2]}(this.value,this.value,$t,e),this}applyEuler(e){const t=(new Ut).fromEuler(e);return this.applyQuaternion(t)}applyMatrix3(e){return function(e,t,i){var r=t[0],a=t[1],s=t[2];e[0]=r*i[0]+a*i[3]+s*i[6],e[1]=r*i[1]+a*i[4]+s*i[7],e[2]=r*i[2]+a*i[5]+s*i[8]}(this.value,this.value,e.value),this}applyMatrix4(e){return function(e,t,i){var r=t[0],a=t[1],s=t[2],n=i[3]*r+i[7]*a+i[11]*s+i[15];e[0]=(i[0]*r+i[4]*a+i[8]*s+i[12])/(n=n||1),e[1]=(i[1]*r+i[5]*a+i[9]*s+i[13])/n,e[2]=(i[2]*r+i[6]*a+i[10]*s+i[14])/n}(this.value,this.value,e.value),this}applyQuaternion(e){return function(e,t,i){var r=i[0],a=i[1],s=i[2],n=t[0],o=t[1],l=t[2],h=a*l-s*o,c=s*n-r*l,d=r*o-a*n,u=a*d-s*c,p=s*h-r*d,f=r*c-a*h,m=2*i[3];c*=m,d*=m,p*=2,f*=2,e[0]=n+(h*=m)+(u*=2),e[1]=o+c+p,e[2]=l+d+f}(this.value,this.value,e.value),this}negate(){for(let e=0;e<this.elements;++e)this.value[e]=-this.value[e];return this}}const qt=Gt;var Wt,Ht=function(e,t,i,r){if("a"===i&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?r:"a"===i?r.call(e):r?r.value:t.get(e)};Wt=new WeakMap;const Zt=class{get type(){return Ht(this,Wt,"f").type}get data(){return Ht(this,Wt,"f").data}set data(e){Ht(this,Wt,"f").data=e}get count(){return Ht(this,Wt,"f").count}get buffer(){return Ht(this,Wt,"f").buffer}set buffer(e){Ht(this,Wt,"f").buffer=e}constructor(e,t,i=!0,r=0,a=0,s){this.size=1,this.dynamic=!1,this.instanced=!1,this.stride=0,this.offset=0,this.divisor=0,this.needsUpdate=!1,Wt.set(this,void 0),function(e,t,i,r,a){if("function"==typeof t||!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");t.set(e,i)}(this,Wt,e),this.size=t,this.normalized=!0===i,this.stride=re(s)?e.stride:s,this.offset=r,this.divisor=a,this.instanced=a>0}};let Yt=1,Xt=1;const Qt=new qt;class Kt extends Mt{get id(){return this._id}get attributes(){return this._attributes}get index(){return this.attributes.get("index")}get bounds(){return this._bounds}constructor(e,t={}){super(e),this.drawRange={start:0,count:0},this.instancedCount=0,this.isInstanced=!1,this._attributes=new Map,this._VAOs={};const i=e.gl;i||console.error("[Aeris GL] GL context not passed as first argument to Geometry"),this._id=Yt,this.drawMode=e.gl.TRIANGLES,Yt+=1,e.bindVertexArray(null),e.state.setActiveGeometry(null),Object.keys(t).forEach((e=>{const r=t[e];if(r instanceof _t||r instanceof Zt)"index"===e?this.setIndex(r):this.addAttribute(e,r);else{const{size:t,data:a,normalized:s,stride:n,offset:o,divisor:l}=r;if(t&&a){const r=new _t(i,a,t,s,n,o,l);"index"===e?this.setIndex(r):this.addAttribute(e,r)}}}))}addAttribute(e,t){const i=this.context.gl;if(t.id=Xt,t.target="index"===e?i.ELEMENT_ARRAY_BUFFER:i.ARRAY_BUFFER,t.divisor=t.divisor||0,t.needsUpdate=!1,this.attributes.set(e,t),Xt+=1,t.buffer||(t.buffer=i.createBuffer(),this.updateAttribute(t)),t.divisor){if(this.isInstanced=!0,this.instancedCount&&this.instancedCount!==t.count*t.divisor)return console.warn(`[Aeris GL] Geometry has multiple instanced buffers of different length - instancedCount: ${this.instancedCount}, count: ${t.count}, divisor: ${t.divisor}, attribute: ${e}`),this.instancedCount=Math.min(this.instancedCount,t.count*t.divisor),this.instancedCount;this.instancedCount=t.count*t.divisor}else"index"===e?this.drawRange.count=t.count:this.index||(this.drawRange.count=Math.max(this.drawRange.count,t.count))}getAttribute(e){return this.attributes.get(e)}setAttributeData(e,t){const i=this.getAttribute(e);i&&(i.data=t,i.needsUpdate=!0)}updateAttribute(e){const t=this.context.gl;t.bindBuffer(e.target,e.buffer),t.bufferData(e.target,e.data,t.STATIC_DRAW),e.needsUpdate=!1}removeAttribute(e){this.attributes.delete(e)}setIndex(e){if(Array.isArray(e)){const t=e.length>65535?new Uint32Array(e):new Uint16Array(e),i=new _t(this.context.gl,t,1);this.addAttribute("index",i)}else e.size=1,this.addAttribute("index",e);this.drawRange.count=this.index.count}setVertices(e){const t=[];for(let i=0,r=e.length;i<r;i+=1){const r=e[i];t.push(r[0],r[1],r[2])}this.addAttribute("position",new _t(this.context.gl,new Float32Array(t),3))}setNormals(e){this.addAttribute("normal",new _t(this.context.gl,new Float32Array(e),2))}setUVs(e){this.addAttribute("uv",new _t(this.context.gl,new Float32Array(e),2))}setColors(e){const t=[];for(let i=0,r=e.length;i<r;i+=1){let r=e[i];r instanceof Ze&&(r=r.toVector().toArray()),t.push(r[0],r[1],r[2],r[3])}this.addAttribute("color",new _t(this.context.gl,new Float32Array(t),4))}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}setInstancedCount(e){this.instancedCount=e}createVAO(e){const t=e.attributeOrder,i=this.context.createVertexArray();this.context.bindVertexArray(i),this._VAOs[t]=i,this.bindAttributes(e),this.context.bindVertexArray(null)}bindAttributes(e){const t=this.context.gl;Object.keys(e.attributes).forEach((i=>{const r=this.attributes.get(i);if(!r)return;const a=e.attributes[i];t.bindBuffer(r.target,r.buffer),this.context.state.opts.boundBuffer=r.buffer;let s=1;35674===r.type&&(s=2),35675===r.type&&(s=3),35676===r.type&&(s=4);for(let e=0;e<s;e++)t.vertexAttribPointer(a+e,r.size,r.type,r.normalized,r.stride,r.offset),t.enableVertexAttribArray(a+e),this.context.vertexAttribDivisor(a+e,r.divisor)}));const i=this.attributes.get("index");i&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,i.buffer)}computeBoundingBox(){const{data:e,offset:t=0,stride:i,size:r}=this.attributes.get("position");this.bounds||(this._bounds={min:new qt,max:new qt,center:new qt,scale:new qt,radius:Number.POSITIVE_INFINITY});const a=this.bounds,s=a.min,n=a.max,o=a.center,l=a.scale;s.setScalar(+Number.POSITIVE_INFINITY),n.setScalar(Number.NEGATIVE_INFINITY);const h=i||r;for(let i=t,r=e.length;i<r;i+=h){const t=e[i+0],r=e[i+1],a=e[i+2];s.x=Math.min(t,s.x),s.y=Math.min(r,s.y),s.z=Math.min(a,s.z),n.x=Math.max(t,n.x),n.y=Math.max(r,n.y),n.z=Math.max(a,n.z)}return l.subVectors(n,s),o.add(s).add(n).divideScalar(2),a}computeBoundingSphere(){const{data:e,offset:t=0,stride:i,size:r}=this.attributes.get("position");this.bounds||this.computeBoundingBox();let a=0;const s=i||r;for(let i=t,r=e.length;i<r;i+=s)Qt.fromArray([...e],i),a=Math.max(a,this.bounds.center.distanceToSquared(Qt));this.bounds.radius=Math.sqrt(a)}draw(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.drawMode;const i=this.context.gl,{start:r,count:a}=this.drawRange,s=`${this.id}_${e.attributeOrder}`;this.context.state.activeGeometryId!==s&&(this._VAOs[e.attributeOrder]||this.createVAO(e),e.context.bindVertexArray(this._VAOs[e.attributeOrder]),this.context.state.setActiveGeometry(s)),Object.keys(e.attributes).forEach((e=>{const t=this.getAttribute(e);t&&t.needsUpdate&&this.updateAttribute(t)})),this.isInstanced?this.index?this.context.drawElementsInstanced(t,a,this.index.type,this.index.offset+2*r,this.instancedCount):this.context.drawArraysInstanced(t,r,a,this.instancedCount):this.index?i.drawElements(t,a,this.index.type,this.index.offset+2*r):i.drawArrays(t,r,a)}clone(){const e={};this.attributes.forEach(((t,i)=>{e[i]=t}));const t=new Kt(this.context,e);return t.drawMode=this.drawMode,t}dispose(){Object.keys(this._VAOs).forEach((e=>{this.context.deleteVertexArray(this._VAOs[e]),delete this._VAOs[e]})),this.attributes.forEach((e=>{this.gl.deleteBuffer(e.buffer)})),this.attributes.clear()}}const Jt=Kt,ei=class{constructor(){this.layoutVertexArray=new et(2),this.colorVertexArray=new et(2),this.indexArray=new Je(3),this.radiusArray=new et(1),this.strokeWidthArray=new et(1),this.segments={point:[]}}get geometry(){return this._geometry}prepareGeometry(e){if(this._geometry)return;const t=(new Float32Array).BYTES_PER_ELEMENT,i=new At(e.gl,this.layoutVertexArray.data,2*t),r=new At(e.gl,this.colorVertexArray.data,4*t),a=new At(e.gl,this.radiusArray.data,1*t),s=new At(e.gl,this.strokeWidthArray.data,1*t),n=new Jt(e,{position:{size:2,data:new Float32Array([0,1,0,0,1,0,1,1])},uv:{size:2,data:new Float32Array([0,1,0,0,1,0,1,1])},anchor:new Zt(i,2,!1,0,1),fillColor:new Zt(r,2,!1,0,1),strokeColor:new Zt(r,2,!1,2*t,1),strokeWidth:new Zt(s,1,!1,0,1,1*t),radius:new Zt(a,1,!1,0,1,1*t)});n.setIndex([0,1,2,0,2,3]),this._geometry=n}trim(){this.layoutVertexArray.trim(),this.indexArray.trim(),this.colorVertexArray.trim(),this.radiusArray.trim(),this.strokeWidthArray.trim()}updateColorArray(e,t,i){const r=Xe(i||new Ze("#000"));for(let i=e;i<t;i++)this.colorVertexArray.emplaceAt(i,r)}updateRadiusArray(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10;for(let r=e;r<t;r++)this.radiusArray.emplaceAt(r,i)}updateStrokeWidthArray(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;for(let r=e;r<t;r++)this.strokeWidthArray.emplaceAt(r,i)}};class ti extends ct{constructor(){super(...arguments),this.buffers=new ei}get type(){return"circle"}addFeature(e,t){const i=this.buffers,r=e.feature.asPoints(),a=e.feature.extent;if(!r)return;const s=i.layoutVertexArray.length;for(let e=0;e<r.length;e++){const t=r[e],s=ft({x:t.x,y:t.y},a);if(r[e]=s,s.x<0||s.x>=ht||s.y<0||s.y>=ht)continue;const n=gt(i.segments.point,2,i.layoutVertexArray.length,i.indexArray.length);i.layoutVertexArray.emplace([s.x,s.y]),n.vertex.length+=2,n.index.length+=1}if(i.layoutVertexArray.length===s)return;const n=Xe(new Ze("#000"));for(let e=i.colorVertexArray.length;e<2*i.layoutVertexArray.length;e++)i.colorVertexArray.emplace(n);for(let e=s;e<i.layoutVertexArray.length;e++)i.radiusArray.emplace(10),i.strokeWidthArray.emplace(1);return{type:e.type,featureIndex:e.featureIndex,sourceId:e.sourceId,sourceLayerIndex:e.sourceLayerIndex,geometry:r,properties:e.properties,vertexRange:{start:s,end:i.layoutVertexArray.length},radius:10,strokeWidth:1}}trim(){this.buffers.trim()}serialize(){const e=this.buffers,t=super.serialize();return Object.assign(Object.assign({},t),{layoutVertexArray:e.layoutVertexArray.serialize(),colorVertexArray:e.colorVertexArray.serialize(),indexArray:e.indexArray.serialize(),radiusArray:e.radiusArray.serialize(),strokeWidthArray:e.strokeWidthArray.serialize(),segments:{point:e.segments.point}})}static from(e){const t=new ti(e.options);return se(e)?console.warn("[MapsGL] Cannot create CircleStore from invalid serialized data."):(t.features=e.features,t.buffers.segments.point=e.segments.point,t.buffers.layoutVertexArray=et.from(e.layoutVertexArray),t.buffers.colorVertexArray=et.from(e.colorVertexArray),t.buffers.indexArray=Je.from(e.indexArray),t.buffers.radiusArray=et.from(e.radiusArray),t.buffers.strokeWidthArray=et.from(e.strokeWidthArray)),t}}const ii=ti;var ri=i(6570),ai=i.n(ri);const si=class{constructor(){this.layoutVertexArray=new et(2),this.colorVertexArray=new et(2),this.patternVertexArray=new et(4),this.pixelRatioArray=new et(1),this.indexArray=new Je(3),this.indexArray2=new Je(2),this.segments={line:[],triangle:[]},this._geometry={fill:null,stroke:null}}get geometry(){return this._geometry}prepareGeometry(e,t){if(t&&this._geometry.stroke||!t&&this._geometry.fill)return;const i=t?this.segments.line:this.segments.triangle,r=t?this.indexArray2:this.indexArray,a=[];for(let t=0;t<i.length;t++){const s=i[t],{vertex:n,index:o}=s,l=vt(this.layoutVertexArray,n),h=vt(this.colorVertexArray,n),c=vt(this.patternVertexArray,n),d=vt(this.pixelRatioArray,n),u=yt(new Uint16Array(o.length*r.stride),r,o),p=new Jt(e,{position:{size:2,data:l},color:{size:2,data:h},pattern:{size:4,data:c},pixelRatio:{size:1,data:d},index:{size:1,data:u}});a.push(p)}t?this._geometry.stroke=a:this._geometry.fill=a}addVertex(e,t){this.layoutVertexArray.emplace([e,t])}trim(){this.layoutVertexArray.trim(),this.indexArray.trim(),this.indexArray2.trim(),this.colorVertexArray.trim(),this.patternVertexArray.trim(),this.pixelRatioArray.trim()}updateColorArray(e,t,i){const r=Xe(i||new Ze("#000"));for(let i=e;i<t;i++)this.colorVertexArray.emplaceAt(i,r)}updatePatternArray(e,t,i,r){for(let a=e;a<t;a++)this.patternVertexArray.emplaceAt(a,i),this.pixelRatioArray.emplaceAt(a,r)}};class ni{constructor(e,t){if(t>e)throw new Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=e,this._minGranularity=t}getGranularityForZoomLevel(e){return Math.max(Math.floor(this._baseZoomGranularity/(1<<e)),this._minGranularity,1)}}class oi{constructor(e){this.fill=new ni(e.fill.base,e.fill.min),this.line=new ni(e.line.base,e.line.min),this.tile=new ni(e.tile.base,e.tile.min),this.stencil=new ni(e.stencil.base,e.stencil.min),this.circle=e.circle}}oi.noSubdivision={fill:{base:0,min:0},line:{base:0,min:0},tile:{base:0,min:0},stencil:{base:0,min:0},circle:1},oi.globeSubdivision={fill:{base:128,min:2},line:{base:512,min:0},tile:{base:128,min:32},stencil:{base:128,min:1},circle:3};class li{constructor(e,t){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._coord=e,this._granularity=t,this._granularityCellSize=ht/t}subdividePolygonInternal(e,t){if(this._used)throw new Error("Subdivision: multiple use not allowed.");this._used=!0;const{flattened:i,holeIndices:r}=function(e){const t=[],i=[];for(const r of e)if(0!==r.length){r!==e[0]&&t.push(i.length/2);for(let e=0;e<r.length;e++)i.push(r[e].x,r[e].y)}return{flattened:i,holeIndices:t}}(e);let a;this._initializeVertices(i);try{const e=ai()(i,r),t=this._convertIndices(i,e);a=this._subdivideTrianglesScanline(t)}catch(e){console.error(e)}let s=[];return t&&(s=this._generateOutline(e)),{verticesFlattened:this._vertexBuffer,indicesTriangles:a,indicesLineList:s}}_getKey(e,t){return(e+=32768)<<16|Math.trunc(t+=32768)}_vertexToIndex(e,t){const i=Math.trunc(e),r=Math.trunc(t),a=this._getKey(i,r);if(this._vertexDictionary.has(a))return this._vertexDictionary.get(a);const s=this._vertexBuffer.length/2;return this._vertexDictionary.set(a,s),this._vertexBuffer.push(i,r),s}_initializeVertices(e){for(let t=0;t<e.length;t+=2)this._vertexToIndex(e[t],e[t+1])}_convertIndices(e,t){const i=[];for(let r=0;r<t.length;r++)i.push(this._vertexToIndex(e[2*t[r]],e[2*t[r]+1]));return i}_subdivideTrianglesScanline(e){if(this._granularity<2)return function(e,t){const i=[];for(let r=0;r<t.length;r+=3){const a=t[r],s=t[r+1],n=t[r+2],o=e[2*a],l=e[2*a+1];(e[2*s]-o)*(e[2*n+1]-l)-(e[2*s+1]-l)*(e[2*n]-o)>0?i.push(a,n,s):i.push(a,s,n)}return i}(this._vertexBuffer,e);const t=[],i=e.length;for(let r=0;r<i;r+=3){const i=[e[r+0],e[r+1],e[r+2]],a=[this._vertexBuffer[2*e[r+0]+0],this._vertexBuffer[2*e[r+0]+1],this._vertexBuffer[2*e[r+1]+0],this._vertexBuffer[2*e[r+1]+1],this._vertexBuffer[2*e[r+2]+0],this._vertexBuffer[2*e[r+2]+1]];let s=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,l=Number.NEGATIVE_INFINITY;for(let e=0;e<3;e++){const t=a[2*e],i=a[2*e+1];s=Math.min(s,t),o=Math.max(o,t),n=Math.min(n,i),l=Math.max(l,i)}if(s===o||n===l)continue;const h=Math.floor(s/this._granularityCellSize),c=Math.ceil(o/this._granularityCellSize),d=Math.floor(n/this._granularityCellSize),u=Math.ceil(l/this._granularityCellSize);if(h!==c||d!==u)for(let e=d;e<u;e++){const r=this._scanlineGenerateVertexRingForCellRow(e,a,i);di(this._vertexBuffer,r,t)}else t.push(...i)}return t}_scanlineGenerateVertexRingForCellRow(e,t,i){const r=e*this._granularityCellSize,a=r+this._granularityCellSize,s=[];for(let e=0;e<3;e++){const n=t[2*e],o=t[2*e+1],l=t[2*(e+1)%6],h=t[(2*(e+1)+1)%6],c=t[2*(e+2)%6],d=t[(2*(e+2)+1)%6],u=l-n,p=h-o,f=0===u,m=0===p,g=(r-o)/p,v=(a-o)/p,y=Math.min(g,v),x=Math.max(g,v);if(!m&&(y>=1||x<=0)||m&&(o<r||o>a)){h>=r&&h<=a&&s.push(i[(e+1)%3]);continue}!m&&y>0&&s.push(this._vertexToIndex(n+u*y,o+p*y));const b=n+u*Math.max(y,0),w=n+u*Math.min(x,1);f||this._generateIntraEdgeVertices(s,n,o,l,h,b,w),!m&&x<1&&s.push(this._vertexToIndex(n+u*x,o+p*x)),(m||h>=r&&h<=a)&&s.push(i[(e+1)%3]),!m&&(h<=r||h>=a)&&this._generateInterEdgeVertices(s,n,o,l,h,c,d,w,r,a)}return s}_generateIntraEdgeVertices(e,t,i,r,a,s,n){const o=r-t,l=a-i,h=0===l,c=h?Math.min(t,r):Math.min(s,n),d=h?Math.max(t,r):Math.max(s,n),u=Math.floor(c/this._granularityCellSize)+1,p=Math.ceil(d/this._granularityCellSize)-1;if(h?t<r:s<n)for(let r=u;r<=p;r++){const a=r*this._granularityCellSize;e.push(this._vertexToIndex(a,i+l*(a-t)/o))}else for(let r=p;r>=u;r--){const a=r*this._granularityCellSize;e.push(this._vertexToIndex(a,i+l*(a-t)/o))}}_generateInterEdgeVertices(e,t,i,r,a,s,n,o,l,h){const c=a-i,d=s-r,u=n-a,p=(l-a)/u,f=(h-a)/u,m=Math.min(p,f),g=Math.max(p,f),v=r+d*m;let y=Math.floor(Math.min(v,o)/this._granularityCellSize)+1,x=Math.ceil(Math.max(v,o)/this._granularityCellSize)-1,b=o<v;const w=0===u;if(w&&(n===l||n===h))return;if(w||m>=1||g<=0){const e=i-n,r=s+(t-s)*Math.min((l-n)/e,(h-n)/e);y=Math.floor(Math.min(r,o)/this._granularityCellSize)+1,x=Math.ceil(Math.max(r,o)/this._granularityCellSize)-1,b=o<r}const _=c>0?h:l;if(b)for(let t=y;t<=x;t++)e.push(this._vertexToIndex(t*this._granularityCellSize,_));else for(let t=x;t>=y;t--)e.push(this._vertexToIndex(t*this._granularityCellSize,_))}_generateOutline(e){const t=[];for(const i of e){const e=ci(i,this._granularity,!0),r=this._pointArrayToIndices(e),a=[];for(let e=1;e<r.length;e++)a.push(r[e-1],r[e]);t.push(a)}return t}_pointArrayToIndices(e){const t=[];for(let i=0;i<e.length;i++){const r=e[i];t.push(this._vertexToIndex(r.x,r.y))}return t}}function hi(e,t,i){let r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];return new li(t,i).subdividePolygonInternal(e,r)}function ci(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!e||0===e.length)return[];if(e.length<2)return[];const r=e[0],a=e.at(-1),s=i&&(r.x!==a.x||r.y!==a.y);if(t<2)return s?[...e,e[0]]:[...e];const n=Math.floor(ht/t),o=[];o.push({x:e[0].x,y:e[0].y});const l=e.length,h=s?l:l-1;for(let t=0;t<h;t++){const i=e[t],r=t<l-1?e[t+1]:e[0],a=i.x,s=i.y,h=r.x,c=r.y,d=a!==h,u=s!==c;if(!d&&!u)continue;const p=h-a,f=c-s,m=Math.abs(p),g=Math.abs(f);let v=a,y=s;for(;;){const e=p>0?(Math.floor(v/n)+1)*n:(Math.ceil(v/n)-1)*n,t=f>0?(Math.floor(y/n)+1)*n:(Math.ceil(y/n)-1)*n,i=Math.abs(v-e),r=Math.abs(y-t),a=Math.abs(v-h),s=Math.abs(y-c),l=d?i/m:Number.POSITIVE_INFINITY,x=u?r/g:Number.POSITIVE_INFINITY;if((a<=i||!d)&&(s<=r||!u))break;if(l<x&&d||!u){v=e,y+=f*l;const t={x:v,y:y};o.at(-1).x===t.x&&o.at(-1).y===t.y||o.push(t)}else{v+=p*x,y=t;const e={x:v,y:y};o.at(-1).x===e.x&&o.at(-1).y===e.y||o.push(e)}}const x={x:h,y:c};o.at(-1).x===x.x&&o.at(-1).y===x.y||o.push(x)}return o}function di(e,t,i){if(0===t.length)throw new Error("Subdivision vertex ring is empty.");let r=0,a=e[2*t[0]];for(let i=1;i<t.length;i++){const s=e[2*t[i]];s<a&&(a=s,r=i)}const s=t.length;let n=r,o=(n+1)%s;for(;;){const r=n-1>=0?n-1:s-1,a=(o+1)%s,l=e[2*t[r]],h=e[2*t[a]],c=e[2*t[n]],d=e[2*t[n]+1],u=e[2*t[o]+1];let p=!1;if(l<h)p=!0;else if(l>h)p=!1;else{const i=u-d,s=-(e[2*t[o]]-c),n=d<u?1:-1;((l-c)*i+(e[2*t[r]+1]-d)*s)*n>((h-c)*i+(e[2*t[a]+1]-d)*s)*n&&(p=!0)}if(p){const e=t[r],a=t[n],l=t[o];e!==a&&e!==l&&a!==l&&i.push(l,a,e),n-=1,n<0&&(n=s-1)}else{const e=t[a],r=t[n],l=t[o];e!==r&&e!==l&&r!==l&&i.push(l,r,e),o+=1,o>=s&&(o=0)}if(r===a)break}}class ui extends ct{constructor(){super(...arguments),this.buffers=new si}get type(){return"fill"}sortFeatures(e,t){const i=t.fillSort();return i?e.filter((e=>oe(dt(e.properties,i.property)))).sort(((e,t)=>{const r=dt(e.properties,i.property),a=dt(t.properties,i.property);return"desc"===i.direction?a-r:r-a})):e}addFeature(e,t){var i,r,a,s,n,o;const l=e.feature.asPolygons(),h=e.feature.extent,c=this.buffers,d=null!==(i=null==t?void 0:t.tileCoord)&&void 0!==i?i:new fe(0,0,0),u=null===(r=null==t?void 0:t.paint)||void 0===r?void 0:r.config,p=null==t?void 0:t.patternDependencies,f=c.layoutVertexArray,m=c.indexArray,g=c.indexArray2,v=c.layoutVertexArray.length;if(!l)return;const y=null!==(s=null===(a=null==t?void 0:t.subdivisionGranularity)||void 0===a?void 0:a.fill.getGranularityForZoomLevel(d.z))&&void 0!==s?s:1;for(let e=0;e<l.length;e++){const t=l[e];for(let e=0;e<t.length;e++){const i=t[e];if(0!==i.length)for(let e=0;e<i.length;e++){const t=ft({x:i[e].x,y:i[e].y},h);i[e]=t}}const i=hi(t,d,y),r=i.verticesFlattened,a=i.indicesTriangles,s=i.indicesLineList,n=r.length/2,o=gt(c.segments.triangle,n,f.length,m.length),u=o.vertex.length;if(a.length%3!=0)throw new Error("Invalid indices count");for(let e=0;e<a.length;e+=3)c.indexArray.emplace([u+a[e+0],u+a[e+1],u+a[e+2]]);o.vertex.length+=n,o.index.length+=a.length/3;const p=gt(c.segments.line,n,f.length,g.length),v=p.vertex.length;p.vertex.length+=n;for(let e=0;e<r.length;e+=2)c.addVertex(r[e],r[e+1]);for(let e=0;e<s.length;e++){const t=s[e],i=[];for(let e=1;e<t.length;e++)i.push(t[e-1],t[e]);for(let e=1;e<i.length;e+=2)g.emplace([v+i[e-1],v+i[e]]);p.index.length+=i.length/2}}const x=Xe(new Ze("#000"));for(let e=c.colorVertexArray.length;e<c.layoutVertexArray.length;e++)c.colorVertexArray.emplace(x);for(let e=c.patternVertexArray.length;e<c.layoutVertexArray.length;e++)c.patternVertexArray.emplace([0,0,1,1]),c.pixelRatioArray.emplace([1]);let b,w=null===(n=u.fill)||void 0===n?void 0:n.pattern;return ut(w)&&(w=w(e.properties)),w&&oe(w)&&(b="string"==typeof w?w:w.id,le(oe(b),`[MapsGL] Icon image id was not provided for pattern: ${JSON.stringify(w)}`),p[b]="string"==typeof w||Object.assign(Object.assign({},w),{pixelRatio:null!==(o=w.pixelRatio)&&void 0!==o?o:1,pattern:!0})),{type:e.type,featureIndex:e.featureIndex,sourceId:e.sourceId,sourceLayerIndex:e.sourceLayerIndex,geometry:l,properties:e.properties,pattern:{id:b},vertexRange:{start:v,end:c.layoutVertexArray.length},dependencies:{patterns:p}}}trim(){this.buffers.trim()}serialize(){const e=this.buffers,t=super.serialize();return Object.assign(Object.assign({},t),{layoutVertexArray:e.layoutVertexArray.serialize(),colorVertexArray:e.colorVertexArray.serialize(),patternVertexArray:e.patternVertexArray.serialize(),pixelRatioArray:e.pixelRatioArray.serialize(),indexArray:e.indexArray.serialize(),index2Array:e.indexArray2.serialize(),segments:{line:e.segments.line,triangle:e.segments.triangle}})}static from(e){const t=new ui(e.options);return se(e)?console.warn("[MapsGL] Cannot create FillStore from invalid serialized data."):(t.features=e.features,t.buffers.segments.line=e.segments.line,t.buffers.segments.triangle=e.segments.triangle,t.buffers.layoutVertexArray=et.from(e.layoutVertexArray),t.buffers.colorVertexArray=et.from(e.colorVertexArray),t.buffers.patternVertexArray=et.from(e.patternVertexArray),t.buffers.pixelRatioArray=et.from(e.pixelRatioArray),t.buffers.indexArray=Je.from(e.indexArray),t.buffers.indexArray2=Je.from(e.index2Array)),t}}const pi=ui,fi=[0,1,2,0,2,3],mi=new Float32Array([0,-.5,1,-.5,1,.5,0,.5]),gi="bevel",vi="round",yi="miter",xi="butt",bi=class{constructor(){this.layoutVertexArray=new et(2),this.colorVertexArray=new et(2),this.indexArray=new Je(2),this.uvArray=new et(2),this.previousVertexArray=new et(2),this.nextVertexArray=new et(2),this.sideArray=new Ke(1),this.widthArray=new et(1),this.lengthArray=new et(1),this.terminalArray=new et(1),this.countersArray=new et(1),this.segments={line:[]}}get geometry(){return this._geometry}prepareGeometry(e,t,i){if(this._geometry)return;const r=!1;let a=0;for(let e=0;e<t.length;e++){const{start:i,end:r}=t[e];a=Math.max(a,r-i)}const s=function(e,t,i,r){let a=arguments.length>4&&void 0!==arguments[4]&&arguments[4],s=0;for(let e=0;e<i.length;e++){const{start:t,end:r}=i[e];s=Math.max(s,(r-t)/2)}const n=(new Float32Array).BYTES_PER_ELEMENT,o=t.layoutVertexArray.data,l=4*n,h={position:{size:2,data:mi},color:{size:2,data:t.colorVertexArray.data,stride:4*n,divisor:1},segments:{size:1,data:t.lengthArray.data,divisor:1},terminal:{size:1,data:t.terminalArray.data,divisor:1}};let c=1===s?i.length:t.layoutVertexArray.length/2;if(a&&s>1){const e=1===s?[0,0,2,2]:[0,4,6,10];h.pA={size:2,data:o,stride:l,offset:e[0]*n,divisor:1},h.pB={size:2,data:o,stride:l,offset:e[1]*n,divisor:1},h.pC={size:2,data:o,stride:l,offset:e[2]*n,divisor:1},h.pD={size:2,data:o,stride:l,offset:e[3]*n,divisor:1},c=(t.layoutVertexArray.length-4)/2}else h.pA={size:2,data:o,stride:l,offset:0*n,divisor:1},h.pB={size:2,data:o,stride:l,offset:2*n,divisor:1};const d=new Jt(e,h);return d.setIndex(fi),d.setInstancedCount(c),d}(e,this,t,i,r),n=function(e,t,i,r){const a=t.layoutVertexArray.data,s=t.colorVertexArray.data,n=[],o=[];for(let e=0;e<i.length;e++){const{start:t,end:r}=i[e];if(r-t>2){let e=0;for(;e<3;){const i=t+2*e;n.push(a[i+0],a[i+1]),o.push(s[i+0],s[i+1]),e+=1}for(e=1;e<=3;){const t=r-2*e;n.push(a[t+0],a[t+1]),o.push(s[t+0],s[t+1]),e+=1}}}if(0===n.length)return;const l=new Float32Array(n),h=(new Float32Array).BYTES_PER_ELEMENT,c=new Jt(e,{position:{size:2,data:new Float32Array([0,-.5,1,-.5,1,.5,0,.5])},color:{size:2,data:new Float32Array(o),stride:4*h,divisor:1},pA:{size:2,data:l,stride:4*h,offset:0*h,divisor:1},pB:{size:2,data:l,stride:4*h,offset:2*h,divisor:1},pC:{size:2,data:l,stride:4*h,offset:3*h,divisor:1}});return c.setInstancedCount(l.length/16),c.setIndex([0,1,2,0,2,3]),c}(e,this,t),o=a>2?function(e,t,i,r){let a=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const s=r.strokeLineJoin(),n=function(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const r={[gi]:{size:3,position:i?[1,0,0,0,1,0,0,0,1]:[0,0,0,1,0,0,0,1,0],index:void 0,id:void 0},[yi]:{size:4,position:i?[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]:[0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,1,0],index:[0,1,2,0,2,3],id:void 0},[vi]:{size:2,position:Array.from({length:t}).reduce(((e,i,r)=>{const a=2*Math.PI*r/t;return e.push(.5*Math.cos(a),.5*Math.sin(a)),e}),[0,0]),index:Array.from({length:t}).reduce(((e,t,i)=>(e.push(0,i+1,i+2),e)),[]),id:Array.from({length:t+2}).reduce(((e,t,i)=>(e.push(i),e)),[])}};return r[e]}(s,12),o=(new Float32Array).BYTES_PER_ELEMENT,l=2*o,h=t.layoutVertexArray.data,c=t.colorVertexArray.data,d={position:{size:n.size,data:new Float32Array(n.position)},color:{size:2,data:c,stride:l,divisor:1},pA:{size:2,data:h,stride:l,offset:0*o,divisor:1},pB:{size:2,data:h,stride:l,offset:4*o,divisor:1},pC:{size:2,data:h,stride:l,offset:8*o,divisor:1}};a&&s===vi&&(d.id={size:1,data:new Float32Array(n.id)});const u=new Jt(e,d);return u.setInstancedCount(t.layoutVertexArray.length-4),a&&n.index&&u.setIndex(n.index),u}(e,this,t,i,r):void 0,l=function(e,t,i,r){const a=r.strokeLineCap(),s=function(e,t){return{butt:{},square:{size:2,position:[0,.5,0,-.5,.5,-.5,.5,.5],index:[0,1,2,0,2,3]},round:{size:2,position:(e=>{const t=[0,0];for(let e=0;e<=12;e++){const i=-.5*Math.PI+Math.PI*e/12;t.push(.5*Math.cos(i),.5*Math.sin(i))}return t})(),index:(e=>{const t=[];for(let e=0;e<12;e++)t.push(0,e+1,e+2);return t})()}}[e]}(a);if(a===xi)return;const n=t.layoutVertexArray.data,o=t.colorVertexArray.data,l=[],h=[];for(let e=0;e<i.length;e++){const{start:t,end:r}=i[e];let a=0;for(;a<2;){const e=2*t+2*a;l.push(n[e+0],n[e+1]),h.push(o[e+0],o[e+1]),a+=1}for(a=1;a<=2;){const e=2*r-2*a;l.push(n[e+0],n[e+1]),h.push(o[e+0],o[e+1]),a+=1}}const c=(new Float32Array).BYTES_PER_ELEMENT,d=4*c,u=new Jt(e,{position:{size:s.size,data:new Float32Array(s.position)},color:{size:2,data:new Float32Array(h),stride:d,divisor:1},pA:{size:2,data:new Float32Array(l),stride:d,offset:0*c,divisor:1},pB:{size:2,data:new Float32Array(l),stride:d,offset:2*c,divisor:1}});return u.setIndex(s.index),u}(e,this,t,i);this._geometry={segments:[s],terminals:[n],joins:[o],caps:[l]}}addVertex(e,t){this.layoutVertexArray.emplace([e,t])}trim(){this.layoutVertexArray.trim(),this.indexArray.trim(),this.colorVertexArray.trim(),this.uvArray.trim(),this.previousVertexArray.trim(),this.nextVertexArray.trim(),this.sideArray.trim(),this.widthArray.trim(),this.lengthArray.trim(),this.terminalArray.trim(),this.countersArray.trim()}updateColorArray(e,t,i){const r=Xe(i||new Ze("#000"));for(let i=e;i<t;i++)this.colorVertexArray.emplaceAt(i,r)}};class wi{constructor(e,t,i=0){this.x=e,this.y=t,this.z=i}equals(e){return this.x===e.x&&this.y===e.y&&this.z===e.z}}class _i extends ct{constructor(){super(...arguments),this.buffers=new bi}get type(){return"line"}addFeature(e,t){const i=this.buffers.layoutVertexArray,r=this.buffers.colorVertexArray,a=i.length;let s;if(2===e.type?s=this.addLines(e,t):3===e.type&&(s=this.addPolygons(e)),i.length===a)return;const n=Xe(new Ze("#000"));for(let e=r.length;e<i.length;e++)r.emplace(n);const o=(i.length-a)/2;for(let e=0;e<o;e++)this.buffers.lengthArray.emplace(o);return{type:e.type,featureIndex:e.featureIndex,sourceId:e.sourceId,sourceLayerIndex:e.sourceLayerIndex,geometry:s,properties:e.properties,vertexRange:{start:a,end:i.length}}}addLines(e,t){var i,r,a;const s=null!==(i=null==t?void 0:t.tileCoord)&&void 0!==i?i:new fe(0,0,0),n=e.feature.asLines(),o=e.feature.extent,l=null!==(a=null===(r=null==t?void 0:t.subdivisionGranularity)||void 0===r?void 0:r.line.getGranularityForZoomLevel(s.z))&&void 0!==a?a:1;for(let t=0;t<n.length;t++){let i=n[t].map((e=>ft(e,o)));i=ci(i,l);const r=i.map((e=>new wi(e.x,e.y)));this.addLine(r,e,yi,xi,0,0)}return n}addPolygons(e){const t=this.buffers,i=e.feature.asPolygons(),r=t.layoutVertexArray,a=t.indexArray;for(let s=0;s<i.length;s++){const n=i[s];for(let t=0;t<n.length;t++){const i=n[t];if(0!==i.length)for(let t=0;t<i.length;t++){const r=ft({x:i[t].x,y:i[t].y},e.feature.extent);i[t]=r}}const{flattened:o,lineList:l}=mt(n),h=o.length/2,c=r.length;gt(t.segments.line,h,r.length,a.length).vertex.length+=h;for(let e=0;e<l.length;e++){const i=l[e];for(let e=0;e<i.length;e++){const r=i[e],a=o[2*r+0],s=o[2*r+1];t.addVertex(a,s),e>0&&e<i.length-1&&t.addVertex(a,s)}}const d=(r.length-c)/2;for(let e=0;e<d;e++){let i=0;0===e?i=1:e===d-1&&(i=2),t.terminalArray.emplace(i)}}return i}addLine(e,t,i,r,a,s){const n=this.buffers,o=3===t.feature.type;let l=e.length;for(;l>=2&&e[l-1].equals(e[l-2]);)l-=1;let h=0;for(;h<l-1&&e[h].equals(e[h+1]);)h+=1;if(l<(o?3:2))return;const c=gt(n.segments.line,10*l,n.layoutVertexArray.length,n.indexArray.length),d=n.layoutVertexArray.length;for(let t=h;t<l;t++){const i=e[t];let r,a;t<l-1&&(r=e[t-1]),t>0&&(a=e[t+1]),this.addVertex(c,t,i,r,a,l),t>h&&t<l-1&&this.addVertex(c,t,i,r,a,l)}c.vertex.length+=e.length,c.index.length+=e.length;const u=(n.layoutVertexArray.length-d)/2;for(let e=0;e<u;e++){let t=0;1===u?t=3:0===e?t=1:e===u-1&&(t=2),n.terminalArray.emplace(t)}}addVertex(e,t,i,r,a,s){this.buffers.layoutVertexArray.emplace([i.x,i.y]),e.vertex.length+=1,e.index.length+=1}serialize(){const e=this.buffers,t=super.serialize();return Object.assign(Object.assign({},t),{layoutVertexArray:e.layoutVertexArray.serialize(),colorVertexArray:e.colorVertexArray.serialize(),indexArray:e.indexArray.serialize(),uvArray:e.uvArray.serialize(),previousVertexArray:e.previousVertexArray.serialize(),nextVertexArray:e.nextVertexArray.serialize(),sideArray:e.sideArray.serialize(),widthArray:e.widthArray.serialize(),lengthArray:e.lengthArray.serialize(),terminalArray:e.terminalArray.serialize(),countersArray:e.countersArray.serialize(),segments:{line:e.segments.line}})}static from(e){const t=new _i(e.options);return se(e)?console.warn("[MapsGL] Cannot create LineStore from invalid serialized data."):(t.features=e.features,t.buffers.segments.line=e.segments.line,t.buffers.layoutVertexArray=et.from(e.layoutVertexArray),t.buffers.colorVertexArray=et.from(e.colorVertexArray),t.buffers.indexArray=Je.from(e.indexArray),t.buffers.uvArray=et.from(e.uvArray),t.buffers.previousVertexArray=et.from(e.previousVertexArray),t.buffers.nextVertexArray=et.from(e.nextVertexArray),t.buffers.sideArray=Ke.from(e.sideArray),t.buffers.widthArray=et.from(e.widthArray),t.buffers.lengthArray=et.from(e.lengthArray),t.buffers.terminalArray=et.from(e.terminalArray),t.buffers.countersArray=et.from(e.countersArray)),t}}const Ai=_i,Mi=(e,t,i)=>{for(let r=0;r<e.kernings[r];r++){const a=e.kernings[r];if(!(a.first<t||a.second<i))return a.first>t||a.first===t&&a.second>i?0:a.amount}return 0},Ti=class{get font(){return this._config.font}constructor(e={}){this._config=Object.freeze(Object.assign({width:Number.POSITIVE_INFINITY,size:1,align:"left",letterSpacing:0,lineHeight:1.4,wordSpacing:0,wordBreak:!1},e))}generateLayout(e){const t=this.font,i=t.common.base,r=this._config.size,a=this._config.lineHeight,s=e.replaceAll(/[\n ]/g,"").length,n={position:{size:3,data:new Float32Array(4*s*3)},uv:{size:2,data:new Float32Array(4*s*2)},id:{size:4,data:new Float32Array(4*s)},index:{size:6,data:new Float32Array(6*s)}},o={position:[],uv:[],id:[],index:[],layout:[]};for(let e=0;e<s;e++)n.id.data[e]=e,n.index.data.set([4*e,4*e+2,4*e+1,4*e+1,4*e+2,4*e+3],6*e),o.id.push(e),o.index.push([4*e,4*e+2,4*e+1,4*e+1,4*e+2,4*e+3]);const l=r/i,h=t.chars.reduce(((e,t)=>(e[t.char]=t,e)),{}),c=[];let d=0,u=0,p=0;const f=()=>{const e={width:0,glyphs:[]};return c.push(e),u=d,p=0,e};let m=f();const g=/\s/,v=/\n/;let y=0;for(;d<e.length&&y<100;){y+=1;const i=e[d];if(!m.width&&g.test(i)){d+=1,u=d,p=0;continue}if(v.test(i)){d+=1,m=f();continue}const a=h[i]||h[" "];if(m.glyphs.length>0){const e=m.glyphs.at(-1)[0],i=Mi(t,a.id,e.id)*l;m.width+=i,p+=i}m.glyphs.push([a,m.width]);let s=0;if(g.test(i)?(u=d,p=0,s+=this._config.wordSpacing*r):s+=this._config.letterSpacing*r,s+=a.xadvance*l,m.width+=s,p+=s,m.width>this._config.width){if(this._config.wordBreak&&m.glyphs.length>1){m.width-=s,m.glyphs.pop(),m=f();continue}if(!this._config.wordBreak&&p!==m.width){const e=d-u+1;m.glyphs.splice(-e,e),d=u,m.width-=p,m=f();continue}}d+=1,y=0}m.width||c.pop();const x={width:Math.max(...c.map((e=>e.width))),height:c.length*r*this._config.lineHeight},{positions:b,uvs:w,layout:_}=this._populateBuffers(n,c,r,a,l,x);return o.position=b,o.uv=w,o.layout=_,{text:e,buffers:n,data:o,layout:_,numChars:s,numLines:c.length,size:x}}_populateBuffers(e,t,i,r,a,s){const n=this.font,o=n.common.scaleW,l=n.common.scaleH,h=this._config.align,c=/\s/,d=[],u=[],p=[];let f=.14*i,m=0;switch(h){case"bottom-left":case"bottom":case"bottom-right":f+=s.height;break;case"left":case"center":case"right":f+=.5*s.height}for(let s=0;s<t.length;s++){const n=t[s];let g=f;for(let t=0;t<n.glyphs.length;t++){const i=n.glyphs[t][0],r={anchor:null,offset:null,uv:null};let s=n.glyphs[t][1];switch(h){case"right":case"top-right":case"bottom-right":s-=n.width;break;case"center":case"top":case"bottom":s-=.5*n.width}if(c.test(i.char))continue;s+=i.xoffset*a,g-=i.yoffset*a;const v=i.width*a,y=i.height*a;e.position.data.set([s,g-y,0,s,g,0,s+v,g-y,0,s+v,g,0],4*m*3),d.push([s,g-y,0,s,g,0,s+v,g-y,0,s+v,g,0]),r.anchor=[s,1-g],r.offset=[v,y];const x=i.x/o,b=i.width/o,w=1-i.y/l,_=i.height/l;e.uv.data.set([x,w-_,x,w,x+b,w-_,x+b,w],4*m*2),u.push([x,w-_,x,w,x+b,w-_,x+b,w]),r.uv=[x,1-w,b,_],g=f,m+=1,p.push(r)}f-=i*r}return{positions:d,uvs:u,layout:p}}};function Ei(e,t){var i=new Pe(2);return i[0]=e,i[1]=t,i}function Si(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e}function Ci(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e}function Oi(e,t,i){return e[0]=t[0]*i[0],e[1]=t[1]*i[1],e}function Ri(e,t,i){return e[0]=t[0]/i[0],e[1]=t[1]/i[1],e}!function(){var e=new Pe(2);Pe!=Float32Array&&(e[0]=0,e[1]=0)}();class Ii extends Ue{get value(){return this._value}get elements(){return this.value.length}get x(){return this.value[0]}set x(e){this.value[0]=e}get y(){return this.value[1]}set y(e){this.value[1]=e}constructor(e=0,t=0){super(),this._value=Ei(e,t)}fromArray(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x=e[t],this.y=e[t+1],this}toArray(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.x,e[t+1]=this.y,e}fromObject(e){let{x:t,y:i}=e;return void 0!==t&&(this.x=t),void 0!==i&&(this.y=i),this}toObject(){return{x:this.x,y:this.y}}set(e,t){return this._value=Ei(e,t),this}setScalar(e){return this.set(e,e)}length(){return e=this.value,Math.hypot(e[0],e[1]);var e}angle(){const e=Ei(1,0);return r=(t=this.value)[0],a=t[1],s=(i=e)[0],n=i[1],o=Math.sqrt(r*r+a*a)*Math.sqrt(s*s+n*n),Math.acos(Math.min(Math.max(o&&(r*s+a*n)/o,-1),1));var t,i,r,a,s,n,o}copy(e){return this.x=e.x,this.y=e.y,this}clone(){return new Ii(this.x,this.y)}add(e){return Si(this.value,this.value,e.value),this}addScalar(e){return Si(this.value,this.value,Ei(e,e)),this}subtract(e){return Ci(this.value,this.value,e.value),this}subtractScalar(e){return Ci(this.value,this.value,Ei(e,e)),this}multiply(e){return Oi(this.value,this.value,e.value),this}multiplyScalar(e){return Oi(this.value,this.value,Ei(e,e)),this}divide(e){return Ri(this.value,this.value,e.value),this}divideScalar(e){return Ri(this.value,this.value,Ei(e,e)),this}distanceTo(e){return t=this.value,i=e.value,Math.hypot(i[0]-t[0],i[1]-t[1]);var t,i}dot(e){return(t=this.value)[0]*(i=e.value)[0]+t[1]*i[1];var t,i}equals(e){return r=(t=this.value)[0],a=t[1],s=(i=e.value)[0],n=i[1],Math.abs(r-s)<=Ie*Math.max(1,Math.abs(r),Math.abs(s))&&Math.abs(a-n)<=Ie*Math.max(1,Math.abs(a),Math.abs(n));var t,i,r,a,s,n}lerp(e,t){return function(e,t,i,r){var a=t[0],s=t[1];e[0]=a+r*(i[0]-a),e[1]=s+r*(i[1]-s)}(this.value,this.value,e.value,t),this}normalize(){return function(e,t){var i=t[0],r=t[1],a=i*i+r*r;a>0&&(a=1/Math.sqrt(a)),e[0]=t[0]*a,e[1]=t[1]*a}(this.value,this.value),this}scale(e){return function(e,t,i){e[0]=t[0]*i,e[1]=t[1]*i}(this.value,this.value,e),this}applyMatrix3(e){return function(e,t,i){var r=t[0],a=t[1];e[0]=i[0]*r+i[3]*a+i[6],e[1]=i[1]*r+i[4]*a+i[7]}(this.value,this.value,e.value),this}applyMatrix4(e){return function(e,t,i){var r=t[0],a=t[1];e[0]=i[0]*r+i[4]*a+i[12],e[1]=i[1]*r+i[5]*a+i[13]}(this.value,this.value,e.value),this}}const Pi=Ii,Di=e=>{const t={x:0,y:0};switch(e){case"right":case"top-right":case"bottom-right":t.x=-.5;break;case"left":case"top-left":case"bottom-left":t.x=.5}switch(e){case"bottom":case"bottom-right":case"bottom-left":t.y=-.5;break;case"top":case"top-right":case"top-left":t.y=.5}return new Pi(t.x,t.y)},zi=class{constructor(){this.layoutVertexArray=new et(13),this.indexArray=new Je(3),this.opacityVertexArray=new et(1),this.styleVertexArray=new et(10),this.segments=[]}get geometry(){return this._geometry}prepareGeometry(e){if(this._geometry)return;const t=this.layoutVertexArray,i=this.opacityVertexArray,r=this.styleVertexArray,a=(new Float32Array).BYTES_PER_ELEMENT,s=new At(e.gl,t.data,t.stride*a),n=new At(e.gl,i.data,i.stride*a),o=new At(e.gl,r.data,r.stride*a),l=new Jt(e,{position:{size:2,data:new Float32Array([0,1,0,0,1,0,1,1])},uv:{size:2,data:new Float32Array([0,1,0,0,1,0,1,1])},anchor:new Zt(s,2,!1,0,1),glyph:new Zt(s,4,!1,2*a,1),texCoordOffset:new Zt(s,4,!1,6*a,1),reference:new Zt(s,1,!1,10*a,1),gridPosition:new Zt(s,2,!1,11*a,1),fillColor:new Zt(o,2,!1,0,1),strokeColor:new Zt(o,2,!1,2*a,1),strokeWidth:new Zt(o,1,!1,4*a,1),size:new Zt(o,1,!1,5*a,1),rotation:new Zt(o,1,!1,6*a,1),factor:new Zt(o,1,!1,7*a,1),random:new Zt(o,1,!1,8*a,1),atlasIndex:new Zt(o,1,!1,9*a,1),opacity:new Zt(n,1,!1,0,1)});l.setIndex([0,1,2,0,2,3]),this._geometry=l}trim(){this.layoutVertexArray.trim(),this.indexArray.trim(),this.opacityVertexArray.trim(),this.styleVertexArray.trim()}updateTexturePositionArray(e,t,i){for(let r=e;r<t;r++){const e=r*this.layoutVertexArray.stride+6;for(let t=0;t<4;t++)this.layoutVertexArray.data[e+t]=i[t]}}updateOpacityArray(e,t,i){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];var a;for(let r=e;r<t;r++)this.opacityVertexArray.emplaceAt(r,i);r&&(null===(a=this.geometry)||void 0===a||a.setAttributeData("opacity",this.opacityVertexArray.data))}updateStyleArray(e,t,i,r,a,s,n,o,l,h){const c=Xe(i||new Ze(0,0,0,1)),d=Xe(r||new Ze(0,0,0,0));for(let i=e;i<t;i++)this.styleVertexArray.emplaceAt(i,[...c,...d,a,s,n,o,l,h])}};class Li extends ct{get type(){return"symbol"}constructor(e){super(e),this.includesSDFIcons=!1,this.text=new zi,this.icon=new zi,this.collisionArrays=[]}addFeature(e,t){var i,r;t=Object.assign({glyphDependencies:{},iconDependencies:{}},t);const a=e.feature.asPoints(),s=e.feature.extent,n=null==t?void 0:t.paint,o=null===(i=null==t?void 0:t.paint)||void 0===i?void 0:i.config,l=[];let h;const c=null===(r=null==o?void 0:o.icon)||void 0===r?void 0:r.shader,d=null==n?void 0:n.textLineCount();for(let t=0;t<d;t++){const i=null==n?void 0:n.textValue(e.properties,t);i&&l.push(xt(i,e.properties))}if((null==o?void 0:o.icon)&&(h=o.icon.type||o.icon.image||o.icon.shader||o.icon.atlas,ut(h)&&(h=h(e.properties))),!a||!0!==t.includeEmptySymbolData&&0===(null==l?void 0:l.length)&&!h&&!c)return;let u,p,f;const m=t.glyphDependencies,g=t.iconDependencies;for(let i=0;i<a.length;i++){const r=a[i],n=ft({x:r.x,y:r.y},s);if(a[i]=n,n.x<0||n.x>=ht||n.y<0||n.y>=ht)continue;f={x:n.x,y:n.y};const o=this.features.find((e=>{var t;return e.anchor.x===f.x&&e.anchor.y===f.y&&(null===(t=e.text)||void 0===t?void 0:t.length)>0&&e.text[0].value===l[0]}));if((null==l?void 0:l.length)>0&&!o){const{symbol:i,glyphDependencies:r}=this.addSymbolAtAnchor(f,Object.assign(Object.assign({},e),{anchor:f,geometry:a,paint:t.paint,text:l.map(((e,t)=>({value:e,index:t,anchor:f,padding:[0,0],offset:[0,0],vertexRange:void 0,atlasIndex:void 0,collisionBox:void 0}))),icon:null}),t);u=i.text,r&&Object.assign(m,r)}if(oe(h)){const{symbol:i,iconDependencies:r}=this.addSymbolAtAnchor(f,Object.assign(Object.assign({},e),{anchor:f,geometry:a,paint:t.paint,text:void 0,icon:{image:h,anchor:f,padding:[0,0],offset:[0,0],vertexRange:void 0,atlasIndex:void 0,collisionBox:void 0},collisionBox:void 0}),t);p=i.icon,r&&Object.assign(g,r)}}return!0===t.includeEmptySymbolData||u||p?{key:n.symbolKey(e.properties),type:e.type,featureIndex:e.featureIndex,sourceId:e.sourceId,sourceLayerIndex:e.sourceLayerIndex,geometry:a,anchor:f,properties:e.properties,vertexRange:void 0,paint:t.paint,text:u,icon:p,dependencies:{glyphs:m,icons:g}}:void 0}addSymbolAtAnchor(e,t,i){if(!(e.x<0||e.x>=ht||e.y<0||e.y>=ht))return t.icon?this.addIcon(e,t,i.iconDependencies):t.text?this.addText(e,t,i.glyphDependencies):void 0}addSymbols(e,t,i,r,a,s){const n=t.layoutVertexArray,o=t.opacityVertexArray,l=t.styleVertexArray,h=gt(t.segments,4*i.length,n.length,t.indexArray.length);for(let t=0;t<i.length;t++){const{offset:c,texture:d,style:u}=i[t],{strokeWidth:p,size:f,opacity:m,rotation:g,factor:v}=u;n.emplace([e.x,e.y,c.x,c.y,c.w,c.h,d.x,d.y,d.w,d.h,r,a,s]),o.emplace(m),l.emplace([0,0,0,0,p,f,g,v,Math.random(),u.atlasIndex]),h.vertex.length+=2,h.index.length+=1}}addIcon(e,t,i){var r;const a=t.properties,s=t.paint,n=s.iconImage(a),o=s.iconShader(a);if(oe(n)){const e="string"==typeof n?n:n.id;le(oe(e),`[MapsGL] Icon image id was not provided for symbol: ${JSON.stringify(n)}`),i[e]="string"==typeof n||Object.assign(Object.assign({},n),{pixelRatio:null!==(r=n.pixelRatio)&&void 0!==r?r:1}),t.icon.image=e}return t.icon.vertexRange={start:0,end:0},oe(o)&&this.layoutIcon(t,{}),{symbol:t,iconDependencies:i}}addText(e,t,i){const r=t.properties,a=t.paint;for(let e=0;e<t.text.length;e++){const s=t.text[e].value||"",n=a.textFont(r,e)||"Inter-Regular",o=a.textTransform(r,e)||"none";let l=s;"none"!==o&&("uppercase"===o?l=l.toUpperCase():"lowercase"===o?l=l.toLowerCase():"capitalize"===o&&(l=l.replaceAll(/\b\w/g,(e=>e.toUpperCase())))),void 0===i[n]&&(i[n]=[]);const h=i[n];for(let e=0;e<l.length;e++)s.charAt(e),h.push(s.charCodeAt(e));t.text[e].value=l,t.text[e].vertexRange={start:0,end:0}}return{symbol:t,glyphDependencies:i}}layoutSymbols(e,t){for(let i=0;i<this.features.length;i++){const r=this.features[i],a=r.text,s=r.icon,n={x1:Number.POSITIVE_INFINITY,y1:Number.POSITIVE_INFINITY,x2:Number.NEGATIVE_INFINITY,y2:Number.NEGATIVE_INFINITY,anchorPointX:r.anchor.x,anchorPointY:r.anchor.y};if(a){this.layoutText(r,t);for(let e=0;e<a.length;e++){const t=a[e];t.collisionBox&&(n.x1=Math.min(n.x1,t.collisionBox.x1),n.y1=Math.min(n.y1,t.collisionBox.y1),n.x2=Math.max(n.x2,t.collisionBox.x2),n.y2=Math.max(n.y2,t.collisionBox.y2))}}((null==s?void 0:s.image)||(null==s?void 0:s.shader))&&(this.layoutIcon(r,e),s.collisionBox&&(n.x1=Math.min(n.x1,s.collisionBox.x1),n.y1=Math.min(n.y1,s.collisionBox.y1),n.x2=Math.max(n.x2,s.collisionBox.x2),n.y2=Math.max(n.y2,s.collisionBox.y2))),r.collisionBox=n}}layoutText(e,t){var i;const r=e.properties,a=this.text,s=[];for(let n=0;n<e.text.length;n++){const o=e.text[n].value,l=e.paint,h=e.text[n].anchor,c=ht/he,d=l.textFont(r,n)||"Inter-Regular",u=l.textSize(r,n)||12,p=l.textAlign(r,n)||"center",f=Di(l.textAnchor(r,n)||"center"),m=l.textLineHeight(r,n)||1,g=l.textLetterSpacing(r,n)||0,v=l.textMaxWidth(r,n)||100,y=l.textOffset(r,n),x=l.textRotation(r,n)||0,b=l.symbolAllowOverlap()||!1,w=(l.symbolFadeOpacity(r),l.iconFactor(r)),_={x:0,y:0};if(y){const{x:e,y:t}=bt(y,s);_.x=e,_.y=t}const A=t[d].ranges[0];if(ne(A))return;const M=A.spec;if(!M)throw new Error(`[MapsGL] Missing font spec for font "${d}"`);const T=new Ti({font:M,size:u,width:v,align:p,lineHeight:Math.max(0,m),letterSpacing:g}).generateLayout(`${o}`),{position:E,layout:S}=T.data,C=[],O={x1:Number.POSITIVE_INFINITY,y1:Number.POSITIVE_INFINITY,x2:Number.NEGATIVE_INFINITY,y2:Number.NEGATIVE_INFINITY,anchorPointX:h.x,anchorPointY:h.y};for(let e=0;e<E.length;e++){const t=S[e],i={box:{tl:{x:t.anchor[0],y:t.anchor[1]},tr:{x:t.anchor[0]+t.offset[0],y:t.anchor[1]},bl:{x:t.anchor[0],y:t.anchor[1]+t.offset[1]},br:{x:t.anchor[0]+t.offset[0],y:t.anchor[1]+t.offset[1]}},offset:{x:t.anchor[0]+_.x,y:t.anchor[1]+_.y,w:t.offset[0],h:t.offset[1]},texture:{x:t.uv[0],y:t.uv[1],w:t.uv[2],h:t.uv[3]},style:{fillColor:l.fillColor(r)||new Ze("#000"),strokeColor:l.strokeColor(r)||new Ze("#000"),strokeWidth:l.strokeThickness(r)||0,size:u,opacity:b?1:0,rotation:x||0,factor:ae(w)?w:0,atlasIndex:0}};O.x1=Math.min(O.x1,t.anchor[0]),O.y1=Math.min(O.y1,t.anchor[1]),O.x2=Math.max(O.x2,t.anchor[0]+t.offset[0]),O.y2=Math.max(O.y2,t.anchor[1]+t.offset[1]),C.push(i)}const R=O.x2-O.x1,I=O.y2-O.y1;C.forEach((e=>{e.offset.x+=R*f.x,e.offset.y+=I*f.y,O.x1=Math.min(O.x1,e.offset.x),O.y1=Math.min(O.y1,e.offset.y),O.x2=Math.max(O.x2,e.offset.x+e.offset.w),O.y2=Math.max(O.y2,e.offset.y+e.offset.h)}));const P=a.layoutVertexArray.length;this.addSymbols(h,a,C,e.featureIndex,0,0),e.text[n].vertexRange={start:P,end:a.layoutVertexArray.length},e.text[n].atlasIndex=null===(i=A.atlas)||void 0===i?void 0:i.index,s.push(Object.assign({},O)),O.x1*=c,O.y1*=c,O.x2*=c,O.y2*=c,e.text[n].collisionBox=O}this.collisionArrays.push({textBox:e.text[0].collisionBox,textFeatureIndex:e.featureIndex})}layoutIcon(e,t){var i,r;const a=e.properties,s=this.icon,n=t[e.icon.image]||{size:{width:20,height:20},position:{x:0,y:0,w:1,h:1},pixelRatio:1,sdf:!1},o=ht/he,l=n.pixelRatio||1,h=e.paint,c=e.icon.anchor,d=h.iconSize(a)||{width:n.size.width/l,height:n.size.height/l},u=h.iconRotation(a),p=h.iconOffset(a),f=Di(h.iconAnchor(a)||"center"),m=h.iconFactor(a),g=[],v=d.width,y=d.height,x=d.width/(n.size.width/l),b={x1:Number.POSITIVE_INFINITY,y1:Number.POSITIVE_INFINITY,x2:Number.NEGATIVE_INFINITY,y2:Number.NEGATIVE_INFINITY,anchorPointX:c.x,anchorPointY:c.y};n.position||console.warn("[MapsGL] Missing icon position for icon:",e.icon.image,t),n.sdf&&(this.includesSDFIcons=!0);const w={box:{tl:{x:c.x,y:c.y},tr:{x:c.x+v,y:c.y},bl:{x:c.x,y:c.y+y},br:{x:c.x+v,y:c.y+y}},offset:{x:-v/2+p.x,y:-y/2+p.y,w:v,h:y},texture:n.position?{x:n.position.x,y:n.position.y,w:n.position.w,h:n.position.h}:{x:0,y:0,w:1,h:1},style:{fillColor:h.fillColor(a)||new Ze("#000"),strokeColor:h.strokeColor(a)||new Ze("#000"),strokeWidth:h.strokeThickness(a)||0,size:x,opacity:1,rotation:u||0,factor:ae(m)?m:0,atlasIndex:0}};w.offset.x+=v*f.x,w.offset.y+=y*f.y,g.push(w),b.x1=Math.min(b.x1,w.offset.x),b.y1=Math.min(b.y1,w.offset.y),b.x2=Math.max(b.x2,w.offset.x+w.offset.w),b.y2=Math.max(b.y2,w.offset.y+w.offset.h);const _=null!==(i=e.properties.gridRow)&&void 0!==i?i:0,A=null!==(r=e.properties.gridCol)&&void 0!==r?r:0,M=s.layoutVertexArray.length;this.addSymbols(c,s,g,e.featureIndex,_,A),e.icon.vertexRange={start:M,end:s.layoutVertexArray.length},b.x1*=o,b.y1*=o,b.x2*=o,b.y2*=o,e.icon.collisionBox=b,this.collisionArrays.push({iconBox:b,iconFeatureIndex:e.featureIndex})}trim(){this.text.trim(),this.icon.trim()}serialize(){const e=super.serialize();return Object.assign({features:this.features.map((e=>(e.paint=void 0,e))),text:{layoutVertexArray:this.text.layoutVertexArray.serialize(),indexArray:this.text.indexArray.serialize(),opacityVertexArray:this.text.opacityVertexArray.serialize(),styleVertexArray:this.text.styleVertexArray.serialize(),segments:[...this.text.segments]},icon:{layoutVertexArray:this.icon.layoutVertexArray.serialize(),indexArray:this.icon.indexArray.serialize(),opacityVertexArray:this.icon.opacityVertexArray.serialize(),styleVertexArray:this.icon.styleVertexArray.serialize(),segments:[...this.icon.segments]},collisionArrays:[...this.collisionArrays],includesSDFIcons:this.includesSDFIcons},e)}static from(e){const t=new Li(e.options);if(t.id=e.id,t.includesSDFIcons=e.includesSDFIcons,se(e))console.warn("[MapsGL] Cannot create SymbolStore from invalid serialized data.");else{const i=new zi;i.layoutVertexArray=et.from(e.text.layoutVertexArray),i.indexArray=Je.from(e.text.indexArray),i.opacityVertexArray=et.from(e.text.opacityVertexArray),i.styleVertexArray=et.from(e.text.styleVertexArray),i.segments=e.text.segments,t.text=i;const r=new zi;r.layoutVertexArray=et.from(e.icon.layoutVertexArray),r.indexArray=Je.from(e.icon.indexArray),r.opacityVertexArray=et.from(e.icon.opacityVertexArray),r.styleVertexArray=et.from(e.icon.styleVertexArray),r.segments=e.icon.segments,t.icon=r,t.collisionArrays=e.collisionArrays,t.features=e.features}return t}}const ki=Li,Fi=class extends ct{},ji=(e,t,i,r)=>{let a=r;if(i=i||{},re(t))return a;if(s(t)){if("object"===e||"any"===e)return t;if("color"===e&&t instanceof Ze)return t;if(t.property)if(t.mapping){const e=dt(i,t.property);a=t.mapping[e]}else a=dt(i,t.property)}else a=ut(t)?t(i):t;var n;return"color"===e&&(a=xe(n=a)||ge(n)?new He(n):n instanceof He?n:s(n)&&ae(n.r)&&ae(n.g)&&ae(n.b)&&ae(n.a)?new He(n.r,n.g,n.b,n.a):null),a},Ni=(e,t)=>{const[i,r,a]=e;let n;if(Array.isArray(a)&&a.length>0&&(t=Ni(a,t)),re(t))throw new Error(`[MapsGL] Input is null or undefined for lookup expression: ${JSON.stringify(e)}`);switch(i){case"has":n=ye(t,[r]);break;case"get":n=dt(t,r);break;case"at":Array.isArray(t)&&!1===Number.isNaN(r)&&r>=0&&(n=t[r]);break;case"length":Array.isArray(t)?n=t.length:s(t)?n=Object.keys(t).length:ge(t)&&(n=t.length);break;default:n=null}return n},Vi=(e,t,i)=>{if(!Array.isArray(i)||0===i.length)return!1;switch(e){case"!":return!t;case"==":return t===i[0];case"!=":return t!==i[0];case">":return t>i[0];case"<":return t<i[0];case">=":return t>=i[0];case"<=":return t<=i[0];case"in":if(Array.isArray(i))return i.includes(t)}return!1},Bi=(e,t,i)=>{let r=!1;for(let a=0;a<i.length;a++){const[s,n,...o]=i[a];let l,h=o;Array.isArray(n)?l=Ni(n,e.properties):ge(n)&&(l=dt(e.properties,n)),Array.isArray(h[0])&&["get","has"].includes(h[0][0])&&(h=[Ni(h[0],e.properties)]);const c=Vi(s,l,h);if("all"===t){if(0===a?r=c:c||(r=!1),!r)break}else"any"===t&&c?r=c:"!"===t&&(r=!c)}return r},Ui=e=>oe(e)&&ge(e)?e.replace(/(?:^|\s)\S/g,(e=>e.toUpperCase())):"",$i=e=>{let t=e.toString().replaceAll("://",":\\/\\/").replaceAll(/\/{2}.*/g,"").replaceAll("\n","").replaceAll("\t","").replaceAll(/\s+/g," ");return e.name&&new RegExp(`^\\s*${e.name}\\s*([(])`).test(t)&&(t=`function ${t}`),JSON.stringify(`_FUNC${t}`)},Gi=(e,t)=>t.startsWith("_FUNC")?(t=t.replace(/^_FUNC/,""),new Function(`return (${t}).apply(this, arguments);`)):t,qi=(e,t)=>{Object.keys(t).forEach((i=>{Array.isArray(t[i])?e[i]=t[i].map((e=>{if(s(e)){const t={};return qi(t,e),t}return ut(e)?$i(e):e})):s(t[i])?(e[i]={},qi(e[i],t[i])):ut(t[i])?["value","transform","key","rank","size","factor","offset","image","pattern"].includes(i)&&(e[i]=$i(t[i])):e[i]=t[i]}))},Wi=(e,t)=>{if(re(t))throw new Error("[MapsGL] Serialized style is null or undefined");Object.keys(t).forEach((i=>{if(Array.isArray(t[i]))e[i]=t[i].map((e=>{if(s(e)){const t={};return Wi(t,e),t}return/_FUNC/.test(e)?JSON.parse(e,Gi):e}));else if(s(t[i]))e[i]={},Wi(e[i],t[i]);else if(/_FUNC/.test(t[i]))try{e[i]=JSON.parse(t[i],Gi)}catch(e){console.error(`[MapsGL] Failed to deserialize function '${i}':`,e)}else e[i]=t[i]}))},Hi=(e,t)=>{if(null==e?void 0:e.text)return Array.isArray(e.text)?e.text[t]:e.text},Zi=e=>(null==e?void 0:e.icon)||(null==e?void 0:e.symbol);class Yi{constructor(e={}){if(this._cachedSerialized=null,e.symbol){const t=new Set(["key","rank","fadeOpacity","pitchWithMap","rotateWithMap","scaleWithMap","sizeAttenuation","allowOverlap"]),i=Object.keys(e.symbol);e.icon||(e.icon={}),i.forEach((i=>{!0!==t.has(i)&&("icon"!==i&&(e.icon[i]=e.symbol[i]),delete e.symbol[i])}))}this.config=e}opacity(e){const t=ji("number",this.provider(e).opacity,e,1);return re(t)?1:t}animated(e){return ji("boolean",this.provider(e).animated,e,!1)}rasterMeld(e){var t;return ji("boolean",null===(t=this.provider(e).raster)||void 0===t?void 0:t.meld,e,!1)}rasterOpacity(e){var t;const i=ji("number",null===(t=this.provider(e).raster)||void 0===t?void 0:t.opacity,e);return re(i)?this.opacity(e):i}fillColor(e){var t;const i=this.fillPattern(e);let r=ji("color",null===(t=this.provider(e).fill)||void 0===t?void 0:t.color,e);return i&&(r=new Ze(0,0,0,1)),r&&(r.a*=this.fillOpacity(e)),r}fillPattern(e){var t;const i=null===(t=this.provider(e).fill)||void 0===t?void 0:t.pattern,r="function"==typeof i?i(e):i;if("string"==typeof r&&/^https?:\/\//.test(r))throw new Error(`[MapsGL] Remote icon images must contain a unique id and provided as { id: string; url: string; }, not ${r}.`);return r}fillOpacity(e){var t;const i=ji("number",null===(t=this.provider(e).fill)||void 0===t?void 0:t.opacity,e,1);return re(i)?1:i}fillSort(e){var t;const i=null===(t=this.provider(e).fill)||void 0===t?void 0:t.sort;return"string"==typeof i?{property:i}:i}strokeColor(e){var t;const i=ji("color",null===(t=this.provider(e).stroke)||void 0===t?void 0:t.color,e);return i&&(i.a=this.strokeOpacity(e)),i}strokeOpacity(e){var t;const i=ji("number",null===(t=this.provider(e).stroke)||void 0===t?void 0:t.opacity,e,1);return re(i)?1:i}strokeThickness(e){var t;const i=ji("number",null===(t=this.provider(e).stroke)||void 0===t?void 0:t.thickness,e);return re(i)?0:i}strokeLineJoin(e){var t;const i=ji("string",null===(t=this.provider(e).stroke)||void 0===t?void 0:t.lineJoin,e);return re(i)?vi:i}strokeLineCap(e){var t;const i=ji("string",null===(t=this.provider(e).stroke)||void 0===t?void 0:t.lineCap,e);return re(i)?"round":i}radius(e){var t,i;const r=(null===(t=this.provider(e).circle)||void 0===t?void 0:t.radius)||(null===(i=this.provider(e).heatmap)||void 0===i?void 0:i.radius);return ji("number",r,e,10)}sampleExpression(e){var t;const i=null===(t=this.provider(e).sample)||void 0===t?void 0:t.expression;return ji("string",i,e,"number")}sampleExpressionOperation(e){var t;return ji("object",null===(t=this.provider(e).sample)||void 0===t?void 0:t.expressionOperation,e)}sampleChannel(e){var t;return ji("string",null===(t=this.provider(e).sample)||void 0===t?void 0:t.channel,e)}sampleColorScale(e){var t;return ji("object",null===(t=this.provider(e).sample)||void 0===t?void 0:t.colorscale,e)}sampleInterpolation(e){var t;const i=null===(t=this.provider(e).sample)||void 0===t?void 0:t.interpolation;return ji("string",i,e)}sampleOpacity(e){return console.warn("[MapsGL] `sample.opacity` is deprecated. Use `opacity` instead."),1}sampleSmoothing(e){var t;return ji("number",null===(t=this.provider(e).sample)||void 0===t?void 0:t.smoothing,e,0)}sampleOffset(e){var t;return ji("number",null===(t=this.provider(e).sample)||void 0===t?void 0:t.offset,e,0)}sampleMeld(e){var t;return ji("boolean",null===(t=this.provider(e).sample)||void 0===t?void 0:t.meld,e,!0)}sampleDataRange(e){var t;return ji("object",null===(t=this.provider(e).sample)||void 0===t?void 0:t.dataRange,e)}sampleDrawRange(e){var t;return ji("object",null===(t=this.provider(e).sample)||void 0===t?void 0:t.drawRange,e)}gridSpacing(e){var t;return ji("number",null===(t=this.provider(e).grid)||void 0===t?void 0:t.spacing,e,30)}particleType(e){var t;return ji("string",null===(t=this.provider(e).particle)||void 0===t?void 0:t.type,e)}particleCount(e){var t;return ji("number",null===(t=this.provider(e).particle)||void 0===t?void 0:t.count,e)}particleDensity(e){var t;return ji("number",null===(t=this.provider(e).particle)||void 0===t?void 0:t.density,e,0)}particleSpeed(e){var t,i;const r=(null===(t=this.provider(e).particle)||void 0===t?void 0:t.speedFactor)||(null===(i=this.provider(e).particle)||void 0===i?void 0:i.speed);return ji("number",r,e,1)}particleSize(e){var t,i,r;if(xe(null===(t=this.config.particle)||void 0===t?void 0:t.size)){const t=ji("number",null===(i=this.provider(e).particle)||void 0===i?void 0:i.size,e,0);return{width:t,height:t}}return ji("object",null===(r=this.provider(e).particle)||void 0===r?void 0:r.size,e,{width:2,height:2})}particleTrails(e){var t;return ji("boolean",null===(t=this.provider(e).particle)||void 0===t?void 0:t.trails,e)}particleTrailsFade(e){var t,i;const r=(null===(t=this.provider(e).particle)||void 0===t?void 0:t.trailsFadeFactor)||(null===(i=this.provider(e).particle)||void 0===i?void 0:i.trailsFade);return ji("number",r,e)}particleDropRate(e){var t;return ji("number",null===(t=this.provider(e).particle)||void 0===t?void 0:t.dropRate,e)}particleDropRateBump(e){var t;return ji("number",null===(t=this.provider(e).particle)||void 0===t?void 0:t.dropRateBump,e)}heatmapColor(e){var t;return ji("colorscale",null===(t=this.provider(e).heatmap)||void 0===t?void 0:t.color,e)}heatmapRadius(e){var t;return ji("number",null===(t=this.provider(e).heatmap)||void 0===t?void 0:t.radius,e,10)}heatmapBlur(e){var t;return ji("number",null===(t=this.provider(e).heatmap)||void 0===t?void 0:t.blur,e,1)}heatmapIntensity(e){var t;return ji("number",null===(t=this.provider(e).heatmap)||void 0===t?void 0:t.intensity,e)}heatmapWeight(e){var t;return ji("number",null===(t=this.provider(e).heatmap)||void 0===t?void 0:t.weight,e,1)}heatmapOpacity(e){return console.warn("[MapsGL] `heatmap.opacity` is deprecated. Use `opacity` instead."),1}contourInterval(e){var t;return ji("number",null===(t=this.provider(e).contour)||void 0===t?void 0:t.interval,e,1)}contourMajorInterval(e){var t;return ji("number",null===(t=this.provider(e).contour)||void 0===t?void 0:t.majorInterval,e,0)}contourWidth(e){var t;return ji("number",null===(t=this.provider(e).contour)||void 0===t?void 0:t.width,e,1)}contourMajorWidth(e){var t;return ji("number",null===(t=this.provider(e).contour)||void 0===t?void 0:t.majorWidth,e,3)}contourScale(e){var t;return ji("number",null===(t=this.provider(e).contour)||void 0===t?void 0:t.scale,e,1)}contourOffset(e){var t;return ji("number",null===(t=this.provider(e).contour)||void 0===t?void 0:t.offset,e,0)}symbolKey(e){var t;return ji("string",null===(t=this.provider(e).symbol)||void 0===t?void 0:t.key,e)}symbolRank(e){var t;return null===(t=this.provider(e).symbol)||void 0===t?void 0:t.rank}symbolRotateWithMap(e){var t;return ji("boolean",null===(t=this.provider(e).symbol)||void 0===t?void 0:t.rotateWithMap,e,!0)}symbolPitchWithMap(e){var t;return ji("boolean",null===(t=this.provider(e).symbol)||void 0===t?void 0:t.pitchWithMap,e,!0)}symbolScaleWithMap(e){var t;return ji("boolean",null===(t=this.provider(e).symbol)||void 0===t?void 0:t.scaleWithMap,e,!1)}symbolSizeAttenuation(e){var t;return ji("boolean",null===(t=this.provider(e).symbol)||void 0===t?void 0:t.sizeAttenuation,e,!1)}symbolAllowOverlap(e){var t;return ji("boolean",null===(t=this.provider(e).symbol)||void 0===t?void 0:t.allowOverlap,e,!0)}symbolOverlapMode(e){var t;return ji("string",null===(t=this.provider(e).symbol)||void 0===t?void 0:t.overlapMode,e,"layer")}symbolFadeOpacity(e){var t;return ji("boolean",null===(t=this.provider(e).symbol)||void 0===t?void 0:t.fadeOpacity,e,!0)}iconType(e){var t;return ji("string",null===(t=Zi(this.provider(e)))||void 0===t?void 0:t.type,e)}iconImage(e){var t,i;const r=null===(t=this.provider(e).icon)||void 0===t?void 0:t.image,a="function"==typeof r?r(e):r;if("string"==typeof a&&/^https?:\/\//.test(a))throw new Error(`[MapsGL] Remote icon images must contain a unique id and provided as { id: string; url: string; }, not ${a}.`);const s=this.iconAtlas(e);return!a&&(null===(i=null==s?void 0:s.ids)||void 0===i?void 0:i.length)>0?s.ids[0]:a}iconShader(e){var t;return ji("string",null===(t=Zi(this.provider(e)))||void 0===t?void 0:t.shader,e)}iconUniforms(e){var t;return ji("object",null===(t=Zi(this.provider(e)))||void 0===t?void 0:t.uniforms,e)}iconSize(e){var t;return ji("object",null===(t=Zi(this.provider(e)))||void 0===t?void 0:t.size,e)}iconAnchor(e){var t;return ji("string",null===(t=Zi(this.provider(e)))||void 0===t?void 0:t.anchor,e,"center")}iconOffset(e){var t;return ji("object",null===(t=Zi(this.provider(e)))||void 0===t?void 0:t.offset,e,{x:0,y:0})}iconPadding(e){var t;const i=ji("object",null===(t=Zi(this.provider(e)))||void 0===t?void 0:t.padding,e,6);return Array.isArray(i)?i:[i,i]}iconRotation(e){var t;return ji("number",null===(t=Zi(this.provider(e)))||void 0===t?void 0:t.rotation,e,0)}iconBlending(e){var t;return ji("number",null===(t=Zi(this.provider(e)))||void 0===t?void 0:t.blending,e)}iconAnimated(e){var t;return ji("boolean",null===(t=Zi(this.provider(e)))||void 0===t?void 0:t.animated,e,!1)}iconFactor(e){var t;return ji("number",null===(t=Zi(this.provider(e)))||void 0===t?void 0:t.factor,e,1)}iconAtlas(e){var t;return ji("object",null===(t=Zi(this.provider(e)))||void 0===t?void 0:t.atlas,e)}textValue(e){var t;const i=null===(t=Hi(this.config,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0))||void 0===t?void 0:t.value;return"function"==typeof i?i(e):i}textTransform(e){var t;return ji("string",null===(t=Hi(this.config,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0))||void 0===t?void 0:t.transform,e,"none")}textFont(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;var i,r;const a=ji("string",null===(i=Hi(this.config,t))||void 0===i?void 0:i.font,e,"Inter");let s=ji("string",null===(r=Hi(this.config,t))||void 0===r?void 0:r.weight,e,"normal");return"normal"===s&&(s="regular"),`${Ui(a)}-${Ui(s)}`}textSize(e){var t;return ji("object",null===(t=Hi(this.config,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0))||void 0===t?void 0:t.size,e,12)}textColor(e){var t;const i=ji("color",null===(t=Hi(this.config,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0))||void 0===t?void 0:t.color,e,new Ze("#000"));return i&&(i.a=this.textOpacity(e)),i}textOutlineColor(e){var t;const i=ji("color",null===(t=Hi(this.config,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0))||void 0===t?void 0:t.outlineColor,e);return i&&(i.a=this.textOpacity(e)),i}textOpacity(e){var t;const i=ji("number",null===(t=Hi(this.config,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0))||void 0===t?void 0:t.opacity,e,1);return re(i)?1:i}textAlign(e){var t;return ji("string",null===(t=Hi(this.config,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0))||void 0===t?void 0:t.align,e,"center")}textAnchor(e){var t;return ji("string",null===(t=Hi(this.config,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0))||void 0===t?void 0:t.anchor,e,"center")}textOffset(e){var t;return ji("object",null===(t=Hi(this.config,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0))||void 0===t?void 0:t.offset,e,{x:0,y:0})}textPadding(e){var t;const i=ji("object",null===(t=Hi(this.config,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0))||void 0===t?void 0:t.padding,e,6);return Array.isArray(i)?i:[i,i]}textRotation(e){var t;return ji("number",null===(t=Hi(this.config,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0))||void 0===t?void 0:t.rotation,e,0)}textLetterSpacing(e){var t;return ji("number",null===(t=Hi(this.config,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0))||void 0===t?void 0:t.letterSpacing,e,0)}textLineHeight(e){var t;return ji("number",null===(t=Hi(this.config,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0))||void 0===t?void 0:t.lineHeight,e,1)}textMaxWidth(e){var t;return ji("number",null===(t=Hi(this.config,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0))||void 0===t?void 0:t.maxWidth,e,140)}textLineCount(e){var t;const i=null===(t=this.config)||void 0===t?void 0:t.text;return i?Array.isArray(i)?i.length:1:0}getProperty(e){return dt(this.config,e)}setProperty(e,t){const i=e.match(/\[\d+]/);if((null==i?void 0:i.length)>0){const r=Number.parseInt(i[0].replaceAll(/\D/g,""),10),a=e.split(i[0]),s=dt(this.config,a[0]),n=a[1].replace(/^\./,"");Array.isArray(s)&&ve(s[r],n,t)}else ve(this.config,e,t);this._cachedSerialized=null}serialized(){if(this._cachedSerialized)return this._cachedSerialized;const e={};return qi(e,this.config),this._cachedSerialized=e,e}provider(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return(ut(this.config)?this.config(e):this.config)||{}}static fromSerialized(e){const t={};return Wi(t,e),new Yi(t)}}const Xi=Yi;class Qi extends ct{get type(){return"data"}addFeature(e,t){const i=e.feature.asPoints(),r=(e.feature.asPolygons(),e.feature.extent);for(let e=0;e<i.length;e++){const t=i[e],a=ft({x:t.x,y:t.y},r);i[e]=a}return{type:e.type,featureIndex:e.featureIndex,sourceId:e.sourceId,sourceLayerIndex:e.sourceLayerIndex,geometry:i,properties:e.properties,vertexRange:{start:null,end:null}}}static from(e){const t=new Qi(e.options);return se(e)?console.warn("[MapsGL] Cannot create FeatureStore from invalid serialized data."):t.features=e.features,t}}const Ki=Qi,Ji=(e,t)=>{if("fill"===e)return new pi(t);if("line"===e)return new Ai(t);if("circle"===e||"heatmap"===e||"voronoi"===e)return new ii(t);if("symbol"===e||"text"===e)return new ki(t);if("data"===e)return new Ki(t);throw new Error(`[MapsGL] Invalid data store type ${e}`)};function er(e){if(!e)return{};const t=Object.assign({},e);return Object.keys(t).forEach((i=>{if(ge(t[i])){const r=e[i];if(/^([[{])/.test(r)){if(t[i]=JSON.parse(r),Array.isArray(t[i]))t[i]=t[i].map((e=>ge(e)?JSON.parse(e):e));else if(s(e[i])){const r=Object.assign({},e[i]);Object.keys(r).forEach((e=>{r[e]=er(r[e])})),t[i]=r}}else t[i]=r}})),t}const tr=class{constructor(e,t={}){this.coord=new fe(e.z,e.x,e.y),this.actor=t.actor,oe(t.granularity)&&(this.subdivisionGranularity=new oi(t.granularity))}parse(e,t){return i=this,a=function*(){var i;const r={};if(!(null==e?void 0:e.layers))return;const a=Object.keys(e.layers),s=t.reduce(((t,i)=>{const{sourceLayerId:r=a[0]}=i;return i.sourceLayerId=r,e.layers[r]&&(t[r]||(t[r]=[]),t[r].push(i)),t}),{}),n=Object.keys(s),o={},l={},h={};n.forEach((t=>{const i=s[t],a=[],n=e.layers[t];if(n){for(let e=0,t=n.length;e<t;e++){const t=n.feature(e),i=t.properties||{},r={};Object.keys(i).forEach((e=>{ve(r,e,i[e])})),t.properties=r,a.push(t)}for(let e=0,t=i.length;e<t;e++){const{type:t,layerId:s,sourceLayerType:n,filter:c,paint:d,options:u}=i[e],p=Ji(t,Object.assign(Object.assign({},u),{tile:this.coord.toInfo(),sourceId:"",sourceLayerIndex:0,zoom:this.coord.z})),f=Xi.fromSerialized(d);if(p){p.id=`${s}:${this.coord.hash}`,r[s]=p;let e=a.filter((e=>re(n)||"point"===n&&1===e.type||"line"===n&&2===e.type||"polygon"===n&&3===e.type)),t=e;if(e=[...e].map((e=>(e.properties=er(e.properties),e))),(null==c?void 0:c.length)>1){const i=c[0],r="all"===i||"any"===i||"!"===i?c:["all",c];t=[],e.forEach((e=>{const[i,...a]=r;Bi(e,i,a)&&t.push(e)}))}p.populate(t,void 0,{tileCoord:this.coord,paint:f,includeEmptySymbolData:"data"===p.type,subdivisionGranularity:this.subdivisionGranularity,glyphDependencies:o,iconDependencies:l,patternDependencies:h})}}}else for(let e=0,t=i.length;e<t;e++){const{layerId:t}=i[e];r[t]=new Fi({tile:this.coord.toInfo(),sourceLayerIndex:0,sourceId:"",zoom:this.coord.z})}}));let c=(null===(i=this.dependencies)||void 0===i?void 0:i.glyphs)||{},d={};if(oe(o)){const e=Object.keys(c),t=Object.keys(o).filter((t=>{var i;return!e.includes(t)||ne(null===(i=c[t])||void 0===i?void 0:i.ranges)}));t.length>0&&Object.keys(o).reduce(((e,t)=>{const i=c[t]||{},r=o[t];return ne(i)?e.push(...r):Object.values((null==i?void 0:i.ranges)||{}).forEach((t=>{r.forEach((i=>{i>=t.start&&i<=t.end&&e.push(i)}))})),e}),[]).length>0&&(c=yield this.actor.send({type:"getGlyphs",data:o}))}const u=Object.assign(Object.assign({},l),h);if(oe(u)){const e=Object.keys(u).filter((e=>ye(u[e],["url"]))).reduce(((e,t)=>{var i,r,a;return e.push({id:t,url:u[t].url,pixelRatio:null!==(i=u[t].pixelRatio)&&void 0!==i?i:1,sdf:null!==(r=u[t].sdf)&&void 0!==r&&r,pattern:null!==(a=u[t].pattern)&&void 0!==a&&a}),e}),[]);e.length>0&&(yield this.actor.send({type:"loadImages",data:e})),d=yield this.actor.send({type:"getImages",data:u})}return(oe(c)||oe(d))&&Object.values(r).forEach((e=>{e instanceof ki&&e.layoutSymbols(d,c)})),new Promise(((e,t)=>{e({stores:Object.keys(r).reduce(((e,t)=>{const i=r[t];return ae(i)&&!i.isEmpty&&(e[t]=i),e}),{}),dependencies:{glyphs:c,icons:d}})}))},new((r=void 0)||(r=Promise))((function(e,t){function s(e){try{o(a.next(e))}catch(e){t(e)}}function n(e){try{o(a.throw(e))}catch(e){t(e)}}function o(t){var i;t.done?e(t.value):(i=t.value,i instanceof r?i:new r((function(e){e(i)}))).then(s,n)}o((a=a.apply(i,[])).next())}));var i,r,a}abort(){}},ir=(e,t,i)=>{const{headers:r,body:a}=t||{};return fetch(e,{headers:r,body:a?"string"==typeof a?a:JSON.stringify(a):void 0}).then(me).then((e=>{if((e=>ae(e)&&e.status>=200&&e.status<=299)(e))return e.arrayBuffer()})).then((e=>{if(ae(e))try{return{vectorTile:new M(new Uint8Array(e))}}catch(e){console.error("Error parsing vector tile",e)}}))},rr=class{constructor(e){this.onTileError=()=>{},this.loading={},this.loaded={},this.dependencies={glyphs:void 0,icons:void 0},this.tileLoader=e||ir}loadTile(e,t){var i;const{tile:{info:r},request:{url:a,headers:s,body:n,reload:o=!1}}=e,l=de(r.x,r.y,r.z,0);this.loading=null!==(i=this.loading)&&void 0!==i?i:{};const h=this.loaded[l];if(h&&!0!==o)return h.parse(h.vectorTile,e.layers).then((e=>(this.loaded[l]=h,e))).catch((e=>{console.error(e)}));const c=new tr(r,{actor:t,granularity:e.granularity});return this.loading[l]=c,this.tileLoader(a,{headers:s,body:n},r).then((t=>{const i=!this.loading[l];if(delete this.loading[l],ae(t)&&(c.vectorTile=t.vectorTile),!i&&!re(t))return c.dependencies=this.dependencies,c.parse(t.vectorTile,e.layers)})).then((e=>(this.loaded=this.loaded||{},this.loaded[l]=c,(null==e?void 0:e.dependencies)&&(this.dependencies=e.dependencies),e))).catch((e=>{console.error(e)}))}reloadTile(e,t){return new Promise((t=>{const{tile:{info:i}}=e,r=de(i.x,i.y,i.z,0),a=this.loaded[r];a&&a.vectorTile?a.parse(a.vectorTile,e.layers).then((e=>{t(e)})):t(null)}))}abortTile(e){return new Promise((t=>{if(this.loading){const t=this.loading[e];t&&(t.abort(),delete this.loading[e])}t()}))}clearTiles(){this.loading={},this.loaded={}}},ar=(e,t)=>fetch(e,t),sr=class extends rr{get geojson(){return this._geojson}constructor(e,t){super(e||((e,t,i)=>((e,t)=>new Promise(((i,r)=>{const a=e.getTile(t.z,t.x,t.y);if(re(null==a?void 0:a.features))return void i(null);const s=new te.GeoJSONWrapper(a.features);s.name="geojsonTileLayer",s.version=2;let n=ie().fromGeojsonVt({geojsonTileLayer:s});0===n.byteOffset&&n.byteLength===n.buffer.byteLength||(n=new Uint8Array(n)),i({vectorTile:new M(new Uint8Array(n))})})))(this._geojsonIndex,i))),this._loadingCallbacks=[],this._loadingData=!1,this._dataLoader=t||ar}setData(e){this.clearTiles(),this._geojson=e,oe(e)&&(this._geojsonIndex=function(e,t){return new J(e,{})}(e))}loadData(e,i){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return new Promise(((a,s)=>{this._geojsonIndex&&!0!==r?a():this._loadingData?this._loadingCallbacks.push((()=>a())):(this._loadingData=!0,le(oe(e),"[MapsGL] GeoJSONWorker: Invalid URL provided for data load"),this._dataLoader(e,{}).then((e=>{if(200===e.status)return e.json();throw new t("Invalid response",e)})).then((e=>{return t=this,a=function*(){const t=yield i.send({type:"transformGeoJSON",data:{data:e}});return this.setData(t)},new((r=void 0)||(r=Promise))((function(e,i){function s(e){try{o(a.next(e))}catch(e){i(e)}}function n(e){try{o(a.throw(e))}catch(e){i(e)}}function o(t){var i;t.done?e(t.value):(i=t.value,i instanceof r?i:new r((function(e){e(i)}))).then(s,n)}o((a=a.apply(t,[])).next())}));var t,r,a})).then((()=>{this._loadingData=!1,a(),this._loadingCallbacks.forEach((e=>e())),this._loadingCallbacks=[]})))}))}loadTile(e,t){const{request:{url:i,reload:r=!1}}=e;return(oe(i)&&ne(this._geojson)?this.loadData(i,t,r):Promise.resolve()).then((()=>{if(ae(this._geojsonIndex))return super.loadTile(e,t)}))}reloadTile(e,t){const{tile:{info:i},request:{reload:r=!1}}=e,a=de(i.x,i.y,i.z,0);return this.loaded[a]?super.reloadTile(e,t):this.loadTile(e,t)}};let nr;const or=new class{constructor(e){this._resolveRejects={},this.worker=e}send(e){const t=Math.round(1e18*Math.random()).toString(36).slice(0,10);return new Promise(((i,r)=>{this._resolveRejects[t]={resolve:i,reject:r},this.worker.addEventListener("message",this.receive.bind(this)),this.worker.postMessage(Object.assign({id:t},e))}))}receive(e){const{id:t,data:i,error:r}=e.data,a=this._resolveRejects[t];a&&(r?a.reject(r):a.resolve(i),delete this._resolveRejects[t])}abort(){this.worker.terminate()}}(self);onmessage=i=>{const r=i.data||{},{id:a,type:s,action:o,data:l={}}=r;if(!["getGlyphs","transformGeoJSON","getImages","loadImages"].includes(s))return nr||(nr="geojson"===s?new sr:new rr,nr.id=l.id),nr instanceof sr&&"setData"===o?(nr.setData(l.data),void postMessage({id:a,error:null})):void("reloadTile"===o?nr.reloadTile(l,or):nr.loadTile(l,or)).then((e=>{const t=[],i=(null==e?void 0:e.stores)?Object.keys(e.stores).reduce(((i,r)=>{const a=e.stores[r],s=n(a.serialize(),t,[".+Array","buffer"]);return s.type=a.type,i[r]=s,i}),{}):{};postMessage({id:a,data:{stores:i,dependencies:null==e?void 0:e.dependencies,geojson:nr instanceof sr?nr.geojson:void 0}},void 0,t)})).catch((i=>{var r;let s=null!==(r=null==i?void 0:i.name)&&void 0!==r?r:"VectorTileWorkerError";const n={code:0,message:void 0};i instanceof t?(s="InvalidResponseError",n.code=i.response.status,n.message=i.response.statusText):i instanceof e&&(s="UnauthorizedError",n.code=401,n.message="Unauthorized"),postMessage({id:a,status:n,error:`${s}: ${null==i?void 0:i.message}`})}))}})(),r})())),(self.webpackChunk_xweather_mapsgl_sdk=self.webpackChunk_xweather_mapsgl_sdk||[]).push([["weather"],{6445:(e,t,i)=>{i.r(t),i.d(t,{default:()=>ri});var r={};i.r(r),i.d(r,{aqi:()=>fe,aqiCategories:()=>me,cai:()=>be,caqi:()=>we,categories:()=>pe,china:()=>ve,co:()=>Oe,eaqi:()=>xe,health:()=>ge,india:()=>ye,no:()=>Se,no2:()=>Ce,o3:()=>Re,pm10:()=>Te,pm2p5:()=>Me,points:()=>ue,pollutant:()=>Ie,so2:()=>Ee,uba_daqi:()=>_e,uk_daqi:()=>Ae});var a={};i.r(a),i.d(a,{aqhi:()=>Le,aqi:()=>ze,cai:()=>Ne,caqi:()=>Ve,china:()=>ke,co:()=>qe,eaqi:()=>je,india:()=>Fe,no:()=>We,no2:()=>He,o3:()=>Ze,pm10:()=>Ge,pm2p5:()=>$e,points:()=>De,so2:()=>Ye,ubaDaqi:()=>Be,ukDaqi:()=>Ue});var s={};i.r(s),i.d(s,{risk:()=>ot,summary:()=>st,surface:()=>nt});var n={};i.r(n),i.d(n,{riskHydroplane:()=>ft,riskLowVizFog:()=>gt,riskLowVizSnow:()=>mt,riskRollover:()=>pt,summary:()=>ht,surface:()=>ct,temperature:()=>dt,temperatureFreeze:()=>ut});var o=i(8708);const l=class{constructor(e){this.variables=e}formattedForRequest(){return this.variables.reduce(((e,t)=>{var i,r;const a={dataMin:t.dataRange.min,dataMax:t.dataRange.max,noData:t.noData,outputMin:null===(i=t.outputRange)||void 0===i?void 0:i.min,outputMax:null===(r=t.outputRange)||void 0===r?void 0:r.max,timeOffset:t.timeOffset};return"string"==typeof t.code?e.push(Object.assign({id:t.code},a)):e.push(Object.assign({id:t.code.u},a),Object.assign({id:t.code.v},a)),e}),[])}};var h=i(7658),c=i(8346),d=i(4229),u=i(2102),p=i(3760),f=i(5711),m=i(2957),g=i(6081),v=i(9369),y=i(8854);const x={bar:{height:14,rounded:!0,labels:{every:10,placement:"middle",marks:"none"}},text:{color:"#fff",stroke:{color:"#000",width:1},shadow:{color:"#000"}}},b={points:{radius:4}},w=(e,t,i)=>(0,m.convert)("temperature",e,t,i),_=(e,t,i)=>(0,m.convert)("temperature-change",e,t,i),A=(e,t,i)=>(0,m.convert)("speed",e,t,i),M=(e,t,i)=>(0,m.convert)("pressure",e,t,i),T=(e,t,i)=>(0,m.convert)("precipitation",e,t,i),E=(e,t,i)=>(0,m.convert)("distance",e,t,i),S=(e,t)=>(t.type="bar",t.title=e,(0,f.$)({},x,t)),C=(e,t)=>(t.type="point",t.title=e,(0,f.$)({},b,t));var O=i(6219),R=i(2208),I=i(5661),P=i(2050);const D={LO:"#4875FB",I:"#4875FB",TD:"#FFE700",TS:"#FEA800",H1:"#DD0002",H2:"#FF0491",H3:"#DD00FD",H4:"#FEAFFF",H5:"#EFEFEF",TY:"#DD0002",STY:"#EFEFEF"},z={"TR.A":"#FFE403","TR.W":"#FF9100","HU.A":"#FF00D2","HU.W":"#FF0018"},L={point:{type:O.m.circle,sourceType:d.V.point,paint:{fill:{color:e=>{var t,i;const r=null===(i=null===(t=e.details)||void 0===t?void 0:t.stormCat)||void 0===i?void 0:i.toUpperCase();return D[r]||"#000000"}},stroke:{color:"#fff",thickness:3},circle:{radius:8}}},symbol:{type:O.m.symbol,sourceType:d.V.point,paint:{fill:{color:e=>{var t,i;const r=null===(i=null===(t=e.details)||void 0===t?void 0:t.stormCat)||void 0===i?void 0:i.toUpperCase();return D[r]||"#000000"}},stroke:{color:"#fff",thickness:1},icon:{image:e=>{var t;switch(null===(t=e.details)||void 0===t?void 0:t.stormType){case"H":case"TY":case"TC":case"STY":return"mapsgl:hurricane";case"TS":return"mapsgl:tropical-storm";case"TD":return"mapsgl:tropical-depression";default:return"mapsgl:tropical-low"}},size:e=>e.zoom<4?{width:20,height:20}:{width:36,height:36},factor:e=>{var t,i;switch(null===(t=e.details)||void 0===t?void 0:t.stormType){case"H":case"TY":case"STY":case"TS":case"TD":{const[t,r]=(null===(i=e.location)||void 0===i?void 0:i.coordinates)||[];return r>0?1:-1}default:return 0}}},text:[{value:e=>{var t;if(e.zoom<4)return null;const i=null===(t=e.details)||void 0===t?void 0:t.stormCat;return/^H\d$/.test(i)?i.replace("H",""):"STY"===i?"S":void 0},size:12,color:"#fff",outlineColor:"#444",weight:"bold",anchor:"center",offset:{x:0,y:-3}}]}},track:{type:O.m.line,paint:{stroke:{color:e=>{var t,i;const r=null===(i=null===(t=e.details)||void 0===t?void 0:t.stormCat)||void 0===i?void 0:i.toUpperCase();return D[r]||"#fff"},thickness:3}}},name:{type:"text",paint:{text:{value:{property:"details.stormShortName"},size:e=>{let{zoom:t}=e;return t<4?12:14},color:"#fff",outlineColor:"#444",weight:"bold",anchor:"top",offset:e=>e.zoom<4?{x:0,y:8}:{x:0,y:12}},symbol:{fadeOpacity:!1,pitchWithMap:!1,rotateWithMap:!1,allowOverlap:!0}}}},k=C("Tropical Cyclones",function(e){return{id:"tropical-cyclones",points:{values:[{color:e.LO,label:"Low"},{color:e.TD,label:"Depression"},{color:e.TS,label:"Storm"},{color:e.H1,label:"Cat 1"},{color:e.H2,label:"Cat 2"},{color:e.H3,label:"Cat 3"},{color:e.H4,label:"Cat 4"},{color:e.H5,label:"Cat 5"},{color:e.TY,label:"Typhoon"},{color:e.STY,label:"Super Typhoon"}]}}}(D)),F=C("Tropical Cyclone Breakpoints",function(e){return{id:"tropical-breakpoints",points:{values:[{color:e["TR.A"],label:"Tropical Storm Watch"},{color:e["TR.W"],label:"Tropical Storm Warning"},{color:e["HU.A"],label:"Hurricane Watch"},{color:e["HU.W"],label:"Hurricane Warning"}]}}}(z)),j={title:e=>{var t,i;const r=e[0];return null===(i=null===(t=null==r?void 0:r.details)||void 0===t?void 0:t.stormShortName)||void 0===i?void 0:i.replace(/(-\w)$/,(e=>e.toUpperCase()))},fn:e=>{var t,i,r,a,s;const n=e[0];if(!n||"errorCone"===n.featureType)return"";const o=(null==n?void 0:n.timestamp)||Date.now()/1e3,l=(0,R.Yq)(new Date(1e3*o),"format[MMM d, yyyy H:mm a]"),h=[],c=null===(t=null==n?void 0:n.details)||void 0===t?void 0:t.windSpeedMPH,d=null===(i=null==n?void 0:n.details)||void 0===i?void 0:i.windSpeedKPH,u=null===(r=null==n?void 0:n.details)||void 0===r?void 0:r.windSpeedKTS;let p=null===(a=null==n?void 0:n.details)||void 0===a?void 0:a.stormCat;if(h.push("forecastPoint"===n.featureType?"Forecast":`Advisory #${null===(s=null==n?void 0:n.details)||void 0===s?void 0:s.advisoryNumber}`,`${l}`),p){switch(p=p.replace(/^H(\d)/,"Cat $1 Hurricane"),p){case"LO":p="Low";break;case"I":p="Invest";break;case"TD":p="Tropical Depression";break;case"TS":p="Tropical Storm";break;case"TY":p="Typhoon";break;case"STY":p="Super Typhoon"}h.push(`${p}`)}return c&&u&&h.push(`${u} knots, ${d} kph, ${c} mph`),h.join("<br>")}};function N(e,t){let{lat:i,lon:r}=e,{lat:a,lon:s}=t;if(Math.abs(r-s)<=180)return null;r>0&&s<0?s+=360:r<0&&s>0&&(r+=360);const n=(180-r)/(s-r);return n<0||n>1?null:i+n*(a-i)}function V(e,t,i){return{type:"Feature",geometry:{type:"LineString",coordinates:[e,t]},properties:(0,P.mg)(i)}}function B(e){const t=new Set,i=[],r=[],a=[];return e.features.forEach((e=>{const s=`${e.id}`.replace(/-trackPoint-.*$/,"").replace(/-forecastPoint-.*$/,"").replace(/-Position$/,"");`${e.id}`.includes("-Position")&&(t.add(s),i.push(e)),`${e.id}`.includes("-trackPoint")&&(t.add(s),r.push(e)),`${e.id}`.includes("-forecastPoint")&&(t.add(s),a.push(e))})),[...t].forEach((t=>{const s=i.find((e=>`${e.id}`.startsWith(t))),n=r.filter((e=>`${e.id}`.startsWith(t))),o=a.filter((e=>`${e.id}`.startsWith(t)));if(s){if(n.length>0){const e=n[0].geometry.coordinates;s.geometry.coordinates.toString()!==e.toString()&&n.push(s)}o.length>0&&o.unshift(s)}[n,o].forEach(((i,r)=>{const a=0===r?"trackLine":"forecastLine";for(let r=0;r<i.length;r++)if(r>0){const s=String(r-1).padStart(3,"0"),n=i[r-1];let o=n.geometry.coordinates;const l=i[r].geometry.coordinates;if(Math.abs(o[0]-l[0])>180){const i=N({lat:o[1],lon:o[0]},{lat:l[1],lon:l[0]}),r=V(o,[-180,i],n.properties);r.id=`${t}-${a}String-${s}`,r.properties.featureType=a,e.features.push(r),o=[180,i]}const h=V(o,l,n.properties);h.id=`${t}-${a}String-${s}`,h.properties.featureType=a,e.features.push(h)}})),e.features=e.features.filter((e=>!/-trackLineString(-(NEG|POS))?$/.test(`${e.id}`)&&!`${e.id}`.endsWith("-forecastLineString")))})),e}function U(e,t){return e.replace("{region}",t)}const $={base_osm:"base.osm",base_cities:"base.cities",conditions_TMP_UGRD_VGRD:"conditions.TMP_2:UGRD_10:VGRD_10",conditions_TMP_DPT_RH:"conditions.TMP_2:DPT_2:RH_2",conditions_TMP_DELTA:"conditions.TMP_2:DELTA",conditions_APTMP_DPT_RH:"conditions.APTMP_2:DPT_2:RH_2",conditions_PRMSL_VIS_GUST:"conditions.PRMSL_0:VIS_0:GUST_10",conditions_SKY_PRECIP_UVI:"conditions.TCDC_0:PRECIP_0:UVI_0",conditions_PTYPE_PRECIP_TMP:"conditions.PTYPE_0:PRECIP_0:TMP_2",conditions_PRECIP:"conditions.PRECIP_0",conditions_SNOW_DERIVED:"conditions.SNOW-PRECIP_0:TMP_2",conditions_SNOD:"conditions.SNOD_0",conditions_VPD:"conditions.VPD_0",radar_REFC_PRATE_PTYPE:"radar.REFC_0:PRATE_0:PTYPESMPL_0",forecast_REFC_PRATE_PTYPE:"forecast.REFC_0:PRATE_0:PTYPESMPL_0",airquality_AQI_PM2P5_PM10:"airquality.AQI-AirNow:PM2P5_0:PM10_0",airquality_AQI_HI_China_India:"airquality.AQI-AQHI:AQI-China:AQI-India",airquality_AQI_EAQI_UBA_UK:"airquality.AQI-EAQI:AQI-UBA_DAQI:AQI-UK_DAQI",airquality_AQI_CAI_CAQI:"airquality.AQI-CAI:AQI-CAQI",airquality_CO_NO_NO2:"airquality.CO_0:NO_0:NO2_0",airquality_O3_SO2:"airquality.O3_0:SO2_0",airquality_points:"airquality.points",maritime_WAVE:"maritime.HTSGW_0:DIRPW_0:PERPW_0",maritime_SWELL1:"maritime.SWELL_1:SWPER_1:SWDIR_1",maritime_SWELL2:"maritime.SWELL_2:SWPER_2:SWDIR_2",maritime_SWELL3:"maritime.SWELL_3:SWPER_3:SWDIR_3",maritime_WTMP_UOGRD_VOGRD:"maritime.WTMP_0:UOGRD_0:VOGRD_0",maritime_SURGE_TIDE:"maritime.SURGE_0:TIDE_0",severe_alerts:"severe.alerts",severe_stormcells:"severe.stormcells",severe_stormreports:"severe.stormreports",severe_lightning:"severe.lightning",severe_lightning_all:"severe.lightning.all",severe_lightning_flash:"severe.lightning.flash",severe_lightning_threats:"severe.lightning.threats",severe_lightning_LGTIC_LGTCG:"severe.lightning.LGT-IC:LGT-CG.{region}",severe_hail_threats:"severe.hail.threats",severe_hail_MESH_POSH:"severe.hail.MESH:POSH.{region}",severe_convective:"severe.convective",fires_obs:"fires.obs",fires_perimeter:"fires.perimeter",fires_outlook:"fires.outlook",drought:"drought",earthquakes:"earthquakes",rivers:"rivers",tropical_active:"tropical.active",tropical_archive:"tropical.archive",tropical_invests:"tropical.invests",roadweather_nowcast_us:"roadweather.nowcast.us",roadweather_nowcast_europe:"roadweather.nowcast.europe",roadweather_nowcast_japan:"roadweather.nowcast.japan",roadweather_nowcast_australia:"roadweather.nowcast.australia",roadweather_nowcast_new_zealand:"roadweather.nowcast.new_zealand",roadweather_forecast_us:"roadweather.forecast.us",roadweather_forecast_europe:"roadweather.forecast.europe",roadweather_forecast_japan:"roadweather.forecast.japan",roadweather_forecast_australia:"roadweather.forecast.australia",roadweather_forecast_new_zealand:"roadweather.forecast.new_zealand",satellite_infrared:"satellite.infrared",satellite_infrared_color:"satellite.infrared_color",satellite_visible:"satellite.visible",satellite_water_vapor:"satellite.water_vapor",satellite_geocolor:"satellite.geocolor"},G=(e,t)=>Object.assign(Object.assign(Object.assign({[$.base_osm]:()=>e.getVectorTileSourceConfig("open-street-map",t),[$.base_cities]:()=>({type:d.o.vector,url:"https://cdn.aerisapi.com/sdk/js/mapsgl/data/cities/{z}/{x}/{y}.pbf",maxZoom:14}),[$.conditions_TMP_UGRD_VGRD]:()=>e.getEncodedSourceConfig(new l([h.X1,h.LO]),t),[$.conditions_TMP_DELTA]:()=>e.getEncodedSourceConfig(new l([h.X1,Object.assign(Object.assign({},h.X1),{timeOffset:-86400}),Object.assign(Object.assign({},h.X1),{timeOffset:-3600})]),t),[$.conditions_TMP_DPT_RH]:()=>e.getEncodedSourceConfig(new l([h.X1,h.$W,h.c1]),t),[$.conditions_APTMP_DPT_RH]:()=>e.getEncodedSourceConfig(new l([h.TX,h.$W,h.c1]),t),[$.conditions_PRMSL_VIS_GUST]:()=>e.getEncodedSourceConfig(new l([h.rv,h.XD,h.MF]),t),[$.conditions_SNOD]:()=>e.getEncodedSourceConfig(new l([h.RX]),t),[$.conditions_SKY_PRECIP_UVI]:()=>e.getEncodedSourceConfig(new l([h.h4,h.Yh,h.DP]),t),[$.conditions_PTYPE_PRECIP_TMP]:()=>e.getEncodedSourceConfig(new l([h.Kn,h.Yh,h.X1]),t),[$.conditions_PRECIP]:()=>e.getEncodedSourceConfig(new l((0,u.T9)(h.Yh,3)),t),[$.conditions_SNOW_DERIVED]:()=>Object.assign(Object.assign({},e.getEncodedSourceConfig(new l([...(0,u.T9)(h.Yh,2),h.X1]),t)),{transformTileData:(e,t)=>{const i=e.dimension+2*e.padding,r=t[1].dataMax,a=t[2].dataMin,s=t[2].dataMax;for(let t=0;t<i*i;t++){const i=4*t,n=0+(e.rawData[i+0]/255+e.rawData[i+1]/255)/2*r,o=a+e.rawData[i+2]/255*(s-a)+273.15;let l=.75;o>271.16&&(l=1.75);let h=10+l*(271.16-o);h=Math.max(0,Math.min(h,20));let c=n*h;c*=3.6,c=(c-0)/1.524,c=Math.max(0,Math.min(c,1)),c=Math.floor(3*c*255);let d=c;for(let t=0;t<3;t++){const r=Math.min(255,d);e.rawData[i+t]=Math.round(r),d-=r}e.rawData[i+3]=255}}}),[$.conditions_VPD]:()=>Object.assign(Object.assign({},e.getEncodedSourceConfig(new l([h.X1,h.$W,h.c1]),t)),{transformTileData:(e,t)=>{const i=e.dimension+2*e.padding,r=t[0].dataMin,a=t[0].dataMax,s=t[2].dataMin,n=t[2].dataMax;for(let t=0;t<i*i;t++){const i=4*t,o=s+e.rawData[i+2]/255*(n-s),l=r+e.rawData[i+0]/255*(a-r)+273.15,h=-2836.5744/Math.pow(l,2)-6.028076559*1e3/l+19.54263612-2.737830188*.01*l+1.6261698*1e-5*Math.pow(l,2)+7.0229056e-10*Math.pow(l,3)-18680009e-20*Math.pow(l,4)+2.7150305*Math.log(l);let c=(100-o)/100*Math.exp(h);c/=100,c=(c-0)/70,e.rawData[i+0]=Math.round(255*c),e.rawData[i+1]=0,e.rawData[i+2]=0,e.rawData[i+3]=255}}}),[$.radar_REFC_PRATE_PTYPE]:()=>e.getEncodedSourceConfig(new l([h.lw,h.Wc,h.Jg]),t),[$.airquality_points]:()=>e.getVectorSourceConfig("air-quality"),[$.airquality_AQI_PM2P5_PM10]:()=>e.getEncodedSourceConfig(new l([h.q_.aqiAirNow,h.q_.pm2p5,h.q_.pm10]),t),[$.airquality_AQI_HI_China_India]:()=>e.getEncodedSourceConfig(new l([h.q_.aqiHealthIndex,h.q_.aqiChina,h.q_.aqiIndia]),t),[$.airquality_AQI_EAQI_UBA_UK]:()=>e.getEncodedSourceConfig(new l([h.q_.aqiEAQI,h.q_.aqiUbaDAQI,h.q_.aqiUkDAQI]),t),[$.airquality_AQI_CAI_CAQI]:()=>e.getEncodedSourceConfig(new l([h.q_.aqiCAI,h.q_.aqiCAQI]),t),[$.airquality_CO_NO_NO2]:()=>e.getEncodedSourceConfig(new l([h.q_.co,h.q_.no,h.q_.no2]),t),[$.airquality_O3_SO2]:()=>e.getEncodedSourceConfig(new l([h.q_.o3,h.q_.so2]),t),[$.maritime_WAVE]:()=>e.getEncodedSourceConfig(new l([h.xj.waveHeight,h.xj.wavePeriod,h.xj.waveDir]),t),[$.maritime_SWELL1]:()=>e.getEncodedSourceConfig(new l([h.xj.swellHeightPrimary,h.xj.swellPeriodPrimary,h.xj.swellDirPrimary]),t),[$.maritime_SWELL2]:()=>e.getEncodedSourceConfig(new l([h.xj.swellHeightSecondary,h.xj.swellPeriodSecondary,h.xj.swellDirSecondary]),t),[$.maritime_SWELL3]:()=>e.getEncodedSourceConfig(new l([h.xj.swellHeightTertiary,h.xj.swellPeriodTertiary,h.xj.swellDirTertiary]),t),[$.maritime_WTMP_UOGRD_VOGRD]:()=>e.getEncodedSourceConfig(new l([h.xj.sst,h.xj.current]),t),[$.maritime_SURGE_TIDE]:()=>e.getEncodedSourceConfig(new l([h.xj.surge,h.xj.tide]),t),[$.severe_alerts]:()=>e.getVectorSourceConfig("alerts"),[$.severe_stormcells]:()=>e.getVectorSourceConfig("stormcells"),[$.severe_stormreports]:()=>e.getVectorSourceConfig("stormreports"),[$.severe_lightning]:()=>e.getVectorSourceConfig("lightning-strikes"),[$.severe_lightning_all]:()=>e.getVectorSourceConfig("lightning-all"),[$.severe_lightning_flash]:()=>e.getVectorSourceConfig("lightning-flash"),[$.severe_lightning_threats]:()=>e.getVectorTileSourceConfig("lightning-threat-zones",t),[$.severe_hail_threats]:()=>e.getVectorTileSourceConfig("hail-threats-nowcast",t),[$.severe_convective]:function(){let{timeline:t,params:i}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{from:r,to:a}=q(t);return e.getGeoJSONSourceConfig("convective/outlook",void 0,Object.assign({from:r,to:a,filter:"cat"},i))}},p.ot.reduce(((i,r)=>{const a="us"===r?"conus":r;return i[U($.severe_hail_MESH_POSH,r)]=()=>e.getEncodedSourceConfig(new l([h.R$.size(a),h.R$.posh(a)]),t,{bounds:c.wi[r]}),i}),{})),p.Q0.reduce(((i,r)=>{const a="us"===r?"conus":r;return i[U($.severe_lightning_LGTIC_LGTCG,r)]=()=>Object.assign(Object.assign({},e.getEncodedSourceConfig(new l([h.VJ.cg(a),h.VJ.ic(a),h.VJ.cg(a)]),t,{bounds:c.wi[r]})),{transformTileData:(e,t)=>{const i=e.dimension+2*e.padding;for(let t=0;t<i*i;t++){const i=4*t;e.rawData[i+2]=Math.min(255,e.rawData[i+0]+e.rawData[i+1])}}}),i}),{})),{[$.fires_obs]:function(){let{timeline:t,params:i}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{from:r,to:a}=q(t);return e.getGeoJSONSourceConfig("fires",void 0,Object.assign({from:r,to:a,query:"area:1",filter:"all",limit:1e3},i))},[$.fires_perimeter]:function(){let{timeline:t,params:i}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{from:r,to:a}=q(t);return e.getGeoJSONSourceConfig("fires",void 0,Object.assign({from:r,to:a,query:"area:1",filter:"all,geo",limit:1e3},i))},[$.fires_outlook]:function(){let{timeline:t,params:i}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{from:r,to:a}=q(t);return e.getGeoJSONSourceConfig("fires/outlook",void 0,Object.assign({from:r,to:a,filter:"firewx"},i))},[$.drought]:function(){let{timeline:t,params:i}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{from:r,to:a}=q(t);return e.getGeoJSONSourceConfig("droughts/monitor",void 0,Object.assign({from:r,to:a,filter:"all,geo",sort:"code"},i))},[$.earthquakes]:function(){let{timeline:t,params:i}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{from:r,to:a}=q(t);return e.getGeoJSONSourceConfig("earthquakes",void 0,Object.assign({from:r,to:a,query:"mag:0",limit:1e3},i))},[$.rivers]:()=>e.getVectorSourceConfig("river-observations"),[$.tropical_active]:function(){let{timeline:t,params:i}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{from:r,to:a}=q(t);return e.getGeoJSONSourceConfig("tropicalcyclones/archive",o.Fu.search,Object.assign({filter:"active,dateline",limit:1e3,from:r,to:a},i),{transformGeoJSON:(e,t)=>B(t)})},[$.tropical_archive]:function(){let{timeline:t,params:i}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{from:r,to:a}=q(t);return e.getGeoJSONSourceConfig("tropicalcyclones/archive",o.Fu.search,Object.assign({filter:"active;notactive,dateline",limit:1e3,from:r,to:a},i),{transformGeoJSON:(e,t)=>{const i=[];let r,a,s;return t.features.forEach(((e,t)=>{if(/-trackPoint-/.test(`${e.id}`)){const t=e.properties.id;r&&t===r||(a&&(a.properties.details=s.properties.details,i.push(a)),a=Object.assign(Object.assign({},e),{id:`${e.id}`.replace(/-trackPoint-.*$/,"-Position"),properties:Object.assign(Object.assign({},e.properties),{id:r,featureType:"position"})}),r=t),s=e}else`${e.id}`.endsWith("-Position")&&(a=void 0)})),t.features=[...t.features,...i],B(t)}})},[$.tropical_invests]:function(){let{timeline:t,params:i}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{from:r,to:a}=q(t);return e.getGeoJSONSourceConfig("tropicalcyclones/archive",o.Fu.search,Object.assign({filter:"invests",from:r,to:a},i))},[$.roadweather_nowcast_us]:()=>e.getVectorTileSourceConfig("road-wx-nowcast-us",t,{bounds:c.wi.us}),[$.roadweather_nowcast_europe]:()=>e.getVectorTileSourceConfig("road-wx-nowcast-europe",t,{bounds:c.wi.europe}),[$.roadweather_nowcast_japan]:()=>e.getVectorTileSourceConfig("road-wx-nowcast-japan",t,{bounds:c.wi.japan}),[$.roadweather_nowcast_australia]:()=>e.getVectorTileSourceConfig("road-wx-nowcast-australia",t,{bounds:c.wi.australia}),[$.roadweather_nowcast_new_zealand]:()=>e.getVectorTileSourceConfig("road-wx-nowcast-new-zealand",t,{bounds:c.wi.new_zealand}),[$.roadweather_forecast_us]:()=>e.getVectorTileSourceConfig("road-wx-forecast-us",t,{bounds:c.wi.us}),[$.roadweather_forecast_europe]:()=>e.getVectorTileSourceConfig("road-wx-forecast-europe",t,{bounds:c.wi.europe}),[$.roadweather_forecast_japan]:()=>e.getVectorTileSourceConfig("road-wx-forecast-japan",t,{bounds:c.wi.japan}),[$.roadweather_forecast_australia]:()=>e.getVectorTileSourceConfig("road-wx-forecast-australia",t,{bounds:c.wi.australia}),[$.roadweather_forecast_new_zealand]:()=>e.getVectorTileSourceConfig("road-wx-forecast-new-zealand",t,{bounds:c.wi.australia}),[$.satellite_infrared]:()=>e.getRasterSourceConfig("satellite"),[$.satellite_infrared_color]:()=>e.getRasterSourceConfig("satellite-infrared-color"),[$.satellite_visible]:()=>e.getRasterSourceConfig("satellite-visible"),[$.satellite_water_vapor]:()=>e.getRasterSourceConfig("satellite-water-vapor"),[$.satellite_geocolor]:()=>e.getRasterSourceConfig("satellite-geocolor")}),q=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{from:e.from||new Date,to:e.to||new Date}},W={temperature:{title:"Temperature",fn:e=>`${e.toFixed(2)}&deg;C, ${m.CtoF(e).toFixed(2)}&deg;F`},temperature_change:{title:"Temp Change",fn:e=>{const t=e>0?"+":"";return`${t}${e.toFixed(2)}&deg;C, ${t}${m.CtoFUnit(e).toFixed(2)}&deg;F`}},winds:{title:"Winds",fn:e=>{if(Number.isNaN(null==e?void 0:e.value))return;const t=e.value;return`${m.degToDir(e.angle-180)} ${m.msToKph(t).toFixed(1)} kph, ${m.msToMph(t).toFixed(1)} mph`}},wind_gusts:{title:"Wind Gusts",fn:e=>`${m.msToKph(e).toFixed(1)} kph, ${m.msToMph(e).toFixed(1)} mph`},humidity:{title:"Humidity",fn:e=>`${Math.round(e)}%`},pressure_msl:{title:"Surface Pressure",fn:e=>`${e.toFixed(1)} mb, ${m.mbToHg(e).toFixed(2)} in`},visibility:{title:"Visibility",fn:e=>`${m.mToKm(e).toFixed(1)} km, ${m.mToMi(e).toFixed(1)} mi`},wave_height:{title:"Wave Height",fn:e=>`${e.toFixed(1)} m, ${m.mToFt(e).toFixed(1)} ft`},angle:{title:"Direction",fn:e=>`${m.degToDir(e-180)}`},angle_reversed:{title:"Direction",fn:e=>{let t=e-180-180;return t<0&&(t+=360),`${m.degToDir(t)}`}},period:{title:"Period",fn:e=>`${Math.round(e)} sec`},height_change:{title:"Height Change",fn:e=>{const t=e>0?"+":"";return`${t}${e.toFixed(2)} m, ${t}${m.mToFt(e).toFixed(1)} ft`}},radar:{title:"Radar",fn:e=>{if(e<5)return"";let t="Very Light";return e>=60?t="Extreme/Hail":e>=55?t="Intense":e>=45?t="Heavy":e>=35?t="Moderate":e>=25&&(t="Light"),`${t}: ${e.toFixed(2)} dbz`}},accum_precip:{title:"Accum Precip",fn:e=>{const t=3600*e;return`${t.toFixed(1)} mm, ${m.mmToIn(t).toFixed(2)} in`}}},H=function(e,t){return(0,f.$)({},{id:e,layer:{type:O.m.line,source:$.base_osm,sourceLayer:"boundary",paint:{stroke:{color:"#000",thickness:1,lineJoin:I.p.Round,lineCap:I.$.Round}}}},{layer:{filter:t,paint:arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}}})},Z=function(e,t){return(0,f.$)({},{id:e,layer:{type:O.m.line,source:$.base_osm,sourceType:d.V.line,sourceLayer:"transportation",paint:{stroke:{color:"#000",thickness:3,lineJoin:I.p.Round,lineCap:I.$.Round}}}},{layer:{filter:t,paint:arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}}})},Y=function(e,t){return(0,f.$)({},{id:e,layer:{type:O.m.symbol,source:$.base_osm,sourceType:d.V.point,sourceLayer:"place",paint:{text:{value:{property:["name:en","name"]},weight:"normal",size:12,color:"#333",outlineColor:"#fff"},symbol:{rank:{property:"rank",direction:"asc"},pitchWithMap:!1,rotateWithMap:!1,scaleWithMap:!1,allowOverlap:!1,overlapMode:"map"}}}},{layer:{filter:t,paint:arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}}})},X=function(e,t){return(0,f.$)({},{id:e,layer:{type:O.m.line,source:$.base_osm,sourceType:d.V.polygon,sourceLayer:"water",paint:{fill:{color:"#333"}}}},{layer:{filter:t,paint:arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}}})};var Q=i(2291);const K={measurement:{type:"temperature",units:m.Units.temperature.C},transform:(e,t)=>Number.isNaN(e)?"":"F"===t?Math.round(1.8*e+32):Math.round(e)},J={measurement:{type:"temperature",units:m.Units.temperature.C},transform:(e,t)=>{if(Number.isNaN(e))return"";let i=Math.round(e);const r=e>0?"+":"";return"F"===t&&(i=Math.round(1.8*e)),`${0===i?"":r}${i}`}},ee={measurement:{type:"speed",units:m.Units.speed.ms},transform:(e,t)=>Number.isNaN(e)?"":"mph"===t?Math.round(2.236936*e):"kmh"===t||"km/h"===t?Math.round(3.6*e):"kts"===t||"knots"===t?Math.round(1.943844*e):Math.round(e)},te={measurement:{type:"pressure",units:m.Units.pressure.mb},transform:(e,t)=>{if(Number.isNaN(e))return"";switch(t){case"inHg":return`${(Math.round(.02953*e*100)/100).toFixed(2)}`;case"Pa":return Math.round(100*e);default:return Math.round(e)}}},ie={measurement:{type:"precipitation",units:m.Units.rate.mms},transform:(e,t)=>{if(Number.isNaN(e)||0===e)return"";switch(t){case"cm":return Math.round(e/10);case"in":return`${(Math.round(.0393701*e*100)/100).toFixed(2)}`;default:return Math.round(e)}}},re={measurement:{type:"precipitation",units:m.Units.precipitation.m},transform:(e,t)=>{if(Number.isNaN(e)||0===e)return"";switch(t){case"cm":return Math.round(100*e);case"in":return`${(Math.round(39.3701*e*100)/100).toFixed(2)}`;default:return Math.round(10*e)/10}}},ae={measurement:{type:"rate",units:m.Units.rate.mms},transform:(e,t)=>{if(Number.isNaN(e))return"";const i=3600*e;let r=0;switch(t){case"mm/hr":case"mm":e=Math.round(10*i)/10;break;case"in/hr":case"in":e=Math.round(.03937*i*100)/100,r=2;break;default:e=Math.round(e)}return 0===e?"":e.toFixed(r)}},se={measurement:{type:"distance",units:m.Units.distance.m},transform:(e,t)=>{if(Number.isNaN(e))return"";switch(t){case"km":return Math.round(e/1e3);case"ft":return Math.round(3.28084*e);case"in":return Math.round(39.3701*e);case"mi":return Math.round(621371e-9*e);default:return Math.round(e)}}};var ne=i(9147);const oe=(e,t,i)=>{if(i>0){const r=(0,y.SG)(Math.round((0,m.CtoF)(e)),i),a=Math.round((0,m.CtoF)(t)),s=Array.from({length:Math.ceil((a-r)/i)},((e,t)=>(0,m.FtoC)(r+t*i)));return s.push(t),s}};var le=i(2436);const he={current:[0,"rgba(16,145,253,0)",.5144,"#1091FD",.7716,"#37FF84",1.0288,"#B6FF06",1.286,"#FEE10A",1.5432,"#EFB80C",1.8004,"#FD8408",2.0576,"#F43305",2.3148,"#AB1406",2.572,"#931537",3.0864,"#A4168A"],wave_height:[0,"#091597",2.43,"#04C9FC",4.88,"#8CFB37",6.09,"#FCFA3A",7.3,"#FF6116",8.53,"#FF040B",10.36,"#79003C",12.19,"#FF2391",14.26,"#FFE0FF"],surge:[0,"#091597",.6096,"#04C9FC",1.2192,"#8CFB37",1.8288,"#FCFA3A",2.4384,"#FF6116",3.048,"#FF040B",3.6576,"#79003C",4.2672,"#FF2391",4.8768,"#FFE0FF"],period:[2,"#091597",6,"#0030AE",10,"#04C9FC",14,"#8CFB37",16,"#FCFA3A",18,"#FF6116",20,"#FF040B",22,"#79003C",24,"#FF2391"],height_diff:[-12.192,"#EF90FF",-9.144,"#D741DA",-6.096,"#8B21DA",-4.572,"#0013CA",-3.048,"#0070F1",-1.524,"#8ED4F9",-.6096,"rgba(142,212,249,0)",0,"rgba(0,0,0,0)",.6096,"rgba(255,217,42,0)",1.524,"#FFD92A",3.048,"#FF932A",4.572,"#E2330B",6.096,"#9D0000",9.144,"#D00071",12.192,"#FF698C"]},ce={current:S("Ocean Currents",{id:"current",bar:{measurement:Object.assign(Object.assign({},h.xj.current.measurement),{converter:A}),colorscale:{range:{min:0,max:h.xj.current.dataRange.max},stops:he.current},labels:{every:e=>1,formatter:(e,t,i)=>0===t?`${Math.round(e)} %%units%%`:`${Math.round(e)}`}}}),wave_height:S("Wave/Swell Height",{id:"wave-height",bar:{measurement:Object.assign(Object.assign({},h.xj.swellHeightPrimary.measurement),{converter:E}),colorscale:{range:h.xj.waveHeight.dataRange,stops:he.wave_height},labels:{every:e=>"m"===e?1:5,formatter:(e,t,i)=>0===t?`${Math.round(e)} %%units%%`:`${Math.round(e)}`}}}),period:S("Wave/Swell Period",{id:"period",bar:{measurement:Object.assign(Object.assign({},h.xj.swellPeriodPrimary.measurement),{converter:(e,t,i)=>(0,m.convert)("time",e,t,i)}),colorscale:{range:h.xj.wavePeriod.dataRange,stops:he.period},labels:{every:2,formatter:(e,t,i)=>0===t?`${Math.round(e)} %%units%%`:`${Math.round(e)}`}}}),surge:S("Storm Surge",{id:"surge",bar:{measurement:Object.assign(Object.assign({},h.xj.surge.measurement),{converter:E}),colorscale:{range:h.xj.surge.dataRange,stops:he.surge},labels:{every:e=>"m"===e?.2:1,formatter:(e,t,i)=>{const r=i.metric?e.toFixed(1):Math.round(e);return 0===t?`${r} %%units%%`:`${r}`}}}}),tide_height:S("Tide Height",{id:"tide-height",bar:{measurement:Object.assign(Object.assign({},h.xj.tide.measurement),{converter:E}),colorscale:{range:h.xj.tide.dataRange,stops:he.height_diff},labels:{every:e=>"m"===e?.5:2,formatter:(e,t,i)=>{const r=`${e>0?"+":""}${Math.round(e)}`;return 0===t?`${r}°%%units%%`:`${r}`}}}})};var de=i(6476);const ue={good:"#29e11f",moderate:"#f8f92a",usg:"#f9681b",unhealthy:"#f60115",very_unhealthy:"#7a2c83",hazardous:"#65001b"},pe={health:{low:"#0000ff",moderate:"#00ff00",high:"#ffff00",very_high:"#ff0000"},china:{excellent:"#00ff00",good:"#ffff00",light:"#ff9900",moderate:"#ff0000",heavy:"#540099",severe:"#800000"},india:{good:"#00cc00",satisfactory:"#66cc00",moderate:"#ffff00",poor:"#ff9900",severe:"#ff0000",hazardous:"#a52a2a"},eaqi:{good:"#50f0e6",fair:"#50ccaa",moderate:"#f0e641",poor:"#ff5050",very_poor:"#960032",extremely_poor:"#7d2181"},cai:{good:"#0000ff",moderate:"#00ff00",unhealthy:"#ffff00",very_unhealthy:"#ff0000"},caqi:{very_low:"#79bc6a",low:"#bbcf4c ",medium:"#eec20b",high:"#f29305",very_high:"#e8416f"},uba_daqi:{very_good:"#50f0e6",good:"#50cdaa",moderate:"#f0e641",poor:"#ff5050",very_poor:"#960032"},uk_daqi:{low:"#009900",moderate:"#ff9900",high:"#ff0000",very_high:"#990099"}},fe=[0,ue.good,25,ue.good,75,ue.moderate,125,ue.usg,175,ue.unhealthy,251,ue.very_unhealthy,301,ue.hazardous,500,ue.hazardous],me=[0,ue.good,51,ue.moderate,101,ue.usg,151,ue.unhealthy,200,ue.very_unhealthy,301,ue.hazardous],ge=[0,pe.health.low,3.5,pe.health.moderate,6.5,pe.health.high,10.5,pe.health.very_high],ve=[0,pe.china.excellent,51,pe.china.good,101,pe.china.light,151,pe.china.moderate,201,pe.china.heavy,301,pe.china.severe],ye=[0,pe.india.good,51,pe.india.satisfactory,101,pe.india.moderate,201,pe.india.poor,301,pe.india.severe,401,pe.india.hazardous],xe=[0,pe.eaqi.good,26,pe.eaqi.fair,51,pe.eaqi.moderate,76,pe.eaqi.poor,101,pe.eaqi.very_poor,126,pe.eaqi.extremely_poor],be=[0,pe.cai.good,51,pe.cai.moderate,101,pe.cai.unhealthy,251,pe.cai.very_unhealthy],we=[0,pe.caqi.very_low,26,pe.caqi.low,51,pe.caqi.medium,76,pe.caqi.high,101,pe.caqi.very_high],_e=[0,pe.uba_daqi.very_good,26,pe.uba_daqi.good,51,pe.uba_daqi.moderate,76,pe.uba_daqi.poor,101,pe.uba_daqi.very_poor],Ae=[0,pe.uk_daqi.low,1.5,pe.uk_daqi.moderate,4.5,pe.uk_daqi.high,7.5,pe.uk_daqi.very_high],Me=[0,"rgb(7, 54, 161, 0)",25,"#0B8ACE",50,"#F2D538",100,"#F28012",200,"#DF0612",300,"#980657"],Te=[0,"rgb(7, 54, 161, 0)",50,"#0B8ACE",100,"#F2D538",250,"#F28012",500,"#DF0612",1e3,"#980657"],Ee=[0,"rgb(7, 54, 161, 0)",5,"#0B8ACE",10,"#F2D538",25,"#F28012",50,"#DF0612",100,"#980657"],Se=[0,"rgb(7, 54, 161, 0)",5,"#0B8ACE",25,"#F2D538",50,"#F28012",100,"#DF0612"],Ce=[0,"rgb(7, 54, 161, 0)",10,"#0B8ACE",20,"#F2D538",30,"#F28012",50,"#DF0612",100,"#980657"],Oe=[0,"rgb(7, 54, 161, 0)",500,"#0B8ACE",650,"#F2D538",800,"#F28012",900,"#DF0612",1e3,"#980657"],Re=[0,"rgb(7, 54, 161, 0)",50,"#0B8ACE",100,"#F2D538",150,"#F28012",200,"#DF0612",300,"#980657"],Ie=[0,"#0043D3",.2,"#3AADF3",.4,"#FAF530",.6,"#FF8418",.8,"#DE1C06",1,"#650D03"],Pe={type:"concentration",units:"µg/m³"},De=C("Air Quality",{id:"airquality-aqi-categories",points:{values:[{color:ue.good,label:"Good"},{color:ue.moderate,label:"Moderate"},{color:ue.usg,label:"Sensitive Groups"},{color:ue.unhealthy,label:"Unhealthy"},{color:ue.very_unhealthy,label:"Very Unhealthy"},{color:ue.hazardous,label:"Hazardous"}]}}),ze=S("Air Quality Index (AQI)",{id:"airquality-aqi",bar:{colorscale:{range:h.q_.aqiAirNow.dataRange,stops:fe,positions:[0,.1,.2,.4,.6,.8,.95,1]},labels:{values:[0,50,100,150,200,300,400,500]}}}),Le=C("Air Quality Health Index (AQHI)",{id:"airquality-aqhi",points:{values:[{color:pe.health.low,label:"Low"},{color:pe.health.moderate,label:"Moderate"},{color:pe.health.high,label:"High"},{color:pe.health.very_high,label:"Very High"}]}}),ke=C("Air Quality Index (China)",{id:"airquality-aqi-china",points:{values:[{color:pe.china.excellent,label:"Excellent"},{color:pe.china.good,label:"Good"},{color:pe.china.light,label:"Lightly Polluted"},{color:pe.china.moderate,label:"Moderately Polluted"},{color:pe.china.heavy,label:"Heavily Polluted"},{color:pe.china.severe,label:"Severely Polluted"}]}}),Fe=C("Air Quality Index (India)",{id:"airquality-aqi-india",points:{values:[{color:pe.india.good,label:"Good"},{color:pe.india.satisfactory,label:"Satisfactory"},{color:pe.india.moderate,label:"Moderate"},{color:pe.india.poor,label:"Poor"},{color:pe.india.severe,label:"Severe"},{color:pe.india.hazardous,label:"Hazardous"}]}}),je=C("Air Quality Index (European)",{id:"airquality-aqi-eaqi",points:{values:[{color:pe.eaqi.good,label:"Good"},{color:pe.eaqi.fair,label:"Fair"},{color:pe.eaqi.moderate,label:"Moderate"},{color:pe.eaqi.poor,label:"Poor"},{color:pe.eaqi.very_poor,label:"Very Poor"},{color:pe.eaqi.extremely_poor,label:"Extremely Poor"}]}}),Ne=C("Air Quality Index (Korean)",{id:"airquality-aqi-cai",points:{values:[{color:pe.cai.good,label:"Good"},{color:pe.cai.moderate,label:"Moderate"},{color:pe.cai.unhealthy,label:"Unhealthy"},{color:pe.cai.very_unhealthy,label:"Very Unhealthy"}]}}),Ve=C("Air Quality Index (Common)",{id:"airquality-aqi-caqi",points:{values:[{color:pe.caqi.very_low,label:"Very Low"},{color:pe.caqi.low,label:"Low"},{color:pe.caqi.medium,label:"Medium"},{color:pe.caqi.high,label:"High"},{color:pe.caqi.very_high,label:"Very High"}]}}),Be=C("Air Quality Index (German)",{id:"airquality-aqi-uba-daqi",points:{values:[{color:pe.uba_daqi.very_good,label:"Very Good"},{color:pe.uba_daqi.good,label:"Good"},{color:pe.uba_daqi.moderate,label:"Moderate"},{color:pe.uba_daqi.poor,label:"Poor"},{color:pe.uba_daqi.very_poor,label:"Very Poor"}]}}),Ue=C("Air Quality Index (UK)",{id:"airquality-aqi-uk-daqi",points:{values:[{color:pe.uk_daqi.low,label:"Low"},{color:pe.uk_daqi.moderate,label:"Moderate"},{color:pe.uk_daqi.high,label:"High"},{color:pe.uk_daqi.very_high,label:"Very High"}]}}),$e=S("Particle Pollution (PM2.5)",{id:"airquality-pm2p5",bar:{measurement:Object.assign({},Pe),colorscale:{range:h.q_.pm2p5.dataRange,stops:Me,resample:(0,v.A)(.65,0,.85,1)},labels:{values:[0,10,25,50,100,200,300],formatter:(e,t,i)=>0===t?`${Math.round(e)} %%units%%`:`${Math.round(e)}`}}}),Ge=S("Particle Pollution (PM10)",{id:"airquality-pm10",bar:{measurement:Object.assign({},Pe),colorscale:{range:h.q_.pm10.dataRange,stops:Te,resample:v.G.inCubic},labels:{values:[0,10,25,50,100,250,500,1e3],formatter:(e,t,i)=>0===t?`${Math.round(e)} %%units%%`:`${Math.round(e)}`}}}),qe=S("Carbon Monoxide (CO)",{id:"airquality-co",bar:{measurement:Object.assign({},Pe),colorscale:{range:h.q_.co.dataRange,stops:Oe,resample:v.G.inOutSqrt},labels:{values:[0,125,250,500,750,1e3],formatter:(e,t,i)=>0===t?`${Math.round(e)} %%units%%`:`${Math.round(e)}`}}}),We=S("Nitrogen Monoxide (NO)",{id:"airquality-no",bar:{measurement:Object.assign({},Pe),colorscale:{range:h.q_.no.dataRange,stops:Se,resample:v.G.inSine},labels:{values:[0,5,10,25,50,100],formatter:(e,t,i)=>0===t?`${Math.round(e)} %%units%%`:`${Math.round(e)}`}}}),He=S("Nitrogen Dioxide (NO2)",{id:"airquality-no2",bar:{measurement:Object.assign({},Pe),colorscale:{range:h.q_.no2.dataRange,stops:Ce,resample:v.G.inSqrt},labels:{values:[0,10,20,30,50,100],formatter:(e,t,i)=>0===t?`${Math.round(e)} %%units%%`:`${Math.round(e)}`}}}),Ze=S("Ozone (03)",{id:"airquality-o3",bar:{measurement:Object.assign({},Pe),colorscale:{range:h.q_.o3.dataRange,stops:Re,resample:v.G.inSqrt},labels:{values:[0,50,100,150,225,300],formatter:(e,t,i)=>0===t?`${Math.round(e)} %%units%%`:`${Math.round(e)}`}}}),Ye=S("Sulfur Dioxide (SO2)",{id:"airquality-so2",bar:{measurement:Object.assign({},Pe),colorscale:{range:h.q_.so2.dataRange,stops:Ee,resample:v.G.inSqrt},labels:{values:[0,5,10,25,50,100],formatter:(e,t,i)=>0===t?`${Math.round(e)} %%units%%`:`${Math.round(e)}`}}});var Xe=i(6694);const Qe={title:"AQI",fn:e=>`${Math.round(e)}`},Ke={title:"Air Quality",fn:e=>{const t=e[0];if(null==t?void 0:t.periods){const e=t.periods[0];return`${(0,Xe.C)(t.place.name)}: ${e.aqi||"N/A"}${e.dominant?` (${e.dominant.toUpperCase()})`:""}`}return""}},Je={title:"",fn:e=>{const t="ug/m^3";return"number"==typeof e?`${Math.round(e)}${t?` ${t}`:""}`:Object.keys(e).map((i=>`${i}: ${Math.round(e[i])}${t?` ${t}`:""}`)).join(", ")}};var et=i(3606);const tt=["us","europe","japan","australia","new-zealand"],it=Object.keys(h.BA),rt={primary:{filter:["in","class","motorway","motorway_link","motorway_junction","trunk","trunk_link"]},secondary:{filter:["in","class","primary","primary_link","secondary","secondary_link","tertiary","tertiary_link"]},bridges:{type:"bridge",filter:["all",["==","brunnel","bridge"],["in","class","motorway","motorway_link","motorway_junction","trunk","trunk_link","primary","primary_link"]]}},at=Object.keys(rt),st={green:"#00C500",yellow:"#FFCE00",red:"#FF0000",unknown:"#666"},nt={dry:"#bbb",moist:"#3B960F",wet:"#00E300",slush:"#B643FF",snow:"#0043FF",ice:"#FF00A6",unknown:"#666"},ot={minimal:"#ccc",low:"#FFEB00",moderate:"#FF9C00",high:"#E00200",major:"#9A00B8"};function lt(e){return C(e,{id:"roadweather-risk",points:{values:[{key:"minimal",color:ot.minimal,label:"Minimal"},{key:"low",color:ot.low,label:"Low"},{key:"moderate",color:ot.moderate,label:"Moderate"},{key:"high",color:ot.high,label:"High"},{key:"major",color:ot.major,label:"Major"}]}})}const ht=C("Road Summary",{id:"roadweather-summary",points:{values:[{key:"green",color:st.green,label:"Low Risk"},{key:"yellow",color:st.yellow,label:"Moderate Risk"},{key:"red",color:st.red,label:"High Risk"},{key:"unknown",color:st.unknown,label:"Unknown"}]}}),ct=C("Road Surface",{id:"roadweather-surface",points:{values:[{key:"dry",color:nt.dry,label:"Dry"},{key:"moist",color:nt.moist,label:"Moist"},{key:"wet",color:nt.wet,label:"Wet"},{key:"slush",color:nt.slush,label:"Slush"},{key:"snow",color:nt.snow,label:"Snow"},{key:"ice",color:nt.ice,label:"Ice"},{key:"unknown",color:nt.unknown,label:"Unknown"}]}}),dt=S("Road Temperature",{id:"roadweather-temperature",bar:{measurement:{type:"temperature",units:m.Units.temperature.C,converter:w},colorscale:{range:{min:-40,max:71.11},stops:g.temperature,interval:(0,m.FtoCUnit)(10)},labels:{every:e=>20,formatter:(e,t,i)=>0===t?`${Math.round(e)}°%%units%%`:`${Math.round(e)}`}}}),ut=C("Road Temperature - Freeze",{id:"roadweather-temperature-freeze",points:{values:[{color:"#992BFF",label:"Hard Freeze"},{color:"#0046FF",label:"Freeze"},{color:"#73DAFC",label:"Near Freeze"}]}}),pt=C("Road Rollover Risk",Object.assign({id:"roadweather-risk-rollover"},lt("Road Rollover Risk"))),ft=C("Road Hydroplane Risk",Object.assign({id:"roadweather-risk-hydroplane"},lt("Road Hydroplane Risk"))),mt=C("Road Snow Visibility Risk",Object.assign({id:"roadweather-risk-snow"},lt("Road Snow Visibility Risk"))),gt=C("Road Fog Visibility Risk",Object.assign({id:"roadweather-risk-fog"},lt("Road Fog Visibility Risk")));function vt(e,t){return{type:t,sourceType:d.V.point,timeSeries:{mode:et.Gp.interval},paint:Object.assign(Object.assign({fill:{color:t=>{const i=h.BA[e].code;if("temperature"===e){const e=g.temperature,r=t[i];let a;for(let t=0;t<e.length;t+=2)r>=e[t]&&r<e[t+2]&&(a=e[t+1]);return a||"#ccc"}if("temperatureFreeze"===e){const e=g.freeze,r=t[i];let a;for(let t=0;t<e.length;t+=2)r>=e[t]&&r<e[t+2]&&(a=e[t+1]);return a||"#ccc"}if(/(rollover|fog|snow|hydroplane)/i.test(e)){const e=t[i];return e>=.8?ot.major:e>=.6?ot.high:e>=.4?ot.moderate:e>=.2?ot.low:ot.minimal}const r=(t[i]||"unknown").toLowerCase();return s[e][r]||"#ccc"}}},t===O.m.circle?{circle:{radius:4},stroke:{color:"#222",thickness:1}}:{}),{symbol:{rotateWithMap:!0,pitchWithMap:!0,scaleWithMap:t===O.m.voronoi}})}}var yt=i(4918);const xt={general:"#2ED300",hail:"#EBE100",rotating:"#F17200",tornado:"#FF2600"},bt={avalanche:"#629FEC",blizzard:"#4100E2",fire:"#E66300",flood:"#117D01",fog:"#767676",ice:"#B300E2",hail:"#61DEF7",lightning:"#8C8C8C",rain:"#39E600",snow:"#165CEF",tides:"#40DB83",tornado:"#C50000",wind:"#D8CC03",tropical:"#FF59B3",other:"#999"},wt={general:"#b3e6b1",marginal:"#6cbd69",slight:"#f4f964",enhanced:"#e0b767",moderate:"#e0686a",high:"#fe59ff"},_t="#eeeeee",At="#F8E203",Mt="#F97000",Tt="#C4150D",Et="#999",St=(()=>{const e=new yt.A(["#F1DE00","#DE2900"]);return e.setDomain([0,60]),[0,10,20,30,40,50,60].reduce(((t,i)=>{const r=e.getColor(i);return t[`lead${i}`]=`rgba(${r.r}, ${r.g}, ${r.b}, ${r.a})`,t}),{})})(),Ct=[0,"rgba(255,235,122,0)",1,"#FFD800",3,"#FF7E00",6,"#ED0000",8,"#E400F0",10,"#EEC5F0"],Ot=(()=>{const e=new yt.A(["#DF0ED3","#520BAE"]);return e.setDomain([0,60]),[0,10,20,30,40,50,60].reduce(((t,i)=>{const r=e.getColor(i);return t[`lead${i}`]=`rgba(${r.r}, ${r.g}, ${r.b}, ${r.a})`,t}),{})})(),Rt=((0,m.inToMM)(.5),(0,m.inToMM)(1),(0,m.inToMM)(1.5),(0,m.inToMM)(2),(0,m.inToMM)(2.5),(0,m.inToMM)(3),[0,"rgba(37,61,156,1)",.2,"#253D9C",.4,"#1D6AA2",.6,"#09BB93",.8,"#FEF112",1,"#FE5412"]);var It=i(7922),Pt=i(8464);const Dt=e=>{let t=e.toLowerCase();return t=t.replace(/thunderstorm/,"t-storm"),t=t.replace(/temperature/,"temp"),t=t.replace(/fog \(marine\)/,"fog"),(0,Xe.C)(t)},zt=e=>C("Alerts",{id:"alerts",points:{layerId:`^${u.Qf}alerts(-outline)?::`,values:t=>new Promise(((i,r)=>{const a=[],s=[];if(t.features)t.features.forEach((e=>{const{ADVISORY:t,COLOR:i="#000000"}=e.properties;s.includes(t)||(a.push({color:i.startsWith("#")?i:`#${i}`,label:Dt(t)}),s.push(t))})),i(a.sort(((e,t)=>e.label.localeCompare(t.label))));else if((0,It.I)(t.bounds)){const r=Object.assign({},t.bounds);if(e.canAccess("advisories_summary"),(0,It.I)(r))return void console.warn("[MapsGL] Cannot load data for alerts legend, coordinate bounds not provided");const n=Math.abs(r.east-r.west),l=Math.floor(n/360),h=e.api().action(o.Fu.within);t.time&&h.from(t.time),l>0?(r.west=-180,r.east=180):(r.west<-180||r.west>180)&&(r.west+=360*Math.floor(r.west/360)),h.bounds(r),h.get().then((e=>{var t,r;if((null===(t=e.data)||void 0===t?void 0:t.length)>0){const t=null===(r=e.data[0].summary)||void 0===r?void 0:r.types;if(t&&Array.isArray(t))return t.forEach((e=>{let{type:t,color:i="#000000"}=e;s.includes(t)||(a.push({color:i.startsWith("#")?i:`#${i}`,label:Dt(t)}),s.push(t))})),void i(a)}i([])}))}}))}}),Lt=C("Storm Cells",{id:"stormcells",points:{values:[{color:xt.general,label:"General"},{color:xt.hail,label:"Hail"},{color:xt.rotating,label:"Rotating"},{color:xt.tornado,label:"Tornadic"}]}}),kt=C("Storm Reports",{id:"stormreports",points:{values:[{color:bt.avalanche,label:"Avalanche"},{color:bt.blizzard,label:"Blizzard"},{color:bt.fire,label:"Fire"},{color:bt.flood,label:"Flood"},{color:bt.fog,label:"Fog"},{color:bt.ice,label:"Ice"},{color:bt.hail,label:"Hail"},{color:bt.lightning,label:"Lightning"},{color:bt.rain,label:"Rain"},{color:bt.snow,label:"Snow"},{color:bt.tides,label:"Tides"},{color:bt.tornado,label:"Tornado"},{color:bt.wind,label:"Wind"},{color:bt.tropical,label:"Tropical"},{color:bt.other,label:"Other"}]}}),Ft=C("Lightning Strikes",{id:"lightning-all",points:{values:[{color:_t,label:"< 1 minute"},{color:At,label:"1-5 minutes"},{color:Mt,label:"5-10 minutes"},{color:Tt,label:"> 10 minutes"},{color:Et,label:"Intra-cloud"}]}}),jt=S("Lightning Threats (lead time)",{id:"lightning-threats",bar:{colorscale:{range:{min:0,max:70},stops:Object.values(St).reduce(((e,t,i)=>(e.push(10*i,t),e)),[]),interpolate:!1},labels:{formatter:(e,t,i)=>0===t?`${Math.round(e)} min`:`${Math.round(e)}`}}}),Nt=S("Lightning Density",{id:"lightning-density",bar:{measurement:Object.assign({},h.VJ.ic("conus").measurement),colorscale:{range:{min:0,max:10},stops:Ct},labels:{every:1,formatter:(e,t,i)=>`${Math.round(e)}`}}}),Vt=S("Hail Threats (lead time)",{id:"hail-threats",bar:{colorscale:{range:{min:0,max:70},stops:Object.values(Ot).reduce(((e,t,i)=>(e.push(10*i,t),e)),[]),interpolate:!1},labels:{formatter:(e,t,i)=>0===t?`${Math.round(e)} min`:`${Math.round(e)}`}}}),Bt=S("Hail Size",{id:"hail-size",bar:{measurement:Object.assign(Object.assign({},h.R$.size("conus").measurement),{converter:T}),colorscale:Object.assign({range:{min:0,max:(0,m.inToMM)(3)},interval:1},(0,Pt.yw)("Viridis")),labels:{every:e=>"mm"===e?5:.5,formatter:(e,t,i)=>{const r="in"===i.units?e.toFixed(1):Math.round(e);return 0===t?`${r} %%units%%`:`${r}`}}}}),Ut=S("Severe Hail Probability",{id:"hail-posh",bar:{measurement:Object.assign({},h.R$.posh("conus").measurement),colorscale:Object.assign({range:{min:0,max:100}},(0,Pt.yw)("Viridis")),labels:{every:10,formatter:(e,t,i)=>0===t?`${Math.round(e)}%`:`${Math.round(e)}`}}}),$t=C("Convective Outlook",{id:"convective",points:{values:[{color:wt.general,label:"General"},{color:wt.marginal,label:"Marginal"},{color:wt.slight,label:"Slight"},{color:wt.enhanced,label:"Enhanced"},{color:wt.moderate,label:"Moderate"},{color:wt.high,label:"High"}]}});var Gt=i(4789);const qt={title:"Alerts",fn:e=>`${e.reduce(((e,t)=>{const i=(0,Xe.C)(t.ADVISORY.toLowerCase());return e.includes(i)||e.push(i),e}),[]).join("<br>")}`},Wt={title:"Storm Cells",fn:e=>{var t,i,r;const a=null==e?void 0:e[0];if(null==a?void 0:a.ob){const e=null===(i=null===(t=a.ob)||void 0===t?void 0:t.movement)||void 0===i?void 0:i.dirTo;return`${(0,Xe.C)(null===(r=a.traits)||void 0===r?void 0:r.type)}${e?`, moving ${e}`:""}`}return""}},Ht={title:"Lightning Threat",fn:e=>{const t=e.at(-1);if(!t)return"";const i=t.details.movement,r=t.period,a=[];if(i&&r){const e=(0,R.Yq)(new Date(1e3*r.range.minTimestamp),"format[MMM d, yyyy H:mm a]"),s=i.dir,n=(0,p.oh)(t);a.push(e),n>0&&a.push(`+${n} minute lead time`),a.push(`Moving ${s} at ${i.speedKPH} kph (${i.speedMPH} mph)`)}return a.join("<br>")}},Zt={title:"Hail Size",fn:e=>`${Math.round(e)} mm, ${Gt.units.mmToIn(e).toFixed(1)} in`},Yt={title:"Severe Hail Prob",fn:e=>`${Math.round(e)}%`},Xt={title:"Convective Outlook",fn:e=>{var t,i;const r=e.at(-1);return(null==r?void 0:r.details)?`${(0,Xe.C)(null===(i=null===(t=r.details)||void 0===t?void 0:t.risk)||void 0===i?void 0:i.type)}`:""}},Qt={title:"Lightning Density",fn:e=>{const t=Math.max(1,Math.round(e));return`${t} strike${1===t?"":"s"}/hr`}},Kt={drought:{d0:"#ffff00",d1:"#fccc66",d2:"#ff9b00",d3:"#e10000",d4:"#600000"},fire_obs:{contained:"#6C6461",active:"#E88900",new:"#E83A00"},fire_outlook:{elevated:"#FFB268",critical:"#FE666A",extreme:"#FE58FF"},earthquakes:{mini:"#6fb314",minor:"#dfcb01",light:"#ce8f00",moderate:"#ff5d01",strong:"#e90004",major:"#ce0052",great:"#b90285",catastrophic:"#f500ff"},rivers:{out_of_service:"#535353",obs_not_current:"#AFB6AD",not_defined:"#5F9CE6",low_threshold:"#7F5013",no_flooding:"#0EFF00",action:"#FFFF00",minor:"#FE8700",moderate:"#FF0100",major:"#C000FF"},vpd:[0,"rgba(255,217,42,0)",10,"#FFD92A",20,"#FF932A",30,"#E2330B",40,"#9D0000",50,"#D00071",60,"#FF698C",70,"#FFE9FF"]},Jt=e=>{var t,i,r;if(!(null==e?void 0:e.report))return;let a=(null===(t=e.report)||void 0===t?void 0:t.mag)>=9?"catastrophic":null===(r=null===(i=e.report)||void 0===i?void 0:i.type)||void 0===r?void 0:r.toLowerCase();return a||(a="mini"),{color:Kt.earthquakes[a],size:{mini:12,minor:18,light:20,moderate:22,strong:26,major:30,great:36,catastrophic:42}[a]}},ei=e=>{const t=null==e?void 0:e.report;if(!t)return;const i=Kt.fire_obs,r=t.perContained||0,a=Math.max(1,t.areaAC)*(100===r?.75:1)/1e4,s=new Date(t.startDateISO);let n=i.active,o=Math.min(40,Math.round(10+30*a)),l=2;return 100===r?(n=i.contained,o*=.75):Date.now()-s.getTime()<864e5&&(n=i.new,l=2),{color:n,size:o,thickness:l}},ti={title:"Fires",fn:e=>{var t,i;const r=e[0];if(null==r?void 0:r.report){const e=r.report,a=Math.round(Math.max(1,null!==(i=null===(t=r.perimeter)||void 0===t?void 0:t.areaAC)&&void 0!==i?i:e.areaAC)),s=null===e.perContained?"":` (${e.perContained}% contained)`;return`${e.name} - ${a.toLocaleString("en-US")} acres${s}`}return""}},ii=e=>{const t={temperature:S("Temperatures",{id:"temperature",bar:{measurement:Object.assign(Object.assign({},h.X1.measurement),{converter:w}),colorscale:{range:h.X1.dataRange,stops:g.temperature},labels:{every:e=>20,formatter:(e,t,i)=>0===t?`${Math.floor(e)}°%%units%%`:`${Math.floor(e)}`}}}),temperature_change_24hr:S("24-Hour Temp Change",{id:"temperature-change-24hr",bar:{measurement:Object.assign(Object.assign({},h.X1.measurement),{converter:_}),colorscale:{range:{min:(0,m.FtoCUnit)(-50),max:(0,m.FtoCUnit)(50)},stops:g.tempChange24Hour},labels:{every:e=>"C"===e?10:20,formatter:(e,t,i)=>{const r=`${e>0?"+":""}${Math.floor(e)}`;return 0===t?`${r}°%%units%%`:`${r}`}}}}),temperature_change_1hr:S("1-Hour Temp Change",{id:"temperature-change-1hr",bar:{measurement:Object.assign(Object.assign({},h.X1.measurement),{converter:_}),colorscale:{range:{min:(0,m.FtoCUnit)(-40),max:(0,m.FtoCUnit)(40)},stops:g.tempChange1Hour},labels:{every:e=>10,formatter:(e,t,i)=>{const r=`${e>0?"+":""}${Math.floor(e)}`;return 0===t?`${r}°%%units%%`:`${r}`}}}}),dewpoint:S("Dew Point",{id:"dew-point",bar:{measurement:Object.assign(Object.assign({},h.X1.measurement),{converter:w}),colorscale:{range:h.$W.dataRange,stops:g.dewpoint},labels:{every:e=>20,formatter:(e,t,i)=>0===t?`${Math.floor(e)}°%%units%%`:`${Math.floor(e)}`}}}),humidity:S("Humidity",{id:"humidity",bar:{measurement:Object.assign({},h.c1.measurement),colorscale:{range:h.c1.dataRange,stops:g.temperature},labels:{every:20,formatter:(e,t,i)=>0===t?`${Math.floor(e)}%`:`${Math.floor(e)}`}}}),pressure_msl:S("Surface Pressure",{id:"mslp",bar:{measurement:Object.assign(Object.assign({},h.rv.measurement),{converter:M}),colorscale:{range:h.rv.dataRange,stops:g.mslp},labels:{every:e=>"mb"===e?20:1,formatter:(e,t,i)=>{const r=i.metric?Math.floor(e):e.toFixed(2);return 0===t?`${r} %%units%%`:`${r}`}}}}),heatindex:S("Heat Index",{id:"heat-index",bar:{measurement:Object.assign(Object.assign({},h.X1.measurement),{converter:w}),colorscale:{range:{min:(0,m.FtoC)(80),max:h.X1.dataRange.max},stops:g.temperature},labels:{every:e=>"C"===e?5:10,formatter:(e,t,i)=>0===t?`${Math.floor(e)}°%%units%%`:`${Math.floor(e)}`}}}),windchill:S("Wind Chill",{id:"wind-chill",bar:{measurement:Object.assign(Object.assign({},h.X1.measurement),{converter:w}),colorscale:{range:{min:h.X1.dataRange.min,max:(0,m.FtoC)(40)},stops:g.temperature},labels:{every:e=>"C"===e?10:20,formatter:(e,t,i)=>0===t?`${Math.floor(e)}°%%units%%`:`${Math.floor(e)}`}}}),windspeed:S("Wind Speeds",{id:"windspeed",bar:{measurement:Object.assign(Object.assign({},h.LO.measurement),{converter:A}),colorscale:{range:{min:0,max:h.LO.dataRange.max},stops:g.windspeed},labels:{every:e=>"kmh"===e?20:10,formatter:(e,t,i)=>0===t?`${Math.floor(e)} %%units%%`:`${Math.floor(e)}`}}}),cloud_cover:S("Cloud Cover",{id:"cloud-cover",bar:{colorscale:{range:h.h4.dataRange,stops:g.sky},labels:{every:20,formatter:(e,t,i)=>0===t?`${Math.floor(e)}%`:`${Math.floor(e)}`}}}),visibility:S("Visibility",{id:"visibility",bar:{measurement:Object.assign(Object.assign({},h.XD.measurement),{converter:E}),colorscale:{range:h.XD.dataRange,stops:g.visibility},labels:{every:e=>"km"===e?2:1,formatter:(e,t,i)=>0===t?`${Math.floor(e)} %%units%%`:`${Math.floor(e)}`}}}),radar:{id:"radar",type:"bar",title:"Radar",bar:[(0,f.$)({},x.bar,{colorscale:{range:{min:6,max:h.Jg.dataRange.max},stops:g.radar.rain},labels:{values:[{value:0,label:"Light"},{value:.5,label:"RAIN"},{value:1,label:"Heavy"}],normalized:!0}}),(0,f.$)({},x.bar,{colorscale:{range:{min:6,max:h.Jg.dataRange.max},stops:g.radar.mix},labels:{values:[{value:0,label:"Light"},{value:.5,label:"MIX"},{value:1,label:"Heavy"}],normalized:!0}}),(0,f.$)({},x.bar,{colorscale:{range:{min:6,max:h.Jg.dataRange.max},stops:g.radar.snow},labels:{values:[{value:0,label:"Light"},{value:.5,label:"SNOW"},{value:1,label:"Heavy"}],normalized:!0}})],text:x.text,onBeforeUpdate:e=>{var t;const i=e.bar,r={min:6,max:h.Jg.dataRange.max},a=["RAIN","MIX","SNOW"];return Array.isArray(i)?i.forEach(((e,t)=>{var i;if(e.colorscale&&(e.colorscale.range=r),Array.isArray(null===(i=e.labels)||void 0===i?void 0:i.values)){const i=a[t];e.labels.values.forEach(((e,t)=>{"object"==typeof e&&.5===e.value&&(e.label=i)}))}})):(i.colorscale&&(i.colorscale.range=r),Array.isArray(null===(t=i.labels)||void 0===t?void 0:t.values)&&i.labels.values.forEach(((e,t)=>{"object"==typeof e&&.5===e.value&&(e.label="Moderate")}))),e}},accum_precip:S("Accumulated Precipitation",{id:"accum-precip",bar:{measurement:{type:"precipitation",units:m.Units.rate.mms,converter:T},colorscale:{range:{min:(0,m.inToMMRate)(.01),max:h.Yh.dataRange.max},resample:v.G.inCirc},labels:{values:e=>"in"===e?[.01,.1,.5,1,2,3,4,6,8,12,16,18,20,30]:[1,2,5,10,25,50,75,100,150,200,300,400,500,600,700],formatter:(e,t,i)=>{const r=(0,y.NT)(e,2);return 0===t?`${r} %%units%%`:`${r}`}}}}),accum_snow:S("Accumulated Snowfall",{id:"accum-snow",bar:{measurement:{type:"snowfall",units:m.Units.precipitation.m,converter:T},colorscale:{range:{min:(0,m.inToM)(.1),max:(0,m.inToM)(60)},stops:g.snowdepth,resample:(0,v.A)(.55,.09,1,.75)},labels:{values:e=>"in"===e?[.1,1,3,6,12,18,24,36,48,60]:[.5,3,5,10,25,50,100,150],formatter:(e,t,i)=>0===t?`${Math.floor(e)} %%units%%`:`${Math.floor(e)}`}}}),snow_depth:S("Snow Depth",{id:"snow-depth",bar:{measurement:{type:"snowfall",units:m.Units.precipitation.m,converter:T},colorscale:{range:{min:(0,m.inToM)(1),max:h.RX.dataRange.max},stops:g.snowdepth,resample:(0,v.A)(.7,0,1,.6)},labels:{values:e=>"in"===e?[1,3,6,12,18,24,36,48,72,96,120,168,216,300]:[3,5,10,25,50,100,200,350,500,700],formatter:(e,t,i)=>0===t?`${Math.floor(e)} %%units%%`:`${Math.floor(e)}`}}}),uvi:S("Ultraviolet Index (UVI)",{id:"uvi",bar:{colorscale:{range:{min:1,max:12},stops:g.uvi,interval:1},labels:{every:1,formatter:(e,t,i)=>`${Math.floor(e)}`}}})};return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},{water:{id:"base.water.fill",layer:{type:O.m.fill,source:$.base_osm,sourceType:d.V.polygon,sourceLayer:"water",paint:{fill:{color:"#333"}}}},"admin-2-boundaries":H("base.admin_2_boundaries.line",["all",["==","admin_level",2],["!=","maritime",1]],{stroke:{color:"#333",thickness:e=>e.zoom<2?1:2,opacity:.85}}),"admin-3-4-boundaries":H("base.admin_3_4_boundaries.line",["all",[">=","admin_level",3],["<=","admin_level",4],["!=","maritime",1]],{stroke:{color:"#333",opacity:e=>e.zoom<2?.5:.75}}),"admin-5-6-boundaries":H("base.admin_5_6_boundaries.line",["all",[">=","admin_level",5],["<=","admin_level",6],["!=","maritime",1]],{stroke:{color:"#333",opacity:.6}}),"waterway-ocean-boundaries":X("base.waterway_ocean.line",["==","class","ocean"],{stroke:{color:"#333",thickness:e=>e.zoom<2?1:2,opacity:.85}}),"waterway-lake-river-boundaries":X("base.waterway_lake.line",["any",["==","class","river"],["==","class","lake"]],{stroke:{color:"#333",thickness:1,opacity:.7}}),boundaries:["admin-2-boundaries","admin-3-4-boundaries","admin-5-6-boundaries","waterway-ocean-boundaries","waterway-lake-river-boundaries"],"place-city":Y("base.place_city.text",["in","class","city","town"],{text:{size:e=>{const t=e.rank,i=e.zoom;return"city"===e.class?i<4?10:i<6?12:i<8?t<5?16:12:i<11?t<5?20:16:22:i>10?16:12}}}),"place-neighborhood":Y("base.place_neighborhood.text",["in","class","village","neighbourhood","hamlet","suburb"],{text:{size:e=>e.zoom<13?11:14}}),"place-state":Y("base.place_state.text",["in","class","state","province"],{text:{size:e=>e.zoom<4?10:12,color:"#999",weight:"bold",transform:"uppercase",letterSpacing:.1}}),"place-country":Y("base.place_country.text",["in","class","country","continent"],{text:{size:e=>{const t=e.zoom;return t<2?13:t<4?16:20},color:"#666"}}),places:["place-country","place-state","place-city","place-neighborhood"],"waterways-text":{id:"base.waterways.text",layer:{type:O.m.symbol,source:$.base_osm,sourceType:d.V.point,sourceLayer:"water_name",paint:{text:{value:{property:["name:en","name"]},weight:e=>"ocean"===e.class?"bold":"normal",size:e=>{const t=e.zoom;return"ocean"===e.class?t<3?13:20:"sea"===e.class&&t<4?10:12},letterSpacing:e=>"ocean"===e.class?.1:0,color:"#999"},symbol:{rank:{property:"rank",direction:"asc"},pitchWithMap:!1,rotateWithMap:!1,allowOverlap:!1}}}},"road-all":Z("admin.road_all.line"),"road-motorway":Z("admin.road_motorway.line",["==","class","motorway"],{stroke:{thickness:e=>{const t=e.zoom;return t<5?1:t<10?2:t<15?4:10}}}),"road-trunk":Z("admin.road_trunk.line",["==","class","trunk"],{stroke:{thickness:e=>e.zoom<10?1:2,opacity:e=>{const t=e.zoom;return t<5?0:t<10?.5:1}}}),"road-primary":Z("admin.road_primary.line",["==","class","primary"],{stroke:{thickness:1,opacity:e=>{const t=e.zoom;return t<5?0:t<10?.5:1}}}),"road-secondary-tertiary":Z("admin.road_secondary_tertiary.line",["in","class","secondary","tertiary"],{stroke:{thickness:e=>e.zoom<12?1:2,opacity:e=>{const t=e.zoom;return t<8?0:t<12?.5:1}}}),"road-street":Z("admin.road_street.line",["in","class","minor","service"],{stroke:{thickness:1,opacity:.6}}),roads:["road-motorway","road-trunk","road-primary","road-secondary-tertiary","road-street"],"cities-points":{id:"base.cities.points",layer:{type:O.m.circle,source:$.base_cities,sourceType:d.V.point,sourceLayer:"cities",paint:{fill:{color:"#000"},circle:{radius:3}}}}}),[{id:"conditions.radar.fill",code:"radar",source:$.radar_REFC_PRATE_PTYPE}].reduce(((e,i)=>{let{id:r,code:a,source:s}=i;return e[a]={id:r,layer:(0,u.Af)(s,{quality:O.E.exact,zoomOffset:0,paint:{sample:{channel:"r",colorscale:{masks:[{channel:"g",value:1,drawRange:{min:10},colorscale:{range:{min:0,max:87},stops:g.radar.rain}},{channel:"g",value:3,colorscale:{range:{min:0,max:87},stops:g.radar.mix}},{channel:"g",value:2,colorscale:{range:{min:0,max:87},stops:g.radar.snow}}]}}}}),legend:t.radar,evaluator:W.radar},e}),{})),((e,t,i)=>{const r={temperatures:{id:(0,u.RC)("conditions.temperature.fill"),layer:(0,u.Af)($.conditions_TMP_UGRD_VGRD,{paint:{sample:{channel:"r",colorscale:{stops:g.temperature,breaks:oe}}}}),legend:t.temperature,evaluator:i.temperature},"temperatures-contour":{id:(0,u.RC)("conditions.temperature.contour"),layer:(0,u.Af)($.conditions_TMP_UGRD_VGRD,{type:O.m.contour,paint:{sample:{channel:"r",smoothing:1,colorscale:{stops:g.temperature,interval:1,breaks:oe}},contour:{interval:(0,m.FtoCUnit)(2),majorInterval:(0,m.FtoCUnit)(10)}}}),legend:t.temperature,evaluator:i.temperature},"temperatures-24hr-change":{id:(0,u.RC)("conditions.temperature_24hr_change.fill"),layer:(0,u.Af)($.conditions_TMP_DELTA,{paint:{sample:{expression:ne.BG.difference,channel:"rg",offset:.5,colorscale:{range:{min:(0,m.FtoCUnit)(-50),max:(0,m.FtoCUnit)(50)},stops:g.tempChange24Hour}}}}),legend:t.temperature_change_24hr,evaluator:i.temperature_change},"temperatures-1hr-change":{id:(0,u.RC)("conditions.temperature_1hr_change.fill"),layer:(0,u.Af)($.conditions_TMP_DELTA,{paint:{sample:{expression:ne.BG.difference,channel:"rb",offset:.5,colorscale:{range:{min:(0,m.FtoCUnit)(-40),max:(0,m.FtoCUnit)(40)},stops:g.tempChange1Hour}}}}),legend:t.temperature_change_1hr,evaluator:i.temperature_change},"wind-speeds":{id:(0,u.RC)("conditions.wind_speed.fill"),layer:(0,u.Af)($.conditions_TMP_UGRD_VGRD,{paint:{sample:{channel:"gb",expression:ne.BG.vector,colorscale:{range:{min:0,max:h.LO.dataRange.max},stops:g.windspeed}}}}),legend:t.windspeed,evaluator:i.winds},"wind-speeds-contour":{id:(0,u.RC)("conditions.wind_speed.contour"),layer:(0,u.Af)($.conditions_TMP_UGRD_VGRD,{type:O.m.contour,paint:{sample:{channel:"gb",expression:ne.BG.vector,smoothing:1,colorscale:{range:{min:0,max:h.LO.dataRange.max},stops:g.windspeed,interval:(0,m.mphToMsUnit)(5)}},contour:{interval:(0,m.mphToMsUnit)(5),majorInterval:(0,m.mphToMsUnit)(25)}}}),legend:t.windspeed,evaluator:i.winds},"wind-dir":{id:(0,u.RC)("conditions.wind_speed.arrow"),layer:(0,u.Af)($.conditions_TMP_UGRD_VGRD,{type:O.m.grid,paint:{sample:{channel:"gb",expression:ne.BG.vector,interpolation:ne.uN.bilinear,smoothing:1,colorscale:{range:{min:0,max:h.LO.dataRange.max},stops:g.windspeed}},grid:{spacing:30},icon:{type:"arrow",size:{width:40,height:20},anchor:"left"},symbol:{rotateWithMap:!0,pitchWithMap:!0}}}),legend:t.windspeed,evaluator:i.winds},"wind-barbs":{id:(0,u.RC)("conditions.wind_speed.barb"),layer:(0,u.Af)($.conditions_TMP_UGRD_VGRD,{type:O.m.grid,paint:{sample:{channel:"gb",expression:ne.BG.vector,interpolation:ne.uN.bilinear,smoothing:1,colorscale:{range:{min:0,max:h.LO.dataRange.max},stops:g.windspeed}},fill:{color:"#fff"},grid:{spacing:30},icon:{atlas:{ids:[0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100].map((e=>`mapsgl:wind-barb-${e}`)),interval:2.572222},size:{width:40,height:40},anchor:"bottom",offset:{x:0,y:5},rotation:-90},symbol:{rotateWithMap:!0,pitchWithMap:!0}}}),legend:t.windspeed,evaluator:i.winds},"wind-particles":{id:(0,u.RC)("conditions.wind_speed.particle"),layer:(0,u.Af)($.conditions_TMP_UGRD_VGRD,{type:O.m.particle,paint:{sample:{channel:"gb",expression:ne.BG.vector,interpolation:ne.uN.bilinear,smoothing:1,colorscale:{range:{min:0,max:h.LO.dataRange.max},stops:g.windspeed}},particle:{density:Q.j.normal,size:2},symbol:{sizeAttenuation:!0,rotateWithMap:!0,pitchWithMap:!0}}}),legend:t.windspeed,evaluator:i.winds},"wind-gusts":{id:(0,u.RC)("conditions.wind_gust.fill"),layer:(0,u.Af)($.conditions_PRMSL_VIS_GUST,{paint:{sample:{channel:"b",colorscale:{range:{min:0,max:h.LO.dataRange.max},stops:g.windspeed}}}}),legend:t.windspeed,evaluator:i.wind_gusts},"feels-like":{id:(0,u.RC)("conditions.feels_like.fill"),layer:(0,u.Af)($.conditions_APTMP_DPT_RH,{paint:{sample:{channel:"r",colorscale:{stops:g.temperature,breaks:oe}}}}),legend:t.temperature,evaluator:Object.assign(Object.assign({},i.temperature),{title:"Feels Like"})},"wind-chill":{id:(0,u.RC)("conditions.wind_chill.fill"),layer:(0,u.Af)($.conditions_APTMP_DPT_RH,{paint:{sample:{channel:"r",drawRange:{max:(0,m.FtoC)(40)},colorscale:{stops:g.temperature,breaks:oe}}}}),legend:t.windchill,evaluator:Object.assign(Object.assign({},i.temperature),{title:"Wind Chill"})},"heat-index":{id:(0,u.RC)("conditions.heat_index.fill"),layer:(0,u.Af)($.conditions_APTMP_DPT_RH,{paint:{sample:{channel:"r",drawRange:{min:(0,m.FtoC)(80)},colorscale:{stops:g.temperature,breaks:oe}}}}),legend:t.heatindex,evaluator:Object.assign(Object.assign({},i.temperature),{title:"Heat Index"})},"dew-points":{id:(0,u.RC)("conditions.dew_point.fill"),layer:(0,u.Af)($.conditions_APTMP_DPT_RH,{paint:{sample:{channel:"g",colorscale:{stops:g.dewpoint,breaks:oe}}}}),legend:t.dewpoint,evaluator:Object.assign(Object.assign({},i.temperature),{title:"Dew Point"})},humidity:{id:(0,u.RC)("conditions.humidity.fill"),layer:(0,u.Af)($.conditions_APTMP_DPT_RH,{paint:{sample:{channel:"b",colorscale:{stops:g.humidity}}}}),legend:t.humidity,evaluator:i.humidity},"pressure-msl":{id:(0,u.RC)("conditions.pressure_msl.fill"),layer:(0,u.Af)($.conditions_PRMSL_VIS_GUST,{quality:O.E.low,paint:{sample:{channel:"r",colorscale:{stops:g.mslp}}}}),legend:t.pressure_msl,evaluator:i.pressure_msl},"pressure-msl-contour":{id:(0,u.RC)("conditions.pressure_msl.contour"),layer:(0,u.Af)($.conditions_PRMSL_VIS_GUST,{type:O.m.contour,quality:O.E.low,paint:{sample:{channel:"r",smoothing:.5,colorscale:{stops:g.mslp,interval:1}},contour:{interval:2,majorInterval:10}}}),legend:t.pressure_msl,evaluator:i.pressure_msl},"cloud-cover":{id:(0,u.RC)("conditions.cloud_cover.fill"),layer:(0,u.Af)($.conditions_SKY_PRECIP_UVI,{paint:{sample:{channel:"r",colorscale:{stops:g.sky}}}}),legend:t.cloud_cover},precip:{id:(0,u.RC)("conditions.precip.fill"),layer:(0,u.Af)($.conditions_PRECIP,{quality:O.E.high,paint:{sample:{channel:"rgb",colorscale:{stops:g.precip_accum},drawRange:{min:m.inToMMRate(.01)}}}}),legend:t.accum_precip,evaluator:i.accum_precip},"precip-rate":{id:(0,u.RC)("conditions.precip_rate.fill"),layer:(0,u.Af)($.conditions_SKY_PRECIP_UVI,{paint:{sample:{channel:"g",colorscale:{range:{min:0,max:m.inToMMRate(25)},stops:g.prate}}}}),legend:t.radar,evaluator:Object.assign(Object.assign({},i.radar),{title:"Precip Rate"})},snow:{id:(0,u.RC)("conditions.snow.fill"),layer:(0,u.Af)($.conditions_SNOW_DERIVED,{quality:O.E.high,paint:{sample:{channel:"rgb",colorscale:{stops:g.snowdepth},dataRange:{min:0,max:m.inToM(60)},drawRange:{min:m.inToM(.1)}}}}),legend:t.accum_snow,evaluator:{title:"Accum Snow",fn:e=>`${(100*e).toFixed(1)} cm, ${m.mToIn(e).toFixed(1)} in`}},"snow-depth":{id:(0,u.RC)("conditions.snow_depth.fill"),layer:(0,u.Af)($.conditions_SNOD,{quality:O.E.high,paint:{sample:{channel:"r",colorscale:{stops:g.snowdepth},drawRange:{min:m.inToM(1)}}}}),legend:t.snow_depth,evaluator:{title:"Snow Depth",fn:e=>`${e.toFixed(1)} m, ${m.mToIn(e).toFixed(1)} in`}},visibility:{id:(0,u.RC)("conditions.visibility.fill"),layer:(0,u.Af)($.conditions_PRMSL_VIS_GUST,{paint:{sample:{channel:"g",colorscale:{stops:g.visibility}}}}),legend:t.visibility,evaluator:i.visibility},uvi:{id:(0,u.RC)("conditions.uvi.fill"),layer:(0,u.Af)($.conditions_SKY_PRECIP_UVI,{quality:O.E.low,paint:{sample:{channel:"b",smoothing:1,colorscale:{stops:g.uvi,interval:1}}}}),legend:t.uvi,evaluator:{title:"UV Index",fn:e=>`${Math.round(e)}`}}};return r["wind-particles-arrow"]=(0,f.$)({},r["wind-particles"],{id:(0,u.RC)("conditions.wind_speed.particle_arrow"),layer:{paint:{particle:{type:"arrow",density:Q.j.low,size:{width:20,height:10},speed:2,trails:!1}}}}),r["precip-accum"]=Object.assign(Object.assign({},r.precip),{id:(0,u.RC)("conditions.precip_accum.fill"),operation:{type:"sum"}}),r["snow-accum"]=Object.assign(Object.assign({},r.snow),{id:(0,u.RC)("conditions.snow_accum.fill"),operation:{type:"sum"}}),r["temperatures-max"]=Object.assign(Object.assign({},r.temperatures),{id:(0,u.RC)("conditions.temperature_max.fill"),operation:{type:"max"}}),r["temperatures-min"]=Object.assign(Object.assign({},r.temperatures),{id:(0,u.RC)("conditions.temperature_min.fill"),operation:{type:"min"}}),r["wind-speeds-max"]=Object.assign(Object.assign({},r["wind-speeds"]),{id:(0,u.RC)("conditions.wind_speed_max.fill"),operation:{type:"max"}}),r["wind-gusts-max"]=Object.assign(Object.assign({},r["wind-gusts"]),{id:(0,u.RC)("conditions.wind_gust_max.fill"),operation:{type:"max"}}),Object.keys(r).forEach((e=>{const t=r[e];if(t.layer.type===O.m.sample){let i=(e=>{switch(e){case"temperature":return K;case"precipitation":return ie;case"rate":return ae;case"speed":return ee;case"pressure":return te;case"distance":return se}})(m.getMeasurementType(e));/^temperature.+-change$/.test(e)?i=J:e.startsWith("precip")?i=ae:e.startsWith("snow")&&(i=re),r[`${e}-text`]={id:t.id.replace(/\.\w+$/,".text"),layer:(0,u.Z)($.base_cities,i),query:{layerId:e,hidden:!0}}}})),r})(0,t,W)),((e,t,i)=>Object.assign(Object.assign({sst:{id:(0,u.RC)("maritime.sst.fill"),layer:(0,u.Af)($.maritime_WTMP_UOGRD_VOGRD,{paint:{sample:{channel:"r",colorscale:{stops:g.temperature}}}}),mask:le.E,legend:t.temperature,evaluator:i.temperature},"ocean-currents":{id:(0,u.RC)("maritime.ocean_current.fill"),layer:(0,u.Af)($.maritime_WTMP_UOGRD_VOGRD,{paint:{sample:{channel:"gb",expression:ne.BG.vector,colorscale:{range:{min:0,max:h.xj.current.dataRange.max},stops:he.current}}}}),mask:le.E,legend:ce.current,evaluator:Object.assign(Object.assign({},i.winds),{title:"Ocean Current"})},"ocean-currents-particles":{id:(0,u.RC)("maritime.ocean_current.particle"),layer:(0,u.Af)($.maritime_WTMP_UOGRD_VOGRD,{type:O.m.particle,paint:{sample:{channel:"gb",expression:ne.BG.vector,interpolation:ne.uN.bilinear,colorscale:{range:{min:0,max:h.xj.current.dataRange.max},stops:he.current}},particle:{density:Q.j.normal,size:2,speed:10}}}),mask:le.E,legend:ce.current,evaluator:Object.assign(Object.assign({},i.winds),{title:"Ocean Current"})}},[{prefix:"wave",dataset:$.maritime_WAVE,title:"Wave"},{prefix:"swell",dataset:$.maritime_SWELL1,title:"Swell"},{prefix:"swell2",dataset:$.maritime_SWELL2,title:"Swell 2"},{prefix:"swell3",dataset:$.maritime_SWELL3,title:"Swell 3"}].reduce(((e,t)=>{let{prefix:r,dataset:a,title:s}=t;return e[`${r}-heights`]={id:(0,u.RC)(`maritime.${r}_height.fill`),layer:(0,u.Af)(a,{paint:{sample:{channel:"r",colorscale:{stops:he.wave_height}}}}),mask:le.E,legend:ce.wave_height,evaluator:Object.assign(Object.assign({},i.wave_height),{title:`${s} Height`})},e[`${r}-periods`]={id:(0,u.RC)(`maritime.${r}_period.fill`),layer:(0,u.Af)(a,{paint:{sample:{channel:"g",colorscale:{stops:he.period,interval:1}}}}),mask:le.E,legend:ce.period,evaluator:Object.assign(Object.assign({},i.period),{title:`${s} Period`})},e[`${r}-dir`]={id:(0,u.RC)(`maritime.${r}_dir.fill`),layer:(0,u.Af)(a,{type:O.m.grid,paint:{sample:{channel:"b",expression:ne.BG.angle,interpolation:ne.uN.bilinear,colorscale:{range:{min:0,max:359},stops:[0,"#ffffff",1,"#ffffff"],normalized:!0}},grid:{spacing:30},icon:{type:"arrow",size:{width:40,height:20},anchor:"left"}}}),mask:le.E,evaluator:Object.assign(Object.assign({},i.angle_reversed),{title:`${s} Direction`})},e[`${r}-particles`]={id:(0,u.RC)(`maritime.${r}_dir.particle`),layer:(0,u.Af)(a,{type:O.m.particle,paint:{sample:{channel:"b",expression:ne.BG.angle,interpolation:ne.uN.bilinear,colorscale:{range:{min:0,max:359},stops:[0,"#ffffff",1,"#ffffff"],normalized:!0}},particle:{type:"bar",size:{width:8,height:1},speed:3,trails:!0,trailsFade:.94}}}),mask:le.E,evaluator:Object.assign(Object.assign({},i.angle_reversed),{title:`${s} Direction`})},e}),{})),{"storm-surge":{id:(0,u.RC)("maritime.storm_surge.fill"),layer:(0,u.Af)($.maritime_SURGE_TIDE,{paint:{sample:{channel:"r",colorscale:{stops:he.surge}}}}),mask:le.E,legend:ce.surge,evaluator:Object.assign(Object.assign({},i.wave_height),{title:"Storm Surge"})},"tide-heights":{id:(0,u.RC)("maritime.tide_height.fill"),layer:(0,u.Af)($.maritime_SURGE_TIDE,{paint:{sample:{channel:"g",colorscale:{stops:he.height_diff}}}}),mask:le.E,legend:ce.tide_height,evaluator:Object.assign(Object.assign({},i.height_change),{title:"Tide Height"})}}))(0,t,W)),Object.assign(Object.assign({"air-quality":{id:(0,u.RC)("air_quality.point"),layer:{type:O.m.circle,source:$.airquality_points,sourceType:d.V.point,paint:{fill:{color:e=>{var t,i;if((0,de.g)(null==e?void 0:e.periods)||0===(null===(t=null==e?void 0:e.periods)||void 0===t?void 0:t.length))return;const r=null===(i=e.periods[0].category)||void 0===i?void 0:i.replace(/[\s-]/,"_").toLowerCase();return ue[r]||"#000000"}},stroke:{color:"#fff",thickness:3},circle:{radius:8}}},legend:De,evaluator:Ke},"air-quality-index":{id:(0,u.RC)("air_quality.index.fill"),layer:(0,u.Af)($.airquality_AQI_PM2P5_PM10,{paint:{sample:{channel:"r",colorscale:{stops:fe}}}}),legend:ze,evaluator:Object.assign(Object.assign({},Qe),{title:"AQI"})},"air-quality-index-text":{id:(0,u.RC)("air_quality.index.text"),layer:(0,u.Z)($.base_cities),query:{layerId:"air-quality-index",hidden:!0}},"air-quality-index-categories":{id:(0,u.RC)("air_quality.index_categories.fill"),layer:(0,u.Af)($.airquality_AQI_PM2P5_PM10,{paint:{sample:{channel:"r",colorscale:{stops:me,interpolate:!1}}}}),legend:De,evaluator:Object.assign(Object.assign({},Qe),{title:"AQI"})},"air-quality-health-index-categories":{id:(0,u.RC)("air_quality.aqhi.fill"),layer:(0,u.Af)($.airquality_AQI_HI_China_India,{paint:{sample:{channel:"r",colorscale:{stops:ge,interpolate:!1}}}}),legend:Le,evaluator:Object.assign(Object.assign({},Qe),{title:"Health Index"})}},[{source:$.airquality_AQI_HI_China_India,items:["china","india"],channels:["g","b"]},{source:$.airquality_AQI_EAQI_UBA_UK,items:["eaqi","uba_daqi","uk_daqi"],channels:["r","g","b"]},{source:$.airquality_AQI_CAI_CAQI,items:["cai","caqi"],channels:["r","g"]}].reduce(((e,t)=>{let{source:i,items:s,channels:n}=t;return s.forEach(((t,s)=>{const o=t.replace(/_/,"-"),l=t.replaceAll("_"," ").replaceAll("-"," ").split(" ").map(((e,t)=>0===t&&e.length>0&&e[0]===e[0].toLowerCase()?e.toLowerCase():e.charAt(0).toUpperCase()+e.slice(1).toLowerCase())).join("");e[`air-quality-index-${o}-categories`]={id:(0,u.RC)(`air_quality.${t}.fill`),layer:(0,u.Af)(i,{paint:{sample:{channel:n[s],colorscale:{stops:r[t],interpolate:!1}}}}),legend:a[l],evaluator:Object.assign(Object.assign({},Qe),{title:"AQI"})},e[`air-quality-index-${o}-text`]={id:(0,u.RC)(`air_quality.${t}.text`),layer:(0,u.Z)($.base_cities),query:{layerId:`air-quality-index-${o}-categories`,hidden:!0}}})),e}),{})),[{source:$.airquality_AQI_PM2P5_PM10,items:["pm2p5","pm10"],channels:["g","b"]},{source:$.airquality_CO_NO_NO2,items:["co","no","no2"],channels:["r","g","b"]},{source:$.airquality_O3_SO2,items:["o3","so2"],channels:["r","g"]}].reduce(((e,t)=>{let{source:i,items:s,channels:n}=t;return s.forEach(((t,s)=>{e[`air-quality-${t}`]={id:(0,u.RC)(`air_quality.${t}.fill`),layer:(0,u.Af)(i,{paint:{sample:{channel:n[s],colorscale:{stops:r[t]}}}}),legend:a[t],evaluator:Object.assign(Object.assign({},Je),{title:t.toUpperCase()})},e[`air-quality-${t}-text`]={id:(0,u.RC)(`air_quality.${t}.text`),layer:(0,u.Z)($.base_cities),query:{layerId:`air-quality-${t}`,hidden:!0}}})),e}),{}))),[{sourceType:"nowcast",prefix:""},{sourceType:"forecast",prefix:"f"}].reduce(((e,t)=>{let{sourceType:i,prefix:r}=t;return tt.forEach((t=>{let a;switch(t){case"us":a="forecast"===i?$.roadweather_forecast_us:$.roadweather_nowcast_us;break;case"europe":a="forecast"===i?$.roadweather_forecast_europe:$.roadweather_nowcast_europe;break;case"japan":a="forecast"===i?$.roadweather_forecast_japan:$.roadweather_nowcast_japan;break;case"australia":a="forecast"===i?$.roadweather_forecast_australia:$.roadweather_nowcast_australia;break;case"new-zealand":a="forecast"===i?$.roadweather_forecast_new_zealand:$.roadweather_nowcast_new_zealand}it.forEach((s=>{const o=s.replaceAll(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),l=`${r}road-weather-${o}-${t}`;at.forEach((r=>{const{type:h=r,filter:c}=rt[r];e[`${l}-${r}-points`]={id:(0,u.RC)(`road_weather.${o}.${t}.${r}.point`),layer:Object.assign(Object.assign({},vt(s,O.m.circle)),{source:a,sourceLayer:`road-wx-${i}`,filter:["==","roadType_0-SFC",h]}),legend:n[`${s}`]},e[`${l}-${r}`]={id:(0,u.RC)(`road_weather.${o}.${t}.${r}.fill`),layer:Object.assign(Object.assign({},vt(s,O.m.voronoi)),{source:a,sourceLayer:`road-wx-${i}`,filter:["==","roadType_0-SFC",h]}),mask:{layerId:"road-all",overrides:{filter:c,paint:{stroke:"bridges"===r?{color:"#fff",thickness:6,lineJoin:"round",lineCap:"square"}:{color:"#fff",thickness:"secondary"===h?2:4}}}},legend:n[`${s}`]}})),e[`${l}-points`]={id:(0,u.RC)(`road_weather.${o}.${t}.point`),layer:Object.assign(Object.assign({},vt(s,O.m.circle)),{source:a,sourceLayer:`road-wx-${i}`}),legend:n[`${s}`]},e[l]=at.map((e=>`${l}-${e}`))}))})),e}),{})),((e,t,i)=>{const r=Object.assign(Object.assign({alerts:{id:(0,u.RC)("severe.alerts.fill"),layer:{type:O.m.fill,source:$.severe_alerts,timeSeries:{mode:et.Gp.any},paint:{fill:{color:{property:"COLOR"}},stroke:{color:"#000"}}},legend:zt(e),evaluator:qt},"alerts-outline":{id:(0,u.RC)("severe.alerts.line"),layer:{type:O.m.line,source:$.severe_alerts,timeSeries:{mode:et.Gp.any},paint:{stroke:{color:{property:"COLOR"},thickness:3,lineJoin:I.p.Round,lineCap:I.$.Round}}},legend:zt(e),evaluator:qt},"stormcells-positions":{id:(0,u.RC)("severe.stormcells.position.circle"),layer:{type:O.m.circle,source:$.severe_stormcells,sourceType:d.V.point,timeSeries:{mode:et.Gp.any},paint:{fill:{color:e=>{var t,i;const r=null===(i=null===(t=e.traits)||void 0===t?void 0:t.type)||void 0===i?void 0:i.toLowerCase();return xt[r]||"#000000"}},stroke:{color:"#fff",thickness:3},circle:{radius:7}}},legend:Lt,evaluator:Wt},"stormcells-tracks":{id:(0,u.RC)("severe.stormcells.track.line"),layer:{type:O.m.line,source:$.severe_stormcells,sourceType:d.V.line,timeSeries:{mode:et.Gp.any},paint:{stroke:{color:"#fff",thickness:3,lineCap:I.$.Round}}},evaluator:Wt},"stormcells-cones":{id:(0,u.RC)("severe.stormcells.cone.line"),layer:{type:O.m.fill,source:$.severe_stormcells,timeSeries:{mode:et.Gp.any},paint:{fill:{color:e=>{var t,i;const r=null===(i=null===(t=e.traits)||void 0===t?void 0:t.type)||void 0===i?void 0:i.toLowerCase();return xt[r]||"#000000"},opacity:.5}}},legend:Lt,evaluator:Wt},stormcells:["stormcells-cones","stormcells-tracks","stormcells-positions"],"stormcells-heat":{id:(0,u.RC)("severe.stormcells.heat"),layer:{type:O.m.heatmap,source:$.severe_stormcells,sourceType:d.V.point,timeSeries:{mode:et.Gp.any},paint:{heatmap:{radius:20,color:g.heatmap}}}},stormreports:{id:(0,u.RC)("severe.stormreports.circle"),layer:{type:O.m.circle,source:$.severe_stormreports,sourceType:d.V.point,timeSeries:{mode:et.Gp.any},paint:{fill:{color:e=>{var t,i;const r=null===(i=null===(t=e.report)||void 0===t?void 0:t.cat)||void 0===i?void 0:i.toLowerCase();return bt[r]||"#000000"}},stroke:{color:"#fff",thickness:3},circle:{radius:8}}},legend:kt,evaluator:{title:"Storm Reports",fn:e=>{const t=e[0];return(null==t?void 0:t.report)?`${(0,Xe.C)(t.report.type)}`:""}}},"stormreports-heat":{id:(0,u.RC)("severe.stormreports.heat"),layer:{type:O.m.heatmap,source:$.severe_stormreports,sourceType:d.V.point,timeSeries:{mode:et.Gp.any},paint:{heatmap:{radius:20,color:g.heatmap}}}},"lightning-strikes":{id:(0,u.RC)("severe.lightning.circle"),layer:{type:O.m.circle,source:$.severe_lightning,sourceType:d.V.point,timeSeries:{mode:et.Gp.any},paint:{fill:{color:e=>{const t=e.age||0;return t<=60?_t:t<=300?At:t<=600?Mt:Tt}},stroke:{color:"#333",thickness:2},circle:{radius:6}}},legend:Ft},"lightning-flash":{id:(0,u.RC)("severe.lightning_flash.circle"),layer:{type:O.m.circle,source:$.severe_lightning_flash,sourceType:d.V.point,timeSeries:{mode:et.Gp.any},paint:{fill:{color:Et},stroke:{color:"#333",thickness:2},circle:{radius:4}}}},"lightning-all":["lightning-flash","lightning-strikes"],"lightning-threats-polygons":{id:(0,u.RC)("severe.lightning.threats.fill"),layer:{type:O.m.fill,source:$.severe_lightning_threats,timeSeries:{mode:et.Gp.interval},paint:{fill:{color:e=>{const{details:t,period:i}=e;if(!t||!i)return"#000000";const r=(0,p.oh)(e),a=Math.max(0,10*Math.floor(r/10));return St[`lead${a}`]||"#000000"},sort:{property:"period.range.minTimestamp",direction:"desc"}}}},legend:jt,evaluator:Ht},"lightning-threats-tracks":{id:(0,u.RC)("severe.lightning.threats.line"),layer:{type:O.m.line,source:$.severe_lightning_threats,timeSeries:{mode:et.Gp.interval},filter:["all",["==","featureType","forecastPath"],["==",["get","reliability",["get","movement",["get","details"]]],"HIGH"],[">",["get","totalPeriods",["get","details"]],1]],paint:{stroke:{color:"#DE2900"}}}},"lightning-threats-points":{id:(0,u.RC)("severe.lightning.threats.circle"),layer:{type:O.m.circle,source:$.severe_lightning_threats,timeSeries:{mode:et.Gp.interval},paint:{fill:{color:"#DE2900"},stroke:{color:"#fff",thickness:2},circle:{radius:4}}},evaluator:Ht},"lightning-threats":["lightning-threats-polygons","lightning-threats-tracks","lightning-threats-points"],"lightning-strikes-heat":{id:(0,u.RC)("severe.lightning.heat"),layer:{type:O.m.heatmap,source:$.severe_lightning,sourceType:d.V.point,timeSeries:{mode:et.Gp.any},paint:{heatmap:{radius:20,color:g.heatmap}}}},convective:{id:(0,u.RC)("severe.convective.fill"),layer:{type:O.m.fill,source:$.severe_convective,paint:{fill:{color:e=>{var t;const i=null===(t=e.details.risk.type)||void 0===t?void 0:t.toLowerCase();return wt[i]||"#000000"},opacity:.9}}},legend:$t,evaluator:Xt},"convective-outline":{id:(0,u.RC)("severe.convective.line"),layer:{type:O.m.line,source:$.severe_convective,paint:{stroke:{color:e=>{var t;const i=null===(t=e.details.risk.type)||void 0===t?void 0:t.toLowerCase();return wt[i]||"#000000"},thickness:3}}},legend:$t,evaluator:Xt},"hail-threats-polygons":{id:(0,u.RC)("severe.hail.threats.fill"),layer:{type:O.m.fill,source:$.severe_hail_threats,timeSeries:{mode:et.Gp.interval},paint:{fill:{color:e=>{const{details:t,period:i}=e;if(!t||!i)return"#000000";const r=(0,p.oh)(e),a=Math.max(0,10*Math.floor(r/10));return Ot[`lead${a}`]||"#000000"},sort:{property:"period.range.minTimestamp",direction:"desc"}}}},legend:Vt,evaluator:Object.assign(Object.assign({},Ht),{title:"Hail Threat"})},"hail-threats-tracks":{id:(0,u.RC)("severe.hail.threats.line"),layer:{type:O.m.line,source:$.severe_hail_threats,timeSeries:{mode:et.Gp.interval},filter:["==","featureType","forecastPath"],paint:{stroke:{color:"#520BAE"}}}},"hail-threats-points":{id:(0,u.RC)("severe.hail.threats.circle"),layer:{type:O.m.circle,source:$.severe_hail_threats,timeSeries:{mode:et.Gp.interval},paint:{fill:{color:"#520BAE",opacity:.5},stroke:{color:"#fff",thickness:2},circle:{radius:4}}}},"hail-threats":["hail-threats-polygons","hail-threats-tracks","hail-threats-points"]},p.ot.reduce(((e,t)=>{const i=U($.severe_hail_MESH_POSH,t);return e[`hail-size-${t}`]={id:(0,u.RC)(`severe.hail.size.${t}`),layer:(0,u.Af)(i,{quality:O.E.exact,paint:{sample:{channel:"r",colorscale:{range:{min:0,max:(0,m.inToMM)(3)},stops:[0,"rgba(132,0,170,0)",1,"#372497",(0,m.inToMM)(.5),"#1D6AA2",(0,m.inToMM)(.999),"#089E9A",(0,m.inToMM)(1),"#09BB93",(0,m.inToMM)(2),"#FEF112",(0,m.inToMM)(3),"#FE5412"],interval:1},drawRange:{min:1}}}}),legend:Bt,evaluator:Zt},e[`hail-severe-probability-${t}`]={id:(0,u.RC)(`severe.hail.posh.${t}`),layer:(0,u.Af)(i,{quality:O.E.exact,paint:{sample:{channel:"g",colorscale:{range:{min:0,max:100},stops:Rt,normalized:!0},drawRange:{min:10}}}}),legend:Ut,evaluator:Yt},e[`hail-size-max-${t}`]=Object.assign(Object.assign({},e[`hail-size-${t}`]),{id:(0,u.RC)(`severe.hail.size_max.${t}`),operation:{type:"max"}}),e[`hail-severe-probability-max-${t}`]=Object.assign(Object.assign({},e[`hail-severe-probability-${t}`]),{id:(0,u.RC)(`severe.hail.posh_max.${t}`),operation:{type:"max"}}),e}),{})),p.Q0.reduce(((e,t)=>{const i=U($.severe_lightning_LGTIC_LGTCG,t);return e[`lightning-density-${t}`]={id:(0,u.RC)(`severe.lightning.density.${t}.all`),layer:(0,u.Af)(i,{quality:O.E.exact,paint:{sample:{channel:"b",colorscale:{range:{min:0,max:10},stops:Ct},drawRange:{min:.1}}}}),legend:Nt,evaluator:Object.assign(Object.assign({},Qt),{title:"Lightning Density"})},e[`lightning-density-cloud-to-ground-${t}`]={id:(0,u.RC)(`severe.lightning.density.${t}.cg`),layer:(0,u.Af)(i,{quality:O.E.exact,paint:{sample:{channel:"r",colorscale:{range:{min:0,max:10},stops:Ct},drawRange:{min:.1}}}}),legend:Nt,evaluator:Object.assign(Object.assign({},Qt),{title:"Lightning Density (CG)"})},e[`lightning-density-intracloud-${t}`]={id:(0,u.RC)(`severe.lightning.density.${t}.ic`),layer:(0,u.Af)(i,{quality:O.E.exact,paint:{sample:{channel:"g",colorscale:{range:{min:0,max:10},stops:Ct},drawRange:{min:.1}}}}),legend:Nt,evaluator:Object.assign(Object.assign({},Qt),{title:"Lightning Density (IC)"})},e[`lightning-density-accum-${t}`]=Object.assign(Object.assign({},e[`lightning-density-${t}`]),{id:(0,u.RC)(`severe.lightning.density_accum.${t}.all`),operation:{type:"sum"}}),e[`lightning-density-cloud-to-ground-accum-${t}`]=Object.assign(Object.assign({},e[`lightning-density-${t}`]),{id:(0,u.RC)(`severe.lightning.density_accum.${t}.cg`),operation:{type:"sum"}}),e[`lightning-density-intracloud-accum-${t}`]=Object.assign(Object.assign({},e[`lightning-density-intracloud-${t}`]),{id:(0,u.RC)(`severe.lightning.density_accum.${t}.ic`),operation:{type:"sum"}}),e}),{}));return r["lightning-strikes-icons"]=(0,f.$)({},r["lightning-strikes"],{id:(0,u.RC)("severe.lightning.symbol"),layer:{type:O.m.symbol,paint:{stroke:{thickness:1},icon:{image:"mapsgl:lightning-bolt",size:{width:30,height:30}}}}}),r["lightning-all-icons"]=["lightning-flash","lightning-strikes-icons"],r["lightning-strikes-pulse"]=(0,f.$)({},r["lightning-strikes"],{id:(0,u.RC)("severe.lightning.pulse"),layer:{type:O.m.symbol,paint:{icon:{shader:"\n#extension GL_OES_standard_derivatives : enable\n\nprecision mediump float;\n\nuniform vec2 resolution;\nuniform float dpr;\nuniform float time;\n\nvarying vec2 vUv;\nvarying vec2 vPosition;\nvarying float vFactor;\nvarying float vRandom;\n\nvarying float vEnvelope;\nvarying float vInvRadius;\nvarying float vInvRadiusEdge;\nvarying float vIntensity;\n\nvoid main() {\n float envelope = vEnvelope;\n\n // --- Spatial falloff (radial glow) ----------------------------------------\n // Keep glow circular in screen-space: correct for aspect.\n float aspect = resolution.x / max(resolution.y, 1.0);\n vec2 p = vUv - vec2(0.5);\n float r = length(p);\n float q = r * vInvRadius; // normalized radius r / radius\n\n // Radius is in icon-UV units now: 0.5 touches the quad's edge.\n float radius = 0.45; // fills the icon with a small margin\n\n // Soft core + long, soft edge (use precomputed inverses for perf)\n // float core = 1.0 / (1.0 + 8.0 * pow(r / max(radius, 1e-4), 2.0));\n // float core = 1.0 / (1.0 + 18.0 * (q * q)); // tighter core than before\n // // long fade from ~55% of radius to edge (q = 0.55..1.0)\n // float edge = 1.0 - smoothstep(0.7, 1.0, q);\n // float spatial = core * edge;\n\n // Two-term isotropic falloff: tight core + broad halo (both circular)\n float core = 1.0 / (1.0 + 20.0 * (q * q)); // small hot center\n float halo = 1.0 / (1.0 + 4.0 * (q * q)); // wide soft halo\n\n // Limit contribution near the very edge for a clean terminator\n float edgeMask = 1.0 - smoothstep(0.9, 1.0, q);\n\n // // Combined spatial term (circular symmetry)\n // float spatial = (0.55 * core + 0.80 * halo) * edgeMask;\n\n\n // // --- Edge-to-core color grading ---\n // // Keep edges slightly bluish, center approaches white\n // vec3 edgeColor = vec3(0.7, 0.80, 1.00); // icier blue at the outskirts\n // float coreMix = smoothstep(0.1, 0.9, core); // slower transition to white\n\n // // Boost the core so it burns white under additive blending\n // float coreBoost = mix(1.0, 2.2, coreMix);\n // vec3 glowColor = mix(edgeColor, vec3(1.0), coreMix);\n\n\n // Combine: keep some core but emphasize a wide halo\n float spatial = (0.55 * core + 0.80 * halo) * edgeMask;\n\n // --- Edge-to-core color grading -----------------------------------------\n // Bluish edges (halo), hot white core\n vec3 edgeColor = vec3(0.6, 0.65, 1.00);\n\n // Weight toward white near center; toward blue in the halo\n float coreMix = smoothstep(0.35, 0.80, core); // 0 at edge, 1 near center\n float haloMix = smoothstep(0.15, 0.80, halo); // 0 outside, 1 within halo\n\n // Final glow tint: mostly blue in the wings, white in the core\n vec3 glowColor = mix(edgeColor, vec3(1.0), coreMix);\n\n // Slightly lift halo blueness even when core is strong\n glowColor = mix(glowColor, edgeColor, (1.0 - coreMix) * 0.35 * haloMix); // 0.35 is the weight\n\n // Reduce center boost so the core doesn't dominate; additive will bloom it anyway\n float coreBoost = mix(1.0, 1.35, coreMix);\n\n\n // --- Color & output --------------------------------------------------------\n float intensity = vIntensity;\n vec3 color = glowColor * (intensity * coreBoost) * envelope * spatial;\n\n // Additive-friendly output (premult not needed here).\n gl_FragColor = vec4(color, clamp(envelope * spatial, 0.0, 0.8));\n}\n",shaderOnBeforeCompile:e=>{e.vertex=e.vertex.replace("#include <project_vertex>","\n#include <project_vertex>\n\nvarying float vEnvelope;\nvarying float vInvRadius;\nvarying float vInvRadiusEdge;\nvarying float vIntensity;\n\n/* Quick-rise / slow-decay impulse.\n Larger k => narrower, punchier impulse with a fast attack and slower tail. */\nfloat expImpulse(float k, float x) {\n float y = k * x;\n return y * exp(1.0 - y);\n}\n\n/* Tiny hash for flicker without textures. */\nfloat hash11(float x) {\n // one sin + fract -> cheap, stable per-frame noise when driven by time\n return fract(sin(x) * 43758.5453123);\n}\n"),e.vertex=e.vertex.replace("#include <symbol_vert_position>","\n#include <symbol_vert_position>\n\n// --- Temporal envelope ----------------------------------------------------\n// Use vFactor only for the gap between pulses; pulse is always ~1s.\nfloat repeatFactor = clamp(vFactor, 0.0, 1.0);\n\n// // Ensure zero/near-zero factors still differ per-instance (avoid beat sync)\n// float tinyBias = 0.01 * (0.5 + hash11(vRandom * 12345.0)); // ~0.0015..0.003\n// repeatFactor = max(repeatFactor, tinyBias);\n\n// --- Timing model: fixed ~1s pulse, variable gap controlled by vFactor ---\n// A single pulse (fast attack, slow decay) lasts ~1.0s.\n// After that, a gap occurs; higher vFactor => shorter gap (faster repeat).\nfloat pulseDuration = 2.0; // seconds for burst+decay\nfloat minGap = 0.50; // fastest re-strike gap (s)\nfloat maxGap = 5.00; // slowest re-strike gap (s)\nfloat gap = mix(maxGap, minGap, repeatFactor);\n\nfloat nominalPeriod = pulseDuration + gap;\n\n// Instance-staggered time and integer cycle under the *nominal* period\nfloat t0 = time + 10.0 + vRandom * 13.37;\nfloat cycle = floor(t0 / max(nominalPeriod, 1e-3));\n\n// Per-cycle gap variation (random short/long pauses)\nfloat gapJitter = mix(0.6, 1.4, hash11(cycle * 17.0 + vRandom * 123.0));\nfloat basePeriod = pulseDuration + gap * gapJitter;\n\n// Time within the current cycle (under nominal schedule)\nfloat tIn = t0 - cycle * nominalPeriod;\n\n// Normalized phase inside the *jittered* period\nfloat phaseBase = clamp(tIn / max(basePeriod, 1e-3), 0.0, 1.0);\n\n// Additional per-cycle phase jitter to break residual sync\nfloat phaseJitter = hash11(cycle + vRandom * 4096.0);\nfloat phase = fract(phaseBase + (phaseJitter - 0.5) * 0.6); // +/-0.3 cycle shift\n\n// Active portion of the cycle is the initial pulseDuration window\nfloat activeFrac = pulseDuration / basePeriod; // portion of period that is the pulse\nfloat localPhase = clamp(phase / max(activeFrac, 1e-3), 0.0, 1.0);\n\n// Shape: quick rise, slower decay\nfloat k = 14.0; // higher => snappier attack, longer tail\nfloat burst = expImpulse(k, localPhase); // 0..~1 over the 1s window\n\n// Gate the envelope so it is zero during the gap (branch-free)\nfloat gate = step(phase, activeFrac); // 1 in pulse window, 0 in gap\n\n// Subtle micro-flicker only during the burst, reduced amplitude\nfloat flickSeed = floor(time * 180.0 + vRandom * 997.0);\nfloat flick = 0.08 * burst * (hash11(flickSeed) * 2.0 - 1.0);\n\nfloat envelope = max(burst * gate + flick, 0.0);\nfloat radius = 0.45;\n\nvEnvelope = envelope;\n\n// --------- precompute spatial constants ----------\nvInvRadius = 1.0 / max(radius, 1e-4);\nvInvRadiusEdge = 1.0 / (radius * 1.6);\n\n// --------- pack intensity once ----------\nvIntensity = 1.0;\n")},size:e=>{const t=e.zoom,i=Math.max(0,(900-e.age)/900)*(t/5),r=Math.round(20+40*i);return{width:r,height:r}},animated:!0,blending:2,factor:e=>Math.max(0,(900-e.age)/900)},symbol:{pitchWithMap:!0,allowOverlap:!0}}},legend:null}),r["alerts-short-fuse"]=(0,f.$)({},r["alerts-outline"],{id:(0,u.RC)("severe.alerts.short_fuse"),layer:{paint:{animated:!0,opacity:e=>{let{time:t}=e;return Math.min(1,Math.max(0,.5*Math.sin(8*t)+.5))},stroke:{thickness:4}},filter:["in","VTEC","SV.W","TO.W","FF.W","MA.W"]}}),r["hail-size"]=p.ot.map((e=>`hail-size-${e}`)),r["hail-size-max"]=p.ot.map((e=>`hail-size-max-${e}`)),r["hail-severe-probability"]=p.ot.map((e=>`hail-severe-probability-${e}`)),r["hail-severe-probability-max"]=p.ot.map((e=>`hail-severe-probability-max-${e}`)),r["lightning-density"]=p.Q0.map((e=>`lightning-density-${e}`)),r["lightning-density-accum"]=p.Q0.map((e=>`lightning-density-accum-${e}`)),r["lightning-density-cloud-to-ground"]=p.Q0.map((e=>`lightning-density-cloud-to-ground-${e}`)),r["lightning-density-cloud-to-ground-accum"]=p.Q0.map((e=>`lightning-density-cloud-to-ground-accum-${e}`)),r["lightning-density-intracloud"]=p.Q0.map((e=>`lightning-density-intracloud-${e}`)),r["lightning-density-intracloud-accum"]=p.Q0.map((e=>`lightning-density-intracloud-accum-${e}`)),r})(e)),Object.assign(Object.assign({},["active","notactive","invests"].reduce(((e,t)=>{const i="tropical-cyclones-";let r="",a="",s=$.tropical_active;switch(t){case"active":a="_active";break;case"notactive":r="-archive",a="_archive",s=$.tropical_archive;break;case"invests":r="-invests",a="_invests",s=$.tropical_invests}return e[`${i}track-points${r}`]={id:(0,u.RC)(`tropical.track${a}.circle`),layer:Object.assign(Object.assign({},L.point),{source:s,filter:["==","featureType","trackPoint"]}),legend:k,evaluator:j},e[`${i}track-point-icons${r}`]={id:(0,u.RC)(`tropical.track${a}.symbol`),layer:Object.assign(Object.assign({},L.symbol),{source:s,filter:["==","featureType","trackPoint"]}),legend:k,evaluator:j},e[`${i}track-lines${r}`]={id:(0,u.RC)(`tropical.track${a}.line`),layer:Object.assign(Object.assign({},L.track),{source:s,filter:["==","featureType","trackLine"]}),legend:k},e[`${i}names${r}`]={id:(0,u.RC)(`tropical.names${a}.text`),layer:Object.assign(Object.assign({},L.name),{source:s,sourceType:d.V.point,filter:["==","featureType","position"]})},"active"===t||"invests"===t?(e[`${i}positions${r}`]={id:(0,u.RC)(`tropical.positions${a}.circle`),layer:Object.assign(Object.assign({},L.point),{source:s,filter:["==","featureType","position"]}),legend:k,evaluator:j},e[`${i}position-icons${r}`]={id:(0,u.RC)(`tropical.positions${a}.symbol`),layer:(0,f.$)({},L.symbol,{source:s,filter:["==","featureType","position"],paint:{icon:{size:e=>e.zoom<4?{width:28,height:28}:{width:44,height:44},shaderOnBeforeCompile:e=>{e.vertex=e.vertex.replace("#include <symbol_vert_position>","\n symbolAngle += (time * -PI * 2.0) * 0.5 * factor;\n #include <symbol_vert_position>\n ")},animated:!0}}}),legend:k,evaluator:j},e[`${i}forecast-points${r}`]={id:(0,u.RC)(`tropical.forecast${a}.circle`),layer:Object.assign(Object.assign({},L.point),{source:s,filter:["==","featureType","forecastPoint"]}),legend:k,evaluator:j},e[`${i}forecast-point-icons${r}`]={id:(0,u.RC)("tropical.forecast.symbol"),layer:Object.assign(Object.assign({},L.symbol),{source:s,filter:["==","featureType","forecastPoint"]}),legend:k,evaluator:j},e[`${i}forecast-lines${r}`]={id:(0,u.RC)(`tropical.forecast${a}.line`),layer:Object.assign(Object.assign({},L.track),{source:s,filter:["==","featureType","forecastLine"]})},"invests"===t?(e[`tropical-cyclones${r}`]=["track-lines","track-points","positions","names"].map((e=>{const t=e.startsWith("forecast-")?"":r;return`${i}${e}${t}`})),e[`tropical-cyclones${r}-icons`]=["track-lines","track-point-icons","position-icons","names"].map((e=>{const t=e.startsWith("forecast-")?"":r;return`${i}${e}${t}`}))):(e[`tropical-cyclones${r}`]=["forecast-error-cones","track-lines","forecast-lines","track-points","forecast-points","positions","names"].map((e=>{const t=e.startsWith("forecast-")?"":r;return`${i}${e}${t}`})),e[`tropical-cyclones${r}-icons`]=["forecast-error-cones","track-lines","forecast-lines","track-point-icons","forecast-point-icons","position-icons","names"].map((e=>{const t=e.startsWith("forecast-")?"":r;return`${i}${e}${t}`})))):(e[`tropical-cyclones${r}`]=["forecast-error-cones","track-lines-archive","forecast-lines","track-points-archive","forecast-points","names-archive"].map((e=>`${i}${e}`)),e[`tropical-cyclones${r}-icons`]=["forecast-error-cones","track-lines-archive","forecast-lines","track-point-icons-archive","forecast-point-icons","position-icons","names-archive"].map((e=>`${i}${e}`))),e}),{})),{"tropical-cyclones-forecast-error-cones":{id:(0,u.RC)("tropical.cone.fill"),layer:{type:O.m.fill,source:$.tropical_active,paint:{fill:{color:"#ff0000",opacity:.5},stroke:{color:"#ff0000",thickness:1}}}},"tropical-cyclones-break-points":{id:(0,u.RC)("tropical.active.breakpoints"),layer:{type:O.m.line,source:$.tropical_active,filter:["==","featureType","breakPointAlert"],paint:{stroke:{color:e=>{var t;const i=null===(t=e.alertType)||void 0===t?void 0:t.toUpperCase();return z[i]||"#999"},thickness:e=>{var t;switch(null===(t=e.alertType)||void 0===t?void 0:t.toUpperCase()){case"TR.W":case"HU.W":return 8;default:return 4}},lineJoin:I.p.Round,lineCap:I.$.Round}}},legend:F}})),{"fires-obs":function(e){return{id:(0,u.RC)("climate.fire_obs.point"),layer:{type:O.m.circle,source:$.fires_obs,timeSeries:{mode:et.Gp.range},paint:{fill:{color:e=>{const{color:t}=ei(e);return t}},stroke:{color:"#fff",thickness:e=>{const{thickness:t}=ei(e);return t}},circle:{radius:e=>{const{size:t}=ei(e);return t/2}}}},legend:C("Fires",{id:(0,u.RC)("fire-obs"),points:{values:[{color:e.new,label:"New"},{color:e.active,label:"Active"},{color:e.contained,label:"Contained"}]}}),evaluator:ti}}(Kt.fire_obs),"fires-obs-icons":{id:(0,u.RC)("climate.fire_obs.icons"),layer:{type:O.m.symbol,source:$.fires_obs,timeSeries:{mode:et.Gp.range},paint:{icon:{image:e=>{const t=e.report;return t?`mapsgl:fire-${Math.max(1,Math.min(5,Math.floor(1+((t.perContained||0)-50)/50*4)))}`:"fire"},size:e=>{const t=e.report;if(!t)return{width:20,height:20};const i=Math.max(1,t.areaAC),r=Math.min(50,Math.round(20+i/1e4*30));return{width:r,height:r}},anchor:"bottom",offset:{x:0,y:2}},symbol:{rotateWithMap:!1,pitchWithMap:!1}}},evaluator:ti},"fires-obs-names":{id:(0,u.RC)("climate.fire_obs.names"),layer:{type:O.m.symbol,source:$.fires_obs,timeSeries:{mode:et.Gp.range},paint:{text:[{value:e=>{const t=e.report;return!t||e.zoom<7?null:t.name},size:14,color:"#fff",outlineColor:"#444",weight:"bold",anchor:"top",offset:e=>e.report?{x:0,y:4}:null},{value:e=>{var t,i;const r=e.report;return!r||e.zoom<7?null:`${Math.round(Math.max(1,null!==(i=null===(t=e.perimeter)||void 0===t?void 0:t.areaAC)&&void 0!==i?i:r.areaAC)).toLocaleString("en-US")} acres`},size:11,color:"#fff",outlineColor:"#444",anchor:"top",offset:{x:0,y:{target:"text-0-bottom",offset:0}}}],symbol:{allowOverlap:!1,rotateWithMap:!1,pitchWithMap:!1}}}},"fires-obs-heat":{id:(0,u.RC)("climate.fire_obs.heat"),layer:{type:O.m.heatmap,source:$.fires_obs,timeSeries:{mode:et.Gp.range},paint:{heatmap:{radius:20,color:g.heatmap}}}},"fires-perimeter":{id:(0,u.RC)("climate.fire_obs.perimeter"),layer:{type:O.m.fill,source:$.fires_perimeter,timeSeries:{mode:et.Gp.range},paint:{fill:{color:"#ff0000",opacity:.6},stroke:{color:"#ff0000"}}},evaluator:ti},fires:["fires-perimeter","fires-obs","fires-obs-names"],"fires-icons":["fires-perimeter","fires-obs-icons","fires-obs-names"],"fires-outlook":function(e){return{id:(0,u.RC)("climate.fire_outlook.fill"),layer:{type:O.m.fill,source:$.fires_outlook,paint:{fill:{color:t=>{var i;const r=null===(i=t.details.risk.type)||void 0===i?void 0:i.toLowerCase();return e[r]||"#FFB268"},opacity:.9}}},legend:C("Fire Outlook",{id:(0,u.RC)("fire-outlook"),points:{values:[{color:e.elevated,label:"Elevated"},{color:e.critical,label:"Critical"},{color:e.extreme,label:"Extreme"}]}}),evaluator:{title:"Fire Outlook",fn:e=>{var t,i;const r=e.at(-1);return(null==r?void 0:r.details)?`${(0,Xe.C)(null===(i=null===(t=r.details)||void 0===t?void 0:t.risk)||void 0===i?void 0:i.type)}`:""}}}}(Kt.fire_outlook),"fires-vpd":{id:(0,u.RC)("climate.fires_vpd.fill"),layer:(0,u.Af)($.conditions_VPD,{paint:{sample:{channel:"r",dataRange:{min:0,max:70},colorscale:{stops:Kt.vpd}}}}),mask:le.S,legend:S("Vapor Pressure Deficit (VPD)",{id:(0,u.RC)("fires-vpd"),bar:{measurement:{type:"pressure",units:m.Units.pressure.hPa},colorscale:{range:{min:0,max:70},stops:Kt.vpd},labels:{every:e=>20,formatter:(e,t,i)=>0===t?`${Math.round(e)} %%units%%`:`${Math.round(e)}`}}}),evaluator:{title:"Vapor Pressure Deficit (VPD)",fn:e=>`${e.toFixed(2)} hPa`}},"drought-monitor":function(e){return{id:(0,u.RC)("climate.drought_monitor.fill"),layer:{type:O.m.fill,source:$.drought,paint:{fill:{color:t=>{var i;const r=null===(i=t.details.category)||void 0===i?void 0:i.toLowerCase();return e[r]||"#000000"}}}},legend:C("Drought Monitor",{id:(0,u.RC)("drought"),points:{values:[{color:e.d0,label:"Abnormally Dry"},{color:e.d1,label:"Moderate"},{color:e.d2,label:"Severe"},{color:e.d3,label:"Extreme"},{color:e.d4,label:"Exceptional"}]}}),evaluator:{title:"Drought Monitor",fn:e=>{var t,i;const r=e[0];return(null==r?void 0:r.details)?`${(0,Xe.C)(null===(i=null===(t=e[0].details)||void 0===t?void 0:t.risk)||void 0===i?void 0:i.name)}`:""}}}}(Kt.drought),"drought-monitor-outline":function(e){return{id:(0,u.RC)("climate.drought_monitor.outline"),layer:{type:O.m.line,source:$.drought,paint:{stroke:{color:t=>{var i;const r=null===(i=t.details.category)||void 0===i?void 0:i.toLowerCase();return e[r]||"#000000"},thickness:3}}}}}(Kt.drought),earthquakes:function(e){return{id:(0,u.RC)("climate.earthquakes.point"),layer:{type:O.m.circle,source:$.earthquakes,paint:{fill:{color:e=>{const{color:t}=Jt(e);return t}},stroke:{color:"#fff",thickness:2},circle:{radius:e=>{const{size:t}=Jt(e);return(t||12)/2}},symbol:{rotateWithMap:!0,pitchWithMap:!0}}},legend:C("Earthquakes",{id:(0,u.RC)("earthquakes"),points:{values:[{color:e.mini,label:"Mini"},{color:e.minor,label:"Minor"},{color:e.light,label:"Light"},{color:e.moderate,label:"Moderate"},{color:e.strong,label:"Strong"},{color:e.major,label:"Major"},{color:e.great,label:"Great"},{color:e.catastrophic,label:"Catastrophic"}]}}),evaluator:{title:"Earthquakes",fn:e=>{var t,i,r;const a=e[0];return(null==a?void 0:a.report)?`${null===(t=a.report)||void 0===t?void 0:t.mag} (${null===(i=a.report)||void 0===i?void 0:i.type}) - ${(null===(r=a.report)||void 0===r?void 0:r.location)||""}`:""}}}}(Kt.earthquakes),"earthquakes-heat":{id:(0,u.RC)("climate.earthquakes.heat"),layer:{type:O.m.heatmap,source:$.earthquakes,paint:{heatmap:{radius:20,color:g.heatmap},symbol:{rotateWithMap:!0,pitchWithMap:!0}}}},"river-observations":function(e){return{id:(0,u.RC)("climate.river_obs.point"),layer:{type:O.m.circle,source:$.rivers,sourceType:d.V.point,paint:{fill:{color:t=>{var i,r;const a=null===(r=null===(i=t.ob)||void 0===i?void 0:i.status)||void 0===r?void 0:r.toLowerCase();return e[a]||"#000000"}},stroke:{color:"#fff",thickness:3},circle:{radius:8}}},legend:C("River Observations",{id:(0,u.RC)("rivers"),points:{values:[{color:e.out_of_service,label:"Out of Service"},{color:e.obs_not_current,label:"Old Data"},{color:e.not_defined,label:"Unavailable"},{color:e.low_threshold,label:"Low Threshold"},{color:e.no_flooding,label:"No Flooding"},{color:e.action,label:"Action"},{color:e.minor,label:"Minor"},{color:e.moderate,label:"Moderate"},{color:e.major,label:"Major"}]}}),evaluator:{title:"River Obs",fn:e=>{var t;const i=e[0];if(null==i?void 0:i.ob){let e="";return(null===(t=null==i?void 0:i.profile)||void 0===t?void 0:t.waterbody)&&(e+=`${(0,Xe.C)(i.profile.waterbody)} - `),e+=(0,Xe.C)(i.ob.status.replace(/_/," ")),e}return""}}}}(Kt.rivers)}),{satellite:{id:"raster.satellite.infrared",layer:(0,u.BH)($.satellite_infrared)},"satellite-geocolor":{id:"raster.satellite.geocolor",layer:(0,u.BH)($.satellite_geocolor)},"satellite-visible":{id:"raster.satellite.visible",layer:(0,u.BH)($.satellite_visible)},"satellite-infrared-color":{id:"raster.satellite.infrared-color",layer:(0,u.BH)($.satellite_infrared_color)},"satellite-water-vapor":{id:"raster.satellite.water-vapor",layer:(0,u.BH)($.satellite_water_vapor)}})},ri=(e,t)=>({sources:G(t),layers:ii(e)})}}]),t}));