text: var app=function(){"use strict";function t(){}const e=t=>t;function n(t,e){for(const r in e)t[r]=e[r];return t}function i(t){return t()}function o(){return Object.create(null)}function a(t){t.forEach(i)}function s(t){return"function"==typeof t}function u(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t}function l(e,...r){if(null==e)return t;const n=e.subscribe(...r);return n.unsubscribe?()=>n.unsubscribe():n}function c(t,e,r){t.$$.on_destroy.push(l(e,r))}function p(t,e,r,n){if(t){const i=h(t,e,r,n);return t[0](i)}}function h(t,e,r,i){return t[1]&&i?n(r.ctx.slice(),t[1](i(e))):r.ctx}function f(t,e,r,n,i,o,a){const s=function(t,e,r,n){if(t[2]&&n){const i=t[2](n(r));if(void 0===e.dirty)return i;if("object"==typeof i){const t=[],r=Math.max(e.dirty.length,i.length);for(let n=0;n<r;n+=1)t[n]=e.dirty[n]|i[n];return t}return e.dirty|i}return e.dirty}(e,n,i,o);if(s){const i=h(e,r,n,a);t.p(i,s)}}const d="undefined"!=typeof window;let m=d?()=>window.performance.now():()=>Date.now(),y=d?t=>requestAnimationFrame(t):t;const v=new Set;function _(t){v.forEach((e=>{e.c(t)||(v.delete(e),e.f())})),0!==v.size&&y(_)}function x(t,e){t.appendChild(e)}function w(t,e,r){t.insertBefore(e,r||null)}function S(t){t.parentNode.removeChild(t)}function A(t){return document.createElement(t)}function E(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function T(t){return document.createTextNode(t)}function k(){return T(" ")}function I(){return T("")}function z(t,e,r,n){return t.addEventListener(e,r,n),()=>t.removeEventListener(e,r,n)}function C(t,e,r){null==r?t.removeAttribute(e):t.getAttribute(e)!==r&&t.setAttribute(e,r)}function P(t,e){for(const r in e)C(t,r,e[r])}function M(t,e,r){e in t?t[e]=r:C(t,e,r)}function D(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function L(t,e,r,n){t.style.setProperty(e,r,n?"important":"")}let B,R;function O(){if(void 0===B){B=!1;try{"undefined"!=typeof window&&window.parent&&window.parent.document}catch(t){B=!0}}return B}function F(t,e){const r=getComputedStyle(t),n=(parseInt(r.zIndex)||0)-1;"static"===r.position&&(t.style.position="relative");const i=A("iframe");i.setAttribute("style",`display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%; overflow: hidden; border: 0; opacity: 0; pointer-events: none; z-index: ${n};`),i.setAttribute("aria-hidden","true"),i.tabIndex=-1;const o=O();let a;return o?(i.src="data:text/html,<script>onresize=function(){parent.postMessage(0,'*')}<\/script>",a=z(window,"message",(t=>{t.source===i.contentWindow&&e()}))):(i.src="about:blank",i.onload=()=>{a=z(i.contentWindow,"resize",e)}),x(t,i),()=>{(o||a&&i.contentWindow)&&a(),S(i)}}function V(t,e,r){t.classList[r?"add":"remove"](e)}function U(t){R=t}function j(){if(!R)throw new Error("Function called outside component initialization");return R}function N(t){j().$$.on_mount.push(t)}function q(t,e){j().$$.context.set(t,e)}function $(t){return j().$$.context.get(t)}const Z=[],G=[],W=[],X=[],H=Promise.resolve();let K=!1;function Y(t){W.push(t)}function J(t){X.push(t)}let Q=!1;const tt=new Set;function et(){if(!Q){Q=!0;do{for(let t=0;t<Z.length;t+=1){const e=Z[t];U(e),rt(e.$$)}for(U(null),Z.length=0;G.length;)G.pop()();for(let t=0;t<W.length;t+=1){const e=W[t];tt.has(e)||(tt.add(e),e())}W.length=0}while(Z.length);for(;X.length;)X.pop()();K=!1,Q=!1,tt.clear()}}function rt(t){if(null!==t.fragment){t.update(),a(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(Y)}}const nt=new Set;let it;function ot(){it={r:0,c:[],p:it}}function at(){it.r||a(it.c),it=it.p}function st(t,e){t&&t.i&&(nt.delete(t),t.i(e))}function ut(t,e,r,n){if(t&&t.o){if(nt.has(t))return;nt.add(t),it.c.push((()=>{nt.delete(t),n&&(r&&t.d(1),n())})),t.o(e)}}const lt="undefined"!=typeof window?window:"undefined"!=typeof globalThis?globalThis:global;function ct(t,e){ut(t,1,1,(()=>{e.delete(t.key)}))}function pt(t,e){const r={},n={},i={$$scope:1};let o=t.length;for(;o--;){const a=t[o],s=e[o];if(s){for(const t in a)t in s||(n[t]=1);for(const t in s)i[t]||(r[t]=s[t],i[t]=1);t[o]=s}else for(const t in a)i[t]=1}for(const t in n)t in r||(r[t]=void 0);return r}function ht(t,e,r){const n=t.$$.props[e];void 0!==n&&(t.$$.bound[n]=r,r(t.$$.ctx[n]))}function ft(t){t&&t.c()}function dt(t,e,r){const{fragment:n,on_mount:o,on_destroy:u,after_update:l}=t.$$;n&&n.m(e,r),Y((()=>{const e=o.map(i).filter(s);u?u.push(...e):a(e),t.$$.on_mount=[]})),l.forEach(Y)}function mt(t,e){const r=t.$$;null!==r.fragment&&(a(r.on_destroy),r.fragment&&r.fragment.d(e),r.on_destroy=r.fragment=null,r.ctx=[])}function yt(t,e){-1===t.$$.dirty[0]&&(Z.push(t),K||(K=!0,H.then(et)),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function gt(e,r,n,i,s,u,l=[-1]){const c=R;U(e);const p=r.props||{},h=e.$$={fragment:null,ctx:null,props:u,update:t,not_equal:s,bound:o(),on_mount:[],on_destroy:[],before_update:[],after_update:[],context:new Map(c?c.$$.context:[]),callbacks:o(),dirty:l,skip_bound:!1};let f=!1;if(h.ctx=n?n(e,p,((t,r,...n)=>{const i=n.length?n[0]:r;return h.ctx&&s(h.ctx[t],h.ctx[t]=i)&&(!h.skip_bound&&h.bound[t]&&h.bound[t](i),f&&yt(e,t)),r})):[],h.update(),f=!0,a(h.before_update),h.fragment=!!i&&i(h.ctx),r.target){if(r.hydrate){const t=function(t){return Array.from(t.childNodes)}(r.target);h.fragment&&h.fragment.l(t),t.forEach(S)}else h.fragment&&h.fragment.c();r.intro&&st(e.$$.fragment),dt(e,r.target,r.anchor),et()}U(c)}class vt{$destroy(){mt(this,1),this.$destroy=t}$on(t,e){const r=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return r.push(e),()=>{const t=r.indexOf(e);-1!==t&&r.splice(t,1)}}$set(t){var e;this.$$set&&(e=t,0!==Object.keys(e).length)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const _t={light:{text:"#222",muted:"#777",pale:"#f0f0f0",background:"#fff"},dark:{text:"#fff",muted:"#bbb",pale:"#333",background:"#222"}},xt=[];function bt(e,r=t){let n;const i=[];function o(t){if(u(e,t)&&(e=t,n)){const t=!xt.length;for(let t=0;t<i.length;t+=1){const r=i[t];r[1](),xt.push(r,e)}if(t){for(let t=0;t<xt.length;t+=2)xt[t][0](xt[t+1]);xt.length=0}}}return{set:o,update:function(t){o(t(e))},subscribe:function(a,s=t){const u=[a,s];return i.push(u),1===i.length&&(n=r(o)||t),a(e),()=>{const t=i.indexOf(u);-1!==t&&i.splice(t,1),0===i.length&&(n(),n=null)}}}}function wt(e,r,n){const i=!Array.isArray(e),o=i?[e]:e,u=r.length<2;return{subscribe:bt(n,(e=>{let n=!1;const c=[];let p=0,h=t;const f=()=>{if(p)return;h();const n=r(i?c[0]:c,e);u?e(n):h=s(n)?n:t},d=o.map(((t,e)=>l(t,(t=>{c[e]=t,p&=~(1<<e),n&&f()}),(()=>{p|=1<<e}))));return n=!0,f(),function(){a(d),h()}})).subscribe}}function St(t){return 0===(e=t)||e?Array.isArray(t)?e=>t.map((t=>"function"!=typeof t?e[t]:t(e))):"function"!=typeof t?e=>e[t]:t:null;var e}function At(t){return function(t){const e={};for(const r of t){if(Object(r)!==r)throw new TypeError("iterable for fromEntries should yield objects");const{0:t,1:n}=r;Object.defineProperty(e,t,{configurable:!0,enumerable:!0,writable:!0,value:n})}return e}(Object.entries(t).filter((([t,e])=>void 0!==e)))}function Et(t,e){if(!Array.isArray(t)||0===t.length)return null;const r={},n=e.length;let i,o,a,s,u;if(!n)return null;{for(i=0;i<n;i+=1){const n=e[i].accessor(t[0]);null==n||!0===Number.isNaN(n)?r[e[i].field]=[1/0,-1/0]:r[e[i].field]=Array.isArray(n)?n:[n,n]}const l=t.length;for(i=0;i<l;i+=1)for(o=0;o<n;o+=1)if(a=e[o],s=a.accessor(t[i]),u=a.field,Array.isArray(s)){const t=s.length;for(let e=0;e<t;e+=1)void 0!==s[e]&&null!==s[e]&&!1===Number.isNaN(s[e])&&(s[e]<r[u][0]&&(r[u][0]=s[e]),s[e]>r[u][1]&&(r[u][1]=s[e]))}else null!=s&&!1===Number.isNaN(s)&&(s<r[u][0]&&(r[u][0]=s),s>r[u][1]&&(r[u][1]=s))}return r}function Tt(t=[],e){return!0===Array.isArray(e)?e.map(((e,r)=>null===e?t[r]:e)):t}function kt(t){return function([e,r]){return e?Tt(e[t],r):r}}function It(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function zt(t){let e=t,r=t;function n(t,e,n,i){for(null==n&&(n=0),null==i&&(i=t.length);n<i;){const o=n+i>>>1;r(t[o],e)<0?n=o+1:i=o}return n}return 1===t.length&&(e=(e,r)=>t(e)-r,r=function(t){return(e,r)=>It(t(e),r)}(t)),{left:n,center:function(t,r,i,o){null==i&&(i=0),null==o&&(o=t.length);const a=n(t,r,i,o-1);return a>i&&e(t[a-1],r)>-e(t[a],r)?a-1:a},right:function(t,e,n,i){for(null==n&&(n=0),null==i&&(i=t.length);n<i;){const o=n+i>>>1;r(t[o],e)>0?i=o:n=o+1}return n}}}const Ct=zt(It).right;zt((function(t){return null===t?NaN:+t})).center;var Pt=Math.sqrt(50),Mt=Math.sqrt(10),Dt=Math.sqrt(2);function Lt(t,e,r){var n=(e-t)/Math.max(0,r),i=Math.floor(Math.log(n)/Math.LN10),o=n/Math.pow(10,i);return i>=0?(o>=Pt?10:o>=Mt?5:o>=Dt?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(o>=Pt?10:o>=Mt?5:o>=Dt?2:1)}function Bt(t,e,r){t=+t,e=+e,r=(i=arguments.length)<2?(e=t,t=0,1):i<3?1:+r;for(var n=-1,i=0|Math.max(0,Math.ceil((e-t)/r)),o=new Array(i);++n<i;)o[n]=t+n*r;return o}function Rt(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}const Ot=Symbol("implicit");function Ft(){var t=new Map,e=[],r=[],n=Ot;function i(i){var o=i+"",a=t.get(o);if(!a){if(n!==Ot)return n;t.set(o,a=e.push(i))}return r[(a-1)%r.length]}return i.domain=function(r){if(!arguments.length)return e.slice();e=[],t=new Map;for(const n of r){const r=n+"";t.has(r)||t.set(r,e.push(n))}return i},i.range=function(t){return arguments.length?(r=Array.from(t),i):r.slice()},i.unknown=function(t){return arguments.length?(n=t,i):n},i.copy=function(){return Ft(e,r).unknown(n)},Rt.apply(i,arguments),i}function Vt(){var t,e,r=Ft().unknown(void 0),n=r.domain,i=r.range,o=0,a=1,s=!1,u=0,l=0,c=.5;function p(){var r=n().length,p=a<o,h=p?a:o,f=p?o:a;t=(f-h)/Math.max(1,r-u+2*l),s&&(t=Math.floor(t)),h+=(f-h-t*(r-u))*c,e=t*(1-u),s&&(h=Math.round(h),e=Math.round(e));var d=Bt(r).map((function(e){return h+t*e}));return i(p?d.reverse():d)}return delete r.unknown,r.domain=function(t){return arguments.length?(n(t),p()):n()},r.range=function(t){return arguments.length?([o,a]=t,o=+o,a=+a,p()):[o,a]},r.rangeRound=function(t){return[o,a]=t,o=+o,a=+a,s=!0,p()},r.bandwidth=function(){return e},r.step=function(){return t},r.round=function(t){return arguments.length?(s=!!t,p()):s},r.padding=function(t){return arguments.length?(u=Math.min(1,l=+t),p()):u},r.paddingInner=function(t){return arguments.length?(u=Math.min(1,t),p()):u},r.paddingOuter=function(t){return arguments.length?(l=+t,p()):l},r.align=function(t){return arguments.length?(c=Math.max(0,Math.min(1,t)),p()):c},r.copy=function(){return Vt(n(),[o,a]).round(s).paddingInner(u).paddingOuter(l).align(c)},Rt.apply(p(),arguments)}function Ut(t,e,r){t.prototype=e.prototype=r,r.constructor=t}function jt(t,e){var r=Object.create(t.prototype);for(var n in e)r[n]=e[n];return r}function Nt(){}var qt=.7,$t=1/qt,Zt="\\s*([+-]?\\d+)\\s*",Gt="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",Wt="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Xt=/^#([0-9a-f]{3,8})$/,Ht=new RegExp("^rgb\\("+[Zt,Zt,Zt]+"\\)$"),Kt=new RegExp("^rgb\\("+[Wt,Wt,Wt]+"\\)$"),Yt=new RegExp("^rgba\\("+[Zt,Zt,Zt,Gt]+"\\)$"),Jt=new RegExp("^rgba\\("+[Wt,Wt,Wt,Gt]+"\\)$"),Qt=new RegExp("^hsl\\("+[Gt,Wt,Wt]+"\\)$"),te=new RegExp("^hsla\\("+[Gt,Wt,Wt,Gt]+"\\)$"),ee={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};function re(){return this.rgb().formatHex()}function ne(){return this.rgb().formatRgb()}function ie(t){var e,r;return t=(t+"").trim().toLowerCase(),(e=Xt.exec(t))?(r=e[1].length,e=parseInt(e[1],16),6===r?oe(e):3===r?new le(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===r?ae(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===r?ae(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=Ht.exec(t))?new le(e[1],e[2],e[3],1):(e=Kt.exec(t))?new le(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=Yt.exec(t))?ae(e[1],e[2],e[3],e[4]):(e=Jt.exec(t))?ae(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=Qt.exec(t))?fe(e[1],e[2]/100,e[3]/100,1):(e=te.exec(t))?fe(e[1],e[2]/100,e[3]/100,e[4]):ee.hasOwnProperty(t)?oe(ee[t]):"transparent"===t?new le(NaN,NaN,NaN,0):null}function oe(t){return new le(t>>16&255,t>>8&255,255&t,1)}function ae(t,e,r,n){return n<=0&&(t=e=r=NaN),new le(t,e,r,n)}function se(t){return t instanceof Nt||(t=ie(t)),t?new le((t=t.rgb()).r,t.g,t.b,t.opacity):new le}function ue(t,e,r,n){return 1===arguments.length?se(t):new le(t,e,r,null==n?1:n)}function le(t,e,r,n){this.r=+t,this.g=+e,this.b=+r,this.opacity=+n}function ce(){return"#"+he(this.r)+he(this.g)+he(this.b)}function pe(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}function he(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function fe(t,e,r,n){return n<=0?t=e=r=NaN:r<=0||r>=1?t=e=NaN:e<=0&&(t=NaN),new me(t,e,r,n)}function de(t){if(t instanceof me)return new me(t.h,t.s,t.l,t.opacity);if(t instanceof Nt||(t=ie(t)),!t)return new me;if(t instanceof me)return t;var e=(t=t.rgb()).r/255,r=t.g/255,n=t.b/255,i=Math.min(e,r,n),o=Math.max(e,r,n),a=NaN,s=o-i,u=(o+i)/2;return s?(a=e===o?(r-n)/s+6*(r<n):r===o?(n-e)/s+2:(e-r)/s+4,s/=u<.5?o+i:2-o-i,a*=60):s=u>0&&u<1?0:a,new me(a,s,u,t.opacity)}function me(t,e,r,n){this.h=+t,this.s=+e,this.l=+r,this.opacity=+n}function ye(t,e,r){return 255*(t<60?e+(r-e)*t/60:t<180?r:t<240?e+(r-e)*(240-t)/60:e)}Ut(Nt,ie,{copy:function(t){return Object.assign(new this.constructor,this,t)},displayable:function(){return this.rgb().displayable()},hex:re,formatHex:re,formatHsl:function(){return de(this).formatHsl()},formatRgb:ne,toString:ne}),Ut(le,ue,jt(Nt,{brighter:function(t){return t=null==t?$t:Math.pow($t,t),new le(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?qt:Math.pow(qt,t),new le(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:ce,formatHex:ce,formatRgb:pe,toString:pe})),Ut(me,(function(t,e,r,n){return 1===arguments.length?de(t):new me(t,e,r,null==n?1:n)}),jt(Nt,{brighter:function(t){return t=null==t?$t:Math.pow($t,t),new me(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?qt:Math.pow(qt,t),new me(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*e,i=2*r-n;return new le(ye(t>=240?t-240:t+120,i,n),ye(t,i,n),ye(t<120?t+240:t-120,i,n),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===t?")":", "+t+")")}}));var ge=t=>()=>t;function ve(t){return 1==(t=+t)?_e:function(e,r){return r-e?function(t,e,r){return t=Math.pow(t,r),e=Math.pow(e,r)-t,r=1/r,function(n){return Math.pow(t+n*e,r)}}(e,r,t):ge(isNaN(e)?r:e)}}function _e(t,e){var r=e-t;return r?function(t,e){return function(r){return t+r*e}}(t,r):ge(isNaN(t)?e:t)}var xe=function t(e){var r=ve(e);function n(t,e){var n=r((t=ue(t)).r,(e=ue(e)).r),i=r(t.g,e.g),o=r(t.b,e.b),a=_e(t.opacity,e.opacity);return function(e){return t.r=n(e),t.g=i(e),t.b=o(e),t.opacity=a(e),t+""}}return n.gamma=t,n}(1);function be(t,e){e||(e=[]);var r,n=t?Math.min(e.length,t.length):0,i=e.slice();return function(o){for(r=0;r<n;++r)i[r]=t[r]*(1-o)+e[r]*o;return i}}function we(t,e){var r,n=e?e.length:0,i=t?Math.min(n,t.length):0,o=new Array(i),a=new Array(n);for(r=0;r<i;++r)o[r]=ze(t[r],e[r]);for(;r<n;++r)a[r]=e[r];return function(t){for(r=0;r<i;++r)a[r]=o[r](t);return a}}function Se(t,e){var r=new Date;return t=+t,e=+e,function(n){return r.setTime(t*(1-n)+e*n),r}}function Ae(t,e){return t=+t,e=+e,function(r){return t*(1-r)+e*r}}function Ee(t,e){var r,n={},i={};for(r in null!==t&&"object"==typeof t||(t={}),null!==e&&"object"==typeof e||(e={}),e)r in t?n[r]=ze(t[r],e[r]):i[r]=e[r];return function(t){for(r in n)i[r]=n[r](t);return i}}var Te=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ke=new RegExp(Te.source,"g");function Ie(t,e){var r,n,i,o=Te.lastIndex=ke.lastIndex=0,a=-1,s=[],u=[];for(t+="",e+="";(r=Te.exec(t))&&(n=ke.exec(e));)(i=n.index)>o&&(i=e.slice(o,i),s[a]?s[a]+=i:s[++a]=i),(r=r[0])===(n=n[0])?s[a]?s[a]+=n:s[++a]=n:(s[++a]=null,u.push({i:a,x:Ae(r,n)})),o=ke.lastIndex;return o<e.length&&(i=e.slice(o),s[a]?s[a]+=i:s[++a]=i),s.length<2?u[0]?function(t){return function(e){return t(e)+""}}(u[0].x):function(t){return function(){return t}}(e):(e=u.length,function(t){for(var r,n=0;n<e;++n)s[(r=u[n]).i]=r.x(t);return s.join("")})}function ze(t,e){var r,n,i=typeof e;return null==e||"boolean"===i?ge(e):("number"===i?Ae:"string"===i?(r=ie(e))?(e=r,xe):Ie:e instanceof ie?xe:e instanceof Date?Se:(n=e,!ArrayBuffer.isView(n)||n instanceof DataView?Array.isArray(e)?we:"function"!=typeof e.valueOf&&"function"!=typeof e.toString||isNaN(e)?Ee:Ae:be))(t,e)}function Ce(t,e){return t=+t,e=+e,function(r){return Math.round(t*(1-r)+e*r)}}function Pe(t){return+t}var Me=[0,1];function De(t){return t}function Le(t,e){return(e-=t=+t)?function(r){return(r-t)/e}:(r=isNaN(e)?NaN:.5,function(){return r});var r}function Be(t,e,r){var n=t[0],i=t[1],o=e[0],a=e[1];return i<n?(n=Le(i,n),o=r(a,o)):(n=Le(n,i),o=r(o,a)),function(t){return o(n(t))}}function Re(t,e,r){var n=Math.min(t.length,e.length)-1,i=new Array(n),o=new Array(n),a=-1;for(t[n]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++a<n;)i[a]=Le(t[a],t[a+1]),o[a]=r(e[a],e[a+1]);return function(e){var r=Ct(t,e,1,n)-1;return o[r](i[r](e))}}function Oe(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function Fe(){var t,e,r,n,i,o,a=Me,s=Me,u=ze,l=De;function c(){var t=Math.min(a.length,s.length);return l!==De&&(l=function(t,e){var r;return t>e&&(r=t,t=e,e=r),function(r){return Math.max(t,Math.min(e,r))}}(a[0],a[t-1])),n=t>2?Re:Be,i=o=null,p}function p(e){return isNaN(e=+e)?r:(i||(i=n(a.map(t),s,u)))(t(l(e)))}return p.invert=function(r){return l(e((o||(o=n(s,a.map(t),Ae)))(r)))},p.domain=function(t){return arguments.length?(a=Array.from(t,Pe),c()):a.slice()},p.range=function(t){return arguments.length?(s=Array.from(t),c()):s.slice()},p.rangeRound=function(t){return s=Array.from(t),u=Ce,c()},p.clamp=function(t){return arguments.length?(l=!!t||De,c()):l!==De},p.interpolate=function(t){return arguments.length?(u=t,c()):u},p.unknown=function(t){return arguments.length?(r=t,p):r},function(r,n){return t=r,e=n,c()}}function Ve(){return Fe()(De,De)}function Ue(t,e){if((r=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var r,n=t.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+t.slice(r+1)]}function je(t){return(t=Ue(Math.abs(t)))?t[1]:NaN}var Ne,qe=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function $e(t){if(!(e=qe.exec(t)))throw new Error("invalid format: "+t);var e;return new Ze({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}function Ze(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}function Ge(t,e){var r=Ue(t,e);if(!r)return t+"";var n=r[0],i=r[1];return i<0?"0."+new Array(-i).join("0")+n:n.length>i+1?n.slice(0,i+1)+"."+n.slice(i+1):n+new Array(i-n.length+2).join("0")}$e.prototype=Ze.prototype,Ze.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var We={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>Ge(100*t,e),r:Ge,s:function(t,e){var r=Ue(t,e);if(!r)return t+"";var n=r[0],i=r[1],o=i-(Ne=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,a=n.length;return o===a?n:o>a?n+new Array(o-a+1).join("0"):o>0?n.slice(0,o)+"."+n.slice(o):"0."+new Array(1-o).join("0")+Ue(t,Math.max(0,e+o-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function Xe(t){return t}var He,Ke,Ye,Je=Array.prototype.map,Qe=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function tr(t){var e,r,n=void 0===t.grouping||void 0===t.thousands?Xe:(e=Je.call(t.grouping,Number),r=t.thousands+"",function(t,n){for(var i=t.length,o=[],a=0,s=e[0],u=0;i>0&&s>0&&(u+s+1>n&&(s=Math.max(1,n-u)),o.push(t.substring(i-=s,i+s)),!((u+=s+1)>n));)s=e[a=(a+1)%e.length];return o.reverse().join(r)}),i=void 0===t.currency?"":t.currency[0]+"",o=void 0===t.currency?"":t.currency[1]+"",a=void 0===t.decimal?".":t.decimal+"",s=void 0===t.numerals?Xe:function(t){return function(e){return e.replace(/[0-9]/g,(function(e){return t[+e]}))}}(Je.call(t.numerals,String)),u=void 0===t.percent?"%":t.percent+"",l=void 0===t.minus?"−":t.minus+"",c=void 0===t.nan?"NaN":t.nan+"";function p(t){var e=(t=$e(t)).fill,r=t.align,p=t.sign,h=t.symbol,f=t.zero,d=t.width,m=t.comma,y=t.precision,g=t.trim,v=t.type;"n"===v?(m=!0,v="g"):We[v]||(void 0===y&&(y=12),g=!0,v="g"),(f||"0"===e&&"="===r)&&(f=!0,e="0",r="=");var _="$"===h?i:"#"===h&&/[boxX]/.test(v)?"0"+v.toLowerCase():"",x="$"===h?o:/[%p]/.test(v)?u:"",b=We[v],w=/[defgprs%]/.test(v);function S(t){var i,o,u,h=_,S=x;if("c"===v)S=b(t)+S,t="";else{var A=(t=+t)<0||1/t<0;if(t=isNaN(t)?c:b(Math.abs(t),y),g&&(t=function(t){t:for(var e,r=t.length,n=1,i=-1;n<r;++n)switch(t[n]){case".":i=e=n;break;case"0":0===i&&(i=n),e=n;break;default:if(!+t[n])break t;i>0&&(i=0)}return i>0?t.slice(0,i)+t.slice(e+1):t}(t)),A&&0==+t&&"+"!==p&&(A=!1),h=(A?"("===p?p:l:"-"===p||"("===p?"":p)+h,S=("s"===v?Qe[8+Ne/3]:"")+S+(A&&"("===p?")":""),w)for(i=-1,o=t.length;++i<o;)if(48>(u=t.charCodeAt(i))||u>57){S=(46===u?a+t.slice(i+1):t.slice(i))+S,t=t.slice(0,i);break}}m&&!f&&(t=n(t,1/0));var E=h.length+t.length+S.length,T=E<d?new Array(d-E+1).join(e):"";switch(m&&f&&(t=n(T+t,T.length?d-S.length:1/0),T=""),r){case"<":t=h+t+S+T;break;case"=":t=h+T+t+S;break;case"^":t=T.slice(0,E=T.length>>1)+h+t+S+T.slice(E);break;default:t=T+h+t+S}return s(t)}return y=void 0===y?6:/[gprs]/.test(v)?Math.max(1,Math.min(21,y)):Math.max(0,Math.min(20,y)),S.toString=function(){return t+""},S}return{format:p,formatPrefix:function(t,e){var r=p(((t=$e(t)).type="f",t)),n=3*Math.max(-8,Math.min(8,Math.floor(je(e)/3))),i=Math.pow(10,-n),o=Qe[8+n/3];return function(t){return r(i*t)+o}}}}function er(t,e,r,n){var i,o=function(t,e,r){var n=Math.abs(e-t)/Math.max(0,r),i=Math.pow(10,Math.floor(Math.log(n)/Math.LN10)),o=n/i;return o>=Pt?i*=10:o>=Mt?i*=5:o>=Dt&&(i*=2),e<t?-i:i}(t,e,r);switch((n=$e(null==n?",f":n)).type){case"s":var a=Math.max(Math.abs(t),Math.abs(e));return null!=n.precision||isNaN(i=function(t,e){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(je(e)/3)))-je(Math.abs(t)))}(o,a))||(n.precision=i),Ye(n,a);case"":case"e":case"g":case"p":case"r":null!=n.precision||isNaN(i=function(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,je(e)-je(t))+1}(o,Math.max(Math.abs(t),Math.abs(e))))||(n.precision=i-("e"===n.type));break;case"f":case"%":null!=n.precision||isNaN(i=function(t){return Math.max(0,-je(Math.abs(t)))}(o))||(n.precision=i-2*("%"===n.type))}return Ke(n)}function rr(t){var e=t.domain;return t.ticks=function(t){var r=e();return function(t,e,r){var n,i,o,a,s=-1;if(r=+r,(t=+t)==(e=+e)&&r>0)return[t];if((n=e<t)&&(i=t,t=e,e=i),0===(a=Lt(t,e,r))||!isFinite(a))return[];if(a>0)for(t=Math.ceil(t/a),e=Math.floor(e/a),o=new Array(i=Math.ceil(e-t+1));++s<i;)o[s]=(t+s)*a;else for(a=-a,t=Math.ceil(t*a),e=Math.floor(e*a),o=new Array(i=Math.ceil(e-t+1));++s<i;)o[s]=(t+s)/a;return n&&o.reverse(),o}(r[0],r[r.length-1],null==t?10:t)},t.tickFormat=function(t,r){var n=e();return er(n[0],n[n.length-1],null==t?10:t,r)},t.nice=function(r){null==r&&(r=10);var n,i,o=e(),a=0,s=o.length-1,u=o[a],l=o[s],c=10;for(l<u&&(i=u,u=l,l=i,i=a,a=s,s=i);c-- >0;){if((i=Lt(u,l,r))===n)return o[a]=u,o[s]=l,e(o);if(i>0)u=Math.floor(u/i)*i,l=Math.ceil(l/i)*i;else{if(!(i<0))break;u=Math.ceil(u*i)/i,l=Math.floor(l*i)/i}n=i}return t},t}function nr(){var t=Ve();return t.copy=function(){return Oe(t,nr())},Rt.apply(t,arguments),rr(t)}function ir(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function or(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function ar(t){return t<0?-t*t:t*t}function sr(t){var e=t(De,De),r=1;function n(){return 1===r?t(De,De):.5===r?t(or,ar):t(ir(r),ir(1/r))}return e.exponent=function(t){return arguments.length?(r=+t,n()):r},rr(e)}function ur(){var t=sr(Fe());return t.copy=function(){return Oe(t,ur()).exponent(t.exponent())},Rt.apply(t,arguments),t}He=tr({thousands:",",grouping:[3],currency:["$",""]}),Ke=He.format,Ye=He.formatPrefix;var lr={x:nr,y:nr,z:nr,r:function(){return ur.apply(null,arguments).exponent(.5)}};function cr(t){return t}function pr(t){return e=>Math.log(t*e)}function hr(t){return e=>t*Math.exp(e)}function fr(t){return e=>Math.sign(e)*Math.expm1(Math.abs(e))*t}function dr(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function mr(t,e){if("function"!=typeof t.range)throw new Error("Scale method `range` must be a function");if("function"!=typeof t.domain)throw new Error("Scale method `domain` must be a function");if(!Array.isArray(e))return t.domain();2!==t.domain().length&&console.warn("[LayerCake] The scale is expected to have a domain of length 2 to use padding. Are you sure you want to use padding? Your scale's domain is:",t.domain()),2!==t.range().length&&console.warn("[LayerCake] The scale is expected to have a range of length 2 to use padding. Are you sure you want to use padding? Your scale's range is:",t.range());const{lift:r,ground:n}=function(t){const e=function(t){return t.constant?"symlog":t.base?"log":t.exponent?.5===t.exponent()?"sqrt":"pow":"other"}(t);if("log"===e){const r=Math.sign(t.domain()[0]);return{lift:pr(r),ground:hr(r),scaleType:e}}if("pow"===e){const t=1;return{lift:dr(t),ground:dr(1/t),scaleType:e}}if("sqrt"===e){const t=.5;return{lift:dr(t),ground:dr(1/t),scaleType:e}}if("symlog"===e){const t=1;return{lift:(r=t,t=>Math.sign(t)*Math.log1p(Math.abs(t/r))),ground:fr(t),scaleType:e}}var r;return{lift:cr,ground:cr,scaleType:e}}(t),i=t.domain()[0],o="[object Date]"===Object.prototype.toString.call(i),[a,s]=t.domain().map((t=>r(o?t.getTime():t))),[u,l]=t.range(),c=e[0]||0,p=e[1]||0,h=(s-a)/(Math.abs(l-u)-c-p);return[a-c*h,p*h+s].map((t=>n(o?new Date(t):t)))}function yr(t){return function([e,r,n,i,o,a,s,u,l,c]){if(null===r)return null;const p=function(t,e,r,n,i,o){return i?"function"==typeof i?i({width:e,height:r}):i:function(t,e,r,n,i){let o,a;return!0===i?(o=0,a=100):(o="r"===t?1:0,a="y"===t?r:"r"===t?25:e),!0===n?[a,o]:[o,a]}(t,e,r,n,o)}(t,s,u,a,l,c),h=e===lr[t]?e():e.copy();return h.domain(Tt(r[t],n)).range(p),i&&h.domain(mr(h,i)),!0===o&&("function"==typeof h.nice?h.nice():console.error(`[Layer Cake] You set \`${t}Nice: true\` but the ${t}Scale does not have a \`.nice\` method. Ignoring...`)),h}}function gr([t,e]){return r=>{const n=t(r);return Array.isArray(n)?n.map((t=>e(t))):e(n)}}function vr([t]){if("function"==typeof t){if("function"==typeof t.range)return t.range();console.error("[LayerCake] Your scale doesn't have a `.range` method?")}return null}var _r={x:!1,y:!0,z:!1,r:!1};const xr=t=>({width:32&t[0],height:64&t[0],aspectRatio:128&t[0],containerWidth:256&t[0],containerHeight:512&t[0]}),br=t=>({width:t[5],height:t[6],aspectRatio:t[7],containerWidth:t[8],containerHeight:t[9]});function wr(t){let e,r,n,i;const o=t[52].default,a=p(o,t,t[51],br);return{c(){e=A("div"),a&&a.c(),C(e,"class","layercake-container svelte-vhzpsp"),C(e,"style",r="\n\t\t\tposition:"+t[4]+";\n\t\t\t"+("absolute"===t[4]?"top:0;right:0;bottom:0;left:0;":"")+"\n\t\t\t"+(!1===t[3]?"pointer-events:none;":"")+"\n\t\t"),Y((()=>t[53].call(e)))},m(r,o){w(r,e,o),a&&a.m(e,null),n=F(e,t[53].bind(e)),i=!0},p(t,n){a&&a.p&&992&n[0]|1048576&n[1]&&f(a,o,t,t[51],n,xr,br),(!i||24&n[0]&&r!==(r="\n\t\t\tposition:"+t[4]+";\n\t\t\t"+("absolute"===t[4]?"top:0;right:0;bottom:0;left:0;":"")+"\n\t\t\t"+(!1===t[3]?"pointer-events:none;":"")+"\n\t\t"))&&C(e,"style",r)},i(t){i||(st(a,t),i=!0)},o(t){ut(a,t),i=!1},d(t){t&&S(e),a&&a.d(t),n()}}}function Sr(t){let e,r,n=(!0===t[2]||"undefined"!=typeof window)&&wr(t);return{c(){n&&n.c(),e=I()},m(t,i){n&&n.m(t,i),w(t,e,i),r=!0},p(t,r){!0===t[2]||"undefined"!=typeof window?n?(n.p(t,r),4&r[0]&&st(n,1)):(n=wr(t),n.c(),st(n,1),n.m(e.parentNode,e)):n&&(ot(),ut(n,1,1,(()=>{n=null})),at())},i(t){r||(st(n),r=!0)},o(t){ut(n),r=!1},d(t){n&&n.d(t),t&&S(e)}}}function Ar(t,e,r){let n,i,o,a,s,{$$slots:u={},$$scope:l}=e,{ssr:p=!1}=e,{pointerEvents:h=!0}=e,{position:f="relative"}=e,{percentRange:d=!1}=e,{width:m}=e,{height:y}=e,{containerWidth:g=m||100}=e,{containerHeight:v=y||100}=e,{x:_}=e,{y:x}=e,{z:b}=e,{r:w}=e,{custom:S={}}=e,{data:A=[]}=e,{xDomain:E}=e,{yDomain:T}=e,{zDomain:k}=e,{rDomain:I}=e,{xNice:z=!1}=e,{yNice:C=!1}=e,{zNice:P=!1}=e,{rNice:M=!1}=e,{xReverse:D=_r.x}=e,{yReverse:L=_r.y}=e,{zReverse:B=_r.z}=e,{rReverse:R=_r.r}=e,{xPadding:O}=e,{yPadding:F}=e,{zPadding:V}=e,{rPadding:U}=e,{xScale:j=lr.x}=e,{yScale:N=lr.y}=e,{zScale:$=lr.y}=e,{rScale:Z=lr.r}=e,{xRange:G}=e,{yRange:W}=e,{zRange:X}=e,{rRange:H}=e,{padding:K={}}=e,{extents:Y={}}=e,{flatData:J}=e;const Q={},tt=bt(),et=bt();c(t,et,(t=>r(8,a=t)));const rt=bt();c(t,rt,(t=>r(9,s=t)));const nt=bt(),it=bt(),ot=bt(),at=bt(),st=bt(),ut=bt(),lt=bt(),ct=bt(),pt=bt(),ht=bt(),ft=bt(),dt=bt(),mt=bt(),yt=bt(),gt=bt(),vt=bt(),_t=bt(),xt=bt(),Tt=bt(),It=bt(),zt=bt(),Ct=bt(),Pt=bt(),Mt=bt(),Dt=bt(),Lt=bt(),Bt=bt(),Rt=bt(),Ot=bt(),Ft=bt(),Vt=bt(),Ut=bt(),jt=bt(),Nt=bt(Q),qt=wt([nt,it,ot,at],(([t,e,r,n])=>[{field:"x",accessor:t},{field:"y",accessor:e},{field:"z",accessor:r},{field:"r",accessor:n}].filter((t=>t.accessor)))),$t=wt([Vt,et,rt],(([t])=>Object.assign({top:0,right:0,bottom:0,left:0},t))),Zt=wt([et,rt,$t],(([t,e,r])=>{const n={};return n.top=r.top,n.right=t-r.right,n.bottom=e-r.bottom,n.left=r.left,n.width=n.right-n.left,n.height=n.bottom-n.top,n.width<0&&n.height<0?console.error("[LayerCake] Target div has negative width and height. Did you forget to set a width or height on the container?"):n.width<0?console.error("[LayerCake] Target div has a negative width. Did you forget to set that CSS on the container?"):n.height<0&&console.error("[LayerCake] Target div has negative height. Did you forget to set that CSS on the container?"),n})),Gt=wt([Zt],(([t])=>t.width));c(t,Gt,(t=>r(5,n=t)));const Wt=wt([Zt],(([t])=>t.height));c(t,Wt,(t=>r(6,i=t)));const Xt=wt([Ut,qt,jt],(([t,e,r])=>({...Et(t,e.filter((t=>!r[t.field]))),...r}))),Ht=wt([Xt,lt],kt("x")),Kt=wt([Xt,ct],kt("y")),Yt=wt([Xt,pt],kt("z")),Jt=wt([Xt,ht],kt("r")),Qt=wt([Pt,Xt,Ht,Tt,ft,gt,Gt,Wt,Bt,tt],yr("x")),te=wt([nt,Qt],gr),ee=wt([Mt,Xt,Kt,It,dt,vt,Gt,Wt,Rt,tt],yr("y")),re=wt([it,ee],gr),ne=wt([Dt,Xt,Yt,zt,mt,_t,Gt,Wt,Ot,tt],yr("z")),ie=wt([ot,ne],gr),oe=wt([Lt,Xt,Jt,Ct,yt,xt,Gt,Wt,Ft,tt],yr("r")),ae=wt([at,oe],gr),se=wt([Qt],vr),ue=wt([ee],vr),le=wt([ne],vr),ce=wt([oe],vr),pe=wt([Gt,Wt],(([t,e,r])=>e/r));let he;return c(t,pe,(t=>r(7,o=t))),t.$$set=t=>{"ssr"in t&&r(2,p=t.ssr),"pointerEvents"in t&&r(3,h=t.pointerEvents),"position"in t&&r(4,f=t.position),"percentRange"in t&&r(15,d=t.percentRange),"width"in t&&r(16,m=t.width),"height"in t&&r(17,y=t.height),"containerWidth"in t&&r(0,g=t.containerWidth),"containerHeight"in t&&r(1,v=t.containerHeight),"x"in t&&r(18,_=t.x),"y"in t&&r(19,x=t.y),"z"in t&&r(20,b=t.z),"r"in t&&r(21,w=t.r),"custom"in t&&r(22,S=t.custom),"data"in t&&r(23,A=t.data),"xDomain"in t&&r(24,E=t.xDomain),"yDomain"in t&&r(25,T=t.yDomain),"zDomain"in t&&r(26,k=t.zDomain),"rDomain"in t&&r(27,I=t.rDomain),"xNice"in t&&r(28,z=t.xNice),"yNice"in t&&r(29,C=t.yNice),"zNice"in t&&r(30,P=t.zNice),"rNice"in t&&r(31,M=t.rNice),"xReverse"in t&&r(32,D=t.xReverse),"yReverse"in t&&r(33,L=t.yReverse),"zReverse"in t&&r(34,B=t.zReverse),"rReverse"in t&&r(35,R=t.rReverse),"xPadding"in t&&r(36,O=t.xPadding),"yPadding"in t&&r(37,F=t.yPadding),"zPadding"in t&&r(38,V=t.zPadding),"rPadding"in t&&r(39,U=t.rPadding),"xScale"in t&&r(40,j=t.xScale),"yScale"in t&&r(41,N=t.yScale),"zScale"in t&&r(42,$=t.zScale),"rScale"in t&&r(43,Z=t.rScale),"xRange"in t&&r(44,G=t.xRange),"yRange"in t&&r(45,W=t.yRange),"zRange"in t&&r(46,X=t.zRange),"rRange"in t&&r(47,H=t.rRange),"padding"in t&&r(48,K=t.padding),"extents"in t&&r(49,Y=t.extents),"flatData"in t&&r(50,J=t.flatData),"$$scope"in t&&r(51,l=t.$$scope)},t.$$.update=()=>{262144&t.$$.dirty[0]&&_&&(Q.x=_),524288&t.$$.dirty[0]&&x&&(Q.y=x),1048576&t.$$.dirty[0]&&b&&(Q.z=b),2097152&t.$$.dirty[0]&&w&&(Q.r=w),16777216&t.$$.dirty[0]&&E&&(Q.xDomain=E),33554432&t.$$.dirty[0]&&T&&(Q.yDomain=T),67108864&t.$$.dirty[0]&&k&&(Q.zDomain=k),134217728&t.$$.dirty[0]&&I&&(Q.rDomain=I),8192&t.$$.dirty[1]&&G&&(Q.xRange=G),16384&t.$$.dirty[1]&&W&&(Q.yRange=W),32768&t.$$.dirty[1]&&X&&(Q.zRange=X),65536&t.$$.dirty[1]&&H&&(Q.rRange=H),32768&t.$$.dirty[0]&&tt.set(d),1&t.$$.dirty[0]&&et.set(g),2&t.$$.dirty[0]&&rt.set(v),262144&t.$$.dirty[0]&&nt.set(St(_)),524288&t.$$.dirty[0]&&it.set(St(x)),1048576&t.$$.dirty[0]&&ot.set(St(b)),2097152&t.$$.dirty[0]&&at.set(St(w)),16777216&t.$$.dirty[0]&&lt.set(E),33554432&t.$$.dirty[0]&&ct.set(T),67108864&t.$$.dirty[0]&&pt.set(k),134217728&t.$$.dirty[0]&&ht.set(I),4194304&t.$$.dirty[0]&&st.set(S),8388608&t.$$.dirty[0]&&ut.set(A),268435456&t.$$.dirty[0]&&ft.set(z),536870912&t.$$.dirty[0]&&dt.set(C),1073741824&t.$$.dirty[0]&&mt.set(P),1&t.$$.dirty[1]&&yt.set(M),2&t.$$.dirty[1]&&gt.set(D),4&t.$$.dirty[1]&&vt.set(L),8&t.$$.dirty[1]&&_t.set(B),16&t.$$.dirty[1]&&xt.set(R),32&t.$$.dirty[1]&&Tt.set(O),64&t.$$.dirty[1]&&It.set(F),128&t.$$.dirty[1]&&zt.set(V),256&t.$$.dirty[1]&&Ct.set(U),512&t.$$.dirty[1]&&Pt.set(j),1024&t.$$.dirty[1]&&Mt.set(N),2048&t.$$.dirty[1]&&Dt.set($),4096&t.$$.dirty[1]&&Lt.set(Z),8192&t.$$.dirty[1]&&Bt.set(G),16384&t.$$.dirty[1]&&Rt.set(W),32768&t.$$.dirty[1]&&Ot.set(X),65536&t.$$.dirty[1]&&Ft.set(H),131072&t.$$.dirty[1]&&Vt.set(K),262144&t.$$.dirty[1]&&jt.set(At(Y)),8388608&t.$$.dirty[0]|524288&t.$$.dirty[1]&&Ut.set(J||A),16777216&t.$$.dirty[1]&&q("LayerCake",he)},r(55,he={activeGetters:qt,width:Gt,height:Wt,percentRange:tt,aspectRatio:pe,containerWidth:et,containerHeight:rt,x:nt,y:it,z:ot,r:at,custom:st,data:ut,xNice:ft,yNice:dt,zNice:mt,rNice:yt,xReverse:gt,yReverse:vt,zReverse:_t,rReverse:xt,xPadding:Tt,yPadding:It,zPadding:zt,rPadding:Ct,padding:$t,flatData:Ut,extents:Xt,xDomain:Ht,yDomain:Kt,zDomain:Yt,rDomain:Jt,xRange:se,yRange:ue,zRange:le,rRange:ce,config:Nt,xScale:Qt,xGet:te,yScale:ee,yGet:re,zScale:ne,zGet:ie,rScale:oe,rGet:ae}),[g,v,p,h,f,n,i,o,a,s,et,rt,Gt,Wt,pe,d,m,y,_,x,b,w,S,A,E,T,k,I,z,C,P,M,D,L,B,R,O,F,V,U,j,N,$,Z,G,W,X,H,K,Y,J,l,u,function(){g=this.clientWidth,v=this.clientHeight,r(0,g),r(1,v)}]}class Er extends vt{constructor(t){super(),gt(this,t,Ar,Sr,u,{ssr:2,pointerEvents:3,position:4,percentRange:15,width:16,height:17,containerWidth:0,containerHeight:1,x:18,y:19,z:20,r:21,custom:22,data:23,xDomain:24,yDomain:25,zDomain:26,rDomain:27,xNice:28,yNice:29,zNice:30,rNice:31,xReverse:32,yReverse:33,zReverse:34,rReverse:35,xPadding:36,yPadding:37,zPadding:38,rPadding:39,xScale:40,yScale:41,zScale:42,rScale:43,xRange:44,yRange:45,zRange:46,rRange:47,padding:48,extents:49,flatData:50},[-1,-1,-1,-1])}}function Tr(t){let e,r,n;const i=t[7].default,o=p(i,t,t[6],null);return{c(){e=A("div"),o&&o.c(),C(e,"class","layercake-layout-html svelte-1bu60uu"),C(e,"style",r="top: "+t[2].top+"px; right:"+t[2].right+"px; bottom:"+t[2].bottom+"px; left:"+t[2].left+"px;"+t[0]+t[1])},m(t,r){w(t,e,r),o&&o.m(e,null),n=!0},p(t,[a]){o&&o.p&&64&a&&f(o,i,t,t[6],a,null,null),(!n||7&a&&r!==(r="top: "+t[2].top+"px; right:"+t[2].right+"px; bottom:"+t[2].bottom+"px; left:"+t[2].left+"px;"+t[0]+t[1]))&&C(e,"style",r)},i(t){n||(st(o,t),n=!0)},o(t){ut(o,t),n=!1},d(t){t&&S(e),o&&o.d(t)}}}function kr(t,e,r){let n,{$$slots:i={},$$scope:o}=e,{zIndex:a}=e,{pointerEvents:s}=e,u="",l="";const{padding:p}=$("LayerCake");return c(t,p,(t=>r(2,n=t))),t.$$set=t=>{"zIndex"in t&&r(4,a=t.zIndex),"pointerEvents"in t&&r(5,s=t.pointerEvents),"$$scope"in t&&r(6,o=t.$$scope)},t.$$.update=()=>{16&t.$$.dirty&&r(0,u=void 0!==a?`z-index:${a};`:""),32&t.$$.dirty&&r(1,l=!1===s?"pointer-events:none;":"")},[u,l,n,p,a,s,o,i]}class Ir extends vt{constructor(t){super(),gt(this,t,kr,Tr,u,{zIndex:4,pointerEvents:5})}}const zr=t=>({}),Cr=t=>({});function Pr(t){let e,r,n,i,o,a;const s=t[12].defs,u=p(s,t,t[11],Cr),l=t[12].default,c=p(l,t,t[11],null);return{c(){e=E("svg"),r=E("defs"),u&&u.c(),n=E("g"),c&&c.c(),C(n,"transform",i="translate("+t[5].left+", "+t[5].top+")"),C(e,"class","layercake-layout-svg svelte-u84d8d"),C(e,"viewBox",t[0]),C(e,"width",t[3]),C(e,"height",t[4]),C(e,"style",o=""+(t[1]+t[2]))},m(t,i){w(t,e,i),x(e,r),u&&u.m(r,null),x(e,n),c&&c.m(n,null),a=!0},p(t,[r]){u&&u.p&&2048&r&&f(u,s,t,t[11],r,zr,Cr),c&&c.p&&2048&r&&f(c,l,t,t[11],r,null,null),(!a||32&r&&i!==(i="translate("+t[5].left+", "+t[5].top+")"))&&C(n,"transform",i),(!a||1&r)&&C(e,"viewBox",t[0]),(!a||8&r)&&C(e,"width",t[3]),(!a||16&r)&&C(e,"height",t[4]),(!a||6&r&&o!==(o=""+(t[1]+t[2])))&&C(e,"style",o)},i(t){a||(st(u,t),st(c,t),a=!0)},o(t){ut(u,t),ut(c,t),a=!1},d(t){t&&S(e),u&&u.d(t),c&&c.d(t)}}}function Mr(t,e,r){let n,i,o,{$$slots:a={},$$scope:s}=e,{viewBox:u}=e,{zIndex:l}=e,{pointerEvents:p}=e,h="",f="";const{containerWidth:d,containerHeight:m,padding:y}=$("LayerCake");return c(t,d,(t=>r(3,n=t))),c(t,m,(t=>r(4,i=t))),c(t,y,(t=>r(5,o=t))),t.$$set=t=>{"viewBox"in t&&r(0,u=t.viewBox),"zIndex"in t&&r(9,l=t.zIndex),"pointerEvents"in t&&r(10,p=t.pointerEvents),"$$scope"in t&&r(11,s=t.$$scope)},t.$$.update=()=>{512&t.$$.dirty&&r(1,h=void 0!==l?`z-index:${l};`:""),1024&t.$$.dirty&&r(2,f=!1===p?"pointer-events:none;":"")},[u,h,f,n,i,o,d,m,y,l,p,s,a]}class Dr extends vt{constructor(t){super(),gt(this,t,Mr,Pr,u,{viewBox:0,zIndex:9,pointerEvents:10})}}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function Lr(t,e,r){return t(r={path:e,exports:{},require:function(t,e){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&r.path)}},r.exports),r.exports}Lr((function(t,e){t.exports=function(){var t=function(t){return t instanceof Uint8Array||t instanceof Uint16Array||t instanceof Uint32Array||t instanceof Int8Array||t instanceof Int16Array||t instanceof Int32Array||t instanceof Float32Array||t instanceof Float64Array||t instanceof Uint8ClampedArray},e=function(t,e){for(var r=Object.keys(e),n=0;n<r.length;++n)t[r[n]]=e[r[n]];return t},r="\n";function n(t){return"undefined"!=typeof atob?atob(t):"base64:"+t}function i(t){var e=new Error("(regl) "+t);throw console.error(e),e}function o(t,e){t||i(e)}function a(t){return t?": "+t:""}function s(t,e,r){t in e||i("unknown parameter ("+t+")"+a(r)+". possible values: "+Object.keys(e).join())}function u(e,r){t(e)||i("invalid parameter type"+a(r)+". must be a typed array")}function l(t,e){switch(e){case"number":return"number"==typeof t;case"object":return"object"==typeof t;case"string":return"string"==typeof t;case"boolean":return"boolean"==typeof t;case"function":return"function"==typeof t;case"undefined":return void 0===t;case"symbol":return"symbol"==typeof t}}function c(t,e,r){l(t,e)||i("invalid parameter type"+a(r)+". expected "+e+", got "+typeof t)}function p(t,e){t>=0&&(0|t)===t||i("invalid parameter type, ("+t+")"+a(e)+". must be a nonnegative integer")}function h(t,e,r){e.indexOf(t)<0&&i("invalid value"+a(r)+". must be one of: "+e)}var f=["gl","canvas","container","attributes","pixelRatio","extensions","optionalExtensions","profile","onDone"];function d(t){Object.keys(t).forEach((function(t){f.indexOf(t)<0&&i('invalid regl constructor argument "'+t+'". must be one of '+f)}))}function m(t,e){for(t+="";t.length<e;)t=" "+t;return t}function y(){this.name="unknown",this.lines=[],this.index={},this.hasErrors=!1}function g(t,e){this.number=t,this.line=e,this.errors=[]}function v(t,e,r){this.file=t,this.line=e,this.message=r}function _(){var t=new Error,e=(t.stack||t).toString(),r=/compileProcedure.*\n\s*at.*\((.*)\)/.exec(e);if(r)return r[1];var n=/compileProcedure.*\n\s*at\s+(.*)(\n|$)/.exec(e);return n?n[1]:"unknown"}function x(){var t=new Error,e=(t.stack||t).toString(),r=/at REGLCommand.*\n\s+at.*\((.*)\)/.exec(e);if(r)return r[1];var n=/at REGLCommand.*\n\s+at\s+(.*)\n/.exec(e);return n?n[1]:"unknown"}function b(t,e){var r=t.split("\n"),i=1,o=0,a={unknown:new y,0:new y};a.unknown.name=a[0].name=e||_(),a.unknown.lines.push(new g(0,""));for(var s=0;s<r.length;++s){var u=r[s],l=/^\s*#\s*(\w+)\s+(.+)\s*$/.exec(u);if(l)switch(l[1]){case"line":var c=/(\d+)(\s+\d+)?/.exec(l[2]);c&&(i=0|c[1],c[2]&&((o=0|c[2])in a||(a[o]=new y)));break;case"define":var p=/SHADER_NAME(_B64)?\s+(.*)$/.exec(l[2]);p&&(a[o].name=p[1]?n(p[2]):p[2])}a[o].lines.push(new g(i++,u))}return Object.keys(a).forEach((function(t){var e=a[t];e.lines.forEach((function(t){e.index[t.number]=t}))})),a}function w(t){var e=[];return t.split("\n").forEach((function(t){if(!(t.length<5)){var r=/^ERROR:\s+(\d+):(\d+):\s*(.*)$/.exec(t);r?e.push(new v(0|r[1],0|r[2],r[3].trim())):t.length>0&&e.push(new v("unknown",0,t))}})),e}function S(t,e){e.forEach((function(e){var r=t[e.file];if(r){var n=r.index[e.line];if(n)return n.errors.push(e),void(r.hasErrors=!0)}t.unknown.hasErrors=!0,t.unknown.lines[0].errors.push(e)}))}function A(t,e,n,i,a){if(!t.getShaderParameter(e,t.COMPILE_STATUS)){var s=t.getShaderInfoLog(e),u=i===t.FRAGMENT_SHADER?"fragment":"vertex";P(n,"string",u+" shader source must be a string",a);var l=b(n,a),c=w(s);S(l,c),Object.keys(l).forEach((function(t){var e=l[t];if(e.hasErrors){var n=[""],i=[""];o("file number "+t+": "+e.name+"\n","color:red;text-decoration:underline;font-weight:bold"),e.lines.forEach((function(t){if(t.errors.length>0){o(m(t.number,4)+"|  ","background-color:yellow; font-weight:bold"),o(t.line+r,"color:red; background-color:yellow; font-weight:bold");var e=0;t.errors.forEach((function(n){var i=n.message,a=/^\s*'(.*)'\s*:\s*(.*)$/.exec(i);if(a){var s=a[1];switch(i=a[2],s){case"assign":s="="}e=Math.max(t.line.indexOf(s,e),0)}else e=0;o(m("| ",6)),o(m("^^^",e+3)+r,"font-weight:bold"),o(m("| ",6)),o(i+r,"font-weight:bold")})),o(m("| ",6)+r)}else o(m(t.number,4)+"|  "),o(t.line+r,"color:red")})),"undefined"==typeof document||window.chrome?console.log(n.join("")):(i[0]=n.join("%c"),console.log.apply(console,i))}function o(t,e){n.push(t),i.push(e||"")}})),o.raise("Error compiling "+u+" shader, "+l[0].name)}}function E(t,e,n,i,a){if(!t.getProgramParameter(e,t.LINK_STATUS)){var s=t.getProgramInfoLog(e),u=b(n,a),l='Error linking program with vertex shader, "'+b(i,a)[0].name+'", and fragment shader "'+u[0].name+'"';"undefined"!=typeof document?console.log("%c"+l+r+"%c"+s,"color:red;text-decoration:underline;font-weight:bold","color:red"):console.log(l+r+s),o.raise(l)}}function T(t){t._commandRef=_()}function k(t,e,r,n){function i(t){return t?n.id(t):0}function o(t,e){Object.keys(e).forEach((function(e){t[n.id(e)]=!0}))}T(t),t._fragId=i(t.static.frag),t._vertId=i(t.static.vert);var a=t._uniformSet={};o(a,e.static),o(a,e.dynamic);var s=t._attributeSet={};o(s,r.static),o(s,r.dynamic),t._hasCount="count"in t.static||"count"in t.dynamic||"elements"in t.static||"elements"in t.dynamic}function I(t,e){var r=x();i(t+" in command "+(e||_())+("unknown"===r?"":" called from "+r))}function z(t,e,r){t||I(e,r||_())}function C(t,e,r,n){t in e||I("unknown parameter ("+t+")"+a(r)+". possible values: "+Object.keys(e).join(),n||_())}function P(t,e,r,n){l(t,e)||I("invalid parameter type"+a(r)+". expected "+e+", got "+typeof t,n||_())}function M(t){t()}function D(t,e,r){t.texture?h(t.texture._texture.internalformat,e,"unsupported texture format for attachment"):h(t.renderbuffer._renderbuffer.format,r,"unsupported renderbuffer format for attachment")}var L=33071,B=9728,R=9984,O=9985,F=9986,V=9987,U=5121,j=5122,N=5123,q=5124,$=5125,Z=5126,G=32819,W=32820,X=33635,H=34042,K=36193,Y={};function J(t,e){return t===W||t===G||t===X?2:t===H?4:Y[t]*e}function Q(t){return!(t&t-1||!t)}function tt(t,e,r){var n,i=e.width,a=e.height,s=e.channels;o(i>0&&i<=r.maxTextureSize&&a>0&&a<=r.maxTextureSize,"invalid texture shape"),t.wrapS===L&&t.wrapT===L||o(Q(i)&&Q(a),"incompatible wrap mode for texture, both width and height must be power of 2"),1===e.mipmask?1!==i&&1!==a&&o(t.minFilter!==R&&t.minFilter!==F&&t.minFilter!==O&&t.minFilter!==V,"min filter requires mipmap"):(o(Q(i)&&Q(a),"texture must be a square power of 2 to support mipmapping"),o(e.mipmask===(i<<1)-1,"missing or incomplete mipmap data")),e.type===Z&&(r.extensions.indexOf("oes_texture_float_linear")<0&&o(t.minFilter===B&&t.magFilter===B,"filter not supported, must enable oes_texture_float_linear"),o(!t.genMipmaps,"mipmap generation not supported with float textures"));var u=e.images;for(n=0;n<16;++n)if(u[n]){var l=i>>n,c=a>>n;o(e.mipmask&1<<n,"missing mipmap data");var p=u[n];if(o(p.width===l&&p.height===c,"invalid shape for mip images"),o(p.format===e.format&&p.internalformat===e.internalformat&&p.type===e.type,"incompatible type for mip image"),p.compressed);else if(p.data){var h=Math.ceil(J(p.type,s)*l/p.unpackAlignment)*p.unpackAlignment;o(p.data.byteLength===h*c,"invalid data for image, buffer size is inconsistent with image format")}else p.element||p.copy}else t.genMipmaps||o(0==(e.mipmask&1<<n),"extra mipmap data");e.compressed&&o(!t.genMipmaps,"mipmap generation for compressed images not supported")}function et(t,e,r,n){var i=t.width,a=t.height,s=t.channels;o(i>0&&i<=n.maxTextureSize&&a>0&&a<=n.maxTextureSize,"invalid texture shape"),o(i===a,"cube map must be square"),o(e.wrapS===L&&e.wrapT===L,"wrap mode not supported by cube map");for(var u=0;u<r.length;++u){var l=r[u];o(l.width===i&&l.height===a,"inconsistent cube map face shape"),e.genMipmaps&&(o(!l.compressed,"can not generate mipmap for compressed textures"),o(1===l.mipmask,"can not specify mipmaps and generate mipmaps"));for(var c=l.images,p=0;p<16;++p){var h=c[p];if(h){var f=i>>p,d=a>>p;o(l.mipmask&1<<p,"missing mipmap data"),o(h.width===f&&h.height===d,"invalid shape for mip images"),o(h.format===t.format&&h.internalformat===t.internalformat&&h.type===t.type,"incompatible type for mip image"),h.compressed||(h.data?o(h.data.byteLength===f*d*Math.max(J(h.type,s),h.unpackAlignment),"invalid data for image, buffer size is inconsistent with image format"):h.element||h.copy)}}}}Y[5120]=Y[U]=1,Y[j]=Y[N]=Y[K]=Y[X]=Y[G]=Y[W]=2,Y[q]=Y[$]=Y[Z]=Y[H]=4;var rt=e(o,{optional:M,raise:i,commandRaise:I,command:z,parameter:s,commandParameter:C,constructor:d,type:c,commandType:P,isTypedArray:u,nni:p,oneOf:h,shaderError:A,linkError:E,callSite:x,saveCommandRef:T,saveDrawInfo:k,framebufferFormat:D,guessCommand:_,texture2D:tt,textureCube:et}),nt=0,it=0,ot=5,at=6;function st(t,e){this.id=nt++,this.type=t,this.data=e}function ut(t){return t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function lt(t){if(0===t.length)return[];var e=t.charAt(0),r=t.charAt(t.length-1);if(t.length>1&&e===r&&('"'===e||"'"===e))return['"'+ut(t.substr(1,t.length-2))+'"'];var n=/\[(false|true|null|\d+|'[^']*'|"[^"]*")\]/.exec(t);if(n)return lt(t.substr(0,n.index)).concat(lt(n[1])).concat(lt(t.substr(n.index+n[0].length)));var i=t.split(".");if(1===i.length)return['"'+ut(t)+'"'];for(var o=[],a=0;a<i.length;++a)o=o.concat(lt(i[a]));return o}function ct(t){return"["+lt(t).join("][")+"]"}function pt(t,e){return new st(t,ct(e+""))}function ht(t){return"function"==typeof t&&!t._reglType||t instanceof st}function ft(t,e){return"function"==typeof t?new st(it,t):"number"==typeof t||"boolean"==typeof t?new st(ot,t):Array.isArray(t)?new st(at,t.map((function(t,r){return ft(t,e+"["+r+"]")}))):t instanceof st?t:void rt(!1,"invalid option type in uniform "+e)}var dt={DynamicVariable:st,define:pt,isDynamic:ht,unbox:ft,accessor:ct},mt={next:"function"==typeof requestAnimationFrame?function(t){return requestAnimationFrame(t)}:function(t){return setTimeout(t,16)},cancel:"function"==typeof cancelAnimationFrame?function(t){return cancelAnimationFrame(t)}:clearTimeout},yt="undefined"!=typeof performance&&performance.now?function(){return performance.now()}:function(){return+new Date};function gt(){var t={"":0},e=[""];return{id:function(r){var n=t[r];return n||(n=t[r]=e.length,e.push(r),n)},str:function(t){return e[t]}}}function vt(t,r,n){var i,o=document.createElement("canvas");function a(){var r=window.innerWidth,i=window.innerHeight;if(t!==document.body){var a=t.getBoundingClientRect();r=a.right-a.left,i=a.bottom-a.top}o.width=n*r,o.height=n*i,e(o.style,{width:r+"px",height:i+"px"})}function s(){i?i.disconnect():window.removeEventListener("resize",a),t.removeChild(o)}return e(o.style,{border:0,margin:0,padding:0,top:0,left:0}),t.appendChild(o),t===document.body&&(o.style.position="absolute",e(t.style,{margin:0,padding:0})),t!==document.body&&"function"==typeof ResizeObserver?(i=new ResizeObserver((function(){setTimeout(a)}))).observe(t):window.addEventListener("resize",a,!1),a(),{canvas:o,onDestroy:s}}function _t(t,e){function r(r){try{return t.getContext(r,e)}catch(t){return null}}return r("webgl")||r("experimental-webgl")||r("webgl-experimental")}function xt(t){return"string"==typeof t.nodeName&&"function"==typeof t.appendChild&&"function"==typeof t.getBoundingClientRect}function bt(t){return"function"==typeof t.drawArrays||"function"==typeof t.drawElements}function wt(t){return"string"==typeof t?t.split():(rt(Array.isArray(t),"invalid extension array"),t)}function St(t){return"string"==typeof t?(rt("undefined"!=typeof document,"not supported outside of DOM"),document.querySelector(t)):t}function At(t){var e,r,n,i,o=t||{},a={},s=[],u=[],l="undefined"==typeof window?1:window.devicePixelRatio,c=!1,p=function(t){t&&rt.raise(t)},h=function(){};if("string"==typeof o?(rt("undefined"!=typeof document,"selector queries only supported in DOM enviroments"),e=document.querySelector(o),rt(e,"invalid query string for element")):"object"==typeof o?xt(o)?e=o:bt(o)?n=(i=o).canvas:(rt.constructor(o),"gl"in o?i=o.gl:"canvas"in o?n=St(o.canvas):"container"in o&&(r=St(o.container)),"attributes"in o&&(a=o.attributes,rt.type(a,"object","invalid context attributes")),"extensions"in o&&(s=wt(o.extensions)),"optionalExtensions"in o&&(u=wt(o.optionalExtensions)),"onDone"in o&&(rt.type(o.onDone,"function","invalid or missing onDone callback"),p=o.onDone),"profile"in o&&(c=!!o.profile),"pixelRatio"in o&&(l=+o.pixelRatio,rt(l>0,"invalid pixel ratio"))):rt.raise("invalid arguments to regl"),e&&("canvas"===e.nodeName.toLowerCase()?n=e:r=e),!i){if(!n){rt("undefined"!=typeof document,"must manually specify webgl context outside of DOM environments");var f=vt(r||document.body,p,l);if(!f)return null;n=f.canvas,h=f.onDestroy}void 0===a.premultipliedAlpha&&(a.premultipliedAlpha=!0),i=_t(n,a)}return i?{gl:i,canvas:n,container:r,extensions:s,optionalExtensions:u,pixelRatio:l,profile:c,onDone:p,onDestroy:h}:(h(),p("webgl not supported, try upgrading your browser or graphics drivers http://get.webgl.org"),null)}function Et(t,e){var r={};function n(e){rt.type(e,"string","extension name must be string");var n,i=e.toLowerCase();try{n=r[i]=t.getExtension(i)}catch(t){}return!!n}for(var i=0;i<e.extensions.length;++i){var o=e.extensions[i];if(!n(o))return e.onDestroy(),e.onDone('"'+o+'" extension is not supported by the current WebGL context, try upgrading your system or a different browser'),null}return e.optionalExtensions.forEach(n),{extensions:r,restore:function(){Object.keys(r).forEach((function(t){if(r[t]&&!n(t))throw new Error("(regl): error restoring extension "+t)}))}}}function Tt(t,e){for(var r=Array(t),n=0;n<t;++n)r[n]=e(n);return r}var kt=5120,It=5121,zt=5122,Ct=5123,Pt=5124,Mt=5125,Dt=5126;function Lt(t){for(var e=16;e<=1<<28;e*=16)if(t<=e)return e;return 0}function Bt(t){var e,r;return e=(t>65535)<<4,e|=r=((t>>>=e)>255)<<3,e|=r=((t>>>=r)>15)<<2,(e|=r=((t>>>=r)>3)<<1)|(t>>>=r)>>1}function Rt(){var t=Tt(8,(function(){return[]}));function e(e){var r=Lt(e),n=t[Bt(r)>>2];return n.length>0?n.pop():new ArrayBuffer(r)}function r(e){t[Bt(e.byteLength)>>2].push(e)}function n(t,r){var n=null;switch(t){case kt:n=new Int8Array(e(r),0,r);break;case It:n=new Uint8Array(e(r),0,r);break;case zt:n=new Int16Array(e(2*r),0,r);break;case Ct:n=new Uint16Array(e(2*r),0,r);break;case Pt:n=new Int32Array(e(4*r),0,r);break;case Mt:n=new Uint32Array(e(4*r),0,r);break;case Dt:n=new Float32Array(e(4*r),0,r);break;default:return null}return n.length!==r?n.subarray(0,r):n}function i(t){r(t.buffer)}return{alloc:e,free:r,allocType:n,freeType:i}}var Ot=Rt();Ot.zero=Rt();var Ft=3408,Vt=3410,Ut=3411,jt=3412,Nt=3413,qt=3414,$t=3415,Zt=33901,Gt=33902,Wt=3379,Xt=3386,Ht=34921,Kt=36347,Yt=36348,Jt=35661,Qt=35660,te=34930,ee=36349,re=34076,ne=34024,ie=7936,oe=7937,ae=7938,se=35724,ue=34047,le=36063,ce=34852,pe=3553,he=34067,fe=34069,de=33984,me=6408,ye=5126,ge=5121,ve=36160,_e=36053,xe=36064,be=16384,we=function(t,e){var r=1;e.ext_texture_filter_anisotropic&&(r=t.getParameter(ue));var n=1,i=1;e.webgl_draw_buffers&&(n=t.getParameter(ce),i=t.getParameter(le));var o=!!e.oes_texture_float;if(o){var a=t.createTexture();t.bindTexture(pe,a),t.texImage2D(pe,0,me,1,1,0,me,ye,null);var s=t.createFramebuffer();if(t.bindFramebuffer(ve,s),t.framebufferTexture2D(ve,xe,pe,a,0),t.bindTexture(pe,null),t.checkFramebufferStatus(ve)!==_e)o=!1;else{t.viewport(0,0,1,1),t.clearColor(1,0,0,1),t.clear(be);var u=Ot.allocType(ye,4);t.readPixels(0,0,1,1,me,ye,u),t.getError()?o=!1:(t.deleteFramebuffer(s),t.deleteTexture(a),o=1===u[0]),Ot.freeType(u)}}var l=!0;if("undefined"==typeof navigator||!(/MSIE/.test(navigator.userAgent)||/Trident\//.test(navigator.appVersion)||/Edge/.test(navigator.userAgent))){var c=t.createTexture(),p=Ot.allocType(ge,36);t.activeTexture(de),t.bindTexture(he,c),t.texImage2D(fe,0,me,3,3,0,me,ge,p),Ot.freeType(p),t.bindTexture(he,null),t.deleteTexture(c),l=!t.getError()}return{colorBits:[t.getParameter(Vt),t.getParameter(Ut),t.getParameter(jt),t.getParameter(Nt)],depthBits:t.getParameter(qt),stencilBits:t.getParameter($t),subpixelBits:t.getParameter(Ft),extensions:Object.keys(e).filter((function(t){return!!e[t]})),maxAnisotropic:r,maxDrawbuffers:n,maxColorAttachments:i,pointSizeDims:t.getParameter(Zt),lineWidthDims:t.getParameter(Gt),maxViewportDims:t.getParameter(Xt),maxCombinedTextureUnits:t.getParameter(Jt),maxCubeMapSize:t.getParameter(re),maxRenderbufferSize:t.getParameter(ne),maxTextureUnits:t.getParameter(te),maxTextureSize:t.getParameter(Wt),maxAttributes:t.getParameter(Ht),maxVertexUniforms:t.getParameter(Kt),maxVertexTextureUnits:t.getParameter(Qt),maxVaryingVectors:t.getParameter(Yt),maxFragmentUniforms:t.getParameter(ee),glsl:t.getParameter(se),renderer:t.getParameter(oe),vendor:t.getParameter(ie),version:t.getParameter(ae),readFloat:o,npotTextureCube:l}};function Se(e){return!!e&&"object"==typeof e&&Array.isArray(e.shape)&&Array.isArray(e.stride)&&"number"==typeof e.offset&&e.shape.length===e.stride.length&&(Array.isArray(e.data)||t(e.data))}var Ae=function(t){return Object.keys(t).map((function(e){return t[e]}))},Ee={shape:Pe,flatten:Ce};function Te(t,e,r){for(var n=0;n<e;++n)r[n]=t[n]}function ke(t,e,r,n){for(var i=0,o=0;o<e;++o)for(var a=t[o],s=0;s<r;++s)n[i++]=a[s]}function Ie(t,e,r,n,i,o){for(var a=o,s=0;s<e;++s)for(var u=t[s],l=0;l<r;++l)for(var c=u[l],p=0;p<n;++p)i[a++]=c[p]}function ze(t,e,r,n,i){for(var o=1,a=r+1;a<e.length;++a)o*=e[a];var s=e[r];if(e.length-r==4){var u=e[r+1],l=e[r+2],c=e[r+3];for(a=0;a<s;++a)Ie(t[a],u,l,c,n,i),i+=o}else for(a=0;a<s;++a)ze(t[a],e,r+1,n,i),i+=o}function Ce(t,e,r,n){var i=1;if(e.length)for(var o=0;o<e.length;++o)i*=e[o];else i=0;var a=n||Ot.allocType(r,i);switch(e.length){case 0:break;case 1:Te(t,e[0],a);break;case 2:ke(t,e[0],e[1],a);break;case 3:Ie(t,e[0],e[1],e[2],a,0);break;default:ze(t,e,0,a,0)}return a}function Pe(t){for(var e=[],r=t;r.length;r=r[0])e.push(r.length);return e}var Me={"[object Int8Array]":5120,"[object Int16Array]":5122,"[object Int32Array]":5124,"[object Uint8Array]":5121,"[object Uint8ClampedArray]":5121,"[object Uint16Array]":5123,"[object Uint32Array]":5125,"[object Float32Array]":5126,"[object Float64Array]":5121,"[object ArrayBuffer]":5121},De={int8:5120,int16:5122,int32:5124,uint8:5121,uint16:5123,uint32:5125,float:5126,float32:5126},Le={dynamic:35048,stream:35040,static:35044},Be=Ee.flatten,Re=Ee.shape,Oe=35044,Fe=35040,Ve=5121,Ue=5126,je=[];function Ne(t){return 0|Me[Object.prototype.toString.call(t)]}function qe(t,e){for(var r=0;r<e.length;++r)t[r]=e[r]}function $e(t,e,r,n,i,o,a){for(var s=0,u=0;u<r;++u)for(var l=0;l<n;++l)t[s++]=e[i*u+o*l+a]}function Ze(e,r,n,i){var o=0,a={};function s(t){this.id=o++,this.buffer=e.createBuffer(),this.type=t,this.usage=Oe,this.byteLength=0,this.dimension=1,this.dtype=Ve,this.persistentData=null,n.profile&&(this.stats={size:0})}s.prototype.bind=function(){e.bindBuffer(this.type,this.buffer)},s.prototype.destroy=function(){f(this)};var u=[];function l(t,e){var r=u.pop();return r||(r=new s(t)),r.bind(),h(r,e,Fe,0,1,!1),r}function c(t){u.push(t)}function p(t,r,n){t.byteLength=r.byteLength,e.bufferData(t.type,r,n)}function h(e,r,n,i,o,a){var s,u;if(e.usage=n,Array.isArray(r)){if(e.dtype=i||Ue,r.length>0)if(Array.isArray(r[0])){s=Re(r);for(var l=1,c=1;c<s.length;++c)l*=s[c];e.dimension=l,p(e,u=Be(r,s,e.dtype),n),a?e.persistentData=u:Ot.freeType(u)}else if("number"==typeof r[0]){e.dimension=o;var h=Ot.allocType(e.dtype,r.length);qe(h,r),p(e,h,n),a?e.persistentData=h:Ot.freeType(h)}else t(r[0])?(e.dimension=r[0].length,e.dtype=i||Ne(r[0])||Ue,p(e,u=Be(r,[r.length,r[0].length],e.dtype),n),a?e.persistentData=u:Ot.freeType(u)):rt.raise("invalid buffer data")}else if(t(r))e.dtype=i||Ne(r),e.dimension=o,p(e,r,n),a&&(e.persistentData=new Uint8Array(new Uint8Array(r.buffer)));else if(Se(r)){s=r.shape;var f=r.stride,d=r.offset,m=0,y=0,g=0,v=0;1===s.length?(m=s[0],y=1,g=f[0],v=0):2===s.length?(m=s[0],y=s[1],g=f[0],v=f[1]):rt.raise("invalid shape"),e.dtype=i||Ne(r.data)||Ue,e.dimension=y;var _=Ot.allocType(e.dtype,m*y);$e(_,r.data,m,y,g,v,d),p(e,_,n),a?e.persistentData=_:Ot.freeType(_)}else r instanceof ArrayBuffer?(e.dtype=Ve,e.dimension=o,p(e,r,n),a&&(e.persistentData=new Uint8Array(new Uint8Array(r)))):rt.raise("invalid buffer data")}function f(t){r.bufferCount--,i(t);var n=t.buffer;rt(n,"buffer must not be deleted already"),e.deleteBuffer(n),t.buffer=null,delete a[t.id]}function d(i,o,u,l){r.bufferCount++;var c=new s(o);function p(r){var i=Oe,o=null,a=0,s=0,u=1;return Array.isArray(r)||t(r)||Se(r)||r instanceof ArrayBuffer?o=r:"number"==typeof r?a=0|r:r&&(rt.type(r,"object","buffer arguments must be an object, a number or an array"),"data"in r&&(rt(null===o||Array.isArray(o)||t(o)||Se(o),"invalid data for buffer"),o=r.data),"usage"in r&&(rt.parameter(r.usage,Le,"invalid buffer usage"),i=Le[r.usage]),"type"in r&&(rt.parameter(r.type,De,"invalid buffer type"),s=De[r.type]),"dimension"in r&&(rt.type(r.dimension,"number","invalid dimension"),u=0|r.dimension),"length"in r&&(rt.nni(a,"buffer length must be a nonnegative integer"),a=0|r.length)),c.bind(),o?h(c,o,i,s,u,l):(a&&e.bufferData(c.type,a,i),c.dtype=s||Ve,c.usage=i,c.dimension=u,c.byteLength=a),n.profile&&(c.stats.size=c.byteLength*je[c.dtype]),p}function d(t,r){rt(r+t.byteLength<=c.byteLength,"invalid buffer subdata call, buffer is too small.  Can't write data of size "+t.byteLength+" starting from offset "+r+" to a buffer of size "+c.byteLength),e.bufferSubData(c.type,r,t)}function m(e,r){var n,i=0|(r||0);if(c.bind(),t(e)||e instanceof ArrayBuffer)d(e,i);else if(Array.isArray(e)){if(e.length>0)if("number"==typeof e[0]){var o=Ot.allocType(c.dtype,e.length);qe(o,e),d(o,i),Ot.freeType(o)}else if(Array.isArray(e[0])||t(e[0])){n=Re(e);var a=Be(e,n,c.dtype);d(a,i),Ot.freeType(a)}else rt.raise("invalid buffer data")}else if(Se(e)){n=e.shape;var s=e.stride,u=0,l=0,h=0,f=0;1===n.length?(u=n[0],l=1,h=s[0],f=0):2===n.length?(u=n[0],l=n[1],h=s[0],f=s[1]):rt.raise("invalid shape");var m=Array.isArray(e.data)?c.dtype:Ne(e.data),y=Ot.allocType(m,u*l);$e(y,e.data,u,l,h,f,e.offset),d(y,i),Ot.freeType(y)}else rt.raise("invalid data for buffer subdata");return p}return a[c.id]=c,u||p(i),p._reglType="buffer",p._buffer=c,p.subdata=m,n.profile&&(p.stats=c.stats),p.destroy=function(){f(c)},p}function m(){Ae(a).forEach((function(t){t.buffer=e.createBuffer(),e.bindBuffer(t.type,t.buffer),e.bufferData(t.type,t.persistentData||t.byteLength,t.usage)}))}return n.profile&&(r.getTotalBufferSize=function(){var t=0;return Object.keys(a).forEach((function(e){t+=a[e].stats.size})),t}),{create:d,createStream:l,destroyStream:c,clear:function(){Ae(a).forEach(f),u.forEach(f)},getBuffer:function(t){return t&&t._buffer instanceof s?t._buffer:null},restore:m,_initBuffer:h}}je[5120]=1,je[5122]=2,je[5124]=4,je[5121]=1,je[5123]=2,je[5125]=4,je[5126]=4;var Ge={points:0,point:0,lines:1,line:1,triangles:4,triangle:4,"line loop":2,"line strip":3,"triangle strip":5,"triangle fan":6},We=0,Xe=1,He=4,Ke=5120,Ye=5121,Je=5122,Qe=5123,tr=5124,er=5125,rr=34963,nr=35040,ir=35044;function or(e,r,n,i){var o={},a=0,s={uint8:Ye,uint16:Qe};function u(t){this.id=a++,o[this.id]=this,this.buffer=t,this.primType=He,this.vertCount=0,this.type=0}r.oes_element_index_uint&&(s.uint32=er),u.prototype.bind=function(){this.buffer.bind()};var l=[];function c(t){var e=l.pop();return e||(e=new u(n.create(null,rr,!0,!1)._buffer)),h(e,t,nr,-1,-1,0,0),e}function p(t){l.push(t)}function h(i,o,a,s,u,l,c){var p;if(i.buffer.bind(),o){var h=c;c||t(o)&&(!Se(o)||t(o.data))||(h=r.oes_element_index_uint?er:Qe),n._initBuffer(i.buffer,o,a,h,3)}else e.bufferData(rr,l,a),i.buffer.dtype=p||Ye,i.buffer.usage=a,i.buffer.dimension=3,i.buffer.byteLength=l;if(p=c,!c){switch(i.buffer.dtype){case Ye:case Ke:p=Ye;break;case Qe:case Je:p=Qe;break;case er:case tr:p=er;break;default:rt.raise("unsupported type for element array")}i.buffer.dtype=p}i.type=p,rt(p!==er||!!r.oes_element_index_uint,"32 bit element buffers not supported, enable oes_element_index_uint first");var f=u;f<0&&(f=i.buffer.byteLength,p===Qe?f>>=1:p===er&&(f>>=2)),i.vertCount=f;var d=s;if(s<0){d=He;var m=i.buffer.dimension;1===m&&(d=We),2===m&&(d=Xe),3===m&&(d=He)}i.primType=d}function f(t){i.elementsCount--,rt(null!==t.buffer,"must not double destroy elements"),delete o[t.id],t.buffer.destroy(),t.buffer=null}function d(e,r){var o=n.create(null,rr,!0),a=new u(o._buffer);function l(e){if(e)if("number"==typeof e)o(e),a.primType=He,a.vertCount=0|e,a.type=Ye;else{var r=null,n=ir,i=-1,u=-1,c=0,p=0;Array.isArray(e)||t(e)||Se(e)?r=e:(rt.type(e,"object","invalid arguments for elements"),"data"in e&&(r=e.data,rt(Array.isArray(r)||t(r)||Se(r),"invalid data for element buffer")),"usage"in e&&(rt.parameter(e.usage,Le,"invalid element buffer usage"),n=Le[e.usage]),"primitive"in e&&(rt.parameter(e.primitive,Ge,"invalid element buffer primitive"),i=Ge[e.primitive]),"count"in e&&(rt("number"==typeof e.count&&e.count>=0,"invalid vertex count for elements"),u=0|e.count),"type"in e&&(rt.parameter(e.type,s,"invalid buffer type"),p=s[e.type]),"length"in e?c=0|e.length:(c=u,p===Qe||p===Je?c*=2:p!==er&&p!==tr||(c*=4))),h(a,r,n,i,u,c,p)}else o(),a.primType=He,a.vertCount=0,a.type=Ye;return l}return i.elementsCount++,l(e),l._reglType="elements",l._elements=a,l.subdata=function(t,e){return o.subdata(t,e),l},l.destroy=function(){f(a)},l}return{create:d,createStream:c,destroyStream:p,getElements:function(t){return"function"==typeof t&&t._elements instanceof u?t._elements:null},clear:function(){Ae(o).forEach(f)}}}var ar=new Float32Array(1),sr=new Uint32Array(ar.buffer),ur=5123;function lr(t){for(var e=Ot.allocType(ur,t.length),r=0;r<t.length;++r)if(isNaN(t[r]))e[r]=65535;else if(t[r]===1/0)e[r]=31744;else if(t[r]===-1/0)e[r]=64512;else{ar[0]=t[r];var n=sr[0],i=n>>>31<<15,o=(n<<1>>>24)-127,a=n>>13&1023;if(o<-24)e[r]=i;else if(o<-14){var s=-14-o;e[r]=i+(a+1024>>s)}else e[r]=o>15?i+31744:i+(o+15<<10)+a}return e}function cr(e){return Array.isArray(e)||t(e)}var pr=function(t){return!(t&t-1||!t)},hr=34467,fr=3553,dr=34067,mr=34069,yr=6408,gr=6406,vr=6407,_r=6409,xr=6410,br=32854,wr=32855,Sr=36194,Ar=32819,Er=32820,Tr=33635,kr=34042,Ir=6402,zr=34041,Cr=35904,Pr=35906,Mr=36193,Dr=33776,Lr=33777,Br=33778,Rr=33779,Or=35986,Fr=35987,Vr=34798,Ur=35840,jr=35841,Nr=35842,qr=35843,$r=36196,Zr=5121,Gr=5123,Wr=5125,Xr=5126,Hr=10242,Kr=10243,Yr=10497,Jr=33071,Qr=33648,tn=10240,en=10241,rn=9728,nn=9729,on=9984,an=9985,sn=9986,un=9987,ln=33170,cn=4352,pn=4353,hn=4354,fn=34046,dn=3317,mn=37440,yn=37441,gn=37443,vn=37444,_n=33984,xn=[on,sn,an,un],bn=[0,_r,xr,vr,yr],wn={};function Sn(t){return"[object "+t+"]"}wn[_r]=wn[gr]=wn[Ir]=1,wn[zr]=wn[xr]=2,wn[vr]=wn[Cr]=3,wn[yr]=wn[Pr]=4;var An=Sn("HTMLCanvasElement"),En=Sn("OffscreenCanvas"),Tn=Sn("CanvasRenderingContext2D"),kn=Sn("ImageBitmap"),In=Sn("HTMLImageElement"),zn=Sn("HTMLVideoElement"),Cn=Object.keys(Me).concat([An,En,Tn,kn,In,zn]),Pn=[];Pn[Zr]=1,Pn[Xr]=4,Pn[Mr]=2,Pn[Gr]=2,Pn[Wr]=4;var Mn=[];function Dn(t){return Array.isArray(t)&&(0===t.length||"number"==typeof t[0])}function Ln(t){return!!Array.isArray(t)&&!(0===t.length||!cr(t[0]))}function Bn(t){return Object.prototype.toString.call(t)}function Rn(t){return Bn(t)===An}function On(t){return Bn(t)===En}function Fn(t){return Bn(t)===Tn}function Vn(t){return Bn(t)===kn}function Un(t){return Bn(t)===In}function jn(t){return Bn(t)===zn}function Nn(t){if(!t)return!1;var e=Bn(t);return Cn.indexOf(e)>=0||Dn(t)||Ln(t)||Se(t)}function qn(t){return 0|Me[Object.prototype.toString.call(t)]}function $n(t,e){var r=e.length;switch(t.type){case Zr:case Gr:case Wr:case Xr:var n=Ot.allocType(t.type,r);n.set(e),t.data=n;break;case Mr:t.data=lr(e);break;default:rt.raise("unsupported texture type, must specify a typed array")}}function Zn(t,e){return Ot.allocType(t.type===Mr?Xr:t.type,e)}function Gn(t,e){t.type===Mr?(t.data=lr(e),Ot.freeType(e)):t.data=e}function Wn(t,e,r,n,i,o){for(var a=t.width,s=t.height,u=t.channels,l=Zn(t,a*s*u),c=0,p=0;p<s;++p)for(var h=0;h<a;++h)for(var f=0;f<u;++f)l[c++]=e[r*h+n*p+i*f+o];Gn(t,l)}function Xn(t,e,r,n,i,o){var a;if(a=void 0!==Mn[t]?Mn[t]:wn[t]*Pn[e],o&&(a*=6),i){for(var s=0,u=r;u>=1;)s+=a*u*u,u/=2;return s}return a*r*n}function Hn(r,n,i,o,a,s,u){var l={"don't care":cn,"dont care":cn,nice:hn,fast:pn},c={repeat:Yr,clamp:Jr,mirror:Qr},p={nearest:rn,linear:nn},h=e({mipmap:un,"nearest mipmap nearest":on,"linear mipmap nearest":an,"nearest mipmap linear":sn,"linear mipmap linear":un},p),f={none:0,browser:vn},d={uint8:Zr,rgba4:Ar,rgb565:Tr,"rgb5 a1":Er},m={alpha:gr,luminance:_r,"luminance alpha":xr,rgb:vr,rgba:yr,rgba4:br,"rgb5 a1":wr,rgb565:Sr},y={};n.ext_srgb&&(m.srgb=Cr,m.srgba=Pr),n.oes_texture_float&&(d.float32=d.float=Xr),n.oes_texture_half_float&&(d.float16=d["half float"]=Mr),n.webgl_depth_texture&&(e(m,{depth:Ir,"depth stencil":zr}),e(d,{uint16:Gr,uint32:Wr,"depth stencil":kr})),n.webgl_compressed_texture_s3tc&&e(y,{"rgb s3tc dxt1":Dr,"rgba s3tc dxt1":Lr,"rgba s3tc dxt3":Br,"rgba s3tc dxt5":Rr}),n.webgl_compressed_texture_atc&&e(y,{"rgb atc":Or,"rgba atc explicit alpha":Fr,"rgba atc interpolated alpha":Vr}),n.webgl_compressed_texture_pvrtc&&e(y,{"rgb pvrtc 4bppv1":Ur,"rgb pvrtc 2bppv1":jr,"rgba pvrtc 4bppv1":Nr,"rgba pvrtc 2bppv1":qr}),n.webgl_compressed_texture_etc1&&(y["rgb etc1"]=$r);var g=Array.prototype.slice.call(r.getParameter(hr));Object.keys(y).forEach((function(t){var e=y[t];g.indexOf(e)>=0&&(m[t]=e)}));var v=Object.keys(m);i.textureFormats=v;var _=[];Object.keys(m).forEach((function(t){var e=m[t];_[e]=t}));var x=[];Object.keys(d).forEach((function(t){var e=d[t];x[e]=t}));var b=[];Object.keys(p).forEach((function(t){var e=p[t];b[e]=t}));var w=[];Object.keys(h).forEach((function(t){var e=h[t];w[e]=t}));var S=[];Object.keys(c).forEach((function(t){var e=c[t];S[e]=t}));var A=v.reduce((function(t,e){var r=m[e];return r===_r||r===gr||r===_r||r===xr||r===Ir||r===zr||n.ext_srgb&&(r===Cr||r===Pr)?t[r]=r:r===wr||e.indexOf("rgba")>=0?t[r]=yr:t[r]=vr,t}),{});function E(){this.internalformat=yr,this.format=yr,this.type=Zr,this.compressed=!1,this.premultiplyAlpha=!1,this.flipY=!1,this.unpackAlignment=1,this.colorSpace=vn,this.width=0,this.height=0,this.channels=0}function T(t,e){t.internalformat=e.internalformat,t.format=e.format,t.type=e.type,t.compressed=e.compressed,t.premultiplyAlpha=e.premultiplyAlpha,t.flipY=e.flipY,t.unpackAlignment=e.unpackAlignment,t.colorSpace=e.colorSpace,t.width=e.width,t.height=e.height,t.channels=e.channels}function k(t,e){if("object"==typeof e&&e){if("premultiplyAlpha"in e&&(rt.type(e.premultiplyAlpha,"boolean","invalid premultiplyAlpha"),t.premultiplyAlpha=e.premultiplyAlpha),"flipY"in e&&(rt.type(e.flipY,"boolean","invalid texture flip"),t.flipY=e.flipY),"alignment"in e&&(rt.oneOf(e.alignment,[1,2,4,8],"invalid texture unpack alignment"),t.unpackAlignment=e.alignment),"colorSpace"in e&&(rt.parameter(e.colorSpace,f,"invalid colorSpace"),t.colorSpace=f[e.colorSpace]),"type"in e){var r=e.type;rt(n.oes_texture_float||!("float"===r||"float32"===r),"you must enable the OES_texture_float extension in order to use floating point textures."),rt(n.oes_texture_half_float||!("half float"===r||"float16"===r),"you must enable the OES_texture_half_float extension in order to use 16-bit floating point textures."),rt(n.webgl_depth_texture||!("uint16"===r||"uint32"===r||"depth stencil"===r),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures."),rt.parameter(r,d,"invalid texture type"),t.type=d[r]}var o=t.width,a=t.height,s=t.channels,u=!1;"shape"in e?(rt(Array.isArray(e.shape)&&e.shape.length>=2,"shape must be an array"),o=e.shape[0],a=e.shape[1],3===e.shape.length&&(s=e.shape[2],rt(s>0&&s<=4,"invalid number of channels"),u=!0),rt(o>=0&&o<=i.maxTextureSize,"invalid width"),rt(a>=0&&a<=i.maxTextureSize,"invalid height")):("radius"in e&&(o=a=e.radius,rt(o>=0&&o<=i.maxTextureSize,"invalid radius")),"width"in e&&(o=e.width,rt(o>=0&&o<=i.maxTextureSize,"invalid width")),"height"in e&&(a=e.height,rt(a>=0&&a<=i.maxTextureSize,"invalid height")),"channels"in e&&(s=e.channels,rt(s>0&&s<=4,"invalid number of channels"),u=!0)),t.width=0|o,t.height=0|a,t.channels=0|s;var l=!1;if("format"in e){var c=e.format;rt(n.webgl_depth_texture||!("depth"===c||"depth stencil"===c),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures."),rt.parameter(c,m,"invalid texture format");var p=t.internalformat=m[c];t.format=A[p],c in d&&("type"in e||(t.type=d[c])),c in y&&(t.compressed=!0),l=!0}!u&&l?t.channels=wn[t.format]:u&&!l?t.channels!==bn[t.format]&&(t.format=t.internalformat=bn[t.channels]):l&&u&&rt(t.channels===wn[t.format],"number of channels inconsistent with specified format")}}function I(t){r.pixelStorei(mn,t.flipY),r.pixelStorei(yn,t.premultiplyAlpha),r.pixelStorei(gn,t.colorSpace),r.pixelStorei(dn,t.unpackAlignment)}function z(){E.call(this),this.xOffset=0,this.yOffset=0,this.data=null,this.needsFree=!1,this.element=null,this.needsCopy=!1}function C(e,r){var n=null;if(Nn(r)?n=r:r&&(rt.type(r,"object","invalid pixel data type"),k(e,r),"x"in r&&(e.xOffset=0|r.x),"y"in r&&(e.yOffset=0|r.y),Nn(r.data)&&(n=r.data)),rt(!e.compressed||n instanceof Uint8Array,"compressed texture data must be stored in a uint8array"),r.copy){rt(!n,"can not specify copy and data field for the same texture");var o=a.viewportWidth,s=a.viewportHeight;e.width=e.width||o-e.xOffset,e.height=e.height||s-e.yOffset,e.needsCopy=!0,rt(e.xOffset>=0&&e.xOffset<o&&e.yOffset>=0&&e.yOffset<s&&e.width>0&&e.width<=o&&e.height>0&&e.height<=s,"copy texture read out of bounds")}else if(n){if(t(n))e.channels=e.channels||4,e.data=n,"type"in r||e.type!==Zr||(e.type=qn(n));else if(Dn(n))e.channels=e.channels||4,$n(e,n),e.alignment=1,e.needsFree=!0;else if(Se(n)){var u=n.data;Array.isArray(u)||e.type!==Zr||(e.type=qn(u));var l,c,p,h,f,d,m=n.shape,y=n.stride;3===m.length?(p=m[2],d=y[2]):(rt(2===m.length,"invalid ndarray pixel data, must be 2 or 3D"),p=1,d=1),l=m[0],c=m[1],h=y[0],f=y[1],e.alignment=1,e.width=l,e.height=c,e.channels=p,e.format=e.internalformat=bn[p],e.needsFree=!0,Wn(e,u,h,f,d,n.offset)}else if(Rn(n)||On(n)||Fn(n))Rn(n)||On(n)?e.element=n:e.element=n.canvas,e.width=e.element.width,e.height=e.element.height,e.channels=4;else if(Vn(n))e.element=n,e.width=n.width,e.height=n.height,e.channels=4;else if(Un(n))e.element=n,e.width=n.naturalWidth,e.height=n.naturalHeight,e.channels=4;else if(jn(n))e.element=n,e.width=n.videoWidth,e.height=n.videoHeight,e.channels=4;else if(Ln(n)){var g=e.width||n[0].length,v=e.height||n.length,_=e.channels;_=cr(n[0][0])?_||n[0][0].length:_||1;for(var x=Ee.shape(n),b=1,w=0;w<x.length;++w)b*=x[w];var S=Zn(e,b);Ee.flatten(n,x,"",S),Gn(e,S),e.alignment=1,e.width=g,e.height=v,e.channels=_,e.format=e.internalformat=bn[_],e.needsFree=!0}}else e.width=e.width||1,e.height=e.height||1,e.channels=e.channels||4;e.type===Xr?rt(i.extensions.indexOf("oes_texture_float")>=0,"oes_texture_float extension not enabled"):e.type===Mr&&rt(i.extensions.indexOf("oes_texture_half_float")>=0,"oes_texture_half_float extension not enabled")}function P(t,e,n){var i=t.element,a=t.data,s=t.internalformat,u=t.format,l=t.type,c=t.width,p=t.height;I(t),i?r.texImage2D(e,n,u,u,l,i):t.compressed?r.compressedTexImage2D(e,n,s,c,p,0,a):t.needsCopy?(o(),r.copyTexImage2D(e,n,u,t.xOffset,t.yOffset,c,p,0)):r.texImage2D(e,n,u,c,p,0,u,l,a||null)}function M(t,e,n,i,a){var s=t.element,u=t.data,l=t.internalformat,c=t.format,p=t.type,h=t.width,f=t.height;I(t),s?r.texSubImage2D(e,a,n,i,c,p,s):t.compressed?r.compressedTexSubImage2D(e,a,n,i,l,h,f,u):t.needsCopy?(o(),r.copyTexSubImage2D(e,a,n,i,t.xOffset,t.yOffset,h,f)):r.texSubImage2D(e,a,n,i,h,f,c,p,u)}var D=[];function L(){return D.pop()||new z}function B(t){t.needsFree&&Ot.freeType(t.data),z.call(t),D.push(t)}function R(){E.call(this),this.genMipmaps=!1,this.mipmapHint=cn,this.mipmask=0,this.images=Array(16)}function O(t,e,r){var n=t.images[0]=L();t.mipmask=1,n.width=t.width=e,n.height=t.height=r,n.channels=t.channels=4}function F(t,e){var r=null;if(Nn(e))T(r=t.images[0]=L(),t),C(r,e),t.mipmask=1;else if(k(t,e),Array.isArray(e.mipmap))for(var n=e.mipmap,i=0;i<n.length;++i)T(r=t.images[i]=L(),t),r.width>>=i,r.height>>=i,C(r,n[i]),t.mipmask|=1<<i;else T(r=t.images[0]=L(),t),C(r,e),t.mipmask=1;T(t,t.images[0]),!t.compressed||t.internalformat!==Dr&&t.internalformat!==Lr&&t.internalformat!==Br&&t.internalformat!==Rr||rt(t.width%4==0&&t.height%4==0,"for compressed texture formats, mipmap level 0 must have width and height that are a multiple of 4")}function V(t,e){for(var r=t.images,n=0;n<r.length;++n){if(!r[n])return;P(r[n],e,n)}}var U=[];function j(){var t=U.pop()||new R;E.call(t),t.mipmask=0;for(var e=0;e<16;++e)t.images[e]=null;return t}function N(t){for(var e=t.images,r=0;r<e.length;++r)e[r]&&B(e[r]),e[r]=null;U.push(t)}function q(){this.minFilter=rn,this.magFilter=rn,this.wrapS=Jr,this.wrapT=Jr,this.anisotropic=1,this.genMipmaps=!1,this.mipmapHint=cn}function $(t,e){if("min"in e){var r=e.min;rt.parameter(r,h),t.minFilter=h[r],xn.indexOf(t.minFilter)>=0&&!("faces"in e)&&(t.genMipmaps=!0)}if("mag"in e){var n=e.mag;rt.parameter(n,p),t.magFilter=p[n]}var o=t.wrapS,a=t.wrapT;if("wrap"in e){var s=e.wrap;"string"==typeof s?(rt.parameter(s,c),o=a=c[s]):Array.isArray(s)&&(rt.parameter(s[0],c),rt.parameter(s[1],c),o=c[s[0]],a=c[s[1]])}else{if("wrapS"in e){var u=e.wrapS;rt.parameter(u,c),o=c[u]}if("wrapT"in e){var f=e.wrapT;rt.parameter(f,c),a=c[f]}}if(t.wrapS=o,t.wrapT=a,"anisotropic"in e){var d=e.anisotropic;rt("number"==typeof d&&d>=1&&d<=i.maxAnisotropic,"aniso samples must be between 1 and "),t.anisotropic=e.anisotropic}if("mipmap"in e){var m=!1;switch(typeof e.mipmap){case"string":rt.parameter(e.mipmap,l,"invalid mipmap hint"),t.mipmapHint=l[e.mipmap],t.genMipmaps=!0,m=!0;break;case"boolean":m=t.genMipmaps=e.mipmap;break;case"object":rt(Array.isArray(e.mipmap),"invalid mipmap type"),t.genMipmaps=!1,m=!0;break;default:rt.raise("invalid mipmap type")}m&&!("min"in e)&&(t.minFilter=on)}}function Z(t,e){r.texParameteri(e,en,t.minFilter),r.texParameteri(e,tn,t.magFilter),r.texParameteri(e,Hr,t.wrapS),r.texParameteri(e,Kr,t.wrapT),n.ext_texture_filter_anisotropic&&r.texParameteri(e,fn,t.anisotropic),t.genMipmaps&&(r.hint(ln,t.mipmapHint),r.generateMipmap(e))}var G=0,W={},X=i.maxTextureUnits,H=Array(X).map((function(){return null}));function K(t){E.call(this),this.mipmask=0,this.internalformat=yr,this.id=G++,this.refCount=1,this.target=t,this.texture=r.createTexture(),this.unit=-1,this.bindCount=0,this.texInfo=new q,u.profile&&(this.stats={size:0})}function Y(t){r.activeTexture(_n),r.bindTexture(t.target,t.texture)}function J(){var t=H[0];t?r.bindTexture(t.target,t.texture):r.bindTexture(fr,null)}function Q(t){var e=t.texture;rt(e,"must not double destroy texture");var n=t.unit,i=t.target;n>=0&&(r.activeTexture(_n+n),r.bindTexture(i,null),H[n]=null),r.deleteTexture(e),t.texture=null,t.params=null,t.pixels=null,t.refCount=0,delete W[t.id],s.textureCount--}function tt(t,e){var n=new K(fr);function o(t,e){var r=n.texInfo;q.call(r);var a=j();return"number"==typeof t?O(a,0|t,"number"==typeof e?0|e:0|t):t?(rt.type(t,"object","invalid arguments to regl.texture"),$(r,t),F(a,t)):O(a,1,1),r.genMipmaps&&(a.mipmask=(a.width<<1)-1),n.mipmask=a.mipmask,T(n,a),rt.texture2D(r,a,i),n.internalformat=a.internalformat,o.width=a.width,o.height=a.height,Y(n),V(a,fr),Z(r,fr),J(),N(a),u.profile&&(n.stats.size=Xn(n.internalformat,n.type,a.width,a.height,r.genMipmaps,!1)),o.format=_[n.internalformat],o.type=x[n.type],o.mag=b[r.magFilter],o.min=w[r.minFilter],o.wrapS=S[r.wrapS],o.wrapT=S[r.wrapT],o}function a(t,e,r,i){rt(!!t,"must specify image data");var a=0|e,s=0|r,u=0|i,l=L();return T(l,n),l.width=0,l.height=0,C(l,t),l.width=l.width||(n.width>>u)-a,l.height=l.height||(n.height>>u)-s,rt(n.type===l.type&&n.format===l.format&&n.internalformat===l.internalformat,"incompatible format for texture.subimage"),rt(a>=0&&s>=0&&a+l.width<=n.width&&s+l.height<=n.height,"texture.subimage write out of bounds"),rt(n.mipmask&1<<u,"missing mipmap data"),rt(l.data||l.element||l.needsCopy,"missing image data"),Y(n),M(l,fr,a,s,u),J(),B(l),o}function l(t,e){var i=0|t,a=0|e||i;if(i===n.width&&a===n.height)return o;o.width=n.width=i,o.height=n.height=a,Y(n);for(var s=0;n.mipmask>>s;++s){var l=i>>s,c=a>>s;if(!l||!c)break;r.texImage2D(fr,s,n.format,l,c,0,n.format,n.type,null)}return J(),u.profile&&(n.stats.size=Xn(n.internalformat,n.type,i,a,!1,!1)),o}return W[n.id]=n,s.textureCount++,o(t,e),o.subimage=a,o.resize=l,o._reglType="texture2d",o._texture=n,u.profile&&(o.stats=n.stats),o.destroy=function(){n.decRef()},o}function et(t,e,n,o,a,l){var c=new K(dr);W[c.id]=c,s.cubeCount++;var p=new Array(6);function h(t,e,r,n,o,a){var s,l=c.texInfo;for(q.call(l),s=0;s<6;++s)p[s]=j();if("number"!=typeof t&&t)if("object"==typeof t)if(e)F(p[0],t),F(p[1],e),F(p[2],r),F(p[3],n),F(p[4],o),F(p[5],a);else if($(l,t),k(c,t),"faces"in t){var f=t.faces;for(rt(Array.isArray(f)&&6===f.length,"cube faces must be a length 6 array"),s=0;s<6;++s)rt("object"==typeof f[s]&&!!f[s],"invalid input for cube map face"),T(p[s],c),F(p[s],f[s])}else for(s=0;s<6;++s)F(p[s],t);else rt.raise("invalid arguments to cube map");else{var d=0|t||1;for(s=0;s<6;++s)O(p[s],d,d)}for(T(c,p[0]),rt.optional((function(){i.npotTextureCube||rt(pr(c.width)&&pr(c.height),"your browser does not support non power or two texture dimensions")})),l.genMipmaps?c.mipmask=(p[0].width<<1)-1:c.mipmask=p[0].mipmask,rt.textureCube(c,l,p,i),c.internalformat=p[0].internalformat,h.width=p[0].width,h.height=p[0].height,Y(c),s=0;s<6;++s)V(p[s],mr+s);for(Z(l,dr),J(),u.profile&&(c.stats.size=Xn(c.internalformat,c.type,h.width,h.height,l.genMipmaps,!0)),h.format=_[c.internalformat],h.type=x[c.type],h.mag=b[l.magFilter],h.min=w[l.minFilter],h.wrapS=S[l.wrapS],h.wrapT=S[l.wrapT],s=0;s<6;++s)N(p[s]);return h}function f(t,e,r,n,i){rt(!!e,"must specify image data"),rt("number"==typeof t&&t===(0|t)&&t>=0&&t<6,"invalid face");var o=0|r,a=0|n,s=0|i,u=L();return T(u,c),u.width=0,u.height=0,C(u,e),u.width=u.width||(c.width>>s)-o,u.height=u.height||(c.height>>s)-a,rt(c.type===u.type&&c.format===u.format&&c.internalformat===u.internalformat,"incompatible format for texture.subimage"),rt(o>=0&&a>=0&&o+u.width<=c.width&&a+u.height<=c.height,"texture.subimage write out of bounds"),rt(c.mipmask&1<<s,"missing mipmap data"),rt(u.data||u.element||u.needsCopy,"missing image data"),Y(c),M(u,mr+t,o,a,s),J(),B(u),h}function d(t){var e=0|t;if(e!==c.width){h.width=c.width=e,h.height=c.height=e,Y(c);for(var n=0;n<6;++n)for(var i=0;c.mipmask>>i;++i)r.texImage2D(mr+n,i,c.format,e>>i,e>>i,0,c.format,c.type,null);return J(),u.profile&&(c.stats.size=Xn(c.internalformat,c.type,h.width,h.height,!1,!0)),h}}return h(t,e,n,o,a,l),h.subimage=f,h.resize=d,h._reglType="textureCube",h._texture=c,u.profile&&(h.stats=c.stats),h.destroy=function(){c.decRef()},h}function nt(){for(var t=0;t<X;++t)r.activeTexture(_n+t),r.bindTexture(fr,null),H[t]=null;Ae(W).forEach(Q),s.cubeCount=0,s.textureCount=0}function it(){for(var t=0;t<X;++t){var e=H[t];e&&(e.bindCount=0,e.unit=-1,H[t]=null)}Ae(W).forEach((function(t){t.texture=r.createTexture(),r.bindTexture(t.target,t.texture);for(var e=0;e<32;++e)if(0!=(t.mipmask&1<<e))if(t.target===fr)r.texImage2D(fr,e,t.internalformat,t.width>>e,t.height>>e,0,t.internalformat,t.type,null);else for(var n=0;n<6;++n)r.texImage2D(mr+n,e,t.internalformat,t.width>>e,t.height>>e,0,t.internalformat,t.type,null);Z(t.texInfo,t.target)}))}function ot(){for(var t=0;t<X;++t){var e=H[t];e&&(e.bindCount=0,e.unit=-1,H[t]=null),r.activeTexture(_n+t),r.bindTexture(fr,null),r.bindTexture(dr,null)}}return e(K.prototype,{bind:function(){var t=this;t.bindCount+=1;var e=t.unit;if(e<0){for(var n=0;n<X;++n){var i=H[n];if(i){if(i.bindCount>0)continue;i.unit=-1}H[n]=t,e=n;break}e>=X&&rt.raise("insufficient number of texture units"),u.profile&&s.maxTextureUnits<e+1&&(s.maxTextureUnits=e+1),t.unit=e,r.activeTexture(_n+e),r.bindTexture(t.target,t.texture)}return e},unbind:function(){this.bindCount-=1},decRef:function(){--this.refCount<=0&&Q(this)}}),u.profile&&(s.getTotalTextureSize=function(){var t=0;return Object.keys(W).forEach((function(e){t+=W[e].stats.size})),t}),{create2D:tt,createCube:et,clear:nt,getTexture:function(t){return null},restore:it,refresh:ot}}Mn[br]=2,Mn[wr]=2,Mn[Sr]=2,Mn[zr]=4,Mn[Dr]=.5,Mn[Lr]=.5,Mn[Br]=1,Mn[Rr]=1,Mn[Or]=.5,Mn[Fr]=1,Mn[Vr]=1,Mn[Ur]=.5,Mn[jr]=.25,Mn[Nr]=.5,Mn[qr]=.25,Mn[$r]=.5;var Kn=36161,Yn=32854,Jn=32855,Qn=36194,ti=33189,ei=36168,ri=34041,ni=35907,ii=34836,oi=34842,ai=34843,si=[];function ui(t,e,r){return si[t]*e*r}si[Yn]=2,si[Jn]=2,si[Qn]=2,si[ti]=2,si[ei]=1,si[ri]=4,si[ni]=4,si[ii]=16,si[oi]=8,si[ai]=6;var li=function(t,e,r,n,i){var o={rgba4:Yn,rgb565:Qn,"rgb5 a1":Jn,depth:ti,stencil:ei,"depth stencil":ri};e.ext_srgb&&(o.srgba=ni),e.ext_color_buffer_half_float&&(o.rgba16f=oi,o.rgb16f=ai),e.webgl_color_buffer_float&&(o.rgba32f=ii);var a=[];Object.keys(o).forEach((function(t){var e=o[t];a[e]=t}));var s=0,u={};function l(t){this.id=s++,this.refCount=1,this.renderbuffer=t,this.format=Yn,this.width=0,this.height=0,i.profile&&(this.stats={size:0})}function c(e){var r=e.renderbuffer;rt(r,"must not double destroy renderbuffer"),t.bindRenderbuffer(Kn,null),t.deleteRenderbuffer(r),e.renderbuffer=null,e.refCount=0,delete u[e.id],n.renderbufferCount--}function p(e,s){var c=new l(t.createRenderbuffer());function p(e,n){var s=0,u=0,l=Yn;if("object"==typeof e&&e){var h=e;if("shape"in h){var f=h.shape;rt(Array.isArray(f)&&f.length>=2,"invalid renderbuffer shape"),s=0|f[0],u=0|f[1]}else"radius"in h&&(s=u=0|h.radius),"width"in h&&(s=0|h.width),"height"in h&&(u=0|h.height);"format"in h&&(rt.parameter(h.format,o,"invalid renderbuffer format"),l=o[h.format])}else"number"==typeof e?(s=0|e,u="number"==typeof n?0|n:s):e?rt.raise("invalid arguments to renderbuffer constructor"):s=u=1;if(rt(s>0&&u>0&&s<=r.maxRenderbufferSize&&u<=r.maxRenderbufferSize,"invalid renderbuffer size"),s!==c.width||u!==c.height||l!==c.format)return p.width=c.width=s,p.height=c.height=u,c.format=l,t.bindRenderbuffer(Kn,c.renderbuffer),t.renderbufferStorage(Kn,l,s,u),rt(0===t.getError(),"invalid render buffer format"),i.profile&&(c.stats.size=ui(c.format,c.width,c.height)),p.format=a[c.format],p}function h(e,n){var o=0|e,a=0|n||o;return o===c.width&&a===c.height||(rt(o>0&&a>0&&o<=r.maxRenderbufferSize&&a<=r.maxRenderbufferSize,"invalid renderbuffer size"),p.width=c.width=o,p.height=c.height=a,t.bindRenderbuffer(Kn,c.renderbuffer),t.renderbufferStorage(Kn,c.format,o,a),rt(0===t.getError(),"invalid render buffer format"),i.profile&&(c.stats.size=ui(c.format,c.width,c.height))),p}return u[c.id]=c,n.renderbufferCount++,p(e,s),p.resize=h,p._reglType="renderbuffer",p._renderbuffer=c,i.profile&&(p.stats=c.stats),p.destroy=function(){c.decRef()},p}function h(){Ae(u).forEach((function(e){e.renderbuffer=t.createRenderbuffer(),t.bindRenderbuffer(Kn,e.renderbuffer),t.renderbufferStorage(Kn,e.format,e.width,e.height)})),t.bindRenderbuffer(Kn,null)}return l.prototype.decRef=function(){--this.refCount<=0&&c(this)},i.profile&&(n.getTotalRenderbufferSize=function(){var t=0;return Object.keys(u).forEach((function(e){t+=u[e].stats.size})),t}),{create:p,clear:function(){Ae(u).forEach(c)},restore:h}},ci=36160,pi=36161,hi=3553,fi=34069,di=36064,mi=36096,yi=36128,gi=33306,vi=36053,_i=36054,xi=36055,bi=36057,wi=36061,Si=36193,Ai=5121,Ei=5126,Ti=6407,ki=6408,Ii=6402,zi=[Ti,ki],Ci=[];Ci[ki]=4,Ci[Ti]=3;var Pi=[];Pi[Ai]=1,Pi[Ei]=4,Pi[Si]=2;var Mi=33189,Di=36168,Li=34041,Bi=[32854,32855,36194,35907,34842,34843,34836],Ri={};function Oi(t,r,n,i,o,a){var s={cur:null,next:null,dirty:!1,setFBO:null},u=["rgba"],l=["rgba4","rgb565","rgb5 a1"];r.ext_srgb&&l.push("srgba"),r.ext_color_buffer_half_float&&l.push("rgba16f","rgb16f"),r.webgl_color_buffer_float&&l.push("rgba32f");var c=["uint8"];function p(t,e,r){this.target=t,this.texture=e,this.renderbuffer=r;var n=0,i=0;e?(n=e.width,i=e.height):r&&(n=r.width,i=r.height),this.width=n,this.height=i}function h(t){t&&(t.texture&&t.texture._texture.decRef(),t.renderbuffer&&t.renderbuffer._renderbuffer.decRef())}function f(t,e,r){if(t)if(t.texture){var n=t.texture._texture,i=Math.max(1,n.width),o=Math.max(1,n.height);rt(i===e&&o===r,"inconsistent width/height for supplied texture"),n.refCount+=1}else{var a=t.renderbuffer._renderbuffer;rt(a.width===e&&a.height===r,"inconsistent width/height for renderbuffer"),a.refCount+=1}}function d(e,r){r&&(r.texture?t.framebufferTexture2D(ci,e,r.target,r.texture._texture.texture,0):t.framebufferRenderbuffer(ci,e,pi,r.renderbuffer._renderbuffer.renderbuffer))}function m(t){var e=hi,r=null,n=null,i=t;"object"==typeof t&&(i=t.data,"target"in t&&(e=0|t.target)),rt.type(i,"function","invalid attachment data");var o=i._reglType;return"texture2d"===o?(r=i,rt(e===hi)):"textureCube"===o?(r=i,rt(e>=fi&&e<fi+6,"invalid cube map target")):"renderbuffer"===o?(n=i,e=pi):rt.raise("invalid regl object for attachment"),new p(e,r,n)}function y(t,e,r,n,a){if(r){var s=i.create2D({width:t,height:e,format:n,type:a});return s._texture.refCount=0,new p(hi,s,null)}var u=o.create({width:t,height:e,format:n});return u._renderbuffer.refCount=0,new p(pi,null,u)}function g(t){return t&&(t.texture||t.renderbuffer)}function v(t,e,r){t&&(t.texture?t.texture.resize(e,r):t.renderbuffer&&t.renderbuffer.resize(e,r),t.width=e,t.height=r)}r.oes_texture_half_float&&c.push("half float","float16"),r.oes_texture_float&&c.push("float","float32");var _=0,x={};function b(){this.id=_++,x[this.id]=this,this.framebuffer=t.createFramebuffer(),this.width=0,this.height=0,this.colorAttachments=[],this.depthAttachment=null,this.stencilAttachment=null,this.depthStencilAttachment=null}function w(t){t.colorAttachments.forEach(h),h(t.depthAttachment),h(t.stencilAttachment),h(t.depthStencilAttachment)}function S(e){var r=e.framebuffer;rt(r,"must not double destroy framebuffer"),t.deleteFramebuffer(r),e.framebuffer=null,a.framebufferCount--,delete x[e.id]}function A(e){var r;t.bindFramebuffer(ci,e.framebuffer);var i=e.colorAttachments;for(r=0;r<i.length;++r)d(di+r,i[r]);for(r=i.length;r<n.maxColorAttachments;++r)t.framebufferTexture2D(ci,di+r,hi,null,0);t.framebufferTexture2D(ci,gi,hi,null,0),t.framebufferTexture2D(ci,mi,hi,null,0),t.framebufferTexture2D(ci,yi,hi,null,0),d(mi,e.depthAttachment),d(yi,e.stencilAttachment),d(gi,e.depthStencilAttachment);var o=t.checkFramebufferStatus(ci);t.isContextLost()||o===vi||rt.raise("framebuffer configuration not supported, status = "+Ri[o]),t.bindFramebuffer(ci,s.next?s.next.framebuffer:null),s.cur=s.next,t.getError()}function E(t,i){var o=new b;function p(t,e){var i;rt(s.next!==o,"can not update framebuffer which is currently in use");var a=0,h=0,d=!0,v=!0,_=null,x=!0,b="rgba",S="uint8",E=1,T=null,k=null,I=null,z=!1;if("number"==typeof t)a=0|t,h=0|e||a;else if(t){rt.type(t,"object","invalid arguments for framebuffer");var C=t;if("shape"in C){var P=C.shape;rt(Array.isArray(P)&&P.length>=2,"invalid shape for framebuffer"),a=P[0],h=P[1]}else"radius"in C&&(a=h=C.radius),"width"in C&&(a=C.width),"height"in C&&(h=C.height);("color"in C||"colors"in C)&&(_=C.color||C.colors,Array.isArray(_)&&rt(1===_.length||r.webgl_draw_buffers,"multiple render targets not supported")),_||("colorCount"in C&&(E=0|C.colorCount,rt(E>0,"invalid color buffer count")),"colorTexture"in C&&(x=!!C.colorTexture,b="rgba4"),"colorType"in C&&(S=C.colorType,x?(rt(r.oes_texture_float||!("float"===S||"float32"===S),"you must enable OES_texture_float in order to use floating point framebuffer objects"),rt(r.oes_texture_half_float||!("half float"===S||"float16"===S),"you must enable OES_texture_half_float in order to use 16-bit floating point framebuffer objects")):"half float"===S||"float16"===S?(rt(r.ext_color_buffer_half_float,"you must enable EXT_color_buffer_half_float to use 16-bit render buffers"),b="rgba16f"):"float"!==S&&"float32"!==S||(rt(r.webgl_color_buffer_float,"you must enable WEBGL_color_buffer_float in order to use 32-bit floating point renderbuffers"),b="rgba32f"),rt.oneOf(S,c,"invalid color type")),"colorFormat"in C&&(b=C.colorFormat,u.indexOf(b)>=0?x=!0:l.indexOf(b)>=0?x=!1:rt.optional((function(){x?rt.oneOf(C.colorFormat,u,"invalid color format for texture"):rt.oneOf(C.colorFormat,l,"invalid color format for renderbuffer")})))),("depthTexture"in C||"depthStencilTexture"in C)&&(z=!(!C.depthTexture&&!C.depthStencilTexture),rt(!z||r.webgl_depth_texture,"webgl_depth_texture extension not supported")),"depth"in C&&("boolean"==typeof C.depth?d=C.depth:(T=C.depth,v=!1)),"stencil"in C&&("boolean"==typeof C.stencil?v=C.stencil:(k=C.stencil,d=!1)),"depthStencil"in C&&("boolean"==typeof C.depthStencil?d=v=C.depthStencil:(I=C.depthStencil,d=!1,v=!1))}else a=h=1;var M=null,D=null,L=null,B=null;if(Array.isArray(_))M=_.map(m);else if(_)M=[m(_)];else for(M=new Array(E),i=0;i<E;++i)M[i]=y(a,h,x,b,S);rt(r.webgl_draw_buffers||M.length<=1,"you must enable the WEBGL_draw_buffers extension in order to use multiple color buffers."),rt(M.length<=n.maxColorAttachments,"too many color attachments, not supported"),a=a||M[0].width,h=h||M[0].height,T?D=m(T):d&&!v&&(D=y(a,h,z,"depth","uint32")),k?L=m(k):v&&!d&&(L=y(a,h,!1,"stencil","uint8")),I?B=m(I):!T&&!k&&v&&d&&(B=y(a,h,z,"depth stencil","depth stencil")),rt(!!T+!!k+!!I<=1,"invalid framebuffer configuration, can specify exactly one depth/stencil attachment");var R=null;for(i=0;i<M.length;++i)if(f(M[i],a,h),rt(!M[i]||M[i].texture&&zi.indexOf(M[i].texture._texture.format)>=0||M[i].renderbuffer&&Bi.indexOf(M[i].renderbuffer._renderbuffer.format)>=0,"framebuffer color attachment "+i+" is invalid"),M[i]&&M[i].texture){var O=Ci[M[i].texture._texture.format]*Pi[M[i].texture._texture.type];null===R?R=O:rt(R===O,"all color attachments much have the same number of bits per pixel.")}return f(D,a,h),rt(!D||D.texture&&D.texture._texture.format===Ii||D.renderbuffer&&D.renderbuffer._renderbuffer.format===Mi,"invalid depth attachment for framebuffer object"),f(L,a,h),rt(!L||L.renderbuffer&&L.renderbuffer._renderbuffer.format===Di,"invalid stencil attachment for framebuffer object"),f(B,a,h),rt(!B||B.texture&&B.texture._texture.format===Li||B.renderbuffer&&B.renderbuffer._renderbuffer.format===Li,"invalid depth-stencil attachment for framebuffer object"),w(o),o.width=a,o.height=h,o.colorAttachments=M,o.depthAttachment=D,o.stencilAttachment=L,o.depthStencilAttachment=B,p.color=M.map(g),p.depth=g(D),p.stencil=g(L),p.depthStencil=g(B),p.width=o.width,p.height=o.height,A(o),p}function h(t,e){rt(s.next!==o,"can not resize a framebuffer which is currently in use");var r=Math.max(0|t,1),n=Math.max(0|e||r,1);if(r===o.width&&n===o.height)return p;for(var i=o.colorAttachments,a=0;a<i.length;++a)v(i[a],r,n);return v(o.depthAttachment,r,n),v(o.stencilAttachment,r,n),v(o.depthStencilAttachment,r,n),o.width=p.width=r,o.height=p.height=n,A(o),p}return a.framebufferCount++,p(t,i),e(p,{resize:h,_reglType:"framebuffer",_framebuffer:o,destroy:function(){S(o),w(o)},use:function(t){s.setFBO({framebuffer:p},t)}})}function T(t){var o=Array(6);function a(t){var n;rt(o.indexOf(s.next)<0,"can not update framebuffer which is currently in use");var l,p={color:null},h=0,f=null,d="rgba",m="uint8",y=1;if("number"==typeof t)h=0|t;else if(t){rt.type(t,"object","invalid arguments for framebuffer");var g=t;if("shape"in g){var v=g.shape;rt(Array.isArray(v)&&v.length>=2,"invalid shape for framebuffer"),rt(v[0]===v[1],"cube framebuffer must be square"),h=v[0]}else"radius"in g&&(h=0|g.radius),"width"in g?(h=0|g.width,"height"in g&&rt(g.height===h,"must be square")):"height"in g&&(h=0|g.height);("color"in g||"colors"in g)&&(f=g.color||g.colors,Array.isArray(f)&&rt(1===f.length||r.webgl_draw_buffers,"multiple render targets not supported")),f||("colorCount"in g&&(y=0|g.colorCount,rt(y>0,"invalid color buffer count")),"colorType"in g&&(rt.oneOf(g.colorType,c,"invalid color type"),m=g.colorType),"colorFormat"in g&&(d=g.colorFormat,rt.oneOf(g.colorFormat,u,"invalid color format for texture"))),"depth"in g&&(p.depth=g.depth),"stencil"in g&&(p.stencil=g.stencil),"depthStencil"in g&&(p.depthStencil=g.depthStencil)}else h=1;if(f)if(Array.isArray(f))for(l=[],n=0;n<f.length;++n)l[n]=f[n];else l=[f];else{l=Array(y);var _={radius:h,format:d,type:m};for(n=0;n<y;++n)l[n]=i.createCube(_)}for(p.color=Array(l.length),n=0;n<l.length;++n){var x=l[n];rt("function"==typeof x&&"textureCube"===x._reglType,"invalid cube map"),h=h||x.width,rt(x.width===h&&x.height===h,"invalid cube map shape"),p.color[n]={target:fi,data:l[n]}}for(n=0;n<6;++n){for(var b=0;b<l.length;++b)p.color[b].target=fi+n;n>0&&(p.depth=o[0].depth,p.stencil=o[0].stencil,p.depthStencil=o[0].depthStencil),o[n]?o[n](p):o[n]=E(p)}return e(a,{width:h,height:h,color:l})}function l(t){var e,r=0|t;if(rt(r>0&&r<=n.maxCubeMapSize,"invalid radius for cube fbo"),r===a.width)return a;var i=a.color;for(e=0;e<i.length;++e)i[e].resize(r);for(e=0;e<6;++e)o[e].resize(r);return a.width=a.height=r,a}return a(t),e(a,{faces:o,resize:l,_reglType:"framebufferCube",destroy:function(){o.forEach((function(t){t.destroy()}))}})}function k(){s.cur=null,s.next=null,s.dirty=!0,Ae(x).forEach((function(e){e.framebuffer=t.createFramebuffer(),A(e)}))}return e(s,{getFramebuffer:function(t){if("function"==typeof t&&"framebuffer"===t._reglType){var e=t._framebuffer;if(e instanceof b)return e}return null},create:E,createCube:T,clear:function(){Ae(x).forEach(S)},restore:k})}Ri[vi]="complete",Ri[_i]="incomplete attachment",Ri[bi]="incomplete dimensions",Ri[xi]="incomplete, missing attachment",Ri[wi]="unsupported";var Fi=5126,Vi=34962,Ui=34963,ji=["attributes","elements","offset","count","primitive","instances"];function Ni(){this.state=0,this.x=0,this.y=0,this.z=0,this.w=0,this.buffer=null,this.size=0,this.normalized=!1,this.type=Fi,this.offset=0,this.stride=0,this.divisor=0}function qi(e,r,n,i,o,a,s){for(var u=n.maxAttributes,l=new Array(u),c=0;c<u;++c)l[c]=new Ni;var p=0,h={},f={Record:Ni,scope:{},state:l,currentVAO:null,targetVAO:null,restore:m()?w:function(){},createVAO:S,getVAO:g,destroyBuffer:d,setVAO:m()?v:_,clear:m()?x:function(){}};function d(t){for(var r=0;r<l.length;++r){var n=l[r];n.buffer===t&&(e.disableVertexAttribArray(r),n.buffer=null)}}function m(){return r.oes_vertex_array_object}function y(){return r.angle_instanced_arrays}function g(t){return"function"==typeof t&&t._vao?t._vao:null}function v(t){if(t!==f.currentVAO){var e=m();t?e.bindVertexArrayOES(t.vao):e.bindVertexArrayOES(null),f.currentVAO=t}}function _(t){if(t!==f.currentVAO){if(t)t.bindAttrs();else{for(var r=y(),n=0;n<l.length;++n){var i=l[n];i.buffer?(e.enableVertexAttribArray(n),i.buffer.bind(),e.vertexAttribPointer(n,i.size,i.type,i.normalized,i.stride,i.offfset),r&&i.divisor&&r.vertexAttribDivisorANGLE(n,i.divisor)):(e.disableVertexAttribArray(n),e.vertexAttrib4f(n,i.x,i.y,i.z,i.w))}s.elements?e.bindBuffer(Ui,s.elements.buffer.buffer):e.bindBuffer(Ui,null)}f.currentVAO=t}}function x(){Ae(h).forEach((function(t){t.destroy()}))}function b(){this.id=++p,this.attributes=[],this.elements=null,this.ownsElements=!1,this.count=0,this.offset=0,this.instances=-1,this.primitive=4;var t=m();this.vao=t?t.createVertexArrayOES():null,h[this.id]=this,this.buffers=[]}function w(){m()&&Ae(h).forEach((function(t){t.refresh()}))}function S(e){var n=new b;function s(e){var i;if(Array.isArray(e))i=e,n.elements&&n.ownsElements&&n.elements.destroy(),n.elements=null,n.ownsElements=!1,n.offset=0,n.count=0,n.instances=-1,n.primitive=4;else{if(rt("object"==typeof e,"invalid arguments for create vao"),rt("attributes"in e,"must specify attributes for vao"),e.elements){var l=e.elements;n.ownsElements?"function"==typeof l&&"elements"===l._reglType?(n.elements.destroy(),n.ownsElements=!1):(n.elements(l),n.ownsElements=!1):a.getElements(e.elements)?(n.elements=e.elements,n.ownsElements=!1):(n.elements=a.create(e.elements),n.ownsElements=!0)}else n.elements=null,n.ownsElements=!1;i=e.attributes,n.offset=0,n.count=-1,n.instances=-1,n.primitive=4,n.elements&&(n.count=n.elements._elements.vertCount,n.primitive=n.elements._elements.primType),"offset"in e&&(n.offset=0|e.offset),"count"in e&&(n.count=0|e.count),"instances"in e&&(n.instances=0|e.instances),"primitive"in e&&(rt(e.primitive in Ge,"bad primitive type: "+e.primitive),n.primitive=Ge[e.primitive]),rt.optional((()=>{for(var t=Object.keys(e),r=0;r<t.length;++r)rt(ji.indexOf(t[r])>=0,'invalid option for vao: "'+t[r]+'" valid options are '+ji)})),rt(Array.isArray(i),"attributes must be an array")}rt(i.length<u,"too many attributes"),rt(i.length>0,"must specify at least one attribute");var c={},p=n.attributes;p.length=i.length;for(var h=0;h<i.length;++h){var f,d=i[h],m=p[h]=new Ni,y=d.data||d;Array.isArray(y)||t(y)||Se(y)?(n.buffers[h]&&(f=n.buffers[h],t(y)&&f._buffer.byteLength>=y.byteLength?f.subdata(y):(f.destroy(),n.buffers[h]=null)),n.buffers[h]||(f=n.buffers[h]=o.create(d,Vi,!1,!0)),m.buffer=o.getBuffer(f),m.size=0|m.buffer.dimension,m.normalized=!1,m.type=m.buffer.dtype,m.offset=0,m.stride=0,m.divisor=0,m.state=1,c[h]=1):o.getBuffer(d)?(m.buffer=o.getBuffer(d),m.size=0|m.buffer.dimension,m.normalized=!1,m.type=m.buffer.dtype,m.offset=0,m.stride=0,m.divisor=0,m.state=1):o.getBuffer(d.buffer)?(m.buffer=o.getBuffer(d.buffer),m.size=0|(+d.size||m.buffer.dimension),m.normalized=!!d.normalized||!1,"type"in d?(rt.parameter(d.type,De,"invalid buffer type"),m.type=De[d.type]):m.type=m.buffer.dtype,m.offset=0|(d.offset||0),m.stride=0|(d.stride||0),m.divisor=0|(d.divisor||0),m.state=1,rt(m.size>=1&&m.size<=4,"size must be between 1 and 4"),rt(m.offset>=0,"invalid offset"),rt(m.stride>=0&&m.stride<=255,"stride must be between 0 and 255"),rt(m.divisor>=0,"divisor must be positive"),rt(!m.divisor||!!r.angle_instanced_arrays,"ANGLE_instanced_arrays must be enabled to use divisor")):"x"in d?(rt(h>0,"first attribute must not be a constant"),m.x=+d.x||0,m.y=+d.y||0,m.z=+d.z||0,m.w=+d.w||0,m.state=2):rt(!1,"invalid attribute spec for location "+h)}for(var g=0;g<n.buffers.length;++g)!c[g]&&n.buffers[g]&&(n.buffers[g].destroy(),n.buffers[g]=null);return n.refresh(),s}return i.vaoCount+=1,s.destroy=function(){for(var t=0;t<n.buffers.length;++t)n.buffers[t]&&n.buffers[t].destroy();n.buffers.length=0,n.ownsElements&&(n.elements.destroy(),n.elements=null,n.ownsElements=!1),n.destroy()},s._vao=n,s._reglType="vao",s(e)}return b.prototype.bindAttrs=function(){for(var t=y(),r=this.attributes,n=0;n<r.length;++n){var i=r[n];i.buffer?(e.enableVertexAttribArray(n),e.bindBuffer(Vi,i.buffer.buffer),e.vertexAttribPointer(n,i.size,i.type,i.normalized,i.stride,i.offset),t&&i.divisor&&t.vertexAttribDivisorANGLE(n,i.divisor)):(e.disableVertexAttribArray(n),e.vertexAttrib4f(n,i.x,i.y,i.z,i.w))}for(var o=r.length;o<u;++o)e.disableVertexAttribArray(o);var s=a.getElements(this.elements);s?e.bindBuffer(Ui,s.buffer.buffer):e.bindBuffer(Ui,null)},b.prototype.refresh=function(){var t=m();t&&(t.bindVertexArrayOES(this.vao),this.bindAttrs(),f.currentVAO=this)},b.prototype.destroy=function(){if(this.vao){var t=m();this===f.currentVAO&&(f.currentVAO=null,t.bindVertexArrayOES(null)),t.deleteVertexArrayOES(this.vao),this.vao=null}this.ownsElements&&(this.elements.destroy(),this.elements=null,this.ownsElements=!1),h[this.id]&&(delete h[this.id],i.vaoCount-=1)},f}var $i=35632,Zi=35633,Gi=35718,Wi=35721;function Xi(t,r,n,i){var o={},a={};function s(t,e,r,n){this.name=t,this.id=e,this.location=r,this.info=n}function u(t,e){for(var r=0;r<t.length;++r)if(t[r].id===e.id)return void(t[r].location=e.location);t.push(e)}function l(e,n,i){var s=e===$i?o:a,u=s[n];if(!u){var l=r.str(n);u=t.createShader(e),t.shaderSource(u,l),t.compileShader(u),rt.shaderError(t,u,l,e,i),s[n]=u}return u}var c={},p=[],h=0;function f(t,e){this.id=h++,this.fragId=t,this.vertId=e,this.program=null,this.uniforms=[],this.attributes=[],this.refCount=1,i.profile&&(this.stats={uniformsCount:0,attributesCount:0})}function d(e,n,o){var a,c,p=l($i,e.fragId),h=l(Zi,e.vertId),f=e.program=t.createProgram();if(t.attachShader(f,p),t.attachShader(f,h),o)for(a=0;a<o.length;++a){var d=o[a];t.bindAttribLocation(f,d[0],d[1])}t.linkProgram(f),rt.linkError(t,f,r.str(e.fragId),r.str(e.vertId),n);var m=t.getProgramParameter(f,Gi);i.profile&&(e.stats.uniformsCount=m);var y=e.uniforms;for(a=0;a<m;++a)if(c=t.getActiveUniform(f,a))if(c.size>1)for(var g=0;g<c.size;++g){var v=c.name.replace("[0]","["+g+"]");u(y,new s(v,r.id(v),t.getUniformLocation(f,v),c))}else u(y,new s(c.name,r.id(c.name),t.getUniformLocation(f,c.name),c));var _=t.getProgramParameter(f,Wi);i.profile&&(e.stats.attributesCount=_);var x=e.attributes;for(a=0;a<_;++a)(c=t.getActiveAttrib(f,a))&&u(x,new s(c.name,r.id(c.name),t.getAttribLocation(f,c.name),c))}function m(){o={},a={};for(var t=0;t<p.length;++t)d(p[t],null,p[t].attributes.map((function(t){return[t.location,t.name]})))}return i.profile&&(n.getMaxUniformsCount=function(){var t=0;return p.forEach((function(e){e.stats.uniformsCount>t&&(t=e.stats.uniformsCount)})),t},n.getMaxAttributesCount=function(){var t=0;return p.forEach((function(e){e.stats.attributesCount>t&&(t=e.stats.attributesCount)})),t}),{clear:function(){var e=t.deleteShader.bind(t);Ae(o).forEach(e),o={},Ae(a).forEach(e),a={},p.forEach((function(e){t.deleteProgram(e.program)})),p.length=0,c={},n.shaderCount=0},program:function(r,i,s,u){rt.command(r>=0,"missing vertex shader",s),rt.command(i>=0,"missing fragment shader",s);var l=c[i];l||(l=c[i]={});var h=l[r];if(h&&(h.refCount++,!u))return h;var m=new f(i,r);return n.shaderCount++,d(m,s,u),h||(l[r]=m),p.push(m),e(m,{destroy:function(){if(m.refCount--,m.refCount<=0){t.deleteProgram(m.program);var e=p.indexOf(m);p.splice(e,1),n.shaderCount--}l[m.vertId].refCount<=0&&(t.deleteShader(a[m.vertId]),delete a[m.vertId],delete c[m.fragId][m.vertId]),Object.keys(c[m.fragId]).length||(t.deleteShader(o[m.fragId]),delete o[m.fragId],delete c[m.fragId])}})},restore:m,shader:l,frag:-1,vert:-1}}var Hi=6408,Ki=5121,Yi=3333,Ji=5126;function Qi(e,r,n,i,o,a,s){function u(u){var l;null===r.next?(rt(o.preserveDrawingBuffer,'you must create a webgl context with "preserveDrawingBuffer":true in order to read pixels from the drawing buffer'),l=Ki):(rt(null!==r.next.colorAttachments[0].texture,"You cannot read from a renderbuffer"),l=r.next.colorAttachments[0].texture._texture.type,rt.optional((function(){a.oes_texture_float?(rt(l===Ki||l===Ji,"Reading from a framebuffer is only allowed for the types 'uint8' and 'float'"),l===Ji&&rt(s.readFloat,"Reading 'float' values is not permitted in your browser. For a fallback, please see: https://www.npmjs.com/package/glsl-read-float")):rt(l===Ki,"Reading from a framebuffer is only allowed for the type 'uint8'")})));var c=0,p=0,h=i.framebufferWidth,f=i.framebufferHeight,d=null;t(u)?d=u:u&&(rt.type(u,"object","invalid arguments to regl.read()"),c=0|u.x,p=0|u.y,rt(c>=0&&c<i.framebufferWidth,"invalid x offset for regl.read"),rt(p>=0&&p<i.framebufferHeight,"invalid y offset for regl.read"),h=0|(u.width||i.framebufferWidth-c),f=0|(u.height||i.framebufferHeight-p),d=u.data||null),d&&(l===Ki?rt(d instanceof Uint8Array,"buffer must be 'Uint8Array' when reading from a framebuffer of type 'uint8'"):l===Ji&&rt(d instanceof Float32Array,"buffer must be 'Float32Array' when reading from a framebuffer of type 'float'")),rt(h>0&&h+c<=i.framebufferWidth,"invalid width for read pixels"),rt(f>0&&f+p<=i.framebufferHeight,"invalid height for read pixels"),n();var m=h*f*4;return d||(l===Ki?d=new Uint8Array(m):l===Ji&&(d=d||new Float32Array(m))),rt.isTypedArray(d,"data buffer for regl.read() must be a typedarray"),rt(d.byteLength>=m,"data buffer for regl.read() too small"),e.pixelStorei(Yi,4),e.readPixels(c,p,h,f,Hi,l,d),d}function l(t){var e;return r.setFBO({framebuffer:t.framebuffer},(function(){e=u(t)})),e}function c(t){return t&&"framebuffer"in t?l(t):u(t)}return c}function to(t){return Array.prototype.slice.call(t)}function eo(t){return to(t).join("")}function ro(){var t=0,r=[],n=[];function i(e){for(var i=0;i<n.length;++i)if(n[i]===e)return r[i];var o="g"+t++;return r.push(o),n.push(e),o}function o(){var r=[];function n(){r.push.apply(r,to(arguments))}var i=[];function o(){var e="v"+t++;return i.push(e),arguments.length>0&&(r.push(e,"="),r.push.apply(r,to(arguments)),r.push(";")),e}return e(n,{def:o,toString:function(){return eo([i.length>0?"var "+i.join(",")+";":"",eo(r)])}})}function a(){var t=o(),r=o(),n=t.toString,i=r.toString;function a(e,n){r(e,n,"=",t.def(e,n),";")}return e((function(){t.apply(t,to(arguments))}),{def:t.def,entry:t,exit:r,save:a,set:function(e,r,n){a(e,r),t(e,r,"=",n,";")},toString:function(){return n()+i()}})}function s(){var t=eo(arguments),r=a(),n=a(),i=r.toString,o=n.toString;return e(r,{then:function(){return r.apply(r,to(arguments)),this},else:function(){return n.apply(n,to(arguments)),this},toString:function(){var e=o();return e&&(e="else{"+e+"}"),eo(["if(",t,"){",i(),"}",e])}})}var u=o(),l={};function c(t,r){var n=[];function i(){var t="a"+n.length;return n.push(t),t}r=r||0;for(var o=0;o<r;++o)i();var s=a(),u=s.toString;return l[t]=e(s,{arg:i,toString:function(){return eo(["function(",n.join(),"){",u(),"}"])}})}function p(){var t=['"use strict";',u,"return {"];Object.keys(l).forEach((function(e){t.push('"',e,'":',l[e].toString(),",")})),t.push("}");var e=eo(t).replace(/;/g,";\n").replace(/}/g,"}\n").replace(/{/g,"{\n");return Function.apply(null,r.concat(e)).apply(null,n)}return{global:u,link:i,block:o,proc:c,scope:a,cond:s,compile:p}}var no="xyzw".split(""),io=5121,oo=1,ao=2,so=0,uo=1,lo=2,co=3,po=4,ho=5,fo=6,mo="dither",yo="blend.enable",go="blend.color",vo="blend.equation",_o="blend.func",xo="depth.enable",bo="depth.func",wo="depth.range",So="depth.mask",Ao="colorMask",Eo="cull.enable",To="cull.face",ko="frontFace",Io="lineWidth",zo="polygonOffset.enable",Co="polygonOffset.offset",Po="sample.alpha",Mo="sample.enable",Do="sample.coverage",Lo="stencil.enable",Bo="stencil.mask",Ro="stencil.func",Oo="stencil.opFront",Fo="stencil.opBack",Vo="scissor.enable",Uo="scissor.box",jo="viewport",No="profile",qo="framebuffer",$o="vert",Zo="frag",Go="elements",Wo="primitive",Xo="count",Ho="offset",Ko="instances",Yo="vao",Jo="Width",Qo="Height",ta=qo+Jo,ea=qo+Qo,ra=jo+Jo,na=jo+Qo,ia="drawingBuffer",oa=ia+Jo,aa=ia+Qo,sa=[_o,vo,Ro,Oo,Fo,Do,jo,Uo,Co],ua=34962,la=34963,ca=3553,pa=34067,ha=2884,fa=3042,da=3024,ma=2960,ya=2929,ga=3089,va=32823,_a=32926,xa=32928,ba=5126,wa=35664,Sa=35665,Aa=35666,Ea=5124,Ta=35667,ka=35668,Ia=35669,za=35670,Ca=35671,Pa=35672,Ma=35673,Da=35674,La=35675,Ba=35676,Ra=35678,Oa=35680,Fa=4,Va=1028,Ua=1029,ja=2304,Na=2305,qa=32775,$a=32776,Za=519,Ga=7680,Wa=0,Xa=1,Ha=32774,Ka=513,Ya=36160,Ja=36064,Qa={0:0,1:1,zero:0,one:1,"src color":768,"one minus src color":769,"src alpha":770,"one minus src alpha":771,"dst color":774,"one minus dst color":775,"dst alpha":772,"one minus dst alpha":773,"constant color":32769,"one minus constant color":32770,"constant alpha":32771,"one minus constant alpha":32772,"src alpha saturate":776},ts=["constant color, constant alpha","one minus constant color, constant alpha","constant color, one minus constant alpha","one minus constant color, one minus constant alpha","constant alpha, constant color","constant alpha, one minus constant color","one minus constant alpha, constant color","one minus constant alpha, one minus constant color"],es={never:512,less:513,"<":513,equal:514,"=":514,"==":514,"===":514,lequal:515,"<=":515,greater:516,">":516,notequal:517,"!=":517,"!==":517,gequal:518,">=":518,always:519},rs={0:0,zero:0,keep:7680,replace:7681,increment:7682,decrement:7683,"increment wrap":34055,"decrement wrap":34056,invert:5386},ns={frag:35632,vert:35633},is={cw:ja,ccw:Na};function os(e){return Array.isArray(e)||t(e)||Se(e)}function as(t){return t.sort((function(t,e){return t===jo?-1:e===jo?1:t<e?-1:1}))}function ss(t,e,r,n){this.thisDep=t,this.contextDep=e,this.propDep=r,this.append=n}function us(t){return t&&!(t.thisDep||t.contextDep||t.propDep)}function ls(t){return new ss(!1,!1,!1,t)}function cs(t,e){var r=t.type;if(r===so){var n=t.data.length;return new ss(!0,n>=1,n>=2,e)}if(r===po){var i=t.data;return new ss(i.thisDep,i.contextDep,i.propDep,e)}if(r===ho)return new ss(!1,!1,!1,e);if(r===fo){for(var o=!1,a=!1,s=!1,u=0;u<t.data.length;++u){var l=t.data[u];if(l.type===uo)s=!0;else if(l.type===lo)a=!0;else if(l.type===co)o=!0;else if(l.type===so){o=!0;var c=l.data;c>=1&&(a=!0),c>=2&&(s=!0)}else l.type===po&&(o=o||l.data.thisDep,a=a||l.data.contextDep,s=s||l.data.propDep)}return new ss(o,a,s,e)}return new ss(r===co,r===lo,r===uo,e)}var ps=new ss(!1,!1,!1,(function(){}));function hs(t,r,n,i,o,a,s,u,l,c,p,h,f,d,m){var y=c.Record,g={add:32774,subtract:32778,"reverse subtract":32779};n.ext_blend_minmax&&(g.min=qa,g.max=$a);var v=n.angle_instanced_arrays,_=n.webgl_draw_buffers,x=n.oes_vertex_array_object,b={dirty:!0,profile:m.profile},w={},S=[],A={},E={};function T(t){return t.replace(".","_")}function k(t,e,r){var n=T(t);S.push(t),w[n]=b[n]=!!r,A[n]=e}function I(t,e,r){var n=T(t);S.push(t),Array.isArray(r)?(b[n]=r.slice(),w[n]=r.slice()):b[n]=w[n]=r,E[n]=e}k(mo,da),k(yo,fa),I(go,"blendColor",[0,0,0,0]),I(vo,"blendEquationSeparate",[Ha,Ha]),I(_o,"blendFuncSeparate",[Xa,Wa,Xa,Wa]),k(xo,ya,!0),I(bo,"depthFunc",Ka),I(wo,"depthRange",[0,1]),I(So,"depthMask",!0),I(Ao,Ao,[!0,!0,!0,!0]),k(Eo,ha),I(To,"cullFace",Ua),I(ko,ko,Na),I(Io,Io,1),k(zo,va),I(Co,"polygonOffset",[0,0]),k(Po,_a),k(Mo,xa),I(Do,"sampleCoverage",[1,!1]),k(Lo,ma),I(Bo,"stencilMask",-1),I(Ro,"stencilFunc",[Za,0,-1]),I(Oo,"stencilOpSeparate",[Va,Ga,Ga,Ga]),I(Fo,"stencilOpSeparate",[Ua,Ga,Ga,Ga]),k(Vo,ga),I(Uo,"scissor",[0,0,t.drawingBufferWidth,t.drawingBufferHeight]),I(jo,jo,[0,0,t.drawingBufferWidth,t.drawingBufferHeight]);var z={gl:t,context:f,strings:r,next:w,current:b,draw:h,elements:a,buffer:o,shader:p,attributes:c.state,vao:c,uniforms:l,framebuffer:u,extensions:n,timer:d,isBufferArgs:os},C={primTypes:Ge,compareFuncs:es,blendFuncs:Qa,blendEquations:g,stencilOps:rs,glTypes:De,orientationType:is};rt.optional((function(){z.isArrayLike=cr})),_&&(C.backBuffer=[Ua],C.drawBuffer=Tt(i.maxDrawbuffers,(function(t){return 0===t?[0]:Tt(t,(function(t){return Ja+t}))})));var P=0;function M(){var t=ro(),e=t.link,n=t.global;t.id=P++,t.batchId="0";var i=e(z),o=t.shared={props:"a0"};Object.keys(z).forEach((function(t){o[t]=n.def(i,".",t)})),rt.optional((function(){t.CHECK=e(rt),t.commandStr=rt.guessCommand(),t.command=e(t.commandStr),t.assert=function(t,r,n){t("if(!(",r,"))",this.CHECK,".commandRaise(",e(n),",",this.command,");")},C.invalidBlendCombinations=ts}));var a=t.next={},s=t.current={};Object.keys(E).forEach((function(t){Array.isArray(b[t])&&(a[t]=n.def(o.next,".",t),s[t]=n.def(o.current,".",t))}));var u=t.constants={};Object.keys(C).forEach((function(t){u[t]=n.def(JSON.stringify(C[t]))})),t.invoke=function(r,n){switch(n.type){case so:var i=["this",o.context,o.props,t.batchId];return r.def(e(n.data),".call(",i.slice(0,Math.max(n.data.length+1,4)),")");case uo:return r.def(o.props,n.data);case lo:return r.def(o.context,n.data);case co:return r.def("this",n.data);case po:return n.data.append(t,r),n.data.ref;case ho:return n.data.toString();case fo:return n.data.map((function(e){return t.invoke(r,e)}))}},t.attribCache={};var l={};return t.scopeAttrib=function(t){var n=r.id(t);if(n in l)return l[n];var i=c.scope[n];return i||(i=c.scope[n]=new y),l[n]=e(i)},t}function D(t){var e,r=t.static,n=t.dynamic;if(No in r){var i=!!r[No];(e=ls((function(t,e){return i}))).enable=i}else if(No in n){var o=n[No];e=cs(o,(function(t,e){return t.invoke(e,o)}))}return e}function L(t,e){var r=t.static,n=t.dynamic;if(qo in r){var i=r[qo];return i?(i=u.getFramebuffer(i),rt.command(i,"invalid framebuffer object"),ls((function(t,e){var r=t.link(i),n=t.shared;e.set(n.framebuffer,".next",r);var o=n.context;return e.set(o,"."+ta,r+".width"),e.set(o,"."+ea,r+".height"),r}))):ls((function(t,e){var r=t.shared;e.set(r.framebuffer,".next","null");var n=r.context;return e.set(n,"."+ta,n+"."+oa),e.set(n,"."+ea,n+"."+aa),"null"}))}if(qo in n){var o=n[qo];return cs(o,(function(t,e){var r=t.invoke(e,o),n=t.shared,i=n.framebuffer,a=e.def(i,".getFramebuffer(",r,")");rt.optional((function(){t.assert(e,"!"+r+"||"+a,"invalid framebuffer object")})),e.set(i,".next",a);var s=n.context;return e.set(s,"."+ta,a+"?"+a+".width:"+s+"."+oa),e.set(s,"."+ea,a+"?"+a+".height:"+s+"."+aa),a}))}return null}function B(t,e,r){var n=t.static,i=t.dynamic;function o(t){if(t in n){var o=n[t];rt.commandType(o,"object","invalid "+t,r.commandStr);var a,s,u=!0,l=0|o.x,c=0|o.y;return"width"in o?(a=0|o.width,rt.command(a>=0,"invalid "+t,r.commandStr)):u=!1,"height"in o?(s=0|o.height,rt.command(s>=0,"invalid "+t,r.commandStr)):u=!1,new ss(!u&&e&&e.thisDep,!u&&e&&e.contextDep,!u&&e&&e.propDep,(function(t,e){var r=t.shared.context,n=a;"width"in o||(n=e.def(r,".",ta,"-",l));var i=s;return"height"in o||(i=e.def(r,".",ea,"-",c)),[l,c,n,i]}))}if(t in i){var p=i[t],h=cs(p,(function(e,r){var n=e.invoke(r,p);rt.optional((function(){e.assert(r,n+"&&typeof "+n+'==="object"',"invalid "+t)}));var i=e.shared.context,o=r.def(n,".x|0"),a=r.def(n,".y|0"),s=r.def('"width" in ',n,"?",n,".width|0:","(",i,".",ta,"-",o,")"),u=r.def('"height" in ',n,"?",n,".height|0:","(",i,".",ea,"-",a,")");return rt.optional((function(){e.assert(r,s+">=0&&"+u+">=0","invalid "+t)})),[o,a,s,u]}));return e&&(h.thisDep=h.thisDep||e.thisDep,h.contextDep=h.contextDep||e.contextDep,h.propDep=h.propDep||e.propDep),h}return e?new ss(e.thisDep,e.contextDep,e.propDep,(function(t,e){var r=t.shared.context;return[0,0,e.def(r,".",ta),e.def(r,".",ea)]})):null}var a=o(jo);if(a){var s=a;a=new ss(a.thisDep,a.contextDep,a.propDep,(function(t,e){var r=s.append(t,e),n=t.shared.context;return e.set(n,"."+ra,r[2]),e.set(n,"."+na,r[3]),r}))}return{viewport:a,scissor_box:o(Uo)}}function R(t,e){var r=t.static;if("string"==typeof r[Zo]&&"string"==typeof r[$o]){if(Object.keys(e.dynamic).length>0)return null;var n=e.static,i=Object.keys(n);if(i.length>0&&"number"==typeof n[i[0]]){for(var o=[],a=0;a<i.length;++a)rt("number"==typeof n[i[a]],"must specify all vertex attribute locations when using vaos"),o.push([0|n[i[a]],i[a]]);return o}}return null}function O(t,e,n){var i=t.static,o=t.dynamic;function a(t){if(t in i){var e=r.id(i[t]);rt.optional((function(){p.shader(ns[t],e,rt.guessCommand())}));var n=ls((function(){return e}));return n.id=e,n}if(t in o){var a=o[t];return cs(a,(function(e,r){var n=e.invoke(r,a),i=r.def(e.shared.strings,".id(",n,")");return rt.optional((function(){r(e.shared.shader,".shader(",ns[t],",",i,",",e.command,");")})),i}))}return null}var s,u=a(Zo),l=a($o),c=null;return us(u)&&us(l)?(c=p.program(l.id,u.id,null,n),s=ls((function(t,e){return t.link(c)}))):s=new ss(u&&u.thisDep||l&&l.thisDep,u&&u.contextDep||l&&l.contextDep,u&&u.propDep||l&&l.propDep,(function(t,e){var r,n=t.shared.shader;r=u?u.append(t,e):e.def(n,".",Zo);var i=n+".program("+(l?l.append(t,e):e.def(n,".",$o))+","+r;return rt.optional((function(){i+=","+t.command})),e.def(i+")")})),{frag:u,vert:l,progVar:s,program:c}}function F(t,e){var r=t.static,n=t.dynamic,i={},o=!1,s=!1;function u(){if(Yo in r){rt(!r.elements&&!n.elements,"cannot specify elements with vao");var t=r[Yo];return null!==t&&null===c.getVAO(t)&&(t=c.createVAO(t)),o=!0,s=!!t,i.vao=t,ls((function(e){var r=c.getVAO(t);return r?e.link(r):"null"}))}if(Yo in n){rt(!r.elements&&!n.elements,"cannot specify elements with vao"),o=!0,s=!0;var e=n[Yo];return cs(e,(function(t,r){var n=t.invoke(r,e);return r.def(t.shared.vao+".getVAO("+n+")")}))}return null}var l=u(),p=!1;function h(){if(Go in r){rt(!s,"must not specify vao and elements");var t=r[Go];if(i.elements=t,os(t)){var u=i.elements=a.create(t,!0);t=a.getElements(u),p=!0}else t&&(t=a.getElements(t),p=!0,rt.command(t,"invalid elements",e.commandStr));var c=ls((function(e,r){if(t){var n=e.link(t);return e.ELEMENTS=n,n}return e.ELEMENTS=null,null}));return c.value=t,c}if(Go in n){rt(!s,"must not specify vao and elements"),p=!0;var h=n[Go];return cs(h,(function(t,e){var r=t.shared,n=r.isBufferArgs,i=r.elements,o=t.invoke(e,h),a=e.def("null"),s=e.def(n,"(",o,")"),u=t.cond(s).then(a,"=",i,".createStream(",o,");").else(a,"=",i,".getElements(",o,");");return rt.optional((function(){t.assert(u.else,"!"+o+"||"+a,"invalid elements")})),e.entry(u),e.exit(t.cond(s).then(i,".destroyStream(",a,");")),t.ELEMENTS=a,a}))}return o?new ss(l.thisDep,l.contextDep,l.propDep,(function(t,e){return e.def(t.shared.vao+".currentVAO?"+t.shared.elements+".getElements("+t.shared.vao+".currentVAO.elements):null")})):null}var f=h();function d(){if(Wo in r){var t=r[Wo];return i.primitive=t,rt.commandParameter(t,Ge,"invalid primitve",e.commandStr),ls((function(e,r){return Ge[t]}))}if(Wo in n){var a=n[Wo];return cs(a,(function(t,e){var r=t.constants.primTypes,n=t.invoke(e,a);return rt.optional((function(){t.assert(e,n+" in "+r,"invalid primitive, must be one of "+Object.keys(Ge))})),e.def(r,"[",n,"]")}))}return p?us(f)?f.value?ls((function(t,e){return e.def(t.ELEMENTS,".primType")})):ls((function(){return Fa})):new ss(f.thisDep,f.contextDep,f.propDep,(function(t,e){var r=t.ELEMENTS;return e.def(r,"?",r,".primType:",Fa)})):o?new ss(l.thisDep,l.contextDep,l.propDep,(function(t,e){return e.def(t.shared.vao+".currentVAO?"+t.shared.vao+".currentVAO.primitive:"+Fa)})):null}function m(t,a){if(t in r){var s=0|r[t];return a?i.offset=s:i.instances=s,rt.command(!a||s>=0,"invalid "+t,e.commandStr),ls((function(t,e){return a&&(t.OFFSET=s),s}))}if(t in n){var u=n[t];return cs(u,(function(e,r){var n=e.invoke(r,u);return a&&(e.OFFSET=n,rt.optional((function(){e.assert(r,n+">=0","invalid "+t)}))),n}))}if(a){if(p)return ls((function(t,e){return t.OFFSET=0,0}));if(o)return new ss(l.thisDep,l.contextDep,l.propDep,(function(t,e){return e.def(t.shared.vao+".currentVAO?"+t.shared.vao+".currentVAO.offset:0")}))}else if(o)return new ss(l.thisDep,l.contextDep,l.propDep,(function(t,e){return e.def(t.shared.vao+".currentVAO?"+t.shared.vao+".currentVAO.instances:-1")}));return null}p&&(l=ls((function(){return"null"})));var y=m(Ho,!0);function g(){if(Xo in r){var t=0|r[Xo];return i.count=t,rt.command("number"==typeof t&&t>=0,"invalid vertex count",e.commandStr),ls((function(){return t}))}if(Xo in n){var a=n[Xo];return cs(a,(function(t,e){var r=t.invoke(e,a);return rt.optional((function(){t.assert(e,"typeof "+r+'==="number"&&'+r+">=0&&"+r+"===("+r+"|0)","invalid vertex count")})),r}))}if(p){if(us(f)){if(f)return y?new ss(y.thisDep,y.contextDep,y.propDep,(function(t,e){var r=e.def(t.ELEMENTS,".vertCount-",t.OFFSET);return rt.optional((function(){t.assert(e,r+">=0","invalid vertex offset/element buffer too small")})),r})):ls((function(t,e){return e.def(t.ELEMENTS,".vertCount")}));var s=ls((function(){return-1}));return rt.optional((function(){s.MISSING=!0})),s}var u=new ss(f.thisDep||y.thisDep,f.contextDep||y.contextDep,f.propDep||y.propDep,(function(t,e){var r=t.ELEMENTS;return t.OFFSET?e.def(r,"?",r,".vertCount-",t.OFFSET,":-1"):e.def(r,"?",r,".vertCount:-1")}));return rt.optional((function(){u.DYNAMIC=!0})),u}return o?new ss(l.thisDep,l.contextDep,l.propDep,(function(t,e){return e.def(t.shared.vao,".currentVAO?",t.shared.vao,".currentVAO.count:-1")})):null}var v=d(),_=g(),x=m(Ko,!1);return{elements:f,primitive:v,count:_,instances:x,offset:y,vao:l,vaoActive:o,elementsActive:p,static:i}}function V(t,e){var r=t.static,n=t.dynamic,o={};return S.forEach((function(t){var a=T(t);function s(e,i){if(t in r){var s=e(r[t]);o[a]=ls((function(){return s}))}else if(t in n){var u=n[t];o[a]=cs(u,(function(t,e){return i(t,e,t.invoke(e,u))}))}}switch(t){case Eo:case yo:case mo:case Lo:case xo:case Vo:case zo:case Po:case Mo:case So:return s((function(r){return rt.commandType(r,"boolean",t,e.commandStr),r}),(function(e,r,n){return rt.optional((function(){e.assert(r,"typeof "+n+'==="boolean"',"invalid flag "+t,e.commandStr)})),n}));case bo:return s((function(r){return rt.commandParameter(r,es,"invalid "+t,e.commandStr),es[r]}),(function(e,r,n){var i=e.constants.compareFuncs;return rt.optional((function(){e.assert(r,n+" in "+i,"invalid "+t+", must be one of "+Object.keys(es))})),r.def(i,"[",n,"]")}));case wo:return s((function(t){return rt.command(cr(t)&&2===t.length&&"number"==typeof t[0]&&"number"==typeof t[1]&&t[0]<=t[1],"depth range is 2d array",e.commandStr),t}),(function(t,e,r){return rt.optional((function(){t.assert(e,t.shared.isArrayLike+"("+r+")&&"+r+".length===2&&typeof "+r+'[0]==="number"&&typeof '+r+'[1]==="number"&&'+r+"[0]<="+r+"[1]","depth range must be a 2d array")})),[e.def("+",r,"[0]"),e.def("+",r,"[1]")]}));case _o:return s((function(t){rt.commandType(t,"object","blend.func",e.commandStr);var r="srcRGB"in t?t.srcRGB:t.src,n="srcAlpha"in t?t.srcAlpha:t.src,i="dstRGB"in t?t.dstRGB:t.dst,o="dstAlpha"in t?t.dstAlpha:t.dst;return rt.commandParameter(r,Qa,a+".srcRGB",e.commandStr),rt.commandParameter(n,Qa,a+".srcAlpha",e.commandStr),rt.commandParameter(i,Qa,a+".dstRGB",e.commandStr),rt.commandParameter(o,Qa,a+".dstAlpha",e.commandStr),rt.command(-1===ts.indexOf(r+", "+i),"unallowed blending combination (srcRGB, dstRGB) = ("+r+", "+i+")",e.commandStr),[Qa[r],Qa[i],Qa[n],Qa[o]]}),(function(e,r,n){var i=e.constants.blendFuncs;function o(o,a){var s=r.def('"',o,a,'" in ',n,"?",n,".",o,a,":",n,".",o);return rt.optional((function(){e.assert(r,s+" in "+i,"invalid "+t+"."+o+a+", must be one of "+Object.keys(Qa))})),s}rt.optional((function(){e.assert(r,n+"&&typeof "+n+'==="object"',"invalid blend func, must be an object")}));var a=o("src","RGB"),s=o("dst","RGB");rt.optional((function(){var t=e.constants.invalidBlendCombinations;e.assert(r,t+".indexOf("+a+'+", "+'+s+") === -1 ","unallowed blending combination for (srcRGB, dstRGB)")}));var u=r.def(i,"[",a,"]"),l=r.def(i,"[",o("src","Alpha"),"]");return[u,r.def(i,"[",s,"]"),l,r.def(i,"[",o("dst","Alpha"),"]")]}));case vo:return s((function(r){return"string"==typeof r?(rt.commandParameter(r,g,"invalid "+t,e.commandStr),[g[r],g[r]]):"object"==typeof r?(rt.commandParameter(r.rgb,g,t+".rgb",e.commandStr),rt.commandParameter(r.alpha,g,t+".alpha",e.commandStr),[g[r.rgb],g[r.alpha]]):void rt.commandRaise("invalid blend.equation",e.commandStr)}),(function(e,r,n){var i=e.constants.blendEquations,o=r.def(),a=r.def(),s=e.cond("typeof ",n,'==="string"');return rt.optional((function(){function r(t,r,n){e.assert(t,n+" in "+i,"invalid "+r+", must be one of "+Object.keys(g))}r(s.then,t,n),e.assert(s.else,n+"&&typeof "+n+'==="object"',"invalid "+t),r(s.else,t+".rgb",n+".rgb"),r(s.else,t+".alpha",n+".alpha")})),s.then(o,"=",a,"=",i,"[",n,"];"),s.else(o,"=",i,"[",n,".rgb];",a,"=",i,"[",n,".alpha];"),r(s),[o,a]}));case go:return s((function(t){return rt.command(cr(t)&&4===t.length,"blend.color must be a 4d array",e.commandStr),Tt(4,(function(e){return+t[e]}))}),(function(t,e,r){return rt.optional((function(){t.assert(e,t.shared.isArrayLike+"("+r+")&&"+r+".length===4","blend.color must be a 4d array")})),Tt(4,(function(t){return e.def("+",r,"[",t,"]")}))}));case Bo:return s((function(t){return rt.commandType(t,"number",a,e.commandStr),0|t}),(function(t,e,r){return rt.optional((function(){t.assert(e,"typeof "+r+'==="number"',"invalid stencil.mask")})),e.def(r,"|0")}));case Ro:return s((function(r){rt.commandType(r,"object",a,e.commandStr);var n=r.cmp||"keep",i=r.ref||0,o="mask"in r?r.mask:-1;return rt.commandParameter(n,es,t+".cmp",e.commandStr),rt.commandType(i,"number",t+".ref",e.commandStr),rt.commandType(o,"number",t+".mask",e.commandStr),[es[n],i,o]}),(function(t,e,r){var n=t.constants.compareFuncs;return rt.optional((function(){function i(){t.assert(e,Array.prototype.join.call(arguments,""),"invalid stencil.func")}i(r+"&&typeof ",r,'==="object"'),i('!("cmp" in ',r,")||(",r,".cmp in ",n,")")})),[e.def('"cmp" in ',r,"?",n,"[",r,".cmp]",":",Ga),e.def(r,".ref|0"),e.def('"mask" in ',r,"?",r,".mask|0:-1")]}));case Oo:case Fo:return s((function(r){rt.commandType(r,"object",a,e.commandStr);var n=r.fail||"keep",i=r.zfail||"keep",o=r.zpass||"keep";return rt.commandParameter(n,rs,t+".fail",e.commandStr),rt.commandParameter(i,rs,t+".zfail",e.commandStr),rt.commandParameter(o,rs,t+".zpass",e.commandStr),[t===Fo?Ua:Va,rs[n],rs[i],rs[o]]}),(function(e,r,n){var i=e.constants.stencilOps;function o(o){return rt.optional((function(){e.assert(r,'!("'+o+'" in '+n+")||("+n+"."+o+" in "+i+")","invalid "+t+"."+o+", must be one of "+Object.keys(rs))})),r.def('"',o,'" in ',n,"?",i,"[",n,".",o,"]:",Ga)}return rt.optional((function(){e.assert(r,n+"&&typeof "+n+'==="object"',"invalid "+t)})),[t===Fo?Ua:Va,o("fail"),o("zfail"),o("zpass")]}));case Co:return s((function(t){rt.commandType(t,"object",a,e.commandStr);var r=0|t.factor,n=0|t.units;return rt.commandType(r,"number",a+".factor",e.commandStr),rt.commandType(n,"number",a+".units",e.commandStr),[r,n]}),(function(e,r,n){return rt.optional((function(){e.assert(r,n+"&&typeof "+n+'==="object"',"invalid "+t)})),[r.def(n,".factor|0"),r.def(n,".units|0")]}));case To:return s((function(t){var r=0;return"front"===t?r=Va:"back"===t&&(r=Ua),rt.command(!!r,a,e.commandStr),r}),(function(t,e,r){return rt.optional((function(){t.assert(e,r+'==="front"||'+r+'==="back"',"invalid cull.face")})),e.def(r,'==="front"?',Va,":",Ua)}));case Io:return s((function(t){return rt.command("number"==typeof t&&t>=i.lineWidthDims[0]&&t<=i.lineWidthDims[1],"invalid line width, must be a positive number between "+i.lineWidthDims[0]+" and "+i.lineWidthDims[1],e.commandStr),t}),(function(t,e,r){return rt.optional((function(){t.assert(e,"typeof "+r+'==="number"&&'+r+">="+i.lineWidthDims[0]+"&&"+r+"<="+i.lineWidthDims[1],"invalid line width")})),r}));case ko:return s((function(t){return rt.commandParameter(t,is,a,e.commandStr),is[t]}),(function(t,e,r){return rt.optional((function(){t.assert(e,r+'==="cw"||'+r+'==="ccw"',"invalid frontFace, must be one of cw,ccw")})),e.def(r+'==="cw"?'+ja+":"+Na)}));case Ao:return s((function(t){return rt.command(cr(t)&&4===t.length,"color.mask must be length 4 array",e.commandStr),t.map((function(t){return!!t}))}),(function(t,e,r){return rt.optional((function(){t.assert(e,t.shared.isArrayLike+"("+r+")&&"+r+".length===4","invalid color.mask")})),Tt(4,(function(t){return"!!"+r+"["+t+"]"}))}));case Do:return s((function(t){rt.command("object"==typeof t&&t,a,e.commandStr);var r="value"in t?t.value:1,n=!!t.invert;return rt.command("number"==typeof r&&r>=0&&r<=1,"sample.coverage.value must be a number between 0 and 1",e.commandStr),[r,n]}),(function(t,e,r){return rt.optional((function(){t.assert(e,r+"&&typeof "+r+'==="object"',"invalid sample.coverage")})),[e.def('"value" in ',r,"?+",r,".value:1"),e.def("!!",r,".invert")]}))}})),o}function U(t,e){var r=t.static,n=t.dynamic,i={};return Object.keys(r).forEach((function(t){var n,o=r[t];if("number"==typeof o||"boolean"==typeof o)n=ls((function(){return o}));else if("function"==typeof o){var a=o._reglType;"texture2d"===a||"textureCube"===a?n=ls((function(t){return t.link(o)})):"framebuffer"===a||"framebufferCube"===a?(rt.command(o.color.length>0,'missing color attachment for framebuffer sent to uniform "'+t+'"',e.commandStr),n=ls((function(t){return t.link(o.color[0])}))):rt.commandRaise('invalid data for uniform "'+t+'"',e.commandStr)}else cr(o)?n=ls((function(e){return e.global.def("[",Tt(o.length,(function(r){return rt.command("number"==typeof o[r]||"boolean"==typeof o[r],"invalid uniform "+t,e.commandStr),o[r]})),"]")})):rt.commandRaise('invalid or missing data for uniform "'+t+'"',e.commandStr);n.value=o,i[t]=n})),Object.keys(n).forEach((function(t){var e=n[t];i[t]=cs(e,(function(t,r){return t.invoke(r,e)}))})),i}function j(t,e){var n=t.static,i=t.dynamic,a={};return Object.keys(n).forEach((function(t){var i=n[t],s=r.id(t),u=new y;if(os(i))u.state=oo,u.buffer=o.getBuffer(o.create(i,ua,!1,!0)),u.type=0;else{var l=o.getBuffer(i);if(l)u.state=oo,u.buffer=l,u.type=0;else if(rt.command("object"==typeof i&&i,"invalid data for attribute "+t,e.commandStr),"constant"in i){var c=i.constant;u.buffer="null",u.state=ao,"number"==typeof c?u.x=c:(rt.command(cr(c)&&c.length>0&&c.length<=4,"invalid constant for attribute "+t,e.commandStr),no.forEach((function(t,e){e<c.length&&(u[t]=c[e])})))}else{l=os(i.buffer)?o.getBuffer(o.create(i.buffer,ua,!1,!0)):o.getBuffer(i.buffer),rt.command(!!l,'missing buffer for attribute "'+t+'"',e.commandStr);var p=0|i.offset;rt.command(p>=0,'invalid offset for attribute "'+t+'"',e.commandStr);var h=0|i.stride;rt.command(h>=0&&h<256,'invalid stride for attribute "'+t+'", must be integer betweeen [0, 255]',e.commandStr);var f=0|i.size;rt.command(!("size"in i)||f>0&&f<=4,'invalid size for attribute "'+t+'", must be 1,2,3,4',e.commandStr);var d=!!i.normalized,m=0;"type"in i&&(rt.commandParameter(i.type,De,"invalid type for attribute "+t,e.commandStr),m=De[i.type]);var g=0|i.divisor;rt.optional((function(){"divisor"in i&&(rt.command(0===g||v,'cannot specify divisor for attribute "'+t+'", instancing not supported',e.commandStr),rt.command(g>=0,'invalid divisor for attribute "'+t+'"',e.commandStr));var r=e.commandStr,n=["buffer","offset","divisor","normalized","type","size","stride"];Object.keys(i).forEach((function(e){rt.command(n.indexOf(e)>=0,'unknown parameter "'+e+'" for attribute pointer "'+t+'" (valid parameters are '+n+")",r)}))})),u.buffer=l,u.state=oo,u.size=f,u.normalized=d,u.type=m||l.dtype,u.offset=p,u.stride=h,u.divisor=g}}a[t]=ls((function(t,e){var r=t.attribCache;if(s in r)return r[s];var n={isStream:!1};return Object.keys(u).forEach((function(t){n[t]=u[t]})),u.buffer&&(n.buffer=t.link(u.buffer),n.type=n.type||n.buffer+".dtype"),r[s]=n,n}))})),Object.keys(i).forEach((function(t){var e=i[t];function r(r,n){var i=r.invoke(n,e),o=r.shared,a=r.constants,s=o.isBufferArgs,u=o.buffer;rt.optional((function(){r.assert(n,i+"&&(typeof "+i+'==="object"||typeof '+i+'==="function")&&('+s+"("+i+")||"+u+".getBuffer("+i+")||"+u+".getBuffer("+i+".buffer)||"+s+"("+i+'.buffer)||("constant" in '+i+"&&(typeof "+i+'.constant==="number"||'+o.isArrayLike+"("+i+".constant))))",'invalid dynamic attribute "'+t+'"')}));var l={isStream:n.def(!1)},c=new y;c.state=oo,Object.keys(c).forEach((function(t){l[t]=n.def(""+c[t])}));var p=l.buffer,h=l.type;function f(t){n(l[t],"=",i,".",t,"|0;")}return n("if(",s,"(",i,")){",l.isStream,"=true;",p,"=",u,".createStream(",ua,",",i,");",h,"=",p,".dtype;","}else{",p,"=",u,".getBuffer(",i,");","if(",p,"){",h,"=",p,".dtype;",'}else if("constant" in ',i,"){",l.state,"=",ao,";","if(typeof "+i+'.constant === "number"){',l[no[0]],"=",i,".constant;",no.slice(1).map((function(t){return l[t]})).join("="),"=0;","}else{",no.map((function(t,e){return l[t]+"="+i+".constant.length>"+e+"?"+i+".constant["+e+"]:0;"})).join(""),"}}else{","if(",s,"(",i,".buffer)){",p,"=",u,".createStream(",ua,",",i,".buffer);","}else{",p,"=",u,".getBuffer(",i,".buffer);","}",h,'="type" in ',i,"?",a.glTypes,"[",i,".type]:",p,".dtype;",l.normalized,"=!!",i,".normalized;"),f("size"),f("offset"),f("stride"),f("divisor"),n("}}"),n.exit("if(",l.isStream,"){",u,".destroyStream(",p,");","}"),l}a[t]=cs(e,r)})),a}function N(t){var e=t.static,r=t.dynamic,n={};return Object.keys(e).forEach((function(t){var r=e[t];n[t]=ls((function(t,e){return"number"==typeof r||"boolean"==typeof r?""+r:t.link(r)}))})),Object.keys(r).forEach((function(t){var e=r[t];n[t]=cs(e,(function(t,r){return t.invoke(r,e)}))})),n}function q(t,e,r,i,o){var a=t.static,s=t.dynamic;rt.optional((function(){var t=[qo,$o,Zo,Go,Wo,Ho,Xo,Ko,No,Yo].concat(S);function e(e){Object.keys(e).forEach((function(e){rt.command(t.indexOf(e)>=0,'unknown parameter "'+e+'"',o.commandStr)}))}e(a),e(s)}));var u=R(t,e),l=L(t),p=B(t,l,o),h=F(t,o),f=V(t,o),d=O(t,o,u);function m(t){var e=p[t];e&&(f[t]=e)}m(jo),m(T(Uo));var y=Object.keys(f).length>0,g={framebuffer:l,draw:h,shader:d,state:f,dirty:y,scopeVAO:null,drawVAO:null,useVAO:!1,attributes:{}};if(g.profile=D(t),g.uniforms=U(r,o),g.drawVAO=g.scopeVAO=h.vao,!g.drawVAO&&d.program&&!u&&n.angle_instanced_arrays&&h.static.elements){var v=!0,_=d.program.attributes.map((function(t){var r=e.static[t];return v=v&&!!r,r}));if(v&&_.length>0){var x=c.getVAO(c.createVAO({attributes:_,elements:h.static.elements}));g.drawVAO=new ss(null,null,null,(function(t,e){return t.link(x)})),g.useVAO=!0}}return u?(rt(!h.elementsActive,"can not combine elements and vertex array objects. element binding state must be specified in vertex array object"),g.useVAO=!0):g.attributes=j(e,o),g.context=N(i),g}function $(t,e,r){var n=t.shared.context,i=t.scope();Object.keys(r).forEach((function(o){e.save(n,"."+o);var a=r[o].append(t,e);Array.isArray(a)?i(n,".",o,"=[",a.join(),"];"):i(n,".",o,"=",a,";")})),e(i)}function Z(t,e,r,n){var i,o=t.shared,a=o.gl,s=o.framebuffer;_&&(i=e.def(o.extensions,".webgl_draw_buffers"));var u,l=t.constants,c=l.drawBuffer,p=l.backBuffer;u=r?r.append(t,e):e.def(s,".next"),n||e("if(",u,"!==",s,".cur){"),e("if(",u,"){",a,".bindFramebuffer(",Ya,",",u,".framebuffer);"),_&&e(i,".drawBuffersWEBGL(",c,"[",u,".colorAttachments.length]);"),e("}else{",a,".bindFramebuffer(",Ya,",null);"),_&&e(i,".drawBuffersWEBGL(",p,");"),e("}",s,".cur=",u,";"),n||e("}")}function G(t,e,r){var n=t.shared,i=n.gl,o=t.current,a=t.next,s=n.current,u=n.next,l=t.cond(s,".dirty");S.forEach((function(e){var n,c,p=T(e);if(!(p in r.state))if(p in a){n=a[p],c=o[p];var h=Tt(b[p].length,(function(t){return l.def(n,"[",t,"]")}));l(t.cond(h.map((function(t,e){return t+"!=="+c+"["+e+"]"})).join("||")).then(i,".",E[p],"(",h,");",h.map((function(t,e){return c+"["+e+"]="+t})).join(";"),";"))}else{n=l.def(u,".",p);var f=t.cond(n,"!==",s,".",p);l(f),p in A?f(t.cond(n).then(i,".enable(",A[p],");").else(i,".disable(",A[p],");"),s,".",p,"=",n,";"):f(i,".",E[p],"(",n,");",s,".",p,"=",n,";")}})),0===Object.keys(r.state).length&&l(s,".dirty=false;"),e(l)}function W(t,e,r,n){var i=t.shared,o=t.current,a=i.current,s=i.gl;as(Object.keys(r)).forEach((function(i){var u=r[i];if(!n||n(u)){var l=u.append(t,e);if(A[i]){var c=A[i];us(u)?e(s,l?".enable(":".disable(",c,");"):e(t.cond(l).then(s,".enable(",c,");").else(s,".disable(",c,");")),e(a,".",i,"=",l,";")}else if(cr(l)){var p=o[i];e(s,".",E[i],"(",l,");",l.map((function(t,e){return p+"["+e+"]="+t})).join(";"),";")}else e(s,".",E[i],"(",l,");",a,".",i,"=",l,";")}}))}function X(t,e){v&&(t.instancing=e.def(t.shared.extensions,".angle_instanced_arrays"))}function H(t,e,r,n,i){var o,a,s,u=t.shared,l=t.stats,c=u.current,p=u.timer,h=r.profile;function f(){return"undefined"==typeof performance?"Date.now()":"performance.now()"}function m(t){t(o=e.def(),"=",f(),";"),"string"==typeof i?t(l,".count+=",i,";"):t(l,".count++;"),d&&(n?t(a=e.def(),"=",p,".getNumPendingQueries();"):t(p,".beginQuery(",l,");"))}function y(t){t(l,".cpuTime+=",f(),"-",o,";"),d&&(n?t(p,".pushScopeStats(",a,",",p,".getNumPendingQueries(),",l,");"):t(p,".endQuery();"))}function g(t){var r=e.def(c,".profile");e(c,".profile=",t,";"),e.exit(c,".profile=",r,";")}if(h){if(us(h))return void(h.enable?(m(e),y(e.exit),g("true")):g("false"));g(s=h.append(t,e))}else s=e.def(c,".profile");var v=t.block();m(v),e("if(",s,"){",v,"}");var _=t.block();y(_),e.exit("if(",s,"){",_,"}")}function K(t,e,r,n,i){var o=t.shared;function a(t){switch(t){case wa:case Ta:case Ca:return 2;case Sa:case ka:case Pa:return 3;case Aa:case Ia:case Ma:return 4;default:return 1}}function s(r,n,i){var a=o.gl,s=e.def(r,".location"),u=e.def(o.attributes,"[",s,"]"),l=i.state,c=i.buffer,p=[i.x,i.y,i.z,i.w],h=["buffer","normalized","offset","stride"];function f(){e("if(!",u,".buffer){",a,".enableVertexAttribArray(",s,");}");var r,o=i.type;if(r=i.size?e.def(i.size,"||",n):n,e("if(",u,".type!==",o,"||",u,".size!==",r,"||",h.map((function(t){return u+"."+t+"!=="+i[t]})).join("||"),"){",a,".bindBuffer(",ua,",",c,".buffer);",a,".vertexAttribPointer(",[s,r,o,i.normalized,i.stride,i.offset],");",u,".type=",o,";",u,".size=",r,";",h.map((function(t){return u+"."+t+"="+i[t]+";"})).join(""),"}"),v){var l=i.divisor;e("if(",u,".divisor!==",l,"){",t.instancing,".vertexAttribDivisorANGLE(",[s,l],");",u,".divisor=",l,";}")}}function d(){e("if(",u,".buffer){",a,".disableVertexAttribArray(",s,");",u,".buffer=null;","}if(",no.map((function(t,e){return u+"."+t+"!=="+p[e]})).join("||"),"){",a,".vertexAttrib4f(",s,",",p,");",no.map((function(t,e){return u+"."+t+"="+p[e]+";"})).join(""),"}")}l===oo?f():l===ao?d():(e("if(",l,"===",oo,"){"),f(),e("}else{"),d(),e("}"))}n.forEach((function(n){var o,u=n.name,l=r.attributes[u];if(l){if(!i(l))return;o=l.append(t,e)}else{if(!i(ps))return;var c=t.scopeAttrib(u);rt.optional((function(){t.assert(e,c+".state","missing attribute "+u)})),o={},Object.keys(new y).forEach((function(t){o[t]=e.def(c,".",t)}))}s(t.link(n),a(n.info.type),o)}))}function Y(t,e,n,i,o,a){for(var s,u=t.shared,l=u.gl,c=0;c<i.length;++c){var p,h=i[c],f=h.name,d=h.info.type,m=n.uniforms[f],y=t.link(h)+".location";if(m){if(!o(m))continue;if(us(m)){var g=m.value;if(rt.command(null!=g,'missing uniform "'+f+'"',t.commandStr),d===Ra||d===Oa){rt.command("function"==typeof g&&(d===Ra&&("texture2d"===g._reglType||"framebuffer"===g._reglType)||d===Oa&&("textureCube"===g._reglType||"framebufferCube"===g._reglType)),"invalid texture for uniform "+f,t.commandStr);var v=t.link(g._texture||g.color[0]._texture);e(l,".uniform1i(",y,",",v+".bind());"),e.exit(v,".unbind();")}else if(d===Da||d===La||d===Ba){rt.optional((function(){rt.command(cr(g),"invalid matrix for uniform "+f,t.commandStr),rt.command(d===Da&&4===g.length||d===La&&9===g.length||d===Ba&&16===g.length,"invalid length for matrix uniform "+f,t.commandStr)}));var _=t.global.def("new Float32Array(["+Array.prototype.slice.call(g)+"])"),x=2;d===La?x=3:d===Ba&&(x=4),e(l,".uniformMatrix",x,"fv(",y,",false,",_,");")}else{switch(d){case ba:rt.commandType(g,"number","uniform "+f,t.commandStr),s="1f";break;case wa:rt.command(cr(g)&&2===g.length,"uniform "+f,t.commandStr),s="2f";break;case Sa:rt.command(cr(g)&&3===g.length,"uniform "+f,t.commandStr),s="3f";break;case Aa:rt.command(cr(g)&&4===g.length,"uniform "+f,t.commandStr),s="4f";break;case za:rt.commandType(g,"boolean","uniform "+f,t.commandStr),s="1i";break;case Ea:rt.commandType(g,"number","uniform "+f,t.commandStr),s="1i";break;case Ca:case Ta:rt.command(cr(g)&&2===g.length,"uniform "+f,t.commandStr),s="2i";break;case Pa:case ka:rt.command(cr(g)&&3===g.length,"uniform "+f,t.commandStr),s="3i";break;case Ma:case Ia:rt.command(cr(g)&&4===g.length,"uniform "+f,t.commandStr),s="4i"}e(l,".uniform",s,"(",y,",",cr(g)?Array.prototype.slice.call(g):g,");")}continue}p=m.append(t,e)}else{if(!o(ps))continue;p=e.def(u.uniforms,"[",r.id(f),"]")}d===Ra?(rt(!Array.isArray(p),"must specify a scalar prop for textures"),e("if(",p,"&&",p,'._reglType==="framebuffer"){',p,"=",p,".color[0];","}")):d===Oa&&(rt(!Array.isArray(p),"must specify a scalar prop for cube maps"),e("if(",p,"&&",p,'._reglType==="framebufferCube"){',p,"=",p,".color[0];","}")),rt.optional((function(){function r(r,n){t.assert(e,r,'bad data or missing for uniform "'+f+'".  '+n)}function n(t){rt(!Array.isArray(p),"must not specify an array type for uniform"),r("typeof "+p+'==="'+t+'"',"invalid type, expected "+t)}function i(e,n){Array.isArray(p)?rt(p.length===e,"must have length "+e):r(u.isArrayLike+"("+p+")&&"+p+".length==="+e,"invalid vector, should have length "+e,t.commandStr)}function o(e){rt(!Array.isArray(p),"must not specify a value type"),r("typeof "+p+'==="function"&&'+p+'._reglType==="texture'+(e===ca?"2d":"Cube")+'"',"invalid texture type",t.commandStr)}switch(d){case Ea:n("number");break;case Ta:i(2);break;case ka:i(3);break;case Ia:i(4);break;case ba:n("number");break;case wa:i(2);break;case Sa:i(3);break;case Aa:i(4);break;case za:n("boolean");break;case Ca:i(2);break;case Pa:i(3);break;case Ma:case Da:i(4);break;case La:i(9);break;case Ba:i(16);break;case Ra:o(ca);break;case Oa:o(pa)}}));var b=1;switch(d){case Ra:case Oa:var w=e.def(p,"._texture");e(l,".uniform1i(",y,",",w,".bind());"),e.exit(w,".unbind();");continue;case Ea:case za:s="1i";break;case Ta:case Ca:s="2i",b=2;break;case ka:case Pa:s="3i",b=3;break;case Ia:case Ma:s="4i",b=4;break;case ba:s="1f";break;case wa:s="2f",b=2;break;case Sa:s="3f",b=3;break;case Aa:s="4f",b=4;break;case Da:s="Matrix2fv";break;case La:s="Matrix3fv";break;case Ba:s="Matrix4fv"}if("M"===s.charAt(0)){e(l,".uniform",s,"(",y,",");var S=Math.pow(d-Da+2,2),A=t.global.def("new Float32Array(",S,")");Array.isArray(p)?e("false,(",Tt(S,(function(t){return A+"["+t+"]="+p[t]})),",",A,")"):e("false,(Array.isArray(",p,")||",p," instanceof Float32Array)?",p,":(",Tt(S,(function(t){return A+"["+t+"]="+p+"["+t+"]"})),",",A,")"),e(");")}else if(b>1){for(var E=[],T=[],k=0;k<b;++k)Array.isArray(p)?T.push(p[k]):T.push(e.def(p+"["+k+"]")),a&&E.push(e.def());a&&e("if(!",t.batchId,"||",E.map((function(t,e){return t+"!=="+T[e]})).join("||"),"){",E.map((function(t,e){return t+"="+T[e]+";"})).join("")),e(l,".uniform",s,"(",y,",",T.join(","),");"),a&&e("}")}else{if(rt(!Array.isArray(p),"uniform value must not be an array"),a){var I=e.def();e("if(!",t.batchId,"||",I,"!==",p,"){",I,"=",p,";")}e(l,".uniform",s,"(",y,",",p,");"),a&&e("}")}}}function J(t,e,r,n){var i=t.shared,o=i.gl,a=i.draw,s=n.draw;function u(){var u,l=s.elements,c=e;return l?((l.contextDep&&n.contextDynamic||l.propDep)&&(c=r),s.vaoActive?u=l.append(t,c):c("if("+(u=l.append(t,c))+")"+o+".bindBuffer("+la+","+u+".buffer.buffer);")):(u=c.def(),c("if(",i.vao,".currentVAO){",u,"=",t.shared.elements+".getElements("+i.vao,".currentVAO.elements);",x?"":"if("+u+")"+o+".bindBuffer("+la+","+u+".buffer.buffer);","}else{",u,"=",a,".",Go,";","if(",u,"){",o,".bindBuffer(",la,",",u,".buffer.buffer);}}")),u}function l(){var i,o=s.count,u=e;return o?((o.contextDep&&n.contextDynamic||o.propDep)&&(u=r),i=o.append(t,u),rt.optional((function(){o.MISSING&&t.assert(e,"false","missing vertex count"),o.DYNAMIC&&t.assert(u,i+">=0","missing vertex count")}))):(i=u.def(a,".",Xo),rt.optional((function(){t.assert(u,i+">=0","missing vertex count")}))),i}var c=u();function p(i){var o=s[i];return o?o.contextDep&&n.contextDynamic||o.propDep?o.append(t,r):o.append(t,e):e.def(a,".",i)}var h,f,d=p(Wo),m=p(Ho),y=l();if("number"==typeof y){if(0===y)return}else r("if(",y,"){"),r.exit("}");v&&(h=p(Ko),f=t.instancing);var g=c+".type",_=s.elements&&us(s.elements)&&!s.vaoActive;function b(){function t(){r(f,".drawElementsInstancedANGLE(",[d,y,g,m+"<<(("+g+"-"+io+")>>1)",h],");")}function e(){r(f,".drawArraysInstancedANGLE(",[d,m,y,h],");")}c&&"null"!==c?_?t():(r("if(",c,"){"),t(),r("}else{"),e(),r("}")):e()}function w(){function t(){r(o+".drawElements("+[d,y,g,m+"<<(("+g+"-"+io+")>>1)"]+");")}function e(){r(o+".drawArrays("+[d,m,y]+");")}c&&"null"!==c?_?t():(r("if(",c,"){"),t(),r("}else{"),e(),r("}")):e()}v&&("number"!=typeof h||h>=0)?"string"==typeof h?(r("if(",h,">0){"),b(),r("}else if(",h,"<0){"),w(),r("}")):b():w()}function Q(t,e,r,n,i){var o=M(),a=o.proc("body",i);return rt.optional((function(){o.commandStr=e.commandStr,o.command=o.link(e.commandStr)})),v&&(o.instancing=a.def(o.shared.extensions,".angle_instanced_arrays")),t(o,a,r,n),o.compile().body}function tt(t,e,r,n){X(t,e),r.useVAO?r.drawVAO?e(t.shared.vao,".setVAO(",r.drawVAO.append(t,e),");"):e(t.shared.vao,".setVAO(",t.shared.vao,".targetVAO);"):(e(t.shared.vao,".setVAO(null);"),K(t,e,r,n.attributes,(function(){return!0}))),Y(t,e,r,n.uniforms,(function(){return!0}),!1),J(t,e,e,r)}function et(t,e){var r=t.proc("draw",1);X(t,r),$(t,r,e.context),Z(t,r,e.framebuffer),G(t,r,e),W(t,r,e.state),H(t,r,e,!1,!0);var n=e.shader.progVar.append(t,r);if(r(t.shared.gl,".useProgram(",n,".program);"),e.shader.program)tt(t,r,e,e.shader.program);else{r(t.shared.vao,".setVAO(null);");var i=t.global.def("{}"),o=r.def(n,".id"),a=r.def(i,"[",o,"]");r(t.cond(a).then(a,".call(this,a0);").else(a,"=",i,"[",o,"]=",t.link((function(r){return Q(tt,t,e,r,1)})),"(",n,");",a,".call(this,a0);"))}Object.keys(e.state).length>0&&r(t.shared.current,".dirty=true;")}function nt(t,e,r,n){function i(){return!0}t.batchId="a1",X(t,e),K(t,e,r,n.attributes,i),Y(t,e,r,n.uniforms,i,!1),J(t,e,e,r)}function it(t,e,r,n){X(t,e);var i=r.contextDep,o=e.def(),a="a0",s="a1",u=e.def();t.shared.props=u,t.batchId=o;var l=t.scope(),c=t.scope();function p(t){return t.contextDep&&i||t.propDep}function h(t){return!p(t)}if(e(l.entry,"for(",o,"=0;",o,"<",s,";++",o,"){",u,"=",a,"[",o,"];",c,"}",l.exit),r.needsContext&&$(t,c,r.context),r.needsFramebuffer&&Z(t,c,r.framebuffer),W(t,c,r.state,p),r.profile&&p(r.profile)&&H(t,c,r,!1,!0),n)r.useVAO?r.drawVAO?p(r.drawVAO)?c(t.shared.vao,".setVAO(",r.drawVAO.append(t,c),");"):l(t.shared.vao,".setVAO(",r.drawVAO.append(t,l),");"):l(t.shared.vao,".setVAO(",t.shared.vao,".targetVAO);"):(l(t.shared.vao,".setVAO(null);"),K(t,l,r,n.attributes,h),K(t,c,r,n.attributes,p)),Y(t,l,r,n.uniforms,h,!1),Y(t,c,r,n.uniforms,p,!0),J(t,l,c,r);else{var f=t.global.def("{}"),d=r.shader.progVar.append(t,c),m=c.def(d,".id"),y=c.def(f,"[",m,"]");c(t.shared.gl,".useProgram(",d,".program);","if(!",y,"){",y,"=",f,"[",m,"]=",t.link((function(e){return Q(nt,t,r,e,2)})),"(",d,");}",y,".call(this,a0[",o,"],",o,");")}}function ot(t,e){var r=t.proc("batch",2);t.batchId="0",X(t,r);var n=!1,i=!0;Object.keys(e.context).forEach((function(t){n=n||e.context[t].propDep})),n||($(t,r,e.context),i=!1);var o=e.framebuffer,a=!1;function s(t){return t.contextDep&&n||t.propDep}o?(o.propDep?n=a=!0:o.contextDep&&n&&(a=!0),a||Z(t,r,o)):Z(t,r,null),e.state.viewport&&e.state.viewport.propDep&&(n=!0),G(t,r,e),W(t,r,e.state,(function(t){return!s(t)})),e.profile&&s(e.profile)||H(t,r,e,!1,"a1"),e.contextDep=n,e.needsContext=i,e.needsFramebuffer=a;var u=e.shader.progVar;if(u.contextDep&&n||u.propDep)it(t,r,e,null);else{var l=u.append(t,r);if(r(t.shared.gl,".useProgram(",l,".program);"),e.shader.program)it(t,r,e,e.shader.program);else{r(t.shared.vao,".setVAO(null);");var c=t.global.def("{}"),p=r.def(l,".id"),h=r.def(c,"[",p,"]");r(t.cond(h).then(h,".call(this,a0,a1);").else(h,"=",c,"[",p,"]=",t.link((function(r){return Q(it,t,e,r,2)})),"(",l,");",h,".call(this,a0,a1);"))}}Object.keys(e.state).length>0&&r(t.shared.current,".dirty=true;")}function at(t,e){var n=t.proc("scope",3);t.batchId="a2";var i=t.shared,o=i.current;function a(r){var o=e.shader[r];o&&n.set(i.shader,"."+r,o.append(t,n))}$(t,n,e.context),e.framebuffer&&e.framebuffer.append(t,n),as(Object.keys(e.state)).forEach((function(r){var o=e.state[r].append(t,n);cr(o)?o.forEach((function(e,i){n.set(t.next[r],"["+i+"]",e)})):n.set(i.next,"."+r,o)})),H(t,n,e,!0,!0),[Go,Ho,Xo,Ko,Wo].forEach((function(r){var o=e.draw[r];o&&n.set(i.draw,"."+r,""+o.append(t,n))})),Object.keys(e.uniforms).forEach((function(o){var a=e.uniforms[o].append(t,n);Array.isArray(a)&&(a="["+a.join()+"]"),n.set(i.uniforms,"["+r.id(o)+"]",a)})),Object.keys(e.attributes).forEach((function(r){var i=e.attributes[r].append(t,n),o=t.scopeAttrib(r);Object.keys(new y).forEach((function(t){n.set(o,"."+t,i[t])}))})),e.scopeVAO&&n.set(i.vao,".targetVAO",e.scopeVAO.append(t,n)),a($o),a(Zo),Object.keys(e.state).length>0&&(n(o,".dirty=true;"),n.exit(o,".dirty=true;")),n("a1(",t.shared.context,",a0,",t.batchId,");")}function st(t){if("object"==typeof t&&!cr(t)){for(var e=Object.keys(t),r=0;r<e.length;++r)if(dt.isDynamic(t[e[r]]))return!0;return!1}}function ut(t,e,r){var n=e.static[r];if(n&&st(n)){var i=t.global,o=Object.keys(n),a=!1,s=!1,u=!1,l=t.global.def("{}");o.forEach((function(e){var r=n[e];if(dt.isDynamic(r)){"function"==typeof r&&(r=n[e]=dt.unbox(r));var o=cs(r,null);a=a||o.thisDep,u=u||o.propDep,s=s||o.contextDep}else{switch(i(l,".",e,"="),typeof r){case"number":i(r);break;case"string":i('"',r,'"');break;case"object":Array.isArray(r)&&i("[",r.join(),"]");break;default:i(t.link(r))}i(";")}})),e.dynamic[r]=new dt.DynamicVariable(po,{thisDep:a,contextDep:s,propDep:u,ref:l,append:c}),delete e.static[r]}function c(t,e){o.forEach((function(r){var i=n[r];if(dt.isDynamic(i)){var o=t.invoke(e,i);e(l,".",r,"=",o,";")}}))}}function lt(t,r,n,i,o){var a=M();a.stats=a.link(o),Object.keys(r.static).forEach((function(t){ut(a,r,t)})),sa.forEach((function(e){ut(a,t,e)}));var s=q(t,r,n,i,a);return et(a,s),at(a,s),ot(a,s),e(a.compile(),{destroy:function(){s.shader.program.destroy()}})}return{next:w,current:b,procs:function(){var t=M(),e=t.proc("poll"),r=t.proc("refresh"),o=t.block();e(o),r(o);var a,s=t.shared,u=s.gl,l=s.next,c=s.current;o(c,".dirty=false;"),Z(t,e),Z(t,r,null,!0),v&&(a=t.link(v)),n.oes_vertex_array_object&&r(t.link(n.oes_vertex_array_object),".bindVertexArrayOES(null);");for(var p=0;p<i.maxAttributes;++p){var h=r.def(s.attributes,"[",p,"]"),f=t.cond(h,".buffer");f.then(u,".enableVertexAttribArray(",p,");",u,".bindBuffer(",ua,",",h,".buffer.buffer);",u,".vertexAttribPointer(",p,",",h,".size,",h,".type,",h,".normalized,",h,".stride,",h,".offset);").else(u,".disableVertexAttribArray(",p,");",u,".vertexAttrib4f(",p,",",h,".x,",h,".y,",h,".z,",h,".w);",h,".buffer=null;"),r(f),v&&r(a,".vertexAttribDivisorANGLE(",p,",",h,".divisor);")}return r(t.shared.vao,".currentVAO=null;",t.shared.vao,".setVAO(",t.shared.vao,".targetVAO);"),Object.keys(A).forEach((function(n){var i=A[n],a=o.def(l,".",n),s=t.block();s("if(",a,"){",u,".enable(",i,")}else{",u,".disable(",i,")}",c,".",n,"=",a,";"),r(s),e("if(",a,"!==",c,".",n,"){",s,"}")})),Object.keys(E).forEach((function(n){var i,a,s=E[n],p=b[n],h=t.block();if(h(u,".",s,"("),cr(p)){var f=p.length;i=t.global.def(l,".",n),a=t.global.def(c,".",n),h(Tt(f,(function(t){return i+"["+t+"]"})),");",Tt(f,(function(t){return a+"["+t+"]="+i+"["+t+"];"})).join("")),e("if(",Tt(f,(function(t){return i+"["+t+"]!=="+a+"["+t+"]"})).join("||"),"){",h,"}")}else i=o.def(l,".",n),a=o.def(c,".",n),h(i,");",c,".",n,"=",i,";"),e("if(",i,"!==",a,"){",h,"}");r(h)})),t.compile()}(),compile:lt}}function fs(){return{vaoCount:0,bufferCount:0,elementsCount:0,framebufferCount:0,shaderCount:0,textureCount:0,cubeCount:0,renderbufferCount:0,maxTextureUnits:0}}var ds=34918,ms=34919,ys=35007,gs=function(t,e){if(!e.ext_disjoint_timer_query)return null;var r=[];function n(){return r.pop()||e.ext_disjoint_timer_query.createQueryEXT()}function i(t){r.push(t)}var o=[];function a(t){var r=n();e.ext_disjoint_timer_query.beginQueryEXT(ys,r),o.push(r),f(o.length-1,o.length,t)}function s(){e.ext_disjoint_timer_query.endQueryEXT(ys)}function u(){this.startQueryIndex=-1,this.endQueryIndex=-1,this.sum=0,this.stats=null}var l=[];function c(){return l.pop()||new u}function p(t){l.push(t)}var h=[];function f(t,e,r){var n=c();n.startQueryIndex=t,n.endQueryIndex=e,n.sum=0,n.stats=r,h.push(n)}var d=[],m=[];function y(){var t,r,n=o.length;if(0!==n){m.length=Math.max(m.length,n+1),d.length=Math.max(d.length,n+1),d[0]=0,m[0]=0;var a=0;for(t=0,r=0;r<o.length;++r){var s=o[r];e.ext_disjoint_timer_query.getQueryObjectEXT(s,ms)?(a+=e.ext_disjoint_timer_query.getQueryObjectEXT(s,ds),i(s)):o[t++]=s,d[r+1]=a,m[r+1]=t}for(o.length=t,t=0,r=0;r<h.length;++r){var u=h[r],l=u.startQueryIndex,c=u.endQueryIndex;u.sum+=d[c]-d[l];var f=m[l],y=m[c];y===f?(u.stats.gpuTime+=u.sum/1e6,p(u)):(u.startQueryIndex=f,u.endQueryIndex=y,h[t++]=u)}h.length=t}}return{beginQuery:a,endQuery:s,pushScopeStats:f,update:y,getNumPendingQueries:function(){return o.length},clear:function(){r.push.apply(r,o);for(var t=0;t<r.length;t++)e.ext_disjoint_timer_query.deleteQueryEXT(r[t]);o.length=0,r.length=0},restore:function(){o.length=0,r.length=0}}},vs=16384,_s=256,xs=1024,bs=34962,ws="webglcontextlost",Ss="webglcontextrestored",As=1,Es=2,Ts=3;function ks(t,e){for(var r=0;r<t.length;++r)if(t[r]===e)return r;return-1}function Is(t){var r=At(t);if(!r)return null;var n=r.gl,i=n.getContextAttributes(),o=n.isContextLost(),a=Et(n,r);if(!a)return null;var s=gt(),u=fs(),l=a.extensions,c=gs(n,l),p=yt(),h=n.drawingBufferWidth,f=n.drawingBufferHeight,d={tick:0,time:0,viewportWidth:h,viewportHeight:f,framebufferWidth:h,framebufferHeight:f,drawingBufferWidth:h,drawingBufferHeight:f,pixelRatio:r.pixelRatio},m={},y={elements:null,primitive:4,count:-1,offset:0,instances:-1},g=we(n,l),v=Ze(n,u,r,b),_=or(n,l,v,u),x=qi(n,l,g,u,v,_,y);function b(t){return x.destroyBuffer(t)}var w=Xi(n,s,u,r),S=Hn(n,l,g,(function(){T.procs.poll()}),d,u,r),A=li(n,l,g,u,r),E=Oi(n,l,g,S,A,u),T=hs(n,s,l,g,v,_,S,E,m,x,w,y,d,c,r),k=Qi(n,E,T.procs.poll,d,i,l,g),I=T.next,z=n.canvas,C=[],P=[],M=[],D=[r.onDestroy],L=null;function B(){if(0===C.length)return c&&c.update(),void(L=null);L=mt.next(B),W();for(var t=C.length-1;t>=0;--t){var e=C[t];e&&e(d,null,0)}n.flush(),c&&c.update()}function R(){!L&&C.length>0&&(L=mt.next(B))}function O(){L&&(mt.cancel(B),L=null)}function F(t){t.preventDefault(),o=!0,O(),P.forEach((function(t){t()}))}function V(t){n.getError(),o=!1,a.restore(),w.restore(),v.restore(),S.restore(),A.restore(),E.restore(),x.restore(),c&&c.restore(),T.procs.refresh(),R(),M.forEach((function(t){t()}))}function U(){C.length=0,O(),z&&(z.removeEventListener(ws,F),z.removeEventListener(Ss,V)),w.clear(),E.clear(),A.clear(),x.clear(),S.clear(),_.clear(),v.clear(),c&&c.clear(),D.forEach((function(t){t()}))}function j(t){function r(t){var r=e({},t);function n(t){if(t in r){var e=r[t];delete r[t],Object.keys(e).forEach((function(n){r[t+"."+n]=e[n]}))}}return delete r.uniforms,delete r.attributes,delete r.context,delete r.vao,"stencil"in r&&r.stencil.op&&(r.stencil.opBack=r.stencil.opFront=r.stencil.op,delete r.stencil.op),n("blend"),n("depth"),n("cull"),n("stencil"),n("polygonOffset"),n("scissor"),n("sample"),"vao"in t&&(r.vao=t.vao),r}function n(t,e){var r={},n={};return Object.keys(t).forEach((function(i){var o=t[i];if(dt.isDynamic(o))n[i]=dt.unbox(o,i);else{if(e&&Array.isArray(o))for(var a=0;a<o.length;++a)if(dt.isDynamic(o[a]))return void(n[i]=dt.unbox(o,i));r[i]=o}})),{dynamic:n,static:r}}rt(!!t,"invalid args to regl({...})"),rt.type(t,"object","invalid args to regl({...})");var i=n(t.context||{},!0),a=n(t.uniforms||{},!0),s=n(t.attributes||{},!1),u=n(r(t),!1),l={gpuTime:0,cpuTime:0,count:0},c=T.compile(u,s,a,i,l),p=c.draw,h=c.batch,f=c.scope,d=[];function m(t){for(;d.length<t;)d.push(null);return d}function y(t,e){var r;if(o&&rt.raise("context lost"),"function"==typeof t)return f.call(this,null,t,0);if("function"==typeof e)if("number"==typeof t)for(r=0;r<t;++r)f.call(this,null,e,r);else{if(!Array.isArray(t))return f.call(this,t,e,0);for(r=0;r<t.length;++r)f.call(this,t[r],e,r)}else if("number"==typeof t){if(t>0)return h.call(this,m(0|t),0|t)}else{if(!Array.isArray(t))return p.call(this,t);if(t.length)return h.call(this,t,t.length)}}return e(y,{stats:l,destroy:function(){c.destroy()}})}z&&(z.addEventListener(ws,F,!1),z.addEventListener(Ss,V,!1));var N=E.setFBO=j({framebuffer:dt.define.call(null,As,"framebuffer")});function q(t,e){var r=0;T.procs.poll();var i=e.color;i&&(n.clearColor(+i[0]||0,+i[1]||0,+i[2]||0,+i[3]||0),r|=vs),"depth"in e&&(n.clearDepth(+e.depth),r|=_s),"stencil"in e&&(n.clearStencil(0|e.stencil),r|=xs),rt(!!r,"called regl.clear with no buffer specified"),n.clear(r)}function $(t){if(rt("object"==typeof t&&t,"regl.clear() takes an object as input"),"framebuffer"in t)if(t.framebuffer&&"framebufferCube"===t.framebuffer_reglType)for(var r=0;r<6;++r)N(e({framebuffer:t.framebuffer.faces[r]},t),q);else N(t,q);else q(null,t)}function Z(t){function e(){var e=ks(C,t);function r(){var t=ks(C,r);C[t]=C[C.length-1],C.length-=1,C.length<=0&&O()}rt(e>=0,"cannot cancel a frame twice"),C[e]=r}return rt.type(t,"function","regl.frame() callback must be a function"),C.push(t),R(),{cancel:e}}function G(){var t=I.viewport,e=I.scissor_box;t[0]=t[1]=e[0]=e[1]=0,d.viewportWidth=d.framebufferWidth=d.drawingBufferWidth=t[2]=e[2]=n.drawingBufferWidth,d.viewportHeight=d.framebufferHeight=d.drawingBufferHeight=t[3]=e[3]=n.drawingBufferHeight}function W(){d.tick+=1,d.time=H(),G(),T.procs.poll()}function X(){S.refresh(),G(),T.procs.refresh(),c&&c.update()}function H(){return(yt()-p)/1e3}function K(t,e){var r;switch(rt.type(e,"function","listener callback must be a function"),t){case"frame":return Z(e);case"lost":r=P;break;case"restore":r=M;break;case"destroy":r=D;break;default:rt.raise("invalid event, must be one of frame,lost,restore,destroy")}return r.push(e),{cancel:function(){for(var t=0;t<r.length;++t)if(r[t]===e)return r[t]=r[r.length-1],void r.pop()}}}X();var Y=e(j,{clear:$,prop:dt.define.bind(null,As),context:dt.define.bind(null,Es),this:dt.define.bind(null,Ts),draw:j({}),buffer:function(t){return v.create(t,bs,!1,!1)},elements:function(t){return _.create(t,!1)},texture:S.create2D,cube:S.createCube,renderbuffer:A.create,framebuffer:E.create,framebufferCube:E.createCube,vao:x.createVAO,attributes:i,frame:Z,on:K,limits:g,hasExtension:function(t){return g.extensions.indexOf(t.toLowerCase())>=0},read:k,destroy:U,_gl:n,_refresh:X,poll:function(){W(),c&&c.update()},now:H,stats:u});return r.onDone(null,Y),Y}return Is}()}));function Br(t){let e,r,n,i,o;const a=t[8].default,s=p(a,t,t[7],null);return{c(){e=A("header"),r=A("div"),n=A("div"),s&&s.c(),V(n,"center",t[1]),C(r,"class","v-padded col-wide middle svelte-bc814s"),L(r,"position","relative"),V(r,"compact",t[3]),V(r,"short",t[2]),V(r,"height-full",!t[2]&&!t[3]),C(e,"style",i="color: "+_t[t[0]].text+"; background-color: "+_t[t[0]].background+"; "+t[4]),C(e,"class","svelte-bc814s"),V(e,"compact",t[3]),V(e,"short",t[2])},m(t,i){w(t,e,i),x(e,r),x(r,n),s&&s.m(n,null),o=!0},p(t,[u]){s&&s.p&&128&u&&f(s,a,t,t[7],u,null,null),2&u&&V(n,"center",t[1]),8&u&&V(r,"compact",t[3]),4&u&&V(r,"short",t[2]),12&u&&V(r,"height-full",!t[2]&&!t[3]),(!o||17&u&&i!==(i="color: "+_t[t[0]].text+"; background-color: "+_t[t[0]].background+"; "+t[4]))&&C(e,"style",i),8&u&&V(e,"compact",t[3]),4&u&&V(e,"short",t[2])},i(t){o||(st(s,t),o=!0)},o(t){ut(s,t),o=!1},d(t){t&&S(e),s&&s.d(t)}}}function Rr(t,e,r){let{$$slots:n={},$$scope:i}=e,{theme:o=$("theme")}=e,{bgimage:a=null}=e,{bgfixed:s=!1}=e,{center:u=!0}=e,{short:l=!1}=e,{compact:c=!1}=e,p="";return p+=a?`background-image: url(${a});`:"background-image: none;",s&&(p+=" background-attachment: fixed;"),t.$$set=t=>{"theme"in t&&r(0,o=t.theme),"bgimage"in t&&r(5,a=t.bgimage),"bgfixed"in t&&r(6,s=t.bgfixed),"center"in t&&r(1,u=t.center),"short"in t&&r(2,l=t.short),"compact"in t&&r(3,c=t.compact),"$$scope"in t&&r(7,i=t.$$scope)},[o,u,l,c,p,a,s,i,n]}class Or extends vt{constructor(t){super(),gt(this,t,Rr,Br,u,{theme:0,bgimage:5,bgfixed:6,center:1,short:2,compact:3})}}function Fr(t){let e,r,n;const i=t[2].default,o=p(i,t,t[1],null);return{c(){e=A("section"),r=A("div"),o&&o.c(),C(r,"class","col-medium"),L(e,"color",_t[t[0]].text),L(e,"background-color",_t[t[0]].background)},m(t,i){w(t,e,i),x(e,r),o&&o.m(r,null),n=!0},p(t,[r]){o&&o.p&&2&r&&f(o,i,t,t[1],r,null,null),(!n||1&r)&&L(e,"color",_t[t[0]].text),(!n||1&r)&&L(e,"background-color",_t[t[0]].background)},i(t){n||(st(o,t),n=!0)},o(t){ut(o,t),n=!1},d(t){t&&S(e),o&&o.d(t)}}}function Vr(t,e,r){let{$$slots:n={},$$scope:i}=e,{theme:o=$("theme")}=e;return t.$$set=t=>{"theme"in t&&r(0,o=t.theme),"$$scope"in t&&r(1,i=t.$$scope)},[o,i,n]}class Ur extends vt{constructor(t){super(),gt(this,t,Vr,Fr,u,{theme:0})}}const{window:jr}=lt,Nr=t=>({}),qr=t=>({}),$r=t=>({}),Zr=t=>({});function Gr(t){let e,r,n,i,o,a,s,u;Y(t[22]);const l=t[21].background,c=p(l,t,t[20],Zr),h=t[21].foreground,d=p(h,t,t[20],qr);return{c(){e=A("svelte-scroller-outer"),r=A("svelte-scroller-background-container"),n=A("svelte-scroller-background"),c&&c.c(),i=k(),o=A("svelte-scroller-foreground"),d&&d.c(),M(n,"class","svelte-142fpwm"),M(r,"class","background-container svelte-142fpwm"),M(o,"class","svelte-142fpwm"),M(e,"class","svelte-142fpwm"),V(e,"splitscreen",t[0])},m(l,p){w(l,e,p),x(e,r),x(r,n),c&&c.m(n,null),t[23](n),t[24](r),x(e,i),x(e,o),d&&d.m(o,null),t[25](o),t[26](e),a=!0,s||(u=z(jr,"resize",t[22]),s=!0)},p(t,r){c&&c.p&&1048576&r[0]&&f(c,l,t,t[20],r,$r,Zr),d&&d.p&&1048576&r[0]&&f(d,h,t,t[20],r,Nr,qr),1&r[0]&&V(e,"splitscreen",t[0])},i(t){a||(st(c,t),st(d,t),a=!0)},o(t){ut(c,t),ut(d,t),a=!1},d(r){r&&S(e),c&&c.d(r),t[23](null),t[24](null),d&&d.d(r),t[25](null),t[26](null),s=!1,u()}}}const Wr=[];let Xr;if("undefined"!=typeof window){const t=()=>Wr.forEach((t=>t()));window.addEventListener("scroll",t),window.addEventListener("resize",t)}if("undefined"!=typeof IntersectionObserver){const t=new Map,e=new IntersectionObserver(((e,r)=>{e.forEach((e=>{const r=t.get(e.target),n=Wr.indexOf(r);e.isIntersecting?-1===n&&Wr.push(r):(r(),-1!==n&&Wr.splice(n,1))}))}),{rootMargin:"400px 0px"});Xr={add:({outer:r,update:n})=>{const{top:i,bottom:o}=r.getBoundingClientRect();i<window.innerHeight&&o>0&&Wr.push(n),t.set(r,n),e.observe(r)},remove:({outer:r,update:n})=>{const i=Wr.indexOf(n);-1!==i&&Wr.splice(i,1),t.delete(r),e.unobserve(r)}}}else Xr={add:({update:t})=>{Wr.push(t)},remove:({update:t})=>{const e=Wr.indexOf(t);-1!==e&&Wr.splice(e,1)}};function Hr(t,e,r){let n,i,o,a,s,u,l,c,p,h,f,{$$slots:d={},$$scope:m}=e,{top:y=0}=e,{bottom:g=1}=e,{threshold:v=.5}=e,{query:_="section"}=e,{parallax:x=!1}=e,{index:b=0}=e,{count:w=0}=e,{offset:S=0}=e,{progress:A=0}=e,{visible:E=!1}=e,{splitscreen:T=!1}=e,{key:k=""}=e,{image:I=null}=e,{prevImage:z=null}=e,{video:C=null}=e,P=0,M=1;function D(){if(i){let t=`position: ${l?"fixed":"absolute"}; top: 0; transform: translate(0, ${c}px); width: ${M}px; z-index: 1;`;r(2,i.style.cssText=t,i)}}function L(){if(!o)return;const t=n.getBoundingClientRect();s=t.left,M=t.right-t.left;const e=o.getBoundingClientRect(),i=a.getBoundingClientRect();r(10,E=e.top<P&&e.bottom>0);const d=e.bottom-e.top,m=i.bottom-i.top,y=h-p;for(r(9,A=(p-e.top)/(d-y)),A<=0?(c=0,l&&(l=!1,D())):A>=1?(c=x?d-m:d-y,l&&(l=!1,D())):(c=x?Math.round(p-A*(m-y)):p,l||(l=!0,D())),r(6,b=0);b<u.length;r(6,b+=1)){const t=u[b],{top:n}=t.getBoundingClientRect(),i=u[b+1],o=i?i.getBoundingClientRect().top:e.bottom;if(r(13,z=I),r(12,I=null),r(14,C=null),r(11,k=t.getAttribute("key")),r(12,I=t.getAttribute("image")),r(8,S=(f-n)/(o-n)),o>=f)break}}return N((()=>{u=o.querySelectorAll(_),r(7,w=u.length),L();const t={outer:n,update:L};return Xr.add(t),()=>Xr.remove(t)})),t.$$set=t=>{"top"in t&&r(15,y=t.top),"bottom"in t&&r(16,g=t.bottom),"threshold"in t&&r(17,v=t.threshold),"query"in t&&r(18,_=t.query),"parallax"in t&&r(19,x=t.parallax),"index"in t&&r(6,b=t.index),"count"in t&&r(7,w=t.count),"offset"in t&&r(8,S=t.offset),"progress"in t&&r(9,A=t.progress),"visible"in t&&r(10,E=t.visible),"splitscreen"in t&&r(0,T=t.splitscreen),"key"in t&&r(11,k=t.key),"image"in t&&r(12,I=t.image),"prevImage"in t&&r(13,z=t.prevImage),"video"in t&&r(14,C=t.video),"$$scope"in t&&r(20,m=t.$$scope)},t.$$.update=()=>{32800&t.$$.dirty[0]&&(p=Math.round(y*P)),65568&t.$$.dirty[0]&&(h=Math.round(g*P)),131104&t.$$.dirty[0]&&(f=Math.round(v*P)),753664&t.$$.dirty[0]&&L()},[T,n,i,o,a,P,b,w,S,A,E,k,I,z,C,y,g,v,_,x,m,d,function(){r(5,P=jr.innerHeight)},function(t){G[t?"unshift":"push"]((()=>{a=t,r(4,a)}))},function(t){G[t?"unshift":"push"]((()=>{i=t,r(2,i)}))},function(t){G[t?"unshift":"push"]((()=>{o=t,r(3,o)}))},function(t){G[t?"unshift":"push"]((()=>{n=t,r(1,n)}))}]}class Kr extends vt{constructor(t){super(),gt(this,t,Hr,Gr,u,{top:15,bottom:16,threshold:17,query:18,parallax:19,index:6,count:7,offset:8,progress:9,visible:10,splitscreen:0,key:11,image:12,prevImage:13,video:14},[-1,-1])}}function Yr(t){let e;return{c(){e=A("hr"),L(e,"color",_t[t[0]].muted),L(e,"border","none"),C(e,"class","svelte-1l2to1w")},m(t,r){w(t,e,r)},p(t,r){1&r&&L(e,"color",_t[t[0]].muted)},d(t){t&&S(e)}}}function Jr(t){let e;return{c(){e=A("hr"),L(e,"color",_t[t[0]].muted),C(e,"class","svelte-1l2to1w")},m(t,r){w(t,e,r)},p(t,r){1&r&&L(e,"color",_t[t[0]].muted)},d(t){t&&S(e)}}}function Qr(e){let r,n;function i(t,e){return t[1]?Jr:Yr}let o=i(e),a=o(e);return{c(){r=A("section"),n=A("div"),a.c(),C(n,"class","col-medium"),L(r,"color",_t[e[0]].text),L(r,"background-color",_t[e[0]].background)},m(t,e){w(t,r,e),x(r,n),a.m(n,null)},p(t,[e]){o===(o=i(t))&&a?a.p(t,e):(a.d(1),a=o(t),a&&(a.c(),a.m(n,null))),1&e&&L(r,"color",_t[t[0]].text),1&e&&L(r,"background-color",_t[t[0]].background)},i:t,o:t,d(t){t&&S(r),a.d()}}}function tn(t,e,r){let{theme:n=$("theme")}=e,{hr:i=!0}=e;return t.$$set=t=>{"theme"in t&&r(0,n=t.theme),"hr"in t&&r(1,i=t.hr)},[n,i]}class en extends vt{constructor(t){super(),gt(this,t,tn,Qr,u,{theme:0,hr:1})}}Lr((function(t,e){t.exports=function(){var t,e,r;function n(n,i){if(t)if(e){var o="var sharedChunk = {}; ("+t+")(sharedChunk); ("+e+")(sharedChunk);",a={};t(a),r=i(a),"undefined"!=typeof window&&(r.workerUrl=window.URL.createObjectURL(new Blob([o],{type:"text/javascript"})))}else e=i;else t=i}return n(["exports"],(function(t){function e(t,e){return t(e={exports:{}},e.exports),e.exports}var r=n;function n(t,e,r,n){this.cx=3*t,this.bx=3*(r-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(n-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=n,this.p2x=r,this.p2y=n}n.prototype.sampleCurveX=function(t){return((this.ax*t+this.bx)*t+this.cx)*t},n.prototype.sampleCurveY=function(t){return((this.ay*t+this.by)*t+this.cy)*t},n.prototype.sampleCurveDerivativeX=function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},n.prototype.solveCurveX=function(t,e){var r,n,i,o,a;for(void 0===e&&(e=1e-6),i=t,a=0;a<8;a++){if(o=this.sampleCurveX(i)-t,Math.abs(o)<e)return i;var s=this.sampleCurveDerivativeX(i);if(Math.abs(s)<1e-6)break;i-=o/s}if((i=t)<(r=0))return r;if(i>(n=1))return n;for(;r<n;){if(o=this.sampleCurveX(i),Math.abs(o-t)<e)return i;t>o?r=i:n=i,i=.5*(n-r)+r}return i},n.prototype.solve=function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))};var i=o;function o(t,e){this.x=t,this.y=e}o.prototype={clone:function(){return new o(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,r=t.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[2]*this.x+t[3]*this.y;return this.x=t[0]*this.x+t[1]*this.y,this.y=e,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),r=Math.sin(t),n=r*this.x+e*this.y;return this.x=e*this.x-r*this.y,this.y=n,this},_rotateAround:function(t,e){var r=Math.cos(t),n=Math.sin(t),i=e.y+n*(this.x-e.x)+r*(this.y-e.y);return this.x=e.x+r*(this.x-e.x)-n*(this.y-e.y),this.y=i,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},o.convert=function(t){return t instanceof o?t:Array.isArray(t)?new o(t[0],t[1]):t};var a="undefined"!=typeof self?self:{},s=Math.pow(2,53)-1;function u(t,e,n,i){var o=new r(t,e,n,i);return function(t){return o.solve(t)}}var l=u(.25,.1,.25,1);function c(t,e,r){return Math.min(r,Math.max(e,t))}function p(t,e,r){var n=r-e,i=((t-e)%n+n)%n+e;return i===e?r:i}function h(t){for(var e=[],r=arguments.length-1;r-- >0;)e[r]=arguments[r+1];for(var n=0,i=e;n<i.length;n+=1){var o=i[n];for(var a in o)t[a]=o[a]}return t}var f=1;function d(){return f++}function m(){return function t(e){return e?(e^16*Math.random()>>e/4).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,t)}()}function y(t){return!!t&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(t)}function g(t,e){t.forEach((function(t){e[t]&&(e[t]=e[t].bind(e))}))}function v(t,e){return-1!==t.indexOf(e,t.length-e.length)}function _(t,e,r){var n={};for(var i in t)n[i]=e.call(r||this,t[i],i,t);return n}function x(t,e,r){var n={};for(var i in t)e.call(r||this,t[i],i,t)&&(n[i]=t[i]);return n}function b(t){return Array.isArray(t)?t.map(b):"object"==typeof t&&t?_(t,b):t}var w={};function S(t){w[t]||("undefined"!=typeof console&&console.warn(t),w[t]=!0)}function A(t,e,r){return(r.y-t.y)*(e.x-t.x)>(e.y-t.y)*(r.x-t.x)}function E(t){for(var e=0,r=0,n=t.length,i=n-1,o=void 0,a=void 0;r<n;i=r++)e+=((a=t[i]).x-(o=t[r]).x)*(o.y+a.y);return e}function T(){return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope}function k(t){var e={};if(t.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(function(t,r,n,i){var o=n||i;return e[r]=!o||o.toLowerCase(),""})),e["max-age"]){var r=parseInt(e["max-age"],10);isNaN(r)?delete e["max-age"]:e["max-age"]=r}return e}var I=null;function z(t){if(null==I){var e=t.navigator?t.navigator.userAgent:null;I=!!t.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return I}function C(t){try{var e=a[t];return e.setItem("_mapbox_test_",1),e.removeItem("_mapbox_test_"),!0}catch(t){return!1}}var P,M,D,L,B=a.performance&&a.performance.now?a.performance.now.bind(a.performance):Date.now.bind(Date),R=a.requestAnimationFrame||a.mozRequestAnimationFrame||a.webkitRequestAnimationFrame||a.msRequestAnimationFrame,O=a.cancelAnimationFrame||a.mozCancelAnimationFrame||a.webkitCancelAnimationFrame||a.msCancelAnimationFrame,F={now:B,frame:function(t){var e=R(t);return{cancel:function(){return O(e)}}},getImageData:function(t,e){void 0===e&&(e=0);var r=a.document.createElement("canvas"),n=r.getContext("2d");if(!n)throw new Error("failed to create canvas 2d context");return r.width=t.width,r.height=t.height,n.drawImage(t,0,0,t.width,t.height),n.getImageData(-e,-e,t.width+2*e,t.height+2*e)},resolveURL:function(t){return P||(P=a.document.createElement("a")),P.href=t,P.href},hardwareConcurrency:a.navigator&&a.navigator.hardwareConcurrency||4,get devicePixelRatio(){return a.devicePixelRatio},get prefersReducedMotion(){return!!a.matchMedia&&(null==M&&(M=a.matchMedia("(prefers-reduced-motion: reduce)")),M.matches)}},V={API_URL:"https://api.mapbox.com",get EVENTS_URL(){return this.API_URL?0===this.API_URL.indexOf("https://api.mapbox.cn")?"https://events.mapbox.cn/events/v2":0===this.API_URL.indexOf("https://api.mapbox.com")?"https://events.mapbox.com/events/v2":null:null},FEEDBACK_URL:"https://apps.mapbox.com/feedback",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null,MAX_PARALLEL_IMAGE_REQUESTS:16},U={supported:!1,testSupport:function(t){!j&&L&&(N?q(t):D=t)}},j=!1,N=!1;function q(t){var e=t.createTexture();t.bindTexture(t.TEXTURE_2D,e);try{if(t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,L),t.isContextLost())return;U.supported=!0}catch(t){}t.deleteTexture(e),j=!0}a.document&&((L=a.document.createElement("img")).onload=function(){D&&q(D),D=null,N=!0},L.onerror=function(){j=!0,D=null},L.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");var $="01",Z=function(t,e){this._transformRequestFn=t,this._customAccessToken=e,this._createSkuToken()};function G(t){return 0===t.indexOf("mapbox:")}Z.prototype._createSkuToken=function(){var t=function(){for(var t="",e=0;e<10;e++)t+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:["1",$,t].join(""),tokenExpiresAt:Date.now()+432e5}}();this._skuToken=t.token,this._skuTokenExpiresAt=t.tokenExpiresAt},Z.prototype._isSkuTokenExpired=function(){return Date.now()>this._skuTokenExpiresAt},Z.prototype.transformRequest=function(t,e){return this._transformRequestFn&&this._transformRequestFn(t,e)||{url:t}},Z.prototype.normalizeStyleURL=function(t,e){if(!G(t))return t;var r=K(t);return r.path="/styles/v1"+r.path,this._makeAPIURL(r,this._customAccessToken||e)},Z.prototype.normalizeGlyphsURL=function(t,e){if(!G(t))return t;var r=K(t);return r.path="/fonts/v1"+r.path,this._makeAPIURL(r,this._customAccessToken||e)},Z.prototype.normalizeSourceURL=function(t,e){if(!G(t))return t;var r=K(t);return r.path="/v4/"+r.authority+".json",r.params.push("secure"),this._makeAPIURL(r,this._customAccessToken||e)},Z.prototype.normalizeSpriteURL=function(t,e,r,n){var i=K(t);return G(t)?(i.path="/styles/v1"+i.path+"/sprite"+e+r,this._makeAPIURL(i,this._customAccessToken||n)):(i.path+=""+e+r,Y(i))},Z.prototype.normalizeTileURL=function(t,e){if(this._isSkuTokenExpired()&&this._createSkuToken(),t&&!G(t))return t;var r=K(t);r.path=r.path.replace(/(\.(png|jpg)\d*)(?=$)/,(F.devicePixelRatio>=2||512===e?"@2x":"")+(U.supported?".webp":"$1")),r.path=r.path.replace(/^.+\/v4\//,"/"),r.path="/v4"+r.path;var n=this._customAccessToken||function(t){for(var e=0,r=t;e<r.length;e+=1){var n=r[e].match(/^access_token=(.*)$/);if(n)return n[1]}return null}(r.params)||V.ACCESS_TOKEN;return V.REQUIRE_ACCESS_TOKEN&&n&&this._skuToken&&r.params.push("sku="+this._skuToken),this._makeAPIURL(r,n)},Z.prototype.canonicalizeTileURL=function(t,e){var r=K(t);if(!r.path.match(/(^\/v4\/)/)||!r.path.match(/\.[\w]+$/))return t;var n="mapbox://tiles/";n+=r.path.replace("/v4/","");var i=r.params;return e&&(i=i.filter((function(t){return!t.match(/^access_token=/)}))),i.length&&(n+="?"+i.join("&")),n},Z.prototype.canonicalizeTileset=function(t,e){for(var r=!!e&&G(e),n=[],i=0,o=t.tiles||[];i<o.length;i+=1){var a=o[i];X(a)?n.push(this.canonicalizeTileURL(a,r)):n.push(a)}return n},Z.prototype._makeAPIURL=function(t,e){var r="See https://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes",n=K(V.API_URL);if(t.protocol=n.protocol,t.authority=n.authority,"http"===t.protocol){var i=t.params.indexOf("secure");i>=0&&t.params.splice(i,1)}if("/"!==n.path&&(t.path=""+n.path+t.path),!V.REQUIRE_ACCESS_TOKEN)return Y(t);if(!(e=e||V.ACCESS_TOKEN))throw new Error("An API access token is required to use Mapbox GL. "+r);if("s"===e[0])throw new Error("Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). "+r);return t.params=t.params.filter((function(t){return-1===t.indexOf("access_token")})),t.params.push("access_token="+e),Y(t)};var W=/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i;function X(t){return W.test(t)}var H=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function K(t){var e=t.match(H);if(!e)throw new Error("Unable to parse URL object");return{protocol:e[1],authority:e[2],path:e[3]||"/",params:e[4]?e[4].split("&"):[]}}function Y(t){var e=t.params.length?"?"+t.params.join("&"):"";return t.protocol+"://"+t.authority+t.path+e}function J(t){if(!t)return null;var e=t.split(".");if(!e||3!==e.length)return null;try{return JSON.parse(decodeURIComponent(a.atob(e[1]).split("").map((function(t){return"%"+("00"+t.charCodeAt(0).toString(16)).slice(-2)})).join("")))}catch(t){return null}}var Q=function(t){this.type=t,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null};Q.prototype.getStorageKey=function(t){var e,r=J(V.ACCESS_TOKEN);return e=r&&r.u?a.btoa(encodeURIComponent(r.u).replace(/%([0-9A-F]{2})/g,(function(t,e){return String.fromCharCode(Number("0x"+e))}))):V.ACCESS_TOKEN||"",t?"mapbox.eventData."+t+":"+e:"mapbox.eventData:"+e},Q.prototype.fetchEventData=function(){var t=C("localStorage"),e=this.getStorageKey(),r=this.getStorageKey("uuid");if(t)try{var n=a.localStorage.getItem(e);n&&(this.eventData=JSON.parse(n));var i=a.localStorage.getItem(r);i&&(this.anonId=i)}catch(t){S("Unable to read from LocalStorage")}},Q.prototype.saveEventData=function(){var t=C("localStorage"),e=this.getStorageKey(),r=this.getStorageKey("uuid");if(t)try{a.localStorage.setItem(r,this.anonId),Object.keys(this.eventData).length>=1&&a.localStorage.setItem(e,JSON.stringify(this.eventData))}catch(t){S("Unable to write to LocalStorage")}},Q.prototype.processRequests=function(t){},Q.prototype.postEvent=function(t,e,r,n){var i=this;if(V.EVENTS_URL){var o=K(V.EVENTS_URL);o.params.push("access_token="+(n||V.ACCESS_TOKEN||""));var a={event:this.type,created:new Date(t).toISOString(),sdkIdentifier:"mapbox-gl-js",sdkVersion:"1.13.1",skuId:$,userId:this.anonId},s=e?h(a,e):a,u={url:Y(o),headers:{"Content-Type":"text/plain"},body:JSON.stringify([s])};this.pendingRequest=bt(u,(function(t){i.pendingRequest=null,r(t),i.saveEventData(),i.processRequests(n)}))}},Q.prototype.queueRequest=function(t,e){this.queue.push(t),this.processRequests(e)};var tt,et,rt=function(t){function e(){t.call(this,"map.load"),this.success={},this.skuToken=""}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.postMapLoadEvent=function(t,e,r,n){this.skuToken=r,(V.EVENTS_URL&&n||V.ACCESS_TOKEN&&Array.isArray(t)&&t.some((function(t){return G(t)||X(t)})))&&this.queueRequest({id:e,timestamp:Date.now()},n)},e.prototype.processRequests=function(t){var e=this;if(!this.pendingRequest&&0!==this.queue.length){var r=this.queue.shift(),n=r.id,i=r.timestamp;n&&this.success[n]||(this.anonId||this.fetchEventData(),y(this.anonId)||(this.anonId=m()),this.postEvent(i,{skuToken:this.skuToken},(function(t){t||n&&(e.success[n]=!0)}),t))}},e}(Q),nt=new(function(t){function e(e){t.call(this,"appUserTurnstile"),this._customAccessToken=e}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.postTurnstileEvent=function(t,e){V.EVENTS_URL&&V.ACCESS_TOKEN&&Array.isArray(t)&&t.some((function(t){return G(t)||X(t)}))&&this.queueRequest(Date.now(),e)},e.prototype.processRequests=function(t){var e=this;if(!this.pendingRequest&&0!==this.queue.length){this.anonId&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();var r=J(V.ACCESS_TOKEN),n=r?r.u:V.ACCESS_TOKEN,i=n!==this.eventData.tokenU;y(this.anonId)||(this.anonId=m(),i=!0);var o=this.queue.shift();if(this.eventData.lastSuccess){var a=new Date(this.eventData.lastSuccess),s=new Date(o),u=(o-this.eventData.lastSuccess)/864e5;i=i||u>=1||u<-1||a.getDate()!==s.getDate()}else i=!0;if(!i)return this.processRequests();this.postEvent(o,{"enabled.telemetry":!1},(function(t){t||(e.eventData.lastSuccess=o,e.eventData.tokenU=n)}),t)}},e}(Q)),it=nt.postTurnstileEvent.bind(nt),ot=new rt,at=ot.postMapLoadEvent.bind(ot),st=500,ut=50;function lt(){a.caches&&!tt&&(tt=a.caches.open("mapbox-tiles"))}function ct(t){var e=t.indexOf("?");return e<0?t:t.slice(0,e)}var pt,ht=1/0;function ft(){return null==pt&&(pt=a.OffscreenCanvas&&new a.OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof a.createImageBitmap),pt}var dt={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};"function"==typeof Object.freeze&&Object.freeze(dt);var mt,yt,gt=function(t){function e(e,r,n){401===r&&X(n)&&(e+=": you may have provided an invalid Mapbox access token. See https://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes"),t.call(this,e),this.status=r,this.url=n,this.name=this.constructor.name,this.message=e}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.toString=function(){return this.name+": "+this.message+" ("+this.status+"): "+this.url},e}(Error),vt=T()?function(){return self.worker&&self.worker.referrer}:function(){return("blob:"===a.location.protocol?a.parent:a).location.href},_t=function(t,e){if(!(/^file:/.test(r=t.url)||/^file:/.test(vt())&&!/^\w+:/.test(r))){if(a.fetch&&a.Request&&a.AbortController&&a.Request.prototype.hasOwnProperty("signal"))return function(t,e){var r,n=new a.AbortController,i=new a.Request(t.url,{method:t.method||"GET",body:t.body,credentials:t.credentials,headers:t.headers,referrer:vt(),signal:n.signal}),o=!1,s=!1,u=(r=i.url).indexOf("sku=")>0&&X(r);"json"===t.type&&i.headers.set("Accept","application/json");var l=function(r,n,o){if(!s){if(r&&"SecurityError"!==r.message&&S(r),n&&o)return c(n);var l=Date.now();a.fetch(i).then((function(r){if(r.ok){var n=u?r.clone():null;return c(r,n,l)}return e(new gt(r.statusText,r.status,t.url))})).catch((function(t){20!==t.code&&e(new Error(t.message))}))}},c=function(r,n,u){("arrayBuffer"===t.type?r.arrayBuffer():"json"===t.type?r.json():r.text()).then((function(t){s||(n&&u&&function(t,e,r){if(lt(),tt){var n={status:e.status,statusText:e.statusText,headers:new a.Headers};e.headers.forEach((function(t,e){return n.headers.set(e,t)}));var i=k(e.headers.get("Cache-Control")||"");i["no-store"]||(i["max-age"]&&n.headers.set("Expires",new Date(r+1e3*i["max-age"]).toUTCString()),new Date(n.headers.get("Expires")).getTime()-r<42e4||function(t,e){if(void 0===et)try{new Response(new ReadableStream),et=!0}catch(t){et=!1}et?e(t.body):t.blob().then(e)}(e,(function(e){var r=new a.Response(e,n);lt(),tt&&tt.then((function(e){return e.put(ct(t.url),r)})).catch((function(t){return S(t.message)}))})))}}(i,n,u),o=!0,e(null,t,r.headers.get("Cache-Control"),r.headers.get("Expires")))})).catch((function(t){s||e(new Error(t.message))}))};return u?function(t,e){if(lt(),!tt)return e(null);var r=ct(t.url);tt.then((function(t){t.match(r).then((function(n){var i=function(t){if(!t)return!1;var e=new Date(t.headers.get("Expires")||0),r=k(t.headers.get("Cache-Control")||"");return e>Date.now()&&!r["no-cache"]}(n);t.delete(r),i&&t.put(r,n.clone()),e(null,n,i)})).catch(e)})).catch(e)}(i,l):l(null,null),{cancel:function(){s=!0,o||n.abort()}}}(t,e);if(T()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",t,e,void 0,!0)}var r;return function(t,e){var r=new a.XMLHttpRequest;for(var n in r.open(t.method||"GET",t.url,!0),"arrayBuffer"===t.type&&(r.responseType="arraybuffer"),t.headers)r.setRequestHeader(n,t.headers[n]);return"json"===t.type&&(r.responseType="text",r.setRequestHeader("Accept","application/json")),r.withCredentials="include"===t.credentials,r.onerror=function(){e(new Error(r.statusText))},r.onload=function(){if((r.status>=200&&r.status<300||0===r.status)&&null!==r.response){var n=r.response;if("json"===t.type)try{n=JSON.parse(r.response)}catch(t){return e(t)}e(null,n,r.getResponseHeader("Cache-Control"),r.getResponseHeader("Expires"))}else e(new gt(r.statusText,r.status,t.url))},r.send(t.body),{cancel:function(){return r.abort()}}}(t,e)},xt=function(t,e){return _t(h(t,{type:"arrayBuffer"}),e)},bt=function(t,e){return _t(h(t,{method:"POST"}),e)},wt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";mt=[],yt=0;var St=function(t,e){if(U.supported&&(t.headers||(t.headers={}),t.headers.accept="image/webp,*/*"),yt>=V.MAX_PARALLEL_IMAGE_REQUESTS){var r={requestParameters:t,callback:e,cancelled:!1,cancel:function(){this.cancelled=!0}};return mt.push(r),r}yt++;var n=!1,i=function(){if(!n)for(n=!0,yt--;mt.length&&yt<V.MAX_PARALLEL_IMAGE_REQUESTS;){var t=mt.shift();t.cancelled||(t.cancel=St(t.requestParameters,t.callback).cancel)}},o=xt(t,(function(t,r,n,o){i(),t?e(t):r&&(ft()?function(t,e){var r=new a.Blob([new Uint8Array(t)],{type:"image/png"});a.createImageBitmap(r).then((function(t){e(null,t)})).catch((function(t){e(new Error("Could not load image because of "+t.message+". Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."))}))}(r,e):function(t,e,r,n){var i=new a.Image,o=a.URL;i.onload=function(){e(null,i),o.revokeObjectURL(i.src),i.onload=null,a.requestAnimationFrame((function(){i.src=wt}))},i.onerror=function(){return e(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."))};var s=new a.Blob([new Uint8Array(t)],{type:"image/png"});i.cacheControl=r,i.expires=n,i.src=t.byteLength?o.createObjectURL(s):wt}(r,e,n,o))}));return{cancel:function(){o.cancel(),i()}}};function At(t,e,r){r[t]&&-1!==r[t].indexOf(e)||(r[t]=r[t]||[],r[t].push(e))}function Et(t,e,r){if(r&&r[t]){var n=r[t].indexOf(e);-1!==n&&r[t].splice(n,1)}}var Tt=function(t,e){void 0===e&&(e={}),h(this,e),this.type=t},kt=function(t){function e(e,r){void 0===r&&(r={}),t.call(this,"error",h({error:e},r))}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(Tt),It=function(){};It.prototype.on=function(t,e){return this._listeners=this._listeners||{},At(t,e,this._listeners),this},It.prototype.off=function(t,e){return Et(t,e,this._listeners),Et(t,e,this._oneTimeListeners),this},It.prototype.once=function(t,e){return this._oneTimeListeners=this._oneTimeListeners||{},At(t,e,this._oneTimeListeners),this},It.prototype.fire=function(t,e){"string"==typeof t&&(t=new Tt(t,e||{}));var r=t.type;if(this.listens(r)){t.target=this;for(var n=0,i=this._listeners&&this._listeners[r]?this._listeners[r].slice():[];n<i.length;n+=1)i[n].call(this,t);for(var o=0,a=this._oneTimeListeners&&this._oneTimeListeners[r]?this._oneTimeListeners[r].slice():[];o<a.length;o+=1){var s=a[o];Et(r,s,this._oneTimeListeners),s.call(this,t)}var u=this._eventedParent;u&&(h(t,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),u.fire(t))}else t instanceof kt&&console.error(t.error);return this},It.prototype.listens=function(t){return this._listeners&&this._listeners[t]&&this._listeners[t].length>0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t)},It.prototype.setEventedParent=function(t,e){return this._eventedParent=t,this._eventedParentData=e,this};var zt={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},sources:{required:!0,type:"sources"},sprite:{type:"string"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{}},default:"mapbox"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}},Ct=function(t,e,r,n){this.message=(t?t+": ":"")+r,n&&(this.identifier=n),null!=e&&e.__line__&&(this.line=e.__line__)};function Pt(t){var e=t.value;return e?[new Ct(t.key,e,"constants have been deprecated as of v8")]:[]}function Mt(t){for(var e=[],r=arguments.length-1;r-- >0;)e[r]=arguments[r+1];for(var n=0,i=e;n<i.length;n+=1){var o=i[n];for(var a in o)t[a]=o[a]}return t}function Dt(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function Lt(t){if(Array.isArray(t))return t.map(Lt);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){var e={};for(var r in t)e[r]=Lt(t[r]);return e}return Dt(t)}var Bt=function(t){function e(e,r){t.call(this,r),this.message=r,this.key=e}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(Error),Rt=function(t,e){void 0===e&&(e=[]),this.parent=t,this.bindings={};for(var r=0,n=e;r<n.length;r+=1){var i=n[r];this.bindings[i[0]]=i[1]}};Rt.prototype.concat=function(t){return new Rt(this,t)},Rt.prototype.get=function(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw new Error(t+" not found in scope.")},Rt.prototype.has=function(t){return!!this.bindings[t]||!!this.parent&&this.parent.has(t)};var Ot={kind:"null"},Ft={kind:"number"},Vt={kind:"string"},Ut={kind:"boolean"},jt={kind:"color"},Nt={kind:"object"},qt={kind:"value"},$t={kind:"collator"},Zt={kind:"formatted"},Gt={kind:"resolvedImage"};function Wt(t,e){return{kind:"array",itemType:t,N:e}}function Xt(t){if("array"===t.kind){var e=Xt(t.itemType);return"number"==typeof t.N?"array<"+e+", "+t.N+">":"value"===t.itemType.kind?"array":"array<"+e+">"}return t.kind}var Ht=[Ot,Ft,Vt,Ut,jt,Zt,Nt,Wt(qt),Gt];function Kt(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&(0===e.N&&"value"===e.itemType.kind||!Kt(t.itemType,e.itemType))&&("number"!=typeof t.N||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if("value"===t.kind)for(var r=0,n=Ht;r<n.length;r+=1)if(!Kt(n[r],e))return null}return"Expected "+Xt(t)+" but found "+Xt(e)+" instead."}function Yt(t,e){return e.some((function(e){return e.kind===t.kind}))}function Jt(t,e){return e.some((function(e){return"null"===e?null===t:"array"===e?Array.isArray(t):"object"===e?t&&!Array.isArray(t)&&"object"==typeof t:e===typeof t}))}var Qt=e((function(t,e){var r={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function n(t){return(t=Math.round(t))<0?0:t>255?255:t}function i(t){return n("%"===t[t.length-1]?parseFloat(t)/100*255:parseInt(t))}function o(t){return(e="%"===t[t.length-1]?parseFloat(t)/100:parseFloat(t))<0?0:e>1?1:e;var e}function a(t,e,r){return r<0?r+=1:r>1&&(r-=1),6*r<1?t+(e-t)*r*6:2*r<1?e:3*r<2?t+(e-t)*(2/3-r)*6:t}try{e.parseCSSColor=function(t){var e,s=t.replace(/ /g,"").toLowerCase();if(s in r)return r[s].slice();if("#"===s[0])return 4===s.length?(e=parseInt(s.substr(1),16))>=0&&e<=4095?[(3840&e)>>4|(3840&e)>>8,240&e|(240&e)>>4,15&e|(15&e)<<4,1]:null:7===s.length&&(e=parseInt(s.substr(1),16))>=0&&e<=16777215?[(16711680&e)>>16,(65280&e)>>8,255&e,1]:null;var u=s.indexOf("("),l=s.indexOf(")");if(-1!==u&&l+1===s.length){var c=s.substr(0,u),p=s.substr(u+1,l-(u+1)).split(","),h=1;switch(c){case"rgba":if(4!==p.length)return null;h=o(p.pop());case"rgb":return 3!==p.length?null:[i(p[0]),i(p[1]),i(p[2]),h];case"hsla":if(4!==p.length)return null;h=o(p.pop());case"hsl":if(3!==p.length)return null;var f=(parseFloat(p[0])%360+360)%360/360,d=o(p[1]),m=o(p[2]),y=m<=.5?m*(d+1):m+d-m*d,g=2*m-y;return[n(255*a(g,y,f+1/3)),n(255*a(g,y,f)),n(255*a(g,y,f-1/3)),h];default:return null}}return null}}catch(t){}})).parseCSSColor,te=function(t,e,r,n){void 0===n&&(n=1),this.r=t,this.g=e,this.b=r,this.a=n};te.parse=function(t){if(t){if(t instanceof te)return t;if("string"==typeof t){var e=Qt(t);if(e)return new te(e[0]/255*e[3],e[1]/255*e[3],e[2]/255*e[3],e[3])}}},te.prototype.toString=function(){var t=this.toArray(),e=t[1],r=t[2],n=t[3];return"rgba("+Math.round(t[0])+","+Math.round(e)+","+Math.round(r)+","+n+")"},te.prototype.toArray=function(){var t=this.a;return 0===t?[0,0,0,0]:[255*this.r/t,255*this.g/t,255*this.b/t,t]},te.black=new te(0,0,0,1),te.white=new te(1,1,1,1),te.transparent=new te(0,0,0,0),te.red=new te(1,0,0,1);var ee=function(t,e,r){this.sensitivity=t?e?"variant":"case":e?"accent":"base",this.locale=r,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})};ee.prototype.compare=function(t,e){return this.collator.compare(t,e)},ee.prototype.resolvedLocale=function(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale};var re=function(t,e,r,n,i){this.text=t,this.image=e,this.scale=r,this.fontStack=n,this.textColor=i},ne=function(t){this.sections=t};ne.fromString=function(t){return new ne([new re(t,null,null,null,null)])},ne.prototype.isEmpty=function(){return 0===this.sections.length||!this.sections.some((function(t){return 0!==t.text.length||t.image&&0!==t.image.name.length}))},ne.factory=function(t){return t instanceof ne?t:ne.fromString(t)},ne.prototype.toString=function(){return 0===this.sections.length?"":this.sections.map((function(t){return t.text})).join("")},ne.prototype.serialize=function(){for(var t=["format"],e=0,r=this.sections;e<r.length;e+=1){var n=r[e];if(n.image)t.push(["image",n.image.name]);else{t.push(n.text);var i={};n.fontStack&&(i["text-font"]=["literal",n.fontStack.split(",")]),n.scale&&(i["font-scale"]=n.scale),n.textColor&&(i["text-color"]=["rgba"].concat(n.textColor.toArray())),t.push(i)}}return t};var ie=function(t){this.name=t.name,this.available=t.available};function oe(t,e,r,n){return"number"==typeof t&&t>=0&&t<=255&&"number"==typeof e&&e>=0&&e<=255&&"number"==typeof r&&r>=0&&r<=255?void 0===n||"number"==typeof n&&n>=0&&n<=1?null:"Invalid rgba value ["+[t,e,r,n].join(", ")+"]: 'a' must be between 0 and 1.":"Invalid rgba value ["+("number"==typeof n?[t,e,r,n]:[t,e,r]).join(", ")+"]: 'r', 'g', and 'b' must be between 0 and 255."}function ae(t){if(null===t)return!0;if("string"==typeof t)return!0;if("boolean"==typeof t)return!0;if("number"==typeof t)return!0;if(t instanceof te)return!0;if(t instanceof ee)return!0;if(t instanceof ne)return!0;if(t instanceof ie)return!0;if(Array.isArray(t)){for(var e=0,r=t;e<r.length;e+=1)if(!ae(r[e]))return!1;return!0}if("object"==typeof t){for(var n in t)if(!ae(t[n]))return!1;return!0}return!1}function se(t){if(null===t)return Ot;if("string"==typeof t)return Vt;if("boolean"==typeof t)return Ut;if("number"==typeof t)return Ft;if(t instanceof te)return jt;if(t instanceof ee)return $t;if(t instanceof ne)return Zt;if(t instanceof ie)return Gt;if(Array.isArray(t)){for(var e,r=t.length,n=0,i=t;n<i.length;n+=1){var o=se(i[n]);if(e){if(e===o)continue;e=qt;break}e=o}return Wt(e||qt,r)}return Nt}function ue(t){var e=typeof t;return null===t?"":"string"===e||"number"===e||"boolean"===e?String(t):t instanceof te||t instanceof ne||t instanceof ie?t.toString():JSON.stringify(t)}ie.prototype.toString=function(){return this.name},ie.fromString=function(t){return t?new ie({name:t,available:!1}):null},ie.prototype.serialize=function(){return["image",this.name]};var le=function(t,e){this.type=t,this.value=e};le.parse=function(t,e){if(2!==t.length)return e.error("'literal' expression requires exactly one argument, but found "+(t.length-1)+" instead.");if(!ae(t[1]))return e.error("invalid value");var r=t[1],n=se(r),i=e.expectedType;return"array"!==n.kind||0!==n.N||!i||"array"!==i.kind||"number"==typeof i.N&&0!==i.N||(n=i),new le(n,r)},le.prototype.evaluate=function(){return this.value},le.prototype.eachChild=function(){},le.prototype.outputDefined=function(){return!0},le.prototype.serialize=function(){return"array"===this.type.kind||"object"===this.type.kind?["literal",this.value]:this.value instanceof te?["rgba"].concat(this.value.toArray()):this.value instanceof ne?this.value.serialize():this.value};var ce=function(t){this.name="ExpressionEvaluationError",this.message=t};ce.prototype.toJSON=function(){return this.message};var pe={string:Vt,number:Ft,boolean:Ut,object:Nt},he=function(t,e){this.type=t,this.args=e};he.parse=function(t,e){if(t.length<2)return e.error("Expected at least one argument.");var r,n=1,i=t[0];if("array"===i){var o,a;if(t.length>2){var s=t[1];if("string"!=typeof s||!(s in pe)||"object"===s)return e.error('The item type argument of "array" must be one of string, number, boolean',1);o=pe[s],n++}else o=qt;if(t.length>3){if(null!==t[2]&&("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2])))return e.error('The length argument to "array" must be a positive integer literal',2);a=t[2],n++}r=Wt(o,a)}else r=pe[i];for(var u=[];n<t.length;n++){var l=e.parse(t[n],n,qt);if(!l)return null;u.push(l)}return new he(r,u)},he.prototype.evaluate=function(t){for(var e=0;e<this.args.length;e++){var r=this.args[e].evaluate(t);if(!Kt(this.type,se(r)))return r;if(e===this.args.length-1)throw new ce("Expected value to be of type "+Xt(this.type)+", but found "+Xt(se(r))+" instead.")}return null},he.prototype.eachChild=function(t){this.args.forEach(t)},he.prototype.outputDefined=function(){return this.args.every((function(t){return t.outputDefined()}))},he.prototype.serialize=function(){var t=this.type,e=[t.kind];if("array"===t.kind){var r=t.itemType;if("string"===r.kind||"number"===r.kind||"boolean"===r.kind){e.push(r.kind);var n=t.N;("number"==typeof n||this.args.length>1)&&e.push(n)}}return e.concat(this.args.map((function(t){return t.serialize()})))};var fe=function(t){this.type=Zt,this.sections=t};fe.parse=function(t,e){if(t.length<2)return e.error("Expected at least one argument.");var r=t[1];if(!Array.isArray(r)&&"object"==typeof r)return e.error("First argument must be an image or text section.");for(var n=[],i=!1,o=1;o<=t.length-1;++o){var a=t[o];if(i&&"object"==typeof a&&!Array.isArray(a)){i=!1;var s=null;if(a["font-scale"]&&!(s=e.parse(a["font-scale"],1,Ft)))return null;var u=null;if(a["text-font"]&&!(u=e.parse(a["text-font"],1,Wt(Vt))))return null;var l=null;if(a["text-color"]&&!(l=e.parse(a["text-color"],1,jt)))return null;var c=n[n.length-1];c.scale=s,c.font=u,c.textColor=l}else{var p=e.parse(t[o],1,qt);if(!p)return null;var h=p.type.kind;if("string"!==h&&"value"!==h&&"null"!==h&&"resolvedImage"!==h)return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");i=!0,n.push({content:p,scale:null,font:null,textColor:null})}}return new fe(n)},fe.prototype.evaluate=function(t){return new ne(this.sections.map((function(e){var r=e.content.evaluate(t);return se(r)===Gt?new re("",r,null,null,null):new re(ue(r),null,e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(","):null,e.textColor?e.textColor.evaluate(t):null)})))},fe.prototype.eachChild=function(t){for(var e=0,r=this.sections;e<r.length;e+=1){var n=r[e];t(n.content),n.scale&&t(n.scale),n.font&&t(n.font),n.textColor&&t(n.textColor)}},fe.prototype.outputDefined=function(){return!1},fe.prototype.serialize=function(){for(var t=["format"],e=0,r=this.sections;e<r.length;e+=1){var n=r[e];t.push(n.content.serialize());var i={};n.scale&&(i["font-scale"]=n.scale.serialize()),n.font&&(i["text-font"]=n.font.serialize()),n.textColor&&(i["text-color"]=n.textColor.serialize()),t.push(i)}return t};var de=function(t){this.type=Gt,this.input=t};de.parse=function(t,e){if(2!==t.length)return e.error("Expected two arguments.");var r=e.parse(t[1],1,Vt);return r?new de(r):e.error("No image name provided.")},de.prototype.evaluate=function(t){var e=this.input.evaluate(t),r=ie.fromString(e);return r&&t.availableImages&&(r.available=t.availableImages.indexOf(e)>-1),r},de.prototype.eachChild=function(t){t(this.input)},de.prototype.outputDefined=function(){return!1},de.prototype.serialize=function(){return["image",this.input.serialize()]};var me={"to-boolean":Ut,"to-color":jt,"to-number":Ft,"to-string":Vt},ye=function(t,e){this.type=t,this.args=e};ye.parse=function(t,e){if(t.length<2)return e.error("Expected at least one argument.");var r=t[0];if(("to-boolean"===r||"to-string"===r)&&2!==t.length)return e.error("Expected one argument.");for(var n=me[r],i=[],o=1;o<t.length;o++){var a=e.parse(t[o],o,qt);if(!a)return null;i.push(a)}return new ye(n,i)},ye.prototype.evaluate=function(t){if("boolean"===this.type.kind)return Boolean(this.args[0].evaluate(t));if("color"===this.type.kind){for(var e,r,n=0,i=this.args;n<i.length;n+=1){if(r=null,(e=i[n].evaluate(t))instanceof te)return e;if("string"==typeof e){var o=t.parseColor(e);if(o)return o}else if(Array.isArray(e)&&!(r=e.length<3||e.length>4?"Invalid rbga value "+JSON.stringify(e)+": expected an array containing either three or four numeric values.":oe(e[0],e[1],e[2],e[3])))return new te(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new ce(r||"Could not parse color from value '"+("string"==typeof e?e:String(JSON.stringify(e)))+"'")}if("number"===this.type.kind){for(var a=null,s=0,u=this.args;s<u.length;s+=1){if(null===(a=u[s].evaluate(t)))return 0;var l=Number(a);if(!isNaN(l))return l}throw new ce("Could not convert "+JSON.stringify(a)+" to number.")}return"formatted"===this.type.kind?ne.fromString(ue(this.args[0].evaluate(t))):"resolvedImage"===this.type.kind?ie.fromString(ue(this.args[0].evaluate(t))):ue(this.args[0].evaluate(t))},ye.prototype.eachChild=function(t){this.args.forEach(t)},ye.prototype.outputDefined=function(){return this.args.every((function(t){return t.outputDefined()}))},ye.prototype.serialize=function(){if("formatted"===this.type.kind)return new fe([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if("resolvedImage"===this.type.kind)return new de(this.args[0]).serialize();var t=["to-"+this.type.kind];return this.eachChild((function(e){t.push(e.serialize())})),t};var ge=["Unknown","Point","LineString","Polygon"],ve=function(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null};ve.prototype.id=function(){return this.feature&&"id"in this.feature?this.feature.id:null},ve.prototype.geometryType=function(){return this.feature?"number"==typeof this.feature.type?ge[this.feature.type]:this.feature.type:null},ve.prototype.geometry=function(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null},ve.prototype.canonicalID=function(){return this.canonical},ve.prototype.properties=function(){return this.feature&&this.feature.properties||{}},ve.prototype.parseColor=function(t){var e=this._parseColorCache[t];return e||(e=this._parseColorCache[t]=te.parse(t)),e};var _e=function(t,e,r,n){this.name=t,this.type=e,this._evaluate=r,this.args=n};_e.prototype.evaluate=function(t){return this._evaluate(t,this.args)},_e.prototype.eachChild=function(t){this.args.forEach(t)},_e.prototype.outputDefined=function(){return!1},_e.prototype.serialize=function(){return[this.name].concat(this.args.map((function(t){return t.serialize()})))},_e.parse=function(t,e){var r,n=t[0],i=_e.definitions[n];if(!i)return e.error('Unknown expression "'+n+'". If you wanted a literal array, use ["literal", [...]].',0);for(var o=Array.isArray(i)?i[0]:i.type,a=Array.isArray(i)?[[i[1],i[2]]]:i.overloads,s=a.filter((function(e){var r=e[0];return!Array.isArray(r)||r.length===t.length-1})),u=null,l=0,c=s;l<c.length;l+=1){var p=c[l],h=p[0],f=p[1];u=new je(e.registry,e.path,null,e.scope);for(var d=[],m=!1,y=1;y<t.length;y++){var g=t[y],v=Array.isArray(h)?h[y-1]:h.type,_=u.parse(g,1+d.length,v);if(!_){m=!0;break}d.push(_)}if(!m)if(Array.isArray(h)&&h.length!==d.length)u.error("Expected "+h.length+" arguments, but found "+d.length+" instead.");else{for(var x=0;x<d.length;x++){var b=Array.isArray(h)?h[x]:h.type,w=d[x];u.concat(x+1).checkSubtype(b,w.type)}if(0===u.errors.length)return new _e(n,o,f,d)}}if(1===s.length)(r=e.errors).push.apply(r,u.errors);else{for(var S=(s.length?s:a).map((function(t){var e;return e=t[0],Array.isArray(e)?"("+e.map(Xt).join(", ")+")":"("+Xt(e.type)+"...)"})).join(" | "),A=[],E=1;E<t.length;E++){var T=e.parse(t[E],1+A.length);if(!T)return null;A.push(Xt(T.type))}e.error("Expected arguments of type "+S+", but found ("+A.join(", ")+") instead.")}return null},_e.register=function(t,e){for(var r in _e.definitions=e,e)t[r]=_e};var xe=function(t,e,r){this.type=$t,this.locale=r,this.caseSensitive=t,this.diacriticSensitive=e};function be(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.max(t[2],e[0]),t[3]=Math.max(t[3],e[1])}function we(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function Se(t,e){var r=(180+t[0])/360,n=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t[1]*Math.PI/360)))/360,i=Math.pow(2,e.z);return[Math.round(r*i*8192),Math.round(n*i*8192)]}function Ae(t,e,r){return e[1]>t[1]!=r[1]>t[1]&&t[0]<(r[0]-e[0])*(t[1]-e[1])/(r[1]-e[1])+e[0]}function Ee(t,e){for(var r,n,i,o,a,s,u,l=!1,c=0,p=e.length;c<p;c++)for(var h=e[c],f=0,d=h.length;f<d-1;f++){if((o=(r=t)[0]-(n=h[f])[0])*(u=r[1]-(i=h[f+1])[1])-(s=r[0]-i[0])*(a=r[1]-n[1])==0&&o*s<=0&&a*u<=0)return!1;Ae(t,h[f],h[f+1])&&(l=!l)}return l}function Te(t,e){for(var r=0;r<e.length;r++)if(Ee(t,e[r]))return!0;return!1}function ke(t,e,r,n){var i=n[0]-r[0],o=n[1]-r[1],a=(t[0]-r[0])*o-i*(t[1]-r[1]),s=(e[0]-r[0])*o-i*(e[1]-r[1]);return a>0&&s<0||a<0&&s>0}function Ie(t,e,r){for(var n=0,i=r;n<i.length;n+=1)for(var o=i[n],a=0;a<o.length-1;++a)if(0!=(p=[(c=o[a+1])[0]-(l=o[a])[0],c[1]-l[1]])[0]*(h=[(u=e)[0]-(s=t)[0],u[1]-s[1]])[1]-p[1]*h[0]&&ke(s,u,l,c)&&ke(l,c,s,u))return!0;var s,u,l,c,p,h;return!1}function ze(t,e){for(var r=0;r<t.length;++r)if(!Ee(t[r],e))return!1;for(var n=0;n<t.length-1;++n)if(Ie(t[n],t[n+1],e))return!1;return!0}function Ce(t,e){for(var r=0;r<e.length;r++)if(ze(t,e[r]))return!0;return!1}function Pe(t,e,r){for(var n=[],i=0;i<t.length;i++){for(var o=[],a=0;a<t[i].length;a++){var s=Se(t[i][a],r);be(e,s),o.push(s)}n.push(o)}return n}function Me(t,e,r){for(var n=[],i=0;i<t.length;i++){var o=Pe(t[i],e,r);n.push(o)}return n}function De(t,e,r,n){if(t[0]<r[0]||t[0]>r[2]){var i=.5*n,o=t[0]-r[0]>i?-n:r[0]-t[0]>i?n:0;0===o&&(o=t[0]-r[2]>i?-n:r[2]-t[0]>i?n:0),t[0]+=o}be(e,t)}function Le(t,e,r,n){for(var i=8192*Math.pow(2,n.z),o=[8192*n.x,8192*n.y],a=[],s=0,u=t;s<u.length;s+=1)for(var l=0,c=u[s];l<c.length;l+=1){var p=c[l],h=[p.x+o[0],p.y+o[1]];De(h,e,r,i),a.push(h)}return a}function Be(t,e,r,n){for(var i,o=8192*Math.pow(2,n.z),a=[8192*n.x,8192*n.y],s=[],u=0,l=t;u<l.length;u+=1){for(var c=[],p=0,h=l[u];p<h.length;p+=1){var f=h[p],d=[f.x+a[0],f.y+a[1]];be(e,d),c.push(d)}s.push(c)}if(e[2]-e[0]<=o/2){(i=e)[0]=i[1]=1/0,i[2]=i[3]=-1/0;for(var m=0,y=s;m<y.length;m+=1)for(var g=0,v=y[m];g<v.length;g+=1)De(v[g],e,r,o)}return s}xe.parse=function(t,e){if(2!==t.length)return e.error("Expected one argument.");var r=t[1];if("object"!=typeof r||Array.isArray(r))return e.error("Collator options argument must be an object.");var n=e.parse(void 0!==r["case-sensitive"]&&r["case-sensitive"],1,Ut);if(!n)return null;var i=e.parse(void 0!==r["diacritic-sensitive"]&&r["diacritic-sensitive"],1,Ut);if(!i)return null;var o=null;return r.locale&&!(o=e.parse(r.locale,1,Vt))?null:new xe(n,i,o)},xe.prototype.evaluate=function(t){return new ee(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)},xe.prototype.eachChild=function(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)},xe.prototype.outputDefined=function(){return!1},xe.prototype.serialize=function(){var t={};return t["case-sensitive"]=this.caseSensitive.serialize(),t["diacritic-sensitive"]=this.diacriticSensitive.serialize(),this.locale&&(t.locale=this.locale.serialize()),["collator",t]};var Re=function(t,e){this.type=Ut,this.geojson=t,this.geometries=e};function Oe(t){if(t instanceof _e){if("get"===t.name&&1===t.args.length)return!1;if("feature-state"===t.name)return!1;if("has"===t.name&&1===t.args.length)return!1;if("properties"===t.name||"geometry-type"===t.name||"id"===t.name)return!1;if(/^filter-/.test(t.name))return!1}if(t instanceof Re)return!1;var e=!0;return t.eachChild((function(t){e&&!Oe(t)&&(e=!1)})),e}function Fe(t){if(t instanceof _e&&"feature-state"===t.name)return!1;var e=!0;return t.eachChild((function(t){e&&!Fe(t)&&(e=!1)})),e}function Ve(t,e){if(t instanceof _e&&e.indexOf(t.name)>=0)return!1;var r=!0;return t.eachChild((function(t){r&&!Ve(t,e)&&(r=!1)})),r}Re.parse=function(t,e){if(2!==t.length)return e.error("'within' expression requires exactly one argument, but found "+(t.length-1)+" instead.");if(ae(t[1])){var r=t[1];if("FeatureCollection"===r.type)for(var n=0;n<r.features.length;++n){var i=r.features[n].geometry.type;if("Polygon"===i||"MultiPolygon"===i)return new Re(r,r.features[n].geometry)}else if("Feature"===r.type){var o=r.geometry.type;if("Polygon"===o||"MultiPolygon"===o)return new Re(r,r.geometry)}else if("Polygon"===r.type||"MultiPolygon"===r.type)return new Re(r,r)}return e.error("'within' expression requires valid geojson object that contains polygon geometry type.")},Re.prototype.evaluate=function(t){if(null!=t.geometry()&&null!=t.canonicalID()){if("Point"===t.geometryType())return function(t,e){var r=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],i=t.canonicalID();if("Polygon"===e.type){var o=Pe(e.coordinates,n,i),a=Le(t.geometry(),r,n,i);if(!we(r,n))return!1;for(var s=0,u=a;s<u.length;s+=1)if(!Ee(u[s],o))return!1}if("MultiPolygon"===e.type){var l=Me(e.coordinates,n,i),c=Le(t.geometry(),r,n,i);if(!we(r,n))return!1;for(var p=0,h=c;p<h.length;p+=1)if(!Te(h[p],l))return!1}return!0}(t,this.geometries);if("LineString"===t.geometryType())return function(t,e){var r=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],i=t.canonicalID();if("Polygon"===e.type){var o=Pe(e.coordinates,n,i),a=Be(t.geometry(),r,n,i);if(!we(r,n))return!1;for(var s=0,u=a;s<u.length;s+=1)if(!ze(u[s],o))return!1}if("MultiPolygon"===e.type){var l=Me(e.coordinates,n,i),c=Be(t.geometry(),r,n,i);if(!we(r,n))return!1;for(var p=0,h=c;p<h.length;p+=1)if(!Ce(h[p],l))return!1}return!0}(t,this.geometries)}return!1},Re.prototype.eachChild=function(){},Re.prototype.outputDefined=function(){return!0},Re.prototype.serialize=function(){return["within",this.geojson]};var Ue=function(t,e){this.type=e.type,this.name=t,this.boundExpression=e};Ue.parse=function(t,e){if(2!==t.length||"string"!=typeof t[1])return e.error("'var' expression requires exactly one string literal argument.");var r=t[1];return e.scope.has(r)?new Ue(r,e.scope.get(r)):e.error('Unknown variable "'+r+'". Make sure "'+r+'" has been bound in an enclosing "let" expression before using it.',1)},Ue.prototype.evaluate=function(t){return this.boundExpression.evaluate(t)},Ue.prototype.eachChild=function(){},Ue.prototype.outputDefined=function(){return!1},Ue.prototype.serialize=function(){return["var",this.name]};var je=function(t,e,r,n,i){void 0===e&&(e=[]),void 0===n&&(n=new Rt),void 0===i&&(i=[]),this.registry=t,this.path=e,this.key=e.map((function(t){return"["+t+"]"})).join(""),this.scope=n,this.errors=i,this.expectedType=r};function Ne(t,e){for(var r,n=t.length-1,i=0,o=n,a=0;i<=o;)if((r=t[a=Math.floor((i+o)/2)])<=e){if(a===n||e<t[a+1])return a;i=a+1}else{if(!(r>e))throw new ce("Input is not a number.");o=a-1}return 0}je.prototype.parse=function(t,e,r,n,i){return void 0===i&&(i={}),e?this.concat(e,r,n)._parse(t,i):this._parse(t,i)},je.prototype._parse=function(t,e){function r(t,e,r){return"assert"===r?new he(e,[t]):"coerce"===r?new ye(e,[t]):t}if(null!==t&&"string"!=typeof t&&"boolean"!=typeof t&&"number"!=typeof t||(t=["literal",t]),Array.isArray(t)){if(0===t.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');var n=t[0];if("string"!=typeof n)return this.error("Expression name must be a string, but found "+typeof n+' instead. If you wanted a literal array, use ["literal", [...]].',0),null;var i=this.registry[n];if(i){var o=i.parse(t,this);if(!o)return null;if(this.expectedType){var a=this.expectedType,s=o.type;if("string"!==a.kind&&"number"!==a.kind&&"boolean"!==a.kind&&"object"!==a.kind&&"array"!==a.kind||"value"!==s.kind)if("color"!==a.kind&&"formatted"!==a.kind&&"resolvedImage"!==a.kind||"value"!==s.kind&&"string"!==s.kind){if(this.checkSubtype(a,s))return null}else o=r(o,a,e.typeAnnotation||"coerce");else o=r(o,a,e.typeAnnotation||"assert")}if(!(o instanceof le)&&"resolvedImage"!==o.type.kind&&function t(e){if(e instanceof Ue)return t(e.boundExpression);if(e instanceof _e&&"error"===e.name)return!1;if(e instanceof xe)return!1;if(e instanceof Re)return!1;var r=e instanceof ye||e instanceof he,n=!0;return e.eachChild((function(e){n=r?n&&t(e):n&&e instanceof le})),!!n&&Oe(e)&&Ve(e,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}(o)){var u=new ve;try{o=new le(o.type,o.evaluate(u))}catch(t){return this.error(t.message),null}}return o}return this.error('Unknown expression "'+n+'". If you wanted a literal array, use ["literal", [...]].',0)}return this.error(void 0===t?"'undefined' value invalid. Use null instead.":"object"==typeof t?'Bare objects invalid. Use ["literal", {...}] instead.':"Expected an array, but found "+typeof t+" instead.")},je.prototype.concat=function(t,e,r){var n="number"==typeof t?this.path.concat(t):this.path,i=r?this.scope.concat(r):this.scope;return new je(this.registry,n,e||null,i,this.errors)},je.prototype.error=function(t){for(var e=[],r=arguments.length-1;r-- >0;)e[r]=arguments[r+1];var n=""+this.key+e.map((function(t){return"["+t+"]"})).join("");this.errors.push(new Bt(n,t))},je.prototype.checkSubtype=function(t,e){var r=Kt(t,e);return r&&this.error(r),r};var qe=function(t,e,r){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(var n=0,i=r;n<i.length;n+=1){var o=i[n],a=o[1];this.labels.push(o[0]),this.outputs.push(a)}};function $e(t,e,r){return t*(1-r)+e*r}qe.parse=function(t,e){if(t.length-1<4)return e.error("Expected at least 4 arguments, but found only "+(t.length-1)+".");if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");var r=e.parse(t[1],1,Ft);if(!r)return null;var n=[],i=null;e.expectedType&&"value"!==e.expectedType.kind&&(i=e.expectedType);for(var o=1;o<t.length;o+=2){var a=1===o?-1/0:t[o],s=t[o+1],u=o,l=o+1;if("number"!=typeof a)return e.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',u);if(n.length&&n[n.length-1][0]>=a)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',u);var c=e.parse(s,l,i);if(!c)return null;i=i||c.type,n.push([a,c])}return new qe(i,r,n)},qe.prototype.evaluate=function(t){var e=this.labels,r=this.outputs;if(1===e.length)return r[0].evaluate(t);var n=this.input.evaluate(t);if(n<=e[0])return r[0].evaluate(t);var i=e.length;return n>=e[i-1]?r[i-1].evaluate(t):r[Ne(e,n)].evaluate(t)},qe.prototype.eachChild=function(t){t(this.input);for(var e=0,r=this.outputs;e<r.length;e+=1)t(r[e])},qe.prototype.outputDefined=function(){return this.outputs.every((function(t){return t.outputDefined()}))},qe.prototype.serialize=function(){for(var t=["step",this.input.serialize()],e=0;e<this.labels.length;e++)e>0&&t.push(this.labels[e]),t.push(this.outputs[e].serialize());return t};var Ze=Object.freeze({__proto__:null,number:$e,color:function(t,e,r){return new te($e(t.r,e.r,r),$e(t.g,e.g,r),$e(t.b,e.b,r),$e(t.a,e.a,r))},array:function(t,e,r){return t.map((function(t,n){return $e(t,e[n],r)}))}}),Ge=6/29*3*(6/29),We=Math.PI/180,Xe=180/Math.PI;function He(t){return t>.008856451679035631?Math.pow(t,1/3):t/Ge+4/29}function Ke(t){return t>6/29?t*t*t:Ge*(t-4/29)}function Ye(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function Je(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Qe(t){var e=Je(t.r),r=Je(t.g),n=Je(t.b),i=He((.4124564*e+.3575761*r+.1804375*n)/.95047),o=He((.2126729*e+.7151522*r+.072175*n)/1);return{l:116*o-16,a:500*(i-o),b:200*(o-He((.0193339*e+.119192*r+.9503041*n)/1.08883)),alpha:t.a}}function tr(t){var e=(t.l+16)/116,r=isNaN(t.a)?e:e+t.a/500,n=isNaN(t.b)?e:e-t.b/200;return e=1*Ke(e),r=.95047*Ke(r),n=1.08883*Ke(n),new te(Ye(3.2404542*r-1.5371385*e-.4985314*n),Ye(-.969266*r+1.8760108*e+.041556*n),Ye(.0556434*r-.2040259*e+1.0572252*n),t.alpha)}function er(t,e,r){var n=e-t;return t+r*(n>180||n<-180?n-360*Math.round(n/360):n)}var rr={forward:Qe,reverse:tr,interpolate:function(t,e,r){return{l:$e(t.l,e.l,r),a:$e(t.a,e.a,r),b:$e(t.b,e.b,r),alpha:$e(t.alpha,e.alpha,r)}}},nr={forward:function(t){var e=Qe(t),r=e.l,n=e.a,i=e.b,o=Math.atan2(i,n)*Xe;return{h:o<0?o+360:o,c:Math.sqrt(n*n+i*i),l:r,alpha:t.a}},reverse:function(t){var e=t.h*We,r=t.c;return tr({l:t.l,a:Math.cos(e)*r,b:Math.sin(e)*r,alpha:t.alpha})},interpolate:function(t,e,r){return{h:er(t.h,e.h,r),c:$e(t.c,e.c,r),l:$e(t.l,e.l,r),alpha:$e(t.alpha,e.alpha,r)}}},ir=Object.freeze({__proto__:null,lab:rr,hcl:nr}),or=function(t,e,r,n,i){this.type=t,this.operator=e,this.interpolation=r,this.input=n,this.labels=[],this.outputs=[];for(var o=0,a=i;o<a.length;o+=1){var s=a[o],u=s[1];this.labels.push(s[0]),this.outputs.push(u)}};function ar(t,e,r,n){var i=n-r,o=t-r;return 0===i?0:1===e?o/i:(Math.pow(e,o)-1)/(Math.pow(e,i)-1)}or.interpolationFactor=function(t,e,n,i){var o=0;if("exponential"===t.name)o=ar(e,t.base,n,i);else if("linear"===t.name)o=ar(e,1,n,i);else if("cubic-bezier"===t.name){var a=t.controlPoints;o=new r(a[0],a[1],a[2],a[3]).solve(ar(e,1,n,i))}return o},or.parse=function(t,e){var r=t[0],n=t[1],i=t[2],o=t.slice(3);if(!Array.isArray(n)||0===n.length)return e.error("Expected an interpolation type expression.",1);if("linear"===n[0])n={name:"linear"};else if("exponential"===n[0]){var a=n[1];if("number"!=typeof a)return e.error("Exponential interpolation requires a numeric base.",1,1);n={name:"exponential",base:a}}else{if("cubic-bezier"!==n[0])return e.error("Unknown interpolation type "+String(n[0]),1,0);var s=n.slice(1);if(4!==s.length||s.some((function(t){return"number"!=typeof t||t<0||t>1})))return e.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);n={name:"cubic-bezier",controlPoints:s}}if(t.length-1<4)return e.error("Expected at least 4 arguments, but found only "+(t.length-1)+".");if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");if(!(i=e.parse(i,2,Ft)))return null;var u=[],l=null;"interpolate-hcl"===r||"interpolate-lab"===r?l=jt:e.expectedType&&"value"!==e.expectedType.kind&&(l=e.expectedType);for(var c=0;c<o.length;c+=2){var p=o[c],h=o[c+1],f=c+3,d=c+4;if("number"!=typeof p)return e.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',f);if(u.length&&u[u.length-1][0]>=p)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',f);var m=e.parse(h,d,l);if(!m)return null;l=l||m.type,u.push([p,m])}return"number"===l.kind||"color"===l.kind||"array"===l.kind&&"number"===l.itemType.kind&&"number"==typeof l.N?new or(l,r,n,i,u):e.error("Type "+Xt(l)+" is not interpolatable.")},or.prototype.evaluate=function(t){var e=this.labels,r=this.outputs;if(1===e.length)return r[0].evaluate(t);var n=this.input.evaluate(t);if(n<=e[0])return r[0].evaluate(t);var i=e.length;if(n>=e[i-1])return r[i-1].evaluate(t);var o=Ne(e,n),a=or.interpolationFactor(this.interpolation,n,e[o],e[o+1]),s=r[o].evaluate(t),u=r[o+1].evaluate(t);return"interpolate"===this.operator?Ze[this.type.kind.toLowerCase()](s,u,a):"interpolate-hcl"===this.operator?nr.reverse(nr.interpolate(nr.forward(s),nr.forward(u),a)):rr.reverse(rr.interpolate(rr.forward(s),rr.forward(u),a))},or.prototype.eachChild=function(t){t(this.input);for(var e=0,r=this.outputs;e<r.length;e+=1)t(r[e])},or.prototype.outputDefined=function(){return this.outputs.every((function(t){return t.outputDefined()}))},or.prototype.serialize=function(){var t;t="linear"===this.interpolation.name?["linear"]:"exponential"===this.interpolation.name?1===this.interpolation.base?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier"].concat(this.interpolation.controlPoints);for(var e=[this.operator,t,this.input.serialize()],r=0;r<this.labels.length;r++)e.push(this.labels[r],this.outputs[r].serialize());return e};var sr=function(t,e){this.type=t,this.args=e};sr.parse=function(t,e){if(t.length<2)return e.error("Expectected at least one argument.");var r=null,n=e.expectedType;n&&"value"!==n.kind&&(r=n);for(var i=[],o=0,a=t.slice(1);o<a.length;o+=1){var s=e.parse(a[o],1+i.length,r,void 0,{typeAnnotation:"omit"});if(!s)return null;r=r||s.type,i.push(s)}var u=n&&i.some((function(t){return Kt(n,t.type)}));return new sr(u?qt:r,i)},sr.prototype.evaluate=function(t){for(var e,r=null,n=0,i=0,o=this.args;i<o.length&&(n++,(r=o[i].evaluate(t))&&r instanceof ie&&!r.available&&(e||(e=r.name),r=null,n===this.args.length&&(r=e)),null===r);i+=1);return r},sr.prototype.eachChild=function(t){this.args.forEach(t)},sr.prototype.outputDefined=function(){return this.args.every((function(t){return t.outputDefined()}))},sr.prototype.serialize=function(){var t=["coalesce"];return this.eachChild((function(e){t.push(e.serialize())})),t};var ur=function(t,e){this.type=e.type,this.bindings=[].concat(t),this.result=e};ur.prototype.evaluate=function(t){return this.result.evaluate(t)},ur.prototype.eachChild=function(t){for(var e=0,r=this.bindings;e<r.length;e+=1)t(r[e][1]);t(this.result)},ur.parse=function(t,e){if(t.length<4)return e.error("Expected at least 3 arguments, but found "+(t.length-1)+" instead.");for(var r=[],n=1;n<t.length-1;n+=2){var i=t[n];if("string"!=typeof i)return e.error("Expected string, but found "+typeof i+" instead.",n);if(/[^a-zA-Z0-9_]/.test(i))return e.error("Variable names must contain only alphanumeric characters or '_'.",n);var o=e.parse(t[n+1],n+1);if(!o)return null;r.push([i,o])}var a=e.parse(t[t.length-1],t.length-1,e.expectedType,r);return a?new ur(r,a):null},ur.prototype.outputDefined=function(){return this.result.outputDefined()},ur.prototype.serialize=function(){for(var t=["let"],e=0,r=this.bindings;e<r.length;e+=1){var n=r[e];t.push(n[0],n[1].serialize())}return t.push(this.result.serialize()),t};var lr=function(t,e,r){this.type=t,this.index=e,this.input=r};lr.parse=function(t,e){if(3!==t.length)return e.error("Expected 2 arguments, but found "+(t.length-1)+" instead.");var r=e.parse(t[1],1,Ft),n=e.parse(t[2],2,Wt(e.expectedType||qt));return r&&n?new lr(n.type.itemType,r,n):null},lr.prototype.evaluate=function(t){var e=this.index.evaluate(t),r=this.input.evaluate(t);if(e<0)throw new ce("Array index out of bounds: "+e+" < 0.");if(e>=r.length)throw new ce("Array index out of bounds: "+e+" > "+(r.length-1)+".");if(e!==Math.floor(e))throw new ce("Array index must be an integer, but found "+e+" instead.");return r[e]},lr.prototype.eachChild=function(t){t(this.index),t(this.input)},lr.prototype.outputDefined=function(){return!1},lr.prototype.serialize=function(){return["at",this.index.serialize(),this.input.serialize()]};var cr=function(t,e){this.type=Ut,this.needle=t,this.haystack=e};cr.parse=function(t,e){if(3!==t.length)return e.error("Expected 2 arguments, but found "+(t.length-1)+" instead.");var r=e.parse(t[1],1,qt),n=e.parse(t[2],2,qt);return r&&n?Yt(r.type,[Ut,Vt,Ft,Ot,qt])?new cr(r,n):e.error("Expected first argument to be of type boolean, string, number or null, but found "+Xt(r.type)+" instead"):null},cr.prototype.evaluate=function(t){var e=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!r)return!1;if(!Jt(e,["boolean","string","number","null"]))throw new ce("Expected first argument to be of type boolean, string, number or null, but found "+Xt(se(e))+" instead.");if(!Jt(r,["string","array"]))throw new ce("Expected second argument to be of type array or string, but found "+Xt(se(r))+" instead.");return r.indexOf(e)>=0},cr.prototype.eachChild=function(t){t(this.needle),t(this.haystack)},cr.prototype.outputDefined=function(){return!0},cr.prototype.serialize=function(){return["in",this.needle.serialize(),this.haystack.serialize()]};var pr=function(t,e,r){this.type=Ft,this.needle=t,this.haystack=e,this.fromIndex=r};pr.parse=function(t,e){if(t.length<=2||t.length>=5)return e.error("Expected 3 or 4 arguments, but found "+(t.length-1)+" instead.");var r=e.parse(t[1],1,qt),n=e.parse(t[2],2,qt);if(!r||!n)return null;if(!Yt(r.type,[Ut,Vt,Ft,Ot,qt]))return e.error("Expected first argument to be of type boolean, string, number or null, but found "+Xt(r.type)+" instead");if(4===t.length){var i=e.parse(t[3],3,Ft);return i?new pr(r,n,i):null}return new pr(r,n)},pr.prototype.evaluate=function(t){var e=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!Jt(e,["boolean","string","number","null"]))throw new ce("Expected first argument to be of type boolean, string, number or null, but found "+Xt(se(e))+" instead.");if(!Jt(r,["string","array"]))throw new ce("Expected second argument to be of type array or string, but found "+Xt(se(r))+" instead.");if(this.fromIndex){var n=this.fromIndex.evaluate(t);return r.indexOf(e,n)}return r.indexOf(e)},pr.prototype.eachChild=function(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)},pr.prototype.outputDefined=function(){return!1},pr.prototype.serialize=function(){if(null!=this.fromIndex&&void 0!==this.fromIndex){var t=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),t]}return["index-of",this.needle.serialize(),this.haystack.serialize()]};var hr=function(t,e,r,n,i,o){this.inputType=t,this.type=e,this.input=r,this.cases=n,this.outputs=i,this.otherwise=o};hr.parse=function(t,e){if(t.length<5)return e.error("Expected at least 4 arguments, but found only "+(t.length-1)+".");if(t.length%2!=1)return e.error("Expected an even number of arguments.");var r,n;e.expectedType&&"value"!==e.expectedType.kind&&(n=e.expectedType);for(var i={},o=[],a=2;a<t.length-1;a+=2){var s=t[a],u=t[a+1];Array.isArray(s)||(s=[s]);var l=e.concat(a);if(0===s.length)return l.error("Expected at least one branch label.");for(var c=0,p=s;c<p.length;c+=1){var h=p[c];if("number"!=typeof h&&"string"!=typeof h)return l.error("Branch labels must be numbers or strings.");if("number"==typeof h&&Math.abs(h)>Number.MAX_SAFE_INTEGER)return l.error("Branch labels must be integers no larger than "+Number.MAX_SAFE_INTEGER+".");if("number"==typeof h&&Math.floor(h)!==h)return l.error("Numeric branch labels must be integer values.");if(r){if(l.checkSubtype(r,se(h)))return null}else r=se(h);if(void 0!==i[String(h)])return l.error("Branch labels must be unique.");i[String(h)]=o.length}var f=e.parse(u,a,n);if(!f)return null;n=n||f.type,o.push(f)}var d=e.parse(t[1],1,qt);if(!d)return null;var m=e.parse(t[t.length-1],t.length-1,n);return m?"value"!==d.type.kind&&e.concat(1).checkSubtype(r,d.type)?null:new hr(r,n,d,i,o,m):null},hr.prototype.evaluate=function(t){var e=this.input.evaluate(t);return(se(e)===this.inputType&&this.outputs[this.cases[e]]||this.otherwise).evaluate(t)},hr.prototype.eachChild=function(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)},hr.prototype.outputDefined=function(){return this.outputs.every((function(t){return t.outputDefined()}))&&this.otherwise.outputDefined()},hr.prototype.serialize=function(){for(var t=this,e=["match",this.input.serialize()],r=[],n={},i=0,o=Object.keys(this.cases).sort();i<o.length;i+=1){var a=o[i];void 0===(p=n[this.cases[a]])?(n[this.cases[a]]=r.length,r.push([this.cases[a],[a]])):r[p][1].push(a)}for(var s=function(e){return"number"===t.inputType.kind?Number(e):e},u=0,l=r;u<l.length;u+=1){var c=l[u],p=c[0],h=c[1];e.push(1===h.length?s(h[0]):h.map(s)),e.push(this.outputs[outputIndex$1].serialize())}return e.push(this.otherwise.serialize()),e};var fr=function(t,e,r){this.type=t,this.branches=e,this.otherwise=r};fr.parse=function(t,e){if(t.length<4)return e.error("Expected at least 3 arguments, but found only "+(t.length-1)+".");if(t.length%2!=0)return e.error("Expected an odd number of arguments.");var r;e.expectedType&&"value"!==e.expectedType.kind&&(r=e.expectedType);for(var n=[],i=1;i<t.length-1;i+=2){var o=e.parse(t[i],i,Ut);if(!o)return null;var a=e.parse(t[i+1],i+1,r);if(!a)return null;n.push([o,a]),r=r||a.type}var s=e.parse(t[t.length-1],t.length-1,r);return s?new fr(r,n,s):null},fr.prototype.evaluate=function(t){for(var e=0,r=this.branches;e<r.length;e+=1){var n=r[e],i=n[1];if(n[0].evaluate(t))return i.evaluate(t)}return this.otherwise.evaluate(t)},fr.prototype.eachChild=function(t){for(var e=0,r=this.branches;e<r.length;e+=1){var n=r[e],i=n[1];t(n[0]),t(i)}t(this.otherwise)},fr.prototype.outputDefined=function(){return this.branches.every((function(t){return t[1].outputDefined()}))&&this.otherwise.outputDefined()},fr.prototype.serialize=function(){var t=["case"];return this.eachChild((function(e){t.push(e.serialize())})),t};var dr=function(t,e,r,n){this.type=t,this.input=e,this.beginIndex=r,this.endIndex=n};function mr(t,e){return"=="===t||"!="===t?"boolean"===e.kind||"string"===e.kind||"number"===e.kind||"null"===e.kind||"value"===e.kind:"string"===e.kind||"number"===e.kind||"value"===e.kind}function yr(t,e,r,n){return 0===n.compare(e,r)}function gr(t,e,r){var n="=="!==t&&"!="!==t;return function(){function i(t,e,r){this.type=Ut,this.lhs=t,this.rhs=e,this.collator=r,this.hasUntypedArgument="value"===t.type.kind||"value"===e.type.kind}return i.parse=function(t,e){if(3!==t.length&&4!==t.length)return e.error("Expected two or three arguments.");var r=t[0],o=e.parse(t[1],1,qt);if(!o)return null;if(!mr(r,o.type))return e.concat(1).error('"'+r+"\" comparisons are not supported for type '"+Xt(o.type)+"'.");var a=e.parse(t[2],2,qt);if(!a)return null;if(!mr(r,a.type))return e.concat(2).error('"'+r+"\" comparisons are not supported for type '"+Xt(a.type)+"'.");if(o.type.kind!==a.type.kind&&"value"!==o.type.kind&&"value"!==a.type.kind)return e.error("Cannot compare types '"+Xt(o.type)+"' and '"+Xt(a.type)+"'.");n&&("value"===o.type.kind&&"value"!==a.type.kind?o=new he(a.type,[o]):"value"!==o.type.kind&&"value"===a.type.kind&&(a=new he(o.type,[a])));var s=null;if(4===t.length){if("string"!==o.type.kind&&"string"!==a.type.kind&&"value"!==o.type.kind&&"value"!==a.type.kind)return e.error("Cannot use collator to compare non-string types.");if(!(s=e.parse(t[3],3,$t)))return null}return new i(o,a,s)},i.prototype.evaluate=function(i){var o=this.lhs.evaluate(i),a=this.rhs.evaluate(i);if(n&&this.hasUntypedArgument){var s=se(o),u=se(a);if(s.kind!==u.kind||"string"!==s.kind&&"number"!==s.kind)throw new ce('Expected arguments for "'+t+'" to be (string, string) or (number, number), but found ('+s.kind+", "+u.kind+") instead.")}if(this.collator&&!n&&this.hasUntypedArgument){var l=se(o),c=se(a);if("string"!==l.kind||"string"!==c.kind)return e(i,o,a)}return this.collator?r(i,o,a,this.collator.evaluate(i)):e(i,o,a)},i.prototype.eachChild=function(t){t(this.lhs),t(this.rhs),this.collator&&t(this.collator)},i.prototype.outputDefined=function(){return!0},i.prototype.serialize=function(){var e=[t];return this.eachChild((function(t){e.push(t.serialize())})),e},i}()}dr.parse=function(t,e){if(t.length<=2||t.length>=5)return e.error("Expected 3 or 4 arguments, but found "+(t.length-1)+" instead.");var r=e.parse(t[1],1,qt),n=e.parse(t[2],2,Ft);if(!r||!n)return null;if(!Yt(r.type,[Wt(qt),Vt,qt]))return e.error("Expected first argument to be of type array or string, but found "+Xt(r.type)+" instead");if(4===t.length){var i=e.parse(t[3],3,Ft);return i?new dr(r.type,r,n,i):null}return new dr(r.type,r,n)},dr.prototype.evaluate=function(t){var e=this.input.evaluate(t),r=this.beginIndex.evaluate(t);if(!Jt(e,["string","array"]))throw new ce("Expected first argument to be of type array or string, but found "+Xt(se(e))+" instead.");if(this.endIndex){var n=this.endIndex.evaluate(t);return e.slice(r,n)}return e.slice(r)},dr.prototype.eachChild=function(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)},dr.prototype.outputDefined=function(){return!1},dr.prototype.serialize=function(){if(null!=this.endIndex&&void 0!==this.endIndex){var t=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),t]}return["slice",this.input.serialize(),this.beginIndex.serialize()]};var vr=gr("==",(function(t,e,r){return e===r}),yr),_r=gr("!=",(function(t,e,r){return e!==r}),(function(t,e,r,n){return!yr(0,e,r,n)})),xr=gr("<",(function(t,e,r){return e<r}),(function(t,e,r,n){return n.compare(e,r)<0})),br=gr(">",(function(t,e,r){return e>r}),(function(t,e,r,n){return n.compare(e,r)>0})),wr=gr("<=",(function(t,e,r){return e<=r}),(function(t,e,r,n){return n.compare(e,r)<=0})),Sr=gr(">=",(function(t,e,r){return e>=r}),(function(t,e,r,n){return n.compare(e,r)>=0})),Ar=function(t,e,r,n,i){this.type=Vt,this.number=t,this.locale=e,this.currency=r,this.minFractionDigits=n,this.maxFractionDigits=i};Ar.parse=function(t,e){if(3!==t.length)return e.error("Expected two arguments.");var r=e.parse(t[1],1,Ft);if(!r)return null;var n=t[2];if("object"!=typeof n||Array.isArray(n))return e.error("NumberFormat options argument must be an object.");var i=null;if(n.locale&&!(i=e.parse(n.locale,1,Vt)))return null;var o=null;if(n.currency&&!(o=e.parse(n.currency,1,Vt)))return null;var a=null;if(n["min-fraction-digits"]&&!(a=e.parse(n["min-fraction-digits"],1,Ft)))return null;var s=null;return n["max-fraction-digits"]&&!(s=e.parse(n["max-fraction-digits"],1,Ft))?null:new Ar(r,i,o,a,s)},Ar.prototype.evaluate=function(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))},Ar.prototype.eachChild=function(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)},Ar.prototype.outputDefined=function(){return!1},Ar.prototype.serialize=function(){var t={};return this.locale&&(t.locale=this.locale.serialize()),this.currency&&(t.currency=this.currency.serialize()),this.minFractionDigits&&(t["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(t["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),t]};var Er=function(t){this.type=Ft,this.input=t};Er.parse=function(t,e){if(2!==t.length)return e.error("Expected 1 argument, but found "+(t.length-1)+" instead.");var r=e.parse(t[1],1);return r?"array"!==r.type.kind&&"string"!==r.type.kind&&"value"!==r.type.kind?e.error("Expected argument of type string or array, but found "+Xt(r.type)+" instead."):new Er(r):null},Er.prototype.evaluate=function(t){var e=this.input.evaluate(t);if("string"==typeof e)return e.length;if(Array.isArray(e))return e.length;throw new ce("Expected value to be of type string or array, but found "+Xt(se(e))+" instead.")},Er.prototype.eachChild=function(t){t(this.input)},Er.prototype.outputDefined=function(){return!1},Er.prototype.serialize=function(){var t=["length"];return this.eachChild((function(e){t.push(e.serialize())})),t};var Tr={"==":vr,"!=":_r,">":br,"<":xr,">=":Sr,"<=":wr,array:he,at:lr,boolean:he,case:fr,coalesce:sr,collator:xe,format:fe,image:de,in:cr,"index-of":pr,interpolate:or,"interpolate-hcl":or,"interpolate-lab":or,length:Er,let:ur,literal:le,match:hr,number:he,"number-format":Ar,object:he,slice:dr,step:qe,string:he,"to-boolean":ye,"to-color":ye,"to-number":ye,"to-string":ye,var:Ue,within:Re};function kr(t,e){var r=e[0],n=e[1],i=e[2],o=e[3];r=r.evaluate(t),n=n.evaluate(t),i=i.evaluate(t);var a=o?o.evaluate(t):1,s=oe(r,n,i,a);if(s)throw new ce(s);return new te(r/255*a,n/255*a,i/255*a,a)}function Ir(t,e){return t in e}function zr(t,e){var r=e[t];return void 0===r?null:r}function Cr(t){return{type:t}}function Pr(t){return{result:"success",value:t}}function Mr(t){return{result:"error",value:t}}function Dr(t){return"data-driven"===t["property-type"]||"cross-faded-data-driven"===t["property-type"]}function Lr(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function Br(t){return!!t.expression&&t.expression.interpolated}function Rr(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":null===t?"null":typeof t}function Or(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function Fr(t){return t}function Vr(t,e,r){return void 0!==t?t:void 0!==e?e:void 0!==r?r:void 0}function Ur(t,e,r,n,i){return Vr(typeof r===i?n[r]:void 0,t.default,e.default)}function jr(t,e,r){if("number"!==Rr(r))return Vr(t.default,e.default);var n=t.stops.length;if(1===n)return t.stops[0][1];if(r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[n-1][0])return t.stops[n-1][1];var i=Ne(t.stops.map((function(t){return t[0]})),r);return t.stops[i][1]}function Nr(t,e,r){var n=void 0!==t.base?t.base:1;if("number"!==Rr(r))return Vr(t.default,e.default);var i=t.stops.length;if(1===i)return t.stops[0][1];if(r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[i-1][0])return t.stops[i-1][1];var o=Ne(t.stops.map((function(t){return t[0]})),r),a=function(t,e,r,n){var i=n-r,o=t-r;return 0===i?0:1===e?o/i:(Math.pow(e,o)-1)/(Math.pow(e,i)-1)}(r,n,t.stops[o][0],t.stops[o+1][0]),s=t.stops[o][1],u=t.stops[o+1][1],l=Ze[e.type]||Fr;if(t.colorSpace&&"rgb"!==t.colorSpace){var c=ir[t.colorSpace];l=function(t,e){return c.reverse(c.interpolate(c.forward(t),c.forward(e),a))}}return"function"==typeof s.evaluate?{evaluate:function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var r=s.evaluate.apply(void 0,t),n=u.evaluate.apply(void 0,t);if(void 0!==r&&void 0!==n)return l(r,n,a)}}:l(s,u,a)}function qr(t,e,r){return"color"===e.type?r=te.parse(r):"formatted"===e.type?r=ne.fromString(r.toString()):"resolvedImage"===e.type?r=ie.fromString(r.toString()):Rr(r)===e.type||"enum"===e.type&&e.values[r]||(r=void 0),Vr(r,t.default,e.default)}_e.register(Tr,{error:[{kind:"error"},[Vt],function(t,e){throw new ce(e[0].evaluate(t))}],typeof:[Vt,[qt],function(t,e){return Xt(se(e[0].evaluate(t)))}],"to-rgba":[Wt(Ft,4),[jt],function(t,e){return e[0].evaluate(t).toArray()}],rgb:[jt,[Ft,Ft,Ft],kr],rgba:[jt,[Ft,Ft,Ft,Ft],kr],has:{type:Ut,overloads:[[[Vt],function(t,e){return Ir(e[0].evaluate(t),t.properties())}],[[Vt,Nt],function(t,e){var r=e[1];return Ir(e[0].evaluate(t),r.evaluate(t))}]]},get:{type:qt,overloads:[[[Vt],function(t,e){return zr(e[0].evaluate(t),t.properties())}],[[Vt,Nt],function(t,e){var r=e[1];return zr(e[0].evaluate(t),r.evaluate(t))}]]},"feature-state":[qt,[Vt],function(t,e){return zr(e[0].evaluate(t),t.featureState||{})}],properties:[Nt,[],function(t){return t.properties()}],"geometry-type":[Vt,[],function(t){return t.geometryType()}],id:[qt,[],function(t){return t.id()}],zoom:[Ft,[],function(t){return t.globals.zoom}],"heatmap-density":[Ft,[],function(t){return t.globals.heatmapDensity||0}],"line-progress":[Ft,[],function(t){return t.globals.lineProgress||0}],accumulated:[qt,[],function(t){return void 0===t.globals.accumulated?null:t.globals.accumulated}],"+":[Ft,Cr(Ft),function(t,e){for(var r=0,n=0,i=e;n<i.length;n+=1)r+=i[n].evaluate(t);return r}],"*":[Ft,Cr(Ft),function(t,e){for(var r=1,n=0,i=e;n<i.length;n+=1)r*=i[n].evaluate(t);return r}],"-":{type:Ft,overloads:[[[Ft,Ft],function(t,e){var r=e[1];return e[0].evaluate(t)-r.evaluate(t)}],[[Ft],function(t,e){return-e[0].evaluate(t)}]]},"/":[Ft,[Ft,Ft],function(t,e){var r=e[1];return e[0].evaluate(t)/r.evaluate(t)}],"%":[Ft,[Ft,Ft],function(t,e){var r=e[1];return e[0].evaluate(t)%r.evaluate(t)}],ln2:[Ft,[],function(){return Math.LN2}],pi:[Ft,[],function(){return Math.PI}],e:[Ft,[],function(){return Math.E}],"^":[Ft,[Ft,Ft],function(t,e){var r=e[1];return Math.pow(e[0].evaluate(t),r.evaluate(t))}],sqrt:[Ft,[Ft],function(t,e){return Math.sqrt(e[0].evaluate(t))}],log10:[Ft,[Ft],function(t,e){return Math.log(e[0].evaluate(t))/Math.LN10}],ln:[Ft,[Ft],function(t,e){return Math.log(e[0].evaluate(t))}],log2:[Ft,[Ft],function(t,e){return Math.log(e[0].evaluate(t))/Math.LN2}],sin:[Ft,[Ft],function(t,e){return Math.sin(e[0].evaluate(t))}],cos:[Ft,[Ft],function(t,e){return Math.cos(e[0].evaluate(t))}],tan:[Ft,[Ft],function(t,e){return Math.tan(e[0].evaluate(t))}],asin:[Ft,[Ft],function(t,e){return Math.asin(e[0].evaluate(t))}],acos:[Ft,[Ft],function(t,e){return Math.acos(e[0].evaluate(t))}],atan:[Ft,[Ft],function(t,e){return Math.atan(e[0].evaluate(t))}],min:[Ft,Cr(Ft),function(t,e){return Math.min.apply(Math,e.map((function(e){return e.evaluate(t)})))}],max:[Ft,Cr(Ft),function(t,e){return Math.max.apply(Math,e.map((function(e){return e.evaluate(t)})))}],abs:[Ft,[Ft],function(t,e){return Math.abs(e[0].evaluate(t))}],round:[Ft,[Ft],function(t,e){var r=e[0].evaluate(t);return r<0?-Math.round(-r):Math.round(r)}],floor:[Ft,[Ft],function(t,e){return Math.floor(e[0].evaluate(t))}],ceil:[Ft,[Ft],function(t,e){return Math.ceil(e[0].evaluate(t))}],"filter-==":[Ut,[Vt,qt],function(t,e){var r=e[0],n=e[1];return t.properties()[r.value]===n.value}],"filter-id-==":[Ut,[qt],function(t,e){var r=e[0];return t.id()===r.value}],"filter-type-==":[Ut,[Vt],function(t,e){var r=e[0];return t.geometryType()===r.value}],"filter-<":[Ut,[Vt,qt],function(t,e){var r=e[0],n=e[1],i=t.properties()[r.value],o=n.value;return typeof i==typeof o&&i<o}],"filter-id-<":[Ut,[qt],function(t,e){var r=e[0],n=t.id(),i=r.value;return typeof n==typeof i&&n<i}],"filter->":[Ut,[Vt,qt],function(t,e){var r=e[0],n=e[1],i=t.properties()[r.value],o=n.value;return typeof i==typeof o&&i>o}],"filter-id->":[Ut,[qt],function(t,e){var r=e[0],n=t.id(),i=r.value;return typeof n==typeof i&&n>i}],"filter-<=":[Ut,[Vt,qt],function(t,e){var r=e[0],n=e[1],i=t.properties()[r.value],o=n.value;return typeof i==typeof o&&i<=o}],"filter-id-<=":[Ut,[qt],function(t,e){var r=e[0],n=t.id(),i=r.value;return typeof n==typeof i&&n<=i}],"filter->=":[Ut,[Vt,qt],function(t,e){var r=e[0],n=e[1],i=t.properties()[r.value],o=n.value;return typeof i==typeof o&&i>=o}],"filter-id->=":[Ut,[qt],function(t,e){var r=e[0],n=t.id(),i=r.value;return typeof n==typeof i&&n>=i}],"filter-has":[Ut,[qt],function(t,e){return e[0].value in t.properties()}],"filter-has-id":[Ut,[],function(t){return null!==t.id()&&void 0!==t.id()}],"filter-type-in":[Ut,[Wt(Vt)],function(t,e){return e[0].value.indexOf(t.geometryType())>=0}],"filter-id-in":[Ut,[Wt(qt)],function(t,e){return e[0].value.indexOf(t.id())>=0}],"filter-in-small":[Ut,[Vt,Wt(qt)],function(t,e){var r=e[0];return e[1].value.indexOf(t.properties()[r.value])>=0}],"filter-in-large":[Ut,[Vt,Wt(qt)],function(t,e){var r=e[0],n=e[1];return function(t,e,r,n){for(;r<=n;){var i=r+n>>1;if(e[i]===t)return!0;e[i]>t?n=i-1:r=i+1}return!1}(t.properties()[r.value],n.value,0,n.value.length-1)}],all:{type:Ut,overloads:[[[Ut,Ut],function(t,e){var r=e[1];return e[0].evaluate(t)&&r.evaluate(t)}],[Cr(Ut),function(t,e){for(var r=0,n=e;r<n.length;r+=1)if(!n[r].evaluate(t))return!1;return!0}]]},any:{type:Ut,overloads:[[[Ut,Ut],function(t,e){var r=e[1];return e[0].evaluate(t)||r.evaluate(t)}],[Cr(Ut),function(t,e){for(var r=0,n=e;r<n.length;r+=1)if(n[r].evaluate(t))return!0;return!1}]]},"!":[Ut,[Ut],function(t,e){return!e[0].evaluate(t)}],"is-supported-script":[Ut,[Vt],function(t,e){var r=t.globals&&t.globals.isSupportedScript;return!r||r(e[0].evaluate(t))}],upcase:[Vt,[Vt],function(t,e){return e[0].evaluate(t).toUpperCase()}],downcase:[Vt,[Vt],function(t,e){return e[0].evaluate(t).toLowerCase()}],concat:[Vt,Cr(qt),function(t,e){return e.map((function(e){return ue(e.evaluate(t))})).join("")}],"resolved-locale":[Vt,[$t],function(t,e){return e[0].evaluate(t).resolvedLocale()}]});var $r=function(t,e){this.expression=t,this._warningHistory={},this._evaluator=new ve,this._defaultValue=e?function(t){return"color"===t.type&&Or(t.default)?new te(0,0,0,0):"color"===t.type?te.parse(t.default)||null:void 0===t.default?null:t.default}(e):null,this._enumValues=e&&"enum"===e.type?e.values:null};function Zr(t){return Array.isArray(t)&&t.length>0&&"string"==typeof t[0]&&t[0]in Tr}function Gr(t,e){var r=new je(Tr,[],e?function(t){var e={color:jt,string:Vt,number:Ft,enum:Vt,boolean:Ut,formatted:Zt,resolvedImage:Gt};return"array"===t.type?Wt(e[t.value]||qt,t.length):e[t.type]}(e):void 0),n=r.parse(t,void 0,void 0,void 0,e&&"string"===e.type?{typeAnnotation:"coerce"}:void 0);return n?Pr(new $r(n,e)):Mr(r.errors)}$r.prototype.evaluateWithoutErrorHandling=function(t,e,r,n,i,o){return this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=r,this._evaluator.canonical=n,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=o,this.expression.evaluate(this._evaluator)},$r.prototype.evaluate=function(t,e,r,n,i,o){this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=r||null,this._evaluator.canonical=n,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=o||null;try{var a=this.expression.evaluate(this._evaluator);if(null==a||"number"==typeof a&&a!=a)return this._defaultValue;if(this._enumValues&&!(a in this._enumValues))throw new ce("Expected value to be one of "+Object.keys(this._enumValues).map((function(t){return JSON.stringify(t)})).join(", ")+", but found "+JSON.stringify(a)+" instead.");return a}catch(t){return this._warningHistory[t.message]||(this._warningHistory[t.message]=!0,"undefined"!=typeof console&&console.warn(t.message)),this._defaultValue}};var Wr=function(t,e){this.kind=t,this._styleExpression=e,this.isStateDependent="constant"!==t&&!Fe(e.expression)};Wr.prototype.evaluateWithoutErrorHandling=function(t,e,r,n,i,o){return this._styleExpression.evaluateWithoutErrorHandling(t,e,r,n,i,o)},Wr.prototype.evaluate=function(t,e,r,n,i,o){return this._styleExpression.evaluate(t,e,r,n,i,o)};var Xr=function(t,e,r,n){this.kind=t,this.zoomStops=r,this._styleExpression=e,this.isStateDependent="camera"!==t&&!Fe(e.expression),this.interpolationType=n};function Hr(t,e){if("error"===(t=Gr(t,e)).result)return t;var r=t.value.expression,n=Oe(r);if(!n&&!Dr(e))return Mr([new Bt("","data expressions not supported")]);var i=Ve(r,["zoom"]);if(!i&&!Lr(e))return Mr([new Bt("","zoom expressions not supported")]);var o=function t(e){var r=null;if(e instanceof ur)r=t(e.result);else if(e instanceof sr)for(var n=0,i=e.args;n<i.length&&!(r=t(i[n]));n+=1);else(e instanceof qe||e instanceof or)&&e.input instanceof _e&&"zoom"===e.input.name&&(r=e);return r instanceof Bt||e.eachChild((function(e){var n=t(e);n instanceof Bt?r=n:!r&&n?r=new Bt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):r&&n&&r!==n&&(r=new Bt("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),r}(r);return o||i?o instanceof Bt?Mr([o]):o instanceof or&&!Br(e)?Mr([new Bt("",'"interpolate" expressions cannot be used with this property')]):Pr(o?new Xr(n?"camera":"composite",t.value,o.labels,o instanceof or?o.interpolation:void 0):new Wr(n?"constant":"source",t.value)):Mr([new Bt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}Xr.prototype.evaluateWithoutErrorHandling=function(t,e,r,n,i,o){return this._styleExpression.evaluateWithoutErrorHandling(t,e,r,n,i,o)},Xr.prototype.evaluate=function(t,e,r,n,i,o){return this._styleExpression.evaluate(t,e,r,n,i,o)},Xr.prototype.interpolationFactor=function(t,e,r){return this.interpolationType?or.interpolationFactor(this.interpolationType,t,e,r):0};var Kr=function(t,e){this._parameters=t,this._specification=e,Mt(this,function t(e,r){var n,i,o,a="color"===r.type,s=e.stops&&"object"==typeof e.stops[0][0],u=s||!(s||void 0!==e.property),l=e.type||(Br(r)?"exponential":"interval");if(a&&((e=Mt({},e)).stops&&(e.stops=e.stops.map((function(t){return[t[0],te.parse(t[1])]}))),e.default=te.parse(e.default?e.default:r.default)),e.colorSpace&&"rgb"!==e.colorSpace&&!ir[e.colorSpace])throw new Error("Unknown color space: "+e.colorSpace);if("exponential"===l)n=Nr;else if("interval"===l)n=jr;else if("categorical"===l){n=Ur,i=Object.create(null);for(var c=0,p=e.stops;c<p.length;c+=1){var h=p[c];i[h[0]]=h[1]}o=typeof e.stops[0][0]}else{if("identity"!==l)throw new Error('Unknown function type "'+l+'"');n=qr}if(s){for(var f={},d=[],m=0;m<e.stops.length;m++){var y=e.stops[m],g=y[0].zoom;void 0===f[g]&&(f[g]={zoom:g,type:e.type,property:e.property,default:e.default,stops:[]},d.push(g)),f[g].stops.push([y[0].value,y[1]])}for(var v=[],_=0,x=d;_<x.length;_+=1){var b=x[_];v.push([f[b].zoom,t(f[b],r)])}var w={name:"linear"};return{kind:"composite",interpolationType:w,interpolationFactor:or.interpolationFactor.bind(void 0,w),zoomStops:v.map((function(t){return t[0]})),evaluate:function(t,n){var i=t.zoom;return Nr({stops:v,base:e.base},r,i).evaluate(i,n)}}}if(u){var S="exponential"===l?{name:"exponential",base:void 0!==e.base?e.base:1}:null;return{kind:"camera",interpolationType:S,interpolationFactor:or.interpolationFactor.bind(void 0,S),zoomStops:e.stops.map((function(t){return t[0]})),evaluate:function(t){return n(e,r,t.zoom,i,o)}}}return{kind:"source",evaluate:function(t,a){var s=a&&a.properties?a.properties[e.property]:void 0;return void 0===s?Vr(e.default,r.default):n(e,r,s,i,o)}}}(this._parameters,this._specification))};function Yr(t){var e=t.key,r=t.value,n=t.valueSpec||{},i=t.objectElementValidators||{},o=t.style,a=t.styleSpec,s=[],u=Rr(r);if("object"!==u)return[new Ct(e,r,"object expected, "+u+" found")];for(var l in r){var c=l.split(".")[0],p=n[c]||n["*"],h=void 0;if(i[c])h=i[c];else if(n[c])h=Sn;else if(i["*"])h=i["*"];else{if(!n["*"]){s.push(new Ct(e,r[l],'unknown property "'+l+'"'));continue}h=Sn}s=s.concat(h({key:(e?e+".":e)+l,value:r[l],valueSpec:p,style:o,styleSpec:a,object:r,objectKey:l},r))}for(var f in n)i[f]||n[f].required&&void 0===n[f].default&&void 0===r[f]&&s.push(new Ct(e,r,'missing required property "'+f+'"'));return s}function Jr(t){var e=t.value,r=t.valueSpec,n=t.style,i=t.styleSpec,o=t.key,a=t.arrayElementValidator||Sn;if("array"!==Rr(e))return[new Ct(o,e,"array expected, "+Rr(e)+" found")];if(r.length&&e.length!==r.length)return[new Ct(o,e,"array length "+r.length+" expected, length "+e.length+" found")];if(r["min-length"]&&e.length<r["min-length"])return[new Ct(o,e,"array length at least "+r["min-length"]+" expected, length "+e.length+" found")];var s={type:r.value,values:r.values};i.$version<7&&(s.function=r.function),"object"===Rr(r.value)&&(s=r.value);for(var u=[],l=0;l<e.length;l++)u=u.concat(a({array:e,arrayIndex:l,value:e[l],valueSpec:s,style:n,styleSpec:i,key:o+"["+l+"]"}));return u}function Qr(t){var e=t.key,r=t.value,n=t.valueSpec,i=Rr(r);return"number"===i&&r!=r&&(i="NaN"),"number"!==i?[new Ct(e,r,"number expected, "+i+" found")]:"minimum"in n&&r<n.minimum?[new Ct(e,r,r+" is less than the minimum value "+n.minimum)]:"maximum"in n&&r>n.maximum?[new Ct(e,r,r+" is greater than the maximum value "+n.maximum)]:[]}function tn(t){var e,r,n,i=t.valueSpec,o=Dt(t.value.type),a={},s="categorical"!==o&&void 0===t.value.property,u=!s,l="array"===Rr(t.value.stops)&&"array"===Rr(t.value.stops[0])&&"object"===Rr(t.value.stops[0][0]),c=Yr({key:t.key,value:t.value,valueSpec:t.styleSpec.function,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:function(t){if("identity"===o)return[new Ct(t.key,t.value,'identity function may not have a "stops" property')];var e=[],r=t.value;return e=e.concat(Jr({key:t.key,value:r,valueSpec:t.valueSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:p})),"array"===Rr(r)&&0===r.length&&e.push(new Ct(t.key,r,"array must have at least one stop")),e},default:function(t){return Sn({key:t.key,value:t.value,valueSpec:i,style:t.style,styleSpec:t.styleSpec})}}});return"identity"===o&&s&&c.push(new Ct(t.key,t.value,'missing required property "property"')),"identity"===o||t.value.stops||c.push(new Ct(t.key,t.value,'missing required property "stops"')),"exponential"===o&&t.valueSpec.expression&&!Br(t.valueSpec)&&c.push(new Ct(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(u&&!Dr(t.valueSpec)?c.push(new Ct(t.key,t.value,"property functions not supported")):s&&!Lr(t.valueSpec)&&c.push(new Ct(t.key,t.value,"zoom functions not supported"))),"categorical"!==o&&!l||void 0!==t.value.property||c.push(new Ct(t.key,t.value,'"property" property is required')),c;function p(t){var e=[],o=t.value,s=t.key;if("array"!==Rr(o))return[new Ct(s,o,"array expected, "+Rr(o)+" found")];if(2!==o.length)return[new Ct(s,o,"array length 2 expected, length "+o.length+" found")];if(l){if("object"!==Rr(o[0]))return[new Ct(s,o,"object expected, "+Rr(o[0])+" found")];if(void 0===o[0].zoom)return[new Ct(s,o,"object stop key must have zoom")];if(void 0===o[0].value)return[new Ct(s,o,"object stop key must have value")];if(n&&n>Dt(o[0].zoom))return[new Ct(s,o[0].zoom,"stop zoom values must appear in ascending order")];Dt(o[0].zoom)!==n&&(n=Dt(o[0].zoom),r=void 0,a={}),e=e.concat(Yr({key:s+"[0]",value:o[0],valueSpec:{zoom:{}},style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:Qr,value:h}}))}else e=e.concat(h({key:s+"[0]",value:o[0],valueSpec:{},style:t.style,styleSpec:t.styleSpec},o));return Zr(Lt(o[1]))?e.concat([new Ct(s+"[1]",o[1],"expressions are not allowed in function stops.")]):e.concat(Sn({key:s+"[1]",value:o[1],valueSpec:i,style:t.style,styleSpec:t.styleSpec}))}function h(t,n){var s=Rr(t.value),u=Dt(t.value),l=null!==t.value?t.value:n;if(e){if(s!==e)return[new Ct(t.key,l,s+" stop domain type must match previous stop domain type "+e)]}else e=s;if("number"!==s&&"string"!==s&&"boolean"!==s)return[new Ct(t.key,l,"stop domain value must be a number, string, or boolean")];if("number"!==s&&"categorical"!==o){var c="number expected, "+s+" found";return Dr(i)&&void 0===o&&(c+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Ct(t.key,l,c)]}return"categorical"!==o||"number"!==s||isFinite(u)&&Math.floor(u)===u?"categorical"!==o&&"number"===s&&void 0!==r&&u<r?[new Ct(t.key,l,"stop domain values must appear in ascending order")]:(r=u,"categorical"===o&&u in a?[new Ct(t.key,l,"stop domain values must be unique")]:(a[u]=!0,[])):[new Ct(t.key,l,"integer expected, found "+u)]}}function en(t){var e=("property"===t.expressionContext?Hr:Gr)(Lt(t.value),t.valueSpec);if("error"===e.result)return e.value.map((function(e){return new Ct(""+t.key+e.key,t.value,e.message)}));var r=e.value.expression||e.value._styleExpression.expression;if("property"===t.expressionContext&&"text-font"===t.propertyKey&&!r.outputDefined())return[new Ct(t.key,t.value,'Invalid data expression for "'+t.propertyKey+'". Output values must be contained as literals within the expression.')];if("property"===t.expressionContext&&"layout"===t.propertyType&&!Fe(r))return[new Ct(t.key,t.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===t.expressionContext&&!Fe(r))return[new Ct(t.key,t.value,'"feature-state" data expressions are not supported with filters.')];if(t.expressionContext&&0===t.expressionContext.indexOf("cluster")){if(!Ve(r,["zoom","feature-state"]))return[new Ct(t.key,t.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===t.expressionContext&&!Oe(r))return[new Ct(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function rn(t){var e=t.key,r=t.value,n=t.valueSpec,i=[];return Array.isArray(n.values)?-1===n.values.indexOf(Dt(r))&&i.push(new Ct(e,r,"expected one of ["+n.values.join(", ")+"], "+JSON.stringify(r)+" found")):-1===Object.keys(n.values).indexOf(Dt(r))&&i.push(new Ct(e,r,"expected one of ["+Object.keys(n.values).join(", ")+"], "+JSON.stringify(r)+" found")),i}function nn(t){if(!0===t||!1===t)return!0;if(!Array.isArray(t)||0===t.length)return!1;switch(t[0]){case"has":return t.length>=2&&"$id"!==t[1]&&"$type"!==t[1];case"in":return t.length>=3&&("string"!=typeof t[1]||Array.isArray(t[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==t.length||Array.isArray(t[1])||Array.isArray(t[2]);case"any":case"all":for(var e=0,r=t.slice(1);e<r.length;e+=1){var n=r[e];if(!nn(n)&&"boolean"!=typeof n)return!1}return!0;default:return!0}}Kr.deserialize=function(t){return new Kr(t._parameters,t._specification)},Kr.serialize=function(t){return{_parameters:t._parameters,_specification:t._specification}};var on={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function an(t){if(null==t)return{filter:function(){return!0},needGeometry:!1};nn(t)||(t=un(t));var e=Gr(t,on);if("error"===e.result)throw new Error(e.value.map((function(t){return t.key+": "+t.message})).join(", "));return{filter:function(t,r,n){return e.value.evaluate(t,r,{},n)},needGeometry:function t(e){if(!Array.isArray(e))return!1;if("within"===e[0])return!0;for(var r=1;r<e.length;r++)if(t(e[r]))return!0;return!1}(t)}}function sn(t,e){return t<e?-1:t>e?1:0}function un(t){if(!t)return!0;var e,r=t[0];return t.length<=1?"any"!==r:"=="===r?ln(t[1],t[2],"=="):"!="===r?hn(ln(t[1],t[2],"==")):"<"===r||">"===r||"<="===r||">="===r?ln(t[1],t[2],r):"any"===r?(e=t.slice(1),["any"].concat(e.map(un))):"all"===r?["all"].concat(t.slice(1).map(un)):"none"===r?["all"].concat(t.slice(1).map(un).map(hn)):"in"===r?cn(t[1],t.slice(2)):"!in"===r?hn(cn(t[1],t.slice(2))):"has"===r?pn(t[1]):"!has"===r?hn(pn(t[1])):"within"!==r||t}function ln(t,e,r){switch(t){case"$type":return["filter-type-"+r,e];case"$id":return["filter-id-"+r,e];default:return["filter-"+r,t,e]}}function cn(t,e){if(0===e.length)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some((function(t){return typeof t!=typeof e[0]}))?["filter-in-large",t,["literal",e.sort(sn)]]:["filter-in-small",t,["literal",e]]}}function pn(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function hn(t){return["!",t]}function fn(t){return nn(Lt(t.value))?en(Mt({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):function t(e){var r=e.value,n=e.key;if("array"!==Rr(r))return[new Ct(n,r,"array expected, "+Rr(r)+" found")];var i,o=e.styleSpec,a=[];if(r.length<1)return[new Ct(n,r,"filter array must have at least 1 element")];switch(a=a.concat(rn({key:n+"[0]",value:r[0],valueSpec:o.filter_operator,style:e.style,styleSpec:e.styleSpec})),Dt(r[0])){case"<":case"<=":case">":case">=":r.length>=2&&"$type"===Dt(r[1])&&a.push(new Ct(n,r,'"$type" cannot be use with operator "'+r[0]+'"'));case"==":case"!=":3!==r.length&&a.push(new Ct(n,r,'filter array for operator "'+r[0]+'" must have 3 elements'));case"in":case"!in":r.length>=2&&"string"!==(i=Rr(r[1]))&&a.push(new Ct(n+"[1]",r[1],"string expected, "+i+" found"));for(var s=2;s<r.length;s++)i=Rr(r[s]),"$type"===Dt(r[1])?a=a.concat(rn({key:n+"["+s+"]",value:r[s],valueSpec:o.geometry_type,style:e.style,styleSpec:e.styleSpec})):"string"!==i&&"number"!==i&&"boolean"!==i&&a.push(new Ct(n+"["+s+"]",r[s],"string, number, or boolean expected, "+i+" found"));break;case"any":case"all":case"none":for(var u=1;u<r.length;u++)a=a.concat(t({key:n+"["+u+"]",value:r[u],style:e.style,styleSpec:e.styleSpec}));break;case"has":case"!has":i=Rr(r[1]),2!==r.length?a.push(new Ct(n,r,'filter array for "'+r[0]+'" operator must have 2 elements')):"string"!==i&&a.push(new Ct(n+"[1]",r[1],"string expected, "+i+" found"));break;case"within":i=Rr(r[1]),2!==r.length?a.push(new Ct(n,r,'filter array for "'+r[0]+'" operator must have 2 elements')):"object"!==i&&a.push(new Ct(n+"[1]",r[1],"object expected, "+i+" found"))}return a}(t)}function dn(t,e){var r=t.key,n=t.style,i=t.styleSpec,o=t.value,a=t.objectKey,s=i[e+"_"+t.layerType];if(!s)return[];var u=a.match(/^(.*)-transition$/);if("paint"===e&&u&&s[u[1]]&&s[u[1]].transition)return Sn({key:r,value:o,valueSpec:i.transition,style:n,styleSpec:i});var l,c=t.valueSpec||s[a];if(!c)return[new Ct(r,o,'unknown property "'+a+'"')];if("string"===Rr(o)&&Dr(c)&&!c.tokens&&(l=/^{([^}]+)}$/.exec(o)))return[new Ct(r,o,'"'+a+'" does not support interpolation syntax\nUse an identity property function instead: `{ "type": "identity", "property": '+JSON.stringify(l[1])+" }`.")];var p=[];return"symbol"===t.layerType&&("text-field"===a&&n&&!n.glyphs&&p.push(new Ct(r,o,'use of "text-field" requires a style "glyphs" property')),"text-font"===a&&Or(Lt(o))&&"identity"===Dt(o.type)&&p.push(new Ct(r,o,'"text-font" does not support identity functions'))),p.concat(Sn({key:t.key,value:o,valueSpec:c,style:n,styleSpec:i,expressionContext:"property",propertyType:e,propertyKey:a}))}function mn(t){return dn(t,"paint")}function yn(t){return dn(t,"layout")}function gn(t){var e=[],r=t.value,n=t.key,i=t.style,o=t.styleSpec;r.type||r.ref||e.push(new Ct(n,r,'either "type" or "ref" is required'));var a,s=Dt(r.type),u=Dt(r.ref);if(r.id)for(var l=Dt(r.id),c=0;c<t.arrayIndex;c++){var p=i.layers[c];Dt(p.id)===l&&e.push(new Ct(n,r.id,'duplicate layer id "'+r.id+'", previously used at line '+p.id.__line__))}if("ref"in r)["type","source","source-layer","filter","layout"].forEach((function(t){t in r&&e.push(new Ct(n,r[t],'"'+t+'" is prohibited for ref layers'))})),i.layers.forEach((function(t){Dt(t.id)===u&&(a=t)})),a?a.ref?e.push(new Ct(n,r.ref,"ref cannot reference another ref layer")):s=Dt(a.type):e.push(new Ct(n,r.ref,'ref layer "'+u+'" not found'));else if("background"!==s)if(r.source){var h=i.sources&&i.sources[r.source],f=h&&Dt(h.type);h?"vector"===f&&"raster"===s?e.push(new Ct(n,r.source,'layer "'+r.id+'" requires a raster source')):"raster"===f&&"raster"!==s?e.push(new Ct(n,r.source,'layer "'+r.id+'" requires a vector source')):"vector"!==f||r["source-layer"]?"raster-dem"===f&&"hillshade"!==s?e.push(new Ct(n,r.source,"raster-dem source can only be used with layer type 'hillshade'.")):"line"!==s||!r.paint||!r.paint["line-gradient"]||"geojson"===f&&h.lineMetrics||e.push(new Ct(n,r,'layer "'+r.id+'" specifies a line-gradient, which requires a GeoJSON source with `lineMetrics` enabled.')):e.push(new Ct(n,r,'layer "'+r.id+'" must specify a "source-layer"')):e.push(new Ct(n,r.source,'source "'+r.source+'" not found'))}else e.push(new Ct(n,r,'missing required property "source"'));return e=e.concat(Yr({key:n,value:r,valueSpec:o.layer,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":function(){return[]},type:function(){return Sn({key:n+".type",value:r.type,valueSpec:o.layer.type,style:t.style,styleSpec:t.styleSpec,object:r,objectKey:"type"})},filter:fn,layout:function(t){return Yr({layer:r,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":function(t){return yn(Mt({layerType:s},t))}}})},paint:function(t){return Yr({layer:r,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":function(t){return mn(Mt({layerType:s},t))}}})}}}))}function vn(t){var e=t.value,r=t.key,n=Rr(e);return"string"!==n?[new Ct(r,e,"string expected, "+n+" found")]:[]}var _n={promoteId:function(t){var e=t.key,r=t.value;if("string"===Rr(r))return vn({key:e,value:r});var n=[];for(var i in r)n.push.apply(n,vn({key:e+"."+i,value:r[i]}));return n}};function xn(t){var e=t.value,r=t.key,n=t.styleSpec,i=t.style;if(!e.type)return[new Ct(r,e,'"type" is required')];var o,a=Dt(e.type);switch(a){case"vector":case"raster":case"raster-dem":return Yr({key:r,value:e,valueSpec:n["source_"+a.replace("-","_")],style:t.style,styleSpec:n,objectElementValidators:_n});case"geojson":if(o=Yr({key:r,value:e,valueSpec:n.source_geojson,style:i,styleSpec:n,objectElementValidators:_n}),e.cluster)for(var s in e.clusterProperties){var u=e.clusterProperties[s],l=u[0],c="string"==typeof l?[l,["accumulated"],["get",s]]:l;o.push.apply(o,en({key:r+"."+s+".map",value:u[1],expressionContext:"cluster-map"})),o.push.apply(o,en({key:r+"."+s+".reduce",value:c,expressionContext:"cluster-reduce"}))}return o;case"video":return Yr({key:r,value:e,valueSpec:n.source_video,style:i,styleSpec:n});case"image":return Yr({key:r,value:e,valueSpec:n.source_image,style:i,styleSpec:n});case"canvas":return[new Ct(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return rn({key:r+".type",value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:i,styleSpec:n})}}function bn(t){var e=t.value,r=t.styleSpec,n=r.light,i=t.style,o=[],a=Rr(e);if(void 0===e)return o;if("object"!==a)return o.concat([new Ct("light",e,"object expected, "+a+" found")]);for(var s in e){var u=s.match(/^(.*)-transition$/);o=o.concat(u&&n[u[1]]&&n[u[1]].transition?Sn({key:s,value:e[s],valueSpec:r.transition,style:i,styleSpec:r}):n[s]?Sn({key:s,value:e[s],valueSpec:n[s],style:i,styleSpec:r}):[new Ct(s,e[s],'unknown property "'+s+'"')])}return o}var wn={"*":function(){return[]},array:Jr,boolean:function(t){var e=t.value,r=t.key,n=Rr(e);return"boolean"!==n?[new Ct(r,e,"boolean expected, "+n+" found")]:[]},number:Qr,color:function(t){var e=t.key,r=t.value,n=Rr(r);return"string"!==n?[new Ct(e,r,"color expected, "+n+" found")]:null===Qt(r)?[new Ct(e,r,'color expected, "'+r+'" found')]:[]},constants:Pt,enum:rn,filter:fn,function:tn,layer:gn,object:Yr,source:xn,light:bn,string:vn,formatted:function(t){return 0===vn(t).length?[]:en(t)},resolvedImage:function(t){return 0===vn(t).length?[]:en(t)}};function Sn(t){var e=t.value,r=t.valueSpec,n=t.styleSpec;return r.expression&&Or(Dt(e))?tn(t):r.expression&&Zr(Lt(e))?en(t):r.type&&wn[r.type]?wn[r.type](t):Yr(Mt({},t,{valueSpec:r.type?n[r.type]:r}))}function An(t){var e=t.value,r=t.key,n=vn(t);return n.length||(-1===e.indexOf("{fontstack}")&&n.push(new Ct(r,e,'"glyphs" url must include a "{fontstack}" token')),-1===e.indexOf("{range}")&&n.push(new Ct(r,e,'"glyphs" url must include a "{range}" token'))),n}function En(t,e){void 0===e&&(e=zt);var r=[];return r=r.concat(Sn({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,objectElementValidators:{glyphs:An,"*":function(){return[]}}})),t.constants&&(r=r.concat(Pt({key:"constants",value:t.constants,style:t,styleSpec:e}))),Tn(r)}function Tn(t){return[].concat(t).sort((function(t,e){return t.line-e.line}))}function kn(t){return function(){for(var e=[],r=arguments.length;r--;)e[r]=arguments[r];return Tn(t.apply(this,e))}}En.source=kn(xn),En.light=kn(bn),En.layer=kn(gn),En.filter=kn(fn),En.paintProperty=kn(mn),En.layoutProperty=kn(yn);var In=En,zn=In.light,Cn=In.paintProperty,Pn=In.layoutProperty;function Mn(t,e){var r=!1;if(e&&e.length)for(var n=0,i=e;n<i.length;n+=1)t.fire(new kt(new Error(i[n].message))),r=!0;return r}var Dn=Ln;function Ln(t,e,r){var n=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;var i=new Int32Array(this.arrayBuffer);t=i[0],this.d=(e=i[1])+2*(r=i[2]);for(var o=0;o<this.d*this.d;o++){var a=i[3+o],s=i[3+o+1];n.push(a===s?null:i.subarray(a,s))}var u=i[3+n.length+1];this.keys=i.subarray(i[3+n.length],u),this.bboxes=i.subarray(u),this.insert=this._insertReadonly}else{this.d=e+2*r;for(var l=0;l<this.d*this.d;l++)n.push([]);this.keys=[],this.bboxes=[]}this.n=e,this.extent=t,this.padding=r,this.scale=e/t,this.uid=0;var c=r/e*t;this.min=-c,this.max=t+c}Ln.prototype.insert=function(t,e,r,n,i){this._forEachCell(e,r,n,i,this._insertCell,this.uid++),this.keys.push(t),this.bboxes.push(e),this.bboxes.push(r),this.bboxes.push(n),this.bboxes.push(i)},Ln.prototype._insertReadonly=function(){throw"Cannot insert into a GridIndex created from an ArrayBuffer."},Ln.prototype._insertCell=function(t,e,r,n,i,o){this.cells[i].push(o)},Ln.prototype.query=function(t,e,r,n,i){var o=this.min,a=this.max;if(t<=o&&e<=o&&a<=r&&a<=n&&!i)return Array.prototype.slice.call(this.keys);var s=[];return this._forEachCell(t,e,r,n,this._queryCell,s,{},i),s},Ln.prototype._queryCell=function(t,e,r,n,i,o,a,s){var u=this.cells[i];if(null!==u)for(var l=this.keys,c=this.bboxes,p=0;p<u.length;p++){var h=u[p];if(void 0===a[h]){var f=4*h;(s?s(c[f+0],c[f+1],c[f+2],c[f+3]):t<=c[f+2]&&e<=c[f+3]&&r>=c[f+0]&&n>=c[f+1])?(a[h]=!0,o.push(l[h])):a[h]=!1}}},Ln.prototype._forEachCell=function(t,e,r,n,i,o,a,s){for(var u=this._convertToCellCoord(t),l=this._convertToCellCoord(e),c=this._convertToCellCoord(r),p=this._convertToCellCoord(n),h=u;h<=c;h++)for(var f=l;f<=p;f++){var d=this.d*f+h;if((!s||s(this._convertFromCellCoord(h),this._convertFromCellCoord(f),this._convertFromCellCoord(h+1),this._convertFromCellCoord(f+1)))&&i.call(this,t,e,r,n,d,o,a,s))return}},Ln.prototype._convertFromCellCoord=function(t){return(t-this.padding)/this.scale},Ln.prototype._convertToCellCoord=function(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))},Ln.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var t=this.cells,e=3+this.cells.length+1+1,r=0,n=0;n<this.cells.length;n++)r+=this.cells[n].length;var i=new Int32Array(e+r+this.keys.length+this.bboxes.length);i[0]=this.extent,i[1]=this.n,i[2]=this.padding;for(var o=e,a=0;a<t.length;a++){var s=t[a];i[3+a]=o,i.set(s,o),o+=s.length}return i[3+t.length]=o,i.set(this.keys,o),i[3+t.length+1]=o+=this.keys.length,i.set(this.bboxes,o),o+=this.bboxes.length,i.buffer};var Bn=a.ImageData,Rn=a.ImageBitmap,On={};function Fn(t,e,r){void 0===r&&(r={}),Object.defineProperty(e,"_classRegistryKey",{value:t,writeable:!1}),On[t]={klass:e,omit:r.omit||[],shallow:r.shallow||[]}}for(var Vn in Fn("Object",Object),Dn.serialize=function(t,e){var r=t.toArrayBuffer();return e&&e.push(r),{buffer:r}},Dn.deserialize=function(t){return new Dn(t.buffer)},Fn("Grid",Dn),Fn("Color",te),Fn("Error",Error),Fn("ResolvedImage",ie),Fn("StylePropertyFunction",Kr),Fn("StyleExpression",$r,{omit:["_evaluator"]}),Fn("ZoomDependentExpression",Xr),Fn("ZoomConstantExpression",Wr),Fn("CompoundExpression",_e,{omit:["_evaluate"]}),Tr)Tr[Vn]._classRegistryKey||Fn("Expression_"+Vn,Tr[Vn]);function Un(t){return t&&"undefined"!=typeof ArrayBuffer&&(t instanceof ArrayBuffer||t.constructor&&"ArrayBuffer"===t.constructor.name)}function jn(t){return Rn&&t instanceof Rn}function Nn(t,e){if(null==t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp)return t;if(Un(t)||jn(t))return e&&e.push(t),t;if(ArrayBuffer.isView(t)){var r=t;return e&&e.push(r.buffer),r}if(t instanceof Bn)return e&&e.push(t.data.buffer),t;if(Array.isArray(t)){for(var n=[],i=0,o=t;i<o.length;i+=1)n.push(Nn(o[i],e));return n}if("object"==typeof t){var a=t.constructor,s=a._classRegistryKey;if(!s)throw new Error("can't serialize object of unregistered class");var u=a.serialize?a.serialize(t,e):{};if(!a.serialize){for(var l in t)if(t.hasOwnProperty(l)&&!(On[s].omit.indexOf(l)>=0)){var c=t[l];u[l]=On[s].shallow.indexOf(l)>=0?c:Nn(c,e)}t instanceof Error&&(u.message=t.message)}if(u.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==s&&(u.$name=s),u}throw new Error("can't serialize object of type "+typeof t)}function qn(t){if(null==t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||Un(t)||jn(t)||ArrayBuffer.isView(t)||t instanceof Bn)return t;if(Array.isArray(t))return t.map(qn);if("object"==typeof t){var e=t.$name||"Object",r=On[e].klass;if(!r)throw new Error("can't deserialize unregistered class "+e);if(r.deserialize)return r.deserialize(t);for(var n=Object.create(r.prototype),i=0,o=Object.keys(t);i<o.length;i+=1){var a=o[i];if("$name"!==a){var s=t[a];n[a]=On[e].shallow.indexOf(a)>=0?s:qn(s)}}return n}throw new Error("can't deserialize object of type "+typeof t)}var $n=function(){this.first=!0};$n.prototype.update=function(t,e){var r=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=r,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=r,!0):(this.lastFloorZoom>r?(this.lastIntegerZoom=r+1,this.lastIntegerZoomTime=e):this.lastFloorZoom<r&&(this.lastIntegerZoom=r,this.lastIntegerZoomTime=e),t!==this.lastZoom&&(this.lastZoom=t,this.lastFloorZoom=r,!0))};var Zn={"Latin-1 Supplement":function(t){return t>=128&&t<=255},Arabic:function(t){return t>=1536&&t<=1791},"Arabic Supplement":function(t){return t>=1872&&t<=1919},"Arabic Extended-A":function(t){return t>=2208&&t<=2303},"Hangul Jamo":function(t){return t>=4352&&t<=4607},"Unified Canadian Aboriginal Syllabics":function(t){return t>=5120&&t<=5759},Khmer:function(t){return t>=6016&&t<=6143},"Unified Canadian Aboriginal Syllabics Extended":function(t){return t>=6320&&t<=6399},"General Punctuation":function(t){return t>=8192&&t<=8303},"Letterlike Symbols":function(t){return t>=8448&&t<=8527},"Number Forms":function(t){return t>=8528&&t<=8591},"Miscellaneous Technical":function(t){return t>=8960&&t<=9215},"Control Pictures":function(t){return t>=9216&&t<=9279},"Optical Character Recognition":function(t){return t>=9280&&t<=9311},"Enclosed Alphanumerics":function(t){return t>=9312&&t<=9471},"Geometric Shapes":function(t){return t>=9632&&t<=9727},"Miscellaneous Symbols":function(t){return t>=9728&&t<=9983},"Miscellaneous Symbols and Arrows":function(t){return t>=11008&&t<=11263},"CJK Radicals Supplement":function(t){return t>=11904&&t<=12031},"Kangxi Radicals":function(t){return t>=12032&&t<=12255},"Ideographic Description Characters":function(t){return t>=12272&&t<=12287},"CJK Symbols and Punctuation":function(t){return t>=12288&&t<=12351},Hiragana:function(t){return t>=12352&&t<=12447},Katakana:function(t){return t>=12448&&t<=12543},Bopomofo:function(t){return t>=12544&&t<=12591},"Hangul Compatibility Jamo":function(t){return t>=12592&&t<=12687},Kanbun:function(t){return t>=12688&&t<=12703},"Bopomofo Extended":function(t){return t>=12704&&t<=12735},"CJK Strokes":function(t){return t>=12736&&t<=12783},"Katakana Phonetic Extensions":function(t){return t>=12784&&t<=12799},"Enclosed CJK Letters and Months":function(t){return t>=12800&&t<=13055},"CJK Compatibility":function(t){return t>=13056&&t<=13311},"CJK Unified Ideographs Extension A":function(t){return t>=13312&&t<=19903},"Yijing Hexagram Symbols":function(t){return t>=19904&&t<=19967},"CJK Unified Ideographs":function(t){return t>=19968&&t<=40959},"Yi Syllables":function(t){return t>=40960&&t<=42127},"Yi Radicals":function(t){return t>=42128&&t<=42191},"Hangul Jamo Extended-A":function(t){return t>=43360&&t<=43391},"Hangul Syllables":function(t){return t>=44032&&t<=55215},"Hangul Jamo Extended-B":function(t){return t>=55216&&t<=55295},"Private Use Area":function(t){return t>=57344&&t<=63743},"CJK Compatibility Ideographs":function(t){return t>=63744&&t<=64255},"Arabic Presentation Forms-A":function(t){return t>=64336&&t<=65023},"Vertical Forms":function(t){return t>=65040&&t<=65055},"CJK Compatibility Forms":function(t){return t>=65072&&t<=65103},"Small Form Variants":function(t){return t>=65104&&t<=65135},"Arabic Presentation Forms-B":function(t){return t>=65136&&t<=65279},"Halfwidth and Fullwidth Forms":function(t){return t>=65280&&t<=65519}};function Gn(t){for(var e=0,r=t;e<r.length;e+=1)if(Wn(r[e].charCodeAt(0)))return!0;return!1}function Wn(t){return!(746!==t&&747!==t&&(t<4352||!(Zn["Bopomofo Extended"](t)||Zn.Bopomofo(t)||Zn["CJK Compatibility Forms"](t)&&!(t>=65097&&t<=65103)||Zn["CJK Compatibility Ideographs"](t)||Zn["CJK Compatibility"](t)||Zn["CJK Radicals Supplement"](t)||Zn["CJK Strokes"](t)||!(!Zn["CJK Symbols and Punctuation"](t)||t>=12296&&t<=12305||t>=12308&&t<=12319||12336===t)||Zn["CJK Unified Ideographs Extension A"](t)||Zn["CJK Unified Ideographs"](t)||Zn["Enclosed CJK Letters and Months"](t)||Zn["Hangul Compatibility Jamo"](t)||Zn["Hangul Jamo Extended-A"](t)||Zn["Hangul Jamo Extended-B"](t)||Zn["Hangul Jamo"](t)||Zn["Hangul Syllables"](t)||Zn.Hiragana(t)||Zn["Ideographic Description Characters"](t)||Zn.Kanbun(t)||Zn["Kangxi Radicals"](t)||Zn["Katakana Phonetic Extensions"](t)||Zn.Katakana(t)&&12540!==t||!(!Zn["Halfwidth and Fullwidth Forms"](t)||65288===t||65289===t||65293===t||t>=65306&&t<=65310||65339===t||65341===t||65343===t||t>=65371&&t<=65503||65507===t||t>=65512&&t<=65519)||!(!Zn["Small Form Variants"](t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||Zn["Unified Canadian Aboriginal Syllabics"](t)||Zn["Unified Canadian Aboriginal Syllabics Extended"](t)||Zn["Vertical Forms"](t)||Zn["Yijing Hexagram Symbols"](t)||Zn["Yi Syllables"](t)||Zn["Yi Radicals"](t))))}function Xn(t){return!(Wn(t)||function(t){return!!(Zn["Latin-1 Supplement"](t)&&(167===t||169===t||174===t||177===t||188===t||189===t||190===t||215===t||247===t)||Zn["General Punctuation"](t)&&(8214===t||8224===t||8225===t||8240===t||8241===t||8251===t||8252===t||8258===t||8263===t||8264===t||8265===t||8273===t)||Zn["Letterlike Symbols"](t)||Zn["Number Forms"](t)||Zn["Miscellaneous Technical"](t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||9003===t||t>=9085&&t<=9114||t>=9150&&t<=9165||9167===t||t>=9169&&t<=9179||t>=9186&&t<=9215)||Zn["Control Pictures"](t)&&9251!==t||Zn["Optical Character Recognition"](t)||Zn["Enclosed Alphanumerics"](t)||Zn["Geometric Shapes"](t)||Zn["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||Zn["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||Zn["CJK Symbols and Punctuation"](t)||Zn.Katakana(t)||Zn["Private Use Area"](t)||Zn["CJK Compatibility Forms"](t)||Zn["Small Form Variants"](t)||Zn["Halfwidth and Fullwidth Forms"](t)||8734===t||8756===t||8757===t||t>=9984&&t<=10087||t>=10102&&t<=10131||65532===t||65533===t)}(t))}function Hn(t){return t>=1424&&t<=2303||Zn["Arabic Presentation Forms-A"](t)||Zn["Arabic Presentation Forms-B"](t)}function Kn(t,e){return!(!e&&Hn(t)||t>=2304&&t<=3583||t>=3840&&t<=4255||Zn.Khmer(t))}function Yn(t){for(var e=0,r=t;e<r.length;e+=1)if(Hn(r[e].charCodeAt(0)))return!0;return!1}var Jn=null,Qn="unavailable",ti=null,ei=function(t){t&&"string"==typeof t&&t.indexOf("NetworkError")>-1&&(Qn="error"),Jn&&Jn(t)};function ri(){ni.fire(new Tt("pluginStateChange",{pluginStatus:Qn,pluginURL:ti}))}var ni=new It,ii=function(){return Qn},oi=function(){if("deferred"!==Qn||!ti)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Qn="loading",ri(),ti&&xt({url:ti},(function(t){t?ei(t):(Qn="loaded",ri())}))},ai={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:function(){return"loaded"===Qn||null!=ai.applyArabicShaping},isLoading:function(){return"loading"===Qn},setState:function(t){Qn=t.pluginStatus,ti=t.pluginURL},isParsed:function(){return null!=ai.applyArabicShaping&&null!=ai.processBidirectionalText&&null!=ai.processStyledBidirectionalText},getPluginURL:function(){return ti}},si=function(t,e){this.zoom=t,e?(this.now=e.now,this.fadeDuration=e.fadeDuration,this.zoomHistory=e.zoomHistory,this.transition=e.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new $n,this.transition={})};si.prototype.isSupportedScript=function(t){return function(t,e){for(var r=0,n=t;r<n.length;r+=1)if(!Kn(n[r].charCodeAt(0),e))return!1;return!0}(t,ai.isLoaded())},si.prototype.crossFadingFactor=function(){return 0===this.fadeDuration?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)},si.prototype.getCrossfadeParameters=function(){var t=this.zoom,e=t-Math.floor(t),r=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:e+(1-e)*r}:{fromScale:.5,toScale:1,t:1-(1-r)*e}};var ui=function(t,e){this.property=t,this.value=e,this.expression=function(t,e){if(Or(t))return new Kr(t,e);if(Zr(t)){var r=Hr(t,e);if("error"===r.result)throw new Error(r.value.map((function(t){return t.key+": "+t.message})).join(", "));return r.value}var n=t;return"string"==typeof t&&"color"===e.type&&(n=te.parse(t)),{kind:"constant",evaluate:function(){return n}}}(void 0===e?t.specification.default:e,t.specification)};ui.prototype.isDataDriven=function(){return"source"===this.expression.kind||"composite"===this.expression.kind},ui.prototype.possiblyEvaluate=function(t,e,r){return this.property.possiblyEvaluate(this,t,e,r)};var li=function(t){this.property=t,this.value=new ui(t,void 0)};li.prototype.transitioned=function(t,e){return new pi(this.property,this.value,e,h({},t.transition,this.transition),t.now)},li.prototype.untransitioned=function(){return new pi(this.property,this.value,null,{},0)};var ci=function(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)};ci.prototype.getValue=function(t){return b(this._values[t].value.value)},ci.prototype.setValue=function(t,e){this._values.hasOwnProperty(t)||(this._values[t]=new li(this._values[t].property)),this._values[t].value=new ui(this._values[t].property,null===e?void 0:b(e))},ci.prototype.getTransition=function(t){return b(this._values[t].transition)},ci.prototype.setTransition=function(t,e){this._values.hasOwnProperty(t)||(this._values[t]=new li(this._values[t].property)),this._values[t].transition=b(e)||void 0},ci.prototype.serialize=function(){for(var t={},e=0,r=Object.keys(this._values);e<r.length;e+=1){var n=r[e],i=this.getValue(n);void 0!==i&&(t[n]=i);var o=this.getTransition(n);void 0!==o&&(t[n+"-transition"]=o)}return t},ci.prototype.transitioned=function(t,e){for(var r=new hi(this._properties),n=0,i=Object.keys(this._values);n<i.length;n+=1){var o=i[n];r._values[o]=this._values[o].transitioned(t,e._values[o])}return r},ci.prototype.untransitioned=function(){for(var t=new hi(this._properties),e=0,r=Object.keys(this._values);e<r.length;e+=1){var n=r[e];t._values[n]=this._values[n].untransitioned()}return t};var pi=function(t,e,r,n,i){this.property=t,this.value=e,this.begin=i+n.delay||0,this.end=this.begin+n.duration||0,t.specification.transition&&(n.delay||n.duration)&&(this.prior=r)};pi.prototype.possiblyEvaluate=function(t,e,r){var n=t.now||0,i=this.value.possiblyEvaluate(t,e,r),o=this.prior;if(o){if(n>this.end)return this.prior=null,i;if(this.value.isDataDriven())return this.prior=null,i;if(n<this.begin)return o.possiblyEvaluate(t,e,r);var a=(n-this.begin)/(this.end-this.begin);return this.property.interpolate(o.possiblyEvaluate(t,e,r),i,function(t){if(t<=0)return 0;if(t>=1)return 1;var e=t*t,r=e*t;return 4*(t<.5?r:3*(t-e)+r-.75)}(a))}return i};var hi=function(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)};hi.prototype.possiblyEvaluate=function(t,e,r){for(var n=new mi(this._properties),i=0,o=Object.keys(this._values);i<o.length;i+=1){var a=o[i];n._values[a]=this._values[a].possiblyEvaluate(t,e,r)}return n},hi.prototype.hasTransition=function(){for(var t=0,e=Object.keys(this._values);t<e.length;t+=1)if(this._values[e[t]].prior)return!0;return!1};var fi=function(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues)};fi.prototype.getValue=function(t){return b(this._values[t].value)},fi.prototype.setValue=function(t,e){this._values[t]=new ui(this._values[t].property,null===e?void 0:b(e))},fi.prototype.serialize=function(){for(var t={},e=0,r=Object.keys(this._values);e<r.length;e+=1){var n=r[e],i=this.getValue(n);void 0!==i&&(t[n]=i)}return t},fi.prototype.possiblyEvaluate=function(t,e,r){for(var n=new mi(this._properties),i=0,o=Object.keys(this._values);i<o.length;i+=1){var a=o[i];n._values[a]=this._values[a].possiblyEvaluate(t,e,r)}return n};var di=function(t,e,r){this.property=t,this.value=e,this.parameters=r};di.prototype.isConstant=function(){return"constant"===this.value.kind},di.prototype.constantOr=function(t){return"constant"===this.value.kind?this.value.value:t},di.prototype.evaluate=function(t,e,r,n){return this.property.evaluate(this.value,this.parameters,t,e,r,n)};var mi=function(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)};mi.prototype.get=function(t){return this._values[t]};var yi=function(t){this.specification=t};yi.prototype.possiblyEvaluate=function(t,e){return t.expression.evaluate(e)},yi.prototype.interpolate=function(t,e,r){var n=Ze[this.specification.type];return n?n(t,e,r):t};var gi=function(t,e){this.specification=t,this.overrides=e};gi.prototype.possiblyEvaluate=function(t,e,r,n){return new di(this,"constant"===t.expression.kind||"camera"===t.expression.kind?{kind:"constant",value:t.expression.evaluate(e,null,{},r,n)}:t.expression,e)},gi.prototype.interpolate=function(t,e,r){if("constant"!==t.value.kind||"constant"!==e.value.kind)return t;if(void 0===t.value.value||void 0===e.value.value)return new di(this,{kind:"constant",value:void 0},t.parameters);var n=Ze[this.specification.type];return n?new di(this,{kind:"constant",value:n(t.value.value,e.value.value,r)},t.parameters):t},gi.prototype.evaluate=function(t,e,r,n,i,o){return"constant"===t.kind?t.value:t.evaluate(e,r,n,i,o)};var vi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.possiblyEvaluate=function(t,e,r,n){if(void 0===t.value)return new di(this,{kind:"constant",value:void 0},e);if("constant"===t.expression.kind){var i=t.expression.evaluate(e,null,{},r,n),o="resolvedImage"===t.property.specification.type&&"string"!=typeof i?i.name:i,a=this._calculate(o,o,o,e);return new di(this,{kind:"constant",value:a},e)}if("camera"===t.expression.kind){var s=this._calculate(t.expression.evaluate({zoom:e.zoom-1}),t.expression.evaluate({zoom:e.zoom}),t.expression.evaluate({zoom:e.zoom+1}),e);return new di(this,{kind:"constant",value:s},e)}return new di(this,t.expression,e)},e.prototype.evaluate=function(t,e,r,n,i,o){if("source"===t.kind){var a=t.evaluate(e,r,n,i,o);return this._calculate(a,a,a,e)}return"composite"===t.kind?this._calculate(t.evaluate({zoom:Math.floor(e.zoom)-1},r,n),t.evaluate({zoom:Math.floor(e.zoom)},r,n),t.evaluate({zoom:Math.floor(e.zoom)+1},r,n),e):t.value},e.prototype._calculate=function(t,e,r,n){return n.zoom>n.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:r,to:e}},e.prototype.interpolate=function(t){return t},e}(gi),_i=function(t){this.specification=t};_i.prototype.possiblyEvaluate=function(t,e,r,n){if(void 0!==t.value){if("constant"===t.expression.kind){var i=t.expression.evaluate(e,null,{},r,n);return this._calculate(i,i,i,e)}return this._calculate(t.expression.evaluate(new si(Math.floor(e.zoom-1),e)),t.expression.evaluate(new si(Math.floor(e.zoom),e)),t.expression.evaluate(new si(Math.floor(e.zoom+1),e)),e)}},_i.prototype._calculate=function(t,e,r,n){return n.zoom>n.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:r,to:e}},_i.prototype.interpolate=function(t){return t};var xi=function(t){this.specification=t};xi.prototype.possiblyEvaluate=function(t,e,r,n){return!!t.expression.evaluate(e,null,{},r,n)},xi.prototype.interpolate=function(){return!1};var bi=function(t){for(var e in this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[],t){var r=t[e];r.specification.overridable&&this.overridableProperties.push(e);var n=this.defaultPropertyValues[e]=new ui(r,void 0),i=this.defaultTransitionablePropertyValues[e]=new li(r);this.defaultTransitioningPropertyValues[e]=i.untransitioned(),this.defaultPossiblyEvaluatedValues[e]=n.possiblyEvaluate({})}};Fn("DataDrivenProperty",gi),Fn("DataConstantProperty",yi),Fn("CrossFadedDataDrivenProperty",vi),Fn("CrossFadedProperty",_i),Fn("ColorRampProperty",xi);var wi=function(t){function e(e,r){if(t.call(this),this.id=e.id,this.type=e.type,this._featureFilter={filter:function(){return!0},needGeometry:!1},"custom"!==e.type&&(this.metadata=(e=e).metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,"background"!==e.type&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),r.layout&&(this._unevaluatedLayout=new fi(r.layout)),r.paint)){for(var n in this._transitionablePaint=new ci(r.paint),e.paint)this.setPaintProperty(n,e.paint[n],{validate:!1});for(var i in e.layout)this.setLayoutProperty(i,e.layout[i],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new mi(r.paint)}}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getCrossfadeParameters=function(){return this._crossfadeParameters},e.prototype.getLayoutProperty=function(t){return"visibility"===t?this.visibility:this._unevaluatedLayout.getValue(t)},e.prototype.setLayoutProperty=function(t,e,r){void 0===r&&(r={}),null!=e&&this._validate(Pn,"layers."+this.id+".layout."+t,t,e,r)||("visibility"!==t?this._unevaluatedLayout.setValue(t,e):this.visibility=e)},e.prototype.getPaintProperty=function(t){return v(t,"-transition")?this._transitionablePaint.getTransition(t.slice(0,-"-transition".length)):this._transitionablePaint.getValue(t)},e.prototype.setPaintProperty=function(t,e,r){if(void 0===r&&(r={}),null!=e&&this._validate(Cn,"layers."+this.id+".paint."+t,t,e,r))return!1;if(v(t,"-transition"))return this._transitionablePaint.setTransition(t.slice(0,-"-transition".length),e||void 0),!1;var n=this._transitionablePaint._values[t],i="cross-faded-data-driven"===n.property.specification["property-type"],o=n.value.isDataDriven(),a=n.value;this._transitionablePaint.setValue(t,e),this._handleSpecialPaintPropertyUpdate(t);var s=this._transitionablePaint._values[t].value;return s.isDataDriven()||o||i||this._handleOverridablePaintPropertyUpdate(t,a,s)},e.prototype._handleSpecialPaintPropertyUpdate=function(t){},e.prototype._handleOverridablePaintPropertyUpdate=function(t,e,r){return!1},e.prototype.isHidden=function(t){return!!(this.minzoom&&t<this.minzoom)||!!(this.maxzoom&&t>=this.maxzoom)||"none"===this.visibility},e.prototype.updateTransitions=function(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)},e.prototype.hasTransition=function(){return this._transitioningPaint.hasTransition()},e.prototype.recalculate=function(t,e){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,e)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,e)},e.prototype.serialize=function(){var t={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(t.layout=t.layout||{},t.layout.visibility=this.visibility),x(t,(function(t,e){return!(void 0===t||"layout"===e&&!Object.keys(t).length||"paint"===e&&!Object.keys(t).length)}))},e.prototype._validate=function(t,e,r,n,i){return void 0===i&&(i={}),(!i||!1!==i.validate)&&Mn(this,t.call(In,{key:e,layerType:this.type,objectKey:r,value:n,styleSpec:zt,style:{glyphs:!0,sprite:!0}}))},e.prototype.is3D=function(){return!1},e.prototype.isTileClipped=function(){return!1},e.prototype.hasOffscreenPass=function(){return!1},e.prototype.resize=function(){},e.prototype.isStateDependent=function(){for(var t in this.paint._values){var e=this.paint.get(t);if(e instanceof di&&Dr(e.property.specification)&&("source"===e.value.kind||"composite"===e.value.kind)&&e.value.isStateDependent)return!0}return!1},e}(It),Si={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array},Ai=function(t,e){this._structArray=t,this._pos1=e*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8},Ei=function(){this.isTransferred=!1,this.capacity=-1,this.resize(0)};function Ti(t,e){void 0===e&&(e=1);var r=0,n=0;return{members:t.map((function(t){var i=Si[t.type].BYTES_PER_ELEMENT,o=r=ki(r,Math.max(e,i)),a=t.components||1;return n=Math.max(n,i),r+=i*a,{name:t.name,type:t.type,components:a,offset:o}})),size:ki(r,Math.max(n,e)),alignment:e}}function ki(t,e){return Math.ceil(t/e)*e}Ei.serialize=function(t,e){return t._trim(),e&&(t.isTransferred=!0,e.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}},Ei.deserialize=function(t){var e=Object.create(this.prototype);return e.arrayBuffer=t.arrayBuffer,e.length=t.length,e.capacity=t.arrayBuffer.byteLength/e.bytesPerElement,e._refreshViews(),e},Ei.prototype._trim=function(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())},Ei.prototype.clear=function(){this.length=0},Ei.prototype.resize=function(t){this.reserve(t),this.length=t},Ei.prototype.reserve=function(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);var e=this.uint8;this._refreshViews(),e&&this.uint8.set(e)}},Ei.prototype._refreshViews=function(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")};var Ii=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e){var r=this.length;return this.resize(r+1),this.emplace(r,t,e)},e.prototype.emplace=function(t,e,r){var n=2*t;return this.int16[n+0]=e,this.int16[n+1]=r,t},e}(Ei);Ii.prototype.bytesPerElement=4,Fn("StructArrayLayout2i4",Ii);var zi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n){var i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n)},e.prototype.emplace=function(t,e,r,n,i){var o=4*t;return this.int16[o+0]=e,this.int16[o+1]=r,this.int16[o+2]=n,this.int16[o+3]=i,t},e}(Ei);zi.prototype.bytesPerElement=8,Fn("StructArrayLayout4i8",zi);var Ci=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,i,o){var a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,n,i,o)},e.prototype.emplace=function(t,e,r,n,i,o,a){var s=6*t;return this.int16[s+0]=e,this.int16[s+1]=r,this.int16[s+2]=n,this.int16[s+3]=i,this.int16[s+4]=o,this.int16[s+5]=a,t},e}(Ei);Ci.prototype.bytesPerElement=12,Fn("StructArrayLayout2i4i12",Ci);var Pi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,i,o){var a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,n,i,o)},e.prototype.emplace=function(t,e,r,n,i,o,a){var s=4*t,u=8*t;return this.int16[s+0]=e,this.int16[s+1]=r,this.uint8[u+4]=n,this.uint8[u+5]=i,this.uint8[u+6]=o,this.uint8[u+7]=a,t},e}(Ei);Pi.prototype.bytesPerElement=8,Fn("StructArrayLayout2i4ub8",Pi);var Mi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e){var r=this.length;return this.resize(r+1),this.emplace(r,t,e)},e.prototype.emplace=function(t,e,r){var n=2*t;return this.float32[n+0]=e,this.float32[n+1]=r,t},e}(Ei);Mi.prototype.bytesPerElement=8,Fn("StructArrayLayout2f8",Mi);var Di=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,i,o,a,s,u,l){var c=this.length;return this.resize(c+1),this.emplace(c,t,e,r,n,i,o,a,s,u,l)},e.prototype.emplace=function(t,e,r,n,i,o,a,s,u,l,c){var p=10*t;return this.uint16[p+0]=e,this.uint16[p+1]=r,this.uint16[p+2]=n,this.uint16[p+3]=i,this.uint16[p+4]=o,this.uint16[p+5]=a,this.uint16[p+6]=s,this.uint16[p+7]=u,this.uint16[p+8]=l,this.uint16[p+9]=c,t},e}(Ei);Di.prototype.bytesPerElement=20,Fn("StructArrayLayout10ui20",Di);var Li=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,i,o,a,s,u,l,c,p){var h=this.length;return this.resize(h+1),this.emplace(h,t,e,r,n,i,o,a,s,u,l,c,p)},e.prototype.emplace=function(t,e,r,n,i,o,a,s,u,l,c,p,h){var f=12*t;return this.int16[f+0]=e,this.int16[f+1]=r,this.int16[f+2]=n,this.int16[f+3]=i,this.uint16[f+4]=o,this.uint16[f+5]=a,this.uint16[f+6]=s,this.uint16[f+7]=u,this.int16[f+8]=l,this.int16[f+9]=c,this.int16[f+10]=p,this.int16[f+11]=h,t},e}(Ei);Li.prototype.bytesPerElement=24,Fn("StructArrayLayout4i4ui4i24",Li);var Bi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r){var n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)},e.prototype.emplace=function(t,e,r,n){var i=3*t;return this.float32[i+0]=e,this.float32[i+1]=r,this.float32[i+2]=n,t},e}(Ei);Bi.prototype.bytesPerElement=12,Fn("StructArrayLayout3f12",Bi);var Ri=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t){var e=this.length;return this.resize(e+1),this.emplace(e,t)},e.prototype.emplace=function(t,e){return this.uint32[1*t+0]=e,t},e}(Ei);Ri.prototype.bytesPerElement=4,Fn("StructArrayLayout1ul4",Ri);var Oi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,i,o,a,s,u){var l=this.length;return this.resize(l+1),this.emplace(l,t,e,r,n,i,o,a,s,u)},e.prototype.emplace=function(t,e,r,n,i,o,a,s,u,l){var c=10*t,p=5*t;return this.int16[c+0]=e,this.int16[c+1]=r,this.int16[c+2]=n,this.int16[c+3]=i,this.int16[c+4]=o,this.int16[c+5]=a,this.uint32[p+3]=s,this.uint16[c+8]=u,this.uint16[c+9]=l,t},e}(Ei);Oi.prototype.bytesPerElement=20,Fn("StructArrayLayout6i1ul2ui20",Oi);var Fi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,i,o){var a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,n,i,o)},e.prototype.emplace=function(t,e,r,n,i,o,a){var s=6*t;return this.int16[s+0]=e,this.int16[s+1]=r,this.int16[s+2]=n,this.int16[s+3]=i,this.int16[s+4]=o,this.int16[s+5]=a,t},e}(Ei);Fi.prototype.bytesPerElement=12,Fn("StructArrayLayout2i2i2i12",Fi);var Vi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,i){var o=this.length;return this.resize(o+1),this.emplace(o,t,e,r,n,i)},e.prototype.emplace=function(t,e,r,n,i,o){var a=4*t,s=8*t;return this.float32[a+0]=e,this.float32[a+1]=r,this.float32[a+2]=n,this.int16[s+6]=i,this.int16[s+7]=o,t},e}(Ei);Vi.prototype.bytesPerElement=16,Fn("StructArrayLayout2f1f2i16",Vi);var Ui=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n){var i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n)},e.prototype.emplace=function(t,e,r,n,i){var o=12*t,a=3*t;return this.uint8[o+0]=e,this.uint8[o+1]=r,this.float32[a+1]=n,this.float32[a+2]=i,t},e}(Ei);Ui.prototype.bytesPerElement=12,Fn("StructArrayLayout2ub2f12",Ui);var ji=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r){var n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)},e.prototype.emplace=function(t,e,r,n){var i=3*t;return this.uint16[i+0]=e,this.uint16[i+1]=r,this.uint16[i+2]=n,t},e}(Ei);ji.prototype.bytesPerElement=6,Fn("StructArrayLayout3ui6",ji);var Ni=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,i,o,a,s,u,l,c,p,h,f,d,m,y){var g=this.length;return this.resize(g+1),this.emplace(g,t,e,r,n,i,o,a,s,u,l,c,p,h,f,d,m,y)},e.prototype.emplace=function(t,e,r,n,i,o,a,s,u,l,c,p,h,f,d,m,y,g){var v=24*t,_=12*t,x=48*t;return this.int16[v+0]=e,this.int16[v+1]=r,this.uint16[v+2]=n,this.uint16[v+3]=i,this.uint32[_+2]=o,this.uint32[_+3]=a,this.uint32[_+4]=s,this.uint16[v+10]=u,this.uint16[v+11]=l,this.uint16[v+12]=c,this.float32[_+7]=p,this.float32[_+8]=h,this.uint8[x+36]=f,this.uint8[x+37]=d,this.uint8[x+38]=m,this.uint32[_+10]=y,this.int16[v+22]=g,t},e}(Ei);Ni.prototype.bytesPerElement=48,Fn("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Ni);var qi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,i,o,a,s,u,l,c,p,h,f,d,m,y,g,v,_,x,b,w,S,A,E,T,k){var I=this.length;return this.resize(I+1),this.emplace(I,t,e,r,n,i,o,a,s,u,l,c,p,h,f,d,m,y,g,v,_,x,b,w,S,A,E,T,k)},e.prototype.emplace=function(t,e,r,n,i,o,a,s,u,l,c,p,h,f,d,m,y,g,v,_,x,b,w,S,A,E,T,k,I){var z=34*t,C=17*t;return this.int16[z+0]=e,this.int16[z+1]=r,this.int16[z+2]=n,this.int16[z+3]=i,this.int16[z+4]=o,this.int16[z+5]=a,this.int16[z+6]=s,this.int16[z+7]=u,this.uint16[z+8]=l,this.uint16[z+9]=c,this.uint16[z+10]=p,this.uint16[z+11]=h,this.uint16[z+12]=f,this.uint16[z+13]=d,this.uint16[z+14]=m,this.uint16[z+15]=y,this.uint16[z+16]=g,this.uint16[z+17]=v,this.uint16[z+18]=_,this.uint16[z+19]=x,this.uint16[z+20]=b,this.uint16[z+21]=w,this.uint16[z+22]=S,this.uint32[C+12]=A,this.float32[C+13]=E,this.float32[C+14]=T,this.float32[C+15]=k,this.float32[C+16]=I,t},e}(Ei);qi.prototype.bytesPerElement=68,Fn("StructArrayLayout8i15ui1ul4f68",qi);var $i=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t){var e=this.length;return this.resize(e+1),this.emplace(e,t)},e.prototype.emplace=function(t,e){return this.float32[1*t+0]=e,t},e}(Ei);$i.prototype.bytesPerElement=4,Fn("StructArrayLayout1f4",$i);var Zi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r){var n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)},e.prototype.emplace=function(t,e,r,n){var i=3*t;return this.int16[i+0]=e,this.int16[i+1]=r,this.int16[i+2]=n,t},e}(Ei);Zi.prototype.bytesPerElement=6,Fn("StructArrayLayout3i6",Zi);var Gi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r){var n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)},e.prototype.emplace=function(t,e,r,n){var i=4*t;return this.uint32[2*t+0]=e,this.uint16[i+2]=r,this.uint16[i+3]=n,t},e}(Ei);Gi.prototype.bytesPerElement=8,Fn("StructArrayLayout1ul2ui8",Gi);var Wi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e){var r=this.length;return this.resize(r+1),this.emplace(r,t,e)},e.prototype.emplace=function(t,e,r){var n=2*t;return this.uint16[n+0]=e,this.uint16[n+1]=r,t},e}(Ei);Wi.prototype.bytesPerElement=4,Fn("StructArrayLayout2ui4",Wi);var Xi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t){var e=this.length;return this.resize(e+1),this.emplace(e,t)},e.prototype.emplace=function(t,e){return this.uint16[1*t+0]=e,t},e}(Ei);Xi.prototype.bytesPerElement=2,Fn("StructArrayLayout1ui2",Xi);var Hi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n){var i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n)},e.prototype.emplace=function(t,e,r,n,i){var o=4*t;return this.float32[o+0]=e,this.float32[o+1]=r,this.float32[o+2]=n,this.float32[o+3]=i,t},e}(Ei);Hi.prototype.bytesPerElement=16,Fn("StructArrayLayout4f16",Hi);var Ki=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={anchorPointX:{configurable:!0},anchorPointY:{configurable:!0},x1:{configurable:!0},y1:{configurable:!0},x2:{configurable:!0},y2:{configurable:!0},featureIndex:{configurable:!0},sourceLayerIndex:{configurable:!0},bucketIndex:{configurable:!0},anchorPoint:{configurable:!0}};return r.anchorPointX.get=function(){return this._structArray.int16[this._pos2+0]},r.anchorPointY.get=function(){return this._structArray.int16[this._pos2+1]},r.x1.get=function(){return this._structArray.int16[this._pos2+2]},r.y1.get=function(){return this._structArray.int16[this._pos2+3]},r.x2.get=function(){return this._structArray.int16[this._pos2+4]},r.y2.get=function(){return this._structArray.int16[this._pos2+5]},r.featureIndex.get=function(){return this._structArray.uint32[this._pos4+3]},r.sourceLayerIndex.get=function(){return this._structArray.uint16[this._pos2+8]},r.bucketIndex.get=function(){return this._structArray.uint16[this._pos2+9]},r.anchorPoint.get=function(){return new i(this.anchorPointX,this.anchorPointY)},Object.defineProperties(e.prototype,r),e}(Ai);Ki.prototype.size=20;var Yi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.get=function(t){return new Ki(this,t)},e}(Oi);Fn("CollisionBoxArray",Yi);var Ji=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={anchorX:{configurable:!0},anchorY:{configurable:!0},glyphStartIndex:{configurable:!0},numGlyphs:{configurable:!0},vertexStartIndex:{configurable:!0},lineStartIndex:{configurable:!0},lineLength:{configurable:!0},segment:{configurable:!0},lowerSize:{configurable:!0},upperSize:{configurable:!0},lineOffsetX:{configurable:!0},lineOffsetY:{configurable:!0},writingMode:{configurable:!0},placedOrientation:{configurable:!0},hidden:{configurable:!0},crossTileID:{configurable:!0},associatedIconIndex:{configurable:!0}};return r.anchorX.get=function(){return this._structArray.int16[this._pos2+0]},r.anchorY.get=function(){return this._structArray.int16[this._pos2+1]},r.glyphStartIndex.get=function(){return this._structArray.uint16[this._pos2+2]},r.numGlyphs.get=function(){return this._structArray.uint16[this._pos2+3]},r.vertexStartIndex.get=function(){return this._structArray.uint32[this._pos4+2]},r.lineStartIndex.get=function(){return this._structArray.uint32[this._pos4+3]},r.lineLength.get=function(){return this._structArray.uint32[this._pos4+4]},r.segment.get=function(){return this._structArray.uint16[this._pos2+10]},r.lowerSize.get=function(){return this._structArray.uint16[this._pos2+11]},r.upperSize.get=function(){return this._structArray.uint16[this._pos2+12]},r.lineOffsetX.get=function(){return this._structArray.float32[this._pos4+7]},r.lineOffsetY.get=function(){return this._structArray.float32[this._pos4+8]},r.writingMode.get=function(){return this._structArray.uint8[this._pos1+36]},r.placedOrientation.get=function(){return this._structArray.uint8[this._pos1+37]},r.placedOrientation.set=function(t){this._structArray.uint8[this._pos1+37]=t},r.hidden.get=function(){return this._structArray.uint8[this._pos1+38]},r.hidden.set=function(t){this._structArray.uint8[this._pos1+38]=t},r.crossTileID.get=function(){return this._structArray.uint32[this._pos4+10]},r.crossTileID.set=function(t){this._structArray.uint32[this._pos4+10]=t},r.associatedIconIndex.get=function(){return this._structArray.int16[this._pos2+22]},Object.defineProperties(e.prototype,r),e}(Ai);Ji.prototype.size=48;var Qi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.get=function(t){return new Ji(this,t)},e}(Ni);Fn("PlacedSymbolArray",Qi);var to=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={anchorX:{configurable:!0},anchorY:{configurable:!0},rightJustifiedTextSymbolIndex:{configurable:!0},centerJustifiedTextSymbolIndex:{configurable:!0},leftJustifiedTextSymbolIndex:{configurable:!0},verticalPlacedTextSymbolIndex:{configurable:!0},placedIconSymbolIndex:{configurable:!0},verticalPlacedIconSymbolIndex:{configurable:!0},key:{configurable:!0},textBoxStartIndex:{configurable:!0},textBoxEndIndex:{configurable:!0},verticalTextBoxStartIndex:{configurable:!0},verticalTextBoxEndIndex:{configurable:!0},iconBoxStartIndex:{configurable:!0},iconBoxEndIndex:{configurable:!0},verticalIconBoxStartIndex:{configurable:!0},verticalIconBoxEndIndex:{configurable:!0},featureIndex:{configurable:!0},numHorizontalGlyphVertices:{configurable:!0},numVerticalGlyphVertices:{configurable:!0},numIconVertices:{configurable:!0},numVerticalIconVertices:{configurable:!0},useRuntimeCollisionCircles:{configurable:!0},crossTileID:{configurable:!0},textBoxScale:{configurable:!0},textOffset0:{configurable:!0},textOffset1:{configurable:!0},collisionCircleDiameter:{configurable:!0}};return r.anchorX.get=function(){return this._structArray.int16[this._pos2+0]},r.anchorY.get=function(){return this._structArray.int16[this._pos2+1]},r.rightJustifiedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+2]},r.centerJustifiedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+3]},r.leftJustifiedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+4]},r.verticalPlacedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+5]},r.placedIconSymbolIndex.get=function(){return this._structArray.int16[this._pos2+6]},r.verticalPlacedIconSymbolIndex.get=function(){return this._structArray.int16[this._pos2+7]},r.key.get=function(){return this._structArray.uint16[this._pos2+8]},r.textBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+9]},r.textBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+10]},r.verticalTextBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+11]},r.verticalTextBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+12]},r.iconBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+13]},r.iconBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+14]},r.verticalIconBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+15]},r.verticalIconBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+16]},r.featureIndex.get=function(){return this._structArray.uint16[this._pos2+17]},r.numHorizontalGlyphVertices.get=function(){return this._structArray.uint16[this._pos2+18]},r.numVerticalGlyphVertices.get=function(){return this._structArray.uint16[this._pos2+19]},r.numIconVertices.get=function(){return this._structArray.uint16[this._pos2+20]},r.numVerticalIconVertices.get=function(){return this._structArray.uint16[this._pos2+21]},r.useRuntimeCollisionCircles.get=function(){return this._structArray.uint16[this._pos2+22]},r.crossTileID.get=function(){return this._structArray.uint32[this._pos4+12]},r.crossTileID.set=function(t){this._structArray.uint32[this._pos4+12]=t},r.textBoxScale.get=function(){return this._structArray.float32[this._pos4+13]},r.textOffset0.get=function(){return this._structArray.float32[this._pos4+14]},r.textOffset1.get=function(){return this._structArray.float32[this._pos4+15]},r.collisionCircleDiameter.get=function(){return this._structArray.float32[this._pos4+16]},Object.defineProperties(e.prototype,r),e}(Ai);to.prototype.size=68;var eo=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.get=function(t){return new to(this,t)},e}(qi);Fn("SymbolInstanceArray",eo);var ro=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getoffsetX=function(t){return this.float32[1*t+0]},e}($i);Fn("GlyphOffsetArray",ro);var no=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getx=function(t){return this.int16[3*t+0]},e.prototype.gety=function(t){return this.int16[3*t+1]},e.prototype.gettileUnitDistanceFromAnchor=function(t){return this.int16[3*t+2]},e}(Zi);Fn("SymbolLineVertexArray",no);var io=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={featureIndex:{configurable:!0},sourceLayerIndex:{configurable:!0},bucketIndex:{configurable:!0}};return r.featureIndex.get=function(){return this._structArray.uint32[this._pos4+0]},r.sourceLayerIndex.get=function(){return this._structArray.uint16[this._pos2+2]},r.bucketIndex.get=function(){return this._structArray.uint16[this._pos2+3]},Object.defineProperties(e.prototype,r),e}(Ai);io.prototype.size=8;var oo=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.get=function(t){return new io(this,t)},e}(Gi);Fn("FeatureIndexArray",oo);var ao=Ti([{name:"a_pos",components:2,type:"Int16"}],4).members,so=function(t){void 0===t&&(t=[]),this.segments=t};function uo(t,e){return 256*(t=c(Math.floor(t),0,255))+c(Math.floor(e),0,255)}so.prototype.prepareSegment=function(t,e,r,n){var i=this.segments[this.segments.length-1];return t>so.MAX_VERTEX_ARRAY_LENGTH&&S("Max vertices per segment is "+so.MAX_VERTEX_ARRAY_LENGTH+": bucket requested "+t),(!i||i.vertexLength+t>so.MAX_VERTEX_ARRAY_LENGTH||i.sortKey!==n)&&(i={vertexOffset:e.length,primitiveOffset:r.length,vertexLength:0,primitiveLength:0},void 0!==n&&(i.sortKey=n),this.segments.push(i)),i},so.prototype.get=function(){return this.segments},so.prototype.destroy=function(){for(var t=0,e=this.segments;t<e.length;t+=1){var r=e[t];for(var n in r.vaos)r.vaos[n].destroy()}},so.simpleSegment=function(t,e,r,n){return new so([{vertexOffset:t,primitiveOffset:e,vertexLength:r,primitiveLength:n,vaos:{},sortKey:0}])},so.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Fn("SegmentVector",so);var lo=Ti([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]),co=e((function(t){t.exports=function(t,e){var r,n,i,o,a,s,u,l;for(n=t.length-(r=3&t.length),i=e,a=3432918353,s=461845907,l=0;l<n;)u=255&t.charCodeAt(l)|(255&t.charCodeAt(++l))<<8|(255&t.charCodeAt(++l))<<16|(255&t.charCodeAt(++l))<<24,++l,i=27492+(65535&(o=5*(65535&(i=(i^=u=(65535&(u=(u=(65535&u)*a+(((u>>>16)*a&65535)<<16)&4294967295)<<15|u>>>17))*s+(((u>>>16)*s&65535)<<16)&4294967295)<<13|i>>>19))+((5*(i>>>16)&65535)<<16)&4294967295))+((58964+(o>>>16)&65535)<<16);switch(u=0,r){case 3:u^=(255&t.charCodeAt(l+2))<<16;case 2:u^=(255&t.charCodeAt(l+1))<<8;case 1:i^=u=(65535&(u=(u=(65535&(u^=255&t.charCodeAt(l)))*a+(((u>>>16)*a&65535)<<16)&4294967295)<<15|u>>>17))*s+(((u>>>16)*s&65535)<<16)&4294967295}return i^=t.length,i=2246822507*(65535&(i^=i>>>16))+((2246822507*(i>>>16)&65535)<<16)&4294967295,i=3266489909*(65535&(i^=i>>>13))+((3266489909*(i>>>16)&65535)<<16)&4294967295,(i^=i>>>16)>>>0}})),po=e((function(t){t.exports=function(t,e){for(var r,n=t.length,i=e^n,o=0;n>=4;)r=1540483477*(65535&(r=255&t.charCodeAt(o)|(255&t.charCodeAt(++o))<<8|(255&t.charCodeAt(++o))<<16|(255&t.charCodeAt(++o))<<24))+((1540483477*(r>>>16)&65535)<<16),i=1540483477*(65535&i)+((1540483477*(i>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),n-=4,++o;switch(n){case 3:i^=(255&t.charCodeAt(o+2))<<16;case 2:i^=(255&t.charCodeAt(o+1))<<8;case 1:i=1540483477*(65535&(i^=255&t.charCodeAt(o)))+((1540483477*(i>>>16)&65535)<<16)}return i=1540483477*(65535&(i^=i>>>13))+((1540483477*(i>>>16)&65535)<<16),(i^=i>>>15)>>>0}})),ho=co,fo=po;ho.murmur3=co,ho.murmur2=fo;var mo=function(){this.ids=[],this.positions=[],this.indexed=!1};mo.prototype.add=function(t,e,r,n){this.ids.push(go(t)),this.positions.push(e,r,n)},mo.prototype.getPositions=function(t){for(var e=go(t),r=0,n=this.ids.length-1;r<n;){var i=r+n>>1;this.ids[i]>=e?n=i:r=i+1}for(var o=[];this.ids[r]===e;)o.push({index:this.positions[3*r],start:this.positions[3*r+1],end:this.positions[3*r+2]}),r++;return o},mo.serialize=function(t,e){var r=new Float64Array(t.ids),n=new Uint32Array(t.positions);return function t(e,r,n,i){for(;n<i;){for(var o=e[n+i>>1],a=n-1,s=i+1;;){do{a++}while(e[a]<o);do{s--}while(e[s]>o);if(a>=s)break;vo(e,a,s),vo(r,3*a,3*s),vo(r,3*a+1,3*s+1),vo(r,3*a+2,3*s+2)}s-n<i-s?(t(e,r,n,s),n=s+1):(t(e,r,s+1,i),i=s)}}(r,n,0,r.length-1),e&&e.push(r.buffer,n.buffer),{ids:r,positions:n}},mo.deserialize=function(t){var e=new mo;return e.ids=t.ids,e.positions=t.positions,e.indexed=!0,e};var yo=Math.pow(2,53)-1;function go(t){var e=+t;return!isNaN(e)&&e<=yo?e:ho(String(t))}function vo(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}Fn("FeaturePositionMap",mo);var _o=function(t,e){this.gl=t.gl,this.location=e},xo=function(t){function e(e,r){t.call(this,e,r),this.current=0}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.set=function(t){this.current!==t&&(this.current=t,this.gl.uniform1i(this.location,t))},e}(_o),bo=function(t){function e(e,r){t.call(this,e,r),this.current=0}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.set=function(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))},e}(_o),wo=function(t){function e(e,r){t.call(this,e,r),this.current=[0,0]}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.set=function(t){t[0]===this.current[0]&&t[1]===this.current[1]||(this.current=t,this.gl.uniform2f(this.location,t[0],t[1]))},e}(_o),So=function(t){function e(e,r){t.call(this,e,r),this.current=[0,0,0]}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.set=function(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]||(this.current=t,this.gl.uniform3f(this.location,t[0],t[1],t[2]))},e}(_o),Ao=function(t){function e(e,r){t.call(this,e,r),this.current=[0,0,0,0]}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.set=function(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]&&t[3]===this.current[3]||(this.current=t,this.gl.uniform4f(this.location,t[0],t[1],t[2],t[3]))},e}(_o),Eo=function(t){function e(e,r){t.call(this,e,r),this.current=te.transparent}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.set=function(t){t.r===this.current.r&&t.g===this.current.g&&t.b===this.current.b&&t.a===this.current.a||(this.current=t,this.gl.uniform4f(this.location,t.r,t.g,t.b,t.a))},e}(_o),To=new Float32Array(16),ko=function(t){function e(e,r){t.call(this,e,r),this.current=To}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.set=function(t){if(t[12]!==this.current[12]||t[0]!==this.current[0])return this.current=t,void this.gl.uniformMatrix4fv(this.location,!1,t);for(var e=1;e<16;e++)if(t[e]!==this.current[e]){this.current=t,this.gl.uniformMatrix4fv(this.location,!1,t);break}},e}(_o);function Io(t){return[uo(255*t.r,255*t.g),uo(255*t.b,255*t.a)]}var zo=function(t,e,r){this.value=t,this.uniformNames=e.map((function(t){return"u_"+t})),this.type=r};zo.prototype.setUniform=function(t,e,r){t.set(r.constantOr(this.value))},zo.prototype.getBinding=function(t,e,r){return"color"===this.type?new Eo(t,e):new bo(t,e)};var Co=function(t,e){this.uniformNames=e.map((function(t){return"u_"+t})),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1};Co.prototype.setConstantPatternPositions=function(t,e){this.pixelRatioFrom=e.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=e.tlbr,this.patternTo=t.tlbr},Co.prototype.setUniform=function(t,e,r,n){var i="u_pattern_to"===n?this.patternTo:"u_pattern_from"===n?this.patternFrom:"u_pixel_ratio_to"===n?this.pixelRatioTo:"u_pixel_ratio_from"===n?this.pixelRatioFrom:null;i&&t.set(i)},Co.prototype.getBinding=function(t,e,r){return"u_pattern"===r.substr(0,9)?new Ao(t,e):new bo(t,e)};var Po=function(t,e,r,n){this.expression=t,this.type=r,this.maxValue=0,this.paintVertexAttributes=e.map((function(t){return{name:"a_"+t,type:"Float32",components:"color"===r?2:1,offset:0}})),this.paintVertexArray=new n};Po.prototype.populatePaintArray=function(t,e,r,n,i){var o=this.paintVertexArray.length,a=this.expression.evaluate(new si(0),e,{},n,[],i);this.paintVertexArray.resize(t),this._setPaintValue(o,t,a)},Po.prototype.updatePaintArray=function(t,e,r,n){var i=this.expression.evaluate({zoom:0},r,n);this._setPaintValue(t,e,i)},Po.prototype._setPaintValue=function(t,e,r){if("color"===this.type)for(var n=Io(r),i=t;i<e;i++)this.paintVertexArray.emplace(i,n[0],n[1]);else{for(var o=t;o<e;o++)this.paintVertexArray.emplace(o,r);this.maxValue=Math.max(this.maxValue,Math.abs(r))}},Po.prototype.upload=function(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))},Po.prototype.destroy=function(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()};var Mo=function(t,e,r,n,i,o){this.expression=t,this.uniformNames=e.map((function(t){return"u_"+t+"_t"})),this.type=r,this.useIntegerZoom=n,this.zoom=i,this.maxValue=0,this.paintVertexAttributes=e.map((function(t){return{name:"a_"+t,type:"Float32",components:"color"===r?4:2,offset:0}})),this.paintVertexArray=new o};Mo.prototype.populatePaintArray=function(t,e,r,n,i){var o=this.expression.evaluate(new si(this.zoom),e,{},n,[],i),a=this.expression.evaluate(new si(this.zoom+1),e,{},n,[],i),s=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(s,t,o,a)},Mo.prototype.updatePaintArray=function(t,e,r,n){var i=this.expression.evaluate({zoom:this.zoom},r,n),o=this.expression.evaluate({zoom:this.zoom+1},r,n);this._setPaintValue(t,e,i,o)},Mo.prototype._setPaintValue=function(t,e,r,n){if("color"===this.type)for(var i=Io(r),o=Io(n),a=t;a<e;a++)this.paintVertexArray.emplace(a,i[0],i[1],o[0],o[1]);else{for(var s=t;s<e;s++)this.paintVertexArray.emplace(s,r,n);this.maxValue=Math.max(this.maxValue,Math.abs(r),Math.abs(n))}},Mo.prototype.upload=function(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))},Mo.prototype.destroy=function(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()},Mo.prototype.setUniform=function(t,e){var r=this.useIntegerZoom?Math.floor(e.zoom):e.zoom,n=c(this.expression.interpolationFactor(r,this.zoom,this.zoom+1),0,1);t.set(n)},Mo.prototype.getBinding=function(t,e,r){return new bo(t,e)};var Do=function(t,e,r,n,i,o){this.expression=t,this.type=e,this.useIntegerZoom=r,this.zoom=n,this.layerId=o,this.zoomInPaintVertexArray=new i,this.zoomOutPaintVertexArray=new i};Do.prototype.populatePaintArray=function(t,e,r){var n=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(n,t,e.patterns&&e.patterns[this.layerId],r)},Do.prototype.updatePaintArray=function(t,e,r,n,i){this._setPaintValues(t,e,r.patterns&&r.patterns[this.layerId],i)},Do.prototype._setPaintValues=function(t,e,r,n){if(n&&r){var i=n[r.min],o=n[r.mid],a=n[r.max];if(i&&o&&a)for(var s=t;s<e;s++)this.zoomInPaintVertexArray.emplace(s,o.tl[0],o.tl[1],o.br[0],o.br[1],i.tl[0],i.tl[1],i.br[0],i.br[1],o.pixelRatio,i.pixelRatio),this.zoomOutPaintVertexArray.emplace(s,o.tl[0],o.tl[1],o.br[0],o.br[1],a.tl[0],a.tl[1],a.br[0],a.br[1],o.pixelRatio,a.pixelRatio)}},Do.prototype.upload=function(t){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,lo.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,lo.members,this.expression.isStateDependent))},Do.prototype.destroy=function(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()};var Lo=function(t,e,r){this.binders={},this._buffers=[];var n=[];for(var i in t.paint._values)if(r(i)){var o=t.paint.get(i);if(o instanceof di&&Dr(o.property.specification)){var a=Ro(i,t.type),s=o.value,u=o.property.specification.type,l=o.property.useIntegerZoom,c=o.property.specification["property-type"],p="cross-faded"===c||"cross-faded-data-driven"===c;if("constant"===s.kind)this.binders[i]=p?new Co(s.value,a):new zo(s.value,a,u),n.push("/u_"+i);else if("source"===s.kind||p){var h=Oo(i,u,"source");this.binders[i]=p?new Do(s,u,l,e,h,t.id):new Po(s,a,u,h),n.push("/a_"+i)}else{var f=Oo(i,u,"composite");this.binders[i]=new Mo(s,a,u,l,e,f),n.push("/z_"+i)}}}this.cacheKey=n.sort().join("")};Lo.prototype.getMaxValue=function(t){var e=this.binders[t];return e instanceof Po||e instanceof Mo?e.maxValue:0},Lo.prototype.populatePaintArrays=function(t,e,r,n,i){for(var o in this.binders){var a=this.binders[o];(a instanceof Po||a instanceof Mo||a instanceof Do)&&a.populatePaintArray(t,e,r,n,i)}},Lo.prototype.setConstantPatternPositions=function(t,e){for(var r in this.binders){var n=this.binders[r];n instanceof Co&&n.setConstantPatternPositions(t,e)}},Lo.prototype.updatePaintArrays=function(t,e,r,n,i){var o=!1;for(var a in t)for(var s=0,u=e.getPositions(a);s<u.length;s+=1){var l=u[s],c=r.feature(l.index);for(var p in this.binders){var h=this.binders[p];if((h instanceof Po||h instanceof Mo||h instanceof Do)&&!0===h.expression.isStateDependent){var f=n.paint.get(p);h.expression=f.value,h.updatePaintArray(l.start,l.end,c,t[a],i),o=!0}}}return o},Lo.prototype.defines=function(){var t=[];for(var e in this.binders){var r=this.binders[e];(r instanceof zo||r instanceof Co)&&t.push.apply(t,r.uniformNames.map((function(t){return"#define HAS_UNIFORM_"+t})))}return t},Lo.prototype.getBinderAttributes=function(){var t=[];for(var e in this.binders){var r=this.binders[e];if(r instanceof Po||r instanceof Mo)for(var n=0;n<r.paintVertexAttributes.length;n++)t.push(r.paintVertexAttributes[n].name);else if(r instanceof Do)for(var i=0;i<lo.members.length;i++)t.push(lo.members[i].name)}return t},Lo.prototype.getBinderUniforms=function(){var t=[];for(var e in this.binders){var r=this.binders[e];if(r instanceof zo||r instanceof Co||r instanceof Mo)for(var n=0,i=r.uniformNames;n<i.length;n+=1)t.push(i[n])}return t},Lo.prototype.getPaintVertexBuffers=function(){return this._buffers},Lo.prototype.getUniforms=function(t,e){var r=[];for(var n in this.binders){var i=this.binders[n];if(i instanceof zo||i instanceof Co||i instanceof Mo)for(var o=0,a=i.uniformNames;o<a.length;o+=1){var s=a[o];if(e[s]){var u=i.getBinding(t,e[s],s);r.push({name:s,property:n,binding:u})}}}return r},Lo.prototype.setUniforms=function(t,e,r,n){for(var i=0,o=e;i<o.length;i+=1){var a=o[i],s=a.name,u=a.property;this.binders[u].setUniform(a.binding,n,r.get(u),s)}},Lo.prototype.updatePaintBuffers=function(t){for(var e in this._buffers=[],this.binders){var r=this.binders[e];if(t&&r instanceof Do){var n=2===t.fromScale?r.zoomInPaintVertexBuffer:r.zoomOutPaintVertexBuffer;n&&this._buffers.push(n)}else(r instanceof Po||r instanceof Mo)&&r.paintVertexBuffer&&this._buffers.push(r.paintVertexBuffer)}},Lo.prototype.upload=function(t){for(var e in this.binders){var r=this.binders[e];(r instanceof Po||r instanceof Mo||r instanceof Do)&&r.upload(t)}this.updatePaintBuffers()},Lo.prototype.destroy=function(){for(var t in this.binders){var e=this.binders[t];(e instanceof Po||e instanceof Mo||e instanceof Do)&&e.destroy()}};var Bo=function(t,e,r){void 0===r&&(r=function(){return!0}),this.programConfigurations={};for(var n=0,i=t;n<i.length;n+=1){var o=i[n];this.programConfigurations[o.id]=new Lo(o,e,r)}this.needsUpload=!1,this._featureMap=new mo,this._bufferOffset=0};function Ro(t,e){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[t]||[t.replace(e+"-","").replace(/-/g,"_")]}function Oo(t,e,r){var n={color:{source:Mi,composite:Hi},number:{source:$i,composite:Mi}},i=function(t){return{"line-pattern":{source:Di,composite:Di},"fill-pattern":{source:Di,composite:Di},"fill-extrusion-pattern":{source:Di,composite:Di}}[t]}(t);return i&&i[r]||n[e][r]}Bo.prototype.populatePaintArrays=function(t,e,r,n,i,o){for(var a in this.programConfigurations)this.programConfigurations[a].populatePaintArrays(t,e,n,i,o);void 0!==e.id&&this._featureMap.add(e.id,r,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0},Bo.prototype.updatePaintArrays=function(t,e,r,n){for(var i=0,o=r;i<o.length;i+=1){var a=o[i];this.needsUpload=this.programConfigurations[a.id].updatePaintArrays(t,this._featureMap,e,a,n)||this.needsUpload}},Bo.prototype.get=function(t){return this.programConfigurations[t]},Bo.prototype.upload=function(t){if(this.needsUpload){for(var e in this.programConfigurations)this.programConfigurations[e].upload(t);this.needsUpload=!1}},Bo.prototype.destroy=function(){for(var t in this.programConfigurations)this.programConfigurations[t].destroy()},Fn("ConstantBinder",zo),Fn("CrossFadedConstantBinder",Co),Fn("SourceExpressionBinder",Po),Fn("CrossFadedCompositeBinder",Do),Fn("CompositeExpressionBinder",Mo),Fn("ProgramConfiguration",Lo,{omit:["_buffers"]}),Fn("ProgramConfigurationSet",Bo);var Fo=Math.pow(2,14)-1,Vo=-Fo-1;function Uo(t){for(var e=8192/t.extent,r=t.loadGeometry(),n=0;n<r.length;n++)for(var i=r[n],o=0;o<i.length;o++){var a=i[o],s=Math.round(a.x*e),u=Math.round(a.y*e);a.x=c(s,Vo,Fo),a.y=c(u,Vo,Fo),(s<a.x||s>a.x+1||u<a.y||u>a.y+1)&&S("Geometry exceeds allowed extent, reduce your vector tile buffer size")}return r}function jo(t,e){return{type:t.type,id:t.id,properties:t.properties,geometry:e?Uo(t):[]}}function No(t,e,r,n,i){t.emplaceBack(2*e+(n+1)/2,2*r+(i+1)/2)}var qo=function(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((function(t){return t.id})),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new Ii,this.indexArray=new ji,this.segments=new so,this.programConfigurations=new Bo(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter((function(t){return t.isStateDependent()})).map((function(t){return t.id}))};function $o(t,e){for(var r=0;r<t.length;r++)if(Qo(e,t[r]))return!0;for(var n=0;n<e.length;n++)if(Qo(t,e[n]))return!0;return!!Xo(t,e)}function Zo(t,e,r){return!!Qo(t,e)||!!Ko(e,t,r)}function Go(t,e){if(1===t.length)return Jo(e,t[0]);for(var r=0;r<e.length;r++)for(var n=e[r],i=0;i<n.length;i++)if(Qo(t,n[i]))return!0;for(var o=0;o<t.length;o++)if(Jo(e,t[o]))return!0;for(var a=0;a<e.length;a++)if(Xo(t,e[a]))return!0;return!1}function Wo(t,e,r){if(t.length>1){if(Xo(t,e))return!0;for(var n=0;n<e.length;n++)if(Ko(e[n],t,r))return!0}for(var i=0;i<t.length;i++)if(Ko(t[i],e,r))return!0;return!1}function Xo(t,e){if(0===t.length||0===e.length)return!1;for(var r=0;r<t.length-1;r++)for(var n=t[r],i=t[r+1],o=0;o<e.length-1;o++)if(Ho(n,i,e[o],e[o+1]))return!0;return!1}function Ho(t,e,r,n){return A(t,r,n)!==A(e,r,n)&&A(t,e,r)!==A(t,e,n)}function Ko(t,e,r){var n=r*r;if(1===e.length)return t.distSqr(e[0])<n;for(var i=1;i<e.length;i++)if(Yo(t,e[i-1],e[i])<n)return!0;return!1}function Yo(t,e,r){var n=e.distSqr(r);if(0===n)return t.distSqr(e);var i=((t.x-e.x)*(r.x-e.x)+(t.y-e.y)*(r.y-e.y))/n;return t.distSqr(i<0?e:i>1?r:r.sub(e)._mult(i)._add(e))}function Jo(t,e){for(var r,n,i,o=!1,a=0;a<t.length;a++)for(var s=0,u=(r=t[a]).length-1;s<r.length;u=s++)(n=r[s]).y>e.y!=(i=r[u]).y>e.y&&e.x<(i.x-n.x)*(e.y-n.y)/(i.y-n.y)+n.x&&(o=!o);return o}function Qo(t,e){for(var r=!1,n=0,i=t.length-1;n<t.length;i=n++){var o=t[n],a=t[i];o.y>e.y!=a.y>e.y&&e.x<(a.x-o.x)*(e.y-o.y)/(a.y-o.y)+o.x&&(r=!r)}return r}function ta(t,e,r){var n=r[0],i=r[2];if(t.x<n.x&&e.x<n.x||t.x>i.x&&e.x>i.x||t.y<n.y&&e.y<n.y||t.y>i.y&&e.y>i.y)return!1;var o=A(t,e,r[0]);return o!==A(t,e,r[1])||o!==A(t,e,r[2])||o!==A(t,e,r[3])}function ea(t,e,r){var n=e.paint.get(t).value;return"constant"===n.kind?n.value:r.programConfigurations.get(e.id).getMaxValue(t)}function ra(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function na(t,e,r,n,o){if(!e[0]&&!e[1])return t;var a=i.convert(e)._mult(o);"viewport"===r&&a._rotate(-n);for(var s=[],u=0;u<t.length;u++)s.push(t[u].sub(a));return s}qo.prototype.populate=function(t,e,r){var n=this.layers[0],i=[],o=null;"circle"===n.type&&(o=n.layout.get("circle-sort-key"));for(var a=0,s=t;a<s.length;a+=1){var u=s[a],l=u.feature,c=u.id,p=u.index,h=u.sourceLayerIndex,f=this.layers[0]._featureFilter.needGeometry,d=jo(l,f);if(this.layers[0]._featureFilter.filter(new si(this.zoom),d,r)){var m=o?o.evaluate(d,{},r):void 0,y={id:c,properties:l.properties,type:l.type,sourceLayerIndex:h,index:p,geometry:f?d.geometry:Uo(l),patterns:{},sortKey:m};i.push(y)}}o&&i.sort((function(t,e){return t.sortKey-e.sortKey}));for(var g=0,v=i;g<v.length;g+=1){var _=v[g],x=_.geometry,b=_.index,w=_.sourceLayerIndex,S=t[b].feature;this.addFeature(_,x,b,r),e.featureIndex.insert(S,x,b,w,this.index)}},qo.prototype.update=function(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r)},qo.prototype.isEmpty=function(){return 0===this.layoutVertexArray.length},qo.prototype.uploadPending=function(){return!this.uploaded||this.programConfigurations.needsUpload},qo.prototype.upload=function(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,ao),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0},qo.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())},qo.prototype.addFeature=function(t,e,r,n){for(var i=0,o=e;i<o.length;i+=1)for(var a=0,s=o[i];a<s.length;a+=1){var u=s[a],l=u.x,c=u.y;if(!(l<0||l>=8192||c<0||c>=8192)){var p=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,t.sortKey),h=p.vertexLength;No(this.layoutVertexArray,l,c,-1,-1),No(this.layoutVertexArray,l,c,1,-1),No(this.layoutVertexArray,l,c,1,1),No(this.layoutVertexArray,l,c,-1,1),this.indexArray.emplaceBack(h,h+1,h+2),this.indexArray.emplaceBack(h,h+3,h+2),p.vertexLength+=4,p.primitiveLength+=2}}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{},n)},Fn("CircleBucket",qo,{omit:["layers"]});var ia=new bi({"circle-sort-key":new gi(zt.layout_circle["circle-sort-key"])}),oa={paint:new bi({"circle-radius":new gi(zt.paint_circle["circle-radius"]),"circle-color":new gi(zt.paint_circle["circle-color"]),"circle-blur":new gi(zt.paint_circle["circle-blur"]),"circle-opacity":new gi(zt.paint_circle["circle-opacity"]),"circle-translate":new yi(zt.paint_circle["circle-translate"]),"circle-translate-anchor":new yi(zt.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new yi(zt.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new yi(zt.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new gi(zt.paint_circle["circle-stroke-width"]),"circle-stroke-color":new gi(zt.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new gi(zt.paint_circle["circle-stroke-opacity"])}),layout:ia},aa="undefined"!=typeof Float32Array?Float32Array:Array;function sa(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function ua(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=e[4],u=e[5],l=e[6],c=e[7],p=e[8],h=e[9],f=e[10],d=e[11],m=e[12],y=e[13],g=e[14],v=e[15],_=r[0],x=r[1],b=r[2],w=r[3];return t[0]=_*n+x*s+b*p+w*m,t[1]=_*i+x*u+b*h+w*y,t[2]=_*o+x*l+b*f+w*g,t[3]=_*a+x*c+b*d+w*v,t[4]=(_=r[4])*n+(x=r[5])*s+(b=r[6])*p+(w=r[7])*m,t[5]=_*i+x*u+b*h+w*y,t[6]=_*o+x*l+b*f+w*g,t[7]=_*a+x*c+b*d+w*v,t[8]=(_=r[8])*n+(x=r[9])*s+(b=r[10])*p+(w=r[11])*m,t[9]=_*i+x*u+b*h+w*y,t[10]=_*o+x*l+b*f+w*g,t[11]=_*a+x*c+b*d+w*v,t[12]=(_=r[12])*n+(x=r[13])*s+(b=r[14])*p+(w=r[15])*m,t[13]=_*i+x*u+b*h+w*y,t[14]=_*o+x*l+b*f+w*g,t[15]=_*a+x*c+b*d+w*v,t}Math.hypot||(Math.hypot=function(){for(var t=arguments,e=0,r=arguments.length;r--;)e+=t[r]*t[r];return Math.sqrt(e)});var la,ca=ua;function pa(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3];return t[0]=r[0]*n+r[4]*i+r[8]*o+r[12]*a,t[1]=r[1]*n+r[5]*i+r[9]*o+r[13]*a,t[2]=r[2]*n+r[6]*i+r[10]*o+r[14]*a,t[3]=r[3]*n+r[7]*i+r[11]*o+r[15]*a,t}la=new aa(3),aa!=Float32Array&&(la[0]=0,la[1]=0,la[2]=0),function(){var t=new aa(4);aa!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0)}();var ha=(function(){var t=new aa(2);aa!=Float32Array&&(t[0]=0,t[1]=0)}(),function(t){function e(e){t.call(this,e,oa)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.createBucket=function(t){return new qo(t)},e.prototype.queryRadius=function(t){var e=t;return ea("circle-radius",this,e)+ea("circle-stroke-width",this,e)+ra(this.paint.get("circle-translate"))},e.prototype.queryIntersectsFeature=function(t,e,r,n,i,o,a,s){for(var u=na(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),o.angle,a),l=this.paint.get("circle-radius").evaluate(e,r)+this.paint.get("circle-stroke-width").evaluate(e,r),c="map"===this.paint.get("circle-pitch-alignment"),p=c?u:function(t,e){return t.map((function(t){return fa(t,e)}))}(u,s),h=c?l*a:l,f=0,d=n;f<d.length;f+=1)for(var m=0,y=d[f];m<y.length;m+=1){var g=y[m],v=c?g:fa(g,s),_=h,x=pa([],[g.x,g.y,0,1],s);if("viewport"===this.paint.get("circle-pitch-scale")&&"map"===this.paint.get("circle-pitch-alignment")?_*=x[3]/o.cameraToCenterDistance:"map"===this.paint.get("circle-pitch-scale")&&"viewport"===this.paint.get("circle-pitch-alignment")&&(_*=o.cameraToCenterDistance/x[3]),Zo(p,v,_))return!0}return!1},e}(wi));function fa(t,e){var r=pa([],[t.x,t.y,0,1],e);return new i(r[0]/r[3],r[1]/r[3])}var da=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(qo);function ma(t,e,r,n){var i=e.width,o=e.height;if(n){if(n instanceof Uint8ClampedArray)n=new Uint8Array(n.buffer);else if(n.length!==i*o*r)throw new RangeError("mismatched image size")}else n=new Uint8Array(i*o*r);return t.width=i,t.height=o,t.data=n,t}function ya(t,e,r){var n=e.width,i=e.height;if(n!==t.width||i!==t.height){var o=ma({},{width:n,height:i},r);ga(t,o,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,n),height:Math.min(t.height,i)},r),t.width=n,t.height=i,t.data=o.data}}function ga(t,e,r,n,i,o){if(0===i.width||0===i.height)return e;if(i.width>t.width||i.height>t.height||r.x>t.width-i.width||r.y>t.height-i.height)throw new RangeError("out of range source coordinates for image copy");if(i.width>e.width||i.height>e.height||n.x>e.width-i.width||n.y>e.height-i.height)throw new RangeError("out of range destination coordinates for image copy");for(var a=t.data,s=e.data,u=0;u<i.height;u++)for(var l=((r.y+u)*t.width+r.x)*o,c=((n.y+u)*e.width+n.x)*o,p=0;p<i.width*o;p++)s[c+p]=a[l+p];return e}Fn("HeatmapBucket",da,{omit:["layers"]});var va=function(t,e){ma(this,t,1,e)};va.prototype.resize=function(t){ya(this,t,1)},va.prototype.clone=function(){return new va({width:this.width,height:this.height},new Uint8Array(this.data))},va.copy=function(t,e,r,n,i){ga(t,e,r,n,i,1)};var _a=function(t,e){ma(this,t,4,e)};_a.prototype.resize=function(t){ya(this,t,4)},_a.prototype.replace=function(t,e){e?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t},_a.prototype.clone=function(){return new _a({width:this.width,height:this.height},new Uint8Array(this.data))},_a.copy=function(t,e,r,n,i){ga(t,e,r,n,i,4)},Fn("AlphaImage",va),Fn("RGBAImage",_a);var xa={paint:new bi({"heatmap-radius":new gi(zt.paint_heatmap["heatmap-radius"]),"heatmap-weight":new gi(zt.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new yi(zt.paint_heatmap["heatmap-intensity"]),"heatmap-color":new xi(zt.paint_heatmap["heatmap-color"]),"heatmap-opacity":new yi(zt.paint_heatmap["heatmap-opacity"])})};function ba(t){var e={},r=t.resolution||256,n=t.clips?t.clips.length:1,i=t.image||new _a({width:r,height:n}),o=function(r,n,o){e[t.evaluationKey]=o;var a=t.expression.evaluate(e);i.data[r+n+0]=Math.floor(255*a.r/a.a),i.data[r+n+1]=Math.floor(255*a.g/a.a),i.data[r+n+2]=Math.floor(255*a.b/a.a),i.data[r+n+3]=Math.floor(255*a.a)};if(t.clips)for(var a=0,s=0;a<n;++a,s+=4*r)for(var u=0,l=0;u<r;u++,l+=4){var c=u/(r-1),p=t.clips[a];o(s,l,p.start*(1-c)+p.end*c)}else for(var h=0,f=0;h<r;h++,f+=4)o(0,f,h/(r-1));return i}var wa=function(t){function e(e){t.call(this,e,xa),this._updateColorRamp()}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.createBucket=function(t){return new da(t)},e.prototype._handleSpecialPaintPropertyUpdate=function(t){"heatmap-color"===t&&this._updateColorRamp()},e.prototype._updateColorRamp=function(){this.colorRamp=ba({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null},e.prototype.resize=function(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)},e.prototype.queryRadius=function(){return 0},e.prototype.queryIntersectsFeature=function(){return!1},e.prototype.hasOffscreenPass=function(){return 0!==this.paint.get("heatmap-opacity")&&"none"!==this.visibility},e}(wi),Sa={paint:new bi({"hillshade-illumination-direction":new yi(zt.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new yi(zt.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new yi(zt.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new yi(zt.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new yi(zt.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new yi(zt.paint_hillshade["hillshade-accent-color"])})},Aa=function(t){function e(e){t.call(this,e,Sa)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.hasOffscreenPass=function(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility},e}(wi),Ea=Ti([{name:"a_pos",components:2,type:"Int16"}],4).members,Ta=Ia,ka=Ia;function Ia(t,e,r){r=r||2;var n,i,o,a,s,u,l,c=e&&e.length,p=c?e[0]*r:t.length,h=za(t,0,p,r,!0),f=[];if(!h||h.next===h.prev)return f;if(c&&(h=function(t,e,r,n){var i,o,a,s=[];for(i=0,o=e.length;i<o;i++)(a=za(t,e[i]*n,i<o-1?e[i+1]*n:t.length,n,!1))===a.next&&(a.steiner=!0),s.push(Ua(a));for(s.sort(Ra),i=0;i<s.length;i++)Oa(s[i],r),r=Ca(r,r.next);return r}(t,e,h,r)),t.length>80*r){n=o=t[0],i=a=t[1];for(var d=r;d<p;d+=r)(s=t[d])<n&&(n=s),(u=t[d+1])<i&&(i=u),s>o&&(o=s),u>a&&(a=u);l=0!==(l=Math.max(o-n,a-i))?1/l:0}return Pa(h,f,r,n,i,l),f}function za(t,e,r,n,i){var o,a;if(i===Qa(t,e,r,n)>0)for(o=e;o<r;o+=n)a=Ka(o,t[o],t[o+1],a);else for(o=r-n;o>=e;o-=n)a=Ka(o,t[o],t[o+1],a);return a&&$a(a,a.next)&&(Ya(a),a=a.next),a}function Ca(t,e){if(!t)return t;e||(e=t);var r,n=t;do{if(r=!1,n.steiner||!$a(n,n.next)&&0!==qa(n.prev,n,n.next))n=n.next;else{if(Ya(n),(n=e=n.prev)===n.next)break;r=!0}}while(r||n!==e);return e}function Pa(t,e,r,n,i,o,a){if(t){!a&&o&&function(t,e,r,n){var i=t;do{null===i.z&&(i.z=Va(i.x,i.y,e,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){var e,r,n,i,o,a,s,u,l=1;do{for(r=t,t=null,o=null,a=0;r;){for(a++,n=r,s=0,e=0;e<l&&(s++,n=n.nextZ);e++);for(u=l;s>0||u>0&&n;)0!==s&&(0===u||!n||r.z<=n.z)?(i=r,r=r.nextZ,s--):(i=n,n=n.nextZ,u--),o?o.nextZ=i:t=i,i.prevZ=o,o=i;r=n}o.nextZ=null,l*=2}while(a>1)}(i)}(t,n,i,o);for(var s,u,l=t;t.prev!==t.next;)if(s=t.prev,u=t.next,o?Da(t,n,i,o):Ma(t))e.push(s.i/r),e.push(t.i/r),e.push(u.i/r),Ya(t),t=u.next,l=u.next;else if((t=u)===l){a?1===a?Pa(t=La(Ca(t),e,r),e,r,n,i,o,2):2===a&&Ba(t,e,r,n,i,o):Pa(Ca(t),e,r,n,i,o,1);break}}}function Ma(t){var e=t.prev,r=t,n=t.next;if(qa(e,r,n)>=0)return!1;for(var i=t.next.next;i!==t.prev;){if(ja(e.x,e.y,r.x,r.y,n.x,n.y,i.x,i.y)&&qa(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function Da(t,e,r,n){var i=t.prev,o=t,a=t.next;if(qa(i,o,a)>=0)return!1;for(var s=i.x>o.x?i.x>a.x?i.x:a.x:o.x>a.x?o.x:a.x,u=i.y>o.y?i.y>a.y?i.y:a.y:o.y>a.y?o.y:a.y,l=Va(i.x<o.x?i.x<a.x?i.x:a.x:o.x<a.x?o.x:a.x,i.y<o.y?i.y<a.y?i.y:a.y:o.y<a.y?o.y:a.y,e,r,n),c=Va(s,u,e,r,n),p=t.prevZ,h=t.nextZ;p&&p.z>=l&&h&&h.z<=c;){if(p!==t.prev&&p!==t.next&&ja(i.x,i.y,o.x,o.y,a.x,a.y,p.x,p.y)&&qa(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,h!==t.prev&&h!==t.next&&ja(i.x,i.y,o.x,o.y,a.x,a.y,h.x,h.y)&&qa(h.prev,h,h.next)>=0)return!1;h=h.nextZ}for(;p&&p.z>=l;){if(p!==t.prev&&p!==t.next&&ja(i.x,i.y,o.x,o.y,a.x,a.y,p.x,p.y)&&qa(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;h&&h.z<=c;){if(h!==t.prev&&h!==t.next&&ja(i.x,i.y,o.x,o.y,a.x,a.y,h.x,h.y)&&qa(h.prev,h,h.next)>=0)return!1;h=h.nextZ}return!0}function La(t,e,r){var n=t;do{var i=n.prev,o=n.next.next;!$a(i,o)&&Za(i,n,n.next,o)&&Xa(i,o)&&Xa(o,i)&&(e.push(i.i/r),e.push(n.i/r),e.push(o.i/r),Ya(n),Ya(n.next),n=t=o),n=n.next}while(n!==t);return Ca(n)}function Ba(t,e,r,n,i,o){var a=t;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&Na(a,s)){var u=Ha(a,s);return a=Ca(a,a.next),u=Ca(u,u.next),Pa(a,e,r,n,i,o),void Pa(u,e,r,n,i,o)}s=s.next}a=a.next}while(a!==t)}function Ra(t,e){return t.x-e.x}function Oa(t,e){if(e=function(t,e){var r,n=e,i=t.x,o=t.y,a=-1/0;do{if(o<=n.y&&o>=n.next.y&&n.next.y!==n.y){var s=n.x+(o-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(s<=i&&s>a){if(a=s,s===i){if(o===n.y)return n;if(o===n.next.y)return n.next}r=n.x<n.next.x?n:n.next}}n=n.next}while(n!==e);if(!r)return null;if(i===a)return r;var u,l=r,c=r.x,p=r.y,h=1/0;n=r;do{i>=n.x&&n.x>=c&&i!==n.x&&ja(o<p?i:a,o,c,p,o<p?a:i,o,n.x,n.y)&&(u=Math.abs(o-n.y)/(i-n.x),Xa(n,t)&&(u<h||u===h&&(n.x>r.x||n.x===r.x&&Fa(r,n)))&&(r=n,h=u)),n=n.next}while(n!==l);return r}(t,e)){var r=Ha(e,t);Ca(e,e.next),Ca(r,r.next)}}function Fa(t,e){return qa(t.prev,t,e.prev)<0&&qa(e.next,t,t.next)<0}function Va(t,e,r,n,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*i)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*i)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Ua(t){var e=t,r=t;do{(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next}while(e!==t);return r}function ja(t,e,r,n,i,o,a,s){return(i-a)*(e-s)-(t-a)*(o-s)>=0&&(t-a)*(n-s)-(r-a)*(e-s)>=0&&(r-a)*(o-s)-(i-a)*(n-s)>=0}function Na(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&Za(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(t,e)&&(Xa(t,e)&&Xa(e,t)&&function(t,e){var r=t,n=!1,i=(t.x+e.x)/2,o=(t.y+e.y)/2;do{r.y>o!=r.next.y>o&&r.next.y!==r.y&&i<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next}while(r!==t);return n}(t,e)&&(qa(t.prev,t,e.prev)||qa(t,e.prev,e))||$a(t,e)&&qa(t.prev,t,t.next)>0&&qa(e.prev,e,e.next)>0)}function qa(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function $a(t,e){return t.x===e.x&&t.y===e.y}function Za(t,e,r,n){var i=Wa(qa(t,e,r)),o=Wa(qa(t,e,n)),a=Wa(qa(r,n,t)),s=Wa(qa(r,n,e));return i!==o&&a!==s||!(0!==i||!Ga(t,r,e))||!(0!==o||!Ga(t,n,e))||!(0!==a||!Ga(r,t,n))||!(0!==s||!Ga(r,e,n))}function Ga(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function Wa(t){return t>0?1:t<0?-1:0}function Xa(t,e){return qa(t.prev,t,t.next)<0?qa(t,e,t.next)>=0&&qa(t,t.prev,e)>=0:qa(t,e,t.prev)<0||qa(t,t.next,e)<0}function Ha(t,e){var r=new Ja(t.i,t.x,t.y),n=new Ja(e.i,e.x,e.y),i=t.next,o=e.prev;return t.next=e,e.prev=t,r.next=i,i.prev=r,n.next=r,r.prev=n,o.next=n,n.prev=o,n}function Ka(t,e,r,n){var i=new Ja(t,e,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function Ya(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Ja(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Qa(t,e,r,n){for(var i=0,o=e,a=r-n;o<r;o+=n)i+=(t[a]-t[o])*(t[o+1]+t[a+1]),a=o;return i}function ts(t,e,r,n,i){!function t(e,r,n,i,o){for(;i>n;){if(i-n>600){var a=i-n+1,s=r-n+1,u=Math.log(a),l=.5*Math.exp(2*u/3),c=.5*Math.sqrt(u*l*(a-l)/a)*(s-a/2<0?-1:1);t(e,r,Math.max(n,Math.floor(r-s*l/a+c)),Math.min(i,Math.floor(r+(a-s)*l/a+c)),o)}var p=e[r],h=n,f=i;for(es(e,n,r),o(e[i],p)>0&&es(e,n,i);h<f;){for(es(e,h,f),h++,f--;o(e[h],p)<0;)h++;for(;o(e[f],p)>0;)f--}0===o(e[n],p)?es(e,n,f):es(e,++f,i),f<=r&&(n=f+1),r<=f&&(i=f-1)}}(t,e,r||0,n||t.length-1,i||rs)}function es(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function rs(t,e){return t<e?-1:t>e?1:0}function ns(t,e){var r=t.length;if(r<=1)return[t];for(var n,i,o=[],a=0;a<r;a++){var s=E(t[a]);0!==s&&(t[a].area=Math.abs(s),void 0===i&&(i=s<0),i===s<0?(n&&o.push(n),n=[t[a]]):n.push(t[a]))}if(n&&o.push(n),e>1)for(var u=0;u<o.length;u++)o[u].length<=e||(ts(o[u],e,1,o[u].length-1,is),o[u]=o[u].slice(0,e));return o}function is(t,e){return e.area-t.area}function os(t,e,r){for(var n=r.patternDependencies,i=!1,o=0,a=e;o<a.length;o+=1){var s=a[o].paint.get(t+"-pattern");s.isConstant()||(i=!0);var u=s.constantOr(null);u&&(i=!0,n[u.to]=!0,n[u.from]=!0)}return i}function as(t,e,r,n,i){for(var o=i.patternDependencies,a=0,s=e;a<s.length;a+=1){var u=s[a],l=u.paint.get(t+"-pattern").value;if("constant"!==l.kind){var c=l.evaluate({zoom:n-1},r,{},i.availableImages),p=l.evaluate({zoom:n},r,{},i.availableImages),h=l.evaluate({zoom:n+1},r,{},i.availableImages);p=p&&p.name?p.name:p,h=h&&h.name?h.name:h,o[c=c&&c.name?c.name:c]=!0,o[p]=!0,o[h]=!0,r.patterns[u.id]={min:c,mid:p,max:h}}}return r}Ia.deviation=function(t,e,r,n){var i=e&&e.length,o=Math.abs(Qa(t,0,i?e[0]*r:t.length,r));if(i)for(var a=0,s=e.length;a<s;a++)o-=Math.abs(Qa(t,e[a]*r,a<s-1?e[a+1]*r:t.length,r));var u=0;for(a=0;a<n.length;a+=3){var l=n[a]*r,c=n[a+1]*r,p=n[a+2]*r;u+=Math.abs((t[l]-t[p])*(t[c+1]-t[l+1])-(t[l]-t[c])*(t[p+1]-t[l+1]))}return 0===o&&0===u?0:Math.abs((u-o)/o)},Ia.flatten=function(t){for(var e=t[0][0].length,r={vertices:[],holes:[],dimensions:e},n=0,i=0;i<t.length;i++){for(var o=0;o<t[i].length;o++)for(var a=0;a<e;a++)r.vertices.push(t[i][o][a]);i>0&&r.holes.push(n+=t[i-1].length)}return r},Ta.default=ka;var ss=function(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((function(t){return t.id})),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Ii,this.indexArray=new ji,this.indexArray2=new Wi,this.programConfigurations=new Bo(t.layers,t.zoom),this.segments=new so,this.segments2=new so,this.stateDependentLayerIds=this.layers.filter((function(t){return t.isStateDependent()})).map((function(t){return t.id}))};ss.prototype.populate=function(t,e,r){this.hasPattern=os("fill",this.layers,e);for(var n=this.layers[0].layout.get("fill-sort-key"),i=[],o=0,a=t;o<a.length;o+=1){var s=a[o],u=s.feature,l=s.id,c=s.index,p=s.sourceLayerIndex,h=this.layers[0]._featureFilter.needGeometry,f=jo(u,h);if(this.layers[0]._featureFilter.filter(new si(this.zoom),f,r)){var d=n?n.evaluate(f,{},r,e.availableImages):void 0,m={id:l,properties:u.properties,type:u.type,sourceLayerIndex:p,index:c,geometry:h?f.geometry:Uo(u),patterns:{},sortKey:d};i.push(m)}}n&&i.sort((function(t,e){return t.sortKey-e.sortKey}));for(var y=0,g=i;y<g.length;y+=1){var v=g[y],_=v.geometry,x=v.index,b=v.sourceLayerIndex;if(this.hasPattern){var w=as("fill",this.layers,v,this.zoom,e);this.patternFeatures.push(w)}else this.addFeature(v,_,x,r,{});e.featureIndex.insert(t[x].feature,_,x,b,this.index)}},ss.prototype.update=function(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r)},ss.prototype.addFeatures=function(t,e,r){for(var n=0,i=this.patternFeatures;n<i.length;n+=1){var o=i[n];this.addFeature(o,o.geometry,o.index,e,r)}},ss.prototype.isEmpty=function(){return 0===this.layoutVertexArray.length},ss.prototype.uploadPending=function(){return!this.uploaded||this.programConfigurations.needsUpload},ss.prototype.upload=function(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Ea),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),this.uploaded=!0},ss.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())},ss.prototype.addFeature=function(t,e,r,n,i){for(var o=0,a=ns(e,500);o<a.length;o+=1){for(var s=a[o],u=0,l=0,c=s;l<c.length;l+=1)u+=c[l].length;for(var p=this.segments.prepareSegment(u,this.layoutVertexArray,this.indexArray),h=p.vertexLength,f=[],d=[],m=0,y=s;m<y.length;m+=1){var g=y[m];if(0!==g.length){g!==s[0]&&d.push(f.length/2);var v=this.segments2.prepareSegment(g.length,this.layoutVertexArray,this.indexArray2),_=v.vertexLength;this.layoutVertexArray.emplaceBack(g[0].x,g[0].y),this.indexArray2.emplaceBack(_+g.length-1,_),f.push(g[0].x),f.push(g[0].y);for(var x=1;x<g.length;x++)this.layoutVertexArray.emplaceBack(g[x].x,g[x].y),this.indexArray2.emplaceBack(_+x-1,_+x),f.push(g[x].x),f.push(g[x].y);v.vertexLength+=g.length,v.primitiveLength+=g.length}}for(var b=Ta(f,d),w=0;w<b.length;w+=3)this.indexArray.emplaceBack(h+b[w],h+b[w+1],h+b[w+2]);p.vertexLength+=u,p.primitiveLength+=b.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,i,n)},Fn("FillBucket",ss,{omit:["layers","patternFeatures"]});var us=new bi({"fill-sort-key":new gi(zt.layout_fill["fill-sort-key"])}),ls={paint:new bi({"fill-antialias":new yi(zt.paint_fill["fill-antialias"]),"fill-opacity":new gi(zt.paint_fill["fill-opacity"]),"fill-color":new gi(zt.paint_fill["fill-color"]),"fill-outline-color":new gi(zt.paint_fill["fill-outline-color"]),"fill-translate":new yi(zt.paint_fill["fill-translate"]),"fill-translate-anchor":new yi(zt.paint_fill["fill-translate-anchor"]),"fill-pattern":new vi(zt.paint_fill["fill-pattern"])}),layout:us},cs=function(t){function e(e){t.call(this,e,ls)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.recalculate=function(e,r){t.prototype.recalculate.call(this,e,r);var n=this.paint._values["fill-outline-color"];"constant"===n.value.kind&&void 0===n.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])},e.prototype.createBucket=function(t){return new ss(t)},e.prototype.queryRadius=function(){return ra(this.paint.get("fill-translate"))},e.prototype.queryIntersectsFeature=function(t,e,r,n,i,o,a){return Go(na(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),o.angle,a),n)},e.prototype.isTileClipped=function(){return!0},e}(wi),ps=Ti([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4).members,hs=fs;function fs(t,e,r,n,i){this.properties={},this.extent=r,this.type=0,this._pbf=t,this._geometry=-1,this._keys=n,this._values=i,t.readFields(ds,this,e)}function ds(t,e,r){1==t?e.id=r.readVarint():2==t?function(t,e){for(var r=t.readVarint()+t.pos;t.pos<r;){var n=e._keys[t.readVarint()],i=e._values[t.readVarint()];e.properties[n]=i}}(r,e):3==t?e.type=r.readVarint():4==t&&(e._geometry=r.pos)}function ms(t){for(var e,r,n=0,i=0,o=t.length,a=o-1;i<o;a=i++)n+=((r=t[a]).x-(e=t[i]).x)*(e.y+r.y);return n}fs.types=["Unknown","Point","LineString","Polygon"],fs.prototype.loadGeometry=function(){var t=this._pbf;t.pos=this._geometry;for(var e,r=t.readVarint()+t.pos,n=1,o=0,a=0,s=0,u=[];t.pos<r;){if(o<=0){var l=t.readVarint();n=7&l,o=l>>3}if(o--,1===n||2===n)a+=t.readSVarint(),s+=t.readSVarint(),1===n&&(e&&u.push(e),e=[]),e.push(new i(a,s));else{if(7!==n)throw new Error("unknown command "+n);e&&e.push(e[0].clone())}}return e&&u.push(e),u},fs.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,r=1,n=0,i=0,o=0,a=1/0,s=-1/0,u=1/0,l=-1/0;t.pos<e;){if(n<=0){var c=t.readVarint();r=7&c,n=c>>3}if(n--,1===r||2===r)(i+=t.readSVarint())<a&&(a=i),i>s&&(s=i),(o+=t.readSVarint())<u&&(u=o),o>l&&(l=o);else if(7!==r)throw new Error("unknown command "+r)}return[a,u,s,l]},fs.prototype.toGeoJSON=function(t,e,r){var n,i,o=this.extent*Math.pow(2,r),a=this.extent*t,s=this.extent*e,u=this.loadGeometry(),l=fs.types[this.type];function c(t){for(var e=0;e<t.length;e++){var r=t[e];t[e]=[360*(r.x+a)/o-180,360/Math.PI*Math.atan(Math.exp((180-360*(r.y+s)/o)*Math.PI/180))-90]}}switch(this.type){case 1:var p=[];for(n=0;n<u.length;n++)p[n]=u[n][0];c(u=p);break;case 2:for(n=0;n<u.length;n++)c(u[n]);break;case 3:for(u=function(t){var e=t.length;if(e<=1)return[t];for(var r,n,i=[],o=0;o<e;o++){var a=ms(t[o]);0!==a&&(void 0===n&&(n=a<0),n===a<0?(r&&i.push(r),r=[t[o]]):r.push(t[o]))}return r&&i.push(r),i}(u),n=0;n<u.length;n++)for(i=0;i<u[n].length;i++)c(u[n][i])}1===u.length?u=u[0]:l="Multi"+l;var h={type:"Feature",geometry:{type:l,coordinates:u},properties:this.properties};return"id"in this&&(h.id=this.id),h};var ys=gs;function gs(t,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(vs,this,e),this.length=this._features.length}function vs(t,e,r){15===t?e.version=r.readVarint():1===t?e.name=r.readString():5===t?e.extent=r.readVarint():2===t?e._features.push(r.pos):3===t?e._keys.push(r.readString()):4===t&&e._values.push(function(t){for(var e=null,r=t.readVarint()+t.pos;t.pos<r;){var n=t.readVarint()>>3;e=1===n?t.readString():2===n?t.readFloat():3===n?t.readDouble():4===n?t.readVarint64():5===n?t.readVarint():6===n?t.readSVarint():7===n?t.readBoolean():null}return e}(r))}function _s(t,e,r){if(3===t){var n=new ys(r,r.readVarint()+r.pos);n.length&&(e[n.name]=n)}}gs.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var e=this._pbf.readVarint()+this._pbf.pos;return new hs(this._pbf,e,this.extent,this._keys,this._values)};var xs={VectorTile:function(t,e){this.layers=t.readFields(_s,{},e)},VectorTileFeature:hs,VectorTileLayer:ys},bs=xs.VectorTileFeature.types,ws=Math.pow(2,13);function Ss(t,e,r,n,i,o,a,s){t.emplaceBack(e,r,2*Math.floor(n*ws)+a,i*ws*2,o*ws*2,Math.round(s))}var As=function(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((function(t){return t.id})),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new Ci,this.indexArray=new ji,this.programConfigurations=new Bo(t.layers,t.zoom),this.segments=new so,this.stateDependentLayerIds=this.layers.filter((function(t){return t.isStateDependent()})).map((function(t){return t.id}))};function Es(t,e){return t.x===e.x&&(t.x<0||t.x>8192)||t.y===e.y&&(t.y<0||t.y>8192)}As.prototype.populate=function(t,e,r){this.features=[],this.hasPattern=os("fill-extrusion",this.layers,e);for(var n=0,i=t;n<i.length;n+=1){var o=i[n],a=o.feature,s=o.id,u=o.index,l=o.sourceLayerIndex,c=this.layers[0]._featureFilter.needGeometry,p=jo(a,c);if(this.layers[0]._featureFilter.filter(new si(this.zoom),p,r)){var h={id:s,sourceLayerIndex:l,index:u,geometry:c?p.geometry:Uo(a),properties:a.properties,type:a.type,patterns:{}};this.hasPattern?this.features.push(as("fill-extrusion",this.layers,h,this.zoom,e)):this.addFeature(h,h.geometry,u,r,{}),e.featureIndex.insert(a,h.geometry,u,l,this.index,!0)}}},As.prototype.addFeatures=function(t,e,r){for(var n=0,i=this.features;n<i.length;n+=1){var o=i[n];this.addFeature(o,o.geometry,o.index,e,r)}},As.prototype.update=function(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r)},As.prototype.isEmpty=function(){return 0===this.layoutVertexArray.length},As.prototype.uploadPending=function(){return!this.uploaded||this.programConfigurations.needsUpload},As.prototype.upload=function(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,ps),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0},As.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())},As.prototype.addFeature=function(t,e,r,n,i){for(var o=0,a=ns(e,500);o<a.length;o+=1){for(var s=a[o],u=0,l=0,c=s;l<c.length;l+=1)u+=c[l].length;for(var p=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray),h=0,f=s;h<f.length;h+=1){var d=f[h];if(0!==d.length&&!((M=d).every((function(t){return t.x<0}))||M.every((function(t){return t.x>8192}))||M.every((function(t){return t.y<0}))||M.every((function(t){return t.y>8192}))))for(var m=0,y=0;y<d.length;y++){var g=d[y];if(y>=1){var v=d[y-1];if(!Es(g,v)){p.vertexLength+4>so.MAX_VERTEX_ARRAY_LENGTH&&(p=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));var _=g.sub(v)._perp()._unit(),x=v.dist(g);m+x>32768&&(m=0),Ss(this.layoutVertexArray,g.x,g.y,_.x,_.y,0,0,m),Ss(this.layoutVertexArray,g.x,g.y,_.x,_.y,0,1,m),Ss(this.layoutVertexArray,v.x,v.y,_.x,_.y,0,0,m+=x),Ss(this.layoutVertexArray,v.x,v.y,_.x,_.y,0,1,m);var b=p.vertexLength;this.indexArray.emplaceBack(b,b+2,b+1),this.indexArray.emplaceBack(b+1,b+2,b+3),p.vertexLength+=4,p.primitiveLength+=2}}}}if(p.vertexLength+u>so.MAX_VERTEX_ARRAY_LENGTH&&(p=this.segments.prepareSegment(u,this.layoutVertexArray,this.indexArray)),"Polygon"===bs[t.type]){for(var w=[],S=[],A=p.vertexLength,E=0,T=s;E<T.length;E+=1){var k=T[E];if(0!==k.length){k!==s[0]&&S.push(w.length/2);for(var I=0;I<k.length;I++){var z=k[I];Ss(this.layoutVertexArray,z.x,z.y,0,0,1,1,0),w.push(z.x),w.push(z.y)}}}for(var C=Ta(w,S),P=0;P<C.length;P+=3)this.indexArray.emplaceBack(A+C[P],A+C[P+2],A+C[P+1]);p.primitiveLength+=C.length/3,p.vertexLength+=u}}var M;this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,i,n)},Fn("FillExtrusionBucket",As,{omit:["layers","features"]});var Ts={paint:new bi({"fill-extrusion-opacity":new yi(zt["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new gi(zt["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new yi(zt["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new yi(zt["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new vi(zt["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new gi(zt["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new gi(zt["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new yi(zt["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})},ks=function(t){function e(e){t.call(this,e,Ts)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.createBucket=function(t){return new As(t)},e.prototype.queryRadius=function(){return ra(this.paint.get("fill-extrusion-translate"))},e.prototype.is3D=function(){return!0},e.prototype.queryIntersectsFeature=function(t,e,r,n,o,a,s,u){var l=na(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),a.angle,s),c=this.paint.get("fill-extrusion-height").evaluate(e,r),p=this.paint.get("fill-extrusion-base").evaluate(e,r),h=function(t,e,r,n){for(var o=[],a=0,s=t;a<s.length;a+=1){var u=s[a],l=[u.x,u.y,0,1];pa(l,l,e),o.push(new i(l[0]/l[3],l[1]/l[3]))}return o}(l,u),f=function(t,e,r,n){for(var o=[],a=[],s=n[8]*e,u=n[9]*e,l=n[10]*e,c=n[11]*e,p=n[8]*r,h=n[9]*r,f=n[10]*r,d=n[11]*r,m=0,y=t;m<y.length;m+=1){for(var g=[],v=[],_=0,x=y[m];_<x.length;_+=1){var b=x[_],w=b.x,S=b.y,A=n[0]*w+n[4]*S+n[12],E=n[1]*w+n[5]*S+n[13],T=n[2]*w+n[6]*S+n[14],k=n[3]*w+n[7]*S+n[15],I=T+l,z=k+c,C=A+p,P=E+h,M=T+f,D=k+d,L=new i((A+s)/z,(E+u)/z);L.z=I/z,g.push(L);var B=new i(C/D,P/D);B.z=M/D,v.push(B)}o.push(g),a.push(v)}return[o,a]}(n,p,c,u);return function(t,e,r){var n=1/0;Go(r,e)&&(n=zs(r,e[0]));for(var i=0;i<e.length;i++)for(var o=e[i],a=t[i],s=0;s<o.length-1;s++){var u=o[s],l=[u,o[s+1],a[s+1],a[s],u];$o(r,l)&&(n=Math.min(n,zs(r,l)))}return n!==1/0&&n}(f[0],f[1],h)},e}(wi);function Is(t,e){return t.x*e.x+t.y*e.y}function zs(t,e){if(1===t.length){for(var r,n=0,i=e[n++];!r||i.equals(r);)if(!(r=e[n++]))return 1/0;for(;n<e.length;n++){var o=e[n],a=t[0],s=r.sub(i),u=o.sub(i),l=a.sub(i),c=Is(s,s),p=Is(s,u),h=Is(u,u),f=Is(l,s),d=Is(l,u),m=c*h-p*p,y=(h*f-p*d)/m,g=(c*d-p*f)/m,v=i.z*(1-y-g)+r.z*y+o.z*g;if(isFinite(v))return v}return 1/0}for(var _=1/0,x=0,b=e;x<b.length;x+=1)_=Math.min(_,b[x].z);return _}var Cs=Ti([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4).members,Ps=Ti([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]).members,Ms=xs.VectorTileFeature.types,Ds=Math.cos(Math.PI/180*37.5),Ls=Math.pow(2,14)/.5,Bs=function(t){var e=this;this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((function(t){return t.id})),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach((function(t){e.gradients[t.id]={}})),this.layoutVertexArray=new Pi,this.layoutVertexArray2=new Mi,this.indexArray=new ji,this.programConfigurations=new Bo(t.layers,t.zoom),this.segments=new so,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((function(t){return t.isStateDependent()})).map((function(t){return t.id}))};Bs.prototype.populate=function(t,e,r){this.hasPattern=os("line",this.layers,e);for(var n=this.layers[0].layout.get("line-sort-key"),i=[],o=0,a=t;o<a.length;o+=1){var s=a[o],u=s.feature,l=s.id,c=s.index,p=s.sourceLayerIndex,h=this.layers[0]._featureFilter.needGeometry,f=jo(u,h);if(this.layers[0]._featureFilter.filter(new si(this.zoom),f,r)){var d=n?n.evaluate(f,{},r):void 0,m={id:l,properties:u.properties,type:u.type,sourceLayerIndex:p,index:c,geometry:h?f.geometry:Uo(u),patterns:{},sortKey:d};i.push(m)}}n&&i.sort((function(t,e){return t.sortKey-e.sortKey}));for(var y=0,g=i;y<g.length;y+=1){var v=g[y],_=v.geometry,x=v.index,b=v.sourceLayerIndex;if(this.hasPattern){var w=as("line",this.layers,v,this.zoom,e);this.patternFeatures.push(w)}else this.addFeature(v,_,x,r,{});e.featureIndex.insert(t[x].feature,_,x,b,this.index)}},Bs.prototype.update=function(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r)},Bs.prototype.addFeatures=function(t,e,r){for(var n=0,i=this.patternFeatures;n<i.length;n+=1){var o=i[n];this.addFeature(o,o.geometry,o.index,e,r)}},Bs.prototype.isEmpty=function(){return 0===this.layoutVertexArray.length},Bs.prototype.uploadPending=function(){return!this.uploaded||this.programConfigurations.needsUpload},Bs.prototype.upload=function(t){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,Ps)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Cs),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0},Bs.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())},Bs.prototype.lineFeatureClips=function(t){if(t.properties&&t.properties.hasOwnProperty("mapbox_clip_start")&&t.properties.hasOwnProperty("mapbox_clip_end"))return{start:+t.properties.mapbox_clip_start,end:+t.properties.mapbox_clip_end}},Bs.prototype.addFeature=function(t,e,r,n,i){var o=this.layers[0].layout,a=o.get("line-join").evaluate(t,{}),s=o.get("line-cap"),u=o.get("line-miter-limit"),l=o.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(var c=0,p=e;c<p.length;c+=1)this.addLine(p[c],t,a,s,u,l);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,i,n)},Bs.prototype.addLine=function(t,e,r,n,i,o){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(var a=0;a<t.length-1;a++)this.totalDistance+=t[a].dist(t[a+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}for(var s="Polygon"===Ms[e.type],u=t.length;u>=2&&t[u-1].equals(t[u-2]);)u--;for(var l=0;l<u-1&&t[l].equals(t[l+1]);)l++;if(!(u<(s?3:2))){"bevel"===r&&(i=1.05);var c,p=this.overscaling<=16?122880/(512*this.overscaling):0,h=this.segments.prepareSegment(10*u,this.layoutVertexArray,this.indexArray),f=void 0,d=void 0,m=void 0,y=void 0;this.e1=this.e2=-1,s&&(y=t[l].sub(c=t[u-2])._unit()._perp());for(var g=l;g<u;g++)if(!(d=g===u-1?s?t[l+1]:void 0:t[g+1])||!t[g].equals(d)){y&&(m=y),c&&(f=c),c=t[g],y=d?d.sub(c)._unit()._perp():m;var v=(m=m||y).add(y);0===v.x&&0===v.y||v._unit();var _=m.x*y.x+m.y*y.y,x=v.x*y.x+v.y*y.y,b=0!==x?1/x:1/0,w=2*Math.sqrt(2-2*x),S=x<Ds&&f&&d,A=m.x*y.y-m.y*y.x>0;if(S&&g>l){var E=c.dist(f);if(E>2*p){var T=c.sub(c.sub(f)._mult(p/E)._round());this.updateDistance(f,T),this.addCurrentVertex(T,m,0,0,h),f=T}}var k=f&&d,I=k?r:s?"butt":n;if(k&&"round"===I&&(b<o?I="miter":b<=2&&(I="fakeround")),"miter"===I&&b>i&&(I="bevel"),"bevel"===I&&(b>2&&(I="flipbevel"),b<i&&(I="miter")),f&&this.updateDistance(f,c),"miter"===I)v._mult(b),this.addCurrentVertex(c,v,0,0,h);else if("flipbevel"===I){if(b>100)v=y.mult(-1);else{var z=b*m.add(y).mag()/m.sub(y).mag();v._perp()._mult(z*(A?-1:1))}this.addCurrentVertex(c,v,0,0,h),this.addCurrentVertex(c,v.mult(-1),0,0,h)}else if("bevel"===I||"fakeround"===I){var C=-Math.sqrt(b*b-1),P=A?C:0,M=A?0:C;if(f&&this.addCurrentVertex(c,m,P,M,h),"fakeround"===I)for(var D=Math.round(180*w/Math.PI/20),L=1;L<D;L++){var B=L/D;if(.5!==B){var R=B-.5;B+=B*R*(B-1)*((1.0904+_*(_*(3.55645-1.43519*_)-3.2452))*R*R+(.848013+_*(.215638*_-1.06021)))}var O=y.sub(m)._mult(B)._add(m)._unit()._mult(A?-1:1);this.addHalfVertex(c,O.x,O.y,!1,A,0,h)}d&&this.addCurrentVertex(c,y,-P,-M,h)}else if("butt"===I)this.addCurrentVertex(c,v,0,0,h);else if("square"===I){var F=f?1:-1;this.addCurrentVertex(c,v,F,F,h)}else"round"===I&&(f&&(this.addCurrentVertex(c,m,0,0,h),this.addCurrentVertex(c,m,1,1,h,!0)),d&&(this.addCurrentVertex(c,y,-1,-1,h,!0),this.addCurrentVertex(c,y,0,0,h)));if(S&&g<u-1){var V=c.dist(d);if(V>2*p){var U=c.add(d.sub(c)._mult(p/V)._round());this.updateDistance(c,U),this.addCurrentVertex(U,y,0,0,h),c=U}}}}},Bs.prototype.addCurrentVertex=function(t,e,r,n,i,o){void 0===o&&(o=!1);var a=e.y*n-e.x,s=-e.y-e.x*n;this.addHalfVertex(t,e.x+e.y*r,e.y-e.x*r,o,!1,r,i),this.addHalfVertex(t,a,s,o,!0,-n,i),this.distance>Ls/2&&0===this.totalDistance&&(this.distance=0,this.addCurrentVertex(t,e,r,n,i,o))},Bs.prototype.addHalfVertex=function(t,e,r,n,i,o,a){var s=.5*(this.lineClips?this.scaledDistance*(Ls-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((t.x<<1)+(n?1:0),(t.y<<1)+(i?1:0),Math.round(63*e)+128,Math.round(63*r)+128,1+(0===o?0:o<0?-1:1)|(63&s)<<2,s>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);var u=a.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,u),a.primitiveLength++),i?this.e2=u:this.e1=u},Bs.prototype.updateScaledDistance=function(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance},Bs.prototype.updateDistance=function(t,e){this.distance+=t.dist(e),this.updateScaledDistance()},Fn("LineBucket",Bs,{omit:["layers","patternFeatures"]});var Rs=new bi({"line-cap":new yi(zt.layout_line["line-cap"]),"line-join":new gi(zt.layout_line["line-join"]),"line-miter-limit":new yi(zt.layout_line["line-miter-limit"]),"line-round-limit":new yi(zt.layout_line["line-round-limit"]),"line-sort-key":new gi(zt.layout_line["line-sort-key"])}),Os={paint:new bi({"line-opacity":new gi(zt.paint_line["line-opacity"]),"line-color":new gi(zt.paint_line["line-color"]),"line-translate":new yi(zt.paint_line["line-translate"]),"line-translate-anchor":new yi(zt.paint_line["line-translate-anchor"]),"line-width":new gi(zt.paint_line["line-width"]),"line-gap-width":new gi(zt.paint_line["line-gap-width"]),"line-offset":new gi(zt.paint_line["line-offset"]),"line-blur":new gi(zt.paint_line["line-blur"]),"line-dasharray":new _i(zt.paint_line["line-dasharray"]),"line-pattern":new vi(zt.paint_line["line-pattern"]),"line-gradient":new xi(zt.paint_line["line-gradient"])}),layout:Rs},Fs=new(function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.possiblyEvaluate=function(e,r){return r=new si(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,zoomHistory:r.zoomHistory,transition:r.transition}),t.prototype.possiblyEvaluate.call(this,e,r)},e.prototype.evaluate=function(e,r,n,i){return r=h({},r,{zoom:Math.floor(r.zoom)}),t.prototype.evaluate.call(this,e,r,n,i)},e}(gi))(Os.paint.properties["line-width"].specification);Fs.useIntegerZoom=!0;var Vs=function(t){function e(e){t.call(this,e,Os),this.gradientVersion=0}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._handleSpecialPaintPropertyUpdate=function(t){"line-gradient"===t&&(this.stepInterpolant=this._transitionablePaint._values["line-gradient"].value.expression._styleExpression.expression instanceof qe,this.gradientVersion=(this.gradientVersion+1)%s)},e.prototype.gradientExpression=function(){return this._transitionablePaint._values["line-gradient"].value.expression},e.prototype.recalculate=function(e,r){t.prototype.recalculate.call(this,e,r),this.paint._values["line-floorwidth"]=Fs.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)},e.prototype.createBucket=function(t){return new Bs(t)},e.prototype.queryRadius=function(t){var e=t,r=Us(ea("line-width",this,e),ea("line-gap-width",this,e)),n=ea("line-offset",this,e);return r/2+Math.abs(n)+ra(this.paint.get("line-translate"))},e.prototype.queryIntersectsFeature=function(t,e,r,n,o,a,s){var u=na(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),a.angle,s),l=s/2*Us(this.paint.get("line-width").evaluate(e,r),this.paint.get("line-gap-width").evaluate(e,r)),c=this.paint.get("line-offset").evaluate(e,r);return c&&(n=function(t,e){for(var r=[],n=new i(0,0),o=0;o<t.length;o++){for(var a=t[o],s=[],u=0;u<a.length;u++){var l=a[u],c=a[u+1],p=0===u?n:l.sub(a[u-1])._unit()._perp(),h=u===a.length-1?n:c.sub(l)._unit()._perp(),f=p._add(h)._unit();f._mult(1/(f.x*h.x+f.y*h.y)),s.push(f._mult(e)._add(l))}r.push(s)}return r}(n,c*s)),function(t,e,r){for(var n=0;n<e.length;n++){var i=e[n];if(t.length>=3)for(var o=0;o<i.length;o++)if(Qo(t,i[o]))return!0;if(Wo(t,i,r))return!0}return!1}(u,n,l)},e.prototype.isTileClipped=function(){return!0},e}(wi);function Us(t,e){return e>0?e+2*t:t}var js=Ti([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Ns=Ti([{name:"a_projected_pos",components:3,type:"Float32"}],4),qs=(Ti([{name:"a_fade_opacity",components:1,type:"Uint32"}],4),Ti([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}])),$s=(Ti([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]),Ti([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4)),Zs=Ti([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function Gs(t,e,r){return t.sections.forEach((function(t){t.text=function(t,e,r){var n=e.layout.get("text-transform").evaluate(r,{});return"uppercase"===n?t=t.toLocaleUpperCase():"lowercase"===n&&(t=t.toLocaleLowerCase()),ai.applyArabicShaping&&(t=ai.applyArabicShaping(t)),t}(t.text,e,r)})),t}Ti([{name:"triangle",components:3,type:"Uint16"}]),Ti([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"}]),Ti([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"}]),Ti([{type:"Float32",name:"offsetX"}]),Ti([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);var Ws={"!":"︕","#":"＃",$:"＄","%":"％","&":"＆","(":"︵",")":"︶","*":"＊","+":"＋",",":"︐","-":"︲",".":"・","/":"／",":":"︓",";":"︔","<":"︿","=":"＝",">":"﹀","?":"︖","@":"＠","[":"﹇","\\":"＼","]":"﹈","^":"＾",_:"︳","`":"｀","{":"︷","|":"―","}":"︸","~":"～","¢":"￠","£":"￡","¥":"￥","¦":"￤","¬":"￢","¯":"￣","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"￦","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","！":"︕","（":"︵","）":"︶","，":"︐","－":"︲","．":"・","：":"︓","；":"︔","＜":"︿","＞":"﹀","？":"︖","［":"﹇","］":"﹈","＿":"︳","｛":"︷","｜":"―","｝":"︸","｟":"︵","｠":"︶","｡":"︒","｢":"﹁","｣":"﹂"},Xs=function(t,e,r,n,i){var o,a,s=8*i-n-1,u=(1<<s)-1,l=u>>1,c=-7,p=r?i-1:0,h=r?-1:1,f=t[e+p];for(p+=h,o=f&(1<<-c)-1,f>>=-c,c+=s;c>0;o=256*o+t[e+p],p+=h,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=n;c>0;a=256*a+t[e+p],p+=h,c-=8);if(0===o)o=1-l;else{if(o===u)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,n),o-=l}return(f?-1:1)*a*Math.pow(2,o-n)},Hs=function(t,e,r,n,i,o){var a,s,u,l=8*o-i-1,c=(1<<l)-1,p=c>>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:o-1,d=n?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=c):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),(e+=a+p>=1?h/u:h*Math.pow(2,1-p))*u>=2&&(a++,u/=2),a+p>=c?(s=0,a=c):a+p>=1?(s=(e*u-1)*Math.pow(2,i),a+=p):(s=e*Math.pow(2,p-1)*Math.pow(2,i),a=0));i>=8;t[r+f]=255&s,f+=d,s/=256,i-=8);for(a=a<<i|s,l+=i;l>0;t[r+f]=255&a,f+=d,a/=256,l-=8);t[r+f-d]|=128*m},Ks=Ys;function Ys(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}Ys.Varint=0,Ys.Fixed64=1,Ys.Bytes=2,Ys.Fixed32=5;var Js="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function Qs(t){return t.type===Ys.Bytes?t.readVarint()+t.pos:t.pos+1}function tu(t,e,r){return r?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function eu(t,e,r){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));r.realloc(n);for(var i=r.pos-1;i>=t;i--)r.buf[i+n]=r.buf[i]}function ru(t,e){for(var r=0;r<t.length;r++)e.writeVarint(t[r])}function nu(t,e){for(var r=0;r<t.length;r++)e.writeSVarint(t[r])}function iu(t,e){for(var r=0;r<t.length;r++)e.writeFloat(t[r])}function ou(t,e){for(var r=0;r<t.length;r++)e.writeDouble(t[r])}function au(t,e){for(var r=0;r<t.length;r++)e.writeBoolean(t[r])}function su(t,e){for(var r=0;r<t.length;r++)e.writeFixed32(t[r])}function uu(t,e){for(var r=0;r<t.length;r++)e.writeSFixed32(t[r])}function lu(t,e){for(var r=0;r<t.length;r++)e.writeFixed64(t[r])}function cu(t,e){for(var r=0;r<t.length;r++)e.writeSFixed64(t[r])}function pu(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+16777216*t[e+3]}function hu(t,e,r){t[r]=e,t[r+1]=e>>>8,t[r+2]=e>>>16,t[r+3]=e>>>24}function fu(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}function du(t,e,r){1===t&&r.readMessage(mu,e)}function mu(t,e,r){if(3===t){var n=r.readMessage(yu,{}),i=n.width,o=n.height,a=n.left,s=n.top,u=n.advance;e.push({id:n.id,bitmap:new va({width:i+6,height:o+6},n.bitmap),metrics:{width:i,height:o,left:a,top:s,advance:u}})}}function yu(t,e,r){1===t?e.id=r.readVarint():2===t?e.bitmap=r.readBytes():3===t?e.width=r.readVarint():4===t?e.height=r.readVarint():5===t?e.left=r.readSVarint():6===t?e.top=r.readSVarint():7===t&&(e.advance=r.readVarint())}function gu(t){for(var e=0,r=0,n=0,i=t;n<i.length;n+=1){var o=i[n];e+=o.w*o.h,r=Math.max(r,o.w)}t.sort((function(t,e){return e.h-t.h}));for(var a=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}],s=0,u=0,l=0,c=t;l<c.length;l+=1)for(var p=c[l],h=a.length-1;h>=0;h--){var f=a[h];if(!(p.w>f.w||p.h>f.h)){if(p.x=f.x,p.y=f.y,u=Math.max(u,p.y+p.h),s=Math.max(s,p.x+p.w),p.w===f.w&&p.h===f.h){var d=a.pop();h<a.length&&(a[h]=d)}else p.h===f.h?(f.x+=p.w,f.w-=p.w):p.w===f.w?(f.y+=p.h,f.h-=p.h):(a.push({x:f.x+p.w,y:f.y,w:f.w-p.w,h:p.h}),f.y+=p.h,f.h-=p.h);break}}return{w:s,h:u,fill:e/(s*u)||0}}Ys.prototype={destroy:function(){this.buf=null},readFields:function(t,e,r){for(r=r||this.length;this.pos<r;){var n=this.readVarint(),i=n>>3,o=this.pos;this.type=7&n,t(i,e,this),this.pos===o&&this.skip(n)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=pu(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=fu(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=pu(this.buf,this.pos)+4294967296*pu(this.buf,this.pos+4);return this.pos+=8,t},readSFixed64:function(){var t=pu(this.buf,this.pos)+4294967296*fu(this.buf,this.pos+4);return this.pos+=8,t},readFloat:function(){var t=Xs(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=Xs(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,r,n=this.buf;return e=127&(r=n[this.pos++]),r<128?e:(e|=(127&(r=n[this.pos++]))<<7,r<128?e:(e|=(127&(r=n[this.pos++]))<<14,r<128?e:(e|=(127&(r=n[this.pos++]))<<21,r<128?e:function(t,e,r){var n,i,o=r.buf;if(n=(112&(i=o[r.pos++]))>>4,i<128)return tu(t,n,e);if(n|=(127&(i=o[r.pos++]))<<3,i<128)return tu(t,n,e);if(n|=(127&(i=o[r.pos++]))<<10,i<128)return tu(t,n,e);if(n|=(127&(i=o[r.pos++]))<<17,i<128)return tu(t,n,e);if(n|=(127&(i=o[r.pos++]))<<24,i<128)return tu(t,n,e);if(n|=(1&(i=o[r.pos++]))<<31,i<128)return tu(t,n,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(r=n[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&Js?function(t,e,r){return Js.decode(t.subarray(e,r))}(this.buf,e,t):function(t,e,r){for(var n="",i=e;i<r;){var o,a,s,u=t[i],l=null,c=u>239?4:u>223?3:u>191?2:1;if(i+c>r)break;1===c?u<128&&(l=u):2===c?128==(192&(o=t[i+1]))&&(l=(31&u)<<6|63&o)<=127&&(l=null):3===c?(a=t[i+2],128==(192&(o=t[i+1]))&&128==(192&a)&&((l=(15&u)<<12|(63&o)<<6|63&a)<=2047||l>=55296&&l<=57343)&&(l=null)):4===c&&(a=t[i+2],s=t[i+3],128==(192&(o=t[i+1]))&&128==(192&a)&&128==(192&s)&&((l=(15&u)<<18|(63&o)<<12|(63&a)<<6|63&s)<=65535||l>=1114112)&&(l=null)),null===l?(l=65533,c=1):l>65535&&(l-=65536,n+=String.fromCharCode(l>>>10&1023|55296),l=56320|1023&l),n+=String.fromCharCode(l),i+=c}return n}(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==Ys.Bytes)return t.push(this.readVarint(e));var r=Qs(this);for(t=t||[];this.pos<r;)t.push(this.readVarint(e));return t},readPackedSVarint:function(t){if(this.type!==Ys.Bytes)return t.push(this.readSVarint());var e=Qs(this);for(t=t||[];this.pos<e;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==Ys.Bytes)return t.push(this.readBoolean());var e=Qs(this);for(t=t||[];this.pos<e;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==Ys.Bytes)return t.push(this.readFloat());var e=Qs(this);for(t=t||[];this.pos<e;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==Ys.Bytes)return t.push(this.readDouble());var e=Qs(this);for(t=t||[];this.pos<e;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==Ys.Bytes)return t.push(this.readFixed32());var e=Qs(this);for(t=t||[];this.pos<e;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==Ys.Bytes)return t.push(this.readSFixed32());var e=Qs(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==Ys.Bytes)return t.push(this.readFixed64());var e=Qs(this);for(t=t||[];this.pos<e;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==Ys.Bytes)return t.push(this.readSFixed64());var e=Qs(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed64());return t},skip:function(t){var e=7&t;if(e===Ys.Varint)for(;this.buf[this.pos++]>127;);else if(e===Ys.Bytes)this.pos=this.readVarint()+this.pos;else if(e===Ys.Fixed32)this.pos+=4;else{if(e!==Ys.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e<this.pos+t;)e*=2;if(e!==this.length){var r=new Uint8Array(e);r.set(this.buf),this.buf=r,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(t){this.realloc(4),hu(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),hu(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),hu(this.buf,-1&t,this.pos),hu(this.buf,Math.floor(t*(1/4294967296)),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),hu(this.buf,-1&t,this.pos),hu(this.buf,Math.floor(t*(1/4294967296)),this.pos+4),this.pos+=8},writeVarint:function(t){(t=+t||0)>268435455||t<0?function(t,e){var r,n;if(t>=0?(r=t%4294967296|0,n=t/4294967296|0):(n=~(-t/4294967296),4294967295^(r=~(-t%4294967296))?r=r+1|0:(r=0,n=n+1|0)),t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,r){r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,r.buf[r.pos]=127&(t>>>=7)}(r,0,e),function(t,e){var r=(7&t)<<4;e.buf[e.pos++]|=r|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t)))))}(n,e)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var e=this.pos;this.pos=function(t,e,r){for(var n,i,o=0;o<e.length;o++){if((n=e.charCodeAt(o))>55295&&n<57344){if(!i){n>56319||o+1===e.length?(t[r++]=239,t[r++]=191,t[r++]=189):i=n;continue}if(n<56320){t[r++]=239,t[r++]=191,t[r++]=189,i=n;continue}n=i-55296<<10|n-56320|65536,i=null}else i&&(t[r++]=239,t[r++]=191,t[r++]=189,i=null);n<128?t[r++]=n:(n<2048?t[r++]=n>>6|192:(n<65536?t[r++]=n>>12|224:(t[r++]=n>>18|240,t[r++]=n>>12&63|128),t[r++]=n>>6&63|128),t[r++]=63&n|128)}return r}(this.buf,t,this.pos);var r=this.pos-e;r>=128&&eu(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(t){this.realloc(4),Hs(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),Hs(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var r=0;r<e;r++)this.buf[this.pos++]=t[r]},writeRawMessage:function(t,e){this.pos++;var r=this.pos;t(e,this);var n=this.pos-r;n>=128&&eu(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,r){this.writeTag(t,Ys.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,ru,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,nu,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,au,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,iu,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,ou,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,su,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,uu,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,lu,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,cu,e)},writeBytesField:function(t,e){this.writeTag(t,Ys.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,Ys.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,Ys.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,Ys.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,Ys.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,Ys.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,Ys.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,Ys.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,Ys.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,Ys.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}};var vu=function(t,e){var r=e.pixelRatio,n=e.version,i=e.stretchX,o=e.stretchY,a=e.content;this.paddedRect=t,this.pixelRatio=r,this.stretchX=i,this.stretchY=o,this.content=a,this.version=n},_u={tl:{configurable:!0},br:{configurable:!0},tlbr:{configurable:!0},displaySize:{configurable:!0}};_u.tl.get=function(){return[this.paddedRect.x+1,this.paddedRect.y+1]},_u.br.get=function(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]},_u.tlbr.get=function(){return this.tl.concat(this.br)},_u.displaySize.get=function(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]},Object.defineProperties(vu.prototype,_u);var xu=function(t,e){var r={},n={};this.haveRenderCallbacks=[];var i=[];this.addImages(t,r,i),this.addImages(e,n,i);var o=gu(i),a=new _a({width:o.w||1,height:o.h||1});for(var s in t){var u=t[s],l=r[s].paddedRect;_a.copy(u.data,a,{x:0,y:0},{x:l.x+1,y:l.y+1},u.data)}for(var c in e){var p=e[c],h=n[c].paddedRect,f=h.x+1,d=h.y+1,m=p.data.width,y=p.data.height;_a.copy(p.data,a,{x:0,y:0},{x:f,y:d},p.data),_a.copy(p.data,a,{x:0,y:y-1},{x:f,y:d-1},{width:m,height:1}),_a.copy(p.data,a,{x:0,y:0},{x:f,y:d+y},{width:m,height:1}),_a.copy(p.data,a,{x:m-1,y:0},{x:f-1,y:d},{width:1,height:y}),_a.copy(p.data,a,{x:0,y:0},{x:f+m,y:d},{width:1,height:y})}this.image=a,this.iconPositions=r,this.patternPositions=n};xu.prototype.addImages=function(t,e,r){for(var n in t){var i=t[n],o={x:0,y:0,w:i.data.width+2,h:i.data.height+2};r.push(o),e[n]=new vu(o,i),i.hasRenderCallback&&this.haveRenderCallbacks.push(n)}},xu.prototype.patchUpdatedImages=function(t,e){for(var r in t.dispatchRenderCallbacks(this.haveRenderCallbacks),t.updatedImages)this.patchUpdatedImage(this.iconPositions[r],t.getImage(r),e),this.patchUpdatedImage(this.patternPositions[r],t.getImage(r),e)},xu.prototype.patchUpdatedImage=function(t,e,r){if(t&&e&&t.version!==e.version){t.version=e.version;var n=t.tl;r.update(e.data,void 0,{x:n[0],y:n[1]})}},Fn("ImagePosition",vu),Fn("ImageAtlas",xu);var bu={horizontal:1,vertical:2,horizontalOnly:3},wu=function(){this.scale=1,this.fontStack="",this.imageName=null};wu.forText=function(t,e){var r=new wu;return r.scale=t||1,r.fontStack=e,r},wu.forImage=function(t){var e=new wu;return e.imageName=t,e};var Su=function(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null};function Au(t,e,r,n,i,o,a,s,u,l,c,p,h,f,d,m){var y,g=Su.fromFeature(t,i);p===bu.vertical&&g.verticalizePunctuation();var v=ai.processBidirectionalText,_=ai.processStyledBidirectionalText;if(v&&1===g.sections.length){y=[];for(var x=0,b=v(g.toString(),Pu(g,l,o,e,n,f,d));x<b.length;x+=1){var w=b[x],S=new Su;S.text=w,S.sections=g.sections;for(var A=0;A<w.length;A++)S.sectionIndex.push(0);y.push(S)}}else if(_){y=[];for(var E=0,T=_(g.text,g.sectionIndex,Pu(g,l,o,e,n,f,d));E<T.length;E+=1){var k=T[E],I=new Su;I.text=k[0],I.sectionIndex=k[1],I.sections=g.sections,y.push(I)}}else y=function(t,e){for(var r=[],n=t.text,i=0,o=0,a=e;o<a.length;o+=1){var s=a[o];r.push(t.substring(i,s)),i=s}return i<n.length&&r.push(t.substring(i,n.length)),r}(g,Pu(g,l,o,e,n,f,d));var z=[],C={positionedLines:z,text:g.toString(),top:c[1],bottom:c[1],left:c[0],right:c[0],writingMode:p,iconsInText:!1,verticalizable:!1};return function(t,e,r,n,i,o,a,s,u,l,c,p){for(var h=0,f=-17,d=0,m=0,y="right"===s?1:"left"===s?0:.5,g=0,v=0,_=i;v<_.length;v+=1){var x=_[v];x.trim();var b=x.getMaxScale(),w=24*(b-1),S={positionedGlyphs:[],lineOffset:0};t.positionedLines[g]=S;var A=S.positionedGlyphs,E=0;if(x.length()){for(var T=0;T<x.length();T++){var k=x.getSection(T),I=x.getSectionIndex(T),z=x.getCharCode(T),C=0,P=null,M=null,D=null,L=24,B=!(u===bu.horizontal||!c&&!Wn(z)||c&&(Eu[z]||($=z,Zn.Arabic($)||Zn["Arabic Supplement"]($)||Zn["Arabic Extended-A"]($)||Zn["Arabic Presentation Forms-A"]($)||Zn["Arabic Presentation Forms-B"]($))));if(k.imageName){var R=n[k.imageName];if(!R)continue;D=k.imageName,t.iconsInText=t.iconsInText||!0,M=R.paddedRect;var O=R.displaySize;k.scale=24*k.scale/p,C=w+(24-O[1]*k.scale),L=(P={width:O[0],height:O[1],left:1,top:-3,advance:B?O[1]:O[0]}).advance;var F=B?O[0]*k.scale-24*b:O[1]*k.scale-24*b;F>0&&F>E&&(E=F)}else{var V=r[k.fontStack],U=V&&V[z];if(U&&U.rect)M=U.rect,P=U.metrics;else{var j=e[k.fontStack],N=j&&j[z];if(!N)continue;P=N.metrics}C=24*(b-k.scale)}B?(t.verticalizable=!0,A.push({glyph:z,imageName:D,x:h,y:f+C,vertical:B,scale:k.scale,fontStack:k.fontStack,sectionIndex:I,metrics:P,rect:M}),h+=L*k.scale+l):(A.push({glyph:z,imageName:D,x:h,y:f+C,vertical:B,scale:k.scale,fontStack:k.fontStack,sectionIndex:I,metrics:P,rect:M}),h+=P.advance*k.scale+l)}0!==A.length&&(d=Math.max(h-l,d),Du(A,0,A.length-1,y,E)),h=0;var q=o*b+E;S.lineOffset=Math.max(E,w),f+=q,m=Math.max(q,m),++g}else f+=o,++g}var $,Z=f- -17,G=Mu(a),W=G.horizontalAlign,X=G.verticalAlign;(function(t,e,r,n,i,o,a,s,u){var l,c=(e-r)*i;l=o!==a?-s*n- -17:(-n*u+.5)*a;for(var p=0,h=t;p<h.length;p+=1)for(var f=0,d=h[p].positionedGlyphs;f<d.length;f+=1){var m=d[f];m.x+=c,m.y+=l}})(t.positionedLines,y,W,X,d,m,o,Z,i.length),t.top+=-X*Z,t.bottom=t.top+Z,t.left+=-W*d,t.right=t.left+d}(C,e,r,n,y,a,s,u,p,l,h,m),!function(t){for(var e=0,r=t;e<r.length;e+=1)if(0!==r[e].positionedGlyphs.length)return!1;return!0}(z)&&C}Su.fromFeature=function(t,e){for(var r=new Su,n=0;n<t.sections.length;n++){var i=t.sections[n];i.image?r.addImageSection(i):r.addTextSection(i,e)}return r},Su.prototype.length=function(){return this.text.length},Su.prototype.getSection=function(t){return this.sections[this.sectionIndex[t]]},Su.prototype.getSectionIndex=function(t){return this.sectionIndex[t]},Su.prototype.getCharCode=function(t){return this.text.charCodeAt(t)},Su.prototype.verticalizePunctuation=function(){this.text=function(t){for(var e="",r=0;r<t.length;r++){var n=t.charCodeAt(r+1)||null,i=t.charCodeAt(r-1)||null;e+=n&&Xn(n)&&!Ws[t[r+1]]||i&&Xn(i)&&!Ws[t[r-1]]||!Ws[t[r]]?t[r]:Ws[t[r]]}return e}(this.text)},Su.prototype.trim=function(){for(var t=0,e=0;e<this.text.length&&Eu[this.text.charCodeAt(e)];e++)t++;for(var r=this.text.length,n=this.text.length-1;n>=0&&n>=t&&Eu[this.text.charCodeAt(n)];n--)r--;this.text=this.text.substring(t,r),this.sectionIndex=this.sectionIndex.slice(t,r)},Su.prototype.substring=function(t,e){var r=new Su;return r.text=this.text.substring(t,e),r.sectionIndex=this.sectionIndex.slice(t,e),r.sections=this.sections,r},Su.prototype.toString=function(){return this.text},Su.prototype.getMaxScale=function(){var t=this;return this.sectionIndex.reduce((function(e,r){return Math.max(e,t.sections[r].scale)}),0)},Su.prototype.addTextSection=function(t,e){this.text+=t.text,this.sections.push(wu.forText(t.scale,t.fontStack||e));for(var r=this.sections.length-1,n=0;n<t.text.length;++n)this.sectionIndex.push(r)},Su.prototype.addImageSection=function(t){var e=t.image?t.image.name:"";if(0!==e.length){var r=this.getNextImageSectionCharCode();r?(this.text+=String.fromCharCode(r),this.sections.push(wu.forImage(e)),this.sectionIndex.push(this.sections.length-1)):S("Reached maximum number of images 6401")}else S("Can't add FormattedSection with an empty image.")},Su.prototype.getNextImageSectionCharCode=function(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)};var Eu={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Tu={};function ku(t,e,r,n,i,o){if(e.imageName){var a=n[e.imageName];return a?a.displaySize[0]*e.scale*24/o+i:0}var s=r[e.fontStack],u=s&&s[t];return u?u.metrics.advance*e.scale+i:0}function Iu(t,e,r,n){var i=Math.pow(t-e,2);return n?t<e?i/2:2*i:i+Math.abs(r)*r}function zu(t,e,r){var n=0;return 10===t&&(n-=1e4),r&&(n+=150),40!==t&&65288!==t||(n+=50),41!==e&&65289!==e||(n+=50),n}function Cu(t,e,r,n,i,o){for(var a=null,s=Iu(e,r,i,o),u=0,l=n;u<l.length;u+=1){var c=l[u],p=Iu(e-c.x,r,i,o)+c.badness;p<=s&&(a=c,s=p)}return{index:t,x:e,priorBreak:a,badness:s}}function Pu(t,e,r,n,i,o,a){if("point"!==o)return[];if(!t)return[];for(var s,u=[],l=function(t,e,r,n,i,o){for(var a=0,s=0;s<t.length();s++){var u=t.getSection(s);a+=ku(t.getCharCode(s),u,n,i,e,o)}return a/Math.max(1,Math.ceil(a/r))}(t,e,r,n,i,a),c=t.text.indexOf("​")>=0,p=0,h=0;h<t.length();h++){var f=t.getSection(h),d=t.getCharCode(h);if(Eu[d]||(p+=ku(d,f,n,i,e,a)),h<t.length()-1){var m=!((s=d)<11904||!(Zn["Bopomofo Extended"](s)||Zn.Bopomofo(s)||Zn["CJK Compatibility Forms"](s)||Zn["CJK Compatibility Ideographs"](s)||Zn["CJK Compatibility"](s)||Zn["CJK Radicals Supplement"](s)||Zn["CJK Strokes"](s)||Zn["CJK Symbols and Punctuation"](s)||Zn["CJK Unified Ideographs Extension A"](s)||Zn["CJK Unified Ideographs"](s)||Zn["Enclosed CJK Letters and Months"](s)||Zn["Halfwidth and Fullwidth Forms"](s)||Zn.Hiragana(s)||Zn["Ideographic Description Characters"](s)||Zn["Kangxi Radicals"](s)||Zn["Katakana Phonetic Extensions"](s)||Zn.Katakana(s)||Zn["Vertical Forms"](s)||Zn["Yi Radicals"](s)||Zn["Yi Syllables"](s)));(Tu[d]||m||f.imageName)&&u.push(Cu(h+1,p,l,u,zu(d,t.getCharCode(h+1),m&&c),!1))}}return function t(e){return e?t(e.priorBreak).concat(e.index):[]}(Cu(t.length(),p,l,u,0,!0))}function Mu(t){var e=.5,r=.5;switch(t){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(t){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0}return{horizontalAlign:e,verticalAlign:r}}function Du(t,e,r,n,i){if(n||i)for(var o=t[r],a=(t[r].x+o.metrics.advance*o.scale)*n,s=e;s<=r;s++)t[s].x-=a,t[s].y+=i}function Lu(t,e,r,n,i,o){var a,s=t.image;if(s.content){var u=s.content,l=s.pixelRatio||1;a=[u[0]/l,u[1]/l,s.displaySize[0]-u[2]/l,s.displaySize[1]-u[3]/l]}var c,p,h,f,d=e.left*o,m=e.right*o;"width"===r||"both"===r?(f=i[0]+d-n[3],p=i[0]+m+n[1]):p=(f=i[0]+(d+m-s.displaySize[0])/2)+s.displaySize[0];var y=e.top*o,g=e.bottom*o;return"height"===r||"both"===r?(c=i[1]+y-n[0],h=i[1]+g+n[2]):h=(c=i[1]+(y+g-s.displaySize[1])/2)+s.displaySize[1],{image:s,top:c,right:p,bottom:h,left:f,collisionPadding:a}}Tu[10]=!0,Tu[32]=!0,Tu[38]=!0,Tu[40]=!0,Tu[41]=!0,Tu[43]=!0,Tu[45]=!0,Tu[47]=!0,Tu[173]=!0,Tu[183]=!0,Tu[8203]=!0,Tu[8208]=!0,Tu[8211]=!0,Tu[8231]=!0;var Bu=function(t){function e(e,r,n,i){t.call(this,e,r),this.angle=n,void 0!==i&&(this.segment=i)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.clone=function(){return new e(this.x,this.y,this.angle,this.segment)},e}(i);function Ru(t,e){var r=e.expression;if("constant"===r.kind)return{kind:"constant",layoutSize:r.evaluate(new si(t+1))};if("source"===r.kind)return{kind:"source"};for(var n=r.zoomStops,i=r.interpolationType,o=0;o<n.length&&n[o]<=t;)o++;for(var a=o=Math.max(0,o-1);a<n.length&&n[a]<t+1;)a++;a=Math.min(n.length-1,a);var s=n[o],u=n[a];return"composite"===r.kind?{kind:"composite",minZoom:s,maxZoom:u,interpolationType:i}:{kind:"camera",minZoom:s,maxZoom:u,minSize:r.evaluate(new si(s)),maxSize:r.evaluate(new si(u)),interpolationType:i}}function Ou(t,e,r){var n=e.uSize,i=r.lowerSize;return"source"===t.kind?i/128:"composite"===t.kind?$e(i/128,r.upperSize/128,e.uSizeT):n}function Fu(t,e){var r=0,n=0;if("constant"===t.kind)n=t.layoutSize;else if("source"!==t.kind){var i=t.interpolationType,o=i?c(or.interpolationFactor(i,e,t.minZoom,t.maxZoom),0,1):0;"camera"===t.kind?n=$e(t.minSize,t.maxSize,o):r=o}return{uSizeT:r,uSize:n}}Fn("Anchor",Bu);var Vu=Object.freeze({__proto__:null,getSizeData:Ru,evaluateSizeForFeature:Ou,evaluateSizeForZoom:Fu,SIZE_PACK_FACTOR:128});function Uu(t,e,r,n,i){if(void 0===e.segment)return!0;for(var o=e,a=e.segment+1,s=0;s>-r/2;){if(--a<0)return!1;s-=t[a].dist(o),o=t[a]}s+=t[a].dist(t[a+1]),a++;for(var u=[],l=0;s<r/2;){var c=t[a],p=t[a+1];if(!p)return!1;var h=t[a-1].angleTo(c)-c.angleTo(p);for(h=Math.abs((h+3*Math.PI)%(2*Math.PI)-Math.PI),u.push({distance:s,angleDelta:h}),l+=h;s-u[0].distance>n;)l-=u.shift().angleDelta;if(l>i)return!1;a++,s+=c.dist(p)}return!0}function ju(t){for(var e=0,r=0;r<t.length-1;r++)e+=t[r].dist(t[r+1]);return e}function Nu(t,e,r){return t?.6*e*r:0}function qu(t,e){return Math.max(t?t.right-t.left:0,e?e.right-e.left:0)}function $u(t,e,r,n,i,o){for(var a=Nu(r,i,o),s=qu(r,n)*o,u=0,l=ju(t)/2,c=0;c<t.length-1;c++){var p=t[c],h=t[c+1],f=p.dist(h);if(u+f>l){var d=(l-u)/f,m=$e(p.x,h.x,d),y=$e(p.y,h.y,d),g=new Bu(m,y,h.angleTo(p),c);return g._round(),!a||Uu(t,g,s,a,e)?g:void 0}u+=f}}function Zu(t,e,r,n,i,o,a,s,u){var l=Nu(n,o,a),c=qu(n,i),p=c*a,h=0===t[0].x||t[0].x===u||0===t[0].y||t[0].y===u;return e-p<e/4&&(e=p+e/4),function t(e,r,n,i,o,a,s,u,l){for(var c=a/2,p=ju(e),h=0,f=r-n,d=[],m=0;m<e.length-1;m++){for(var y=e[m],g=e[m+1],v=y.dist(g),_=g.angleTo(y);f+n<h+v;){var x=((f+=n)-h)/v,b=$e(y.x,g.x,x),w=$e(y.y,g.y,x);if(b>=0&&b<l&&w>=0&&w<l&&f-c>=0&&f+c<=p){var S=new Bu(b,w,_,m);S._round(),i&&!Uu(e,S,a,i,o)||d.push(S)}}h+=v}return u||d.length||s||(d=t(e,h/2,n,i,o,a,s,!0,l)),d}(t,h?e/2*s%e:(c/2+2*o)*a*s%e,e,l,r,p,h,!1,u)}function Gu(t,e,r,n,o){for(var a=[],s=0;s<t.length;s++)for(var u=t[s],l=void 0,c=0;c<u.length-1;c++){var p=u[c],h=u[c+1];p.x<e&&h.x<e||(p.x<e?p=new i(e,p.y+(e-p.x)/(h.x-p.x)*(h.y-p.y))._round():h.x<e&&(h=new i(e,p.y+(e-p.x)/(h.x-p.x)*(h.y-p.y))._round()),p.y<r&&h.y<r||(p.y<r?p=new i(p.x+(r-p.y)/(h.y-p.y)*(h.x-p.x),r)._round():h.y<r&&(h=new i(p.x+(r-p.y)/(h.y-p.y)*(h.x-p.x),r)._round()),p.x>=n&&h.x>=n||(p.x>=n?p=new i(n,p.y+(n-p.x)/(h.x-p.x)*(h.y-p.y))._round():h.x>=n&&(h=new i(n,p.y+(n-p.x)/(h.x-p.x)*(h.y-p.y))._round()),p.y>=o&&h.y>=o||(p.y>=o?p=new i(p.x+(o-p.y)/(h.y-p.y)*(h.x-p.x),o)._round():h.y>=o&&(h=new i(p.x+(o-p.y)/(h.y-p.y)*(h.x-p.x),o)._round()),l&&p.equals(l[l.length-1])||a.push(l=[p]),l.push(h)))))}return a}function Wu(t,e,r,n){var o=[],a=t.image,s=a.pixelRatio,u=a.paddedRect.w-2,l=a.paddedRect.h-2,c=t.right-t.left,p=t.bottom-t.top,h=a.stretchX||[[0,u]],f=a.stretchY||[[0,l]],d=function(t,e){return t+e[1]-e[0]},m=h.reduce(d,0),y=f.reduce(d,0),g=u-m,v=l-y,_=0,x=m,b=0,w=y,S=0,A=g,E=0,T=v;if(a.content&&n){var k=a.content;_=Xu(h,0,k[0]),b=Xu(f,0,k[1]),x=Xu(h,k[0],k[2]),w=Xu(f,k[1],k[3]),S=k[0]-_,E=k[1]-b,A=k[2]-k[0]-x,T=k[3]-k[1]-w}var I=function(n,o,u,l){var h=Ku(n.stretch-_,x,c,t.left),f=Yu(n.fixed-S,A,n.stretch,m),d=Ku(o.stretch-b,w,p,t.top),g=Yu(o.fixed-E,T,o.stretch,y),v=Ku(u.stretch-_,x,c,t.left),k=Yu(u.fixed-S,A,u.stretch,m),I=Ku(l.stretch-b,w,p,t.top),z=Yu(l.fixed-E,T,l.stretch,y),C=new i(h,d),P=new i(v,d),M=new i(v,I),D=new i(h,I),L=new i(f/s,g/s),B=new i(k/s,z/s),R=e*Math.PI/180;if(R){var O=Math.sin(R),F=Math.cos(R),V=[F,-O,O,F];C._matMult(V),P._matMult(V),D._matMult(V),M._matMult(V)}var U=n.stretch+n.fixed,j=o.stretch+o.fixed;return{tl:C,tr:P,bl:D,br:M,tex:{x:a.paddedRect.x+1+U,y:a.paddedRect.y+1+j,w:u.stretch+u.fixed-U,h:l.stretch+l.fixed-j},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:L,pixelOffsetBR:B,minFontScaleX:A/s/c,minFontScaleY:T/s/p,isSDF:r}};if(n&&(a.stretchX||a.stretchY))for(var z=Hu(h,g,m),C=Hu(f,v,y),P=0;P<z.length-1;P++)for(var M=z[P],D=z[P+1],L=0;L<C.length-1;L++)o.push(I(M,C[L],D,C[L+1]));else o.push(I({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:u+1},{fixed:0,stretch:l+1}));return o}function Xu(t,e,r){for(var n=0,i=0,o=t;i<o.length;i+=1){var a=o[i];n+=Math.max(e,Math.min(r,a[1]))-Math.max(e,Math.min(r,a[0]))}return n}function Hu(t,e,r){for(var n=[{fixed:-1,stretch:0}],i=0,o=t;i<o.length;i+=1){var a=o[i],s=a[0],u=a[1],l=n[n.length-1];n.push({fixed:s-l.stretch,stretch:l.stretch}),n.push({fixed:s-l.stretch,stretch:l.stretch+(u-s)})}return n.push({fixed:e+1,stretch:r}),n}function Ku(t,e,r,n){return t/e*r+n}function Yu(t,e,r,n){return t-e*r/n}var Ju=function(t,e,r,n,o,a,s,u,l,c){if(this.boxStartIndex=t.length,l){var p=a.top,h=a.bottom,f=a.collisionPadding;f&&(p-=f[1],h+=f[3]);var d=h-p;d>0&&(d=Math.max(10,d),this.circleDiameter=d)}else{var m=a.top*s-u,y=a.bottom*s+u,g=a.left*s-u,v=a.right*s+u,_=a.collisionPadding;if(_&&(g-=_[0]*s,m-=_[1]*s,v+=_[2]*s,y+=_[3]*s),c){var x=new i(g,m),b=new i(v,m),w=new i(g,y),S=new i(v,y),A=c*Math.PI/180;x._rotate(A),b._rotate(A),w._rotate(A),S._rotate(A),g=Math.min(x.x,b.x,w.x,S.x),v=Math.max(x.x,b.x,w.x,S.x),m=Math.min(x.y,b.y,w.y,S.y),y=Math.max(x.y,b.y,w.y,S.y)}t.emplaceBack(e.x,e.y,g,m,v,y,r,n,o)}this.boxEndIndex=t.length},Qu=function(t,e){if(void 0===t&&(t=[]),void 0===e&&(e=tl),this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(var r=(this.length>>1)-1;r>=0;r--)this._down(r)};function tl(t,e){return t<e?-1:t>e?1:0}function el(t,e,r){void 0===e&&(e=1),void 0===r&&(r=!1);for(var n=1/0,o=1/0,a=-1/0,s=-1/0,u=t[0],l=0;l<u.length;l++){var c=u[l];(!l||c.x<n)&&(n=c.x),(!l||c.y<o)&&(o=c.y),(!l||c.x>a)&&(a=c.x),(!l||c.y>s)&&(s=c.y)}var p=Math.min(a-n,s-o),h=p/2,f=new Qu([],rl);if(0===p)return new i(n,o);for(var d=n;d<a;d+=p)for(var m=o;m<s;m+=p)f.push(new nl(d+h,m+h,h,t));for(var y=function(t){for(var e=0,r=0,n=0,i=t[0],o=0,a=i.length,s=a-1;o<a;s=o++){var u=i[o],l=i[s],c=u.x*l.y-l.x*u.y;r+=(u.x+l.x)*c,n+=(u.y+l.y)*c,e+=3*c}return new nl(r/e,n/e,0,t)}(t),g=f.length;f.length;){var v=f.pop();(v.d>y.d||!y.d)&&(y=v,r&&console.log("found best %d after %d probes",Math.round(1e4*v.d)/1e4,g)),v.max-y.d<=e||(f.push(new nl(v.p.x-(h=v.h/2),v.p.y-h,h,t)),f.push(new nl(v.p.x+h,v.p.y-h,h,t)),f.push(new nl(v.p.x-h,v.p.y+h,h,t)),f.push(new nl(v.p.x+h,v.p.y+h,h,t)),g+=4)}return r&&(console.log("num probes: "+g),console.log("best distance: "+y.d)),y.p}function rl(t,e){return e.max-t.max}function nl(t,e,r,n){this.p=new i(t,e),this.h=r,this.d=function(t,e){for(var r=!1,n=1/0,i=0;i<e.length;i++)for(var o=e[i],a=0,s=o.length,u=s-1;a<s;u=a++){var l=o[a],c=o[u];l.y>t.y!=c.y>t.y&&t.x<(c.x-l.x)*(t.y-l.y)/(c.y-l.y)+l.x&&(r=!r),n=Math.min(n,Yo(t,l,c))}return(r?1:-1)*Math.sqrt(n)}(this.p,n),this.max=this.d+this.h*Math.SQRT2}Qu.prototype.push=function(t){this.data.push(t),this.length++,this._up(this.length-1)},Qu.prototype.pop=function(){if(0!==this.length){var t=this.data[0],e=this.data.pop();return this.length--,this.length>0&&(this.data[0]=e,this._down(0)),t}},Qu.prototype.peek=function(){return this.data[0]},Qu.prototype._up=function(t){for(var e=this.data,r=this.compare,n=e[t];t>0;){var i=t-1>>1,o=e[i];if(r(n,o)>=0)break;e[t]=o,t=i}e[t]=n},Qu.prototype._down=function(t){for(var e=this.data,r=this.compare,n=this.length>>1,i=e[t];t<n;){var o=1+(t<<1),a=e[o],s=o+1;if(s<this.length&&r(e[s],a)<0&&(o=s,a=e[s]),r(a,i)>=0)break;e[t]=a,t=o}e[t]=i};var il=Number.POSITIVE_INFINITY;function ol(t,e){return e[1]!==il?function(t,e,r){var n=0,i=0;switch(e=Math.abs(e),r=Math.abs(r),t){case"top-right":case"top-left":case"top":i=r-7;break;case"bottom-right":case"bottom-left":case"bottom":i=7-r}switch(t){case"top-right":case"bottom-right":case"right":n=-e;break;case"top-left":case"bottom-left":case"left":n=e}return[n,i]}(t,e[0],e[1]):function(t,e){var r=0,n=0;e<0&&(e=0);var i=e/Math.sqrt(2);switch(t){case"top-right":case"top-left":n=i-7;break;case"bottom-right":case"bottom-left":n=7-i;break;case"bottom":n=7-e;break;case"top":n=e-7}switch(t){case"top-right":case"bottom-right":r=-i;break;case"top-left":case"bottom-left":r=i;break;case"left":r=e;break;case"right":r=-e}return[r,n]}(t,e[0])}function al(t){switch(t){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function sl(t,e,r,n,o,a,s,u,l,c,p,h,f,d,m){var y=function(t,e,r,n,o,a,s,u){for(var l=n.layout.get("text-rotate").evaluate(a,{})*Math.PI/180,c=[],p=0,h=e.positionedLines;p<h.length;p+=1)for(var f=h[p],d=0,m=f.positionedGlyphs;d<m.length;d+=1){var y=m[d];if(y.rect){var g=y.rect||{},v=4,_=!0,x=1,b=0,w=(o||u)&&y.vertical,S=y.metrics.advance*y.scale/2;if(u&&e.verticalizable&&(b=f.lineOffset/2-(y.imageName?-(24-y.metrics.width*y.scale)/2:24*(y.scale-1))),y.imageName){var A=s[y.imageName];_=A.sdf,v=1/(x=A.pixelRatio)}var E=o?[y.x+S,y.y]:[0,0],T=o?[0,0]:[y.x+S+r[0],y.y+r[1]-b],k=[0,0];w&&(k=T,T=[0,0]);var I=(y.metrics.left-v)*y.scale-S+T[0],z=(-y.metrics.top-v)*y.scale+T[1],C=I+g.w*y.scale/x,P=z+g.h*y.scale/x,M=new i(I,z),D=new i(C,z),L=new i(I,P),B=new i(C,P);if(w){var R=new i(-S,S- -17),O=-Math.PI/2,F=12-S,V=new i(22-F,-(y.imageName?F:0)),U=new(Function.prototype.bind.apply(i,[null].concat(k)));M._rotateAround(O,R)._add(V)._add(U),D._rotateAround(O,R)._add(V)._add(U),L._rotateAround(O,R)._add(V)._add(U),B._rotateAround(O,R)._add(V)._add(U)}if(l){var j=Math.sin(l),N=Math.cos(l),q=[N,-j,j,N];M._matMult(q),D._matMult(q),L._matMult(q),B._matMult(q)}var $=new i(0,0),Z=new i(0,0);c.push({tl:M,tr:D,bl:L,br:B,tex:g,writingMode:e.writingMode,glyphOffset:E,sectionIndex:y.sectionIndex,isSDF:_,pixelOffsetTL:$,pixelOffsetBR:Z,minFontScaleX:0,minFontScaleY:0})}}return c}(0,r,u,o,a,s,n,t.allowVerticalPlacement),g=t.textSizeData,v=null;"source"===g.kind?(v=[128*o.layout.get("text-size").evaluate(s,{})])[0]>32640&&S(t.layerIds[0]+': Value for "text-size" is >= 255. Reduce your "text-size".'):"composite"===g.kind&&((v=[128*d.compositeTextSizes[0].evaluate(s,{},m),128*d.compositeTextSizes[1].evaluate(s,{},m)])[0]>32640||v[1]>32640)&&S(t.layerIds[0]+': Value for "text-size" is >= 255. Reduce your "text-size".'),t.addSymbols(t.text,y,v,u,a,s,c,e,l.lineStartIndex,l.lineLength,f,m);for(var _=0,x=p;_<x.length;_+=1)h[x[_]]=t.text.placedSymbolArray.length-1;return 4*y.length}function ul(t){for(var e in t)return t[e];return null}function ll(t,e,r,n){var i=t.compareText;if(e in i){for(var o=i[e],a=o.length-1;a>=0;a--)if(n.dist(o[a])<r)return!0}else i[e]=[];return i[e].push(n),!1}var cl=xs.VectorTileFeature.types,pl=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function hl(t,e,r,n,i,o,a,s,u,l,c,p,h){var f=s?Math.min(32640,Math.round(s[0])):0,d=s?Math.min(32640,Math.round(s[1])):0;t.emplaceBack(e,r,Math.round(32*n),Math.round(32*i),o,a,(f<<1)+(u?1:0),d,16*l,16*c,256*p,256*h)}function fl(t,e,r){t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r)}function dl(t){for(var e=0,r=t.sections;e<r.length;e+=1)if(Yn(r[e].text))return!0;return!1}var ml=function(t){this.layoutVertexArray=new Li,this.indexArray=new ji,this.programConfigurations=t,this.segments=new so,this.dynamicLayoutVertexArray=new Bi,this.opacityVertexArray=new Ri,this.placedSymbolArray=new Qi};ml.prototype.isEmpty=function(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length},ml.prototype.upload=function(t,e,r,n){this.isEmpty()||(r&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,js.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,e),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,Ns.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,pl,!0),this.opacityVertexBuffer.itemSize=1),(r||n)&&this.programConfigurations.upload(t))},ml.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())},Fn("SymbolBuffers",ml);var yl=function(t,e,r){this.layoutVertexArray=new t,this.layoutAttributes=e,this.indexArray=new r,this.segments=new so,this.collisionVertexArray=new Ui};yl.prototype.upload=function(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,qs.members,!0)},yl.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())},Fn("CollisionBuffers",yl);var gl=function(t){this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((function(t){return t.id})),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=sa([]),this.placementViewportMatrix=sa([]);var e=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Ru(this.zoom,e["text-size"]),this.iconSizeData=Ru(this.zoom,e["icon-size"]);var r=this.layers[0].layout,n=r.get("symbol-sort-key"),i=r.get("symbol-z-order");this.canOverlap=r.get("text-allow-overlap")||r.get("icon-allow-overlap")||r.get("text-ignore-placement")||r.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==i&&void 0!==n.constantOr(1),this.sortFeaturesByY=("viewport-y"===i||"auto"===i&&!this.sortFeaturesByKey)&&this.canOverlap,"point"===r.get("symbol-placement")&&(this.writingModes=r.get("text-writing-mode").map((function(t){return bu[t]}))),this.stateDependentLayerIds=this.layers.filter((function(t){return t.isStateDependent()})).map((function(t){return t.id})),this.sourceID=t.sourceID};gl.prototype.createArrays=function(){this.text=new ml(new Bo(this.layers,this.zoom,(function(t){return/^text/.test(t)}))),this.icon=new ml(new Bo(this.layers,this.zoom,(function(t){return/^icon/.test(t)}))),this.glyphOffsetArray=new ro,this.lineVertexArray=new no,this.symbolInstances=new eo},gl.prototype.calculateGlyphDependencies=function(t,e,r,n,i){for(var o=0;o<t.length;o++)if(e[t.charCodeAt(o)]=!0,(r||n)&&i){var a=Ws[t.charAt(o)];a&&(e[a.charCodeAt(0)]=!0)}},gl.prototype.populate=function(t,e,r){var n=this.layers[0],i=n.layout,o=i.get("text-font"),a=i.get("text-field"),s=i.get("icon-image"),u=("constant"!==a.value.kind||a.value.value instanceof ne&&!a.value.value.isEmpty()||a.value.value.toString().length>0)&&("constant"!==o.value.kind||o.value.value.length>0),l="constant"!==s.value.kind||!!s.value.value||Object.keys(s.parameters).length>0,c=i.get("symbol-sort-key");if(this.features=[],u||l){for(var p=e.iconDependencies,h=e.glyphDependencies,f=e.availableImages,d=new si(this.zoom),m=0,y=t;m<y.length;m+=1){var g=y[m],v=g.feature,_=g.id,x=g.index,b=g.sourceLayerIndex,w=n._featureFilter.needGeometry,S=jo(v,w);if(n._featureFilter.filter(d,S,r)){w||(S.geometry=Uo(v));var A=void 0;if(u){var E=n.getValueAndResolveTokens("text-field",S,r,f),T=ne.factory(E);dl(T)&&(this.hasRTLText=!0),(!this.hasRTLText||"unavailable"===ii()||this.hasRTLText&&ai.isParsed())&&(A=Gs(T,n,S))}var k=void 0;if(l){var I=n.getValueAndResolveTokens("icon-image",S,r,f);k=I instanceof ie?I:ie.fromString(I)}if(A||k){var z=this.sortFeaturesByKey?c.evaluate(S,{},r):void 0;if(this.features.push({id:_,text:A,icon:k,index:x,sourceLayerIndex:b,geometry:S.geometry,properties:v.properties,type:cl[v.type],sortKey:z}),k&&(p[k.name]=!0),A){var C=o.evaluate(S,{},r).join(","),P="map"===i.get("text-rotation-alignment")&&"point"!==i.get("symbol-placement");this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(bu.vertical)>=0;for(var M=0,D=A.sections;M<D.length;M+=1){var L=D[M];if(L.image)p[L.image.name]=!0;else{var B=Gn(A.toString()),R=L.fontStack||C,O=h[R]=h[R]||{};this.calculateGlyphDependencies(L.text,O,P,this.allowVerticalPlacement,B)}}}}}}"line"===i.get("symbol-placement")&&(this.features=function(t){var e={},r={},n=[],i=0;function o(e){n.push(t[e]),i++}function a(t,e,i){var o=r[t];return delete r[t],r[e]=o,n[o].geometry[0].pop(),n[o].geometry[0]=n[o].geometry[0].concat(i[0]),o}function s(t,r,i){var o=e[r];return delete e[r],e[t]=o,n[o].geometry[0].shift(),n[o].geometry[0]=i[0].concat(n[o].geometry[0]),o}function u(t,e,r){var n=r?e[0][e[0].length-1]:e[0][0];return t+":"+n.x+":"+n.y}for(var l=0;l<t.length;l++){var c=t[l],p=c.geometry,h=c.text?c.text.toString():null;if(h){var f=u(h,p),d=u(h,p,!0);if(f in r&&d in e&&r[f]!==e[d]){var m=s(f,d,p),y=a(f,d,n[m].geometry);delete e[f],delete r[d],r[u(h,n[y].geometry,!0)]=y,n[m].geometry=null}else f in r?a(f,d,p):d in e?s(f,d,p):(o(l),e[f]=i-1,r[d]=i-1)}else o(l)}return n.filter((function(t){return t.geometry}))}(this.features)),this.sortFeaturesByKey&&this.features.sort((function(t,e){return t.sortKey-e.sortKey}))}},gl.prototype.update=function(t,e,r){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,e,this.layers,r),this.icon.programConfigurations.updatePaintArrays(t,e,this.layers,r))},gl.prototype.isEmpty=function(){return 0===this.symbolInstances.length&&!this.hasRTLText},gl.prototype.uploadPending=function(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload},gl.prototype.upload=function(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0},gl.prototype.destroyDebugData=function(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()},gl.prototype.destroy=function(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()},gl.prototype.addToLineVertexArray=function(t,e){var r=this.lineVertexArray.length;if(void 0!==t.segment){for(var n=t.dist(e[t.segment+1]),i=t.dist(e[t.segment]),o={},a=t.segment+1;a<e.length;a++)o[a]={x:e[a].x,y:e[a].y,tileUnitDistanceFromAnchor:n},a<e.length-1&&(n+=e[a+1].dist(e[a]));for(var s=t.segment||0;s>=0;s--)o[s]={x:e[s].x,y:e[s].y,tileUnitDistanceFromAnchor:i},s>0&&(i+=e[s-1].dist(e[s]));for(var u=0;u<e.length;u++){var l=o[u];this.lineVertexArray.emplaceBack(l.x,l.y,l.tileUnitDistanceFromAnchor)}}return{lineStartIndex:r,lineLength:this.lineVertexArray.length-r}},gl.prototype.addSymbols=function(t,e,r,n,i,o,a,s,u,l,c,p){for(var h=t.indexArray,f=t.layoutVertexArray,d=t.segments.prepareSegment(4*e.length,f,h,this.canOverlap?o.sortKey:void 0),m=this.glyphOffsetArray.length,y=d.vertexLength,g=this.allowVerticalPlacement&&a===bu.vertical?Math.PI/2:0,v=o.text&&o.text.sections,_=0;_<e.length;_++){var x=e[_],b=x.tl,w=x.tr,S=x.bl,A=x.br,E=x.tex,T=x.pixelOffsetTL,k=x.pixelOffsetBR,I=x.minFontScaleX,z=x.minFontScaleY,C=x.glyphOffset,P=x.isSDF,M=x.sectionIndex,D=d.vertexLength,L=C[1];hl(f,s.x,s.y,b.x,L+b.y,E.x,E.y,r,P,T.x,T.y,I,z),hl(f,s.x,s.y,w.x,L+w.y,E.x+E.w,E.y,r,P,k.x,T.y,I,z),hl(f,s.x,s.y,S.x,L+S.y,E.x,E.y+E.h,r,P,T.x,k.y,I,z),hl(f,s.x,s.y,A.x,L+A.y,E.x+E.w,E.y+E.h,r,P,k.x,k.y,I,z),fl(t.dynamicLayoutVertexArray,s,g),h.emplaceBack(D,D+1,D+2),h.emplaceBack(D+1,D+2,D+3),d.vertexLength+=4,d.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(C[0]),_!==e.length-1&&M===e[_+1].sectionIndex||t.programConfigurations.populatePaintArrays(f.length,o,o.index,{},p,v&&v[M])}t.placedSymbolArray.emplaceBack(s.x,s.y,m,this.glyphOffsetArray.length-m,y,u,l,s.segment,r?r[0]:0,r?r[1]:0,n[0],n[1],a,0,!1,0,c)},gl.prototype._addCollisionDebugVertex=function(t,e,r,n,i,o){return e.emplaceBack(0,0),t.emplaceBack(r.x,r.y,n,i,Math.round(o.x),Math.round(o.y))},gl.prototype.addCollisionDebugVertices=function(t,e,r,n,o,a,s){var u=o.segments.prepareSegment(4,o.layoutVertexArray,o.indexArray),l=u.vertexLength,c=o.layoutVertexArray,p=o.collisionVertexArray,h=s.anchorX,f=s.anchorY;this._addCollisionDebugVertex(c,p,a,h,f,new i(t,e)),this._addCollisionDebugVertex(c,p,a,h,f,new i(r,e)),this._addCollisionDebugVertex(c,p,a,h,f,new i(r,n)),this._addCollisionDebugVertex(c,p,a,h,f,new i(t,n)),u.vertexLength+=4;var d=o.indexArray;d.emplaceBack(l,l+1),d.emplaceBack(l+1,l+2),d.emplaceBack(l+2,l+3),d.emplaceBack(l+3,l),u.primitiveLength+=4},gl.prototype.addDebugCollisionBoxes=function(t,e,r,n){for(var i=t;i<e;i++){var o=this.collisionBoxArray.get(i);this.addCollisionDebugVertices(o.x1,o.y1,o.x2,o.y2,n?this.textCollisionBox:this.iconCollisionBox,o.anchorPoint,r)}},gl.prototype.generateCollisionDebugBuffers=function(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new yl(Fi,$s.members,Wi),this.iconCollisionBox=new yl(Fi,$s.members,Wi);for(var t=0;t<this.symbolInstances.length;t++){var e=this.symbolInstances.get(t);this.addDebugCollisionBoxes(e.textBoxStartIndex,e.textBoxEndIndex,e,!0),this.addDebugCollisionBoxes(e.verticalTextBoxStartIndex,e.verticalTextBoxEndIndex,e,!0),this.addDebugCollisionBoxes(e.iconBoxStartIndex,e.iconBoxEndIndex,e,!1),this.addDebugCollisionBoxes(e.verticalIconBoxStartIndex,e.verticalIconBoxEndIndex,e,!1)}},gl.prototype._deserializeCollisionBoxesForSymbol=function(t,e,r,n,i,o,a,s,u){for(var l={},c=e;c<r;c++){var p=t.get(c);l.textBox={x1:p.x1,y1:p.y1,x2:p.x2,y2:p.y2,anchorPointX:p.anchorPointX,anchorPointY:p.anchorPointY},l.textFeatureIndex=p.featureIndex;break}for(var h=n;h<i;h++){var f=t.get(h);l.verticalTextBox={x1:f.x1,y1:f.y1,x2:f.x2,y2:f.y2,anchorPointX:f.anchorPointX,anchorPointY:f.anchorPointY},l.verticalTextFeatureIndex=f.featureIndex;break}for(var d=o;d<a;d++){var m=t.get(d);l.iconBox={x1:m.x1,y1:m.y1,x2:m.x2,y2:m.y2,anchorPointX:m.anchorPointX,anchorPointY:m.anchorPointY},l.iconFeatureIndex=m.featureIndex;break}for(var y=s;y<u;y++){var g=t.get(y);l.verticalIconBox={x1:g.x1,y1:g.y1,x2:g.x2,y2:g.y2,anchorPointX:g.anchorPointX,anchorPointY:g.anchorPointY},l.verticalIconFeatureIndex=g.featureIndex;break}return l},gl.prototype.deserializeCollisionBoxes=function(t){this.collisionArrays=[];for(var e=0;e<this.symbolInstances.length;e++){var r=this.symbolInstances.get(e);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,r.textBoxStartIndex,r.textBoxEndIndex,r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r.iconBoxStartIndex,r.iconBoxEndIndex,r.verticalIconBoxStartIndex,r.verticalIconBoxEndIndex))}},gl.prototype.hasTextData=function(){return this.text.segments.get().length>0},gl.prototype.hasIconData=function(){return this.icon.segments.get().length>0},gl.prototype.hasDebugData=function(){return this.textCollisionBox&&this.iconCollisionBox},gl.prototype.hasTextCollisionBoxData=function(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0},gl.prototype.hasIconCollisionBoxData=function(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0},gl.prototype.addIndicesForPlacedSymbol=function(t,e){for(var r=t.placedSymbolArray.get(e),n=r.vertexStartIndex+4*r.numGlyphs,i=r.vertexStartIndex;i<n;i+=4)t.indexArray.emplaceBack(i,i+1,i+2),t.indexArray.emplaceBack(i+1,i+2,i+3)},gl.prototype.getSortedSymbolIndexes=function(t){if(this.sortedAngle===t&&void 0!==this.symbolInstanceIndexes)return this.symbolInstanceIndexes;for(var e=Math.sin(t),r=Math.cos(t),n=[],i=[],o=[],a=0;a<this.symbolInstances.length;++a){o.push(a);var s=this.symbolInstances.get(a);n.push(0|Math.round(e*s.anchorX+r*s.anchorY)),i.push(s.featureIndex)}return o.sort((function(t,e){return n[t]-n[e]||i[e]-i[t]})),o},gl.prototype.addToSortKeyRanges=function(t,e){var r=this.sortKeyRanges[this.sortKeyRanges.length-1];r&&r.sortKey===e?r.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:e,symbolInstanceStart:t,symbolInstanceEnd:t+1})},gl.prototype.sortFeatures=function(t){var e=this;if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(var r=0,n=this.symbolInstanceIndexes;r<n.length;r+=1){var i=this.symbolInstances.get(n[r]);this.featureSortOrder.push(i.featureIndex),[i.rightJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.leftJustifiedTextSymbolIndex].forEach((function(t,r,n){t>=0&&n.indexOf(t)===r&&e.addIndicesForPlacedSymbol(e.text,t)})),i.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,i.verticalPlacedTextSymbolIndex),i.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,i.placedIconSymbolIndex),i.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,i.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}},Fn("SymbolBucket",gl,{omit:["layers","collisionBoxArray","features","compareText"]}),gl.MAX_GLYPHS=65535,gl.addDynamicAttributes=fl;var vl=new bi({"symbol-placement":new yi(zt.layout_symbol["symbol-placement"]),"symbol-spacing":new yi(zt.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new yi(zt.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new gi(zt.layout_symbol["symbol-sort-key"]),"symbol-z-order":new yi(zt.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new yi(zt.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new yi(zt.layout_symbol["icon-ignore-placement"]),"icon-optional":new yi(zt.layout_symbol["icon-optional"]),"icon-rotation-alignment":new yi(zt.layout_symbol["icon-rotation-alignment"]),"icon-size":new gi(zt.layout_symbol["icon-size"]),"icon-text-fit":new yi(zt.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new yi(zt.layout_symbol["icon-text-fit-padding"]),"icon-image":new gi(zt.layout_symbol["icon-image"]),"icon-rotate":new gi(zt.layout_symbol["icon-rotate"]),"icon-padding":new yi(zt.layout_symbol["icon-padding"]),"icon-keep-upright":new yi(zt.layout_symbol["icon-keep-upright"]),"icon-offset":new gi(zt.layout_symbol["icon-offset"]),"icon-anchor":new gi(zt.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new yi(zt.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new yi(zt.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new yi(zt.layout_symbol["text-rotation-alignment"]),"text-field":new gi(zt.layout_symbol["text-field"]),"text-font":new gi(zt.layout_symbol["text-font"]),"text-size":new gi(zt.layout_symbol["text-size"]),"text-max-width":new gi(zt.layout_symbol["text-max-width"]),"text-line-height":new yi(zt.layout_symbol["text-line-height"]),"text-letter-spacing":new gi(zt.layout_symbol["text-letter-spacing"]),"text-justify":new gi(zt.layout_symbol["text-justify"]),"text-radial-offset":new gi(zt.layout_symbol["text-radial-offset"]),"text-variable-anchor":new yi(zt.layout_symbol["text-variable-anchor"]),"text-anchor":new gi(zt.layout_symbol["text-anchor"]),"text-max-angle":new yi(zt.layout_symbol["text-max-angle"]),"text-writing-mode":new yi(zt.layout_symbol["text-writing-mode"]),"text-rotate":new gi(zt.layout_symbol["text-rotate"]),"text-padding":new yi(zt.layout_symbol["text-padding"]),"text-keep-upright":new yi(zt.layout_symbol["text-keep-upright"]),"text-transform":new gi(zt.layout_symbol["text-transform"]),"text-offset":new gi(zt.layout_symbol["text-offset"]),"text-allow-overlap":new yi(zt.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new yi(zt.layout_symbol["text-ignore-placement"]),"text-optional":new yi(zt.layout_symbol["text-optional"])}),_l={paint:new bi({"icon-opacity":new gi(zt.paint_symbol["icon-opacity"]),"icon-color":new gi(zt.paint_symbol["icon-color"]),"icon-halo-color":new gi(zt.paint_symbol["icon-halo-color"]),"icon-halo-width":new gi(zt.paint_symbol["icon-halo-width"]),"icon-halo-blur":new gi(zt.paint_symbol["icon-halo-blur"]),"icon-translate":new yi(zt.paint_symbol["icon-translate"]),"icon-translate-anchor":new yi(zt.paint_symbol["icon-translate-anchor"]),"text-opacity":new gi(zt.paint_symbol["text-opacity"]),"text-color":new gi(zt.paint_symbol["text-color"],{runtimeType:jt,getOverride:function(t){return t.textColor},hasOverride:function(t){return!!t.textColor}}),"text-halo-color":new gi(zt.paint_symbol["text-halo-color"]),"text-halo-width":new gi(zt.paint_symbol["text-halo-width"]),"text-halo-blur":new gi(zt.paint_symbol["text-halo-blur"]),"text-translate":new yi(zt.paint_symbol["text-translate"]),"text-translate-anchor":new yi(zt.paint_symbol["text-translate-anchor"])}),layout:vl},xl=function(t){this.type=t.property.overrides?t.property.overrides.runtimeType:Ot,this.defaultValue=t};xl.prototype.evaluate=function(t){if(t.formattedSection){var e=this.defaultValue.property.overrides;if(e&&e.hasOverride(t.formattedSection))return e.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default},xl.prototype.eachChild=function(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)},xl.prototype.outputDefined=function(){return!1},xl.prototype.serialize=function(){return null},Fn("FormatSectionOverride",xl,{omit:["defaultValue"]});var bl=function(t){function e(e){t.call(this,e,_l)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.recalculate=function(e,r){if(t.prototype.recalculate.call(this,e,r),"auto"===this.layout.get("icon-rotation-alignment")&&(this.layout._values["icon-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-rotation-alignment")&&(this.layout._values["text-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),"point"===this.layout.get("symbol-placement")){var n=this.layout.get("text-writing-mode");if(n){for(var i=[],o=0,a=n;o<a.length;o+=1){var s=a[o];i.indexOf(s)<0&&i.push(s)}this.layout._values["text-writing-mode"]=i}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()},e.prototype.getValueAndResolveTokens=function(t,e,r,n){var i=this.layout.get(t).evaluate(e,{},r,n),o=this._unevaluatedLayout._values[t];return o.isDataDriven()||Zr(o.value)||!i?i:function(t,e){return e.replace(/{([^{}]+)}/g,(function(e,r){return r in t?String(t[r]):""}))}(e.properties,i)},e.prototype.createBucket=function(t){return new gl(t)},e.prototype.queryRadius=function(){return 0},e.prototype.queryIntersectsFeature=function(){return!1},e.prototype._setPaintOverrides=function(){for(var t=0,r=_l.paint.overridableProperties;t<r.length;t+=1){var n=r[t];if(e.hasPaintOverride(this.layout,n)){var i,o=this.paint.get(n),a=new xl(o),s=new $r(a,o.property.specification);i="constant"===o.value.kind||"source"===o.value.kind?new Wr("source",s):new Xr("composite",s,o.value.zoomStops,o.value._interpolationType),this.paint._values[n]=new di(o.property,i,o.parameters)}}},e.prototype._handleOverridablePaintPropertyUpdate=function(t,r,n){return!(!this.layout||r.isDataDriven()||n.isDataDriven())&&e.hasPaintOverride(this.layout,t)},e.hasPaintOverride=function(t,e){var r=t.get("text-field"),n=_l.paint.properties[e],i=!1,o=function(t){for(var e=0,r=t;e<r.length;e+=1)if(n.overrides&&n.overrides.hasOverride(r[e]))return void(i=!0)};if("constant"===r.value.kind&&r.value.value instanceof ne)o(r.value.value.sections);else if("source"===r.value.kind){var a=function(t){i||(t instanceof le&&se(t.value)===Zt?o(t.value.sections):t instanceof fe?o(t.sections):t.eachChild(a))},s=r.value;s._styleExpression&&a(s._styleExpression.expression)}return i},e}(wi),wl={paint:new bi({"background-color":new yi(zt.paint_background["background-color"]),"background-pattern":new _i(zt.paint_background["background-pattern"]),"background-opacity":new yi(zt.paint_background["background-opacity"])})},Sl=function(t){function e(e){t.call(this,e,wl)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(wi),Al={paint:new bi({"raster-opacity":new yi(zt.paint_raster["raster-opacity"]),"raster-hue-rotate":new yi(zt.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new yi(zt.paint_raster["raster-brightness-min"]),"raster-brightness-max":new yi(zt.paint_raster["raster-brightness-max"]),"raster-saturation":new yi(zt.paint_raster["raster-saturation"]),"raster-contrast":new yi(zt.paint_raster["raster-contrast"]),"raster-resampling":new yi(zt.paint_raster["raster-resampling"]),"raster-fade-duration":new yi(zt.paint_raster["raster-fade-duration"])})},El=function(t){function e(e){t.call(this,e,Al)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(wi),Tl=function(t){function e(e){t.call(this,e,{}),this.implementation=e}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.is3D=function(){return"3d"===this.implementation.renderingMode},e.prototype.hasOffscreenPass=function(){return void 0!==this.implementation.prerender},e.prototype.recalculate=function(){},e.prototype.updateTransitions=function(){},e.prototype.hasTransition=function(){},e.prototype.serialize=function(){},e.prototype.onAdd=function(t){this.implementation.onAdd&&this.implementation.onAdd(t,t.painter.context.gl)},e.prototype.onRemove=function(t){this.implementation.onRemove&&this.implementation.onRemove(t,t.painter.context.gl)},e}(wi),kl={circle:ha,heatmap:wa,hillshade:Aa,fill:cs,"fill-extrusion":ks,line:Vs,symbol:bl,background:Sl,raster:El},Il=a.HTMLImageElement,zl=a.HTMLCanvasElement,Cl=a.HTMLVideoElement,Pl=a.ImageData,Ml=a.ImageBitmap,Dl=function(t,e,r,n){this.context=t,this.format=r,this.texture=t.gl.createTexture(),this.update(e,n)};Dl.prototype.update=function(t,e,r){var n=t.width,i=t.height,o=!(this.size&&this.size[0]===n&&this.size[1]===i||r),a=this.context,s=a.gl;if(this.useMipmap=Boolean(e&&e.useMipmap),s.bindTexture(s.TEXTURE_2D,this.texture),a.pixelStoreUnpackFlipY.set(!1),a.pixelStoreUnpack.set(1),a.pixelStoreUnpackPremultiplyAlpha.set(this.format===s.RGBA&&(!e||!1!==e.premultiply)),o)this.size=[n,i],t instanceof Il||t instanceof zl||t instanceof Cl||t instanceof Pl||Ml&&t instanceof Ml?s.texImage2D(s.TEXTURE_2D,0,this.format,this.format,s.UNSIGNED_BYTE,t):s.texImage2D(s.TEXTURE_2D,0,this.format,n,i,0,this.format,s.UNSIGNED_BYTE,t.data);else{var u=r||{x:0,y:0},l=u.x,c=u.y;t instanceof Il||t instanceof zl||t instanceof Cl||t instanceof Pl||Ml&&t instanceof Ml?s.texSubImage2D(s.TEXTURE_2D,0,l,c,s.RGBA,s.UNSIGNED_BYTE,t):s.texSubImage2D(s.TEXTURE_2D,0,l,c,n,i,s.RGBA,s.UNSIGNED_BYTE,t.data)}this.useMipmap&&this.isSizePowerOfTwo()&&s.generateMipmap(s.TEXTURE_2D)},Dl.prototype.bind=function(t,e,r){var n=this.context.gl;n.bindTexture(n.TEXTURE_2D,this.texture),r!==n.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(r=n.LINEAR),t!==this.filter&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,t),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,r||t),this.filter=t),e!==this.wrap&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,e),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,e),this.wrap=e)},Dl.prototype.isSizePowerOfTwo=function(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0},Dl.prototype.destroy=function(){this.context.gl.deleteTexture(this.texture),this.texture=null};var Ll=function(t){var e=this;this._callback=t,this._triggered=!1,"undefined"!=typeof MessageChannel&&(this._channel=new MessageChannel,this._channel.port2.onmessage=function(){e._triggered=!1,e._callback()})};Ll.prototype.trigger=function(){var t=this;this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout((function(){t._triggered=!1,t._callback()}),0))},Ll.prototype.remove=function(){delete this._channel,this._callback=function(){}};var Bl=function(t,e,r){this.target=t,this.parent=e,this.mapId=r,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},g(["receive","process"],this),this.invoker=new Ll(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=T()?t:a};function Rl(t,e,r){var n=2*Math.PI*6378137/256/Math.pow(2,r);return[t*n-2*Math.PI*6378137/2,e*n-2*Math.PI*6378137/2]}Bl.prototype.send=function(t,e,r,n,i){var o=this;void 0===i&&(i=!1);var a=Math.round(1e18*Math.random()).toString(36).substring(0,10);r&&(this.callbacks[a]=r);var s=z(this.globalScope)?void 0:[];return this.target.postMessage({id:a,type:t,hasCallback:!!r,targetMapId:n,mustQueue:i,sourceMapId:this.mapId,data:Nn(e,s)},s),{cancel:function(){r&&delete o.callbacks[a],o.target.postMessage({id:a,type:"<cancel>",targetMapId:n,sourceMapId:o.mapId})}}},Bl.prototype.receive=function(t){var e=t.data,r=e.id;if(r&&(!e.targetMapId||this.mapId===e.targetMapId))if("<cancel>"===e.type){delete this.tasks[r];var n=this.cancelCallbacks[r];delete this.cancelCallbacks[r],n&&n()}else T()||e.mustQueue?(this.tasks[r]=e,this.taskQueue.push(r),this.invoker.trigger()):this.processTask(r,e)},Bl.prototype.process=function(){if(this.taskQueue.length){var t=this.taskQueue.shift(),e=this.tasks[t];delete this.tasks[t],this.taskQueue.length&&this.invoker.trigger(),e&&this.processTask(t,e)}},Bl.prototype.processTask=function(t,e){var r=this;if("<response>"===e.type){var n=this.callbacks[t];delete this.callbacks[t],n&&(e.error?n(qn(e.error)):n(null,qn(e.data)))}else{var i=!1,o=z(this.globalScope)?void 0:[],a=e.hasCallback?function(e,n){i=!0,delete r.cancelCallbacks[t],r.target.postMessage({id:t,type:"<response>",sourceMapId:r.mapId,error:e?Nn(e):null,data:Nn(n,o)},o)}:function(t){i=!0},s=null,u=qn(e.data);if(this.parent[e.type])s=this.parent[e.type](e.sourceMapId,u,a);else if(this.parent.getWorkerSource){var l=e.type.split(".");s=this.parent.getWorkerSource(e.sourceMapId,l[0],u.source)[l[1]](u,a)}else a(new Error("Could not find function "+e.type));!i&&s&&s.cancel&&(this.cancelCallbacks[t]=s.cancel)}},Bl.prototype.remove=function(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)};var Ol=function(t,e){t&&(e?this.setSouthWest(t).setNorthEast(e):4===t.length?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1]))};Ol.prototype.setNorthEast=function(t){return this._ne=t instanceof Fl?new Fl(t.lng,t.lat):Fl.convert(t),this},Ol.prototype.setSouthWest=function(t){return this._sw=t instanceof Fl?new Fl(t.lng,t.lat):Fl.convert(t),this},Ol.prototype.extend=function(t){var e,r,n=this._sw,i=this._ne;if(t instanceof Fl)e=t,r=t;else{if(!(t instanceof Ol))return Array.isArray(t)?4===t.length||t.every(Array.isArray)?this.extend(Ol.convert(t)):this.extend(Fl.convert(t)):this;if(r=t._ne,!(e=t._sw)||!r)return this}return n||i?(n.lng=Math.min(e.lng,n.lng),n.lat=Math.min(e.lat,n.lat),i.lng=Math.max(r.lng,i.lng),i.lat=Math.max(r.lat,i.lat)):(this._sw=new Fl(e.lng,e.lat),this._ne=new Fl(r.lng,r.lat)),this},Ol.prototype.getCenter=function(){return new Fl((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)},Ol.prototype.getSouthWest=function(){return this._sw},Ol.prototype.getNorthEast=function(){return this._ne},Ol.prototype.getNorthWest=function(){return new Fl(this.getWest(),this.getNorth())},Ol.prototype.getSouthEast=function(){return new Fl(this.getEast(),this.getSouth())},Ol.prototype.getWest=function(){return this._sw.lng},Ol.prototype.getSouth=function(){return this._sw.lat},Ol.prototype.getEast=function(){return this._ne.lng},Ol.prototype.getNorth=function(){return this._ne.lat},Ol.prototype.toArray=function(){return[this._sw.toArray(),this._ne.toArray()]},Ol.prototype.toString=function(){return"LngLatBounds("+this._sw.toString()+", "+this._ne.toString()+")"},Ol.prototype.isEmpty=function(){return!(this._sw&&this._ne)},Ol.prototype.contains=function(t){var e=Fl.convert(t),r=e.lng,n=e.lat,i=this._sw.lng<=r&&r<=this._ne.lng;return this._sw.lng>this._ne.lng&&(i=this._sw.lng>=r&&r>=this._ne.lng),this._sw.lat<=n&&n<=this._ne.lat&&i},Ol.convert=function(t){return!t||t instanceof Ol?t:new Ol(t)};var Fl=function(t,e){if(isNaN(t)||isNaN(e))throw new Error("Invalid LngLat object: ("+t+", "+e+")");if(this.lng=+t,this.lat=+e,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")};Fl.prototype.wrap=function(){return new Fl(p(this.lng,-180,180),this.lat)},Fl.prototype.toArray=function(){return[this.lng,this.lat]},Fl.prototype.toString=function(){return"LngLat("+this.lng+", "+this.lat+")"},Fl.prototype.distanceTo=function(t){var e=Math.PI/180,r=this.lat*e,n=t.lat*e,i=Math.sin(r)*Math.sin(n)+Math.cos(r)*Math.cos(n)*Math.cos((t.lng-this.lng)*e);return 6371008.8*Math.acos(Math.min(i,1))},Fl.prototype.toBounds=function(t){void 0===t&&(t=0);var e=360*t/40075017,r=e/Math.cos(Math.PI/180*this.lat);return new Ol(new Fl(this.lng-r,this.lat-e),new Fl(this.lng+r,this.lat+e))},Fl.convert=function(t){if(t instanceof Fl)return t;if(Array.isArray(t)&&(2===t.length||3===t.length))return new Fl(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&"object"==typeof t&&null!==t)return new Fl(Number("lng"in t?t.lng:t.lon),Number(t.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")};var Vl=2*Math.PI*6371008.8;function Ul(t){return Vl*Math.cos(t*Math.PI/180)}function jl(t){return(180+t)/360}function Nl(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function ql(t,e){return t/Ul(e)}function $l(t){return 360/Math.PI*Math.atan(Math.exp((180-360*t)*Math.PI/180))-90}var Zl=function(t,e,r){void 0===r&&(r=0),this.x=+t,this.y=+e,this.z=+r};Zl.fromLngLat=function(t,e){void 0===e&&(e=0);var r=Fl.convert(t);return new Zl(jl(r.lng),Nl(r.lat),ql(e,r.lat))},Zl.prototype.toLngLat=function(){return new Fl(360*this.x-180,$l(this.y))},Zl.prototype.toAltitude=function(){return this.z*Ul($l(this.y))},Zl.prototype.meterInMercatorCoordinateUnits=function(){return 1/Vl*(t=$l(this.y),1/Math.cos(t*Math.PI/180));var t};var Gl=function(t,e,r){this.z=t,this.x=e,this.y=r,this.key=Hl(0,t,t,e,r)};Gl.prototype.equals=function(t){return this.z===t.z&&this.x===t.x&&this.y===t.y},Gl.prototype.url=function(t,e){var r,n,i,o,a,s=(n=this.y,i=this.z,o=Rl(256*(r=this.x),256*(n=Math.pow(2,i)-n-1),i),a=Rl(256*(r+1),256*(n+1),i),o[0]+","+o[1]+","+a[0]+","+a[1]),u=function(t,e,r){for(var n,i="",o=t;o>0;o--)i+=(e&(n=1<<o-1)?1:0)+(r&n?2:0);return i}(this.z,this.x,this.y);return t[(this.x+this.y)%t.length].replace("{prefix}",(this.x%16).toString(16)+(this.y%16).toString(16)).replace("{z}",String(this.z)).replace("{x}",String(this.x)).replace("{y}",String("tms"===e?Math.pow(2,this.z)-this.y-1:this.y)).replace("{quadkey}",u).replace("{bbox-epsg-3857}",s)},Gl.prototype.getTilePoint=function(t){var e=Math.pow(2,this.z);return new i(8192*(t.x*e-this.x),8192*(t.y*e-this.y))},Gl.prototype.toString=function(){return this.z+"/"+this.x+"/"+this.y};var Wl=function(t,e){this.wrap=t,this.canonical=e,this.key=Hl(t,e.z,e.z,e.x,e.y)},Xl=function(t,e,r,n,i){this.overscaledZ=t,this.wrap=e,this.canonical=new Gl(r,+n,+i),this.key=Hl(e,t,r,n,i)};function Hl(t,e,r,n,i){(t*=2)<0&&(t=-1*t-1);var o=1<<r;return(o*o*t+o*i+n).toString(36)+r.toString(36)+e.toString(36)}Xl.prototype.equals=function(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)},Xl.prototype.scaledTo=function(t){var e=this.canonical.z-t;return t>this.canonical.z?new Xl(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Xl(t,this.wrap,t,this.canonical.x>>e,this.canonical.y>>e)},Xl.prototype.calculateScaledKey=function(t,e){var r=this.canonical.z-t;return t>this.canonical.z?Hl(this.wrap*+e,t,this.canonical.z,this.canonical.x,this.canonical.y):Hl(this.wrap*+e,t,t,this.canonical.x>>r,this.canonical.y>>r)},Xl.prototype.isChildOf=function(t){if(t.wrap!==this.wrap)return!1;var e=this.canonical.z-t.canonical.z;return 0===t.overscaledZ||t.overscaledZ<this.overscaledZ&&t.canonical.x===this.canonical.x>>e&&t.canonical.y===this.canonical.y>>e},Xl.prototype.children=function(t){if(this.overscaledZ>=t)return[new Xl(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];var e=this.canonical.z+1,r=2*this.canonical.x,n=2*this.canonical.y;return[new Xl(e,this.wrap,e,r,n),new Xl(e,this.wrap,e,r+1,n),new Xl(e,this.wrap,e,r,n+1),new Xl(e,this.wrap,e,r+1,n+1)]},Xl.prototype.isLessThan=function(t){return this.wrap<t.wrap||!(this.wrap>t.wrap)&&(this.overscaledZ<t.overscaledZ||!(this.overscaledZ>t.overscaledZ)&&(this.canonical.x<t.canonical.x||!(this.canonical.x>t.canonical.x)&&this.canonical.y<t.canonical.y))},Xl.prototype.wrapped=function(){return new Xl(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)},Xl.prototype.unwrapTo=function(t){return new Xl(this.overscaledZ,t,this.canonical.z,this.canonical.x,this.canonical.y)},Xl.prototype.overscaleFactor=function(){return Math.pow(2,this.overscaledZ-this.canonical.z)},Xl.prototype.toUnwrapped=function(){return new Wl(this.wrap,this.canonical)},Xl.prototype.toString=function(){return this.overscaledZ+"/"+this.canonical.x+"/"+this.canonical.y},Xl.prototype.getTilePoint=function(t){return this.canonical.getTilePoint(new Zl(t.x-this.wrap,t.y))},Fn("CanonicalTileID",Gl),Fn("OverscaledTileID",Xl,{omit:["posMatrix"]});var Kl=function(t,e,r){if(this.uid=t,e.height!==e.width)throw new RangeError("DEM tiles must be square");if(r&&"mapbox"!==r&&"terrarium"!==r)return S('"'+r+'" is not a valid encoding type. Valid types include "mapbox" and "terrarium".');this.stride=e.height;var n=this.dim=e.height-2;this.data=new Uint32Array(e.data.buffer),this.encoding=r||"mapbox";for(var i=0;i<n;i++)this.data[this._idx(-1,i)]=this.data[this._idx(0,i)],this.data[this._idx(n,i)]=this.data[this._idx(n-1,i)],this.data[this._idx(i,-1)]=this.data[this._idx(i,0)],this.data[this._idx(i,n)]=this.data[this._idx(i,n-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(n,-1)]=this.data[this._idx(n-1,0)],this.data[this._idx(-1,n)]=this.data[this._idx(0,n-1)],this.data[this._idx(n,n)]=this.data[this._idx(n-1,n-1)]};Kl.prototype.get=function(t,e){var r=new Uint8Array(this.data.buffer),n=4*this._idx(t,e);return("terrarium"===this.encoding?this._unpackTerrarium:this._unpackMapbox)(r[n],r[n+1],r[n+2])},Kl.prototype.getUnpackVector=function(){return"terrarium"===this.encoding?[256,1,1/256,32768]:[6553.6,25.6,.1,1e4]},Kl.prototype._idx=function(t,e){if(t<-1||t>=this.dim+1||e<-1||e>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(e+1)*this.stride+(t+1)},Kl.prototype._unpackMapbox=function(t,e,r){return(256*t*256+256*e+r)/10-1e4},Kl.prototype._unpackTerrarium=function(t,e,r){return 256*t+e+r/256-32768},Kl.prototype.getPixels=function(){return new _a({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))},Kl.prototype.backfillBorder=function(t,e,r){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");var n=e*this.dim,i=e*this.dim+this.dim,o=r*this.dim,a=r*this.dim+this.dim;switch(e){case-1:n=i-1;break;case 1:i=n+1}switch(r){case-1:o=a-1;break;case 1:a=o+1}for(var s=-e*this.dim,u=-r*this.dim,l=o;l<a;l++)for(var c=n;c<i;c++)this.data[this._idx(c,l)]=t.data[this._idx(c+s,l+u)]},Fn("DEMData",Kl);var Yl=function(t){this._stringToNumber={},this._numberToString=[];for(var e=0;e<t.length;e++){var r=t[e];this._stringToNumber[r]=e,this._numberToString[e]=r}};Yl.prototype.encode=function(t){return this._stringToNumber[t]},Yl.prototype.decode=function(t){return this._numberToString[t]};var Jl=function(t,e,r,n,i){this.type="Feature",this._vectorTileFeature=t,t._z=e,t._x=r,t._y=n,this.properties=t.properties,this.id=i},Ql={geometry:{configurable:!0}};Ql.geometry.get=function(){return void 0===this._geometry&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry},Ql.geometry.set=function(t){this._geometry=t},Jl.prototype.toJSON=function(){var t={geometry:this.geometry};for(var e in this)"_geometry"!==e&&"_vectorTileFeature"!==e&&(t[e]=this[e]);return t},Object.defineProperties(Jl.prototype,Ql);var tc=function(){this.state={},this.stateChanges={},this.deletedStates={}};tc.prototype.updateState=function(t,e,r){var n=String(e);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][n]=this.stateChanges[t][n]||{},h(this.stateChanges[t][n],r),null===this.deletedStates[t])for(var i in this.deletedStates[t]={},this.state[t])i!==n&&(this.deletedStates[t][i]=null);else if(this.deletedStates[t]&&null===this.deletedStates[t][n])for(var o in this.deletedStates[t][n]={},this.state[t][n])r[o]||(this.deletedStates[t][n][o]=null);else for(var a in r)this.deletedStates[t]&&this.deletedStates[t][n]&&null===this.deletedStates[t][n][a]&&delete this.deletedStates[t][n][a]},tc.prototype.removeFeatureState=function(t,e,r){if(null!==this.deletedStates[t]){var n=String(e);if(this.deletedStates[t]=this.deletedStates[t]||{},r&&void 0!==e)null!==this.deletedStates[t][n]&&(this.deletedStates[t][n]=this.deletedStates[t][n]||{},this.deletedStates[t][n][r]=null);else if(void 0!==e)if(this.stateChanges[t]&&this.stateChanges[t][n])for(r in this.deletedStates[t][n]={},this.stateChanges[t][n])this.deletedStates[t][n][r]=null;else this.deletedStates[t][n]=null;else this.deletedStates[t]=null}},tc.prototype.getState=function(t,e){var r=String(e),n=h({},(this.state[t]||{})[r],(this.stateChanges[t]||{})[r]);if(null===this.deletedStates[t])return{};if(this.deletedStates[t]){var i=this.deletedStates[t][e];if(null===i)return{};for(var o in i)delete n[o]}return n},tc.prototype.initializeTileState=function(t,e){t.setFeatureState(this.state,e)},tc.prototype.coalesceChanges=function(t,e){var r={};for(var n in this.stateChanges){this.state[n]=this.state[n]||{};var i={};for(var o in this.stateChanges[n])this.state[n][o]||(this.state[n][o]={}),h(this.state[n][o],this.stateChanges[n][o]),i[o]=this.state[n][o];r[n]=i}for(var a in this.deletedStates){this.state[a]=this.state[a]||{};var s={};if(null===this.deletedStates[a])for(var u in this.state[a])s[u]={},this.state[a][u]={};else for(var l in this.deletedStates[a]){if(null===this.deletedStates[a][l])this.state[a][l]={};else for(var c=0,p=Object.keys(this.deletedStates[a][l]);c<p.length;c+=1)delete this.state[a][l][p[c]];s[l]=this.state[a][l]}r[a]=r[a]||{},h(r[a],s)}if(this.stateChanges={},this.deletedStates={},0!==Object.keys(r).length)for(var f in t)t[f].setFeatureState(r,e)};var ec=function(t,e){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new Dn(8192,16,0),this.grid3D=new Dn(8192,16,0),this.featureIndexArray=new oo,this.promoteId=e};function rc(t,e,r,n,i){return _(t,(function(t,o){var a=e instanceof mi?e.get(o):null;return a&&a.evaluate?a.evaluate(r,n,i):a}))}function nc(t){for(var e=1/0,r=1/0,n=-1/0,i=-1/0,o=0,a=t;o<a.length;o+=1){var s=a[o];e=Math.min(e,s.x),r=Math.min(r,s.y),n=Math.max(n,s.x),i=Math.max(i,s.y)}return{minX:e,minY:r,maxX:n,maxY:i}}function ic(t,e){return e-t}ec.prototype.insert=function(t,e,r,n,i,o){var a=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(r,n,i);for(var s=o?this.grid3D:this.grid,u=0;u<e.length;u++){for(var l=e[u],c=[1/0,1/0,-1/0,-1/0],p=0;p<l.length;p++){var h=l[p];c[0]=Math.min(c[0],h.x),c[1]=Math.min(c[1],h.y),c[2]=Math.max(c[2],h.x),c[3]=Math.max(c[3],h.y)}c[0]<8192&&c[1]<8192&&c[2]>=0&&c[3]>=0&&s.insert(a,c[0],c[1],c[2],c[3])}},ec.prototype.loadVTLayers=function(){return this.vtLayers||(this.vtLayers=new xs.VectorTile(new Ks(this.rawTileData)).layers,this.sourceLayerCoder=new Yl(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers},ec.prototype.query=function(t,e,r,n){var o=this;this.loadVTLayers();for(var a=t.params||{},s=8192/t.tileSize/t.scale,u=an(a.filter),l=t.queryGeometry,c=t.queryPadding*s,p=nc(l),h=this.grid.query(p.minX-c,p.minY-c,p.maxX+c,p.maxY+c),f=nc(t.cameraQueryGeometry),d=0,m=this.grid3D.query(f.minX-c,f.minY-c,f.maxX+c,f.maxY+c,(function(e,r,n,o){return function(t,e,r,n,o){for(var a=0,s=t;a<s.length;a+=1){var u=s[a];if(e<=u.x&&r<=u.y&&n>=u.x&&o>=u.y)return!0}var l=[new i(e,r),new i(e,o),new i(n,o),new i(n,r)];if(t.length>2)for(var c=0,p=l;c<p.length;c+=1)if(Qo(t,p[c]))return!0;for(var h=0;h<t.length-1;h++)if(ta(t[h],t[h+1],l))return!0;return!1}(t.cameraQueryGeometry,e-c,r-c,n+c,o+c)}));d<m.length;d+=1)h.push(m[d]);h.sort(ic);for(var y,g={},v=function(i){var c=h[i];if(c!==y){y=c;var p=o.featureIndexArray.get(c),f=null;o.loadMatchingFeature(g,p.bucketIndex,p.sourceLayerIndex,p.featureIndex,u,a.layers,a.availableImages,e,r,n,(function(e,r,n){return f||(f=Uo(e)),r.queryIntersectsFeature(l,e,n,f,o.z,t.transform,s,t.pixelPosMatrix)}))}},_=0;_<h.length;_++)v(_);return g},ec.prototype.loadMatchingFeature=function(t,e,r,n,i,o,a,s,u,l,c){var p=this.bucketLayerIDs[e];if(!o||function(t,e){for(var r=0;r<t.length;r++)if(e.indexOf(t[r])>=0)return!0;return!1}(o,p)){var f=this.sourceLayerCoder.decode(r),d=this.vtLayers[f].feature(n);if(i.needGeometry){var m=jo(d,!0);if(!i.filter(new si(this.tileID.overscaledZ),m,this.tileID.canonical))return}else if(!i.filter(new si(this.tileID.overscaledZ),d))return;for(var y=this.getId(d,f),g=0;g<p.length;g++){var v=p[g];if(!(o&&o.indexOf(v)<0)){var _=s[v];if(_){var x={};void 0!==y&&l&&(x=l.getState(_.sourceLayer||"_geojsonTileLayer",y));var b=h({},u[v]);b.paint=rc(b.paint,_.paint,d,x,a),b.layout=rc(b.layout,_.layout,d,x,a);var w=!c||c(d,_,x);if(w){var S=new Jl(d,this.z,this.x,this.y,y);S.layer=b;var A=t[v];void 0===A&&(A=t[v]=[]),A.push({featureIndex:n,feature:S,intersectionZ:w})}}}}}},ec.prototype.lookupSymbolFeatures=function(t,e,r,n,i,o,a,s){var u={};this.loadVTLayers();for(var l=an(i),c=0,p=t;c<p.length;c+=1)this.loadMatchingFeature(u,r,n,p[c],l,o,a,s,e);return u},ec.prototype.hasLayer=function(t){for(var e=0,r=this.bucketLayerIDs;e<r.length;e+=1)for(var n=0,i=r[e];n<i.length;n+=1)if(t===i[n])return!0;return!1},ec.prototype.getId=function(t,e){var r=t.id;return this.promoteId&&"boolean"==typeof(r=t.properties["string"==typeof this.promoteId?this.promoteId:this.promoteId[e]])&&(r=Number(r)),r},Fn("FeatureIndex",ec,{omit:["rawTileData","sourceLayerCoder"]});var oc=function(t,e){this.tileID=t,this.uid=d(),this.uses=0,this.tileSize=e,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.expiredRequestCount=0,this.state="loading"};oc.prototype.registerFadeDuration=function(t){var e=t+this.timeAdded;e<F.now()||this.fadeEndTime&&e<this.fadeEndTime||(this.fadeEndTime=e)},oc.prototype.wasRequested=function(){return"errored"===this.state||"loaded"===this.state||"reloading"===this.state},oc.prototype.loadVectorData=function(t,e,r){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",t){for(var n in t.featureIndex&&(this.latestFeatureIndex=t.featureIndex,t.rawTileData?(this.latestRawTileData=t.rawTileData,this.latestFeatureIndex.rawTileData=t.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=t.collisionBoxArray,this.buckets=function(t,e){var r={};if(!e)return r;for(var n=function(){var t=o[i],n=t.layerIds.map((function(t){return e.getLayer(t)})).filter(Boolean);if(0!==n.length){t.layers=n,t.stateDependentLayerIds&&(t.stateDependentLayers=t.stateDependentLayerIds.map((function(t){return n.filter((function(e){return e.id===t}))[0]})));for(var a=0,s=n;a<s.length;a+=1)r[s[a].id]=t}},i=0,o=t;i<o.length;i+=1)n();return r}(t.buckets,e.style),this.hasSymbolBuckets=!1,this.buckets){var i=this.buckets[n];if(i instanceof gl){if(this.hasSymbolBuckets=!0,!r)break;i.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(var o in this.buckets){var a=this.buckets[o];if(a instanceof gl&&a.hasRTLText){this.hasRTLText=!0,ai.isLoading()||ai.isLoaded()||"deferred"!==ii()||oi();break}}for(var s in this.queryPadding=0,this.buckets){var u=this.buckets[s];this.queryPadding=Math.max(this.queryPadding,e.style.getLayer(s).queryRadius(u))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage)}else this.collisionBoxArray=new Yi},oc.prototype.unloadVectorData=function(){for(var t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"},oc.prototype.getBucket=function(t){return this.buckets[t.id]},oc.prototype.upload=function(t){for(var e in this.buckets){var r=this.buckets[e];r.uploadPending()&&r.upload(t)}var n=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new Dl(t,this.imageAtlas.image,n.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Dl(t,this.glyphAtlasImage,n.ALPHA),this.glyphAtlasImage=null)},oc.prototype.prepare=function(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)},oc.prototype.queryRenderedFeatures=function(t,e,r,n,i,o,a,s,u,l){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:n,cameraQueryGeometry:i,scale:o,tileSize:this.tileSize,pixelPosMatrix:l,transform:s,params:a,queryPadding:this.queryPadding*u},t,e,r):{}},oc.prototype.querySourceFeatures=function(t,e){var r=this.latestFeatureIndex;if(r&&r.rawTileData){var n=r.loadVTLayers(),i=e?e.sourceLayer:"",o=n._geojsonTileLayer||n[i];if(o)for(var a=an(e&&e.filter),s=this.tileID.canonical,u=s.z,l=s.x,c=s.y,p={z:u,x:l,y:c},h=0;h<o.length;h++){var f=o.feature(h);if(a.needGeometry){var d=jo(f,!0);if(!a.filter(new si(this.tileID.overscaledZ),d,this.tileID.canonical))continue}else if(!a.filter(new si(this.tileID.overscaledZ),f))continue;var m=r.getId(f,i),y=new Jl(f,u,l,c,m);y.tile=p,t.push(y)}}},oc.prototype.hasData=function(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state},oc.prototype.patternsLoaded=function(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length},oc.prototype.setExpiryData=function(t){var e=this.expirationTime;if(t.cacheControl){var r=k(t.cacheControl);r["max-age"]&&(this.expirationTime=Date.now()+1e3*r["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){var n=Date.now(),i=!1;if(this.expirationTime>n)i=!1;else if(e)if(this.expirationTime<e)i=!0;else{var o=this.expirationTime-e;o?this.expirationTime=n+Math.max(o,3e4):i=!0}else i=!0;i?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}},oc.prototype.getExpiryTimeout=function(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-(new Date).getTime(),Math.pow(2,31)-1)},oc.prototype.setFeatureState=function(t,e){if(this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData&&0!==Object.keys(t).length){var r=this.latestFeatureIndex.loadVTLayers();for(var n in this.buckets)if(e.style.hasLayer(n)){var i=this.buckets[n],o=i.layers[0].sourceLayer||"_geojsonTileLayer",a=r[o],s=t[o];if(a&&s&&0!==Object.keys(s).length){i.update(s,a,this.imageAtlas&&this.imageAtlas.patternPositions||{});var u=e&&e.style&&e.style.getLayer(n);u&&(this.queryPadding=Math.max(this.queryPadding,u.queryRadius(i)))}}}},oc.prototype.holdingForFade=function(){return void 0!==this.symbolFadeHoldUntil},oc.prototype.symbolFadeFinished=function(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<F.now()},oc.prototype.clearFadeHold=function(){this.symbolFadeHoldUntil=void 0},oc.prototype.setHoldDuration=function(t){this.symbolFadeHoldUntil=F.now()+t},oc.prototype.setDependencies=function(t,e){for(var r={},n=0,i=e;n<i.length;n+=1)r[i[n]]=!0;this.dependencies[t]=r},oc.prototype.hasDependency=function(t,e){for(var r=0,n=t;r<n.length;r+=1){var i=this.dependencies[n[r]];if(i)for(var o=0,a=e;o<a.length;o+=1)if(i[a[o]])return!0}return!1};var ac=a.performance,sc=function(t){this._marks={start:[t.url,"start"].join("#"),end:[t.url,"end"].join("#"),measure:t.url.toString()},ac.mark(this._marks.start)};sc.prototype.finish=function(){ac.mark(this._marks.end);var t=ac.getEntriesByName(this._marks.measure);return 0===t.length&&(ac.measure(this._marks.measure,this._marks.start,this._marks.end),t=ac.getEntriesByName(this._marks.measure),ac.clearMarks(this._marks.start),ac.clearMarks(this._marks.end),ac.clearMeasures(this._marks.measure)),t},t.Actor=Bl,t.AlphaImage=va,t.CanonicalTileID=Gl,t.CollisionBoxArray=Yi,t.Color=te,t.DEMData=Kl,t.DataConstantProperty=yi,t.DictionaryCoder=Yl,t.EXTENT=8192,t.ErrorEvent=kt,t.EvaluationParameters=si,t.Event=Tt,t.Evented=It,t.FeatureIndex=ec,t.FillBucket=ss,t.FillExtrusionBucket=As,t.ImageAtlas=xu,t.ImagePosition=vu,t.LineBucket=Bs,t.LngLat=Fl,t.LngLatBounds=Ol,t.MercatorCoordinate=Zl,t.ONE_EM=24,t.OverscaledTileID=Xl,t.Point=i,t.Point$1=i,t.Properties=bi,t.Protobuf=Ks,t.RGBAImage=_a,t.RequestManager=Z,t.RequestPerformance=sc,t.ResourceType=dt,t.SegmentVector=so,t.SourceFeatureState=tc,t.StructArrayLayout1ui2=Xi,t.StructArrayLayout2f1f2i16=Vi,t.StructArrayLayout2i4=Ii,t.StructArrayLayout3ui6=ji,t.StructArrayLayout4i8=zi,t.SymbolBucket=gl,t.Texture=Dl,t.Tile=oc,t.Transitionable=ci,t.Uniform1f=bo,t.Uniform1i=xo,t.Uniform2f=wo,t.Uniform3f=So,t.Uniform4f=Ao,t.UniformColor=Eo,t.UniformMatrix4f=ko,t.UnwrappedTileID=Wl,t.ValidationError=Ct,t.WritingMode=bu,t.ZoomHistory=$n,t.add=function(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t},t.addDynamicAttributes=fl,t.asyncAll=function(t,e,r){if(!t.length)return r(null,[]);var n=t.length,i=new Array(t.length),o=null;t.forEach((function(t,a){e(t,(function(t,e){t&&(o=t),i[a]=e,0==--n&&r(o,i)}))}))},t.bezier=u,t.bindAll=g,t.browser=F,t.cacheEntryPossiblyAdded=function(t){++ht>ut&&(t.getActor().send("enforceCacheSizeLimit",st),ht=0)},t.clamp=c,t.clearTileCache=function(t){var e=a.caches.delete("mapbox-tiles");t&&e.catch(t).then((function(){return t()}))},t.clipLine=Gu,t.clone=function(t){var e=new aa(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],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},t.clone$1=b,t.clone$2=function(t){var e=new aa(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e},t.collisionCircleLayout=Zs,t.config=V,t.create=function(){var t=new aa(16);return aa!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t},t.create$1=function(){var t=new aa(9);return aa!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t},t.create$2=function(){var t=new aa(4);return aa!=Float32Array&&(t[1]=0,t[2]=0),t[0]=1,t[3]=1,t},t.createCommonjsModule=e,t.createExpression=Gr,t.createLayout=Ti,t.createStyleLayer=function(t){return"custom"===t.type?new Tl(t):new kl[t.type](t)},t.cross=function(t,e,r){var n=e[0],i=e[1],o=e[2],a=r[0],s=r[1],u=r[2];return t[0]=i*u-o*s,t[1]=o*a-n*u,t[2]=n*s-i*a,t},t.deepEqual=function t(e,r){if(Array.isArray(e)){if(!Array.isArray(r)||e.length!==r.length)return!1;for(var n=0;n<e.length;n++)if(!t(e[n],r[n]))return!1;return!0}if("object"==typeof e&&null!==e&&null!==r){if("object"!=typeof r)return!1;if(Object.keys(e).length!==Object.keys(r).length)return!1;for(var i in e)if(!t(e[i],r[i]))return!1;return!0}return e===r},t.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]},t.dot$1=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]},t.ease=l,t.emitValidationErrors=Mn,t.endsWith=v,t.enforceCacheSizeLimit=function(t){lt(),tt&&tt.then((function(e){e.keys().then((function(r){for(var n=0;n<r.length-t;n++)e.delete(r[n])}))}))},t.evaluateSizeForFeature=Ou,t.evaluateSizeForZoom=Fu,t.evaluateVariableOffset=ol,t.evented=ni,t.extend=h,t.featureFilter=an,t.filterObject=x,t.fromRotation=function(t,e){var r=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=r,t[2]=0,t[3]=-r,t[4]=n,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},t.getAnchorAlignment=Mu,t.getAnchorJustification=al,t.getArrayBuffer=xt,t.getImage=St,t.getJSON=function(t,e){return _t(h(t,{type:"json"}),e)},t.getRTLTextPluginStatus=ii,t.getReferrer=vt,t.getVideo=function(t,e){var r,n,i=a.document.createElement("video");i.muted=!0,i.onloadstart=function(){e(null,i)};for(var o=0;o<t.length;o++){var s=a.document.createElement("source");r=t[o],n=void 0,(n=a.document.createElement("a")).href=r,(n.protocol!==a.document.location.protocol||n.host!==a.document.location.host)&&(i.crossOrigin="Anonymous"),s.src=t[o],i.appendChild(s)}return{cancel:function(){}}},t.identity=sa,t.invert=function(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=e[4],s=e[5],u=e[6],l=e[7],c=e[8],p=e[9],h=e[10],f=e[11],d=e[12],m=e[13],y=e[14],g=e[15],v=r*s-n*a,_=r*u-i*a,x=r*l-o*a,b=n*u-i*s,w=n*l-o*s,S=i*l-o*u,A=c*m-p*d,E=c*y-h*d,T=c*g-f*d,k=p*y-h*m,I=p*g-f*m,z=h*g-f*y,C=v*z-_*I+x*k+b*T-w*E+S*A;return C?(t[0]=(s*z-u*I+l*k)*(C=1/C),t[1]=(i*I-n*z-o*k)*C,t[2]=(m*S-y*w+g*b)*C,t[3]=(h*w-p*S-f*b)*C,t[4]=(u*T-a*z-l*E)*C,t[5]=(r*z-i*T+o*E)*C,t[6]=(y*x-d*S-g*_)*C,t[7]=(c*S-h*x+f*_)*C,t[8]=(a*I-s*T+l*A)*C,t[9]=(n*T-r*I-o*A)*C,t[10]=(d*w-m*x+g*v)*C,t[11]=(p*x-c*w-f*v)*C,t[12]=(s*E-a*k-u*A)*C,t[13]=(r*k-n*E+i*A)*C,t[14]=(m*_-d*b-y*v)*C,t[15]=(c*b-p*_+h*v)*C,t):null},t.isChar=Zn,t.isMapboxURL=G,t.keysDifference=function(t,e){var r=[];for(var n in t)n in e||r.push(n);return r},t.makeRequest=_t,t.mapObject=_,t.mercatorXfromLng=jl,t.mercatorYfromLat=Nl,t.mercatorZfromAltitude=ql,t.mul=ca,t.multiply=ua,t.mvt=xs,t.nextPowerOfTwo=function(t){return t<=1?1:Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},t.normalize=function(t,e){var r=e[0],n=e[1],i=e[2],o=r*r+n*n+i*i;return o>0&&(o=1/Math.sqrt(o)),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o,t},t.number=$e,t.offscreenCanvasSupported=ft,t.ortho=function(t,e,r,n,i,o,a){var s=1/(e-r),u=1/(n-i),l=1/(o-a);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*u,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*l,t[11]=0,t[12]=(e+r)*s,t[13]=(i+n)*u,t[14]=(a+o)*l,t[15]=1,t},t.parseGlyphPBF=function(t){return new Ks(t).readFields(du,[])},t.pbf=Ks,t.performSymbolLayout=function(t,e,r,n,i,o,a){t.createArrays(),t.tilePixelRatio=8192/(512*t.overscaling),t.compareText={},t.iconsNeedLinear=!1;var s=t.layers[0].layout,u=t.layers[0]._unevaluatedLayout._values,l={};if("composite"===t.textSizeData.kind){var c=t.textSizeData,p=c.maxZoom;l.compositeTextSizes=[u["text-size"].possiblyEvaluate(new si(c.minZoom),a),u["text-size"].possiblyEvaluate(new si(p),a)]}if("composite"===t.iconSizeData.kind){var h=t.iconSizeData,f=h.maxZoom;l.compositeIconSizes=[u["icon-size"].possiblyEvaluate(new si(h.minZoom),a),u["icon-size"].possiblyEvaluate(new si(f),a)]}l.layoutTextSize=u["text-size"].possiblyEvaluate(new si(t.zoom+1),a),l.layoutIconSize=u["icon-size"].possiblyEvaluate(new si(t.zoom+1),a),l.textMaxSize=u["text-size"].possiblyEvaluate(new si(18));for(var d=24*s.get("text-line-height"),m="map"===s.get("text-rotation-alignment")&&"point"!==s.get("symbol-placement"),y=s.get("text-keep-upright"),g=s.get("text-size"),v=function(){var o=x[_],u=s.get("text-font").evaluate(o,{},a).join(","),c=g.evaluate(o,{},a),p=l.layoutTextSize.evaluate(o,{},a),h=l.layoutIconSize.evaluate(o,{},a),f={horizontal:{},vertical:void 0},v=o.text,b=[0,0];if(v){var w=v.toString(),A=24*s.get("text-letter-spacing").evaluate(o,{},a),E=function(t){for(var e=0,r=t;e<r.length;e+=1)if(n=r[e].charCodeAt(0),Zn.Arabic(n)||Zn["Arabic Supplement"](n)||Zn["Arabic Extended-A"](n)||Zn["Arabic Presentation Forms-A"](n)||Zn["Arabic Presentation Forms-B"](n))return!1;var n;return!0}(w)?A:0,T=s.get("text-anchor").evaluate(o,{},a),k=s.get("text-variable-anchor");if(!k){var I=s.get("text-radial-offset").evaluate(o,{},a);b=I?ol(T,[24*I,il]):s.get("text-offset").evaluate(o,{},a).map((function(t){return 24*t}))}var z=m?"center":s.get("text-justify").evaluate(o,{},a),C=s.get("symbol-placement"),P="point"===C?24*s.get("text-max-width").evaluate(o,{},a):0,M=function(){t.allowVerticalPlacement&&Gn(w)&&(f.vertical=Au(v,e,r,i,u,P,d,T,"left",E,b,bu.vertical,!0,C,p,c))};if(!m&&k){for(var D="auto"===z?k.map((function(t){return al(t)})):[z],L=!1,B=0;B<D.length;B++){var R=D[B];if(!f.horizontal[R])if(L)f.horizontal[R]=f.horizontal[0];else{var O=Au(v,e,r,i,u,P,d,"center",R,E,b,bu.horizontal,!1,C,p,c);O&&(f.horizontal[R]=O,L=1===O.positionedLines.length)}}M()}else{"auto"===z&&(z=al(T));var F=Au(v,e,r,i,u,P,d,T,z,E,b,bu.horizontal,!1,C,p,c);F&&(f.horizontal[z]=F),M(),Gn(w)&&m&&y&&(f.vertical=Au(v,e,r,i,u,P,d,T,z,E,b,bu.vertical,!1,C,p,c))}}var V=void 0,U=!1;if(o.icon&&o.icon.name){var j=n[o.icon.name];j&&(V=function(t,e,r){var n=Mu(r),i=e[0]-t.displaySize[0]*n.horizontalAlign,o=e[1]-t.displaySize[1]*n.verticalAlign;return{image:t,top:o,bottom:o+t.displaySize[1],left:i,right:i+t.displaySize[0]}}(i[o.icon.name],s.get("icon-offset").evaluate(o,{},a),s.get("icon-anchor").evaluate(o,{},a)),U=j.sdf,void 0===t.sdfIcons?t.sdfIcons=j.sdf:t.sdfIcons!==j.sdf&&S("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(j.pixelRatio!==t.pixelRatio||0!==s.get("icon-rotate").constantOr(1))&&(t.iconsNeedLinear=!0))}var N=ul(f.horizontal)||f.vertical;t.iconsInText=!!N&&N.iconsInText,(N||V)&&function(t,e,r,n,i,o,a,s,u,l,c){var p=o.textMaxSize.evaluate(e,{});void 0===p&&(p=a);var h,f=t.layers[0].layout,d=f.get("icon-offset").evaluate(e,{},c),m=ul(r.horizontal),y=a/24,g=t.tilePixelRatio*y,v=t.tilePixelRatio*p/24,_=t.tilePixelRatio*s,x=t.tilePixelRatio*f.get("symbol-spacing"),b=f.get("text-padding")*t.tilePixelRatio,w=f.get("icon-padding")*t.tilePixelRatio,A=f.get("text-max-angle")/180*Math.PI,E="map"===f.get("text-rotation-alignment")&&"point"!==f.get("symbol-placement"),T="map"===f.get("icon-rotation-alignment")&&"point"!==f.get("symbol-placement"),k=f.get("symbol-placement"),I=x/2,z=f.get("icon-text-fit");n&&"none"!==z&&(t.allowVerticalPlacement&&r.vertical&&(h=Lu(n,r.vertical,z,f.get("icon-text-fit-padding"),d,y)),m&&(n=Lu(n,m,z,f.get("icon-text-fit-padding"),d,y)));var C=function(s,p){p.x<0||p.x>=8192||p.y<0||p.y>=8192||function(t,e,r,n,i,o,a,s,u,l,c,p,h,f,d,m,y,g,v,_,x,b,w,A,E){var T,k,I,z,C,P=t.addToLineVertexArray(e,r),M=0,D=0,L=0,B=0,R=-1,O=-1,F={},V=ho(""),U=0,j=0;if(void 0===s._unevaluatedLayout.getValue("text-radial-offset")?(U=(T=s.layout.get("text-offset").evaluate(x,{},A).map((function(t){return 24*t})))[0],j=T[1]):(U=24*s.layout.get("text-radial-offset").evaluate(x,{},A),j=il),t.allowVerticalPlacement&&n.vertical){var N=s.layout.get("text-rotate").evaluate(x,{},A)+90;z=new Ju(u,e,l,c,p,n.vertical,h,f,d,N),a&&(C=new Ju(u,e,l,c,p,a,y,g,d,N))}if(i){var q=s.layout.get("icon-rotate").evaluate(x,{}),$="none"!==s.layout.get("icon-text-fit"),Z=Wu(i,q,w,$),G=a?Wu(a,q,w,$):void 0;I=new Ju(u,e,l,c,p,i,y,g,!1,q),M=4*Z.length;var W=t.iconSizeData,X=null;"source"===W.kind?(X=[128*s.layout.get("icon-size").evaluate(x,{})])[0]>32640&&S(t.layerIds[0]+': Value for "icon-size" is >= 255. Reduce your "icon-size".'):"composite"===W.kind&&((X=[128*b.compositeIconSizes[0].evaluate(x,{},A),128*b.compositeIconSizes[1].evaluate(x,{},A)])[0]>32640||X[1]>32640)&&S(t.layerIds[0]+': Value for "icon-size" is >= 255. Reduce your "icon-size".'),t.addSymbols(t.icon,Z,X,_,v,x,!1,e,P.lineStartIndex,P.lineLength,-1,A),R=t.icon.placedSymbolArray.length-1,G&&(D=4*G.length,t.addSymbols(t.icon,G,X,_,v,x,bu.vertical,e,P.lineStartIndex,P.lineLength,-1,A),O=t.icon.placedSymbolArray.length-1)}for(var H in n.horizontal){var K=n.horizontal[H];if(!k){V=ho(K.text);var Y=s.layout.get("text-rotate").evaluate(x,{},A);k=new Ju(u,e,l,c,p,K,h,f,d,Y)}var J=1===K.positionedLines.length;if(L+=sl(t,e,K,o,s,d,x,m,P,n.vertical?bu.horizontal:bu.horizontalOnly,J?Object.keys(n.horizontal):[H],F,R,b,A),J)break}n.vertical&&(B+=sl(t,e,n.vertical,o,s,d,x,m,P,bu.vertical,["vertical"],F,O,b,A));var Q=k?k.boxStartIndex:t.collisionBoxArray.length,tt=k?k.boxEndIndex:t.collisionBoxArray.length,et=z?z.boxStartIndex:t.collisionBoxArray.length,rt=z?z.boxEndIndex:t.collisionBoxArray.length,nt=I?I.boxStartIndex:t.collisionBoxArray.length,it=I?I.boxEndIndex:t.collisionBoxArray.length,ot=C?C.boxStartIndex:t.collisionBoxArray.length,at=C?C.boxEndIndex:t.collisionBoxArray.length,st=-1,ut=function(t,e){return t&&t.circleDiameter?Math.max(t.circleDiameter,e):e};st=ut(k,st),st=ut(z,st),st=ut(I,st);var lt=(st=ut(C,st))>-1?1:0;lt&&(st*=E/24),t.glyphOffsetArray.length>=gl.MAX_GLYPHS&&S("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==x.sortKey&&t.addToSortKeyRanges(t.symbolInstances.length,x.sortKey),t.symbolInstances.emplaceBack(e.x,e.y,F.right>=0?F.right:-1,F.center>=0?F.center:-1,F.left>=0?F.left:-1,F.vertical||-1,R,O,V,Q,tt,et,rt,nt,it,ot,at,l,L,B,M,D,lt,0,h,U,j,st)}(t,p,s,r,n,i,h,t.layers[0],t.collisionBoxArray,e.index,e.sourceLayerIndex,t.index,g,b,E,u,_,w,T,d,e,o,l,c,a)};if("line"===k)for(var P=0,M=Gu(e.geometry,0,0,8192,8192);P<M.length;P+=1)for(var D=M[P],L=0,B=Zu(D,x,A,r.vertical||m,n,24,v,t.overscaling,8192);L<B.length;L+=1){var R=B[L];m&&ll(t,m.text,I,R)||C(D,R)}else if("line-center"===k)for(var O=0,F=e.geometry;O<F.length;O+=1){var V=F[O];if(V.length>1){var U=$u(V,A,r.vertical||m,n,24,v);U&&C(V,U)}}else if("Polygon"===e.type)for(var j=0,N=ns(e.geometry,0);j<N.length;j+=1){var q=N[j],$=el(q,16);C(q[0],new Bu($.x,$.y,0))}else if("LineString"===e.type)for(var Z=0,G=e.geometry;Z<G.length;Z+=1){var W=G[Z];C(W,new Bu(W[0].x,W[0].y,0))}else if("Point"===e.type)for(var X=0,H=e.geometry;X<H.length;X+=1)for(var K=0,Y=H[X];K<Y.length;K+=1){var J=Y[K];C([J],new Bu(J.x,J.y,0))}}(t,o,f,V,n,l,p,h,b,U,a)},_=0,x=t.features;_<x.length;_+=1)v();o&&t.generateCollisionDebugBuffers()},t.perspective=function(t,e,r,n,i){var o,a=1/Math.tan(e/2);return t[0]=a/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=i&&i!==1/0?(t[10]=(i+n)*(o=1/(n-i)),t[14]=2*i*n*o):(t[10]=-1,t[14]=-2*n),t},t.pick=function(t,e){for(var r={},n=0;n<e.length;n++){var i=e[n];i in t&&(r[i]=t[i])}return r},t.plugin=ai,t.polygonIntersectsPolygon=$o,t.postMapLoadEvent=at,t.postTurnstileEvent=it,t.potpack=gu,t.refProperties=["type","source","source-layer","minzoom","maxzoom","filter","layout"],t.register=Fn,t.registerForPluginStateChange=function(t){return t({pluginStatus:Qn,pluginURL:ti}),ni.on("pluginStateChange",t),t},t.renderColorRamp=ba,t.rotate=function(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=Math.sin(r),u=Math.cos(r);return t[0]=n*u+o*s,t[1]=i*u+a*s,t[2]=n*-s+o*u,t[3]=i*-s+a*u,t},t.rotateX=function(t,e,r){var n=Math.sin(r),i=Math.cos(r),o=e[4],a=e[5],s=e[6],u=e[7],l=e[8],c=e[9],p=e[10],h=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=o*i+l*n,t[5]=a*i+c*n,t[6]=s*i+p*n,t[7]=u*i+h*n,t[8]=l*i-o*n,t[9]=c*i-a*n,t[10]=p*i-s*n,t[11]=h*i-u*n,t},t.rotateZ=function(t,e,r){var n=Math.sin(r),i=Math.cos(r),o=e[0],a=e[1],s=e[2],u=e[3],l=e[4],c=e[5],p=e[6],h=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*i+l*n,t[1]=a*i+c*n,t[2]=s*i+p*n,t[3]=u*i+h*n,t[4]=l*i-o*n,t[5]=c*i-a*n,t[6]=p*i-s*n,t[7]=h*i-u*n,t},t.scale=function(t,e,r){var n=r[0],i=r[1],o=r[2];return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*o,t[9]=e[9]*o,t[10]=e[10]*o,t[11]=e[11]*o,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},t.scale$1=function(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t},t.scale$2=function(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t},t.setCacheLimits=function(t,e){st=t,ut=e},t.setRTLTextPlugin=function(t,e,r){if(void 0===r&&(r=!1),"deferred"===Qn||"loading"===Qn||"loaded"===Qn)throw new Error("setRTLTextPlugin cannot be called multiple times.");ti=F.resolveURL(t),Qn="deferred",Jn=e,ri(),r||oi()},t.sphericalToCartesian=function(t){var e=t[0],r=t[1],n=t[2];return r+=90,r*=Math.PI/180,n*=Math.PI/180,{x:e*Math.cos(r)*Math.sin(n),y:e*Math.sin(r)*Math.sin(n),z:e*Math.cos(n)}},t.sqrLen=function(t){var e=t[0],r=t[1];return e*e+r*r},t.styleSpec=zt,t.sub=function(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t},t.symbolSize=Vu,t.transformMat3=function(t,e,r){var n=e[0],i=e[1],o=e[2];return t[0]=n*r[0]+i*r[3]+o*r[6],t[1]=n*r[1]+i*r[4]+o*r[7],t[2]=n*r[2]+i*r[5]+o*r[8],t},t.transformMat4=pa,t.translate=function(t,e,r){var n,i,o,a,s,u,l,c,p,h,f,d,m=r[0],y=r[1],g=r[2];return e===t?(t[12]=e[0]*m+e[4]*y+e[8]*g+e[12],t[13]=e[1]*m+e[5]*y+e[9]*g+e[13],t[14]=e[2]*m+e[6]*y+e[10]*g+e[14],t[15]=e[3]*m+e[7]*y+e[11]*g+e[15]):(i=e[1],o=e[2],a=e[3],s=e[4],u=e[5],l=e[6],c=e[7],p=e[8],h=e[9],f=e[10],d=e[11],t[0]=n=e[0],t[1]=i,t[2]=o,t[3]=a,t[4]=s,t[5]=u,t[6]=l,t[7]=c,t[8]=p,t[9]=h,t[10]=f,t[11]=d,t[12]=n*m+s*y+p*g+e[12],t[13]=i*m+u*y+h*g+e[13],t[14]=o*m+l*y+f*g+e[14],t[15]=a*m+c*y+d*g+e[15]),t},t.triggerPluginCompletionEvent=ei,t.uniqueId=d,t.validateCustomStyleLayer=function(t){var e=[],r=t.id;return void 0===r&&e.push({message:"layers."+r+': missing required property "id"'}),void 0===t.render&&e.push({message:"layers."+r+': missing required method "render"'}),t.renderingMode&&"2d"!==t.renderingMode&&"3d"!==t.renderingMode&&e.push({message:"layers."+r+': property "renderingMode" must be either "2d" or "3d"'}),e},t.validateLight=zn,t.validateStyle=In,t.values=function(t){var e=[];for(var r in t)e.push(t[r]);return e},t.vectorTile=xs,t.version="1.13.1",t.warnOnce=S,t.webpSupported=U,t.window=a,t.wrap=p})),n(["./shared"],(function(t){function e(t){var r=typeof t;if("number"===r||"boolean"===r||"string"===r||null==t)return JSON.stringify(t);if(Array.isArray(t)){for(var n="[",i=0,o=t;i<o.length;i+=1)n+=e(o[i])+",";return n+"]"}for(var a=Object.keys(t).sort(),s="{",u=0;u<a.length;u++)s+=JSON.stringify(a[u])+":"+e(t[a[u]])+",";return s+"}"}function r(r){for(var n="",i=0,o=t.refProperties;i<o.length;i+=1)n+="/"+e(r[o[i]]);return n}var n=function(t){this.keyCache={},t&&this.replace(t)};n.prototype.replace=function(t){this._layerConfigs={},this._layers={},this.update(t,[])},n.prototype.update=function(e,n){for(var i=this,o=0,a=e;o<a.length;o+=1){var s=a[o];this._layerConfigs[s.id]=s;var u=this._layers[s.id]=t.createStyleLayer(s);u._featureFilter=t.featureFilter(u.filter),this.keyCache[s.id]&&delete this.keyCache[s.id]}for(var l=0,c=n;l<c.length;l+=1){var p=c[l];delete this.keyCache[p],delete this._layerConfigs[p],delete this._layers[p]}this.familiesBySource={};for(var h=0,f=function(t,e){for(var n={},i=0;i<t.length;i++){var o=e&&e[t[i].id]||r(t[i]);e&&(e[t[i].id]=o);var a=n[o];a||(a=n[o]=[]),a.push(t[i])}var s=[];for(var u in n)s.push(n[u]);return s}(t.values(this._layerConfigs),this.keyCache);h<f.length;h+=1){var d=f[h].map((function(t){return i._layers[t.id]})),m=d[0];if("none"!==m.visibility){var y=m.source||"",g=this.familiesBySource[y];g||(g=this.familiesBySource[y]={});var v=m.sourceLayer||"_geojsonTileLayer",_=g[v];_||(_=g[v]=[]),_.push(d)}}};var i=function(e){var r={},n=[];for(var i in e){var o=e[i],a=r[i]={};for(var s in o){var u=o[+s];if(u&&0!==u.bitmap.width&&0!==u.bitmap.height){var l={x:0,y:0,w:u.bitmap.width+2,h:u.bitmap.height+2};n.push(l),a[s]={rect:l,metrics:u.metrics}}}}var c=t.potpack(n),p=new t.AlphaImage({width:c.w||1,height:c.h||1});for(var h in e){var f=e[h];for(var d in f){var m=f[+d];if(m&&0!==m.bitmap.width&&0!==m.bitmap.height){var y=r[h][d].rect;t.AlphaImage.copy(m.bitmap,p,{x:0,y:0},{x:y.x+1,y:y.y+1},m.bitmap)}}}this.image=p,this.positions=r};t.register("GlyphAtlas",i);var o=function(e){this.tileID=new t.OverscaledTileID(e.tileID.overscaledZ,e.tileID.wrap,e.tileID.canonical.z,e.tileID.canonical.x,e.tileID.canonical.y),this.uid=e.uid,this.zoom=e.zoom,this.pixelRatio=e.pixelRatio,this.tileSize=e.tileSize,this.source=e.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=e.showCollisionBoxes,this.collectResourceTiming=!!e.collectResourceTiming,this.returnDependencies=!!e.returnDependencies,this.promoteId=e.promoteId};function a(e,r,n){for(var i=new t.EvaluationParameters(r),o=0,a=e;o<a.length;o+=1)a[o].recalculate(i,n)}function s(e,r){var n=t.getArrayBuffer(e.request,(function(e,n,i,o){e?r(e):n&&r(null,{vectorTile:new t.vectorTile.VectorTile(new t.pbf(n)),rawData:n,cacheControl:i,expires:o})}));return function(){n.cancel(),r()}}o.prototype.parse=function(e,r,n,o,s){var u=this;this.status="parsing",this.data=e,this.collisionBoxArray=new t.CollisionBoxArray;var l=new t.DictionaryCoder(Object.keys(e.layers).sort()),c=new t.FeatureIndex(this.tileID,this.promoteId);c.bucketLayerIDs=[];var p,h,f,d,m={},y={featureIndex:c,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:n},g=r.familiesBySource[this.source];for(var v in g){var _=e.layers[v];if(_){1===_.version&&t.warnOnce('Vector tile source "'+this.source+'" layer "'+v+'" does not use vector tile spec v2 and therefore may have some rendering errors.');for(var x=l.encode(v),b=[],w=0;w<_.length;w++){var S=_.feature(w),A=c.getId(S,v);b.push({feature:S,id:A,index:w,sourceLayerIndex:x})}for(var E=0,T=g[v];E<T.length;E+=1){var k=T[E],I=k[0];I.minzoom&&this.zoom<Math.floor(I.minzoom)||I.maxzoom&&this.zoom>=I.maxzoom||"none"!==I.visibility&&(a(k,this.zoom,n),(m[I.id]=I.createBucket({index:c.bucketLayerIDs.length,layers:k,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:x,sourceID:this.source})).populate(b,y,this.tileID.canonical),c.bucketLayerIDs.push(k.map((function(t){return t.id}))))}}}var z=t.mapObject(y.glyphDependencies,(function(t){return Object.keys(t).map(Number)}));Object.keys(z).length?o.send("getGlyphs",{uid:this.uid,stacks:z},(function(t,e){p||(p=t,h=e,M.call(u))})):h={};var C=Object.keys(y.iconDependencies);C.length?o.send("getImages",{icons:C,source:this.source,tileID:this.tileID,type:"icons"},(function(t,e){p||(p=t,f=e,M.call(u))})):f={};var P=Object.keys(y.patternDependencies);function M(){if(p)return s(p);if(h&&f&&d){var e=new i(h),r=new t.ImageAtlas(f,d);for(var o in m){var u=m[o];u instanceof t.SymbolBucket?(a(u.layers,this.zoom,n),t.performSymbolLayout(u,h,e.positions,f,r.iconPositions,this.showCollisionBoxes,this.tileID.canonical)):u.hasPattern&&(u instanceof t.LineBucket||u instanceof t.FillBucket||u instanceof t.FillExtrusionBucket)&&(a(u.layers,this.zoom,n),u.addFeatures(y,this.tileID.canonical,r.patternPositions))}this.status="done",s(null,{buckets:t.values(m).filter((function(t){return!t.isEmpty()})),featureIndex:c,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:e.image,imageAtlas:r,glyphMap:this.returnDependencies?h:null,iconMap:this.returnDependencies?f:null,glyphPositions:this.returnDependencies?e.positions:null})}}P.length?o.send("getImages",{icons:P,source:this.source,tileID:this.tileID,type:"patterns"},(function(t,e){p||(p=t,d=e,M.call(u))})):d={},M.call(this)};var u=function(t,e,r,n){this.actor=t,this.layerIndex=e,this.availableImages=r,this.loadVectorData=n||s,this.loading={},this.loaded={}};u.prototype.loadTile=function(e,r){var n=this,i=e.uid;this.loading||(this.loading={});var a=!!(e&&e.request&&e.request.collectResourceTiming)&&new t.RequestPerformance(e.request),s=this.loading[i]=new o(e);s.abort=this.loadVectorData(e,(function(e,o){if(delete n.loading[i],e||!o)return s.status="done",n.loaded[i]=s,r(e);var u=o.rawData,l={};o.expires&&(l.expires=o.expires),o.cacheControl&&(l.cacheControl=o.cacheControl);var c={};if(a){var p=a.finish();p&&(c.resourceTiming=JSON.parse(JSON.stringify(p)))}s.vectorTile=o.vectorTile,s.parse(o.vectorTile,n.layerIndex,n.availableImages,n.actor,(function(e,n){if(e||!n)return r(e);r(null,t.extend({rawTileData:u.slice(0)},n,l,c))})),n.loaded=n.loaded||{},n.loaded[i]=s}))},u.prototype.reloadTile=function(t,e){var r=this,n=this.loaded,i=t.uid,o=this;if(n&&n[i]){var a=n[i];a.showCollisionBoxes=t.showCollisionBoxes;var s=function(t,n){var i=a.reloadCallback;i&&(delete a.reloadCallback,a.parse(a.vectorTile,o.layerIndex,r.availableImages,o.actor,i)),e(t,n)};"parsing"===a.status?a.reloadCallback=s:"done"===a.status&&(a.vectorTile?a.parse(a.vectorTile,this.layerIndex,this.availableImages,this.actor,s):s())}},u.prototype.abortTile=function(t,e){var r=this.loading,n=t.uid;r&&r[n]&&r[n].abort&&(r[n].abort(),delete r[n]),e()},u.prototype.removeTile=function(t,e){var r=this.loaded,n=t.uid;r&&r[n]&&delete r[n],e()};var l=t.window.ImageBitmap,c=function(){this.loaded={}};function p(t,e){if(0!==t.length){h(t[0],e);for(var r=1;r<t.length;r++)h(t[r],!e)}}function h(t,e){for(var r=0,n=0,i=t.length,o=i-1;n<i;o=n++)r+=(t[n][0]-t[o][0])*(t[o][1]+t[n][1]);r>=0!=!!e&&t.reverse()}c.prototype.loadTile=function(e,r){var n=e.uid,i=e.encoding,o=e.rawImageData,a=l&&o instanceof l?this.getImageData(o):o,s=new t.DEMData(n,a,i);this.loaded=this.loaded||{},this.loaded[n]=s,r(null,s)},c.prototype.getImageData=function(e){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(e.width,e.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d")),this.offscreenCanvas.width=e.width,this.offscreenCanvas.height=e.height,this.offscreenCanvasContext.drawImage(e,0,0,e.width,e.height);var r=this.offscreenCanvasContext.getImageData(-1,-1,e.width+2,e.height+2);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new t.RGBAImage({width:r.width,height:r.height},r.data)},c.prototype.removeTile=function(t){var e=this.loaded,r=t.uid;e&&e[r]&&delete e[r]};var f=t.vectorTile.VectorTileFeature.prototype.toGeoJSON,d=function(e){this._feature=e,this.extent=t.EXTENT,this.type=e.type,this.properties=e.tags,"id"in e&&!isNaN(e.id)&&(this.id=parseInt(e.id,10))};d.prototype.loadGeometry=function(){if(1===this._feature.type){for(var e=[],r=0,n=this._feature.geometry;r<n.length;r+=1){var i=n[r];e.push([new t.Point$1(i[0],i[1])])}return e}for(var o=[],a=0,s=this._feature.geometry;a<s.length;a+=1){for(var u=[],l=0,c=s[a];l<c.length;l+=1){var p=c[l];u.push(new t.Point$1(p[0],p[1]))}o.push(u)}return o},d.prototype.toGeoJSON=function(t,e,r){return f.call(this,t,e,r)};var m=function(e){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=t.EXTENT,this.length=e.length,this._features=e};m.prototype.feature=function(t){return new d(this._features[t])};var y=t.vectorTile.VectorTileFeature,g=v;function v(t,e){this.options=e||{},this.features=t,this.length=t.length}function _(t,e){this.id="number"==typeof t.id?t.id:void 0,this.type=t.type,this.rawGeometry=1===t.type?[t.geometry]:t.geometry,this.properties=t.tags,this.extent=e||4096}v.prototype.feature=function(t){return new _(this.features[t],this.options.extent)},_.prototype.loadGeometry=function(){var e=this.rawGeometry;this.geometry=[];for(var r=0;r<e.length;r++){for(var n=e[r],i=[],o=0;o<n.length;o++)i.push(new t.Point$1(n[o][0],n[o][1]));this.geometry.push(i)}return this.geometry},_.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var t=this.geometry,e=1/0,r=-1/0,n=1/0,i=-1/0,o=0;o<t.length;o++)for(var a=t[o],s=0;s<a.length;s++){var u=a[s];e=Math.min(e,u.x),r=Math.max(r,u.x),n=Math.min(n,u.y),i=Math.max(i,u.y)}return[e,n,r,i]},_.prototype.toGeoJSON=y.prototype.toGeoJSON;var x=w,b=g;function w(e){var r=new t.pbf;return function(t,e){for(var r in t.layers)e.writeMessage(3,S,t.layers[r])}(e,r),r.finish()}function S(t,e){var r;e.writeVarintField(15,t.version||1),e.writeStringField(1,t.name||""),e.writeVarintField(5,t.extent||4096);var n={keys:[],values:[],keycache:{},valuecache:{}};for(r=0;r<t.length;r++)n.feature=t.feature(r),e.writeMessage(2,A,n);var i=n.keys;for(r=0;r<i.length;r++)e.writeStringField(3,i[r]);var o=n.values;for(r=0;r<o.length;r++)e.writeMessage(4,z,o[r])}function A(t,e){var r=t.feature;void 0!==r.id&&e.writeVarintField(1,r.id),e.writeMessage(2,E,t),e.writeVarintField(3,r.type),e.writeMessage(4,I,r)}function E(t,e){var r=t.feature,n=t.keys,i=t.values,o=t.keycache,a=t.valuecache;for(var s in r.properties){var u=o[s];void 0===u&&(n.push(s),o[s]=u=n.length-1),e.writeVarint(u);var l=r.properties[s],c=typeof l;"string"!==c&&"boolean"!==c&&"number"!==c&&(l=JSON.stringify(l));var p=c+":"+l,h=a[p];void 0===h&&(i.push(l),a[p]=h=i.length-1),e.writeVarint(h)}}function T(t,e){return(e<<3)+(7&t)}function k(t){return t<<1^t>>31}function I(t,e){for(var r=t.loadGeometry(),n=t.type,i=0,o=0,a=r.length,s=0;s<a;s++){var u=r[s],l=1;1===n&&(l=u.length),e.writeVarint(T(1,l));for(var c=3===n?u.length-1:u.length,p=0;p<c;p++){1===p&&1!==n&&e.writeVarint(T(2,c-1));var h=u[p].x-i,f=u[p].y-o;e.writeVarint(k(h)),e.writeVarint(k(f)),i+=h,o+=f}3===n&&e.writeVarint(T(7,1))}}function z(t,e){var r=typeof t;"string"===r?e.writeStringField(1,t):"boolean"===r?e.writeBooleanField(7,t):"number"===r&&(t%1!=0?e.writeDoubleField(3,t):t<0?e.writeSVarintField(6,t):e.writeVarintField(5,t))}function C(t,e,r,n){P(t,r,n),P(e,2*r,2*n),P(e,2*r+1,2*n+1)}function P(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function M(t,e,r,n){var i=t-r,o=e-n;return i*i+o*o}x.fromVectorTileJs=w,x.fromGeojsonVt=function(t,e){e=e||{};var r={};for(var n in t)r[n]=new g(t[n].features,e),r[n].name=n,r[n].version=e.version,r[n].extent=e.extent;return w({layers:r})},x.GeoJSONWrapper=b;var D=function(t){return t[0]},L=function(t){return t[1]},B=function(t,e,r,n,i){void 0===e&&(e=D),void 0===r&&(r=L),void 0===n&&(n=64),void 0===i&&(i=Float64Array),this.nodeSize=n,this.points=t;for(var o=t.length<65536?Uint16Array:Uint32Array,a=this.ids=new o(t.length),s=this.coords=new i(2*t.length),u=0;u<t.length;u++)a[u]=u,s[2*u]=e(t[u]),s[2*u+1]=r(t[u]);!function t(e,r,n,i,o,a){if(!(o-i<=n)){var s=i+o>>1;!function t(e,r,n,i,o,a){for(;o>i;){if(o-i>600){var s=o-i+1,u=n-i+1,l=Math.log(s),c=.5*Math.exp(2*l/3),p=.5*Math.sqrt(l*c*(s-c)/s)*(u-s/2<0?-1:1);t(e,r,n,Math.max(i,Math.floor(n-u*c/s+p)),Math.min(o,Math.floor(n+(s-u)*c/s+p)),a)}var h=r[2*n+a],f=i,d=o;for(C(e,r,i,n),r[2*o+a]>h&&C(e,r,i,o);f<d;){for(C(e,r,f,d),f++,d--;r[2*f+a]<h;)f++;for(;r[2*d+a]>h;)d--}r[2*i+a]===h?C(e,r,i,d):C(e,r,++d,o),d<=n&&(i=d+1),n<=d&&(o=d-1)}}(e,r,s,i,o,a%2),t(e,r,n,i,s-1,a+1),t(e,r,n,s+1,o,a+1)}}(a,s,n,0,a.length-1,0)};B.prototype.range=function(t,e,r,n){return function(t,e,r,n,i,o,a){for(var s,u,l=[0,t.length-1,0],c=[];l.length;){var p=l.pop(),h=l.pop(),f=l.pop();if(h-f<=a)for(var d=f;d<=h;d++)u=e[2*d+1],(s=e[2*d])>=r&&s<=i&&u>=n&&u<=o&&c.push(t[d]);else{var m=Math.floor((f+h)/2);u=e[2*m+1],(s=e[2*m])>=r&&s<=i&&u>=n&&u<=o&&c.push(t[m]);var y=(p+1)%2;(0===p?r<=s:n<=u)&&(l.push(f),l.push(m-1),l.push(y)),(0===p?i>=s:o>=u)&&(l.push(m+1),l.push(h),l.push(y))}}return c}(this.ids,this.coords,t,e,r,n,this.nodeSize)},B.prototype.within=function(t,e,r){return function(t,e,r,n,i,o){for(var a=[0,t.length-1,0],s=[],u=i*i;a.length;){var l=a.pop(),c=a.pop(),p=a.pop();if(c-p<=o)for(var h=p;h<=c;h++)M(e[2*h],e[2*h+1],r,n)<=u&&s.push(t[h]);else{var f=Math.floor((p+c)/2),d=e[2*f],m=e[2*f+1];M(d,m,r,n)<=u&&s.push(t[f]);var y=(l+1)%2;(0===l?r-i<=d:n-i<=m)&&(a.push(p),a.push(f-1),a.push(y)),(0===l?r+i>=d:n+i>=m)&&(a.push(f+1),a.push(c),a.push(y))}}return s}(this.ids,this.coords,t,e,r,this.nodeSize)};var R={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:function(t){return t}},O=function(t){this.options=$(Object.create(R),t),this.trees=new Array(this.options.maxZoom+1)};function F(t,e,r,n,i){return{x:t,y:e,zoom:1/0,id:r,parentId:-1,numPoints:n,properties:i}}function V(t,e){var r=t.geometry.coordinates,n=r[1];return{x:N(r[0]),y:q(n),zoom:1/0,index:e,parentId:-1}}function U(t){return{type:"Feature",id:t.id,properties:j(t),geometry:{type:"Point",coordinates:[(n=t.x,360*(n-.5)),(e=t.y,r=(180-360*e)*Math.PI/180,360*Math.atan(Math.exp(r))/Math.PI-90)]}};var e,r,n}function j(t){var e=t.numPoints,r=e>=1e4?Math.round(e/1e3)+"k":e>=1e3?Math.round(e/100)/10+"k":e;return $($({},t.properties),{cluster:!0,cluster_id:t.id,point_count:e,point_count_abbreviated:r})}function N(t){return t/360+.5}function q(t){var e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return r<0?0:r>1?1:r}function $(t,e){for(var r in e)t[r]=e[r];return t}function Z(t){return t.x}function G(t){return t.y}function W(t,e,r,n,i,o){var a=i-r,s=o-n;if(0!==a||0!==s){var u=((t-r)*a+(e-n)*s)/(a*a+s*s);u>1?(r=i,n=o):u>0&&(r+=a*u,n+=s*u)}return(a=t-r)*a+(s=e-n)*s}function X(t,e,r,n){var i={id:void 0===t?null:t,type:e,geometry:r,tags:n,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(t){var e=t.geometry,r=t.type;if("Point"===r||"MultiPoint"===r||"LineString"===r)H(t,e);else if("Polygon"===r||"MultiLineString"===r)for(var n=0;n<e.length;n++)H(t,e[n]);else if("MultiPolygon"===r)for(n=0;n<e.length;n++)for(var i=0;i<e[n].length;i++)H(t,e[n][i])}(i),i}function H(t,e){for(var r=0;r<e.length;r+=3)t.minX=Math.min(t.minX,e[r]),t.minY=Math.min(t.minY,e[r+1]),t.maxX=Math.max(t.maxX,e[r]),t.maxY=Math.max(t.maxY,e[r+1])}function K(t,e,r,n){if(e.geometry){var i=e.geometry.coordinates,o=e.geometry.type,a=Math.pow(r.tolerance/((1<<r.maxZoom)*r.extent),2),s=[],u=e.id;if(r.promoteId?u=e.properties[r.promoteId]:r.generateId&&(u=n||0),"Point"===o)Y(i,s);else if("MultiPoint"===o)for(var l=0;l<i.length;l++)Y(i[l],s);else if("LineString"===o)J(i,s,a,!1);else if("MultiLineString"===o){if(r.lineMetrics){for(l=0;l<i.length;l++)J(i[l],s=[],a,!1),t.push(X(u,"LineString",s,e.properties));return}Q(i,s,a,!1)}else if("Polygon"===o)Q(i,s,a,!0);else{if("MultiPolygon"!==o){if("GeometryCollection"===o){for(l=0;l<e.geometry.geometries.length;l++)K(t,{id:u,geometry:e.geometry.geometries[l],properties:e.properties},r,n);return}throw new Error("Input data is not a valid GeoJSON object.")}for(l=0;l<i.length;l++){var c=[];Q(i[l],c,a,!0),s.push(c)}}t.push(X(u,o,s,e.properties))}}function Y(t,e){e.push(tt(t[0])),e.push(et(t[1])),e.push(0)}function J(t,e,r,n){for(var i,o,a=0,s=0;s<t.length;s++){var u=tt(t[s][0]),l=et(t[s][1]);e.push(u),e.push(l),e.push(0),s>0&&(a+=n?(i*l-u*o)/2:Math.sqrt(Math.pow(u-i,2)+Math.pow(l-o,2))),i=u,o=l}var c=e.length-3;e[2]=1,function t(e,r,n,i){for(var o,a=i,s=n-r>>1,u=n-r,l=e[r],c=e[r+1],p=e[n],h=e[n+1],f=r+3;f<n;f+=3){var d=W(e[f],e[f+1],l,c,p,h);if(d>a)o=f,a=d;else if(d===a){var m=Math.abs(f-s);m<u&&(o=f,u=m)}}a>i&&(o-r>3&&t(e,r,o,i),e[o+2]=a,n-o>3&&t(e,o,n,i))}(e,0,c,r),e[c+2]=1,e.size=Math.abs(a),e.start=0,e.end=e.size}function Q(t,e,r,n){for(var i=0;i<t.length;i++){var o=[];J(t[i],o,r,n),e.push(o)}}function tt(t){return t/360+.5}function et(t){var e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return r<0?0:r>1?1:r}function rt(t,e,r,n,i,o,a,s){if(n/=e,o>=(r/=e)&&a<n)return t;if(a<r||o>=n)return null;for(var u=[],l=0;l<t.length;l++){var c=t[l],p=c.geometry,h=c.type,f=0===i?c.minX:c.minY,d=0===i?c.maxX:c.maxY;if(f>=r&&d<n)u.push(c);else if(!(d<r||f>=n)){var m=[];if("Point"===h||"MultiPoint"===h)nt(p,m,r,n,i);else if("LineString"===h)it(p,m,r,n,i,!1,s.lineMetrics);else if("MultiLineString"===h)at(p,m,r,n,i,!1);else if("Polygon"===h)at(p,m,r,n,i,!0);else if("MultiPolygon"===h)for(var y=0;y<p.length;y++){var g=[];at(p[y],g,r,n,i,!0),g.length&&m.push(g)}if(m.length){if(s.lineMetrics&&"LineString"===h){for(y=0;y<m.length;y++)u.push(X(c.id,h,m[y],c.tags));continue}"LineString"!==h&&"MultiLineString"!==h||(1===m.length?(h="LineString",m=m[0]):h="MultiLineString"),"Point"!==h&&"MultiPoint"!==h||(h=3===m.length?"Point":"MultiPoint"),u.push(X(c.id,h,m,c.tags))}}}return u.length?u:null}function nt(t,e,r,n,i){for(var o=0;o<t.length;o+=3){var a=t[o+i];a>=r&&a<=n&&(e.push(t[o]),e.push(t[o+1]),e.push(t[o+2]))}}function it(t,e,r,n,i,o,a){for(var s,u,l=ot(t),c=0===i?ut:lt,p=t.start,h=0;h<t.length-3;h+=3){var f=t[h],d=t[h+1],m=t[h+2],y=t[h+3],g=t[h+4],v=0===i?f:d,_=0===i?y:g,x=!1;a&&(s=Math.sqrt(Math.pow(f-y,2)+Math.pow(d-g,2))),v<r?_>r&&(u=c(l,f,d,y,g,r),a&&(l.start=p+s*u)):v>n?_<n&&(u=c(l,f,d,y,g,n),a&&(l.start=p+s*u)):st(l,f,d,m),_<r&&v>=r&&(u=c(l,f,d,y,g,r),x=!0),_>n&&v<=n&&(u=c(l,f,d,y,g,n),x=!0),!o&&x&&(a&&(l.end=p+s*u),e.push(l),l=ot(t)),a&&(p+=s)}var b=t.length-3;f=t[b],d=t[b+1],m=t[b+2],(v=0===i?f:d)>=r&&v<=n&&st(l,f,d,m),b=l.length-3,o&&b>=3&&(l[b]!==l[0]||l[b+1]!==l[1])&&st(l,l[0],l[1],l[2]),l.length&&e.push(l)}function ot(t){var e=[];return e.size=t.size,e.start=t.start,e.end=t.end,e}function at(t,e,r,n,i,o){for(var a=0;a<t.length;a++)it(t[a],e,r,n,i,o,!1)}function st(t,e,r,n){t.push(e),t.push(r),t.push(n)}function ut(t,e,r,n,i,o){var a=(o-e)/(n-e);return t.push(o),t.push(r+(i-r)*a),t.push(1),a}function lt(t,e,r,n,i,o){var a=(o-r)/(i-r);return t.push(e+(n-e)*a),t.push(o),t.push(1),a}function ct(t,e){for(var r=[],n=0;n<t.length;n++){var i,o=t[n],a=o.type;if("Point"===a||"MultiPoint"===a||"LineString"===a)i=pt(o.geometry,e);else if("MultiLineString"===a||"Polygon"===a){i=[];for(var s=0;s<o.geometry.length;s++)i.push(pt(o.geometry[s],e))}else if("MultiPolygon"===a)for(i=[],s=0;s<o.geometry.length;s++){for(var u=[],l=0;l<o.geometry[s].length;l++)u.push(pt(o.geometry[s][l],e));i.push(u)}r.push(X(o.id,a,i,o.tags))}return r}function pt(t,e){var r=[];r.size=t.size,void 0!==t.start&&(r.start=t.start,r.end=t.end);for(var n=0;n<t.length;n+=3)r.push(t[n]+e,t[n+1],t[n+2]);return r}function ht(t,e){if(t.transformed)return t;var r,n,i,o=1<<t.z,a=t.x,s=t.y;for(r=0;r<t.features.length;r++){var u=t.features[r],l=u.geometry,c=u.type;if(u.geometry=[],1===c)for(n=0;n<l.length;n+=2)u.geometry.push(ft(l[n],l[n+1],e,o,a,s));else for(n=0;n<l.length;n++){var p=[];for(i=0;i<l[n].length;i+=2)p.push(ft(l[n][i],l[n][i+1],e,o,a,s));u.geometry.push(p)}}return t.transformed=!0,t}function ft(t,e,r,n,i,o){return[Math.round(r*(t*n-i)),Math.round(r*(e*n-o))]}function dt(t,e,r,n,i){for(var o=e===i.maxZoom?0:i.tolerance/((1<<e)*i.extent),a={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:r,y:n,z:e,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},s=0;s<t.length;s++){a.numFeatures++,mt(a,t[s],o,i);var u=t[s].minX,l=t[s].minY,c=t[s].maxX,p=t[s].maxY;u<a.minX&&(a.minX=u),l<a.minY&&(a.minY=l),c>a.maxX&&(a.maxX=c),p>a.maxY&&(a.maxY=p)}return a}function mt(t,e,r,n){var i=e.geometry,o=e.type,a=[];if("Point"===o||"MultiPoint"===o)for(var s=0;s<i.length;s+=3)a.push(i[s]),a.push(i[s+1]),t.numPoints++,t.numSimplified++;else if("LineString"===o)yt(a,i,t,r,!1,!1);else if("MultiLineString"===o||"Polygon"===o)for(s=0;s<i.length;s++)yt(a,i[s],t,r,"Polygon"===o,0===s);else if("MultiPolygon"===o)for(var u=0;u<i.length;u++){var l=i[u];for(s=0;s<l.length;s++)yt(a,l[s],t,r,!0,0===s)}if(a.length){var c=e.tags||null;if("LineString"===o&&n.lineMetrics){for(var p in c={},e.tags)c[p]=e.tags[p];c.mapbox_clip_start=i.start/i.size,c.mapbox_clip_end=i.end/i.size}var h={geometry:a,type:"Polygon"===o||"MultiPolygon"===o?3:"LineString"===o||"MultiLineString"===o?2:1,tags:c};null!==e.id&&(h.id=e.id),t.features.push(h)}}function yt(t,e,r,n,i,o){var a=n*n;if(n>0&&e.size<(i?a:n))r.numPoints+=e.length/3;else{for(var s=[],u=0;u<e.length;u+=3)(0===n||e[u+2]>a)&&(r.numSimplified++,s.push(e[u]),s.push(e[u+1])),r.numPoints++;i&&function(t,e){for(var r=0,n=0,i=t.length,o=i-2;n<i;o=n,n+=2)r+=(t[n]-t[o])*(t[n+1]+t[o+1]);if(r>0===e)for(n=0,i=t.length;n<i/2;n+=2){var a=t[n],s=t[n+1];t[n]=t[i-2-n],t[n+1]=t[i-1-n],t[i-2-n]=a,t[i-1-n]=s}}(s,o),t.push(s)}}function gt(t,e){var r=(e=this.options=function(t,e){for(var r in e)t[r]=e[r];return t}(Object.create(this.options),e)).debug;if(r&&console.time("preprocess data"),e.maxZoom<0||e.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(e.promoteId&&e.generateId)throw new Error("promoteId and generateId cannot be used together.");var n=function(t,e){var r=[];if("FeatureCollection"===t.type)for(var n=0;n<t.features.length;n++)K(r,t.features[n],e,n);else K(r,"Feature"===t.type?t:{geometry:t},e);return r}(t,e);this.tiles={},this.tileCoords=[],r&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",e.indexMaxZoom,e.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),(n=function(t,e){var r=e.buffer/e.extent,n=t,i=rt(t,1,-1-r,r,0,-1,2,e),o=rt(t,1,1-r,2+r,0,-1,2,e);return(i||o)&&(n=rt(t,1,-r,1+r,0,-1,2,e)||[],i&&(n=ct(i,1).concat(n)),o&&(n=n.concat(ct(o,-1)))),n}(n,e)).length&&this.splitTile(n,0,0,0),r&&(n.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}function vt(t,e,r){return 32*((1<<t)*r+e)+t}function _t(t,e){var r=t.tileID.canonical;if(!this._geoJSONIndex)return e(null,null);var n=this._geoJSONIndex.getTile(r.z,r.x,r.y);if(!n)return e(null,null);var i=new m(n.features),o=x(i);0===o.byteOffset&&o.byteLength===o.buffer.byteLength||(o=new Uint8Array(o)),e(null,{vectorTile:i,rawData:o.buffer})}O.prototype.load=function(t){var e=this.options,r=e.log,n=e.minZoom,i=e.maxZoom,o=e.nodeSize;r&&console.time("total time");var a="prepare "+t.length+" points";r&&console.time(a),this.points=t;for(var s=[],u=0;u<t.length;u++)t[u].geometry&&s.push(V(t[u],u));this.trees[i+1]=new B(s,Z,G,o,Float32Array),r&&console.timeEnd(a);for(var l=i;l>=n;l--){var c=+Date.now();s=this._cluster(s,l),this.trees[l]=new B(s,Z,G,o,Float32Array),r&&console.log("z%d: %d clusters in %dms",l,s.length,+Date.now()-c)}return r&&console.timeEnd("total time"),this},O.prototype.getClusters=function(t,e){var r=((t[0]+180)%360+360)%360-180,n=Math.max(-90,Math.min(90,t[1])),i=180===t[2]?180:((t[2]+180)%360+360)%360-180,o=Math.max(-90,Math.min(90,t[3]));if(t[2]-t[0]>=360)r=-180,i=180;else if(r>i){var a=this.getClusters([r,n,180,o],e),s=this.getClusters([-180,n,i,o],e);return a.concat(s)}for(var u=this.trees[this._limitZoom(e)],l=[],c=0,p=u.range(N(r),q(o),N(i),q(n));c<p.length;c+=1){var h=u.points[p[c]];l.push(h.numPoints?U(h):this.points[h.index])}return l},O.prototype.getChildren=function(t){var e=this._getOriginId(t),r=this._getOriginZoom(t),n="No cluster with the specified id.",i=this.trees[r];if(!i)throw new Error(n);var o=i.points[e];if(!o)throw new Error(n);for(var a=this.options.radius/(this.options.extent*Math.pow(2,r-1)),s=[],u=0,l=i.within(o.x,o.y,a);u<l.length;u+=1){var c=i.points[l[u]];c.parentId===t&&s.push(c.numPoints?U(c):this.points[c.index])}if(0===s.length)throw new Error(n);return s},O.prototype.getLeaves=function(t,e,r){var n=[];return this._appendLeaves(n,t,e=e||10,r=r||0,0),n},O.prototype.getTile=function(t,e,r){var n=this.trees[this._limitZoom(t)],i=Math.pow(2,t),o=this.options,a=o.radius/o.extent,s=(r-a)/i,u=(r+1+a)/i,l={features:[]};return this._addTileFeatures(n.range((e-a)/i,s,(e+1+a)/i,u),n.points,e,r,i,l),0===e&&this._addTileFeatures(n.range(1-a/i,s,1,u),n.points,i,r,i,l),e===i-1&&this._addTileFeatures(n.range(0,s,a/i,u),n.points,-1,r,i,l),l.features.length?l:null},O.prototype.getClusterExpansionZoom=function(t){for(var e=this._getOriginZoom(t)-1;e<=this.options.maxZoom;){var r=this.getChildren(t);if(e++,1!==r.length)break;t=r[0].properties.cluster_id}return e},O.prototype._appendLeaves=function(t,e,r,n,i){for(var o=0,a=this.getChildren(e);o<a.length;o+=1){var s=a[o],u=s.properties;if(u&&u.cluster?i+u.point_count<=n?i+=u.point_count:i=this._appendLeaves(t,u.cluster_id,r,n,i):i<n?i++:t.push(s),t.length===r)break}return i},O.prototype._addTileFeatures=function(t,e,r,n,i,o){for(var a=0,s=t;a<s.length;a+=1){var u=e[s[a]],l=u.numPoints,c={type:1,geometry:[[Math.round(this.options.extent*(u.x*i-r)),Math.round(this.options.extent*(u.y*i-n))]],tags:l?j(u):this.points[u.index].properties},p=void 0;l?p=u.id:this.options.generateId?p=u.index:this.points[u.index].id&&(p=this.points[u.index].id),void 0!==p&&(c.id=p),o.features.push(c)}},O.prototype._limitZoom=function(t){return Math.max(this.options.minZoom,Math.min(+t,this.options.maxZoom+1))},O.prototype._cluster=function(t,e){for(var r=[],n=this.options,i=n.reduce,o=n.minPoints,a=n.radius/(n.extent*Math.pow(2,e)),s=0;s<t.length;s++){var u=t[s];if(!(u.zoom<=e)){u.zoom=e;for(var l=this.trees[e+1],c=l.within(u.x,u.y,a),p=u.numPoints||1,h=p,f=0,d=c;f<d.length;f+=1){var m=l.points[d[f]];m.zoom>e&&(h+=m.numPoints||1)}if(h>=o){for(var y=u.x*p,g=u.y*p,v=i&&p>1?this._map(u,!0):null,_=(s<<5)+(e+1)+this.points.length,x=0,b=c;x<b.length;x+=1){var w=l.points[b[x]];if(!(w.zoom<=e)){w.zoom=e;var S=w.numPoints||1;y+=w.x*S,g+=w.y*S,w.parentId=_,i&&(v||(v=this._map(u,!0)),i(v,this._map(w)))}}u.parentId=_,r.push(F(y/h,g/h,_,h,v))}else if(r.push(u),h>1)for(var A=0,E=c;A<E.length;A+=1){var T=l.points[E[A]];T.zoom<=e||(T.zoom=e,r.push(T))}}}return r},O.prototype._getOriginId=function(t){return t-this.points.length>>5},O.prototype._getOriginZoom=function(t){return(t-this.points.length)%32},O.prototype._map=function(t,e){if(t.numPoints)return e?$({},t.properties):t.properties;var r=this.points[t.index].properties,n=this.options.map(r);return e&&n===r?$({},n):n},gt.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},gt.prototype.splitTile=function(t,e,r,n,i,o,a){for(var s=[t,e,r,n],u=this.options,l=u.debug;s.length;){n=s.pop(),r=s.pop(),e=s.pop(),t=s.pop();var c=1<<e,p=vt(e,r,n),h=this.tiles[p];if(!h&&(l>1&&console.time("creation"),h=this.tiles[p]=dt(t,e,r,n,u),this.tileCoords.push({z:e,x:r,y:n}),l)){l>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",e,r,n,h.numFeatures,h.numPoints,h.numSimplified),console.timeEnd("creation"));var f="z"+e;this.stats[f]=(this.stats[f]||0)+1,this.total++}if(h.source=t,i){if(e===u.maxZoom||e===i)continue;var d=1<<i-e;if(r!==Math.floor(o/d)||n!==Math.floor(a/d))continue}else if(e===u.indexMaxZoom||h.numPoints<=u.indexMaxPoints)continue;if(h.source=null,0!==t.length){l>1&&console.time("clipping");var m,y,g,v,_,x,b=.5*u.buffer/u.extent,w=.5-b,S=.5+b,A=1+b;m=y=g=v=null,_=rt(t,c,r-b,r+S,0,h.minX,h.maxX,u),x=rt(t,c,r+w,r+A,0,h.minX,h.maxX,u),t=null,_&&(m=rt(_,c,n-b,n+S,1,h.minY,h.maxY,u),y=rt(_,c,n+w,n+A,1,h.minY,h.maxY,u),_=null),x&&(g=rt(x,c,n-b,n+S,1,h.minY,h.maxY,u),v=rt(x,c,n+w,n+A,1,h.minY,h.maxY,u),x=null),l>1&&console.timeEnd("clipping"),s.push(m||[],e+1,2*r,2*n),s.push(y||[],e+1,2*r,2*n+1),s.push(g||[],e+1,2*r+1,2*n),s.push(v||[],e+1,2*r+1,2*n+1)}}},gt.prototype.getTile=function(t,e,r){var n=this.options,i=n.extent,o=n.debug;if(t<0||t>24)return null;var a=1<<t,s=vt(t,e=(e%a+a)%a,r);if(this.tiles[s])return ht(this.tiles[s],i);o>1&&console.log("drilling down to z%d-%d-%d",t,e,r);for(var u,l=t,c=e,p=r;!u&&l>0;)l--,c=Math.floor(c/2),p=Math.floor(p/2),u=this.tiles[vt(l,c,p)];return u&&u.source?(o>1&&console.log("found parent tile z%d-%d-%d",l,c,p),o>1&&console.time("drilling down"),this.splitTile(u.source,l,c,p,t,e,r),o>1&&console.timeEnd("drilling down"),this.tiles[s]?ht(this.tiles[s],i):null):null};var xt=function(e){function r(t,r,n,i){e.call(this,t,r,n,_t),i&&(this.loadGeoJSON=i)}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.loadData=function(t,e){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),this._pendingCallback=e,this._pendingLoadDataParams=t,this._state&&"Idle"!==this._state?this._state="NeedsLoadData":(this._state="Coalescing",this._loadData())},r.prototype._loadData=function(){var e=this;if(this._pendingCallback&&this._pendingLoadDataParams){var r=this._pendingCallback,n=this._pendingLoadDataParams;delete this._pendingCallback,delete this._pendingLoadDataParams;var i=!!(n&&n.request&&n.request.collectResourceTiming)&&new t.RequestPerformance(n.request);this.loadGeoJSON(n,(function(o,a){if(o||!a)return r(o);if("object"!=typeof a)return r(new Error("Input data given to '"+n.source+"' is not a valid GeoJSON object."));!function t(e,r){var n,i=e&&e.type;if("FeatureCollection"===i)for(n=0;n<e.features.length;n++)t(e.features[n],r);else if("GeometryCollection"===i)for(n=0;n<e.geometries.length;n++)t(e.geometries[n],r);else if("Feature"===i)t(e.geometry,r);else if("Polygon"===i)p(e.coordinates,r);else if("MultiPolygon"===i)for(n=0;n<e.coordinates.length;n++)p(e.coordinates[n],r);return e}(a,!0);try{if(n.filter){var s=t.createExpression(n.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===s.result)throw new Error(s.value.map((function(t){return t.key+": "+t.message})).join(", "));var u=a.features.filter((function(t){return s.value.evaluate({zoom:0},t)}));a={type:"FeatureCollection",features:u}}e._geoJSONIndex=n.cluster?new O(function(e){var r=e.superclusterOptions,n=e.clusterProperties;if(!n||!r)return r;for(var i={},o={},a={accumulated:null,zoom:0},s={properties:null},u=Object.keys(n),l=0,c=u;l<c.length;l+=1){var p=c[l],h=n[p],f=h[0],d=t.createExpression(h[1]),m=t.createExpression("string"==typeof f?[f,["accumulated"],["get",p]]:f);i[p]=d.value,o[p]=m.value}return r.map=function(t){s.properties=t;for(var e={},r=0,n=u;r<n.length;r+=1){var o=n[r];e[o]=i[o].evaluate(a,s)}return e},r.reduce=function(t,e){s.properties=e;for(var r=0,n=u;r<n.length;r+=1){var i=n[r];a.accumulated=t[i],t[i]=o[i].evaluate(a,s)}},r}(n)).load(a.features):function(t,e){return new gt(t,e)}(a,n.geojsonVtOptions)}catch(o){return r(o)}e.loaded={};var l={};if(i){var c=i.finish();c&&(l.resourceTiming={},l.resourceTiming[n.source]=JSON.parse(JSON.stringify(c)))}r(null,l)}))}},r.prototype.coalesce=function(){"Coalescing"===this._state?this._state="Idle":"NeedsLoadData"===this._state&&(this._state="Coalescing",this._loadData())},r.prototype.reloadTile=function(t,r){var n=this.loaded;return n&&n[t.uid]?e.prototype.reloadTile.call(this,t,r):this.loadTile(t,r)},r.prototype.loadGeoJSON=function(e,r){if(e.request)t.getJSON(e.request,r);else{if("string"!=typeof e.data)return r(new Error("Input data given to '"+e.source+"' is not a valid GeoJSON object."));try{return r(null,JSON.parse(e.data))}catch(t){return r(new Error("Input data given to '"+e.source+"' is not a valid GeoJSON object."))}}},r.prototype.removeSource=function(t,e){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),e()},r.prototype.getClusterExpansionZoom=function(t,e){try{e(null,this._geoJSONIndex.getClusterExpansionZoom(t.clusterId))}catch(t){e(t)}},r.prototype.getClusterChildren=function(t,e){try{e(null,this._geoJSONIndex.getChildren(t.clusterId))}catch(t){e(t)}},r.prototype.getClusterLeaves=function(t,e){try{e(null,this._geoJSONIndex.getLeaves(t.clusterId,t.limit,t.offset))}catch(t){e(t)}},r}(u),bt=function(e){var r=this;this.self=e,this.actor=new t.Actor(e,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:u,geojson:xt},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=function(t,e){if(r.workerSourceTypes[t])throw new Error('Worker source with name "'+t+'" already registered.');r.workerSourceTypes[t]=e},this.self.registerRTLTextPlugin=function(e){if(t.plugin.isParsed())throw new Error("RTL text plugin already registered.");t.plugin.applyArabicShaping=e.applyArabicShaping,t.plugin.processBidirectionalText=e.processBidirectionalText,t.plugin.processStyledBidirectionalText=e.processStyledBidirectionalText}};return bt.prototype.setReferrer=function(t,e){this.referrer=e},bt.prototype.setImages=function(t,e,r){for(var n in this.availableImages[t]=e,this.workerSources[t]){var i=this.workerSources[t][n];for(var o in i)i[o].availableImages=e}r()},bt.prototype.setLayers=function(t,e,r){this.getLayerIndex(t).replace(e),r()},bt.prototype.updateLayers=function(t,e,r){this.getLayerIndex(t).update(e.layers,e.removedIds),r()},bt.prototype.loadTile=function(t,e,r){this.getWorkerSource(t,e.type,e.source).loadTile(e,r)},bt.prototype.loadDEMTile=function(t,e,r){this.getDEMWorkerSource(t,e.source).loadTile(e,r)},bt.prototype.reloadTile=function(t,e,r){this.getWorkerSource(t,e.type,e.source).reloadTile(e,r)},bt.prototype.abortTile=function(t,e,r){this.getWorkerSource(t,e.type,e.source).abortTile(e,r)},bt.prototype.removeTile=function(t,e,r){this.getWorkerSource(t,e.type,e.source).removeTile(e,r)},bt.prototype.removeDEMTile=function(t,e){this.getDEMWorkerSource(t,e.source).removeTile(e)},bt.prototype.removeSource=function(t,e,r){if(this.workerSources[t]&&this.workerSources[t][e.type]&&this.workerSources[t][e.type][e.source]){var n=this.workerSources[t][e.type][e.source];delete this.workerSources[t][e.type][e.source],void 0!==n.removeSource?n.removeSource(e,r):r()}},bt.prototype.loadWorkerSource=function(t,e,r){try{this.self.importScripts(e.url),r()}catch(t){r(t.toString())}},bt.prototype.syncRTLPluginState=function(e,r,n){try{t.plugin.setState(r);var i=t.plugin.getPluginURL();if(t.plugin.isLoaded()&&!t.plugin.isParsed()&&null!=i){this.self.importScripts(i);var o=t.plugin.isParsed();n(o?void 0:new Error("RTL Text Plugin failed to import scripts from "+i),o)}}catch(t){n(t.toString())}},bt.prototype.getAvailableImages=function(t){var e=this.availableImages[t];return e||(e=[]),e},bt.prototype.getLayerIndex=function(t){var e=this.layerIndexes[t];return e||(e=this.layerIndexes[t]=new n),e},bt.prototype.getWorkerSource=function(t,e,r){var n=this;return this.workerSources[t]||(this.workerSources[t]={}),this.workerSources[t][e]||(this.workerSources[t][e]={}),this.workerSources[t][e][r]||(this.workerSources[t][e][r]=new this.workerSourceTypes[e]({send:function(e,r,i){n.actor.send(e,r,i,t)}},this.getLayerIndex(t),this.getAvailableImages(t))),this.workerSources[t][e][r]},bt.prototype.getDEMWorkerSource=function(t,e){return this.demWorkerSources[t]||(this.demWorkerSources[t]={}),this.demWorkerSources[t][e]||(this.demWorkerSources[t][e]=new c),this.demWorkerSources[t][e]},bt.prototype.enforceCacheSizeLimit=function(e,r){t.enforceCacheSizeLimit(r)},"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope&&(self.worker=new bt(self)),bt})),n(["./shared"],(function(t){var e=t.createCommonjsModule((function(t){function e(t){return!r(t)}function r(t){return"undefined"==typeof window||"undefined"==typeof document?"not a browser":Array.prototype&&Array.prototype.every&&Array.prototype.filter&&Array.prototype.forEach&&Array.prototype.indexOf&&Array.prototype.lastIndexOf&&Array.prototype.map&&Array.prototype.some&&Array.prototype.reduce&&Array.prototype.reduceRight&&Array.isArray?Function.prototype&&Function.prototype.bind?Object.keys&&Object.create&&Object.getPrototypeOf&&Object.getOwnPropertyNames&&Object.isSealed&&Object.isFrozen&&Object.isExtensible&&Object.getOwnPropertyDescriptor&&Object.defineProperty&&Object.defineProperties&&Object.seal&&Object.freeze&&Object.preventExtensions?"JSON"in window&&"parse"in JSON&&"stringify"in JSON?function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var t,e,r=new Blob([""],{type:"text/javascript"}),n=URL.createObjectURL(r);try{e=new Worker(n),t=!0}catch(e){t=!1}return e&&e.terminate(),URL.revokeObjectURL(n),t}()?"Uint8ClampedArray"in window?ArrayBuffer.isView?function(){var t=document.createElement("canvas");t.width=t.height=1;var e=t.getContext("2d");if(!e)return!1;var r=e.getImageData(0,0,1,1);return r&&r.width===t.width}()?(void 0===n[r=t&&t.failIfMajorPerformanceCaveat]&&(n[r]=function(t){var r=function(t){var r=document.createElement("canvas"),n=Object.create(e.webGLContextAttributes);return n.failIfMajorPerformanceCaveat=t,r.probablySupportsContext?r.probablySupportsContext("webgl",n)||r.probablySupportsContext("experimental-webgl",n):r.supportsContext?r.supportsContext("webgl",n)||r.supportsContext("experimental-webgl",n):r.getContext("webgl",n)||r.getContext("experimental-webgl",n)}(t);if(!r)return!1;var n=r.createShader(r.VERTEX_SHADER);return!(!n||r.isContextLost())&&(r.shaderSource(n,"void main() {}"),r.compileShader(n),!0===r.getShaderParameter(n,r.COMPILE_STATUS))}(r)),n[r]?void 0:"insufficient WebGL support"):"insufficient Canvas/getImageData support":"insufficient ArrayBuffer support":"insufficient Uint8ClampedArray support":"insufficient worker support":"insufficient JSON support":"insufficient Object support":"insufficient Function support":"insufficent Array support";var r}t.exports?t.exports=e:window&&(window.mapboxgl=window.mapboxgl||{},window.mapboxgl.supported=e,window.mapboxgl.notSupportedReason=r);var n={};e.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0}})),r={create:function(e,r,n){var i=t.window.document.createElement(e);return void 0!==r&&(i.className=r),n&&n.appendChild(i),i},createNS:function(e,r){return t.window.document.createElementNS(e,r)}},n=t.window.document&&t.window.document.documentElement.style;function i(t){if(!n)return t[0];for(var e=0;e<t.length;e++)if(t[e]in n)return t[e];return t[0]}var o,a=i(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]);r.disableDrag=function(){n&&a&&(o=n[a],n[a]="none")},r.enableDrag=function(){n&&a&&(n[a]=o)};var s=i(["transform","WebkitTransform"]);r.setTransform=function(t,e){t.style[s]=e};var u=!1;try{var l=Object.defineProperty({},"passive",{get:function(){u=!0}});t.window.addEventListener("test",l,l),t.window.removeEventListener("test",l,l)}catch(t){u=!1}r.addEventListener=function(t,e,r,n){void 0===n&&(n={}),t.addEventListener(e,r,"passive"in n&&u?n:n.capture)},r.removeEventListener=function(t,e,r,n){void 0===n&&(n={}),t.removeEventListener(e,r,"passive"in n&&u?n:n.capture)};var c=function(e){e.preventDefault(),e.stopPropagation(),t.window.removeEventListener("click",c,!0)};function p(t){var e=t.userImage;return!!(e&&e.render&&e.render())&&(t.data.replace(new Uint8Array(e.data.buffer)),!0)}r.suppressClick=function(){t.window.addEventListener("click",c,!0),t.window.setTimeout((function(){t.window.removeEventListener("click",c,!0)}),0)},r.mousePos=function(e,r){var n=e.getBoundingClientRect();return new t.Point(r.clientX-n.left-e.clientLeft,r.clientY-n.top-e.clientTop)},r.touchPos=function(e,r){for(var n=e.getBoundingClientRect(),i=[],o=0;o<r.length;o++)i.push(new t.Point(r[o].clientX-n.left-e.clientLeft,r[o].clientY-n.top-e.clientTop));return i},r.mouseButton=function(e){return void 0!==t.window.InstallTrigger&&2===e.button&&e.ctrlKey&&t.window.navigator.platform.toUpperCase().indexOf("MAC")>=0?0:e.button},r.remove=function(t){t.parentNode&&t.parentNode.removeChild(t)};var h=function(e){function r(){e.call(this),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new t.RGBAImage({width:1,height:1}),this.dirty=!0}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.isLoaded=function(){return this.loaded},r.prototype.setLoaded=function(t){if(this.loaded!==t&&(this.loaded=t,t)){for(var e=0,r=this.requestors;e<r.length;e+=1){var n=r[e];this._notify(n.ids,n.callback)}this.requestors=[]}},r.prototype.getImage=function(t){return this.images[t]},r.prototype.addImage=function(t,e){this._validate(t,e)&&(this.images[t]=e)},r.prototype._validate=function(e,r){var n=!0;return this._validateStretch(r.stretchX,r.data&&r.data.width)||(this.fire(new t.ErrorEvent(new Error('Image "'+e+'" has invalid "stretchX" value'))),n=!1),this._validateStretch(r.stretchY,r.data&&r.data.height)||(this.fire(new t.ErrorEvent(new Error('Image "'+e+'" has invalid "stretchY" value'))),n=!1),this._validateContent(r.content,r)||(this.fire(new t.ErrorEvent(new Error('Image "'+e+'" has invalid "content" value'))),n=!1),n},r.prototype._validateStretch=function(t,e){if(!t)return!0;for(var r=0,n=0,i=t;n<i.length;n+=1){var o=i[n];if(o[0]<r||o[1]<o[0]||e<o[1])return!1;r=o[1]}return!0},r.prototype._validateContent=function(t,e){return!(t&&(4!==t.length||t[0]<0||e.data.width<t[0]||t[1]<0||e.data.height<t[1]||t[2]<0||e.data.width<t[2]||t[3]<0||e.data.height<t[3]||t[2]<t[0]||t[3]<t[1]))},r.prototype.updateImage=function(t,e){e.version=this.images[t].version+1,this.images[t]=e,this.updatedImages[t]=!0},r.prototype.removeImage=function(t){var e=this.images[t];delete this.images[t],delete this.patterns[t],e.userImage&&e.userImage.onRemove&&e.userImage.onRemove()},r.prototype.listImages=function(){return Object.keys(this.images)},r.prototype.getImages=function(t,e){var r=!0;if(!this.isLoaded())for(var n=0,i=t;n<i.length;n+=1)this.images[i[n]]||(r=!1);this.isLoaded()||r?this._notify(t,e):this.requestors.push({ids:t,callback:e})},r.prototype._notify=function(e,r){for(var n={},i=0,o=e;i<o.length;i+=1){var a=o[i];this.images[a]||this.fire(new t.Event("styleimagemissing",{id:a}));var s=this.images[a];s?n[a]={data:s.data.clone(),pixelRatio:s.pixelRatio,sdf:s.sdf,version:s.version,stretchX:s.stretchX,stretchY:s.stretchY,content:s.content,hasRenderCallback:Boolean(s.userImage&&s.userImage.render)}:t.warnOnce('Image "'+a+'" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.')}r(null,n)},r.prototype.getPixelSize=function(){var t=this.atlasImage;return{width:t.width,height:t.height}},r.prototype.getPattern=function(e){var r=this.patterns[e],n=this.getImage(e);if(!n)return null;if(r&&r.position.version===n.version)return r.position;if(r)r.position.version=n.version;else{var i={w:n.data.width+2,h:n.data.height+2,x:0,y:0},o=new t.ImagePosition(i,n);this.patterns[e]={bin:i,position:o}}return this._updatePatternAtlas(),this.patterns[e].position},r.prototype.bind=function(e){var r=e.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new t.Texture(e,this.atlasImage,r.RGBA),this.atlasTexture.bind(r.LINEAR,r.CLAMP_TO_EDGE)},r.prototype._updatePatternAtlas=function(){var e=[];for(var r in this.patterns)e.push(this.patterns[r].bin);var n=t.potpack(e),i=n.w,o=n.h,a=this.atlasImage;for(var s in a.resize({width:i||1,height:o||1}),this.patterns){var u=this.patterns[s].bin,l=u.x+1,c=u.y+1,p=this.images[s].data,h=p.width,f=p.height;t.RGBAImage.copy(p,a,{x:0,y:0},{x:l,y:c},{width:h,height:f}),t.RGBAImage.copy(p,a,{x:0,y:f-1},{x:l,y:c-1},{width:h,height:1}),t.RGBAImage.copy(p,a,{x:0,y:0},{x:l,y:c+f},{width:h,height:1}),t.RGBAImage.copy(p,a,{x:h-1,y:0},{x:l-1,y:c},{width:1,height:f}),t.RGBAImage.copy(p,a,{x:0,y:0},{x:l+h,y:c},{width:1,height:f})}this.dirty=!0},r.prototype.beginFrame=function(){this.callbackDispatchedThisFrame={}},r.prototype.dispatchRenderCallbacks=function(t){for(var e=0,r=t;e<r.length;e+=1){var n=r[e];if(!this.callbackDispatchedThisFrame[n]){this.callbackDispatchedThisFrame[n]=!0;var i=this.images[n];p(i)&&this.updateImage(n,i)}}},r}(t.Evented),f=y,d=y,m=1e20;function y(t,e,r,n,i,o){this.fontSize=t||24,this.buffer=void 0===e?3:e,this.cutoff=n||.25,this.fontFamily=i||"sans-serif",this.fontWeight=o||"normal",this.radius=r||8;var a=this.size=this.fontSize+2*this.buffer;this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=a,this.ctx=this.canvas.getContext("2d"),this.ctx.font=this.fontWeight+" "+this.fontSize+"px "+this.fontFamily,this.ctx.textBaseline="middle",this.ctx.fillStyle="black",this.gridOuter=new Float64Array(a*a),this.gridInner=new Float64Array(a*a),this.f=new Float64Array(a),this.d=new Float64Array(a),this.z=new Float64Array(a+1),this.v=new Int16Array(a),this.middle=Math.round(a/2*(navigator.userAgent.indexOf("Gecko/")>=0?1.2:1))}function g(t,e,r,n,i,o,a){for(var s=0;s<e;s++){for(var u=0;u<r;u++)n[u]=t[u*e+s];for(v(n,i,o,a,r),u=0;u<r;u++)t[u*e+s]=i[u]}for(u=0;u<r;u++){for(s=0;s<e;s++)n[s]=t[u*e+s];for(v(n,i,o,a,e),s=0;s<e;s++)t[u*e+s]=Math.sqrt(i[s])}}function v(t,e,r,n,i){r[0]=0,n[0]=-m,n[1]=+m;for(var o=1,a=0;o<i;o++){for(var s=(t[o]+o*o-(t[r[a]]+r[a]*r[a]))/(2*o-2*r[a]);s<=n[a];)a--,s=(t[o]+o*o-(t[r[a]]+r[a]*r[a]))/(2*o-2*r[a]);r[++a]=o,n[a]=s,n[a+1]=+m}for(o=0,a=0;o<i;o++){for(;n[a+1]<o;)a++;e[o]=(o-r[a])*(o-r[a])+t[r[a]]}}y.prototype.draw=function(t){this.ctx.clearRect(0,0,this.size,this.size),this.ctx.fillText(t,this.buffer,this.middle);for(var e=this.ctx.getImageData(0,0,this.size,this.size),r=new Uint8ClampedArray(this.size*this.size),n=0;n<this.size*this.size;n++){var i=e.data[4*n+3]/255;this.gridOuter[n]=1===i?0:0===i?m:Math.pow(Math.max(0,.5-i),2),this.gridInner[n]=1===i?m:0===i?0:Math.pow(Math.max(0,i-.5),2)}for(g(this.gridOuter,this.size,this.size,this.f,this.d,this.v,this.z),g(this.gridInner,this.size,this.size,this.f,this.d,this.v,this.z),n=0;n<this.size*this.size;n++)r[n]=Math.max(0,Math.min(255,Math.round(255-255*((this.gridOuter[n]-this.gridInner[n])/this.radius+this.cutoff))));return r},f.default=d;var _=function(t,e){this.requestManager=t,this.localIdeographFontFamily=e,this.entries={}};_.prototype.setURL=function(t){this.url=t},_.prototype.getGlyphs=function(e,r){var n=this,i=[];for(var o in e)for(var a=0,s=e[o];a<s.length;a+=1)i.push({stack:o,id:s[a]});t.asyncAll(i,(function(t,e){var r=t.stack,i=t.id,o=n.entries[r];o||(o=n.entries[r]={glyphs:{},requests:{},ranges:{}});var a=o.glyphs[i];if(void 0===a){if(a=n._tinySDF(o,r,i))return o.glyphs[i]=a,void e(null,{stack:r,id:i,glyph:a});var s=Math.floor(i/256);if(256*s>65535)e(new Error("glyphs > 65535 not supported"));else if(o.ranges[s])e(null,{stack:r,id:i,glyph:a});else{var u=o.requests[s];u||(u=o.requests[s]=[],_.loadGlyphRange(r,s,n.url,n.requestManager,(function(t,e){if(e){for(var r in e)n._doesCharSupportLocalGlyph(+r)||(o.glyphs[+r]=e[+r]);o.ranges[s]=!0}for(var i=0,a=u;i<a.length;i+=1)(0,a[i])(t,e);delete o.requests[s]}))),u.push((function(t,n){t?e(t):n&&e(null,{stack:r,id:i,glyph:n[i]||null})}))}}else e(null,{stack:r,id:i,glyph:a})}),(function(t,e){if(t)r(t);else if(e){for(var n={},i=0,o=e;i<o.length;i+=1){var a=o[i],s=a.stack,u=a.id,l=a.glyph;(n[s]||(n[s]={}))[u]=l&&{id:l.id,bitmap:l.bitmap.clone(),metrics:l.metrics}}r(null,n)}}))},_.prototype._doesCharSupportLocalGlyph=function(e){return!!this.localIdeographFontFamily&&(t.isChar["CJK Unified Ideographs"](e)||t.isChar["Hangul Syllables"](e)||t.isChar.Hiragana(e)||t.isChar.Katakana(e))},_.prototype._tinySDF=function(e,r,n){var i=this.localIdeographFontFamily;if(i&&this._doesCharSupportLocalGlyph(n)){var o=e.tinySDF;if(!o){var a="400";/bold/i.test(r)?a="900":/medium/i.test(r)?a="500":/light/i.test(r)&&(a="200"),o=e.tinySDF=new _.TinySDF(24,3,8,.25,i,a)}return{id:n,bitmap:new t.AlphaImage({width:30,height:30},o.draw(String.fromCharCode(n))),metrics:{width:24,height:24,left:0,top:-8,advance:24}}}},_.loadGlyphRange=function(e,r,n,i,o){var a=256*r,s=a+255,u=i.transformRequest(i.normalizeGlyphsURL(n).replace("{fontstack}",e).replace("{range}",a+"-"+s),t.ResourceType.Glyphs);t.getArrayBuffer(u,(function(e,r){if(e)o(e);else if(r){for(var n={},i=0,a=t.parseGlyphPBF(r);i<a.length;i+=1){var s=a[i];n[s.id]=s}o(null,n)}}))},_.TinySDF=f;var x=function(){this.specification=t.styleSpec.light.position};x.prototype.possiblyEvaluate=function(e,r){return t.sphericalToCartesian(e.expression.evaluate(r))},x.prototype.interpolate=function(e,r,n){return{x:t.number(e.x,r.x,n),y:t.number(e.y,r.y,n),z:t.number(e.z,r.z,n)}};var b=new t.Properties({anchor:new t.DataConstantProperty(t.styleSpec.light.anchor),position:new x,color:new t.DataConstantProperty(t.styleSpec.light.color),intensity:new t.DataConstantProperty(t.styleSpec.light.intensity)}),w=function(e){function r(r){e.call(this),this._transitionable=new t.Transitionable(b),this.setLight(r),this._transitioning=this._transitionable.untransitioned()}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.getLight=function(){return this._transitionable.serialize()},r.prototype.setLight=function(e,r){if(void 0===r&&(r={}),!this._validate(t.validateLight,e,r))for(var n in e){var i=e[n];t.endsWith(n,"-transition")?this._transitionable.setTransition(n.slice(0,-"-transition".length),i):this._transitionable.setValue(n,i)}},r.prototype.updateTransitions=function(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)},r.prototype.hasTransition=function(){return this._transitioning.hasTransition()},r.prototype.recalculate=function(t){this.properties=this._transitioning.possiblyEvaluate(t)},r.prototype._validate=function(e,r,n){return(!n||!1!==n.validate)&&t.emitValidationErrors(this,e.call(t.validateStyle,t.extend({value:r,style:{glyphs:!0,sprite:!0},styleSpec:t.styleSpec})))},r}(t.Evented),S=function(t,e){this.width=t,this.height=e,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}};S.prototype.getDash=function(t,e){var r=t.join(",")+String(e);return this.dashEntry[r]||(this.dashEntry[r]=this.addDash(t,e)),this.dashEntry[r]},S.prototype.getDashRanges=function(t,e,r){var n=[],i=t.length%2==1?-t[t.length-1]*r:0,o=t[0]*r,a=!0;n.push({left:i,right:o,isDash:a,zeroLength:0===t[0]});for(var s=t[0],u=1;u<t.length;u++){var l=t[u];n.push({left:i=s*r,right:o=(s+=l)*r,isDash:a=!a,zeroLength:0===l})}return n},S.prototype.addRoundDash=function(t,e,r){for(var n=e/2,i=-r;i<=r;i++)for(var o=this.width*(this.nextRow+r+i),a=0,s=t[a],u=0;u<this.width;u++){u/s.right>1&&(s=t[++a]);var l=Math.abs(u-s.left),c=Math.abs(u-s.right),p=Math.min(l,c),h=void 0,f=i/r*(n+1);if(s.isDash){var d=n-Math.abs(f);h=Math.sqrt(p*p+d*d)}else h=n-Math.sqrt(p*p+f*f);this.data[o+u]=Math.max(0,Math.min(255,h+128))}},S.prototype.addRegularDash=function(t){for(var e=t.length-1;e>=0;--e){var r=t[e],n=t[e+1];r.zeroLength?t.splice(e,1):n&&n.isDash===r.isDash&&(n.left=r.left,t.splice(e,1))}var i=t[0],o=t[t.length-1];i.isDash===o.isDash&&(i.left=o.left-this.width,o.right=i.right+this.width);for(var a=this.width*this.nextRow,s=0,u=t[s],l=0;l<this.width;l++){l/u.right>1&&(u=t[++s]);var c=Math.abs(l-u.left),p=Math.abs(l-u.right),h=Math.min(c,p);this.data[a+l]=Math.max(0,Math.min(255,(u.isDash?h:-h)+128))}},S.prototype.addDash=function(e,r){var n=r?7:0,i=2*n+1;if(this.nextRow+i>this.height)return t.warnOnce("LineAtlas out of space"),null;for(var o=0,a=0;a<e.length;a++)o+=e[a];if(0!==o){var s=this.width/o,u=this.getDashRanges(e,this.width,s);r?this.addRoundDash(u,s,n):this.addRegularDash(u)}var l={y:(this.nextRow+n+.5)/this.height,height:2*n/this.height,width:o};return this.nextRow+=i,this.dirty=!0,l},S.prototype.bind=function(t){var e=t.gl;this.texture?(e.bindTexture(e.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,e.texSubImage2D(e.TEXTURE_2D,0,0,0,this.width,this.height,e.ALPHA,e.UNSIGNED_BYTE,this.data))):(this.texture=e.createTexture(),e.bindTexture(e.TEXTURE_2D,this.texture),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.REPEAT),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.REPEAT),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texImage2D(e.TEXTURE_2D,0,e.ALPHA,this.width,this.height,0,e.ALPHA,e.UNSIGNED_BYTE,this.data))};var A=function e(r,n){this.workerPool=r,this.actors=[],this.currentActor=0,this.id=t.uniqueId();for(var i=this.workerPool.acquire(this.id),o=0;o<i.length;o++){var a=new e.Actor(i[o],n,this.id);a.name="Worker "+o,this.actors.push(a)}};function E(e,r,n){var i=function(i,o){if(i)return n(i);if(o){var a=t.pick(t.extend(o,e),["tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","scheme","tileSize","encoding"]);o.vector_layers&&(a.vectorLayers=o.vector_layers,a.vectorLayerIds=a.vectorLayers.map((function(t){return t.id}))),a.tiles=r.canonicalizeTileset(a,e.url),n(null,a)}};return e.url?t.getJSON(r.transformRequest(r.normalizeSourceURL(e.url),t.ResourceType.Source),i):t.browser.frame((function(){return i(null,e)}))}A.prototype.broadcast=function(e,r,n){t.asyncAll(this.actors,(function(t,n){t.send(e,r,n)}),n=n||function(){})},A.prototype.getActor=function(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]},A.prototype.remove=function(){this.actors.forEach((function(t){t.remove()})),this.actors=[],this.workerPool.release(this.id)},A.Actor=t.Actor;var T=function(e,r,n){this.bounds=t.LngLatBounds.convert(this.validateBounds(e)),this.minzoom=r||0,this.maxzoom=n||24};T.prototype.validateBounds=function(t){return Array.isArray(t)&&4===t.length?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]},T.prototype.contains=function(e){var r=Math.pow(2,e.z),n=Math.floor(t.mercatorXfromLng(this.bounds.getWest())*r),i=Math.floor(t.mercatorYfromLat(this.bounds.getNorth())*r),o=Math.ceil(t.mercatorXfromLng(this.bounds.getEast())*r),a=Math.ceil(t.mercatorYfromLat(this.bounds.getSouth())*r);return e.x>=n&&e.x<o&&e.y>=i&&e.y<a};var k=function(e){function r(r,n,i,o){if(e.call(this),this.id=r,this.dispatcher=i,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,t.extend(this,t.pick(n,["url","scheme","tileSize","promoteId"])),this._options=t.extend({type:"vector"},n),this._collectResourceTiming=n.collectResourceTiming,512!==this.tileSize)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(o)}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.load=function(){var e=this;this._loaded=!1,this.fire(new t.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=E(this._options,this.map._requestManager,(function(r,n){e._tileJSONRequest=null,e._loaded=!0,r?e.fire(new t.ErrorEvent(r)):n&&(t.extend(e,n),n.bounds&&(e.tileBounds=new T(n.bounds,e.minzoom,e.maxzoom)),t.postTurnstileEvent(n.tiles,e.map._requestManager._customAccessToken),t.postMapLoadEvent(n.tiles,e.map._getMapId(),e.map._requestManager._skuToken,e.map._requestManager._customAccessToken),e.fire(new t.Event("data",{dataType:"source",sourceDataType:"metadata"})),e.fire(new t.Event("data",{dataType:"source",sourceDataType:"content"})))}))},r.prototype.loaded=function(){return this._loaded},r.prototype.hasTile=function(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)},r.prototype.onAdd=function(t){this.map=t,this.load()},r.prototype.setSourceProperty=function(t){this._tileJSONRequest&&this._tileJSONRequest.cancel(),t(),this.map.style.sourceCaches[this.id].clearTiles(),this.load()},r.prototype.setTiles=function(t){var e=this;return this.setSourceProperty((function(){e._options.tiles=t})),this},r.prototype.setUrl=function(t){var e=this;return this.setSourceProperty((function(){e.url=t,e._options.url=t})),this},r.prototype.onRemove=function(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)},r.prototype.serialize=function(){return t.extend({},this._options)},r.prototype.loadTile=function(e,r){var n=this.map._requestManager.normalizeTileURL(e.tileID.canonical.url(this.tiles,this.scheme)),i={request:this.map._requestManager.transformRequest(n,t.ResourceType.Tile),uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:t.browser.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};function o(n,i){return delete e.request,e.aborted?r(null):n&&404!==n.status?r(n):(i&&i.resourceTiming&&(e.resourceTiming=i.resourceTiming),this.map._refreshExpiredTiles&&i&&e.setExpiryData(i),e.loadVectorData(i,this.map.painter),t.cacheEntryPossiblyAdded(this.dispatcher),r(null),void(e.reloadCallback&&(this.loadTile(e,e.reloadCallback),e.reloadCallback=null)))}i.request.collectResourceTiming=this._collectResourceTiming,e.actor&&"expired"!==e.state?"loading"===e.state?e.reloadCallback=r:e.request=e.actor.send("reloadTile",i,o.bind(this)):(e.actor=this.dispatcher.getActor(),e.request=e.actor.send("loadTile",i,o.bind(this)))},r.prototype.abortTile=function(t){t.request&&(t.request.cancel(),delete t.request),t.actor&&t.actor.send("abortTile",{uid:t.uid,type:this.type,source:this.id},void 0)},r.prototype.unloadTile=function(t){t.unloadVectorData(),t.actor&&t.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id},void 0)},r.prototype.hasTransition=function(){return!1},r}(t.Evented),I=function(e){function r(r,n,i,o){e.call(this),this.id=r,this.dispatcher=i,this.setEventedParent(o),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=t.extend({type:"raster"},n),t.extend(this,t.pick(n,["url","scheme","tileSize"]))}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.load=function(){var e=this;this._loaded=!1,this.fire(new t.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=E(this._options,this.map._requestManager,(function(r,n){e._tileJSONRequest=null,e._loaded=!0,r?e.fire(new t.ErrorEvent(r)):n&&(t.extend(e,n),n.bounds&&(e.tileBounds=new T(n.bounds,e.minzoom,e.maxzoom)),t.postTurnstileEvent(n.tiles),t.postMapLoadEvent(n.tiles,e.map._getMapId(),e.map._requestManager._skuToken),e.fire(new t.Event("data",{dataType:"source",sourceDataType:"metadata"})),e.fire(new t.Event("data",{dataType:"source",sourceDataType:"content"})))}))},r.prototype.loaded=function(){return this._loaded},r.prototype.onAdd=function(t){this.map=t,this.load()},r.prototype.onRemove=function(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)},r.prototype.serialize=function(){return t.extend({},this._options)},r.prototype.hasTile=function(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)},r.prototype.loadTile=function(e,r){var n=this,i=this.map._requestManager.normalizeTileURL(e.tileID.canonical.url(this.tiles,this.scheme),this.tileSize);e.request=t.getImage(this.map._requestManager.transformRequest(i,t.ResourceType.Tile),(function(i,o){if(delete e.request,e.aborted)e.state="unloaded",r(null);else if(i)e.state="errored",r(i);else if(o){n.map._refreshExpiredTiles&&e.setExpiryData(o),delete o.cacheControl,delete o.expires;var a=n.map.painter.context,s=a.gl;e.texture=n.map.painter.getTileTexture(o.width),e.texture?e.texture.update(o,{useMipmap:!0}):(e.texture=new t.Texture(a,o,s.RGBA,{useMipmap:!0}),e.texture.bind(s.LINEAR,s.CLAMP_TO_EDGE,s.LINEAR_MIPMAP_NEAREST),a.extTextureFilterAnisotropic&&s.texParameterf(s.TEXTURE_2D,a.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,a.extTextureFilterAnisotropicMax)),e.state="loaded",t.cacheEntryPossiblyAdded(n.dispatcher),r(null)}}))},r.prototype.abortTile=function(t,e){t.request&&(t.request.cancel(),delete t.request),e()},r.prototype.unloadTile=function(t,e){t.texture&&this.map.painter.saveTileTexture(t.texture),e()},r.prototype.hasTransition=function(){return!1},r}(t.Evented),z=function(e){function r(r,n,i,o){e.call(this,r,n,i,o),this.type="raster-dem",this.maxzoom=22,this._options=t.extend({type:"raster-dem"},n),this.encoding=n.encoding||"mapbox"}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.serialize=function(){return{type:"raster-dem",url:this.url,tileSize:this.tileSize,tiles:this.tiles,bounds:this.bounds,encoding:this.encoding}},r.prototype.loadTile=function(e,r){var n=this.map._requestManager.normalizeTileURL(e.tileID.canonical.url(this.tiles,this.scheme),this.tileSize);function i(t,n){t&&(e.state="errored",r(t)),n&&(e.dem=n,e.needsHillshadePrepare=!0,e.state="loaded",r(null))}e.request=t.getImage(this.map._requestManager.transformRequest(n,t.ResourceType.Tile),function(n,o){if(delete e.request,e.aborted)e.state="unloaded",r(null);else if(n)e.state="errored",r(n);else if(o){this.map._refreshExpiredTiles&&e.setExpiryData(o),delete o.cacheControl,delete o.expires;var a=t.window.ImageBitmap&&o instanceof t.window.ImageBitmap&&t.offscreenCanvasSupported()?o:t.browser.getImageData(o,1),s={uid:e.uid,coord:e.tileID,source:this.id,rawImageData:a,encoding:this.encoding};e.actor&&"expired"!==e.state||(e.actor=this.dispatcher.getActor(),e.actor.send("loadDEMTile",s,i.bind(this)))}}.bind(this)),e.neighboringTiles=this._getNeighboringTiles(e.tileID)},r.prototype._getNeighboringTiles=function(e){var r=e.canonical,n=Math.pow(2,r.z),i=(r.x-1+n)%n,o=0===r.x?e.wrap-1:e.wrap,a=(r.x+1+n)%n,s=r.x+1===n?e.wrap+1:e.wrap,u={};return u[new t.OverscaledTileID(e.overscaledZ,o,r.z,i,r.y).key]={backfilled:!1},u[new t.OverscaledTileID(e.overscaledZ,s,r.z,a,r.y).key]={backfilled:!1},r.y>0&&(u[new t.OverscaledTileID(e.overscaledZ,o,r.z,i,r.y-1).key]={backfilled:!1},u[new t.OverscaledTileID(e.overscaledZ,e.wrap,r.z,r.x,r.y-1).key]={backfilled:!1},u[new t.OverscaledTileID(e.overscaledZ,s,r.z,a,r.y-1).key]={backfilled:!1}),r.y+1<n&&(u[new t.OverscaledTileID(e.overscaledZ,o,r.z,i,r.y+1).key]={backfilled:!1},u[new t.OverscaledTileID(e.overscaledZ,e.wrap,r.z,r.x,r.y+1).key]={backfilled:!1},u[new t.OverscaledTileID(e.overscaledZ,s,r.z,a,r.y+1).key]={backfilled:!1}),u},r.prototype.unloadTile=function(t){t.demTexture&&this.map.painter.saveTileTexture(t.demTexture),t.fbo&&(t.fbo.destroy(),delete t.fbo),t.dem&&delete t.dem,delete t.neighboringTiles,t.state="unloaded",t.actor&&t.actor.send("removeDEMTile",{uid:t.uid,source:this.id})},r}(I),C=function(e){function r(r,n,i,o){e.call(this),this.id=r,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._loaded=!1,this.actor=i.getActor(),this.setEventedParent(o),this._data=n.data,this._options=t.extend({},n),this._collectResourceTiming=n.collectResourceTiming,this._resourceTiming=[],void 0!==n.maxzoom&&(this.maxzoom=n.maxzoom),n.type&&(this.type=n.type),n.attribution&&(this.attribution=n.attribution),this.promoteId=n.promoteId;var a=t.EXTENT/this.tileSize;this.workerOptions=t.extend({source:this.id,cluster:n.cluster||!1,geojsonVtOptions:{buffer:(void 0!==n.buffer?n.buffer:128)*a,tolerance:(void 0!==n.tolerance?n.tolerance:.375)*a,extent:t.EXTENT,maxZoom:this.maxzoom,lineMetrics:n.lineMetrics||!1,generateId:n.generateId||!1},superclusterOptions:{maxZoom:void 0!==n.clusterMaxZoom?Math.min(n.clusterMaxZoom,this.maxzoom-1):this.maxzoom-1,minPoints:Math.max(2,n.clusterMinPoints||2),extent:t.EXTENT,radius:(n.clusterRadius||50)*a,log:!1,generateId:n.generateId||!1},clusterProperties:n.clusterProperties,filter:n.filter},n.workerOptions)}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.load=function(){var e=this;this.fire(new t.Event("dataloading",{dataType:"source"})),this._updateWorkerData((function(r){if(r)e.fire(new t.ErrorEvent(r));else{var n={dataType:"source",sourceDataType:"metadata"};e._collectResourceTiming&&e._resourceTiming&&e._resourceTiming.length>0&&(n.resourceTiming=e._resourceTiming,e._resourceTiming=[]),e.fire(new t.Event("data",n))}}))},r.prototype.onAdd=function(t){this.map=t,this.load()},r.prototype.setData=function(e){var r=this;return this._data=e,this.fire(new t.Event("dataloading",{dataType:"source"})),this._updateWorkerData((function(e){if(e)r.fire(new t.ErrorEvent(e));else{var n={dataType:"source",sourceDataType:"content"};r._collectResourceTiming&&r._resourceTiming&&r._resourceTiming.length>0&&(n.resourceTiming=r._resourceTiming,r._resourceTiming=[]),r.fire(new t.Event("data",n))}})),this},r.prototype.getClusterExpansionZoom=function(t,e){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:t,source:this.id},e),this},r.prototype.getClusterChildren=function(t,e){return this.actor.send("geojson.getClusterChildren",{clusterId:t,source:this.id},e),this},r.prototype.getClusterLeaves=function(t,e,r,n){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:t,limit:e,offset:r},n),this},r.prototype._updateWorkerData=function(e){var r=this;this._loaded=!1;var n=t.extend({},this.workerOptions),i=this._data;"string"==typeof i?(n.request=this.map._requestManager.transformRequest(t.browser.resolveURL(i),t.ResourceType.Source),n.request.collectResourceTiming=this._collectResourceTiming):n.data=JSON.stringify(i),this.actor.send(this.type+".loadData",n,(function(t,i){r._removed||i&&i.abandoned||(r._loaded=!0,i&&i.resourceTiming&&i.resourceTiming[r.id]&&(r._resourceTiming=i.resourceTiming[r.id].slice(0)),r.actor.send(r.type+".coalesce",{source:n.source},null),e(t))}))},r.prototype.loaded=function(){return this._loaded},r.prototype.loadTile=function(e,r){var n=this,i=e.actor?"reloadTile":"loadTile";e.actor=this.actor,e.request=this.actor.send(i,{type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:t.browser.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId},(function(t,o){return delete e.request,e.unloadVectorData(),e.aborted?r(null):t?r(t):(e.loadVectorData(o,n.map.painter,"reloadTile"===i),r(null))}))},r.prototype.abortTile=function(t){t.request&&(t.request.cancel(),delete t.request),t.aborted=!0},r.prototype.unloadTile=function(t){t.unloadVectorData(),this.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id})},r.prototype.onRemove=function(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id})},r.prototype.serialize=function(){return t.extend({},this._options,{type:this.type,data:this._data})},r.prototype.hasTransition=function(){return!1},r}(t.Evented),P=t.createLayout([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]),M=function(e){function r(t,r,n,i){e.call(this),this.id=t,this.dispatcher=n,this.coordinates=r.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(i),this.options=r}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.load=function(e,r){var n=this;this._loaded=!1,this.fire(new t.Event("dataloading",{dataType:"source"})),this.url=this.options.url,t.getImage(this.map._requestManager.transformRequest(this.url,t.ResourceType.Image),(function(i,o){n._loaded=!0,i?n.fire(new t.ErrorEvent(i)):o&&(n.image=o,e&&(n.coordinates=e),r&&r(),n._finishLoading())}))},r.prototype.loaded=function(){return this._loaded},r.prototype.updateImage=function(t){var e=this;return this.image&&t.url?(this.options.url=t.url,this.load(t.coordinates,(function(){e.texture=null})),this):this},r.prototype._finishLoading=function(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"metadata"})))},r.prototype.onAdd=function(t){this.map=t,this.load()},r.prototype.setCoordinates=function(e){var r=this;this.coordinates=e;var n=e.map(t.MercatorCoordinate.fromLngLat);this.tileID=function(e){for(var r=1/0,n=1/0,i=-1/0,o=-1/0,a=0,s=e;a<s.length;a+=1){var u=s[a];r=Math.min(r,u.x),n=Math.min(n,u.y),i=Math.max(i,u.x),o=Math.max(o,u.y)}var l=Math.max(i-r,o-n),c=Math.max(0,Math.floor(-Math.log(l)/Math.LN2)),p=Math.pow(2,c);return new t.CanonicalTileID(c,Math.floor((r+i)/2*p),Math.floor((n+o)/2*p))}(n),this.minzoom=this.maxzoom=this.tileID.z;var i=n.map((function(t){return r.tileID.getTilePoint(t)._round()}));return this._boundsArray=new t.StructArrayLayout4i8,this._boundsArray.emplaceBack(i[0].x,i[0].y,0,0),this._boundsArray.emplaceBack(i[1].x,i[1].y,t.EXTENT,0),this._boundsArray.emplaceBack(i[3].x,i[3].y,0,t.EXTENT),this._boundsArray.emplaceBack(i[2].x,i[2].y,t.EXTENT,t.EXTENT),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"content"})),this},r.prototype.prepare=function(){if(0!==Object.keys(this.tiles).length&&this.image){var e=this.map.painter.context,r=e.gl;for(var n in this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,P.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture||(this.texture=new t.Texture(e,this.image,r.RGBA),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE)),this.tiles){var i=this.tiles[n];"loaded"!==i.state&&(i.state="loaded",i.texture=this.texture)}}},r.prototype.loadTile=function(t,e){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={},e(null)):(t.state="errored",e(null))},r.prototype.serialize=function(){return{type:"image",url:this.options.url,coordinates:this.coordinates}},r.prototype.hasTransition=function(){return!1},r}(t.Evented),D=function(e){function r(t,r,n,i){e.call(this,t,r,n,i),this.roundZoom=!0,this.type="video",this.options=r}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.load=function(){var e=this;this._loaded=!1;var r=this.options;this.urls=[];for(var n=0,i=r.urls;n<i.length;n+=1)this.urls.push(this.map._requestManager.transformRequest(i[n],t.ResourceType.Source).url);t.getVideo(this.urls,(function(r,n){e._loaded=!0,r?e.fire(new t.ErrorEvent(r)):n&&(e.video=n,e.video.loop=!0,e.video.addEventListener("playing",(function(){e.map.triggerRepaint()})),e.map&&e.video.play(),e._finishLoading())}))},r.prototype.pause=function(){this.video&&this.video.pause()},r.prototype.play=function(){this.video&&this.video.play()},r.prototype.seek=function(e){if(this.video){var r=this.video.seekable;e<r.start(0)||e>r.end(0)?this.fire(new t.ErrorEvent(new t.ValidationError("sources."+this.id,null,"Playback for this video can be set only between the "+r.start(0)+" and "+r.end(0)+"-second mark."))):this.video.currentTime=e}},r.prototype.getVideo=function(){return this.video},r.prototype.onAdd=function(t){this.map||(this.map=t,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))},r.prototype.prepare=function(){if(!(0===Object.keys(this.tiles).length||this.video.readyState<2)){var e=this.map.painter.context,r=e.gl;for(var n in this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,P.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE),r.texSubImage2D(r.TEXTURE_2D,0,0,0,r.RGBA,r.UNSIGNED_BYTE,this.video)):(this.texture=new t.Texture(e,this.video,r.RGBA),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE)),this.tiles){var i=this.tiles[n];"loaded"!==i.state&&(i.state="loaded",i.texture=this.texture)}}},r.prototype.serialize=function(){return{type:"video",urls:this.urls,coordinates:this.coordinates}},r.prototype.hasTransition=function(){return this.video&&!this.video.paused},r}(M),L=function(e){function r(r,n,i,o){e.call(this,r,n,i,o),n.coordinates?Array.isArray(n.coordinates)&&4===n.coordinates.length&&!n.coordinates.some((function(t){return!Array.isArray(t)||2!==t.length||t.some((function(t){return"number"!=typeof t}))}))||this.fire(new t.ErrorEvent(new t.ValidationError("sources."+r,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new t.ErrorEvent(new t.ValidationError("sources."+r,null,'missing required property "coordinates"'))),n.animate&&"boolean"!=typeof n.animate&&this.fire(new t.ErrorEvent(new t.ValidationError("sources."+r,null,'optional "animate" property must be a boolean value'))),n.canvas?"string"==typeof n.canvas||n.canvas instanceof t.window.HTMLCanvasElement||this.fire(new t.ErrorEvent(new t.ValidationError("sources."+r,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new t.ErrorEvent(new t.ValidationError("sources."+r,null,'missing required property "canvas"'))),this.options=n,this.animate=void 0===n.animate||n.animate}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.load=function(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof t.window.HTMLCanvasElement?this.options.canvas:t.window.document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new t.ErrorEvent(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())},r.prototype.getCanvas=function(){return this.canvas},r.prototype.onAdd=function(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()},r.prototype.onRemove=function(){this.pause()},r.prototype.prepare=function(){var e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),!this._hasInvalidDimensions()&&0!==Object.keys(this.tiles).length){var r=this.map.painter.context,n=r.gl;for(var i in this.boundsBuffer||(this.boundsBuffer=r.createVertexBuffer(this._boundsArray,P.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new t.Texture(r,this.canvas,n.RGBA,{premultiply:!0}),this.tiles){var o=this.tiles[i];"loaded"!==o.state&&(o.state="loaded",o.texture=this.texture)}}},r.prototype.serialize=function(){return{type:"canvas",coordinates:this.coordinates}},r.prototype.hasTransition=function(){return this._playing},r.prototype._hasInvalidDimensions=function(){for(var t=0,e=[this.canvas.width,this.canvas.height];t<e.length;t+=1){var r=e[t];if(isNaN(r)||r<=0)return!0}return!1},r}(M),B={vector:k,raster:I,"raster-dem":z,geojson:C,video:D,image:M,canvas:L};function R(e,r){var n=t.identity([]);return t.translate(n,n,[1,1,0]),t.scale(n,n,[.5*e.width,.5*e.height,1]),t.multiply(n,n,e.calculatePosMatrix(r.toUnwrapped()))}function O(t,e,r,n,i,o){var a=function(t,e,r){if(t)for(var n=0,i=t;n<i.length;n+=1){var o=e[i[n]];if(o&&o.source===r&&"fill-extrusion"===o.type)return!0}else for(var a in e){var s=e[a];if(s.source===r&&"fill-extrusion"===s.type)return!0}return!1}(i&&i.layers,e,t.id),s=o.maxPitchScaleFactor(),u=t.tilesIn(n,s,a);u.sort(F);for(var l=[],c=0,p=u;c<p.length;c+=1){var h=p[c];l.push({wrappedTileID:h.tileID.wrapped().key,queryResults:h.tile.queryRenderedFeatures(e,r,t._state,h.queryGeometry,h.cameraQueryGeometry,h.scale,i,o,s,R(t.transform,h.tileID))})}var f=function(t){for(var e={},r={},n=0,i=t;n<i.length;n+=1){var o=i[n],a=o.queryResults,s=o.wrappedTileID,u=r[s]=r[s]||{};for(var l in a)for(var c=a[l],p=u[l]=u[l]||{},h=e[l]=e[l]||[],f=0,d=c;f<d.length;f+=1){var m=d[f];p[m.featureIndex]||(p[m.featureIndex]=!0,h.push(m))}}return e}(l);for(var d in f)f[d].forEach((function(e){var r=e.feature,n=t.getFeatureState(r.layer["source-layer"],r.id);r.source=r.layer.source,r.layer["source-layer"]&&(r.sourceLayer=r.layer["source-layer"]),r.state=n}));return f}function F(t,e){var r=t.tileID,n=e.tileID;return r.overscaledZ-n.overscaledZ||r.canonical.y-n.canonical.y||r.wrap-n.wrap||r.canonical.x-n.canonical.x}var V=function(t,e){this.max=t,this.onRemove=e,this.reset()};V.prototype.reset=function(){for(var t in this.data)for(var e=0,r=this.data[t];e<r.length;e+=1){var n=r[e];n.timeout&&clearTimeout(n.timeout),this.onRemove(n.value)}return this.data={},this.order=[],this},V.prototype.add=function(t,e,r){var n=this,i=t.wrapped().key;void 0===this.data[i]&&(this.data[i]=[]);var o={value:e,timeout:void 0};if(void 0!==r&&(o.timeout=setTimeout((function(){n.remove(t,o)}),r)),this.data[i].push(o),this.order.push(i),this.order.length>this.max){var a=this._getAndRemoveByKey(this.order[0]);a&&this.onRemove(a)}return this},V.prototype.has=function(t){return t.wrapped().key in this.data},V.prototype.getAndRemove=function(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null},V.prototype._getAndRemoveByKey=function(t){var e=this.data[t].shift();return e.timeout&&clearTimeout(e.timeout),0===this.data[t].length&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),e.value},V.prototype.getByKey=function(t){var e=this.data[t];return e?e[0].value:null},V.prototype.get=function(t){return this.has(t)?this.data[t.wrapped().key][0].value:null},V.prototype.remove=function(t,e){if(!this.has(t))return this;var r=t.wrapped().key,n=void 0===e?0:this.data[r].indexOf(e),i=this.data[r][n];return this.data[r].splice(n,1),i.timeout&&clearTimeout(i.timeout),0===this.data[r].length&&delete this.data[r],this.onRemove(i.value),this.order.splice(this.order.indexOf(r),1),this},V.prototype.setMaxSize=function(t){for(this.max=t;this.order.length>this.max;){var e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this},V.prototype.filter=function(t){var e=[];for(var r in this.data)for(var n=0,i=this.data[r];n<i.length;n+=1){var o=i[n];t(o.value)||e.push(o)}for(var a=0,s=e;a<s.length;a+=1){var u=s[a];this.remove(u.value.tileID,u)}};var U=function(t,e,r){this.context=t;var n=t.gl;this.buffer=n.createBuffer(),this.dynamicDraw=Boolean(r),this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),n.bufferData(n.ELEMENT_ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?n.DYNAMIC_DRAW:n.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer};U.prototype.bind=function(){this.context.bindElementBuffer.set(this.buffer)},U.prototype.updateData=function(t){var e=this.context.gl;this.context.unbindVAO(),this.bind(),e.bufferSubData(e.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)},U.prototype.destroy=function(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)};var j={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"},N=function(t,e,r,n){this.length=e.length,this.attributes=r,this.itemSize=e.bytesPerElement,this.dynamicDraw=n,this.context=t;var i=t.gl;this.buffer=i.createBuffer(),t.bindVertexBuffer.set(this.buffer),i.bufferData(i.ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?i.DYNAMIC_DRAW:i.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer};N.prototype.bind=function(){this.context.bindVertexBuffer.set(this.buffer)},N.prototype.updateData=function(t){var e=this.context.gl;this.bind(),e.bufferSubData(e.ARRAY_BUFFER,0,t.arrayBuffer)},N.prototype.enableAttributes=function(t,e){for(var r=0;r<this.attributes.length;r++){var n=e.attributes[this.attributes[r].name];void 0!==n&&t.enableVertexAttribArray(n)}},N.prototype.setVertexAttribPointers=function(t,e,r){for(var n=0;n<this.attributes.length;n++){var i=this.attributes[n],o=e.attributes[i.name];void 0!==o&&t.vertexAttribPointer(o,i.components,t[j[i.type]],!1,this.itemSize,i.offset+this.itemSize*(r||0))}},N.prototype.destroy=function(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)};var q=function(t){this.gl=t.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1};q.prototype.get=function(){return this.current},q.prototype.set=function(t){},q.prototype.getDefault=function(){return this.default},q.prototype.setDefault=function(){this.set(this.default)};var $=function(e){function r(){e.apply(this,arguments)}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.getDefault=function(){return t.Color.transparent},r.prototype.set=function(t){var e=this.current;(t.r!==e.r||t.g!==e.g||t.b!==e.b||t.a!==e.a||this.dirty)&&(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)},r}(q),Z=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return 1},e.prototype.set=function(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)},e}(q),G=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return 0},e.prototype.set=function(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)},e}(q),W=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return[!0,!0,!0,!0]},e.prototype.set=function(t){var e=this.current;(t[0]!==e[0]||t[1]!==e[1]||t[2]!==e[2]||t[3]!==e[3]||this.dirty)&&(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)},e}(q),X=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return!0},e.prototype.set=function(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)},e}(q),H=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return 255},e.prototype.set=function(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)},e}(q),K=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return{func:this.gl.ALWAYS,ref:0,mask:255}},e.prototype.set=function(t){var e=this.current;(t.func!==e.func||t.ref!==e.ref||t.mask!==e.mask||this.dirty)&&(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)},e}(q),Y=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){var t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]},e.prototype.set=function(t){var e=this.current;(t[0]!==e[0]||t[1]!==e[1]||t[2]!==e[2]||this.dirty)&&(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)},e}(q),J=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return!1},e.prototype.set=function(t){if(t!==this.current||this.dirty){var e=this.gl;t?e.enable(e.STENCIL_TEST):e.disable(e.STENCIL_TEST),this.current=t,this.dirty=!1}},e}(q),Q=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return[0,1]},e.prototype.set=function(t){var e=this.current;(t[0]!==e[0]||t[1]!==e[1]||this.dirty)&&(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)},e}(q),tt=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return!1},e.prototype.set=function(t){if(t!==this.current||this.dirty){var e=this.gl;t?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),this.current=t,this.dirty=!1}},e}(q),et=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return this.gl.LESS},e.prototype.set=function(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)},e}(q),rt=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return!1},e.prototype.set=function(t){if(t!==this.current||this.dirty){var e=this.gl;t?e.enable(e.BLEND):e.disable(e.BLEND),this.current=t,this.dirty=!1}},e}(q),nt=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){var t=this.gl;return[t.ONE,t.ZERO]},e.prototype.set=function(t){var e=this.current;(t[0]!==e[0]||t[1]!==e[1]||this.dirty)&&(this.gl.blendFunc(t[0],t[1]),this.current=t,this.dirty=!1)},e}(q),it=function(e){function r(){e.apply(this,arguments)}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.getDefault=function(){return t.Color.transparent},r.prototype.set=function(t){var e=this.current;(t.r!==e.r||t.g!==e.g||t.b!==e.b||t.a!==e.a||this.dirty)&&(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)},r}(q),ot=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return this.gl.FUNC_ADD},e.prototype.set=function(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)},e}(q),at=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return!1},e.prototype.set=function(t){if(t!==this.current||this.dirty){var e=this.gl;t?e.enable(e.CULL_FACE):e.disable(e.CULL_FACE),this.current=t,this.dirty=!1}},e}(q),st=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return this.gl.BACK},e.prototype.set=function(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)},e}(q),ut=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return this.gl.CCW},e.prototype.set=function(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)},e}(q),lt=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return null},e.prototype.set=function(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)},e}(q),ct=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return this.gl.TEXTURE0},e.prototype.set=function(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)},e}(q),pt=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){var t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]},e.prototype.set=function(t){var e=this.current;(t[0]!==e[0]||t[1]!==e[1]||t[2]!==e[2]||t[3]!==e[3]||this.dirty)&&(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)},e}(q),ht=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return null},e.prototype.set=function(t){if(t!==this.current||this.dirty){var e=this.gl;e.bindFramebuffer(e.FRAMEBUFFER,t),this.current=t,this.dirty=!1}},e}(q),ft=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return null},e.prototype.set=function(t){if(t!==this.current||this.dirty){var e=this.gl;e.bindRenderbuffer(e.RENDERBUFFER,t),this.current=t,this.dirty=!1}},e}(q),dt=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return null},e.prototype.set=function(t){if(t!==this.current||this.dirty){var e=this.gl;e.bindTexture(e.TEXTURE_2D,t),this.current=t,this.dirty=!1}},e}(q),mt=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return null},e.prototype.set=function(t){if(t!==this.current||this.dirty){var e=this.gl;e.bindBuffer(e.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}},e}(q),yt=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return null},e.prototype.set=function(t){var e=this.gl;e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1},e}(q),gt=function(t){function e(e){t.call(this,e),this.vao=e.extVertexArrayObject}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return null},e.prototype.set=function(t){this.vao&&(t!==this.current||this.dirty)&&(this.vao.bindVertexArrayOES(t),this.current=t,this.dirty=!1)},e}(q),vt=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return 4},e.prototype.set=function(t){if(t!==this.current||this.dirty){var e=this.gl;e.pixelStorei(e.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}},e}(q),_t=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return!1},e.prototype.set=function(t){if(t!==this.current||this.dirty){var e=this.gl;e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}},e}(q),xt=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return!1},e.prototype.set=function(t){if(t!==this.current||this.dirty){var e=this.gl;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}},e}(q),bt=function(t){function e(e,r){t.call(this,e),this.context=e,this.parent=r}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return null},e}(q),wt=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.setDirty=function(){this.dirty=!0},e.prototype.set=function(t){if(t!==this.current||this.dirty){this.context.bindFramebuffer.set(this.parent);var e=this.gl;e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}},e}(bt),St=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.set=function(t){if(t!==this.current||this.dirty){this.context.bindFramebuffer.set(this.parent);var e=this.gl;e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,t),this.current=t,this.dirty=!1}},e}(bt),At=function(t,e,r,n){this.context=t,this.width=e,this.height=r;var i=this.framebuffer=t.gl.createFramebuffer();this.colorAttachment=new wt(t,i),n&&(this.depthAttachment=new St(t,i))};At.prototype.destroy=function(){var t=this.context.gl,e=this.colorAttachment.get();if(e&&t.deleteTexture(e),this.depthAttachment){var r=this.depthAttachment.get();r&&t.deleteRenderbuffer(r)}t.deleteFramebuffer(this.framebuffer)};var Et=function(t,e,r){this.func=t,this.mask=e,this.range=r};Et.ReadOnly=!1,Et.ReadWrite=!0,Et.disabled=new Et(519,Et.ReadOnly,[0,1]);var Tt=function(t,e,r,n,i,o){this.test=t,this.ref=e,this.mask=r,this.fail=n,this.depthFail=i,this.pass=o};Tt.disabled=new Tt({func:519,mask:0},0,0,7680,7680,7680);var kt=function(t,e,r){this.blendFunction=t,this.blendColor=e,this.mask=r};kt.disabled=new kt(kt.Replace=[1,0],t.Color.transparent,[!1,!1,!1,!1]),kt.unblended=new kt(kt.Replace,t.Color.transparent,[!0,!0,!0,!0]),kt.alphaBlended=new kt([1,771],t.Color.transparent,[!0,!0,!0,!0]);var It=function(t,e,r){this.enable=t,this.mode=e,this.frontFace=r};It.disabled=new It(!1,1029,2305),It.backCCW=new It(!0,1029,2305);var zt=function(t){this.gl=t,this.extVertexArrayObject=this.gl.getExtension("OES_vertex_array_object"),this.clearColor=new $(this),this.clearDepth=new Z(this),this.clearStencil=new G(this),this.colorMask=new W(this),this.depthMask=new X(this),this.stencilMask=new H(this),this.stencilFunc=new K(this),this.stencilOp=new Y(this),this.stencilTest=new J(this),this.depthRange=new Q(this),this.depthTest=new tt(this),this.depthFunc=new et(this),this.blend=new rt(this),this.blendFunc=new nt(this),this.blendColor=new it(this),this.blendEquation=new ot(this),this.cullFace=new at(this),this.cullFaceSide=new st(this),this.frontFace=new ut(this),this.program=new lt(this),this.activeTexture=new ct(this),this.viewport=new pt(this),this.bindFramebuffer=new ht(this),this.bindRenderbuffer=new ft(this),this.bindTexture=new dt(this),this.bindVertexBuffer=new mt(this),this.bindElementBuffer=new yt(this),this.bindVertexArrayOES=this.extVertexArrayObject&&new gt(this),this.pixelStoreUnpack=new vt(this),this.pixelStoreUnpackPremultiplyAlpha=new _t(this),this.pixelStoreUnpackFlipY=new xt(this),this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.extTextureHalfFloat=t.getExtension("OES_texture_half_float"),this.extTextureHalfFloat&&(t.getExtension("OES_texture_half_float_linear"),this.extRenderToTextureHalfFloat=t.getExtension("EXT_color_buffer_half_float")),this.extTimerQuery=t.getExtension("EXT_disjoint_timer_query"),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE)};zt.prototype.setDefault=function(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()},zt.prototype.setDirty=function(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.extVertexArrayObject&&(this.bindVertexArrayOES.dirty=!0),this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0},zt.prototype.createIndexBuffer=function(t,e){return new U(this,t,e)},zt.prototype.createVertexBuffer=function(t,e,r){return new N(this,t,e,r)},zt.prototype.createRenderbuffer=function(t,e,r){var n=this.gl,i=n.createRenderbuffer();return this.bindRenderbuffer.set(i),n.renderbufferStorage(n.RENDERBUFFER,t,e,r),this.bindRenderbuffer.set(null),i},zt.prototype.createFramebuffer=function(t,e,r){return new At(this,t,e,r)},zt.prototype.clear=function(t){var e=t.color,r=t.depth,n=this.gl,i=0;e&&(i|=n.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set([!0,!0,!0,!0])),void 0!==r&&(i|=n.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(r),this.depthMask.set(!0)),n.clear(i)},zt.prototype.setCullFace=function(t){!1===t.enable?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(t.mode),this.frontFace.set(t.frontFace))},zt.prototype.setDepthMode=function(t){t.func!==this.gl.ALWAYS||t.mask?(this.depthTest.set(!0),this.depthFunc.set(t.func),this.depthMask.set(t.mask),this.depthRange.set(t.range)):this.depthTest.set(!1)},zt.prototype.setStencilMode=function(t){t.test.func!==this.gl.ALWAYS||t.mask?(this.stencilTest.set(!0),this.stencilMask.set(t.mask),this.stencilOp.set([t.fail,t.depthFail,t.pass]),this.stencilFunc.set({func:t.test.func,ref:t.ref,mask:t.test.mask})):this.stencilTest.set(!1)},zt.prototype.setColorMode=function(e){t.deepEqual(e.blendFunction,kt.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(e.blendFunction),this.blendColor.set(e.blendColor)),this.colorMask.set(e.mask)},zt.prototype.unbindVAO=function(){this.extVertexArrayObject&&this.bindVertexArrayOES.set(null)};var Ct=function(e){function r(r,n,i){var o=this;e.call(this),this.id=r,this.dispatcher=i,this.on("data",(function(t){"source"===t.dataType&&"metadata"===t.sourceDataType&&(o._sourceLoaded=!0),o._sourceLoaded&&!o._paused&&"source"===t.dataType&&"content"===t.sourceDataType&&(o.reload(),o.transform&&o.update(o.transform))})),this.on("error",(function(){o._sourceErrored=!0})),this._source=function(e,r,n,i){var o=new B[r.type](e,r,n,i);if(o.id!==e)throw new Error("Expected Source id to be "+e+" instead of "+o.id);return t.bindAll(["load","abort","unload","serialize","prepare"],o),o}(r,n,i,this),this._tiles={},this._cache=new V(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new t.SourceFeatureState}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.onAdd=function(t){this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._source&&this._source.onAdd&&this._source.onAdd(t)},r.prototype.onRemove=function(t){this._source&&this._source.onRemove&&this._source.onRemove(t)},r.prototype.loaded=function(){if(this._sourceErrored)return!0;if(!this._sourceLoaded)return!1;if(!this._source.loaded())return!1;for(var t in this._tiles){var e=this._tiles[t];if("loaded"!==e.state&&"errored"!==e.state)return!1}return!0},r.prototype.getSource=function(){return this._source},r.prototype.pause=function(){this._paused=!0},r.prototype.resume=function(){if(this._paused){var t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform)}},r.prototype._loadTile=function(t,e){return this._source.loadTile(t,e)},r.prototype._unloadTile=function(t){if(this._source.unloadTile)return this._source.unloadTile(t,(function(){}))},r.prototype._abortTile=function(t){if(this._source.abortTile)return this._source.abortTile(t,(function(){}))},r.prototype.serialize=function(){return this._source.serialize()},r.prototype.prepare=function(t){for(var e in this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null),this._tiles){var r=this._tiles[e];r.upload(t),r.prepare(this.map.style.imageManager)}},r.prototype.getIds=function(){return t.values(this._tiles).map((function(t){return t.tileID})).sort(Pt).map((function(t){return t.key}))},r.prototype.getRenderableIds=function(e){var r=this,n=[];for(var i in this._tiles)this._isIdRenderable(i,e)&&n.push(this._tiles[i]);return e?n.sort((function(e,n){var i=e.tileID,o=n.tileID,a=new t.Point(i.canonical.x,i.canonical.y)._rotate(r.transform.angle),s=new t.Point(o.canonical.x,o.canonical.y)._rotate(r.transform.angle);return i.overscaledZ-o.overscaledZ||s.y-a.y||s.x-a.x})).map((function(t){return t.tileID.key})):n.map((function(t){return t.tileID})).sort(Pt).map((function(t){return t.key}))},r.prototype.hasRenderableParent=function(t){var e=this.findLoadedParent(t,0);return!!e&&this._isIdRenderable(e.tileID.key)},r.prototype._isIdRenderable=function(t,e){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(e||!this._tiles[t].holdingForFade())},r.prototype.reload=function(){if(this._paused)this._shouldReloadOnResume=!0;else for(var t in this._cache.reset(),this._tiles)"errored"!==this._tiles[t].state&&this._reloadTile(t,"reloading")},r.prototype._reloadTile=function(t,e){var r=this._tiles[t];r&&("loading"!==r.state&&(r.state=e),this._loadTile(r,this._tileLoaded.bind(this,r,t,e)))},r.prototype._tileLoaded=function(e,r,n,i){if(i)return e.state="errored",void(404!==i.status?this._source.fire(new t.ErrorEvent(i,{tile:e})):this.update(this.transform));e.timeAdded=t.browser.now(),"expired"===n&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(r,e),"raster-dem"===this.getSource().type&&e.dem&&this._backfillDEM(e),this._state.initializeTileState(e,this.map?this.map.painter:null),this._source.fire(new t.Event("data",{dataType:"source",tile:e,coord:e.tileID}))},r.prototype._backfillDEM=function(t){for(var e=this.getRenderableIds(),r=0;r<e.length;r++){var n=e[r];if(t.neighboringTiles&&t.neighboringTiles[n]){var i=this.getTileByID(n);o(t,i),o(i,t)}}function o(t,e){t.needsHillshadePrepare=!0;var r=e.tileID.canonical.x-t.tileID.canonical.x,n=e.tileID.canonical.y-t.tileID.canonical.y,i=Math.pow(2,t.tileID.canonical.z),o=e.tileID.key;0===r&&0===n||Math.abs(n)>1||(Math.abs(r)>1&&(1===Math.abs(r+i)?r+=i:1===Math.abs(r-i)&&(r-=i)),e.dem&&t.dem&&(t.dem.backfillBorder(e.dem,r,n),t.neighboringTiles&&t.neighboringTiles[o]&&(t.neighboringTiles[o].backfilled=!0)))}},r.prototype.getTile=function(t){return this.getTileByID(t.key)},r.prototype.getTileByID=function(t){return this._tiles[t]},r.prototype._retainLoadedChildren=function(t,e,r,n){for(var i in this._tiles){var o=this._tiles[i];if(!(n[i]||!o.hasData()||o.tileID.overscaledZ<=e||o.tileID.overscaledZ>r)){for(var a=o.tileID;o&&o.tileID.overscaledZ>e+1;){var s=o.tileID.scaledTo(o.tileID.overscaledZ-1);(o=this._tiles[s.key])&&o.hasData()&&(a=s)}for(var u=a;u.overscaledZ>e;)if(t[(u=u.scaledTo(u.overscaledZ-1)).key]){n[a.key]=a;break}}}},r.prototype.findLoadedParent=function(t,e){if(t.key in this._loadedParentTiles){var r=this._loadedParentTiles[t.key];return r&&r.tileID.overscaledZ>=e?r:null}for(var n=t.overscaledZ-1;n>=e;n--){var i=t.scaledTo(n),o=this._getLoadedTile(i);if(o)return o}},r.prototype._getLoadedTile=function(t){var e=this._tiles[t.key];return e&&e.hasData()?e:this._cache.getByKey(t.wrapped().key)},r.prototype.updateCacheSize=function(t){var e=Math.ceil(t.width/this._source.tileSize)+1,r=Math.ceil(t.height/this._source.tileSize)+1,n=Math.floor(e*r*5),i="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,n):n;this._cache.setMaxSize(i)},r.prototype.handleWrapJump=function(t){var e=Math.round((t-(void 0===this._prevLng?t:this._prevLng))/360);if(this._prevLng=t,e){var r={};for(var n in this._tiles){var i=this._tiles[n];i.tileID=i.tileID.unwrapTo(i.tileID.wrap+e),r[i.tileID.key]=i}for(var o in this._tiles=r,this._timers)clearTimeout(this._timers[o]),delete this._timers[o];for(var a in this._tiles)this._setTileReloadTimer(a,this._tiles[a])}},r.prototype.update=function(e){var n=this;if(this.transform=e,this._sourceLoaded&&!this._paused){var i;this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used?this._source.tileID?i=e.getVisibleUnwrappedCoordinates(this._source.tileID).map((function(e){return new t.OverscaledTileID(e.canonical.z,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y)})):(i=e.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}),this._source.hasTile&&(i=i.filter((function(t){return n._source.hasTile(t)})))):i=[];var o=e.coveringZoomLevel(this._source),a=Math.max(o-r.maxOverzooming,this._source.minzoom),s=Math.max(o+r.maxUnderzooming,this._source.minzoom),u=this._updateRetainedTiles(i,o);if(Mt(this._source.type)){for(var l={},c={},p=0,h=Object.keys(u);p<h.length;p+=1){var f=h[p],d=u[f],m=this._tiles[f];if(m&&!(m.fadeEndTime&&m.fadeEndTime<=t.browser.now())){var y=this.findLoadedParent(d,a);y&&(this._addTile(y.tileID),l[y.tileID.key]=y.tileID),c[f]=d}}for(var g in this._retainLoadedChildren(c,o,s,u),l)u[g]||(this._coveredTiles[g]=!0,u[g]=l[g])}for(var v in u)this._tiles[v].clearFadeHold();for(var _=0,x=t.keysDifference(this._tiles,u);_<x.length;_+=1){var b=x[_],w=this._tiles[b];w.hasSymbolBuckets&&!w.holdingForFade()?w.setHoldDuration(this.map._fadeDuration):w.hasSymbolBuckets&&!w.symbolFadeFinished()||this._removeTile(b)}this._updateLoadedParentTileCache()}},r.prototype.releaseSymbolFadeTiles=function(){for(var t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(t)},r.prototype._updateRetainedTiles=function(t,e){for(var n={},i={},o=Math.max(e-r.maxOverzooming,this._source.minzoom),a=Math.max(e+r.maxUnderzooming,this._source.minzoom),s={},u=0,l=t;u<l.length;u+=1){var c=l[u],p=this._addTile(c);n[c.key]=c,p.hasData()||e<this._source.maxzoom&&(s[c.key]=c)}this._retainLoadedChildren(s,e,a,n);for(var h=0,f=t;h<f.length;h+=1){var d=f[h],m=this._tiles[d.key];if(!m.hasData()){if(e+1>this._source.maxzoom){var y=d.children(this._source.maxzoom)[0],g=this.getTile(y);if(g&&g.hasData()){n[y.key]=y;continue}}else{var v=d.children(this._source.maxzoom);if(n[v[0].key]&&n[v[1].key]&&n[v[2].key]&&n[v[3].key])continue}for(var _=m.wasRequested(),x=d.overscaledZ-1;x>=o;--x){var b=d.scaledTo(x);if(i[b.key])break;if(i[b.key]=!0,!(m=this.getTile(b))&&_&&(m=this._addTile(b)),m&&(n[b.key]=b,_=m.wasRequested(),m.hasData()))break}}}return n},r.prototype._updateLoadedParentTileCache=function(){for(var t in this._loadedParentTiles={},this._tiles){for(var e=[],r=void 0,n=this._tiles[t].tileID;n.overscaledZ>0;){if(n.key in this._loadedParentTiles){r=this._loadedParentTiles[n.key];break}e.push(n.key);var i=n.scaledTo(n.overscaledZ-1);if(r=this._getLoadedTile(i))break;n=i}for(var o=0,a=e;o<a.length;o+=1)this._loadedParentTiles[a[o]]=r}},r.prototype._addTile=function(e){var r=this._tiles[e.key];if(r)return r;(r=this._cache.getAndRemove(e))&&(this._setTileReloadTimer(e.key,r),r.tileID=e,this._state.initializeTileState(r,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,r)));var n=Boolean(r);return n||(r=new t.Tile(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(r,this._tileLoaded.bind(this,r,e.key,r.state))),r?(r.uses++,this._tiles[e.key]=r,n||this._source.fire(new t.Event("dataloading",{tile:r,coord:r.tileID,dataType:"source"})),r):null},r.prototype._setTileReloadTimer=function(t,e){var r=this;t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);var n=e.getExpiryTimeout();n&&(this._timers[t]=setTimeout((function(){r._reloadTile(t,"expired"),delete r._timers[t]}),n))},r.prototype._removeTile=function(t){var e=this._tiles[t];e&&(e.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),e.uses>0||(e.hasData()&&"reloading"!==e.state?this._cache.add(e.tileID,e,e.getExpiryTimeout()):(e.aborted=!0,this._abortTile(e),this._unloadTile(e))))},r.prototype.clearTiles=function(){for(var t in this._shouldReloadOnResume=!1,this._paused=!1,this._tiles)this._removeTile(t);this._cache.reset()},r.prototype.tilesIn=function(e,r,n){var i=this,o=[],a=this.transform;if(!a)return o;for(var s=n?a.getCameraQueryGeometry(e):e,u=e.map((function(t){return a.pointCoordinate(t)})),l=s.map((function(t){return a.pointCoordinate(t)})),c=this.getIds(),p=1/0,h=1/0,f=-1/0,d=-1/0,m=0,y=l;m<y.length;m+=1){var g=y[m];p=Math.min(p,g.x),h=Math.min(h,g.y),f=Math.max(f,g.x),d=Math.max(d,g.y)}for(var v=function(e){var n=i._tiles[c[e]];if(!n.holdingForFade()){var s=n.tileID,m=Math.pow(2,a.zoom-n.tileID.overscaledZ),y=r*n.queryPadding*t.EXTENT/n.tileSize/m,g=[s.getTilePoint(new t.MercatorCoordinate(p,h)),s.getTilePoint(new t.MercatorCoordinate(f,d))];if(g[0].x-y<t.EXTENT&&g[0].y-y<t.EXTENT&&g[1].x+y>=0&&g[1].y+y>=0){var v=u.map((function(t){return s.getTilePoint(t)})),_=l.map((function(t){return s.getTilePoint(t)}));o.push({tile:n,tileID:s,queryGeometry:v,cameraQueryGeometry:_,scale:m})}}},_=0;_<c.length;_++)v(_);return o},r.prototype.getVisibleCoordinates=function(t){for(var e=this,r=this.getRenderableIds(t).map((function(t){return e._tiles[t].tileID})),n=0,i=r;n<i.length;n+=1){var o=i[n];o.posMatrix=this.transform.calculatePosMatrix(o.toUnwrapped())}return r},r.prototype.hasTransition=function(){if(this._source.hasTransition())return!0;if(Mt(this._source.type))for(var e in this._tiles){var r=this._tiles[e];if(void 0!==r.fadeEndTime&&r.fadeEndTime>=t.browser.now())return!0}return!1},r.prototype.setFeatureState=function(t,e,r){this._state.updateState(t=t||"_geojsonTileLayer",e,r)},r.prototype.removeFeatureState=function(t,e,r){this._state.removeFeatureState(t=t||"_geojsonTileLayer",e,r)},r.prototype.getFeatureState=function(t,e){return this._state.getState(t=t||"_geojsonTileLayer",e)},r.prototype.setDependencies=function(t,e,r){var n=this._tiles[t];n&&n.setDependencies(e,r)},r.prototype.reloadTilesForDependencies=function(t,e){for(var r in this._tiles)this._tiles[r].hasDependency(t,e)&&this._reloadTile(r,"reloading");this._cache.filter((function(r){return!r.hasDependency(t,e)}))},r}(t.Evented);function Pt(t,e){var r=Math.abs(2*t.wrap)-+(t.wrap<0),n=Math.abs(2*e.wrap)-+(e.wrap<0);return t.overscaledZ-e.overscaledZ||n-r||e.canonical.y-t.canonical.y||e.canonical.x-t.canonical.x}function Mt(t){return"raster"===t||"image"===t||"video"===t}function Dt(){return new t.window.Worker(Hi.workerUrl)}Ct.maxOverzooming=10,Ct.maxUnderzooming=3;var Lt="mapboxgl_preloaded_worker_pool",Bt=function(){this.active={}};Bt.prototype.acquire=function(t){if(!this.workers)for(this.workers=[];this.workers.length<Bt.workerCount;)this.workers.push(new Dt);return this.active[t]=!0,this.workers.slice()},Bt.prototype.release=function(t){delete this.active[t],0===this.numActive()&&(this.workers.forEach((function(t){t.terminate()})),this.workers=null)},Bt.prototype.isPreloaded=function(){return!!this.active[Lt]},Bt.prototype.numActive=function(){return Object.keys(this.active).length};var Rt,Ot=Math.floor(t.browser.hardwareConcurrency/2);function Ft(){return Rt||(Rt=new Bt),Rt}function Vt(e,r){var n={};for(var i in e)"ref"!==i&&(n[i]=e[i]);return t.refProperties.forEach((function(t){t in r&&(n[t]=r[t])})),n}function Ut(t){t=t.slice();for(var e=Object.create(null),r=0;r<t.length;r++)e[t[r].id]=t[r];for(var n=0;n<t.length;n++)"ref"in t[n]&&(t[n]=Vt(t[n],e[t[n].ref]));return t}Bt.workerCount=Math.max(Math.min(Ot,6),1);var jt={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight"};function Nt(t,e,r){r.push({command:jt.addSource,args:[t,e[t]]})}function qt(t,e,r){e.push({command:jt.removeSource,args:[t]}),r[t]=!0}function $t(t,e,r,n){qt(t,r,n),Nt(t,e,r)}function Zt(e,r,n){var i;for(i in e[n])if(e[n].hasOwnProperty(i)&&"data"!==i&&!t.deepEqual(e[n][i],r[n][i]))return!1;for(i in r[n])if(r[n].hasOwnProperty(i)&&"data"!==i&&!t.deepEqual(e[n][i],r[n][i]))return!1;return!0}function Gt(e,r,n,i,o,a){var s;for(s in r=r||{},e=e||{})e.hasOwnProperty(s)&&(t.deepEqual(e[s],r[s])||n.push({command:a,args:[i,s,r[s],o]}));for(s in r)r.hasOwnProperty(s)&&!e.hasOwnProperty(s)&&(t.deepEqual(e[s],r[s])||n.push({command:a,args:[i,s,r[s],o]}))}function Wt(t){return t.id}function Xt(t,e){return t[e.id]=e,t}var Ht=function(t,e){this.reset(t,e)};Ht.prototype.reset=function(t,e){this.points=t||[],this._distances=[0];for(var r=1;r<this.points.length;r++)this._distances[r]=this._distances[r-1]+this.points[r].dist(this.points[r-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(e||0,.5*this.length),this.paddedLength=this.length-2*this.padding},Ht.prototype.lerp=function(e){if(1===this.points.length)return this.points[0];e=t.clamp(e,0,1);for(var r=1,n=this._distances[r],i=e*this.paddedLength+this.padding;n<i&&r<this._distances.length;)n=this._distances[++r];var o=r-1,a=this._distances[o],s=n-a,u=s>0?(i-a)/s:0;return this.points[o].mult(1-u).add(this.points[r].mult(u))};var Kt=function(t,e,r){var n=this.boxCells=[],i=this.circleCells=[];this.xCellCount=Math.ceil(t/r),this.yCellCount=Math.ceil(e/r);for(var o=0;o<this.xCellCount*this.yCellCount;o++)n.push([]),i.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=e,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/e,this.boxUid=0,this.circleUid=0};function Yt(e,r,n,i,o){var a=t.create();return r?(t.scale(a,a,[1/o,1/o,1]),n||t.rotateZ(a,a,i.angle)):t.multiply(a,i.labelPlaneMatrix,e),a}function Jt(e,r,n,i,o){if(r){var a=t.clone(e);return t.scale(a,a,[o,o,1]),n||t.rotateZ(a,a,-i.angle),a}return i.glCoordMatrix}function Qt(e,r){var n=[e.x,e.y,0,1];ce(n,n,r);var i=n[3];return{point:new t.Point(n[0]/i,n[1]/i),signedDistanceFromCamera:i}}function te(t,e){return.5+t/e*.5}function ee(t,e){var r=t[0]/t[3],n=t[1]/t[3];return r>=-e[0]&&r<=e[0]&&n>=-e[1]&&n<=e[1]}function re(e,r,n,i,o,a,s,u){var l=i?e.textSizeData:e.iconSizeData,c=t.evaluateSizeForZoom(l,n.transform.zoom),p=[256/n.width*2+1,256/n.height*2+1],h=i?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;h.clear();for(var f=e.lineVertexArray,d=i?e.text.placedSymbolArray:e.icon.placedSymbolArray,m=n.transform.width/n.transform.height,y=!1,g=0;g<d.length;g++){var v=d.get(g);if(v.hidden||v.writingMode===t.WritingMode.vertical&&!y)le(v.numGlyphs,h);else{y=!1;var _=[v.anchorX,v.anchorY,0,1];if(t.transformMat4(_,_,r),ee(_,p)){var x=te(n.transform.cameraToCenterDistance,_[3]),b=t.evaluateSizeForFeature(l,c,v),w=s?b/x:b*x,S=new t.Point(v.anchorX,v.anchorY),A=Qt(S,o).point,E={},T=oe(v,w,!1,u,r,o,a,e.glyphOffsetArray,f,h,A,S,E,m);y=T.useVertical,(T.notEnoughRoom||y||T.needsFlipping&&oe(v,w,!0,u,r,o,a,e.glyphOffsetArray,f,h,A,S,E,m).notEnoughRoom)&&le(v.numGlyphs,h)}else le(v.numGlyphs,h)}}i?e.text.dynamicLayoutVertexBuffer.updateData(h):e.icon.dynamicLayoutVertexBuffer.updateData(h)}function ne(t,e,r,n,i,o,a,s,u,l,c){var p=s.glyphStartIndex+s.numGlyphs,h=s.lineStartIndex,f=s.lineStartIndex+s.lineLength,d=e.getoffsetX(s.glyphStartIndex),m=e.getoffsetX(p-1),y=se(t*d,r,n,i,o,a,s.segment,h,f,u,l,c);if(!y)return null;var g=se(t*m,r,n,i,o,a,s.segment,h,f,u,l,c);return g?{first:y,last:g}:null}function ie(e,r,n,i){return e===t.WritingMode.horizontal&&Math.abs(n.y-r.y)>Math.abs(n.x-r.x)*i?{useVertical:!0}:(e===t.WritingMode.vertical?r.y<n.y:r.x>n.x)?{needsFlipping:!0}:null}function oe(e,r,n,i,o,a,s,u,l,c,p,h,f,d){var m,y=r/24,g=e.lineOffsetX*y,v=e.lineOffsetY*y;if(e.numGlyphs>1){var _=e.glyphStartIndex+e.numGlyphs,x=e.lineStartIndex,b=e.lineStartIndex+e.lineLength,w=ne(y,u,g,v,n,p,h,e,l,a,f);if(!w)return{notEnoughRoom:!0};var S=Qt(w.first.point,s).point,A=Qt(w.last.point,s).point;if(i&&!n){var E=ie(e.writingMode,S,A,d);if(E)return E}m=[w.first];for(var T=e.glyphStartIndex+1;T<_-1;T++)m.push(se(y*u.getoffsetX(T),g,v,n,p,h,e.segment,x,b,l,a,f));m.push(w.last)}else{if(i&&!n){var k=Qt(h,o).point,I=e.lineStartIndex+e.segment+1,z=new t.Point(l.getx(I),l.gety(I)),C=Qt(z,o),P=C.signedDistanceFromCamera>0?C.point:ae(h,z,k,1,o),M=ie(e.writingMode,k,P,d);if(M)return M}var D=se(y*u.getoffsetX(e.glyphStartIndex),g,v,n,p,h,e.segment,e.lineStartIndex,e.lineStartIndex+e.lineLength,l,a,f);if(!D)return{notEnoughRoom:!0};m=[D]}for(var L=0,B=m;L<B.length;L+=1){var R=B[L];t.addDynamicAttributes(c,R.point,R.angle)}return{}}function ae(t,e,r,n,i){var o=Qt(t.add(t.sub(e)._unit()),i).point,a=r.sub(o);return r.add(a._mult(n/a.mag()))}function se(e,r,n,i,o,a,s,u,l,c,p,h){var f=i?e-r:e+r,d=f>0?1:-1,m=0;i&&(d*=-1,m=Math.PI),d<0&&(m+=Math.PI);for(var y=d>0?u+s:u+s+1,g=o,v=o,_=0,x=0,b=Math.abs(f),w=[];_+x<=b;){if((y+=d)<u||y>=l)return null;if(v=g,w.push(g),void 0===(g=h[y])){var S=new t.Point(c.getx(y),c.gety(y)),A=Qt(S,p);if(A.signedDistanceFromCamera>0)g=h[y]=A.point;else{var E=y-d;g=ae(0===_?a:new t.Point(c.getx(E),c.gety(E)),S,v,b-_+1,p)}}_+=x,x=v.dist(g)}var T=(b-_)/x,k=g.sub(v),I=k.mult(T)._add(v);I._add(k._unit()._perp()._mult(n*d));var z=m+Math.atan2(g.y-v.y,g.x-v.x);return w.push(I),{point:I,angle:z,path:w}}Kt.prototype.keysLength=function(){return this.boxKeys.length+this.circleKeys.length},Kt.prototype.insert=function(t,e,r,n,i){this._forEachCell(e,r,n,i,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(e),this.bboxes.push(r),this.bboxes.push(n),this.bboxes.push(i)},Kt.prototype.insertCircle=function(t,e,r,n){this._forEachCell(e-n,r-n,e+n,r+n,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(e),this.circles.push(r),this.circles.push(n)},Kt.prototype._insertBoxCell=function(t,e,r,n,i,o){this.boxCells[i].push(o)},Kt.prototype._insertCircleCell=function(t,e,r,n,i,o){this.circleCells[i].push(o)},Kt.prototype._query=function(t,e,r,n,i,o){if(r<0||t>this.width||n<0||e>this.height)return!i&&[];var a=[];if(t<=0&&e<=0&&this.width<=r&&this.height<=n){if(i)return!0;for(var s=0;s<this.boxKeys.length;s++)a.push({key:this.boxKeys[s],x1:this.bboxes[4*s],y1:this.bboxes[4*s+1],x2:this.bboxes[4*s+2],y2:this.bboxes[4*s+3]});for(var u=0;u<this.circleKeys.length;u++){var l=this.circles[3*u],c=this.circles[3*u+1],p=this.circles[3*u+2];a.push({key:this.circleKeys[u],x1:l-p,y1:c-p,x2:l+p,y2:c+p})}return o?a.filter(o):a}return this._forEachCell(t,e,r,n,this._queryCell,a,{hitTest:i,seenUids:{box:{},circle:{}}},o),i?a.length>0:a},Kt.prototype._queryCircle=function(t,e,r,n,i){var o=t-r,a=t+r,s=e-r,u=e+r;if(a<0||o>this.width||u<0||s>this.height)return!n&&[];var l=[];return this._forEachCell(o,s,a,u,this._queryCellCircle,l,{hitTest:n,circle:{x:t,y:e,radius:r},seenUids:{box:{},circle:{}}},i),n?l.length>0:l},Kt.prototype.query=function(t,e,r,n,i){return this._query(t,e,r,n,!1,i)},Kt.prototype.hitTest=function(t,e,r,n,i){return this._query(t,e,r,n,!0,i)},Kt.prototype.hitTestCircle=function(t,e,r,n){return this._queryCircle(t,e,r,!0,n)},Kt.prototype._queryCell=function(t,e,r,n,i,o,a,s){var u=a.seenUids,l=this.boxCells[i];if(null!==l)for(var c=this.bboxes,p=0,h=l;p<h.length;p+=1){var f=h[p];if(!u.box[f]){u.box[f]=!0;var d=4*f;if(t<=c[d+2]&&e<=c[d+3]&&r>=c[d+0]&&n>=c[d+1]&&(!s||s(this.boxKeys[f]))){if(a.hitTest)return o.push(!0),!0;o.push({key:this.boxKeys[f],x1:c[d],y1:c[d+1],x2:c[d+2],y2:c[d+3]})}}}var m=this.circleCells[i];if(null!==m)for(var y=this.circles,g=0,v=m;g<v.length;g+=1){var _=v[g];if(!u.circle[_]){u.circle[_]=!0;var x=3*_;if(this._circleAndRectCollide(y[x],y[x+1],y[x+2],t,e,r,n)&&(!s||s(this.circleKeys[_]))){if(a.hitTest)return o.push(!0),!0;var b=y[x],w=y[x+1],S=y[x+2];o.push({key:this.circleKeys[_],x1:b-S,y1:w-S,x2:b+S,y2:w+S})}}}},Kt.prototype._queryCellCircle=function(t,e,r,n,i,o,a,s){var u=a.circle,l=a.seenUids,c=this.boxCells[i];if(null!==c)for(var p=this.bboxes,h=0,f=c;h<f.length;h+=1){var d=f[h];if(!l.box[d]){l.box[d]=!0;var m=4*d;if(this._circleAndRectCollide(u.x,u.y,u.radius,p[m+0],p[m+1],p[m+2],p[m+3])&&(!s||s(this.boxKeys[d])))return o.push(!0),!0}}var y=this.circleCells[i];if(null!==y)for(var g=this.circles,v=0,_=y;v<_.length;v+=1){var x=_[v];if(!l.circle[x]){l.circle[x]=!0;var b=3*x;if(this._circlesCollide(g[b],g[b+1],g[b+2],u.x,u.y,u.radius)&&(!s||s(this.circleKeys[x])))return o.push(!0),!0}}},Kt.prototype._forEachCell=function(t,e,r,n,i,o,a,s){for(var u=this._convertToXCellCoord(t),l=this._convertToYCellCoord(e),c=this._convertToXCellCoord(r),p=this._convertToYCellCoord(n),h=u;h<=c;h++)for(var f=l;f<=p;f++)if(i.call(this,t,e,r,n,this.xCellCount*f+h,o,a,s))return},Kt.prototype._convertToXCellCoord=function(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))},Kt.prototype._convertToYCellCoord=function(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))},Kt.prototype._circlesCollide=function(t,e,r,n,i,o){var a=n-t,s=i-e,u=r+o;return u*u>a*a+s*s},Kt.prototype._circleAndRectCollide=function(t,e,r,n,i,o,a){var s=(o-n)/2,u=Math.abs(t-(n+s));if(u>s+r)return!1;var l=(a-i)/2,c=Math.abs(e-(i+l));if(c>l+r)return!1;if(u<=s||c<=l)return!0;var p=u-s,h=c-l;return p*p+h*h<=r*r};var ue=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function le(t,e){for(var r=0;r<t;r++){var n=e.length;e.resize(n+4),e.float32.set(ue,3*n)}}function ce(t,e,r){var n=e[0],i=e[1];return t[0]=r[0]*n+r[4]*i+r[12],t[1]=r[1]*n+r[5]*i+r[13],t[3]=r[3]*n+r[7]*i+r[15],t}var pe=function(t,e,r){void 0===e&&(e=new Kt(t.width+200,t.height+200,25)),void 0===r&&(r=new Kt(t.width+200,t.height+200,25)),this.transform=t,this.grid=e,this.ignoredGrid=r,this.pitchfactor=Math.cos(t._pitch)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+100,this.screenBottomBoundary=t.height+100,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200};function he(e,r,n){return r*(t.EXTENT/(e.tileSize*Math.pow(2,n-e.tileID.overscaledZ)))}pe.prototype.placeCollisionBox=function(t,e,r,n,i){var o=this.projectAndGetPerspectiveRatio(n,t.anchorPointX,t.anchorPointY),a=r*o.perspectiveRatio,s=t.x1*a+o.point.x,u=t.y1*a+o.point.y,l=t.x2*a+o.point.x,c=t.y2*a+o.point.y;return!this.isInsideGrid(s,u,l,c)||!e&&this.grid.hitTest(s,u,l,c,i)?{box:[],offscreen:!1}:{box:[s,u,l,c],offscreen:this.isOffscreen(s,u,l,c)}},pe.prototype.placeCollisionCircles=function(e,r,n,i,o,a,s,u,l,c,p,h,f){var d=[],m=new t.Point(r.anchorX,r.anchorY),y=Qt(m,a),g=te(this.transform.cameraToCenterDistance,y.signedDistanceFromCamera),v=(c?o/g:o*g)/t.ONE_EM,_=Qt(m,s).point,x=ne(v,i,r.lineOffsetX*v,r.lineOffsetY*v,!1,_,m,r,n,s,{}),b=!1,w=!1,S=!0;if(x){for(var A=.5*h*g+f,E=new t.Point(-100,-100),T=new t.Point(this.screenRightBoundary,this.screenBottomBoundary),k=new Ht,I=x.first,z=x.last,C=[],P=I.path.length-1;P>=1;P--)C.push(I.path[P]);for(var M=1;M<z.path.length;M++)C.push(z.path[M]);var D=2.5*A;if(u){var L=C.map((function(t){return Qt(t,u)}));C=L.some((function(t){return t.signedDistanceFromCamera<=0}))?[]:L.map((function(t){return t.point}))}var B=[];if(C.length>0){for(var R=C[0].clone(),O=C[0].clone(),F=1;F<C.length;F++)R.x=Math.min(R.x,C[F].x),R.y=Math.min(R.y,C[F].y),O.x=Math.max(O.x,C[F].x),O.y=Math.max(O.y,C[F].y);B=R.x>=E.x&&O.x<=T.x&&R.y>=E.y&&O.y<=T.y?[C]:O.x<E.x||R.x>T.x||O.y<E.y||R.y>T.y?[]:t.clipLine([C],E.x,E.y,T.x,T.y)}for(var V=0,U=B;V<U.length;V+=1){var j;k.reset(U[V],.25*A),j=k.length<=.5*A?1:Math.ceil(k.paddedLength/D)+1;for(var N=0;N<j;N++){var q=N/Math.max(j-1,1),$=k.lerp(q),Z=$.x+100,G=$.y+100;d.push(Z,G,A,0);var W=Z-A,X=G-A,H=Z+A,K=G+A;if(S=S&&this.isOffscreen(W,X,H,K),w=w||this.isInsideGrid(W,X,H,K),!e&&this.grid.hitTestCircle(Z,G,A,p)&&(b=!0,!l))return{circles:[],offscreen:!1,collisionDetected:b}}}}return{circles:!l&&b||!w?[]:d,offscreen:S,collisionDetected:b}},pe.prototype.queryRenderedSymbols=function(e){if(0===e.length||0===this.grid.keysLength()&&0===this.ignoredGrid.keysLength())return{};for(var r=[],n=1/0,i=1/0,o=-1/0,a=-1/0,s=0,u=e;s<u.length;s+=1){var l=u[s],c=new t.Point(l.x+100,l.y+100);n=Math.min(n,c.x),i=Math.min(i,c.y),o=Math.max(o,c.x),a=Math.max(a,c.y),r.push(c)}for(var p={},h={},f=0,d=this.grid.query(n,i,o,a).concat(this.ignoredGrid.query(n,i,o,a));f<d.length;f+=1){var m=d[f],y=m.key;if(void 0===p[y.bucketInstanceId]&&(p[y.bucketInstanceId]={}),!p[y.bucketInstanceId][y.featureIndex]){var g=[new t.Point(m.x1,m.y1),new t.Point(m.x2,m.y1),new t.Point(m.x2,m.y2),new t.Point(m.x1,m.y2)];t.polygonIntersectsPolygon(r,g)&&(p[y.bucketInstanceId][y.featureIndex]=!0,void 0===h[y.bucketInstanceId]&&(h[y.bucketInstanceId]=[]),h[y.bucketInstanceId].push(y.featureIndex))}}return h},pe.prototype.insertCollisionBox=function(t,e,r,n,i){(e?this.ignoredGrid:this.grid).insert({bucketInstanceId:r,featureIndex:n,collisionGroupID:i},t[0],t[1],t[2],t[3])},pe.prototype.insertCollisionCircles=function(t,e,r,n,i){for(var o=e?this.ignoredGrid:this.grid,a={bucketInstanceId:r,featureIndex:n,collisionGroupID:i},s=0;s<t.length;s+=4)o.insertCircle(a,t[s],t[s+1],t[s+2])},pe.prototype.projectAndGetPerspectiveRatio=function(e,r,n){var i=[r,n,0,1];return ce(i,i,e),{point:new t.Point((i[0]/i[3]+1)/2*this.transform.width+100,(-i[1]/i[3]+1)/2*this.transform.height+100),perspectiveRatio:.5+this.transform.cameraToCenterDistance/i[3]*.5}},pe.prototype.isOffscreen=function(t,e,r,n){return r<100||t>=this.screenRightBoundary||n<100||e>this.screenBottomBoundary},pe.prototype.isInsideGrid=function(t,e,r,n){return r>=0&&t<this.gridRightBoundary&&n>=0&&e<this.gridBottomBoundary},pe.prototype.getViewportMatrix=function(){var e=t.identity([]);return t.translate(e,e,[-100,-100,0]),e};var fe=function(t,e,r,n){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?e:-e))):n&&r?1:0,this.placed=r};fe.prototype.isHidden=function(){return 0===this.opacity&&!this.placed};var de=function(t,e,r,n,i){this.text=new fe(t?t.text:null,e,r,i),this.icon=new fe(t?t.icon:null,e,n,i)};de.prototype.isHidden=function(){return this.text.isHidden()&&this.icon.isHidden()};var me=function(t,e,r){this.text=t,this.icon=e,this.skipFade=r},ye=function(){this.invProjMatrix=t.create(),this.viewportMatrix=t.create(),this.circles=[]},ge=function(t,e,r,n,i){this.bucketInstanceId=t,this.featureIndex=e,this.sourceLayerIndex=r,this.bucketIndex=n,this.tileID=i},ve=function(t){this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}};function _e(e,r,n,i,o){var a=t.getAnchorAlignment(e),s=-(a.horizontalAlign-.5)*r,u=-(a.verticalAlign-.5)*n,l=t.evaluateVariableOffset(e,i);return new t.Point(s+l[0]*o,u+l[1]*o)}function xe(e,r,n,i,o,a){var s=e.x1,u=e.x2,l=e.y1,c=e.y2,p=e.anchorPointX,h=e.anchorPointY,f=new t.Point(r,n);return i&&f._rotate(o?a:-a),{x1:s+f.x,y1:l+f.y,x2:u+f.x,y2:c+f.y,anchorPointX:p,anchorPointY:h}}ve.prototype.get=function(t){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[t]){var e=++this.maxGroupID;this.collisionGroups[t]={ID:e,predicate:function(t){return t.collisionGroupID===e}}}return this.collisionGroups[t]};var be=function(t,e,r,n){this.transform=t.clone(),this.collisionIndex=new pe(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=e,this.retainedQueryData={},this.collisionGroups=new ve(r),this.collisionCircleArrays={},this.prevPlacement=n,n&&(n.prevPlacement=void 0),this.placedOrientations={}};function we(t,e,r,n,i){t.emplaceBack(e?1:0,r?1:0,n||0,i||0),t.emplaceBack(e?1:0,r?1:0,n||0,i||0),t.emplaceBack(e?1:0,r?1:0,n||0,i||0),t.emplaceBack(e?1:0,r?1:0,n||0,i||0)}be.prototype.getBucketParts=function(e,r,n,i){var o=n.getBucket(r),a=n.latestFeatureIndex;if(o&&a&&r.id===o.layerIds[0]){var s=n.collisionBoxArray,u=o.layers[0].layout,l=Math.pow(2,this.transform.zoom-n.tileID.overscaledZ),c=n.tileSize/t.EXTENT,p=this.transform.calculatePosMatrix(n.tileID.toUnwrapped()),h="map"===u.get("text-pitch-alignment"),f="map"===u.get("text-rotation-alignment"),d=he(n,1,this.transform.zoom),m=Yt(p,h,f,this.transform,d),y=null;if(h){var g=Jt(p,h,f,this.transform,d);y=t.multiply([],this.transform.labelPlaneMatrix,g)}this.retainedQueryData[o.bucketInstanceId]=new ge(o.bucketInstanceId,a,o.sourceLayerIndex,o.index,n.tileID);var v={bucket:o,layout:u,posMatrix:p,textLabelPlaneMatrix:m,labelToScreenMatrix:y,scale:l,textPixelRatio:c,holdingForFade:n.holdingForFade(),collisionBoxArray:s,partiallyEvaluatedTextSize:t.evaluateSizeForZoom(o.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(o.sourceID)};if(i)for(var _=0,x=o.sortKeyRanges;_<x.length;_+=1){var b=x[_];e.push({sortKey:b.sortKey,symbolInstanceStart:b.symbolInstanceStart,symbolInstanceEnd:b.symbolInstanceEnd,parameters:v})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:o.symbolInstances.length,parameters:v})}},be.prototype.attemptAnchorPlacement=function(t,e,r,n,i,o,a,s,u,l,c,p,h,f,d){var m,y=[p.textOffset0,p.textOffset1],g=_e(t,r,n,y,i),v=this.collisionIndex.placeCollisionBox(xe(e,g.x,g.y,o,a,this.transform.angle),c,s,u,l.predicate);if(!d||0!==this.collisionIndex.placeCollisionBox(xe(d,g.x,g.y,o,a,this.transform.angle),c,s,u,l.predicate).box.length)return v.box.length>0?(this.prevPlacement&&this.prevPlacement.variableOffsets[p.crossTileID]&&this.prevPlacement.placements[p.crossTileID]&&this.prevPlacement.placements[p.crossTileID].text&&(m=this.prevPlacement.variableOffsets[p.crossTileID].anchor),this.variableOffsets[p.crossTileID]={textOffset:y,width:r,height:n,anchor:t,textBoxScale:i,prevAnchor:m},this.markUsedJustification(h,t,p,f),h.allowVerticalPlacement&&(this.markUsedOrientation(h,f,p),this.placedOrientations[p.crossTileID]=f),{shift:g,placedGlyphBoxes:v}):void 0},be.prototype.placeLayerBucketPart=function(e,r,n){var i=this,o=e.parameters,a=o.bucket,s=o.layout,u=o.posMatrix,l=o.textLabelPlaneMatrix,c=o.labelToScreenMatrix,p=o.textPixelRatio,h=o.holdingForFade,f=o.collisionBoxArray,d=o.partiallyEvaluatedTextSize,m=o.collisionGroup,y=s.get("text-optional"),g=s.get("icon-optional"),v=s.get("text-allow-overlap"),_=s.get("icon-allow-overlap"),x="map"===s.get("text-rotation-alignment"),b="map"===s.get("text-pitch-alignment"),w="none"!==s.get("icon-text-fit"),S="viewport-y"===s.get("symbol-z-order"),A=v&&(_||!a.hasIconData()||g),E=_&&(v||!a.hasTextData()||y);!a.collisionArrays&&f&&a.deserializeCollisionBoxes(f);var T=function(e,o){if(!r[e.crossTileID])if(h)i.placements[e.crossTileID]=new me(!1,!1,!1);else{var f,S=!1,T=!1,k=!0,I=null,z={box:null,offscreen:null},C={box:null,offscreen:null},P=null,M=null,D=0,L=0,B=0;o.textFeatureIndex?D=o.textFeatureIndex:e.useRuntimeCollisionCircles&&(D=e.featureIndex),o.verticalTextFeatureIndex&&(L=o.verticalTextFeatureIndex);var R=o.textBox;if(R){var O=function(r){var n=t.WritingMode.horizontal;if(a.allowVerticalPlacement&&!r&&i.prevPlacement){var o=i.prevPlacement.placedOrientations[e.crossTileID];o&&(i.placedOrientations[e.crossTileID]=o,i.markUsedOrientation(a,n=o,e))}return n},F=function(r,n){if(a.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&o.verticalTextBox)for(var i=0,s=a.writingModes;i<s.length&&(s[i]===t.WritingMode.vertical?(z=n(),C=z):z=r(),!(z&&z.box&&z.box.length));i+=1);else z=r()};if(s.get("text-variable-anchor")){var V=s.get("text-variable-anchor");if(i.prevPlacement&&i.prevPlacement.variableOffsets[e.crossTileID]){var U=i.prevPlacement.variableOffsets[e.crossTileID];V.indexOf(U.anchor)>0&&(V=V.filter((function(t){return t!==U.anchor}))).unshift(U.anchor)}var j=function(t,r,n){for(var o=t.x2-t.x1,s=t.y2-t.y1,l=e.textBoxScale,c=w&&!_?r:null,h={box:[],offscreen:!1},f=v?2*V.length:V.length,d=0;d<f;++d){var y=i.attemptAnchorPlacement(V[d%V.length],t,o,s,l,x,b,p,u,m,d>=V.length,e,a,n,c);if(y&&(h=y.placedGlyphBoxes)&&h.box&&h.box.length){S=!0,I=y.shift;break}}return h};F((function(){return j(R,o.iconBox,t.WritingMode.horizontal)}),(function(){var r=o.verticalTextBox;return a.allowVerticalPlacement&&!(z&&z.box&&z.box.length)&&e.numVerticalGlyphVertices>0&&r?j(r,o.verticalIconBox,t.WritingMode.vertical):{box:null,offscreen:null}})),z&&(S=z.box,k=z.offscreen);var N=O(z&&z.box);if(!S&&i.prevPlacement){var q=i.prevPlacement.variableOffsets[e.crossTileID];q&&(i.variableOffsets[e.crossTileID]=q,i.markUsedJustification(a,q.anchor,e,N))}}else{var $=function(t,r){var n=i.collisionIndex.placeCollisionBox(t,v,p,u,m.predicate);return n&&n.box&&n.box.length&&(i.markUsedOrientation(a,r,e),i.placedOrientations[e.crossTileID]=r),n};F((function(){return $(R,t.WritingMode.horizontal)}),(function(){var r=o.verticalTextBox;return a.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&r?$(r,t.WritingMode.vertical):{box:null,offscreen:null}})),O(z&&z.box&&z.box.length)}}if(S=(f=z)&&f.box&&f.box.length>0,k=f&&f.offscreen,e.useRuntimeCollisionCircles){var Z=a.text.placedSymbolArray.get(e.centerJustifiedTextSymbolIndex),G=t.evaluateSizeForFeature(a.textSizeData,d,Z),W=s.get("text-padding");P=i.collisionIndex.placeCollisionCircles(v,Z,a.lineVertexArray,a.glyphOffsetArray,G,u,l,c,n,b,m.predicate,e.collisionCircleDiameter,W),S=v||P.circles.length>0&&!P.collisionDetected,k=k&&P.offscreen}if(o.iconFeatureIndex&&(B=o.iconFeatureIndex),o.iconBox){var X=function(t){var e=w&&I?xe(t,I.x,I.y,x,b,i.transform.angle):t;return i.collisionIndex.placeCollisionBox(e,_,p,u,m.predicate)};T=C&&C.box&&C.box.length&&o.verticalIconBox?(M=X(o.verticalIconBox)).box.length>0:(M=X(o.iconBox)).box.length>0,k=k&&M.offscreen}var H=y||0===e.numHorizontalGlyphVertices&&0===e.numVerticalGlyphVertices,K=g||0===e.numIconVertices;if(H||K?K?H||(T=T&&S):S=T&&S:T=S=T&&S,S&&f&&f.box&&i.collisionIndex.insertCollisionBox(f.box,s.get("text-ignore-placement"),a.bucketInstanceId,C&&C.box&&L?L:D,m.ID),T&&M&&i.collisionIndex.insertCollisionBox(M.box,s.get("icon-ignore-placement"),a.bucketInstanceId,B,m.ID),P&&(S&&i.collisionIndex.insertCollisionCircles(P.circles,s.get("text-ignore-placement"),a.bucketInstanceId,D,m.ID),n)){var Y=a.bucketInstanceId,J=i.collisionCircleArrays[Y];void 0===J&&(J=i.collisionCircleArrays[Y]=new ye);for(var Q=0;Q<P.circles.length;Q+=4)J.circles.push(P.circles[Q+0]),J.circles.push(P.circles[Q+1]),J.circles.push(P.circles[Q+2]),J.circles.push(P.collisionDetected?1:0)}i.placements[e.crossTileID]=new me(S||A,T||E,k||a.justReloaded),r[e.crossTileID]=!0}};if(S)for(var k=a.getSortedSymbolIndexes(this.transform.angle),I=k.length-1;I>=0;--I){var z=k[I];T(a.symbolInstances.get(z),a.collisionArrays[z])}else for(var C=e.symbolInstanceStart;C<e.symbolInstanceEnd;C++)T(a.symbolInstances.get(C),a.collisionArrays[C]);if(n&&a.bucketInstanceId in this.collisionCircleArrays){var P=this.collisionCircleArrays[a.bucketInstanceId];t.invert(P.invProjMatrix,u),P.viewportMatrix=this.collisionIndex.getViewportMatrix()}a.justReloaded=!1},be.prototype.markUsedJustification=function(e,r,n,i){var o;o=i===t.WritingMode.vertical?n.verticalPlacedTextSymbolIndex:{left:n.leftJustifiedTextSymbolIndex,center:n.centerJustifiedTextSymbolIndex,right:n.rightJustifiedTextSymbolIndex}[t.getAnchorJustification(r)];for(var a=0,s=[n.leftJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.rightJustifiedTextSymbolIndex,n.verticalPlacedTextSymbolIndex];a<s.length;a+=1){var u=s[a];u>=0&&(e.text.placedSymbolArray.get(u).crossTileID=o>=0&&u!==o?0:n.crossTileID)}},be.prototype.markUsedOrientation=function(e,r,n){for(var i=r===t.WritingMode.horizontal||r===t.WritingMode.horizontalOnly?r:0,o=r===t.WritingMode.vertical?r:0,a=0,s=[n.leftJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.rightJustifiedTextSymbolIndex];a<s.length;a+=1)e.text.placedSymbolArray.get(s[a]).placedOrientation=i;n.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(n.verticalPlacedTextSymbolIndex).placedOrientation=o)},be.prototype.commit=function(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;var e=this.prevPlacement,r=!1;this.prevZoomAdjustment=e?e.zoomAdjustment(this.transform.zoom):0;var n=e?e.symbolFadeChange(t):1,i=e?e.opacities:{},o=e?e.variableOffsets:{},a=e?e.placedOrientations:{};for(var s in this.placements){var u=this.placements[s],l=i[s];l?(this.opacities[s]=new de(l,n,u.text,u.icon),r=r||u.text!==l.text.placed||u.icon!==l.icon.placed):(this.opacities[s]=new de(null,n,u.text,u.icon,u.skipFade),r=r||u.text||u.icon)}for(var c in i){var p=i[c];if(!this.opacities[c]){var h=new de(p,n,!1,!1);h.isHidden()||(this.opacities[c]=h,r=r||p.text.placed||p.icon.placed)}}for(var f in o)this.variableOffsets[f]||!this.opacities[f]||this.opacities[f].isHidden()||(this.variableOffsets[f]=o[f]);for(var d in a)this.placedOrientations[d]||!this.opacities[d]||this.opacities[d].isHidden()||(this.placedOrientations[d]=a[d]);r?this.lastPlacementChangeTime=t:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=e?e.lastPlacementChangeTime:t)},be.prototype.updateLayerOpacities=function(t,e){for(var r={},n=0,i=e;n<i.length;n+=1){var o=i[n],a=o.getBucket(t);a&&o.latestFeatureIndex&&t.id===a.layerIds[0]&&this.updateBucketOpacities(a,r,o.collisionBoxArray)}},be.prototype.updateBucketOpacities=function(e,r,n){var i=this;e.hasTextData()&&e.text.opacityVertexArray.clear(),e.hasIconData()&&e.icon.opacityVertexArray.clear(),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();var o=e.layers[0].layout,a=new de(null,0,!1,!1,!0),s=o.get("text-allow-overlap"),u=o.get("icon-allow-overlap"),l=o.get("text-variable-anchor"),c="map"===o.get("text-rotation-alignment"),p="map"===o.get("text-pitch-alignment"),h="none"!==o.get("icon-text-fit"),f=new de(null,0,s&&(u||!e.hasIconData()||o.get("icon-optional")),u&&(s||!e.hasTextData()||o.get("text-optional")),!0);!e.collisionArrays&&n&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(n);for(var d=function(t,e,r){for(var n=0;n<e/4;n++)t.opacityVertexArray.emplaceBack(r)},m=function(n){var o=e.symbolInstances.get(n),s=o.numHorizontalGlyphVertices,u=o.numVerticalGlyphVertices,m=o.crossTileID,y=i.opacities[m];r[m]?y=a:y||(i.opacities[m]=y=f),r[m]=!0;var g=o.numIconVertices>0,v=i.placedOrientations[o.crossTileID],_=v===t.WritingMode.vertical,x=v===t.WritingMode.horizontal||v===t.WritingMode.horizontalOnly;if(s>0||u>0){var b=Ce(y.text);d(e.text,s,_?Pe:b),d(e.text,u,x?Pe:b);var w=y.text.isHidden();[o.rightJustifiedTextSymbolIndex,o.centerJustifiedTextSymbolIndex,o.leftJustifiedTextSymbolIndex].forEach((function(t){t>=0&&(e.text.placedSymbolArray.get(t).hidden=w||_?1:0)})),o.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(o.verticalPlacedTextSymbolIndex).hidden=w||x?1:0);var S=i.variableOffsets[o.crossTileID];S&&i.markUsedJustification(e,S.anchor,o,v);var A=i.placedOrientations[o.crossTileID];A&&(i.markUsedJustification(e,"left",o,A),i.markUsedOrientation(e,A,o))}if(g){var E=Ce(y.icon),T=!(h&&o.verticalPlacedIconSymbolIndex&&_);o.placedIconSymbolIndex>=0&&(d(e.icon,o.numIconVertices,T?E:Pe),e.icon.placedSymbolArray.get(o.placedIconSymbolIndex).hidden=y.icon.isHidden()),o.verticalPlacedIconSymbolIndex>=0&&(d(e.icon,o.numVerticalIconVertices,T?Pe:E),e.icon.placedSymbolArray.get(o.verticalPlacedIconSymbolIndex).hidden=y.icon.isHidden())}if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){var k=e.collisionArrays[n];if(k){var I=new t.Point(0,0);if(k.textBox||k.verticalTextBox){var z=!0;if(l){var C=i.variableOffsets[m];C?(I=_e(C.anchor,C.width,C.height,C.textOffset,C.textBoxScale),c&&I._rotate(p?i.transform.angle:-i.transform.angle)):z=!1}k.textBox&&we(e.textCollisionBox.collisionVertexArray,y.text.placed,!z||_,I.x,I.y),k.verticalTextBox&&we(e.textCollisionBox.collisionVertexArray,y.text.placed,!z||x,I.x,I.y)}var P=Boolean(!x&&k.verticalIconBox);k.iconBox&&we(e.iconCollisionBox.collisionVertexArray,y.icon.placed,P,h?I.x:0,h?I.y:0),k.verticalIconBox&&we(e.iconCollisionBox.collisionVertexArray,y.icon.placed,!P,h?I.x:0,h?I.y:0)}}},y=0;y<e.symbolInstances.length;y++)m(y);if(e.sortFeatures(this.transform.angle),this.retainedQueryData[e.bucketInstanceId]&&(this.retainedQueryData[e.bucketInstanceId].featureSortOrder=e.featureSortOrder),e.hasTextData()&&e.text.opacityVertexBuffer&&e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray),e.hasIconData()&&e.icon.opacityVertexBuffer&&e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexBuffer&&e.iconCollisionBox.collisionVertexBuffer.updateData(e.iconCollisionBox.collisionVertexArray),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexBuffer&&e.textCollisionBox.collisionVertexBuffer.updateData(e.textCollisionBox.collisionVertexArray),e.bucketInstanceId in this.collisionCircleArrays){var g=this.collisionCircleArrays[e.bucketInstanceId];e.placementInvProjMatrix=g.invProjMatrix,e.placementViewportMatrix=g.viewportMatrix,e.collisionCircleArray=g.circles,delete this.collisionCircleArrays[e.bucketInstanceId]}},be.prototype.symbolFadeChange=function(t){return 0===this.fadeDuration?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment},be.prototype.zoomAdjustment=function(t){return Math.max(0,(this.transform.zoom-t)/1.5)},be.prototype.hasTransitions=function(t){return this.stale||t-this.lastPlacementChangeTime<this.fadeDuration},be.prototype.stillRecent=function(t,e){var r=this.zoomAtLastRecencyCheck===e?1-this.zoomAdjustment(e):1;return this.zoomAtLastRecencyCheck=e,this.commitTime+this.fadeDuration*r>t},be.prototype.setStale=function(){this.stale=!0};var Se=Math.pow(2,25),Ae=Math.pow(2,24),Ee=Math.pow(2,17),Te=Math.pow(2,16),ke=Math.pow(2,9),Ie=Math.pow(2,8),ze=Math.pow(2,1);function Ce(t){if(0===t.opacity&&!t.placed)return 0;if(1===t.opacity&&t.placed)return 4294967295;var e=t.placed?1:0,r=Math.floor(127*t.opacity);return r*Se+e*Ae+r*Ee+e*Te+r*ke+e*Ie+r*ze+e}var Pe=0,Me=function(t){this._sortAcrossTiles="viewport-y"!==t.layout.get("symbol-z-order")&&void 0!==t.layout.get("symbol-sort-key").constantOr(1),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]};Me.prototype.continuePlacement=function(t,e,r,n,i){for(var o=this._bucketParts;this._currentTileIndex<t.length;)if(e.getBucketParts(o,n,t[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,i())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,o.sort((function(t,e){return t.sortKey-e.sortKey})));this._currentPartIndex<o.length;)if(e.placeLayerBucketPart(o[this._currentPartIndex],this._seenCrossTileIDs,r),this._currentPartIndex++,i())return!0;return!1};var De=function(t,e,r,n,i,o,a){this.placement=new be(t,i,o,a),this._currentPlacementIndex=e.length-1,this._forceFullPlacement=r,this._showCollisionBoxes=n,this._done=!1};De.prototype.isDone=function(){return this._done},De.prototype.continuePlacement=function(e,r,n){for(var i=this,o=t.browser.now(),a=function(){var e=t.browser.now()-o;return!i._forceFullPlacement&&e>2};this._currentPlacementIndex>=0;){var s=r[e[this._currentPlacementIndex]],u=this.placement.collisionIndex.transform.zoom;if("symbol"===s.type&&(!s.minzoom||s.minzoom<=u)&&(!s.maxzoom||s.maxzoom>u)){if(this._inProgressLayer||(this._inProgressLayer=new Me(s)),this._inProgressLayer.continuePlacement(n[s.source],this.placement,this._showCollisionBoxes,s,a))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0},De.prototype.commit=function(t){return this.placement.commit(t),this.placement};var Le=512/t.EXTENT/2,Be=function(t,e,r){this.tileID=t,this.indexedSymbolInstances={},this.bucketInstanceId=r;for(var n=0;n<e.length;n++){var i=e.get(n),o=i.key;this.indexedSymbolInstances[o]||(this.indexedSymbolInstances[o]=[]),this.indexedSymbolInstances[o].push({crossTileID:i.crossTileID,coord:this.getScaledCoordinates(i,t)})}};Be.prototype.getScaledCoordinates=function(e,r){var n=Le/Math.pow(2,r.canonical.z-this.tileID.canonical.z);return{x:Math.floor((r.canonical.x*t.EXTENT+e.anchorX)*n),y:Math.floor((r.canonical.y*t.EXTENT+e.anchorY)*n)}},Be.prototype.findMatches=function(t,e,r){for(var n=this.tileID.canonical.z<e.canonical.z?1:Math.pow(2,this.tileID.canonical.z-e.canonical.z),i=0;i<t.length;i++){var o=t.get(i);if(!o.crossTileID){var a=this.indexedSymbolInstances[o.key];if(a)for(var s=this.getScaledCoordinates(o,e),u=0,l=a;u<l.length;u+=1){var c=l[u];if(Math.abs(c.coord.x-s.x)<=n&&Math.abs(c.coord.y-s.y)<=n&&!r[c.crossTileID]){r[c.crossTileID]=!0,o.crossTileID=c.crossTileID;break}}}}};var Re=function(){this.maxCrossTileID=0};Re.prototype.generate=function(){return++this.maxCrossTileID};var Oe=function(){this.indexes={},this.usedCrossTileIDs={},this.lng=0};Oe.prototype.handleWrapJump=function(t){var e=Math.round((t-this.lng)/360);if(0!==e)for(var r in this.indexes){var n=this.indexes[r],i={};for(var o in n){var a=n[o];a.tileID=a.tileID.unwrapTo(a.tileID.wrap+e),i[a.tileID.key]=a}this.indexes[r]=i}this.lng=t},Oe.prototype.addBucket=function(t,e,r){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===e.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(var n=0;n<e.symbolInstances.length;n++)e.symbolInstances.get(n).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||(this.usedCrossTileIDs[t.overscaledZ]={});var i=this.usedCrossTileIDs[t.overscaledZ];for(var o in this.indexes){var a=this.indexes[o];if(Number(o)>t.overscaledZ)for(var s in a){var u=a[s];u.tileID.isChildOf(t)&&u.findMatches(e.symbolInstances,t,i)}else{var l=a[t.scaledTo(Number(o)).key];l&&l.findMatches(e.symbolInstances,t,i)}}for(var c=0;c<e.symbolInstances.length;c++){var p=e.symbolInstances.get(c);p.crossTileID||(p.crossTileID=r.generate(),i[p.crossTileID]=!0)}return void 0===this.indexes[t.overscaledZ]&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new Be(t,e.symbolInstances,e.bucketInstanceId),!0},Oe.prototype.removeBucketCrossTileIDs=function(t,e){for(var r in e.indexedSymbolInstances)for(var n=0,i=e.indexedSymbolInstances[r];n<i.length;n+=1)delete this.usedCrossTileIDs[t][i[n].crossTileID]},Oe.prototype.removeStaleBuckets=function(t){var e=!1;for(var r in this.indexes){var n=this.indexes[r];for(var i in n)t[n[i].bucketInstanceId]||(this.removeBucketCrossTileIDs(r,n[i]),delete n[i],e=!0)}return e};var Fe=function(){this.layerIndexes={},this.crossTileIDs=new Re,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}};Fe.prototype.addLayer=function(t,e,r){var n=this.layerIndexes[t.id];void 0===n&&(n=this.layerIndexes[t.id]=new Oe);var i=!1,o={};n.handleWrapJump(r);for(var a=0,s=e;a<s.length;a+=1){var u=s[a],l=u.getBucket(t);l&&t.id===l.layerIds[0]&&(l.bucketInstanceId||(l.bucketInstanceId=++this.maxBucketInstanceId),n.addBucket(u.tileID,l,this.crossTileIDs)&&(i=!0),o[l.bucketInstanceId]=!0)}return n.removeStaleBuckets(o)&&(i=!0),i},Fe.prototype.pruneUnusedLayers=function(t){var e={};for(var r in t.forEach((function(t){e[t]=!0})),this.layerIndexes)e[r]||delete this.layerIndexes[r]};var Ve=function(e,r){return t.emitValidationErrors(e,r&&r.filter((function(t){return"source.canvas"!==t.identifier})))},Ue=t.pick(jt,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData"]),je=t.pick(jt,["setCenter","setZoom","setBearing","setPitch"]),Ne=function(){var e={},r=t.styleSpec.$version;for(var n in t.styleSpec.$root){var i,o=t.styleSpec.$root[n];o.required&&null!=(i="version"===n?r:"array"===o.type?[]:{})&&(e[n]=i)}return e}(),qe=function(e){function r(n,i){var o=this;void 0===i&&(i={}),e.call(this),this.map=n,this.dispatcher=new A(Ft(),this),this.imageManager=new h,this.imageManager.setEventedParent(this),this.glyphManager=new _(n._requestManager,i.localIdeographFontFamily),this.lineAtlas=new S(256,512),this.crossTileSymbolIndex=new Fe,this._layers={},this._serializedLayers={},this._order=[],this.sourceCaches={},this.zoomHistory=new t.ZoomHistory,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("setReferrer",t.getReferrer());var a=this;this._rtlTextPluginCallback=r.registerForPluginStateChange((function(e){a.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:e.pluginStatus,pluginURL:e.pluginURL},(function(e,r){if(t.triggerPluginCompletionEvent(e),r&&r.every((function(t){return t})))for(var n in a.sourceCaches)a.sourceCaches[n].reload()}))})),this.on("data",(function(t){if("source"===t.dataType&&"metadata"===t.sourceDataType){var e=o.sourceCaches[t.sourceId];if(e){var r=e.getSource();if(r&&r.vectorLayerIds)for(var n in o._layers){var i=o._layers[n];i.source===r.id&&o._validateLayer(i)}}}}))}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.loadURL=function(e,r){var n=this;void 0===r&&(r={}),this.fire(new t.Event("dataloading",{dataType:"style"}));var i="boolean"==typeof r.validate?r.validate:!t.isMapboxURL(e);e=this.map._requestManager.normalizeStyleURL(e,r.accessToken);var o=this.map._requestManager.transformRequest(e,t.ResourceType.Style);this._request=t.getJSON(o,(function(e,r){n._request=null,e?n.fire(new t.ErrorEvent(e)):r&&n._load(r,i)}))},r.prototype.loadJSON=function(e,r){var n=this;void 0===r&&(r={}),this.fire(new t.Event("dataloading",{dataType:"style"})),this._request=t.browser.frame((function(){n._request=null,n._load(e,!1!==r.validate)}))},r.prototype.loadEmpty=function(){this.fire(new t.Event("dataloading",{dataType:"style"})),this._load(Ne,!1)},r.prototype._load=function(e,r){if(!r||!Ve(this,t.validateStyle(e))){for(var n in this._loaded=!0,this.stylesheet=e,e.sources)this.addSource(n,e.sources[n],{validate:!1});e.sprite?this._loadSprite(e.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(e.glyphs);var i=Ut(this.stylesheet.layers);this._order=i.map((function(t){return t.id})),this._layers={},this._serializedLayers={};for(var o=0,a=i;o<a.length;o+=1){var s=a[o];(s=t.createStyleLayer(s)).setEventedParent(this,{layer:{id:s.id}}),this._layers[s.id]=s,this._serializedLayers[s.id]=s.serialize()}this.dispatcher.broadcast("setLayers",this._serializeLayers(this._order)),this.light=new w(this.stylesheet.light),this.fire(new t.Event("data",{dataType:"style"})),this.fire(new t.Event("style.load"))}},r.prototype._loadSprite=function(e){var r=this;this._spriteRequest=function(e,r,n){var i,o,a,s=t.browser.devicePixelRatio>1?"@2x":"",u=t.getJSON(r.transformRequest(r.normalizeSpriteURL(e,s,".json"),t.ResourceType.SpriteJSON),(function(t,e){u=null,a||(a=t,i=e,c())})),l=t.getImage(r.transformRequest(r.normalizeSpriteURL(e,s,".png"),t.ResourceType.SpriteImage),(function(t,e){l=null,a||(a=t,o=e,c())}));function c(){if(a)n(a);else if(i&&o){var e=t.browser.getImageData(o),r={};for(var s in i){var u=i[s],l=u.width,c=u.height,p=u.x,h=u.y,f=u.sdf,d=u.pixelRatio,m=u.stretchX,y=u.stretchY,g=u.content,v=new t.RGBAImage({width:l,height:c});t.RGBAImage.copy(e,v,{x:p,y:h},{x:0,y:0},{width:l,height:c}),r[s]={data:v,pixelRatio:d,sdf:f,stretchX:m,stretchY:y,content:g}}n(null,r)}}return{cancel:function(){u&&(u.cancel(),u=null),l&&(l.cancel(),l=null)}}}(e,this.map._requestManager,(function(e,n){if(r._spriteRequest=null,e)r.fire(new t.ErrorEvent(e));else if(n)for(var i in n)r.imageManager.addImage(i,n[i]);r.imageManager.setLoaded(!0),r._availableImages=r.imageManager.listImages(),r.dispatcher.broadcast("setImages",r._availableImages),r.fire(new t.Event("data",{dataType:"style"}))}))},r.prototype._validateLayer=function(e){var r=this.sourceCaches[e.source];if(r){var n=e.sourceLayer;if(n){var i=r.getSource();("geojson"===i.type||i.vectorLayerIds&&-1===i.vectorLayerIds.indexOf(n))&&this.fire(new t.ErrorEvent(new Error('Source layer "'+n+'" does not exist on source "'+i.id+'" as specified by style layer "'+e.id+'"')))}}},r.prototype.loaded=function(){if(!this._loaded)return!1;if(Object.keys(this._updatedSources).length)return!1;for(var t in this.sourceCaches)if(!this.sourceCaches[t].loaded())return!1;return!!this.imageManager.isLoaded()},r.prototype._serializeLayers=function(t){for(var e=[],r=0,n=t;r<n.length;r+=1){var i=this._layers[n[r]];"custom"!==i.type&&e.push(i.serialize())}return e},r.prototype.hasTransitions=function(){if(this.light&&this.light.hasTransition())return!0;for(var t in this.sourceCaches)if(this.sourceCaches[t].hasTransition())return!0;for(var e in this._layers)if(this._layers[e].hasTransition())return!0;return!1},r.prototype._checkLoaded=function(){if(!this._loaded)throw new Error("Style is not done loading")},r.prototype.update=function(e){if(this._loaded){var r=this._changed;if(this._changed){var n=Object.keys(this._updatedLayers),i=Object.keys(this._removedLayers);for(var o in(n.length||i.length)&&this._updateWorkerLayers(n,i),this._updatedSources){var a=this._updatedSources[o];"reload"===a?this._reloadSource(o):"clear"===a&&this._clearSource(o)}for(var s in this._updateTilesForChangedImages(),this._updatedPaintProps)this._layers[s].updateTransitions(e);this.light.updateTransitions(e),this._resetUpdates()}var u={};for(var l in this.sourceCaches){var c=this.sourceCaches[l];u[l]=c.used,c.used=!1}for(var p=0,h=this._order;p<h.length;p+=1){var f=this._layers[h[p]];f.recalculate(e,this._availableImages),!f.isHidden(e.zoom)&&f.source&&(this.sourceCaches[f.source].used=!0)}for(var d in u){var m=this.sourceCaches[d];u[d]!==m.used&&m.fire(new t.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:d}))}this.light.recalculate(e),this.z=e.zoom,r&&this.fire(new t.Event("data",{dataType:"style"}))}},r.prototype._updateTilesForChangedImages=function(){var t=Object.keys(this._changedImages);if(t.length){for(var e in this.sourceCaches)this.sourceCaches[e].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}},r.prototype._updateWorkerLayers=function(t,e){this.dispatcher.broadcast("updateLayers",{layers:this._serializeLayers(t),removedIds:e})},r.prototype._resetUpdates=function(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={}},r.prototype.setState=function(e){var r=this;if(this._checkLoaded(),Ve(this,t.validateStyle(e)))return!1;(e=t.clone$1(e)).layers=Ut(e.layers);var n=function(e,r){if(!e)return[{command:jt.setStyle,args:[r]}];var n=[];try{if(!t.deepEqual(e.version,r.version))return[{command:jt.setStyle,args:[r]}];t.deepEqual(e.center,r.center)||n.push({command:jt.setCenter,args:[r.center]}),t.deepEqual(e.zoom,r.zoom)||n.push({command:jt.setZoom,args:[r.zoom]}),t.deepEqual(e.bearing,r.bearing)||n.push({command:jt.setBearing,args:[r.bearing]}),t.deepEqual(e.pitch,r.pitch)||n.push({command:jt.setPitch,args:[r.pitch]}),t.deepEqual(e.sprite,r.sprite)||n.push({command:jt.setSprite,args:[r.sprite]}),t.deepEqual(e.glyphs,r.glyphs)||n.push({command:jt.setGlyphs,args:[r.glyphs]}),t.deepEqual(e.transition,r.transition)||n.push({command:jt.setTransition,args:[r.transition]}),t.deepEqual(e.light,r.light)||n.push({command:jt.setLight,args:[r.light]});var i={},o=[];!function(e,r,n,i){var o;for(o in r=r||{},e=e||{})e.hasOwnProperty(o)&&(r.hasOwnProperty(o)||qt(o,n,i));for(o in r)r.hasOwnProperty(o)&&(e.hasOwnProperty(o)?t.deepEqual(e[o],r[o])||("geojson"===e[o].type&&"geojson"===r[o].type&&Zt(e,r,o)?n.push({command:jt.setGeoJSONSourceData,args:[o,r[o].data]}):$t(o,r,n,i)):Nt(o,r,n))}(e.sources,r.sources,o,i);var a=[];e.layers&&e.layers.forEach((function(t){i[t.source]?n.push({command:jt.removeLayer,args:[t.id]}):a.push(t)})),n=n.concat(o),function(e,r,n){r=r||[];var i,o,a,s,u,l,c,p=(e=e||[]).map(Wt),h=r.map(Wt),f=e.reduce(Xt,{}),d=r.reduce(Xt,{}),m=p.slice(),y=Object.create(null);for(i=0,o=0;i<p.length;i++)d.hasOwnProperty(a=p[i])?o++:(n.push({command:jt.removeLayer,args:[a]}),m.splice(m.indexOf(a,o),1));for(i=0,o=0;i<h.length;i++)m[m.length-1-i]!==(a=h[h.length-1-i])&&(f.hasOwnProperty(a)?(n.push({command:jt.removeLayer,args:[a]}),m.splice(m.lastIndexOf(a,m.length-o),1)):o++,n.push({command:jt.addLayer,args:[d[a],l=m[m.length-i]]}),m.splice(m.length-i,0,a),y[a]=!0);for(i=0;i<h.length;i++)if(s=f[a=h[i]],u=d[a],!y[a]&&!t.deepEqual(s,u))if(t.deepEqual(s.source,u.source)&&t.deepEqual(s["source-layer"],u["source-layer"])&&t.deepEqual(s.type,u.type)){for(c in Gt(s.layout,u.layout,n,a,null,jt.setLayoutProperty),Gt(s.paint,u.paint,n,a,null,jt.setPaintProperty),t.deepEqual(s.filter,u.filter)||n.push({command:jt.setFilter,args:[a,u.filter]}),t.deepEqual(s.minzoom,u.minzoom)&&t.deepEqual(s.maxzoom,u.maxzoom)||n.push({command:jt.setLayerZoomRange,args:[a,u.minzoom,u.maxzoom]}),s)s.hasOwnProperty(c)&&"layout"!==c&&"paint"!==c&&"filter"!==c&&"metadata"!==c&&"minzoom"!==c&&"maxzoom"!==c&&(0===c.indexOf("paint.")?Gt(s[c],u[c],n,a,c.slice(6),jt.setPaintProperty):t.deepEqual(s[c],u[c])||n.push({command:jt.setLayerProperty,args:[a,c,u[c]]}));for(c in u)u.hasOwnProperty(c)&&!s.hasOwnProperty(c)&&"layout"!==c&&"paint"!==c&&"filter"!==c&&"metadata"!==c&&"minzoom"!==c&&"maxzoom"!==c&&(0===c.indexOf("paint.")?Gt(s[c],u[c],n,a,c.slice(6),jt.setPaintProperty):t.deepEqual(s[c],u[c])||n.push({command:jt.setLayerProperty,args:[a,c,u[c]]}))}else n.push({command:jt.removeLayer,args:[a]}),l=m[m.lastIndexOf(a)+1],n.push({command:jt.addLayer,args:[u,l]})}(a,r.layers,n)}catch(t){console.warn("Unable to compute style diff:",t),n=[{command:jt.setStyle,args:[r]}]}return n}(this.serialize(),e).filter((function(t){return!(t.command in je)}));if(0===n.length)return!1;var i=n.filter((function(t){return!(t.command in Ue)}));if(i.length>0)throw new Error("Unimplemented: "+i.map((function(t){return t.command})).join(", ")+".");return n.forEach((function(t){"setTransition"!==t.command&&r[t.command].apply(r,t.args)})),this.stylesheet=e,!0},r.prototype.addImage=function(e,r){if(this.getImage(e))return this.fire(new t.ErrorEvent(new Error("An image with this name already exists.")));this.imageManager.addImage(e,r),this._afterImageUpdated(e)},r.prototype.updateImage=function(t,e){this.imageManager.updateImage(t,e)},r.prototype.getImage=function(t){return this.imageManager.getImage(t)},r.prototype.removeImage=function(e){if(!this.getImage(e))return this.fire(new t.ErrorEvent(new Error("No image with this name exists.")));this.imageManager.removeImage(e),this._afterImageUpdated(e)},r.prototype._afterImageUpdated=function(e){this._availableImages=this.imageManager.listImages(),this._changedImages[e]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new t.Event("data",{dataType:"style"}))},r.prototype.listImages=function(){return this._checkLoaded(),this.imageManager.listImages()},r.prototype.addSource=function(e,r,n){var i=this;if(void 0===n&&(n={}),this._checkLoaded(),void 0!==this.sourceCaches[e])throw new Error("There is already a source with this ID");if(!r.type)throw new Error("The type property must be defined, but only the following properties were given: "+Object.keys(r).join(", ")+".");if(!(["vector","raster","geojson","video","image"].indexOf(r.type)>=0&&this._validate(t.validateStyle.source,"sources."+e,r,null,n))){this.map&&this.map._collectResourceTiming&&(r.collectResourceTiming=!0);var o=this.sourceCaches[e]=new Ct(e,r,this.dispatcher);o.style=this,o.setEventedParent(this,(function(){return{isSourceLoaded:i.loaded(),source:o.serialize(),sourceId:e}})),o.onAdd(this.map),this._changed=!0}},r.prototype.removeSource=function(e){if(this._checkLoaded(),void 0===this.sourceCaches[e])throw new Error("There is no source with this ID");for(var r in this._layers)if(this._layers[r].source===e)return this.fire(new t.ErrorEvent(new Error('Source "'+e+'" cannot be removed while layer "'+r+'" is using it.')));var n=this.sourceCaches[e];delete this.sourceCaches[e],delete this._updatedSources[e],n.fire(new t.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),n.setEventedParent(null),n.clearTiles(),n.onRemove&&n.onRemove(this.map),this._changed=!0},r.prototype.setGeoJSONSourceData=function(t,e){this._checkLoaded(),this.sourceCaches[t].getSource().setData(e),this._changed=!0},r.prototype.getSource=function(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()},r.prototype.addLayer=function(e,r,n){void 0===n&&(n={}),this._checkLoaded();var i=e.id;if(this.getLayer(i))this.fire(new t.ErrorEvent(new Error('Layer with id "'+i+'" already exists on this map')));else{var o;if("custom"===e.type){if(Ve(this,t.validateCustomStyleLayer(e)))return;o=t.createStyleLayer(e)}else{if("object"==typeof e.source&&(this.addSource(i,e.source),e=t.clone$1(e),e=t.extend(e,{source:i})),this._validate(t.validateStyle.layer,"layers."+i,e,{arrayIndex:-1},n))return;o=t.createStyleLayer(e),this._validateLayer(o),o.setEventedParent(this,{layer:{id:i}}),this._serializedLayers[o.id]=o.serialize()}var a=r?this._order.indexOf(r):this._order.length;if(r&&-1===a)this.fire(new t.ErrorEvent(new Error('Layer with id "'+r+'" does not exist on this map.')));else{if(this._order.splice(a,0,i),this._layerOrderChanged=!0,this._layers[i]=o,this._removedLayers[i]&&o.source&&"custom"!==o.type){var s=this._removedLayers[i];delete this._removedLayers[i],s.type!==o.type?this._updatedSources[o.source]="clear":(this._updatedSources[o.source]="reload",this.sourceCaches[o.source].pause())}this._updateLayer(o),o.onAdd&&o.onAdd(this.map)}}},r.prototype.moveLayer=function(e,r){if(this._checkLoaded(),this._changed=!0,this._layers[e]){if(e!==r){var n=this._order.indexOf(e);this._order.splice(n,1);var i=r?this._order.indexOf(r):this._order.length;r&&-1===i?this.fire(new t.ErrorEvent(new Error('Layer with id "'+r+'" does not exist on this map.'))):(this._order.splice(i,0,e),this._layerOrderChanged=!0)}}else this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be moved.")))},r.prototype.removeLayer=function(e){this._checkLoaded();var r=this._layers[e];if(r){r.setEventedParent(null);var n=this._order.indexOf(e);this._order.splice(n,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=r,delete this._layers[e],delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],r.onRemove&&r.onRemove(this.map)}else this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be removed.")))},r.prototype.getLayer=function(t){return this._layers[t]},r.prototype.hasLayer=function(t){return t in this._layers},r.prototype.setLayerZoomRange=function(e,r,n){this._checkLoaded();var i=this.getLayer(e);i?i.minzoom===r&&i.maxzoom===n||(null!=r&&(i.minzoom=r),null!=n&&(i.maxzoom=n),this._updateLayer(i)):this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot have zoom extent.")))},r.prototype.setFilter=function(e,r,n){void 0===n&&(n={}),this._checkLoaded();var i=this.getLayer(e);if(i){if(!t.deepEqual(i.filter,r))return null==r?(i.filter=void 0,void this._updateLayer(i)):void(this._validate(t.validateStyle.filter,"layers."+i.id+".filter",r,null,n)||(i.filter=t.clone$1(r),this._updateLayer(i)))}else this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be filtered.")))},r.prototype.getFilter=function(e){return t.clone$1(this.getLayer(e).filter)},r.prototype.setLayoutProperty=function(e,r,n,i){void 0===i&&(i={}),this._checkLoaded();var o=this.getLayer(e);o?t.deepEqual(o.getLayoutProperty(r),n)||(o.setLayoutProperty(r,n,i),this._updateLayer(o)):this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be styled.")))},r.prototype.getLayoutProperty=function(e,r){var n=this.getLayer(e);if(n)return n.getLayoutProperty(r);this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style.")))},r.prototype.setPaintProperty=function(e,r,n,i){void 0===i&&(i={}),this._checkLoaded();var o=this.getLayer(e);o?t.deepEqual(o.getPaintProperty(r),n)||(o.setPaintProperty(r,n,i)&&this._updateLayer(o),this._changed=!0,this._updatedPaintProps[e]=!0):this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be styled.")))},r.prototype.getPaintProperty=function(t,e){return this.getLayer(t).getPaintProperty(e)},r.prototype.setFeatureState=function(e,r){this._checkLoaded();var n=e.source,i=e.sourceLayer,o=this.sourceCaches[n];if(void 0!==o){var a=o.getSource().type;"geojson"===a&&i?this.fire(new t.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):"vector"!==a||i?(void 0===e.id&&this.fire(new t.ErrorEvent(new Error("The feature id parameter must be provided."))),o.setFeatureState(i,e.id,r)):this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new t.ErrorEvent(new Error("The source '"+n+"' does not exist in the map's style.")))},r.prototype.removeFeatureState=function(e,r){this._checkLoaded();var n=e.source,i=this.sourceCaches[n];if(void 0!==i){var o=i.getSource().type,a="vector"===o?e.sourceLayer:void 0;"vector"!==o||a?r&&"string"!=typeof e.id&&"number"!=typeof e.id?this.fire(new t.ErrorEvent(new Error("A feature id is required to remove its specific state property."))):i.removeFeatureState(a,e.id,r):this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new t.ErrorEvent(new Error("The source '"+n+"' does not exist in the map's style.")))},r.prototype.getFeatureState=function(e){this._checkLoaded();var r=e.source,n=e.sourceLayer,i=this.sourceCaches[r];if(void 0!==i){if("vector"!==i.getSource().type||n)return void 0===e.id&&this.fire(new t.ErrorEvent(new Error("The feature id parameter must be provided."))),i.getFeatureState(n,e.id);this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new t.ErrorEvent(new Error("The source '"+r+"' does not exist in the map's style.")))},r.prototype.getTransition=function(){return t.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)},r.prototype.serialize=function(){return t.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,sources:t.mapObject(this.sourceCaches,(function(t){return t.serialize()})),layers:this._serializeLayers(this._order)},(function(t){return void 0!==t}))},r.prototype._updateLayer=function(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&"raster"!==this.sourceCaches[t.source].getSource().type&&(this._updatedSources[t.source]="reload",this.sourceCaches[t.source].pause()),this._changed=!0},r.prototype._flattenAndSortRenderedFeatures=function(t){for(var e=this,r=function(t){return"fill-extrusion"===e._layers[t].type},n={},i=[],o=this._order.length-1;o>=0;o--){var a=this._order[o];if(r(a)){n[a]=o;for(var s=0,u=t;s<u.length;s+=1){var l=u[s][a];if(l)for(var c=0,p=l;c<p.length;c+=1)i.push(p[c])}}}i.sort((function(t,e){return e.intersectionZ-t.intersectionZ}));for(var h=[],f=this._order.length-1;f>=0;f--){var d=this._order[f];if(r(d))for(var m=i.length-1;m>=0;m--){var y=i[m].feature;if(n[y.layer.id]<f)break;h.push(y),i.pop()}else for(var g=0,v=t;g<v.length;g+=1){var _=v[g][d];if(_)for(var x=0,b=_;x<b.length;x+=1)h.push(b[x].feature)}}return h},r.prototype.queryRenderedFeatures=function(e,r,n){r&&r.filter&&this._validate(t.validateStyle.filter,"queryRenderedFeatures.filter",r.filter,null,r);var i={};if(r&&r.layers){if(!Array.isArray(r.layers))return this.fire(new t.ErrorEvent(new Error("parameters.layers must be an Array."))),[];for(var o=0,a=r.layers;o<a.length;o+=1){var s=a[o],u=this._layers[s];if(!u)return this.fire(new t.ErrorEvent(new Error("The layer '"+s+"' does not exist in the map's style and cannot be queried for features."))),[];i[u.source]=!0}}var l=[];for(var c in r.availableImages=this._availableImages,this.sourceCaches)r.layers&&!i[c]||l.push(O(this.sourceCaches[c],this._layers,this._serializedLayers,e,r,n));return this.placement&&l.push(function(t,e,r,n,i,o,a){for(var s={},u=o.queryRenderedSymbols(n),l=[],c=0,p=Object.keys(u).map(Number);c<p.length;c+=1)l.push(a[p[c]]);l.sort(F);for(var h=function(){var r=d[f],n=r.featureIndex.lookupSymbolFeatures(u[r.bucketInstanceId],e,r.bucketIndex,r.sourceLayerIndex,i.filter,i.layers,i.availableImages,t);for(var o in n){var a=s[o]=s[o]||[],l=n[o];l.sort((function(t,e){var n=r.featureSortOrder;if(n){var i=n.indexOf(t.featureIndex);return n.indexOf(e.featureIndex)-i}return e.featureIndex-t.featureIndex}));for(var c=0,p=l;c<p.length;c+=1)a.push(p[c])}},f=0,d=l;f<d.length;f+=1)h();var m=function(e){s[e].forEach((function(n){var i=n.feature,o=r[t[e].source].getFeatureState(i.layer["source-layer"],i.id);i.source=i.layer.source,i.layer["source-layer"]&&(i.sourceLayer=i.layer["source-layer"]),i.state=o}))};for(var y in s)m(y);return s}(this._layers,this._serializedLayers,this.sourceCaches,e,r,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(l)},r.prototype.querySourceFeatures=function(e,r){r&&r.filter&&this._validate(t.validateStyle.filter,"querySourceFeatures.filter",r.filter,null,r);var n=this.sourceCaches[e];return n?function(t,e){for(var r=t.getRenderableIds().map((function(e){return t.getTileByID(e)})),n=[],i={},o=0;o<r.length;o++){var a=r[o],s=a.tileID.canonical.key;i[s]||(i[s]=!0,a.querySourceFeatures(n,e))}return n}(n,r):[]},r.prototype.addSourceType=function(t,e,n){return r.getSourceType(t)?n(new Error('A source type called "'+t+'" already exists.')):(r.setSourceType(t,e),e.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:t,url:e.workerSourceURL},n):n(null,null))},r.prototype.getLight=function(){return this.light.getLight()},r.prototype.setLight=function(e,r){void 0===r&&(r={}),this._checkLoaded();var n=this.light.getLight(),i=!1;for(var o in e)if(!t.deepEqual(e[o],n[o])){i=!0;break}if(i){var a={now:t.browser.now(),transition:t.extend({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(e,r),this.light.updateTransitions(a)}},r.prototype._validate=function(e,r,n,i,o){return void 0===o&&(o={}),(!o||!1!==o.validate)&&Ve(this,e.call(t.validateStyle,t.extend({key:r,style:this.serialize(),value:n,styleSpec:t.styleSpec},i)))},r.prototype._remove=function(){for(var e in this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),t.evented.off("pluginStateChange",this._rtlTextPluginCallback),this._layers)this._layers[e].setEventedParent(null);for(var r in this.sourceCaches)this.sourceCaches[r].clearTiles(),this.sourceCaches[r].setEventedParent(null);this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove()},r.prototype._clearSource=function(t){this.sourceCaches[t].clearTiles()},r.prototype._reloadSource=function(t){this.sourceCaches[t].resume(),this.sourceCaches[t].reload()},r.prototype._updateSources=function(t){for(var e in this.sourceCaches)this.sourceCaches[e].update(t)},r.prototype._generateCollisionBoxes=function(){for(var t in this.sourceCaches)this._reloadSource(t)},r.prototype._updatePlacement=function(e,r,n,i,o){void 0===o&&(o=!1);for(var a=!1,s=!1,u={},l=0,c=this._order;l<c.length;l+=1){var p=this._layers[c[l]];if("symbol"===p.type){if(!u[p.source]){var h=this.sourceCaches[p.source];u[p.source]=h.getRenderableIds(!0).map((function(t){return h.getTileByID(t)})).sort((function(t,e){return e.tileID.overscaledZ-t.tileID.overscaledZ||(t.tileID.isLessThan(e.tileID)?-1:1)}))}var f=this.crossTileSymbolIndex.addLayer(p,u[p.source],e.center.lng);a=a||f}}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((o=o||this._layerOrderChanged||0===n)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(t.browser.now(),e.zoom))&&(this.pauseablePlacement=new De(e,this._order,o,r,n,i,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,u),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(t.browser.now()),s=!0),a&&this.pauseablePlacement.placement.setStale()),s||a)for(var d=0,m=this._order;d<m.length;d+=1){var y=this._layers[m[d]];"symbol"===y.type&&this.placement.updateLayerOpacities(y,u[y.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(t.browser.now())},r.prototype._releaseSymbolFadeTiles=function(){for(var t in this.sourceCaches)this.sourceCaches[t].releaseSymbolFadeTiles()},r.prototype.getImages=function(t,e,r){this.imageManager.getImages(e.icons,r),this._updateTilesForChangedImages();var n=this.sourceCaches[e.source];n&&n.setDependencies(e.tileID.key,e.type,e.icons)},r.prototype.getGlyphs=function(t,e,r){this.glyphManager.getGlyphs(e.stacks,r)},r.prototype.getResource=function(e,r,n){return t.makeRequest(r,n)},r}(t.Evented);qe.getSourceType=function(t){return B[t]},qe.setSourceType=function(t,e){B[t]=e},qe.registerForPluginStateChange=t.registerForPluginStateChange;var $e=t.createLayout([{name:"a_pos",type:"Int16",components:2}]),Ze=gr("#ifdef GL_ES\nprecision mediump float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif","#ifdef GL_ES\nprecision highp float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}"),Ge=gr("uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),We=gr("uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"),Xe=gr("varying vec3 v_data;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));gl_FragColor=opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;varying vec3 v_data;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main(void) {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,0,1);} else {gl_Position=u_matrix*vec4(circle_center,0,1);if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);}"),He=gr("void main() {gl_FragColor=vec4(1.0);}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),Ke=gr("uniform highp float u_intensity;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec4 pos=vec4(floor(a_pos*0.5)+extrude,0,1);gl_Position=u_matrix*pos;}"),Ye=gr("uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(0.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),Je=gr("varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}","attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);gl_Position=u_matrix*vec4(a_pos,0.0,1.0);gl_Position.xy+=(a_extrude+a_shift)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}"),Qe=gr("varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}","attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd  =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz  /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),tr=gr("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}","attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,0,1);}"),er=gr("#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_FragColor=color*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);}"),rr=gr("varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}"),nr=gr("uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}"),ir=gr("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}"),or=gr("varying vec4 v_color;void main() {gl_FragColor=v_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed;varying vec4 v_color;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\nvec3 normal=a_normal_ed.xyz;base=max(0.0,base);height=max(0.0,height);float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}"),ar=gr("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;base=max(0.0,base);height=max(0.0,height);float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0\n? a_pos\n: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}"),sr=gr("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),ur=gr("uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;\n#define PI 3.141592653589793\nvoid main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}"),lr=gr("uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_width2=vec2(outset,inset);}"),cr=gr("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_width2=vec2(outset,inset);}"),pr=gr("uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}"),hr=gr("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}"),fr=gr("uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),dr=gr("uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nlowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0),0.0,1.0);v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;v_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));}"),mr=gr("#define SDF_PX 8.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),0.0,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}"),yr=gr("#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),0.0,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}");function gr(t,e){var r=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,n=e.match(/attribute ([\w]+) ([\w]+)/g),i=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),o=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),a=o?o.concat(i):i,s={};return{fragmentSource:t=t.replace(r,(function(t,e,r,n,i){return s[i]=!0,"define"===e?"\n#ifndef HAS_UNIFORM_u_"+i+"\nvarying "+r+" "+n+" "+i+";\n#else\nuniform "+r+" "+n+" u_"+i+";\n#endif\n":"\n#ifdef HAS_UNIFORM_u_"+i+"\n    "+r+" "+n+" "+i+" = u_"+i+";\n#endif\n"})),vertexSource:e=e.replace(r,(function(t,e,r,n,i){var o="float"===n?"vec2":"vec4",a=i.match(/color/)?"color":o;return s[i]?"define"===e?"\n#ifndef HAS_UNIFORM_u_"+i+"\nuniform lowp float u_"+i+"_t;\nattribute "+r+" "+o+" a_"+i+";\nvarying "+r+" "+n+" "+i+";\n#else\nuniform "+r+" "+n+" u_"+i+";\n#endif\n":"vec4"===a?"\n#ifndef HAS_UNIFORM_u_"+i+"\n    "+i+" = a_"+i+";\n#else\n    "+r+" "+n+" "+i+" = u_"+i+";\n#endif\n":"\n#ifndef HAS_UNIFORM_u_"+i+"\n    "+i+" = unpack_mix_"+a+"(a_"+i+", u_"+i+"_t);\n#else\n    "+r+" "+n+" "+i+" = u_"+i+";\n#endif\n":"define"===e?"\n#ifndef HAS_UNIFORM_u_"+i+"\nuniform lowp float u_"+i+"_t;\nattribute "+r+" "+o+" a_"+i+";\n#else\nuniform "+r+" "+n+" u_"+i+";\n#endif\n":"vec4"===a?"\n#ifndef HAS_UNIFORM_u_"+i+"\n    "+r+" "+n+" "+i+" = a_"+i+";\n#else\n    "+r+" "+n+" "+i+" = u_"+i+";\n#endif\n":"\n#ifndef HAS_UNIFORM_u_"+i+"\n    "+r+" "+n+" "+i+" = unpack_mix_"+a+"(a_"+i+", u_"+i+"_t);\n#else\n    "+r+" "+n+" "+i+" = u_"+i+";\n#endif\n"})),staticAttributes:n,staticUniforms:a}}var vr=Object.freeze({__proto__:null,prelude:Ze,background:Ge,backgroundPattern:We,circle:Xe,clippingMask:He,heatmap:Ke,heatmapTexture:Ye,collisionBox:Je,collisionCircle:Qe,debug:tr,fill:er,fillOutline:rr,fillOutlinePattern:nr,fillPattern:ir,fillExtrusion:or,fillExtrusionPattern:ar,hillshadePrepare:sr,hillshade:ur,line:lr,lineGradient:cr,linePattern:pr,lineSDF:hr,raster:fr,symbolIcon:dr,symbolSDF:mr,symbolTextAndIcon:yr}),_r=function(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null};function xr(t){for(var e=[],r=0;r<t.length;r++)if(null!==t[r]){var n=t[r].split(" ");e.push(n.pop())}return e}_r.prototype.bind=function(t,e,r,n,i,o,a,s){this.context=t;for(var u=this.boundPaintVertexBuffers.length!==n.length,l=0;!u&&l<n.length;l++)this.boundPaintVertexBuffers[l]!==n[l]&&(u=!0);t.extVertexArrayObject&&this.vao&&this.boundProgram===e&&this.boundLayoutVertexBuffer===r&&!u&&this.boundIndexBuffer===i&&this.boundVertexOffset===o&&this.boundDynamicVertexBuffer===a&&this.boundDynamicVertexBuffer2===s?(t.bindVertexArrayOES.set(this.vao),a&&a.bind(),i&&i.dynamicDraw&&i.bind(),s&&s.bind()):this.freshBind(e,r,n,i,o,a,s)},_r.prototype.freshBind=function(t,e,r,n,i,o,a){var s,u=t.numAttributes,l=this.context,c=l.gl;if(l.extVertexArrayObject)this.vao&&this.destroy(),this.vao=l.extVertexArrayObject.createVertexArrayOES(),l.bindVertexArrayOES.set(this.vao),s=0,this.boundProgram=t,this.boundLayoutVertexBuffer=e,this.boundPaintVertexBuffers=r,this.boundIndexBuffer=n,this.boundVertexOffset=i,this.boundDynamicVertexBuffer=o,this.boundDynamicVertexBuffer2=a;else{s=l.currentNumAttributes||0;for(var p=u;p<s;p++)c.disableVertexAttribArray(p)}e.enableAttributes(c,t);for(var h=0,f=r;h<f.length;h+=1)f[h].enableAttributes(c,t);o&&o.enableAttributes(c,t),a&&a.enableAttributes(c,t),e.bind(),e.setVertexAttribPointers(c,t,i);for(var d=0,m=r;d<m.length;d+=1){var y=m[d];y.bind(),y.setVertexAttribPointers(c,t,i)}o&&(o.bind(),o.setVertexAttribPointers(c,t,i)),n&&n.bind(),a&&(a.bind(),a.setVertexAttribPointers(c,t,i)),l.currentNumAttributes=u},_r.prototype.destroy=function(){this.vao&&(this.context.extVertexArrayObject.deleteVertexArrayOES(this.vao),this.vao=null)};var br=function(t,e,r,n,i,o){var a=t.gl;this.program=a.createProgram();for(var s=xr(r.staticAttributes),u=n?n.getBinderAttributes():[],l=s.concat(u),c=r.staticUniforms?xr(r.staticUniforms):[],p=n?n.getBinderUniforms():[],h=[],f=0,d=c.concat(p);f<d.length;f+=1){var m=d[f];h.indexOf(m)<0&&h.push(m)}var y=n?n.defines():[];o&&y.push("#define OVERDRAW_INSPECTOR;");var g=y.concat(Ze.fragmentSource,r.fragmentSource).join("\n"),v=y.concat(Ze.vertexSource,r.vertexSource).join("\n"),_=a.createShader(a.FRAGMENT_SHADER);if(a.isContextLost())this.failedToCreate=!0;else{a.shaderSource(_,g),a.compileShader(_),a.attachShader(this.program,_);var x=a.createShader(a.VERTEX_SHADER);if(a.isContextLost())this.failedToCreate=!0;else{a.shaderSource(x,v),a.compileShader(x),a.attachShader(this.program,x),this.attributes={};var b={};this.numAttributes=l.length;for(var w=0;w<this.numAttributes;w++)l[w]&&(a.bindAttribLocation(this.program,w,l[w]),this.attributes[l[w]]=w);a.linkProgram(this.program),a.deleteShader(x),a.deleteShader(_);for(var S=0;S<h.length;S++){var A=h[S];if(A&&!b[A]){var E=a.getUniformLocation(this.program,A);E&&(b[A]=E)}}this.fixedUniforms=i(t,b),this.binderUniforms=n?n.getUniforms(t,b):[]}}};function wr(t,e,r){var n=1/he(r,1,e.transform.tileZoom),i=Math.pow(2,r.tileID.overscaledZ),o=r.tileSize*Math.pow(2,e.transform.tileZoom)/i,a=o*(r.tileID.canonical.x+r.tileID.wrap*i),s=o*r.tileID.canonical.y;return{u_image:0,u_texsize:r.imageAtlasTexture.size,u_scale:[n,t.fromScale,t.toScale],u_fade:t.t,u_pixel_coord_upper:[a>>16,s>>16],u_pixel_coord_lower:[65535&a,65535&s]}}br.prototype.draw=function(t,e,r,n,i,o,a,s,u,l,c,p,h,f,d,m){var y,g=t.gl;if(!this.failedToCreate){for(var v in t.program.set(this.program),t.setDepthMode(r),t.setStencilMode(n),t.setColorMode(i),t.setCullFace(o),this.fixedUniforms)this.fixedUniforms[v].set(a[v]);f&&f.setUniforms(t,this.binderUniforms,p,{zoom:h});for(var _=(y={},y[g.LINES]=2,y[g.TRIANGLES]=3,y[g.LINE_STRIP]=1,y)[e],x=0,b=c.get();x<b.length;x+=1){var w=b[x],S=w.vaos||(w.vaos={});(S[s]||(S[s]=new _r)).bind(t,this,u,f?f.getPaintVertexBuffers():[],l,w.vertexOffset,d,m),g.drawElements(e,w.primitiveLength*_,g.UNSIGNED_SHORT,w.primitiveOffset*_*2)}}};var Sr=function(e,r,n,i){var o=r.style.light,a=o.properties.get("position"),s=[a.x,a.y,a.z],u=t.create$1();"viewport"===o.properties.get("anchor")&&t.fromRotation(u,-r.transform.angle),t.transformMat3(s,s,u);var l=o.properties.get("color");return{u_matrix:e,u_lightpos:s,u_lightintensity:o.properties.get("intensity"),u_lightcolor:[l.r,l.g,l.b],u_vertical_gradient:+n,u_opacity:i}},Ar=function(e,r,n,i,o,a,s){return t.extend(Sr(e,r,n,i),wr(a,r,s),{u_height_factor:-Math.pow(2,o.overscaledZ)/s.tileSize/8})},Er=function(t){return{u_matrix:t}},Tr=function(e,r,n,i){return t.extend(Er(e),wr(n,r,i))},kr=function(t,e){return{u_matrix:t,u_world:e}},Ir=function(e,r,n,i,o){return t.extend(Tr(e,r,n,i),{u_world:o})},zr=function(e,r,n,i){var o,a,s=e.transform;if("map"===i.paint.get("circle-pitch-alignment")){var u=he(n,1,s.zoom);o=!0,a=[u,u]}else o=!1,a=s.pixelsToGLUnits;return{u_camera_to_center_distance:s.cameraToCenterDistance,u_scale_with_map:+("map"===i.paint.get("circle-pitch-scale")),u_matrix:e.translatePosMatrix(r.posMatrix,n,i.paint.get("circle-translate"),i.paint.get("circle-translate-anchor")),u_pitch_with_map:+o,u_device_pixel_ratio:t.browser.devicePixelRatio,u_extrude_scale:a}},Cr=function(t,e,r){var n=he(r,1,e.zoom),i=Math.pow(2,e.zoom-r.tileID.overscaledZ),o=r.tileID.overscaleFactor();return{u_matrix:t,u_camera_to_center_distance:e.cameraToCenterDistance,u_pixels_to_tile_units:n,u_extrude_scale:[e.pixelsToGLUnits[0]/(n*i),e.pixelsToGLUnits[1]/(n*i)],u_overscale_factor:o}},Pr=function(t,e,r){return{u_matrix:t,u_inv_matrix:e,u_camera_to_center_distance:r.cameraToCenterDistance,u_viewport_size:[r.width,r.height]}},Mr=function(t,e,r){return void 0===r&&(r=1),{u_matrix:t,u_color:e,u_overlay:0,u_overlay_scale:r}},Dr=function(t){return{u_matrix:t}},Lr=function(t,e,r,n){return{u_matrix:t,u_extrude_scale:he(e,1,r),u_intensity:n}},Br=function(e,r,n){var i=e.transform;return{u_matrix:Ur(e,r,n),u_ratio:1/he(r,1,i.zoom),u_device_pixel_ratio:t.browser.devicePixelRatio,u_units_to_pixels:[1/i.pixelsToGLUnits[0],1/i.pixelsToGLUnits[1]]}},Rr=function(e,r,n,i){return t.extend(Br(e,r,n),{u_image:0,u_image_height:i})},Or=function(e,r,n,i){var o=e.transform,a=Vr(r,o);return{u_matrix:Ur(e,r,n),u_texsize:r.imageAtlasTexture.size,u_ratio:1/he(r,1,o.zoom),u_device_pixel_ratio:t.browser.devicePixelRatio,u_image:0,u_scale:[a,i.fromScale,i.toScale],u_fade:i.t,u_units_to_pixels:[1/o.pixelsToGLUnits[0],1/o.pixelsToGLUnits[1]]}},Fr=function(e,r,n,i,o){var a=e.lineAtlas,s=Vr(r,e.transform),u="round"===n.layout.get("line-cap"),l=a.getDash(i.from,u),c=a.getDash(i.to,u),p=l.width*o.fromScale,h=c.width*o.toScale;return t.extend(Br(e,r,n),{u_patternscale_a:[s/p,-l.height/2],u_patternscale_b:[s/h,-c.height/2],u_sdfgamma:a.width/(256*Math.min(p,h)*t.browser.devicePixelRatio)/2,u_image:0,u_tex_y_a:l.y,u_tex_y_b:c.y,u_mix:o.t})};function Vr(t,e){return 1/he(t,1,e.tileZoom)}function Ur(t,e,r){return t.translatePosMatrix(e.tileID.posMatrix,e,r.paint.get("line-translate"),r.paint.get("line-translate-anchor"))}var jr=function(t,e,r,n,i){return{u_matrix:t,u_tl_parent:e,u_scale_parent:r,u_buffer_scale:1,u_fade_t:n.mix,u_opacity:n.opacity*i.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:i.paint.get("raster-brightness-min"),u_brightness_high:i.paint.get("raster-brightness-max"),u_saturation_factor:(a=i.paint.get("raster-saturation"),a>0?1-1/(1.001-a):-a),u_contrast_factor:(o=i.paint.get("raster-contrast"),o>0?1/(1-o):1+o),u_spin_weights:Nr(i.paint.get("raster-hue-rotate"))};var o,a};function Nr(t){t*=Math.PI/180;var e=Math.sin(t),r=Math.cos(t);return[(2*r+1)/3,(-Math.sqrt(3)*e-r+1)/3,(Math.sqrt(3)*e-r+1)/3]}var qr,$r=function(t,e,r,n,i,o,a,s,u,l){var c=i.transform;return{u_is_size_zoom_constant:+("constant"===t||"source"===t),u_is_size_feature_constant:+("constant"===t||"camera"===t),u_size_t:e?e.uSizeT:0,u_size:e?e.uSize:0,u_camera_to_center_distance:c.cameraToCenterDistance,u_pitch:c.pitch/360*2*Math.PI,u_rotate_symbol:+r,u_aspect_ratio:c.width/c.height,u_fade_change:i.options.fadeDuration?i.symbolFadeChange:1,u_matrix:o,u_label_plane_matrix:a,u_coord_matrix:s,u_is_text:+u,u_pitch_with_map:+n,u_texsize:l,u_texture:0}},Zr=function(e,r,n,i,o,a,s,u,l,c,p){var h=o.transform;return t.extend($r(e,r,n,i,o,a,s,u,l,c),{u_gamma_scale:i?Math.cos(h._pitch)*h.cameraToCenterDistance:1,u_device_pixel_ratio:t.browser.devicePixelRatio,u_is_halo:+p})},Gr=function(e,r,n,i,o,a,s,u,l,c){return t.extend(Zr(e,r,n,i,o,a,s,u,!0,l,!0),{u_texsize_icon:c,u_texture_icon:1})},Wr=function(t,e,r){return{u_matrix:t,u_opacity:e,u_color:r}},Xr=function(e,r,n,i,o,a){return t.extend(function(t,e,r,n){var i=r.imageManager.getPattern(t.from.toString()),o=r.imageManager.getPattern(t.to.toString()),a=r.imageManager.getPixelSize(),s=a.width,u=a.height,l=Math.pow(2,n.tileID.overscaledZ),c=n.tileSize*Math.pow(2,r.transform.tileZoom)/l,p=c*(n.tileID.canonical.x+n.tileID.wrap*l),h=c*n.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:i.tl,u_pattern_br_a:i.br,u_pattern_tl_b:o.tl,u_pattern_br_b:o.br,u_texsize:[s,u],u_mix:e.t,u_pattern_size_a:i.displaySize,u_pattern_size_b:o.displaySize,u_scale_a:e.fromScale,u_scale_b:e.toScale,u_tile_units_to_pixels:1/he(n,1,r.transform.tileZoom),u_pixel_coord_upper:[p>>16,h>>16],u_pixel_coord_lower:[65535&p,65535&h]}}(i,a,n,o),{u_matrix:e,u_opacity:r})},Hr={fillExtrusion:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_lightpos:new t.Uniform3f(e,r.u_lightpos),u_lightintensity:new t.Uniform1f(e,r.u_lightintensity),u_lightcolor:new t.Uniform3f(e,r.u_lightcolor),u_vertical_gradient:new t.Uniform1f(e,r.u_vertical_gradient),u_opacity:new t.Uniform1f(e,r.u_opacity)}},fillExtrusionPattern:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_lightpos:new t.Uniform3f(e,r.u_lightpos),u_lightintensity:new t.Uniform1f(e,r.u_lightintensity),u_lightcolor:new t.Uniform3f(e,r.u_lightcolor),u_vertical_gradient:new t.Uniform1f(e,r.u_vertical_gradient),u_height_factor:new t.Uniform1f(e,r.u_height_factor),u_image:new t.Uniform1i(e,r.u_image),u_texsize:new t.Uniform2f(e,r.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,r.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,r.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,r.u_scale),u_fade:new t.Uniform1f(e,r.u_fade),u_opacity:new t.Uniform1f(e,r.u_opacity)}},fill:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix)}},fillPattern:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_image:new t.Uniform1i(e,r.u_image),u_texsize:new t.Uniform2f(e,r.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,r.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,r.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,r.u_scale),u_fade:new t.Uniform1f(e,r.u_fade)}},fillOutline:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_world:new t.Uniform2f(e,r.u_world)}},fillOutlinePattern:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_world:new t.Uniform2f(e,r.u_world),u_image:new t.Uniform1i(e,r.u_image),u_texsize:new t.Uniform2f(e,r.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,r.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,r.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,r.u_scale),u_fade:new t.Uniform1f(e,r.u_fade)}},circle:function(e,r){return{u_camera_to_center_distance:new t.Uniform1f(e,r.u_camera_to_center_distance),u_scale_with_map:new t.Uniform1i(e,r.u_scale_with_map),u_pitch_with_map:new t.Uniform1i(e,r.u_pitch_with_map),u_extrude_scale:new t.Uniform2f(e,r.u_extrude_scale),u_device_pixel_ratio:new t.Uniform1f(e,r.u_device_pixel_ratio),u_matrix:new t.UniformMatrix4f(e,r.u_matrix)}},collisionBox:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_camera_to_center_distance:new t.Uniform1f(e,r.u_camera_to_center_distance),u_pixels_to_tile_units:new t.Uniform1f(e,r.u_pixels_to_tile_units),u_extrude_scale:new t.Uniform2f(e,r.u_extrude_scale),u_overscale_factor:new t.Uniform1f(e,r.u_overscale_factor)}},collisionCircle:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_inv_matrix:new t.UniformMatrix4f(e,r.u_inv_matrix),u_camera_to_center_distance:new t.Uniform1f(e,r.u_camera_to_center_distance),u_viewport_size:new t.Uniform2f(e,r.u_viewport_size)}},debug:function(e,r){return{u_color:new t.UniformColor(e,r.u_color),u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_overlay:new t.Uniform1i(e,r.u_overlay),u_overlay_scale:new t.Uniform1f(e,r.u_overlay_scale)}},clippingMask:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix)}},heatmap:function(e,r){return{u_extrude_scale:new t.Uniform1f(e,r.u_extrude_scale),u_intensity:new t.Uniform1f(e,r.u_intensity),u_matrix:new t.UniformMatrix4f(e,r.u_matrix)}},heatmapTexture:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_world:new t.Uniform2f(e,r.u_world),u_image:new t.Uniform1i(e,r.u_image),u_color_ramp:new t.Uniform1i(e,r.u_color_ramp),u_opacity:new t.Uniform1f(e,r.u_opacity)}},hillshade:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_image:new t.Uniform1i(e,r.u_image),u_latrange:new t.Uniform2f(e,r.u_latrange),u_light:new t.Uniform2f(e,r.u_light),u_shadow:new t.UniformColor(e,r.u_shadow),u_highlight:new t.UniformColor(e,r.u_highlight),u_accent:new t.UniformColor(e,r.u_accent)}},hillshadePrepare:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_image:new t.Uniform1i(e,r.u_image),u_dimension:new t.Uniform2f(e,r.u_dimension),u_zoom:new t.Uniform1f(e,r.u_zoom),u_unpack:new t.Uniform4f(e,r.u_unpack)}},line:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_ratio:new t.Uniform1f(e,r.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,r.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,r.u_units_to_pixels)}},lineGradient:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_ratio:new t.Uniform1f(e,r.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,r.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,r.u_units_to_pixels),u_image:new t.Uniform1i(e,r.u_image),u_image_height:new t.Uniform1f(e,r.u_image_height)}},linePattern:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_texsize:new t.Uniform2f(e,r.u_texsize),u_ratio:new t.Uniform1f(e,r.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,r.u_device_pixel_ratio),u_image:new t.Uniform1i(e,r.u_image),u_units_to_pixels:new t.Uniform2f(e,r.u_units_to_pixels),u_scale:new t.Uniform3f(e,r.u_scale),u_fade:new t.Uniform1f(e,r.u_fade)}},lineSDF:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_ratio:new t.Uniform1f(e,r.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,r.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,r.u_units_to_pixels),u_patternscale_a:new t.Uniform2f(e,r.u_patternscale_a),u_patternscale_b:new t.Uniform2f(e,r.u_patternscale_b),u_sdfgamma:new t.Uniform1f(e,r.u_sdfgamma),u_image:new t.Uniform1i(e,r.u_image),u_tex_y_a:new t.Uniform1f(e,r.u_tex_y_a),u_tex_y_b:new t.Uniform1f(e,r.u_tex_y_b),u_mix:new t.Uniform1f(e,r.u_mix)}},raster:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_tl_parent:new t.Uniform2f(e,r.u_tl_parent),u_scale_parent:new t.Uniform1f(e,r.u_scale_parent),u_buffer_scale:new t.Uniform1f(e,r.u_buffer_scale),u_fade_t:new t.Uniform1f(e,r.u_fade_t),u_opacity:new t.Uniform1f(e,r.u_opacity),u_image0:new t.Uniform1i(e,r.u_image0),u_image1:new t.Uniform1i(e,r.u_image1),u_brightness_low:new t.Uniform1f(e,r.u_brightness_low),u_brightness_high:new t.Uniform1f(e,r.u_brightness_high),u_saturation_factor:new t.Uniform1f(e,r.u_saturation_factor),u_contrast_factor:new t.Uniform1f(e,r.u_contrast_factor),u_spin_weights:new t.Uniform3f(e,r.u_spin_weights)}},symbolIcon:function(e,r){return{u_is_size_zoom_constant:new t.Uniform1i(e,r.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,r.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,r.u_size_t),u_size:new t.Uniform1f(e,r.u_size),u_camera_to_center_distance:new t.Uniform1f(e,r.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,r.u_pitch),u_rotate_symbol:new t.Uniform1i(e,r.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,r.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,r.u_fade_change),u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,r.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,r.u_coord_matrix),u_is_text:new t.Uniform1i(e,r.u_is_text),u_pitch_with_map:new t.Uniform1i(e,r.u_pitch_with_map),u_texsize:new t.Uniform2f(e,r.u_texsize),u_texture:new t.Uniform1i(e,r.u_texture)}},symbolSDF:function(e,r){return{u_is_size_zoom_constant:new t.Uniform1i(e,r.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,r.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,r.u_size_t),u_size:new t.Uniform1f(e,r.u_size),u_camera_to_center_distance:new t.Uniform1f(e,r.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,r.u_pitch),u_rotate_symbol:new t.Uniform1i(e,r.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,r.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,r.u_fade_change),u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,r.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,r.u_coord_matrix),u_is_text:new t.Uniform1i(e,r.u_is_text),u_pitch_with_map:new t.Uniform1i(e,r.u_pitch_with_map),u_texsize:new t.Uniform2f(e,r.u_texsize),u_texture:new t.Uniform1i(e,r.u_texture),u_gamma_scale:new t.Uniform1f(e,r.u_gamma_scale),u_device_pixel_ratio:new t.Uniform1f(e,r.u_device_pixel_ratio),u_is_halo:new t.Uniform1i(e,r.u_is_halo)}},symbolTextAndIcon:function(e,r){return{u_is_size_zoom_constant:new t.Uniform1i(e,r.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,r.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,r.u_size_t),u_size:new t.Uniform1f(e,r.u_size),u_camera_to_center_distance:new t.Uniform1f(e,r.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,r.u_pitch),u_rotate_symbol:new t.Uniform1i(e,r.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,r.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,r.u_fade_change),u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,r.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,r.u_coord_matrix),u_is_text:new t.Uniform1i(e,r.u_is_text),u_pitch_with_map:new t.Uniform1i(e,r.u_pitch_with_map),u_texsize:new t.Uniform2f(e,r.u_texsize),u_texsize_icon:new t.Uniform2f(e,r.u_texsize_icon),u_texture:new t.Uniform1i(e,r.u_texture),u_texture_icon:new t.Uniform1i(e,r.u_texture_icon),u_gamma_scale:new t.Uniform1f(e,r.u_gamma_scale),u_device_pixel_ratio:new t.Uniform1f(e,r.u_device_pixel_ratio),u_is_halo:new t.Uniform1i(e,r.u_is_halo)}},background:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_opacity:new t.Uniform1f(e,r.u_opacity),u_color:new t.UniformColor(e,r.u_color)}},backgroundPattern:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_opacity:new t.Uniform1f(e,r.u_opacity),u_image:new t.Uniform1i(e,r.u_image),u_pattern_tl_a:new t.Uniform2f(e,r.u_pattern_tl_a),u_pattern_br_a:new t.Uniform2f(e,r.u_pattern_br_a),u_pattern_tl_b:new t.Uniform2f(e,r.u_pattern_tl_b),u_pattern_br_b:new t.Uniform2f(e,r.u_pattern_br_b),u_texsize:new t.Uniform2f(e,r.u_texsize),u_mix:new t.Uniform1f(e,r.u_mix),u_pattern_size_a:new t.Uniform2f(e,r.u_pattern_size_a),u_pattern_size_b:new t.Uniform2f(e,r.u_pattern_size_b),u_scale_a:new t.Uniform1f(e,r.u_scale_a),u_scale_b:new t.Uniform1f(e,r.u_scale_b),u_pixel_coord_upper:new t.Uniform2f(e,r.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,r.u_pixel_coord_lower),u_tile_units_to_pixels:new t.Uniform1f(e,r.u_tile_units_to_pixels)}}};function Kr(e,r,n,i,o,a,s){for(var u=e.context,l=u.gl,c=e.useProgram("collisionBox"),p=[],h=0,f=0,d=0;d<i.length;d++){var m=i[d],y=r.getTile(m),g=y.getBucket(n);if(g){var v=m.posMatrix;0===o[0]&&0===o[1]||(v=e.translatePosMatrix(m.posMatrix,y,o,a));var _=s?g.textCollisionBox:g.iconCollisionBox,x=g.collisionCircleArray;if(x.length>0){var b=t.create(),w=v;t.mul(b,g.placementInvProjMatrix,e.transform.glCoordMatrix),t.mul(b,b,g.placementViewportMatrix),p.push({circleArray:x,circleOffset:f,transform:w,invTransform:b}),f=h+=x.length/4}_&&c.draw(u,l.LINES,Et.disabled,Tt.disabled,e.colorModeForRenderPass(),It.disabled,Cr(v,e.transform,y),n.id,_.layoutVertexBuffer,_.indexBuffer,_.segments,null,e.transform.zoom,null,null,_.collisionVertexBuffer)}}if(s&&p.length){var S=e.useProgram("collisionCircle"),A=new t.StructArrayLayout2f1f2i16;A.resize(4*h),A._trim();for(var E=0,T=0,k=p;T<k.length;T+=1)for(var I=k[T],z=0;z<I.circleArray.length/4;z++){var C=4*z,P=I.circleArray[C+0],M=I.circleArray[C+1],D=I.circleArray[C+2],L=I.circleArray[C+3];A.emplace(E++,P,M,D,L,0),A.emplace(E++,P,M,D,L,1),A.emplace(E++,P,M,D,L,2),A.emplace(E++,P,M,D,L,3)}(!qr||qr.length<2*h)&&(qr=function(e){var r=2*e,n=new t.StructArrayLayout3ui6;n.resize(r),n._trim();for(var i=0;i<r;i++){var o=6*i;n.uint16[o+0]=4*i+0,n.uint16[o+1]=4*i+1,n.uint16[o+2]=4*i+2,n.uint16[o+3]=4*i+2,n.uint16[o+4]=4*i+3,n.uint16[o+5]=4*i+0}return n}(h));for(var B=u.createIndexBuffer(qr,!0),R=u.createVertexBuffer(A,t.collisionCircleLayout.members,!0),O=0,F=p;O<F.length;O+=1){var V=F[O],U=Pr(V.transform,V.invTransform,e.transform);S.draw(u,l.TRIANGLES,Et.disabled,Tt.disabled,e.colorModeForRenderPass(),It.disabled,U,n.id,R,B,t.SegmentVector.simpleSegment(0,2*V.circleOffset,V.circleArray.length,V.circleArray.length/2),null,e.transform.zoom,null,null,null)}R.destroy(),B.destroy()}}var Yr=t.identity(new Float32Array(16));function Jr(e,r,n,i,o,a){var s=t.getAnchorAlignment(e),u=-(s.horizontalAlign-.5)*r,l=-(s.verticalAlign-.5)*n,c=t.evaluateVariableOffset(e,i);return new t.Point((u/o+c[0])*a,(l/o+c[1])*a)}function Qr(e,r,n,i,o,a,s,u,l,c,p){var h=e.text.placedSymbolArray,f=e.text.dynamicLayoutVertexArray,d=e.icon.dynamicLayoutVertexArray,m={};f.clear();for(var y=0;y<h.length;y++){var g=h.get(y),v=g.hidden||!g.crossTileID||e.allowVerticalPlacement&&!g.placedOrientation?null:i[g.crossTileID];if(v){var _=new t.Point(g.anchorX,g.anchorY),x=Qt(_,n?u:s),b=te(a.cameraToCenterDistance,x.signedDistanceFromCamera),w=o.evaluateSizeForFeature(e.textSizeData,c,g)*b/t.ONE_EM;n&&(w*=e.tilePixelRatio/l);for(var S=Jr(v.anchor,v.width,v.height,v.textOffset,v.textBoxScale,w),A=n?Qt(_.add(S),s).point:x.point.add(r?S.rotate(-a.angle):S),E=e.allowVerticalPlacement&&g.placedOrientation===t.WritingMode.vertical?Math.PI/2:0,T=0;T<g.numGlyphs;T++)t.addDynamicAttributes(f,A,E);p&&g.associatedIconIndex>=0&&(m[g.associatedIconIndex]={shiftedAnchor:A,angle:E})}else le(g.numGlyphs,f)}if(p){d.clear();for(var k=e.icon.placedSymbolArray,I=0;I<k.length;I++){var z=k.get(I);if(z.hidden)le(z.numGlyphs,d);else{var C=m[I];if(C)for(var P=0;P<z.numGlyphs;P++)t.addDynamicAttributes(d,C.shiftedAnchor,C.angle);else le(z.numGlyphs,d)}}e.icon.dynamicLayoutVertexBuffer.updateData(d)}e.text.dynamicLayoutVertexBuffer.updateData(f)}function tn(t,e,r){return r.iconsInText&&e?"symbolTextAndIcon":t?"symbolSDF":"symbolIcon"}function en(e,r,n,i,o,a,s,u,l,c,p,h){for(var f=e.context,d=f.gl,m=e.transform,y="map"===u,g="map"===l,v=y&&"point"!==n.layout.get("symbol-placement"),_=y&&!g&&!v,x=void 0!==n.layout.get("symbol-sort-key").constantOr(1),b=!1,w=e.depthModeForSublayer(0,Et.ReadOnly),S=n.layout.get("text-variable-anchor"),A=[],E=0,T=i;E<T.length;E+=1){var k=T[E],I=r.getTile(k),z=I.getBucket(n);if(z){var C=o?z.text:z.icon;if(C&&C.segments.get().length){var P=C.programConfigurations.get(n.id),M=o||z.sdfIcons,D=o?z.textSizeData:z.iconSizeData,L=g||0!==m.pitch,B=e.useProgram(tn(M,o,z),P),R=t.evaluateSizeForZoom(D,m.zoom),O=void 0,F=[0,0],V=void 0,U=void 0,j=null,N=void 0;if(o)V=I.glyphAtlasTexture,U=d.LINEAR,O=I.glyphAtlasTexture.size,z.iconsInText&&(F=I.imageAtlasTexture.size,j=I.imageAtlasTexture,N=L||e.options.rotating||e.options.zooming||"composite"===D.kind||"camera"===D.kind?d.LINEAR:d.NEAREST);else{var q=1!==n.layout.get("icon-size").constantOr(0)||z.iconsNeedLinear;V=I.imageAtlasTexture,U=M||e.options.rotating||e.options.zooming||q||L?d.LINEAR:d.NEAREST,O=I.imageAtlasTexture.size}var $=he(I,1,e.transform.zoom),Z=Yt(k.posMatrix,g,y,e.transform,$),G=Jt(k.posMatrix,g,y,e.transform,$),W=S&&z.hasTextData(),X="none"!==n.layout.get("icon-text-fit")&&W&&z.hasIconData();v&&re(z,k.posMatrix,e,o,Z,G,g,c);var H=e.translatePosMatrix(k.posMatrix,I,a,s),K=v||o&&S||X?Yr:Z,Y=e.translatePosMatrix(G,I,a,s,!0),J=M&&0!==n.paint.get(o?"text-halo-width":"icon-halo-width").constantOr(1),Q={program:B,buffers:C,uniformValues:M?z.iconsInText?Gr(D.kind,R,_,g,e,H,K,Y,O,F):Zr(D.kind,R,_,g,e,H,K,Y,o,O,!0):$r(D.kind,R,_,g,e,H,K,Y,o,O),atlasTexture:V,atlasTextureIcon:j,atlasInterpolation:U,atlasInterpolationIcon:N,isSDF:M,hasHalo:J};if(x&&z.canOverlap){b=!0;for(var tt=0,et=C.segments.get();tt<et.length;tt+=1){var rt=et[tt];A.push({segments:new t.SegmentVector([rt]),sortKey:rt.sortKey,state:Q})}}else A.push({segments:C.segments,sortKey:0,state:Q})}}}b&&A.sort((function(t,e){return t.sortKey-e.sortKey}));for(var nt=0,it=A;nt<it.length;nt+=1){var ot=it[nt],at=ot.state;if(f.activeTexture.set(d.TEXTURE0),at.atlasTexture.bind(at.atlasInterpolation,d.CLAMP_TO_EDGE),at.atlasTextureIcon&&(f.activeTexture.set(d.TEXTURE1),at.atlasTextureIcon&&at.atlasTextureIcon.bind(at.atlasInterpolationIcon,d.CLAMP_TO_EDGE)),at.isSDF){var st=at.uniformValues;at.hasHalo&&(st.u_is_halo=1,rn(at.buffers,ot.segments,n,e,at.program,w,p,h,st)),st.u_is_halo=0}rn(at.buffers,ot.segments,n,e,at.program,w,p,h,at.uniformValues)}}function rn(t,e,r,n,i,o,a,s,u){var l=n.context;i.draw(l,l.gl.TRIANGLES,o,a,s,It.disabled,u,r.id,t.layoutVertexBuffer,t.indexBuffer,e,r.paint,n.transform.zoom,t.programConfigurations.get(r.id),t.dynamicLayoutVertexBuffer,t.opacityVertexBuffer)}function nn(t,e,r,n,i,o,a){var s,u,l,c,p,h=t.context.gl,f=r.paint.get("fill-pattern"),d=f&&f.constantOr(1),m=r.getCrossfadeParameters();a?(u=d&&!r.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",s=h.LINES):(u=d?"fillPattern":"fill",s=h.TRIANGLES);for(var y=0,g=n;y<g.length;y+=1){var v=g[y],_=e.getTile(v);if(!d||_.patternsLoaded()){var x=_.getBucket(r);if(x){var b=x.programConfigurations.get(r.id),w=t.useProgram(u,b);d&&(t.context.activeTexture.set(h.TEXTURE0),_.imageAtlasTexture.bind(h.LINEAR,h.CLAMP_TO_EDGE),b.updatePaintBuffers(m));var S=f.constantOr(null);if(S&&_.imageAtlas){var A=_.imageAtlas,E=A.patternPositions[S.to.toString()],T=A.patternPositions[S.from.toString()];E&&T&&b.setConstantPatternPositions(E,T)}var k=t.translatePosMatrix(v.posMatrix,_,r.paint.get("fill-translate"),r.paint.get("fill-translate-anchor"));if(a){c=x.indexBuffer2,p=x.segments2;var I=[h.drawingBufferWidth,h.drawingBufferHeight];l="fillOutlinePattern"===u&&d?Ir(k,t,m,_,I):kr(k,I)}else c=x.indexBuffer,p=x.segments,l=d?Tr(k,t,m,_):Er(k);w.draw(t.context,s,i,t.stencilModeForClipping(v),o,It.disabled,l,r.id,x.layoutVertexBuffer,c,p,r.paint,t.transform.zoom,b)}}}}function on(t,e,r,n,i,o,a){for(var s=t.context,u=s.gl,l=r.paint.get("fill-extrusion-pattern"),c=l.constantOr(1),p=r.getCrossfadeParameters(),h=r.paint.get("fill-extrusion-opacity"),f=0,d=n;f<d.length;f+=1){var m=d[f],y=e.getTile(m),g=y.getBucket(r);if(g){var v=g.programConfigurations.get(r.id),_=t.useProgram(c?"fillExtrusionPattern":"fillExtrusion",v);c&&(t.context.activeTexture.set(u.TEXTURE0),y.imageAtlasTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE),v.updatePaintBuffers(p));var x=l.constantOr(null);if(x&&y.imageAtlas){var b=y.imageAtlas,w=b.patternPositions[x.to.toString()],S=b.patternPositions[x.from.toString()];w&&S&&v.setConstantPatternPositions(w,S)}var A=t.translatePosMatrix(m.posMatrix,y,r.paint.get("fill-extrusion-translate"),r.paint.get("fill-extrusion-translate-anchor")),E=r.paint.get("fill-extrusion-vertical-gradient"),T=c?Ar(A,t,E,h,m,p,y):Sr(A,t,E,h);_.draw(s,s.gl.TRIANGLES,i,o,a,It.backCCW,T,r.id,g.layoutVertexBuffer,g.indexBuffer,g.segments,r.paint,t.transform.zoom,v)}}}function an(e,r,n,i,o,a){var s=e.context,u=s.gl,l=r.fbo;if(l){var c=e.useProgram("hillshade");s.activeTexture.set(u.TEXTURE0),u.bindTexture(u.TEXTURE_2D,l.colorAttachment.get());var p=function(e,r,n){var i=n.paint.get("hillshade-shadow-color"),o=n.paint.get("hillshade-highlight-color"),a=n.paint.get("hillshade-accent-color"),s=n.paint.get("hillshade-illumination-direction")*(Math.PI/180);"viewport"===n.paint.get("hillshade-illumination-anchor")&&(s-=e.transform.angle);var u,l,c,p=!e.options.moving;return{u_matrix:e.transform.calculatePosMatrix(r.tileID.toUnwrapped(),p),u_image:0,u_latrange:(u=r.tileID,l=Math.pow(2,u.canonical.z),c=u.canonical.y,[new t.MercatorCoordinate(0,c/l).toLngLat().lat,new t.MercatorCoordinate(0,(c+1)/l).toLngLat().lat]),u_light:[n.paint.get("hillshade-exaggeration"),s],u_shadow:i,u_highlight:o,u_accent:a}}(e,r,n);c.draw(s,u.TRIANGLES,i,o,a,It.disabled,p,n.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments)}}function sn(e,r,n,i,o,a){var s=e.context,u=s.gl,l=r.dem;if(l&&l.data){var c=l.dim,p=l.stride,h=l.getPixels();if(s.activeTexture.set(u.TEXTURE1),s.pixelStoreUnpackPremultiplyAlpha.set(!1),r.demTexture=r.demTexture||e.getTileTexture(p),r.demTexture){var f=r.demTexture;f.update(h,{premultiply:!1}),f.bind(u.NEAREST,u.CLAMP_TO_EDGE)}else r.demTexture=new t.Texture(s,h,u.RGBA,{premultiply:!1}),r.demTexture.bind(u.NEAREST,u.CLAMP_TO_EDGE);s.activeTexture.set(u.TEXTURE0);var d=r.fbo;if(!d){var m=new t.Texture(s,{width:c,height:c,data:null},u.RGBA);m.bind(u.LINEAR,u.CLAMP_TO_EDGE),(d=r.fbo=s.createFramebuffer(c,c,!0)).colorAttachment.set(m.texture)}s.bindFramebuffer.set(d.framebuffer),s.viewport.set([0,0,c,c]),e.useProgram("hillshadePrepare").draw(s,u.TRIANGLES,i,o,a,It.disabled,function(e,r){var n=r.stride,i=t.create();return t.ortho(i,0,t.EXTENT,-t.EXTENT,0,0,1),t.translate(i,i,[0,-t.EXTENT,0]),{u_matrix:i,u_image:1,u_dimension:[n,n],u_zoom:e.overscaledZ,u_unpack:r.getUnpackVector()}}(r.tileID,l),n.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments),r.needsHillshadePrepare=!1}}function un(e,r,n,i,o){var a=i.paint.get("raster-fade-duration");if(a>0){var s=t.browser.now(),u=(s-e.timeAdded)/a,l=r?(s-r.timeAdded)/a:-1,c=n.getSource(),p=o.coveringZoomLevel({tileSize:c.tileSize,roundZoom:c.roundZoom}),h=!r||Math.abs(r.tileID.overscaledZ-p)>Math.abs(e.tileID.overscaledZ-p),f=h&&e.refreshedUponExpiration?1:t.clamp(h?u:1-l,0,1);return e.refreshedUponExpiration&&u>=1&&(e.refreshedUponExpiration=!1),r?{opacity:1,mix:1-f}:{opacity:f,mix:0}}return{opacity:1,mix:0}}var ln=new t.Color(1,0,0,1),cn=new t.Color(0,1,0,1),pn=new t.Color(0,0,1,1),hn=new t.Color(1,0,1,1),fn=new t.Color(0,1,1,1);function dn(t,e,r,n){yn(t,0,e+r/2,t.transform.width,r,n)}function mn(t,e,r,n){yn(t,e-r/2,0,r,t.transform.height,n)}function yn(e,r,n,i,o,a){var s=e.context,u=s.gl;u.enable(u.SCISSOR_TEST),u.scissor(r*t.browser.devicePixelRatio,n*t.browser.devicePixelRatio,i*t.browser.devicePixelRatio,o*t.browser.devicePixelRatio),s.clear({color:a}),u.disable(u.SCISSOR_TEST)}function gn(e,r,n){var i=e.context,o=i.gl,a=n.posMatrix,s=e.useProgram("debug"),u=Et.disabled,l=Tt.disabled,c=e.colorModeForRenderPass();i.activeTexture.set(o.TEXTURE0),e.emptyTexture.bind(o.LINEAR,o.CLAMP_TO_EDGE),s.draw(i,o.LINE_STRIP,u,l,c,It.disabled,Mr(a,t.Color.red),"$debug",e.debugBuffer,e.tileBorderIndexBuffer,e.debugSegments);var p=r.getTileByID(n.key).latestRawTileData,h=Math.floor((p&&p.byteLength||0)/1024),f=r.getTile(n).tileSize,d=512/Math.min(f,512)*(n.overscaledZ/e.transform.zoom)*.5,m=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(m+=" => "+n.overscaledZ),function(t,e){t.initDebugOverlayCanvas();var r=t.debugOverlayCanvas,n=t.context.gl,i=t.debugOverlayCanvas.getContext("2d");i.clearRect(0,0,r.width,r.height),i.shadowColor="white",i.shadowBlur=2,i.lineWidth=1.5,i.strokeStyle="white",i.textBaseline="top",i.font="bold 36px Open Sans, sans-serif",i.fillText(e,5,5),i.strokeText(e,5,5),t.debugOverlayTexture.update(r),t.debugOverlayTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}(e,m+" "+h+"kb"),s.draw(i,o.TRIANGLES,u,l,kt.alphaBlended,It.disabled,Mr(a,t.Color.transparent,d),"$debug",e.debugBuffer,e.quadTriangleIndexBuffer,e.debugSegments)}var vn={symbol:function(e,r,n,i,o){if("translucent"===e.renderPass){var a=Tt.disabled,s=e.colorModeForRenderPass();n.layout.get("text-variable-anchor")&&function(e,r,n,i,o,a,s){for(var u=r.transform,l="map"===o,c="map"===a,p=0,h=e;p<h.length;p+=1){var f=h[p],d=i.getTile(f),m=d.getBucket(n);if(m&&m.text&&m.text.segments.get().length){var y=t.evaluateSizeForZoom(m.textSizeData,u.zoom),g=he(d,1,r.transform.zoom),v=Yt(f.posMatrix,c,l,r.transform,g),_="none"!==n.layout.get("icon-text-fit")&&m.hasIconData();if(y){var x=Math.pow(2,u.zoom-d.tileID.overscaledZ);Qr(m,l,c,s,t.symbolSize,u,v,f.posMatrix,x,y,_)}}}}(i,e,n,r,n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),o),0!==n.paint.get("icon-opacity").constantOr(1)&&en(e,r,n,i,!1,n.paint.get("icon-translate"),n.paint.get("icon-translate-anchor"),n.layout.get("icon-rotation-alignment"),n.layout.get("icon-pitch-alignment"),n.layout.get("icon-keep-upright"),a,s),0!==n.paint.get("text-opacity").constantOr(1)&&en(e,r,n,i,!0,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),n.layout.get("text-keep-upright"),a,s),r.map.showCollisionBoxes&&(Kr(e,r,n,i,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),!0),Kr(e,r,n,i,n.paint.get("icon-translate"),n.paint.get("icon-translate-anchor"),!1))}},circle:function(e,r,n,i){if("translucent"===e.renderPass){var o=n.paint.get("circle-opacity"),a=n.paint.get("circle-stroke-width"),s=n.paint.get("circle-stroke-opacity"),u=void 0!==n.layout.get("circle-sort-key").constantOr(1);if(0!==o.constantOr(1)||0!==a.constantOr(1)&&0!==s.constantOr(1)){for(var l=e.context,c=l.gl,p=e.depthModeForSublayer(0,Et.ReadOnly),h=Tt.disabled,f=e.colorModeForRenderPass(),d=[],m=0;m<i.length;m++){var y=i[m],g=r.getTile(y),v=g.getBucket(n);if(v){var _=v.programConfigurations.get(n.id),x={programConfiguration:_,program:e.useProgram("circle",_),layoutVertexBuffer:v.layoutVertexBuffer,indexBuffer:v.indexBuffer,uniformValues:zr(e,y,g,n)};if(u)for(var b=0,w=v.segments.get();b<w.length;b+=1){var S=w[b];d.push({segments:new t.SegmentVector([S]),sortKey:S.sortKey,state:x})}else d.push({segments:v.segments,sortKey:0,state:x})}}u&&d.sort((function(t,e){return t.sortKey-e.sortKey}));for(var A=0,E=d;A<E.length;A+=1){var T=E[A],k=T.state;k.program.draw(l,c.TRIANGLES,p,h,f,It.disabled,k.uniformValues,n.id,k.layoutVertexBuffer,k.indexBuffer,T.segments,n.paint,e.transform.zoom,k.programConfiguration)}}}},heatmap:function(e,r,n,i){if(0!==n.paint.get("heatmap-opacity"))if("offscreen"===e.renderPass){var o=e.context,a=o.gl,s=Tt.disabled,u=new kt([a.ONE,a.ONE],t.Color.transparent,[!0,!0,!0,!0]);!function(t,e,r){var n=t.gl;t.activeTexture.set(n.TEXTURE1),t.viewport.set([0,0,e.width/4,e.height/4]);var i=r.heatmapFbo;if(i)n.bindTexture(n.TEXTURE_2D,i.colorAttachment.get()),t.bindFramebuffer.set(i.framebuffer);else{var o=n.createTexture();n.bindTexture(n.TEXTURE_2D,o),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),i=r.heatmapFbo=t.createFramebuffer(e.width/4,e.height/4,!1),function(t,e,r,n){var i=t.gl;i.texImage2D(i.TEXTURE_2D,0,i.RGBA,e.width/4,e.height/4,0,i.RGBA,t.extRenderToTextureHalfFloat?t.extTextureHalfFloat.HALF_FLOAT_OES:i.UNSIGNED_BYTE,null),n.colorAttachment.set(r)}(t,e,o,i)}}(o,e,n),o.clear({color:t.Color.transparent});for(var l=0;l<i.length;l++){var c=i[l];if(!r.hasRenderableParent(c)){var p=r.getTile(c),h=p.getBucket(n);if(h){var f=h.programConfigurations.get(n.id);e.useProgram("heatmap",f).draw(o,a.TRIANGLES,Et.disabled,s,u,It.disabled,Lr(c.posMatrix,p,e.transform.zoom,n.paint.get("heatmap-intensity")),n.id,h.layoutVertexBuffer,h.indexBuffer,h.segments,n.paint,e.transform.zoom,f)}}}o.viewport.set([0,0,e.width,e.height])}else"translucent"===e.renderPass&&(e.context.setColorMode(e.colorModeForRenderPass()),function(e,r){var n=e.context,i=n.gl,o=r.heatmapFbo;if(o){n.activeTexture.set(i.TEXTURE0),i.bindTexture(i.TEXTURE_2D,o.colorAttachment.get()),n.activeTexture.set(i.TEXTURE1);var a=r.colorRampTexture;a||(a=r.colorRampTexture=new t.Texture(n,r.colorRamp,i.RGBA)),a.bind(i.LINEAR,i.CLAMP_TO_EDGE),e.useProgram("heatmapTexture").draw(n,i.TRIANGLES,Et.disabled,Tt.disabled,e.colorModeForRenderPass(),It.disabled,function(e,r,n,i){var o=t.create();t.ortho(o,0,e.width,e.height,0,0,1);var a=e.context.gl;return{u_matrix:o,u_world:[a.drawingBufferWidth,a.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:r.paint.get("heatmap-opacity")}}(e,r),r.id,e.viewportBuffer,e.quadTriangleIndexBuffer,e.viewportSegments,r.paint,e.transform.zoom)}}(e,n))},line:function(e,r,n,i){if("translucent"===e.renderPass){var o=n.paint.get("line-opacity"),a=n.paint.get("line-width");if(0!==o.constantOr(1)&&0!==a.constantOr(1))for(var s=e.depthModeForSublayer(0,Et.ReadOnly),u=e.colorModeForRenderPass(),l=n.paint.get("line-dasharray"),c=n.paint.get("line-pattern"),p=c.constantOr(1),h=n.paint.get("line-gradient"),f=n.getCrossfadeParameters(),d=p?"linePattern":l?"lineSDF":h?"lineGradient":"line",m=e.context,y=m.gl,g=!0,v=0,_=i;v<_.length;v+=1){var x=_[v],b=r.getTile(x);if(!p||b.patternsLoaded()){var w=b.getBucket(n);if(w){var S=w.programConfigurations.get(n.id),A=e.context.program.get(),E=e.useProgram(d,S),T=g||E.program!==A,k=c.constantOr(null);if(k&&b.imageAtlas){var I=b.imageAtlas,z=I.patternPositions[k.to.toString()],C=I.patternPositions[k.from.toString()];z&&C&&S.setConstantPatternPositions(z,C)}var P=p?Or(e,b,n,f):l?Fr(e,b,n,l,f):h?Rr(e,b,n,w.lineClipsArray.length):Br(e,b,n);if(p)m.activeTexture.set(y.TEXTURE0),b.imageAtlasTexture.bind(y.LINEAR,y.CLAMP_TO_EDGE),S.updatePaintBuffers(f);else if(l&&(T||e.lineAtlas.dirty))m.activeTexture.set(y.TEXTURE0),e.lineAtlas.bind(m);else if(h){var M=w.gradients[n.id],D=M.texture;if(n.gradientVersion!==M.version){var L=256;if(n.stepInterpolant){var B=r.getSource().maxzoom,R=x.canonical.z===B?Math.ceil(1<<e.transform.maxZoom-x.canonical.z):1;L=t.clamp(t.nextPowerOfTwo(w.maxLineLength/t.EXTENT*1024*R),256,m.maxTextureSize)}M.gradient=t.renderColorRamp({expression:n.gradientExpression(),evaluationKey:"lineProgress",resolution:L,image:M.gradient||void 0,clips:w.lineClipsArray}),M.texture?M.texture.update(M.gradient):M.texture=new t.Texture(m,M.gradient,y.RGBA),M.version=n.gradientVersion,D=M.texture}m.activeTexture.set(y.TEXTURE0),D.bind(n.stepInterpolant?y.NEAREST:y.LINEAR,y.CLAMP_TO_EDGE)}E.draw(m,y.TRIANGLES,s,e.stencilModeForClipping(x),u,It.disabled,P,n.id,w.layoutVertexBuffer,w.indexBuffer,w.segments,n.paint,e.transform.zoom,S,w.layoutVertexBuffer2),g=!1}}}}},fill:function(e,r,n,i){var o=n.paint.get("fill-color"),a=n.paint.get("fill-opacity");if(0!==a.constantOr(1)){var s=e.colorModeForRenderPass(),u=n.paint.get("fill-pattern"),l=e.opaquePassEnabledForLayer()&&!u.constantOr(1)&&1===o.constantOr(t.Color.transparent).a&&1===a.constantOr(0)?"opaque":"translucent";if(e.renderPass===l){var c=e.depthModeForSublayer(1,"opaque"===e.renderPass?Et.ReadWrite:Et.ReadOnly);nn(e,r,n,i,c,s,!1)}if("translucent"===e.renderPass&&n.paint.get("fill-antialias")){var p=e.depthModeForSublayer(n.getPaintProperty("fill-outline-color")?2:0,Et.ReadOnly);nn(e,r,n,i,p,s,!0)}}},"fill-extrusion":function(t,e,r,n){var i=r.paint.get("fill-extrusion-opacity");if(0!==i&&"translucent"===t.renderPass){var o=new Et(t.context.gl.LEQUAL,Et.ReadWrite,t.depthRangeFor3D);if(1!==i||r.paint.get("fill-extrusion-pattern").constantOr(1))on(t,e,r,n,o,Tt.disabled,kt.disabled),on(t,e,r,n,o,t.stencilModeFor3D(),t.colorModeForRenderPass());else{var a=t.colorModeForRenderPass();on(t,e,r,n,o,Tt.disabled,a)}}},hillshade:function(t,e,r,n){if("offscreen"===t.renderPass||"translucent"===t.renderPass){for(var i=t.context,o=t.depthModeForSublayer(0,Et.ReadOnly),a=t.colorModeForRenderPass(),s="translucent"===t.renderPass?t.stencilConfigForOverlap(n):[{},n],u=s[0],l=0,c=s[1];l<c.length;l+=1){var p=c[l],h=e.getTile(p);h.needsHillshadePrepare&&"offscreen"===t.renderPass?sn(t,h,r,o,Tt.disabled,a):"translucent"===t.renderPass&&an(t,h,r,o,u[p.overscaledZ],a)}i.viewport.set([0,0,t.width,t.height])}},raster:function(t,e,r,n){if("translucent"===t.renderPass&&0!==r.paint.get("raster-opacity")&&n.length)for(var i=t.context,o=i.gl,a=e.getSource(),s=t.useProgram("raster"),u=t.colorModeForRenderPass(),l=a instanceof M?[{},n]:t.stencilConfigForOverlap(n),c=l[0],p=l[1],h=p[p.length-1].overscaledZ,f=!t.options.moving,d=0,m=p;d<m.length;d+=1){var y=m[d],g=t.depthModeForSublayer(y.overscaledZ-h,1===r.paint.get("raster-opacity")?Et.ReadWrite:Et.ReadOnly,o.LESS),v=e.getTile(y),_=t.transform.calculatePosMatrix(y.toUnwrapped(),f);v.registerFadeDuration(r.paint.get("raster-fade-duration"));var x=e.findLoadedParent(y,0),b=un(v,x,e,r,t.transform),w=void 0,S=void 0,A="nearest"===r.paint.get("raster-resampling")?o.NEAREST:o.LINEAR;i.activeTexture.set(o.TEXTURE0),v.texture.bind(A,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST),i.activeTexture.set(o.TEXTURE1),x?(x.texture.bind(A,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST),w=Math.pow(2,x.tileID.overscaledZ-v.tileID.overscaledZ),S=[v.tileID.canonical.x*w%1,v.tileID.canonical.y*w%1]):v.texture.bind(A,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST);var E=jr(_,S||[0,0],w||1,b,r);a instanceof M?s.draw(i,o.TRIANGLES,g,Tt.disabled,u,It.disabled,E,r.id,a.boundsBuffer,t.quadTriangleIndexBuffer,a.boundsSegments):s.draw(i,o.TRIANGLES,g,c[y.overscaledZ],u,It.disabled,E,r.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments)}},background:function(t,e,r){var n=r.paint.get("background-color"),i=r.paint.get("background-opacity");if(0!==i){var o=t.context,a=o.gl,s=t.transform,u=s.tileSize,l=r.paint.get("background-pattern");if(!t.isPatternMissing(l)){var c=!l&&1===n.a&&1===i&&t.opaquePassEnabledForLayer()?"opaque":"translucent";if(t.renderPass===c){var p=Tt.disabled,h=t.depthModeForSublayer(0,"opaque"===c?Et.ReadWrite:Et.ReadOnly),f=t.colorModeForRenderPass(),d=t.useProgram(l?"backgroundPattern":"background"),m=s.coveringTiles({tileSize:u});l&&(o.activeTexture.set(a.TEXTURE0),t.imageManager.bind(t.context));for(var y=r.getCrossfadeParameters(),g=0,v=m;g<v.length;g+=1){var _=v[g],x=t.transform.calculatePosMatrix(_.toUnwrapped()),b=l?Xr(x,i,t,l,{tileID:_,tileSize:u},y):Wr(x,i,n);d.draw(o,a.TRIANGLES,h,p,f,It.disabled,b,r.id,t.tileExtentBuffer,t.quadTriangleIndexBuffer,t.tileExtentSegments)}}}}},debug:function(t,e,r){for(var n=0;n<r.length;n++)gn(t,e,r[n])},custom:function(t,e,r){var n=t.context,i=r.implementation;if("offscreen"===t.renderPass){var o=i.prerender;o&&(t.setCustomLayerDefaults(),n.setColorMode(t.colorModeForRenderPass()),o.call(i,n.gl,t.transform.customLayerMatrix()),n.setDirty(),t.setBaseState())}else if("translucent"===t.renderPass){t.setCustomLayerDefaults(),n.setColorMode(t.colorModeForRenderPass()),n.setStencilMode(Tt.disabled);var a="3d"===i.renderingMode?new Et(t.context.gl.LEQUAL,Et.ReadWrite,t.depthRangeFor3D):t.depthModeForSublayer(0,Et.ReadOnly);n.setDepthMode(a),i.render(n.gl,t.transform.customLayerMatrix()),n.setDirty(),t.setBaseState(),n.bindFramebuffer.set(null)}}},_n=function(t,e){this.context=new zt(t),this.transform=e,this._tileTextures={},this.setup(),this.numSublayers=Ct.maxUnderzooming+Ct.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Fe,this.gpuTimers={}};_n.prototype.resize=function(e,r){if(this.width=e*t.browser.devicePixelRatio,this.height=r*t.browser.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(var n=0,i=this.style._order;n<i.length;n+=1)this.style._layers[i[n]].resize()},_n.prototype.setup=function(){var e=this.context,r=new t.StructArrayLayout2i4;r.emplaceBack(0,0),r.emplaceBack(t.EXTENT,0),r.emplaceBack(0,t.EXTENT),r.emplaceBack(t.EXTENT,t.EXTENT),this.tileExtentBuffer=e.createVertexBuffer(r,$e.members),this.tileExtentSegments=t.SegmentVector.simpleSegment(0,0,4,2);var n=new t.StructArrayLayout2i4;n.emplaceBack(0,0),n.emplaceBack(t.EXTENT,0),n.emplaceBack(0,t.EXTENT),n.emplaceBack(t.EXTENT,t.EXTENT),this.debugBuffer=e.createVertexBuffer(n,$e.members),this.debugSegments=t.SegmentVector.simpleSegment(0,0,4,5);var i=new t.StructArrayLayout4i8;i.emplaceBack(0,0,0,0),i.emplaceBack(t.EXTENT,0,t.EXTENT,0),i.emplaceBack(0,t.EXTENT,0,t.EXTENT),i.emplaceBack(t.EXTENT,t.EXTENT,t.EXTENT,t.EXTENT),this.rasterBoundsBuffer=e.createVertexBuffer(i,P.members),this.rasterBoundsSegments=t.SegmentVector.simpleSegment(0,0,4,2);var o=new t.StructArrayLayout2i4;o.emplaceBack(0,0),o.emplaceBack(1,0),o.emplaceBack(0,1),o.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(o,$e.members),this.viewportSegments=t.SegmentVector.simpleSegment(0,0,4,2);var a=new t.StructArrayLayout1ui2;a.emplaceBack(0),a.emplaceBack(1),a.emplaceBack(3),a.emplaceBack(2),a.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(a);var s=new t.StructArrayLayout3ui6;s.emplaceBack(0,1,2),s.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(s),this.emptyTexture=new t.Texture(e,{width:1,height:1,data:new Uint8Array([0,0,0,0])},e.gl.RGBA);var u=this.context.gl;this.stencilClearMode=new Tt({func:u.ALWAYS,mask:0},0,255,u.ZERO,u.ZERO,u.ZERO)},_n.prototype.clearStencil=function(){var e=this.context,r=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;var n=t.create();t.ortho(n,0,this.width,this.height,0,0,1),t.scale(n,n,[r.drawingBufferWidth,r.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(e,r.TRIANGLES,Et.disabled,this.stencilClearMode,kt.disabled,It.disabled,Dr(n),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)},_n.prototype._renderTileClippingMasks=function(t,e){if(this.currentStencilSource!==t.source&&t.isTileClipped()&&e&&e.length){this.currentStencilSource=t.source;var r=this.context,n=r.gl;this.nextStencilID+e.length>256&&this.clearStencil(),r.setColorMode(kt.disabled),r.setDepthMode(Et.disabled);var i=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(var o=0,a=e;o<a.length;o+=1){var s=a[o],u=this._tileClippingMaskIDs[s.key]=this.nextStencilID++;i.draw(r,n.TRIANGLES,Et.disabled,new Tt({func:n.ALWAYS,mask:0},u,255,n.KEEP,n.KEEP,n.REPLACE),kt.disabled,It.disabled,Dr(s.posMatrix),"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}},_n.prototype.stencilModeFor3D=function(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();var t=this.nextStencilID++,e=this.context.gl;return new Tt({func:e.NOTEQUAL,mask:255},t,255,e.KEEP,e.KEEP,e.REPLACE)},_n.prototype.stencilModeForClipping=function(t){var e=this.context.gl;return new Tt({func:e.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,e.KEEP,e.KEEP,e.REPLACE)},_n.prototype.stencilConfigForOverlap=function(t){var e,r=this.context.gl,n=t.sort((function(t,e){return e.overscaledZ-t.overscaledZ})),i=n[n.length-1].overscaledZ,o=n[0].overscaledZ-i+1;if(o>1){this.currentStencilSource=void 0,this.nextStencilID+o>256&&this.clearStencil();for(var a={},s=0;s<o;s++)a[s+i]=new Tt({func:r.GEQUAL,mask:255},s+this.nextStencilID,255,r.KEEP,r.KEEP,r.REPLACE);return this.nextStencilID+=o,[a,n]}return[(e={},e[i]=Tt.disabled,e),n]},_n.prototype.colorModeForRenderPass=function(){var e=this.context.gl;return this._showOverdrawInspector?new kt([e.CONSTANT_COLOR,e.ONE],new t.Color(1/8,1/8,1/8,0),[!0,!0,!0,!0]):"opaque"===this.renderPass?kt.unblended:kt.alphaBlended},_n.prototype.depthModeForSublayer=function(t,e,r){if(!this.opaquePassEnabledForLayer())return Et.disabled;var n=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new Et(r||this.context.gl.LEQUAL,e,[n,n])},_n.prototype.opaquePassEnabledForLayer=function(){return this.currentLayer<this.opaquePassCutoff},_n.prototype.render=function(e,r){var n=this;this.style=e,this.options=r,this.lineAtlas=e.lineAtlas,this.imageManager=e.imageManager,this.glyphManager=e.glyphManager,this.symbolFadeChange=e.placement.symbolFadeChange(t.browser.now()),this.imageManager.beginFrame();var i=this.style._order,o=this.style.sourceCaches;for(var a in o){var s=o[a];s.used&&s.prepare(this.context)}var u,l,c={},p={},h={};for(var f in o){var d=o[f];c[f]=d.getVisibleCoordinates(),p[f]=c[f].slice().reverse(),h[f]=d.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(var m=0;m<i.length;m++)if(this.style._layers[i[m]].is3D()){this.opaquePassCutoff=m;break}this.renderPass="offscreen";for(var y=0,g=i;y<g.length;y+=1){var v=this.style._layers[g[y]];if(v.hasOffscreenPass()&&!v.isHidden(this.transform.zoom)){var _=p[v.source];("custom"===v.type||_.length)&&this.renderLayer(this,o[v.source],v,_)}}for(this.context.bindFramebuffer.set(null),this.context.clear({color:r.showOverdrawInspector?t.Color.black:t.Color.transparent,depth:1}),this.clearStencil(),this._showOverdrawInspector=r.showOverdrawInspector,this.depthRangeFor3D=[0,1-(e._order.length+2)*this.numSublayers*this.depthEpsilon],this.renderPass="opaque",this.currentLayer=i.length-1;this.currentLayer>=0;this.currentLayer--){var x=this.style._layers[i[this.currentLayer]],b=o[x.source],w=c[x.source];this._renderTileClippingMasks(x,w),this.renderLayer(this,b,x,w)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<i.length;this.currentLayer++){var S=this.style._layers[i[this.currentLayer]],A=o[S.source],E=("symbol"===S.type?h:p)[S.source];this._renderTileClippingMasks(S,c[S.source]),this.renderLayer(this,A,S,E)}this.options.showTileBoundaries&&(t.values(this.style._layers).forEach((function(t){t.source&&!t.isHidden(n.transform.zoom)&&(t.source!==(l&&l.id)&&(l=n.style.sourceCaches[t.source]),(!u||u.getSource().maxzoom<l.getSource().maxzoom)&&(u=l))})),u&&vn.debug(this,u,u.getVisibleCoordinates())),this.options.showPadding&&function(t){var e=t.transform.padding;dn(t,t.transform.height-(e.top||0),3,ln),dn(t,e.bottom||0,3,cn),mn(t,e.left||0,3,pn),mn(t,t.transform.width-(e.right||0),3,hn);var r=t.transform.centerPoint;!function(t,e,r,n){yn(t,e-1,r-10,2,20,n),yn(t,e-10,r-1,20,2,n)}(t,r.x,t.transform.height-r.y,fn)}(this),this.context.setDefault()},_n.prototype.renderLayer=function(t,e,r,n){r.isHidden(this.transform.zoom)||("background"===r.type||"custom"===r.type||n.length)&&(this.id=r.id,this.gpuTimingStart(r),vn[r.type](t,e,r,n,this.style.placement.variableOffsets),this.gpuTimingEnd())},_n.prototype.gpuTimingStart=function(t){if(this.options.gpuTiming){var e=this.context.extTimerQuery,r=this.gpuTimers[t.id];r||(r=this.gpuTimers[t.id]={calls:0,cpuTime:0,query:e.createQueryEXT()}),r.calls++,e.beginQueryEXT(e.TIME_ELAPSED_EXT,r.query)}},_n.prototype.gpuTimingEnd=function(){if(this.options.gpuTiming){var t=this.context.extTimerQuery;t.endQueryEXT(t.TIME_ELAPSED_EXT)}},_n.prototype.collectGpuTimers=function(){var t=this.gpuTimers;return this.gpuTimers={},t},_n.prototype.queryGpuTimers=function(t){var e={};for(var r in t){var n=t[r],i=this.context.extTimerQuery,o=i.getQueryObjectEXT(n.query,i.QUERY_RESULT_EXT)/1e6;i.deleteQueryEXT(n.query),e[r]=o}return e},_n.prototype.translatePosMatrix=function(e,r,n,i,o){if(!n[0]&&!n[1])return e;var a=o?"map"===i?this.transform.angle:0:"viewport"===i?-this.transform.angle:0;if(a){var s=Math.sin(a),u=Math.cos(a);n=[n[0]*u-n[1]*s,n[0]*s+n[1]*u]}var l=[o?n[0]:he(r,n[0],this.transform.zoom),o?n[1]:he(r,n[1],this.transform.zoom),0],c=new Float32Array(16);return t.translate(c,e,l),c},_n.prototype.saveTileTexture=function(t){var e=this._tileTextures[t.size[0]];e?e.push(t):this._tileTextures[t.size[0]]=[t]},_n.prototype.getTileTexture=function(t){var e=this._tileTextures[t];return e&&e.length>0?e.pop():null},_n.prototype.isPatternMissing=function(t){if(!t)return!1;if(!t.from||!t.to)return!0;var e=this.imageManager.getPattern(t.from.toString()),r=this.imageManager.getPattern(t.to.toString());return!e||!r},_n.prototype.useProgram=function(t,e){this.cache=this.cache||{};var r=""+t+(e?e.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"");return this.cache[r]||(this.cache[r]=new br(this.context,t,vr[t],e,Hr[t],this._showOverdrawInspector)),this.cache[r]},_n.prototype.setCustomLayerDefaults=function(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()},_n.prototype.setBaseState=function(){var t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)},_n.prototype.initDebugOverlayCanvas=function(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=t.window.document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new t.Texture(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))},_n.prototype.destroy=function(){this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy()};var xn=function(t,e){this.points=t,this.planes=e};xn.fromInvProjectionMatrix=function(e,r,n){var i=Math.pow(2,n),o=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map((function(r){return t.transformMat4([],r,e)})).map((function(e){return t.scale$1([],e,1/e[3]/r*i)})),a=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map((function(e){var r=t.sub([],o[e[0]],o[e[1]]),n=t.sub([],o[e[2]],o[e[1]]),i=t.normalize([],t.cross([],r,n)),a=-t.dot(i,o[e[1]]);return i.concat(a)}));return new xn(o,a)};var bn=function(e,r){this.min=e,this.max=r,this.center=t.scale$2([],t.add([],this.min,this.max),.5)};bn.prototype.quadrant=function(e){for(var r=[e%2==0,e<2],n=t.clone$2(this.min),i=t.clone$2(this.max),o=0;o<r.length;o++)n[o]=r[o]?this.min[o]:this.center[o],i[o]=r[o]?this.center[o]:this.max[o];return i[2]=this.max[2],new bn(n,i)},bn.prototype.distanceX=function(t){return Math.max(Math.min(this.max[0],t[0]),this.min[0])-t[0]},bn.prototype.distanceY=function(t){return Math.max(Math.min(this.max[1],t[1]),this.min[1])-t[1]},bn.prototype.intersects=function(e){for(var r=[[this.min[0],this.min[1],0,1],[this.max[0],this.min[1],0,1],[this.max[0],this.max[1],0,1],[this.min[0],this.max[1],0,1]],n=!0,i=0;i<e.planes.length;i++){for(var o=e.planes[i],a=0,s=0;s<r.length;s++)a+=t.dot$1(o,r[s])>=0;if(0===a)return 0;a!==r.length&&(n=!1)}if(n)return 2;for(var u=0;u<3;u++){for(var l=Number.MAX_VALUE,c=-Number.MAX_VALUE,p=0;p<e.points.length;p++){var h=e.points[p][u]-this.min[u];l=Math.min(l,h),c=Math.max(c,h)}if(c<0||l>this.max[u]-this.min[u])return 0}return 1};var wn=function(t,e,r,n){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=0),isNaN(t)||t<0||isNaN(e)||e<0||isNaN(r)||r<0||isNaN(n)||n<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=e,this.left=r,this.right=n};wn.prototype.interpolate=function(e,r,n){return null!=r.top&&null!=e.top&&(this.top=t.number(e.top,r.top,n)),null!=r.bottom&&null!=e.bottom&&(this.bottom=t.number(e.bottom,r.bottom,n)),null!=r.left&&null!=e.left&&(this.left=t.number(e.left,r.left,n)),null!=r.right&&null!=e.right&&(this.right=t.number(e.right,r.right,n)),this},wn.prototype.getCenter=function(e,r){var n=t.clamp((this.left+e-this.right)/2,0,e),i=t.clamp((this.top+r-this.bottom)/2,0,r);return new t.Point(n,i)},wn.prototype.equals=function(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right},wn.prototype.clone=function(){return new wn(this.top,this.bottom,this.left,this.right)},wn.prototype.toJSON=function(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}};var Sn=function(e,r,n,i,o){this.tileSize=512,this.maxValidLatitude=85.051129,this._renderWorldCopies=void 0===o||o,this._minZoom=e||0,this._maxZoom=r||22,this._minPitch=null==n?0:n,this._maxPitch=null==i?60:i,this.setMaxBounds(),this.width=0,this.height=0,this._center=new t.LngLat(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new wn,this._posMatrixCache={},this._alignedPosMatrixCache={}},An={minZoom:{configurable:!0},maxZoom:{configurable:!0},minPitch:{configurable:!0},maxPitch:{configurable:!0},renderWorldCopies:{configurable:!0},worldSize:{configurable:!0},centerOffset:{configurable:!0},size:{configurable:!0},bearing:{configurable:!0},pitch:{configurable:!0},fov:{configurable:!0},zoom:{configurable:!0},center:{configurable:!0},padding:{configurable:!0},centerPoint:{configurable:!0},unmodified:{configurable:!0},point:{configurable:!0}};Sn.prototype.clone=function(){var t=new Sn(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return t.tileSize=this.tileSize,t.latRange=this.latRange,t.width=this.width,t.height=this.height,t._center=this._center,t.zoom=this.zoom,t.angle=this.angle,t._fov=this._fov,t._pitch=this._pitch,t._unmodified=this._unmodified,t._edgeInsets=this._edgeInsets.clone(),t._calcMatrices(),t},An.minZoom.get=function(){return this._minZoom},An.minZoom.set=function(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))},An.maxZoom.get=function(){return this._maxZoom},An.maxZoom.set=function(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))},An.minPitch.get=function(){return this._minPitch},An.minPitch.set=function(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))},An.maxPitch.get=function(){return this._maxPitch},An.maxPitch.set=function(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))},An.renderWorldCopies.get=function(){return this._renderWorldCopies},An.renderWorldCopies.set=function(t){void 0===t?t=!0:null===t&&(t=!1),this._renderWorldCopies=t},An.worldSize.get=function(){return this.tileSize*this.scale},An.centerOffset.get=function(){return this.centerPoint._sub(this.size._div(2))},An.size.get=function(){return new t.Point(this.width,this.height)},An.bearing.get=function(){return-this.angle/Math.PI*180},An.bearing.set=function(e){var r=-t.wrap(e,-180,180)*Math.PI/180;this.angle!==r&&(this._unmodified=!1,this.angle=r,this._calcMatrices(),this.rotationMatrix=t.create$2(),t.rotate(this.rotationMatrix,this.rotationMatrix,this.angle))},An.pitch.get=function(){return this._pitch/Math.PI*180},An.pitch.set=function(e){var r=t.clamp(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==r&&(this._unmodified=!1,this._pitch=r,this._calcMatrices())},An.fov.get=function(){return this._fov/Math.PI*180},An.fov.set=function(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=t/180*Math.PI,this._calcMatrices())},An.zoom.get=function(){return this._zoom},An.zoom.set=function(t){var e=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==e&&(this._unmodified=!1,this._zoom=e,this.scale=this.zoomScale(e),this.tileZoom=Math.floor(e),this.zoomFraction=e-this.tileZoom,this._constrain(),this._calcMatrices())},An.center.get=function(){return this._center},An.center.set=function(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices())},An.padding.get=function(){return this._edgeInsets.toJSON()},An.padding.set=function(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())},An.centerPoint.get=function(){return this._edgeInsets.getCenter(this.width,this.height)},Sn.prototype.isPaddingEqual=function(t){return this._edgeInsets.equals(t)},Sn.prototype.interpolatePadding=function(t,e,r){this._unmodified=!1,this._edgeInsets.interpolate(t,e,r),this._constrain(),this._calcMatrices()},Sn.prototype.coveringZoomLevel=function(t){var e=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,e)},Sn.prototype.getVisibleUnwrappedCoordinates=function(e){var r=[new t.UnwrappedTileID(0,e)];if(this._renderWorldCopies)for(var n=this.pointCoordinate(new t.Point(0,0)),i=this.pointCoordinate(new t.Point(this.width,0)),o=this.pointCoordinate(new t.Point(this.width,this.height)),a=this.pointCoordinate(new t.Point(0,this.height)),s=Math.floor(Math.min(n.x,i.x,o.x,a.x)),u=Math.floor(Math.max(n.x,i.x,o.x,a.x)),l=s-1;l<=u+1;l++)0!==l&&r.push(new t.UnwrappedTileID(l,e));return r},Sn.prototype.coveringTiles=function(e){var r=this.coveringZoomLevel(e),n=r;if(void 0!==e.minzoom&&r<e.minzoom)return[];void 0!==e.maxzoom&&r>e.maxzoom&&(r=e.maxzoom);var i=t.MercatorCoordinate.fromLngLat(this.center),o=Math.pow(2,r),a=[o*i.x,o*i.y,0],s=xn.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,r),u=e.minzoom||0;this.pitch<=60&&this._edgeInsets.top<.1&&(u=r);var l=function(t){return{aabb:new bn([t*o,0,0],[(t+1)*o,o,0]),zoom:0,x:0,y:0,wrap:t,fullyVisible:!1}},c=[],p=[],h=r,f=e.reparseOverscaled?n:r;if(this._renderWorldCopies)for(var d=1;d<=3;d++)c.push(l(-d)),c.push(l(d));for(c.push(l(0));c.length>0;){var m=c.pop(),y=m.x,g=m.y,v=m.fullyVisible;if(!v){var _=m.aabb.intersects(s);if(0===_)continue;v=2===_}var x=m.aabb.distanceX(a),b=m.aabb.distanceY(a),w=Math.max(Math.abs(x),Math.abs(b));if(m.zoom===h||w>3+(1<<h-m.zoom)-2&&m.zoom>=u)p.push({tileID:new t.OverscaledTileID(m.zoom===h?f:m.zoom,m.wrap,m.zoom,y,g),distanceSq:t.sqrLen([a[0]-.5-y,a[1]-.5-g])});else for(var S=0;S<4;S++){var A=(y<<1)+S%2,E=(g<<1)+(S>>1);c.push({aabb:m.aabb.quadrant(S),zoom:m.zoom+1,x:A,y:E,wrap:m.wrap,fullyVisible:v})}}return p.sort((function(t,e){return t.distanceSq-e.distanceSq})).map((function(t){return t.tileID}))},Sn.prototype.resize=function(t,e){this.width=t,this.height=e,this.pixelsToGLUnits=[2/t,-2/e],this._constrain(),this._calcMatrices()},An.unmodified.get=function(){return this._unmodified},Sn.prototype.zoomScale=function(t){return Math.pow(2,t)},Sn.prototype.scaleZoom=function(t){return Math.log(t)/Math.LN2},Sn.prototype.project=function(e){var r=t.clamp(e.lat,-this.maxValidLatitude,this.maxValidLatitude);return new t.Point(t.mercatorXfromLng(e.lng)*this.worldSize,t.mercatorYfromLat(r)*this.worldSize)},Sn.prototype.unproject=function(e){return new t.MercatorCoordinate(e.x/this.worldSize,e.y/this.worldSize).toLngLat()},An.point.get=function(){return this.project(this.center)},Sn.prototype.setLocationAtPoint=function(e,r){var n=this.pointCoordinate(r),i=this.pointCoordinate(this.centerPoint),o=this.locationCoordinate(e),a=new t.MercatorCoordinate(o.x-(n.x-i.x),o.y-(n.y-i.y));this.center=this.coordinateLocation(a),this._renderWorldCopies&&(this.center=this.center.wrap())},Sn.prototype.locationPoint=function(t){return this.coordinatePoint(this.locationCoordinate(t))},Sn.prototype.pointLocation=function(t){return this.coordinateLocation(this.pointCoordinate(t))},Sn.prototype.locationCoordinate=function(e){return t.MercatorCoordinate.fromLngLat(e)},Sn.prototype.coordinateLocation=function(t){return t.toLngLat()},Sn.prototype.pointCoordinate=function(e){var r=[e.x,e.y,0,1],n=[e.x,e.y,1,1];t.transformMat4(r,r,this.pixelMatrixInverse),t.transformMat4(n,n,this.pixelMatrixInverse);var i=r[3],o=n[3],a=r[1]/i,s=n[1]/o,u=r[2]/i,l=n[2]/o,c=u===l?0:(0-u)/(l-u);return new t.MercatorCoordinate(t.number(r[0]/i,n[0]/o,c)/this.worldSize,t.number(a,s,c)/this.worldSize)},Sn.prototype.coordinatePoint=function(e){var r=[e.x*this.worldSize,e.y*this.worldSize,0,1];return t.transformMat4(r,r,this.pixelMatrix),new t.Point(r[0]/r[3],r[1]/r[3])},Sn.prototype.getBounds=function(){return(new t.LngLatBounds).extend(this.pointLocation(new t.Point(0,0))).extend(this.pointLocation(new t.Point(this.width,0))).extend(this.pointLocation(new t.Point(this.width,this.height))).extend(this.pointLocation(new t.Point(0,this.height)))},Sn.prototype.getMaxBounds=function(){return this.latRange&&2===this.latRange.length&&this.lngRange&&2===this.lngRange.length?new t.LngLatBounds([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null},Sn.prototype.setMaxBounds=function(t){t?(this.lngRange=[t.getWest(),t.getEast()],this.latRange=[t.getSouth(),t.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])},Sn.prototype.calculatePosMatrix=function(e,r){void 0===r&&(r=!1);var n=e.key,i=r?this._alignedPosMatrixCache:this._posMatrixCache;if(i[n])return i[n];var o=e.canonical,a=this.worldSize/this.zoomScale(o.z),s=o.x+Math.pow(2,o.z)*e.wrap,u=t.identity(new Float64Array(16));return t.translate(u,u,[s*a,o.y*a,0]),t.scale(u,u,[a/t.EXTENT,a/t.EXTENT,1]),t.multiply(u,r?this.alignedProjMatrix:this.projMatrix,u),i[n]=new Float32Array(u),i[n]},Sn.prototype.customLayerMatrix=function(){return this.mercatorMatrix.slice()},Sn.prototype._constrain=function(){if(this.center&&this.width&&this.height&&!this._constraining){this._constraining=!0;var e,r,n,i,o=-90,a=90,s=-180,u=180,l=this.size,c=this._unmodified;if(this.latRange){var p=this.latRange;o=t.mercatorYfromLat(p[1])*this.worldSize,e=(a=t.mercatorYfromLat(p[0])*this.worldSize)-o<l.y?l.y/(a-o):0}if(this.lngRange){var h=this.lngRange;s=t.mercatorXfromLng(h[0])*this.worldSize,r=(u=t.mercatorXfromLng(h[1])*this.worldSize)-s<l.x?l.x/(u-s):0}var f=this.point,d=Math.max(r||0,e||0);if(d)return this.center=this.unproject(new t.Point(r?(u+s)/2:f.x,e?(a+o)/2:f.y)),this.zoom+=this.scaleZoom(d),this._unmodified=c,void(this._constraining=!1);if(this.latRange){var m=f.y,y=l.y/2;m-y<o&&(i=o+y),m+y>a&&(i=a-y)}if(this.lngRange){var g=f.x,v=l.x/2;g-v<s&&(n=s+v),g+v>u&&(n=u-v)}void 0===n&&void 0===i||(this.center=this.unproject(new t.Point(void 0!==n?n:f.x,void 0!==i?i:f.y))),this._unmodified=c,this._constraining=!1}},Sn.prototype._calcMatrices=function(){if(this.height){var e=this.centerOffset;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height;var r=Math.PI/2+this._pitch,n=this._fov*(.5+e.y/this.height),i=Math.sin(n)*this.cameraToCenterDistance/Math.sin(t.clamp(Math.PI-r-n,.01,Math.PI-.01)),o=this.point,a=o.x,s=o.y,u=1.01*(Math.cos(Math.PI/2-this._pitch)*i+this.cameraToCenterDistance),l=this.height/50,c=new Float64Array(16);t.perspective(c,this._fov,this.width/this.height,l,u),c[8]=2*-e.x/this.width,c[9]=2*e.y/this.height,t.scale(c,c,[1,-1,1]),t.translate(c,c,[0,0,-this.cameraToCenterDistance]),t.rotateX(c,c,this._pitch),t.rotateZ(c,c,this.angle),t.translate(c,c,[-a,-s,0]),this.mercatorMatrix=t.scale([],c,[this.worldSize,this.worldSize,this.worldSize]),t.scale(c,c,[1,1,t.mercatorZfromAltitude(1,this.center.lat)*this.worldSize,1]),this.projMatrix=c,this.invProjMatrix=t.invert([],this.projMatrix);var p=this.width%2/2,h=this.height%2/2,f=Math.cos(this.angle),d=Math.sin(this.angle),m=a-Math.round(a)+f*p+d*h,y=s-Math.round(s)+f*h+d*p,g=new Float64Array(c);if(t.translate(g,g,[m>.5?m-1:m,y>.5?y-1:y,0]),this.alignedProjMatrix=g,c=t.create(),t.scale(c,c,[this.width/2,-this.height/2,1]),t.translate(c,c,[1,-1,0]),this.labelPlaneMatrix=c,c=t.create(),t.scale(c,c,[1,-1,1]),t.translate(c,c,[-1,-1,0]),t.scale(c,c,[2/this.width,2/this.height,1]),this.glCoordMatrix=c,this.pixelMatrix=t.multiply(new Float64Array(16),this.labelPlaneMatrix,this.projMatrix),!(c=t.invert(new Float64Array(16),this.pixelMatrix)))throw new Error("failed to invert matrix");this.pixelMatrixInverse=c,this._posMatrixCache={},this._alignedPosMatrixCache={}}},Sn.prototype.maxPitchScaleFactor=function(){if(!this.pixelMatrixInverse)return 1;var e=this.pointCoordinate(new t.Point(0,0)),r=[e.x*this.worldSize,e.y*this.worldSize,0,1];return t.transformMat4(r,r,this.pixelMatrix)[3]/this.cameraToCenterDistance},Sn.prototype.getCameraPoint=function(){var e=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new t.Point(0,e))},Sn.prototype.getCameraQueryGeometry=function(e){var r=this.getCameraPoint();if(1===e.length)return[e[0],r];for(var n=r.x,i=r.y,o=r.x,a=r.y,s=0,u=e;s<u.length;s+=1){var l=u[s];n=Math.min(n,l.x),i=Math.min(i,l.y),o=Math.max(o,l.x),a=Math.max(a,l.y)}return[new t.Point(n,i),new t.Point(o,i),new t.Point(o,a),new t.Point(n,a),new t.Point(n,i)]},Object.defineProperties(Sn.prototype,An);var En=function(e){var r,n,i,o;this._hashName=e&&encodeURIComponent(e),t.bindAll(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=(r=this._updateHashUnthrottled.bind(this),n=!1,i=null,o=function(){i=null,n&&(r(),i=setTimeout(o,300),n=!1)},function(){return n=!0,i||o(),i})};En.prototype.addTo=function(e){return this._map=e,t.window.addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this},En.prototype.remove=function(){return t.window.removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this},En.prototype.getHashString=function(e){var r=this._map.getCenter(),n=Math.round(100*this._map.getZoom())/100,i=Math.ceil((n*Math.LN2+Math.log(512/360/.5))/Math.LN10),o=Math.pow(10,i),a=Math.round(r.lng*o)/o,s=Math.round(r.lat*o)/o,u=this._map.getBearing(),l=this._map.getPitch(),c="";if(c+=e?"/"+a+"/"+s+"/"+n:n+"/"+s+"/"+a,(u||l)&&(c+="/"+Math.round(10*u)/10),l&&(c+="/"+Math.round(l)),this._hashName){var p=this._hashName,h=!1,f=t.window.location.hash.slice(1).split("&").map((function(t){var e=t.split("=")[0];return e===p?(h=!0,e+"="+c):t})).filter((function(t){return t}));return h||f.push(p+"="+c),"#"+f.join("&")}return"#"+c},En.prototype._getCurrentHash=function(){var e,r=this,n=t.window.location.hash.replace("#","");return this._hashName?(n.split("&").map((function(t){return t.split("=")})).forEach((function(t){t[0]===r._hashName&&(e=t)})),(e&&e[1]||"").split("/")):n.split("/")},En.prototype._onHashChange=function(){var t=this._getCurrentHash();if(t.length>=3&&!t.some((function(t){return isNaN(t)}))){var e=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(t[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:e,pitch:+(t[4]||0)}),!0}return!1},En.prototype._updateHashUnthrottled=function(){var e=t.window.location.href.replace(/(#.+)?$/,this.getHashString());try{t.window.history.replaceState(t.window.history.state,null,e)}catch(t){}};var Tn={linearity:.3,easing:t.bezier(0,0,.3,1)},kn=t.extend({deceleration:2500,maxSpeed:1400},Tn),In=t.extend({deceleration:20,maxSpeed:1400},Tn),zn=t.extend({deceleration:1e3,maxSpeed:360},Tn),Cn=t.extend({deceleration:1e3,maxSpeed:90},Tn),Pn=function(t){this._map=t,this.clear()};function Mn(t,e){(!t.duration||t.duration<e.duration)&&(t.duration=e.duration,t.easing=e.easing)}function Dn(e,r,n){var i=n.maxSpeed,o=n.linearity,a=n.deceleration,s=t.clamp(e*o/(r/1e3),-i,i),u=Math.abs(s)/(a*o);return{easing:n.easing,duration:1e3*u,amount:s*(u/2)}}Pn.prototype.clear=function(){this._inertiaBuffer=[]},Pn.prototype.record=function(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:t.browser.now(),settings:e})},Pn.prototype._drainInertiaBuffer=function(){for(var e=this._inertiaBuffer,r=t.browser.now();e.length>0&&r-e[0].time>160;)e.shift()},Pn.prototype._onMoveEnd=function(e){if(this._drainInertiaBuffer(),!(this._inertiaBuffer.length<2)){for(var r={zoom:0,bearing:0,pitch:0,pan:new t.Point(0,0),pinchAround:void 0,around:void 0},n=0,i=this._inertiaBuffer;n<i.length;n+=1){var o=i[n].settings;r.zoom+=o.zoomDelta||0,r.bearing+=o.bearingDelta||0,r.pitch+=o.pitchDelta||0,o.panDelta&&r.pan._add(o.panDelta),o.around&&(r.around=o.around),o.pinchAround&&(r.pinchAround=o.pinchAround)}var a=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,s={};if(r.pan.mag()){var u=Dn(r.pan.mag(),a,t.extend({},kn,e||{}));s.offset=r.pan.mult(u.amount/r.pan.mag()),s.center=this._map.transform.center,Mn(s,u)}if(r.zoom){var l=Dn(r.zoom,a,In);s.zoom=this._map.transform.zoom+l.amount,Mn(s,l)}if(r.bearing){var c=Dn(r.bearing,a,zn);s.bearing=this._map.transform.bearing+t.clamp(c.amount,-179,179),Mn(s,c)}if(r.pitch){var p=Dn(r.pitch,a,Cn);s.pitch=this._map.transform.pitch+p.amount,Mn(s,p)}if(s.zoom||s.bearing){var h=void 0===r.pinchAround?r.around:r.pinchAround;s.around=h?this._map.unproject(h):this._map.getCenter()}return this.clear(),t.extend(s,{noMoveStart:!0})}};var Ln=function(e){function n(n,i,o,a){void 0===a&&(a={});var s=r.mousePos(i.getCanvasContainer(),o),u=i.unproject(s);e.call(this,n,t.extend({point:s,lngLat:u,originalEvent:o},a)),this._defaultPrevented=!1,this.target=i}e&&(n.__proto__=e),(n.prototype=Object.create(e&&e.prototype)).constructor=n;var i={defaultPrevented:{configurable:!0}};return n.prototype.preventDefault=function(){this._defaultPrevented=!0},i.defaultPrevented.get=function(){return this._defaultPrevented},Object.defineProperties(n.prototype,i),n}(t.Event),Bn=function(e){function n(n,i,o){var a="touchend"===n?o.changedTouches:o.touches,s=r.touchPos(i.getCanvasContainer(),a),u=s.map((function(t){return i.unproject(t)})),l=s.reduce((function(t,e,r,n){return t.add(e.div(n.length))}),new t.Point(0,0)),c=i.unproject(l);e.call(this,n,{points:s,point:l,lngLats:u,lngLat:c,originalEvent:o}),this._defaultPrevented=!1}e&&(n.__proto__=e),(n.prototype=Object.create(e&&e.prototype)).constructor=n;var i={defaultPrevented:{configurable:!0}};return n.prototype.preventDefault=function(){this._defaultPrevented=!0},i.defaultPrevented.get=function(){return this._defaultPrevented},Object.defineProperties(n.prototype,i),n}(t.Event),Rn=function(t){function e(e,r,n){t.call(this,e,{originalEvent:n}),this._defaultPrevented=!1}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={defaultPrevented:{configurable:!0}};return e.prototype.preventDefault=function(){this._defaultPrevented=!0},r.defaultPrevented.get=function(){return this._defaultPrevented},Object.defineProperties(e.prototype,r),e}(t.Event),On=function(t,e){this._map=t,this._clickTolerance=e.clickTolerance};On.prototype.reset=function(){delete this._mousedownPos},On.prototype.wheel=function(t){return this._firePreventable(new Rn(t.type,this._map,t))},On.prototype.mousedown=function(t,e){return this._mousedownPos=e,this._firePreventable(new Ln(t.type,this._map,t))},On.prototype.mouseup=function(t){this._map.fire(new Ln(t.type,this._map,t))},On.prototype.click=function(t,e){this._mousedownPos&&this._mousedownPos.dist(e)>=this._clickTolerance||this._map.fire(new Ln(t.type,this._map,t))},On.prototype.dblclick=function(t){return this._firePreventable(new Ln(t.type,this._map,t))},On.prototype.mouseover=function(t){this._map.fire(new Ln(t.type,this._map,t))},On.prototype.mouseout=function(t){this._map.fire(new Ln(t.type,this._map,t))},On.prototype.touchstart=function(t){return this._firePreventable(new Bn(t.type,this._map,t))},On.prototype.touchmove=function(t){this._map.fire(new Bn(t.type,this._map,t))},On.prototype.touchend=function(t){this._map.fire(new Bn(t.type,this._map,t))},On.prototype.touchcancel=function(t){this._map.fire(new Bn(t.type,this._map,t))},On.prototype._firePreventable=function(t){if(this._map.fire(t),t.defaultPrevented)return{}},On.prototype.isEnabled=function(){return!0},On.prototype.isActive=function(){return!1},On.prototype.enable=function(){},On.prototype.disable=function(){};var Fn=function(t){this._map=t};Fn.prototype.reset=function(){this._delayContextMenu=!1,delete this._contextMenuEvent},Fn.prototype.mousemove=function(t){this._map.fire(new Ln(t.type,this._map,t))},Fn.prototype.mousedown=function(){this._delayContextMenu=!0},Fn.prototype.mouseup=function(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Ln("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)},Fn.prototype.contextmenu=function(t){this._delayContextMenu?this._contextMenuEvent=t:this._map.fire(new Ln(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()},Fn.prototype.isEnabled=function(){return!0},Fn.prototype.isActive=function(){return!1},Fn.prototype.enable=function(){},Fn.prototype.disable=function(){};var Vn=function(t,e){this._map=t,this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=e.clickTolerance||1};function Un(t,e){for(var r={},n=0;n<t.length;n++)r[t[n].identifier]=e[n];return r}Vn.prototype.isEnabled=function(){return!!this._enabled},Vn.prototype.isActive=function(){return!!this._active},Vn.prototype.enable=function(){this.isEnabled()||(this._enabled=!0)},Vn.prototype.disable=function(){this.isEnabled()&&(this._enabled=!1)},Vn.prototype.mousedown=function(t,e){this.isEnabled()&&t.shiftKey&&0===t.button&&(r.disableDrag(),this._startPos=this._lastPos=e,this._active=!0)},Vn.prototype.mousemoveWindow=function(t,e){if(this._active){var n=e;if(!(this._lastPos.equals(n)||!this._box&&n.dist(this._startPos)<this._clickTolerance)){var i=this._startPos;this._lastPos=n,this._box||(this._box=r.create("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",t));var o=Math.min(i.x,n.x),a=Math.max(i.x,n.x),s=Math.min(i.y,n.y),u=Math.max(i.y,n.y);r.setTransform(this._box,"translate("+o+"px,"+s+"px)"),this._box.style.width=a-o+"px",this._box.style.height=u-s+"px"}}},Vn.prototype.mouseupWindow=function(e,n){var i=this;if(this._active&&0===e.button){var o=this._startPos,a=n;if(this.reset(),r.suppressClick(),o.x!==a.x||o.y!==a.y)return this._map.fire(new t.Event("boxzoomend",{originalEvent:e})),{cameraAnimation:function(t){return t.fitScreenCoordinates(o,a,i._map.getBearing(),{linear:!0})}};this._fireEvent("boxzoomcancel",e)}},Vn.prototype.keydown=function(t){this._active&&27===t.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",t))},Vn.prototype.reset=function(){this._active=!1,this._container.classList.remove("mapboxgl-crosshair"),this._box&&(r.remove(this._box),this._box=null),r.enableDrag(),delete this._startPos,delete this._lastPos},Vn.prototype._fireEvent=function(e,r){return this._map.fire(new t.Event(e,{originalEvent:r}))};var jn=function(t){this.reset(),this.numTouches=t.numTouches};jn.prototype.reset=function(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1},jn.prototype.touchstart=function(e,r,n){(this.centroid||n.length>this.numTouches)&&(this.aborted=!0),this.aborted||(void 0===this.startTime&&(this.startTime=e.timeStamp),n.length===this.numTouches&&(this.centroid=function(e){for(var r=new t.Point(0,0),n=0,i=e;n<i.length;n+=1)r._add(i[n]);return r.div(e.length)}(r),this.touches=Un(n,r)))},jn.prototype.touchmove=function(t,e,r){if(!this.aborted&&this.centroid){var n=Un(r,e);for(var i in this.touches){var o=n[i];(!o||o.dist(this.touches[i])>30)&&(this.aborted=!0)}}},jn.prototype.touchend=function(t,e,r){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),0===r.length){var n=!this.aborted&&this.centroid;if(this.reset(),n)return n}};var Nn=function(t){this.singleTap=new jn(t),this.numTaps=t.numTaps,this.reset()};Nn.prototype.reset=function(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()},Nn.prototype.touchstart=function(t,e,r){this.singleTap.touchstart(t,e,r)},Nn.prototype.touchmove=function(t,e,r){this.singleTap.touchmove(t,e,r)},Nn.prototype.touchend=function(t,e,r){var n=this.singleTap.touchend(t,e,r);if(n){var i=t.timeStamp-this.lastTime<500,o=!this.lastTap||this.lastTap.dist(n)<30;if(i&&o||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=n,this.count===this.numTaps)return this.reset(),n}};var qn=function(){this._zoomIn=new Nn({numTouches:1,numTaps:2}),this._zoomOut=new Nn({numTouches:2,numTaps:1}),this.reset()};qn.prototype.reset=function(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()},qn.prototype.touchstart=function(t,e,r){this._zoomIn.touchstart(t,e,r),this._zoomOut.touchstart(t,e,r)},qn.prototype.touchmove=function(t,e,r){this._zoomIn.touchmove(t,e,r),this._zoomOut.touchmove(t,e,r)},qn.prototype.touchend=function(t,e,r){var n=this,i=this._zoomIn.touchend(t,e,r),o=this._zoomOut.touchend(t,e,r);return i?(this._active=!0,t.preventDefault(),setTimeout((function(){return n.reset()}),0),{cameraAnimation:function(e){return e.easeTo({duration:300,zoom:e.getZoom()+1,around:e.unproject(i)},{originalEvent:t})}}):o?(this._active=!0,t.preventDefault(),setTimeout((function(){return n.reset()}),0),{cameraAnimation:function(e){return e.easeTo({duration:300,zoom:e.getZoom()-1,around:e.unproject(o)},{originalEvent:t})}}):void 0},qn.prototype.touchcancel=function(){this.reset()},qn.prototype.enable=function(){this._enabled=!0},qn.prototype.disable=function(){this._enabled=!1,this.reset()},qn.prototype.isEnabled=function(){return this._enabled},qn.prototype.isActive=function(){return this._active};var $n={0:1,2:2},Zn=function(t){this.reset(),this._clickTolerance=t.clickTolerance||1};Zn.prototype.reset=function(){this._active=!1,this._moved=!1,delete this._lastPoint,delete this._eventButton},Zn.prototype._correctButton=function(t,e){return!1},Zn.prototype._move=function(t,e){return{}},Zn.prototype.mousedown=function(t,e){if(!this._lastPoint){var n=r.mouseButton(t);this._correctButton(t,n)&&(this._lastPoint=e,this._eventButton=n)}},Zn.prototype.mousemoveWindow=function(t,e){var r=this._lastPoint;if(r)if(t.preventDefault(),function(t,e){var r=$n[e];return void 0===t.buttons||(t.buttons&r)!==r}(t,this._eventButton))this.reset();else if(this._moved||!(e.dist(r)<this._clickTolerance))return this._moved=!0,this._lastPoint=e,this._move(r,e)},Zn.prototype.mouseupWindow=function(t){this._lastPoint&&r.mouseButton(t)===this._eventButton&&(this._moved&&r.suppressClick(),this.reset())},Zn.prototype.enable=function(){this._enabled=!0},Zn.prototype.disable=function(){this._enabled=!1,this.reset()},Zn.prototype.isEnabled=function(){return this._enabled},Zn.prototype.isActive=function(){return this._active};var Gn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.mousedown=function(e,r){t.prototype.mousedown.call(this,e,r),this._lastPoint&&(this._active=!0)},e.prototype._correctButton=function(t,e){return 0===e&&!t.ctrlKey},e.prototype._move=function(t,e){return{around:e,panDelta:e.sub(t)}},e}(Zn),Wn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._correctButton=function(t,e){return 0===e&&t.ctrlKey||2===e},e.prototype._move=function(t,e){var r=.8*(e.x-t.x);if(r)return this._active=!0,{bearingDelta:r}},e.prototype.contextmenu=function(t){t.preventDefault()},e}(Zn),Xn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._correctButton=function(t,e){return 0===e&&t.ctrlKey||2===e},e.prototype._move=function(t,e){var r=-.5*(e.y-t.y);if(r)return this._active=!0,{pitchDelta:r}},e.prototype.contextmenu=function(t){t.preventDefault()},e}(Zn),Hn=function(t){this._minTouches=1,this._clickTolerance=t.clickTolerance||1,this.reset()};Hn.prototype.reset=function(){this._active=!1,this._touches={},this._sum=new t.Point(0,0)},Hn.prototype.touchstart=function(t,e,r){return this._calculateTransform(t,e,r)},Hn.prototype.touchmove=function(t,e,r){if(this._active&&!(r.length<this._minTouches))return t.preventDefault(),this._calculateTransform(t,e,r)},Hn.prototype.touchend=function(t,e,r){this._calculateTransform(t,e,r),this._active&&r.length<this._minTouches&&this.reset()},Hn.prototype.touchcancel=function(){this.reset()},Hn.prototype._calculateTransform=function(e,r,n){n.length>0&&(this._active=!0);var i=Un(n,r),o=new t.Point(0,0),a=new t.Point(0,0),s=0;for(var u in i){var l=i[u],c=this._touches[u];c&&(o._add(l),a._add(l.sub(c)),s++,i[u]=l)}if(this._touches=i,!(s<this._minTouches)&&a.mag()){var p=a.div(s);if(this._sum._add(p),!(this._sum.mag()<this._clickTolerance))return{around:o.div(s),panDelta:p}}},Hn.prototype.enable=function(){this._enabled=!0},Hn.prototype.disable=function(){this._enabled=!1,this.reset()},Hn.prototype.isEnabled=function(){return this._enabled},Hn.prototype.isActive=function(){return this._active};var Kn=function(){this.reset()};function Yn(t,e,r){for(var n=0;n<t.length;n++)if(t[n].identifier===r)return e[n]}function Jn(t,e){return Math.log(t/e)/Math.LN2}Kn.prototype.reset=function(){this._active=!1,delete this._firstTwoTouches},Kn.prototype._start=function(t){},Kn.prototype._move=function(t,e,r){return{}},Kn.prototype.touchstart=function(t,e,r){this._firstTwoTouches||r.length<2||(this._firstTwoTouches=[r[0].identifier,r[1].identifier],this._start([e[0],e[1]]))},Kn.prototype.touchmove=function(t,e,r){if(this._firstTwoTouches){t.preventDefault();var n=this._firstTwoTouches,i=n[1],o=Yn(r,e,n[0]),a=Yn(r,e,i);if(o&&a){var s=this._aroundCenter?null:o.add(a).div(2);return this._move([o,a],s,t)}}},Kn.prototype.touchend=function(t,e,n){if(this._firstTwoTouches){var i=this._firstTwoTouches,o=i[1],a=Yn(n,e,i[0]),s=Yn(n,e,o);a&&s||(this._active&&r.suppressClick(),this.reset())}},Kn.prototype.touchcancel=function(){this.reset()},Kn.prototype.enable=function(t){this._enabled=!0,this._aroundCenter=!!t&&"center"===t.around},Kn.prototype.disable=function(){this._enabled=!1,this.reset()},Kn.prototype.isEnabled=function(){return this._enabled},Kn.prototype.isActive=function(){return this._active};var Qn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.reset=function(){t.prototype.reset.call(this),delete this._distance,delete this._startDistance},e.prototype._start=function(t){this._startDistance=this._distance=t[0].dist(t[1])},e.prototype._move=function(t,e){var r=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(Jn(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Jn(this._distance,r),pinchAround:e}},e}(Kn);function ti(t,e){return 180*t.angleWith(e)/Math.PI}var ei=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.reset=function(){t.prototype.reset.call(this),delete this._minDiameter,delete this._startVector,delete this._vector},e.prototype._start=function(t){this._startVector=this._vector=t[0].sub(t[1]),this._minDiameter=t[0].dist(t[1])},e.prototype._move=function(t,e){var r=this._vector;if(this._vector=t[0].sub(t[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:ti(this._vector,r),pinchAround:e}},e.prototype._isBelowThreshold=function(t){this._minDiameter=Math.min(this._minDiameter,t.mag());var e=25/(Math.PI*this._minDiameter)*360,r=ti(t,this._startVector);return Math.abs(r)<e},e}(Kn);function ri(t){return Math.abs(t.y)>Math.abs(t.x)}var ni=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.reset=function(){t.prototype.reset.call(this),this._valid=void 0,delete this._firstMove,delete this._lastPoints},e.prototype._start=function(t){this._lastPoints=t,ri(t[0].sub(t[1]))&&(this._valid=!1)},e.prototype._move=function(t,e,r){var n=t[0].sub(this._lastPoints[0]),i=t[1].sub(this._lastPoints[1]);if(this._valid=this.gestureBeginsVertically(n,i,r.timeStamp),this._valid)return this._lastPoints=t,this._active=!0,{pitchDelta:(n.y+i.y)/2*-.5}},e.prototype.gestureBeginsVertically=function(t,e,r){if(void 0!==this._valid)return this._valid;var n=t.mag()>=2,i=e.mag()>=2;if(n||i){if(!n||!i)return void 0===this._firstMove&&(this._firstMove=r),r-this._firstMove<100&&void 0;var o=t.y>0==e.y>0;return ri(t)&&ri(e)&&o}},e}(Kn),ii={panStep:100,bearingStep:15,pitchStep:10},oi=function(){var t=ii;this._panStep=t.panStep,this._bearingStep=t.bearingStep,this._pitchStep=t.pitchStep,this._rotationDisabled=!1};function ai(t){return t*(2-t)}oi.prototype.reset=function(){this._active=!1},oi.prototype.keydown=function(t){var e=this;if(!(t.altKey||t.ctrlKey||t.metaKey)){var r=0,n=0,i=0,o=0,a=0;switch(t.keyCode){case 61:case 107:case 171:case 187:r=1;break;case 189:case 109:case 173:r=-1;break;case 37:t.shiftKey?n=-1:(t.preventDefault(),o=-1);break;case 39:t.shiftKey?n=1:(t.preventDefault(),o=1);break;case 38:t.shiftKey?i=1:(t.preventDefault(),a=-1);break;case 40:t.shiftKey?i=-1:(t.preventDefault(),a=1);break;default:return}return this._rotationDisabled&&(n=0,i=0),{cameraAnimation:function(s){var u=s.getZoom();s.easeTo({duration:300,easeId:"keyboardHandler",easing:ai,zoom:r?Math.round(u)+r*(t.shiftKey?2:1):u,bearing:s.getBearing()+n*e._bearingStep,pitch:s.getPitch()+i*e._pitchStep,offset:[-o*e._panStep,-a*e._panStep],center:s.getCenter()},{originalEvent:t})}}}},oi.prototype.enable=function(){this._enabled=!0},oi.prototype.disable=function(){this._enabled=!1,this.reset()},oi.prototype.isEnabled=function(){return this._enabled},oi.prototype.isActive=function(){return this._active},oi.prototype.disableRotation=function(){this._rotationDisabled=!0},oi.prototype.enableRotation=function(){this._rotationDisabled=!1};var si=function(e,r){this._map=e,this._el=e.getCanvasContainer(),this._handler=r,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=1/450,t.bindAll(["_onTimeout"],this)};si.prototype.setZoomRate=function(t){this._defaultZoomRate=t},si.prototype.setWheelZoomRate=function(t){this._wheelZoomRate=t},si.prototype.isEnabled=function(){return!!this._enabled},si.prototype.isActive=function(){return!!this._active||void 0!==this._finishTimeout},si.prototype.isZooming=function(){return!!this._zooming},si.prototype.enable=function(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=t&&"center"===t.around)},si.prototype.disable=function(){this.isEnabled()&&(this._enabled=!1)},si.prototype.wheel=function(e){if(this.isEnabled()){var r=e.deltaMode===t.window.WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY,n=t.browser.now(),i=n-(this._lastWheelEventTime||0);this._lastWheelEventTime=n,0!==r&&r%4.000244140625==0?this._type="wheel":0!==r&&Math.abs(r)<4?this._type="trackpad":i>400?(this._type=null,this._lastValue=r,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(i*r)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,r+=this._lastValue)),e.shiftKey&&r&&(r/=4),this._type&&(this._lastWheelEvent=e,this._delta-=r,this._active||this._start(e)),e.preventDefault()}},si.prototype._onTimeout=function(t){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(t)},si.prototype._start=function(e){if(this._delta){this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);var n=r.mousePos(this._el,e);this._around=t.LngLat.convert(this._aroundCenter?this._map.getCenter():this._map.unproject(n)),this._aroundPoint=this._map.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}},si.prototype.renderFrame=function(){var e=this;if(this._frameId&&(this._frameId=null,this.isActive())){var r=this._map.transform;if(0!==this._delta){var n="wheel"===this._type&&Math.abs(this._delta)>4.000244140625?this._wheelZoomRate:this._defaultZoomRate,i=2/(1+Math.exp(-Math.abs(this._delta*n)));this._delta<0&&0!==i&&(i=1/i);var o="number"==typeof this._targetZoom?r.zoomScale(this._targetZoom):r.scale;this._targetZoom=Math.min(r.maxZoom,Math.max(r.minZoom,r.scaleZoom(o*i))),"wheel"===this._type&&(this._startZoom=r.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}var a,s="number"==typeof this._targetZoom?this._targetZoom:r.zoom,u=this._startZoom,l=this._easing,c=!1;if("wheel"===this._type&&u&&l){var p=Math.min((t.browser.now()-this._lastWheelEventTime)/200,1),h=l(p);a=t.number(u,s,h),p<1?this._frameId||(this._frameId=!0):c=!0}else a=s,c=!0;return this._active=!0,c&&(this._active=!1,this._finishTimeout=setTimeout((function(){e._zooming=!1,e._handler._triggerRenderFrame(),delete e._targetZoom,delete e._finishTimeout}),200)),{noInertia:!0,needsRenderFrame:!c,zoomDelta:a-r.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}},si.prototype._smoothOutEasing=function(e){var r=t.ease;if(this._prevEase){var n=this._prevEase,i=(t.browser.now()-n.start)/n.duration,o=n.easing(i+.01)-n.easing(i),a=.27/Math.sqrt(o*o+1e-4)*.01,s=Math.sqrt(.0729-a*a);r=t.bezier(a,s,.25,1)}return this._prevEase={start:t.browser.now(),duration:e,easing:r},r},si.prototype.reset=function(){this._active=!1};var ui=function(t,e){this._clickZoom=t,this._tapZoom=e};ui.prototype.enable=function(){this._clickZoom.enable(),this._tapZoom.enable()},ui.prototype.disable=function(){this._clickZoom.disable(),this._tapZoom.disable()},ui.prototype.isEnabled=function(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()},ui.prototype.isActive=function(){return this._clickZoom.isActive()||this._tapZoom.isActive()};var li=function(){this.reset()};li.prototype.reset=function(){this._active=!1},li.prototype.dblclick=function(t,e){return t.preventDefault(),{cameraAnimation:function(r){r.easeTo({duration:300,zoom:r.getZoom()+(t.shiftKey?-1:1),around:r.unproject(e)},{originalEvent:t})}}},li.prototype.enable=function(){this._enabled=!0},li.prototype.disable=function(){this._enabled=!1,this.reset()},li.prototype.isEnabled=function(){return this._enabled},li.prototype.isActive=function(){return this._active};var ci=function(){this._tap=new Nn({numTouches:1,numTaps:1}),this.reset()};ci.prototype.reset=function(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,this._tap.reset()},ci.prototype.touchstart=function(t,e,r){this._swipePoint||(this._tapTime&&t.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?r.length>0&&(this._swipePoint=e[0],this._swipeTouch=r[0].identifier):this._tap.touchstart(t,e,r))},ci.prototype.touchmove=function(t,e,r){if(this._tapTime){if(this._swipePoint){if(r[0].identifier!==this._swipeTouch)return;var n=e[0],i=n.y-this._swipePoint.y;return this._swipePoint=n,t.preventDefault(),this._active=!0,{zoomDelta:i/128}}}else this._tap.touchmove(t,e,r)},ci.prototype.touchend=function(t,e,r){this._tapTime?this._swipePoint&&0===r.length&&this.reset():this._tap.touchend(t,e,r)&&(this._tapTime=t.timeStamp)},ci.prototype.touchcancel=function(){this.reset()},ci.prototype.enable=function(){this._enabled=!0},ci.prototype.disable=function(){this._enabled=!1,this.reset()},ci.prototype.isEnabled=function(){return this._enabled},ci.prototype.isActive=function(){return this._active};var pi=function(t,e,r){this._el=t,this._mousePan=e,this._touchPan=r};pi.prototype.enable=function(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("mapboxgl-touch-drag-pan")},pi.prototype.disable=function(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("mapboxgl-touch-drag-pan")},pi.prototype.isEnabled=function(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()},pi.prototype.isActive=function(){return this._mousePan.isActive()||this._touchPan.isActive()};var hi=function(t,e,r){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=e,this._mousePitch=r};hi.prototype.enable=function(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()},hi.prototype.disable=function(){this._mouseRotate.disable(),this._mousePitch.disable()},hi.prototype.isEnabled=function(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())},hi.prototype.isActive=function(){return this._mouseRotate.isActive()||this._mousePitch.isActive()};var fi=function(t,e,r,n){this._el=t,this._touchZoom=e,this._touchRotate=r,this._tapDragZoom=n,this._rotationDisabled=!1,this._enabled=!0};fi.prototype.enable=function(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("mapboxgl-touch-zoom-rotate")},fi.prototype.disable=function(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("mapboxgl-touch-zoom-rotate")},fi.prototype.isEnabled=function(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()},fi.prototype.isActive=function(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()},fi.prototype.disableRotation=function(){this._rotationDisabled=!0,this._touchRotate.disable()},fi.prototype.enableRotation=function(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()};var di=function(t){return t.zoom||t.drag||t.pitch||t.rotate},mi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(t.Event);function yi(t){return t.panDelta&&t.panDelta.mag()||t.zoomDelta||t.bearingDelta||t.pitchDelta}var gi=function(e,n){this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Pn(e),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(n),t.bindAll(["handleEvent","handleWindowEvent"],this);var i=this._el;this._listeners=[[i,"touchstart",{passive:!0}],[i,"touchmove",{passive:!1}],[i,"touchend",void 0],[i,"touchcancel",void 0],[i,"mousedown",void 0],[i,"mousemove",void 0],[i,"mouseup",void 0],[t.window.document,"mousemove",{capture:!0}],[t.window.document,"mouseup",void 0],[i,"mouseover",void 0],[i,"mouseout",void 0],[i,"dblclick",void 0],[i,"click",void 0],[i,"keydown",{capture:!1}],[i,"keyup",void 0],[i,"wheel",{passive:!1}],[i,"contextmenu",void 0],[t.window,"blur",void 0]];for(var o=0,a=this._listeners;o<a.length;o+=1){var s=a[o],u=s[0];r.addEventListener(u,s[1],u===t.window.document?this.handleWindowEvent:this.handleEvent,s[2])}};gi.prototype.destroy=function(){for(var e=0,n=this._listeners;e<n.length;e+=1){var i=n[e],o=i[0];r.removeEventListener(o,i[1],o===t.window.document?this.handleWindowEvent:this.handleEvent,i[2])}},gi.prototype._addDefaultHandlers=function(t){var e=this._map,r=e.getCanvasContainer();this._add("mapEvent",new On(e,t));var n=e.boxZoom=new Vn(e,t);this._add("boxZoom",n);var i=new qn,o=new li;e.doubleClickZoom=new ui(o,i),this._add("tapZoom",i),this._add("clickZoom",o);var a=new ci;this._add("tapDragZoom",a);var s=e.touchPitch=new ni;this._add("touchPitch",s);var u=new Wn(t),l=new Xn(t);e.dragRotate=new hi(t,u,l),this._add("mouseRotate",u,["mousePitch"]),this._add("mousePitch",l,["mouseRotate"]);var c=new Gn(t),p=new Hn(t);e.dragPan=new pi(r,c,p),this._add("mousePan",c),this._add("touchPan",p,["touchZoom","touchRotate"]);var h=new ei,f=new Qn;e.touchZoomRotate=new fi(r,f,h,a),this._add("touchRotate",h,["touchPan","touchZoom"]),this._add("touchZoom",f,["touchPan","touchRotate"]);var d=e.scrollZoom=new si(e,this);this._add("scrollZoom",d,["mousePan"]);var m=e.keyboard=new oi;this._add("keyboard",m),this._add("blockableMapEvent",new Fn(e));for(var y=0,g=["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"];y<g.length;y+=1){var v=g[y];t.interactive&&t[v]&&e[v].enable(t[v])}},gi.prototype._add=function(t,e,r){this._handlers.push({handlerName:t,handler:e,allowed:r}),this._handlersById[t]=e},gi.prototype.stop=function(t){if(!this._updatingCamera){for(var e=0,r=this._handlers;e<r.length;e+=1)r[e].handler.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}},gi.prototype.isActive=function(){for(var t=0,e=this._handlers;t<e.length;t+=1)if(e[t].handler.isActive())return!0;return!1},gi.prototype.isZooming=function(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()},gi.prototype.isRotating=function(){return!!this._eventsInProgress.rotate},gi.prototype.isMoving=function(){return Boolean(di(this._eventsInProgress))||this.isZooming()},gi.prototype._blockedByActive=function(t,e,r){for(var n in t)if(n!==r&&(!e||e.indexOf(n)<0))return!0;return!1},gi.prototype.handleWindowEvent=function(t){this.handleEvent(t,t.type+"Window")},gi.prototype._getMapTouches=function(t){for(var e=[],r=0,n=t;r<n.length;r+=1){var i=n[r];this._el.contains(i.target)&&e.push(i)}return e},gi.prototype.handleEvent=function(t,e){if("blur"!==t.type){this._updatingCamera=!0;for(var n="renderFrame"===t.type?void 0:t,i={needsRenderFrame:!1},o={},a={},s=t.touches?this._getMapTouches(t.touches):void 0,u=s?r.touchPos(this._el,s):r.mousePos(this._el,t),l=0,c=this._handlers;l<c.length;l+=1){var p=c[l],h=p.handlerName,f=p.handler,d=p.allowed;if(f.isEnabled()){var m=void 0;this._blockedByActive(a,d,h)?f.reset():f[e||t.type]&&(m=f[e||t.type](t,u,s),this.mergeHandlerResult(i,o,m,h,n),m&&m.needsRenderFrame&&this._triggerRenderFrame()),(m||f.isActive())&&(a[h]=f)}}var y={};for(var g in this._previousActiveHandlers)a[g]||(y[g]=n);this._previousActiveHandlers=a,(Object.keys(y).length||yi(i))&&(this._changes.push([i,o,y]),this._triggerRenderFrame()),(Object.keys(a).length||yi(i))&&this._map._stop(!0),this._updatingCamera=!1;var v=i.cameraAnimation;v&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],v(this._map))}else this.stop(!0)},gi.prototype.mergeHandlerResult=function(e,r,n,i,o){if(n){t.extend(e,n);var a={handlerName:i,originalEvent:n.originalEvent||o};void 0!==n.zoomDelta&&(r.zoom=a),void 0!==n.panDelta&&(r.drag=a),void 0!==n.pitchDelta&&(r.pitch=a),void 0!==n.bearingDelta&&(r.rotate=a)}},gi.prototype._applyChanges=function(){for(var e={},r={},n={},i=0,o=this._changes;i<o.length;i+=1){var a=o[i],s=a[0],u=a[1],l=a[2];s.panDelta&&(e.panDelta=(e.panDelta||new t.Point(0,0))._add(s.panDelta)),s.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+s.zoomDelta),s.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+s.bearingDelta),s.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+s.pitchDelta),void 0!==s.around&&(e.around=s.around),void 0!==s.pinchAround&&(e.pinchAround=s.pinchAround),s.noInertia&&(e.noInertia=s.noInertia),t.extend(r,u),t.extend(n,l)}this._updateMapTransform(e,r,n),this._changes=[]},gi.prototype._updateMapTransform=function(t,e,r){var n=this._map,i=n.transform;if(!yi(t))return this._fireEvents(e,r,!0);var o=t.panDelta,a=t.zoomDelta,s=t.bearingDelta,u=t.pitchDelta,l=t.around,c=t.pinchAround;void 0!==c&&(l=c),n._stop(!0),l=l||n.transform.centerPoint;var p=i.pointLocation(o?l.sub(o):l);s&&(i.bearing+=s),u&&(i.pitch+=u),a&&(i.zoom+=a),i.setLocationAtPoint(p,l),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(e,r,!0)},gi.prototype._fireEvents=function(e,r,n){var i=this,o=di(this._eventsInProgress),a=di(e),s={};for(var u in e)this._eventsInProgress[u]||(s[u+"start"]=e[u].originalEvent),this._eventsInProgress[u]=e[u];for(var l in!o&&a&&this._fireEvent("movestart",a.originalEvent),s)this._fireEvent(l,s[l]);for(var c in a&&this._fireEvent("move",a.originalEvent),e)this._fireEvent(c,e[c].originalEvent);var p,h={};for(var f in this._eventsInProgress){var d=this._eventsInProgress[f],m=d.handlerName,y=d.originalEvent;this._handlersById[m].isActive()||(delete this._eventsInProgress[f],h[f+"end"]=p=r[m]||y)}for(var g in h)this._fireEvent(g,h[g]);var v=di(this._eventsInProgress);if(n&&(o||a)&&!v){this._updatingCamera=!0;var _=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),x=function(t){return 0!==t&&-i._bearingSnap<t&&t<i._bearingSnap};_?(x(_.bearing||this._map.getBearing())&&(_.bearing=0),this._map.easeTo(_,{originalEvent:p})):(this._map.fire(new t.Event("moveend",{originalEvent:p})),x(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}},gi.prototype._fireEvent=function(e,r){this._map.fire(new t.Event(e,r?{originalEvent:r}:{}))},gi.prototype._requestFrame=function(){var t=this;return this._map.triggerRepaint(),this._map._renderTaskQueue.add((function(e){delete t._frameId,t.handleEvent(new mi("renderFrame",{timeStamp:e})),t._applyChanges()}))},gi.prototype._triggerRenderFrame=function(){void 0===this._frameId&&(this._frameId=this._requestFrame())};var vi=function(e){function r(r,n){e.call(this),this._moving=!1,this._zooming=!1,this.transform=r,this._bearingSnap=n.bearingSnap,t.bindAll(["_renderFrameCallback"],this)}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.getCenter=function(){return new t.LngLat(this.transform.center.lng,this.transform.center.lat)},r.prototype.setCenter=function(t,e){return this.jumpTo({center:t},e)},r.prototype.panBy=function(e,r,n){return e=t.Point.convert(e).mult(-1),this.panTo(this.transform.center,t.extend({offset:e},r),n)},r.prototype.panTo=function(e,r,n){return this.easeTo(t.extend({center:e},r),n)},r.prototype.getZoom=function(){return this.transform.zoom},r.prototype.setZoom=function(t,e){return this.jumpTo({zoom:t},e),this},r.prototype.zoomTo=function(e,r,n){return this.easeTo(t.extend({zoom:e},r),n)},r.prototype.zoomIn=function(t,e){return this.zoomTo(this.getZoom()+1,t,e),this},r.prototype.zoomOut=function(t,e){return this.zoomTo(this.getZoom()-1,t,e),this},r.prototype.getBearing=function(){return this.transform.bearing},r.prototype.setBearing=function(t,e){return this.jumpTo({bearing:t},e),this},r.prototype.getPadding=function(){return this.transform.padding},r.prototype.setPadding=function(t,e){return this.jumpTo({padding:t},e),this},r.prototype.rotateTo=function(e,r,n){return this.easeTo(t.extend({bearing:e},r),n)},r.prototype.resetNorth=function(e,r){return this.rotateTo(0,t.extend({duration:1e3},e),r),this},r.prototype.resetNorthPitch=function(e,r){return this.easeTo(t.extend({bearing:0,pitch:0,duration:1e3},e),r),this},r.prototype.snapToNorth=function(t,e){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,e):this},r.prototype.getPitch=function(){return this.transform.pitch},r.prototype.setPitch=function(t,e){return this.jumpTo({pitch:t},e),this},r.prototype.cameraForBounds=function(e,r){e=t.LngLatBounds.convert(e);var n=r&&r.bearing||0;return this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),n,r)},r.prototype._cameraForBoxAndBearing=function(e,r,n,i){var o={top:0,bottom:0,right:0,left:0};if("number"==typeof(i=t.extend({padding:o,offset:[0,0],maxZoom:this.transform.maxZoom},i)).padding){var a=i.padding;i.padding={top:a,bottom:a,right:a,left:a}}i.padding=t.extend(o,i.padding);var s=this.transform,u=s.padding,l=s.project(t.LngLat.convert(e)),c=s.project(t.LngLat.convert(r)),p=l.rotate(-n*Math.PI/180),h=c.rotate(-n*Math.PI/180),f=new t.Point(Math.max(p.x,h.x),Math.max(p.y,h.y)),d=new t.Point(Math.min(p.x,h.x),Math.min(p.y,h.y)),m=f.sub(d),y=(s.width-(u.left+u.right+i.padding.left+i.padding.right))/m.x,g=(s.height-(u.top+u.bottom+i.padding.top+i.padding.bottom))/m.y;if(!(g<0||y<0)){var v=Math.min(s.scaleZoom(s.scale*Math.min(y,g)),i.maxZoom),_="number"==typeof i.offset.x?new t.Point(i.offset.x,i.offset.y):t.Point.convert(i.offset),x=new t.Point((i.padding.left-i.padding.right)/2,(i.padding.top-i.padding.bottom)/2).rotate(n*Math.PI/180),b=_.add(x).mult(s.scale/s.zoomScale(v));return{center:s.unproject(l.add(c).div(2).sub(b)),zoom:v,bearing:n}}t.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset.")},r.prototype.fitBounds=function(t,e,r){return this._fitInternal(this.cameraForBounds(t,e),e,r)},r.prototype.fitScreenCoordinates=function(e,r,n,i,o){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(t.Point.convert(e)),this.transform.pointLocation(t.Point.convert(r)),n,i),i,o)},r.prototype._fitInternal=function(e,r,n){return e?(delete(r=t.extend(e,r)).padding,r.linear?this.easeTo(r,n):this.flyTo(r,n)):this},r.prototype.jumpTo=function(e,r){this.stop();var n=this.transform,i=!1,o=!1,a=!1;return"zoom"in e&&n.zoom!==+e.zoom&&(i=!0,n.zoom=+e.zoom),void 0!==e.center&&(n.center=t.LngLat.convert(e.center)),"bearing"in e&&n.bearing!==+e.bearing&&(o=!0,n.bearing=+e.bearing),"pitch"in e&&n.pitch!==+e.pitch&&(a=!0,n.pitch=+e.pitch),null==e.padding||n.isPaddingEqual(e.padding)||(n.padding=e.padding),this.fire(new t.Event("movestart",r)).fire(new t.Event("move",r)),i&&this.fire(new t.Event("zoomstart",r)).fire(new t.Event("zoom",r)).fire(new t.Event("zoomend",r)),o&&this.fire(new t.Event("rotatestart",r)).fire(new t.Event("rotate",r)).fire(new t.Event("rotateend",r)),a&&this.fire(new t.Event("pitchstart",r)).fire(new t.Event("pitch",r)).fire(new t.Event("pitchend",r)),this.fire(new t.Event("moveend",r))},r.prototype.easeTo=function(e,r){var n=this;this._stop(!1,e.easeId),(!1===(e=t.extend({offset:[0,0],duration:500,easing:t.ease},e)).animate||!e.essential&&t.browser.prefersReducedMotion)&&(e.duration=0);var i=this.transform,o=this.getZoom(),a=this.getBearing(),s=this.getPitch(),u=this.getPadding(),l="zoom"in e?+e.zoom:o,c="bearing"in e?this._normalizeBearing(e.bearing,a):a,p="pitch"in e?+e.pitch:s,h="padding"in e?e.padding:i.padding,f=t.Point.convert(e.offset),d=i.centerPoint.add(f),m=i.pointLocation(d),y=t.LngLat.convert(e.center||m);this._normalizeCenter(y);var g,v,_=i.project(m),x=i.project(y).sub(_),b=i.zoomScale(l-o);e.around&&(g=t.LngLat.convert(e.around),v=i.locationPoint(g));var w={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||l!==o,this._rotating=this._rotating||a!==c,this._pitching=this._pitching||p!==s,this._padding=!i.isPaddingEqual(h),this._easeId=e.easeId,this._prepareEase(r,e.noMoveStart,w),this._ease((function(e){if(n._zooming&&(i.zoom=t.number(o,l,e)),n._rotating&&(i.bearing=t.number(a,c,e)),n._pitching&&(i.pitch=t.number(s,p,e)),n._padding&&(i.interpolatePadding(u,h,e),d=i.centerPoint.add(f)),g)i.setLocationAtPoint(g,v);else{var m=i.zoomScale(i.zoom-o),y=l>o?Math.min(2,b):Math.max(.5,b),w=Math.pow(y,1-e),S=i.unproject(_.add(x.mult(e*w)).mult(m));i.setLocationAtPoint(i.renderWorldCopies?S.wrap():S,d)}n._fireMoveEvents(r)}),(function(t){n._afterEase(r,t)}),e),this},r.prototype._prepareEase=function(e,r,n){void 0===n&&(n={}),this._moving=!0,r||n.moving||this.fire(new t.Event("movestart",e)),this._zooming&&!n.zooming&&this.fire(new t.Event("zoomstart",e)),this._rotating&&!n.rotating&&this.fire(new t.Event("rotatestart",e)),this._pitching&&!n.pitching&&this.fire(new t.Event("pitchstart",e))},r.prototype._fireMoveEvents=function(e){this.fire(new t.Event("move",e)),this._zooming&&this.fire(new t.Event("zoom",e)),this._rotating&&this.fire(new t.Event("rotate",e)),this._pitching&&this.fire(new t.Event("pitch",e))},r.prototype._afterEase=function(e,r){if(!this._easeId||!r||this._easeId!==r){delete this._easeId;var n=this._zooming,i=this._rotating,o=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,n&&this.fire(new t.Event("zoomend",e)),i&&this.fire(new t.Event("rotateend",e)),o&&this.fire(new t.Event("pitchend",e)),this.fire(new t.Event("moveend",e))}},r.prototype.flyTo=function(e,r){var n=this;if(!e.essential&&t.browser.prefersReducedMotion){var i=t.pick(e,["center","zoom","bearing","pitch","around"]);return this.jumpTo(i,r)}this.stop(),e=t.extend({offset:[0,0],speed:1.2,curve:1.42,easing:t.ease},e);var o=this.transform,a=this.getZoom(),s=this.getBearing(),u=this.getPitch(),l=this.getPadding(),c="zoom"in e?t.clamp(+e.zoom,o.minZoom,o.maxZoom):a,p="bearing"in e?this._normalizeBearing(e.bearing,s):s,h="pitch"in e?+e.pitch:u,f="padding"in e?e.padding:o.padding,d=o.zoomScale(c-a),m=t.Point.convert(e.offset),y=o.centerPoint.add(m),g=o.pointLocation(y),v=t.LngLat.convert(e.center||g);this._normalizeCenter(v);var _=o.project(g),x=o.project(v).sub(_),b=e.curve,w=Math.max(o.width,o.height),S=w/d,A=x.mag();if("minZoom"in e){var E=t.clamp(Math.min(e.minZoom,a,c),o.minZoom,o.maxZoom),T=w/o.zoomScale(E-a);b=Math.sqrt(T/A*2)}var k=b*b;function I(t){var e=(S*S-w*w+(t?-1:1)*k*k*A*A)/(2*(t?S:w)*k*A);return Math.log(Math.sqrt(e*e+1)-e)}function z(t){return(Math.exp(t)-Math.exp(-t))/2}function C(t){return(Math.exp(t)+Math.exp(-t))/2}var P=I(0),M=function(t){return C(P)/C(P+b*t)},D=function(t){return w*((C(P)*(z(e=P+b*t)/C(e))-z(P))/k)/A;var e},L=(I(1)-P)/b;if(Math.abs(A)<1e-6||!isFinite(L)){if(Math.abs(w-S)<1e-6)return this.easeTo(e,r);var B=S<w?-1:1;L=Math.abs(Math.log(S/w))/b,D=function(){return 0},M=function(t){return Math.exp(B*b*t)}}return e.duration="duration"in e?+e.duration:1e3*L/("screenSpeed"in e?+e.screenSpeed/b:+e.speed),e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=s!==p,this._pitching=h!==u,this._padding=!o.isPaddingEqual(f),this._prepareEase(r,!1),this._ease((function(e){var i=e*L,d=1/M(i);o.zoom=1===e?c:a+o.scaleZoom(d),n._rotating&&(o.bearing=t.number(s,p,e)),n._pitching&&(o.pitch=t.number(u,h,e)),n._padding&&(o.interpolatePadding(l,f,e),y=o.centerPoint.add(m));var g=1===e?v:o.unproject(_.add(x.mult(D(i))).mult(d));o.setLocationAtPoint(o.renderWorldCopies?g.wrap():g,y),n._fireMoveEvents(r)}),(function(){return n._afterEase(r)}),e),this},r.prototype.isEasing=function(){return!!this._easeFrameId},r.prototype.stop=function(){return this._stop()},r.prototype._stop=function(t,e){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){var r=this._onEaseEnd;delete this._onEaseEnd,r.call(this,e)}if(!t){var n=this.handlers;n&&n.stop(!1)}return this},r.prototype._ease=function(e,r,n){!1===n.animate||0===n.duration?(e(1),r()):(this._easeStart=t.browser.now(),this._easeOptions=n,this._onEaseFrame=e,this._onEaseEnd=r,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))},r.prototype._renderFrameCallback=function(){var e=Math.min((t.browser.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(e)),e<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},r.prototype._normalizeBearing=function(e,r){e=t.wrap(e,-180,180);var n=Math.abs(e-r);return Math.abs(e-360-r)<n&&(e-=360),Math.abs(e+360-r)<n&&(e+=360),e},r.prototype._normalizeCenter=function(t){var e=this.transform;if(e.renderWorldCopies&&!e.lngRange){var r=t.lng-e.center.lng;t.lng+=r>180?-360:r<-180?360:0}},r}(t.Evented),_i=function(e){void 0===e&&(e={}),this.options=e,t.bindAll(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)};_i.prototype.getDefaultPosition=function(){return"bottom-right"},_i.prototype.onAdd=function(t){var e=this.options&&this.options.compact;return this._map=t,this._container=r.create("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=r.create("button","mapboxgl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=r.create("div","mapboxgl-ctrl-attrib-inner",this._container),this._innerContainer.setAttribute("role","list"),e&&this._container.classList.add("mapboxgl-compact"),this._updateAttributions(),this._updateEditLink(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("moveend",this._updateEditLink),void 0===e&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container},_i.prototype.onRemove=function(){r.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0,this._attribHTML=void 0},_i.prototype._setElementTitle=function(t,e){var r=this._map._getUIString("AttributionControl."+e);t.title=r,t.setAttribute("aria-label",r)},_i.prototype._toggleAttribution=function(){this._container.classList.contains("mapboxgl-compact-show")?(this._container.classList.remove("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-pressed","false")):(this._container.classList.add("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-pressed","true"))},_i.prototype._updateEditLink=function(){var e=this._editLink;e||(e=this._editLink=this._container.querySelector(".mapbox-improve-map"));var r=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||t.config.ACCESS_TOKEN}];if(e){var n=r.reduce((function(t,e,n){return e.value&&(t+=e.key+"="+e.value+(n<r.length-1?"&":"")),t}),"?");e.href=t.config.FEEDBACK_URL+"/"+n+(this._map._hash?this._map._hash.getHashString(!0):""),e.rel="noopener nofollow",this._setElementTitle(e,"MapFeedback")}},_i.prototype._updateData=function(t){!t||"metadata"!==t.sourceDataType&&"visibility"!==t.sourceDataType&&"style"!==t.dataType||(this._updateAttributions(),this._updateEditLink())},_i.prototype._updateAttributions=function(){if(this._map.style){var t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map((function(t){return"string"!=typeof t?"":t}))):"string"==typeof this.options.customAttribution&&t.push(this.options.customAttribution)),this._map.style.stylesheet){var e=this._map.style.stylesheet;this.styleOwner=e.owner,this.styleId=e.id}var r=this._map.style.sourceCaches;for(var n in r){var i=r[n];if(i.used){var o=i.getSource();o.attribution&&t.indexOf(o.attribution)<0&&t.push(o.attribution)}}t.sort((function(t,e){return t.length-e.length}));var a=(t=t.filter((function(e,r){for(var n=r+1;n<t.length;n++)if(t[n].indexOf(e)>=0)return!1;return!0}))).join(" | ");a!==this._attribHTML&&(this._attribHTML=a,t.length?(this._innerContainer.innerHTML=a,this._container.classList.remove("mapboxgl-attrib-empty")):this._container.classList.add("mapboxgl-attrib-empty"),this._editLink=null)}},_i.prototype._updateCompact=function(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("mapboxgl-compact"):this._container.classList.remove("mapboxgl-compact","mapboxgl-compact-show")};var xi=function(){t.bindAll(["_updateLogo"],this),t.bindAll(["_updateCompact"],this)};xi.prototype.onAdd=function(t){this._map=t,this._container=r.create("div","mapboxgl-ctrl");var e=r.create("a","mapboxgl-ctrl-logo");return e.target="_blank",e.rel="noopener nofollow",e.href="https://www.mapbox.com/",e.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),e.setAttribute("rel","noopener nofollow"),this._container.appendChild(e),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._map.on("resize",this._updateCompact),this._updateCompact(),this._container},xi.prototype.onRemove=function(){r.remove(this._container),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact)},xi.prototype.getDefaultPosition=function(){return"bottom-left"},xi.prototype._updateLogo=function(t){t&&"metadata"!==t.sourceDataType||(this._container.style.display=this._logoRequired()?"block":"none")},xi.prototype._logoRequired=function(){if(this._map.style){var t=this._map.style.sourceCaches;for(var e in t)if(t[e].getSource().mapbox_logo)return!0;return!1}},xi.prototype._updateCompact=function(){var t=this._container.children;if(t.length){var e=t[0];this._map.getCanvasContainer().offsetWidth<250?e.classList.add("mapboxgl-compact"):e.classList.remove("mapboxgl-compact")}};var bi=function(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1};bi.prototype.add=function(t){var e=++this._id;return this._queue.push({callback:t,id:e,cancelled:!1}),e},bi.prototype.remove=function(t){for(var e=this._currentlyRunning,r=0,n=e?this._queue.concat(e):this._queue;r<n.length;r+=1){var i=n[r];if(i.id===t)return void(i.cancelled=!0)}},bi.prototype.run=function(t){void 0===t&&(t=0);var e=this._currentlyRunning=this._queue;this._queue=[];for(var r=0,n=e;r<n.length;r+=1){var i=n[r];if(!i.cancelled&&(i.callback(t),this._cleared))break}this._cleared=!1,this._currentlyRunning=!1},bi.prototype.clear=function(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]};var wi={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox logo","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm"},Si=t.window.HTMLImageElement,Ai=t.window.HTMLElement,Ei=t.window.ImageBitmap,Ti={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",transformRequest:null,accessToken:null,fadeDuration:300,crossSourceCollisions:!0},ki=function(n){function i(e){var r=this;if(null!=(e=t.extend({},Ti,e)).minZoom&&null!=e.maxZoom&&e.minZoom>e.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(null!=e.minPitch&&null!=e.maxPitch&&e.minPitch>e.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(null!=e.minPitch&&e.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(null!=e.maxPitch&&e.maxPitch>60)throw new Error("maxPitch must be less than or equal to 60");var i=new Sn(e.minZoom,e.maxZoom,e.minPitch,e.maxPitch,e.renderWorldCopies);if(n.call(this,i,e),this._interactive=e.interactive,this._maxTileCacheSize=e.maxTileCacheSize,this._failIfMajorPerformanceCaveat=e.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=e.preserveDrawingBuffer,this._antialias=e.antialias,this._trackResize=e.trackResize,this._bearingSnap=e.bearingSnap,this._refreshExpiredTiles=e.refreshExpiredTiles,this._fadeDuration=e.fadeDuration,this._crossSourceCollisions=e.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=e.collectResourceTiming,this._renderTaskQueue=new bi,this._controls=[],this._mapId=t.uniqueId(),this._locale=t.extend({},wi,e.locale),this._clickTolerance=e.clickTolerance,this._requestManager=new t.RequestManager(e.transformRequest,e.accessToken),"string"==typeof e.container){if(this._container=t.window.document.getElementById(e.container),!this._container)throw new Error("Container '"+e.container+"' not found.")}else{if(!(e.container instanceof Ai))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=e.container}if(e.maxBounds&&this.setMaxBounds(e.maxBounds),t.bindAll(["_onWindowOnline","_onWindowResize","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),void 0===this.painter)throw new Error("Failed to initialize WebGL.");this.on("move",(function(){return r._update(!1)})),this.on("moveend",(function(){return r._update(!1)})),this.on("zoom",(function(){return r._update(!0)})),void 0!==t.window&&(t.window.addEventListener("online",this._onWindowOnline,!1),t.window.addEventListener("resize",this._onWindowResize,!1),t.window.addEventListener("orientationchange",this._onWindowResize,!1)),this.handlers=new gi(this,e),this._hash=e.hash&&new En("string"==typeof e.hash&&e.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:e.center,zoom:e.zoom,bearing:e.bearing,pitch:e.pitch}),e.bounds&&(this.resize(),this.fitBounds(e.bounds,t.extend({},e.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=e.localIdeographFontFamily,e.style&&this.setStyle(e.style,{localIdeographFontFamily:e.localIdeographFontFamily}),e.attributionControl&&this.addControl(new _i({customAttribution:e.customAttribution})),this.addControl(new xi,e.logoPosition),this.on("style.load",(function(){r.transform.unmodified&&r.jumpTo(r.style.stylesheet)})),this.on("data",(function(e){r._update("style"===e.dataType),r.fire(new t.Event(e.dataType+"data",e))})),this.on("dataloading",(function(e){r.fire(new t.Event(e.dataType+"dataloading",e))}))}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var o={showTileBoundaries:{configurable:!0},showPadding:{configurable:!0},showCollisionBoxes:{configurable:!0},showOverdrawInspector:{configurable:!0},repaint:{configurable:!0},vertices:{configurable:!0},version:{configurable:!0}};return i.prototype._getMapId=function(){return this._mapId},i.prototype.addControl=function(e,r){if(void 0===r&&(r=e.getDefaultPosition?e.getDefaultPosition():"top-right"),!e||!e.onAdd)return this.fire(new t.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));var n=e.onAdd(this);this._controls.push(e);var i=this._controlPositions[r];return-1!==r.indexOf("bottom")?i.insertBefore(n,i.firstChild):i.appendChild(n),this},i.prototype.removeControl=function(e){if(!e||!e.onRemove)return this.fire(new t.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));var r=this._controls.indexOf(e);return r>-1&&this._controls.splice(r,1),e.onRemove(this),this},i.prototype.hasControl=function(t){return this._controls.indexOf(t)>-1},i.prototype.resize=function(e){var r=this._containerDimensions(),n=r[0],i=r[1];this._resizeCanvas(n,i),this.transform.resize(n,i),this.painter.resize(n,i);var o=!this._moving;return o&&(this.stop(),this.fire(new t.Event("movestart",e)).fire(new t.Event("move",e))),this.fire(new t.Event("resize",e)),o&&this.fire(new t.Event("moveend",e)),this},i.prototype.getBounds=function(){return this.transform.getBounds()},i.prototype.getMaxBounds=function(){return this.transform.getMaxBounds()},i.prototype.setMaxBounds=function(e){return this.transform.setMaxBounds(t.LngLatBounds.convert(e)),this._update()},i.prototype.setMinZoom=function(t){if((t=null==t?-2:t)>=-2&&t<=this.transform.maxZoom)return this.transform.minZoom=t,this._update(),this.getZoom()<t&&this.setZoom(t),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")},i.prototype.getMinZoom=function(){return this.transform.minZoom},i.prototype.setMaxZoom=function(t){if((t=null==t?22:t)>=this.transform.minZoom)return this.transform.maxZoom=t,this._update(),this.getZoom()>t&&this.setZoom(t),this;throw new Error("maxZoom must be greater than the current minZoom")},i.prototype.getMaxZoom=function(){return this.transform.maxZoom},i.prototype.setMinPitch=function(t){if((t=null==t?0:t)<0)throw new Error("minPitch must be greater than or equal to 0");if(t>=0&&t<=this.transform.maxPitch)return this.transform.minPitch=t,this._update(),this.getPitch()<t&&this.setPitch(t),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")},i.prototype.getMinPitch=function(){return this.transform.minPitch},i.prototype.setMaxPitch=function(t){if((t=null==t?60:t)>60)throw new Error("maxPitch must be less than or equal to 60");if(t>=this.transform.minPitch)return this.transform.maxPitch=t,this._update(),this.getPitch()>t&&this.setPitch(t),this;throw new Error("maxPitch must be greater than the current minPitch")},i.prototype.getMaxPitch=function(){return this.transform.maxPitch},i.prototype.getRenderWorldCopies=function(){return this.transform.renderWorldCopies},i.prototype.setRenderWorldCopies=function(t){return this.transform.renderWorldCopies=t,this._update()},i.prototype.project=function(e){return this.transform.locationPoint(t.LngLat.convert(e))},i.prototype.unproject=function(e){return this.transform.pointLocation(t.Point.convert(e))},i.prototype.isMoving=function(){return this._moving||this.handlers.isMoving()},i.prototype.isZooming=function(){return this._zooming||this.handlers.isZooming()},i.prototype.isRotating=function(){return this._rotating||this.handlers.isRotating()},i.prototype._createDelegatedListener=function(t,e,r){var n,i=this;if("mouseenter"===t||"mouseover"===t){var o=!1;return{layer:e,listener:r,delegates:{mousemove:function(n){var a=i.getLayer(e)?i.queryRenderedFeatures(n.point,{layers:[e]}):[];a.length?o||(o=!0,r.call(i,new Ln(t,i,n.originalEvent,{features:a}))):o=!1},mouseout:function(){o=!1}}}}if("mouseleave"===t||"mouseout"===t){var a=!1;return{layer:e,listener:r,delegates:{mousemove:function(n){(i.getLayer(e)?i.queryRenderedFeatures(n.point,{layers:[e]}):[]).length?a=!0:a&&(a=!1,r.call(i,new Ln(t,i,n.originalEvent)))},mouseout:function(e){a&&(a=!1,r.call(i,new Ln(t,i,e.originalEvent)))}}}}return{layer:e,listener:r,delegates:(n={},n[t]=function(t){var n=i.getLayer(e)?i.queryRenderedFeatures(t.point,{layers:[e]}):[];n.length&&(t.features=n,r.call(i,t),delete t.features)},n)}},i.prototype.on=function(t,e,r){if(void 0===r)return n.prototype.on.call(this,t,e);var i=this._createDelegatedListener(t,e,r);for(var o in this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[t]=this._delegatedListeners[t]||[],this._delegatedListeners[t].push(i),i.delegates)this.on(o,i.delegates[o]);return this},i.prototype.once=function(t,e,r){if(void 0===r)return n.prototype.once.call(this,t,e);var i=this._createDelegatedListener(t,e,r);for(var o in i.delegates)this.once(o,i.delegates[o]);return this},i.prototype.off=function(t,e,r){var i=this;return void 0===r?n.prototype.off.call(this,t,e):(this._delegatedListeners&&this._delegatedListeners[t]&&function(n){for(var o=n[t],a=0;a<o.length;a++){var s=o[a];if(s.layer===e&&s.listener===r){for(var u in s.delegates)i.off(u,s.delegates[u]);return o.splice(a,1),i}}}(this._delegatedListeners),this)},i.prototype.queryRenderedFeatures=function(e,r){if(!this.style)return[];var n;if(void 0!==r||void 0===e||e instanceof t.Point||Array.isArray(e)||(r=e,e=void 0),r=r||{},(e=e||[[0,0],[this.transform.width,this.transform.height]])instanceof t.Point||"number"==typeof e[0])n=[t.Point.convert(e)];else{var i=t.Point.convert(e[0]),o=t.Point.convert(e[1]);n=[i,new t.Point(o.x,i.y),o,new t.Point(i.x,o.y),i]}return this.style.queryRenderedFeatures(n,r,this.transform)},i.prototype.querySourceFeatures=function(t,e){return this.style.querySourceFeatures(t,e)},i.prototype.setStyle=function(e,r){return!1!==(r=t.extend({},{localIdeographFontFamily:this._localIdeographFontFamily},r)).diff&&r.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&e?(this._diffStyle(e,r),this):(this._localIdeographFontFamily=r.localIdeographFontFamily,this._updateStyle(e,r))},i.prototype._getUIString=function(t){var e=this._locale[t];if(null==e)throw new Error("Missing UI string '"+t+"'");return e},i.prototype._updateStyle=function(t,e){return this.style&&(this.style.setEventedParent(null),this.style._remove()),t?(this.style=new qe(this,e||{}),this.style.setEventedParent(this,{style:this.style}),"string"==typeof t?this.style.loadURL(t):this.style.loadJSON(t),this):(delete this.style,this)},i.prototype._lazyInitEmptyStyle=function(){this.style||(this.style=new qe(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())},i.prototype._diffStyle=function(e,r){var n=this;if("string"==typeof e){var i=this._requestManager.normalizeStyleURL(e),o=this._requestManager.transformRequest(i,t.ResourceType.Style);t.getJSON(o,(function(e,i){e?n.fire(new t.ErrorEvent(e)):i&&n._updateDiff(i,r)}))}else"object"==typeof e&&this._updateDiff(e,r)},i.prototype._updateDiff=function(e,r){try{this.style.setState(e)&&this._update(!0)}catch(n){t.warnOnce("Unable to perform style diff: "+(n.message||n.error||n)+".  Rebuilding the style from scratch."),this._updateStyle(e,r)}},i.prototype.getStyle=function(){if(this.style)return this.style.serialize()},i.prototype.isStyleLoaded=function(){return this.style?this.style.loaded():t.warnOnce("There is no style added to the map.")},i.prototype.addSource=function(t,e){return this._lazyInitEmptyStyle(),this.style.addSource(t,e),this._update(!0)},i.prototype.isSourceLoaded=function(e){var r=this.style&&this.style.sourceCaches[e];if(void 0!==r)return r.loaded();this.fire(new t.ErrorEvent(new Error("There is no source with ID '"+e+"'")))},i.prototype.areTilesLoaded=function(){var t=this.style&&this.style.sourceCaches;for(var e in t){var r=t[e]._tiles;for(var n in r){var i=r[n];if("loaded"!==i.state&&"errored"!==i.state)return!1}}return!0},i.prototype.addSourceType=function(t,e,r){return this._lazyInitEmptyStyle(),this.style.addSourceType(t,e,r)},i.prototype.removeSource=function(t){return this.style.removeSource(t),this._update(!0)},i.prototype.getSource=function(t){return this.style.getSource(t)},i.prototype.addImage=function(e,r,n){void 0===n&&(n={});var i=n.pixelRatio;void 0===i&&(i=1);var o=n.sdf;void 0===o&&(o=!1);var a=n.stretchX,s=n.stretchY,u=n.content;if(this._lazyInitEmptyStyle(),r instanceof Si||Ei&&r instanceof Ei){var l=t.browser.getImageData(r);this.style.addImage(e,{data:new t.RGBAImage({width:l.width,height:l.height},l.data),pixelRatio:i,stretchX:a,stretchY:s,content:u,sdf:o,version:0})}else{if(void 0===r.width||void 0===r.height)return this.fire(new t.ErrorEvent(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));var c=r;this.style.addImage(e,{data:new t.RGBAImage({width:r.width,height:r.height},new Uint8Array(r.data)),pixelRatio:i,stretchX:a,stretchY:s,content:u,sdf:o,version:0,userImage:c}),c.onAdd&&c.onAdd(this,e)}},i.prototype.updateImage=function(e,r){var n=this.style.getImage(e);if(!n)return this.fire(new t.ErrorEvent(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));var i=r instanceof Si||Ei&&r instanceof Ei?t.browser.getImageData(r):r,o=i.width,a=i.height,s=i.data;return void 0===o||void 0===a?this.fire(new t.ErrorEvent(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`"))):o!==n.data.width||a!==n.data.height?this.fire(new t.ErrorEvent(new Error("The width and height of the updated image must be that same as the previous version of the image"))):(n.data.replace(s,!(r instanceof Si||Ei&&r instanceof Ei)),void this.style.updateImage(e,n))},i.prototype.hasImage=function(e){return e?!!this.style.getImage(e):(this.fire(new t.ErrorEvent(new Error("Missing required image id"))),!1)},i.prototype.removeImage=function(t){this.style.removeImage(t)},i.prototype.loadImage=function(e,r){t.getImage(this._requestManager.transformRequest(e,t.ResourceType.Image),r)},i.prototype.listImages=function(){return this.style.listImages()},i.prototype.addLayer=function(t,e){return this._lazyInitEmptyStyle(),this.style.addLayer(t,e),this._update(!0)},i.prototype.moveLayer=function(t,e){return this.style.moveLayer(t,e),this._update(!0)},i.prototype.removeLayer=function(t){return this.style.removeLayer(t),this._update(!0)},i.prototype.getLayer=function(t){return this.style.getLayer(t)},i.prototype.setLayerZoomRange=function(t,e,r){return this.style.setLayerZoomRange(t,e,r),this._update(!0)},i.prototype.setFilter=function(t,e,r){return void 0===r&&(r={}),this.style.setFilter(t,e,r),this._update(!0)},i.prototype.getFilter=function(t){return this.style.getFilter(t)},i.prototype.setPaintProperty=function(t,e,r,n){return void 0===n&&(n={}),this.style.setPaintProperty(t,e,r,n),this._update(!0)},i.prototype.getPaintProperty=function(t,e){return this.style.getPaintProperty(t,e)},i.prototype.setLayoutProperty=function(t,e,r,n){return void 0===n&&(n={}),this.style.setLayoutProperty(t,e,r,n),this._update(!0)},i.prototype.getLayoutProperty=function(t,e){return this.style.getLayoutProperty(t,e)},i.prototype.setLight=function(t,e){return void 0===e&&(e={}),this._lazyInitEmptyStyle(),this.style.setLight(t,e),this._update(!0)},i.prototype.getLight=function(){return this.style.getLight()},i.prototype.setFeatureState=function(t,e){return this.style.setFeatureState(t,e),this._update()},i.prototype.removeFeatureState=function(t,e){return this.style.removeFeatureState(t,e),this._update()},i.prototype.getFeatureState=function(t){return this.style.getFeatureState(t)},i.prototype.getContainer=function(){return this._container},i.prototype.getCanvasContainer=function(){return this._canvasContainer},i.prototype.getCanvas=function(){return this._canvas},i.prototype._containerDimensions=function(){var t=0,e=0;return this._container&&(t=this._container.clientWidth||400,e=this._container.clientHeight||300),[t,e]},i.prototype._detectMissingCSS=function(){"rgb(250, 128, 114)"!==t.window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")&&t.warnOnce("This page appears to be missing CSS declarations for Mapbox GL JS, which may cause the map to display incorrectly. Please ensure your page includes mapbox-gl.css, as described in https://www.mapbox.com/mapbox-gl-js/api/.")},i.prototype._setupContainer=function(){var t=this._container;t.classList.add("mapboxgl-map"),(this._missingCSSCanary=r.create("div","mapboxgl-canary",t)).style.visibility="hidden",this._detectMissingCSS();var e=this._canvasContainer=r.create("div","mapboxgl-canvas-container",t);this._interactive&&e.classList.add("mapboxgl-interactive"),this._canvas=r.create("canvas","mapboxgl-canvas",e),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");var n=this._containerDimensions();this._resizeCanvas(n[0],n[1]);var i=this._controlContainer=r.create("div","mapboxgl-control-container",t),o=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach((function(t){o[t]=r.create("div","mapboxgl-ctrl-"+t,i)})),this._container.addEventListener("scroll",this._onMapScroll,!1)},i.prototype._resizeCanvas=function(e,r){var n=t.browser.devicePixelRatio||1;this._canvas.width=n*e,this._canvas.height=n*r,this._canvas.style.width=e+"px",this._canvas.style.height=r+"px"},i.prototype._setupPainter=function(){var r=t.extend({},e.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),n=this._canvas.getContext("webgl",r)||this._canvas.getContext("experimental-webgl",r);n?(this.painter=new _n(n,this.transform),t.webpSupported.testSupport(n)):this.fire(new t.ErrorEvent(new Error("Failed to initialize WebGL")))},i.prototype._contextLost=function(e){e.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new t.Event("webglcontextlost",{originalEvent:e}))},i.prototype._contextRestored=function(e){this._setupPainter(),this.resize(),this._update(),this.fire(new t.Event("webglcontextrestored",{originalEvent:e}))},i.prototype._onMapScroll=function(t){if(t.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},i.prototype.loaded=function(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()},i.prototype._update=function(t){return this.style?(this._styleDirty=this._styleDirty||t,this._sourcesDirty=!0,this.triggerRepaint(),this):this},i.prototype._requestRenderFrame=function(t){return this._update(),this._renderTaskQueue.add(t)},i.prototype._cancelRenderFrame=function(t){this._renderTaskQueue.remove(t)},i.prototype._render=function(e){var r,n=this,i=0,o=this.painter.context.extTimerQuery;if(this.listens("gpu-timing-frame")&&(r=o.createQueryEXT(),o.beginQueryEXT(o.TIME_ELAPSED_EXT,r),i=t.browser.now()),this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(e),!this._removed){var a=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;var s=this.transform.zoom,u=t.browser.now();this.style.zoomHistory.update(s,u);var l=new t.EvaluationParameters(s,{now:u,fadeDuration:this._fadeDuration,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),c=l.crossFadingFactor();1===c&&c===this._crossFadingFactor||(a=!0,this._crossFadingFactor=c),this.style.update(l)}if(this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,this._fadeDuration,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:this._fadeDuration,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer")}),this.fire(new t.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new t.Event("load"))),this.style&&(this.style.hasTransitions()||a)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),this.listens("gpu-timing-frame")){var p=t.browser.now()-i;o.endQueryEXT(o.TIME_ELAPSED_EXT,r),setTimeout((function(){var e=o.getQueryObjectEXT(r,o.QUERY_RESULT_EXT)/1e6;o.deleteQueryEXT(r),n.fire(new t.Event("gpu-timing-frame",{cpuTime:p,gpuTime:e}))}),50)}if(this.listens("gpu-timing-layer")){var h=this.painter.collectGpuTimers();setTimeout((function(){var e=n.painter.queryGpuTimers(h);n.fire(new t.Event("gpu-timing-layer",{layerTimes:e}))}),50)}var f=this._sourcesDirty||this._styleDirty||this._placementDirty;return f||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new t.Event("idle")),!this._loaded||this._fullyLoaded||f||(this._fullyLoaded=!0),this}},i.prototype.remove=function(){this._hash&&this._hash.remove();for(var e=0,r=this._controls;e<r.length;e+=1)r[e].onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),void 0!==t.window&&(t.window.removeEventListener("resize",this._onWindowResize,!1),t.window.removeEventListener("orientationchange",this._onWindowResize,!1),t.window.removeEventListener("online",this._onWindowOnline,!1));var n=this.painter.context.gl.getExtension("WEBGL_lose_context");n&&n.loseContext(),Ii(this._canvasContainer),Ii(this._controlContainer),Ii(this._missingCSSCanary),this._container.classList.remove("mapboxgl-map"),this._removed=!0,this.fire(new t.Event("remove"))},i.prototype.triggerRepaint=function(){var e=this;this.style&&!this._frame&&(this._frame=t.browser.frame((function(t){e._frame=null,e._render(t)})))},i.prototype._onWindowOnline=function(){this._update()},i.prototype._onWindowResize=function(t){this._trackResize&&this.resize({originalEvent:t})._update()},o.showTileBoundaries.get=function(){return!!this._showTileBoundaries},o.showTileBoundaries.set=function(t){this._showTileBoundaries!==t&&(this._showTileBoundaries=t,this._update())},o.showPadding.get=function(){return!!this._showPadding},o.showPadding.set=function(t){this._showPadding!==t&&(this._showPadding=t,this._update())},o.showCollisionBoxes.get=function(){return!!this._showCollisionBoxes},o.showCollisionBoxes.set=function(t){this._showCollisionBoxes!==t&&(this._showCollisionBoxes=t,t?this.style._generateCollisionBoxes():this._update())},o.showOverdrawInspector.get=function(){return!!this._showOverdrawInspector},o.showOverdrawInspector.set=function(t){this._showOverdrawInspector!==t&&(this._showOverdrawInspector=t,this._update())},o.repaint.get=function(){return!!this._repaint},o.repaint.set=function(t){this._repaint!==t&&(this._repaint=t,this.triggerRepaint())},o.vertices.get=function(){return!!this._vertices},o.vertices.set=function(t){this._vertices=t,this._update()},i.prototype._setCacheLimits=function(e,r){t.setCacheLimits(e,r)},o.version.get=function(){return t.version},Object.defineProperties(i.prototype,o),i}(vi);function Ii(t){t.parentNode&&t.parentNode.removeChild(t)}var zi={showCompass:!0,showZoom:!0,visualizePitch:!1},Ci=function(e){var n=this;this.options=t.extend({},zi,e),this._container=r.create("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",(function(t){return t.preventDefault()})),this.options.showZoom&&(t.bindAll(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",(function(t){return n._map.zoomIn({},{originalEvent:t})})),r.create("span","mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden",!0),this._zoomOutButton=this._createButton("mapboxgl-ctrl-zoom-out",(function(t){return n._map.zoomOut({},{originalEvent:t})})),r.create("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden",!0)),this.options.showCompass&&(t.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",(function(t){n.options.visualizePitch?n._map.resetNorthPitch({},{originalEvent:t}):n._map.resetNorth({},{originalEvent:t})})),this._compassIcon=r.create("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden",!0))};Ci.prototype._updateZoomButtons=function(){var t=this._map.getZoom(),e=t===this._map.getMaxZoom(),r=t===this._map.getMinZoom();this._zoomInButton.disabled=e,this._zoomOutButton.disabled=r,this._zoomInButton.setAttribute("aria-disabled",e.toString()),this._zoomOutButton.setAttribute("aria-disabled",r.toString())},Ci.prototype._rotateCompassArrow=function(){var t=this.options.visualizePitch?"scale("+1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)+") rotateX("+this._map.transform.pitch+"deg) rotateZ("+this._map.transform.angle*(180/Math.PI)+"deg)":"rotate("+this._map.transform.angle*(180/Math.PI)+"deg)";this._compassIcon.style.transform=t},Ci.prototype.onAdd=function(t){return this._map=t,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Pi(this._map,this._compass,this.options.visualizePitch)),this._container},Ci.prototype.onRemove=function(){r.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map},Ci.prototype._createButton=function(t,e){var n=r.create("button",t,this._container);return n.type="button",n.addEventListener("click",e),n},Ci.prototype._setButtonTitle=function(t,e){var r=this._map._getUIString("NavigationControl."+e);t.title=r,t.setAttribute("aria-label",r)};var Pi=function(e,n,i){void 0===i&&(i=!1),this._clickTolerance=10,this.element=n,this.mouseRotate=new Wn({clickTolerance:e.dragRotate._mouseRotate._clickTolerance}),this.map=e,i&&(this.mousePitch=new Xn({clickTolerance:e.dragRotate._mousePitch._clickTolerance})),t.bindAll(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),r.addEventListener(n,"mousedown",this.mousedown),r.addEventListener(n,"touchstart",this.touchstart,{passive:!1}),r.addEventListener(n,"touchmove",this.touchmove),r.addEventListener(n,"touchend",this.touchend),r.addEventListener(n,"touchcancel",this.reset)};function Mi(e,r,n){if(e=new t.LngLat(e.lng,e.lat),r){var i=new t.LngLat(e.lng-360,e.lat),o=new t.LngLat(e.lng+360,e.lat),a=n.locationPoint(e).distSqr(r);n.locationPoint(i).distSqr(r)<a?e=i:n.locationPoint(o).distSqr(r)<a&&(e=o)}for(;Math.abs(e.lng-n.center.lng)>180;){var s=n.locationPoint(e);if(s.x>=0&&s.y>=0&&s.x<=n.width&&s.y<=n.height)break;e.lng>n.center.lng?e.lng-=360:e.lng+=360}return e}Pi.prototype.down=function(t,e){this.mouseRotate.mousedown(t,e),this.mousePitch&&this.mousePitch.mousedown(t,e),r.disableDrag()},Pi.prototype.move=function(t,e){var r=this.map,n=this.mouseRotate.mousemoveWindow(t,e);if(n&&n.bearingDelta&&r.setBearing(r.getBearing()+n.bearingDelta),this.mousePitch){var i=this.mousePitch.mousemoveWindow(t,e);i&&i.pitchDelta&&r.setPitch(r.getPitch()+i.pitchDelta)}},Pi.prototype.off=function(){var t=this.element;r.removeEventListener(t,"mousedown",this.mousedown),r.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),r.removeEventListener(t,"touchmove",this.touchmove),r.removeEventListener(t,"touchend",this.touchend),r.removeEventListener(t,"touchcancel",this.reset),this.offTemp()},Pi.prototype.offTemp=function(){r.enableDrag(),r.removeEventListener(t.window,"mousemove",this.mousemove),r.removeEventListener(t.window,"mouseup",this.mouseup)},Pi.prototype.mousedown=function(e){this.down(t.extend({},e,{ctrlKey:!0,preventDefault:function(){return e.preventDefault()}}),r.mousePos(this.element,e)),r.addEventListener(t.window,"mousemove",this.mousemove),r.addEventListener(t.window,"mouseup",this.mouseup)},Pi.prototype.mousemove=function(t){this.move(t,r.mousePos(this.element,t))},Pi.prototype.mouseup=function(t){this.mouseRotate.mouseupWindow(t),this.mousePitch&&this.mousePitch.mouseupWindow(t),this.offTemp()},Pi.prototype.touchstart=function(t){1!==t.targetTouches.length?this.reset():(this._startPos=this._lastPos=r.touchPos(this.element,t.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:function(){return t.preventDefault()}},this._startPos))},Pi.prototype.touchmove=function(t){1!==t.targetTouches.length?this.reset():(this._lastPos=r.touchPos(this.element,t.targetTouches)[0],this.move({preventDefault:function(){return t.preventDefault()}},this._lastPos))},Pi.prototype.touchend=function(t){0===t.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),this.reset()},Pi.prototype.reset=function(){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()};var Di={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function Li(t,e,r){var n=t.classList;for(var i in Di)n.remove("mapboxgl-"+r+"-anchor-"+i);n.add("mapboxgl-"+r+"-anchor-"+e)}var Bi,Ri=function(e){function n(n,i){if(e.call(this),(n instanceof t.window.HTMLElement||i)&&(n=t.extend({element:n},i)),t.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress"],this),this._anchor=n&&n.anchor||"center",this._color=n&&n.color||"#3FB1CE",this._scale=n&&n.scale||1,this._draggable=n&&n.draggable||!1,this._clickTolerance=n&&n.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=n&&n.rotation||0,this._rotationAlignment=n&&n.rotationAlignment||"auto",this._pitchAlignment=n&&n.pitchAlignment&&"auto"!==n.pitchAlignment?n.pitchAlignment:this._rotationAlignment,n&&n.element)this._element=n.element,this._offset=t.Point.convert(n&&n.offset||[0,0]);else{this._defaultMarker=!0,this._element=r.create("div"),this._element.setAttribute("aria-label","Map marker");var o=r.createNS("http://www.w3.org/2000/svg","svg");o.setAttributeNS(null,"display","block"),o.setAttributeNS(null,"height","41px"),o.setAttributeNS(null,"width","27px"),o.setAttributeNS(null,"viewBox","0 0 27 41");var a=r.createNS("http://www.w3.org/2000/svg","g");a.setAttributeNS(null,"stroke","none"),a.setAttributeNS(null,"stroke-width","1"),a.setAttributeNS(null,"fill","none"),a.setAttributeNS(null,"fill-rule","evenodd");var s=r.createNS("http://www.w3.org/2000/svg","g");s.setAttributeNS(null,"fill-rule","nonzero");var u=r.createNS("http://www.w3.org/2000/svg","g");u.setAttributeNS(null,"transform","translate(3.0, 29.0)"),u.setAttributeNS(null,"fill","#000000");for(var l=0,c=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];l<c.length;l+=1){var p=c[l],h=r.createNS("http://www.w3.org/2000/svg","ellipse");h.setAttributeNS(null,"opacity","0.04"),h.setAttributeNS(null,"cx","10.5"),h.setAttributeNS(null,"cy","5.80029008"),h.setAttributeNS(null,"rx",p.rx),h.setAttributeNS(null,"ry",p.ry),u.appendChild(h)}var f=r.createNS("http://www.w3.org/2000/svg","g");f.setAttributeNS(null,"fill",this._color);var d=r.createNS("http://www.w3.org/2000/svg","path");d.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),f.appendChild(d);var m=r.createNS("http://www.w3.org/2000/svg","g");m.setAttributeNS(null,"opacity","0.25"),m.setAttributeNS(null,"fill","#000000");var y=r.createNS("http://www.w3.org/2000/svg","path");y.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),m.appendChild(y);var g=r.createNS("http://www.w3.org/2000/svg","g");g.setAttributeNS(null,"transform","translate(6.0, 7.0)"),g.setAttributeNS(null,"fill","#FFFFFF");var v=r.createNS("http://www.w3.org/2000/svg","g");v.setAttributeNS(null,"transform","translate(8.0, 8.0)");var _=r.createNS("http://www.w3.org/2000/svg","circle");_.setAttributeNS(null,"fill","#000000"),_.setAttributeNS(null,"opacity","0.25"),_.setAttributeNS(null,"cx","5.5"),_.setAttributeNS(null,"cy","5.5"),_.setAttributeNS(null,"r","5.4999962");var x=r.createNS("http://www.w3.org/2000/svg","circle");x.setAttributeNS(null,"fill","#FFFFFF"),x.setAttributeNS(null,"cx","5.5"),x.setAttributeNS(null,"cy","5.5"),x.setAttributeNS(null,"r","5.4999962"),v.appendChild(_),v.appendChild(x),s.appendChild(u),s.appendChild(f),s.appendChild(m),s.appendChild(g),s.appendChild(v),o.appendChild(s),o.setAttributeNS(null,"height",41*this._scale+"px"),o.setAttributeNS(null,"width",27*this._scale+"px"),this._element.appendChild(o),this._offset=t.Point.convert(n&&n.offset||[0,-14])}this._element.classList.add("mapboxgl-marker"),this._element.addEventListener("dragstart",(function(t){t.preventDefault()})),this._element.addEventListener("mousedown",(function(t){t.preventDefault()})),Li(this._element,this._anchor,"marker"),this._popup=null}return e&&(n.__proto__=e),(n.prototype=Object.create(e&&e.prototype)).constructor=n,n.prototype.addTo=function(t){return this.remove(),this._map=t,t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this},n.prototype.remove=function(){return this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),r.remove(this._element),this._popup&&this._popup.remove(),this},n.prototype.getLngLat=function(){return this._lngLat},n.prototype.setLngLat=function(e){return this._lngLat=t.LngLat.convert(e),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this},n.prototype.getElement=function(){return this._element},n.prototype.setPopup=function(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){var e=Math.sqrt(Math.pow(13.5,2)/2);t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[e,-1*(24.6+e)],"bottom-right":[-e,-1*(24.6+e)],left:[13.5,-24.6],right:[-13.5,-24.6]}:this._offset}this._popup=t,this._lngLat&&this._popup.setLngLat(this._lngLat),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this},n.prototype._onKeyPress=function(t){var e=t.code,r=t.charCode||t.keyCode;"Space"!==e&&"Enter"!==e&&32!==r&&13!==r||this.togglePopup()},n.prototype._onMapClick=function(t){var e=t.originalEvent.target,r=this._element;this._popup&&(e===r||r.contains(e))&&this.togglePopup()},n.prototype.getPopup=function(){return this._popup},n.prototype.togglePopup=function(){var t=this._popup;return t?(t.isOpen()?t.remove():t.addTo(this._map),this):this},n.prototype._update=function(t){if(this._map){this._map.transform.renderWorldCopies&&(this._lngLat=Mi(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(this._lngLat)._add(this._offset);var e="";"viewport"===this._rotationAlignment||"auto"===this._rotationAlignment?e="rotateZ("+this._rotation+"deg)":"map"===this._rotationAlignment&&(e="rotateZ("+(this._rotation-this._map.getBearing())+"deg)");var n="";"viewport"===this._pitchAlignment||"auto"===this._pitchAlignment?n="rotateX(0deg)":"map"===this._pitchAlignment&&(n="rotateX("+this._map.getPitch()+"deg)"),t&&"moveend"!==t.type||(this._pos=this._pos.round()),r.setTransform(this._element,Di[this._anchor]+" translate("+this._pos.x+"px, "+this._pos.y+"px) "+n+" "+e)}},n.prototype.getOffset=function(){return this._offset},n.prototype.setOffset=function(e){return this._offset=t.Point.convert(e),this._update(),this},n.prototype._onMove=function(e){if(!this._isDragging){var r=this._clickTolerance||this._map._clickTolerance;this._isDragging=e.point.dist(this._pointerdownPos)>=r}this._isDragging&&(this._pos=e.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none","pending"===this._state&&(this._state="active",this.fire(new t.Event("dragstart"))),this.fire(new t.Event("drag")))},n.prototype._onUp=function(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),"active"===this._state&&this.fire(new t.Event("dragend")),this._state="inactive"},n.prototype._addDragHandler=function(t){this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(this._pos).add(this._offset),this._pointerdownPos=t.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},n.prototype.setDraggable=function(t){return this._draggable=!!t,this._map&&(t?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this},n.prototype.isDraggable=function(){return this._draggable},n.prototype.setRotation=function(t){return this._rotation=t||0,this._update(),this},n.prototype.getRotation=function(){return this._rotation},n.prototype.setRotationAlignment=function(t){return this._rotationAlignment=t||"auto",this._update(),this},n.prototype.getRotationAlignment=function(){return this._rotationAlignment},n.prototype.setPitchAlignment=function(t){return this._pitchAlignment=t&&"auto"!==t?t:this._rotationAlignment,this._update(),this},n.prototype.getPitchAlignment=function(){return this._pitchAlignment},n}(t.Evented),Oi={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0},Fi=0,Vi=!1,Ui=function(e){function n(r){e.call(this),this.options=t.extend({},Oi,r),t.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker"],this)}return e&&(n.__proto__=e),(n.prototype=Object.create(e&&e.prototype)).constructor=n,n.prototype.onAdd=function(e){var n;return this._map=e,this._container=r.create("div","mapboxgl-ctrl mapboxgl-ctrl-group"),n=this._setupUI,void 0!==Bi?n(Bi):void 0!==t.window.navigator.permissions?t.window.navigator.permissions.query({name:"geolocation"}).then((function(t){n(Bi="denied"!==t.state)})):n(Bi=!!t.window.navigator.geolocation),this._container},n.prototype.onRemove=function(){void 0!==this._geolocationWatchID&&(t.window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),r.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Fi=0,Vi=!1},n.prototype._isOutOfMapMaxBounds=function(t){var e=this._map.getMaxBounds(),r=t.coords;return e&&(r.longitude<e.getWest()||r.longitude>e.getEast()||r.latitude<e.getSouth()||r.latitude>e.getNorth())},n.prototype._setErrorState=function(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting")}},n.prototype._onSuccess=function(e){if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new t.Event("outofmaxbounds",e)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background")}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(e),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove("mapboxgl-user-location-dot-stale"),this.fire(new t.Event("geolocate",e)),this._finish()}},n.prototype._updateCamera=function(e){var r=new t.LngLat(e.coords.longitude,e.coords.latitude),n=e.coords.accuracy,i=this._map.getBearing(),o=t.extend({bearing:i},this.options.fitBoundsOptions);this._map.fitBounds(r.toBounds(n),o,{geolocateSource:!0})},n.prototype._updateMarker=function(e){if(e){var r=new t.LngLat(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(r).addTo(this._map),this._userLocationDotMarker.setLngLat(r).addTo(this._map),this._accuracy=e.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},n.prototype._updateCircleRadius=function(){var t=this._map._container.clientHeight/2,e=this._map.unproject([0,t]),r=this._map.unproject([1,t]),n=e.distanceTo(r),i=Math.ceil(2*this._accuracy/n);this._circleElement.style.width=i+"px",this._circleElement.style.height=i+"px"},n.prototype._onZoom=function(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},n.prototype._onError=function(e){if(this._map){if(this.options.trackUserLocation)if(1===e.code){this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;var r=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=r,this._geolocateButton.setAttribute("aria-label",r),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===e.code&&Vi)return;this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("mapboxgl-user-location-dot-stale"),this.fire(new t.Event("error",e)),this._finish()}},n.prototype._finish=function(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},n.prototype._setupUI=function(e){var n=this;if(this._container.addEventListener("contextmenu",(function(t){return t.preventDefault()})),this._geolocateButton=r.create("button","mapboxgl-ctrl-geolocate",this._container),r.create("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden",!0),this._geolocateButton.type="button",!1===e){t.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");var i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i)}else{var o=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=o,this._geolocateButton.setAttribute("aria-label",o)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=r.create("div","mapboxgl-user-location-dot"),this._userLocationDotMarker=new Ri(this._dotElement),this._circleElement=r.create("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Ri({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",(function(e){e.geolocateSource||"ACTIVE_LOCK"!==n._watchState||e.originalEvent&&"resize"===e.originalEvent.type||(n._watchState="BACKGROUND",n._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),n._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),n.fire(new t.Event("trackuserlocationend")))}))},n.prototype.trigger=function(){if(!this._setup)return t.warnOnce("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new t.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Fi--,Vi=!1,this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this.fire(new t.Event("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new t.Event("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error")}if("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){var e;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),++Fi>1?(e={maximumAge:6e5,timeout:0},Vi=!0):(e=this.options.positionOptions,Vi=!1),this._geolocationWatchID=t.window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,e)}}else t.window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0},n.prototype._clearWatch=function(){t.window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)},n}(t.Evented),ji={maxWidth:100,unit:"metric"},Ni=function(e){this.options=t.extend({},ji,e),t.bindAll(["_onMove","setUnit"],this)};function qi(t,e,r){var n=r&&r.maxWidth||100,i=t._container.clientHeight/2,o=t.unproject([0,i]),a=t.unproject([n,i]),s=o.distanceTo(a);if(r&&"imperial"===r.unit){var u=3.2808*s;u>5280?$i(e,n,u/5280,t._getUIString("ScaleControl.Miles")):$i(e,n,u,t._getUIString("ScaleControl.Feet"))}else r&&"nautical"===r.unit?$i(e,n,s/1852,t._getUIString("ScaleControl.NauticalMiles")):s>=1e3?$i(e,n,s/1e3,t._getUIString("ScaleControl.Kilometers")):$i(e,n,s,t._getUIString("ScaleControl.Meters"))}function $i(t,e,r,n){var i,o,a,s=(i=r,(o=Math.pow(10,(""+Math.floor(i)).length-1))*(a=(a=i/o)>=10?10:a>=5?5:a>=3?3:a>=2?2:a>=1?1:function(t){var e=Math.pow(10,Math.ceil(-Math.log(t)/Math.LN10));return Math.round(t*e)/e}(a)));t.style.width=e*(s/r)+"px",t.innerHTML=s+"&nbsp;"+n}Ni.prototype.getDefaultPosition=function(){return"bottom-left"},Ni.prototype._onMove=function(){qi(this._map,this._container,this.options)},Ni.prototype.onAdd=function(t){return this._map=t,this._container=r.create("div","mapboxgl-ctrl mapboxgl-ctrl-scale",t.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container},Ni.prototype.onRemove=function(){r.remove(this._container),this._map.off("move",this._onMove),this._map=void 0},Ni.prototype.setUnit=function(t){this.options.unit=t,qi(this._map,this._container,this.options)};var Zi=function(e){this._fullscreen=!1,e&&e.container&&(e.container instanceof t.window.HTMLElement?this._container=e.container:t.warnOnce("Full screen control 'container' must be a DOM element.")),t.bindAll(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in t.window.document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in t.window.document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in t.window.document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in t.window.document&&(this._fullscreenchange="MSFullscreenChange")};Zi.prototype.onAdd=function(e){return this._map=e,this._container||(this._container=this._map.getContainer()),this._controlContainer=r.create("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",t.warnOnce("This device does not support fullscreen mode.")),this._controlContainer},Zi.prototype.onRemove=function(){r.remove(this._controlContainer),this._map=null,t.window.document.removeEventListener(this._fullscreenchange,this._changeIcon)},Zi.prototype._checkFullscreenSupport=function(){return!!(t.window.document.fullscreenEnabled||t.window.document.mozFullScreenEnabled||t.window.document.msFullscreenEnabled||t.window.document.webkitFullscreenEnabled)},Zi.prototype._setupUI=function(){var e=this._fullscreenButton=r.create("button","mapboxgl-ctrl-fullscreen",this._controlContainer);r.create("span","mapboxgl-ctrl-icon",e).setAttribute("aria-hidden",!0),e.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),t.window.document.addEventListener(this._fullscreenchange,this._changeIcon)},Zi.prototype._updateTitle=function(){var t=this._getTitle();this._fullscreenButton.setAttribute("aria-label",t),this._fullscreenButton.title=t},Zi.prototype._getTitle=function(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")},Zi.prototype._isFullscreen=function(){return this._fullscreen},Zi.prototype._changeIcon=function(){(t.window.document.fullscreenElement||t.window.document.mozFullScreenElement||t.window.document.webkitFullscreenElement||t.window.document.msFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())},Zi.prototype._onClickFullscreen=function(){this._isFullscreen()?t.window.document.exitFullscreen?t.window.document.exitFullscreen():t.window.document.mozCancelFullScreen?t.window.document.mozCancelFullScreen():t.window.document.msExitFullscreen?t.window.document.msExitFullscreen():t.window.document.webkitCancelFullScreen&&t.window.document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()};var Gi={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},Wi=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", "),Xi=function(e){function n(r){e.call(this),this.options=t.extend(Object.create(Gi),r),t.bindAll(["_update","_onClose","remove","_onMouseMove","_onMouseUp","_onDrag"],this)}return e&&(n.__proto__=e),(n.prototype=Object.create(e&&e.prototype)).constructor=n,n.prototype.addTo=function(e){return this._map&&this.remove(),this._map=e,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("mapboxgl-track-pointer")):this._map.on("move",this._update),this.fire(new t.Event("open")),this},n.prototype.isOpen=function(){return!!this._map},n.prototype.remove=function(){return this._content&&r.remove(this._content),this._container&&(r.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),delete this._map),this.fire(new t.Event("close")),this},n.prototype.getLngLat=function(){return this._lngLat},n.prototype.setLngLat=function(e){return this._lngLat=t.LngLat.convert(e),this._pos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.remove("mapboxgl-track-pointer")),this},n.prototype.trackPointer=function(){return this._trackPointer=!0,this._pos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("mapboxgl-track-pointer")),this},n.prototype.getElement=function(){return this._container},n.prototype.setText=function(e){return this.setDOMContent(t.window.document.createTextNode(e))},n.prototype.setHTML=function(e){var r,n=t.window.document.createDocumentFragment(),i=t.window.document.createElement("body");for(i.innerHTML=e;r=i.firstChild;)n.appendChild(r);return this.setDOMContent(n)},n.prototype.getMaxWidth=function(){return this._container&&this._container.style.maxWidth},n.prototype.setMaxWidth=function(t){return this.options.maxWidth=t,this._update(),this},n.prototype.setDOMContent=function(t){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=r.create("div","mapboxgl-popup-content",this._container);return this._content.appendChild(t),this._createCloseButton(),this._update(),this._focusFirstElement(),this},n.prototype.addClassName=function(t){this._container&&this._container.classList.add(t)},n.prototype.removeClassName=function(t){this._container&&this._container.classList.remove(t)},n.prototype.setOffset=function(t){return this.options.offset=t,this._update(),this},n.prototype.toggleClassName=function(t){if(this._container)return this._container.classList.toggle(t)},n.prototype._createCloseButton=function(){this.options.closeButton&&(this._closeButton=r.create("button","mapboxgl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose))},n.prototype._onMouseUp=function(t){this._update(t.point)},n.prototype._onMouseMove=function(t){this._update(t.point)},n.prototype._onDrag=function(t){this._update(t.point)},n.prototype._update=function(e){var n=this;if(this._map&&(this._lngLat||this._trackPointer)&&this._content&&(this._container||(this._container=r.create("div","mapboxgl-popup",this._map.getContainer()),this._tip=r.create("div","mapboxgl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className&&this.options.className.split(" ").forEach((function(t){return n._container.classList.add(t)})),this._trackPointer&&this._container.classList.add("mapboxgl-popup-track-pointer")),this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=Mi(this._lngLat,this._pos,this._map.transform)),!this._trackPointer||e)){var i=this._pos=this._trackPointer&&e?e:this._map.project(this._lngLat),o=this.options.anchor,a=function e(r){if(r){if("number"==typeof r){var n=Math.round(Math.sqrt(.5*Math.pow(r,2)));return{center:new t.Point(0,0),top:new t.Point(0,r),"top-left":new t.Point(n,n),"top-right":new t.Point(-n,n),bottom:new t.Point(0,-r),"bottom-left":new t.Point(n,-n),"bottom-right":new t.Point(-n,-n),left:new t.Point(r,0),right:new t.Point(-r,0)}}if(r instanceof t.Point||Array.isArray(r)){var i=t.Point.convert(r);return{center:i,top:i,"top-left":i,"top-right":i,bottom:i,"bottom-left":i,"bottom-right":i,left:i,right:i}}return{center:t.Point.convert(r.center||[0,0]),top:t.Point.convert(r.top||[0,0]),"top-left":t.Point.convert(r["top-left"]||[0,0]),"top-right":t.Point.convert(r["top-right"]||[0,0]),bottom:t.Point.convert(r.bottom||[0,0]),"bottom-left":t.Point.convert(r["bottom-left"]||[0,0]),"bottom-right":t.Point.convert(r["bottom-right"]||[0,0]),left:t.Point.convert(r.left||[0,0]),right:t.Point.convert(r.right||[0,0])}}return e(new t.Point(0,0))}(this.options.offset);if(!o){var s,u=this._container.offsetWidth,l=this._container.offsetHeight;s=i.y+a.bottom.y<l?["top"]:i.y>this._map.transform.height-l?["bottom"]:[],i.x<u/2?s.push("left"):i.x>this._map.transform.width-u/2&&s.push("right"),o=0===s.length?"bottom":s.join("-")}var c=i.add(a[o]).round();r.setTransform(this._container,Di[o]+" translate("+c.x+"px,"+c.y+"px)"),Li(this._container,o,"popup")}},n.prototype._focusFirstElement=function(){if(this.options.focusAfterOpen&&this._container){var t=this._container.querySelector(Wi);t&&t.focus()}},n.prototype._onClose=function(){this.remove()},n}(t.Evented),Hi={version:t.version,supported:e,setRTLTextPlugin:t.setRTLTextPlugin,getRTLTextPluginStatus:t.getRTLTextPluginStatus,Map:ki,NavigationControl:Ci,GeolocateControl:Ui,AttributionControl:_i,ScaleControl:Ni,FullscreenControl:Zi,Popup:Xi,Marker:Ri,Style:qe,LngLat:t.LngLat,LngLatBounds:t.LngLatBounds,Point:t.Point,MercatorCoordinate:t.MercatorCoordinate,Evented:t.Evented,config:t.config,prewarm:function(){Ft().acquire(Lt)},clearPrewarmedResources:function(){var t=Rt;t&&(t.isPreloaded()&&1===t.numActive()?(t.release(Lt),Rt=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},get accessToken(){return t.config.ACCESS_TOKEN},set accessToken(e){t.config.ACCESS_TOKEN=e},get baseApiUrl(){return t.config.API_URL},set baseApiUrl(e){t.config.API_URL=e},get workerCount(){return Bt.workerCount},set workerCount(t){Bt.workerCount=t},get maxParallelImageRequests(){return t.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(e){t.config.MAX_PARALLEL_IMAGE_REQUESTS=e},clearStorage:function(e){t.clearTileCache(e)},workerUrl:""};return Hi})),r}()}));var rn={rgb2hsl:nn,rgb2hsv:on,rgb2hwb:an,rgb2cmyk:sn,rgb2keyword:un,rgb2xyz:ln,rgb2lab:cn,rgb2lch:function(t){return vn(cn(t))},hsl2rgb:pn,hsl2hsv:function(t){var e=t[0],r=t[1]/100,n=t[2]/100;if(0===n)return[0,0,0];return[e,100*(2*(r*=(n*=2)<=1?n:2-n)/(n+r)),100*((n+r)/2)]},hsl2hwb:function(t){return an(pn(t))},hsl2cmyk:function(t){return sn(pn(t))},hsl2keyword:function(t){return un(pn(t))},hsv2rgb:hn,hsv2hsl:function(t){var e,r,n=t[0],i=t[1]/100,o=t[2]/100;return e=i*o,[n,100*(e=(e/=(r=(2-i)*o)<=1?r:2-r)||0),100*(r/=2)]},hsv2hwb:function(t){return an(hn(t))},hsv2cmyk:function(t){return sn(hn(t))},hsv2keyword:function(t){return un(hn(t))},hwb2rgb:fn,hwb2hsl:function(t){return nn(fn(t))},hwb2hsv:function(t){return on(fn(t))},hwb2cmyk:function(t){return sn(fn(t))},hwb2keyword:function(t){return un(fn(t))},cmyk2rgb:dn,cmyk2hsl:function(t){return nn(dn(t))},cmyk2hsv:function(t){return on(dn(t))},cmyk2hwb:function(t){return an(dn(t))},cmyk2keyword:function(t){return un(dn(t))},keyword2rgb:bn,keyword2hsl:function(t){return nn(bn(t))},keyword2hsv:function(t){return on(bn(t))},keyword2hwb:function(t){return an(bn(t))},keyword2cmyk:function(t){return sn(bn(t))},keyword2lab:function(t){return cn(bn(t))},keyword2xyz:function(t){return ln(bn(t))},xyz2rgb:mn,xyz2lab:yn,xyz2lch:function(t){return vn(yn(t))},lab2xyz:gn,lab2rgb:_n,lab2lch:vn,lch2lab:xn,lch2xyz:function(t){return gn(xn(t))},lch2rgb:function(t){return _n(xn(t))}};function nn(t){var e,r,n=t[0]/255,i=t[1]/255,o=t[2]/255,a=Math.min(n,i,o),s=Math.max(n,i,o),u=s-a;return s==a?e=0:n==s?e=(i-o)/u:i==s?e=2+(o-n)/u:o==s&&(e=4+(n-i)/u),(e=Math.min(60*e,360))<0&&(e+=360),r=(a+s)/2,[e,100*(s==a?0:r<=.5?u/(s+a):u/(2-s-a)),100*r]}function on(t){var e,r,n=t[0],i=t[1],o=t[2],a=Math.min(n,i,o),s=Math.max(n,i,o),u=s-a;return r=0==s?0:u/s*1e3/10,s==a?e=0:n==s?e=(i-o)/u:i==s?e=2+(o-n)/u:o==s&&(e=4+(n-i)/u),(e=Math.min(60*e,360))<0&&(e+=360),[e,r,s/255*1e3/10]}function an(t){var e=t[0],r=t[1],n=t[2];return[nn(t)[0],100*(1/255*Math.min(e,Math.min(r,n))),100*(n=1-1/255*Math.max(e,Math.max(r,n)))]}function sn(t){var e,r=t[0]/255,n=t[1]/255,i=t[2]/255;return[100*((1-r-(e=Math.min(1-r,1-n,1-i)))/(1-e)||0),100*((1-n-e)/(1-e)||0),100*((1-i-e)/(1-e)||0),100*e]}function un(t){return Sn[JSON.stringify(t)]}function ln(t){var e=t[0]/255,r=t[1]/255,n=t[2]/255;return[100*(.4124*(e=e>.04045?Math.pow((e+.055)/1.055,2.4):e/12.92)+.3576*(r=r>.04045?Math.pow((r+.055)/1.055,2.4):r/12.92)+.1805*(n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92)),100*(.2126*e+.7152*r+.0722*n),100*(.0193*e+.1192*r+.9505*n)]}function cn(t){var e=ln(t),r=e[0],n=e[1],i=e[2];return n/=100,i/=108.883,r=(r/=95.047)>.008856?Math.pow(r,1/3):7.787*r+16/116,[116*(n=n>.008856?Math.pow(n,1/3):7.787*n+16/116)-16,500*(r-n),200*(n-(i=i>.008856?Math.pow(i,1/3):7.787*i+16/116))]}function pn(t){var e,r,n,i,o,a=t[0]/360,s=t[1]/100,u=t[2]/100;if(0==s)return[o=255*u,o,o];e=2*u-(r=u<.5?u*(1+s):u+s-u*s),i=[0,0,0];for(var l=0;l<3;l++)(n=a+1/3*-(l-1))<0&&n++,n>1&&n--,o=6*n<1?e+6*(r-e)*n:2*n<1?r:3*n<2?e+(r-e)*(2/3-n)*6:e,i[l]=255*o;return i}function hn(t){var e=t[0]/60,r=t[1]/100,n=t[2]/100,i=Math.floor(e)%6,o=e-Math.floor(e),a=255*n*(1-r),s=255*n*(1-r*o),u=255*n*(1-r*(1-o));n*=255;switch(i){case 0:return[n,u,a];case 1:return[s,n,a];case 2:return[a,n,u];case 3:return[a,s,n];case 4:return[u,a,n];case 5:return[n,a,s]}}function fn(t){var e,n,i,o,a=t[0]/360,s=t[1]/100,u=t[2]/100,l=s+u;switch(l>1&&(s/=l,u/=l),i=6*a-(e=Math.floor(6*a)),0!=(1&e)&&(i=1-i),o=s+i*((n=1-u)-s),e){default:case 6:case 0:r=n,g=o,b=s;break;case 1:r=o,g=n,b=s;break;case 2:r=s,g=n,b=o;break;case 3:r=s,g=o,b=n;break;case 4:r=o,g=s,b=n;break;case 5:r=n,g=s,b=o}return[255*r,255*g,255*b]}function dn(t){var e=t[0]/100,r=t[1]/100,n=t[2]/100,i=t[3]/100;return[255*(1-Math.min(1,e*(1-i)+i)),255*(1-Math.min(1,r*(1-i)+i)),255*(1-Math.min(1,n*(1-i)+i))]}function mn(t){var e,r,n,i=t[0]/100,o=t[1]/100,a=t[2]/100;return r=-.9689*i+1.8758*o+.0415*a,n=.0557*i+-.204*o+1.057*a,e=(e=3.2406*i+-1.5372*o+-.4986*a)>.0031308?1.055*Math.pow(e,1/2.4)-.055:e*=12.92,r=r>.0031308?1.055*Math.pow(r,1/2.4)-.055:r*=12.92,n=n>.0031308?1.055*Math.pow(n,1/2.4)-.055:n*=12.92,[255*(e=Math.min(Math.max(0,e),1)),255*(r=Math.min(Math.max(0,r),1)),255*(n=Math.min(Math.max(0,n),1))]}function yn(t){var e=t[0],r=t[1],n=t[2];return r/=100,n/=108.883,e=(e/=95.047)>.008856?Math.pow(e,1/3):7.787*e+16/116,[116*(r=r>.008856?Math.pow(r,1/3):7.787*r+16/116)-16,500*(e-r),200*(r-(n=n>.008856?Math.pow(n,1/3):7.787*n+16/116))]}function gn(t){var e,r,n,i,o=t[0],a=t[1],s=t[2];return o<=8?i=(r=100*o/903.3)/100*7.787+16/116:(r=100*Math.pow((o+16)/116,3),i=Math.pow(r/100,1/3)),[e=e/95.047<=.008856?e=95.047*(a/500+i-16/116)/7.787:95.047*Math.pow(a/500+i,3),r,n=n/108.883<=.008859?n=108.883*(i-s/200-16/116)/7.787:108.883*Math.pow(i-s/200,3)]}function vn(t){var e,r=t[0],n=t[1],i=t[2];return(e=360*Math.atan2(i,n)/2/Math.PI)<0&&(e+=360),[r,Math.sqrt(n*n+i*i),e]}function _n(t){return mn(gn(t))}function xn(t){var e,r=t[0],n=t[1];return e=t[2]/360*2*Math.PI,[r,n*Math.cos(e),n*Math.sin(e)]}function bn(t){return wn[t]}var wn={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},Sn={};for(var An in wn)Sn[JSON.stringify(wn[An])]=An;var En=function(){return new Cn};for(var Tn in rn){En[Tn+"Raw"]=function(t){return function(e){return"number"==typeof e&&(e=Array.prototype.slice.call(arguments)),rn[t](e)}}(Tn);var kn=/(\w+)2(\w+)/.exec(Tn),In=kn[1],zn=kn[2];(En[In]=En[In]||{})[zn]=En[Tn]=function(t){return function(e){"number"==typeof e&&(e=Array.prototype.slice.call(arguments));var r=rn[t](e);if("string"==typeof r||void 0===r)return r;for(var n=0;n<r.length;n++)r[n]=Math.round(r[n]);return r}}(Tn)}var Cn=function(){this.convs={}};function Pn(t){let e,r,n;const i=t[4].default,o=p(i,t,t[3],null);return{c(){e=A("img"),o&&o.c(),e.src!==(r="./img/scroll-down-"+t[0]+".svg")&&C(e,"src",r),C(e,"class","arrow left svelte-1prdo3z"),C(e,"alt",""),C(e,"aria-hidden","true"),V(e,"bounce",t[1])},m(t,r){w(t,e,r),o&&o.m(t,r),n=!0},p(t,a){(!n||1&a&&e.src!==(r="./img/scroll-down-"+t[0]+".svg"))&&C(e,"src",r),2&a&&V(e,"bounce",t[1]),o&&o.p&&8&a&&f(o,i,t,t[3],a,null,null)},i(t){n||(st(o,t),n=!0)},o(t){ut(o,t),n=!1},d(t){t&&S(e),o&&o.d(t)}}}function Mn(t){let e,r,n,i,o;const a=t[4].default,s=p(a,t,t[3],null);return{c(){s&&s.c(),e=A("br"),r=k(),n=A("img"),n.src!==(i="./img/scroll-down-"+t[0]+".svg")&&C(n,"src",i),C(n,"class","arrow svelte-1prdo3z"),C(n,"alt",""),C(n,"aria-hidden","true"),V(n,"bounce",t[1])},m(t,i){s&&s.m(t,i),w(t,e,i),w(t,r,i),w(t,n,i),o=!0},p(t,e){s&&s.p&&8&e&&f(s,a,t,t[3],e,null,null),(!o||1&e&&n.src!==(i="./img/scroll-down-"+t[0]+".svg"))&&C(n,"src",i),2&e&&V(n,"bounce",t[1])},i(t){o||(st(s,t),o=!0)},o(t){ut(s,t),o=!1},d(t){s&&s.d(t),t&&S(e),t&&S(r),t&&S(n)}}}function Dn(t){let e,r,n,i;const o=[Mn,Pn],a=[];function s(t,e){return t[2]?0:1}return e=s(t),r=a[e]=o[e](t),{c(){r.c(),n=I()},m(t,r){a[e].m(t,r),w(t,n,r),i=!0},p(t,[i]){let u=e;e=s(t),e===u?a[e].p(t,i):(ot(),ut(a[u],1,1,(()=>{a[u]=null})),at(),r=a[e],r?r.p(t,i):(r=a[e]=o[e](t),r.c()),st(r,1),r.m(n.parentNode,n))},i(t){i||(st(r),i=!0)},o(t){ut(r),i=!1},d(t){a[e].d(t),t&&S(n)}}}function Ln(t,e,r){let{$$slots:n={},$$scope:i}=e,{color:o="black"}=e,{animation:a=!0}=e,{center:s=!0}=e;return o=["black","white"].includes(o)?o:"black",t.$$set=t=>{"color"in t&&r(0,o=t.color),"animation"in t&&r(1,a=t.animation),"center"in t&&r(2,s=t.center),"$$scope"in t&&r(3,i=t.$$scope)},[o,a,s,i,n]}Cn.prototype.routeSpace=function(t,e){var r=e[0];return void 0===r?this.getValues(t):("number"==typeof r&&(r=Array.prototype.slice.call(e)),this.setValues(t,r))},Cn.prototype.setValues=function(t,e){return this.space=t,this.convs={},this.convs[t]=e,this},Cn.prototype.getValues=function(t){var e=this.convs[t];if(!e){var r=this.space,n=this.convs[r];e=En[r][t](n),this.convs[t]=e}return e},["rgb","hsl","hsv","cmyk","keyword"].forEach((function(t){Cn.prototype[t]=function(e){return this.routeSpace(t,arguments)}}));class Bn extends vt{constructor(t){super(),gt(this,t,Ln,Dn,u,{color:0,animation:1,center:2})}}function Rn(t){return"[object Date]"===Object.prototype.toString.call(t)}function On(t,e){if(t===e||t!=t)return()=>t;const r=typeof t;if(r!==typeof e||Array.isArray(t)!==Array.isArray(e))throw new Error("Cannot interpolate values of different type");if(Array.isArray(t)){const r=e.map(((e,r)=>On(t[r],e)));return t=>r.map((e=>e(t)))}if("object"===r){if(!t||!e)throw new Error("Object cannot be null");if(Rn(t)&&Rn(e)){t=t.getTime();const r=(e=e.getTime())-t;return e=>new Date(t+e*r)}const r=Object.keys(e),n={};return r.forEach((r=>{n[r]=On(t[r],e[r])})),t=>{const e={};return r.forEach((r=>{e[r]=n[r](t)})),e}}if("number"===r){const r=e-t;return e=>t+e*r}throw new Error(`Cannot interpolate ${r} values`)}function Fn(t,r={}){const i=bt(t);let o,a=t;function s(s,u){if(null==t)return i.set(t=s),Promise.resolve();a=s;let l=o,c=!1,{delay:p=0,duration:h=400,easing:f=e,interpolate:d=On}=n(n({},r),u);if(0===h)return l&&(l.abort(),l=null),i.set(t=a),Promise.resolve();const g=m()+p;let x;return o=function(t){let e;return 0===v.size&&y(_),{promise:new Promise((r=>{v.add(e={c:t,f:r})})),abort(){v.delete(e)}}}((e=>{if(e<g)return!0;c||(x=d(t,s),"function"==typeof h&&(h=h(t,s)),c=!0),l&&(l.abort(),l=null);const r=e-g;return r>h?(i.set(t=s),!1):(i.set(t=x(f(r/h))),!0)})),o.promise}return{set:s,update:(e,r)=>s(e(a,t),r),subscribe:i.subscribe}}function Vn(t){let e,r,i=[{style:""},{d:t[0]},{transform:r=`scale(${t[5].width})`},{fill:t[2]}],o={};for(let t=0;t<i.length;t+=1)o=n(o,i[t]);return{c(){e=E("path"),P(e,o)},m(t,r){w(t,e,r)},p(t,n){P(e,o=pt(i,[{style:""},1&n&&{d:t[0]},32&n&&r!==(r=`scale(${t[5].width})`)&&{transform:r},4&n&&{fill:t[2]}]))},d(t){t&&S(e)}}}function Un(t){let e,r,i,o=[{style:""},{height:r=t[5].height},{width:i=t[5].width},{fill:t[2]},{"fill-opacity":t[4]}],a={};for(let t=0;t<o.length;t+=1)a=n(a,o[t]);return{c(){e=E("rect"),P(e,a)},m(t,r){w(t,e,r)},p(t,n){P(e,a=pt(o,[{style:""},32&n&&r!==(r=t[5].height)&&{height:r},32&n&&i!==(i=t[5].width)&&{width:i},4&n&&{fill:t[2]},16&n&&{"fill-opacity":t[4]}]))},d(t){t&&S(e)}}}function jn(t){let e,r,n,i;return{c(){e=E("circle"),C(e,"r",r=t[5].width/6),C(e,"cx",n=t[1]/2),C(e,"cy",i=t[1]/2),C(e,"fill","black")},m(t,r){w(t,e,r)},p(t,o){32&o&&r!==(r=t[5].width/6)&&C(e,"r",r),2&o&&n!==(n=t[1]/2)&&C(e,"cx",n),2&o&&i!==(i=t[1]/2)&&C(e,"cy",i)},d(t){t&&S(e)}}}function Nn(e){let r,n,i;function o(t,e){return"rect"===t[0]?Un:Vn}let a=o(e),s=a(e),u=e[3]&&jn(e);return{c(){r=E("g"),s.c(),n=I(),u&&u.c(),C(r,"class","cell"),C(r,"transform",i=`translate(${e[5].x}, ${e[5].y})`)},m(t,e){w(t,r,e),s.m(r,null),x(r,n),u&&u.m(r,null)},p(t,[e]){a===(a=o(t))&&s?s.p(t,e):(s.d(1),s=a(t),s&&(s.c(),s.m(r,n))),t[3]?u?u.p(t,e):(u=jn(t),u.c(),u.m(r,null)):u&&(u.d(1),u=null),32&e&&i!==(i=`translate(${t[5].x}, ${t[5].y})`)&&C(r,"transform",i)},i:t,o:t,d(t){t&&S(r),s.d(),u&&u.d()}}}function qn(t,e,r){let n,{duration:i=5e3}=e,{shape:o="rect"}=e,{x:a}=e,{y:s}=e,{width:u}=e,{height:l}=e,{fill:p="red"}=e,{stroked:h=!1}=e,{fillOpacity:f=1}=e,{id:d}=e,{attrs:m}=e;const y=Fn({x:a,y:s,width:u,height:l},{duration:i,interpolate:ze});return c(t,y,(t=>r(5,n=t))),t.$$set=t=>{"duration"in t&&r(7,i=t.duration),"shape"in t&&r(0,o=t.shape),"x"in t&&r(8,a=t.x),"y"in t&&r(9,s=t.y),"width"in t&&r(1,u=t.width),"height"in t&&r(10,l=t.height),"fill"in t&&r(2,p=t.fill),"stroked"in t&&r(3,h=t.stroked),"fillOpacity"in t&&r(4,f=t.fillOpacity),"id"in t&&r(11,d=t.id),"attrs"in t&&r(12,m=t.attrs)},t.$$.update=()=>{var e;1794&t.$$.dirty&&(e={x:a,y:s,width:u,height:l},y.set(e))},[o,u,p,h,f,n,y,i,a,s,l,d,m]}class $n extends vt{constructor(t){super(),gt(this,t,qn,Nn,u,{duration:7,shape:0,x:8,y:9,width:1,height:10,fill:2,stroked:3,fillOpacity:4,id:11,attrs:12})}}function Zn(e){let r,n,i,o,a,s,u,l,c,p,h,f,d,m,y,g,v,_,b,E,I,z,P,M,L,B,R,O,F=e[0].vinf+"",V=e[0].vtot+"",U=e[0].nvinf+"",j=e[0].nvtot+"",N=e[1].toPrecision(3)+"";return{c(){r=A("div"),n=A("div"),n.textContent="Efficacy:",i=k(),o=A("div"),a=A("div"),a.textContent="1- ",s=k(),u=A("div"),l=A("div"),c=A("span"),p=T("("),h=T(F),f=T("/"),d=T(V),m=T(")"),y=k(),g=A("div"),v=A("span"),_=T("("),b=T(U),E=T("/"),I=T(j),z=T(")"),P=k(),M=A("div"),L=T("= "),B=A("span"),R=T(N),O=T("%"),C(n,"class","eq__lead svelte-15dkc2w"),C(a,"class","big1 svelte-15dkc2w"),C(c,"class","triangle-up svelte-15dkc2w"),C(l,"class","num svelte-15dkc2w"),C(v,"class","triangle-up svelte-15dkc2w"),C(g,"class","den svelte-15dkc2w"),C(u,"class","divider svelte-15dkc2w"),C(B,"class","bigsign"),C(M,"class","efficacy svelte-15dkc2w"),C(o,"class","eq svelte-15dkc2w"),C(r,"class","label svelte-15dkc2w")},m(t,e){w(t,r,e),x(r,n),x(r,i),x(r,o),x(o,a),x(o,s),x(o,u),x(u,l),x(l,c),x(c,p),x(c,h),x(c,f),x(c,d),x(c,m),x(u,y),x(u,g),x(g,v),x(v,_),x(v,b),x(v,E),x(v,I),x(v,z),x(o,P),x(o,M),x(M,L),x(M,B),x(B,R),x(B,O)},p(t,[e]){1&e&&F!==(F=t[0].vinf+"")&&D(h,F),1&e&&V!==(V=t[0].vtot+"")&&D(d,V),1&e&&U!==(U=t[0].nvinf+"")&&D(b,U),1&e&&j!==(j=t[0].nvtot+"")&&D(I,j),2&e&&N!==(N=t[1].toPrecision(3)+"")&&D(R,N)},i:t,o:t,d(t){t&&S(r)}}}function Gn(t,e,r){let n,{data:i}=e,{scale:o}=e;return t.$$set=t=>{"data"in t&&r(0,i=t.data),"scale"in t&&r(2,o=t.scale)},t.$$.update=()=>{if(1&t.$$.dirty){let t=i.nvinf/i.nvtot,e=i.vinf/i.vtot;r(1,n=100*(1-e/t))}},[i,n,o]}class Wn extends vt{constructor(t){super(),gt(this,t,Gn,Zn,u,{data:0,scale:2})}}function Xn(t,e,r){const n=t.slice();return n[28]=e[r],n}function Hn(t,e,r){const n=t.slice();return n[31]=e[r],n}function Kn(t){let e,r,n,i;return e=new Dr({props:{$$slots:{default:[Jn]},$$scope:{ctx:t}}}),n=new Ir({props:{$$slots:{default:[ei]},$$scope:{ctx:t}}}),{c(){ft(e.$$.fragment),r=k(),ft(n.$$.fragment)},m(t,o){dt(e,t,o),w(t,r,o),dt(n,t,o),i=!0},p(t,r){const i={};3&r[0]|8&r[1]&&(i.$$scope={dirty:r,ctx:t}),e.$set(i);const o={};4&r[0]|8&r[1]&&(o.$$scope={dirty:r,ctx:t}),n.$set(o)},i(t){i||(st(e.$$.fragment,t),st(n.$$.fragment,t),i=!0)},o(t){ut(e.$$.fragment,t),ut(n.$$.fragment,t),i=!1},d(t){mt(e,t),t&&S(r),mt(n,t)}}}function Yn(t,e){let r,i,o;const a=[e[31],{duration:e[0]}];let s={};for(let t=0;t<a.length;t+=1)s=n(s,a[t]);return i=new $n({props:s}),{key:t,first:null,c(){r=E("g"),ft(i.$$.fragment),this.first=r},m(t,e){w(t,r,e),dt(i,r,null),o=!0},p(t,e){const r=3&e[0]?pt(a,[2&e[0]&&(n=t[31],"object"==typeof n&&null!==n?n:{}),1&e[0]&&{duration:t[0]}]):{};var n;i.$set(r)},i(t){o||(st(i.$$.fragment,t),o=!0)},o(t){ut(i.$$.fragment,t),o=!1},d(t){t&&S(r),mt(i)}}}function Jn(t){let e,r,n=[],i=new Map,o=t[1];const a=t=>t[31].id;for(let e=0;e<o.length;e+=1){let r=Hn(t,o,e),s=a(r);i.set(s,n[e]=Yn(s,r))}return{c(){for(let t=0;t<n.length;t+=1)n[t].c();e=I()},m(t,i){for(let e=0;e<n.length;e+=1)n[e].m(t,i);w(t,e,i),r=!0},p(t,r){if(3&r[0]){const o=t[1];ot(),n=function(t,e,r,n,i,o,a,s,u,l,c,p){let h=t.length,f=o.length,d=h;const m={};for(;d--;)m[t[d].key]=d;const y=[],g=new Map,v=new Map;for(d=f;d--;){const t=p(i,o,d),s=r(t);let u=a.get(s);u?n&&u.p(t,e):(u=l(s,t),u.c()),g.set(s,y[d]=u),s in m&&v.set(s,Math.abs(d-m[s]))}const _=new Set,x=new Set;function b(t){st(t,1),t.m(s,c),a.set(t.key,t),c=t.first,f--}for(;h&&f;){const e=y[f-1],r=t[h-1],n=e.key,i=r.key;e===r?(c=e.first,h--,f--):g.has(i)?!a.has(n)||_.has(n)?b(e):x.has(i)?h--:v.get(n)>v.get(i)?(x.add(n),b(e)):(_.add(i),h--):(u(r,a),h--)}for(;h--;){const e=t[h];g.has(e.key)||u(e,a)}for(;f;)b(y[f-1]);return y}(n,r,a,1,t,o,i,e.parentNode,ct,Yn,e,Hn),at()}},i(t){if(!r){for(let t=0;t<o.length;t+=1)st(n[t]);r=!0}},o(t){for(let t=0;t<n.length;t+=1)ut(n[t]);r=!1},d(t){for(let e=0;e<n.length;e+=1)n[e].d(t);t&&S(e)}}}function Qn(t){let e,r,n=t[2].labels,i=[];for(let e=0;e<n.length;e+=1)i[e]=ti(Xn(t,n,e));const o=t=>ut(i[t],1,1,(()=>{i[t]=null}));return{c(){for(let t=0;t<i.length;t+=1)i[t].c();e=I()},m(t,n){for(let e=0;e<i.length;e+=1)i[e].m(t,n);w(t,e,n),r=!0},p(t,r){if(4&r[0]){let a;for(n=t[2].labels,a=0;a<n.length;a+=1){const o=Xn(t,n,a);i[a]?(i[a].p(o,r),st(i[a],1)):(i[a]=ti(o),i[a].c(),st(i[a],1),i[a].m(e.parentNode,e))}for(ot(),a=n.length;a<i.length;a+=1)o(a);at()}},i(t){if(!r){for(let t=0;t<n.length;t+=1)st(i[t]);r=!0}},o(t){i=i.filter(Boolean);for(let t=0;t<i.length;t+=1)ut(i[t]);r=!1},d(t){!function(t,e){for(let r=0;r<t.length;r+=1)t[r]&&t[r].d(e)}(i,t),t&&S(e)}}}function ti(t){let e,r,n,i,o;return r=new Wn({props:{data:t[28].stats,scale:t[28].scale}}),{c(){e=A("div"),ft(r.$$.fragment),n=k(),C(e,"class","label__wrapper svelte-1nw32e1"),C(e,"style",i=`left: ${t[28].x}px; bottom: -${t[28].y}px; _width: ${t[28].width}px`)},m(t,i){w(t,e,i),dt(r,e,null),x(e,n),o=!0},p(t,n){const a={};4&n[0]&&(a.data=t[28].stats),4&n[0]&&(a.scale=t[28].scale),r.$set(a),(!o||4&n[0]&&i!==(i=`left: ${t[28].x}px; bottom: -${t[28].y}px; _width: ${t[28].width}px`))&&C(e,"style",i)},i(t){o||(st(r.$$.fragment,t),o=!0)},o(t){ut(r.$$.fragment,t),o=!1},d(t){t&&S(e),mt(r)}}}function ei(t){let e,r,n=t[2]&&Qn(t);return{c(){n&&n.c(),e=I()},m(t,i){n&&n.m(t,i),w(t,e,i),r=!0},p(t,r){t[2]?n?(n.p(t,r),4&r[0]&&st(n,1)):(n=Qn(t),n.c(),st(n,1),n.m(e.parentNode,e)):n&&(ot(),ut(n,1,1,(()=>{n=null})),at())},i(t){r||(st(n),r=!0)},o(t){ut(n),r=!1},d(t){n&&n.d(t),t&&S(e)}}}function ri(t){let e,r,n=t[3]>100&&Kn(t);return{c(){n&&n.c(),e=I()},m(t,i){n&&n.m(t,i),w(t,e,i),r=!0},p(t,r){t[3]>100?n?(n.p(t,r),8&r[0]&&st(n,1)):(n=Kn(t),n.c(),st(n,1),n.m(e.parentNode,e)):n&&(ot(),ut(n,1,1,(()=>{n=null})),at())},i(t){r||(st(n),r=!0)},o(t){ut(n),r=!1},d(t){n&&n.d(t),t&&S(e)}}}function ni(t){let e={};return e.vtot=t.filter((t=>t.vaccinated)).length,e.vinf=t.filter((t=>t.vaccinated)).filter((t=>t.infected)).length,e.nvtot=t.filter((t=>!t.vaccinated)).length,e.nvinf=t.filter((t=>!t.vaccinated)).filter((t=>t.infected)).length,console.log("Groups stats: ",e),e}function ii(t,e,r){let n,i,o,a,s;const{data:u,containerWidth:l,width:p,height:h,padding:f}=$("LayerCake");c(t,u,(t=>r(22,o=t))),c(t,l,(t=>r(3,n=t))),c(t,p,(t=>r(23,a=t))),c(t,h,(t=>r(21,i=t))),c(t,f,(t=>r(24,s=t)));let{columns:d=10}=e,{colors:m={NV:"red",V:"green"}}=e,{columnWidth:y=.03}=e,{gridPad:g=10}=e,{cellPadding:v=.1}=e,{labels:_=[]}=e,{animated:x=!1}=e,{duration:b=2e3}=e,{groupedByAge:w=!1}=e,S="M 0 0.933 L 1 0.933 L 0.5 0.067 z";function A(t,e="vaccinated",r=10,n=600,o=0,a=0,s=.25){let u=[],l=Vt().domain([0,1]).range([0,n]).paddingOuter(.1).paddingInner(.1),c=Vt().domain(Bt(r)).range([0,l.bandwidth()]).padding(.1),p=nr().domain([0,i]).range([i-c.bandwidth(),0]),h=(t,e,n)=>{let i=l(n)+c(e%r)+o,s=c.step()*parseInt(e/r)+a;return s=p(s),{x:i,y:s,width:c.bandwidth(),height:c.bandwidth(),id:t.id,attrs:{...t},fill:t.vaccinated?"green":"red",shape:t.infected?S:"rect",stroked:"U50"===t.age}},f=0,d=t.filter((t=>t.vaccinated)).sort(((t,e)=>t.infected===e.infected?0:t.infected?1:-1));return d.forEach((t=>{u.push(h(t,f++,0))})),f=0,d=t.filter((t=>!t.vaccinated)).sort(((t,e)=>t.infected===e.infected?0:t.infected?1:-1)),d.forEach((t=>{u.push(h(t,f++,1))})),u}let E,T,k,I,z=[],C=t=>{r(2,I=t),console.log("Context: ",I),I.cells&&r(1,z=I.cells)};return t.$$set=t=>{"columns"in t&&r(9,d=t.columns),"colors"in t&&r(10,m=t.colors),"columnWidth"in t&&r(11,y=t.columnWidth),"gridPad"in t&&r(12,g=t.gridPad),"cellPadding"in t&&r(13,v=t.cellPadding),"labels"in t&&r(14,_=t.labels),"animated"in t&&r(15,x=t.animated),"duration"in t&&r(0,b=t.duration),"groupedByAge"in t&&r(16,w=t.groupedByAge)},t.$$.update=()=>{if(t.$$.dirty[0],29753344&t.$$.dirty[0]){r(18,T={cells:A(o,"vaccinated",20,a),labels:[]}),r(18,T.labels=[{x:a/2,y:s.bottom,stats:ni(o),scale:.5,width:.7*a}],T);let t=[];r(17,E=o.filter((t=>"O50"===t.age))),t.push({x:3*a/4,y:s.bottom,stats:ni(E),scale:.3,width:.35*a});let e=A(E,"vaccinated",10,a/2,a/2);r(17,E=o.filter((t=>"U50"===t.age))),t.push({x:a/4,y:s.bottom,stats:ni(E),scale:.3,width:.35*a});let n=A(E,"vaccinated",10,a/2);r(19,k={cells:e.concat(n),labels:t}),C(T)}851968&t.$$.dirty[0]&&(w?(console.log("Switching to minor grids"),C(k)):(console.log("Switching to major grids"),C(T))),8388620&t.$$.dirty[0]&&console.log("Context changed: ",I,a,n)},r(2,I={labels:[]}),[b,z,I,n,u,l,p,h,f,d,m,y,g,v,_,x,w]}class oi extends vt{constructor(t){super(),gt(this,t,ii,ri,u,{columns:9,colors:10,columnWidth:11,gridPad:12,cellPadding:13,labels:14,animated:15,duration:0,groupedByAge:16},[-1,-1])}}function ai(t){let e,r;return e=new oi({props:{animated:t[3],groupedByAge:t[1]}}),{c(){ft(e.$$.fragment)},m(t,n){dt(e,t,n),r=!0},p(t,r){const n={};8&r&&(n.animated=t[3]),2&r&&(n.groupedByAge=t[1]),e.$set(n)},i(t){r||(st(e.$$.fragment,t),r=!0)},o(t){ut(e.$$.fragment,t),r=!1},d(t){mt(e,t)}}}function si(t){let e,r,n,i,o,a,s=t[3]?"pause":"resume";return{c(){e=A("div"),r=A("div"),n=A("button"),i=T(s),V(n,"active",t[3]),C(r,"class","animate"),C(e,"class","chart__controls")},m(s,u){w(s,e,u),x(e,r),x(r,n),x(n,i),o||(a=z(n,"click",t[6]),o=!0)},p(t,e){8&e&&s!==(s=t[3]?"pause":"resume")&&D(i,s),8&e&&V(n,"active",t[3])},d(t){t&&S(e),o=!1,a()}}}function ui(t){let e,r,n,i,o,a;n=new Er({props:{padding:{top:20,bottom:t[4],left:0,right:0},yDomain:[0,null],data:t[5],$$slots:{default:[ai]},$$scope:{ctx:t}}});let s=t[0]&&si(t);return{c(){e=A("div"),r=A("div"),ft(n.$$.fragment),i=k(),s&&s.c(),C(r,"class","chart-container svelte-1a7f2s9"),C(e,"class","chart__wrapper svelte-1a7f2s9"),Y((()=>t[7].call(e)))},m(u,l){w(u,e,l),x(e,r),dt(n,r,null),x(e,i),s&&s.m(e,null),o=F(e,t[7].bind(e)),a=!0},p(t,[r]){const i={};16&r&&(i.padding={top:20,bottom:t[4],left:0,right:0}),1034&r&&(i.$$scope={dirty:r,ctx:t}),n.$set(i),t[0]?s?s.p(t,r):(s=si(t),s.c(),s.m(e,null)):s&&(s.d(1),s=null)},i(t){a||(st(n.$$.fragment,t),a=!0)},o(t){ut(n.$$.fragment,t),a=!1},d(t){t&&S(e),mt(n),s&&s.d(),o()}}}function li(t,e,r){let n,{controls:i=!1}=e,{groupedByAge:o=!1}=e,a=!1,s=[],u=!0;setInterval((()=>{a&&(u?(u=!1,console.log("Big grid: ",u),switchContext(minGrids)):(u=!0,console.log("Big grid: ",u),switchContext(majGrids)))}),1e4);let l;t.$$set=t=>{"controls"in t&&r(0,i=t.controls),"groupedByAge"in t&&r(1,o=t.groupedByAge)},t.$$.update=()=>{4&t.$$.dirty&&r(4,l=n>600?120:n>400?100:75)};{let t=0,e=(e,r)=>{for(let n=0;n<r;n++)s.push({...e,id:t++})};e({vaccinated:!1,infected:!1,age:"O50"},1),e({vaccinated:!1,infected:!0,age:"O50"},17),e({vaccinated:!1,infected:!1,age:"U50"},107),e({vaccinated:!1,infected:!0,age:"U50"},4),e({vaccinated:!0,infected:!1,age:"O50"},188),e({vaccinated:!0,infected:!0,age:"O50"},29),e({vaccinated:!0,infected:!1,age:"U50"},349),e({vaccinated:!0,infected:!0,age:"U50"},1),console.log(s)}return[i,o,n,a,l,s,()=>r(3,a=!a),function(){n=this.clientHeight,r(2,n)}]}class ci extends vt{constructor(t){super(),gt(this,t,li,ui,u,{controls:0,groupedByAge:1})}}function pi(t){let e;return{c(){e=A("span"),e.textContent="Scroll to begin",C(e,"class","_bg-white")},m(t,r){w(t,e,r)},d(t){t&&S(e)}}}function hi(t){let e,r,n,i,o;return i=new Bn({props:{color:"_white",animation:wi,$$slots:{default:[pi]},$$scope:{ctx:t}}}),{c(){e=A("h1"),e.textContent="Visualizing Simpson's Paradox in Covid Vaccine Efficacy",r=k(),n=A("div"),ft(i.$$.fragment),C(e,"class","_text-shadow bg-white svelte-1ist5j1"),C(n,"class","_text-shadow"),L(n,"margin-top","48px")},m(t,a){w(t,e,a),w(t,r,a),w(t,n,a),dt(i,n,null),o=!0},p(t,e){const r={};8192&e&&(r.$$scope={dirty:e,ctx:t}),i.$set(r)},i(t){o||(st(i.$$.fragment,t),o=!0)},o(t){ut(i.$$.fragment,t),o=!1},d(t){t&&S(e),t&&S(r),t&&S(n),mt(i)}}}function fi(t){let e,r,n,i,o,a,s,u,l,c,p,h,f;return{c(){e=A("h2"),e.textContent="Simpson's Paradox",r=k(),n=A("p"),n.innerHTML='I recently came across a tweet which mentioned the likelihood that recent\n      Covid vaccine efficacy stats coming out of Israel were an example of a\n      famous statistical paradox generally attributed to the British\n      statistician Edward Simpson but noticed by a number of predecessors (see\n      the <a href="https://en.wikipedia.org/wiki/Simpson%27s_paradox">Wikipedia entry</a> for details). Here&#39;s the tweet in question:',i=k(),o=A("div"),o.innerHTML='<img src="img/bak-coleman-tweet.png" alt=""/>',a=k(),s=A("p"),s.textContent="The paradox is that while the efficacy (we'll deal with how this is\n      measured shortly) of the vaccine when assessed against the whole\n      population of unvaccinated and fully vaccinated (67.5%) looks low, if we\n      separate the population into over and under 50 years old the efficacy for\n      each of those groups is considerably higher at 91.8% for under 50s and\n      85.2% for over 50s.",u=k(),l=A("p"),l.textContent="While it's very cool to have an example of a canonical paradox in the\n      wild, one usually encountered as an interesting statistical quirk while\n      studying the subject, in this case, as highlighted by Bak-Coleman, failure\n      to appreciate the paradoxical results could result in detrimental policy\n      decisions.",c=k(),p=A("p"),p.textContent="If we take that low efficacy of 67.5% for the whole population it suggests\n      the need of a booster shot for the currently vaccinated, diverting those\n      vaccines from the unvaccinated. But if we deal with the over and under 50s\n      separately their respective efficacies at 85.2% and 91.8% seem healthy\n      enough and suggest not diverting first and second vaccine shots to boost\n      the vaccinated with a third.",h=k(),f=A("p"),f.textContent="So Simpson's paradox is not only interesting in its own right but in this\n      case failure to appreciate it could do harm. Like most good paradoxes,\n      Simpson's is hard to grasp and rather counterintuitive. It seems like a\n      good candidate for some data visualization which can help people to that\n      'aha' moment. There are various ones about but it occurred to me that this\n      was a good case for creating an animated chart where you clearly see the\n      morphing of the whole of the aggregated vaccinated and unvaccinated into\n      age related groups and appreciate the way in which this affects the\n      measured efficacies.",C(o,"class","tweet__image")},m(t,d){w(t,e,d),w(t,r,d),w(t,n,d),w(t,i,d),w(t,o,d),w(t,a,d),w(t,s,d),w(t,u,d),w(t,l,d),w(t,c,d),w(t,p,d),w(t,h,d),w(t,f,d)},d(t){t&&S(e),t&&S(r),t&&S(n),t&&S(i),t&&S(o),t&&S(a),t&&S(s),t&&S(u),t&&S(l),t&&S(c),t&&S(p),t&&S(h),t&&S(f)}}}function di(t){let e,r,n;return{c(){e=A("h2"),e.textContent="Visualising Simpson's Paradox",r=k(),n=A("p"),n.textContent="The sections below will respond to the captions as you scroll down. The\n      mode is set to splitscreen, with captions on the left on larger screens."},m(t,i){w(t,e,i),w(t,r,i),w(t,n,i)},d(t){t&&S(e),t&&S(r),t&&S(n)}}}function mi(t){let e,r;return{c(){e=A("img"),C(e,"class","fade-in svelte-1ist5j1"),e.src!==(r=t[5])&&C(e,"src",r),C(e,"alt","")},m(t,r){w(t,e,r)},p(t,n){32&n&&e.src!==(r=t[5])&&C(e,"src",r)},d(t){t&&S(e)}}}function yi(t){let e,r,n,i,o,a,s,u,l=!!t[3]&&mi(t);return s=new ci({props:{groupedByAge:t[0]}}),{c(){e=A("div"),r=A("figure"),n=A("div"),i=A("div"),l&&l.c(),o=k(),a=A("div"),ft(s.$$.fragment),C(i,"class","image svelte-1ist5j1"),V(i,"hidden",!t[3]),C(a,"class","chart svelte-1ist5j1"),V(a,"hidden",!!t[3]),C(n,"class","col-wide height-full _middle"),C(e,"slot","background")},m(t,c){w(t,e,c),x(e,r),x(r,n),x(n,i),l&&l.m(i,null),x(n,o),x(n,a),dt(s,a,null),u=!0},p(t,e){t[3]?l?l.p(t,e):(l=mi(t),l.c(),l.m(i,null)):l&&(l.d(1),l=null),8&e&&V(i,"hidden",!t[3]);const r={};1&e&&(r.groupedByAge=t[0]),s.$set(r),8&e&&V(a,"hidden",!!t[3])},i(t){u||(st(s.$$.fragment,t),u=!0)},o(t){ut(s.$$.fragment,t),u=!1},d(t){t&&S(e),l&&l.d(),mt(s)}}}function gi(t){let e;return{c(){e=A("div"),e.innerHTML='<section key="foo" image="simpsons-legend.png"><div class="col-medium"><p>In the upcoming chart we&#39;ll use the colors red and green to mark the\n            unvaccinated and vaccinated groups. Squares indicate an uninfected\n            sample, triangles a severely infected sample.</p></div></section> \n      <section key="baa" image="simpsons-legend-u50.png"><div class="col-medium"><p>We&#39;ll place a black circle at the center of samples taken from the\n            under 50s group to clearly divide the over and under 50s.</p></div></section> \n      <section key="baa" image="simpsons-efficacy.png"><div class="col-medium"><p>Efficacy is the key metric when calculating the effectiveness of a\n            vaccine. To calculate it we divide the proportion of infected people\n            in the vaccinated group (infected divided by infected plus\n            uninfected) by the proportion of infected people in the unvaccinated\n            group. Note that efficacy is zero if those proportions are the same\n            and 100% if there are no infected members of the vaccinated group.</p></div></section> \n      <section key="ungrouped"><div class="col-medium"><p>Here we see the two groups of vaccinated and unvaccinated with their\n            relative numbers of uninfected and severely infected. The total\n            efficacy of the vaccine is 67.5%, a number disturbingly low.</p> \n          <p>Note that the majority of the unvaccinated are under 50 and that of\n            those the large majority of severely infected are over 50.</p> \n          <p>Scroll down to see what happens when we separate the these groups\n            age, dealing with the over and under fifties separately. But first\n            make sure you agree with the calculated efficacy.</p></div></section> \n      <section key="grouped"><div class="col-medium"><p>By further separating the vaccinated and unvaccinated by age we get\n            much more positive numbers for efficacy, demonstrating Simpson&#39;s\n            paradox in action. By focusing on the two age defined subgroups we\n            get a very different picture for the efficacy of the Covid vaccine.</p> \n          <p>Scroll up and down between the two sections to see the transition\n            and reassure yourself there&#39;s no sleight of hand. Try and get a feel\n            for why the efficacies are so different between the aggregated\n            groups and those separated by age.</p></div></section> \n\n      <section class="section__end svelte-1ist5j1"><div class="col-medium"><h2>Conclusion</h2> \n          <p>The previous section demonstrated that by separating our vaccinated\n            and unvaccinated population by age we get a very different\n            indication of the overall efficacy of the Covid vaccine. If policy\n            makers were given the efficacy of the total population (67.5%) they\n            may well conclude a need for a booster shot for the vulnerable\n            groups, potentially diverting precious vaccine resources from the\n            unvaccinated. However, if they were shown the efficacy by age (92.1%\n            for the under 50s, 85.8% for the over 50s) it is unlikely a booster\n            shot would be found necessary. In this instance the ability to grasp\n            Simpson&#39;s paradox is not a cool statistical insight but could have\n            life and death consequences in the real world.</p></div></section>',C(e,"slot","foreground")},m(t,r){w(t,e,r)},d(t){t&&S(e)}}}function vi(e){let r;return{c(){r=k()},m(t,e){w(t,r,e)},p:t,i:t,o:t,d(t){t&&S(r)}}}function _i(t){let e,r,n,i,o,a,s,u,l,c,p,h,f,d,m;function y(e){t[6].call(null,e)}function g(e){t[7].call(null,e)}function v(e){t[8].call(null,e)}function _(e){t[9].call(null,e)}r=new Or({props:{bgimage:"./img/simpsons-bg.png",bgfixed:!0,theme:"light",compact:!0,$$slots:{default:[hi]},$$scope:{ctx:t}}}),i=new Ur({props:{$$slots:{default:[fi]},$$scope:{ctx:t}}}),a=new en({}),u=new Ur({props:{$$slots:{default:[di]},$$scope:{ctx:t}}});let b={threshold:bi,splitscreen:!0,$$slots:{default:[vi],foreground:[gi],background:[yi]},$$scope:{ctx:t}};return void 0!==t[1][0]&&(b.index=t[1][0]),void 0!==t[2]&&(b.key=t[2]),void 0!==t[3]&&(b.image=t[3]),void 0!==t[4]&&(b.prevImage=t[4]),c=new Kr({props:b}),G.push((()=>ht(c,"index",y))),G.push((()=>ht(c,"key",g))),G.push((()=>ht(c,"image",v))),G.push((()=>ht(c,"prevImage",_))),{c(){e=A("div"),ft(r.$$.fragment),n=k(),ft(i.$$.fragment),o=k(),ft(a.$$.fragment),s=k(),ft(u.$$.fragment),l=k(),ft(c.$$.fragment),C(e,"class","app__wrapper")},m(t,p){w(t,e,p),dt(r,e,null),x(e,n),dt(i,e,null),x(e,o),dt(a,e,null),x(e,s),dt(u,e,null),x(e,l),dt(c,e,null),m=!0},p(t,[e]){const n={};8192&e&&(n.$$scope={dirty:e,ctx:t}),r.$set(n);const o={};8192&e&&(o.$$scope={dirty:e,ctx:t}),i.$set(o);const a={};8192&e&&(a.$$scope={dirty:e,ctx:t}),u.$set(a);const s={};8233&e&&(s.$$scope={dirty:e,ctx:t}),!p&&2&e&&(p=!0,s.index=t[1][0],J((()=>p=!1))),!h&&4&e&&(h=!0,s.key=t[2],J((()=>h=!1))),!f&&8&e&&(f=!0,s.image=t[3],J((()=>f=!1))),!d&&16&e&&(d=!0,s.prevImage=t[4],J((()=>d=!1))),c.$set(s)},i(t){m||(st(r.$$.fragment,t),st(i.$$.fragment,t),st(a.$$.fragment,t),st(u.$$.fragment,t),st(c.$$.fragment,t),m=!0)},o(t){ut(r.$$.fragment,t),ut(i.$$.fragment,t),ut(a.$$.fragment,t),ut(u.$$.fragment,t),ut(c.$$.fragment,t),m=!1},d(t){t&&S(e),mt(r),mt(i),mt(a),mt(u),mt(c)}}}let xi="light";const bi=.65;let wi=!0;function Si(t,e,r){q("theme",xi),function(t,e){for(let r in t[e])document.documentElement.style.setProperty("--"+r,t[e][r])}(_t,xi);let n,i,o,a=!1,s=[],u=[];N((()=>{r(10,u=[...s])}));const l={ungrouped:()=>{r(0,a=!1)},grouped:()=>{r(0,a=!0)},legend:()=>{}};let c;return t.$$.update=()=>{8&t.$$.dirty&&r(5,c="img/"+i),t.$$.dirty,1030&t.$$.dirty&&s[0]!=u[0]&&(console.log("Current key: ",n),l[n]&&l[n](),r(10,u[0]=s[0],u))},[a,s,n,i,o,c,function(t){s[0]=t,r(1,s)},function(t){n=t,r(2,n)},function(t){i=t,r(3,i)},function(t){o=t,r(4,o)}]}return new class extends vt{constructor(t){super(),gt(this,t,Si,_i,u,{})}}({target:document.body})}();
  //# sourceMappingURL=bundle.js.map
  