!function e(t,i,n){function r(a,s){if(!i[a]){if(!t[a]){var l="function"==typeof require&&require;if(!s&&l)return l(a,!0);if(o)return o(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var u=i[a]={exports:{}};t[a][0].call(u.exports,(function(e){return r(t[a][1][e]||e)}),u,u.exports,e,t,i,n)}return i[a].exports}for(var o="function"==typeof require&&require,a=0;ac/r*n?e/n:c/r:"contain"===s?c>e/n*r?e/n:c/r:1,l?i.style.transform="scale("+t+")":(i.style.width=n*t+"px",i.style.height=r*t+"px"),i.style.left=e!==n*t?u*a+"px":"0px",i.style.top=c!==r*t?d*o+"px":"0px"):setTimeout(h,30)}i.style.position="absolute",i.parentElement.style.overflow="hidden",l&&(i.style.transformOrigin="left top"),-1===["relative","absolute","fixed"].indexOf(window.getComputedStyle(i.parentElement,null).getPropertyValue("position"))&&(i.parentElement.style.position="relative"),c(),u(),h(),this.update=h,this.setWidth=function(e){n=Number(e)},this.setHeight=function(e){r=Number(e)},this.setValign=function(e){o=e,c()},this.setHalign=function(e){a=e,u()},this.setFit=function(e){s=e},this.getWidth=function(){return Number(n)},this.getHeight=function(){return Number(r)},this.getCurrentWidth=function(){return t*n},this.getCurrentHeight=function(){return t*r},this.getValign=function(){return o},this.getHalign=function(){return a},this.getFit=function(){return s},this.getScale=function(){return t}}},{}],3:[function(e,t,i){"use strict";e("./index").polyfill()},{"./index":4}],4:[function(e,t,i){"use strict";function n(e,t){if(null==e)throw new TypeError("Cannot convert first argument to object");for(var i=Object(e),n=1;no;)a=a._prev;return a?(t._next=a._next,a._next=t):(t._next=e[i],e[i]=t),t._next?t._next._prev=t:e[n]=t,t._prev=a,t.parent=t._dp=e,t},Ee=function(e,t,i,n){void 0===i&&(i="_first"),void 0===n&&(n="_last");var r=t._prev,o=t._next;r?r._next=o:e[i]===t&&(e[i]=o),o?o._prev=r:e[n]===t&&(e[n]=r),t._next=t._prev=t.parent=null},ke=function(e,t){e.parent&&(!t||e.parent.autoRemoveChildren)&&e.parent.remove(e),e._act=0},Ae=function(e,t){if(e&&(!t||t._end>e._dur||t._start<0))for(var i=e;i;)i._dirty=1,i=i.parent;return e},Me=function(e){for(var t=e.parent;t&&t.parent;)t._dirty=1,t.totalDuration(),t=t.parent;return e},Ie=function(e,t,i,n){return e._startAt&&(r?e._startAt.revert(J):e.vars.immediateRender&&!e.vars.autoRevert||e._startAt.render(t,!0,n))},Pe=function e(t){return!t||t._ts&&e(t.parent)},De=function(e){return e._repeat?ze(e._tTime,e=e.duration()+e._rDelay)*e:0},ze=function(e,t){var i=Math.floor(e/=t);return e&&i===e?i-1:i},Oe=function(e,t){return(e-t._start)*t._ts+(t._ts>=0?0:t._dirty?t.totalDuration():t._tDur)},Le=function(e){return e._end=pe(e._start+(e._tDur/Math.abs(e._ts||e._rts||b)||0))},Re=function(e,t){var i=e._dp;return i&&i.smoothChildTiming&&e._ts&&(e._start=pe(i._time-(e._ts>0?t/e._ts:((e._dirty?e.totalDuration():e._tDur)-t)/-e._ts)),Le(e),i._dirty||Ae(i,e)),e},Be=function(e,t){var i;if((t._time||t._initted&&!t._dur)&&(i=Oe(e.rawTime(),t),(!t._dur||Xe(0,t.totalDuration(),i)-t._tTime>b)&&t.render(i,!0)),Ae(e,t)._dp&&e._initted&&e._time>=e._dur&&e._ts){if(e._dur=0&&i.totalTime(i._tTime),i=i._dp;e._zTime=-1e-8}},Fe=function(e,t,i,n){return t.parent&&ke(t),t._start=pe((I(i)?i:i||e!==a?We(e,i,t):e._time)+t._delay),t._end=pe(t._start+(t.totalDuration()/Math.abs(t.timeScale())||0)),Se(e,t,"_first","_last",e._sort?"_start":0),Ue(t)||(e._recent=t),n||Be(e,t),e._ts<0&&Re(e,e._tTime),e},$e=function(e,t){return q.ScrollTrigger?q.ScrollTrigger.create(t,e):void 0},je=function(e,t,i,n,o){return Gt(e,t,o),e._initted?!i&&e._pt&&!r&&(e._dur&&!1!==e.vars.lazy||!e._dur&&e.vars.lazy)&&h!==Tt.frame?(te.push(e),e._lazy=[o,n],1):void 0:1},Ne=function e(t){var i=t.parent;return i&&i._ts&&i._initted&&!i._lock&&(i.rawTime()<0||e(i))},Ue=function(e){var t=e.data;return"isFromStart"===t||"isStart"===t},Ve=function(e,t,i,n){var r=e._repeat,o=pe(t)||0,a=e._tTime/e._tDur;return a&&!n&&(e._time*=o/e._dur),e._dur=o,e._tDur=r?r<0?1e10:pe(o*(r+1)+e._rDelay*r):o,a>0&&!n&&Re(e,e._tTime=e._tDur*a),e.parent&&Le(e),i||Ae(e.parent,e),e},Ge=function(e){return e instanceof Ft?Ae(e):Ve(e,e._dur)},qe={_start:0,endTime:Y,totalDuration:Y},We=function e(t,i,n){var r,o,a,s=t.labels,l=t._recent||qe,c=t.duration()>=x?l.endTime(!1):t._dur;return A(i)&&(isNaN(i)||i in s)?(o=i.charAt(0),a="%"===i.substr(-1),r=i.indexOf("="),"<"===o||">"===o?(r>=0&&(i=i.replace(/=/,"")),("<"===o?l._start:l.endTime(l._repeat>=0))+(parseFloat(i.substr(1))||0)*(a?(r<0?l:n).totalDuration()/100:1)):r<0?(i in s||(s[i]=c),s[i]):(o=parseFloat(i.charAt(r-1)+i.substr(r+1)),a&&n&&(o=o/100*(B(n)?n[0]:n).totalDuration()),r>1?e(t,i.substr(0,r-1),n)+o:c+o)):null==i?c:+i},Ze=function(e,t,i){var n,r,o=I(t[1]),a=(o?2:1)+(e<2?0:1),s=t[a];if(o&&(s.duration=t[1]),s.parent=i,e){for(n=s,r=i;r&&!("immediateRender"in n);)n=r.vars.defaults||{},r=z(r.vars.inherit)&&r.parent;s.immediateRender=z(n.immediateRender),e<2?s.runBackwards=1:s.startAt=t[a-1]}return new Xt(t[0],s,t[a+1])},He=function(e,t){return e||0===e?t(e):t},Xe=function(e,t,i){return it?t:i},Ye=function(e,t){return A(e)&&(t=G.exec(e))?t[1]:""},Ke=[].slice,Je=function(e,t){return e&&D(e)&&"length"in e&&(!t&&!e.length||e.length-1 in e&&D(e[0]))&&!e.nodeType&&e!==s},Qe=function(e,t,i){return void 0===i&&(i=[]),e.forEach((function(e){var n;return A(e)&&!t||Je(e,1)?(n=i).push.apply(n,et(e)):i.push(e)}))||i},et=function(e,t,i){return o&&!t&&o.selector?o.selector(e):!A(e)||i||!l&&Ct()?B(e)?Qe(e,i):Je(e)?Ke.call(e,0):e?[e]:[]:Ke.call((t||c).querySelectorAll(e),0)},tt=function(e){return e=et(e)[0]||H()||{},function(t){var i=e.current||e.nativeElement||e;return et(t,i.querySelectorAll?i:i===e?H()||c.createElement("div"):e)}},it=function(e){return e.sort((function(){return.5-Math.random()}))},nt=function(e){if(M(e))return e;var t=D(e)?e:{each:e},i=Pt(t.ease),n=t.from||0,r=parseFloat(t.base)||0,o={},a=n>0&&n<1,s=isNaN(n)||a,l=t.axis,c=n,u=n;return A(n)?c=u={center:.5,edges:.5,end:1}[n]||0:!a&&s&&(c=n[0],u=n[1]),function(e,a,h){var d,p,f,m,g,_,v,y,b,w=(h||t).length,T=o[w];if(!T){if(!(b="auto"===t.grid?0:(t.grid||[1,x])[1])){for(v=-x;v<(v=h[b++].getBoundingClientRect().left)&&bv&&(v=g),gw?w-1:l?"y"===l?w/b:b:Math.max(b,w/b))||0)*("edges"===n?-1:1),T.b=w<0?r-w:r,T.u=Ye(t.amount||t.each)||0,i=i&&w<0?Mt(i):i}return w=(T[e]-T.min)/T.max||0,pe(T.b+(i?i(w):w)*T.v)+T.u}},rt=function(e){var t=Math.pow(10,((e+"").split(".")[1]||"").length);return function(i){var n=pe(Math.round(parseFloat(i)/e)*e*t);return(n-n%1)/t+(I(i)?0:Ye(i))}},ot=function(e,t){var i,n,r=B(e);return!r&&D(e)&&(i=r=e.radius||x,e.values?(e=et(e.values),(n=!I(e[0]))&&(i*=i)):e=rt(e.increment)),He(t,r?M(e)?function(t){return n=e(t),Math.abs(n-t)<=i?n:t}:function(t){for(var r,o,a=parseFloat(n?t.x:t),s=parseFloat(n?t.y:0),l=x,c=0,u=e.length;u--;)(r=n?(r=e[u].x-a)*r+(o=e[u].y-s)*o:Math.abs(e[u]-a))(r=Math.abs(r))&&(o=n,s=r);return o},ht=function(e,t,i){var n,r,a,s=e.vars,l=s[t],c=o,u=e._ctx;if(l)return n=s[t+"Params"],r=s.callbackScope||e,i&&te.length&&ge(),u&&(o=u),a=n?l.apply(r,n):l.call(r),o=c,a},dt=function(e){return ke(e),e.scrollTrigger&&e.scrollTrigger.kill(!!r),e.progress()<1&&ht(e,"onInterrupt"),e},pt=function(e){var t=(e=!e.name&&e.default||e).name,i=M(e),n=t&&!i&&e.init?function(){this._props=[]}:e,r={init:Y,render:ri,add:Ut,kill:ai,modifier:oi,rawVars:0},o={targetTest:0,get:0,getSetter:ei,aliases:{},register:0};if(Ct(),e!==n){if(ne[t])return;xe(n,xe(Te(e,r),o)),be(n.prototype,be(r,Te(e,o))),ne[n.prop=t]=n,e.targetTest&&(ae.push(n),ee[t]=1),t=("css"===t?"CSS":t.charAt(0).toUpperCase()+t.substr(1))+"Plugin"}X(t,n),e.register&&e.register(bi,n,ci)},ft=255,mt={aqua:[0,ft,ft],lime:[0,ft,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,ft],navy:[0,0,128],white:[ft,ft,ft],olive:[128,128,0],yellow:[ft,ft,0],orange:[ft,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[ft,0,0],pink:[ft,192,203],cyan:[0,ft,ft],transparent:[ft,ft,ft,0]},gt=function(e,t,i){return(6*(e+=e<0?1:e>1?-1:0)<1?t+(i-t)*e*6:e<.5?i:3*e<2?t+(i-t)*(2/3-e)*6:t)*ft+.5|0},_t=function(e,t,i){var n,r,o,a,s,l,c,u,h,d,p=e?I(e)?[e>>16,e>>8&ft,e&ft]:0:mt.black;if(!p){if(","===e.substr(-1)&&(e=e.substr(0,e.length-1)),mt[e])p=mt[e];else if("#"===e.charAt(0)){if(e.length<6&&(n=e.charAt(1),r=e.charAt(2),o=e.charAt(3),e="#"+n+n+r+r+o+o+(5===e.length?e.charAt(4)+e.charAt(4):"")),9===e.length)return[(p=parseInt(e.substr(1,6),16))>>16,p>>8&ft,p&ft,parseInt(e.substr(7),16)/255];p=[(e=parseInt(e.substr(1),16))>>16,e>>8&ft,e&ft]}else if("hsl"===e.substr(0,3))if(p=d=e.match(F),t){if(~e.indexOf("="))return p=e.match($),i&&p.length<4&&(p[3]=1),p}else a=+p[0]%360/360,s=+p[1]/100,n=2*(l=+p[2]/100)-(r=l<=.5?l*(s+1):l+s-l*s),p.length>3&&(p[3]*=1),p[0]=gt(a+1/3,n,r),p[1]=gt(a,n,r),p[2]=gt(a-1/3,n,r);else p=e.match(F)||mt.transparent;p=p.map(Number)}return t&&!d&&(n=p[0]/ft,r=p[1]/ft,o=p[2]/ft,l=((c=Math.max(n,r,o))+(u=Math.min(n,r,o)))/2,c===u?a=s=0:(h=c-u,s=l>.5?h/(2-c-u):h/(c+u),a=c===n?(r-o)/h+(rh&&(f+=y-d),((l=(u=(m+=y)-f)-_)>0||x)&&(p=++n.frame,r=u-1e3*n.time,n.time=u/=1e3,_+=l+(l>=g?4:g-l),c=1),x||(e=t(i)),c)for(o=0;o=t&&o--},_listeners:v}}(),Ct=function(){return!p&&Tt.wake()},St={},Et=/^[\d.\-M][\d.\-,\s]/,kt=/["']/g,At=function(e){for(var t,i,n,r={},o=e.substr(1,e.length-3).split(":"),a=o[0],s=1,l=o.length;s1&&a.config?a.config.apply(null,~e.indexOf("{")?[At(o[1])]:(t=e,i=t.indexOf("(")+1,n=t.indexOf(")"),r=t.indexOf("(",i),t.substring(i,~r&&r=1?i:1,o=(n||(t?.3:.45))/(i<1?i:1),a=o/w*(Math.asin(1/r)||0),s=function(e){return 1===e?1:r*Math.pow(2,-10*e)*k((e-a)*o)+1},l="out"===t?s:"in"===t?function(e){return 1-s(1-e)}:zt(s);return o=w/o,l.config=function(i,n){return e(t,i,n)},l},Lt=function e(t,i){void 0===i&&(i=1.70158);var n=function(e){return e?--e*e*((i+1)*e+i)+1:0},r="out"===t?n:"in"===t?function(e){return 1-n(1-e)}:zt(n);return r.config=function(i){return e(t,i)},r};he("Linear,Quad,Cubic,Quart,Quint,Strong",(function(e,t){var i=t<5?t+1:t;Dt(e+",Power"+(i-1),t?function(e){return Math.pow(e,i)}:function(e){return e},(function(e){return 1-Math.pow(1-e,i)}),(function(e){return e<.5?Math.pow(2*e,i)/2:1-Math.pow(2*(1-e),i)/2}))})),St.Linear.easeNone=St.none=St.Linear.easeIn,Dt("Elastic",Ot("in"),Ot("out"),Ot()),f=7.5625,g=1/(m=2.75),Dt("Bounce",(function(e){return 1-_(1-e)}),_=function(e){return e0?e+(e+this._rDelay)*this._repeat:e):this.totalDuration()&&this._dur},t.totalDuration=function(e){return arguments.length?(this._dirty=0,Ve(this,this._repeat<0?e:(e-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur},t.totalTime=function(e,t){if(Ct(),!arguments.length)return this._tTime;var i=this._dp;if(i&&i.smoothChildTiming&&this._ts){for(Re(this,e),!i._dp||i.parent||Be(i,this);i&&i.parent;)i.parent._time!==i._start+(i._ts>=0?i._tTime/i._ts:(i.totalDuration()-i._tTime)/-i._ts)&&i.totalTime(i._tTime,!0),i=i.parent;!this.parent&&this._dp.autoRemoveChildren&&(this._ts>0&&e0||!this._tDur&&!e)&&Fe(this._dp,this,this._start-this._delay)}return(this._tTime!==e||!this._dur&&!t||this._initted&&Math.abs(this._zTime)===b||!e&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=e),_e(this,e,t)),this},t.time=function(e,t){return arguments.length?this.totalTime(Math.min(this.totalDuration(),e+De(this))%(this._dur+this._rDelay)||(e?this._dur:0),t):this._time},t.totalProgress=function(e,t){return arguments.length?this.totalTime(this.totalDuration()*e,t):this.totalDuration()?Math.min(1,this._tTime/this._tDur):this.ratio},t.progress=function(e,t){return arguments.length?this.totalTime(this.duration()*(!this._yoyo||1&this.iteration()?e:1-e)+De(this),t):this.duration()?Math.min(1,this._time/this._dur):this.ratio},t.iteration=function(e,t){var i=this.duration()+this._rDelay;return arguments.length?this.totalTime(this._time+(e-1)*i,t):this._repeat?ze(this._tTime,i)+1:1},t.timeScale=function(e){if(!arguments.length)return-1e-8===this._rts?0:this._rts;if(this._rts===e)return this;var t=this.parent&&this._ts?Oe(this.parent._time,this):this._tTime;return this._rts=+e||0,this._ts=this._ps||-1e-8===e?0:this._rts,this.totalTime(Xe(-this._delay,this._tDur,t),!0),Le(this),Me(this)},t.paused=function(e){return arguments.length?(this._ps!==e&&(this._ps=e,e?(this._pTime=this._tTime||Math.max(-this._delay,this.rawTime()),this._ts=this._act=0):(Ct(),this._ts=this._rts,this.totalTime(this.parent&&!this.parent.smoothChildTiming?this.rawTime():this._tTime||this._pTime,1===this.progress()&&Math.abs(this._zTime)!==b&&(this._tTime-=b)))),this):this._ps},t.startTime=function(e){if(arguments.length){this._start=e;var t=this.parent||this._dp;return t&&(t._sort||!this.parent)&&Fe(t,this,e-this._delay),this}return this._start},t.endTime=function(e){return this._start+(z(e)?this.totalDuration():this.duration())/Math.abs(this._ts||1)},t.rawTime=function(e){var t=this.parent||this._dp;return t?e&&(!this._ts||this._repeat&&this._time&&this.totalProgress()<1)?this._tTime%(this._dur+this._rDelay):this._ts?Oe(t.rawTime(e),this):this._tTime:this._tTime},t.revert=function(e){void 0===e&&(e=Q);var t=r;return r=e,(this._initted||this._startAt)&&(this.timeline&&this.timeline.revert(e),this.totalTime(-.01,e.suppressEvents)),"nested"!==this.data&&!1!==e.kill&&this.kill(),r=t,this},t.globalTime=function(e){for(var t=this,i=arguments.length?e:t.rawTime();t;)i=t._start+i/(t._ts||1),t=t._dp;return!this.parent&&this.vars.immediateRender?-1:i},t.repeat=function(e){return arguments.length?(this._repeat=e===1/0?-2:e,Ge(this)):-2===this._repeat?1/0:this._repeat},t.repeatDelay=function(e){if(arguments.length){var t=this._time;return this._rDelay=e,Ge(this),t?this.time(t):this}return this._rDelay},t.yoyo=function(e){return arguments.length?(this._yoyo=e,this):this._yoyo},t.seek=function(e,t){return this.totalTime(We(this,e),z(t))},t.restart=function(e,t){return this.play().totalTime(e?-this._delay:0,z(t))},t.play=function(e,t){return null!=e&&this.seek(e,t),this.reversed(!1).paused(!1)},t.reverse=function(e,t){return null!=e&&this.seek(e||this.totalDuration(),t),this.reversed(!0).paused(!1)},t.pause=function(e,t){return null!=e&&this.seek(e,t),this.paused(!0)},t.resume=function(){return this.paused(!1)},t.reversed=function(e){return arguments.length?(!!e!==this.reversed()&&this.timeScale(-this._rts||(e?-1e-8:0)),this):this._rts<0},t.invalidate=function(){return this._initted=this._act=0,this._zTime=-1e-8,this},t.isActive=function(){var e,t=this.parent||this._dp,i=this._start;return!(t&&!(this._ts&&this._initted&&t.isActive()&&(e=t.rawTime(!0))>=i&&e1?(t?(n[e]=t,i&&(n[e+"Params"]=i),"onUpdate"===e&&(this._onUpdate=t)):delete n[e],this):n[e]},t.then=function(e){var t=this;return new Promise((function(i){var n=M(e)?e:ye,r=function(){var e=t.then;t.then=null,M(n)&&(n=n(t))&&(n.then||n===t)&&(t.then=e),i(n),t.then=e};t._initted&&1===t.totalProgress()&&t._ts>=0||!t._tTime&&t._ts<0?r():t._prom=r}))},t.kill=function(){dt(this)},e}();xe(Bt.prototype,{_time:0,_start:0,_end:0,_tTime:0,_tDur:0,_dirty:0,_repeat:0,_yoyo:!1,parent:null,_initted:!1,_rDelay:0,_ts:1,_dp:0,ratio:0,_zTime:-1e-8,_prom:0,_ps:!1,_rts:1});var Ft=function(e){function n(t,n){var r;return void 0===t&&(t={}),(r=e.call(this,t)||this).labels={},r.smoothChildTiming=!!t.smoothChildTiming,r.autoRemoveChildren=!!t.autoRemoveChildren,r._sort=z(t.sortChildren),a&&Fe(t.parent||a,i(r),n),t.reversed&&r.reverse(),t.paused&&r.paused(!0),t.scrollTrigger&&$e(i(r),t.scrollTrigger),r}t(n,e);var o=n.prototype;return o.to=function(e,t,i){return Ze(0,arguments,this),this},o.from=function(e,t,i){return Ze(1,arguments,this),this},o.fromTo=function(e,t,i,n){return Ze(2,arguments,this),this},o.set=function(e,t,i){return t.duration=0,t.parent=this,Ce(t).repeatDelay||(t.repeat=0),t.immediateRender=!!t.immediateRender,new Xt(e,t,We(this,i),1),this},o.call=function(e,t,i){return Fe(this,Xt.delayedCall(0,e,t),i)},o.staggerTo=function(e,t,i,n,r,o,a){return i.duration=t,i.stagger=i.stagger||n,i.onComplete=o,i.onCompleteParams=a,i.parent=this,new Xt(e,i,We(this,r)),this},o.staggerFrom=function(e,t,i,n,r,o,a){return i.runBackwards=1,Ce(i).immediateRender=z(i.immediateRender),this.staggerTo(e,t,i,n,r,o,a)},o.staggerFromTo=function(e,t,i,n,r,o,a,s){return n.startAt=i,Ce(n).immediateRender=z(n.immediateRender),this.staggerTo(e,t,n,r,o,a,s)},o.render=function(e,t,i){var n,o,s,l,c,u,h,d,p,f,m,g,_=this._time,v=this._dirty?this.totalDuration():this._tDur,y=this._dur,x=e<=0?0:pe(e),w=this._zTime<0!=e<0&&(this._initted||!y);if(this!==a&&x>v&&e>=0&&(x=v),x!==this._tTime||i||w){if(_!==this._time&&y&&(x+=this._time-_,e+=this._time-_),n=x,p=this._start,u=!(d=this._ts),w&&(y||(_=this._zTime),(e||!t)&&(this._zTime=e)),this._repeat){if(m=this._yoyo,c=y+this._rDelay,this._repeat<-1&&e<0)return this.totalTime(100*c+e,t,i);if(n=pe(x%c),x===v?(l=this._repeat,n=y):((l=~~(x/c))&&l===x/c&&(n=y,l--),n>y&&(n=y)),f=ze(this._tTime,c),!_&&this._tTime&&f!==l&&(f=l),m&&1&l&&(n=y-n,g=1),l!==f&&!this._lock){var T=m&&1&f,C=T===(m&&1&l);if(lt)for(n=e._first;n&&n._start<=i;){if("isPause"===n.data&&n._start>t)return n;n=n._next}else for(n=e._last;n&&n._start>=i;){if("isPause"===n.data&&n._start=_&&e>=0)for(o=this._first;o;){if(s=o._next,(o._act||n>=o._start)&&o._ts&&h!==o){if(o.parent!==this)return this.render(e,t,i);if(o.render(o._ts>0?(n-o._start)*o._ts:(o._dirty?o.totalDuration():o._tDur)+(n-o._start)*o._ts,t,i),n!==this._time||!this._ts&&!u){h=0,s&&(x+=this._zTime=-1e-8);break}}o=s}else{o=this._last;for(var S=e<0?e:n;o;){if(s=o._prev,(o._act||S<=o._end)&&o._ts&&h!==o){if(o.parent!==this)return this.render(e,t,i);if(o.render(o._ts>0?(S-o._start)*o._ts:(o._dirty?o.totalDuration():o._tDur)+(S-o._start)*o._ts,t,i||r&&(o._initted||o._startAt)),n!==this._time||!this._ts&&!u){h=0,s&&(x+=this._zTime=S?-1e-8:b);break}}o=s}}if(h&&!t&&(this.pause(),h.render(n>=_?0:-1e-8)._zTime=n>=_?1:-1,this._ts))return this._start=p,Le(this),this.render(e,t,i);this._onUpdate&&!t&&ht(this,"onUpdate",!0),(x===v&&this._tTime>=this.totalDuration()||!x&&_)&&(p!==this._start&&Math.abs(d)===Math.abs(this._ts)||this._lock||((e||!y)&&(x===v&&this._ts>0||!x&&this._ts<0)&&ke(this,1),t||e<0&&!_||!x&&!_&&v||(ht(this,x===v&&e>=0?"onComplete":"onReverseComplete",!0),this._prom&&!(x0)&&this._prom())))}return this},o.add=function(e,t){var i=this;if(I(t)||(t=We(this,t,e)),!(e instanceof Bt)){if(B(e))return e.forEach((function(e){return i.add(e,t)})),this;if(A(e))return this.addLabel(e,t);if(!M(e))return this;e=Xt.delayedCall(0,e)}return this!==e?Fe(this,e,t):this},o.getChildren=function(e,t,i,n){void 0===e&&(e=!0),void 0===t&&(t=!0),void 0===i&&(i=!0),void 0===n&&(n=-x);for(var r=[],o=this._first;o;)o._start>=n&&(o instanceof Xt?t&&r.push(o):(i&&r.push(o),e&&r.push.apply(r,o.getChildren(!0,t,i)))),o=o._next;return r},o.getById=function(e){for(var t=this.getChildren(1,1,1),i=t.length;i--;)if(t[i].vars.id===e)return t[i]},o.remove=function(e){return A(e)?this.removeLabel(e):M(e)?this.killTweensOf(e):(Ee(this,e),e===this._recent&&(this._recent=this._last),Ae(this))},o.totalTime=function(t,i){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=pe(Tt.time-(this._ts>0?t/this._ts:(this.totalDuration()-t)/-this._ts))),e.prototype.totalTime.call(this,t,i),this._forcing=0,this):this._tTime},o.addLabel=function(e,t){return this.labels[e]=We(this,t),this},o.removeLabel=function(e){return delete this.labels[e],this},o.addPause=function(e,t,i){var n=Xt.delayedCall(0,t||Y,i);return n.data="isPause",this._hasPause=1,Fe(this,n,We(this,e))},o.removePause=function(e){var t=this._first;for(e=We(this,e);t;)t._start===e&&"isPause"===t.data&&ke(t),t=t._next},o.killTweensOf=function(e,t,i){for(var n=this.getTweensOf(e,i),r=n.length;r--;)$t!==n[r]&&n[r].kill(e,t);return this},o.getTweensOf=function(e,t){for(var i,n=[],r=et(e),o=this._first,a=I(t);o;)o instanceof Xt?me(o._targets,r)&&(a?(!$t||o._initted&&o._ts)&&o.globalTime(0)<=t&&o.globalTime(o.totalDuration())>t:!t||o.isActive())&&n.push(o):(i=o.getTweensOf(r,t)).length&&n.push.apply(n,i),o=o._next;return n},o.tweenTo=function(e,t){t=t||{};var i,n=this,r=We(n,e),o=t,a=o.startAt,s=o.onStart,l=o.onStartParams,c=o.immediateRender,u=Xt.to(n,xe({ease:t.ease||"none",lazy:!1,immediateRender:!1,time:r,overwrite:"auto",duration:t.duration||Math.abs((r-(a&&"time"in a?a.time:n._time))/n.timeScale())||b,onStart:function(){if(n.pause(),!i){var e=t.duration||Math.abs((r-(a&&"time"in a?a.time:n._time))/n.timeScale());u._dur!==e&&Ve(u,e,0,1).render(u._time,!0,!0),i=1}s&&s.apply(u,l||[])}},t));return c?u.render(0):u},o.tweenFromTo=function(e,t,i){return this.tweenTo(t,xe({startAt:{time:We(this,e)}},i))},o.recent=function(){return this._recent},o.nextLabel=function(e){return void 0===e&&(e=this._time),ut(this,We(this,e))},o.previousLabel=function(e){return void 0===e&&(e=this._time),ut(this,We(this,e),1)},o.currentLabel=function(e){return arguments.length?this.seek(e,!0):this.previousLabel(this._time+b)},o.shiftChildren=function(e,t,i){void 0===i&&(i=0);for(var n,r=this._first,o=this.labels;r;)r._start>=i&&(r._start+=e,r._end+=e),r=r._next;if(t)for(n in o)o[n]>=i&&(o[n]+=e);return Ae(this)},o.invalidate=function(t){var i=this._first;for(this._lock=0;i;)i.invalidate(t),i=i._next;return e.prototype.invalidate.call(this,t)},o.clear=function(e){void 0===e&&(e=!0);for(var t,i=this._first;i;)t=i._next,this.remove(i),i=t;return this._dp&&(this._time=this._tTime=this._pTime=0),e&&(this.labels={}),Ae(this)},o.totalDuration=function(e){var t,i,n,r=0,o=this,s=o._last,l=x;if(arguments.length)return o.timeScale((o._repeat<0?o.duration():o.totalDuration())/(o.reversed()?-e:e));if(o._dirty){for(n=o.parent;s;)t=s._prev,s._dirty&&s.totalDuration(),(i=s._start)>l&&o._sort&&s._ts&&!o._lock?(o._lock=1,Fe(o,s,i-s._delay,1)._lock=0):l=i,i<0&&s._ts&&(r-=i,(!n&&!o._dp||n&&n.smoothChildTiming)&&(o._start+=i/o._ts,o._time-=i,o._tTime-=i),o.shiftChildren(-i,!1,-Infinity),l=0),s._end>r&&s._ts&&(r=s._end),s=t;Ve(o,o===a&&o._time>r?o._time:r,1,1),o._dirty=0}return o._tDur},n.updateRoot=function(e){if(a._ts&&(_e(a,Oe(e,a)),h=Tt.frame),Tt.frame>=oe){oe+=v.autoSleep||120;var t=a._first;if((!t||!t._ts)&&v.autoSleep&&Tt._listeners.length<2){for(;t&&!t._ts;)t=t._next;t||Tt.sleep()}}},n}(Bt);xe(Ft.prototype,{_lock:0,_hasPause:0,_forcing:0});var $t,jt,Nt=function(e,t,i,n,r,o,a){var s,l,c,u,h,d,p,f,m=new ci(this._pt,e,t,0,1,ni,null,r),g=0,_=0;for(m.b=i,m.e=n,i+="",(p=~(n+="").indexOf("random("))&&(n=lt(n)),o&&(o(f=[i,n],e,t),i=f[0],n=f[1]),l=i.match(N)||[];s=N.exec(n);)u=s[0],h=n.substring(g,s.index),c?c=(c+1)%5:"rgba("===h.substr(-5)&&(c=1),u!==l[_++]&&(d=parseFloat(l[_-1])||0,m._pt={_next:m._pt,p:h||1===_?h:",",s:d,c:"="===u.charAt(1)?fe(d,u)-d:parseFloat(u)-d,m:c&&c<4?Math.round:0},g=N.lastIndex);return m.c=g")})),c.duration();else{for(p in h={},C)"ease"===p||"easeEach"===p||qt(p,C[p],h,C.easeEach);for(p in h)for(P=h[p].sort((function(e,t){return e.t-t.t})),$=0,u=0;uf-b&&!g?f:em&&(n=m)),(c=this._yoyo&&1&a)&&(d=this._yEase,n=m-n),l=ze(this._tTime,s),n===p&&!i&&this._initted)return this._tTime=_,this;a!==l&&(h&&this._yEase&&It(h,c),!this.vars.repeatRefresh||c||this._lock||(this._lock=i=1,this.render(pe(s*a),!0).invalidate()._lock=0))}if(!this._initted){if(je(this,g?e:n,i,t,_))return this._tTime=0,this;if(p!==this._time)return this;if(m!==this._dur)return this.render(e,t,i)}if(this._tTime=_,this._time=n,!this._act&&this._ts&&(this._act=1,this._lazy=0),this.ratio=u=(d||this._ease)(n/m),this._from&&(this.ratio=u=1-u),n&&!p&&!t&&(ht(this,"onStart"),this._tTime!==_))return this;for(o=this._pt;o;)o.r(u,o.d),o=o._next;h&&h.render(e<0?e:!n&&c?-1e-8:h._dur*h._ease(n/this._dur),t,i)||this._startAt&&(this._zTime=e),this._onUpdate&&!t&&(g&&Ie(this,e,0,i),ht(this,"onUpdate")),this._repeat&&a!==l&&this.vars.onRepeat&&!t&&this.parent&&ht(this,"onRepeat"),_!==this._tDur&&_||this._tTime!==_||(g&&!this._onUpdate&&Ie(this,e,0,!0),(e||!m)&&(_===this._tDur&&this._ts>0||!_&&this._ts<0)&&ke(this,1),t||g&&!p||!(_||p||c)||(ht(this,_===f?"onComplete":"onReverseComplete",!0),this._prom&&!(_0)&&this._prom()))}}else!function(e,t,i,n){var o,a,s,l=e.ratio,c=t<0||!t&&(!e._start&&Ne(e)&&(e._initted||!Ue(e))||(e._ts<0||e._dp._ts<0)&&!Ue(e))?0:1,u=e._rDelay,h=0;if(u&&e._repeat&&(h=Xe(0,e._tDur,t),a=ze(h,u),e._yoyo&&1&a&&(c=1-c),a!==ze(e._tTime,u)&&(l=1-c,e.vars.repeatRefresh&&e._initted&&e.invalidate())),c!==l||r||n||e._zTime===b||!t&&e._zTime){if(!e._initted&&je(e,t,n,i,h))return;for(s=e._zTime,e._zTime=t||(i?b:0),i||(i=t&&!s),e.ratio=c,e._from&&(c=1-c),e._time=0,e._tTime=h,o=e._pt;o;)o.r(c,o.d),o=o._next;t<0&&Ie(e,t,0,!0),e._onUpdate&&!i&&ht(e,"onUpdate"),h&&e._repeat&&!i&&e.parent&&ht(e,"onRepeat"),(t>=e._tDur||t<0)&&e.ratio===c&&(c&&ke(e,1),i||r||(ht(e,c?"onComplete":"onReverseComplete",!0),e._prom&&e._prom()))}else e._zTime||(e._zTime=t)}(this,e,t,i);return this},s.targets=function(){return this._targets},s.invalidate=function(t){return(!t||!this.vars.runBackwards)&&(this._startAt=0),this._pt=this._op=this._onUpdate=this._lazy=this.ratio=0,this._ptLookup=[],this.timeline&&this.timeline.invalidate(t),e.prototype.invalidate.call(this,t)},s.resetTo=function(e,t,i,n){p||Tt.wake(),this._ts||this.play();var r=Math.min(this._dur,(this._dp._time-this._start)*this._ts);return this._initted||Gt(this,r),function(e,t,i,n,r,o,a){var s,l,c,u,h=(e._pt&&e._ptCache||(e._ptCache={}))[t];if(!h)for(h=e._ptCache[t]=[],c=e._ptLookup,u=e._targets.length;u--;){if((s=c[u][t])&&s.d&&s.d._pt)for(s=s.d._pt;s&&s.p!==t&&s.fp!==t;)s=s._next;if(!s)return jt=1,e.vars[t]="+=0",Gt(e,a),jt=0,1;h.push(s)}for(u=h.length;u--;)(s=(l=h[u])._pt||l).s=!n&&0!==n||r?s.s+(n||0)+o*s.c:n,s.c=i-s.s,l.e&&(l.e=de(i)+Ye(l.e)),l.b&&(l.b=s.s+Ye(l.b))}(this,e,t,i,n,this._ease(r/this._dur),r)?this.resetTo(e,t,i,n):(Re(this,0),this.parent||Se(this._dp,this,"_first","_last",this._dp._sort?"_start":0),this.render(0))},s.kill=function(e,t){if(void 0===t&&(t="all"),!(e||t&&"all"!==t))return this._lazy=this._pt=0,this.parent?dt(this):this;if(this.timeline){var i=this.timeline.totalDuration();return this.timeline.killTweensOf(e,t,$t&&!0!==$t.vars.overwrite)._first||dt(this),this.parent&&i!==this.timeline.totalDuration()&&Ve(this,this._dur*this.timeline._tDur/i,0,1),this}var n,r,o,a,s,l,c,u=this._targets,h=e?et(e):u,d=this._ptLookup,p=this._pt;if((!t||"all"===t)&&function(e,t){for(var i=e.length,n=i===t.length;n&&i--&&e[i]===t[i];);return i<0}(u,h))return"all"===t&&(this._pt=0),dt(this);for(n=this._op=this._op||[],"all"!==t&&(A(t)&&(s={},he(t,(function(e){return s[e]=1})),t=s),t=function(e,t){var i,n,r,o,a=e[0]?ce(e[0]).harness:0,s=a&&a.aliases;if(!s)return t;for(n in i=be({},t),s)if(n in i)for(r=(o=s[n].split(",")).length;r--;)i[o[r]]=i[n];return i}(u,t)),c=u.length;c--;)if(~h.indexOf(u[c]))for(s in r=d[c],"all"===t?(n[c]=t,a=r,o={}):(o=n[c]=n[c]||{},a=t),a)(l=r&&r[s])&&("kill"in l.d&&!0!==l.d.kill(s)||Ee(this,l,"_pt"),delete r[s]),"all"!==o&&(o[s]=1);return this._initted&&!this._pt&&p&&dt(this),this},o.to=function(e,t){return new o(e,t,arguments[2])},o.from=function(e,t){return Ze(1,arguments)},o.delayedCall=function(e,t,i,n){return new o(t,0,{immediateRender:!1,lazy:!1,overwrite:!1,delay:e,onComplete:t,onReverseComplete:t,onCompleteParams:i,onReverseCompleteParams:i,callbackScope:n})},o.fromTo=function(e,t,i){return Ze(2,arguments)},o.set=function(e,t){return t.duration=0,t.repeatDelay||(t.repeat=0),new o(e,t)},o.killTweensOf=function(e,t,i){return a.killTweensOf(e,t,i)},o}(Bt);xe(Xt.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0}),he("staggerTo,staggerFrom,staggerFromTo",(function(e){Xt[e]=function(){var t=new Ft,i=Ke.call(arguments,0);return i.splice("staggerFromTo"===e?5:4,0,0),t[e].apply(t,i)}}));var Yt=function(e,t,i){return e[t]=i},Kt=function(e,t,i){return e[t](i)},Jt=function(e,t,i,n){return e[t](n.fp,i)},Qt=function(e,t,i){return e.setAttribute(t,i)},ei=function(e,t){return M(e[t])?Kt:P(e[t])&&e.setAttribute?Qt:Yt},ti=function(e,t){return t.set(t.t,t.p,Math.round(1e6*(t.s+t.c*e))/1e6,t)},ii=function(e,t){return t.set(t.t,t.p,!!(t.s+t.c*e),t)},ni=function(e,t){var i=t._pt,n="";if(!e&&t.b)n=t.b;else if(1===e&&t.e)n=t.e;else{for(;i;)n=i.p+(i.m?i.m(i.s+i.c*e):Math.round(1e4*(i.s+i.c*e))/1e4)+n,i=i._next;n+=t.c}t.set(t.t,t.p,n,t)},ri=function(e,t){for(var i=t._pt;i;)i.r(e,i.d),i=i._next},oi=function(e,t,i,n){for(var r,o=this._pt;o;)r=o._next,o.p===n&&o.modifier(e,t,i),o=r},ai=function(e){for(var t,i,n=this._pt;n;)i=n._next,n.p===e&&!n.op||n.op===e?Ee(this,n,"_pt"):n.dep||(t=1),n=i;return!t},si=function(e,t,i,n){n.mSet(e,t,n.m.call(n.tween,i,n.mt),n)},li=function(e){for(var t,i,n,r,o=e._pt;o;){for(t=o._next,i=n;i&&i.pr>o.pr;)i=i._next;(o._prev=i?i._prev:r)?o._prev._next=o:n=o,(o._next=i)?i._prev=o:r=o,o=t}e._pt=n},ci=function(){function e(e,t,i,n,r,o,a,s,l){this.t=t,this.s=n,this.c=r,this.p=i,this.r=o||ti,this.d=a||this,this.set=s||Yt,this.pr=l||0,this._next=e,e&&(e._prev=this)}return e.prototype.modifier=function(e,t,i){this.mSet=this.mSet||this.set,this.set=si,this.m=e,this.mt=i,this.tween=t},e}();he(se+"parent,duration,ease,delay,overwrite,runBackwards,startAt,yoyo,immediateRender,repeat,repeatDelay,data,paused,reversed,lazy,callbackScope,stringFilter,id,yoyoEase,stagger,inherit,repeatRefresh,keyframes,autoRevert,scrollTrigger",(function(e){return ee[e]=1})),q.TweenMax=q.TweenLite=Xt,q.TimelineLite=q.TimelineMax=Ft,a=new Ft({sortChildren:!1,defaults:y,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0}),v.stringFilter=wt;var ui=[],hi={},di=[],pi=0,fi=function(e){return(hi[e]||di).map((function(e){return e()}))},mi=function(){var e=Date.now(),t=[];e-pi>2&&(fi("matchMediaInit"),ui.forEach((function(e){var i,n,r,o,a=e.queries,l=e.conditions;for(n in a)(i=s.matchMedia(a[n]).matches)&&(r=1),i!==l[n]&&(l[n]=i,o=1);o&&(e.revert(),r&&t.push(e))})),fi("matchMediaRevert"),t.forEach((function(e){return e.onMatch(e)})),pi=e,fi("matchMedia"))},gi=function(){function e(e,t){this.selector=t&&tt(t),this.data=[],this._r=[],this.isReverted=!1,e&&this.add(e)}var t=e.prototype;return t.add=function(e,t,i){M(e)&&(i=t,t=e,e=M);var n=this,r=function(){var e,r=o,a=n.selector;return r&&r!==n&&r.data.push(n),i&&(n.selector=tt(i)),o=n,e=t.apply(n,arguments),M(e)&&n._r.push(e),o=r,n.selector=a,n.isReverted=!1,e};return n.last=r,e===M?r(n):e?n[e]=r:r},t.ignore=function(e){var t=o;o=null,e(this),o=t},t.getTweens=function(){var t=[];return this.data.forEach((function(i){return i instanceof e?t.push.apply(t,i.getTweens()):i instanceof Xt&&!(i.parent&&"nested"===i.parent.data)&&t.push(i)})),t},t.clear=function(){this._r.length=this.data.length=0},t.kill=function(e,t){var i=this;if(e){var n=this.getTweens();this.data.forEach((function(e){"isFlip"===e.data&&(e.revert(),e.getChildren(!0,!0,!1).forEach((function(e){return n.splice(n.indexOf(e),1)})))})),n.map((function(e){return{g:e.globalTime(0),t:e}})).sort((function(e,t){return t.g-e.g||-1})).forEach((function(t){return t.t.revert(e)})),this.data.forEach((function(t){return!(t instanceof Bt)&&t.revert&&t.revert(e)})),this._r.forEach((function(t){return t(e,i)})),this.isReverted=!0}else this.data.forEach((function(e){return e.kill&&e.kill()}));if(this.clear(),t){var r=ui.indexOf(this);~r&&ui.splice(r,1)}},t.revert=function(e){this.kill(e||{})},e}(),_i=function(){function e(e){this.contexts=[],this.scope=e}var t=e.prototype;return t.add=function(e,t,i){D(e)||(e={matches:e});var n,r,o,a=new gi(0,i||this.scope),l=a.conditions={};for(r in this.contexts.push(a),t=a.add("onMatch",t),a.queries=e,e)"all"===r?o=1:(n=s.matchMedia(e[r]))&&(ui.indexOf(a)<0&&ui.push(a),(l[r]=n.matches)&&(o=1),n.addListener?n.addListener(mi):n.addEventListener("change",mi));return o&&t(a),this},t.revert=function(e){this.kill(e||{})},t.kill=function(e){this.contexts.forEach((function(t){return t.kill(e,!0)}))},e}(),vi={registerPlugin:function(){for(var e=arguments.length,t=new Array(e),i=0;i1){var n=e.map((function(e){return bi.quickSetter(e,t,i)})),r=n.length;return function(e){for(var t=r;t--;)n[t](e)}}e=e[0]||{};var o=ne[t],a=ce(e),s=a.harness&&(a.harness.aliases||{})[t]||t,l=o?function(t){var n=new o;d._pt=0,n.init(e,i?t+i:t,d,0,[e]),n.render(1,n),d._pt&&ri(1,d)}:a.set(e,s);return o?l:function(t){return l(e,s,i?t+i:t,a,1)}},quickTo:function(e,t,i){var n,r=bi.to(e,be(((n={})[t]="+=0.1",n.paused=!0,n),i||{})),o=function(e,i,n){return r.resetTo(t,e,i,n)};return o.tween=r,o},isTweening:function(e){return a.getTweensOf(e,!0).length>0},defaults:function(e){return e&&e.ease&&(e.ease=Pt(e.ease,y.ease)),we(y,e||{})},config:function(e){return we(v,e||{})},registerEffect:function(e){var t=e.name,i=e.effect,n=e.plugins,r=e.defaults,o=e.extendTimeline;(n||"").split(",").forEach((function(e){return e&&!ne[e]&&!q[e]&&H()})),re[t]=function(e,t,n){return i(et(e),xe(t||{},r),n)},o&&(Ft.prototype[t]=function(e,i,n){return this.add(re[t](e,D(i)?i:(n=i)&&{},this),n)})},registerEase:function(e,t){St[e]=Pt(t)},parseEase:function(e,t){return arguments.length?Pt(e,t):St},getById:function(e){return a.getById(e)},exportRoot:function(e,t){void 0===e&&(e={});var i,n,r=new Ft(e);for(r.smoothChildTiming=z(e.smoothChildTiming),a.remove(r),r._dp=0,r._time=r._tTime=a._time,i=a._first;i;)n=i._next,!t&&!i._dur&&i instanceof Xt&&i.vars.onComplete===i._targets[0]||Fe(r,i,i._start-i._delay),i=n;return Fe(a,r,0),r},context:function(e,t){return e?new gi(e,t):o},matchMedia:function(e){return new _i(e)},matchMediaRefresh:function(){return ui.forEach((function(e){var t,i,n=e.conditions;for(i in n)n[i]&&(n[i]=!1,t=1);t&&e.revert()}))||mi()},addEventListener:function(e,t){var i=hi[e]||(hi[e]=[]);~i.indexOf(t)||i.push(t)},removeEventListener:function(e,t){var i=hi[e],n=i&&i.indexOf(t);n>=0&&i.splice(n,1)},utils:{wrap:function e(t,i,n){var r=i-t;return B(t)?st(t,e(0,t.length),i):He(n,(function(e){return(r+(e-t)%r)%r+t}))},wrapYoyo:function e(t,i,n){var r=i-t,o=2*r;return B(t)?st(t,e(0,t.length-1),i):He(n,(function(e){return t+((e=(o+(e-t)%o)%o||0)>r?o-e:e)}))},distribute:nt,random:at,snap:ot,normalize:function(e,t,i){return ct(e,t,0,1,i)},getUnit:Ye,clamp:function(e,t,i){return He(i,(function(i){return Xe(e,t,i)}))},splitColor:_t,toArray:et,selector:tt,mapRange:ct,pipe:function(){for(var e=arguments.length,t=new Array(e),i=0;i=0)return;n._gsap.svg&&(this.svgo=n.getAttribute("data-svg-origin"),this.props.push(gn,t,"")),e=mn}(r||t)&&this.props.push(e,t,r[e])},vn=function(e){e.translate&&(e.removeProperty("translate"),e.removeProperty("scale"),e.removeProperty("rotate"))},yn=function(){var e,t,i=this.props,n=this.target,r=n.style,o=n._gsap;for(e=0;e=0?Tn[r]:"")+e},Sn=function(){"undefined"!=typeof window&&window.document&&(wi=window,Ti=wi.document,Ci=Ti.documentElement,Ei=bn("div")||{style:{}},bn("div"),mn=Cn(mn),gn=mn+"Origin",Ei.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",Mi=!!Cn("perspective"),Ai=bi.core.reverting,Si=1)},En=function e(t){var i,n=bn("svg",this.ownerSVGElement&&this.ownerSVGElement.getAttribute("xmlns")||"http://www.w3.org/2000/svg"),r=this.parentNode,o=this.nextSibling,a=this.style.cssText;if(Ci.appendChild(n),n.appendChild(this),this.style.display="block",t)try{i=this.getBBox(),this._gsapBBox=this.getBBox,this.getBBox=e}catch(e){}else this._gsapBBox&&(i=this._gsapBBox());return r&&(o?r.insertBefore(this,o):r.appendChild(this)),Ci.removeChild(n),this.style.cssText=a,i},kn=function(e,t){for(var i=t.length;i--;)if(e.hasAttribute(t[i]))return e.getAttribute(t[i])},An=function(e){var t;try{t=e.getBBox()}catch(i){t=En.call(e,!0)}return t&&(t.width||t.height)||e.getBBox===En||(t=En.call(e,!0)),!t||t.width||t.x||t.y?t:{x:+kn(e,["x","cx","x1"])||0,y:+kn(e,["y","cy","y1"])||0,width:0,height:0}},Mn=function(e){return!(!e.getCTM||e.parentNode&&!e.ownerSVGElement||!An(e))},In=function(e,t){if(t){var i=e.style;t in Hi&&t!==gn&&(t=mn),i.removeProperty?("ms"!==t.substr(0,2)&&"webkit"!==t.substr(0,6)||(t="-"+t),i.removeProperty(t.replace(Ji,"-$1").toLowerCase())):i.removeAttribute(t)}},Pn=function(e,t,i,n,r,o){var a=new ci(e._pt,t,i,0,1,o?ln:sn);return e._pt=a,a.b=n,a.e=r,e._props.push(i),a},Dn={deg:1,rad:1,turn:1},zn={grid:1,flex:1},On=function e(t,i,n,r){var o,a,s,l,c=parseFloat(n)||0,u=(n+"").trim().substr((c+"").length)||"px",h=Ei.style,d=Qi.test(i),p="svg"===t.tagName.toLowerCase(),f=(p?"client":"offset")+(d?"Width":"Height"),m=100,g="px"===r,_="%"===r;return r===u||!c||Dn[r]||Dn[u]?c:("px"!==u&&!g&&(c=e(t,i,n,"px")),l=t.getCTM&&Mn(t),!_&&"%"!==u||!Hi[i]&&!~i.indexOf("adius")?(h[d?"width":"height"]=m+(g?u:r),a=~i.indexOf("adius")||"em"===r&&t.appendChild&&!p?t:t.parentNode,l&&(a=(t.ownerSVGElement||{}).parentNode),a&&a!==Ti&&a.appendChild||(a=Ti.body),(s=a._gsap)&&_&&s.width&&d&&s.time===Tt.time&&!s.uncache?de(c/s.width*m):((_||"%"===u)&&!zn[wn(a,"display")]&&(h.position=wn(t,"position")),a===t&&(h.position="static"),a.appendChild(Ei),o=Ei[f],a.removeChild(Ei),h.position="absolute",d&&_&&((s=ce(a)).time=Tt.time,s.width=a[f]),de(g?o*c/m:o&&c?m/o*c:0))):(o=l?t.getBBox()[d?"width":"height"]:t[f],de(_?c/o*m:c/100*o)))},Ln=function(e,t,i,n){var r;return Si||Sn(),t in tn&&"transform"!==t&&~(t=tn[t]).indexOf(",")&&(t=t.split(",")[0]),Hi[t]&&"transform"!==t?(r=Wn(e,n),r="transformOrigin"!==t?r[t]:r.svg?r.origin:Zn(wn(e,gn))+" "+r.zOrigin+"px"):(!(r=e.style[t])||"auto"===r||n||~(r+"").indexOf("calc("))&&(r=$n[t]&&$n[t](e,t,i)||wn(e,t)||ue(e,t)||("opacity"===t?1:0)),i&&!~(r+"").trim().indexOf(" ")?On(e,t,r,i)+i:r},Rn=function(e,t,i,n){if(!i||"none"===i){var r=Cn(t,e,1),o=r&&wn(e,r,1);o&&o!==i?(t=r,i=o):"borderColor"===t&&(i=wn(e,"borderTopColor"))}var a,s,l,c,u,h,d,p,f,m,g,_=new ci(this._pt,e.style,t,0,1,ni),y=0,x=0;if(_.b=i,_.e=n,i+="","auto"===(n+="")&&(e.style[t]=n,n=wn(e,t)||n,e.style[t]=i),wt(a=[i,n]),n=a[1],l=(i=a[0]).match(j)||[],(n.match(j)||[]).length){for(;s=j.exec(n);)d=s[0],f=n.substring(y,s.index),u?u=(u+1)%5:"rgba("!==f.substr(-5)&&"hsla("!==f.substr(-5)||(u=1),d!==(h=l[x++]||"")&&(c=parseFloat(h)||0,g=h.substr((c+"").length),"="===d.charAt(1)&&(d=fe(c,d)+g),p=parseFloat(d),m=d.substr((p+"").length),y=j.lastIndex-m.length,m||(m=m||v.units[t]||g,y===n.length&&(n+=m,_.e+=m)),g!==m&&(c=On(e,t,h,m)||0),_._pt={_next:_._pt,p:f||1===x?f:",",s:c,c:p-c,m:u&&u<4||"zIndex"===t?Math.round:0});_.c=y-1;)i=s[r],Hi[i]&&(n=1,i="transformOrigin"===i?gn:mn),In(o,i);n&&(In(o,mn),l&&(l.svg&&o.removeAttribute("transform"),Wn(o,1),l.uncache=1,vn(a)))}},$n={clearProps:function(e,t,i,n,r){if("isFromStart"!==r.data){var o=e._pt=new ci(e._pt,t,i,0,0,Fn);return o.u=n,o.pr=-10,o.tween=r,e._props.push(i),1}}},jn=[1,0,0,1,0,0],Nn={},Un=function(e){return"matrix(1, 0, 0, 1, 0, 0)"===e||"none"===e||!e},Vn=function(e){var t=wn(e,mn);return Un(t)?jn:t.substr(7).match($).map(de)},Gn=function(e,t){var i,n,r,o,a=e._gsap||ce(e),s=e.style,l=Vn(e);return a.svg&&e.getAttribute("transform")?"1,0,0,1,0,0"===(l=[(r=e.transform.baseVal.consolidate().matrix).a,r.b,r.c,r.d,r.e,r.f]).join(",")?jn:l:(l!==jn||e.offsetParent||e===Ci||a.svg||(r=s.display,s.display="block",(i=e.parentNode)&&e.offsetParent||(o=1,n=e.nextElementSibling,Ci.appendChild(e)),l=Vn(e),r?s.display=r:In(e,"display"),o&&(n?i.insertBefore(e,n):i?i.appendChild(e):Ci.removeChild(e))),t&&l.length>6?[l[0],l[1],l[4],l[5],l[12],l[13]]:l)},qn=function(e,t,i,n,r,o){var a,s,l,c=e._gsap,u=r||Gn(e,!0),h=c.xOrigin||0,d=c.yOrigin||0,p=c.xOffset||0,f=c.yOffset||0,m=u[0],g=u[1],_=u[2],v=u[3],y=u[4],x=u[5],b=t.split(" "),w=parseFloat(b[0])||0,T=parseFloat(b[1])||0;i?u!==jn&&(s=m*v-g*_)&&(l=w*(-g/s)+T*(m/s)-(m*x-g*y)/s,w=w*(v/s)+T*(-_/s)+(_*x-v*y)/s,T=l):(w=(a=An(e)).x+(~b[0].indexOf("%")?w/100*a.width:w),T=a.y+(~(b[1]||b[0]).indexOf("%")?T/100*a.height:T)),n||!1!==n&&c.smooth?(y=w-h,x=T-d,c.xOffset=p+(y*m+x*_)-y,c.yOffset=f+(y*g+x*v)-x):c.xOffset=c.yOffset=0,c.xOrigin=w,c.yOrigin=T,c.smooth=!!n,c.origin=t,c.originIsAbsolute=!!i,e.style[gn]="0px 0px",o&&(Pn(o,c,"xOrigin",h,w),Pn(o,c,"yOrigin",d,T),Pn(o,c,"xOffset",p,c.xOffset),Pn(o,c,"yOffset",f,c.yOffset)),e.setAttribute("data-svg-origin",w+" "+T)},Wn=function(e,t){var i=e._gsap||new Rt(e);if("x"in i&&!t&&!i.uncache)return i;var n,r,o,a,s,l,c,u,h,d,p,f,m,g,_,y,x,b,w,T,C,S,E,k,A,M,I,P,D,z,O,L,R=e.style,B=i.scaleX<0,F="px",$="deg",j=getComputedStyle(e),N=wn(e,gn)||"0";return n=r=o=l=c=u=h=d=p=0,a=s=1,i.svg=!(!e.getCTM||!Mn(e)),j.translate&&("none"===j.translate&&"none"===j.scale&&"none"===j.rotate||(R[mn]=("none"!==j.translate?"translate3d("+(j.translate+" 0 0").split(" ").slice(0,3).join(", ")+") ":"")+("none"!==j.rotate?"rotate("+j.rotate+") ":"")+("none"!==j.scale?"scale("+j.scale.split(" ").join(",")+") ":"")+("none"!==j[mn]?j[mn]:"")),R.scale=R.rotate=R.translate="none"),g=Gn(e,i.svg),i.svg&&(i.uncache?(A=e.getBBox(),N=i.xOrigin-A.x+"px "+(i.yOrigin-A.y)+"px",k=""):k=!t&&e.getAttribute("data-svg-origin"),qn(e,k||N,!!k||i.originIsAbsolute,!1!==i.smooth,g)),f=i.xOrigin||0,m=i.yOrigin||0,g!==jn&&(b=g[0],w=g[1],T=g[2],C=g[3],n=S=g[4],r=E=g[5],6===g.length?(a=Math.sqrt(b*b+w*w),s=Math.sqrt(C*C+T*T),l=b||w?Ki(w,b)*Xi:0,(h=T||C?Ki(T,C)*Xi+l:0)&&(s*=Math.abs(Math.cos(h*Yi))),i.svg&&(n-=f-(f*b+m*T),r-=m-(f*w+m*C))):(L=g[6],z=g[7],I=g[8],P=g[9],D=g[10],O=g[11],n=g[12],r=g[13],o=g[14],c=(_=Ki(L,D))*Xi,_&&(k=S*(y=Math.cos(-_))+I*(x=Math.sin(-_)),A=E*y+P*x,M=L*y+D*x,I=S*-x+I*y,P=E*-x+P*y,D=L*-x+D*y,O=z*-x+O*y,S=k,E=A,L=M),u=(_=Ki(-T,D))*Xi,_&&(y=Math.cos(-_),O=C*(x=Math.sin(-_))+O*y,b=k=b*y-I*x,w=A=w*y-P*x,T=M=T*y-D*x),l=(_=Ki(w,b))*Xi,_&&(k=b*(y=Math.cos(_))+w*(x=Math.sin(_)),A=S*y+E*x,w=w*y-b*x,E=E*y-S*x,b=k,S=A),c&&Math.abs(c)+Math.abs(l)>359.9&&(c=l=0,u=180-u),a=de(Math.sqrt(b*b+w*w+T*T)),s=de(Math.sqrt(E*E+L*L)),_=Ki(S,E),h=Math.abs(_)>2e-4?_*Xi:0,p=O?1/(O<0?-O:O):0),i.svg&&(k=e.getAttribute("transform"),i.forceCSS=e.setAttribute("transform","")||!Un(wn(e,mn)),k&&e.setAttribute("transform",k))),Math.abs(h)>90&&Math.abs(h)<270&&(B?(a*=-1,h+=l<=0?180:-180,l+=l<=0?180:-180):(s*=-1,h+=h<=0?180:-180)),t=t||i.uncache,i.x=n-((i.xPercent=n&&(!t&&i.xPercent||(Math.round(e.offsetWidth/2)===Math.round(-n)?-50:0)))?e.offsetWidth*i.xPercent/100:0)+F,i.y=r-((i.yPercent=r&&(!t&&i.yPercent||(Math.round(e.offsetHeight/2)===Math.round(-r)?-50:0)))?e.offsetHeight*i.yPercent/100:0)+F,i.z=o+F,i.scaleX=de(a),i.scaleY=de(s),i.rotation=de(l)+$,i.rotationX=de(c)+$,i.rotationY=de(u)+$,i.skewX=h+$,i.skewY=d+$,i.transformPerspective=p+F,(i.zOrigin=parseFloat(N.split(" ")[2])||0)&&(R[gn]=Zn(N)),i.xOffset=i.yOffset=0,i.force3D=v.force3D,i.renderTransform=i.svg?er:Mi?Qn:Xn,i.uncache=0,i},Zn=function(e){return(e=e.split(" "))[0]+" "+e[1]},Hn=function(e,t,i){var n=Ye(t);return de(parseFloat(t)+parseFloat(On(e,"x",i+"px",n)))+n},Xn=function(e,t){t.z="0px",t.rotationY=t.rotationX="0deg",t.force3D=0,Qn(e,t)},Yn="0deg",Kn="0px",Jn=") ",Qn=function(e,t){var i=t||this,n=i.xPercent,r=i.yPercent,o=i.x,a=i.y,s=i.z,l=i.rotation,c=i.rotationY,u=i.rotationX,h=i.skewX,d=i.skewY,p=i.scaleX,f=i.scaleY,m=i.transformPerspective,g=i.force3D,_=i.target,v=i.zOrigin,y="",x="auto"===g&&e&&1!==e||!0===g;if(v&&(u!==Yn||c!==Yn)){var b,w=parseFloat(c)*Yi,T=Math.sin(w),C=Math.cos(w);w=parseFloat(u)*Yi,b=Math.cos(w),o=Hn(_,o,T*b*-v),a=Hn(_,a,-Math.sin(w)*-v),s=Hn(_,s,C*b*-v+v)}m!==Kn&&(y+="perspective("+m+Jn),(n||r)&&(y+="translate("+n+"%, "+r+"%) "),(x||o!==Kn||a!==Kn||s!==Kn)&&(y+=s!==Kn||x?"translate3d("+o+", "+a+", "+s+") ":"translate("+o+", "+a+Jn),l!==Yn&&(y+="rotate("+l+Jn),c!==Yn&&(y+="rotateY("+c+Jn),u!==Yn&&(y+="rotateX("+u+Jn),h===Yn&&d===Yn||(y+="skew("+h+", "+d+Jn),1===p&&1===f||(y+="scale("+p+", "+f+Jn),_.style[mn]=y||"translate(0, 0)"},er=function(e,t){var i,n,r,o,a,s=t||this,l=s.xPercent,c=s.yPercent,u=s.x,h=s.y,d=s.rotation,p=s.skewX,f=s.skewY,m=s.scaleX,g=s.scaleY,_=s.target,v=s.xOrigin,y=s.yOrigin,x=s.xOffset,b=s.yOffset,w=s.forceCSS,T=parseFloat(u),C=parseFloat(h);d=parseFloat(d),p=parseFloat(p),(f=parseFloat(f))&&(p+=f=parseFloat(f),d+=f),d||p?(d*=Yi,p*=Yi,i=Math.cos(d)*m,n=Math.sin(d)*m,r=Math.sin(d-p)*-g,o=Math.cos(d-p)*g,p&&(f*=Yi,a=Math.tan(p-f),r*=a=Math.sqrt(1+a*a),o*=a,f&&(a=Math.tan(f),i*=a=Math.sqrt(1+a*a),n*=a)),i=de(i),n=de(n),r=de(r),o=de(o)):(i=m,o=g,n=r=0),(T&&!~(u+"").indexOf("px")||C&&!~(h+"").indexOf("px"))&&(T=On(_,"x",u,"px"),C=On(_,"y",h,"px")),(v||y||x||b)&&(T=de(T+v-(v*i+y*r)+x),C=de(C+y-(v*n+y*o)+b)),(l||c)&&(a=_.getBBox(),T=de(T+l/100*a.width),C=de(C+c/100*a.height)),a="matrix("+i+","+n+","+r+","+o+","+T+","+C+")",_.setAttribute("transform",a),w&&(_.style[mn]=a)},tr=function(e,t,i,n,r){var o,a,s=360,l=A(r),c=parseFloat(r)*(l&&~r.indexOf("rad")?Xi:1)-n,u=n+c+"deg";return l&&("short"===(o=r.split("_")[1])&&(c%=s)!==c%180&&(c+=c<0?s:-360),"cw"===o&&c<0?c=(c+36e9)%s-~~(c/s)*s:"ccw"===o&&c>0&&(c=(c-36e9)%s-~~(c/s)*s)),e._pt=a=new ci(e._pt,t,i,n,c,rn),a.e=u,a.u="deg",e._props.push(i),a},ir=function(e,t){for(var i in t)e[i]=t[i];return e},nr=function(e,t,i){var n,r,o,a,s,l,c,u=ir({},i._gsap),h=i.style;for(r in u.svg?(o=i.getAttribute("transform"),i.setAttribute("transform",""),h[mn]=t,n=Wn(i,1),In(i,mn),i.setAttribute("transform",o)):(o=getComputedStyle(i)[mn],h[mn]=t,n=Wn(i,1),h[mn]=o),Hi)(o=u[r])!==(a=n[r])&&"perspective,force3D,transformOrigin,svgOrigin".indexOf(r)<0&&(s=Ye(o)!==(c=Ye(a))?On(i,r,o,c):parseFloat(o),l=parseFloat(a),e._pt=new ci(e._pt,n,r,s,l-s,nn),e._pt.u=c||0,e._props.push(r));ir(n,u)};he("padding,margin,Width,Radius",(function(e,t){var i="Top",n="Right",r="Bottom",o="Left",a=(t<3?[i,n,r,o]:[i+o,i+n,r+n,r+o]).map((function(i){return t<2?e+i:"border"+i+e}));$n[t>1?"border"+e:e]=function(e,t,i,n,r){var o,s;if(arguments.length<4)return o=a.map((function(t){return Ln(e,t,i)})),5===(s=o.join(" ")).split(o[0]).length?o[0]:s;o=(n+"").split(" "),s={},a.forEach((function(e,t){return s[e]=o[t]=o[t]||o[(t-1)/2|0]})),e.init(t,s,r)}}));var rr,or,ar,sr={name:"css",register:Sn,targetTest:function(e){return e.style&&e.nodeType},init:function(e,t,i,n,r){var o,a,s,l,c,u,h,d,p,f,m,g,_,y,x,b,w,T,C,S,E=this._props,k=e.style,M=i.vars.startAt;for(h in Si||Sn(),this.styles=this.styles||xn(e),b=this.styles.props,this.tween=i,t)if("autoRound"!==h&&(a=t[h],!ne[h]||!Vt(h,t,i,n,e,r)))if(c=typeof a,u=$n[h],"function"===c&&(c=typeof(a=a.call(i,n,e,r))),"string"===c&&~a.indexOf("random(")&&(a=lt(a)),u)u(this,e,h,a,i)&&(x=1);else if("--"===h.substr(0,2))o=(getComputedStyle(e).getPropertyValue(h)+"").trim(),a+="",xt.lastIndex=0,xt.test(o)||(d=Ye(o),p=Ye(a)),p?d!==p&&(o=On(e,h,o,p)+p):d&&(a+=d),this.add(k,"setProperty",o,a,n,r,0,0,h),E.push(h),b.push(h,0,k[h]);else if("undefined"!==c){if(M&&h in M?(o="function"==typeof M[h]?M[h].call(i,n,e,r):M[h],A(o)&&~o.indexOf("random(")&&(o=lt(o)),Ye(o+"")||(o+=v.units[h]||Ye(Ln(e,h))||""),"="===(o+"").charAt(1)&&(o=Ln(e,h))):o=Ln(e,h),l=parseFloat(o),(f="string"===c&&"="===a.charAt(1)&&a.substr(0,2))&&(a=a.substr(2)),s=parseFloat(a),h in tn&&("autoAlpha"===h&&(1===l&&"hidden"===Ln(e,"visibility")&&s&&(l=0),b.push("visibility",0,k.visibility),Pn(this,k,"visibility",l?"inherit":"hidden",s?"inherit":"hidden",!s)),"scale"!==h&&"transform"!==h&&~(h=tn[h]).indexOf(",")&&(h=h.split(",")[0])),m=h in Hi)if(this.styles.save(h),g||((_=e._gsap).renderTransform&&!t.parseTransform||Wn(e,t.parseTransform),y=!1!==t.smoothOrigin&&_.smooth,(g=this._pt=new ci(this._pt,k,mn,0,1,_.renderTransform,_,0,-1)).dep=1),"scale"===h)this._pt=new ci(this._pt,_,"scaleY",l,(f?fe(l,f+s):s)-l||0,nn),this._pt.u=0,E.push("scaleY",h),h+="X";else{if("transformOrigin"===h){b.push(gn,0,k[gn]),T=void 0,C=void 0,S=void 0,T=(w=a).split(" "),C=T[0],S=T[1]||"50%","top"!==C&&"bottom"!==C&&"left"!==S&&"right"!==S||(w=C,C=S,S=w),T[0]=Bn[C]||C,T[1]=Bn[S]||S,a=T.join(" "),_.svg?qn(e,a,0,y,0,this):((p=parseFloat(a.split(" ")[2])||0)!==_.zOrigin&&Pn(this,_,"zOrigin",_.zOrigin,p),Pn(this,k,h,Zn(o),Zn(a)));continue}if("svgOrigin"===h){qn(e,a,1,y,0,this);continue}if(h in Nn){tr(this,_,h,l,f?fe(l,f+a):a);continue}if("smoothOrigin"===h){Pn(this,_,"smooth",_.smooth,a);continue}if("force3D"===h){_[h]=a;continue}if("transform"===h){nr(this,a,e);continue}}else h in k||(h=Cn(h)||h);if(m||(s||0===s)&&(l||0===l)&&!en.test(a)&&h in k)s||(s=0),(d=(o+"").substr((l+"").length))!==(p=Ye(a)||(h in v.units?v.units[h]:d))&&(l=On(e,h,o,p)),this._pt=new ci(this._pt,m?_:k,h,l,(f?fe(l,f+s):s)-l,m||"px"!==p&&"zIndex"!==h||!1===t.autoRound?nn:an),this._pt.u=p||0,d!==p&&"%"!==p&&(this._pt.b=o,this._pt.r=on);else if(h in k)Rn.call(this,e,h,o,f?f+a:a);else{if(!(h in e))continue;this.add(e,h,o||e[h],f?f+a:a,n,r)}m||(h in k?b.push(h,0,k[h]):b.push(h,1,o||e[h])),E.push(h)}x&&li(this)},render:function(e,t){if(t.tween._time||!Ai())for(var i=t._pt;i;)i.r(e,i.d),i=i._next;else t.styles.revert()},get:Ln,aliases:tn,getSetter:function(e,t,i){var n=tn[t];return n&&n.indexOf(",")<0&&(t=n),t in Hi&&t!==gn&&(e._gsap.x||Ln(e,"x"))?i&&ki===i?"scale"===t?dn:hn:(ki=i||{})&&("scale"===t?pn:fn):e.style&&!P(e.style[t])?cn:~t.indexOf("-")?un:ei(e,t)},core:{_removeProperty:In,_getMatrix:Gn}};bi.utils.checkPrefix=Cn,bi.core.getStyleSaver=xn,ar=he((rr="x,y,z,scale,scaleX,scaleY,xPercent,yPercent")+","+(or="rotation,rotationX,rotationY,skewX,skewY")+",transform,transformOrigin,svgOrigin,force3D,smoothOrigin,transformPerspective",(function(e){Hi[e]=1})),he(or,(function(e){v.units[e]="deg",Nn[e]=1})),tn[ar[13]]=rr+","+or,he("0:translateX,1:translateY,2:translateZ,8:rotate,8:rotationZ,8:rotateZ,9:rotateX,10:rotateY",(function(e){var t=e.split(":");tn[t[1]]=ar[t[0]]})),he("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",(function(e){v.units[e]="px"})),bi.registerPlugin(sr);var lr=bi.registerPlugin(sr)||bi,cr=lr.core.Tween;e.Back=Ui,e.Bounce=Gi,e.CSSPlugin=sr,e.Circ=Zi,e.Cubic=Bi,e.Elastic=Ni,e.Expo=Wi,e.Linear=Li,e.Power0=Ii,e.Power1=Pi,e.Power2=Di,e.Power3=zi,e.Power4=Oi,e.Quad=Ri,e.Quart=Fi,e.Quint=$i,e.Sine=qi,e.SteppedEase=Vi,e.Strong=ji,e.TimelineLite=Ft,e.TimelineMax=Ft,e.TweenLite=Xt,e.TweenMax=cr,e.default=lr,e.gsap=lr,"undefined"==typeof window||window!==e?Object.defineProperty(e,"__esModule",{value:!0}):delete window.default}))},{}],6:[function(e,t,i){(function(e){(function(){!function(e,n){"object"==typeof i&&void 0!==t?t.exports=n():"function"==typeof define&&define.amd?define(n):(e="undefined"!=typeof globalThis?globalThis:e||self).mapboxgl=n()}(this,(function(){"use strict";var t,i,n;function r(e,r){if(t)if(i){var o="self.onerror = function() { console.error('An error occurred while parsing the WebWorker bundle. This is most likely due to improper transpilation by Babel; please see https://docs.mapbox.com/mapbox-gl-js/guides/install/#transpiling'); }; var sharedChunk = {}; ("+t+")(sharedChunk); ("+i+")(sharedChunk); self.onerror = null;",a={};t(a),n=r(a),"undefined"!=typeof window&&window&&window.URL&&window.URL.createObjectURL&&(n.workerUrl=window.URL.createObjectURL(new Blob([o],{type:"text/javascript"})))}else i=r;else t=r}return r(0,(function(t){var i="undefined"!=typeof self?self:{},n="2.11.0";let r;const o={API_URL:"https://api.mapbox.com",get API_URL_REGEX(){if(null==r){const t=/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i;try{r=null!=e.env.API_URL_REGEX?new RegExp(e.env.API_URL_REGEX):t}catch(e){r=t}}return r},get API_TILEJSON_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/v[0-9]*\/.*\.json.*$)/i},get API_SPRITE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*\/sprite.*\..*$)/i},get API_FONTS_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/fonts\/v[0-9]*\/)(.*\.pbf.*$)/i},get API_STYLE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*$)/i},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},SESSION_PATH:"/map-sessions/v1",FEEDBACK_URL:"https://apps.mapbox.com/feedback",TILE_URL_VERSION:"v4",RASTER_URL_PREFIX:"raster/v1",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null,MAX_PARALLEL_IMAGE_REQUESTS:16},a={supported:!1,testSupport:function(e){!c&&l&&(u?h(e):s=e)}};let s,l,c=!1,u=!1;function h(e){const t=e.createTexture();e.bindTexture(e.TEXTURE_2D,t);try{if(e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,l),e.isContextLost())return;a.supported=!0}catch(e){}e.deleteTexture(t),c=!0}i.document&&(l=i.document.createElement("img"),l.onload=function(){s&&h(s),s=null,u=!0},l.onerror=function(){c=!0,s=null},l.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const d="01";var p=f;function f(e,t,i,n){this.cx=3*e,this.bx=3*(i-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(n-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=i,this.p2y=n}f.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,t){if(void 0===t&&(t=1e-6),e<0)return 0;if(e>1)return 1;for(var i=e,n=0;n<8;n++){var r=this.sampleCurveX(i)-e;if(Math.abs(r)r?a=i:s=i,i=.5*(s-a)+a;return i},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}};var m=g;function g(e,t){this.x=e,this.y=t}g.prototype={clone:function(){return new g(this.x,this.y)},add:function(e){return this.clone()._add(e)},sub:function(e){return this.clone()._sub(e)},multByPoint:function(e){return this.clone()._multByPoint(e)},divByPoint:function(e){return this.clone()._divByPoint(e)},mult:function(e){return this.clone()._mult(e)},div:function(e){return this.clone()._div(e)},rotate:function(e){return this.clone()._rotate(e)},rotateAround:function(e,t){return this.clone()._rotateAround(e,t)},matMult:function(e){return this.clone()._matMult(e)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(e){return this.x===e.x&&this.y===e.y},dist:function(e){return Math.sqrt(this.distSqr(e))},distSqr:function(e){var t=e.x-this.x,i=e.y-this.y;return t*t+i*i},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith:function(e){return this.angleWithSep(e.x,e.y)},angleWithSep:function(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult:function(e){var t=e[2]*this.x+e[3]*this.y;return this.x=e[0]*this.x+e[1]*this.y,this.y=t,this},_add:function(e){return this.x+=e.x,this.y+=e.y,this},_sub:function(e){return this.x-=e.x,this.y-=e.y,this},_mult:function(e){return this.x*=e,this.y*=e,this},_div:function(e){return this.x/=e,this.y/=e,this},_multByPoint:function(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint:function(e){return this.x/=e.x,this.y/=e.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var e=this.y;return this.y=this.x,this.x=-e,this},_rotate:function(e){var t=Math.cos(e),i=Math.sin(e),n=i*this.x+t*this.y;return this.x=t*this.x-i*this.y,this.y=n,this},_rotateAround:function(e,t){var i=Math.cos(e),n=Math.sin(e),r=t.y+n*(this.x-t.x)+i*(this.y-t.y);return this.x=t.x+i*(this.x-t.x)-n*(this.y-t.y),this.y=r,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},g.convert=function(e){return e instanceof g?e:Array.isArray(e)?new g(e[0],e[1]):e};const _=Math.PI/180,v=180/Math.PI;function y(e){return e*_}function x(e){return e*v}const b=[[0,0],[1,0],[1,1],[0,1]];function w(e){if(e<=0)return 0;if(e>=1)return 1;const t=e*e,i=t*e;return 4*(e<.5?i:3*(e-t)+i-.75)}function T(e,t,i,n){const r=new p(e,t,i,n);return function(e){return r.solve(e)}}const C=T(.25,.1,.25,1);function S(e,t,i){return Math.min(i,Math.max(t,e))}function E(e,t,i){return(i=S((i-e)/(t-e),0,1))*i*(3-2*i)}function k(e,t,i){const n=i-t,r=((e-t)%n+n)%n+t;return r===t?i:r}function A(e,t,i){if(!e.length)return i(null,[]);let n=e.length;const r=new Array(e.length);let o=null;e.forEach(((e,a)=>{t(e,((e,t)=>{e&&(o=e),r[a]=t,0==--n&&i(o,r)}))}))}function M(e){const t=[];for(const i in e)t.push(e[i]);return t}function I(e,...t){for(const i of t)for(const t in i)e[t]=i[t];return e}let P=1;function D(){return P++}function z(){return function e(t){return t?(t^Math.random()*(16>>t/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,e)}()}function O(e){return e<=1?1:Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function L(e){return!!e&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e)}function R(e,t){e.forEach((e=>{t[e]&&(t[e]=t[e].bind(t))}))}function B(e,t){return-1!==e.indexOf(t,e.length-t.length)}function F(e,t,i){const n={};for(const r in e)n[r]=t.call(i||this,e[r],r,e);return n}function $(e,t,i){const n={};for(const r in e)t.call(i||this,e[r],r,e)&&(n[r]=e[r]);return n}function j(e){return Array.isArray(e)?e.map(j):"object"==typeof e&&e?F(e,j):e}const N={};function U(e){N[e]||(N[e]=!0)}function V(e,t,i){return(i.y-e.y)*(t.x-e.x)>(t.y-e.y)*(i.x-e.x)}function G(e){let t=0;for(let i,n,r=0,o=e.length,a=o-1;r@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,((e,i,n,r)=>{const o=n||r;return t[i]=!o||o.toLowerCase(),""})),t["max-age"]){const e=parseInt(t["max-age"],10);isNaN(e)?delete t["max-age"]:t["max-age"]=e}return t}let Z=null;function H(e){if(null==Z){const t=e.navigator?e.navigator.userAgent:null;Z=!!e.safari||!(!t||!(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return Z}function X(e){try{const t=i[e];return t.setItem("_mapbox_test_",1),t.removeItem("_mapbox_test_"),!0}catch(e){return!1}}function Y(e,t){return[e[4*t],e[4*t+1],e[4*t+2],e[4*t+3]]}const K="mapbox-tiles";let J,Q,ee=500,te=50;function ie(){try{return i.caches}catch(e){}}function ne(){ie()&&!J&&(J=i.caches.open(K))}function re(e){const t=e.indexOf("?");if(t<0)return e;const i=function(e){const t=e.indexOf("?");return t>0?e.slice(t+1).split("&"):[]}(e),n=i.filter((e=>{const t=e.split("=");return"language"===t[0]||"worldview"===t[0]}));return n.length?`${e.slice(0,t)}?${n.join("&")}`:e.slice(0,t)}let oe=1/0;const ae={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};"function"==typeof Object.freeze&&Object.freeze(ae);class se extends Error{constructor(e,t,i){401===t&&ve(i)&&(e+=": you may have provided an invalid Mapbox access token. See https://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes"),super(e),this.status=t,this.url=i}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}const le=q()?()=>self.worker&&self.worker.referrer:()=>("blob:"===i.location.protocol?i.parent:i).location.href,ce=function(e,t){if(!(/^file:/.test(n=e.url)||/^file:/.test(le())&&!/^\w+:/.test(n))){if(i.fetch&&i.Request&&i.AbortController&&i.Request.prototype.hasOwnProperty("signal"))return function(e,t){const n=new i.AbortController,r=new i.Request(e.url,{method:e.method||"GET",body:e.body,credentials:e.credentials,headers:e.headers,referrer:le(),signal:n.signal});let o=!1,a=!1;const s=(l=r.url).indexOf("sku=")>0&&ve(l);var l;"json"===e.type&&r.headers.set("Accept","application/json");const c=(n,o,l)=>{if(a)return;if(n&&"SecurityError"!==n.message&&U(n),o&&l)return u(o);const c=Date.now();i.fetch(r).then((i=>{if(i.ok){const e=s?i.clone():null;return u(i,e,c)}return t(new se(i.statusText,i.status,e.url))})).catch((e=>{20!==e.code&&t(new Error(e.message))}))},u=(n,s,l)=>{("arrayBuffer"===e.type?n.arrayBuffer():"json"===e.type?n.json():n.text()).then((e=>{a||(s&&l&&function(e,t,n){if(ne(),!J)return;const r={status:t.status,statusText:t.statusText,headers:new i.Headers};t.headers.forEach(((e,t)=>r.headers.set(t,e)));const o=W(t.headers.get("Cache-Control")||"");if(o["no-store"])return;o["max-age"]&&r.headers.set("Expires",new Date(n+1e3*o["max-age"]).toUTCString());const a=r.headers.get("Expires");a&&(new Date(a).getTime()-n<42e4||function(e,t){if(void 0===Q)try{new Response(new ReadableStream),Q=!0}catch(e){Q=!1}Q?t(e.body):e.blob().then(t)}(t,(t=>{const n=new i.Response(t,r);ne(),J&&J.then((t=>t.put(re(e.url),n))).catch((e=>U(e.message)))})))}(r,s,l),o=!0,t(null,e,n.headers.get("Cache-Control"),n.headers.get("Expires")))})).catch((e=>{a||t(new Error(e.message))}))};return s?function(e,t){if(ne(),!J)return t(null);const i=re(e.url);J.then((e=>{e.match(i).then((n=>{const r=function(e){if(!e)return!1;const t=new Date(e.headers.get("Expires")||0),i=W(e.headers.get("Cache-Control")||"");return t>Date.now()&&!i["no-cache"]}(n);e.delete(i),r&&e.put(i,n.clone()),t(null,n,r)})).catch(t)})).catch(t)}(r,c):c(null,null),{cancel:()=>{a=!0,o||n.abort()}}}(e,t);if(q()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",e,t,void 0,!0)}var n;return function(e,t){const n=new i.XMLHttpRequest;n.open(e.method||"GET",e.url,!0),"arrayBuffer"===e.type&&(n.responseType="arraybuffer");for(const t in e.headers)n.setRequestHeader(t,e.headers[t]);return"json"===e.type&&(n.responseType="text",n.setRequestHeader("Accept","application/json")),n.withCredentials="include"===e.credentials,n.onerror=()=>{t(new Error(n.statusText))},n.onload=()=>{if((n.status>=200&&n.status<300||0===n.status)&&null!==n.response){let i=n.response;if("json"===e.type)try{i=JSON.parse(n.response)}catch(e){return t(e)}t(null,i,n.getResponseHeader("Cache-Control"),n.getResponseHeader("Expires"))}else t(new se(n.statusText,n.status,e.url))},n.send(e.body),{cancel:()=>n.abort()}}(e,t)},ue=function(e,t){return ce(I(e,{type:"arrayBuffer"}),t)};function he(e){const t=i.document.createElement("a");return t.href=e,t.protocol===i.document.location.protocol&&t.host===i.document.location.host}const de="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let pe,fe;pe=[],fe=0;const me=function(e,t){if(a.supported&&(e.headers||(e.headers={}),e.headers.accept="image/webp,*/*"),fe>=o.MAX_PARALLEL_IMAGE_REQUESTS){const i={requestParameters:e,callback:t,cancelled:!1,cancel(){this.cancelled=!0}};return pe.push(i),i}fe++;let n=!1;const r=()=>{if(!n)for(n=!0,fe--;pe.length&&fe{r(),e?t(e):n&&(i.createImageBitmap?function(e,t){const n=new i.Blob([new Uint8Array(e)],{type:"image/png"});i.createImageBitmap(n).then((e=>{t(null,e)})).catch((e=>{t(new Error(`Could not load image because of ${e.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))}))}(n,((e,i)=>t(e,i,o,a))):function(e,t){const n=new i.Image,r=i.URL;n.onload=()=>{t(null,n),r.revokeObjectURL(n.src),n.onload=null,i.requestAnimationFrame((()=>{n.src=de}))},n.onerror=()=>t(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."));const o=new i.Blob([new Uint8Array(e)],{type:"image/png"});n.src=e.byteLength?r.createObjectURL(o):de}(n,((e,i)=>t(e,i,o,a))))}));return{cancel:()=>{s.cancel(),r()}}},ge="NO_ACCESS_TOKEN";function _e(e){return 0===e.indexOf("mapbox:")}function ve(e){return o.API_URL_REGEX.test(e)}function ye(e){return o.API_STYLE_REGEX.test(e)&&!xe(e)}function xe(e){return o.API_SPRITE_REGEX.test(e)}const be=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function we(e){const t=e.match(be);if(!t)throw new Error("Unable to parse URL object");return{protocol:t[1],authority:t[2],path:t[3]||"/",params:t[4]?t[4].split("&"):[]}}function Te(e){const t=e.params.length?`?${e.params.join("&")}`:"";return`${e.protocol}://${e.authority}${e.path}${t}`}function Ce(e){if(!e)return null;const t=e.split(".");if(!t||3!==t.length)return null;try{return JSON.parse(decodeURIComponent(i.atob(t[1]).split("").map((e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2))).join("")))}catch(e){return null}}class Se{constructor(e){this.type=e,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(e){const t=Ce(o.ACCESS_TOKEN);let n="";return n=t&&t.u?i.btoa(encodeURIComponent(t.u).replace(/%([0-9A-F]{2})/g,((e,t)=>String.fromCharCode(Number("0x"+t))))):o.ACCESS_TOKEN||"",e?`mapbox.eventData.${e}:${n}`:`mapbox.eventData:${n}`}fetchEventData(){const e=X("localStorage"),t=this.getStorageKey(),n=this.getStorageKey("uuid");if(e)try{const e=i.localStorage.getItem(t);e&&(this.eventData=JSON.parse(e));const r=i.localStorage.getItem(n);r&&(this.anonId=r)}catch(e){U("Unable to read from LocalStorage")}}saveEventData(){const e=X("localStorage"),t=this.getStorageKey(),n=this.getStorageKey("uuid");if(e)try{i.localStorage.setItem(n,this.anonId),Object.keys(this.eventData).length>=1&&i.localStorage.setItem(t,JSON.stringify(this.eventData))}catch(e){U("Unable to write to LocalStorage")}}processRequests(e){}postEvent(e,t,i,n){if(!o.EVENTS_URL)return;const r=we(o.EVENTS_URL);r.params.push(`access_token=${n||o.ACCESS_TOKEN||""}`);const a={event:this.type,created:new Date(e).toISOString()},s=t?I(a,t):a,l={url:Te(r),headers:{"Content-Type":"text/plain"},body:JSON.stringify([s])};this.pendingRequest=function(e,t){return ce(I(e,{method:"POST"}),t)}(l,(e=>{this.pendingRequest=null,i(e),this.saveEventData(),this.processRequests(n)}))}queueRequest(e,t){this.queue.push(e),this.processRequests(t)}}const Ee=new class extends Se{constructor(e){super("appUserTurnstile"),this._customAccessToken=e}postTurnstileEvent(e,t){o.EVENTS_URL&&o.ACCESS_TOKEN&&Array.isArray(e)&&e.some((e=>_e(e)||ve(e)))&&this.queueRequest(Date.now(),t)}processRequests(e){if(this.pendingRequest||0===this.queue.length)return;this.anonId&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();const t=Ce(o.ACCESS_TOKEN),i=t?t.u:o.ACCESS_TOKEN;let r=i!==this.eventData.tokenU;L(this.anonId)||(this.anonId=z(),r=!0);const a=this.queue.shift();if(this.eventData.lastSuccess){const e=new Date(this.eventData.lastSuccess),t=new Date(a),i=(a-this.eventData.lastSuccess)/864e5;r=r||i>=1||i<-1||e.getDate()!==t.getDate()}else r=!0;r?this.postEvent(a,{sdkIdentifier:"mapbox-gl-js",sdkVersion:n,skuId:d,"enabled.telemetry":!1,userId:this.anonId},(e=>{e||(this.eventData.lastSuccess=a,this.eventData.tokenU=i)}),e):this.processRequests()}},ke=Ee.postTurnstileEvent.bind(Ee),Ae=new class extends Se{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(e,t,i,n){this.skuToken=t,this.errorCb=n,o.EVENTS_URL&&(i||o.ACCESS_TOKEN?this.queueRequest({id:e,timestamp:Date.now()},i):this.errorCb(new Error(ge)))}processRequests(e){if(this.pendingRequest||0===this.queue.length)return;const{id:t,timestamp:i}=this.queue.shift();t&&this.success[t]||(this.anonId||this.fetchEventData(),L(this.anonId)||(this.anonId=z()),this.postEvent(i,{sdkIdentifier:"mapbox-gl-js",sdkVersion:n,skuId:d,skuToken:this.skuToken,userId:this.anonId},(e=>{e?this.errorCb(e):t&&(this.success[t]=!0)}),e))}},Me=Ae.postMapLoadEvent.bind(Ae),Ie=new class extends Se{constructor(){super("gljs.performance")}postPerformanceEvent(e,t){o.EVENTS_URL&&(e||o.ACCESS_TOKEN)&&this.queueRequest({timestamp:Date.now(),performanceData:t},e)}processRequests(e){if(this.pendingRequest||0===this.queue.length)return;const{timestamp:t,performanceData:r}=this.queue.shift(),o=function(e){const t=i.performance.getEntriesByType("resource"),r=i.performance.getEntriesByType("mark"),o=function(e){const t={};if(e)for(const i in e)if("other"!==i)for(const n of e[i]){const e=`${i}RequestCount`,r=`${i}ResolveRangeMin`,o=`${i}ResolveRangeMax`;t[r]=Math.min(t[r]||1/0,n.startTime),t[o]=Math.max(t[o]||-1/0,n.responseEnd),void 0===t[e]&&(t[e]=0),++t[e]}return t}(function(e,t){const i={};if(e)for(const n of e){const e=t(n);void 0===i[e]&&(i[e]=[]),i[e].push(n)}return i}(t,Be)),a=i.devicePixelRatio,s=i.navigator.connection||i.navigator.mozConnection||i.navigator.webkitConnection,l={counters:[],metadata:[],attributes:[]},c=(e,t,i)=>{null!=i&&e.push({name:t,value:i.toString()})};for(const e in o)c(l.counters,e,o[e]);if(e.interactionRange[0]!==1/0&&e.interactionRange[1]!==-1/0&&(c(l.counters,"interactionRangeMin",e.interactionRange[0]),c(l.counters,"interactionRangeMax",e.interactionRange[1])),r)for(const e of Object.keys(Le)){const t=Le[e],i=r.find((e=>e.name===t));i&&c(l.counters,t,i.startTime)}return c(l.attributes,"style",function(e){if(e)for(const t of e){const e=t.name.split("?")[0];if(ye(e)){const t=e.split("/").slice(-2);if(2===t.length)return`mapbox://styles/${t[0]}/${t[1]}`}}}(t)),c(l.attributes,"terrainEnabled",e.terrainEnabled?"true":"false"),c(l.attributes,"fogEnabled",e.fogEnabled?"true":"false"),c(l.attributes,"projection",e.projection.name),c(l.attributes,"zoom",e.zoom),c(l.metadata,"devicePixelRatio",a),c(l.metadata,"connectionEffectiveType",s?s.effectiveType:void 0),c(l.metadata,"navigatorUserAgent",i.navigator.userAgent),c(l.metadata,"screenWidth",i.screen.width),c(l.metadata,"screenHeight",i.screen.height),c(l.metadata,"windowWidth",i.innerWidth),c(l.metadata,"windowHeight",i.innerHeight),c(l.metadata,"mapWidth",e.width/a),c(l.metadata,"mapHeight",e.height/a),c(l.metadata,"webglRenderer",e.renderer),c(l.metadata,"webglVendor",e.vendor),c(l.metadata,"sdkVersion",n),c(l.metadata,"sdkIdentifier","mapbox-gl-js"),l}(r);for(const e of o.metadata);for(const e of o.counters);for(const e of o.attributes);this.postEvent(t,o,(()=>{}),e)}},Pe=Ie.postPerformanceEvent.bind(Ie),De=new class extends Se{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(e,t,i,n){if(!o.API_URL||!o.SESSION_PATH)return;const r=we(o.API_URL+o.SESSION_PATH);r.params.push(`sku=${t||""}`),r.params.push(`access_token=${n||o.ACCESS_TOKEN||""}`);const a={url:Te(r),headers:{"Content-Type":"text/plain"}};this.pendingRequest=function(e,t){return ce(I(e,{method:"GET"}),t)}(a,(e=>{this.pendingRequest=null,i(e),this.saveEventData(),this.processRequests(n)}))}getSessionAPI(e,t,i,n){this.skuToken=t,this.errorCb=n,o.SESSION_PATH&&o.API_URL&&(i||o.ACCESS_TOKEN?this.queueRequest({id:e,timestamp:Date.now()},i):this.errorCb(new Error(ge)))}processRequests(e){if(this.pendingRequest||0===this.queue.length)return;const{id:t,timestamp:i}=this.queue.shift();t&&this.success[t]||this.getSession(i,this.skuToken,(e=>{e?this.errorCb(e):t&&(this.success[t]=!0)}),e)}},ze=De.getSessionAPI.bind(De),Oe=new Set,Le={create:"create",load:"load",fullLoad:"fullLoad"},Re={mark(e){i.performance.mark(e)},measure(e,t,n){i.performance.measure(e,t,n)}};function Be(e){const t=e.name.split("?")[0];return t.includes("mapbox-gl.js")?"javascript":t.includes("mapbox-gl.css")?"css":function(e){return o.API_FONTS_REGEX.test(e)}(t)?"fontRange":xe(t)?"sprite":ye(t)?"style":function(e){return o.API_TILEJSON_REGEX.test(e)}(t)?"tilejson":"other"}const Fe=i.performance;function $e(e){const t=e?e.url.toString():void 0;return Fe.getEntriesByName(t)}let je,Ne,Ue,Ve;const Ge={now:()=>void 0!==Ue?Ue:i.performance.now(),setNow(e){Ue=e},restoreNow(){Ue=void 0},frame(e){const t=i.requestAnimationFrame(e);return{cancel:()=>i.cancelAnimationFrame(t)}},getImageData(e,t=0){const{width:n,height:r}=e;Ve||(Ve=i.document.createElement("canvas"));const o=Ve.getContext("2d");if(!o)throw new Error("failed to create canvas 2d context");return(n>Ve.width||r>Ve.height)&&(Ve.width=n,Ve.height=r),o.clearRect(-t,-t,n+2*t,r+2*t),o.drawImage(e,0,0,n,r),o.getImageData(-t,-t,n+2*t,r+2*t)},resolveURL:e=>(je||(je=i.document.createElement("a")),je.href=e,je.href),get devicePixelRatio(){return i.devicePixelRatio},get prefersReducedMotion(){return!!i.matchMedia&&(null==Ne&&(Ne=i.matchMedia("(prefers-reduced-motion: reduce)")),Ne.matches)}};function qe(e,t,i){i[e]&&-1!==i[e].indexOf(t)||(i[e]=i[e]||[],i[e].push(t))}function We(e,t,i){if(i&&i[e]){const n=i[e].indexOf(t);-1!==n&&i[e].splice(n,1)}}class Ze{constructor(e,t={}){I(this,t),this.type=e}}class He extends Ze{constructor(e,t={}){super("error",I({error:e},t))}}class Xe{on(e,t){return this._listeners=this._listeners||{},qe(e,t,this._listeners),this}off(e,t){return We(e,t,this._listeners),We(e,t,this._oneTimeListeners),this}once(e,t){return t?(this._oneTimeListeners=this._oneTimeListeners||{},qe(e,t,this._oneTimeListeners),this):new Promise((t=>this.once(e,t)))}fire(e,t){"string"==typeof e&&(e=new Ze(e,t||{}));const i=e.type;if(this.listens(i)){e.target=this;const t=this._listeners&&this._listeners[i]?this._listeners[i].slice():[];for(const i of t)i.call(this,e);const n=this._oneTimeListeners&&this._oneTimeListeners[i]?this._oneTimeListeners[i].slice():[];for(const t of n)We(i,t,this._oneTimeListeners),t.call(this,e);const r=this._eventedParent;r&&(I(e,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),r.fire(e))}return this}listens(e){return!!(this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e))}setEventedParent(e,t){return this._eventedParent=e,this._eventedParentData=t,this}}var Ye=JSON.parse('{"$version":8,"$root":{"version":{"required":true,"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"},"terrain":{"type":"terrain"},"fog":{"type":"fog"},"sources":{"required":true,"type":"sources"},"sprite":{"type":"string"},"glyphs":{"type":"string"},"transition":{"type":"transition"},"projection":{"type":"projection"},"layers":{"required":true,"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":true,"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":false},"*":{"type":"*"}},"source_raster":{"type":{"required":true,"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":false},"*":{"type":"*"}},"source_raster_dem":{"type":{"required":true,"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":false},"*":{"type":"*"}},"source_geojson":{"type":{"required":true,"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":0.375},"cluster":{"type":"boolean","default":false},"clusterRadius":{"type":"number","default":50,"minimum":0},"clusterMaxZoom":{"type":"number"},"clusterMinPoints":{"type":"number"},"clusterProperties":{"type":"*"},"lineMetrics":{"type":"boolean","default":false},"generateId":{"type":"boolean","default":false},"promoteId":{"type":"promoteId"}},"source_video":{"type":{"required":true,"type":"enum","values":{"video":{}}},"urls":{"required":true,"type":"array","value":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_image":{"type":{"required":true,"type":"enum","values":{"image":{}}},"url":{"required":true,"type":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"layer":{"id":{"type":"string","required":true},"type":{"type":"enum","values":{"fill":{},"line":{},"symbol":{},"circle":{},"heatmap":{},"fill-extrusion":{},"raster":{},"hillshade":{},"background":{},"sky":{}},"required":true},"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_sky"],"layout_background":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_sky":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_fill":{"fill-sort-key":{"type":"number","expression":{"interpolated":false,"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":false,"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"},"fill-extrusion-edge-radius":{"type":"number","private":true,"default":0,"minimum":0,"maximum":1,"property-type":"constant"}},"layout_line":{"line-cap":{"type":"enum","values":{"butt":{},"round":{},"square":{}},"default":"butt","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-join":{"type":"enum","values":{"bevel":{},"round":{},"miter":{}},"default":"miter","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{"type":"number","default":2,"requires":[{"line-join":"miter"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-round-limit":{"type":"number","default":1.05,"requires":[{"line-join":"round"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-sort-key":{"type":"number","expression":{"interpolated":false,"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":false,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-spacing":{"type":"number","default":250,"minimum":1,"units":"pixels","requires":[{"symbol-placement":"line"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{"type":"boolean","default":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{"type":"number","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{"type":"enum","values":{"auto":{},"viewport-y":{},"source":{}},"default":"auto","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{"type":"boolean","default":false,"requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{"type":"boolean","default":false,"requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-optional":{"type":"boolean","default":false,"requires":["icon-image","text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["icon-image"],"expression":{"interpolated":false,"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":true,"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":false,"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":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-image":{"type":"resolvedImage","tokens":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{"type":"number","default":0,"period":360,"units":"degrees","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{"type":"number","default":2,"minimum":0,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-keep-upright":{"type":"boolean","default":false,"requires":["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-offset":{"type":"array","value":"number","length":2,"default":[0,0],"requires":["icon-image"],"expression":{"interpolated":true,"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":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-field":{"type":"formatted","default":"","tokens":true,"expression":{"interpolated":false,"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":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size":{"type":"number","default":16,"minimum":0,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{"type":"number","default":10,"minimum":0,"units":"ems","requires":["text-field",{"symbol-placement":["point"]}],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{"type":"number","default":1.2,"units":"ems","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-letter-spacing":{"type":"number","default":0,"units":"ems","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-justify":{"type":"enum","values":{"auto":{},"left":{},"center":{},"right":{}},"default":"center","requires":["text-field"],"expression":{"interpolated":false,"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":true,"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":false,"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":false,"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":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-writing-mode":{"type":"array","value":"enum","values":{"horizontal":{},"vertical":{}},"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-rotate":{"type":"number","default":0,"period":360,"units":"degrees","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-padding":{"type":"number","default":2,"minimum":0,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-keep-upright":{"type":"boolean","default":true,"requires":["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-transform":{"type":"enum","values":{"none":{},"uppercase":{},"lowercase":{}},"default":"none","requires":["text-field"],"expression":{"interpolated":false,"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":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{"type":"boolean","default":false,"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{"type":"boolean","default":false,"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-optional":{"type":"boolean","default":false,"requires":["text-field","icon-image"],"expression":{"interpolated":false,"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_symbol":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature","pitch","distance-from-center"]}},"filter_fill":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_line":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_circle":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_fill-extrusion":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_heatmap":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"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":false}},"function_stop":{"type":"array","minimum":0,"maximum":24,"value":["number","color"],"length":2},"expression":{"type":"array","value":"*","minimum":1},"fog":{"range":{"type":"array","default":[0.5,10],"minimum":-20,"maximum":20,"length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"high-color":{"type":"color","property-type":"data-constant","default":"#245cdf","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"space-color":{"type":"color","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"horizon-blend":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],4,0.2,7,0.1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"star-intensity":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],5,0.35,6,0],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"light":{"anchor":{"type":"enum","default":"viewport","values":{"map":{},"viewport":{}},"property-type":"data-constant","transition":false,"expression":{"interpolated":false,"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"projection":{"name":{"type":"enum","values":{"albers":{},"equalEarth":{},"equirectangular":{},"lambertConformalConic":{},"mercator":{},"naturalEarth":{},"winkelTripel":{},"globe":{}},"default":"mercator","required":true},"center":{"type":"array","length":2,"value":"number","property-type":"data-constant","minimum":[-180,-90],"maximum":[180,90],"transition":false,"requires":[{"name":["albers","lambertConformalConic"]}]},"parallels":{"type":"array","length":2,"value":"number","property-type":"data-constant","minimum":[-90,-90],"maximum":[90,90],"transition":false,"requires":[{"name":["albers","lambertConformalConic"]}]}},"terrain":{"source":{"type":"string","required":true},"exaggeration":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1000,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true,"requires":["source"]}},"paint":["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background","paint_sky"],"paint_fill":{"fill-antialias":{"type":"boolean","default":true,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"fill-pattern"}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{"type":"color","transition":true,"requires":[{"!":"fill-pattern"},{"fill-antialias":true}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["fill-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-pattern":{"type":"resolvedImage","transition":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"fill-extrusion-pattern"}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["fill-extrusion-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{"type":"resolvedImage","transition":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{"type":"number","default":0,"minimum":0,"units":"meters","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{"type":"number","default":0,"minimum":0,"units":"meters","transition":true,"requires":["fill-extrusion-height"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{"type":"boolean","default":true,"transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-ambient-occlusion-intensity":{"property-type":"data-constant","type":"number","private":true,"default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-radius":{"property-type":"data-constant","type":"number","private":true,"default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true,"requires":["fill-extrusion-edge-radius"]}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"line-pattern"}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["line-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"line-width":{"type":"number","default":1,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{"type":"array","value":"number","minimum":0,"transition":true,"units":"line widths","requires":[{"!":"line-pattern"}],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-pattern":{"type":"resolvedImage","transition":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{"type":"color","transition":false,"requires":[{"!":"line-pattern"},{"source":"geojson","has":{"lineMetrics":true}}],"expression":{"interpolated":true,"parameters":["line-progress"]},"property-type":"color-ramp"},"line-trim-offset":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1],"transition":false,"requires":[{"source":"geojson","has":{"lineMetrics":true}}],"property-type":"constant"}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["circle-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{"type":"enum","values":{"map":{},"viewport":{}},"default":"viewport","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"transition":false,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"heatmap-color":{"type":"color","default":["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",0.1,"royalblue",0.3,"cyan",0.5,"lime",0.7,"yellow",1,"red"],"transition":false,"expression":{"interpolated":true,"parameters":["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{"type":"color","default":"#000000","transition":true,"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["icon-image","icon-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{"type":"color","default":"#000000","transition":true,"overridable":true,"requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["text-field","text-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{"type":"number","default":0,"period":360,"transition":true,"units":"degrees","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-resampling":{"type":"enum","values":{"linear":{},"nearest":{}},"default":"linear","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"transition":false,"units":"milliseconds","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"transition":false,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"viewport","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{"type":"number","default":0.5,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_background":{"background-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"background-pattern"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"background-pattern":{"type":"resolvedImage","transition":true,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"cross-faded"},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_sky":{"sky-type":{"type":"enum","values":{"gradient":{},"atmosphere":{}},"default":"atmosphere","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun":{"type":"array","value":"number","length":2,"units":"degrees","minimum":[0,0],"maximum":[360,180],"transition":false,"requires":[{"sky-type":"atmosphere"}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun-intensity":{"type":"number","requires":[{"sky-type":"atmosphere"}],"default":10,"minimum":0,"maximum":100,"transition":false,"property-type":"data-constant"},"sky-gradient-center":{"type":"array","requires":[{"sky-type":"gradient"}],"value":"number","default":[0,0],"length":2,"units":"degrees","minimum":[0,0],"maximum":[360,180],"transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient-radius":{"type":"number","requires":[{"sky-type":"gradient"}],"default":90,"minimum":0,"maximum":180,"transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient":{"type":"color","default":["interpolate",["linear"],["sky-radial-progress"],0.8,"#87ceeb",1,"white"],"transition":false,"requires":[{"sky-type":"gradient"}],"expression":{"interpolated":true,"parameters":["sky-radial-progress"]},"property-type":"color-ramp"},"sky-atmosphere-halo-color":{"type":"color","default":"white","transition":false,"requires":[{"sky-type":"atmosphere"}],"property-type":"data-constant"},"sky-atmosphere-color":{"type":"color","default":"white","transition":false,"requires":[{"sky-type":"atmosphere"}],"property-type":"data-constant"},"sky-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"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"}}}');function Ke(e,...t){for(const i of t)for(const t in i)e[t]=i[t];return e}function Je(e){return e instanceof Number||e instanceof String||e instanceof Boolean?e.valueOf():e}function Qe(e){if(Array.isArray(e))return e.map(Qe);if(e instanceof Object&&!(e instanceof Number||e instanceof String||e instanceof Boolean)){const t={};for(const i in e)t[i]=Qe(e[i]);return t}return Je(e)}class et extends Error{constructor(e,t){super(t),this.message=t,this.key=e}}var tt=et;class it{constructor(e,t=[]){this.parent=e,this.bindings={};for(const[e,i]of t)this.bindings[e]=i}concat(e){return new it(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}var nt=it;const rt={kind:"null"},ot={kind:"number"},at={kind:"string"},st={kind:"boolean"},lt={kind:"color"},ct={kind:"object"},ut={kind:"value"},ht={kind:"collator"},dt={kind:"formatted"},pt={kind:"resolvedImage"};function ft(e,t){return{kind:"array",itemType:e,N:t}}function mt(e){if("array"===e.kind){const t=mt(e.itemType);return"number"==typeof e.N?`array<${t}, ${e.N}>`:"value"===e.itemType.kind?"array":`array<${t}>`}return e.kind}const gt=[rt,ot,at,st,lt,dt,ct,ft(ut),pt];function _t(e,t){if("error"===t.kind)return null;if("array"===e.kind){if("array"===t.kind&&(0===t.N&&"value"===t.itemType.kind||!_t(e.itemType,t.itemType))&&("number"!=typeof e.N||e.N===t.N))return null}else{if(e.kind===t.kind)return null;if("value"===e.kind)for(const e of gt)if(!_t(e,t))return null}return`Expected ${mt(e)} but found ${mt(t)} instead.`}function vt(e,t){return t.some((t=>t.kind===e.kind))}function yt(e,t){return t.some((t=>"null"===t?null===e:"array"===t?Array.isArray(e):"object"===t?e&&!Array.isArray(e)&&"object"==typeof e:t===typeof e))}var xt,bt={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 wt(e){return(e=Math.round(e))<0?0:e>255?255:e}function Tt(e){return wt("%"===e[e.length-1]?parseFloat(e)/100*255:parseInt(e))}function Ct(e){return(t="%"===e[e.length-1]?parseFloat(e)/100:parseFloat(e))<0?0:t>1?1:t;var t}function St(e,t,i){return i<0?i+=1:i>1&&(i-=1),6*i<1?e+(t-e)*i*6:2*i<1?t:3*i<2?e+(t-e)*(2/3-i)*6:e}try{xt={}.parseCSSColor=function(e){var t,i=e.replace(/ /g,"").toLowerCase();if(i in bt)return bt[i].slice();if("#"===i[0])return 4===i.length?(t=parseInt(i.substr(1),16))>=0&&t<=4095?[(3840&t)>>4|(3840&t)>>8,240&t|(240&t)>>4,15&t|(15&t)<<4,1]:null:7===i.length&&(t=parseInt(i.substr(1),16))>=0&&t<=16777215?[(16711680&t)>>16,(65280&t)>>8,255&t,1]:null;var n=i.indexOf("("),r=i.indexOf(")");if(-1!==n&&r+1===i.length){var o=i.substr(0,n),a=i.substr(n+1,r-(n+1)).split(","),s=1;switch(o){case"rgba":if(4!==a.length)return null;s=Ct(a.pop());case"rgb":return 3!==a.length?null:[Tt(a[0]),Tt(a[1]),Tt(a[2]),s];case"hsla":if(4!==a.length)return null;s=Ct(a.pop());case"hsl":if(3!==a.length)return null;var l=(parseFloat(a[0])%360+360)%360/360,c=Ct(a[1]),u=Ct(a[2]),h=u<=.5?u*(c+1):u+c-u*c,d=2*u-h;return[wt(255*St(d,h,l+1/3)),wt(255*St(d,h,l)),wt(255*St(d,h,l-1/3)),s];default:return null}}return null}}catch(t){}class Et{constructor(e,t,i,n=1){this.r=e,this.g=t,this.b=i,this.a=n}static parse(e){if(!e)return;if(e instanceof Et)return e;if("string"!=typeof e)return;const t=xt(e);return t?new Et(t[0]/255*t[3],t[1]/255*t[3],t[2]/255*t[3],t[3]):void 0}toString(){const[e,t,i,n]=this.toArray();return`rgba(${Math.round(e)},${Math.round(t)},${Math.round(i)},${n})`}toArray(){const{r:e,g:t,b:i,a:n}=this;return 0===n?[0,0,0,0]:[255*e/n,255*t/n,255*i/n,n]}toArray01(){const{r:e,g:t,b:i,a:n}=this;return 0===n?[0,0,0,0]:[e/n,t/n,i/n,n]}toArray01PremultipliedAlpha(){const{r:e,g:t,b:i,a:n}=this;return[e,t,i,n]}}Et.black=new Et(0,0,0,1),Et.white=new Et(1,1,1,1),Et.transparent=new Et(0,0,0,0),Et.red=new Et(1,0,0,1),Et.blue=new Et(0,0,1,1);var kt=Et;class At{constructor(e,t,i){this.sensitivity=e?t?"variant":"case":t?"accent":"base",this.locale=i,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,t){return this.collator.compare(e,t)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Mt{constructor(e,t,i,n,r){this.text=e.normalize?e.normalize():e,this.image=t,this.scale=i,this.fontStack=n,this.textColor=r}}class It{constructor(e){this.sections=e}static fromString(e){return new It([new Mt(e,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some((e=>0!==e.text.length||e.image&&0!==e.image.name.length))}static factory(e){return e instanceof It?e:It.fromString(e)}toString(){return 0===this.sections.length?"":this.sections.map((e=>e.text)).join("")}serialize(){const e=["format"];for(const t of this.sections){if(t.image){e.push(["image",t.image.name]);continue}e.push(t.text);const i={};t.fontStack&&(i["text-font"]=["literal",t.fontStack.split(",")]),t.scale&&(i["font-scale"]=t.scale),t.textColor&&(i["text-color"]=["rgba"].concat(t.textColor.toArray())),e.push(i)}return e}}class Pt{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new Pt({name:e,available:!1}):null}serialize(){return["image",this.name]}}function Dt(e,t,i,n){return"number"==typeof e&&e>=0&&e<=255&&"number"==typeof t&&t>=0&&t<=255&&"number"==typeof i&&i>=0&&i<=255?void 0===n||"number"==typeof n&&n>=0&&n<=1?null:`Invalid rgba value [${[e,t,i,n].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof n?[e,t,i,n]:[e,t,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function zt(e){if(null===e)return!0;if("string"==typeof e)return!0;if("boolean"==typeof e)return!0;if("number"==typeof e)return!0;if(e instanceof kt)return!0;if(e instanceof At)return!0;if(e instanceof It)return!0;if(e instanceof Pt)return!0;if(Array.isArray(e)){for(const t of e)if(!zt(t))return!1;return!0}if("object"==typeof e){for(const t in e)if(!zt(e[t]))return!1;return!0}return!1}function Ot(e){if(null===e)return rt;if("string"==typeof e)return at;if("boolean"==typeof e)return st;if("number"==typeof e)return ot;if(e instanceof kt)return lt;if(e instanceof At)return ht;if(e instanceof It)return dt;if(e instanceof Pt)return pt;if(Array.isArray(e)){const t=e.length;let i;for(const t of e){const e=Ot(t);if(i){if(i===e)continue;i=ut;break}i=e}return ft(i||ut,t)}return ct}function Lt(e){const t=typeof e;return null===e?"":"string"===t||"number"===t||"boolean"===t?String(e):e instanceof kt||e instanceof It||e instanceof Pt?e.toString():JSON.stringify(e)}class Rt{constructor(e,t){this.type=e,this.value=t}static parse(e,t){if(2!==e.length)return t.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!zt(e[1]))return t.error("invalid value");const i=e[1];let n=Ot(i);const r=t.expectedType;return"array"!==n.kind||0!==n.N||!r||"array"!==r.kind||"number"==typeof r.N&&0!==r.N||(n=r),new Rt(n,i)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return"array"===this.type.kind||"object"===this.type.kind?["literal",this.value]:this.value instanceof kt?["rgba"].concat(this.value.toArray()):this.value instanceof It?this.value.serialize():this.value}}var Bt=Rt,Ft=class{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}};const $t={string:at,number:ot,boolean:st,object:ct};class jt{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let i,n=1;const r=e[0];if("array"===r){let r,o;if(e.length>2){const i=e[1];if("string"!=typeof i||!(i in $t)||"object"===i)return t.error('The item type argument of "array" must be one of string, number, boolean',1);r=$t[i],n++}else r=ut;if(e.length>3){if(null!==e[2]&&("number"!=typeof e[2]||e[2]<0||e[2]!==Math.floor(e[2])))return t.error('The length argument to "array" must be a positive integer literal',2);o=e[2],n++}i=ft(r,o)}else i=$t[r];const o=[];for(;ne.outputDefined()))}serialize(){const e=this.type,t=[e.kind];if("array"===e.kind){const i=e.itemType;if("string"===i.kind||"number"===i.kind||"boolean"===i.kind){t.push(i.kind);const n=e.N;("number"==typeof n||this.args.length>1)&&t.push(n)}}return t.concat(this.args.map((e=>e.serialize())))}}var Nt=jt;class Ut{constructor(e){this.type=dt,this.sections=e}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const i=e[1];if(!Array.isArray(i)&&"object"==typeof i)return t.error("First argument must be an image or text section.");const n=[];let r=!1;for(let i=1;i<=e.length-1;++i){const o=e[i];if(r&&"object"==typeof o&&!Array.isArray(o)){r=!1;let e=null;if(o["font-scale"]&&(e=t.parse(o["font-scale"],1,ot),!e))return null;let i=null;if(o["text-font"]&&(i=t.parse(o["text-font"],1,ft(at)),!i))return null;let a=null;if(o["text-color"]&&(a=t.parse(o["text-color"],1,lt),!a))return null;const s=n[n.length-1];s.scale=e,s.font=i,s.textColor=a}else{const o=t.parse(e[i],1,ut);if(!o)return null;const a=o.type.kind;if("string"!==a&&"value"!==a&&"null"!==a&&"resolvedImage"!==a)return t.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");r=!0,n.push({content:o,scale:null,font:null,textColor:null})}}return new Ut(n)}evaluate(e){return new It(this.sections.map((t=>{const i=t.content.evaluate(e);return Ot(i)===pt?new Mt("",i,null,null,null):new Mt(Lt(i),null,t.scale?t.scale.evaluate(e):null,t.font?t.font.evaluate(e).join(","):null,t.textColor?t.textColor.evaluate(e):null)})))}eachChild(e){for(const t of this.sections)e(t.content),t.scale&&e(t.scale),t.font&&e(t.font),t.textColor&&e(t.textColor)}outputDefined(){return!1}serialize(){const e=["format"];for(const t of this.sections){e.push(t.content.serialize());const i={};t.scale&&(i["font-scale"]=t.scale.serialize()),t.font&&(i["text-font"]=t.font.serialize()),t.textColor&&(i["text-color"]=t.textColor.serialize()),e.push(i)}return e}}class Vt{constructor(e){this.type=pt,this.input=e}static parse(e,t){if(2!==e.length)return t.error("Expected two arguments.");const i=t.parse(e[1],1,at);return i?new Vt(i):t.error("No image name provided.")}evaluate(e){const t=this.input.evaluate(e),i=Pt.fromString(t);return i&&e.availableImages&&(i.available=e.availableImages.indexOf(t)>-1),i}eachChild(e){e(this.input)}outputDefined(){return!1}serialize(){return["image",this.input.serialize()]}}const Gt={"to-boolean":st,"to-color":lt,"to-number":ot,"to-string":at};class qt{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const i=e[0];if(("to-boolean"===i||"to-string"===i)&&2!==e.length)return t.error("Expected one argument.");const n=Gt[i],r=[];for(let i=1;i4?`Invalid rbga value ${JSON.stringify(t)}: expected an array containing either three or four numeric values.`:Dt(t[0],t[1],t[2],t[3]),!i))return new kt(t[0]/255,t[1]/255,t[2]/255,t[3])}throw new Ft(i||`Could not parse color from value '${"string"==typeof t?t:String(JSON.stringify(t))}'`)}if("number"===this.type.kind){let t=null;for(const i of this.args){if(t=i.evaluate(e),null===t)return 0;const n=Number(t);if(!isNaN(n))return n}throw new Ft(`Could not convert ${JSON.stringify(t)} to number.`)}return"formatted"===this.type.kind?It.fromString(Lt(this.args[0].evaluate(e))):"resolvedImage"===this.type.kind?Pt.fromString(Lt(this.args[0].evaluate(e))):Lt(this.args[0].evaluate(e))}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}serialize(){if("formatted"===this.type.kind)return new Ut([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if("resolvedImage"===this.type.kind)return new Vt(this.args[0]).serialize();const e=[`to-${this.type.kind}`];return this.eachChild((t=>{e.push(t.serialize())})),e}}var Wt=qt;const Zt=["Unknown","Point","LineString","Polygon"];var Ht=class{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null}id(){return this.feature&&void 0!==this.feature.id?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?Zt[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){const e=this.featureDistanceData.center,t=this.featureDistanceData.scale,{x:i,y:n}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(i*t-e[0])+this.featureDistanceData.bearing[1]*(n*t-e[1])}return 0}parseColor(e){let t=this._parseColorCache[e];return t||(t=this._parseColorCache[e]=kt.parse(e)),t}};class Xt{constructor(e,t,i,n){this.name=e,this.type=t,this._evaluate=i,this.args=n}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map((e=>e.serialize())))}static parse(e,t){const i=e[0],n=Xt.definitions[i];if(!n)return t.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0);const r=Array.isArray(n)?n[0]:n.type,o=Array.isArray(n)?[[n[1],n[2]]]:n.overloads,a=o.filter((([t])=>!Array.isArray(t)||t.length===e.length-1));let s=null;for(const[n,o]of a){s=new wi(t.registry,t.path,null,t.scope);const a=[];let l=!1;for(let t=1;t{return t=e,Array.isArray(t)?`(${t.map(mt).join(", ")})`:`(${mt(t.type)}...)`;var t})).join(" | "),n=[];for(let i=1;i=t[2]||e[1]<=t[1]||e[3]>=t[3])}function ti(e,t){const i=(180+e[0])/360,n=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e[1]*Math.PI/360)))/360,r=Math.pow(2,t.z);return[Math.round(i*r*Jt),Math.round(n*r*Jt)]}function ii(e,t,i){const n=e[0]-t[0],r=e[1]-t[1],o=e[0]-i[0],a=e[1]-i[1];return n*a-o*r==0&&n*o<=0&&r*a<=0}function ni(e,t){let i=!1;for(let a=0,s=t.length;a(n=e)[1]!=(o=s[t+1])[1]>n[1]&&n[0]<(o[0]-r[0])*(n[1]-r[1])/(o[1]-r[1])+r[0]&&(i=!i)}}var n,r,o;return i}function ri(e,t){for(let i=0;i0&&s<0||a<0&&s>0}function ai(e,t,i){for(const c of i)for(let i=0;ii[2]){const t=.5*n;let r=e[0]-i[0]>t?-n:i[0]-e[0]>t?n:0;0===r&&(r=e[0]-i[2]>t?-n:i[2]-e[0]>t?n:0),e[0]+=r}Qt(t,e)}function di(e,t,i,n){const r=Math.pow(2,n.z)*Jt,o=[n.x*Jt,n.y*Jt],a=[];if(!e)return a;for(const n of e)for(const e of n){const n=[e.x+o[0],e.y+o[1]];hi(n,t,i,r),a.push(n)}return a}function pi(e,t,i,n){const r=Math.pow(2,n.z)*Jt,o=[n.x*Jt,n.y*Jt],a=[];if(!e)return a;for(const i of e){const e=[];for(const n of i){const i=[n.x+o[0],n.y+o[1]];Qt(t,i),e.push(i)}a.push(e)}if(t[2]-t[0]<=r/2){(s=t)[0]=s[1]=1/0,s[2]=s[3]=-1/0;for(const e of a)for(const n of e)hi(n,t,i,r)}var s;return a}class fi{constructor(e,t){this.type=st,this.geojson=e,this.geometries=t}static parse(e,t){if(2!==e.length)return t.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(zt(e[1])){const t=e[1];if("FeatureCollection"===t.type)for(let e=0;e{t&&!gi(e)&&(t=!1)})),t}function _i(e){if(e instanceof Yt&&"feature-state"===e.name)return!1;let t=!0;return e.eachChild((e=>{t&&!_i(e)&&(t=!1)})),t}function vi(e,t){if(e instanceof Yt&&t.indexOf(e.name)>=0)return!1;let i=!0;return e.eachChild((e=>{i&&!vi(e,t)&&(i=!1)})),i}class yi{constructor(e,t){this.type=t.type,this.name=e,this.boundExpression=t}static parse(e,t){if(2!==e.length||"string"!=typeof e[1])return t.error("'var' expression requires exactly one string literal argument.");const i=e[1];return t.scope.has(i)?new yi(i,t.scope.get(i)):t.error(`Unknown variable "${i}". Make sure "${i}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}var xi=yi;class bi{constructor(e,t=[],i,n=new nt,r=[]){this.registry=e,this.path=t,this.key=t.map((e=>`[${e}]`)).join(""),this.scope=n,this.errors=r,this.expectedType=i}parse(e,t,i,n,r={}){return t?this.concat(t,i,n)._parse(e,r):this._parse(e,r)}_parse(e,t){function i(e,t,i){return"assert"===i?new Nt(t,[e]):"coerce"===i?new Wt(t,[e]):e}if(null!==e&&"string"!=typeof e&&"boolean"!=typeof e&&"number"!=typeof e||(e=["literal",e]),Array.isArray(e)){if(0===e.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const n=e[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;const r=this.registry[n];if(r){let n=r.parse(e,this);if(!n)return null;if(this.expectedType){const e=this.expectedType,r=n.type;if("string"!==e.kind&&"number"!==e.kind&&"boolean"!==e.kind&&"object"!==e.kind&&"array"!==e.kind||"value"!==r.kind)if("color"!==e.kind&&"formatted"!==e.kind&&"resolvedImage"!==e.kind||"value"!==r.kind&&"string"!==r.kind){if(this.checkSubtype(e,r))return null}else n=i(n,e,t.typeAnnotation||"coerce");else n=i(n,e,t.typeAnnotation||"assert")}if(!(n instanceof Bt)&&"resolvedImage"!==n.type.kind&&Ti(n)){const t=new Ht;try{n=new Bt(n.type,n.evaluate(t))}catch(e){return this.error(e.message),null}}return n}return this.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(void 0===e?"'undefined' value invalid. Use null instead.":"object"==typeof e?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,t,i){const n="number"==typeof e?this.path.concat(e):this.path,r=i?this.scope.concat(i):this.scope;return new bi(this.registry,n,t||null,r,this.errors)}error(e,...t){const i=`${this.key}${t.map((e=>`[${e}]`)).join("")}`;this.errors.push(new tt(i,e))}checkSubtype(e,t){const i=_t(e,t);return i&&this.error(i),i}}var wi=bi;function Ti(e){if(e instanceof xi)return Ti(e.boundExpression);if(e instanceof Yt&&"error"===e.name)return!1;if(e instanceof Kt)return!1;if(e instanceof mi)return!1;const t=e instanceof Wt||e instanceof Nt;let i=!0;return e.eachChild((e=>{i=t?i&&Ti(e):i&&e instanceof Bt})),!!i&&gi(e)&&vi(e,["zoom","heatmap-density","line-progress","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center"])}function Ci(e,t){const i=e.length-1;let n,r,o=0,a=i,s=0;for(;o<=a;)if(s=Math.floor((o+a)/2),n=e[s],r=e[s+1],n<=t){if(s===i||tt))throw new Ft("Input is not a number.");a=s-1}return 0}class Si{constructor(e,t,i){this.type=e,this.input=t,this.labels=[],this.outputs=[];for(const[e,t]of i)this.labels.push(e),this.outputs.push(t)}static parse(e,t){if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return t.error("Expected an even number of arguments.");const i=t.parse(e[1],1,ot);if(!i)return null;const n=[];let r=null;t.expectedType&&"value"!==t.expectedType.kind&&(r=t.expectedType);for(let i=1;i=o)return t.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',s);const c=t.parse(a,l,r);if(!c)return null;r=r||c.type,n.push([o,c])}return new Si(r,i,n)}evaluate(e){const t=this.labels,i=this.outputs;if(1===t.length)return i[0].evaluate(e);const n=this.input.evaluate(e);if(n<=t[0])return i[0].evaluate(e);const r=t.length;return n>=t[r-1]?i[r-1].evaluate(e):i[Ci(t,n)].evaluate(e)}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}serialize(){const e=["step",this.input.serialize()];for(let t=0;t0&&e.push(this.labels[t]),e.push(this.outputs[t].serialize());return e}}var Ei=Si;function ki(e,t,i){return e*(1-i)+t*i}var Ai=Object.freeze({__proto__:null,number:ki,color:function(e,t,i){return new kt(ki(e.r,t.r,i),ki(e.g,t.g,i),ki(e.b,t.b,i),ki(e.a,t.a,i))},array:function(e,t,i){return e.map(((e,n)=>ki(e,t[n],i)))}});const Mi=.95047,Ii=1.08883,Pi=4/29,Di=6/29,zi=3*Di*Di,Oi=Math.PI/180,Li=180/Math.PI;function Ri(e){return e>.008856451679035631?Math.pow(e,1/3):e/zi+Pi}function Bi(e){return e>Di?e*e*e:zi*(e-Pi)}function Fi(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function $i(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function ji(e){const t=$i(e.r),i=$i(e.g),n=$i(e.b),r=Ri((.4124564*t+.3575761*i+.1804375*n)/Mi),o=Ri((.2126729*t+.7151522*i+.072175*n)/1);return{l:116*o-16,a:500*(r-o),b:200*(o-Ri((.0193339*t+.119192*i+.9503041*n)/Ii)),alpha:e.a}}function Ni(e){let t=(e.l+16)/116,i=isNaN(e.a)?t:t+e.a/500,n=isNaN(e.b)?t:t-e.b/200;return t=1*Bi(t),i=Mi*Bi(i),n=Ii*Bi(n),new kt(Fi(3.2404542*i-1.5371385*t-.4985314*n),Fi(-.969266*i+1.8760108*t+.041556*n),Fi(.0556434*i-.2040259*t+1.0572252*n),e.alpha)}function Ui(e,t,i){const n=t-e;return e+i*(n>180||n<-180?n-360*Math.round(n/360):n)}const Vi={forward:ji,reverse:Ni,interpolate:function(e,t,i){return{l:ki(e.l,t.l,i),a:ki(e.a,t.a,i),b:ki(e.b,t.b,i),alpha:ki(e.alpha,t.alpha,i)}}},Gi={forward:function(e){const{l:t,a:i,b:n}=ji(e),r=Math.atan2(n,i)*Li;return{h:r<0?r+360:r,c:Math.sqrt(i*i+n*n),l:t,alpha:e.a}},reverse:function(e){const t=e.h*Oi,i=e.c;return Ni({l:e.l,a:Math.cos(t)*i,b:Math.sin(t)*i,alpha:e.alpha})},interpolate:function(e,t,i){return{h:Ui(e.h,t.h,i),c:ki(e.c,t.c,i),l:ki(e.l,t.l,i),alpha:ki(e.alpha,t.alpha,i)}}};var qi=Object.freeze({__proto__:null,lab:Vi,hcl:Gi});class Wi{constructor(e,t,i,n,r){this.type=e,this.operator=t,this.interpolation=i,this.input=n,this.labels=[],this.outputs=[];for(const[e,t]of r)this.labels.push(e),this.outputs.push(t)}static interpolationFactor(e,t,i,n){let r=0;if("exponential"===e.name)r=Zi(t,e.base,i,n);else if("linear"===e.name)r=Zi(t,1,i,n);else if("cubic-bezier"===e.name){const o=e.controlPoints;r=new p(o[0],o[1],o[2],o[3]).solve(Zi(t,1,i,n))}return r}static parse(e,t){let[i,n,r,...o]=e;if(!Array.isArray(n)||0===n.length)return t.error("Expected an interpolation type expression.",1);if("linear"===n[0])n={name:"linear"};else if("exponential"===n[0]){const e=n[1];if("number"!=typeof e)return t.error("Exponential interpolation requires a numeric base.",1,1);n={name:"exponential",base:e}}else{if("cubic-bezier"!==n[0])return t.error(`Unknown interpolation type ${String(n[0])}`,1,0);{const e=n.slice(1);if(4!==e.length||e.some((e=>"number"!=typeof e||e<0||e>1)))return t.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);n={name:"cubic-bezier",controlPoints:e}}}if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return t.error("Expected an even number of arguments.");if(r=t.parse(r,2,ot),!r)return null;const a=[];let s=null;"interpolate-hcl"===i||"interpolate-lab"===i?s=lt:t.expectedType&&"value"!==t.expectedType.kind&&(s=t.expectedType);for(let e=0;e=i)return t.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',r);const c=t.parse(n,l,s);if(!c)return null;s=s||c.type,a.push([i,c])}return"number"===s.kind||"color"===s.kind||"array"===s.kind&&"number"===s.itemType.kind&&"number"==typeof s.N?new Wi(s,i,n,r,a):t.error(`Type ${mt(s)} is not interpolatable.`)}evaluate(e){const t=this.labels,i=this.outputs;if(1===t.length)return i[0].evaluate(e);const n=this.input.evaluate(e);if(n<=t[0])return i[0].evaluate(e);const r=t.length;if(n>=t[r-1])return i[r-1].evaluate(e);const o=Ci(t,n),a=Wi.interpolationFactor(this.interpolation,n,t[o],t[o+1]),s=i[o].evaluate(e),l=i[o+1].evaluate(e);return"interpolate"===this.operator?Ai[this.type.kind.toLowerCase()](s,l,a):"interpolate-hcl"===this.operator?Gi.reverse(Gi.interpolate(Gi.forward(s),Gi.forward(l),a)):Vi.reverse(Vi.interpolate(Vi.forward(s),Vi.forward(l),a))}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}serialize(){let e;e="linear"===this.interpolation.name?["linear"]:"exponential"===this.interpolation.name?1===this.interpolation.base?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier"].concat(this.interpolation.controlPoints);const t=[this.operator,e,this.input.serialize()];for(let e=0;e_t(n,e.type)));return new Xi(o?ut:i,r)}evaluate(e){let t,i=null,n=0;for(const r of this.args){if(n++,i=r.evaluate(e),i&&i instanceof Pt&&!i.available&&(t||(t=i),i=null,n===this.args.length))return t;if(null!==i)break}return i}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}serialize(){const e=["coalesce"];return this.eachChild((t=>{e.push(t.serialize())})),e}}var Yi=Xi;class Ki{constructor(e,t){this.type=t.type,this.bindings=[].concat(e),this.result=t}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const t of this.bindings)e(t[1]);e(this.result)}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const i=[];for(let n=1;n=i.length)throw new Ft(`Array index out of bounds: ${t} > ${i.length-1}.`);if(t!==Math.floor(t))throw new Ft(`Array index must be an integer, but found ${t} instead.`);return i[t]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}var en=Qi;class tn{constructor(e,t){this.type=st,this.needle=e,this.haystack=t}static parse(e,t){if(3!==e.length)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const i=t.parse(e[1],1,ut),n=t.parse(e[2],2,ut);return i&&n?vt(i.type,[st,at,ot,rt,ut])?new tn(i,n):t.error(`Expected first argument to be of type boolean, string, number or null, but found ${mt(i.type)} instead`):null}evaluate(e){const t=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(null==i)return!1;if(!yt(t,["boolean","string","number","null"]))throw new Ft(`Expected first argument to be of type boolean, string, number or null, but found ${mt(Ot(t))} instead.`);if(!yt(i,["string","array"]))throw new Ft(`Expected second argument to be of type array or string, but found ${mt(Ot(i))} instead.`);return i.indexOf(t)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}var nn=tn;class rn{constructor(e,t,i){this.type=ot,this.needle=e,this.haystack=t,this.fromIndex=i}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const i=t.parse(e[1],1,ut),n=t.parse(e[2],2,ut);if(!i||!n)return null;if(!vt(i.type,[st,at,ot,rt,ut]))return t.error(`Expected first argument to be of type boolean, string, number or null, but found ${mt(i.type)} instead`);if(4===e.length){const r=t.parse(e[3],3,ot);return r?new rn(i,n,r):null}return new rn(i,n)}evaluate(e){const t=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(!yt(t,["boolean","string","number","null"]))throw new Ft(`Expected first argument to be of type boolean, string, number or null, but found ${mt(Ot(t))} instead.`);if(!yt(i,["string","array"]))throw new Ft(`Expected second argument to be of type array or string, but found ${mt(Ot(i))} instead.`);if(this.fromIndex){const n=this.fromIndex.evaluate(e);return i.indexOf(t,n)}return i.indexOf(t)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}serialize(){if(null!=this.fromIndex&&void 0!==this.fromIndex){const e=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),e]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}var on=rn;class an{constructor(e,t,i,n,r,o){this.inputType=e,this.type=t,this.input=i,this.cases=n,this.outputs=r,this.otherwise=o}static parse(e,t){if(e.length<5)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return t.error("Expected an even number of arguments.");let i,n;t.expectedType&&"value"!==t.expectedType.kind&&(n=t.expectedType);const r={},o=[];for(let a=2;aNumber.MAX_SAFE_INTEGER)return c.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof e&&Math.floor(e)!==e)return c.error("Numeric branch labels must be integer values.");if(i){if(c.checkSubtype(i,Ot(e)))return null}else i=Ot(e);if(void 0!==r[String(e)])return c.error("Branch labels must be unique.");r[String(e)]=o.length}const u=t.parse(l,a,n);if(!u)return null;n=n||u.type,o.push(u)}const a=t.parse(e[1],1,ut);if(!a)return null;const s=t.parse(e[e.length-1],e.length-1,n);return s?"value"!==a.type.kind&&t.concat(1).checkSubtype(i,a.type)?null:new an(i,n,a,r,o,s):null}evaluate(e){const t=this.input.evaluate(e);return(Ot(t)===this.inputType&&this.outputs[this.cases[t]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))&&this.otherwise.outputDefined()}serialize(){const e=["match",this.input.serialize()],t=Object.keys(this.cases).sort(),i=[],n={};for(const e of t){const t=n[this.cases[e]];void 0===t?(n[this.cases[e]]=i.length,i.push([this.cases[e],[e]])):i[t][1].push(e)}const r=e=>"number"===this.inputType.kind?Number(e):e;for(const[t,n]of i)e.push(1===n.length?r(n[0]):n.map(r)),e.push(this.outputs[t].serialize());return e.push(this.otherwise.serialize()),e}}var sn=an;class ln{constructor(e,t,i){this.type=e,this.branches=t,this.otherwise=i}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return t.error("Expected an odd number of arguments.");let i;t.expectedType&&"value"!==t.expectedType.kind&&(i=t.expectedType);const n=[];for(let r=1;rt.outputDefined()))&&this.otherwise.outputDefined()}serialize(){const e=["case"];return this.eachChild((t=>{e.push(t.serialize())})),e}}var cn=ln;class un{constructor(e,t,i,n){this.type=e,this.input=t,this.beginIndex=i,this.endIndex=n}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const i=t.parse(e[1],1,ut),n=t.parse(e[2],2,ot);if(!i||!n)return null;if(!vt(i.type,[ft(ut),at,ut]))return t.error(`Expected first argument to be of type array or string, but found ${mt(i.type)} instead`);if(4===e.length){const r=t.parse(e[3],3,ot);return r?new un(i.type,i,n,r):null}return new un(i.type,i,n)}evaluate(e){const t=this.input.evaluate(e),i=this.beginIndex.evaluate(e);if(!yt(t,["string","array"]))throw new Ft(`Expected first argument to be of type array or string, but found ${mt(Ot(t))} instead.`);if(this.endIndex){const n=this.endIndex.evaluate(e);return t.slice(i,n)}return t.slice(i)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}serialize(){if(null!=this.endIndex&&void 0!==this.endIndex){const e=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),e]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}var hn=un;function dn(e,t){return"=="===e||"!="===e?"boolean"===t.kind||"string"===t.kind||"number"===t.kind||"null"===t.kind||"value"===t.kind:"string"===t.kind||"number"===t.kind||"value"===t.kind}function pn(e,t,i,n){return 0===n.compare(t,i)}function fn(e,t,i){const n="=="!==e&&"!="!==e;return class r{constructor(e,t,i){this.type=st,this.lhs=e,this.rhs=t,this.collator=i,this.hasUntypedArgument="value"===e.type.kind||"value"===t.type.kind}static parse(e,t){if(3!==e.length&&4!==e.length)return t.error("Expected two or three arguments.");const i=e[0];let o=t.parse(e[1],1,ut);if(!o)return null;if(!dn(i,o.type))return t.concat(1).error(`"${i}" comparisons are not supported for type '${mt(o.type)}'.`);let a=t.parse(e[2],2,ut);if(!a)return null;if(!dn(i,a.type))return t.concat(2).error(`"${i}" comparisons are not supported for type '${mt(a.type)}'.`);if(o.type.kind!==a.type.kind&&"value"!==o.type.kind&&"value"!==a.type.kind)return t.error(`Cannot compare types '${mt(o.type)}' and '${mt(a.type)}'.`);n&&("value"===o.type.kind&&"value"!==a.type.kind?o=new Nt(a.type,[o]):"value"!==o.type.kind&&"value"===a.type.kind&&(a=new Nt(o.type,[a])));let s=null;if(4===e.length){if("string"!==o.type.kind&&"string"!==a.type.kind&&"value"!==o.type.kind&&"value"!==a.type.kind)return t.error("Cannot use collator to compare non-string types.");if(s=t.parse(e[3],3,ht),!s)return null}return new r(o,a,s)}evaluate(r){const o=this.lhs.evaluate(r),a=this.rhs.evaluate(r);if(n&&this.hasUntypedArgument){const t=Ot(o),i=Ot(a);if(t.kind!==i.kind||"string"!==t.kind&&"number"!==t.kind)throw new Ft(`Expected arguments for "${e}" to be (string, string) or (number, number), but found (${t.kind}, ${i.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){const e=Ot(o),i=Ot(a);if("string"!==e.kind||"string"!==i.kind)return t(r,o,a)}return this.collator?i(r,o,a,this.collator.evaluate(r)):t(r,o,a)}eachChild(e){e(this.lhs),e(this.rhs),this.collator&&e(this.collator)}outputDefined(){return!0}serialize(){const t=[e];return this.eachChild((e=>{t.push(e.serialize())})),t}}}const mn=fn("==",(function(e,t,i){return t===i}),pn),gn=fn("!=",(function(e,t,i){return t!==i}),(function(e,t,i,n){return!pn(0,t,i,n)})),_n=fn("<",(function(e,t,i){return t",(function(e,t,i){return t>i}),(function(e,t,i,n){return n.compare(t,i)>0})),yn=fn("<=",(function(e,t,i){return t<=i}),(function(e,t,i,n){return n.compare(t,i)<=0})),xn=fn(">=",(function(e,t,i){return t>=i}),(function(e,t,i,n){return n.compare(t,i)>=0}));class bn{constructor(e,t,i,n,r,o){this.type=at,this.number=e,this.locale=t,this.currency=i,this.unit=n,this.minFractionDigits=r,this.maxFractionDigits=o}static parse(e,t){if(3!==e.length)return t.error("Expected two arguments.");const i=t.parse(e[1],1,ot);if(!i)return null;const n=e[2];if("object"!=typeof n||Array.isArray(n))return t.error("NumberFormat options argument must be an object.");let r=null;if(n.locale&&(r=t.parse(n.locale,1,at),!r))return null;let o=null;if(n.currency&&(o=t.parse(n.currency,1,at),!o))return null;let a=null;if(n.unit&&(a=t.parse(n.unit,1,at),!a))return null;let s=null;if(n["min-fraction-digits"]&&(s=t.parse(n["min-fraction-digits"],1,ot),!s))return null;let l=null;return n["max-fraction-digits"]&&(l=t.parse(n["max-fraction-digits"],1,ot),!l)?null:new bn(i,r,o,a,s,l)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:(this.currency?"currency":this.unit&&"unit")||"decimal",currency:this.currency?this.currency.evaluate(e):void 0,unit:this.unit?this.unit.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.unit&&e(this.unit),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}serialize(){const e={};return this.locale&&(e.locale=this.locale.serialize()),this.currency&&(e.currency=this.currency.serialize()),this.unit&&(e.unit=this.unit.serialize()),this.minFractionDigits&&(e["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(e["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),e]}}class wn{constructor(e){this.type=ot,this.input=e}static parse(e,t){if(2!==e.length)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`);const i=t.parse(e[1],1);return i?"array"!==i.type.kind&&"string"!==i.type.kind&&"value"!==i.type.kind?t.error(`Expected argument of type string or array, but found ${mt(i.type)} instead.`):new wn(i):null}evaluate(e){const t=this.input.evaluate(e);if("string"==typeof t)return t.length;if(Array.isArray(t))return t.length;throw new Ft(`Expected value to be of type string or array, but found ${mt(Ot(t))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}serialize(){const e=["length"];return this.eachChild((t=>{e.push(t.serialize())})),e}}const Tn={"==":mn,"!=":gn,">":vn,"<":_n,">=":xn,"<=":yn,array:Nt,at:en,boolean:Nt,case:cn,coalesce:Yi,collator:Kt,format:Ut,image:Vt,in:nn,"index-of":on,interpolate:Hi,"interpolate-hcl":Hi,"interpolate-lab":Hi,length:wn,let:Ji,literal:Bt,match:sn,number:Nt,"number-format":bn,object:Nt,slice:hn,step:Ei,string:Nt,"to-boolean":Wt,"to-color":Wt,"to-number":Wt,"to-string":Wt,var:xi,within:mi};function Cn(e,[t,i,n,r]){t=t.evaluate(e),i=i.evaluate(e),n=n.evaluate(e);const o=r?r.evaluate(e):1,a=Dt(t,i,n,o);if(a)throw new Ft(a);return new kt(t/255*o,i/255*o,n/255*o,o)}function Sn(e,t){return e in t}function En(e,t){const i=t[e];return void 0===i?null:i}function kn(e){return{type:e}}Yt.register(Tn,{error:[{kind:"error"},[at],(e,[t])=>{throw new Ft(t.evaluate(e))}],typeof:[at,[ut],(e,[t])=>mt(Ot(t.evaluate(e)))],"to-rgba":[ft(ot,4),[lt],(e,[t])=>t.evaluate(e).toArray()],rgb:[lt,[ot,ot,ot],Cn],rgba:[lt,[ot,ot,ot,ot],Cn],has:{type:st,overloads:[[[at],(e,[t])=>Sn(t.evaluate(e),e.properties())],[[at,ct],(e,[t,i])=>Sn(t.evaluate(e),i.evaluate(e))]]},get:{type:ut,overloads:[[[at],(e,[t])=>En(t.evaluate(e),e.properties())],[[at,ct],(e,[t,i])=>En(t.evaluate(e),i.evaluate(e))]]},"feature-state":[ut,[at],(e,[t])=>En(t.evaluate(e),e.featureState||{})],properties:[ct,[],e=>e.properties()],"geometry-type":[at,[],e=>e.geometryType()],id:[ut,[],e=>e.id()],zoom:[ot,[],e=>e.globals.zoom],pitch:[ot,[],e=>e.globals.pitch||0],"distance-from-center":[ot,[],e=>e.distanceFromCenter()],"heatmap-density":[ot,[],e=>e.globals.heatmapDensity||0],"line-progress":[ot,[],e=>e.globals.lineProgress||0],"sky-radial-progress":[ot,[],e=>e.globals.skyRadialProgress||0],accumulated:[ut,[],e=>void 0===e.globals.accumulated?null:e.globals.accumulated],"+":[ot,kn(ot),(e,t)=>{let i=0;for(const n of t)i+=n.evaluate(e);return i}],"*":[ot,kn(ot),(e,t)=>{let i=1;for(const n of t)i*=n.evaluate(e);return i}],"-":{type:ot,overloads:[[[ot,ot],(e,[t,i])=>t.evaluate(e)-i.evaluate(e)],[[ot],(e,[t])=>-t.evaluate(e)]]},"/":[ot,[ot,ot],(e,[t,i])=>t.evaluate(e)/i.evaluate(e)],"%":[ot,[ot,ot],(e,[t,i])=>t.evaluate(e)%i.evaluate(e)],ln2:[ot,[],()=>Math.LN2],pi:[ot,[],()=>Math.PI],e:[ot,[],()=>Math.E],"^":[ot,[ot,ot],(e,[t,i])=>Math.pow(t.evaluate(e),i.evaluate(e))],sqrt:[ot,[ot],(e,[t])=>Math.sqrt(t.evaluate(e))],log10:[ot,[ot],(e,[t])=>Math.log(t.evaluate(e))/Math.LN10],ln:[ot,[ot],(e,[t])=>Math.log(t.evaluate(e))],log2:[ot,[ot],(e,[t])=>Math.log(t.evaluate(e))/Math.LN2],sin:[ot,[ot],(e,[t])=>Math.sin(t.evaluate(e))],cos:[ot,[ot],(e,[t])=>Math.cos(t.evaluate(e))],tan:[ot,[ot],(e,[t])=>Math.tan(t.evaluate(e))],asin:[ot,[ot],(e,[t])=>Math.asin(t.evaluate(e))],acos:[ot,[ot],(e,[t])=>Math.acos(t.evaluate(e))],atan:[ot,[ot],(e,[t])=>Math.atan(t.evaluate(e))],min:[ot,kn(ot),(e,t)=>Math.min(...t.map((t=>t.evaluate(e))))],max:[ot,kn(ot),(e,t)=>Math.max(...t.map((t=>t.evaluate(e))))],abs:[ot,[ot],(e,[t])=>Math.abs(t.evaluate(e))],round:[ot,[ot],(e,[t])=>{const i=t.evaluate(e);return i<0?-Math.round(-i):Math.round(i)}],floor:[ot,[ot],(e,[t])=>Math.floor(t.evaluate(e))],ceil:[ot,[ot],(e,[t])=>Math.ceil(t.evaluate(e))],"filter-==":[st,[at,ut],(e,[t,i])=>e.properties()[t.value]===i.value],"filter-id-==":[st,[ut],(e,[t])=>e.id()===t.value],"filter-type-==":[st,[at],(e,[t])=>e.geometryType()===t.value],"filter-<":[st,[at,ut],(e,[t,i])=>{const n=e.properties()[t.value],r=i.value;return typeof n==typeof r&&n{const i=e.id(),n=t.value;return typeof i==typeof n&&i":[st,[at,ut],(e,[t,i])=>{const n=e.properties()[t.value],r=i.value;return typeof n==typeof r&&n>r}],"filter-id->":[st,[ut],(e,[t])=>{const i=e.id(),n=t.value;return typeof i==typeof n&&i>n}],"filter-<=":[st,[at,ut],(e,[t,i])=>{const n=e.properties()[t.value],r=i.value;return typeof n==typeof r&&n<=r}],"filter-id-<=":[st,[ut],(e,[t])=>{const i=e.id(),n=t.value;return typeof i==typeof n&&i<=n}],"filter->=":[st,[at,ut],(e,[t,i])=>{const n=e.properties()[t.value],r=i.value;return typeof n==typeof r&&n>=r}],"filter-id->=":[st,[ut],(e,[t])=>{const i=e.id(),n=t.value;return typeof i==typeof n&&i>=n}],"filter-has":[st,[ut],(e,[t])=>t.value in e.properties()],"filter-has-id":[st,[],e=>null!==e.id()&&void 0!==e.id()],"filter-type-in":[st,[ft(at)],(e,[t])=>t.value.indexOf(e.geometryType())>=0],"filter-id-in":[st,[ft(ut)],(e,[t])=>t.value.indexOf(e.id())>=0],"filter-in-small":[st,[at,ft(ut)],(e,[t,i])=>i.value.indexOf(e.properties()[t.value])>=0],"filter-in-large":[st,[at,ft(ut)],(e,[t,i])=>function(e,t,i,n){for(;i<=n;){const r=i+n>>1;if(t[r]===e)return!0;t[r]>e?n=r-1:i=r+1}return!1}(e.properties()[t.value],i.value,0,i.value.length-1)],all:{type:st,overloads:[[[st,st],(e,[t,i])=>t.evaluate(e)&&i.evaluate(e)],[kn(st),(e,t)=>{for(const i of t)if(!i.evaluate(e))return!1;return!0}]]},any:{type:st,overloads:[[[st,st],(e,[t,i])=>t.evaluate(e)||i.evaluate(e)],[kn(st),(e,t)=>{for(const i of t)if(i.evaluate(e))return!0;return!1}]]},"!":[st,[st],(e,[t])=>!t.evaluate(e)],"is-supported-script":[st,[at],(e,[t])=>{const i=e.globals&&e.globals.isSupportedScript;return!i||i(t.evaluate(e))}],upcase:[at,[at],(e,[t])=>t.evaluate(e).toUpperCase()],downcase:[at,[at],(e,[t])=>t.evaluate(e).toLowerCase()],concat:[at,kn(ut),(e,t)=>t.map((t=>Lt(t.evaluate(e)))).join("")],"resolved-locale":[at,[ht],(e,[t])=>t.evaluate(e).resolvedLocale()]});var An=Tn;function Mn(e){return{result:"success",value:e}}function In(e){return{result:"error",value:e}}function Pn(e){return"data-driven"===e["property-type"]||"cross-faded-data-driven"===e["property-type"]}function Dn(e){return!!e.expression&&e.expression.parameters.indexOf("zoom")>-1}function zn(e){return!!e.expression&&e.expression.interpolated}function On(e){return e instanceof Number?"number":e instanceof String?"string":e instanceof Boolean?"boolean":Array.isArray(e)?"array":null===e?"null":typeof e}function Ln(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function Rn(e){return e}function Bn(e,t){const i="color"===t.type,n=e.stops&&"object"==typeof e.stops[0][0],r=n||!(n||void 0!==e.property),o=e.type||(zn(t)?"exponential":"interval");if(i&&((e=Ke({},e)).stops&&(e.stops=e.stops.map((e=>[e[0],kt.parse(e[1])]))),e.default=kt.parse(e.default?e.default:t.default)),e.colorSpace&&"rgb"!==e.colorSpace&&!qi[e.colorSpace])throw new Error(`Unknown color space: ${e.colorSpace}`);let a,s,l;if("exponential"===o)a=Nn;else if("interval"===o)a=jn;else if("categorical"===o){a=$n,s=Object.create(null);for(const t of e.stops)s[t[0]]=t[1];l=typeof e.stops[0][0]}else{if("identity"!==o)throw new Error(`Unknown function type "${o}"`);a=Un}if(n){const i={},n=[];for(let t=0;te[0])),evaluate:({zoom:i},n)=>Nn({stops:r,base:e.base},t,i).evaluate(i,n)}}if(r){const i="exponential"===o?{name:"exponential",base:void 0!==e.base?e.base:1}:null;return{kind:"camera",interpolationType:i,interpolationFactor:Hi.interpolationFactor.bind(void 0,i),zoomStops:e.stops.map((e=>e[0])),evaluate:({zoom:i})=>a(e,t,i,s,l)}}return{kind:"source",evaluate(i,n){const r=n&&n.properties?n.properties[e.property]:void 0;return void 0===r?Fn(e.default,t.default):a(e,t,r,s,l)}}}function Fn(e,t,i){return void 0!==e?e:void 0!==t?t:void 0!==i?i:void 0}function $n(e,t,i,n,r){return Fn(typeof i===r?n[i]:void 0,e.default,t.default)}function jn(e,t,i){if("number"!==On(i))return Fn(e.default,t.default);const n=e.stops.length;if(1===n)return e.stops[0][1];if(i<=e.stops[0][0])return e.stops[0][1];if(i>=e.stops[n-1][0])return e.stops[n-1][1];const r=Ci(e.stops.map((e=>e[0])),i);return e.stops[r][1]}function Nn(e,t,i){const n=void 0!==e.base?e.base:1;if("number"!==On(i))return Fn(e.default,t.default);const r=e.stops.length;if(1===r)return e.stops[0][1];if(i<=e.stops[0][0])return e.stops[0][1];if(i>=e.stops[r-1][0])return e.stops[r-1][1];const o=Ci(e.stops.map((e=>e[0])),i),a=function(e,t,i,n){const r=n-i,o=e-i;return 0===r?0:1===t?o/r:(Math.pow(t,o)-1)/(Math.pow(t,r)-1)}(i,n,e.stops[o][0],e.stops[o+1][0]),s=e.stops[o][1],l=e.stops[o+1][1];let c=Ai[t.type]||Rn;if(e.colorSpace&&"rgb"!==e.colorSpace){const t=qi[e.colorSpace];c=(e,i)=>t.reverse(t.interpolate(t.forward(e),t.forward(i),a))}return"function"==typeof s.evaluate?{evaluate(...e){const t=s.evaluate.apply(void 0,e),i=l.evaluate.apply(void 0,e);if(void 0!==t&&void 0!==i)return c(t,i,a)}}:c(s,l,a)}function Un(e,t,i){return"color"===t.type?i=kt.parse(i):"formatted"===t.type?i=It.fromString(i.toString()):"resolvedImage"===t.type?i=Pt.fromString(i.toString()):On(i)===t.type||"enum"===t.type&&t.values[i]||(i=void 0),Fn(i,e.default,t.default)}class Vn{constructor(e,t){this.expression=e,this._warningHistory={},this._evaluator=new Ht,this._defaultValue=t?function(e){return"color"===e.type&&(Ln(e.default)||Array.isArray(e.default))?new kt(0,0,0,0):"color"===e.type?kt.parse(e.default)||null:void 0===e.default?null:e.default}(t):null,this._enumValues=t&&"enum"===t.type?t.values:null}evaluateWithoutErrorHandling(e,t,i,n,r,o,a,s){return this._evaluator.globals=e,this._evaluator.feature=t,this._evaluator.featureState=i,this._evaluator.canonical=n||null,this._evaluator.availableImages=r||null,this._evaluator.formattedSection=o,this._evaluator.featureTileCoord=a||null,this._evaluator.featureDistanceData=s||null,this.expression.evaluate(this._evaluator)}evaluate(e,t,i,n,r,o,a,s){this._evaluator.globals=e,this._evaluator.feature=t||null,this._evaluator.featureState=i||null,this._evaluator.canonical=n||null,this._evaluator.availableImages=r||null,this._evaluator.formattedSection=o||null,this._evaluator.featureTileCoord=a||null,this._evaluator.featureDistanceData=s||null;try{const e=this.expression.evaluate(this._evaluator);if(null==e||"number"==typeof e&&e!=e)return this._defaultValue;if(this._enumValues&&!(e in this._enumValues))throw new Ft(`Expected value to be one of ${Object.keys(this._enumValues).map((e=>JSON.stringify(e))).join(", ")}, but found ${JSON.stringify(e)} instead.`);return e}catch(e){return this._warningHistory[e.message]||(this._warningHistory[e.message]=!0),this._defaultValue}}}function Gn(e){return Array.isArray(e)&&e.length>0&&"string"==typeof e[0]&&e[0]in An}function qn(e,t){const i=new wi(An,[],t?function(e){const t={color:lt,string:at,number:ot,enum:at,boolean:st,formatted:dt,resolvedImage:pt};return"array"===e.type?ft(t[e.value]||ut,e.length):t[e.type]}(t):void 0),n=i.parse(e,void 0,void 0,void 0,t&&"string"===t.type?{typeAnnotation:"coerce"}:void 0);return n?Mn(new Vn(n,t)):In(i.errors)}class Wn{constructor(e,t){this.kind=e,this._styleExpression=t,this.isStateDependent="constant"!==e&&!_i(t.expression)}evaluateWithoutErrorHandling(e,t,i,n,r,o){return this._styleExpression.evaluateWithoutErrorHandling(e,t,i,n,r,o)}evaluate(e,t,i,n,r,o){return this._styleExpression.evaluate(e,t,i,n,r,o)}}class Zn{constructor(e,t,i,n){this.kind=e,this.zoomStops=i,this._styleExpression=t,this.isStateDependent="camera"!==e&&!_i(t.expression),this.interpolationType=n}evaluateWithoutErrorHandling(e,t,i,n,r,o){return this._styleExpression.evaluateWithoutErrorHandling(e,t,i,n,r,o)}evaluate(e,t,i,n,r,o){return this._styleExpression.evaluate(e,t,i,n,r,o)}interpolationFactor(e,t,i){return this.interpolationType?Hi.interpolationFactor(this.interpolationType,e,t,i):0}}function Hn(e,t){if("error"===(e=qn(e,t)).result)return e;const i=e.value.expression,n=gi(i);if(!n&&!Pn(t))return In([new tt("","data expressions not supported")]);const r=vi(i,["zoom","pitch","distance-from-center"]);if(!r&&!Dn(t))return In([new tt("","zoom expressions not supported")]);const o=Yn(i);return o||r?o instanceof tt?In([o]):o instanceof Hi&&!zn(t)?In([new tt("",'"interpolate" expressions cannot be used with this property')]):Mn(o?new Zn(n?"camera":"composite",e.value,o.labels,o instanceof Hi?o.interpolation:void 0):new Wn(n?"constant":"source",e.value)):In([new tt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Xn{constructor(e,t){this._parameters=e,this._specification=t,Ke(this,Bn(this._parameters,this._specification))}static deserialize(e){return new Xn(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function Yn(e){let t=null;if(e instanceof Ji)t=Yn(e.result);else if(e instanceof Yi){for(const i of e.args)if(t=Yn(i),t)break}else(e instanceof Ei||e instanceof Hi)&&e.input instanceof Yt&&"zoom"===e.input.name&&(t=e);return t instanceof tt||e.eachChild((e=>{const i=Yn(e);i instanceof tt?t=i:!t&&i?t=new tt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t&&i&&t!==i&&(t=new tt("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),t}class Kn{constructor(e,t,i,n){this.message=(e?`${e}: `:"")+i,n&&(this.identifier=n),null!=t&&t.__line__&&(this.line=t.__line__)}}function Jn(e){const t=e.key,i=e.value,n=e.valueSpec||{},r=e.objectElementValidators||{},o=e.style,a=e.styleSpec;let s=[];const l=On(i);if("object"!==l)return[new Kn(t,i,`object expected, ${l} found`)];for(const e in i){const l=e.split(".")[0],c=n[l]||n["*"];let u;r[l]?u=r[l]:n[l]?u=Pr:r["*"]?u=r["*"]:n["*"]&&(u=Pr),u?s=s.concat(u({key:(t?`${t}.`:t)+e,value:i[e],valueSpec:c,style:o,styleSpec:a,object:i,objectKey:e},i)):s.push(new Kn(t,i[e],`unknown property "${e}"`))}for(const e in n)r[e]||n[e].required&&void 0===n[e].default&&void 0===i[e]&&s.push(new Kn(t,i,`missing required property "${e}"`));return s}function Qn(e){const t=e.value,i=e.valueSpec,n=e.style,r=e.styleSpec,o=e.key,a=e.arrayElementValidator||Pr;if("array"!==On(t))return[new Kn(o,t,`array expected, ${On(t)} found`)];if(i.length&&t.length!==i.length)return[new Kn(o,t,`array length ${i.length} expected, length ${t.length} found`)];if(i["min-length"]&&t.lengthr)return[new Kn(t,i,`${i} is greater than the maximum value ${r}`)]}return[]}function tr(e){const t=e.valueSpec,i=Je(e.value.type);let n,r,o,a={};const s="categorical"!==i&&void 0===e.value.property,l=!s,c="array"===On(e.value.stops)&&"array"===On(e.value.stops[0])&&"object"===On(e.value.stops[0][0]),u=Jn({key:e.key,value:e.value,valueSpec:e.styleSpec.function,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{stops:function(e){if("identity"===i)return[new Kn(e.key,e.value,'identity function may not have a "stops" property')];let t=[];const n=e.value;return t=t.concat(Qn({key:e.key,value:n,valueSpec:e.valueSpec,style:e.style,styleSpec:e.styleSpec,arrayElementValidator:h})),"array"===On(n)&&0===n.length&&t.push(new Kn(e.key,n,"array must have at least one stop")),t},default:function(e){return Pr({key:e.key,value:e.value,valueSpec:t,style:e.style,styleSpec:e.styleSpec})}}});return"identity"===i&&s&&u.push(new Kn(e.key,e.value,'missing required property "property"')),"identity"===i||e.value.stops||u.push(new Kn(e.key,e.value,'missing required property "stops"')),"exponential"===i&&e.valueSpec.expression&&!zn(e.valueSpec)&&u.push(new Kn(e.key,e.value,"exponential functions not supported")),e.styleSpec.$version>=8&&(l&&!Pn(e.valueSpec)?u.push(new Kn(e.key,e.value,"property functions not supported")):s&&!Dn(e.valueSpec)&&u.push(new Kn(e.key,e.value,"zoom functions not supported"))),"categorical"!==i&&!c||void 0!==e.value.property||u.push(new Kn(e.key,e.value,'"property" property is required')),u;function h(e){let i=[];const n=e.value,s=e.key;if("array"!==On(n))return[new Kn(s,n,`array expected, ${On(n)} found`)];if(2!==n.length)return[new Kn(s,n,`array length 2 expected, length ${n.length} found`)];if(c){if("object"!==On(n[0]))return[new Kn(s,n,`object expected, ${On(n[0])} found`)];if(void 0===n[0].zoom)return[new Kn(s,n,"object stop key must have zoom")];if(void 0===n[0].value)return[new Kn(s,n,"object stop key must have value")];const t=Je(n[0].zoom);if("number"!=typeof t)return[new Kn(s,n[0].zoom,"stop zoom values must be numbers")];if(o&&o>t)return[new Kn(s,n[0].zoom,"stop zoom values must appear in ascending order")];t!==o&&(o=t,r=void 0,a={}),i=i.concat(Jn({key:`${s}[0]`,value:n[0],valueSpec:{zoom:{}},style:e.style,styleSpec:e.styleSpec,objectElementValidators:{zoom:er,value:d}}))}else i=i.concat(d({key:`${s}[0]`,value:n[0],valueSpec:{},style:e.style,styleSpec:e.styleSpec},n));return Gn(Qe(n[1]))?i.concat([new Kn(`${s}[1]`,n[1],"expressions are not allowed in function stops.")]):i.concat(Pr({key:`${s}[1]`,value:n[1],valueSpec:t,style:e.style,styleSpec:e.styleSpec}))}function d(e,o){const s=On(e.value),l=Je(e.value),c=null!==e.value?e.value:o;if(n){if(s!==n)return[new Kn(e.key,c,`${s} stop domain type must match previous stop domain type ${n}`)]}else n=s;if("number"!==s&&"string"!==s&&"boolean"!==s&&"number"!=typeof l&&"string"!=typeof l&&"boolean"!=typeof l)return[new Kn(e.key,c,"stop domain value must be a number, string, or boolean")];if("number"!==s&&"categorical"!==i){let n=`number expected, ${s} found`;return Pn(t)&&void 0===i&&(n+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Kn(e.key,c,n)]}return"categorical"!==i||"number"!==s||"number"==typeof l&&isFinite(l)&&Math.floor(l)===l?"categorical"!==i&&"number"===s&&"number"==typeof l&&"number"==typeof r&&void 0!==r&&lnew Kn(`${e.key}${t.key}`,e.value,t.message)));const i=t.value.expression||t.value._styleExpression.expression;if("property"===e.expressionContext&&"text-font"===e.propertyKey&&!i.outputDefined())return[new Kn(e.key,e.value,`Invalid data expression for "${e.propertyKey}". Output values must be contained as literals within the expression.`)];if("property"===e.expressionContext&&"layout"===e.propertyType&&!_i(i))return[new Kn(e.key,e.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===e.expressionContext)return nr(i,e);if(e.expressionContext&&0===e.expressionContext.indexOf("cluster")){if(!vi(i,["zoom","feature-state"]))return[new Kn(e.key,e.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===e.expressionContext&&!gi(i))return[new Kn(e.key,e.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function nr(e,t){const i=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(t.valueSpec&&t.valueSpec.expression)for(const e of t.valueSpec.expression.parameters)i.delete(e);if(0===i.size)return[];const n=[];return e instanceof Yt&&i.has(e.name)?[new Kn(t.key,t.value,`["${e.name}"] expression is not supported in a filter for a ${t.object.type} layer with id: ${t.object.id}`)]:(e.eachChild((e=>{n.push(...nr(e,t))})),n)}function rr(e){const t=e.key,i=e.value,n=e.valueSpec,r=[];return Array.isArray(n.values)?-1===n.values.indexOf(Je(i))&&r.push(new Kn(t,i,`expected one of [${n.values.join(", ")}], ${JSON.stringify(i)} found`)):-1===Object.keys(n.values).indexOf(Je(i))&&r.push(new Kn(t,i,`expected one of [${Object.keys(n.values).join(", ")}], ${JSON.stringify(i)} found`)),r}function or(e){if(!0===e||!1===e)return!0;if(!Array.isArray(e)||0===e.length)return!1;switch(e[0]){case"has":return e.length>=2&&"$id"!==e[1]&&"$type"!==e[1];case"in":return e.length>=3&&("string"!=typeof e[1]||Array.isArray(e[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==e.length||Array.isArray(e[1])||Array.isArray(e[2]);case"any":case"all":for(const t of e.slice(1))if(!or(t)&&"boolean"!=typeof t)return!1;return!0;default:return!0}}function ar(e,t="fill"){if(null==e)return{filter:()=>!0,needGeometry:!1,needFeature:!1};or(e)||(e=pr(e));const i=e;let n=!0;try{n=function(e){if(!cr(e))return e;let t=Qe(e);return lr(t),t=sr(t),t}(i)}catch(e){}const r=Ye[`filter_${t}`],o=qn(n,r);let a=null;if("error"===o.result)throw new Error(o.value.map((e=>`${e.key}: ${e.message}`)).join(", "));a=(e,t,i)=>o.value.evaluate(e,t,{},i);let s=null,l=null;if(n!==i){const e=qn(i,r);if("error"===e.result)throw new Error(e.value.map((e=>`${e.key}: ${e.message}`)).join(", "));s=(t,i,n,r,o)=>e.value.evaluate(t,i,{},n,void 0,void 0,r,o),l=!gi(e.value.expression)}return{filter:a,dynamicFilter:s||void 0,needGeometry:dr(n),needFeature:!!l}}function sr(e){if(!Array.isArray(e))return e;const t=function(e){if(ur.has(e[0]))for(let t=1;tsr(e)))}function lr(e){let t=!1;const i=[];if("case"===e[0]){for(let n=1;n",">=","<","<=","to-boolean"]);function hr(e,t){return et?1:0}function dr(e){if(!Array.isArray(e))return!1;if("within"===e[0])return!0;for(let t=1;t"===t||"<="===t||">="===t?fr(e[1],e[2],t):"any"===t?(i=e.slice(1),["any"].concat(i.map(pr))):"all"===t?["all"].concat(e.slice(1).map(pr)):"none"===t?["all"].concat(e.slice(1).map(pr).map(_r)):"in"===t?mr(e[1],e.slice(2)):"!in"===t?_r(mr(e[1],e.slice(2))):"has"===t?gr(e[1]):"!has"===t?_r(gr(e[1])):"within"!==t||e;var i}function fr(e,t,i){switch(e){case"$type":return[`filter-type-${i}`,t];case"$id":return[`filter-id-${i}`,t];default:return[`filter-${i}`,e,t]}}function mr(e,t){if(0===t.length)return!1;switch(e){case"$type":return["filter-type-in",["literal",t]];case"$id":return["filter-id-in",["literal",t]];default:return t.length>200&&!t.some((e=>typeof e!=typeof t[0]))?["filter-in-large",e,["literal",t.sort(hr)]]:["filter-in-small",e,["literal",t]]}}function gr(e){switch(e){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",e]}}function _r(e){return["!",e]}function vr(e){return or(Qe(e.value))?ir(Ke({},e,{expressionContext:"filter",valueSpec:e.styleSpec[`filter_${e.layerType||"fill"}`]})):yr(e)}function yr(e){const t=e.value,i=e.key;if("array"!==On(t))return[new Kn(i,t,`array expected, ${On(t)} found`)];const n=e.styleSpec;let r,o=[];if(t.length<1)return[new Kn(i,t,"filter array must have at least 1 element")];switch(o=o.concat(rr({key:`${i}[0]`,value:t[0],valueSpec:n.filter_operator,style:e.style,styleSpec:e.styleSpec})),Je(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&"$type"===Je(t[1])&&o.push(new Kn(i,t,`"$type" cannot be use with operator "${t[0]}"`));case"==":case"!=":3!==t.length&&o.push(new Kn(i,t,`filter array for operator "${t[0]}" must have 3 elements`));case"in":case"!in":t.length>=2&&(r=On(t[1]),"string"!==r&&o.push(new Kn(`${i}[1]`,t[1],`string expected, ${r} found`)));for(let a=2;a{e in i&&t.push(new Kn(n,i[e],`"${e}" is prohibited for ref layers`))})),r.layers.forEach((t=>{Je(t.id)===s&&(e=t)})),e?e.ref?t.push(new Kn(n,i.ref,"ref cannot reference another ref layer")):a=Je(e.type):"string"==typeof s&&t.push(new Kn(n,i.ref,`ref layer "${s}" not found`))}else if("background"!==a&&"sky"!==a)if(i.source){const e=r.sources&&r.sources[i.source],o=e&&Je(e.type);e?"vector"===o&&"raster"===a?t.push(new Kn(n,i.source,`layer "${i.id}" requires a raster source`)):"raster"===o&&"raster"!==a?t.push(new Kn(n,i.source,`layer "${i.id}" requires a vector source`)):"vector"!==o||i["source-layer"]?"raster-dem"===o&&"hillshade"!==a?t.push(new Kn(n,i.source,"raster-dem source can only be used with layer type 'hillshade'.")):"line"!==a||!i.paint||!i.paint["line-gradient"]&&!i.paint["line-trim-offset"]||"geojson"===o&&e.lineMetrics||t.push(new Kn(n,i,`layer "${i.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):t.push(new Kn(n,i,`layer "${i.id}" must specify a "source-layer"`)):t.push(new Kn(n,i.source,`source "${i.source}" not found`))}else t.push(new Kn(n,i,'missing required property "source"'));return t=t.concat(Jn({key:n,value:i,valueSpec:o.layer,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{"*":()=>[],type:()=>Pr({key:`${n}.type`,value:i.type,valueSpec:o.layer.type,style:e.style,styleSpec:e.styleSpec,object:i,objectKey:"type"}),filter:e=>vr(Ke({layerType:a},e)),layout:e=>Jn({layer:i,key:e.key,value:e.value,valueSpec:{},style:e.style,styleSpec:e.styleSpec,objectElementValidators:{"*":e=>wr(Ke({layerType:a},e))}}),paint:e=>Jn({layer:i,key:e.key,value:e.value,valueSpec:{},style:e.style,styleSpec:e.styleSpec,objectElementValidators:{"*":e=>br(Ke({layerType:a},e))}})}})),t}function Cr(e){const t=e.value,i=e.key,n=On(t);return"string"!==n?[new Kn(i,t,`string expected, ${n} found`)]:[]}const Sr={promoteId:function({key:e,value:t}){if("string"===On(t))return Cr({key:e,value:t});{const i=[];for(const n in t)i.push(...Cr({key:`${e}.${n}`,value:t[n]}));return i}}};function Er(e){const t=e.value,i=e.key,n=e.styleSpec,r=e.style;if(!t.type)return[new Kn(i,t,'"type" is required')];const o=Je(t.type);let a;switch(o){case"vector":case"raster":case"raster-dem":return a=Jn({key:i,value:t,valueSpec:n[`source_${o.replace("-","_")}`],style:e.style,styleSpec:n,objectElementValidators:Sr}),a;case"geojson":if(a=Jn({key:i,value:t,valueSpec:n.source_geojson,style:r,styleSpec:n,objectElementValidators:Sr}),t.cluster)for(const e in t.clusterProperties){const[n,r]=t.clusterProperties[e],o="string"==typeof n?[n,["accumulated"],["get",e]]:n;a.push(...ir({key:`${i}.${e}.map`,value:r,expressionContext:"cluster-map"})),a.push(...ir({key:`${i}.${e}.reduce`,value:o,expressionContext:"cluster-reduce"}))}return a;case"video":return Jn({key:i,value:t,valueSpec:n.source_video,style:r,styleSpec:n});case"image":return Jn({key:i,value:t,valueSpec:n.source_image,style:r,styleSpec:n});case"canvas":return[new Kn(i,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return rr({key:`${i}.type`,value:t.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:r,styleSpec:n})}}function kr(e){const t=e.value,i=e.styleSpec,n=i.light,r=e.style;let o=[];const a=On(t);if(void 0===t)return o;if("object"!==a)return o=o.concat([new Kn("light",t,`object expected, ${a} found`)]),o;for(const e in t){const a=e.match(/^(.*)-transition$/);o=o.concat(a&&n[a[1]]&&n[a[1]].transition?Pr({key:e,value:t[e],valueSpec:i.transition,style:r,styleSpec:i}):n[e]?Pr({key:e,value:t[e],valueSpec:n[e],style:r,styleSpec:i}):[new Kn(e,t[e],`unknown property "${e}"`)])}return o}function Ar(e){const t=e.value,i=e.key,n=e.style,r=e.styleSpec,o=r.terrain;let a=[];const s=On(t);if(void 0===t)return a;if("object"!==s)return a=a.concat([new Kn("terrain",t,`object expected, ${s} found`)]),a;for(const e in t){const i=e.match(/^(.*)-transition$/);a=a.concat(i&&o[i[1]]&&o[i[1]].transition?Pr({key:e,value:t[e],valueSpec:r.transition,style:n,styleSpec:r}):o[e]?Pr({key:e,value:t[e],valueSpec:o[e],style:n,styleSpec:r}):[new Kn(e,t[e],`unknown property "${e}"`)])}if(t.source){const e=n.sources&&n.sources[t.source],r=e&&Je(e.type);e?"raster-dem"!==r&&a.push(new Kn(i,t.source,`terrain cannot be used with a source of type ${String(r)}, it only be used with a "raster-dem" source type`)):a.push(new Kn(i,t.source,`source "${t.source}" not found`))}else a.push(new Kn(i,t,'terrain is missing required property "source"'));return a}function Mr(e){const t=e.value,i=e.style,n=e.styleSpec,r=n.fog;let o=[];const a=On(t);if(void 0===t)return o;if("object"!==a)return o=o.concat([new Kn("fog",t,`object expected, ${a} found`)]),o;for(const e in t){const a=e.match(/^(.*)-transition$/);o=o.concat(a&&r[a[1]]&&r[a[1]].transition?Pr({key:e,value:t[e],valueSpec:n.transition,style:i,styleSpec:n}):r[e]?Pr({key:e,value:t[e],valueSpec:r[e],style:i,styleSpec:n}):[new Kn(e,t[e],`unknown property "${e}"`)])}return o}const Ir={"*":()=>[],array:Qn,boolean:function(e){const t=e.value,i=e.key,n=On(t);return"boolean"!==n?[new Kn(i,t,`boolean expected, ${n} found`)]:[]},number:er,color:function(e){const t=e.key,i=e.value,n=On(i);return"string"!==n?[new Kn(t,i,`color expected, ${n} found`)]:null===xt(i)?[new Kn(t,i,`color expected, "${i}" found`)]:[]},enum:rr,filter:vr,function:tr,layer:Tr,object:Jn,source:Er,light:kr,terrain:Ar,fog:Mr,string:Cr,formatted:function(e){return 0===Cr(e).length?[]:ir(e)},resolvedImage:function(e){return 0===Cr(e).length?[]:ir(e)},projection:function(e){const t=e.value,i=e.styleSpec,n=i.projection,r=e.style;let o=[];const a=On(t);if("object"===a)for(const e in t)o=o.concat(Pr({key:e,value:t[e],valueSpec:n[e],style:r,styleSpec:i}));else"string"!==a&&(o=o.concat([new Kn("projection",t,`object or string expected, ${a} found`)]));return o}};function Pr(e){const t=e.value,i=e.valueSpec,n=e.styleSpec;return i.expression&&Ln(Je(t))?tr(e):i.expression&&Gn(Qe(t))?ir(e):i.type&&Ir[i.type]?Ir[i.type](e):Jn(Ke({},e,{valueSpec:i.type?n[i.type]:i}))}function Dr(e){const t=e.value,i=e.key,n=Cr(e);return n.length||(-1===t.indexOf("{fontstack}")&&n.push(new Kn(i,t,'"glyphs" url must include a "{fontstack}" token')),-1===t.indexOf("{range}")&&n.push(new Kn(i,t,'"glyphs" url must include a "{range}" token'))),n}function zr(e,t=Ye){return Rr(Pr({key:"",value:e,valueSpec:t.$root,styleSpec:t,style:e,objectElementValidators:{glyphs:Dr,"*":()=>[]}}))}const Or=e=>Rr(br(e)),Lr=e=>Rr(wr(e));function Rr(e){return e.slice().sort(((e,t)=>e.line&&t.line?e.line-t.line:0))}function Br(e,t){let i=!1;if(t&&t.length)for(const n of t)e.fire(new He(new Error(n.message))),i=!0;return i}var Fr=$r;function $r(e,t,i){var n=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;var r=new Int32Array(this.arrayBuffer);e=r[0],this.d=(t=r[1])+2*(i=r[2]);for(var o=0;o=u[p+0]&&n>=u[p+1])?(a[d]=!0,o.push(c[d])):a[d]=!1}}},$r.prototype._forEachCell=function(e,t,i,n,r,o,a,s){for(var l=this._convertToCellCoord(e),c=this._convertToCellCoord(t),u=this._convertToCellCoord(i),h=this._convertToCellCoord(n),d=l;d<=u;d++)for(var p=c;p<=h;p++){var f=this.d*p+d;if((!s||s(this._convertFromCellCoord(d),this._convertFromCellCoord(p),this._convertFromCellCoord(d+1),this._convertFromCellCoord(p+1)))&&r.call(this,e,t,i,n,f,o,a,s))return}},$r.prototype._convertFromCellCoord=function(e){return(e-this.padding)/this.scale},$r.prototype._convertToCellCoord=function(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))},$r.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var e=this.cells,t=3+this.cells.length+1+1,i=0,n=0;n=0||(r[i]=Gr(e[i],t)));e instanceof Error&&(r.message=e.message)}if(r.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==n&&(r.$name=n),r}throw new Error("can't serialize object of type "+typeof e)}function qr(e){if(null==e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||e instanceof Boolean||e instanceof Number||e instanceof String||e instanceof Date||e instanceof RegExp||Ur(e)||Vr(e)||ArrayBuffer.isView(e)||e instanceof i.ImageData)return e;if(Array.isArray(e))return e.map(qr);if("object"==typeof e){const t=e.$name||"Object",{klass:i}=jr[t];if(!i)throw new Error(`can't deserialize unregistered class ${t}`);if(i.deserialize)return i.deserialize(e);const n=Object.create(i.prototype);for(const t of Object.keys(e))"$name"!==t&&(n[t]=qr(e[t]));return n}throw new Error("can't deserialize object of type "+typeof e)}class Wr{constructor(){this.first=!0}update(e,t){const i=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=i,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=i,!0):(this.lastFloorZoom>i?(this.lastIntegerZoom=i+1,this.lastIntegerZoomTime=t):this.lastFloorZoome>=1536&&e<=1791,Hr=e=>e>=1872&&e<=1919,Xr=e=>e>=2208&&e<=2303,Yr=e=>e>=11904&&e<=12031,Kr=e=>e>=12032&&e<=12255,Jr=e=>e>=12272&&e<=12287,Qr=e=>e>=12288&&e<=12351,eo=e=>e>=12352&&e<=12447,to=e=>e>=12448&&e<=12543,io=e=>e>=12544&&e<=12591,no=e=>e>=12704&&e<=12735,ro=e=>e>=12736&&e<=12783,oo=e=>e>=12784&&e<=12799,ao=e=>e>=12800&&e<=13055,so=e=>e>=13056&&e<=13311,lo=e=>e>=13312&&e<=19903,co=e=>e>=19968&&e<=40959,uo=e=>e>=40960&&e<=42127,ho=e=>e>=42128&&e<=42191,po=e=>e>=44032&&e<=55215,fo=e=>e>=63744&&e<=64255,mo=e=>e>=64336&&e<=65023,go=e=>e>=65040&&e<=65055,_o=e=>e>=65072&&e<=65103,vo=e=>e>=65104&&e<=65135,yo=e=>e>=65136&&e<=65279,xo=e=>e>=65280&&e<=65519;function bo(e){for(const t of e)if(Co(t.charCodeAt(0)))return!0;return!1}function wo(e){for(const t of e)if(!To(t.charCodeAt(0)))return!1;return!0}function To(e){return!(Zr(e)||Hr(e)||Xr(e)||mo(e)||yo(e))}function Co(e){return!(746!==e&&747!==e&&(e<4352||!(no(e)||io(e)||_o(e)&&!(e>=65097&&e<=65103)||fo(e)||so(e)||Yr(e)||ro(e)||!(!Qr(e)||e>=12296&&e<=12305||e>=12308&&e<=12319||12336===e)||lo(e)||co(e)||ao(e)||(e=>e>=12592&&e<=12687)(e)||(e=>e>=43360&&e<=43391)(e)||(e=>e>=55216&&e<=55295)(e)||(e=>e>=4352&&e<=4607)(e)||po(e)||eo(e)||Jr(e)||(e=>e>=12688&&e<=12703)(e)||Kr(e)||oo(e)||to(e)&&12540!==e||!(!xo(e)||65288===e||65289===e||65293===e||e>=65306&&e<=65310||65339===e||65341===e||65343===e||e>=65371&&e<=65503||65507===e||e>=65512&&e<=65519)||!(!vo(e)||e>=65112&&e<=65118||e>=65123&&e<=65126)||(e=>e>=5120&&e<=5759)(e)||(e=>e>=6320&&e<=6399)(e)||go(e)||(e=>e>=19904&&e<=19967)(e)||uo(e)||ho(e))))}function So(e){return!(Co(e)||function(e){return!!((e=>e>=128&&e<=255)(e)&&(167===e||169===e||174===e||177===e||188===e||189===e||190===e||215===e||247===e)||(e=>e>=8192&&e<=8303)(e)&&(8214===e||8224===e||8225===e||8240===e||8241===e||8251===e||8252===e||8258===e||8263===e||8264===e||8265===e||8273===e)||(e=>e>=8448&&e<=8527)(e)||(e=>e>=8528&&e<=8591)(e)||(e=>e>=8960&&e<=9215)(e)&&(e>=8960&&e<=8967||e>=8972&&e<=8991||e>=8996&&e<=9e3||9003===e||e>=9085&&e<=9114||e>=9150&&e<=9165||9167===e||e>=9169&&e<=9179||e>=9186&&e<=9215)||(e=>e>=9216&&e<=9279)(e)&&9251!==e||(e=>e>=9280&&e<=9311)(e)||(e=>e>=9312&&e<=9471)(e)||(e=>e>=9632&&e<=9727)(e)||(e=>e>=9728&&e<=9983)(e)&&!(e>=9754&&e<=9759)||(e=>e>=11008&&e<=11263)(e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||Qr(e)||to(e)||(e=>e>=57344&&e<=63743)(e)||_o(e)||vo(e)||xo(e)||8734===e||8756===e||8757===e||e>=9984&&e<=10087||e>=10102&&e<=10131||65532===e||65533===e)}(e))}function Eo(e){return e>=1424&&e<=2303||mo(e)||yo(e)}function ko(e,t){return!(!t&&Eo(e)||e>=2304&&e<=3583||e>=3840&&e<=4255||(e=>e>=6016&&e<=6143)(e))}function Ao(e){for(const t of e)if(Eo(t.charCodeAt(0)))return!0;return!1}const Mo="deferred",Io="loading",Po="loaded";let Do=null,zo="unavailable",Oo=null;const Lo=function(e){e&&"string"==typeof e&&e.indexOf("NetworkError")>-1&&(zo="error"),Do&&Do(e)};function Ro(){Bo.fire(new Ze("pluginStateChange",{pluginStatus:zo,pluginURL:Oo}))}const Bo=new Xe,Fo=function(){return zo},$o=function(){if(zo!==Mo||!Oo)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");zo=Io,Ro(),Oo&&ue({url:Oo},(e=>{e?Lo(e):(zo=Po,Ro())}))},jo={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>zo===Po||null!=jo.applyArabicShaping,isLoading:()=>zo===Io,setState(e){zo=e.pluginStatus,Oo=e.pluginURL},isParsed:()=>null!=jo.applyArabicShaping&&null!=jo.processBidirectionalText&&null!=jo.processStyledBidirectionalText,getPluginURL:()=>Oo};class No{constructor(e,t){this.zoom=e,t?(this.now=t.now,this.fadeDuration=t.fadeDuration,this.zoomHistory=t.zoomHistory,this.transition=t.transition,this.pitch=t.pitch):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Wr,this.transition={},this.pitch=0)}isSupportedScript(e){return function(e,t){for(const i of e)if(!ko(i.charCodeAt(0),t))return!1;return!0}(e,jo.isLoaded())}crossFadingFactor(){return 0===this.fadeDuration?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const e=this.zoom,t=e-Math.floor(e),i=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:t+(1-t)*i}:{fromScale:.5,toScale:1,t:1-(1-i)*t}}}class Uo{constructor(e,t){this.property=e,this.value=t,this.expression=function(e,t){if(Ln(e))return new Xn(e,t);if(Gn(e)){const i=Hn(e,t);if("error"===i.result)throw new Error(i.value.map((e=>`${e.key}: ${e.message}`)).join(", "));return i.value}{let i=e;return"string"==typeof e&&"color"===t.type&&(i=kt.parse(e)),{kind:"constant",evaluate:()=>i}}}(void 0===t?e.specification.default:t,e.specification)}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}possiblyEvaluate(e,t,i){return this.property.possiblyEvaluate(this,e,t,i)}}class Vo{constructor(e){this.property=e,this.value=new Uo(e,void 0)}transitioned(e,t){return new qo(this.property,this.value,t,I({},e.transition,this.transition),e.now)}untransitioned(){return new qo(this.property,this.value,null,{},0)}}class Go{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return j(this._values[e].value.value)}setValue(e,t){this._values.hasOwnProperty(e)||(this._values[e]=new Vo(this._values[e].property)),this._values[e].value=new Uo(this._values[e].property,null===t?void 0:j(t))}getTransition(e){return j(this._values[e].transition)}setTransition(e,t){this._values.hasOwnProperty(e)||(this._values[e]=new Vo(this._values[e].property)),this._values[e].transition=j(t)||void 0}serialize(){const e={};for(const t of Object.keys(this._values)){const i=this.getValue(t);void 0!==i&&(e[t]=i);const n=this.getTransition(t);void 0!==n&&(e[`${t}-transition`]=n)}return e}transitioned(e,t){const i=new Wo(this._properties);for(const n of Object.keys(this._values))i._values[n]=this._values[n].transitioned(e,t._values[n]);return i}untransitioned(){const e=new Wo(this._properties);for(const t of Object.keys(this._values))e._values[t]=this._values[t].untransitioned();return e}}class qo{constructor(e,t,i,n,r){const o=n.delay||0,a=n.duration||0;r=r||0,this.property=e,this.value=t,this.begin=r+o,this.end=this.begin+a,e.specification.transition&&(n.delay||n.duration)&&(this.prior=i)}possiblyEvaluate(e,t,i){const n=e.now||0,r=this.value.possiblyEvaluate(e,t,i),o=this.prior;if(o){if(n>this.end)return this.prior=null,r;if(this.value.isDataDriven())return this.prior=null,r;if(nn.zoomHistory.lastIntegerZoom?{from:e,to:t,other:i}:{from:i,to:t,other:e}}interpolate(e){return e}}class Qo{constructor(e){this.specification=e}possiblyEvaluate(e,t,i,n){if(void 0!==e.value){if("constant"===e.expression.kind){const r=e.expression.evaluate(t,null,{},i,n);return this._calculate(r,r,r,t)}return this._calculate(e.expression.evaluate(new No(Math.floor(t.zoom-1),t)),e.expression.evaluate(new No(Math.floor(t.zoom),t)),e.expression.evaluate(new No(Math.floor(t.zoom+1),t)),t)}}_calculate(e,t,i,n){return n.zoom>n.zoomHistory.lastIntegerZoom?{from:e,to:t}:{from:i,to:t}}interpolate(e){return e}}class ea{constructor(e){this.specification=e}possiblyEvaluate(e,t,i,n){return!!e.expression.evaluate(t,null,{},i,n)}interpolate(){return!1}}class ta{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];const t=new No(0,{});for(const i in e){const n=e[i];n.specification.overridable&&this.overridableProperties.push(i);const r=this.defaultPropertyValues[i]=new Uo(n,void 0),o=this.defaultTransitionablePropertyValues[i]=new Vo(n);this.defaultTransitioningPropertyValues[i]=o.untransitioned(),this.defaultPossiblyEvaluatedValues[i]=r.possiblyEvaluate(t)}}}function ia(e,t){return 256*(e=S(Math.floor(e),0,255))+S(Math.floor(t),0,255)}Nr(Ko,"DataDrivenProperty"),Nr(Yo,"DataConstantProperty"),Nr(Jo,"CrossFadedDataDrivenProperty"),Nr(Qo,"CrossFadedProperty"),Nr(ea,"ColorRampProperty");const na={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class ra{constructor(e,t){this._structArray=e,this._pos1=t*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class oa{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,t){return e._trim(),t&&(e.isTransferred=!0,t.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const t=Object.create(this.prototype);return t.arrayBuffer=e.arrayBuffer,t.length=e.length,t.capacity=e.arrayBuffer.byteLength/t.bytesPerElement,t._refreshViews(),t}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const t=this.uint8;this._refreshViews(),t&&this.uint8.set(t)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}destroy(){this.int8=this.uint8=this.int16=this.uint16=this.int32=this.uint32=this.float32=null,this.arrayBuffer=null}}function aa(e,t=1){let i=0,n=0;return{members:e.map((e=>{const r=na[e.type].BYTES_PER_ELEMENT,o=i=sa(i,Math.max(t,r)),a=e.components||1;return n=Math.max(n,r),i+=r*a,{name:e.name,type:e.type,components:a,offset:o}})),size:sa(i,Math.max(n,t)),alignment:t}}function sa(e,t){return Math.ceil(e/t)*t}class la extends oa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t){const i=this.length;return this.resize(i+1),this.emplace(i,e,t)}emplace(e,t,i){const n=2*e;return this.int16[n+0]=t,this.int16[n+1]=i,e}}la.prototype.bytesPerElement=4,Nr(la,"StructArrayLayout2i4");class ca extends oa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i){const n=this.length;return this.resize(n+1),this.emplace(n,e,t,i)}emplace(e,t,i,n){const r=3*e;return this.int16[r+0]=t,this.int16[r+1]=i,this.int16[r+2]=n,e}}ca.prototype.bytesPerElement=6,Nr(ca,"StructArrayLayout3i6");class ua extends oa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,n){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,i,n)}emplace(e,t,i,n,r){const o=4*e;return this.int16[o+0]=t,this.int16[o+1]=i,this.int16[o+2]=n,this.int16[o+3]=r,e}}ua.prototype.bytesPerElement=8,Nr(ua,"StructArrayLayout4i8");class ha extends oa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,n,r,o,a){const s=this.length;return this.resize(s+1),this.emplace(s,e,t,i,n,r,o,a)}emplace(e,t,i,n,r,o,a,s){const l=6*e,c=12*e,u=3*e;return this.int16[l+0]=t,this.int16[l+1]=i,this.uint8[c+4]=n,this.uint8[c+5]=r,this.uint8[c+6]=o,this.uint8[c+7]=a,this.float32[u+2]=s,e}}ha.prototype.bytesPerElement=12,Nr(ha,"StructArrayLayout2i4ub1f12");class da extends oa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,n){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,i,n)}emplace(e,t,i,n,r){const o=4*e;return this.float32[o+0]=t,this.float32[o+1]=i,this.float32[o+2]=n,this.float32[o+3]=r,e}}da.prototype.bytesPerElement=16,Nr(da,"StructArrayLayout4f16");class pa extends oa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,n,r,o,a,s,l,c){const u=this.length;return this.resize(u+1),this.emplace(u,e,t,i,n,r,o,a,s,l,c)}emplace(e,t,i,n,r,o,a,s,l,c,u){const h=10*e;return this.uint16[h+0]=t,this.uint16[h+1]=i,this.uint16[h+2]=n,this.uint16[h+3]=r,this.uint16[h+4]=o,this.uint16[h+5]=a,this.uint16[h+6]=s,this.uint16[h+7]=l,this.uint16[h+8]=c,this.uint16[h+9]=u,e}}pa.prototype.bytesPerElement=20,Nr(pa,"StructArrayLayout10ui20");class fa extends oa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,n,r,o,a,s){const l=this.length;return this.resize(l+1),this.emplace(l,e,t,i,n,r,o,a,s)}emplace(e,t,i,n,r,o,a,s,l){const c=8*e;return this.uint16[c+0]=t,this.uint16[c+1]=i,this.uint16[c+2]=n,this.uint16[c+3]=r,this.uint16[c+4]=o,this.uint16[c+5]=a,this.uint16[c+6]=s,this.uint16[c+7]=l,e}}fa.prototype.bytesPerElement=16,Nr(fa,"StructArrayLayout8ui16");class ma extends oa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,n,r,o){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,i,n,r,o)}emplace(e,t,i,n,r,o,a){const s=6*e;return this.int16[s+0]=t,this.int16[s+1]=i,this.int16[s+2]=n,this.int16[s+3]=r,this.int16[s+4]=o,this.int16[s+5]=a,e}}ma.prototype.bytesPerElement=12,Nr(ma,"StructArrayLayout6i12");class ga extends oa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,n,r,o,a,s,l,c,u,h){const d=this.length;return this.resize(d+1),this.emplace(d,e,t,i,n,r,o,a,s,l,c,u,h)}emplace(e,t,i,n,r,o,a,s,l,c,u,h,d){const p=12*e;return this.int16[p+0]=t,this.int16[p+1]=i,this.int16[p+2]=n,this.int16[p+3]=r,this.uint16[p+4]=o,this.uint16[p+5]=a,this.uint16[p+6]=s,this.uint16[p+7]=l,this.int16[p+8]=c,this.int16[p+9]=u,this.int16[p+10]=h,this.int16[p+11]=d,e}}ga.prototype.bytesPerElement=24,Nr(ga,"StructArrayLayout4i4ui4i24");class _a extends oa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,n,r,o){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,i,n,r,o)}emplace(e,t,i,n,r,o,a){const s=10*e,l=5*e;return this.int16[s+0]=t,this.int16[s+1]=i,this.int16[s+2]=n,this.float32[l+2]=r,this.float32[l+3]=o,this.float32[l+4]=a,e}}_a.prototype.bytesPerElement=20,Nr(_a,"StructArrayLayout3i3f20");class va extends oa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.uint32[1*e+0]=t,e}}va.prototype.bytesPerElement=4,Nr(va,"StructArrayLayout1ul4");class ya extends oa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,n,r,o,a,s,l,c,u,h,d){const p=this.length;return this.resize(p+1),this.emplace(p,e,t,i,n,r,o,a,s,l,c,u,h,d)}emplace(e,t,i,n,r,o,a,s,l,c,u,h,d,p){const f=20*e,m=10*e;return this.int16[f+0]=t,this.int16[f+1]=i,this.int16[f+2]=n,this.int16[f+3]=r,this.int16[f+4]=o,this.float32[m+3]=a,this.float32[m+4]=s,this.float32[m+5]=l,this.float32[m+6]=c,this.int16[f+14]=u,this.uint32[m+8]=h,this.uint16[f+18]=d,this.uint16[f+19]=p,e}}ya.prototype.bytesPerElement=40,Nr(ya,"StructArrayLayout5i4f1i1ul2ui40");class xa extends oa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,n,r,o,a){const s=this.length;return this.resize(s+1),this.emplace(s,e,t,i,n,r,o,a)}emplace(e,t,i,n,r,o,a,s){const l=8*e;return this.int16[l+0]=t,this.int16[l+1]=i,this.int16[l+2]=n,this.int16[l+4]=r,this.int16[l+5]=o,this.int16[l+6]=a,this.int16[l+7]=s,e}}xa.prototype.bytesPerElement=16,Nr(xa,"StructArrayLayout3i2i2i16");class ba extends oa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,n,r){const o=this.length;return this.resize(o+1),this.emplace(o,e,t,i,n,r)}emplace(e,t,i,n,r,o){const a=4*e,s=8*e;return this.float32[a+0]=t,this.float32[a+1]=i,this.float32[a+2]=n,this.int16[s+6]=r,this.int16[s+7]=o,e}}ba.prototype.bytesPerElement=16,Nr(ba,"StructArrayLayout2f1f2i16");class wa extends oa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,n){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,i,n)}emplace(e,t,i,n,r){const o=12*e,a=3*e;return this.uint8[o+0]=t,this.uint8[o+1]=i,this.float32[a+1]=n,this.float32[a+2]=r,e}}wa.prototype.bytesPerElement=12,Nr(wa,"StructArrayLayout2ub2f12");class Ta extends oa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i){const n=this.length;return this.resize(n+1),this.emplace(n,e,t,i)}emplace(e,t,i,n){const r=3*e;return this.float32[r+0]=t,this.float32[r+1]=i,this.float32[r+2]=n,e}}Ta.prototype.bytesPerElement=12,Nr(Ta,"StructArrayLayout3f12");class Ca extends oa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i){const n=this.length;return this.resize(n+1),this.emplace(n,e,t,i)}emplace(e,t,i,n){const r=3*e;return this.uint16[r+0]=t,this.uint16[r+1]=i,this.uint16[r+2]=n,e}}Ca.prototype.bytesPerElement=6,Nr(Ca,"StructArrayLayout3ui6");class Sa extends oa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e,t,i,n,r,o,a,s,l,c,u,h,d,p,f,m,g,_,v,y,x){const b=this.length;return this.resize(b+1),this.emplace(b,e,t,i,n,r,o,a,s,l,c,u,h,d,p,f,m,g,_,v,y,x)}emplace(e,t,i,n,r,o,a,s,l,c,u,h,d,p,f,m,g,_,v,y,x,b){const w=30*e,T=15*e,C=60*e;return this.int16[w+0]=t,this.int16[w+1]=i,this.int16[w+2]=n,this.float32[T+2]=r,this.float32[T+3]=o,this.uint16[w+8]=a,this.uint16[w+9]=s,this.uint32[T+5]=l,this.uint32[T+6]=c,this.uint32[T+7]=u,this.uint16[w+16]=h,this.uint16[w+17]=d,this.uint16[w+18]=p,this.float32[T+10]=f,this.float32[T+11]=m,this.uint8[C+48]=g,this.uint8[C+49]=_,this.uint8[C+50]=v,this.uint32[T+13]=y,this.int16[w+28]=x,this.uint8[C+58]=b,e}}Sa.prototype.bytesPerElement=60,Nr(Sa,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class Ea extends oa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e,t,i,n,r,o,a,s,l,c,u,h,d,p,f,m,g,_,v,y,x,b,w,T,C,S,E,k,A,M){const I=this.length;return this.resize(I+1),this.emplace(I,e,t,i,n,r,o,a,s,l,c,u,h,d,p,f,m,g,_,v,y,x,b,w,T,C,S,E,k,A,M)}emplace(e,t,i,n,r,o,a,s,l,c,u,h,d,p,f,m,g,_,v,y,x,b,w,T,C,S,E,k,A,M,I){const P=38*e,D=19*e;return this.int16[P+0]=t,this.int16[P+1]=i,this.int16[P+2]=n,this.float32[D+2]=r,this.float32[D+3]=o,this.int16[P+8]=a,this.int16[P+9]=s,this.int16[P+10]=l,this.int16[P+11]=c,this.int16[P+12]=u,this.int16[P+13]=h,this.uint16[P+14]=d,this.uint16[P+15]=p,this.uint16[P+16]=f,this.uint16[P+17]=m,this.uint16[P+18]=g,this.uint16[P+19]=_,this.uint16[P+20]=v,this.uint16[P+21]=y,this.uint16[P+22]=x,this.uint16[P+23]=b,this.uint16[P+24]=w,this.uint16[P+25]=T,this.uint16[P+26]=C,this.uint16[P+27]=S,this.uint16[P+28]=E,this.uint32[D+15]=k,this.float32[D+16]=A,this.float32[D+17]=M,this.float32[D+18]=I,e}}Ea.prototype.bytesPerElement=76,Nr(Ea,"StructArrayLayout3i2f6i15ui1ul3f76");class ka extends oa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.float32[1*e+0]=t,e}}ka.prototype.bytesPerElement=4,Nr(ka,"StructArrayLayout1f4");class Aa extends oa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,n,r){const o=this.length;return this.resize(o+1),this.emplace(o,e,t,i,n,r)}emplace(e,t,i,n,r,o){const a=5*e;return this.float32[a+0]=t,this.float32[a+1]=i,this.float32[a+2]=n,this.float32[a+3]=r,this.float32[a+4]=o,e}}Aa.prototype.bytesPerElement=20,Nr(Aa,"StructArrayLayout5f20");class Ma extends oa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,n){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,i,n)}emplace(e,t,i,n,r){const o=6*e;return this.uint32[3*e+0]=t,this.uint16[o+2]=i,this.uint16[o+3]=n,this.uint16[o+4]=r,e}}Ma.prototype.bytesPerElement=12,Nr(Ma,"StructArrayLayout1ul3ui12");class Ia extends oa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t){const i=this.length;return this.resize(i+1),this.emplace(i,e,t)}emplace(e,t,i){const n=2*e;return this.uint16[n+0]=t,this.uint16[n+1]=i,e}}Ia.prototype.bytesPerElement=4,Nr(Ia,"StructArrayLayout2ui4");class Pa extends oa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.uint16[1*e+0]=t,e}}Pa.prototype.bytesPerElement=2,Nr(Pa,"StructArrayLayout1ui2");class Da extends oa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t){const i=this.length;return this.resize(i+1),this.emplace(i,e,t)}emplace(e,t,i){const n=2*e;return this.float32[n+0]=t,this.float32[n+1]=i,e}}Da.prototype.bytesPerElement=8,Nr(Da,"StructArrayLayout2f8");class za extends ra{get a_pos_30(){return this._structArray.int16[this._pos2+0]}get a_pos_31(){return this._structArray.int16[this._pos2+1]}get a_pos_32(){return this._structArray.int16[this._pos2+2]}get a_pos_normal_30(){return this._structArray.int16[this._pos2+3]}get a_pos_normal_31(){return this._structArray.int16[this._pos2+4]}get a_pos_normal_32(){return this._structArray.int16[this._pos2+5]}}za.prototype.size=12;class Oa extends ma{get(e){return new za(this,e)}}Nr(Oa,"FillExtrusionExtArray");class La extends ra{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.int16[this._pos2+3]}get tileAnchorY(){return this._structArray.int16[this._pos2+4]}get x1(){return this._structArray.float32[this._pos4+3]}get y1(){return this._structArray.float32[this._pos4+4]}get x2(){return this._structArray.float32[this._pos4+5]}get y2(){return this._structArray.float32[this._pos4+6]}get padding(){return this._structArray.int16[this._pos2+14]}get featureIndex(){return this._structArray.uint32[this._pos4+8]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+18]}get bucketIndex(){return this._structArray.uint16[this._pos2+19]}}La.prototype.size=40;class Ra extends ya{get(e){return new La(this,e)}}Nr(Ra,"CollisionBoxArray");class Ba extends ra{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.float32[this._pos4+2]}get tileAnchorY(){return this._structArray.float32[this._pos4+3]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+8]}get numGlyphs(){return this._structArray.uint16[this._pos2+9]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+5]}get lineStartIndex(){return this._structArray.uint32[this._pos4+6]}get lineLength(){return this._structArray.uint32[this._pos4+7]}get segment(){return this._structArray.uint16[this._pos2+16]}get lowerSize(){return this._structArray.uint16[this._pos2+17]}get upperSize(){return this._structArray.uint16[this._pos2+18]}get lineOffsetX(){return this._structArray.float32[this._pos4+10]}get lineOffsetY(){return this._structArray.float32[this._pos4+11]}get writingMode(){return this._structArray.uint8[this._pos1+48]}get placedOrientation(){return this._structArray.uint8[this._pos1+49]}set placedOrientation(e){this._structArray.uint8[this._pos1+49]=e}get hidden(){return this._structArray.uint8[this._pos1+50]}set hidden(e){this._structArray.uint8[this._pos1+50]=e}get crossTileID(){return this._structArray.uint32[this._pos4+13]}set crossTileID(e){this._structArray.uint32[this._pos4+13]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+28]}get flipState(){return this._structArray.uint8[this._pos1+58]}set flipState(e){this._structArray.uint8[this._pos1+58]=e}}Ba.prototype.size=60;class Fa extends Sa{get(e){return new Ba(this,e)}}Nr(Fa,"PlacedSymbolArray");class $a extends ra{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.float32[this._pos4+2]}get tileAnchorY(){return this._structArray.float32[this._pos4+3]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+8]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+9]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+10]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+11]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+12]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+13]}get key(){return this._structArray.uint16[this._pos2+14]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+17]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+18]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+19]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+20]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+21]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+22]}get featureIndex(){return this._structArray.uint16[this._pos2+23]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+24]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+25]}get numIconVertices(){return this._structArray.uint16[this._pos2+26]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+27]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+28]}get crossTileID(){return this._structArray.uint32[this._pos4+15]}set crossTileID(e){this._structArray.uint32[this._pos4+15]=e}get textOffset0(){return this._structArray.float32[this._pos4+16]}get textOffset1(){return this._structArray.float32[this._pos4+17]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+18]}}$a.prototype.size=76;class ja extends Ea{get(e){return new $a(this,e)}}Nr(ja,"SymbolInstanceArray");class Na extends ka{getoffsetX(e){return this.float32[1*e+0]}}Nr(Na,"GlyphOffsetArray");class Ua extends ca{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}Nr(Ua,"SymbolLineVertexArray");class Va extends ra{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}get layoutVertexArrayOffset(){return this._structArray.uint16[this._pos2+4]}}Va.prototype.size=12;class Ga extends Ma{get(e){return new Va(this,e)}}Nr(Ga,"FeatureIndexArray");class qa extends ra{get a_centroid_pos0(){return this._structArray.uint16[this._pos2+0]}get a_centroid_pos1(){return this._structArray.uint16[this._pos2+1]}}qa.prototype.size=4;class Wa extends Ia{get(e){return new qa(this,e)}}Nr(Wa,"FillExtrusionCentroidArray");class Za extends ra{get a_pos_30(){return this._structArray.int16[this._pos2+0]}get a_pos_31(){return this._structArray.int16[this._pos2+1]}get a_pos_32(){return this._structArray.int16[this._pos2+2]}get a_pos_normal_30(){return this._structArray.int16[this._pos2+3]}get a_pos_normal_31(){return this._structArray.int16[this._pos2+4]}get a_pos_normal_32(){return this._structArray.int16[this._pos2+5]}}Za.prototype.size=12;class Ha extends ma{get(e){return new Za(this,e)}}Nr(Ha,"CircleGlobeExtArray");const Xa=aa([{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"}]),Ya=aa([{name:"a_dash_to",components:4,type:"Uint16"},{name:"a_dash_from",components:4,type:"Uint16"}]);var Ka={exports:{}},Ja={exports:{}};Ja.exports=function(e,t){var i,n,r,o,a,s,l,c;for(n=e.length-(i=3&e.length),r=t,a=3432918353,s=461845907,c=0;c>>16)*a&65535)<<16)&4294967295)<<15|l>>>17))*s+(((l>>>16)*s&65535)<<16)&4294967295)<<13|r>>>19))+((5*(r>>>16)&65535)<<16)&4294967295))+((58964+(o>>>16)&65535)<<16);switch(l=0,i){case 3:l^=(255&e.charCodeAt(c+2))<<16;case 2:l^=(255&e.charCodeAt(c+1))<<8;case 1:r^=l=(65535&(l=(l=(65535&(l^=255&e.charCodeAt(c)))*a+(((l>>>16)*a&65535)<<16)&4294967295)<<15|l>>>17))*s+(((l>>>16)*s&65535)<<16)&4294967295}return r^=e.length,r=2246822507*(65535&(r^=r>>>16))+((2246822507*(r>>>16)&65535)<<16)&4294967295,r=3266489909*(65535&(r^=r>>>13))+((3266489909*(r>>>16)&65535)<<16)&4294967295,(r^=r>>>16)>>>0};var Qa={exports:{}};Qa.exports=function(e,t){for(var i,n=e.length,r=t^n,o=0;n>=4;)i=1540483477*(65535&(i=255&e.charCodeAt(o)|(255&e.charCodeAt(++o))<<8|(255&e.charCodeAt(++o))<<16|(255&e.charCodeAt(++o))<<24))+((1540483477*(i>>>16)&65535)<<16),r=1540483477*(65535&r)+((1540483477*(r>>>16)&65535)<<16)^(i=1540483477*(65535&(i^=i>>>24))+((1540483477*(i>>>16)&65535)<<16)),n-=4,++o;switch(n){case 3:r^=(255&e.charCodeAt(o+2))<<16;case 2:r^=(255&e.charCodeAt(o+1))<<8;case 1:r=1540483477*(65535&(r^=255&e.charCodeAt(o)))+((1540483477*(r>>>16)&65535)<<16)}return r=1540483477*(65535&(r^=r>>>13))+((1540483477*(r>>>16)&65535)<<16),(r^=r>>>15)>>>0};var es=Ja.exports,ts=Qa.exports;Ka.exports=es,Ka.exports.murmur3=es,Ka.exports.murmur2=ts;class is{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,t,i,n){this.ids.push(ns(e)),this.positions.push(t,i,n)}getPositions(e){const t=ns(e);let i=0,n=this.ids.length-1;for(;i>1;this.ids[e]>=t?n=e:i=e+1}const r=[];for(;this.ids[i]===t;)r.push({index:this.positions[3*i],start:this.positions[3*i+1],end:this.positions[3*i+2]}),i++;return r}static serialize(e,t){const i=new Float64Array(e.ids),n=new Uint32Array(e.positions);return rs(i,n,0,i.length-1),t&&t.push(i.buffer,n.buffer),{ids:i,positions:n}}static deserialize(e){const t=new is;return t.ids=e.ids,t.positions=e.positions,t.indexed=!0,t}}function ns(e){const t=+e;return!isNaN(t)&&Number.MIN_SAFE_INTEGER<=t&&t<=Number.MAX_SAFE_INTEGER?t:Ka.exports(String(e))}function rs(e,t,i,n){for(;i>1];let o=i-1,a=n+1;for(;;){do{o++}while(e[o]r);if(o>=a)break;os(e,o,a),os(t,3*o,3*a),os(t,3*o+1,3*a+1),os(t,3*o+2,3*a+2)}a-i`u_${e}`)),this.type=i}setUniform(e,t,i,n,r){t.set(e,r,n.constantOr(this.value))}getBinding(e,t){return"color"===this.type?new cs(e):new ss(e)}}class ms{constructor(e,t){this.uniformNames=t.map((e=>`u_${e}`)),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,t){this.pixelRatioFrom=t.pixelRatio||1,this.pixelRatioTo=e.pixelRatio||1,this.patternFrom=t.tl.concat(t.br),this.patternTo=e.tl.concat(e.br)}setUniform(e,t,i,n,r){const o="u_pattern_to"===r||"u_dash_to"===r?this.patternTo:"u_pattern_from"===r||"u_dash_from"===r?this.patternFrom:"u_pixel_ratio_to"===r?this.pixelRatioTo:"u_pixel_ratio_from"===r?this.pixelRatioFrom:null;o&&t.set(e,r,o)}getBinding(e,t){return"u_pattern_from"===t||"u_pattern_to"===t||"u_dash_from"===t||"u_dash_to"===t?new ls(e):new ss(e)}}class gs{constructor(e,t,i,n){this.expression=e,this.type=i,this.maxValue=0,this.paintVertexAttributes=t.map((e=>({name:`a_${e}`,type:"Float32",components:"color"===i?2:1,offset:0}))),this.paintVertexArray=new n}populatePaintArray(e,t,i,n,r,o){const a=this.paintVertexArray.length,s=this.expression.evaluate(new No(0),t,{},r,n,o);this.paintVertexArray.resize(e),this._setPaintValue(a,e,s)}updatePaintArray(e,t,i,n,r){const o=this.expression.evaluate({zoom:0},i,n,void 0,r);this._setPaintValue(e,t,o)}_setPaintValue(e,t,i){if("color"===this.type){const n=ps(i);for(let i=e;i`u_${e}_t`)),this.type=i,this.useIntegerZoom=n,this.zoom=r,this.maxValue=0,this.paintVertexAttributes=t.map((e=>({name:`a_${e}`,type:"Float32",components:"color"===i?4:2,offset:0}))),this.paintVertexArray=new o}populatePaintArray(e,t,i,n,r,o){const a=this.expression.evaluate(new No(this.zoom),t,{},r,n,o),s=this.expression.evaluate(new No(this.zoom+1),t,{},r,n,o),l=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(l,e,a,s)}updatePaintArray(e,t,i,n,r){const o=this.expression.evaluate({zoom:this.zoom},i,n,void 0,r),a=this.expression.evaluate({zoom:this.zoom+1},i,n,void 0,r);this._setPaintValue(e,t,o,a)}_setPaintValue(e,t,i,n){if("color"===this.type){const r=ps(i),o=ps(n);for(let i=e;i!0)){this.binders={},this._buffers=[];const n=[];for(const r in e.paint._values){if(!i(r))continue;const o=e.paint.get(r);if(!(o instanceof Ho&&Pn(o.property.specification)))continue;const a=ws(r,e.type),s=o.value,l=o.property.specification.type,c=o.property.useIntegerZoom,u=o.property.specification["property-type"],h="cross-faded"===u||"cross-faded-data-driven"===u,d="line-dasharray"===String(r)&&"constant"!==e.layout.get("line-cap").value.kind;if("constant"!==s.kind||d)if("source"===s.kind||d||h){const i=Ss(r,l,"source");this.binders[r]=h?new vs(s,a,l,c,t,i,e.id):new gs(s,a,l,i),n.push(`/a_${r}`)}else{const e=Ss(r,l,"composite");this.binders[r]=new _s(s,a,l,c,t,e),n.push(`/z_${r}`)}else this.binders[r]=h?new ms(s.value,a):new fs(s.value,a,l),n.push(`/u_${r}`)}this.cacheKey=n.sort().join("")}getMaxValue(e){const t=this.binders[e];return t instanceof gs||t instanceof _s?t.maxValue:0}populatePaintArrays(e,t,i,n,r,o){for(const a in this.binders){const s=this.binders[a];(s instanceof gs||s instanceof _s||s instanceof vs)&&s.populatePaintArray(e,t,i,n,r,o)}}setConstantPatternPositions(e,t){for(const i in this.binders){const n=this.binders[i];n instanceof ms&&n.setConstantPatternPositions(e,t)}}updatePaintArrays(e,t,i,n,r,o){let a=!1;for(const s in e){const l=t.getPositions(s);for(const t of l){const l=i.feature(t.index);for(const i in this.binders){const c=this.binders[i];if((c instanceof gs||c instanceof _s||c instanceof vs)&&!0===c.expression.isStateDependent){const u=n.paint.get(i);c.expression=u.value,c.updatePaintArray(t.start,t.end,l,e[s],r,o),a=!0}}}}return a}defines(){const e=[];for(const t in this.binders){const i=this.binders[t];(i instanceof fs||i instanceof ms)&&e.push(...i.uniformNames.map((e=>`#define HAS_UNIFORM_${e}`)))}return e}getBinderAttributes(){const e=[];for(const t in this.binders){const i=this.binders[t];if(i instanceof gs||i instanceof _s||i instanceof vs)for(let t=0;t!0)){this.programConfigurations={};for(const n of e)this.programConfigurations[n.id]=new ys(n,t,i);this.needsUpload=!1,this._featureMap=new is,this._bufferOffset=0}populatePaintArrays(e,t,i,n,r,o,a){for(const i in this.programConfigurations)this.programConfigurations[i].populatePaintArrays(e,t,n,r,o,a);void 0!==t.id&&this._featureMap.add(t.id,i,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,t,i,n,r){for(const o of i)this.needsUpload=this.programConfigurations[o.id].updatePaintArrays(e,this._featureMap,t,o,n,r)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const t in this.programConfigurations)this.programConfigurations[t].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}const bs={"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"],"line-dasharray":["dash_to","dash_from"]};function ws(e,t){return bs[e]||[e.replace(`${t}-`,"").replace(/-/g,"_")]}const Ts={"line-pattern":{source:pa,composite:pa},"fill-pattern":{source:pa,composite:pa},"fill-extrusion-pattern":{source:pa,composite:pa},"line-dasharray":{source:fa,composite:fa}},Cs={color:{source:Da,composite:da},number:{source:ka,composite:Da}};function Ss(e,t,i){const n=Ts[e];return n&&n[i]||Cs[t][i]}Nr(fs,"ConstantBinder"),Nr(ms,"CrossFadedConstantBinder"),Nr(gs,"SourceExpressionBinder"),Nr(vs,"CrossFadedCompositeBinder"),Nr(_s,"CompositeExpressionBinder"),Nr(ys,"ProgramConfiguration",{omit:["_buffers"]}),Nr(xs,"ProgramConfigurationSet");const Es="-transition";class ks extends Xe{constructor(e,t){if(super(),this.id=e.id,this.type=e.type,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,"custom"!==e.type&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,"background"!==e.type&&"sky"!==e.type&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),t.layout&&(this._unevaluatedLayout=new Zo(t.layout)),t.paint)){this._transitionablePaint=new Go(t.paint);for(const t in e.paint)this.setPaintProperty(t,e.paint[t],{validate:!1});for(const t in e.layout)this.setLayoutProperty(t,e.layout[t],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Xo(t.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return"visibility"===e?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,t,i={}){null!=t&&this._validate(Lr,`layers.${this.id}.layout.${e}`,e,t,i)||("visibility"!==e?this._unevaluatedLayout.setValue(e,t):this.visibility=t)}getPaintProperty(e){return B(e,Es)?this._transitionablePaint.getTransition(e.slice(0,-Es.length)):this._transitionablePaint.getValue(e)}setPaintProperty(e,t,i={}){if(null!=t&&this._validate(Or,`layers.${this.id}.paint.${e}`,e,t,i))return!1;if(B(e,Es))return this._transitionablePaint.setTransition(e.slice(0,-Es.length),t||void 0),!1;{const i=this._transitionablePaint._values[e],n="cross-faded-data-driven"===i.property.specification["property-type"],r=i.value.isDataDriven(),o=i.value;this._transitionablePaint.setValue(e,t),this._handleSpecialPaintPropertyUpdate(e);const a=this._transitionablePaint._values[e].value;return a.isDataDriven()||r||n||this._handleOverridablePaintPropertyUpdate(e,o,a)}}_handleSpecialPaintPropertyUpdate(e){}getProgramIds(){return null}getProgramConfiguration(e){return null}_handleOverridablePaintPropertyUpdate(e,t,i){return!1}isHidden(e){return!!(this.minzoom&&e=this.maxzoom)||"none"===this.visibility}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,t){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,t)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,t)}serialize(){const e={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&&(e.layout=e.layout||{},e.layout.visibility=this.visibility),$(e,((e,t)=>!(void 0===e||"layout"===t&&!Object.keys(e).length||"paint"===t&&!Object.keys(e).length)))}_validate(e,t,i,n,r={}){return(!r||!1!==r.validate)&&Br(this,e.call(zr,{key:t,layerType:this.type,objectKey:i,value:n,styleSpec:Ye,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isSky(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const e in this.paint._values){const t=this.paint.get(e);if(t instanceof Ho&&Pn(t.property.specification)&&("source"===t.value.kind||"composite"===t.value.kind)&&t.value.isStateDependent)return!0}return!1}compileFilter(){this._filterCompiled||(this._featureFilter=ar(this.filter),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}}const As=aa([{name:"a_pos",components:2,type:"Int16"}],4),Ms=aa([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class Is{constructor(e=[]){this.segments=e}prepareSegment(e,t,i,n){let r=this.segments[this.segments.length-1];return e>Is.MAX_VERTEX_ARRAY_LENGTH&&U(`Max vertices per segment is ${Is.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!r||r.vertexLength+e>Is.MAX_VERTEX_ARRAY_LENGTH||r.sortKey!==n)&&(r={vertexOffset:t.length,primitiveOffset:i.length,vertexLength:0,primitiveLength:0},void 0!==n&&(r.sortKey=n),this.segments.push(r)),r}get(){return this.segments}destroy(){for(const e of this.segments)for(const t in e.vaos)e.vaos[t].destroy()}static simpleSegment(e,t,i,n){return new Is([{vertexOffset:e,primitiveOffset:t,vertexLength:i,primitiveLength:n,vaos:{},sortKey:0}])}}Is.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Nr(Is,"SegmentVector");var Ps=8192;class Ds{constructor(e,t){e&&(t?this.setSouthWest(e).setNorthEast(t):4===e.length?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1]))}setNorthEast(e){return this._ne=e instanceof Os?new Os(e.lng,e.lat):Os.convert(e),this}setSouthWest(e){return this._sw=e instanceof Os?new Os(e.lng,e.lat):Os.convert(e),this}extend(e){const t=this._sw,i=this._ne;let n,r;if(e instanceof Os)n=e,r=e;else{if(!(e instanceof Ds))return Array.isArray(e)?4===e.length||e.every(Array.isArray)?this.extend(Ds.convert(e)):this.extend(Os.convert(e)):"object"==typeof e&&null!==e&&e.hasOwnProperty("lat")&&e.hasOwnProperty("lon")?this.extend(Os.convert(e)):this;if(n=e._sw,r=e._ne,!n||!r)return this}return t||i?(t.lng=Math.min(n.lng,t.lng),t.lat=Math.min(n.lat,t.lat),i.lng=Math.max(r.lng,i.lng),i.lat=Math.max(r.lat,i.lat)):(this._sw=new Os(n.lng,n.lat),this._ne=new Os(r.lng,r.lat)),this}getCenter(){return new Os((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new Os(this.getWest(),this.getNorth())}getSouthEast(){return new Os(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){const{lng:t,lat:i}=Os.convert(e);let n=this._sw.lng<=t&&t<=this._ne.lng;return this._sw.lng>this._ne.lng&&(n=this._sw.lng>=t&&t>=this._ne.lng),this._sw.lat<=i&&i<=this._ne.lat&&n}static convert(e){return!e||e instanceof Ds?e:new Ds(e)}}const zs=6371008.8;class Os{constructor(e,t){if(isNaN(e)||isNaN(t))throw new Error(`Invalid LngLat object: (${e}, ${t})`);if(this.lng=+e,this.lat=+t,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Os(k(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const t=Math.PI/180,i=this.lat*t,n=e.lat*t,r=Math.sin(i)*Math.sin(n)+Math.cos(i)*Math.cos(n)*Math.cos((e.lng-this.lng)*t);return zs*Math.acos(Math.min(r,1))}toBounds(e=0){const t=360*e/40075017,i=t/Math.cos(Math.PI/180*this.lat);return new Ds(new Os(this.lng-i,this.lat-t),new Os(this.lng+i,this.lat+t))}static convert(e){if(e instanceof Os)return e;if(Array.isArray(e)&&(2===e.length||3===e.length))return new Os(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&"object"==typeof e&&null!==e)return new Os(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")}}const Ls=2*Math.PI*zs;function Rs(e){return Ls*Math.cos(e*Math.PI/180)}function Bs(e){return(180+e)/360}function Fs(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function $s(e,t){return e/Rs(t)}function js(e){return 360*e-180}function Ns(e){return 360/Math.PI*Math.atan(Math.exp((180-360*e)*Math.PI/180))-90}function Us(e,t){return e*Rs(Ns(t))}const Vs=85.051129;function Gs(e){return 1/Math.cos(e*Math.PI/180)}class qs{constructor(e,t,i=0){this.x=+e,this.y=+t,this.z=+i}static fromLngLat(e,t=0){const i=Os.convert(e);return new qs(Bs(i.lng),Fs(i.lat),$s(t,i.lat))}toLngLat(){return new Os(js(this.x),Ns(this.y))}toAltitude(){return Us(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/Ls*Gs(Ns(this.y))}}function Ws(e,t,i,n,r,o,a,s,l){const c=(t+n)/2,u=(i+r)/2,h=new m(c,u);s(h),function(e,t,i,n,r,o){const a=i-r,s=n-o;return Math.abs((n-t)*a-(i-e)*s)/Math.hypot(a,s)}(h.x,h.y,o.x,o.y,a.x,a.y)>=l?(Ws(e,t,i,c,u,o,h,s,l),Ws(e,c,u,n,r,h,a,s,l)):e.push(a)}function Zs(e,t,i){let n=e[0],r=n.x,o=n.y;t(n);const a=[n];for(let s=1;se.x+1||ne.y+1)&&U("Geometry exceeds allowed extent, reduce your vector tile buffer size"),e}function Qs(e,t,i){const n=e.loadGeometry(),r=e.extent,o=Ps/r;if(t&&i&&i.projection.isReprojectedInTileSpace){const o=1<{const i=js((t.x+e.x/r)/o),n=Ns((t.y+e.y/r)/o),u=c.project(i,n);e.x=(u.x*a-s)*r,e.y=(u.y*a-l)*r};for(let t=0;t=r||i.y<0||i.y>=r||(u(i),e.push(i));n[t]=e}}for(const e of n)for(const t of e)Js(t,o);return n}function el(e,t){return{type:e.type,id:e.id,properties:e.properties,geometry:t?Qs(e):[]}}function tl(e,t,i,n,r){e.emplaceBack(2*t+(n+1)/2,2*i+(r+1)/2)}function il(e,t,i){const n=16384;e.emplaceBack(t.x,t.y,t.z,i[0]*n,i[1]*n,i[2]*n)}class nl{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.id)),this.index=e.index,this.hasPattern=!1,this.projection=e.projection,this.layoutVertexArray=new la,this.indexArray=new Ca,this.segments=new Is,this.programConfigurations=new xs(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id))}populate(e,t,i,n){const r=this.layers[0],o=[];let a=null;"circle"===r.type&&(a=r.layout.get("circle-sort-key"));for(const{feature:t,id:r,index:s,sourceLayerIndex:l}of e){const e=this.layers[0]._featureFilter.needGeometry,c=el(t,e);if(!this.layers[0]._featureFilter.filter(new No(this.zoom),c,i))continue;const u=a?a.evaluate(c,{},i):void 0,h={id:r,properties:t.properties,type:t.type,sourceLayerIndex:l,index:s,geometry:e?c.geometry:Qs(t,i,n),patterns:{},sortKey:u};o.push(h)}a&&o.sort(((e,t)=>e.sortKey-t.sortKey));let s=null;"globe"===n.projection.name&&(this.globeExtVertexArray=new Ha,s=n.projection);for(const n of o){const{geometry:r,index:o,sourceLayerIndex:a}=n,l=e[o].feature;this.addFeature(n,r,o,t.availableImages,i,s),t.featureIndex.insert(l,r,o,a,this.index)}}update(e,t,i,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,i,n)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,As.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,Ms.members))),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy())}addFeature(e,t,i,n,r,o){for(const i of t)for(const t of i){const i=t.x,n=t.y;if(i<0||i>=Ps||n<0||n>=Ps)continue;if(o){const e=o.projectTilePoint(i,n,r),t=o.upVector(r,i,n),a=this.globeExtVertexArray;il(a,e,t),il(a,e,t),il(a,e,t),il(a,e,t)}const a=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),s=a.vertexLength;tl(this.layoutVertexArray,i,n,-1,-1),tl(this.layoutVertexArray,i,n,1,-1),tl(this.layoutVertexArray,i,n,1,1),tl(this.layoutVertexArray,i,n,-1,1),this.indexArray.emplaceBack(s,s+1,s+2),this.indexArray.emplaceBack(s,s+2,s+3),a.vertexLength+=4,a.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,{},n,r)}}function rl(e,t){for(let i=0;i1){if(ll(e,t))return!0;for(let n=0;n1?i:i.sub(t)._mult(r)._add(t))}function dl(e,t){let i,n,r,o=!1;for(let a=0;at.y!=r.y>t.y&&t.x<(r.x-n.x)*(t.y-n.y)/(r.y-n.y)+n.x&&(o=!o)}return o}function pl(e,t){let i=!1;for(let n=0,r=e.length-1;nt.y!=a.y>t.y&&t.x<(a.x-o.x)*(t.y-o.y)/(a.y-o.y)+o.x&&(i=!i)}return i}function fl(e,t,i,n,r){for(const o of e)if(t<=o.x&&i<=o.y&&n>=o.x&&r>=o.y)return!0;const o=[new m(t,i),new m(t,r),new m(n,r),new m(n,i)];if(e.length>2)for(const t of o)if(pl(e,t))return!0;for(let t=0;tr.x&&t.x>r.x||e.yr.y&&t.y>r.y)return!1;const o=V(e,t,i[0]);return o!==V(e,t,i[1])||o!==V(e,t,i[2])||o!==V(e,t,i[3])}function gl(e,t,i){const n=t.paint.get(e).value;return"constant"===n.kind?n.value:i.programConfigurations.get(t.id).getMaxValue(e)}function _l(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function vl(e,t,i,n,r){if(!t[0]&&!t[1])return e;const o=m.convert(t)._mult(r);"viewport"===i&&o._rotate(-n);const a=[];for(let t=0;t0&&(o=1/Math.sqrt(o)),e[0]=t[0]*o,e[1]=t[1]*o,e[2]=t[2]*o,e}function Hl(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Xl(e,t,i){var n=t[0],r=t[1],o=t[2],a=i[0],s=i[1],l=i[2];return e[0]=r*l-o*s,e[1]=o*a-n*l,e[2]=n*s-r*a,e}function Yl(e,t,i){var n=t[0],r=t[1],o=t[2],a=i[3]*n+i[7]*r+i[11]*o+i[15];return e[0]=(i[0]*n+i[4]*r+i[8]*o+i[12])/(a=a||1),e[1]=(i[1]*n+i[5]*r+i[9]*o+i[13])/a,e[2]=(i[2]*n+i[6]*r+i[10]*o+i[14])/a,e}function Kl(e,t,i){var n=i[0],r=i[1],o=i[2],a=t[0],s=t[1],l=t[2],c=r*l-o*s,u=o*a-n*l,h=n*s-r*a,d=r*h-o*u,p=o*c-n*h,f=n*u-r*c,m=2*i[3];return u*=m,h*=m,p*=2,f*=2,e[0]=a+(c*=m)+(d*=2),e[1]=s+u+p,e[2]=l+h+f,e}var Jl,Ql=Nl,ec=Ul,tc=Fl;function ic(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e}function nc(e,t){var i=t[0],n=t[1],r=t[2],o=t[3],a=i*i+n*n+r*r+o*o;return a>0&&(a=1/Math.sqrt(a)),e[0]=i*a,e[1]=n*a,e[2]=r*a,e[3]=o*a,e}function rc(e,t,i){var n=t[0],r=t[1],o=t[2],a=t[3];return e[0]=i[0]*n+i[4]*r+i[8]*o+i[12]*a,e[1]=i[1]*n+i[5]*r+i[9]*o+i[13]*a,e[2]=i[2]*n+i[6]*r+i[10]*o+i[14]*a,e[3]=i[3]*n+i[7]*r+i[11]*o+i[15]*a,e}function oc(){var e=new Tl(4);return Tl!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function ac(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function sc(e,t,i){i*=.5;var n=t[0],r=t[1],o=t[2],a=t[3],s=Math.sin(i),l=Math.cos(i);return e[0]=n*l+a*s,e[1]=r*l+o*s,e[2]=o*l-r*s,e[3]=a*l-n*s,e}function lc(e,t,i){i*=.5;var n=t[0],r=t[1],o=t[2],a=t[3],s=Math.sin(i),l=Math.cos(i);return e[0]=n*l-o*s,e[1]=r*l+a*s,e[2]=o*l+n*s,e[3]=a*l-r*s,e}Rl(),Jl=new Tl(4),Tl!=Float32Array&&(Jl[0]=0,Jl[1]=0,Jl[2]=0,Jl[3]=0);var cc=nc;Rl(),$l(1,0,0),$l(0,1,0),oc(),oc(),Cl();class uc{constructor(e,t){this.pos=e,this.dir=t}intersectsPlane(e,t,i){const n=Hl(t,this.dir);if(Math.abs(n)<1e-6)return!1;const r=((e[0]-this.pos[0])*t[0]+(e[1]-this.pos[1])*t[1]+(e[2]-this.pos[2])*t[2])/n;return i[0]=this.pos[0]+this.dir[0]*r,i[1]=this.pos[1]+this.dir[1]*r,i[2]=this.pos[2]+this.dir[2]*r,!0}closestPointOnSphere(e,t,i){if(function(e,t){var i=e[0],n=e[1],r=e[2],o=t[0],a=t[1],s=t[2];return Math.abs(i-o)<=wl*Math.max(1,Math.abs(i),Math.abs(o))&&Math.abs(n-a)<=wl*Math.max(1,Math.abs(n),Math.abs(a))&&Math.abs(r-s)<=wl*Math.max(1,Math.abs(r),Math.abs(s))}(this.pos,e)||0===t)return i[0]=i[1]=i[2]=0,!1;const[n,r,o]=this.dir,a=this.pos[0]-e[0],s=this.pos[1]-e[1],l=this.pos[2]-e[2],c=n*n+r*r+o*o,u=2*(a*n+s*r+l*o),h=u*u-4*c*(a*a+s*s+l*l-t*t);if(h<0){const e=Math.max(-u/2,0),c=a+n*e,h=s+r*e,d=l+o*e,p=Math.hypot(c,h,d);return i[0]=c*t/p,i[1]=h*t/p,i[2]=d*t/p,!1}{const e=(-u-Math.sqrt(h))/(2*c);if(e<0){const e=Math.hypot(a,s,l);return i[0]=a*t/e,i[1]=s*t/e,i[2]=l*t/e,!1}return i[0]=a+n*e,i[1]=s+r*e,i[2]=l+o*e,!0}}}class hc{constructor(e,t,i,n,r){this.TL=e,this.TR=t,this.BR=i,this.BL=n,this.horizon=r}static fromInvProjectionMatrix(e,t,i){const n=[-1,1,1],r=[1,1,1],o=[1,-1,1],a=[-1,-1,1],s=Yl(n,n,e),l=Yl(r,r,e),c=Yl(o,o,e),u=Yl(a,a,e);return new hc(s,l,c,u,t/i)}}class dc{constructor(e,t){this.points=e,this.planes=t}static fromInvProjectionMatrix(e,t,i,n){const r=Math.pow(2,i),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((i=>{const o=rc([],i,e),a=1/o[3]/t*r;return function(e,t,i){return e[0]=t[0]*i[0],e[1]=t[1]*i[1],e[2]=t[2]*i[2],e[3]=t[3]*i[3],e}(o,o,[a,a,n?1/o[3]:a,a])})),a=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map((e=>{const t=Zl([],Xl([],Ql([],o[e[0]],o[e[1]]),Ql([],o[e[2]],o[e[1]]))),i=-Hl(t,o[e[1]]);return t.concat(i)}));return new dc(o,a)}}class pc{static fromPoints(e){const t=[1/0,1/0,1/0],i=[-1/0,-1/0,-1/0];for(const n of e)Vl(t,t,n),Gl(i,i,n);return new pc(t,i)}static applyTransform(e,t){const i=e.getCorners();for(let e=0;e=0;if(0===o)return 0;o!==t.length&&(i=!1)}if(i)return 2;for(let t=0;t<3;t++){let i=Number.MAX_VALUE,n=-Number.MAX_VALUE;for(let r=0;rthis.max[t]-this.min[t])return 0}return 1}}function fc(e,t,i,n,r,o,a,s,l){if(o&&e.queryGeometry.isAboveHorizon)return!1;o&&(l*=e.pixelToTileUnitsFactor);const c=e.tileID.canonical,u=i.projection.upVectorScale(c,i.center.lat,i.worldSize).metersToTile;for(const h of t)for(const t of h){const h=t.add(s),d=r&&i.elevation?i.elevation.exaggeration()*r.getElevationAt(h.x,h.y,!0):0,p=i.projection.projectTilePoint(h.x,h.y,c);if(d>0){const e=i.projection.upVector(c,h.x,h.y);p.x+=e[0]*u*d,p.y+=e[1]*u*d,p.z+=e[2]*u*d}const f=o?h:mc(p.x,p.y,p.z,n),m=o?e.tilespaceRays.map((e=>vc(e,d))):e.queryGeometry.screenGeometry,g=rc([],[p.x,p.y,p.z,1],n);if(!a&&o?l*=g[3]/i.cameraToCenterDistance:a&&!o&&(l*=i.cameraToCenterDistance/g[3]),o){const e=Ns((t.y/Ps+c.y)/(1<e.width||r.height>e.height||i.x>e.width-r.width||i.y>e.height-r.height)throw new RangeError("out of range source coordinates for image copy");if(r.width>t.width||r.height>t.height||n.x>t.width-r.width||n.y>t.height-r.height)throw new RangeError("out of range destination coordinates for image copy");const a=e.data,s=t.data;for(let l=0;l{t[e.evaluationKey]=o;const a=e.expression.evaluate(t);r.data[i+n+0]=Math.floor(255*a.r/a.a),r.data[i+n+1]=Math.floor(255*a.g/a.a),r.data[i+n+2]=Math.floor(255*a.b/a.a),r.data[i+n+3]=Math.floor(255*a.a)};if(e.clips)for(let t=0,r=0;t80*i){n=o=e[0],r=a=e[1];for(var f=i;fo&&(o=s),l>a&&(a=l);c=0!==(c=Math.max(o-n,a-r))?32767/c:0}return Oc(d,p,i,n,r,c,0),p}function Dc(e,t,i,n,r){var o,a;if(r===iu(e,t,i,n)>0)for(o=t;o=t;o-=n)a=Qc(o,e[o],e[o+1],a);return a&&Zc(a,a.next)&&(eu(a),a=a.next),a}function zc(e,t){if(!e)return e;t||(t=e);var i,n=e;do{if(i=!1,n.steiner||!Zc(n,n.next)&&0!==Wc(n.prev,n,n.next))n=n.next;else{if(eu(n),(n=t=n.prev)===n.next)break;i=!0}}while(i||n!==t);return t}function Oc(e,t,i,n,r,o,a){if(e){!a&&o&&function(e,t,i,n){var r=e;do{0===r.z&&(r.z=Uc(r.x,r.y,t,i,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==e);r.prevZ.nextZ=null,r.prevZ=null,function(e){var t,i,n,r,o,a,s,l,c=1;do{for(i=e,e=null,o=null,a=0;i;){for(a++,n=i,s=0,t=0;t0||l>0&&n;)0!==s&&(0===l||!n||i.z<=n.z)?(r=i,i=i.nextZ,s--):(r=n,n=n.nextZ,l--),o?o.nextZ=r:e=r,r.prevZ=o,o=r;i=n}o.nextZ=null,c*=2}while(a>1)}(r)}(e,n,r,o);for(var s,l,c=e;e.prev!==e.next;)if(s=e.prev,l=e.next,o?Rc(e,n,r,o):Lc(e))t.push(s.i/i|0),t.push(e.i/i|0),t.push(l.i/i|0),eu(e),e=l.next,c=l.next;else if((e=l)===c){a?1===a?Oc(e=Bc(zc(e),t,i),t,i,n,r,o,2):2===a&&Fc(e,t,i,n,r,o):Oc(zc(e),t,i,n,r,o,1);break}}}function Lc(e){var t=e.prev,i=e,n=e.next;if(Wc(t,i,n)>=0)return!1;for(var r=t.x,o=i.x,a=n.x,s=t.y,l=i.y,c=n.y,u=ro?r>a?r:a:o>a?o:a,p=s>l?s>c?s:c:l>c?l:c,f=n.next;f!==t;){if(f.x>=u&&f.x<=d&&f.y>=h&&f.y<=p&&Gc(r,s,o,l,a,c,f.x,f.y)&&Wc(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function Rc(e,t,i,n){var r=e.prev,o=e,a=e.next;if(Wc(r,o,a)>=0)return!1;for(var s=r.x,l=o.x,c=a.x,u=r.y,h=o.y,d=a.y,p=sl?s>c?s:c:l>c?l:c,g=u>h?u>d?u:d:h>d?h:d,_=Uc(p,f,t,i,n),v=Uc(m,g,t,i,n),y=e.prevZ,x=e.nextZ;y&&y.z>=_&&x&&x.z<=v;){if(y.x>=p&&y.x<=m&&y.y>=f&&y.y<=g&&y!==r&&y!==a&&Gc(s,u,l,h,c,d,y.x,y.y)&&Wc(y.prev,y,y.next)>=0)return!1;if(y=y.prevZ,x.x>=p&&x.x<=m&&x.y>=f&&x.y<=g&&x!==r&&x!==a&&Gc(s,u,l,h,c,d,x.x,x.y)&&Wc(x.prev,x,x.next)>=0)return!1;x=x.nextZ}for(;y&&y.z>=_;){if(y.x>=p&&y.x<=m&&y.y>=f&&y.y<=g&&y!==r&&y!==a&&Gc(s,u,l,h,c,d,y.x,y.y)&&Wc(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;x&&x.z<=v;){if(x.x>=p&&x.x<=m&&x.y>=f&&x.y<=g&&x!==r&&x!==a&&Gc(s,u,l,h,c,d,x.x,x.y)&&Wc(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function Bc(e,t,i){var n=e;do{var r=n.prev,o=n.next.next;!Zc(r,o)&&Hc(r,n,n.next,o)&&Kc(r,o)&&Kc(o,r)&&(t.push(r.i/i|0),t.push(n.i/i|0),t.push(o.i/i|0),eu(n),eu(n.next),n=e=o),n=n.next}while(n!==e);return zc(n)}function Fc(e,t,i,n,r,o){var a=e;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&qc(a,s)){var l=Jc(a,s);return a=zc(a,a.next),l=zc(l,l.next),Oc(a,t,i,n,r,o,0),void Oc(l,t,i,n,r,o,0)}s=s.next}a=a.next}while(a!==e)}function $c(e,t){return e.x-t.x}function jc(e,t){var i=function(e,t){var i,n=t,r=e.x,o=e.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<=r&&s>a&&(a=s,i=n.x=n.x&&n.x>=u&&r!==n.x&&Gc(oi.x||n.x===i.x&&Nc(i,n)))&&(i=n,d=l)),n=n.next}while(n!==c);return i}(e,t);if(!i)return t;var n=Jc(i,e);return zc(n,n.next),zc(i,i.next)}function Nc(e,t){return Wc(e.prev,e,t.prev)<0&&Wc(t.next,e,e.next)<0}function Uc(e,t,i,n,r){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-i)*r|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-n)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function Vc(e){var t=e,i=e;do{(t.x=(e-a)*(o-s)&&(e-a)*(n-s)>=(i-a)*(t-s)&&(i-a)*(o-s)>=(r-a)*(n-s)}function qc(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var i=e;do{if(i.i!==e.i&&i.next.i!==e.i&&i.i!==t.i&&i.next.i!==t.i&&Hc(i,i.next,e,t))return!0;i=i.next}while(i!==e);return!1}(e,t)&&(Kc(e,t)&&Kc(t,e)&&function(e,t){var i=e,n=!1,r=(e.x+t.x)/2,o=(e.y+t.y)/2;do{i.y>o!=i.next.y>o&&i.next.y!==i.y&&r<(i.next.x-i.x)*(o-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next}while(i!==e);return n}(e,t)&&(Wc(e.prev,e,t.prev)||Wc(e,t.prev,t))||Zc(e,t)&&Wc(e.prev,e,e.next)>0&&Wc(t.prev,t,t.next)>0)}function Wc(e,t,i){return(t.y-e.y)*(i.x-t.x)-(t.x-e.x)*(i.y-t.y)}function Zc(e,t){return e.x===t.x&&e.y===t.y}function Hc(e,t,i,n){var r=Yc(Wc(e,t,i)),o=Yc(Wc(e,t,n)),a=Yc(Wc(i,n,e)),s=Yc(Wc(i,n,t));return r!==o&&a!==s||!(0!==r||!Xc(e,i,t))||!(0!==o||!Xc(e,n,t))||!(0!==a||!Xc(i,e,n))||!(0!==s||!Xc(i,t,n))}function Xc(e,t,i){return t.x<=Math.max(e.x,i.x)&&t.x>=Math.min(e.x,i.x)&&t.y<=Math.max(e.y,i.y)&&t.y>=Math.min(e.y,i.y)}function Yc(e){return e>0?1:e<0?-1:0}function Kc(e,t){return Wc(e.prev,e,e.next)<0?Wc(e,t,e.next)>=0&&Wc(e,e.prev,t)>=0:Wc(e,t,e.prev)<0||Wc(e,e.next,t)<0}function Jc(e,t){var i=new tu(e.i,e.x,e.y),n=new tu(t.i,t.x,t.y),r=e.next,o=t.prev;return e.next=t,t.prev=e,i.next=r,r.prev=i,n.next=i,i.prev=n,o.next=n,n.prev=o,n}function Qc(e,t,i,n){var r=new tu(e,t,i);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function eu(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function tu(e,t,i){this.i=e,this.x=t,this.y=i,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function iu(e,t,i,n){for(var r=0,o=t,a=i-n;oi;){if(n-i>600){var o=n-i+1,a=t-i+1,s=Math.log(o),l=.5*Math.exp(2*s/3),c=.5*Math.sqrt(s*l*(o-l)/o)*(a-o/2<0?-1:1);ru(e,t,Math.max(i,Math.floor(t-a*l/o+c)),Math.min(n,Math.floor(t+(o-a)*l/o+c)),r)}var u=e[t],h=i,d=n;for(ou(e,i,t),r(e[n],u)>0&&ou(e,i,n);h0;)d--}0===r(e[i],u)?ou(e,i,d):ou(e,++d,n),d<=t&&(i=d+1),t<=d&&(n=d-1)}}function ou(e,t,i){var n=e[t];e[t]=e[i],e[i]=n}function au(e,t){return et?1:0}function su(e,t){const i=e.length;if(i<=1)return[e];const n=[];let r,o;for(let t=0;t1)for(let e=0;e0&&i.holes.push(n+=e[r-1].length)}return i};class hu{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.id)),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new la,this.indexArray=new Ca,this.indexArray2=new Ia,this.programConfigurations=new xs(e.layers,e.zoom),this.segments=new Is,this.segments2=new Is,this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id)),this.projection=e.projection}populate(e,t,i,n){this.hasPattern=cu("fill",this.layers,t);const r=this.layers[0].layout.get("fill-sort-key"),o=[];for(const{feature:a,id:s,index:l,sourceLayerIndex:c}of e){const e=this.layers[0]._featureFilter.needGeometry,u=el(a,e);if(!this.layers[0]._featureFilter.filter(new No(this.zoom),u,i))continue;const h=r?r.evaluate(u,{},i,t.availableImages):void 0,d={id:s,properties:a.properties,type:a.type,sourceLayerIndex:c,index:l,geometry:e?u.geometry:Qs(a,i,n),patterns:{},sortKey:h};o.push(d)}r&&o.sort(((e,t)=>e.sortKey-t.sortKey));for(const n of o){const{geometry:r,index:o,sourceLayerIndex:a}=n;if(this.hasPattern){const e=uu("fill",this.layers,n,this.zoom,t);this.patternFeatures.push(e)}else this.addFeature(n,r,o,i,{},t.availableImages);t.featureIndex.insert(e[o].feature,r,o,a,this.index)}}update(e,t,i,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,i,n)}addFeatures(e,t,i,n,r){for(const e of this.patternFeatures)this.addFeature(e,e.geometry,e.index,t,i,n)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Mc),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(e,t,i,n,r,o=[]){for(const e of su(t,500)){let t=0;for(const i of e)t+=i.length;const i=this.segments.prepareSegment(t,this.layoutVertexArray,this.indexArray),n=i.vertexLength,r=[],o=[];for(const t of e){if(0===t.length)continue;t!==e[0]&&o.push(r.length/2);const i=this.segments2.prepareSegment(t.length,this.layoutVertexArray,this.indexArray2),n=i.vertexLength;this.layoutVertexArray.emplaceBack(t[0].x,t[0].y),this.indexArray2.emplaceBack(n+t.length-1,n),r.push(t[0].x),r.push(t[0].y);for(let e=1;e>3}if(r--,1===n||2===n)o+=e.readSVarint(),a+=e.readSVarint(),1===n&&(t&&s.push(t),t=[]),t.push(new yu(o,a));else{if(7!==n)throw new Error("unknown command "+n);t&&t.push(t[0].clone())}}return t&&s.push(t),s},bu.prototype.bbox=function(){var e=this._pbf;e.pos=this._geometry;for(var t=e.readVarint()+e.pos,i=1,n=0,r=0,o=0,a=1/0,s=-1/0,l=1/0,c=-1/0;e.pos>3}if(n--,1===i||2===i)(r+=e.readSVarint())s&&(s=r),(o+=e.readSVarint())c&&(c=o);else if(7!==i)throw new Error("unknown command "+i)}return[a,l,s,c]},bu.prototype.toGeoJSON=function(e,t,i){var n,r,o=this.extent*Math.pow(2,i),a=this.extent*e,s=this.extent*t,l=this.loadGeometry(),c=bu.types[this.type];function u(e){for(var t=0;t>3;t=1===n?e.readString():2===n?e.readFloat():3===n?e.readDouble():4===n?e.readVarint64():5===n?e.readVarint():6===n?e.readSVarint():7===n?e.readBoolean():null}return t}(i))}Eu.prototype.feature=function(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];var t=this._pbf.readVarint()+this._pbf.pos;return new Cu(this._pbf,t,this.extent,this._keys,this._values)};var Au=Su;function Mu(e,t,i){if(3===e){var n=new Au(i,i.readVarint()+i.pos);n.length&&(t[n.name]=n)}}var Iu=vu.VectorTile=function(e,t){this.layers=e.readFields(Mu,{},t)},Pu=vu.VectorTileFeature=xu;function Du(e,t,i,n){const r=[],o=0===n?(e,t,i,n,r,o)=>{e.push(new m(o,i+(o-t)/(n-t)*(r-i)))}:(e,t,i,n,r,o)=>{e.push(new m(t+(o-i)/(r-i)*(n-t),o))};for(const a of e){const e=[];for(const r of a){if(r.length<=2)continue;const a=[];for(let e=0;et&&o(a,s,l,c,u,t):h>i?d=t&&o(a,s,l,c,u,t),d>i&&h<=i&&o(a,s,l,c,u,i)}let s=r[r.length-1];const l=0===n?s.x:s.y;l>=t&&l<=i&&a.push(s),a.length&&(s=a[a.length-1],a[0].x===s.x&&a[0].y===s.y||a.push(a[0]),e.push(a))}e.length&&r.push(e)}return r}vu.VectorTileLayer=Su;const zu=Pu.types,Ou=Math.pow(2,13);function Lu(e,t,i,n,r,o,a,s){e.emplaceBack((t<<1)+a,(i<<1)+o,(Math.floor(n*Ou)<<1)+r,Math.round(s))}function Ru(e,t,i){const n=16384;e.emplaceBack(t.x,t.y,t.z,i[0]*n,i[1]*n,i[2]*n)}class Bu{constructor(){this.acc=new m(0,0),this.polyCount=[]}startRing(e){this.currentPolyCount={edges:0,top:0},this.polyCount.push(this.currentPolyCount),this.min||(this.min=new m(e.x,e.y),this.max=new m(e.x,e.y))}append(e,t){this.currentPolyCount.edges++,this.acc._add(e);const i=this.min,n=this.max;e.xn.x&&(n.x=e.x),e.yn.y&&(n.y=e.y),((0===e.x||e.x===Ps)&&e.x===t.x)!=((0===e.y||e.y===Ps)&&e.y===t.y)&&this.processBorderOverlap(e,t),t.x<0!=e.x<0&&this.addBorderIntersection(0,ki(t.y,e.y,(0-t.x)/(e.x-t.x))),t.x>Ps!=e.x>Ps&&this.addBorderIntersection(1,ki(t.y,e.y,(Ps-t.x)/(e.x-t.x))),t.y<0!=e.y<0&&this.addBorderIntersection(2,ki(t.x,e.x,(0-t.y)/(e.y-t.y))),t.y>Ps!=e.y>Ps&&this.addBorderIntersection(3,ki(t.x,e.x,(Ps-t.y)/(e.y-t.y)))}addBorderIntersection(e,t){this.borders||(this.borders=[[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE]]);const i=this.borders[e];ti[1]&&(i[1]=t)}processBorderOverlap(e,t){if(e.x===t.x){if(e.y===t.y)return;const i=0===e.x?0:1;this.addBorderIntersection(i,t.y),this.addBorderIntersection(i,e.y)}else{const i=0===e.y?2:3;this.addBorderIntersection(i,t.x),this.addBorderIntersection(i,e.x)}}centroid(){const e=this.polyCount.reduce(((e,t)=>e+t.edges),0);return 0!==e?this.acc.div(e)._round():new m(0,0)}span(){return new m(this.max.x-this.min.x,this.max.y-this.min.y)}intersectsCount(){return this.borders.reduce(((e,t)=>e+ +(t[0]!==Number.MAX_VALUE)),0)}}class Fu{constructor(e){this.zoom=e.zoom,this.canonical=e.canonical,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.id)),this.index=e.index,this.hasPattern=!1,this.edgeRadius=0,this.projection=e.projection,this.layoutVertexArray=new ua,this.centroidVertexArray=new Wa,this.indexArray=new Ca,this.programConfigurations=new xs(e.layers,e.zoom),this.segments=new Is,this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id)),this.enableTerrain=e.enableTerrain}populate(e,t,i,n){this.features=[],this.hasPattern=cu("fill-extrusion",this.layers,t),this.featuresOnBorder=[],this.borders=[[],[],[],[]],this.borderDoneWithNeighborZ=[-1,-1,-1,-1],this.tileToMeter=function(e){const t=Math.exp(Math.PI*(1-e.y/(1<=0;e--){const t=d[e];(0===t.length||(p=t[0]).every((e=>e.x<=0))||p.every((e=>e.x>=Ps))||p.every((e=>e.y<=0))||p.every((e=>e.y>=Ps)))&&d.splice(e,1)}var p;let f;if(c)f=Wu(d,s,n);else{f=[];for(const e of d)f.push({polygon:e,bounds:s})}const g=h?this.edgeRadius:0;for(const{polygon:e,bounds:t}of f){let i=0,r=0;for(const t of e)h&&!t[0].equals(t[t.length-1])&&t.push(t[0]),r+=h?t.length-1:t.length;const o=this.segments.prepareSegment((h?5:4)*r,this.layoutVertexArray,this.indexArray);if(h){const t=[],r=[];i=o.vertexLength;for(const i of e){let a,s;i.length&&i!==e[0]&&r.push(t.length/2),a=i[1].sub(i[0])._perp()._unit();for(let e=1;e4&&Vu(r[r.length-2],r[0],r[1]),p=g?ju(r[r.length-2],r[0],r[1],g):0;a=r[1].sub(r[0])._perp()._unit();let f=!0;for(let m=1,_=0;m0?1:0,C=v.dist(y);if(_+C>32768&&(_=0),g){s=x.sub(y)._perp()._unit();let e=Nu(v,y,x,$u(a,s),g);isNaN(e)&&(e=0);const t=y.sub(v)._unit();v=v.add(t.mult(p))._round(),y=y.add(t.mult(-e))._round(),p=e,a=s}const S=o.vertexLength,E=r.length>4&&Vu(v,y,x);let k=Gu(_,d,f);if(Lu(this.layoutVertexArray,v.x,v.y,w,T,0,0,k),Lu(this.layoutVertexArray,v.x,v.y,w,T,0,1,k),_+=C,k=Gu(_,E,!f),d=E,Lu(this.layoutVertexArray,y.x,y.y,w,T,0,0,k),Lu(this.layoutVertexArray,y.x,y.y,w,T,0,1,k),o.vertexLength+=4,this.indexArray.emplaceBack(S+0,S+1,S+2),this.indexArray.emplaceBack(S+1,S+3,S+2),o.primitiveLength+=2,g){const n=i+(1===m?r.length-2:m-2),a=1===m?i:n+1;if(this.indexArray.emplaceBack(S+1,n,S+3),this.indexArray.emplaceBack(n,a,S+3),o.primitiveLength+=2,void 0===e&&(e=S),!Uu(x,r[m],t)){const t=m===r.length-1?e:o.vertexLength;this.indexArray.emplaceBack(S+2,S+3,t),this.indexArray.emplaceBack(S+3,t+1,t),this.indexArray.emplaceBack(S+3,a,t+1),o.primitiveLength+=3}f=!f}if(c){const e=this.layoutVertexExtArray,t=l.projectTilePoint(v.x,v.y,n),i=l.projectTilePoint(y.x,y.y,n),r=l.upVector(n,v.x,v.y),o=l.upVector(n,y.x,y.y);Ru(e,t,r),Ru(e,t,r),Ru(e,i,o),Ru(e,i,o)}}h&&(i+=r.length-1)}}if(u&&u.polyCount.length>0){if(u.borders){u.vertexArrayOffset=this.centroidVertexArray.length;const e=u.borders,t=this.featuresOnBorder.push(u)-1;for(let i=0;i<4;i++)e[i][0]!==Number.MAX_VALUE&&this.borders[i].push(t)}this.encodeCentroid(u.borders?void 0:u.centroid(),u)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,r,o,n)}sortBorders(){for(let e=0;e<4;e++)this.borders[e].sort(((t,i)=>this.featuresOnBorder[t].borders[e][0]-this.featuresOnBorder[i].borders[e][0]))}encodeCentroid(e,t,i=!0){let n,r;if(e)if(0!==e.y){const i=t.span()._mult(this.tileToMeter);n=(Math.max(e.x,1)<<3)+Math.min(7,Math.round(i.x/10)),r=(Math.max(e.y,1)<<3)+Math.min(7,Math.round(i.y/10))}else n=Math.ceil(7*(e.x+450)),r=0;else n=0,r=+i;let o=i?this.centroidVertexArray.length:t.vertexArrayOffset;for(const e of t.polyCount){i&&this.centroidVertexArray.resize(this.centroidVertexArray.length+4*e.edges+e.top);for(let t=0;ti[1].x&&t.x>i[1].x||e.yi[1].y&&t.y>i[1].y}function Vu(e,t,i){if(e.x<0||e.x>=Ps||t.x<0||t.x>=Ps||i.x<0||i.x>=Ps)return!1;const n=i.sub(t),r=n.perp(),o=e.sub(t);return(n.x*o.x+n.y*o.y)/Math.sqrt((n.x*n.x+n.y*n.y)*(o.x*o.x+o.y*o.y))>-.866&&r.x*o.x+r.y*o.y<0}function Gu(e,t,i){const n=t?2|e:-3&e;return i?1|n:-2&n}function qu(){const e=Math.PI/32,t=Math.tan(e),i=zs;return i*Math.sqrt(1+2*t*t)-i}function Wu(e,t,i){const n=1<{for(const i of e)a.push({polygon:i,bounds:t})},l=Math.ceil(Math.log2(i)),c=Math.ceil(Math.log2(n)),u=l-c,h=[];for(let e=0;e0?0:1);for(let e=0;et+1?p.push({polygons:d,bounds:e,depth:t+1}):s(d,e)}if(f.length){const e=[new m(0===i?u:n.x,1===i?u:n.y),a];h.length>t+1?p.push({polygons:f,bounds:e,depth:t+1}):s(f,e)}}return a}(e,t,Math.ceil((o-r)/11.25),Math.ceil((a-s)/11.25),1,((e,t,r)=>{if(0===e)return.5*(t+r);{const e=Ns((i.y+t/Ps)/n);return(Fs(.5*(Ns((i.y+r/Ps)/n)+e))*n-i.y)*Ps}}))}Nr(Fu,"FillExtrusionBucket",{omit:["layers","features"]}),Nr(Bu,"PartMetadata");const Zu=new ta({"fill-extrusion-edge-radius":new Yo(Ye["layout_fill-extrusion"]["fill-extrusion-edge-radius"])});var Hu={paint:new ta({"fill-extrusion-opacity":new Yo(Ye["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Ko(Ye["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Yo(Ye["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Yo(Ye["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Jo(Ye["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Ko(Ye["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Ko(Ye["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Yo(Ye["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]),"fill-extrusion-ambient-occlusion-intensity":new Yo(Ye["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-intensity"]),"fill-extrusion-ambient-occlusion-radius":new Yo(Ye["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-radius"])}),layout:Zu};function Xu(e,t,i){var n=2*Math.PI*6378137/256/Math.pow(2,i);return[e*n-2*Math.PI*6378137/2,t*n-2*Math.PI*6378137/2]}class Yu{constructor(e,t,i){this.z=e,this.x=t,this.y=i,this.key=Qu(0,e,e,t,i)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,t){const i=function(e,t,i){var n=Xu(256*e,256*(t=Math.pow(2,i)-t-1),i),r=Xu(256*(e+1),256*(t+1),i);return n[0]+","+n[1]+","+r[0]+","+r[1]}(this.x,this.y,this.z),n=function(e,t,i){let n,r="";for(let o=e;o>0;o--)n=1<this.canonical.z?new Ju(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Ju(e,this.wrap,e,this.canonical.x>>t,this.canonical.y>>t)}calculateScaledKey(e,t=!0){if(this.overscaledZ===e&&t)return this.key;if(e>this.canonical.z)return Qu(this.wrap*+t,e,this.canonical.z,this.canonical.x,this.canonical.y);{const i=this.canonical.z-e;return Qu(this.wrap*+t,e,e,this.canonical.x>>i,this.canonical.y>>i)}}isChildOf(e){if(e.wrap!==this.wrap)return!1;const t=this.canonical.z-e.canonical.z;return 0===e.overscaledZ||e.overscaledZ>t&&e.canonical.y===this.canonical.y>>t}children(e){if(this.overscaledZ>=e)return[new Ju(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const t=this.canonical.z+1,i=2*this.canonical.x,n=2*this.canonical.y;return[new Ju(t,this.wrap,t,i,n),new Ju(t,this.wrap,t,i+1,n),new Ju(t,this.wrap,t,i,n+1),new Ju(t,this.wrap,t,i+1,n+1)]}isLessThan(e){return this.wrape.wrap)&&(this.overscaledZe.overscaledZ)&&(this.canonical.xe.canonical.x)&&this.canonical.ye.id)),this.index=e.index,this.projection=e.projection,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach((e=>{this.gradients[e.id]={}})),this.layoutVertexArray=new ha,this.layoutVertexArray2=new da,this.indexArray=new Ca,this.programConfigurations=new xs(e.layers,e.zoom),this.segments=new Is,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id))}populate(e,t,i,n){this.hasPattern=cu("line",this.layers,t);const r=this.layers[0].layout.get("line-sort-key"),o=[];for(const{feature:t,id:a,index:s,sourceLayerIndex:l}of e){const e=this.layers[0]._featureFilter.needGeometry,c=el(t,e);if(!this.layers[0]._featureFilter.filter(new No(this.zoom),c,i))continue;const u=r?r.evaluate(c,{},i):void 0,h={id:a,properties:t.properties,type:t.type,sourceLayerIndex:l,index:s,geometry:e?c.geometry:Qs(t,i,n),patterns:{},sortKey:u};o.push(h)}r&&o.sort(((e,t)=>e.sortKey-t.sortKey));const{lineAtlas:a,featureIndex:s}=t,l=this.addConstantDashes(a);for(const n of o){const{geometry:r,index:o,sourceLayerIndex:c}=n;if(l&&this.addFeatureDashes(n,a),this.hasPattern){const e=uu("line",this.layers,n,this.zoom,t);this.patternFeatures.push(e)}else this.addFeature(n,r,o,i,a.positions,t.availableImages);s.insert(e[o].feature,r,o,c,this.index)}}addConstantDashes(e){let t=!1;for(const i of this.layers){const n=i.paint.get("line-dasharray").value,r=i.layout.get("line-cap").value;if("constant"!==n.kind||"constant"!==r.kind)t=!0;else{const t=r.value,i=n.value;if(!i)continue;e.addDash(i.from,t),e.addDash(i.to,t),i.other&&e.addDash(i.other,t)}}return t}addFeatureDashes(e,t){const i=this.zoom;for(const n of this.layers){const r=n.paint.get("line-dasharray").value,o=n.layout.get("line-cap").value;if("constant"===r.kind&&"constant"===o.kind)continue;let a,s,l,c,u,h;if("constant"===r.kind){const e=r.value;if(!e)continue;a=e.other||e.to,s=e.to,l=e.from}else a=r.evaluate({zoom:i-1},e),s=r.evaluate({zoom:i},e),l=r.evaluate({zoom:i+1},e);"constant"===o.kind?c=u=h=o.value:(c=o.evaluate({zoom:i-1},e),u=o.evaluate({zoom:i},e),h=o.evaluate({zoom:i+1},e)),t.addDash(a,c),t.addDash(s,u),t.addDash(l,h);const d=t.getKey(a,c),p=t.getKey(s,u),f=t.getKey(l,h);e.patterns[n.id]={min:d,mid:p,max:f}}}update(e,t,i,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,i,n)}addFeatures(e,t,i,n,r){for(const e of this.patternFeatures)this.addFeature(e,e.geometry,e.index,t,i,n)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,sh)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,oh),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&e.properties.hasOwnProperty("mapbox_clip_start")&&e.properties.hasOwnProperty("mapbox_clip_end"))return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}addFeature(e,t,i,n,r,o){const a=this.layers[0].layout,s=a.get("line-join").evaluate(e,{}),l=a.get("line-cap").evaluate(e,{}),c=a.get("line-miter-limit"),u=a.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(const i of t)this.addLine(i,e,s,l,c,u);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,r,o,n)}addLine(e,t,i,n,r,o){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineSoFar=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let t=0;t=2&&e[s-1].equals(e[s-2]);)s--;let l=0;for(;l0;if(b&&t>l){const e=h.dist(d);if(e>2*c){const t=h.sub(h.sub(d)._mult(c/e)._round());this.updateDistance(d,t),this.addCurrentVertex(t,f,0,0,u),d=t}}const T=d&&p;let C=T?i:a?"butt":n;if(T&&"round"===C&&(yr&&(C="bevel"),"bevel"===C&&(y>2&&(C="flipbevel"),y100)g=m.mult(-1);else{const e=y*f.add(m).mag()/f.sub(m).mag();g._perp()._mult(e*(w?-1:1))}this.addCurrentVertex(h,g,0,0,u),this.addCurrentVertex(h,g.mult(-1),0,0,u)}else if("bevel"===C||"fakeround"===C){const e=-Math.sqrt(y*y-1),t=w?e:0,i=w?0:e;if(d&&this.addCurrentVertex(h,f,t,i,u),"fakeround"===C){const e=Math.round(180*x/Math.PI/20);for(let t=1;t2*c){const t=h.add(p.sub(h)._mult(c/e)._round());this.updateDistance(h,t),this.addCurrentVertex(t,m,0,0,u),h=t}}}}addCurrentVertex(e,t,i,n,r,o=!1){const a=t.y*n-t.x,s=-t.y-t.x*n;this.addHalfVertex(e,t.x+t.y*i,t.y-t.x*i,o,!1,i,r),this.addHalfVertex(e,a,s,o,!0,-n,r)}addHalfVertex({x:e,y:t},i,n,r,o,a,s){this.layoutVertexArray.emplaceBack((e<<1)+(r?1:0),(t<<1)+(o?1:0),Math.round(63*i)+128,Math.round(63*n)+128,1+(0===a?0:a<0?-1:1),0,this.lineSoFar),this.lineClips&&this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length,this.lineClips.start,this.lineClips.end);const l=s.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,l),s.primitiveLength++),o?this.e2=l:this.e1=l}updateScaledDistance(){if(this.lineClips){const e=this.totalDistance/(this.lineClips.end-this.lineClips.start);this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=e*this.lineClips.start+this.distance}else this.lineSoFar=this.distance}updateDistance(e,t){this.distance+=e.dist(t),this.updateScaledDistance()}}Nr(uh,"LineBucket",{omit:["layers","patternFeatures"]});const hh=new ta({"line-cap":new Ko(Ye.layout_line["line-cap"]),"line-join":new Ko(Ye.layout_line["line-join"]),"line-miter-limit":new Yo(Ye.layout_line["line-miter-limit"]),"line-round-limit":new Yo(Ye.layout_line["line-round-limit"]),"line-sort-key":new Ko(Ye.layout_line["line-sort-key"])});var dh={paint:new ta({"line-opacity":new Ko(Ye.paint_line["line-opacity"]),"line-color":new Ko(Ye.paint_line["line-color"]),"line-translate":new Yo(Ye.paint_line["line-translate"]),"line-translate-anchor":new Yo(Ye.paint_line["line-translate-anchor"]),"line-width":new Ko(Ye.paint_line["line-width"]),"line-gap-width":new Ko(Ye.paint_line["line-gap-width"]),"line-offset":new Ko(Ye.paint_line["line-offset"]),"line-blur":new Ko(Ye.paint_line["line-blur"]),"line-dasharray":new Jo(Ye.paint_line["line-dasharray"]),"line-pattern":new Jo(Ye.paint_line["line-pattern"]),"line-gradient":new ea(Ye.paint_line["line-gradient"]),"line-trim-offset":new Yo(Ye.paint_line["line-trim-offset"])}),layout:hh};const ph=new class extends Ko{possiblyEvaluate(e,t){return t=new No(Math.floor(t.zoom),{now:t.now,fadeDuration:t.fadeDuration,zoomHistory:t.zoomHistory,transition:t.transition}),super.possiblyEvaluate(e,t)}evaluate(e,t,i,n){return t=I({},t,{zoom:Math.floor(t.zoom)}),super.evaluate(e,t,i,n)}}(dh.paint.properties["line-width"].specification);function fh(e,t){return t>0?t+2*e:e}ph.useIntegerZoom=!0;const mh=aa([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),gh=aa([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),_h=aa([{name:"a_projected_pos",components:4,type:"Float32"}],4);aa([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const vh=aa([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]),yh=aa([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"}]);aa([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Int16",name:"tileAnchorX"},{type:"Int16",name:"tileAnchorY"},{type:"Float32",name:"x1"},{type:"Float32",name:"y1"},{type:"Float32",name:"x2"},{type:"Float32",name:"y2"},{type:"Int16",name:"padding"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const xh=aa([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),bh=aa([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);aa([{name:"triangle",components:3,type:"Uint16"}]),aa([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{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"},{type:"Uint8",name:"flipState"}]),aa([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{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",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"}]),aa([{type:"Float32",name:"offsetX"}]),aa([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);var wh=24;const Th=128;function Ch(e,t){const{expression:i}=t;if("constant"===i.kind)return{kind:"constant",layoutSize:i.evaluate(new No(e+1))};if("source"===i.kind)return{kind:"source"};{const{zoomStops:t,interpolationType:n}=i;let r=0;for(;r{e.text=function(e,t,i){const n=t.layout.get("text-transform").evaluate(i,{});return"uppercase"===n?e=e.toLocaleUpperCase():"lowercase"===n&&(e=e.toLocaleLowerCase()),jo.applyArabicShaping&&(e=jo.applyArabicShaping(e)),e}(e.text,t,i)})),e}const Mh={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};function Ih(e){return"︶"===e||"﹈"===e||"︸"===e||"﹄"===e||"﹂"===e||"︾"===e||"︼"===e||"︺"===e||"︘"===e||"﹀"===e||"︐"===e||"︓"===e||"︔"===e||"`"===e||" ̄"===e||"︑"===e||"︒"===e}function Ph(e){return"︵"===e||"﹇"===e||"︷"===e||"﹃"===e||"﹁"===e||"︽"===e||"︻"===e||"︹"===e||"︗"===e||"︿"===e}var Dh=Lh,zh=function(e,t,i,n,r){var o,a,s=8*r-n-1,l=(1<>1,u=-7,h=i?r-1:0,d=i?-1:1,p=e[t+h];for(h+=d,o=p&(1<<-u)-1,p>>=-u,u+=s;u>0;o=256*o+e[t+h],h+=d,u-=8);for(a=o&(1<<-u)-1,o>>=-u,u+=n;u>0;a=256*a+e[t+h],h+=d,u-=8);if(0===o)o=1-c;else{if(o===l)return a?NaN:1/0*(p?-1:1);a+=Math.pow(2,n),o-=c}return(p?-1:1)*a*Math.pow(2,o-n)},Oh=function(e,t,i,n,r,o){var a,s,l,c=8*o-r-1,u=(1<>1,d=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,f=n?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=u):(a=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-a))<1&&(a--,l*=2),(t+=a+h>=1?d/l:d*Math.pow(2,1-h))*l>=2&&(a++,l/=2),a+h>=u?(s=0,a=u):a+h>=1?(s=(t*l-1)*Math.pow(2,r),a+=h):(s=t*Math.pow(2,h-1)*Math.pow(2,r),a=0));r>=8;e[i+p]=255&s,p+=f,s/=256,r-=8);for(a=a<0;e[i+p]=255&a,p+=f,a/=256,c-=8);e[i+p-f]|=128*m}; /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */function Lh(e){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(e)?e:new Uint8Array(e||0),this.pos=0,this.type=0,this.length=this.buf.length}Lh.Varint=0,Lh.Fixed64=1,Lh.Bytes=2,Lh.Fixed32=5;var Rh=4294967296,Bh=1/Rh,Fh="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function $h(e){return e.type===Lh.Bytes?e.readVarint()+e.pos:e.pos+1}function jh(e,t,i){return i?4294967296*t+(e>>>0):4294967296*(t>>>0)+(e>>>0)}function Nh(e,t,i){var n=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(7*Math.LN2));i.realloc(n);for(var r=i.pos-1;r>=e;r--)i.buf[r+n]=i.buf[r]}function Uh(e,t){for(var i=0;i>>8,e[i+2]=t>>>16,e[i+3]=t>>>24}function Qh(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}function ed(e,t,i){t.glyphs=[],1===e&&i.readMessage(td,t)}function td(e,t,i){if(3===e){const{id:e,bitmap:n,width:r,height:o,left:a,top:s,advance:l}=i.readMessage(id,{});t.glyphs.push({id:e,bitmap:new Tc({width:r+6,height:o+6},n),metrics:{width:r,height:o,left:a,top:s,advance:l}})}else 4===e?t.ascender=i.readSVarint():5===e&&(t.descender=i.readSVarint())}function id(e,t,i){1===e?t.id=i.readVarint():2===e?t.bitmap=i.readBytes():3===e?t.width=i.readVarint():4===e?t.height=i.readVarint():5===e?t.left=i.readSVarint():6===e?t.top=i.readSVarint():7===e&&(t.advance=i.readVarint())}function nd(e){let t=0,i=0;for(const n of e)t+=n.w*n.h,i=Math.max(i,n.w);e.sort(((e,t)=>t.h-e.h));const n=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),i),h:1/0}];let r=0,o=0;for(const t of e)for(let e=n.length-1;e>=0;e--){const i=n[e];if(!(t.w>i.w||t.h>i.h)){if(t.x=i.x,t.y=i.y,o=Math.max(o,t.y+t.h),r=Math.max(r,t.x+t.w),t.w===i.w&&t.h===i.h){const t=n.pop();e>3,o=this.pos;this.type=7&n,e(r,t,this),this.pos===o&&this.skip(n)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=Kh(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=Qh(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=Kh(this.buf,this.pos)+Kh(this.buf,this.pos+4)*Rh;return this.pos+=8,e},readSFixed64:function(){var e=Kh(this.buf,this.pos)+Qh(this.buf,this.pos+4)*Rh;return this.pos+=8,e},readFloat:function(){var e=zh(this.buf,this.pos,!0,23,4);return this.pos+=4,e},readDouble:function(){var e=zh(this.buf,this.pos,!0,52,8);return this.pos+=8,e},readVarint:function(e){var t,i,n=this.buf;return t=127&(i=n[this.pos++]),i<128?t:(t|=(127&(i=n[this.pos++]))<<7,i<128?t:(t|=(127&(i=n[this.pos++]))<<14,i<128?t:(t|=(127&(i=n[this.pos++]))<<21,i<128?t:function(e,t,i){var n,r,o=i.buf;if(n=(112&(r=o[i.pos++]))>>4,r<128)return jh(e,n,t);if(n|=(127&(r=o[i.pos++]))<<3,r<128)return jh(e,n,t);if(n|=(127&(r=o[i.pos++]))<<10,r<128)return jh(e,n,t);if(n|=(127&(r=o[i.pos++]))<<17,r<128)return jh(e,n,t);if(n|=(127&(r=o[i.pos++]))<<24,r<128)return jh(e,n,t);if(n|=(1&(r=o[i.pos++]))<<31,r<128)return jh(e,n,t);throw new Error("Expected varint not more than 10 bytes")}(t|=(15&(i=n[this.pos]))<<28,e,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var e=this.readVarint();return e%2==1?(e+1)/-2:e/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=12&&Fh?function(e,t,i){return Fh.decode(e.subarray(t,i))}(this.buf,t,e):function(e,t,i){for(var n="",r=t;r239?4:l>223?3:l>191?2:1;if(r+u>i)break;1===u?l<128&&(c=l):2===u?128==(192&(o=e[r+1]))&&(c=(31&l)<<6|63&o)<=127&&(c=null):3===u?(a=e[r+2],128==(192&(o=e[r+1]))&&128==(192&a)&&((c=(15&l)<<12|(63&o)<<6|63&a)<=2047||c>=55296&&c<=57343)&&(c=null)):4===u&&(a=e[r+2],s=e[r+3],128==(192&(o=e[r+1]))&&128==(192&a)&&128==(192&s)&&((c=(15&l)<<18|(63&o)<<12|(63&a)<<6|63&s)<=65535||c>=1114112)&&(c=null)),null===c?(c=65533,u=1):c>65535&&(c-=65536,n+=String.fromCharCode(c>>>10&1023|55296),c=56320|1023&c),n+=String.fromCharCode(c),r+=u}return n}(this.buf,t,e)},readBytes:function(){var e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t},readPackedVarint:function(e,t){if(this.type!==Lh.Bytes)return e.push(this.readVarint(t));var i=$h(this);for(e=e||[];this.pos127;);else if(t===Lh.Bytes)this.pos=this.readVarint()+this.pos;else if(t===Lh.Fixed32)this.pos+=4;else{if(t!==Lh.Fixed64)throw new Error("Unimplemented type: "+t);this.pos+=8}},writeTag:function(e,t){this.writeVarint(e<<3|t)},realloc:function(e){for(var t=this.length||16;t268435455||e<0?function(e,t){var i,n;if(e>=0?(i=e%4294967296|0,n=e/4294967296|0):(n=~(-e/4294967296),4294967295^(i=~(-e%4294967296))?i=i+1|0:(i=0,n=n+1|0)),e>=0x10000000000000000||e<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),function(e,t,i){i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,i.buf[i.pos]=127&(e>>>=7)}(i,0,t),function(e,t){var i=(7&e)<<4;t.buf[t.pos++]|=i|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e)))))}(n,t)}(e,this):(this.realloc(4),this.buf[this.pos++]=127&e|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=e>>>7&127))))},writeSVarint:function(e){this.writeVarint(e<0?2*-e-1:2*e)},writeBoolean:function(e){this.writeVarint(Boolean(e))},writeString:function(e){e=String(e),this.realloc(4*e.length),this.pos++;var t=this.pos;this.pos=function(e,t,i){for(var n,r,o=0;o55295&&n<57344){if(!r){n>56319||o+1===t.length?(e[i++]=239,e[i++]=191,e[i++]=189):r=n;continue}if(n<56320){e[i++]=239,e[i++]=191,e[i++]=189,r=n;continue}n=r-55296<<10|n-56320|65536,r=null}else r&&(e[i++]=239,e[i++]=191,e[i++]=189,r=null);n<128?e[i++]=n:(n<2048?e[i++]=n>>6|192:(n<65536?e[i++]=n>>12|224:(e[i++]=n>>18|240,e[i++]=n>>12&63|128),e[i++]=n>>6&63|128),e[i++]=63&n|128)}return i}(this.buf,e,this.pos);var i=this.pos-t;i>=128&&Nh(t,i,this),this.pos=t-1,this.writeVarint(i),this.pos+=i},writeFloat:function(e){this.realloc(4),Oh(this.buf,e,this.pos,!0,23,4),this.pos+=4},writeDouble:function(e){this.realloc(8),Oh(this.buf,e,this.pos,!0,52,8),this.pos+=8},writeBytes:function(e){var t=e.length;this.writeVarint(t),this.realloc(t);for(var i=0;i=128&&Nh(i,n,this),this.pos=i-1,this.writeVarint(n),this.pos+=n},writeMessage:function(e,t,i){this.writeTag(e,Lh.Bytes),this.writeRawMessage(t,i)},writePackedVarint:function(e,t){t.length&&this.writeMessage(e,Uh,t)},writePackedSVarint:function(e,t){t.length&&this.writeMessage(e,Vh,t)},writePackedBoolean:function(e,t){t.length&&this.writeMessage(e,Wh,t)},writePackedFloat:function(e,t){t.length&&this.writeMessage(e,Gh,t)},writePackedDouble:function(e,t){t.length&&this.writeMessage(e,qh,t)},writePackedFixed32:function(e,t){t.length&&this.writeMessage(e,Zh,t)},writePackedSFixed32:function(e,t){t.length&&this.writeMessage(e,Hh,t)},writePackedFixed64:function(e,t){t.length&&this.writeMessage(e,Xh,t)},writePackedSFixed64:function(e,t){t.length&&this.writeMessage(e,Yh,t)},writeBytesField:function(e,t){this.writeTag(e,Lh.Bytes),this.writeBytes(t)},writeFixed32Field:function(e,t){this.writeTag(e,Lh.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(e,t){this.writeTag(e,Lh.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(e,t){this.writeTag(e,Lh.Fixed64),this.writeFixed64(t)},writeSFixed64Field:function(e,t){this.writeTag(e,Lh.Fixed64),this.writeSFixed64(t)},writeVarintField:function(e,t){this.writeTag(e,Lh.Varint),this.writeVarint(t)},writeSVarintField:function(e,t){this.writeTag(e,Lh.Varint),this.writeSVarint(t)},writeStringField:function(e,t){this.writeTag(e,Lh.Bytes),this.writeString(t)},writeFloatField:function(e,t){this.writeTag(e,Lh.Fixed32),this.writeFloat(t)},writeDoubleField:function(e,t){this.writeTag(e,Lh.Fixed64),this.writeDouble(t)},writeBooleanField:function(e,t){this.writeVarintField(e,Boolean(t))}};class rd{constructor(e,{pixelRatio:t,version:i,stretchX:n,stretchY:r,content:o}){this.paddedRect=e,this.pixelRatio=t,this.stretchX=n,this.stretchY=r,this.content=o,this.version=i}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}}class od{constructor(e,t){const i={},n={};this.haveRenderCallbacks=[];const r=[];this.addImages(e,i,r),this.addImages(t,n,r);const{w:o,h:a}=nd(r),s=new Cc({width:o||1,height:a||1});for(const t in e){const n=e[t],r=i[t].paddedRect;Cc.copy(n.data,s,{x:0,y:0},{x:r.x+1,y:r.y+1},n.data)}for(const e in t){const i=t[e],r=n[e].paddedRect,o=r.x+1,a=r.y+1,l=i.data.width,c=i.data.height;Cc.copy(i.data,s,{x:0,y:0},{x:o,y:a},i.data),Cc.copy(i.data,s,{x:0,y:c-1},{x:o,y:a-1},{width:l,height:1}),Cc.copy(i.data,s,{x:0,y:0},{x:o,y:a+c},{width:l,height:1}),Cc.copy(i.data,s,{x:l-1,y:0},{x:o-1,y:a},{width:1,height:c}),Cc.copy(i.data,s,{x:0,y:0},{x:o+l,y:a},{width:1,height:c})}this.image=s,this.iconPositions=i,this.patternPositions=n}addImages(e,t,i){for(const n in e){const r=e[n],o={x:0,y:0,w:r.data.width+2,h:r.data.height+2};i.push(o),t[n]=new rd(o,r),r.hasRenderCallback&&this.haveRenderCallbacks.push(n)}}patchUpdatedImages(e,t){this.haveRenderCallbacks=this.haveRenderCallbacks.filter((t=>e.hasImage(t))),e.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const i in e.updatedImages)this.patchUpdatedImage(this.iconPositions[i],e.getImage(i),t),this.patchUpdatedImage(this.patternPositions[i],e.getImage(i),t)}patchUpdatedImage(e,t,i){if(!e||!t)return;if(e.version===t.version)return;e.version=t.version;const[n,r]=e.tl;i.update(t.data,void 0,{x:n,y:r})}}Nr(rd,"ImagePosition"),Nr(od,"ImageAtlas");const ad={horizontal:1,vertical:2,horizontalOnly:3};class sd{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(e,t){const i=new sd;return i.scale=e||1,i.fontStack=t,i}static forImage(e){const t=new sd;return t.imageName=e,t}}class ld{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,t){const i=new ld;for(let n=0;n=0&&i>=e&&ud[this.text.charCodeAt(i)];i--)t--;this.text=this.text.substring(e,t),this.sectionIndex=this.sectionIndex.slice(e,t)}substring(e,t){const i=new ld;return i.text=this.text.substring(e,t),i.sectionIndex=this.sectionIndex.slice(e,t),i.sections=this.sections,i}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce(((e,t)=>Math.max(e,this.sections[t].scale)),0)}addTextSection(e,t){this.text+=e.text,this.sections.push(sd.forText(e.scale,e.fontStack||t));const i=this.sections.length-1;for(let t=0;t=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function cd(e,t,i,n,r,o,a,s,l,c,u,h,d,p,f,m){const g=ld.fromFeature(e,r);let _;h===ad.vertical&&g.verticalizePunctuation(d);const{processBidirectionalText:v,processStyledBidirectionalText:y}=jo;if(v&&1===g.sections.length){_=[];const e=v(g.toString(),_d(g,c,o,t,n,p,f));for(const t of e){const e=new ld;e.text=t,e.sections=g.sections;for(let i=0;i0&&o>b&&(b=o)}else{const e=i[s.fontStack];if(!e)continue;e[m]&&(C=e[m]);const n=t[s.fontStack];if(!n)continue;const o=n.glyphs[m];if(!o)continue;if(y=o.metrics,E=8203!==m?wh:0,g){const e=void 0!==n.ascender?Math.abs(n.ascender):0,t=void 0!==n.descender?Math.abs(n.descender):0,i=(e+t)*_;w=0;let u=0;for(let i=0;i-i/2;){if(a--,a<0)return!1;s-=e[a].dist(o),o=e[a]}s+=e[a].dist(e[a+1]),a++;const l=[];let c=0;for(;sn;)c-=l.shift().angleDelta;if(c>r)return!1;a++,s+=t.dist(i)}return!0}function Cd(e){let t=0;for(let i=0;ic){const u=(c-l)/o,h=ki(n.x,r.x,u),d=ki(n.y,r.y,u),p=new wd(h,d,0,r.angleTo(n),i);return!a||Td(e,p,s,a,t)?p:void 0}l+=o}}function Ad(e,t,i,n,r,o,a,s,l){const c=Sd(n,o,a),u=Ed(n,r),h=u*a,d=0===e[0].x||e[0].x===l||0===e[0].y||e[0].y===l;return t-h=0&&_=0&&v=0&&d+c<=u){const i=new wd(_,v,0,m,t);i._round(),n&&!Td(e,i,o,n,r)||p.push(i)}}h+=f}return s||p.length||a||(p=Md(e,h/2,i,n,r,o,a,!0,l)),p}function Id(e,t,i,n,r){const o=[];for(let a=0;a=n&&c.x>=n||(a.x>=n?a=new m(n,a.y+(n-a.x)/(c.x-a.x)*(c.y-a.y))._round():c.x>=n&&(c=new m(n,a.y+(n-a.x)/(c.x-a.x)*(c.y-a.y))._round()),a.y>=r&&c.y>=r||(a.y>=r?a=new m(a.x+(r-a.y)/(c.y-a.y)*(c.x-a.x),r)._round():c.y>=r&&(c=new m(a.x+(r-a.y)/(c.y-a.y)*(c.x-a.x),r)._round()),l&&a.equals(l[l.length-1])||(l=[a],o.push(l)),l.push(c)))))}}return o}Nr(wd,"Anchor");const Pd=1e20;function Dd(e,t,i,n,r,o,a,s,l){for(let c=t;c-1);l++,o[l]=s,a[l]=c,a[l+1]=Pd}for(let s=0,l=0;s{let n=this.entries[e];n||(n=this.entries[e]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let r=n.glyphs[t];if(void 0!==r)return void i(null,{stack:e,id:t,glyph:r});if(r=this._tinySDF(n,e,t),r)return n.glyphs[t]=r,void i(null,{stack:e,id:t,glyph:r});const o=Math.floor(t/256);if(256*o>65535)return void i(new Error("glyphs > 65535 not supported"));if(n.ranges[o])return void i(null,{stack:e,id:t,glyph:r});let a=n.requests[o];a||(a=n.requests[o]=[],Ld.loadGlyphRange(e,o,this.url,this.requestManager,((e,t)=>{if(t){n.ascender=t.ascender,n.descender=t.descender;for(const e in t.glyphs)this._doesCharSupportLocalGlyph(+e)||(n.glyphs[+e]=t.glyphs[+e]);n.ranges[o]=!0}for(const i of a)i(e,t);delete n.requests[o]}))),a.push(((n,r)=>{n?i(n):r&&i(null,{stack:e,id:t,glyph:r.glyphs[t]||null})}))}),((e,i)=>{if(e)t(e);else if(i){const e={};for(const{stack:t,id:n,glyph:r}of i)void 0===e[t]&&(e[t]={}),void 0===e[t].glyphs&&(e[t].glyphs={}),e[t].glyphs[n]=r&&{id:r.id,bitmap:r.bitmap.clone(),metrics:r.metrics},e[t].ascender=this.entries[t].ascender,e[t].descender=this.entries[t].descender;t(null,e)}}))}_doesCharSupportLocalGlyph(e){return this.localGlyphMode!==Od.none&&(this.localGlyphMode===Od.all?!!this.localFontFamily:!!this.localFontFamily&&(co(e)||po(e)||eo(e)||to(e)||Qr(e)))}_tinySDF(e,t,i){const n=this.localFontFamily;if(!n||!this._doesCharSupportLocalGlyph(i))return;let r=e.tinySDF;if(!r){let i="400";/bold/i.test(t)?i="900":/medium/i.test(t)?i="500":/light/i.test(t)&&(i="200"),r=e.tinySDF=new Ld.TinySDF({fontFamily:n,fontWeight:i,fontSize:48,buffer:6,radius:16}),r.fontWeight=i}if(this.localGlyphs[r.fontWeight][i])return this.localGlyphs[r.fontWeight][i];const o=String.fromCharCode(i),{data:a,width:s,height:l,glyphWidth:c,glyphHeight:u,glyphLeft:h,glyphTop:d,glyphAdvance:p}=r.draw(o);return this.localGlyphs[r.fontWeight][i]={id:i,bitmap:new Tc({width:s,height:l},a),metrics:{width:c/2,height:u/2,left:h/2,top:d/2-27,advance:p/2,localGlyph:!0}}}}function Rd(e,t,i,n){const r=[],o=e.image,a=o.pixelRatio,s=o.paddedRect.w-2,l=o.paddedRect.h-2,c=e.right-e.left,u=e.bottom-e.top,h=o.stretchX||[[0,s]],d=o.stretchY||[[0,l]],p=(e,t)=>e+t[1]-t[0],f=h.reduce(p,0),g=d.reduce(p,0),_=s-f,v=l-g;let y=0,x=f,b=0,w=g,T=0,C=_,S=0,E=v;if(o.content&&n){const e=o.content;y=Bd(h,0,e[0]),b=Bd(d,0,e[1]),x=Bd(h,e[0],e[2]),w=Bd(d,e[1],e[3]),T=e[0]-y,S=e[1]-b,C=e[2]-e[0]-x,E=e[3]-e[1]-w}const k=(n,r,s,l)=>{const h=$d(n.stretch-y,x,c,e.left),d=jd(n.fixed-T,C,n.stretch,f),p=$d(r.stretch-b,w,u,e.top),_=jd(r.fixed-S,E,r.stretch,g),v=$d(s.stretch-y,x,c,e.left),k=jd(s.fixed-T,C,s.stretch,f),A=$d(l.stretch-b,w,u,e.top),M=jd(l.fixed-S,E,l.stretch,g),I=new m(h,p),P=new m(v,p),D=new m(v,A),z=new m(h,A),O=new m(d/a,_/a),L=new m(k/a,M/a),R=t*Math.PI/180;if(R){const e=Math.sin(R),t=Math.cos(R),i=[t,-e,e,t];I._matMult(i),P._matMult(i),z._matMult(i),D._matMult(i)}const B=n.stretch+n.fixed,F=r.stretch+r.fixed;return{tl:I,tr:P,bl:z,br:D,tex:{x:o.paddedRect.x+1+B,y:o.paddedRect.y+1+F,w:s.stretch+s.fixed-B,h:l.stretch+l.fixed-F},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:O,pixelOffsetBR:L,minFontScaleX:C/a/c,minFontScaleY:E/a/u,isSDF:i}};if(n&&(o.stretchX||o.stretchY)){const e=Fd(h,_,f),t=Fd(d,v,g);for(let i=0;i{if(e)r(e);else if(t){const e={},i=function(e){return new Dh(e).readFields(ed,{})}(t);for(const t of i.glyphs)e[t.id]=t;r(null,{glyphs:e,ascender:i.ascender,descender:i.descender})}}))},Ld.TinySDF=class{constructor({fontSize:e=24,buffer:t=3,radius:i=8,cutoff:n=.25,fontFamily:r="sans-serif",fontWeight:o="normal",fontStyle:a="normal"}={}){this.buffer=t,this.cutoff=n,this.radius=i;const s=this.size=e+4*t,l=this._createCanvas(s),c=this.ctx=l.getContext("2d",{willReadFrequently:!0});c.font=`${a} ${o} ${e}px ${r}`,c.textBaseline="alphabetic",c.textAlign="left",c.fillStyle="black",this.gridOuter=new Float64Array(s*s),this.gridInner=new Float64Array(s*s),this.f=new Float64Array(s),this.z=new Float64Array(s+1),this.v=new Uint16Array(s)}_createCanvas(e){const t=document.createElement("canvas");return t.width=t.height=e,t}draw(e){const{width:t,actualBoundingBoxAscent:i,actualBoundingBoxDescent:n,actualBoundingBoxLeft:r,actualBoundingBoxRight:o}=this.ctx.measureText(e),a=Math.ceil(i),s=Math.min(this.size-this.buffer,Math.ceil(o-r)),l=Math.min(this.size-this.buffer,a+Math.ceil(n)),c=s+2*this.buffer,u=l+2*this.buffer,h=Math.max(c*u,0),d=new Uint8ClampedArray(h),p={data:d,width:c,height:u,glyphWidth:s,glyphHeight:l,glyphTop:a,glyphLeft:0,glyphAdvance:t};if(0===s||0===l)return p;const{ctx:f,buffer:m,gridInner:g,gridOuter:_}=this;f.clearRect(m,m,s,l),f.fillText(e,m,m+a);const v=f.getImageData(m,m,s,l);_.fill(Pd,0,h),g.fill(0,0,h);for(let e=0;e0?e*e:0,g[n]=e<0?e*e:0}}Dd(_,0,0,c,u,c,this.f,this.v,this.z),Dd(g,m,m,s,l,c,this.f,this.v,this.z);for(let e=0;e0)for(let e=(this.length>>1)-1;e>=0;e--)this._down(e)}push(e){this.data.push(e),this.length++,this._up(this.length-1)}pop(){if(0===this.length)return;const e=this.data[0],t=this.data.pop();return this.length--,this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:t,compare:i}=this,n=t[e];for(;e>0;){const r=e-1>>1,o=t[r];if(i(n,o)>=0)break;t[e]=o,e=r}t[e]=n}_down(e){const{data:t,compare:i}=this,n=this.length>>1,r=t[e];for(;e=0)break;t[e]=o,e=n}t[e]=r}}function Vd(e,t){return et?1:0}function Gd(e,t=1,i=!1){let n=1/0,r=1/0,o=-1/0,a=-1/0;const s=e[0];for(let e=0;eo)&&(o=t.x),(!e||t.y>a)&&(a=t.y)}const l=Math.min(o-n,a-r);let c=l/2;const u=new Ud([],qd);if(0===l)return new m(n,r);for(let t=n;th.d||!h.d)&&(h=i),i.max-h.d<=t||(c=i.h/2,u.push(new Wd(i.p.x-c,i.p.y-c,c,e)),u.push(new Wd(i.p.x+c,i.p.y-c,c,e)),u.push(new Wd(i.p.x-c,i.p.y+c,c,e)),u.push(new Wd(i.p.x+c,i.p.y+c,c,e)),d+=4)}return h.p}function qd(e,t){return t.max-e.max}function Wd(e,t,i,n){this.p=new m(e,t),this.h=i,this.d=function(e,t){let i=!1,n=1/0;for(let r=0;re.y!=s.y>e.y&&e.x<(s.x-r.x)*(e.y-r.y)/(s.y-r.y)+r.x&&(i=!i),n=Math.min(n,hl(e,r,s))}}return(i?1:-1)*Math.sqrt(n)}(this.p,n),this.max=this.d+this.h*Math.SQRT2}const Zd=Number.POSITIVE_INFINITY,Hd=Math.sqrt(2);function Xd(e,t){return t[1]!==Zd?function(e,t,i){let n=0,r=0;switch(t=Math.abs(t),i=Math.abs(i),e){case"top-right":case"top-left":case"top":r=i-7;break;case"bottom-right":case"bottom-left":case"bottom":r=7-i}switch(e){case"top-right":case"bottom-right":case"right":n=-t;break;case"top-left":case"bottom-left":case"left":n=t}return[n,r]}(e,t[0],t[1]):function(e,t){let i=0,n=0;t<0&&(t=0);const r=t/Hd;switch(e){case"top-right":case"top-left":n=r-7;break;case"bottom-right":case"bottom-left":n=7-r;break;case"bottom":n=7-t;break;case"top":n=t-7}switch(e){case"top-right":case"bottom-right":i=-r;break;case"top-left":case"bottom-left":i=r;break;case"left":i=t;break;case"right":i=-t}return[i,n]}(e,t[0])}function Yd(e,t,i,n,r,o,a,s,l,c){e.createArrays(),e.tilePixelRatio=Ps/(512*e.overscaling),e.compareText={},e.iconsNeedLinear=!1;const u=e.layers[0].layout,h=e.layers[0]._unevaluatedLayout._values,d={};if("composite"===e.textSizeData.kind){const{minZoom:t,maxZoom:i}=e.textSizeData;d.compositeTextSizes=[h["text-size"].possiblyEvaluate(new No(t),s),h["text-size"].possiblyEvaluate(new No(i),s)]}if("composite"===e.iconSizeData.kind){const{minZoom:t,maxZoom:i}=e.iconSizeData;d.compositeIconSizes=[h["icon-size"].possiblyEvaluate(new No(t),s),h["icon-size"].possiblyEvaluate(new No(i),s)]}d.layoutTextSize=h["text-size"].possiblyEvaluate(new No(l+1),s),d.layoutIconSize=h["icon-size"].possiblyEvaluate(new No(l+1),s),d.textMaxSize=h["text-size"].possiblyEvaluate(new No(18),s);const p="map"===u.get("text-rotation-alignment")&&"point"!==u.get("symbol-placement"),f=u.get("text-size");for(const o of e.features){const l=u.get("text-font").evaluate(o,{},s).join(","),h=f.evaluate(o,{},s),m=d.layoutTextSize.evaluate(o,{},s),g=(d.layoutIconSize.evaluate(o,{},s),{horizontal:{},vertical:void 0}),_=o.text;let v,y=[0,0];if(_){const n=_.toString(),a=u.get("text-letter-spacing").evaluate(o,{},s)*wh,c=u.get("text-line-height").evaluate(o,{},s)*wh,d=wo(n)?a:0,f=u.get("text-anchor").evaluate(o,{},s),v=u.get("text-variable-anchor");if(!v){const e=u.get("text-radial-offset").evaluate(o,{},s);y=e?Xd(f,[e*wh,Zd]):u.get("text-offset").evaluate(o,{},s).map((e=>e*wh))}let x=p?"center":u.get("text-justify").evaluate(o,{},s);const b=u.get("symbol-placement"),w="point"===b,T="point"===b?u.get("text-max-width").evaluate(o,{},s)*wh:0,C=o=>{e.allowVerticalPlacement&&bo(n)&&(g.vertical=cd(_,t,i,r,l,T,c,f,o,d,y,ad.vertical,!0,b,m,h))};if(!p&&v){const e="auto"===x?v.map((e=>Kd(e))):[x];let n=!1;for(let o=0;o=0||!bo(n)){const e=cd(_,t,i,r,l,T,c,f,x,d,y,ad.horizontal,!1,b,m,h);e&&(g.horizontal[x]=e)}C("point"===b?"left":x)}}let x=!1;if(o.icon&&o.icon.name){const t=n[o.icon.name];t&&(v=xd(r[o.icon.name],u.get("icon-offset").evaluate(o,{},s),u.get("icon-anchor").evaluate(o,{},s)),x=t.sdf,void 0===e.sdfIcons?e.sdfIcons=t.sdf:e.sdfIcons!==t.sdf&&U("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(t.pixelRatio!==e.pixelRatio||0!==u.get("icon-rotate").constantOr(1))&&(e.iconsNeedLinear=!0))}const b=tp(g.horizontal)||g.vertical;e.iconsInText||(e.iconsInText=!!b&&b.iconsInText),(b||v)&&Jd(e,o,g,v,n,d,m,0,y,x,a,s,c)}o&&e.generateCollisionDebugBuffers(l,e.collisionBoxArray)}function Kd(e){switch(e){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function Jd(e,t,i,n,r,o,a,s,l,c,u,h,d){let p=o.textMaxSize.evaluate(t,{},h);void 0===p&&(p=a);const f=e.layers[0].layout,m=f.get("icon-offset").evaluate(t,{},h),g=tp(i.horizontal)||i.vertical,_="globe"===d.name,v=a/24,x=e.tilePixelRatio*p/24,b=(M=e.overscaling,e.zoom>18&&M>2&&(M>>=1),Math.max(Ps/(512*M),1)*f.get("symbol-spacing")),w=f.get("text-padding")*e.tilePixelRatio,T=f.get("icon-padding")*e.tilePixelRatio,C=y(f.get("text-max-angle")),S="map"===f.get("text-rotation-alignment")&&"point"!==f.get("symbol-placement"),E="map"===f.get("icon-rotation-alignment")&&"point"!==f.get("symbol-placement"),k=f.get("symbol-placement"),A=b/2;var M;const I=f.get("icon-text-fit");let P;n&&"none"!==I&&(e.allowVerticalPlacement&&i.vertical&&(P=bd(n,i.vertical,I,f.get("icon-text-fit-padding"),m,v)),g&&(n=bd(n,g,I,f.get("icon-text-fit-padding"),m,v)));const D=(a,s,p)=>{if(s.x<0||s.x>=Ps||s.y<0||s.y>=Ps)return;let f=null;if(_){const{x:e,y:t,z:i}=d.projectTilePoint(s.x,s.y,p);f={anchor:new wd(e,t,i,0,void 0),up:d.upVector(p,s.x,s.y)}}!function(e,t,i,n,r,o,a,s,l,c,u,h,d,p,f,m,g,_,v,y,x,b,w,T,C){const S=e.addToLineVertexArray(t,n);let E,k,A,M,I,P,D,z=0,O=0,L=0,R=0,B=-1,F=-1;const $={};let j=Ka.exports("");const N=i?i.anchor:t;let V=0,G=0;if(void 0===l._unevaluatedLayout.getValue("text-radial-offset")?[V,G]=l.layout.get("text-offset").evaluate(x,{},C).map((e=>e*wh)):(V=l.layout.get("text-radial-offset").evaluate(x,{},C)*wh,G=Zd),e.allowVerticalPlacement&&r.vertical){const e=r.vertical;if(f)P=np(e),s&&(D=np(s));else{const i=l.layout.get("text-rotate").evaluate(x,{},C)+90;A=ip(c,N,t,u,h,d,e,p,i,m),s&&(M=ip(c,N,t,u,h,d,s,_,i))}}if(o){const n=l.layout.get("icon-rotate").evaluate(x,{},C),r="none"!==l.layout.get("icon-text-fit"),a=Rd(o,n,w,r),p=s?Rd(s,n,w,r):void 0;k=ip(c,N,t,u,h,d,o,_,n),z=4*a.length;const f=e.iconSizeData;let m=null;"source"===f.kind?(m=[Th*l.layout.get("icon-size").evaluate(x,{},C)],m[0]>Qd&&U(`${e.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):"composite"===f.kind&&(m=[Th*b.compositeIconSizes[0].evaluate(x,{},C),Th*b.compositeIconSizes[1].evaluate(x,{},C)],(m[0]>Qd||m[1]>Qd)&&U(`${e.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),e.addSymbols(e.icon,a,m,y,v,x,!1,i,t,S.lineStartIndex,S.lineLength,-1,T,C),B=e.icon.placedSymbolArray.length-1,p&&(O=4*p.length,e.addSymbols(e.icon,p,m,y,v,x,ad.vertical,i,t,S.lineStartIndex,S.lineLength,-1,T,C),F=e.icon.placedSymbolArray.length-1)}for(const n in r.horizontal){const o=r.horizontal[n];E||(j=Ka.exports(o.text),f?I=np(o):E=ip(c,N,t,u,h,d,o,p,l.layout.get("text-rotate").evaluate(x,{},C),m));const s=1===o.positionedLines.length;if(L+=ep(e,i,t,o,a,l,f,x,m,S,r.vertical?ad.horizontal:ad.horizontalOnly,s?Object.keys(r.horizontal):[n],$,B,b,T,C),s)break}r.vertical&&(R+=ep(e,i,t,r.vertical,a,l,f,x,m,S,ad.vertical,["vertical"],$,F,b,T,C));let q=-1;const W=(e,t)=>e?Math.max(e,t):t;q=W(I,q),q=W(P,q),q=W(D,q);const Z=q>-1?1:0;e.glyphOffsetArray.length>=gf.MAX_GLYPHS&&U("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==x.sortKey&&e.addToSortKeyRanges(e.symbolInstances.length,x.sortKey),e.symbolInstances.emplaceBack(N.x,N.y,N.z,t.x,t.y,$.right>=0?$.right:-1,$.center>=0?$.center:-1,$.left>=0?$.left:-1,$.vertical>=0?$.vertical:-1,B,F,j,void 0!==E?E:e.collisionBoxArray.length,void 0!==E?E+1:e.collisionBoxArray.length,void 0!==A?A:e.collisionBoxArray.length,void 0!==A?A+1:e.collisionBoxArray.length,void 0!==k?k:e.collisionBoxArray.length,void 0!==k?k+1:e.collisionBoxArray.length,M||e.collisionBoxArray.length,M?M+1:e.collisionBoxArray.length,u,L,R,z,O,Z,0,V,G,q)}(e,s,f,a,i,n,r,P,e.layers[0],e.collisionBoxArray,t.index,t.sourceLayerIndex,e.index,w,S,l,0,T,E,m,t,o,c,u,h)};if("line"===k)for(const r of Id(t.geometry,0,0,Ps,Ps)){const t=Ad(r,b,C,i.vertical||g,n,24,x,e.overscaling,Ps);for(const i of t){const t=g;t&&rp(e,t.text,A,i)||D(r,i,h)}}else if("line-center"===k){for(const e of t.geometry)if(e.length>1){const t=kd(e,C,i.vertical||g,n,24,x);t&&D(e,t,h)}}else if("Polygon"===t.type)for(const e of su(t.geometry,0)){const t=Gd(e,16);D(e[0],new wd(t.x,t.y,0,0,void 0),h)}else if("LineString"===t.type)for(const e of t.geometry)D(e,new wd(e[0].x,e[0].y,0,0,void 0),h);else if("Point"===t.type)for(const e of t.geometry)for(const t of e)D([t],new wd(t.x,t.y,0,0,void 0),h)}const Qd=32640;function ep(e,t,i,n,r,o,a,s,l,c,u,h,d,p,f,g,_){const v=function(e,t,i,n,r,o,a,s){const l=[];if(0===t.positionedLines.length)return l;const c=n.layout.get("text-rotate").evaluate(o,{})*Math.PI/180,u=function(e){const t=e[0],i=e[1],n=t*i;return n>0?[t,-i]:n<0?[-t,i]:0===t?[i,t]:[i,-t]}(i);let h=Math.abs(t.top-t.bottom);for(const e of t.positionedLines)h-=e.lineOffset;const d=t.positionedLines.length,p=h/d;let f=t.top-i[1];for(let e=0;eQd&&U(`${e.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):"composite"===y.kind&&(x=[Th*f.compositeTextSizes[0].evaluate(s,{},_),Th*f.compositeTextSizes[1].evaluate(s,{},_)],(x[0]>Qd||x[1]>Qd)&&U(`${e.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),e.addSymbols(e.text,v,x,l,a,s,u,t,i,c.lineStartIndex,c.lineLength,p,g,_);for(const t of h)d[t]=e.text.placedSymbolArray.length-1;return 4*v.length}function tp(e){for(const t in e)return e[t];return null}function ip(e,t,i,n,r,o,a,s,l,c){let u=a.top,h=a.bottom,d=a.left,p=a.right;const f=a.collisionPadding;if(f&&(d-=f[0],u-=f[1],p+=f[2],h+=f[3]),l){const e=new m(d,u),t=new m(p,u),i=new m(d,h),n=new m(p,h),r=y(l);let o=new m(0,0);c&&(o=new m(c[0],c[1])),e._rotateAround(r,o),t._rotateAround(r,o),i._rotateAround(r,o),n._rotateAround(r,o),d=Math.min(e.x,t.x,i.x,n.x),p=Math.max(e.x,t.x,i.x,n.x),u=Math.min(e.y,t.y,i.y,n.y),h=Math.max(e.y,t.y,i.y,n.y)}return e.emplaceBack(t.x,t.y,t.z,i.x,i.y,d,u,p,h,s,n,r,o),e.length-1}function np(e){e.collisionPadding&&(e.top-=e.collisionPadding[1],e.bottom+=e.collisionPadding[3]);const t=e.bottom-e.top;return t>0?Math.max(10,t):null}function rp(e,t,i,n){const r=e.compareText;if(t in r){const e=r[t];for(let t=e.length-1;t>=0;t--)if(n.dist(e[t])1?null:function(e,t,i,n){const r=Math.sin(i);return e*(Math.sin((1-n)*i)/r)+t*(Math.sin(n*i)/r)}(e.a[t],e.b[t],e.angle,S(i,0,1))+e.center[t]}function yp(e){if(e.z<=1)return mp[e.z+2*e.y+e.x];const t=Cp(Tp(e));return pc.fromPoints(t)}function xp(e,t,i){return ql(e,e,1-i),Wl(e,e,t,i)}function bp(e,t){const i=zp(t.zoom);if(0===i)return yp(e);const n=Tp(e),r=Cp(n),o=Bs(n.getWest())*t.worldSize,a=Bs(n.getEast())*t.worldSize,s=Fs(n.getNorth())*t.worldSize,l=Fs(n.getSouth())*t.worldSize,c=[o,s,0],u=[a,s,0],h=[o,l,0],d=[a,l,0],p=kl([],t.globeMatrix);return Yl(c,c,p),Yl(u,u,p),Yl(h,h,p),Yl(d,d,p),r[0]=xp(r[0],h,i),r[1]=xp(r[1],d,i),r[2]=xp(r[2],u,i),r[3]=xp(r[3],c,i),pc.fromPoints(r)}function wp(e,t,i){for(const n of e)Yl(n,n,t),ql(n,n,i)}function Tp({x:e,y:t,z:i}){const n=1/(1<y&&(x(e,c,n,r,s,l),x(c,i,s,l,o,a))}x(h,d,n,o,r,o),x(d,p,r,o,r,a),x(p,f,r,a,n,a),x(f,h,n,a,n,o),m-=y,g-=y,_+=y,v+=y;const b=1/Math.max(_-m,v-g);return{scale:b,x:m*b,y:g*b,x2:_*b,y2:v*b,projection:t}}const jp=El(new Float32Array(16));class Np{constructor(e){this.spec=e,this.name=e.name,this.wrap=!1,this.requiresDraping=!1,this.supportsWorldCopies=!1,this.supportsTerrain=!1,this.supportsFog=!1,this.supportsFreeCamera=!1,this.zAxisUnit="meters",this.isReprojectedInTileSpace=!0,this.unsupportedLayers=["custom"],this.center=[0,0],this.range=[3.5,7]}project(e,t){return{x:0,y:0,z:0}}unproject(e,t){return new Os(0,0)}projectTilePoint(e,t,i){return{x:e,y:t,z:0}}locationPoint(e,t,i=!0){return e._coordinatePoint(e.locationCoordinate(t),i)}pixelsPerMeter(e,t){return $s(1,e)*t}pixelSpaceConversion(e,t,i){return 1}farthestPixelDistance(e){return Fp(e,e.pixelsPerMeter)}pointCoordinate(e,t,i,n){const r=e.horizonLineFromTop(!1),o=new m(t,Math.max(r,i));return e.rayIntersectionCoordinate(e.pointRayIntersection(o,n))}pointCoordinate3D(e,t,i){const n=new m(t,i);if(e.elevation)return e.elevation.pointCoordinate(n);{const t=this.pointCoordinate(e,n.x,n.y,0);return[t.x,t.y,t.z]}}isPointAboveHorizon(e,t){if(e.elevation)return!this.pointCoordinate3D(e,t.x,t.y);const i=e.horizonLineFromTop();return t.y0?t<-Yp+i&&(t=-Yp+i):t>Yp-i&&(t=Yp-i);const o=r/Math.pow(Kp(t),n);let a=o*Math.sin(n*e),s=r-o*Math.cos(n*e);return a=.5*(a/Math.PI+.5),s=.5*(s/Math.PI+.5),{x:a,y:this.southernCenter?s:1-s,z:0}}unproject(e,t){e=(2*e-.5)*Math.PI,this.southernCenter&&(t=1-t),t=(2*(1-t)-.5)*Math.PI;const{n:i,f:n}=this,r=n-t,o=Math.sign(r),a=Math.sign(i)*Math.sqrt(e*e+r*r);let s=Math.atan2(e,Math.abs(r))*o;r*i<0&&(s-=Math.PI*Math.sign(e)*o);const l=S(x(s/i)+this.center[0],-180,180),c=S(x(2*Math.atan(Math.pow(n/a,1/i))-Yp),-85.051129,Vs);return new Os(l,this.southernCenter?-c:c)}}class Qp extends Np{constructor(e){super(e),this.wrap=!0,this.supportsWorldCopies=!0,this.supportsTerrain=!0,this.supportsFog=!0,this.supportsFreeCamera=!0,this.isReprojectedInTileSpace=!1,this.unsupportedLayers=[],this.range=null}project(e,t){return{x:Bs(e),y:Fs(t),z:0}}unproject(e,t){const i=js(e),n=Ns(t);return new Os(i,n)}}const ef=y(Vs);class tf extends Np{project(e,t){const i=(t=y(t))*t,n=i*i;return{x:.5*((e=y(e))*(.8707-.131979*i+n*(n*(.003971*i-.001529*n)-.013791))/Math.PI+.5),y:1-.5*(t*(1.007226+i*(.015085+n*(.028874*i-.044475-.005916*n)))/Math.PI+1),z:0}}unproject(e,t){e=(2*e-.5)*Math.PI;let i=t=(2*(1-t)-1)*Math.PI,n=25,r=0,o=i*i;do{o=i*i;const e=o*o;r=(i*(1.007226+o*(.015085+e*(.028874*o-.044475-.005916*e)))-t)/(1.007226+o*(.045255+e*(.259866*o-.311325-.005916*11*e))),i=S(i-r,-ef,ef)}while(Math.abs(r)>1e-6&&--n>0);o=i*i;const a=S(x(e/(.8707+o*(o*(o*o*o*(.003971-.001529*o)-.013791)-.131979))),-180,180),s=x(i);return new Os(a,s)}}const nf=y(Vs);class rf extends Np{project(e,t){t=y(t),e=y(e);const i=Math.cos(t),n=2/Math.PI,r=Math.acos(i*Math.cos(e/2)),o=Math.sin(r)/r,a=.5*(e*n+2*i*Math.sin(e/2)/o)||0,s=.5*(t+Math.sin(t)/o)||0;return{x:.5*(a/Math.PI+.5),y:1-.5*(s/Math.PI+1),z:0}}unproject(e,t){let i=e=(2*e-.5)*Math.PI,n=t=(2*(1-t)-1)*Math.PI,r=25;const o=1e-6;let a=0,s=0;do{const r=Math.cos(n),o=Math.sin(n),l=2*o*r,c=o*o,u=r*r,h=Math.cos(i/2),d=Math.sin(i/2),p=2*h*d,f=d*d,m=1-u*h*h,g=m?1/m:0,_=m?Math.acos(r*h)*Math.sqrt(1/m):0,v=.5*(2*_*r*d+2*i/Math.PI)-e,y=.5*(_*o+n)-t,x=.5*g*(u*f+_*r*h*c)+1/Math.PI,b=g*(p*l/4-_*o*d),w=.125*g*(l*d-_*o*u*p),T=.5*g*(c*h+_*f*r)+.5,C=b*w-T*x;a=(y*b-v*T)/C,s=(v*w-y*x)/C,i=S(i-a,-Math.PI,Math.PI),n=S(n-s,-nf,nf)}while((Math.abs(a)>o||Math.abs(s)>o)&&--r>0);return new Os(x(i),x(n))}}class of extends Np{constructor(e){super(e),this.center=e.center||[0,0],this.parallels=e.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(y(this.parallels[0]))),this.scale=1/(2*Math.max(Math.PI*this.cosPhi,1/this.cosPhi)),this.wrap=!0,this.supportsWorldCopies=!0}project(e,t){const{scale:i,cosPhi:n}=this;return{x:y(e)*n*i+.5,y:-Math.sin(y(t))/n*i+.5,z:0}}unproject(e,t){const{scale:i,cosPhi:n}=this,r=-(t-.5)/i,o=S(x((e-.5)/i)/n,-180,180),a=Math.asin(S(r*n,-1,1)),s=S(x(a),-85.051129,Vs);return new Os(o,s)}}class af extends Qp{constructor(e){super(e),this.requiresDraping=!0,this.supportsWorldCopies=!1,this.supportsFog=!0,this.zAxisUnit="pixels",this.unsupportedLayers=["debug","custom"],this.range=[3,5]}projectTilePoint(e,t,i){const n=kp(e,t,i);return Yl(n,n,Ip(yp(i))),{x:n[0],y:n[1],z:n[2]}}locationPoint(e,t){const i=Ep(t.lat,t.lng),n=Zl([],i),r=e.elevation?e.elevation.getAtPointOrZero(e.locationCoordinate(t),e._centerAltitude):e._centerAltitude;Wl(i,i,n,$s(1,0)*Ps*r);const o=El(new Float64Array(16));return Al(o,e.pixelMatrix,e.globeMatrix),Yl(i,i,o),new m(i[0],i[1])}pixelsPerMeter(e,t){return $s(1,0)*t}pixelSpaceConversion(e,t,i){const n=$s(1,e)*t,r=ki($s(1,45)*t,n,i);return this.pixelsPerMeter(e,t)/r}createTileMatrix(e,t,i){const n=Pp(yp(i.canonical));return Al(new Float64Array(16),e.globeMatrix,n)}createInversionMatrix(e,t){const{center:i}=e,n=Ip(yp(t));return Dl(n,n,y(i.lng)),Pl(n,n,y(i.lat)),Il(n,n,[e._pixelsPerMercatorPixel,e._pixelsPerMercatorPixel,1]),Float32Array.from(n)}pointCoordinate(e,t,i,n){return gp(e,t,i,!0)||new qs(0,0)}pointCoordinate3D(e,t,i){const n=this.pointCoordinate(e,t,i,0);return[n.x,n.y,n.z]}isPointAboveHorizon(e,t){return!gp(e,t.x,t.y,!1)}farthestPixelDistance(e){const t=function(e,t){const i=e.cameraToCenterDistance,n=e._centerAltitude*t,r=e._camera,o=e._camera.forward(),a=jl([],ql([],o,-i),[0,0,n]),s=e.worldSize/(2*Math.PI),l=[0,0,-s],c=e.width/e.height,u=Math.tan(e.fovAboveCenter),h=ql([],r.up(),u),d=ql([],r.right(),u*c),p=Zl([],jl([],jl([],o,h),d)),f=[];let m;if(new uc(a,p).closestPointOnSphere(l,s,f)){const t=jl([],f,l),i=Ql([],t,a);m=Math.cos(e.fovAboveCenter)*Fl(i)}else{const e=Ql([],a,l),t=Ql([],l,a);Zl(t,t);const i=Fl(e)-s;m=Math.sqrt(i*(i+2*s));const n=Math.acos(m/(s+i))-Math.acos(Hl(o,t));m*=Math.cos(n)}return 1.01*m}(e,this.pixelsPerMeter(e.center.lat,e.worldSize)),i=zp(e.zoom);if(i>0){const n=Fp(e,$s(1,e.center.lat)*e.worldSize),r=e.worldSize/(2*Math.PI),o=Math.max(e.width,e.height)/e.worldSize*Math.PI;return ki(t,n+r*(1-Math.cos(o)),Math.pow(i,10))}return t}upVector(e,t,i){return kp(t,i,e,1)}upVectorScale(e){return{metersToTile:up*Ap(yp(e))}}}function sf(e){const t=e.parallels,i=!!t&&Math.abs(t[0]+t[1])<.01;switch(e.name){case"mercator":return new Qp(e);case"equirectangular":return new Xp(e);case"naturalEarth":return new tf(e);case"equalEarth":return new Hp(e);case"winkelTripel":return new rf(e);case"albers":return i?new of(e):new Up(e);case"lambertConformalConic":return i?new of(e):new Jp(e);case"globe":return new af(e)}throw new Error(`Invalid projection name: ${e.name}`)}const lf=Pu.types,cf=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function uf(e,t,i,n,r,o,a,s,l,c,u,h,d){const p=s?Math.min(Qd,Math.round(s[0])):0,f=s?Math.min(Qd,Math.round(s[1])):0;e.emplaceBack(t,i,Math.round(32*n),Math.round(32*r),o,a,(p<<1)+(l?1:0),f,16*c,16*u,256*h,256*d)}function hf(e,t,i,n,r,o,a){e.emplaceBack(t,i,n,r,o,a)}function df(e,t,i,n,r){e.emplaceBack(t,i,n,r),e.emplaceBack(t,i,n,r),e.emplaceBack(t,i,n,r),e.emplaceBack(t,i,n,r)}function pf(e){for(const t of e.sections)if(Ao(t.text))return!0;return!1}class ff{constructor(e){this.layoutVertexArray=new ga,this.indexArray=new Ca,this.programConfigurations=e,this.segments=new Is,this.dynamicLayoutVertexArray=new da,this.opacityVertexArray=new va,this.placedSymbolArray=new Fa,this.globeExtVertexArray=new _a}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length}upload(e,t,i,n){this.isEmpty()||(i&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,mh.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,t),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,_h.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,cf,!0),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,gh.members,!0)),this.opacityVertexBuffer.itemSize=1),(i||n)&&this.programConfigurations.upload(e))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy())}}Nr(ff,"SymbolBuffers");class mf{constructor(e,t,i){this.layoutVertexArray=new e,this.layoutAttributes=t,this.indexArray=new i,this.segments=new Is,this.collisionVertexArray=new wa,this.collisionVertexArrayExt=new Ta}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,vh.members,!0),this.collisionVertexBufferExt=e.createVertexBuffer(this.collisionVertexArrayExt,yh.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.destroy())}}Nr(mf,"CollisionBuffers");class gf{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.id)),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=El([]),this.placementViewportMatrix=El([]);const t=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Ch(this.zoom,t["text-size"]),this.iconSizeData=Ch(this.zoom,t["icon-size"]);const i=this.layers[0].layout,n=i.get("symbol-sort-key"),r=i.get("symbol-z-order");this.canOverlap=i.get("text-allow-overlap")||i.get("icon-allow-overlap")||i.get("text-ignore-placement")||i.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==r&&void 0!==n.constantOr(1),this.sortFeaturesByY=("viewport-y"===r||"auto"===r&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=i.get("text-writing-mode").map((e=>ad[e])),this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id)),this.sourceID=e.sourceID,this.projection=e.projection}createArrays(){this.text=new ff(new xs(this.layers,this.zoom,(e=>/^text/.test(e)))),this.icon=new ff(new xs(this.layers,this.zoom,(e=>/^icon/.test(e)))),this.glyphOffsetArray=new Na,this.lineVertexArray=new Ua,this.symbolInstances=new ja}calculateGlyphDependencies(e,t,i,n,r){for(let i=0;i0)&&("constant"!==s.value.kind||s.value.value.length>0),h="constant"!==c.value.kind||!!c.value.value||Object.keys(c.parameters).length>0,d=o.get("symbol-sort-key");if(this.features=[],!u&&!h)return;const p=t.iconDependencies,f=t.glyphDependencies,m=t.availableImages,g=new No(this.zoom);for(const{feature:t,id:l,index:c,sourceLayerIndex:_}of e){const e=r._featureFilter.needGeometry,v=el(t,e);if(!r._featureFilter.filter(g,v,i))continue;if(e||(v.geometry=Qs(t,i,n)),a&&1!==t.type&&i.z<=5){const e=v.geometry,t=.98078528056,n=(e,n)=>Hl(kp(e.x,e.y,i,1),kp(n.x,n.y,i,1))=0;for(const i of y.sections)if(i.image)p[i.image.name]=!0;else{const n=bo(y.toString()),r=i.fontStack||e,o=f[r]=f[r]||{};this.calculateGlyphDependencies(i.text,o,t,this.allowVerticalPlacement,n)}}}"line"===o.get("symbol-placement")&&(this.features=function(e){const t={},i={},n=[];let r=0;function o(t){n.push(e[t]),r++}function a(e,t,r){const o=i[e];return delete i[e],i[t]=o,n[o].geometry[0].pop(),n[o].geometry[0]=n[o].geometry[0].concat(r[0]),o}function s(e,i,r){const o=t[i];return delete t[i],t[e]=o,n[o].geometry[0].shift(),n[o].geometry[0]=r[0].concat(n[o].geometry[0]),o}function l(e,t,i){const n=i?t[0][t[0].length-1]:t[0][0];return`${e}:${n.x}:${n.y}`}for(let c=0;ce.geometry))}(this.features)),this.sortFeaturesByKey&&this.features.sort(((e,t)=>e.sortKey-t.sortKey))}update(e,t,i,n){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,t,this.layers,i,n),this.icon.programConfigurations.updatePaintArrays(e,t,this.layers,i,n))}isEmpty(){return 0===this.symbolInstances.length&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}getProjection(){return this.projectionInstance||(this.projectionInstance=sf(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,t){const i=this.lineVertexArray.length,n=e.segment;if(void 0!==n){let i=e.dist(t[n+1]),r=e.dist(t[n]);const o={};for(let e=n+1;e=0;e--)o[e]={x:t[e].x,y:t[e].y,tileUnitDistanceFromAnchor:r},e>0&&(r+=t[e-1].dist(t[e]));for(let e=0;e=0?t.rightJustifiedTextSymbolIndex:t.centerJustifiedTextSymbolIndex>=0?t.centerJustifiedTextSymbolIndex:t.leftJustifiedTextSymbolIndex>=0?t.leftJustifiedTextSymbolIndex:t.verticalPlacedTextSymbolIndex>=0?t.verticalPlacedTextSymbolIndex:n),o=Sh(this.textSizeData,e,r)/wh;return this.tilePixelRatio*o}getSymbolInstanceIconSize(e,t,i){const n=this.icon.placedSymbolArray.get(i),r=Sh(this.iconSizeData,e,n);return this.tilePixelRatio*r}_commitDebugCollisionVertexUpdate(e,t,i){e.emplaceBack(t,-i,-i),e.emplaceBack(t,i,-i),e.emplaceBack(t,i,i),e.emplaceBack(t,-i,i)}_updateTextDebugCollisionBoxes(e,t,i,n,r,o){for(let a=n;a0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(e,t){const i=e.placedSymbolArray.get(t),n=i.vertexStartIndex+4*i.numGlyphs;for(let t=i.vertexStartIndex;tn[e]-n[t]||r[t]-r[e])),o}addToSortKeyRanges(e,t){const i=this.sortKeyRanges[this.sortKeyRanges.length-1];i&&i.sortKey===t?i.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:t,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const e of this.symbolInstanceIndexes){const t=this.symbolInstances.get(e);this.featureSortOrder.push(t.featureIndex),[t.rightJustifiedTextSymbolIndex,t.centerJustifiedTextSymbolIndex,t.leftJustifiedTextSymbolIndex].forEach(((e,t,i)=>{e>=0&&i.indexOf(e)===t&&this.addIndicesForPlacedSymbol(this.text,e)})),t.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,t.verticalPlacedTextSymbolIndex),t.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,t.placedIconSymbolIndex),t.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,t.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}Nr(gf,"SymbolBucket",{omit:["layers","collisionBoxArray","features","compareText"]}),gf.MAX_GLYPHS=65535,gf.addDynamicAttributes=df;const _f=new ta({"symbol-placement":new Yo(Ye.layout_symbol["symbol-placement"]),"symbol-spacing":new Yo(Ye.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Yo(Ye.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Ko(Ye.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Yo(Ye.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Yo(Ye.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new Yo(Ye.layout_symbol["icon-ignore-placement"]),"icon-optional":new Yo(Ye.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Yo(Ye.layout_symbol["icon-rotation-alignment"]),"icon-size":new Ko(Ye.layout_symbol["icon-size"]),"icon-text-fit":new Yo(Ye.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Yo(Ye.layout_symbol["icon-text-fit-padding"]),"icon-image":new Ko(Ye.layout_symbol["icon-image"]),"icon-rotate":new Ko(Ye.layout_symbol["icon-rotate"]),"icon-padding":new Yo(Ye.layout_symbol["icon-padding"]),"icon-keep-upright":new Yo(Ye.layout_symbol["icon-keep-upright"]),"icon-offset":new Ko(Ye.layout_symbol["icon-offset"]),"icon-anchor":new Ko(Ye.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Yo(Ye.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Yo(Ye.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Yo(Ye.layout_symbol["text-rotation-alignment"]),"text-field":new Ko(Ye.layout_symbol["text-field"]),"text-font":new Ko(Ye.layout_symbol["text-font"]),"text-size":new Ko(Ye.layout_symbol["text-size"]),"text-max-width":new Ko(Ye.layout_symbol["text-max-width"]),"text-line-height":new Ko(Ye.layout_symbol["text-line-height"]),"text-letter-spacing":new Ko(Ye.layout_symbol["text-letter-spacing"]),"text-justify":new Ko(Ye.layout_symbol["text-justify"]),"text-radial-offset":new Ko(Ye.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Yo(Ye.layout_symbol["text-variable-anchor"]),"text-anchor":new Ko(Ye.layout_symbol["text-anchor"]),"text-max-angle":new Yo(Ye.layout_symbol["text-max-angle"]),"text-writing-mode":new Yo(Ye.layout_symbol["text-writing-mode"]),"text-rotate":new Ko(Ye.layout_symbol["text-rotate"]),"text-padding":new Yo(Ye.layout_symbol["text-padding"]),"text-keep-upright":new Yo(Ye.layout_symbol["text-keep-upright"]),"text-transform":new Ko(Ye.layout_symbol["text-transform"]),"text-offset":new Ko(Ye.layout_symbol["text-offset"]),"text-allow-overlap":new Yo(Ye.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new Yo(Ye.layout_symbol["text-ignore-placement"]),"text-optional":new Yo(Ye.layout_symbol["text-optional"])});var vf={paint:new ta({"icon-opacity":new Ko(Ye.paint_symbol["icon-opacity"]),"icon-color":new Ko(Ye.paint_symbol["icon-color"]),"icon-halo-color":new Ko(Ye.paint_symbol["icon-halo-color"]),"icon-halo-width":new Ko(Ye.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Ko(Ye.paint_symbol["icon-halo-blur"]),"icon-translate":new Yo(Ye.paint_symbol["icon-translate"]),"icon-translate-anchor":new Yo(Ye.paint_symbol["icon-translate-anchor"]),"text-opacity":new Ko(Ye.paint_symbol["text-opacity"]),"text-color":new Ko(Ye.paint_symbol["text-color"],{runtimeType:lt,getOverride:e=>e.textColor,hasOverride:e=>!!e.textColor}),"text-halo-color":new Ko(Ye.paint_symbol["text-halo-color"]),"text-halo-width":new Ko(Ye.paint_symbol["text-halo-width"]),"text-halo-blur":new Ko(Ye.paint_symbol["text-halo-blur"]),"text-translate":new Yo(Ye.paint_symbol["text-translate"]),"text-translate-anchor":new Yo(Ye.paint_symbol["text-translate-anchor"])}),layout:_f};class yf{constructor(e){this.type=e.property.overrides?e.property.overrides.runtimeType:rt,this.defaultValue=e}evaluate(e){if(e.formattedSection){const t=this.defaultValue.property.overrides;if(t&&t.hasOverride(e.formattedSection))return t.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Nr(yf,"FormatSectionOverride",{omit:["defaultValue"]});class xf extends ks{constructor(e){super(e,vf)}recalculate(e,t){super.recalculate(e,t),"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"));const i=this.layout.get("text-writing-mode");if(i){const e=[];for(const t of i)e.indexOf(t)<0&&e.push(t);this.layout._values["text-writing-mode"]=e}else this.layout._values["text-writing-mode"]="point"===this.layout.get("symbol-placement")?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getValueAndResolveTokens(e,t,i,n){const r=this.layout.get(e).evaluate(t,{},i,n),o=this._unevaluatedLayout._values[e];return o.isDataDriven()||Gn(o.value)||!r?r:function(e,t){return t.replace(/{([^{}]+)}/g,((t,i)=>i in e?String(e[i]):""))}(t.properties,r)}createBucket(e){return new gf(e)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const e of vf.paint.overridableProperties){if(!xf.hasPaintOverride(this.layout,e))continue;const t=this.paint.get(e),i=new yf(t),n=new Vn(i,t.property.specification);let r=null;r="constant"===t.value.kind||"source"===t.value.kind?new Wn("source",n):new Zn("composite",n,t.value.zoomStops,t.value._interpolationType),this.paint._values[e]=new Ho(t.property,r,t.parameters)}}_handleOverridablePaintPropertyUpdate(e,t,i){return!(!this.layout||t.isDataDriven()||i.isDataDriven())&&xf.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,t){const i=e.get("text-field"),n=vf.paint.properties[t];let r=!1;const o=e=>{for(const t of e)if(n.overrides&&n.overrides.hasOverride(t))return void(r=!0)};if("constant"===i.value.kind&&i.value.value instanceof It)o(i.value.value.sections);else if("source"===i.value.kind){const e=t=>{r||(t instanceof Bt&&Ot(t.value)===dt?o(t.value.sections):t instanceof Ut?o(t.sections):t.eachChild(e))},t=i.value;t._styleExpression&&e(t._styleExpression.expression)}return r}getProgramConfiguration(e){return new ys(this,e)}}var bf={paint:new ta({"background-color":new Yo(Ye.paint_background["background-color"]),"background-pattern":new Qo(Ye.paint_background["background-pattern"]),"background-opacity":new Yo(Ye.paint_background["background-opacity"])})},wf={paint:new ta({"raster-opacity":new Yo(Ye.paint_raster["raster-opacity"]),"raster-hue-rotate":new Yo(Ye.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Yo(Ye.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Yo(Ye.paint_raster["raster-brightness-max"]),"raster-saturation":new Yo(Ye.paint_raster["raster-saturation"]),"raster-contrast":new Yo(Ye.paint_raster["raster-contrast"]),"raster-resampling":new Yo(Ye.paint_raster["raster-resampling"]),"raster-fade-duration":new Yo(Ye.paint_raster["raster-fade-duration"])})};class Tf extends ks{constructor(e){super(e,{}),this.implementation=e}is3D(){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){}onAdd(e){this.implementation.onAdd&&this.implementation.onAdd(e,e.painter.context.gl)}onRemove(e){this.implementation.onRemove&&this.implementation.onRemove(e,e.painter.context.gl)}}var Cf={paint:new ta({"sky-type":new Yo(Ye.paint_sky["sky-type"]),"sky-atmosphere-sun":new Yo(Ye.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new Yo(Ye.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new Yo(Ye.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new Yo(Ye.paint_sky["sky-gradient-radius"]),"sky-gradient":new ea(Ye.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new Yo(Ye.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new Yo(Ye.paint_sky["sky-atmosphere-color"]),"sky-opacity":new Yo(Ye.paint_sky["sky-opacity"])})};function Sf(e,t,i){const n=[0,0,1],r=ac([]);return lc(r,r,i?-y(e)+Math.PI:y(e)),sc(r,r,-y(t)),Kl(n,n,r),Zl(n,n)}const Ef={circle:class extends ks{constructor(e){super(e,bl)}createBucket(e){return new nl(e)}queryRadius(e){const t=e;return gl("circle-radius",this,t)+gl("circle-stroke-width",this,t)+_l(this.paint.get("circle-translate"))}queryIntersectsFeature(e,t,i,n,r,o,a,s){const l=yl(this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),o.angle,e.pixelToTileUnitsFactor),c=this.paint.get("circle-radius").evaluate(t,i)+this.paint.get("circle-stroke-width").evaluate(t,i);return fc(e,n,o,a,s,"map"===this.paint.get("circle-pitch-alignment"),"map"===this.paint.get("circle-pitch-scale"),l,c)}getProgramIds(){return["circle"]}getProgramConfiguration(e){return new ys(this,e)}},heatmap:class extends ks{createBucket(e){return new yc(e)}constructor(e){super(e,Sc),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){"heatmap-color"===e&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Ec({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(e){return gl("heatmap-radius",this,e)}queryIntersectsFeature(e,t,i,n,r,o,a,s){const l=this.paint.get("heatmap-radius").evaluate(t,i);return fc(e,n,o,a,s,!0,!0,new m(0,0),l)}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&"none"!==this.visibility}getProgramIds(){return["heatmap","heatmapTexture"]}getProgramConfiguration(e){return new ys(this,e)}},hillshade:class extends ks{constructor(e){super(e,kc)}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility}getProgramIds(){return["hillshade","hillshadePrepare"]}},fill:class extends ks{constructor(e){super(e,pu)}getProgramIds(){const e=this.paint.get("fill-pattern"),t=e&&e.constantOr(1),i=[t?"fillPattern":"fill"];return this.paint.get("fill-antialias")&&i.push(t&&!this.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline"),i}getProgramConfiguration(e){return new ys(this,e)}recalculate(e,t){super.recalculate(e,t);const i=this.paint._values["fill-outline-color"];"constant"===i.value.kind&&void 0===i.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(e){return new hu(e)}queryRadius(){return _l(this.paint.get("fill-translate"))}queryIntersectsFeature(e,t,i,n,r,o){return!e.queryGeometry.isAboveHorizon&&al(vl(e.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),o.angle,e.pixelToTileUnitsFactor),n)}isTileClipped(){return!0}},"fill-extrusion":class extends ks{constructor(e){super(e,Hu)}createBucket(e){return new Fu(e)}queryRadius(){return _l(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}getProgramIds(){return[this.paint.get("fill-extrusion-pattern").constantOr(1)?"fillExtrusionPattern":"fillExtrusion"]}getProgramConfiguration(e){return new ys(this,e)}queryIntersectsFeature(e,t,i,n,r,o,a,s,l){const c=yl(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),o.angle,e.pixelToTileUnitsFactor),u=this.paint.get("fill-extrusion-height").evaluate(t,i),h=this.paint.get("fill-extrusion-base").evaluate(t,i),d=[0,0],p=s&&o.elevation,f=o.elevation?o.elevation.exaggeration():1,g=e.tile.getBucket(this);if(p&&g instanceof Fu){const e=g.centroidVertexArray,t=l+1;if(te.polygon)).flat());const _=p?s:null,[v,y]=function(e,t,i,n,r,o,a,s,l,c,u){return"globe"===e.projection.name?function(e,t,i,n,r,o,a,s,l,c,u){const h=[],d=[],p=e.projection.upVectorScale(u,e.center.lat,e.worldSize).metersToTile,f=[0,0,0,1],m=[0,0,0,1],g=(e,t,i,n)=>{e[0]=t,e[1]=i,e[2]=n,e[3]=1},_=qu();i>0&&(i+=_),n+=_;for(const _ of t){const t=[],v=[];for(const h of _){const d=h.x+r.x,_=h.y+r.y,y=e.projection.projectTilePoint(d,_,u),x=e.projection.upVector(u,h.x,h.y);let b=i,w=n;if(a){const e=nh(d,_,i,n,a,s,l,c);b+=e.base,w+=e.top}0!==i?g(f,y.x+x[0]*p*b,y.y+x[1]*p*b,y.z+x[2]*p*b):g(f,y.x,y.y,y.z),g(m,y.x+x[0]*p*w,y.y+x[1]*p*w,y.z+x[2]*p*w),Yl(f,f,o),Yl(m,m,o),t.push(new eh(f[0],f[1],f[2])),v.push(new eh(m[0],m[1],m[2]))}h.push(t),d.push(v)}return[h,d]}(e,t,i,n,r,o,a,s,l,c,u):a?function(e,t,i,n,r,o,a,s,l){const c=[],u=[],h=[0,0,0,1];for(const d of e){const e=[],p=[];for(const c of d){const u=c.x+n.x,d=c.y+n.y,f=nh(u,d,t,i,o,a,s,l);h[0]=u,h[1]=d,h[2]=f.base,h[3]=1,rc(h,h,r),h[3]=Math.max(h[3],1e-5);const m=new eh(h[0]/h[3],h[1]/h[3],h[2]/h[3]);h[0]=u,h[1]=d,h[2]=f.top,h[3]=1,rc(h,h,r),h[3]=Math.max(h[3],1e-5);const g=new eh(h[0]/h[3],h[1]/h[3],h[2]/h[3]);e.push(m),p.push(g)}c.push(e),u.push(p)}return[c,u]}(t,i,n,r,o,a,s,l,c):function(e,t,i,n,r){const o=[],a=[],s=r[8]*t,l=r[9]*t,c=r[10]*t,u=r[11]*t,h=r[8]*i,d=r[9]*i,p=r[10]*i,f=r[11]*i;for(const t of e){const e=[],i=[];for(const o of t){const t=o.x+n.x,a=o.y+n.y,m=r[0]*t+r[4]*a+r[12],g=r[1]*t+r[5]*a+r[13],_=r[2]*t+r[6]*a+r[14],v=r[3]*t+r[7]*a+r[15],y=m+s,x=g+l,b=_+c,w=Math.max(v+u,1e-5),T=m+h,C=g+d,S=_+p,E=Math.max(v+f,1e-5);e.push(new eh(y/w,x/w,b/w)),i.push(new eh(T/E,C/E,S/E))}o.push(e),a.push(i)}return[o,a]}(t,i,n,r,o)}(o,n,h,u,c,a,_,d,f,o.center.lat,e.tileID.canonical),x=e.queryGeometry;return function(e,t,i){let n=1/0;al(i,t)&&(n=ih(i,t[0]));for(let r=0;r=3)for(let t=0;t{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout((()=>{this._triggered=!1,this._callback()}),0))}remove(){this._channel=void 0,this._callback=()=>{}}}class Mf{constructor(){this.tasks={},this.taskQueue=[],R(["process"],this),this.invoker=new Af(this.process),this.nextId=0}add(e,t){const i=this.nextId++,n=function({type:e,isSymbolTile:t,zoom:i}){return i=i||0,"message"===e?0:"maybePrepare"!==e||t?"parseTile"!==e||t?"parseTile"===e&&t?300-i:"maybePrepare"===e&&t?400-i:500:200-i:100-i}(t);if(0===n){q();try{e()}finally{}return{cancel:()=>{}}}return this.tasks[i]={fn:e,metadata:t,priority:n,id:i},this.taskQueue.push(i),this.invoker.trigger(),{cancel:()=>{delete this.tasks[i]}}}process(){q();try{if(this.taskQueue=this.taskQueue.filter((e=>!!this.tasks[e])),!this.taskQueue.length)return;const e=this.pick();if(null===e)return;const t=this.tasks[e];if(delete this.tasks[e],this.taskQueue.length&&this.invoker.trigger(),!t)return;t.fn()}finally{}}pick(){let e=null,t=1/0;for(let i=0;i>=1)>1;){const e=i+r>>1,l=n+o>>1;1&t?(r=i,o=n,i=a,n=s):(i=r,n=o,r=a,o=s),a=e,s=l}const l=4*e;Lf[l+0]=i,Lf[l+1]=n,Lf[l+2]=r,Lf[l+3]=o}const Rf=new Uint16Array(2178),Bf=new Uint8Array(1089),Ff=new Uint16Array(1089);function $f(e){return 0===e?-.03125:32===e?.03125:0}var jf=aa([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);const Nf={type:2,extent:Ps,loadGeometry:()=>[[new m(0,0),new m(8193,0),new m(8193,8193),new m(0,8193),new m(0,0)]]};class Uf{constructor(e,t,i,n,r){this.tileID=e,this.uid=D(),this.uses=0,this.tileSize=t,this.tileZoom=i,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=r,this.expiredRequestCount=0,this.state="loading",n&&n.transform&&(this.projection=n.transform.projection)}registerFadeDuration(e){const t=e+this.timeAdded;tt.getLayer(e))).filter(Boolean);if(0!==e.length){n.layers=e,n.stateDependentLayerIds&&(n.stateDependentLayers=n.stateDependentLayerIds.map((t=>e.filter((e=>e.id===t))[0])));for(const t of e)i[t.id]=n}}return i}(e.buckets,t.style),this.hasSymbolBuckets=!1;for(const e in this.buckets){const t=this.buckets[e];if(t instanceof gf){if(this.hasSymbolBuckets=!0,!i)break;t.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const e in this.buckets){const t=this.buckets[e];if(t instanceof gf&&t.hasRTLText){this.hasRTLText=!0,jo.isLoading()||jo.isLoaded()||"deferred"!==Fo()||$o();break}}this.queryPadding=0;for(const e in this.buckets){const i=this.buckets[e];this.queryPadding=Math.max(this.queryPadding,t.style.getLayer(e).queryRadius(i))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage),e.lineAtlas&&(this.lineAtlas=e.lineAtlas)}else this.collisionBoxArray=new Ra}unloadVectorData(){if(this.hasData()){for(const e in this.buckets)this.buckets[e].destroy();this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.lineAtlasTexture&&this.lineAtlasTexture.destroy(),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),this.latestFeatureIndex=null,this.state="unloaded"}}getBucket(e){return this.buckets[e.id]}upload(e){for(const t in this.buckets){const i=this.buckets[t];i.uploadPending()&&i.upload(e)}const t=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new kf(e,this.imageAtlas.image,t.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new kf(e,this.glyphAtlasImage,t.ALPHA),this.glyphAtlasImage=null),this.lineAtlas&&!this.lineAtlas.uploaded&&(this.lineAtlasTexture=new kf(e,this.lineAtlas.image,t.ALPHA),this.lineAtlas.uploaded=!0)}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,t,i,n,r,o,a,s){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({tileResult:n,pixelPosMatrix:a,transform:o,params:r,tileTransform:this.tileTransform},e,t,i):{}}querySourceFeatures(e,t){const i=this.latestFeatureIndex;if(!i||!i.rawTileData)return;const n=i.loadVTLayers(),r=t?t.sourceLayer:"",o=n._geojsonTileLayer||n[r];if(!o)return;const a=ar(t&&t.filter),{z:s,x:l,y:c}=this.tileID.canonical,u={z:s,x:l,y:c};for(let t=0;te)i=!1;else if(t)if(this.expirationTime=0;e--){const t=4*e,i=Lf[t+0],n=Lf[t+1],r=Lf[t+2],o=Lf[t+3],a=i+r>>1,s=n+o>>1,l=a+s-n,c=s+i-a,u=n*Of+i,h=o*Of+r,d=s*Of+a,p=Math.hypot((Rf[2*u+0]+Rf[2*h+0])/2-Rf[2*d+0],(Rf[2*u+1]+Rf[2*h+1])/2-Rf[2*d+1])>=16;if(Bf[d]=Bf[d]||(p?1:0),e<1022){const e=(n+c>>1)*Of+(i+l>>1),t=(o+c>>1)*Of+(r+l>>1);Bf[d]=Bf[d]||Bf[e]||Bf[t]}}const r=new ua,o=new Ca;let a=0;function s(e,t){const i=t*Of+e;return 0===Ff[i]&&(r.emplaceBack(Rf[2*i+0],Rf[2*i+1],e*Ps/zf,t*Ps/zf),Ff[i]=++a),Ff[i]-1}function l(e,t,i,n,r,a){const c=e+i>>1,u=t+n>>1;if(Math.abs(e-r)+Math.abs(t-a)>1&&Bf[u*Of+c])l(r,a,e,t,c,u),l(i,n,r,a,c,u);else{const l=s(e,t),c=s(i,n),u=s(r,a);o.emplaceBack(l,c,u)}}return l(0,0,zf,zf,zf,0),l(zf,zf,0,0,0,zf),{vertices:r,indices:o}}(this.tileID.canonical,t);n=e.vertices,r=e.indices}else{n=new ua,r=new Ca;for(const{x:e,y:t}of i)n.emplaceBack(e,t,0,0);const e=Ic.exports(n.int16,void 0,4);for(let t=0;t0&&(a=kl(new Float64Array(16),t.globeMatrix)),this._makeGlobeTileDebugBorderBuffer(e,n,t,r,a,o),this._makeGlobeTileDebugTextBuffer(e,n,t,r,a,o)}_globePoint(e,t,i,n,r,o,a){let s=kp(e,t,i);if(o){const r=1<.5?h=-1:u<-.5&&(h=1);let d=(e/Ps+i.x)/r+h,p=(t/Ps+i.y)/r;d=(d-l)*n._pixelsPerMercatorPixel+l,p=(p-c)*n._pixelsPerMercatorPixel+c;const f=[d*n.worldSize,p*n.worldSize,0];Yl(f,f,o),s=xp(s,f,a)}return Yl(s,s,r)}_makeGlobeTileDebugBorderBuffer(e,t,i,n,r,o){const a=new la,s=new Pa,l=new ca,c=(e,c,u,h,d)=>{const p=(u-e)/(d-1),f=(h-c)/(d-1),m=a.length;for(let u=0;uc*e+t;for(let e=0;et[a])return null}else{const s=1/n[a];let l=(e[a]-i[a])*s,c=(t[a]-i[a])*s;if(l>c){const e=l;l=c,c=e}if(l>r&&(r=l),co)return null}return r}function Wf(e,t,i,n,r,o,a,s,l,c,u){const h=n-e,d=r-t,p=o-i,f=a-e,m=s-t,g=l-i,_=u[1]*g-u[2]*m,v=u[2]*f-u[0]*g,y=u[0]*m-u[1]*f,x=h*_+d*v+p*y;if(Math.abs(x)<1e-15)return null;const b=1/x,w=c[0]-e,T=c[1]-t,C=c[2]-i,S=(w*_+T*v+C*y)*b;if(S<0||S>1)return null;const E=T*p-C*d,k=C*h-w*p,A=w*d-T*h,M=(u[0]*E+u[1]*k+u[2]*A)*b;return M<0||S+M>1?null:(f*E+m*k+g*A)*b}function Zf(e,t,i){return(e-t)/(i-t)}function Hf(e,t,i,n,r,o,a,s,l){const c=1<{const o=n?1:0,a=(e+1)*i-o,s=t*i,l=(t+1)*i-o;r[0]=e*i,r[1]=s,r[2]=a,r[3]=l};let a=new Gf(n);const s=[];for(let t=0;t=1;n/=2){const e=i[i.length-1];a=new Gf(n);for(let t=0;t0;){const{idx:s,t:p,nodex:f,nodey:m,depth:g}=d.pop();if(this.leaves[s]){Hf(f,m,g,e,t,i,n,u,h);const s=1<=e[2])return p}continue}let _=0;for(let d=0;d=l[c[i]]&&(c.splice(i,0,d),t=!0);t||(c[_]=d),_++}}for(let e=0;e<_;e++){const t=c[e];d.push({idx:this.childOffsets[s]+t,t:l[t],nodex:(f<<1)+this._siblingOffset[t][0],nodey:(m<<1)+this._siblingOffset[t][1],depth:g+1})}}return null}_addNode(e,t,i){return this.minimums.push(e),this.maximums.push(t),this.leaves.push(i),this.childOffsets.push(0),this.nodeCount++}_construct(e,t,i,n,r){if(1===e[n].isLeaf(t,i))return;this.childOffsets[r]||(this.childOffsets[r]=this.nodeCount);const o=n-1,a=e[o];let s=0,l=0;for(let e=0;e=this.dim+1||t<-1||t>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(t+1)*this.stride+(e+1)}_unpackMapbox(e,t,i){return(256*e*256+256*t+i)/10-1e4}_unpackTerrarium(e,t,i){return 256*e+t+i/256-32768}static pack(e,t){const i=[0,0,0,0],n=Qf.getUnpackVector(t);let r=Math.floor((e+n[3])/n[2]);return i[2]=r%256,r=Math.floor(r/256),i[1]=r%256,r=Math.floor(r/256),i[0]=r,i}getPixels(){return new Cc({width:this.stride,height:this.stride},this.pixels)}backfillBorder(e,t,i){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let n=t*this.dim,r=t*this.dim+this.dim,o=i*this.dim,a=i*this.dim+this.dim;switch(t){case-1:n=r-1;break;case 1:r=n+1}switch(i){case-1:o=a-1;break;case 1:a=o+1}const s=-t*this.dim,l=-i*this.dim;for(let t=o;t{this.remove(e,r)}),i)),this.data[n].push(r),this.order.push(n),this.order.length>this.max){const e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){const t=this.data[e].shift();return t.timeout&&clearTimeout(t.timeout),0===this.data[e].length&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),t.value}getByKey(e){const t=this.data[e];return t?t[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,t){if(!this.has(e))return this;const i=e.wrapped().key,n=void 0===t?0:this.data[i].indexOf(t),r=this.data[i][n];return this.data[i].splice(n,1),r.timeout&&clearTimeout(r.timeout),0===this.data[i].length&&delete this.data[i],this.onRemove(r.value),this.order.splice(this.order.indexOf(i),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){const e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}filter(e){const t=[];for(const i in this.data)for(const n of this.data[i])e(n.value)||t.push(n);for(const e of t)this.remove(e.value.tileID,e)}}class tm{constructor(e,t,i){this.func=e,this.mask=t,this.range=i}}tm.ReadOnly=!1,tm.ReadWrite=!0,tm.disabled=new tm(519,tm.ReadOnly,[0,1]);const im=7680;class nm{constructor(e,t,i,n,r,o){this.test=e,this.ref=t,this.mask=i,this.fail=n,this.depthFail=r,this.pass=o}}nm.disabled=new nm({func:519,mask:0},0,0,im,im,im);class rm{constructor(e,t,i){this.blendFunction=e,this.blendColor=t,this.mask=i}}rm.Replace=[1,0],rm.disabled=new rm(rm.Replace,kt.transparent,[!1,!1,!1,!1]),rm.unblended=new rm(rm.Replace,kt.transparent,[!0,!0,!0,!0]),rm.alphaBlended=new rm([1,771],kt.transparent,[!0,!0,!0,!0]);const om=1029,am=2305;class sm{constructor(e,t,i){this.enable=e,this.mode=t,this.frontFace=i}}sm.disabled=new sm(!1,om,am),sm.backCCW=new sm(!0,om,am),sm.backCW=new sm(!0,om,2304),sm.frontCW=new sm(!0,1028,2304),sm.frontCCW=new sm(!0,1028,am);class lm extends Xe{constructor(e,t,i){super(),this.id=e,this._onlySymbols=i,t.on("data",(e=>{"source"===e.dataType&&"metadata"===e.sourceDataType&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&"source"===e.dataType&&"content"===e.sourceDataType&&(this.reload(),this.transform&&this.update(this.transform))})),t.on("error",(()=>{this._sourceErrored=!0})),this._source=t,this._tiles={},this._cache=new em(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._minTileCacheSize=t.minTileCacheSize,this._maxTileCacheSize=t.maxTileCacheSize,this._loadedParentTiles={},this._coveredTiles={},this._state=new Vf,this._isRaster="raster"===this._source.type||"raster-dem"===this._source.type||"custom"===this._source.type&&"raster"===this._source._dataType}onAdd(e){this.map=e,this._minTileCacheSize=void 0===this._minTileCacheSize&&e?e._minTileCacheSize:this._minTileCacheSize,this._maxTileCacheSize=void 0===this._maxTileCacheSize&&e?e._maxTileCacheSize:this._maxTileCacheSize}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded)return!1;if(!this._source.loaded())return!1;for(const e in this._tiles){const t=this._tiles[e];if("loaded"!==t.state&&"errored"!==t.state)return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform)}_loadTile(e,t){return e.isSymbolTile=this._onlySymbols,this._source.loadTile(e,t)}_unloadTile(e){if(this._source.unloadTile)return this._source.unloadTile(e,(()=>{}))}_abortTile(e){if(this._source.abortTile)return this._source.abortTile(e,(()=>{}))}serialize(){return this._source.serialize()}prepare(e){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const t in this._tiles){const i=this._tiles[t];i.upload(e),i.prepare(this.map.style.imageManager)}}getIds(){return M(this._tiles).map((e=>e.tileID)).sort(cm).map((e=>e.key))}getRenderableIds(e){const t=[];for(const i in this._tiles)this._isIdRenderable(+i,e)&&t.push(this._tiles[i]);return e?t.sort(((e,t)=>{const i=e.tileID,n=t.tileID,r=new m(i.canonical.x,i.canonical.y)._rotate(this.transform.angle),o=new m(n.canonical.x,n.canonical.y)._rotate(this.transform.angle);return i.overscaledZ-n.overscaledZ||o.y-r.y||o.x-r.x})).map((e=>e.tileID.key)):t.map((e=>e.tileID)).sort(cm).map((e=>e.key))}hasRenderableParent(e){const t=this.findLoadedParent(e,0);return!!t&&this._isIdRenderable(t.tileID.key)}_isIdRenderable(e,t){return this._tiles[e]&&this._tiles[e].hasData()&&!this._coveredTiles[e]&&(t||!this._tiles[e].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const e in this._tiles)"errored"!==this._tiles[e].state&&this._reloadTile(+e,"reloading")}}_reloadTile(e,t){const i=this._tiles[e];i&&("loading"!==i.state&&(i.state=t),this._loadTile(i,this._tileLoaded.bind(this,i,e,t)))}_tileLoaded(e,t,i,n){if(n)if(e.state="errored",404!==n.status)this._source.fire(new He(n,{tile:e}));else if("raster-dem"===this._source.type&&this.usedForTerrain&&this.map.painter.terrain){const e=this.map.painter.terrain;this.update(this.transform,e.getScaledDemTileSize(),!0),e.resetTileLookupCache(this.id)}else this.update(this.transform);else e.timeAdded=Ge.now(),"expired"===i&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(t,e),"raster-dem"===this._source.type&&e.dem&&this._backfillDEM(e),this._state.initializeTileState(e,this.map?this.map.painter:null),this._source.fire(new Ze("data",{dataType:"source",tile:e,coord:e.tileID,sourceCacheId:this.id}))}_backfillDEM(e){const t=this.getRenderableIds();for(let n=0;n1||(Math.abs(i)>1&&(1===Math.abs(i+r)?i+=r:1===Math.abs(i-r)&&(i-=r)),t.dem&&e.dem&&(e.dem.backfillBorder(t.dem,i,n),e.neighboringTiles&&e.neighboringTiles[o]&&(e.neighboringTiles[o].backfilled=!0)))}}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._tiles[e]}_retainLoadedChildren(e,t,i,n){for(const r in this._tiles){let o=this._tiles[r];if(n[r]||!o.hasData()||o.tileID.overscaledZ<=t||o.tileID.overscaledZ>i)continue;let a=o.tileID;for(;o&&o.tileID.overscaledZ>t+1;){const e=o.tileID.scaledTo(o.tileID.overscaledZ-1);o=this._tiles[e.key],o&&o.hasData()&&(a=e)}let s=a;for(;s.overscaledZ>t;)if(s=s.scaledTo(s.overscaledZ-1),e[s.key]){n[a.key]=a;break}}}findLoadedParent(e,t){if(e.key in this._loadedParentTiles){const i=this._loadedParentTiles[e.key];return i&&i.tileID.overscaledZ>=t?i:null}for(let i=e.overscaledZ-1;i>=t;i--){const t=e.scaledTo(i),n=this._getLoadedTile(t);if(n)return n}}_getLoadedTile(e){const t=this._tiles[e.key];return t&&t.hasData()?t:this._cache.getByKey(this._source.reparseOverscaled?e.wrapped().key:e.canonical.key)}updateCacheSize(e,t){t=t||this._source.tileSize;const i=Math.ceil(e.width/t)+1,n=Math.ceil(e.height/t)+1,r=Math.floor(i*n*5),o="number"==typeof this._minTileCacheSize?Math.max(this._minTileCacheSize,r):r,a="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,o):o;this._cache.setMaxSize(a)}handleWrapJump(e){const t=Math.round((e-(void 0===this._prevLng?e:this._prevLng))/360);if(this._prevLng=e,t){const e={};for(const i in this._tiles){const n=this._tiles[i];n.tileID=n.tileID.unwrapTo(n.tileID.wrap+t),e[n.tileID.key]=n}this._tiles=e;for(const e in this._timers)clearTimeout(this._timers[e]),delete this._timers[e];for(const e in this._tiles)this._setTileReloadTimer(+e,this._tiles[e])}}update(e,t,i){if(this.transform=e,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage)return;if(this.usedForTerrain&&!i)return;let n;this.updateCacheSize(e,t),"globe"!==this.transform.projection.name&&this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?n=e.getVisibleUnwrappedCoordinates(this._source.tileID).map((e=>new Ju(e.canonical.z,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y))):(n=e.coveringTiles({tileSize:t||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!i,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain}),this._source.hasTile&&(n=n.filter((e=>this._source.hasTile(e))))):n=[];const r=this._updateRetainedTiles(n);if(um(this._source.type)&&0!==n.length){const e={},t={},i=Object.keys(r);for(const n of i){const i=r[n],o=this._tiles[n];if(!o||o.fadeEndTime&&o.fadeEndTime<=Ge.now())continue;const a=this.findLoadedParent(i,Math.max(i.overscaledZ-lm.maxOverzooming,this._source.minzoom));a&&(this._addTile(a.tileID),e[a.tileID.key]=a.tileID),t[n]=i}const o=n[n.length-1].overscaledZ;for(const e in this._tiles){const i=this._tiles[e];if(r[e]||!i.hasData())continue;let n=i.tileID;for(;n.overscaledZ>o;){n=n.scaledTo(n.overscaledZ-1);const o=this._tiles[n.key];if(o&&o.hasData()&&t[n.key]){r[e]=i.tileID;break}}}for(const t in e)r[t]||(this._coveredTiles[t]=!0,r[t]=e[t])}for(const e in r)this._tiles[e].clearFadeHold();const o=function(e,t){const i=[];for(const n in e)n in t||i.push(n);return i}(this._tiles,r);for(const e of o){const t=this._tiles[e];t.hasSymbolBuckets&&!t.holdingForFade()?t.setHoldDuration(this.map._fadeDuration):t.hasSymbolBuckets&&!t.symbolFadeFinished()||this._removeTile(+e)}this._updateLoadedParentTileCache(),this._onlySymbols&&this._source.afterUpdate&&this._source.afterUpdate()}releaseSymbolFadeTiles(){for(const e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(+e)}_updateRetainedTiles(e){const t={};if(0===e.length)return t;const i={},n=e.reduce(((e,t)=>Math.min(e,t.overscaledZ)),1/0),r=e[0].overscaledZ,o=Math.max(r-lm.maxOverzooming,this._source.minzoom),a=Math.max(r+lm.maxUnderzooming,this._source.minzoom),s={};for(const i of e){const e=this._addTile(i);t[i.key]=i,e.hasData()||n=this._source.maxzoom){const e=n.children(this._source.maxzoom)[0],i=this.getTile(e);if(i&&i.hasData()){t[e.key]=e;continue}}else{const e=n.children(this._source.maxzoom);if(t[e[0].key]&&t[e[1].key]&&t[e[2].key]&&t[e[3].key])continue}let r=e.wasRequested();for(let a=n.overscaledZ-1;a>=o;--a){const o=n.scaledTo(a);if(i[o.key])break;if(i[o.key]=!0,e=this.getTile(o),!e&&r&&(e=this._addTile(o)),e&&(t[o.key]=o,r=e.wasRequested(),e.hasData()))break}}return t}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const e in this._tiles){const t=[];let i,n=this._tiles[e].tileID;for(;n.overscaledZ>0;){if(n.key in this._loadedParentTiles){i=this._loadedParentTiles[n.key];break}t.push(n.key);const e=n.scaledTo(n.overscaledZ-1);if(i=this._getLoadedTile(e),i)break;n=e}for(const e of t)this._loadedParentTiles[e]=i}}_addTile(e){let t=this._tiles[e.key];if(t)return t;t=this._cache.getAndRemove(e),t&&(this._setTileReloadTimer(e.key,t),t.tileID=e,this._state.initializeTileState(t,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,t)));const i=Boolean(t);if(!i){const i=this.map?this.map.painter:null;t=new Uf(e,this._source.tileSize*e.overscaleFactor(),this.transform.tileZoom,i,this._isRaster),this._loadTile(t,this._tileLoaded.bind(this,t,e.key,t.state))}return t?(t.uses++,this._tiles[e.key]=t,i||this._source.fire(new Ze("dataloading",{tile:t,coord:t.tileID,dataType:"source"})),t):null}_setTileReloadTimer(e,t){e in this._timers&&(clearTimeout(this._timers[e]),delete this._timers[e]);const i=t.getExpiryTimeout();i&&(this._timers[e]=setTimeout((()=>{this._reloadTile(e,"expired"),delete this._timers[e]}),i))}_removeTile(e){const t=this._tiles[e];t&&(t.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),t.uses>0||(t.hasData()&&"reloading"!==t.state?this._cache.add(t.tileID,t,t.getExpiryTimeout()):(t.aborted=!0,this._abortTile(t),this._unloadTile(t))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const e in this._tiles)this._removeTile(+e);this._source._clear&&this._source._clear(),this._cache.reset(),this.map&&this.usedForTerrain&&this.map.painter.terrain&&this.map.painter.terrain.resetTileLookupCache(this.id)}tilesIn(e,t,i){const n=[],r=this.transform;if(!r)return n;const o="globe"===r.projection.name,a=Bs(r.center.lng);for(const s in this._tiles){const l=this._tiles[s];if(i&&l.clearQueryDebugViz(),l.holdingForFade())continue;let c;if(o){const e=l.tileID.canonical;if(0===e.z){const t=[Math.abs(S(a,...hm(e,-1))-a),Math.abs(S(a,...hm(e,1))-a)];c=[0,2*t.indexOf(Math.min(...t))-1]}else{const t=[Math.abs(S(a,...hm(e,-1))-a),Math.abs(S(a,...hm(e,0))-a),Math.abs(S(a,...hm(e,1))-a)];c=[t.indexOf(Math.min(...t))-1]}}else c=[0];for(const i of c){const o=e.containsTile(l,r,t,i);o&&n.push(o)}}return n}getVisibleCoordinates(e){const t=this.getRenderableIds(e).map((e=>this._tiles[e].tileID));for(const e of t)e.projMatrix=this.transform.calculateProjMatrix(e.toUnwrapped());return t}hasTransition(){if(this._source.hasTransition())return!0;if(um(this._source.type))for(const e in this._tiles){const t=this._tiles[e];if(void 0!==t.fadeEndTime&&t.fadeEndTime>=Ge.now())return!0}return!1}setFeatureState(e,t,i){this._state.updateState(e=e||"_geojsonTileLayer",t,i)}removeFeatureState(e,t,i){this._state.removeFeatureState(e=e||"_geojsonTileLayer",t,i)}getFeatureState(e,t){return this._state.getState(e=e||"_geojsonTileLayer",t)}setDependencies(e,t,i){const n=this._tiles[e];n&&n.setDependencies(t,i)}reloadTilesForDependencies(e,t){for(const i in this._tiles)this._tiles[i].hasDependency(e,t)&&this._reloadTile(+i,"reloading");this._cache.filter((i=>!i.hasDependency(e,t)))}_preloadTiles(e,t){const i=new Map,n=Array.isArray(e)?e:[e],r=this.map.painter.terrain,o=this.usedForTerrain&&r?r.getScaledDemTileSize():this._source.tileSize;for(const e of n){const t=e.coveringTiles({tileSize:o,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain});for(const e of t)i.set(e.key,e);this.usedForTerrain&&e.updateElevation(!1)}A(Array.from(i.values()),((e,t)=>{const i=new Uf(e,this._source.tileSize*e.overscaleFactor(),this.transform.tileZoom,this.map.painter,this._isRaster);this._loadTile(i,(e=>{"raster-dem"===this._source.type&&i.dem&&this._backfillDEM(i),t(e,i)}))}),t)}}function cm(e,t){const i=Math.abs(2*e.wrap)-+(e.wrap<0),n=Math.abs(2*t.wrap)-+(t.wrap<0);return e.overscaledZ-t.overscaledZ||n-i||t.canonical.y-e.canonical.y||t.canonical.x-e.canonical.x}function um(e){return"raster"===e||"image"===e||"video"===e||"custom"===e}function hm(e,t){const i=1<=0&&n[3]>=0&&s.insert(a,n[0],n[1],n[2],n[3])}}loadVTLayers(){if(!this.vtLayers){this.vtLayers=new Iu(new Dh(this.rawTileData)).layers,this.sourceLayerCoder=new If(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={};for(const e in this.vtLayers)this.vtFeatures[e]=[]}return this.vtLayers}query(e,t,i,n){this.loadVTLayers();const r=e.params||{},o=ar(r.filter),a=e.tileResult,s=e.transform,l=a.bufferedTilespaceBounds,c=this.grid.query(l.min.x,l.min.y,l.max.x,l.max.y,((e,t,i,n)=>fl(a.bufferedTilespaceGeometry,e,t,i,n)));c.sort(mm);let u=null;s.elevation&&c.length>0&&(u=dm.create(s.elevation,this.tileID));const h={};let d;for(let s=0;s(f||(f=Qs(t,this.tileID.canonical,e.tileTransform)),i.queryIntersectsFeature(a,t,n,f,this.z,e.transform,e.pixelPosMatrix,u,r))))}return h}loadMatchingFeature(e,t,i,n,r,o,a,s,l){const{featureIndex:c,bucketIndex:u,sourceLayerIndex:h,layoutVertexArrayOffset:d}=t,p=this.bucketLayerIDs[u];if(n&&!function(e,t){for(let i=0;i=0)return!0;return!1}(n,p))return;const f=this.sourceLayerCoder.decode(h),m=this.vtLayers[f].feature(c);if(i.needGeometry){const e=el(m,!0);if(!i.filter(new No(this.tileID.overscaledZ),e,this.tileID.canonical))return}else if(!i.filter(new No(this.tileID.overscaledZ),m))return;const g=this.getId(m,f);for(let t=0;t{const a=t instanceof Xo?t.get(o):null;return a&&a.evaluate?a.evaluate(i,n,r):a}))}function mm(e,t){return t-e}Nr(pm,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});class gm{constructor(e,t){this.width=e,this.height=t,this.nextRow=0,this.image=new Tc({width:e,height:t}),this.positions={},this.uploaded=!1}getDash(e,t){const i=this.getKey(e,t);return this.positions[i]}trim(){const e=this.width,t=this.height=O(this.nextRow);this.image.resize({width:e,height:t})}getKey(e,t){return e.join(",")+t}getDashRanges(e,t,i){const n=[];let r=e.length%2==1?-e[e.length-1]*i:0,o=e[0]*i,a=!0;n.push({left:r,right:o,isDash:a,zeroLength:0===e[0]});let s=e[0];for(let t=1;t1&&(a=e[++o]);const l=Math.abs(s-a.left),c=Math.abs(s-a.right),u=Math.min(l,c);let h;const d=t/i*(n+1);if(a.isDash){const e=n-Math.abs(d);h=Math.sqrt(u*u+e*e)}else h=n-Math.sqrt(u*u+d*d);this.image.data[r+s]=Math.max(0,Math.min(255,h+128))}}}addRegularDash(e,t){for(let t=e.length-1;t>=0;--t){const i=e[t],n=e[t+1];i.zeroLength?e.splice(t,1):n&&n.isDash===i.isDash&&(n.left=i.left,e.splice(t,1))}const i=e[0],n=e[e.length-1];i.isDash===n.isDash&&(i.left=n.left-this.width,n.right=i.right+this.width);const r=this.width*this.nextRow;let o=0,a=e[o];for(let i=0;i1&&(a=e[++o]);const n=Math.abs(i-a.left),s=Math.abs(i-a.right),l=Math.min(n,s);this.image.data[r+i]=Math.max(0,Math.min(255,(a.isDash?l:-l)+t+128))}}addDash(e,t){const i=this.getKey(e,t);if(this.positions[i])return this.positions[i];const n="round"===t,r=n?7:0,o=2*r+1;if(this.nextRow+o>this.height)return U("LineAtlas out of space"),null;0===e.length&&e.push(1);let a=0;for(let t=0;t=t.maxzoom||"none"!==t.visibility&&(ym(e,this.zoom,i),(s[t.id]=t.createBucket({index:a.bucketLayerIDs.length,layers:e,zoom:this.zoom,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:h,sourceID:this.source,enableTerrain:this.enableTerrain,projection:this.projection.spec,availableImages:i})).populate(d,c,this.tileID.canonical,this.tileTransform),a.bucketLayerIDs.push(e.map((e=>e.id))))}}let h,d,p,f;l.trim();const m={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},g=F(c.glyphDependencies,(e=>Object.keys(e).map(Number)));Object.keys(g).length?n.send("getGlyphs",{uid:this.uid,stacks:g},((e,t)=>{h||(h=e,d=t,y.call(this))}),void 0,!1,m):d={};const _=Object.keys(c.iconDependencies);_.length?n.send("getImages",{icons:_,source:this.source,tileID:this.tileID,type:"icons"},((e,t)=>{h||(h=e,p=t,y.call(this))}),void 0,!1,m):p={};const v=Object.keys(c.patternDependencies);function y(){if(h)return r(h);if(d&&p&&f){const e=new _m(d),t=new od(p,f);for(const n in s){const r=s[n];r instanceof gf?(ym(r.layers,this.zoom,i),Yd(r,d,e.positions,p,t.iconPositions,this.showCollisionBoxes,i,this.tileID.canonical,this.tileZoom,this.projection)):r.hasPattern&&(r instanceof uh||r instanceof hu||r instanceof Fu)&&(ym(r.layers,this.zoom,i),r.addFeatures(c,this.tileID.canonical,t.patternPositions,i,this.tileTransform))}this.status="done",r(null,{buckets:M(s).filter((e=>!e.isEmpty())),featureIndex:a,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:e.image,lineAtlas:l,imageAtlas:t,glyphMap:this.returnDependencies?d:null,iconMap:this.returnDependencies?p:null,glyphPositions:this.returnDependencies?e.positions:null})}}v.length?n.send("getImages",{icons:v,source:this.source,tileID:this.tileID,type:"patterns"},((e,t)=>{h||(h=e,f=t,y.call(this))}),void 0,!1,m):f={},y.call(this)}}function ym(e,t,i){const n=new No(t);for(const t of e)t.recalculate(n,i)}class xm{constructor(e){this.entries={},this.scheduler=e}request(e,t,i,n){const r=this.entries[e]=this.entries[e]||{callbacks:[]};if(r.result){const[e,i]=r.result;return this.scheduler?this.scheduler.add((()=>{n(e,i)}),t):n(e,i),()=>{}}return r.callbacks.push(n),r.cancel||(r.cancel=i(((i,n)=>{r.result=[i,n];for(const e of r.callbacks)this.scheduler?this.scheduler.add((()=>{e(i,n)}),t):e(i,n);setTimeout((()=>delete this.entries[e]),3e3)}))),()=>{r.result||(r.callbacks=r.callbacks.filter((e=>e!==n)),r.callbacks.length||(r.cancel(),delete this.entries[e]))}}}function bm(e,t,i){const n=JSON.stringify(e.request);return e.data&&(this.deduped.entries[n]={result:[null,e.data]}),this.deduped.request(n,{type:"parseTile",isSymbolTile:e.isSymbolTile,zoom:e.tileZoom},(t=>{const n=ue(e.request,((e,n,r,o)=>{e?t(e):n&&t(null,{vectorTile:i?void 0:new Iu(new Dh(n)),rawData:n,cacheControl:r,expires:o})}));return()=>{n.cancel(),t()}}),t)}t.ARRAY_TYPE=Tl,t.AUTH_ERR_MSG=ge,t.Aabb=pc,t.Actor=class{constructor(e,t,n){this.target=e,this.parent=t,this.mapId=n,this.callbacks={},this.cancelCallbacks={},R(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.globalScope=q()?e:i,this.scheduler=new Mf}send(e,t,i,n,r=!1,o){const a=Math.round(1e18*Math.random()).toString(36).substring(0,10);i&&(i.metadata=o,this.callbacks[a]=i);const s=H(this.globalScope)?void 0:[];return this.target.postMessage({id:a,type:e,hasCallback:!!i,targetMapId:n,mustQueue:r,sourceMapId:this.mapId,data:Gr(t,s)},s),{cancel:()=>{i&&delete this.callbacks[a],this.target.postMessage({id:a,type:"",targetMapId:n,sourceMapId:this.mapId})}}}receive(e){const t=e.data,i=t.id;if(i&&(!t.targetMapId||this.mapId===t.targetMapId))if(""===t.type){const e=this.cancelCallbacks[i];delete this.cancelCallbacks[i],e&&e.cancel()}else if(t.mustQueue||q()){const e=this.callbacks[i];this.cancelCallbacks[i]=this.scheduler.add((()=>this.processTask(i,t)),e&&e.metadata||{type:"message"})}else this.processTask(i,t)}processTask(e,t){if(""===t.type){const i=this.callbacks[e];delete this.callbacks[e],i&&(t.error?i(qr(t.error)):i(null,qr(t.data)))}else{const i=H(this.globalScope)?void 0:[],n=t.hasCallback?(t,n)=>{delete this.cancelCallbacks[e],this.target.postMessage({id:e,type:"",sourceMapId:this.mapId,error:t?Gr(t):null,data:Gr(n,i)},i)}:e=>{},r=qr(t.data);if(this.parent[t.type])this.parent[t.type](t.sourceMapId,r,n);else if(this.parent.getWorkerSource){const e=t.type.split(".");this.parent.getWorkerSource(t.sourceMapId,e[0],r.source)[e[1]](r,n)}else n(new Error(`Could not find function ${t.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}},t.CanonicalTileID=Yu,t.Color=kt,t.ColorMode=rm,t.CullFaceMode=sm,t.DEMData=Qf,t.DataConstantProperty=Yo,t.DedupedRequest=xm,t.DepthMode=tm,t.EXTENT=Ps,t.Elevation=class{isDataAvailableAtPoint(e){const t=this._source();if(this.isUsingMockSource()||!t||e.y<0||e.y>1)return!1;const i=t.getSource().maxzoom,n=1<1)return t;const r=n.getSource().maxzoom,o=1<{const o=this.getAtTileOffset(e,r.x,r.y),a=n.upVector(e.canonical,r.x,r.y);return ql(a,a,o*n.upVectorScale(e.canonical,t,i).metersToTile),a}}getForTilePoints(e,t,i,n){if(this.isUsingMockSource())return!1;const r=dm.create(this,e,n);return!!r&&(t.forEach((e=>{e[2]=this.exaggeration()*r.getElevationAt(e[0],e[1],i)})),!0)}getMinMaxForTile(e){if(this.isUsingMockSource())return null;const t=this.findDEMTileFor(e);if(!t||!t.dem)return null;const i=t.dem.tree,n=t.tileID,r=1<this._skuTokenExpiresAt}transformRequest(e,t){return this._transformRequestFn&&this._transformRequestFn(e,t)||{url:e}}normalizeStyleURL(e,t){if(!_e(e))return e;const i=we(e);return i.path=`/styles/v1${i.path}`,this._makeAPIURL(i,this._customAccessToken||t)}normalizeGlyphsURL(e,t){if(!_e(e))return e;const i=we(e);return i.path=`/fonts/v1${i.path}`,this._makeAPIURL(i,this._customAccessToken||t)}normalizeSourceURL(e,t,i,n){if(!_e(e))return e;const r=we(e);return r.path=`/v4/${r.authority}.json`,r.params.push("secure"),i&&r.params.push(`language=${i}`),n&&r.params.push(`worldview=${n}`),this._makeAPIURL(r,this._customAccessToken||t)}normalizeSpriteURL(e,t,i,n){const r=we(e);return _e(e)?(r.path=`/styles/v1${r.path}/sprite${t}${i}`,this._makeAPIURL(r,this._customAccessToken||n)):(r.path+=`${t}${i}`,Te(r))}normalizeTileURL(e,t,i){if(this._isSkuTokenExpired()&&this._createSkuToken(),e&&!_e(e))return e;const n=we(e);n.path=n.path.replace(/(\.(png|jpg)\d*)(?=$)/,`${t||i&&"raster"!==n.authority&&512===i?"@2x":""}${a.supported?".webp":"$1"}`),"raster"===n.authority?n.path=`/${o.RASTER_URL_PREFIX}${n.path}`:(n.path=n.path.replace(/^.+\/v4\//,"/"),n.path=`/${o.TILE_URL_VERSION}${n.path}`);const r=this._customAccessToken||function(e){for(const t of e){const e=t.match(/^access_token=(.*)$/);if(e)return e[1]}return null}(n.params)||o.ACCESS_TOKEN;return o.REQUIRE_ACCESS_TOKEN&&r&&this._skuToken&&n.params.push(`sku=${this._skuToken}`),this._makeAPIURL(n,r)}canonicalizeTileURL(e,t){const i=we(e);if(!i.path.match(/^(\/v4\/|\/raster\/v1\/)/)||!i.path.match(/\.[\w]+$/))return e;let n="mapbox://";i.path.match(/^\/raster\/v1\//)?n+=`raster/${i.path.replace(`/${o.RASTER_URL_PREFIX}/`,"")}`:n+=`tiles/${i.path.replace(`/${o.TILE_URL_VERSION}/`,"")}`;let r=i.params;return t&&(r=r.filter((e=>!e.match(/^access_token=/)))),r.length&&(n+=`?${r.join("&")}`),n}canonicalizeTileset(e,t){const i=!!t&&_e(t),n=[];for(const t of e.tiles||[])ve(t)?n.push(this.canonicalizeTileURL(t,i)):n.push(t);return n}_makeAPIURL(e,t){const i="See https://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes",n=we(o.API_URL);if(e.protocol=n.protocol,e.authority=n.authority,"http"===e.protocol){const t=e.params.indexOf("secure");t>=0&&e.params.splice(t,1)}if("/"!==n.path&&(e.path=`${n.path}${e.path}`),!o.REQUIRE_ACCESS_TOKEN)return Te(e);if(t=t||o.ACCESS_TOKEN,!this._silenceAuthErrors){if(!t)throw new Error(`An API access token is required to use Mapbox GL. ${i}`);if("s"===t[0])throw new Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${i}`)}return e.params=e.params.filter((e=>-1===e.indexOf("access_token"))),e.params.push(`access_token=${t||""}`),Te(e)}},t.ResourceType=ae,t.SegmentVector=Is,t.SourceCache=lm,t.StencilMode=nm,t.StructArrayLayout1ui2=Pa,t.StructArrayLayout2f1f2i16=ba,t.StructArrayLayout2i4=la,t.StructArrayLayout2ui4=Ia,t.StructArrayLayout3f12=Ta,t.StructArrayLayout3ui6=Ca,t.StructArrayLayout4i8=ua,t.StructArrayLayout5f20=Aa,t.Texture=kf,t.Tile=Uf,t.Transitionable=Go,t.Uniform1f=ss,t.Uniform1i=class extends as{constructor(e){super(e),this.current=0}set(e,t,i){this.fetchUniformLocation(e,t)&&this.current!==i&&(this.current=i,this.gl.uniform1i(this.location,i))}},t.Uniform2f=class extends as{constructor(e){super(e),this.current=[0,0]}set(e,t,i){this.fetchUniformLocation(e,t)&&(i[0]===this.current[0]&&i[1]===this.current[1]||(this.current=i,this.gl.uniform2f(this.location,i[0],i[1])))}},t.Uniform3f=class extends as{constructor(e){super(e),this.current=[0,0,0]}set(e,t,i){this.fetchUniformLocation(e,t)&&(i[0]===this.current[0]&&i[1]===this.current[1]&&i[2]===this.current[2]||(this.current=i,this.gl.uniform3f(this.location,i[0],i[1],i[2])))}},t.Uniform4f=ls,t.UniformColor=cs,t.UniformMatrix2f=class extends as{constructor(e){super(e),this.current=ds}set(e,t,i){if(this.fetchUniformLocation(e,t))for(let e=0;e<4;e++)if(i[e]!==this.current[e]){this.current=i,this.gl.uniformMatrix2fv(this.location,!1,i);break}}},t.UniformMatrix3f=class extends as{constructor(e){super(e),this.current=hs}set(e,t,i){if(this.fetchUniformLocation(e,t))for(let e=0;e<9;e++)if(i[e]!==this.current[e]){this.current=i,this.gl.uniformMatrix3fv(this.location,!1,i);break}}},t.UniformMatrix4f=class extends as{constructor(e){super(e),this.current=us}set(e,t,i){if(this.fetchUniformLocation(e,t)){if(i[12]!==this.current[12]||i[0]!==this.current[0])return this.current=i,void this.gl.uniformMatrix4fv(this.location,!1,i);for(let e=1;e<16;e++)if(i[e]!==this.current[e]){this.current=i,this.gl.uniformMatrix4fv(this.location,!1,i);break}}}},t.UnwrappedTileID=Ku,t.ValidationError=Kn,t.VectorTileFeature=Pu,t.VectorTileWorkerSource=class extends Xe{constructor(e,t,i,n,r){super(),this.actor=e,this.layerIndex=t,this.availableImages=i,this.loadVectorData=r||bm,this.loading={},this.loaded={},this.deduped=new xm(e.scheduler),this.isSpriteLoaded=n,this.scheduler=e.scheduler}loadTile(e,t){const i=e.uid,n=e&&e.request,r=n&&n.collectResourceTiming,o=this.loading[i]=new vm(e);o.abort=this.loadVectorData(e,((a,s)=>{const l=!this.loading[i];if(delete this.loading[i],l||a||!s)return o.status="done",l||(this.loaded[i]=o),t(a);const c=s.rawData,u={};s.expires&&(u.expires=s.expires),s.cacheControl&&(u.cacheControl=s.cacheControl),o.vectorTile=s.vectorTile||new Iu(new Dh(c));const h=()=>{o.parse(o.vectorTile,this.layerIndex,this.availableImages,this.actor,((e,i)=>{if(e||!i)return t(e);const o={};if(r){const e=$e(n);e.length>0&&(o.resourceTiming=JSON.parse(JSON.stringify(e)))}t(null,I({rawTileData:c.slice(0)},i,u,o))}))};this.isSpriteLoaded?h():this.once("isSpriteLoaded",(()=>{this.scheduler?this.scheduler.add(h,{type:"parseTile",isSymbolTile:e.isSymbolTile,zoom:e.tileZoom}):h()})),this.loaded=this.loaded||{},this.loaded[i]=o}))}reloadTile(e,t){const i=this.loaded,n=e.uid,r=this;if(i&&i[n]){const o=i[n];o.showCollisionBoxes=e.showCollisionBoxes,o.enableTerrain=!!e.enableTerrain,o.projection=e.projection,o.tileTransform=$p(e.tileID.canonical,e.projection);const a=(e,i)=>{const n=o.reloadCallback;n&&(delete o.reloadCallback,o.parse(o.vectorTile,r.layerIndex,this.availableImages,r.actor,n)),t(e,i)};"parsing"===o.status?o.reloadCallback=a:"done"===o.status&&(o.vectorTile?o.parse(o.vectorTile,this.layerIndex,this.availableImages,this.actor,a):a())}}abortTile(e,t){const i=e.uid,n=this.loading[i];n&&(n.abort&&n.abort(),delete this.loading[i]),t()}removeTile(e,t){const i=this.loaded,n=e.uid;i&&i[n]&&delete i[n],t()}},t.WritingMode=ad,t.ZoomHistory=Wr,t.add=jl,t.addDynamicAttributes=df,t.adjoint=function(e,t){var i=t[0],n=t[1],r=t[2],o=t[3],a=t[4],s=t[5],l=t[6],c=t[7],u=t[8];return e[0]=a*u-s*c,e[1]=r*c-n*u,e[2]=n*s-r*a,e[3]=s*l-o*u,e[4]=i*u-r*l,e[5]=r*o-i*s,e[6]=o*c-a*l,e[7]=n*l-i*c,e[8]=i*a-n*o,e},t.asyncAll=A,t.bezier=T,t.bindAll=R,t.boundsAttributes=jf,t.bufferConvexPolygon=function(e,t){const i=[];for(let n=0;nte&&(e.getActor().send("enforceCacheSizeLimit",ee),oe=0)},t.calculateGlobeLabelMatrix=function(e,t){const{x:i,y:n}=e.point,r=Dp(i,n,e.worldSize/e._pixelsPerMercatorPixel,0,0);return Al(r,r,Pp(yp(t)))},t.calculateGlobeMatrix=function(e){const{x:t,y:i}=e.point,{lng:n,lat:r}=e._center;return Dp(t,i,e.worldSize,n,r)},t.calculateGlobeMercatorMatrix=function(e){const t=e.pixelsPerMeter,i=t/$s(1,e.center.lat),n=El(new Float64Array(16));return Ml(n,n,[e.point.x,e.point.y,0]),Il(n,n,[i,i,t]),Float32Array.from(n)},t.circumferenceAtLatitude=Rs,t.clamp=S,t.clearTileCache=function(e){if(!ie())return;const t=i.caches.delete(K);e&&t.catch(e).then((()=>e()))},t.clipLine=Id,t.clone=function(e){var t=new Tl(16);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],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},t.clone$1=j,t.collisionCircleLayout=bh,t.config=o,t.conjugate=function(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e},t.create=function(){var e=new Tl(16);return Tl!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e},t.create$1=Cl,t.createExpression=qn,t.createLayout=aa,t.createStyleLayer=function(e){return"custom"===e.type?new Tf(e):new Ef[e.type](e)},t.cross=Xl,t.degToRad=y,t.distance=function(e,t){return Math.hypot(t[0]-e[0],t[1]-e[1],t[2]-e[2])},t.div=function(e,t,i){return e[0]=t[0]/i[0],e[1]=t[1]/i[1],e[2]=t[2]/i[2],e},t.dot=Hl,t.earthRadius=zs,t.ease=C,t.easeCubicInOut=w,t.ecefToLatLng=function([e,t,i]){const n=Math.hypot(e,t,i),r=Math.atan2(e,i),o=.5*Math.PI-Math.acos(-t/n);return new Os(x(r),x(o))},t.emitValidationErrors=Br,t.endsWith=B,t.enforceCacheSizeLimit=function(e){ne(),J&&J.then((t=>{t.keys().then((i=>{for(let n=0;no&&(n+=(e[r]-o)*(e[r]-o)),t[r]0){const e=180/n;Sl(p,p,[e/c+1,0,0,0,e/u+1,0,-.5*e/h,.5*e/d,1])}return p[2]=l,p[5]=e.x,p[8]=e.y,p},t.getImage=me,t.getJSON=function(e,t){return ce(I(e,{type:"json"}),t)},t.getLatitudinalLod=function(e){const t=80.051129;e=S(e,-80.051129,t)/t*90;const i=Math.pow(Math.abs(Math.sin(y(e))),3);return Math.round(i*(dp.length-1))},t.getMapSessionAPI=ze,t.getPerformanceMeasurement=$e,t.getProjection=sf,t.getRTLTextPluginStatus=Fo,t.getReferrer=le,t.getTilePoint=function(e,{x:t,y:i},n=0){return new m(((t-n)*e.scale-e.x)*Ps,(i*e.scale-e.y)*Ps)},t.getTileVec3=function(e,t,i=0){return $l(((t.x-i)*e.scale-e.x)*Ps,(t.y*e.scale-e.y)*Ps,Us(t.z,t.y))},t.getVideo=function(e,t){const n=i.document.createElement("video");n.muted=!0,n.onloadstart=function(){t(null,n)};for(let t=0;t{}}},t.globeCenterToScreenPoint=function(e){const t=[0,0,0],i=El(new Float64Array(16));return Al(i,e.pixelMatrix,e.globeMatrix),Yl(t,t,i),new m(t[0],t[1])},t.globeDenormalizeECEF=Pp,t.globeECEFOrigin=function(e,t){const i=[0,0,0];return Yl(i,i,Ip(yp(t.canonical))),Yl(i,i,e),i},t.globeNormalizeECEF=Ip,t.globePixelsToTileUnits=function(e,t){return Ps/(512*Math.pow(2,e))*Ap(yp(t))},t.globePoleMatrixForTile=function(e,t,i){const n=El(new Float64Array(16)),r=(t/(1<0;return 0===n&&!r&&!a&&o},t.identity=El,t.identity$1=ac,t.invert=kl,t.isFullscreen=function(){return!!i.document.fullscreenElement||!!i.document.webkitFullscreenElement},t.isLngLatBehindGlobe=function(e,t){return Op(e,t)>Math.PI/2*1.01},t.isMapAuthenticated=function(e){return Oe.has(e)},t.isMapboxURL=_e,t.isSafariWithAntialiasingBug=function(e){const t=e.navigator?e.navigator.userAgent:null;return!!H(e)&&t&&(t.match("Version/15.4")||t.match("Version/15.5")||t.match(/CPU (OS|iPhone OS) (15_4|15_5) like Mac OS X/))},t.latFromMercatorY=Ns,t.latLngToECEF=Ep,t.len=tc,t.length=Fl,t.length$1=function(e){return Math.hypot(e[0],e[1],e[2],e[3])},t.lngFromMercatorX=js,t.loadVectorTile=bm,t.makeRequest=ce,t.mapValue=function(e,t,i,n,r){return S((e-t)/(i-t)*(r-n)+n,n,r)},t.mercatorScale=Gs,t.mercatorXfromLng=Bs,t.mercatorYfromLat=Fs,t.mercatorZfromAltitude=$s,t.mul=Ll,t.mul$1=ec,t.multiply=Al,t.multiply$1=Sl,t.multiply$2=Ul,t.nextPowerOfTwo=O,t.normalize=Zl,t.normalize$1=cc,t.normalize$2=nc,t.number=ki,t.ortho=function(e,t,i,n,r,o,a){var s=1/(t-i),l=1/(n-r),c=1/(o-a);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*c,e[11]=0,e[12]=(t+i)*s,e[13]=(r+n)*l,e[14]=(a+o)*c,e[15]=1,e},t.pbf=Dh,t.perspective=function(e,t,i,n,r){var o,a=1/Math.tan(t/2);return e[0]=a/i,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=r&&r!==1/0?(e[10]=(r+n)*(o=1/(n-r)),e[14]=2*r*n*o):(e[10]=-1,e[14]=-2*n),e},t.pick=function(e,t){const i={};for(let n=0;n.5?g-=1:g<-.5&&(g+=1);let v=0;Math.abs(g)>Math.abs(_)?v=g>=0?1:3:(v=_>=0?0:2,Wl(u,u,[r[4]*n,r[5]*n,r[6]*n],-Math.sin(y(_>=0?o.getSouth():o.getNorth()))*cp));const x=a[v],b=a[(v+1)%4],w=new _p(x,b,u),T=[vp(w,0)||x[0],vp(w,1)||x[1],vp(w,2)||x[2]],C=zp(e.zoom);if(C>0){const n=function({x:e,y:t,z:i},n,r,o,a){const s=1/(1<.5?d=-1:p<-.5&&(d=1),l=((l+d)*n-(o*=n))*r+o,c=((c+d)*n-o)*r+o,u=(u*n-(a*=n))*r+a,h=(h*n-a)*r+a,[[l,h,0],[c,h,0],[c,u,0],[l,u,0]]}(i,t,e._pixelsPerMercatorPixel,f,m);for(let e=0;eRr(vr(e)),t.validateFog=e=>Rr(Mr(e)),t.validateLayer=e=>Rr(Tr(e)),t.validateLight=e=>Rr(kr(e)),t.validateSource=e=>Rr(Er(e)),t.validateStyle=zr,t.validateTerrain=e=>Rr(Ar(e)),t.values=M,t.vectorTile=vu,t.version=n,t.warnOnce=U,t.window=i,t.wrap=k})),r(0,(function(e){function t(e){if("number"==typeof e||"boolean"==typeof e||"string"==typeof e||null==e)return JSON.stringify(e);if(Array.isArray(e)){let i="[";for(const n of e)i+=`${t(n)},`;return`${i}]`}let i="{";for(const n of Object.keys(e).sort())i+=`${n}:${t(e[n])},`;return`${i}}`}function i(i){let n="";for(const r of e.refProperties)n+=`/${t(i[r])}`;return n}class n{constructor(e){this.keyCache={},e&&this.replace(e)}replace(e){this._layerConfigs={},this._layers={},this.update(e,[])}update(t,n){for(const i of t)this._layerConfigs[i.id]=i,(this._layers[i.id]=e.createStyleLayer(i)).compileFilter(),this.keyCache[i.id]&&delete this.keyCache[i.id];for(const e of n)delete this.keyCache[e],delete this._layerConfigs[e],delete this._layers[e];this.familiesBySource={};const r=function(e,t){const n={};for(let r=0;rthis._layers[e.id])),i=t[0];if("none"===i.visibility)continue;const n=i.source||"";let r=this.familiesBySource[n];r||(r=this.familiesBySource[n]={});const o=i.sourceLayer||"_geojsonTileLayer";let a=r[o];a||(a=r[o]=[]),a.push(t)}}}class r{loadTile(t,i){const{uid:n,encoding:r,rawImageData:o,padding:a,buildQuadTree:s}=t,l=e.window.ImageBitmap&&o instanceof e.window.ImageBitmap?this.getImageData(o,a):o;i(null,new e.DEMData(n,l,r,a<1,s))}getImageData(e,t){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);const i=this.offscreenCanvasContext.getImageData(-t,-t,e.width+2*t,e.height+2*t);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),i}}var o=function e(t,i){var n,r=t&&t.type;if("FeatureCollection"===r)for(n=0;n=Math.abs(s)?i-l+s:s-l+i,i=l}i+n>=0!=!!t&&e.reverse()}const l=e.VectorTileFeature.prototype.toGeoJSON;class c{constructor(t){this._feature=t,this.extent=e.EXTENT,this.type=t.type,this.properties=t.tags,"id"in t&&!isNaN(t.id)&&(this.id=parseInt(t.id,10))}loadGeometry(){if(1===this._feature.type){const t=[];for(const i of this._feature.geometry)t.push([new e.pointGeometry(i[0],i[1])]);return t}{const t=[];for(const i of this._feature.geometry){const n=[];for(const t of i)n.push(new e.pointGeometry(t[0],t[1]));t.push(n)}return t}}toGeoJSON(e,t,i){return l.call(this,e,t,i)}}class u{constructor(t){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=e.EXTENT,this.length=t.length,this._features=t}feature(e){return new c(this._features[e])}}var h={exports:{}},d=e.pointGeometry,p=e.vectorTile.VectorTileFeature,f=m;function m(e,t){this.options=t||{},this.features=e,this.length=e.length}function g(e,t){this.id="number"==typeof e.id?e.id:void 0,this.type=e.type,this.rawGeometry=1===e.type?[e.geometry]:e.geometry,this.properties=e.tags,this.extent=t||4096}m.prototype.feature=function(e){return new g(this.features[e],this.options.extent)},g.prototype.loadGeometry=function(){var e=this.rawGeometry;this.geometry=[];for(var t=0;t>31}function S(e,t){for(var i=e.loadGeometry(),n=e.type,r=0,o=0,a=i.length,s=0;s>1;A(e,t,a,n,r,o%2),k(e,t,i,n,a-1,o+1),k(e,t,i,a+1,r,o+1)}function A(e,t,i,n,r,o){for(;r>n;){if(r-n>600){const a=r-n+1,s=i-n+1,l=Math.log(a),c=.5*Math.exp(2*l/3),u=.5*Math.sqrt(l*c*(a-c)/a)*(s-a/2<0?-1:1);A(e,t,i,Math.max(n,Math.floor(i-s*c/a+u)),Math.min(r,Math.floor(i+(a-s)*c/a+u)),o)}const a=t[2*i+o];let s=n,l=r;for(M(e,t,n,i),t[2*r+o]>a&&M(e,t,n,r);sa;)l--}t[2*n+o]===a?M(e,t,n,l):(l++,M(e,t,l,r)),l<=i&&(n=l+1),i<=l&&(r=l-1)}}function M(e,t,i,n){I(e,i,n),I(t,2*i,2*n),I(t,2*i+1,2*n+1)}function I(e,t,i){const n=e[t];e[t]=e[i],e[i]=n}function P(e,t,i,n){const r=e-i,o=t-n;return r*r+o*o}h.exports=y,h.exports.fromVectorTileJs=y,h.exports.fromGeojsonVt=function(e,t){t=t||{};var i={};for(var n in e)i[n]=new v(e[n].features,t),i[n].name=n,i[n].version=t.version,i[n].extent=t.extent;return y({layers:i})},h.exports.GeoJSONWrapper=v;const D=e=>e[0],z=e=>e[1];class O{constructor(e,t=D,i=z,n=64,r=Float64Array){this.nodeSize=n,this.points=e;const o=e.length<65536?Uint16Array:Uint32Array,a=this.ids=new o(e.length),s=this.coords=new r(2*e.length);for(let n=0;n=i&&c<=r&&u>=n&&u<=o&&l.push(e[a]);continue}const f=Math.floor((p+d)/2);c=t[2*f],u=t[2*f+1],c>=i&&c<=r&&u>=n&&u<=o&&l.push(e[f]);const m=(h+1)%2;(0===h?i<=c:n<=u)&&(s.push(p),s.push(f-1),s.push(m)),(0===h?r>=c:o>=u)&&(s.push(f+1),s.push(d),s.push(m))}return l}(this.ids,this.coords,e,t,i,n,this.nodeSize)}within(e,t,i){return function(e,t,i,n,r,o){const a=[0,e.length-1,0],s=[],l=r*r;for(;a.length;){const c=a.pop(),u=a.pop(),h=a.pop();if(u-h<=o){for(let r=h;r<=u;r++)P(t[2*r],t[2*r+1],i,n)<=l&&s.push(e[r]);continue}const d=Math.floor((h+u)/2),p=t[2*d],f=t[2*d+1];P(p,f,i,n)<=l&&s.push(e[d]);const m=(c+1)%2;(0===c?i-r<=p:n-r<=f)&&(a.push(h),a.push(d-1),a.push(m)),(0===c?i+r>=p:n+r>=f)&&(a.push(d+1),a.push(u),a.push(m))}return s}(this.ids,this.coords,e,t,i,this.nodeSize)}}const L={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:e=>e},R=Math.fround||(B=new Float32Array(1),e=>(B[0]=+e,B[0]));var B;class F{constructor(e){this.options=W(Object.create(L),e),this.trees=new Array(this.options.maxZoom+1)}load(e){const{log:t,minZoom:i,maxZoom:n,nodeSize:r}=this.options;e.length;this.points=e;let o=[];for(let t=0;t=i;e--){Date.now();o=this._cluster(o,e),this.trees[e]=new O(o,Z,H,r,Float32Array)}return this}getClusters(e,t){let i=((e[0]+180)%360+360)%360-180;const n=Math.max(-90,Math.min(90,e[1]));let r=180===e[2]?180:((e[2]+180)%360+360)%360-180;const o=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)i=-180,r=180;else if(i>r){const e=this.getClusters([i,n,180,o],t),a=this.getClusters([-180,n,r,o],t);return e.concat(a)}const a=this.trees[this._limitZoom(t)],s=a.range(V(i),G(o),V(r),G(n)),l=[];for(const e of s){const t=a.points[e];l.push(t.numPoints?N(t):this.points[t.index])}return l}getChildren(e){const t=this._getOriginId(e),i=this._getOriginZoom(e),n="No cluster with the specified id.",r=this.trees[i];if(!r)throw new Error(n);const o=r.points[t];if(!o)throw new Error(n);const a=this.options.radius/(this.options.extent*Math.pow(2,i-1)),s=r.within(o.x,o.y,a),l=[];for(const t of s){const i=r.points[t];i.parentId===e&&l.push(i.numPoints?N(i):this.points[i.index])}if(0===l.length)throw new Error(n);return l}getLeaves(e,t,i){const n=[];return this._appendLeaves(n,e,t=t||10,i=i||0,0),n}getTile(e,t,i){const n=this.trees[this._limitZoom(e)],r=Math.pow(2,e),{extent:o,radius:a}=this.options,s=a/o,l=(i-s)/r,c=(i+1+s)/r,u={features:[]};return this._addTileFeatures(n.range((t-s)/r,l,(t+1+s)/r,c),n.points,t,i,r,u),0===t&&this._addTileFeatures(n.range(1-s/r,l,1,c),n.points,r,i,r,u),t===r-1&&this._addTileFeatures(n.range(0,l,s/r,c),n.points,-1,i,r,u),u.features.length?u:null}getClusterExpansionZoom(e){let t=this._getOriginZoom(e)-1;for(;t<=this.options.maxZoom;){const i=this.getChildren(e);if(t++,1!==i.length)break;e=i[0].properties.cluster_id}return t}_appendLeaves(e,t,i,n,r){const o=this.getChildren(t);for(const t of o){const o=t.properties;if(o&&o.cluster?r+o.point_count<=n?r+=o.point_count:r=this._appendLeaves(e,o.cluster_id,i,n,r):rt&&(h+=i.numPoints||1)}if(h>u&&h>=a){let e=r.x*u,a=r.y*u,s=o&&u>1?this._map(r,!0):null;const d=(n<<5)+(t+1)+this.points.length;for(const i of c){const n=l.points[i];if(n.zoom<=t)continue;n.zoom=t;const c=n.numPoints||1;e+=n.x*c,a+=n.y*c,n.parentId=d,o&&(s||(s=this._map(r,!0)),o(s,this._map(n)))}r.parentId=d,i.push($(e/h,a/h,d,h,s))}else if(i.push(r),h>1)for(const e of c){const n=l.points[e];n.zoom<=t||(n.zoom=t,i.push(n))}}return i}_getOriginId(e){return e-this.points.length>>5}_getOriginZoom(e){return(e-this.points.length)%32}_map(e,t){if(e.numPoints)return t?W({},e.properties):e.properties;const i=this.points[e.index].properties,n=this.options.map(i);return t&&n===i?W({},n):n}}function $(e,t,i,n,r){return{x:R(e),y:R(t),zoom:1/0,id:i,parentId:-1,numPoints:n,properties:r}}function j(e,t){const[i,n]=e.geometry.coordinates;return{x:R(V(i)),y:R(G(n)),zoom:1/0,index:t,parentId:-1}}function N(e){return{type:"Feature",id:e.id,properties:U(e),geometry:{type:"Point",coordinates:[(t=e.x,360*(t-.5)),q(e.y)]}};var t}function U(e){const t=e.numPoints,i=t>=1e4?`${Math.round(t/1e3)}k`:t>=1e3?Math.round(t/100)/10+"k":t;return W(W({},e.properties),{cluster:!0,cluster_id:e.id,point_count:t,point_count_abbreviated:i})}function V(e){return e/360+.5}function G(e){const t=Math.sin(e*Math.PI/180),i=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return i<0?0:i>1?1:i}function q(e){const t=(180-360*e)*Math.PI/180;return 360*Math.atan(Math.exp(t))/Math.PI-90}function W(e,t){for(const i in t)e[i]=t[i];return e}function Z(e){return e.x}function H(e){return e.y}function X(e,t,i,n){for(var r,o=n,a=i-t>>1,s=i-t,l=e[t],c=e[t+1],u=e[i],h=e[i+1],d=t+3;do)r=d,o=p;else if(p===o){var f=Math.abs(d-a);fn&&(r-t>3&&X(e,t,r,n),e[r+2]=o,i-r>3&&X(e,r,i,n))}function Y(e,t,i,n,r,o){var a=r-i,s=o-n;if(0!==a||0!==s){var l=((e-i)*a+(t-n)*s)/(a*a+s*s);l>1?(i=r,n=o):l>0&&(i+=a*l,n+=s*l)}return(a=e-i)*a+(s=t-n)*s}function K(e,t,i,n){var r={id:void 0===e?null:e,type:t,geometry:i,tags:n,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(e){var t=e.geometry,i=e.type;if("Point"===i||"MultiPoint"===i||"LineString"===i)J(e,t);else if("Polygon"===i||"MultiLineString"===i)for(var n=0;n0&&(a+=n?(r*c-l*o)/2:Math.sqrt(Math.pow(l-r,2)+Math.pow(c-o,2))),r=l,o=c}var u=t.length-3;t[2]=1,X(t,0,u,i),t[u+2]=1,t.size=Math.abs(a),t.start=0,t.end=t.size}function ie(e,t,i,n){for(var r=0;r1?1:i}function oe(e,t,i,n,r,o,a,s){if(n/=t,o>=(i/=t)&&a=n)return null;for(var l=[],c=0;c=i&&f=n)){var m=[];if("Point"===d||"MultiPoint"===d)ae(h,m,i,n,r);else if("LineString"===d)se(h,m,i,n,r,!1,s.lineMetrics);else if("MultiLineString"===d)ce(h,m,i,n,r,!1);else if("Polygon"===d)ce(h,m,i,n,r,!0);else if("MultiPolygon"===d)for(var g=0;g=i&&a<=n&&(t.push(e[o]),t.push(e[o+1]),t.push(e[o+2]))}}function se(e,t,i,n,r,o,a){for(var s,l,c=le(e),u=0===r?he:de,h=e.start,d=0;di&&(l=u(c,p,f,g,_,i),a&&(c.start=h+s*l)):v>n?y=i&&(l=u(c,p,f,g,_,i),x=!0),y>n&&v<=n&&(l=u(c,p,f,g,_,n),x=!0),!o&&x&&(a&&(c.end=h+s*l),t.push(c),c=le(e)),a&&(h+=s)}var b=e.length-3;p=e[b],f=e[b+1],m=e[b+2],(v=0===r?p:f)>=i&&v<=n&&ue(c,p,f,m),b=c.length-3,o&&b>=3&&(c[b]!==c[0]||c[b+1]!==c[1])&&ue(c,c[0],c[1],c[2]),c.length&&t.push(c)}function le(e){var t=[];return t.size=e.size,t.start=e.start,t.end=e.end,t}function ce(e,t,i,n,r,o){for(var a=0;aa.maxX&&(a.maxX=u),h>a.maxY&&(a.maxY=h)}return a}function ve(e,t,i,n){var r=t.geometry,o=t.type,a=[];if("Point"===o||"MultiPoint"===o)for(var s=0;s0&&t.size<(r?a:n))i.numPoints+=t.length/3;else{for(var s=[],l=0;la)&&(i.numSimplified++,s.push(t[l]),s.push(t[l+1])),i.numPoints++;r&&function(e,t){for(var i=0,n=0,r=e.length,o=r-2;n0===t)for(n=0,r=e.length;n24)throw new Error("maxZoom should be in the 0-24 range");if(t.promoteId&&t.generateId)throw new Error("promoteId and generateId cannot be used together.");var n=function(e,t){var i=[];if("FeatureCollection"===e.type)for(var n=0;n24)return null;var o=1<0;)l--,c=Math.floor(c/2),u=Math.floor(u/2),s=this.tiles[be(l,c,u)];return s&&s.source?(this.splitTile(s.source,l,c,u,e,t,i),this.tiles[a]?me(this.tiles[a],r):null):null};class Te extends e.VectorTileWorkerSource{constructor(e,t,i,n,r){super(e,t,i,n,we),r&&(this.loadGeoJSON=r)}loadData(t,i){const n=t&&t.request,r=n&&n.collectResourceTiming;this.loadGeoJSON(t,((a,s)=>{if(a||!s)return i(a);if("object"!=typeof s)return i(new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`));{o(s,!0);try{if(t.filter){const i=e.createExpression(t.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===i.result)throw new Error(i.value.map((e=>`${e.key}: ${e.message}`)).join(", "));const n=s.features.filter((e=>i.value.evaluate({zoom:0},e)));s={type:"FeatureCollection",features:n}}this._geoJSONIndex=t.cluster?new F(function({superclusterOptions:t,clusterProperties:i}){if(!i||!t)return t;const n={},r={},o={accumulated:null,zoom:0},a={properties:null},s=Object.keys(i);for(const t of s){const[o,a]=i[t],s=e.createExpression(a),l=e.createExpression("string"==typeof o?[o,["accumulated"],["get",t]]:o);n[t]=s.value,r[t]=l.value}return t.map=e=>{a.properties=e;const t={};for(const e of s)t[e]=n[e].evaluate(o,a);return t},t.reduce=(e,t)=>{a.properties=t;for(const t of s)o.accumulated=e[t],e[t]=r[t].evaluate(o,a)},t}(t)).load(s.features):function(e,t){return new xe(e,t)}(s,t.geojsonVtOptions)}catch(a){return i(a)}this.loaded={};const l={};if(r){const i=e.getPerformanceMeasurement(n);i&&(l.resourceTiming={},l.resourceTiming[t.source]=JSON.parse(JSON.stringify(i)))}i(null,l)}}))}reloadTile(e,t){const i=this.loaded;return i&&i[e.uid]?super.reloadTile(e,t):this.loadTile(e,t)}loadGeoJSON(t,i){if(t.request)e.getJSON(t.request,i);else{if("string"!=typeof t.data)return i(new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`));try{return i(null,JSON.parse(t.data))}catch(e){return i(new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`))}}}getClusterExpansionZoom(e,t){try{t(null,this._geoJSONIndex.getClusterExpansionZoom(e.clusterId))}catch(e){t(e)}}getClusterChildren(e,t){try{t(null,this._geoJSONIndex.getChildren(e.clusterId))}catch(e){t(e)}}getClusterLeaves(e,t){try{t(null,this._geoJSONIndex.getLeaves(e.clusterId,e.limit,e.offset))}catch(e){t(e)}}}class Ce{constructor(t){this.self=t,this.actor=new e.Actor(t,this),this.layerIndexes={},this.availableImages={},this.isSpriteLoaded={},this.projections={},this.defaultProjection=e.getProjection({name:"mercator"}),this.workerSourceTypes={vector:e.VectorTileWorkerSource,geojson:Te},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(e,t)=>{if(this.workerSourceTypes[e])throw new Error(`Worker source with name "${e}" already registered.`);this.workerSourceTypes[e]=t},this.self.registerRTLTextPlugin=t=>{if(e.plugin.isParsed())throw new Error("RTL text plugin already registered.");e.plugin.applyArabicShaping=t.applyArabicShaping,e.plugin.processBidirectionalText=t.processBidirectionalText,e.plugin.processStyledBidirectionalText=t.processStyledBidirectionalText}}clearCaches(e,t,i){delete this.layerIndexes[e],delete this.availableImages[e],delete this.workerSources[e],delete this.demWorkerSources[e],i()}checkIfReady(e,t,i){i()}setReferrer(e,t){this.referrer=t}spriteLoaded(t,i){this.isSpriteLoaded[t]=i;for(const n in this.workerSources[t]){const r=this.workerSources[t][n];for(const t in r)r[t]instanceof e.VectorTileWorkerSource&&(r[t].isSpriteLoaded=i,r[t].fire(new e.Event("isSpriteLoaded")))}}setImages(e,t,i){this.availableImages[e]=t;for(const i in this.workerSources[e]){const n=this.workerSources[e][i];for(const e in n)n[e].availableImages=t}i()}enableTerrain(e,t,i){this.terrain=t,i()}setProjection(t,i){this.projections[t]=e.getProjection(i)}setLayers(e,t,i){this.getLayerIndex(e).replace(t),i()}updateLayers(e,t,i){this.getLayerIndex(e).update(t.layers,t.removedIds),i()}loadTile(t,i,n){const r=this.enableTerrain?e.extend({enableTerrain:this.terrain},i):i;r.projection=this.projections[t]||this.defaultProjection,this.getWorkerSource(t,i.type,i.source).loadTile(r,n)}loadDEMTile(t,i,n){const r=this.enableTerrain?e.extend({buildQuadTree:this.terrain},i):i;this.getDEMWorkerSource(t,i.source).loadTile(r,n)}reloadTile(t,i,n){const r=this.enableTerrain?e.extend({enableTerrain:this.terrain},i):i;r.projection=this.projections[t]||this.defaultProjection,this.getWorkerSource(t,i.type,i.source).reloadTile(r,n)}abortTile(e,t,i){this.getWorkerSource(e,t.type,t.source).abortTile(t,i)}removeTile(e,t,i){this.getWorkerSource(e,t.type,t.source).removeTile(t,i)}removeSource(e,t,i){if(!this.workerSources[e]||!this.workerSources[e][t.type]||!this.workerSources[e][t.type][t.source])return;const n=this.workerSources[e][t.type][t.source];delete this.workerSources[e][t.type][t.source],void 0!==n.removeSource?n.removeSource(t,i):i()}loadWorkerSource(e,t,i){try{this.self.importScripts(t.url),i()}catch(e){i(e.toString())}}syncRTLPluginState(t,i,n){try{e.plugin.setState(i);const t=e.plugin.getPluginURL();if(e.plugin.isLoaded()&&!e.plugin.isParsed()&&null!=t){this.self.importScripts(t);const i=e.plugin.isParsed();n(i?void 0:new Error(`RTL Text Plugin failed to import scripts from ${t}`),i)}}catch(e){n(e.toString())}}getAvailableImages(e){let t=this.availableImages[e];return t||(t=[]),t}getLayerIndex(e){let t=this.layerIndexes[e];return t||(t=this.layerIndexes[e]=new n),t}getWorkerSource(e,t,i){if(this.workerSources[e]||(this.workerSources[e]={}),this.workerSources[e][t]||(this.workerSources[e][t]={}),!this.workerSources[e][t][i]){const n={send:(t,i,n,r,o,a)=>{this.actor.send(t,i,n,e,o,a)},scheduler:this.actor.scheduler};this.workerSources[e][t][i]=new this.workerSourceTypes[t](n,this.getLayerIndex(e),this.getAvailableImages(e),this.isSpriteLoaded[e])}return this.workerSources[e][t][i]}getDEMWorkerSource(e,t){return this.demWorkerSources[e]||(this.demWorkerSources[e]={}),this.demWorkerSources[e][t]||(this.demWorkerSources[e][t]=new r),this.demWorkerSources[e][t]}enforceCacheSizeLimit(t,i){e.enforceCacheSizeLimit(i)}getWorkerPerformanceMetrics(e,t,i){i(void 0,void 0)}}return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope&&(self.worker=new Ce(self)),Ce})),r(0,(function(e){function t(e,i){if(Array.isArray(e)){if(!Array.isArray(i)||e.length!==i.length)return!1;for(let n=0;n{e.window.removeEventListener("click",d,!0)}),0)}function f(e,t){const i=e.getBoundingClientRect();return _(e,i,t)}function m(e,t){const i=e.getBoundingClientRect(),n=[];for(let r=0;r=0?0:t.button}function _(t,i,n){const r=t.offsetWidth===i.width?1:t.offsetWidth/i.width;return new e.pointGeometry((n.clientX-i.left)*r,(n.clientY-i.top)*r)}function v(e,t){var i=t[0],n=t[1],r=t[2],o=t[3],a=i*o-r*n;return a?(e[0]=o*(a=1/a),e[1]=-n*a,e[2]=-r*a,e[3]=i*a,e):null}function y(e){const{userImage:t}=e;return!!(t&&t.render&&t.render())&&(e.data.replace(new Uint8Array(t.data.buffer)),!0)}class x extends e.Evented{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new e.RGBAImage({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(e){if(this.loaded!==e&&(this.loaded=e,e)){for(const{ids:e,callback:t}of this.requestors)this._notify(e,t);this.requestors=[]}}hasImage(e){return!!this.getImage(e)}getImage(e){return this.images[e]}addImage(e,t){this._validate(e,t)&&(this.images[e]=t)}_validate(t,i){let n=!0;return this._validateStretch(i.stretchX,i.data&&i.data.width)||(this.fire(new e.ErrorEvent(new Error(`Image "${t}" has invalid "stretchX" value`))),n=!1),this._validateStretch(i.stretchY,i.data&&i.data.height)||(this.fire(new e.ErrorEvent(new Error(`Image "${t}" has invalid "stretchY" value`))),n=!1),this._validateContent(i.content,i)||(this.fire(new e.ErrorEvent(new Error(`Image "${t}" has invalid "content" value`))),n=!1),n}_validateStretch(e,t){if(!e)return!0;let i=0;for(const n of e){if(n[0]{this.ready=!0}))}broadcast(t,i,n){e.asyncAll(this.actors,((e,n)=>{e.send(t,i,n)}),n=n||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach((e=>{e.remove()})),this.actors=[],this.workerPool.release(this.id)}}function z(t,i,n){return i*(e.EXTENT/(t.tileSize*Math.pow(2,n-t.tileID.overscaledZ)))}D.Actor=e.Actor;class O{constructor(e,t,i,n){this.screenBounds=e,this.cameraPoint=t,this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=i,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this._bufferedScreenMercator(0,n)}static createFromScreenPoints(t,i){let n,r;if(t instanceof e.pointGeometry||"number"==typeof t[0]){const o=e.pointGeometry.convert(t);n=[o],r=i.isPointAboveHorizon(o)}else{const o=e.pointGeometry.convert(t[0]),a=e.pointGeometry.convert(t[1]);n=[o,a],r=e.polygonizeBounds(o,a).every((e=>i.isPointAboveHorizon(e)))}return new O(n,i.getCameraPoint(),r,i)}isPointQuery(){return 1===this.screenBounds.length}bufferedScreenGeometry(t){return e.polygonizeBounds(this.screenBounds[0],1===this.screenBounds.length?this.screenBounds[0]:this.screenBounds[1],t)}bufferedCameraGeometry(t){const i=this.screenBounds[0],n=1===this.screenBounds.length?this.screenBounds[0].add(new e.pointGeometry(1,1)):this.screenBounds[1],r=e.polygonizeBounds(i,n,0,!1);return this.cameraPoint.y>n.y&&(this.cameraPoint.x>i.x&&this.cameraPoint.x=n.x?r[2]=this.cameraPoint:this.cameraPoint.x<=i.x&&(r[3]=this.cameraPoint)),e.bufferConvexPolygon(r,t)}bufferedCameraGeometryGlobe(t){const i=this.screenBounds[0],n=1===this.screenBounds.length?this.screenBounds[0].add(new e.pointGeometry(1,1)):this.screenBounds[1],r=e.polygonizeBounds(i,n,t),o=this.cameraPoint.clone();switch(3*((o.y>i.y)+(o.y>n.y))+((o.x>i.x)+(o.x>n.x))){case 0:r[0]=o,r[4]=o.clone();break;case 1:r.splice(1,0,o);break;case 2:r[1]=o;break;case 3:r.splice(4,0,o);break;case 5:r.splice(2,0,o);break;case 6:r[3]=o;break;case 7:r.splice(3,0,o);break;case 8:r[2]=o}return r}containsTile(t,i,n,r=0){const o=t.queryPadding/i._pixelsPerMercatorPixel+1,a=n?this._bufferedCameraMercator(o,i):this._bufferedScreenMercator(o,i);let s=t.tileID.wrap+(a.unwrapped?r:0);const l=a.polygon.map((i=>e.getTilePoint(t.tileTransform,i,s)));if(!e.polygonIntersectsBox(l,0,0,e.EXTENT,e.EXTENT))return;s=t.tileID.wrap+(this.screenGeometryMercator.unwrapped?r:0);const c=this.screenGeometryMercator.polygon.map((i=>e.getTileVec3(t.tileTransform,i,s))),u=c.map((t=>new e.pointGeometry(t[0],t[1]))),h=i.getFreeCameraOptions().position||new e.MercatorCoordinate(0,0,0),d=e.getTileVec3(t.tileTransform,h,s),p=c.map((t=>{const i=e.sub(t,t,d);return e.normalize(i,i),new e.Ray(d,i)})),f=z(t,1,i.zoom)*i._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:u,tilespaceRays:p,bufferedTilespaceGeometry:l,bufferedTilespaceBounds:(m=e.getBounds(l),m.min.x=e.clamp(m.min.x,0,e.EXTENT),m.min.y=e.clamp(m.min.y,0,e.EXTENT),m.max.x=e.clamp(m.max.x,0,e.EXTENT),m.max.y=e.clamp(m.max.y,0,e.EXTENT),m),tile:t,tileID:t.tileID,pixelToTileUnitsFactor:f};var m}_bufferedScreenMercator(e,t){const i=B(e);if(this._screenRaycastCache[i])return this._screenRaycastCache[i];{let n;return n="globe"===t.projection.name?this._projectAndResample(this.bufferedScreenGeometry(e),t):{polygon:this.bufferedScreenGeometry(e).map((e=>t.pointCoordinate3D(e))),unwrapped:!0},this._screenRaycastCache[i]=n,n}}_bufferedCameraMercator(e,t){const i=B(e);if(this._cameraRaycastCache[i])return this._cameraRaycastCache[i];{let n;return n="globe"===t.projection.name?this._projectAndResample(this.bufferedCameraGeometryGlobe(e),t):{polygon:this.bufferedCameraGeometry(e).map((e=>t.pointCoordinate3D(e))),unwrapped:!0},this._cameraRaycastCache[i]=n,n}}_projectAndResample(t,i){const n=function(t,i){const n=e.multiply([],i.pixelMatrix,i.globeMatrix),r=[0,-e.GLOBE_RADIUS,0,1],o=[0,e.GLOBE_RADIUS,0,1],a=[0,0,0,1];e.transformMat4$1(r,r,n),e.transformMat4$1(o,o,n),e.transformMat4$1(a,a,n);const s=new e.pointGeometry(r[0]/r[3],r[1]/r[3]),l=new e.pointGeometry(o[0]/o[3],o[1]/o[3]),c=e.polygonContainsPoint(t,s)&&r[3]1?L(t.slice(0,d),i):[],m=dnew e.pointGeometry(R(t.x),t.y))),m=m.map((t=>new e.pointGeometry(R(t.x),t.y)));const g=[...f];0===g.length&&g.push(m[m.length-1]);const _=e.number(g[g.length-1].y,(0===m.length?f[0]:m[0]).y,p);let v;return v=c?[new e.pointGeometry(0,_),new e.pointGeometry(0,0),new e.pointGeometry(1,0),new e.pointGeometry(1,_)]:[new e.pointGeometry(1,_),new e.pointGeometry(1,1),new e.pointGeometry(0,1),new e.pointGeometry(0,_)],g.push(...v),0===m.length?g.push(f[0]):g.push(...m),{polygon:g.map((t=>new e.MercatorCoordinate(t.x,t.y))),unwrapped:!1}}(t,i);if(n)return n;const r=function(t,i){let n=!1,r=-1/0,o=0;for(let e=0;er&&(r=t[e].x,o=e);for(let e=0;e.5&&(r.x{e.x-=1})),{polygon:t,unwrapped:n}}(L(t,i).map((t=>new e.pointGeometry(R(t.x),t.y))),i);return{polygon:r.polygon.map((t=>new e.MercatorCoordinate(t.x,t.y))),unwrapped:r.unwrapped}}}function L(t,i){return e.resample(t,(e=>{const t=i.pointCoordinate3D(e);e.x=t.x,e.y=t.y}),1/256)}function R(e){return e<0?1+e%1:e%1}function B(e){return 100*e|0}function F(t,i,n,r,o){const a=function(n,r){if(n)return o(n);if(r){t.url&&r.tiles&&t.tiles&&delete t.tiles;const n=e.pick(e.extend(r,t),["tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","scheme","tileSize","encoding"]);r.vector_layers&&(n.vectorLayers=r.vector_layers,n.vectorLayerIds=n.vectorLayers.map((e=>e.id))),n.tiles=i.canonicalizeTileset(n,t.url),o(null,n)}};return t.url?e.getJSON(i.transformRequest(i.normalizeSourceURL(t.url,null,n,r),e.ResourceType.Source),a):e.exported.frame((()=>a(null,t)))}class ${constructor(t,i,n){this.bounds=e.LngLatBounds.convert(this.validateBounds(t)),this.minzoom=i||0,this.maxzoom=n||24}validateBounds(e){return Array.isArray(e)&&4===e.length?[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]:[-180,-90,180,90]}contains(t){const i=Math.pow(2,t.z),n=Math.floor(e.mercatorXfromLng(this.bounds.getWest())*i),r=Math.floor(e.mercatorYfromLat(this.bounds.getNorth())*i),o=Math.ceil(e.mercatorXfromLng(this.bounds.getEast())*i),a=Math.ceil(e.mercatorYfromLat(this.bounds.getSouth())*i);return t.x>=n&&t.x=r&&t.y{this._tileJSONRequest=null,this._loaded=!0,t?this.fire(new e.ErrorEvent(t)):i&&(e.extend(this,i),i.bounds&&(this.tileBounds=new $(i.bounds,this.minzoom,this.maxzoom)),e.postTurnstileEvent(i.tiles),this.fire(new e.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.Event("data",{dataType:"source",sourceDataType:"content"})))}))}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return e.extend({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(t,i){const n=e.exported.devicePixelRatio>=2,r=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),n,this.tileSize);t.request=e.getImage(this.map._requestManager.transformRequest(r,e.ResourceType.Tile),((n,r,o,a)=>(delete t.request,t.aborted?(t.state="unloaded",i(null)):n?(t.state="errored",i(n)):r?(this.map._refreshExpiredTiles&&t.setExpiryData({cacheControl:o,expires:a}),t.setTexture(r,this.map.painter),t.state="loaded",e.cacheEntryPossiblyAdded(this.dispatcher),void i(null)):i(null))))}static loadTileData(e,t,i){e.setTexture(t,i)}static unloadTileData(e,t){e.texture&&t.saveTileTexture(e.texture)}abortTile(e,t){e.request&&(e.request.cancel(),delete e.request),t()}unloadTile(e,t){e.texture&&this.map.painter.saveTileTexture(e.texture),t()}hasTransition(){return!1}}let Ae;function Me(t,i,n,r,o,a,s,l){const c=[t,n,o,i,r,a,1,1,1],u=[s,l,1],h=e.adjoint([],c),[d,p,f]=e.transformMat3(u,u,e.transpose(h,h));return e.multiply$1(c,[d,0,0,0,p,0,0,0,f],c)}class Ie extends e.Evented{constructor(e,t,i,n){super(),this.id=e,this.dispatcher=i,this.coordinates=t.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(n),this.options=t,this._dirty=!1}load(t,i){this._loaded=i||!1,this.fire(new e.Event("dataloading",{dataType:"source"})),this.url=this.options.url,this._imageRequest=e.getImage(this.map._requestManager.transformRequest(this.url,e.ResourceType.Image),((i,n)=>{if(this._imageRequest=null,this._loaded=!0,i)this.fire(new e.ErrorEvent(i));else if(n){const{HTMLImageElement:i}=e.window;this.image=n instanceof i?e.exported.getImageData(n):n,this._dirty=!0,this.width=this.image.width,this.height=this.image.height,t&&(this.coordinates=t),this._finishLoading()}}))}loaded(){return this._loaded}updateImage(e){return this.image&&e.url?(this._imageRequest&&e.url!==this.options.url&&(this._imageRequest.cancel(),this._imageRequest=null),this.options.url=e.url,this.load(e.coordinates,this._loaded),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new e.Event("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(){this._imageRequest&&(this._imageRequest.cancel(),this._imageRequest=null),this.texture&&this.texture.destroy()}setCoordinates(t){this.coordinates=t,this._boundsArray=void 0;const i=t.map(e.MercatorCoordinate.fromLngLat);return this.tileID=function(t){let i=1/0,n=1/0,r=-1/0,o=-1/0;for(const e of t)i=Math.min(i,e.x),n=Math.min(n,e.y),r=Math.max(r,e.x),o=Math.max(o,e.y);const a=Math.max(r-i,o-n),s=Math.max(0,Math.floor(-Math.log(a)/Math.LN2)),l=Math.pow(2,s);return new e.CanonicalTileID(s,Math.floor((i+r)/2*l),Math.floor((n+o)/2*l))}(i),this.minzoom=this.maxzoom=this.tileID.z,this.fire(new e.Event("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){this._boundsArray=void 0}_prepareData(t){for(const e in this.tiles){const t=this.tiles[e];"loaded"!==t.state&&(t.state="loaded",t.texture=this.texture)}if(this._boundsArray)return;const i=e.tileTransform(this.tileID,this.map.transform.projection),[n,r,o,a]=this.coordinates.map((t=>{const n=i.projection.project(t[0],t[1]);return e.getTilePoint(i,n)._round()}));this.perspectiveTransform=function(t,i,n,r,o,a,s,l,c,u){const h=Me(0,0,t,0,0,i,t,i),d=Me(n,r,o,a,s,l,c,u);return e.multiply$1(d,e.adjoint(h,h),d),[d[6]/d[8]*t/e.EXTENT,d[7]/d[8]*i/e.EXTENT]}(this.width,this.height,n.x,n.y,r.x,r.y,a.x,a.y,o.x,o.y);const s=this._boundsArray=new e.StructArrayLayout4i8;s.emplaceBack(n.x,n.y,0,0),s.emplaceBack(r.x,r.y,e.EXTENT,0),s.emplaceBack(a.x,a.y,0,e.EXTENT),s.emplaceBack(o.x,o.y,e.EXTENT,e.EXTENT),this.boundsBuffer&&this.boundsBuffer.destroy(),this.boundsBuffer=t.createVertexBuffer(s,e.boundsAttributes.members),this.boundsSegments=e.SegmentVector.simpleSegment(0,0,4,2)}prepare(){if(0===Object.keys(this.tiles).length||!this.image)return;const t=this.map.painter.context,i=t.gl;this._dirty&&(this.texture?this.texture.update(this.image):(this.texture=new e.Texture(t,this.image,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE)),this._dirty=!1),this._prepareData(t)}loadTile(e,t){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={},t(null)):(e.state="errored",t(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}const Pe={vector:class extends e.Evented{constructor(t,i,n,r){if(super(),this.id=t,this.dispatcher=n,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,e.extend(this,e.pick(i,["url","scheme","tileSize","promoteId"])),this._options=e.extend({type:"vector"},i),this._collectResourceTiming=i.collectResourceTiming,512!==this.tileSize)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(r),this._tileWorkers={},this._deduped=new e.DedupedRequest}load(t){this._loaded=!1,this.fire(new e.Event("dataloading",{dataType:"source"}));const i=Array.isArray(this.map._language)?this.map._language.join():this.map._language,n=this.map._worldview;this._tileJSONRequest=F(this._options,this.map._requestManager,i,n,((i,r)=>{this._tileJSONRequest=null,this._loaded=!0,i?(n&&n.length,this.fire(new e.ErrorEvent(i))):r&&(e.extend(this,r),r.bounds&&(this.tileBounds=new $(r.bounds,this.minzoom,this.maxzoom)),e.postTurnstileEvent(r.tiles,this.map._requestManager._customAccessToken),this.fire(new e.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.Event("data",{dataType:"source",sourceDataType:"content"}))),t&&t(i)}))}loaded(){return this._loaded}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}onAdd(e){this.map=e,this.load()}reload(){this.cancelTileJSONRequest(),this.load((()=>{const e=this.map.style._getSourceCaches(this.id);for(const t of e)t.clearTiles()}))}setSourceProperty(e){e(),this.reload()}setTiles(e){return this._options.tiles=e,this.reload(),this}setUrl(e){return this.url=e,this._options.url=e,this.reload(),this}onRemove(){this.cancelTileJSONRequest()}serialize(){return e.extend({},this._options)}loadTile(t,i){const n=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme)),r={request:this.map._requestManager.transformRequest(n,e.ResourceType.Tile),data:void 0,uid:t.uid,tileID:t.tileID,tileZoom:t.tileZoom,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:e.exported.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,isSymbolTile:t.isSymbolTile};if(r.request.collectResourceTiming=this._collectResourceTiming,t.actor&&"expired"!==t.state)"loading"===t.state?t.reloadCallback=i:t.request=t.actor.send("reloadTile",r,o.bind(this));else if(t.actor=this._tileWorkers[n]=this._tileWorkers[n]||this.dispatcher.getActor(),this.dispatcher.ready)t.request=t.actor.send("loadTile",r,o.bind(this),void 0,!0);else{const i=e.loadVectorTile.call({deduped:this._deduped},r,((e,i)=>{e||!i?o.call(this,e):(r.data={cacheControl:i.cacheControl,expires:i.expires,rawData:i.rawData.slice(0)},t.actor&&t.actor.send("loadTile",r,o.bind(this),void 0,!0))}),!0);t.request={cancel:i}}function o(n,r){return delete t.request,t.aborted?i(null):n&&404!==n.status?i(n):(r&&r.resourceTiming&&(t.resourceTiming=r.resourceTiming),this.map._refreshExpiredTiles&&r&&t.setExpiryData(r),t.loadVectorData(r,this.map.painter),e.cacheEntryPossiblyAdded(this.dispatcher),i(null),void(t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)))}}abortTile(e){e.request&&(e.request.cancel(),delete e.request),e.actor&&e.actor.send("abortTile",{uid:e.uid,type:this.type,source:this.id})}unloadTile(e){e.unloadVectorData(),e.actor&&e.actor.send("removeTile",{uid:e.uid,type:this.type,source:this.id})}hasTransition(){return!1}afterUpdate(){this._tileWorkers={}}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}},raster:ke,"raster-dem":class extends ke{constructor(t,i,n,r){super(t,i,n,r),this.type="raster-dem",this.maxzoom=22,this._options=e.extend({type:"raster-dem"},i),this.encoding=i.encoding||"mapbox"}loadTile(t,i){const n=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);function r(e,n){e&&(t.state="errored",i(e)),n&&(t.dem=n,t.dem.onDeserialize(),t.needsHillshadePrepare=!0,t.needsDEMTextureUpload=!0,t.state="loaded",i(null))}t.request=e.getImage(this.map._requestManager.transformRequest(n,e.ResourceType.Tile),function(n,o,a,s){if(delete t.request,t.aborted)t.state="unloaded",i(null);else if(n)t.state="errored",i(n);else if(o){this.map._refreshExpiredTiles&&t.setExpiryData({cacheControl:a,expires:s});const i=e.window.ImageBitmap&&o instanceof e.window.ImageBitmap&&(null==Ae&&(Ae=e.window.OffscreenCanvas&&new e.window.OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof e.window.createImageBitmap),Ae),n=1-(o.width-e.prevPowerOfTwo(o.width))/2;n<1||t.neighboringTiles||(t.neighboringTiles=this._getNeighboringTiles(t.tileID));const l=i?o:e.exported.getImageData(o,n),c={uid:t.uid,coord:t.tileID,source:this.id,rawImageData:l,encoding:this.encoding,padding:n};t.actor&&"expired"!==t.state||(t.actor=this.dispatcher.getActor(),t.actor.send("loadDEMTile",c,r.bind(this),void 0,!0))}}.bind(this))}_getNeighboringTiles(t){const i=t.canonical,n=Math.pow(2,i.z),r=(i.x-1+n)%n,o=0===i.x?t.wrap-1:t.wrap,a=(i.x+1+n)%n,s=i.x+1===n?t.wrap+1:t.wrap,l={};return l[new e.OverscaledTileID(t.overscaledZ,o,i.z,r,i.y).key]={backfilled:!1},l[new e.OverscaledTileID(t.overscaledZ,s,i.z,a,i.y).key]={backfilled:!1},i.y>0&&(l[new e.OverscaledTileID(t.overscaledZ,o,i.z,r,i.y-1).key]={backfilled:!1},l[new e.OverscaledTileID(t.overscaledZ,t.wrap,i.z,i.x,i.y-1).key]={backfilled:!1},l[new e.OverscaledTileID(t.overscaledZ,s,i.z,a,i.y-1).key]={backfilled:!1}),i.y+1{if(this._loaded=!0,this._pendingLoad=null,t)this.fire(new e.ErrorEvent(t));else{const t={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&i&&i.resourceTiming&&i.resourceTiming[this.id]&&(t.resourceTiming=i.resourceTiming[this.id]),this.fire(new e.Event("data",t)),this._metadataFired=!0}this._coalesce&&(this._updateWorkerData(),this._coalesce=!1)}))}loaded(){return this._loaded}loadTile(t,i){const n=t.actor?"reloadTile":"loadTile";t.actor=this.actor,t.request=this.actor.send(n,{type:this.type,uid:t.uid,tileID:t.tileID,tileZoom:t.tileZoom,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:e.exported.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId},((e,r)=>(delete t.request,t.unloadVectorData(),t.aborted?i(null):e?i(e):(t.loadVectorData(r,this.map.painter,"reloadTile"===n),i(null)))),void 0,"loadTile"===n)}abortTile(e){e.request&&(e.request.cancel(),delete e.request),e.aborted=!0}unloadTile(e){e.unloadVectorData(),this.actor.send("removeTile",{uid:e.uid,type:this.type,source:this.id})}onRemove(){this._pendingLoad&&this._pendingLoad.cancel()}serialize(){return e.extend({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},video:class extends Ie{constructor(e,t,i,n){super(e,t,i,n),this.roundZoom=!0,this.type="video",this.options=t}load(){this._loaded=!1;const t=this.options;this.urls=[];for(const i of t.urls)this.urls.push(this.map._requestManager.transformRequest(i,e.ResourceType.Source).url);e.getVideo(this.urls,((t,i)=>{this._loaded=!0,t?this.fire(new e.ErrorEvent(t)):i&&(this.video=i,this.video.loop=!0,this.video.setAttribute("playsinline",""),this.video.addEventListener("playing",(()=>{this.map.triggerRepaint()})),this.map&&this.video.play(),this._finishLoading())}))}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(t){if(this.video){const i=this.video.seekable;ti.end(0)?this.fire(new e.ErrorEvent(new e.ValidationError(`sources.${this.id}`,null,`Playback for this video can be set only between the ${i.start(0)} and ${i.end(0)}-second mark.`))):this.video.currentTime=t}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(0===Object.keys(this.tiles).length||this.video.readyState<2)return;const t=this.map.painter.context,i=t.gl;this.texture?this.video.paused||(this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE),i.texSubImage2D(i.TEXTURE_2D,0,0,0,i.RGBA,i.UNSIGNED_BYTE,this.video)):(this.texture=new e.Texture(t,this.video,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE),this.width=this.video.videoWidth,this.height=this.video.videoHeight),this._prepareData(t)}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:Ie,canvas:class extends Ie{constructor(t,i,n,r){super(t,i,n,r),i.coordinates?Array.isArray(i.coordinates)&&4===i.coordinates.length&&!i.coordinates.some((e=>!Array.isArray(e)||2!==e.length||e.some((e=>"number"!=typeof e))))||this.fire(new e.ErrorEvent(new e.ValidationError(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new e.ErrorEvent(new e.ValidationError(`sources.${t}`,null,'missing required property "coordinates"'))),i.animate&&"boolean"!=typeof i.animate&&this.fire(new e.ErrorEvent(new e.ValidationError(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),i.canvas?"string"==typeof i.canvas||i.canvas instanceof e.window.HTMLCanvasElement||this.fire(new e.ErrorEvent(new e.ValidationError(`sources.${t}`,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 e.ErrorEvent(new e.ValidationError(`sources.${t}`,null,'missing required property "canvas"'))),this.options=i,this.animate=void 0===i.animate||i.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof e.window.HTMLCanvasElement?this.options.canvas:e.window.document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new e.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())}getCanvas(){return this.canvas}onAdd(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let t=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,t=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,t=!0),this._hasInvalidDimensions())return;if(0===Object.keys(this.tiles).length)return;const i=this.map.painter.context;this.texture?(t||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new e.Texture(i,this.canvas,i.gl.RGBA,{premultiply:!0}),this._prepareData(i)}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}},custom:class extends e.Evented{constructor(t,i,n,r){super(),this.id=t,this.type="custom",this._dataType="raster",this._dispatcher=n,this._implementation=i,this.setEventedParent(r),this.scheme="xyz",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this._loaded=!1,this.roundZoom=!0,this._implementation||this.fire(new e.ErrorEvent(new Error(`Missing implementation for ${this.id} custom source`))),this._implementation.loadTile||this.fire(new e.ErrorEvent(new Error(`Missing loadTile implementation for ${this.id} custom source`))),this._implementation.bounds&&(this.tileBounds=new $(this._implementation.bounds,this.minzoom,this.maxzoom)),i.update=this._update.bind(this),i.clearTiles=this._clearTiles.bind(this),i.coveringTiles=this._coveringTiles.bind(this),e.extend(this,e.pick(i,["dataType","scheme","minzoom","maxzoom","tileSize","attribution","minTileCacheSize","maxTileCacheSize"]))}serialize(){return e.pick(this,["type","scheme","minzoom","maxzoom","tileSize","attribution"])}load(){this._loaded=!0,this.fire(new e.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.Event("data",{dataType:"source",sourceDataType:"content"}))}loaded(){return this._loaded}onAdd(t){this._map=t,this._loaded=!1,this.fire(new e.Event("dataloading",{dataType:"source"})),this._implementation.onAdd&&this._implementation.onAdd(t),this.load()}onRemove(e){this._implementation.onRemove&&this._implementation.onRemove(e)}hasTile(e){if(this._implementation.hasTile){const{x:t,y:i,z:n}=e.canonical;return this._implementation.hasTile({x:t,y:i,z:n})}return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(t,i){const{x:n,y:r,z:o}=t.tileID.canonical,a=new e.window.AbortController;t.request=Promise.resolve(this._implementation.loadTile({x:n,y:r,z:o},{signal:a.signal})).then(function(n){return delete t.request,t.aborted?(t.state="unloaded",i(null)):void 0===n?(t.state="errored",i(null)):null===n?(this.loadTileData(t,{width:this.tileSize,height:this.tileSize,data:null}),t.state="loaded",i(null)):function(t){return t instanceof e.window.ImageData||t instanceof e.window.HTMLCanvasElement||t instanceof e.window.ImageBitmap||t instanceof e.window.HTMLImageElement}(n)?(this.loadTileData(t,n),t.state="loaded",void i(null)):(t.state="errored",i(new Error(`Can't infer data type for ${this.id}, only raster data supported at the moment`)))}.bind(this)).catch((e=>{20!==e.code&&(t.state="errored",i(e))})),t.request.cancel=()=>a.abort()}loadTileData(e,t){ke.loadTileData(e,t,this._map.painter)}unloadTileData(e){ke.unloadTileData(e,this._map.painter)}unloadTile(e,t){if(this.unloadTileData(e),this._implementation.unloadTile){const{x:t,y:i,z:n}=e.tileID.canonical;this._implementation.unloadTile({x:t,y:i,z:n})}t()}abortTile(e,t){e.request&&e.request.cancel&&(e.request.cancel(),delete e.request),t()}hasTransition(){return!1}_coveringTiles(){return this._map.transform.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,roundZoom:this.roundZoom}).map((e=>({x:e.canonical.x,y:e.canonical.y,z:e.canonical.z})))}_clearTiles(){this._map.style._clearSource(this.id)}_update(){this.fire(new e.Event("data",{dataType:"source",sourceDataType:"content"}))}}},De=function(t,i,n,r){const o=new Pe[i.type](t,i,n,r);if(o.id!==t)throw new Error(`Expected Source id to be ${t} instead of ${o.id}`);return e.bindAll(["load","abort","unload","serialize","prepare"],o),o};function ze(t,i){const n=e.identity([]);return e.scale(n,n,[.5*t.width,.5*-t.height,1]),e.translate(n,n,[1,-1,0]),e.multiply(n,n,t.calculateProjMatrix(i.toUnwrapped())),Float32Array.from(n)}function Oe(e,t,i,n,r,o,a,s=!1){const l=e.tilesIn(n,a,s);l.sort(Re);const c=[];for(const n of l)c.push({wrappedTileID:n.tile.tileID.wrapped().key,queryResults:n.tile.queryRenderedFeatures(t,i,e._state,n,r,o,ze(e.transform,n.tile.tileID),s)});const u=function(e){const t={},i={};for(const n of e){const e=n.queryResults,r=n.wrappedTileID,o=i[r]=i[r]||{};for(const i in e){const n=e[i],r=o[i]=o[i]||{},a=t[i]=t[i]||[];for(const e of n)r[e.featureIndex]||(r[e.featureIndex]=!0,a.push(e))}}return t}(c);for(const t in u)u[t].forEach((t=>{const i=t.feature,n=i.layer;n&&"background"!==n.type&&"sky"!==n.type&&(i.source=n.source,n["source-layer"]&&(i.sourceLayer=n["source-layer"]),i.state=void 0!==i.id?e.getFeatureState(n["source-layer"],i.id):{})}));return u}function Le(e,t){const i=e.getRenderableIds().map((t=>e.getTileByID(t))),n=[],r={};for(let e=0;e{e.terminate()})),this.workers=null)}isPreloaded(){return!!this.active[Fe]}numActive(){return Object.keys(this.active).length}}let je;function Ne(){return je||(je=new $e),je}function Ue(t,i){const n={};for(const e in t)"ref"!==e&&(n[e]=t[e]);return e.refProperties.forEach((e=>{e in i&&(n[e]=i[e])})),n}function Ve(e){e=e.slice();const t=Object.create(null);for(let i=0;i0?(r-a)/s:0;return this.points[o].mult(1-l).add(this.points[i].mult(l))}}class Qe{constructor(e,t,i){const n=this.boxCells=[],r=this.circleCells=[];this.xCellCount=Math.ceil(e/i),this.yCellCount=Math.ceil(t/i);for(let e=0;ethis.width||n<0||t>this.height)return!r&&[];const a=[];if(e<=0&&t<=0&&this.width<=i&&this.height<=n){if(r)return!0;for(let e=0;e0:a}_queryCircle(e,t,i,n,r){const o=e-i,a=e+i,s=t-i,l=t+i;if(a<0||o>this.width||l<0||s>this.height)return!n&&[];const c=[];return this._forEachCell(o,s,a,l,this._queryCellCircle,c,{hitTest:n,circle:{x:e,y:t,radius:i},seenUids:{box:{},circle:{}}},r),n?c.length>0:c}query(e,t,i,n,r){return this._query(e,t,i,n,!1,r)}hitTest(e,t,i,n,r){return this._query(e,t,i,n,!0,r)}hitTestCircle(e,t,i,n){return this._queryCircle(e,t,i,!0,n)}_queryCell(e,t,i,n,r,o,a,s){const l=a.seenUids,c=this.boxCells[r];if(null!==c){const r=this.bboxes;for(const u of c)if(!l.box[u]){l.box[u]=!0;const c=4*u;if(e<=r[c+2]&&t<=r[c+3]&&i>=r[c+0]&&n>=r[c+1]&&(!s||s(this.boxKeys[u]))){if(a.hitTest)return o.push(!0),!0;o.push({key:this.boxKeys[u],x1:r[c],y1:r[c+1],x2:r[c+2],y2:r[c+3]})}}}const u=this.circleCells[r];if(null!==u){const r=this.circles;for(const c of u)if(!l.circle[c]){l.circle[c]=!0;const u=3*c;if(this._circleAndRectCollide(r[u],r[u+1],r[u+2],e,t,i,n)&&(!s||s(this.circleKeys[c]))){if(a.hitTest)return o.push(!0),!0;{const e=r[u],t=r[u+1],i=r[u+2];o.push({key:this.circleKeys[c],x1:e-i,y1:t-i,x2:e+i,y2:t+i})}}}}}_queryCellCircle(e,t,i,n,r,o,a,s){const l=a.circle,c=a.seenUids,u=this.boxCells[r];if(null!==u){const e=this.bboxes;for(const t of u)if(!c.box[t]){c.box[t]=!0;const i=4*t;if(this._circleAndRectCollide(l.x,l.y,l.radius,e[i+0],e[i+1],e[i+2],e[i+3])&&(!s||s(this.boxKeys[t])))return o.push(!0),!0}}const h=this.circleCells[r];if(null!==h){const e=this.circles;for(const t of h)if(!c.circle[t]){c.circle[t]=!0;const i=3*t;if(this._circlesCollide(e[i],e[i+1],e[i+2],l.x,l.y,l.radius)&&(!s||s(this.circleKeys[t])))return o.push(!0),!0}}}_forEachCell(e,t,i,n,r,o,a,s){const l=this._convertToXCellCoord(e),c=this._convertToYCellCoord(t),u=this._convertToXCellCoord(i),h=this._convertToYCellCoord(n);for(let d=l;d<=u;d++)for(let l=c;l<=h;l++)if(r.call(this,e,t,i,n,this.xCellCount*l+d,o,a,s))return}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,t,i,n,r,o){const a=n-e,s=r-t,l=i+o;return l*l>a*a+s*s}_circleAndRectCollide(e,t,i,n,r,o,a){const s=(o-n)/2,l=Math.abs(e-(n+s));if(l>s+i)return!1;const c=(a-r)/2,u=Math.abs(t-(r+c));if(u>c+i)return!1;if(l<=s||u<=c)return!0;const h=l-s,d=u-c;return h*h+d*d<=i*i}}const et=Math.tan(85*Math.PI/180);function tt(t,i,n,r,o,a,s){const l=e.create();if(n)if("globe"===a.name){const t=e.calculateGlobeLabelMatrix(o,i);e.multiply(l,l,t)}else{const t=v([],s);l[0]=t[0],l[1]=t[1],l[4]=t[2],l[5]=t[3],r||e.rotateZ(l,l,o.angle)}else e.multiply(l,o.labelPlaneMatrix,t);return l}function it(e,t,i,n,r,o,a){const s=tt(e,t,i,n,r,o,a);return"globe"===o.name&&i||(s[2]=s[6]=s[10]=s[14]=0),s}function nt(t,i,n,r,o,a,s){if(n){if("globe"===a.name){const l=tt(t,i,n,r,o,a,s);return e.invert(l,l),e.multiply(l,t,l),l}{const i=e.clone(t),n=e.identity([]);return n[0]=s[0],n[1]=s[1],n[4]=s[2],n[5]=s[3],e.multiply(i,i,n),r||e.rotateZ(i,i,-o.angle),i}}return o.glCoordMatrix}function rt(t,i,n=0){const r=[t.x,t.y,n,1];n?e.transformMat4$1(r,r,i):_t(r,r,i);const o=r[3];return{point:[r[0]/o,r[1]/o,r[2]/o],signedDistanceFromCamera:o}}function ot(t,i){const n=[t[0],t[1],t[2],1];e.transformMat4$1(n,n,i);const r=n[3];return{point:[n[0]/r,n[1]/r,n[2]/r],signedDistanceFromCamera:r}}function at(e,t){return Math.min(.5+e/t*.5,1.5)}function st(e,t){const i=e[0]/e[3],n=e[1]/e[3];return i>=-t[0]&&i<=t[0]&&n>=-t[1]&&n<=t[1]}function lt(t,i,n,r,o,a,s,l,c,u){const h=n.transform,d=r?t.textSizeData:t.iconSizeData,p=e.evaluateSizeForZoom(d,n.transform.zoom),f="globe"===h.projection.name,m=[256/n.width*2+1,256/n.height*2+1],g=r?t.text.dynamicLayoutVertexArray:t.icon.dynamicLayoutVertexArray;g.clear();let _=null;f&&(_=r?t.text.globeExtVertexArray:t.icon.globeExtVertexArray);const v=t.lineVertexArray,y=r?t.text.placedSymbolArray:t.icon.placedSymbolArray,x=n.transform.width/n.transform.height;let b=!1;for(let r=0;rMath.abs(n.x-i.x)*r?{useVertical:!0}:t.writingMode===e.WritingMode.vertical?i.yet}(i,n,r)?1===t.flipState?{needsFlipping:!0}:null:i.x>n.x?{needsFlipping:!0}:null}function ht(t,i,n,r,o,a,s,l,c,u,h,d,p,f,m,g,_,v,y){const x=i/24,b=t.lineOffsetX*x,w=t.lineOffsetY*x;let T=[];if(t.numGlyphs>1){const i=t.glyphStartIndex+t.numGlyphs,o=t.lineStartIndex,u=t.lineStartIndex+t.lineLength,h=ct(x,l,b,w,n,d,p,t,c,a,f,g,!1,_,v,y);if(!h)return{notEnoughRoom:!0};const C=ot(h.first.point,s).point,S=ot(h.last.point,s).point,E=new e.pointGeometry(C[0],C[1]),k=new e.pointGeometry(S[0],S[1]);if(r&&!n){const e=ut(t,E,k,m);if(t.flipState=e&&e.needsFlipping?1:2,e)return e}T=[h.first];for(let e=t.glyphStartIndex+1;e0?a.point:pt(p,r,i,1,o,void 0,_,v.canonical),l=ut(t,new e.pointGeometry(i[0],i[1]),new e.pointGeometry(s[0],s[1]),m);if(t.flipState=l&&l.needsFlipping?1:2,l)return l}const i=ft(x*l.getoffsetX(t.glyphStartIndex),b,w,n,d,p,t.segment,t.lineStartIndex,t.lineStartIndex+t.lineLength,c,a,f,g,!1,!1,_,v,y);if(!i)return{notEnoughRoom:!0};T=[i]}if(h)for(const t of T)e.updateGlobeVertexNormal(h,u.length+0,t.up[0],t.up[1],t.up[2]),e.updateGlobeVertexNormal(h,u.length+1,t.up[0],t.up[1],t.up[2]),e.updateGlobeVertexNormal(h,u.length+2,t.up[0],t.up[1],t.up[2]),e.updateGlobeVertexNormal(h,u.length+3,t.up[0],t.up[1],t.up[2]),e.addDynamicAttributes(u,t.point[0],t.point[1],t.point[2],t.angle);else for(const t of T)e.addDynamicAttributes(u,t.point[0],t.point[1],t.point[2],t.angle);return{}}function dt(t,i,n,r,o){const a=r.projectTilePoint(t.x,t.y,i);if(!o)return rt(a,n,a.z);const s=o(t);return rt(new e.pointGeometry(a.x+s[0],a.y+s[1]),n,a.z+s[2])}function pt(t,i,n,r,o,a,s,l){const c=dt(t.add(t.sub(i)._unit()),l,o,s,a).point,u=e.sub([],n,c);return e.scaleAndAdd([],n,u,r/e.length(u))}function ft(t,i,n,r,o,a,s,l,c,u,h,d,p,f,m,g,_,v){const y=r?t-i:t+i;let x=y>0?1:-1,b=0;r&&(x*=-1,b=Math.PI),x<0&&(b+=Math.PI);let w=x>0?l+s:l+s+1,T=o,C=o,S=0,E=0;const k=Math.abs(y),A=[],M=[];let I=a;const P=()=>{const t=w-x;return 0===S?a:new e.pointGeometry(u.getx(t),u.gety(t))},D=()=>{const e=P();return pt(e,I||e,C,k-S+1,h,p,g,_.canonical)};for(;S+E<=k;){if(w+=x,w=c)return null;if(C=T,A.push(T),f&&M.push(I||P()),T=d[w],void 0===T){I=new e.pointGeometry(u.getx(w),u.gety(w));const t=dt(I,_.canonical,h,g,p);T=t.signedDistanceFromCamera>0?d[w]=t.point:D()}else I=null;S+=E,E=e.distance(C,T)}I=I||new e.pointGeometry(u.getx(w),u.gety(w));const z=P();m&&p&&(d[w]=T=void 0===d[w]?T:D(),E=e.distance(C,T));const O=(k-S)/E,L=I.sub(z).mult(O)._add(z),R=e.sub([],T,C),B=e.scaleAndAdd([],C,R,O);let F=[0,0,1],$=R[0],j=R[1];if(v&&(F=g.upVector(_.canonical,L.x,L.y),0!==F[0]||0!==F[1]||1!==F[2])){const t=[1,0,0],i=[0,1,0];t[0]=F[2],t[1]=0,t[2]=-F[0],e.cross(i,F,t),e.normalize(t,t),e.normalize(i,i),$=e.dot(R,t),j=e.dot(R,i)}if(n){const t=e.cross([],F,R);e.normalize(t,t),e.scaleAndAdd(B,B,t,n*x)}const N=b+Math.atan2(j,$);return A.push(B),f&&M.push(L),{point:B,angle:N,path:A,tilePath:M,up:F}}const mt=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function gt(e,t){for(let i=0;i0,e.getProjection()),f=o*p.perspectiveRatio,m=(i.x1*t+n.x-i.padding)*f+p.point.x,g=(i.y1*t+n.y-i.padding)*f+p.point.y,_=(i.x2*t+n.x+i.padding)*f+p.point.x,v=(i.y2*t+n.y+i.padding)*f+p.point.y,y=p.perspectiveRatio<=.55||p.occluded;return!this.isInsideGrid(m,g,_,v)||!r&&this.grid.hitTest(m,g,_,v,s)||y?{box:[],offscreen:!1,occluded:p.occluded}:{box:[m,g,_,v],offscreen:this.isOffscreen(m,g,_,v),occluded:!1}}placeCollisionCircles(t,i,n,r,o,a,s,l,c,u,h,d,p,f,m){const g=[],_=this.transform.elevation,v=_?_.getAtTileOffsetFunc(m,this.transform.center.lat,this.transform.worldSize,t.getProjection()):e=>[0,0,0],y=new e.pointGeometry(n.tileAnchorX,n.tileAnchorY),x=t.getProjection().projectTilePoint(n.tileAnchorX,n.tileAnchorY,m.canonical),b=v(y),w=[x.x+b[0],x.y+b[1],x.z+b[2]],T="globe"===t.projection.name,C=this.projectAndGetPerspectiveRatio(s,[w[0],w[1],w[2]],m,T||!!_||this.transform.pitch>0,t.getProjection()),{perspectiveRatio:S}=C,E=(h?a/S:a*S)/e.ONE_EM,k=rt(new e.pointGeometry(w[0],w[1]),l,w[2]).point,A=C.signedDistanceFromCamera>0?ct(E,o,n.lineOffsetX*E,n.lineOffsetY*E,!1,k,y,n,r,l,{},_&&!h?v:null,h&&!!_,t.getProjection(),m,h):null;let M=!1,I=!1,P=!0;if(A&&!C.occluded){const t=.5*p*S+f,n=new e.pointGeometry(-100,-100),r=new e.pointGeometry(this.screenRightBoundary,this.screenBottomBoundary),o=new Je,a=A.first,s=A.last;let l=[];for(let e=a.path.length-1;e>=1;e--)l.push(a.path[e]);for(let e=1;e{const i=v(tot(e,c));l=e.some((e=>e.signedDistanceFromCamera<=0))?[]:e.map((e=>e.point))}let m=[];if(l.length>0){const t=l.map((t=>new e.pointGeometry(t[0],t[1])));let i=1/0,o=-1/0,a=1/0,s=-1/0;for(let e=0;e=n.x&&o<=r.x&&a>=n.y&&s<=r.y?[t]:or.x||sr.y?[]:e.clipLine([t],n.x,n.y,r.x,r.y)}for(const e of m){o.reset(e,.25*t);let n=0;n=o.length<=.5*t?1:Math.ceil(o.paddedLength/h)+1;for(let e=0;e0){e.transformMat4$1(a,a,t);const r="globe"===o.name;this.fogState&&n&&!r&&(s=function(t,i,n,r,o,a){const s=a.calculateFogTileMatrix(o),l=[i,n,r];return e.transformMat4(l,l,s),k(t,l,a.pitch,a._fov)}(this.fogState,i[0],i[1],i[2],n.toUnwrapped(),this.transform)>.9)}else _t(a,a,t);return{point:new e.pointGeometry((a[0]/a[3]+1)/2*this.transform.width+vt,(-a[1]/a[3]+1)/2*this.transform.height+vt),perspectiveRatio:Math.min(.5+this.transform.getCameraToCenterDistance(o)/a[3]*.5,1.5),signedDistanceFromCamera:a[3],occluded:r&&a[2]>a[3]||s}}isOffscreen(e,t,i,n){return i=this.screenRightBoundary||nthis.screenBottomBoundary}isInsideGrid(e,t,i,n){return i>=0&&e=0&&te.collisionGroupID===t}}return this.collisionGroups[e]}}function Mt(t,i,n,r,o){const{horizontalAlign:a,verticalAlign:s}=e.getAnchorAlignment(t),l=-(a-.5)*i,c=-(s-.5)*n,u=e.evaluateVariableOffset(t,r);return new e.pointGeometry(l+u[0]*o,c+u[1]*o)}function It(t,i,n,r,o){const a=new e.pointGeometry(t,i);return n&&a._rotate(r?o:-o),a}class Pt{constructor(e,t,i,n,r){this.transform=e.clone(),this.projection=e.projection.name,this.collisionIndex=new yt(this.transform,r),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=t,this.retainedQueryData={},this.collisionGroups=new At(i),this.collisionCircleArrays={},this.prevPlacement=n,n&&(n.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(t,i,n,r){const o=n.getBucket(i),a=n.latestFeatureIndex;if(!o||!a||i.id!==o.layerIds[0])return;const s=o.layers[0].layout,l=n.collisionBoxArray,c=Math.pow(2,this.transform.zoom-n.tileID.overscaledZ),u=n.tileSize/e.EXTENT,h=n.tileID.toUnwrapped();this.transform.setProjection(o.projection);const d=(p=n.tileID,f=o.getProjection(),m=this.transform,f.name===this.projection?m.calculateProjMatrix(p.toUnwrapped()):xt(m,f,p));var p,f,m;const g="map"===s.get("text-pitch-alignment"),_="map"===s.get("text-rotation-alignment");i.compileFilter();const v=i.dynamicFilter(),y=i.dynamicFilterNeedsFeature(),x=this.transform.calculatePixelsToTileUnitsMatrix(n),b=it(d,n.tileID.canonical,g,_,this.transform,o.getProjection(),x);let w=null;if(g){const t=nt(d,n.tileID.canonical,g,_,this.transform,o.getProjection(),x);w=e.multiply([],this.transform.labelPlaneMatrix,t)}let T=null;v&&n.latestFeatureIndex&&(T={unwrappedTileID:h,dynamicFilter:v,dynamicFilterNeedsFeature:y,featureIndex:n.latestFeatureIndex}),this.retainedQueryData[o.bucketInstanceId]=new kt(o.bucketInstanceId,a,o.sourceLayerIndex,o.index,n.tileID);const C={bucket:o,layout:s,posMatrix:d,textLabelPlaneMatrix:b,labelToScreenMatrix:w,clippingData:T,scale:c,textPixelRatio:u,holdingForFade:n.holdingForFade(),collisionBoxArray:l,partiallyEvaluatedTextSize:e.evaluateSizeForZoom(o.textSizeData,this.transform.zoom),partiallyEvaluatedIconSize:e.evaluateSizeForZoom(o.iconSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(o.sourceID)};if(r)for(const e of o.sortKeyRanges){const{sortKey:i,symbolInstanceStart:n,symbolInstanceEnd:r}=e;t.push({sortKey:i,symbolInstanceStart:n,symbolInstanceEnd:r,parameters:C})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:o.symbolInstances.length,parameters:C})}attemptAnchorPlacement(e,t,i,n,r,o,a,s,l,c,u,h,d,p,f,m,g,_){const v=[h.textOffset0,h.textOffset1],y=Mt(e,i,n,v,r),x=this.collisionIndex.placeCollisionBox(p,r,t,It(y.x,y.y,o,a,this.transform.angle),u,s,l,c.predicate);if(m){const e=p.getSymbolInstanceIconSize(_,this.transform.zoom,h.placedIconSymbolIndex);if(0===this.collisionIndex.placeCollisionBox(p,e,m,It(y.x,y.y,o,a,this.transform.angle),u,s,l,c.predicate).box.length)return}if(x.box.length>0){let t;return this.prevPlacement&&this.prevPlacement.variableOffsets[h.crossTileID]&&this.prevPlacement.placements[h.crossTileID]&&this.prevPlacement.placements[h.crossTileID].text&&(t=this.prevPlacement.variableOffsets[h.crossTileID].anchor),this.variableOffsets[h.crossTileID]={textOffset:v,width:i,height:n,anchor:e,textScale:r,prevAnchor:t},this.markUsedJustification(p,e,h,f),p.allowVerticalPlacement&&(this.markUsedOrientation(p,f,h),this.placedOrientations[h.crossTileID]=f),{shift:y,placedGlyphBoxes:x}}}placeLayerBucketPart(t,i,n,r){const{bucket:o,layout:a,posMatrix:s,textLabelPlaneMatrix:l,labelToScreenMatrix:c,clippingData:u,textPixelRatio:h,holdingForFade:d,collisionBoxArray:p,partiallyEvaluatedTextSize:f,partiallyEvaluatedIconSize:m,collisionGroup:g}=t.parameters,_=a.get("text-optional"),v=a.get("icon-optional"),y=a.get("text-allow-overlap"),x=a.get("icon-allow-overlap"),b="map"===a.get("text-rotation-alignment"),w="map"===a.get("text-pitch-alignment"),T="none"!==a.get("icon-text-fit"),C="viewport-y"===a.get("symbol-z-order");this.transform.setProjection(o.projection);let S=y&&(x||!o.hasIconData()||v),E=x&&(y||!o.hasTextData()||_);!o.collisionArrays&&p&&o.deserializeCollisionBoxes(p),n&&r&&o.updateCollisionDebugBuffers(this.transform.zoom,p);const k=(t,r,p)=>{if(u){const n={zoom:this.transform.zoom,pitch:this.transform.pitch};let r=null;if(u.dynamicFilterNeedsFeature){const e=this.retainedQueryData[o.bucketInstanceId];r=u.featureIndex.loadFeature({featureIndex:t.featureIndex,bucketIndex:e.bucketIndex,sourceLayerIndex:e.sourceLayerIndex,layoutVertexArrayOffset:0})}if(!(0,u.dynamicFilter)(n,r,this.retainedQueryData[o.bucketInstanceId].tileID.canonical,new e.pointGeometry(t.tileAnchorX,t.tileAnchorY),this.transform.calculateDistanceTileData(u.unwrappedTileID)))return this.placements[t.crossTileID]=new St(!1,!1,!1,!0),void(i[t.crossTileID]=!0)}if(i[t.crossTileID])return;if(d)return void(this.placements[t.crossTileID]=new St(!1,!1,!1));let C=!1,k=!1,A=!0,M=!1,I=!1,P=null,D={box:null,offscreen:null,occluded:null},z={box:null,offscreen:null,occluded:null},O=null,L=null,R=null,B=0,F=0,$=0;p.textFeatureIndex?B=p.textFeatureIndex:t.useRuntimeCollisionCircles&&(B=t.featureIndex),p.verticalTextFeatureIndex&&(F=p.verticalTextFeatureIndex);const j=e=>{e.tileID=this.retainedQueryData[o.bucketInstanceId].tileID,(this.transform.elevation||e.elevation)&&(e.elevation=this.transform.elevation?this.transform.elevation.getAtTileOffset(this.retainedQueryData[o.bucketInstanceId].tileID,e.tileAnchorX,e.tileAnchorY):0)},N=p.textBox;if(N){j(N);const i=i=>{let n=e.WritingMode.horizontal;if(o.allowVerticalPlacement&&!i&&this.prevPlacement){const e=this.prevPlacement.placedOrientations[t.crossTileID];e&&(this.placedOrientations[t.crossTileID]=e,n=e,this.markUsedOrientation(o,n,t))}return n},n=(i,n)=>{if(o.allowVerticalPlacement&&t.numVerticalGlyphVertices>0&&p.verticalTextBox){for(const t of o.writingModes)if(t===e.WritingMode.vertical?(D=n(),z=D):D=i(),D&&D.box&&D.box.length)break}else D=i()};if(a.get("text-variable-anchor")){let l=a.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[t.crossTileID]){const e=this.prevPlacement.variableOffsets[t.crossTileID];l.indexOf(e.anchor)>0&&(l=l.filter((t=>t!==e.anchor)),l.unshift(e.anchor))}const c=(e,i,n)=>{const a=o.getSymbolInstanceTextSize(f,t,this.transform.zoom,r),c=(e.x2-e.x1)*a+2*e.padding,u=(e.y2-e.y1)*a+2*e.padding,d=T&&!x?i:null;d&&j(d);let p={box:[],offscreen:!1,occluded:!1};const _=y?2*l.length:l.length;for(let i=0;i<_;++i){const _=this.attemptAnchorPlacement(l[i%l.length],e,c,u,a,b,w,h,s,g,i>=l.length,t,r,o,n,d,f,m);if(_&&(p=_.placedGlyphBoxes,p&&p.box&&p.box.length)){C=!0,P=_.shift;break}}return p};n((()=>c(N,p.iconBox,e.WritingMode.horizontal)),(()=>{const i=p.verticalTextBox;return i&&j(i),o.allowVerticalPlacement&&!(D&&D.box&&D.box.length)&&t.numVerticalGlyphVertices>0&&i?c(i,p.verticalIconBox,e.WritingMode.vertical):{box:null,offscreen:null,occluded:null}})),D&&(C=D.box,A=D.offscreen,M=D.occluded);const u=i(D&&D.box);if(!C&&this.prevPlacement){const e=this.prevPlacement.variableOffsets[t.crossTileID];e&&(this.variableOffsets[t.crossTileID]=e,this.markUsedJustification(o,e.anchor,t,u))}}else{const a=(i,n)=>{const a=o.getSymbolInstanceTextSize(f,t,this.transform.zoom,r),l=this.collisionIndex.placeCollisionBox(o,a,i,new e.pointGeometry(0,0),y,h,s,g.predicate);return l&&l.box&&l.box.length&&(this.markUsedOrientation(o,n,t),this.placedOrientations[t.crossTileID]=n),l};n((()=>a(N,e.WritingMode.horizontal)),(()=>{const i=p.verticalTextBox;return o.allowVerticalPlacement&&t.numVerticalGlyphVertices>0&&i?(j(i),a(i,e.WritingMode.vertical)):{box:null,offscreen:null,occluded:null}})),i(D&&D.box&&D.box.length)}}if(O=D,C=O&&O.box&&O.box.length>0,A=O&&O.offscreen,M=O&&O.occluded,t.useRuntimeCollisionCircles){const i=o.text.placedSymbolArray.get(t.centerJustifiedTextSymbolIndex>=0?t.centerJustifiedTextSymbolIndex:t.verticalPlacedTextSymbolIndex),r=e.evaluateSizeForFeature(o.textSizeData,f,i),u=a.get("text-padding");L=this.collisionIndex.placeCollisionCircles(o,y,i,o.lineVertexArray,o.glyphOffsetArray,r,s,l,c,n,w,g.predicate,t.collisionCircleDiameter*r/e.ONE_EM,u,this.retainedQueryData[o.bucketInstanceId].tileID),C=y||L.circles.length>0&&!L.collisionDetected,A=A&&L.offscreen,M=L.occluded}if(p.iconFeatureIndex&&($=p.iconFeatureIndex),p.iconBox){const i=i=>{j(i);const n=T&&P?It(P.x,P.y,b,w,this.transform.angle):new e.pointGeometry(0,0),r=o.getSymbolInstanceIconSize(m,this.transform.zoom,t.placedIconSymbolIndex);return this.collisionIndex.placeCollisionBox(o,r,i,n,x,h,s,g.predicate)};z&&z.box&&z.box.length&&p.verticalIconBox?(R=i(p.verticalIconBox),k=R.box.length>0):(R=i(p.iconBox),k=R.box.length>0),A=A&&R.offscreen,I=R.occluded}const U=_||0===t.numHorizontalGlyphVertices&&0===t.numVerticalGlyphVertices,V=v||0===t.numIconVertices;if(U||V?V?U||(k=k&&C):C=k&&C:k=C=k&&C,C&&O&&O.box&&this.collisionIndex.insertCollisionBox(O.box,a.get("text-ignore-placement"),o.bucketInstanceId,z&&z.box&&F?F:B,g.ID),k&&R&&this.collisionIndex.insertCollisionBox(R.box,a.get("icon-ignore-placement"),o.bucketInstanceId,$,g.ID),L&&(C&&this.collisionIndex.insertCollisionCircles(L.circles,a.get("text-ignore-placement"),o.bucketInstanceId,B,g.ID),n)){const e=o.bucketInstanceId;let t=this.collisionCircleArrays[e];void 0===t&&(t=this.collisionCircleArrays[e]=new Et);for(let e=0;e=0;--t){const i=e[t];k(o.symbolInstances.get(i),i,o.collisionArrays[i])}}else for(let e=t.symbolInstanceStart;e=0&&(t.text.placedSymbolArray.get(e).crossTileID=o>=0&&e!==o?0:n.crossTileID)}markUsedOrientation(t,i,n){const r=i===e.WritingMode.horizontal||i===e.WritingMode.horizontalOnly?i:0,o=i===e.WritingMode.vertical?i:0,a=[n.leftJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.rightJustifiedTextSymbolIndex].filter((e=>-1!==e));for(const e of a)t.text.placedSymbolArray.get(e).placedOrientation=r;-1!==n.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(n.verticalPlacedTextSymbolIndex).placedOrientation=o)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;const t=this.prevPlacement;let i=!1;this.prevZoomAdjustment=t?t.zoomAdjustment(this.transform.zoom):0;const n=t?t.symbolFadeChange(e):1,r=t?t.opacities:{},o=t?t.variableOffsets:{},a=t?t.placedOrientations:{};for(const e in this.placements){const t=this.placements[e],o=r[e];o?(this.opacities[e]=new Ct(o,n,t.text,t.icon,null,t.clipped),i=i||t.text!==o.text.placed||t.icon!==o.icon.placed):(this.opacities[e]=new Ct(null,n,t.text,t.icon,t.skipFade,t.clipped),i=i||t.text||t.icon)}for(const e in r){const t=r[e];if(!this.opacities[e]){const r=new Ct(t,n,!1,!1);r.isHidden()||(this.opacities[e]=r,i=i||t.text.placed||t.icon.placed)}}for(const e in o)this.variableOffsets[e]||!this.opacities[e]||this.opacities[e].isHidden()||(this.variableOffsets[e]=o[e]);for(const e in a)this.placedOrientations[e]||!this.opacities[e]||this.opacities[e].isHidden()||(this.placedOrientations[e]=a[e]);i?this.lastPlacementChangeTime=e:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=t?t.lastPlacementChangeTime:e)}updateLayerOpacities(e,t){const i={};for(const n of t){const t=n.getBucket(e);t&&n.latestFeatureIndex&&e.id===t.layerIds[0]&&this.updateBucketOpacities(t,i,n.collisionBoxArray)}}updateBucketOpacities(t,i,n){t.hasTextData()&&t.text.opacityVertexArray.clear(),t.hasIconData()&&t.icon.opacityVertexArray.clear(),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();const r=t.layers[0].layout,o=!!t.layers[0].dynamicFilter(),a=new Ct(null,0,!1,!1,!0),s=r.get("text-allow-overlap"),l=r.get("icon-allow-overlap"),c=r.get("text-variable-anchor"),u="map"===r.get("text-rotation-alignment"),h="map"===r.get("text-pitch-alignment"),d="none"!==r.get("icon-text-fit"),p=new Ct(null,0,s&&(l||!t.hasIconData()||r.get("icon-optional")),l&&(s||!t.hasTextData()||r.get("text-optional")),!0);!t.collisionArrays&&n&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(n);const f=(e,t,i)=>{for(let n=0;n0||l>0,y=r.numIconVertices>0,x=this.placedOrientations[r.crossTileID],b=x===e.WritingMode.vertical,w=x===e.WritingMode.horizontal||x===e.WritingMode.horizontalOnly;if(!v&&!y||_.isHidden()||m++,v){const e=jt(_.text);f(t.text,s,b?Nt:e),f(t.text,l,w?Nt:e);const i=_.text.isHidden();[r.rightJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.leftJustifiedTextSymbolIndex].forEach((e=>{e>=0&&(t.text.placedSymbolArray.get(e).hidden=i||b?1:0)})),r.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(r.verticalPlacedTextSymbolIndex).hidden=i||w?1:0);const n=this.variableOffsets[r.crossTileID];n&&this.markUsedJustification(t,n.anchor,r,x);const o=this.placedOrientations[r.crossTileID];o&&(this.markUsedJustification(t,"left",r,o),this.markUsedOrientation(t,o,r))}if(y){const e=jt(_.icon);r.placedIconSymbolIndex>=0&&(f(t.icon,r.numIconVertices,b?Nt:e),t.icon.placedSymbolArray.get(r.placedIconSymbolIndex).hidden=_.icon.isHidden()),r.verticalPlacedIconSymbolIndex>=0&&(f(t.icon,r.numVerticalIconVertices,w?Nt:e),t.icon.placedSymbolArray.get(r.verticalPlacedIconSymbolIndex).hidden=_.icon.isHidden())}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const i=t.collisionArrays[n];if(i){let n=new e.pointGeometry(0,0),r=!0;if(i.textBox||i.verticalTextBox){if(c){const e=this.variableOffsets[g];e?(n=Mt(e.anchor,e.width,e.height,e.textOffset,e.textScale),u&&n._rotate(h?this.transform.angle:-this.transform.angle)):r=!1}o&&(r=!_.clipped),i.textBox&&Dt(t.textCollisionBox.collisionVertexArray,_.text.placed,!r||b,n.x,n.y),i.verticalTextBox&&Dt(t.textCollisionBox.collisionVertexArray,_.text.placed,!r||w,n.x,n.y)}const a=r&&Boolean(!w&&i.verticalIconBox);i.iconBox&&Dt(t.iconCollisionBox.collisionVertexArray,_.icon.placed,a,d?n.x:0,d?n.y:0),i.verticalIconBox&&Dt(t.iconCollisionBox.collisionVertexArray,_.icon.placed,!a,d?n.x:0,d?n.y:0)}}}if(t.fullyClipped=0===m,t.sortFeatures(this.transform.angle),this.retainedQueryData[t.bucketInstanceId]&&(this.retainedQueryData[t.bucketInstanceId].featureSortOrder=t.featureSortOrder),t.hasTextData()&&t.text.opacityVertexBuffer&&t.text.opacityVertexBuffer.updateData(t.text.opacityVertexArray),t.hasIconData()&&t.icon.opacityVertexBuffer&&t.icon.opacityVertexBuffer.updateData(t.icon.opacityVertexArray),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexBuffer&&t.iconCollisionBox.collisionVertexBuffer.updateData(t.iconCollisionBox.collisionVertexArray),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexBuffer&&t.textCollisionBox.collisionVertexBuffer.updateData(t.textCollisionBox.collisionVertexArray),t.bucketInstanceId in this.collisionCircleArrays){const e=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=e.invProjMatrix,t.placementViewportMatrix=e.viewportMatrix,t.collisionCircleArray=e.circles,delete this.collisionCircleArrays[t.bucketInstanceId]}}symbolFadeChange(e){return 0===this.fadeDuration?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(e){return Math.max(0,(this.transform.zoom-e)/1.5)}hasTransitions(e){return this.stale||e-this.lastPlacementChangeTimee}setStale(){this.stale=!0}}function Dt(e,t,i,n,r){e.emplaceBack(t?1:0,i?1:0,n||0,r||0),e.emplaceBack(t?1:0,i?1:0,n||0,r||0),e.emplaceBack(t?1:0,i?1:0,n||0,r||0),e.emplaceBack(t?1:0,i?1:0,n||0,r||0)}const zt=Math.pow(2,25),Ot=Math.pow(2,24),Lt=Math.pow(2,17),Rt=Math.pow(2,16),Bt=Math.pow(2,9),Ft=Math.pow(2,8),$t=Math.pow(2,1);function jt(e){if(0===e.opacity&&!e.placed)return 0;if(1===e.opacity&&e.placed)return 4294967295;const t=e.placed?1:0,i=Math.floor(127*e.opacity);return i*zt+t*Ot+i*Lt+t*Rt+i*Bt+t*Ft+i*$t+t}const Nt=0;class Ut{constructor(e){this._sortAcrossTiles="viewport-y"!==e.layout.get("symbol-z-order")&&void 0!==e.layout.get("symbol-sort-key").constantOr(1),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(e,t,i,n,r){const o=this._bucketParts;for(;this._currentTileIndexe.sortKey-t.sortKey)));this._currentPartIndex{const t=e.exported.now()-r;return!this._forceFullPlacement&&t>2};for(;this._currentPlacementIndex>=0;){const e=i[t[this._currentPlacementIndex]],r=this.placement.collisionIndex.transform.zoom;if("symbol"===e.type&&(!e.minzoom||e.minzoom<=r)&&(!e.maxzoom||e.maxzoom>r)){if(this._inProgressLayer||(this._inProgressLayer=new Ut(e)),this._inProgressLayer.continuePlacement(n[e.source],this.placement,this._showCollisionBoxes,e,o))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}}const Gt=512/e.EXTENT/2;class qt{constructor(e,t,i){this.tileID=e,this.indexedSymbolInstances={},this.bucketInstanceId=i;for(let i=0;ie.overscaledZ)for(const i in r){const o=r[i];o.tileID.isChildOf(e)&&o.findMatches(t.symbolInstances,e,n)}else{const o=r[e.scaledTo(Number(i)).key];o&&o.findMatches(t.symbolInstances,e,n)}}for(let e=0;e{t[e]=!0}));for(const e in this.layerIndexes)t[e]||delete this.layerIndexes[e]}}const Xt=(t,i)=>e.emitValidationErrors(t,i&&i.filter((e=>"source.canvas"!==e.identifier))),Yt=e.pick(Ge,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setTerrain","setFog","setProjection"]),Kt=e.pick(Ge,["setCenter","setZoom","setBearing","setPitch"]),Jt={version:8,layers:[],sources:{}},Qt={fill:!0,line:!0,background:!0,hillshade:!0,raster:!0};class ei extends e.Evented{constructor(t,i={}){super(),this.map=t,this.dispatcher=new D(Ne(),this),this.imageManager=new x,this.imageManager.setEventedParent(this),this.glyphManager=new e.GlyphManager(t._requestManager,i.localFontFamily?e.LocalGlyphMode.all:i.localIdeographFontFamily?e.LocalGlyphMode.ideographs:e.LocalGlyphMode.none,i.localFontFamily||i.localIdeographFontFamily),this.crossTileSymbolIndex=new Ht,this._layers={},this._num3DLayers=0,this._numSymbolLayers=0,this._numCircleLayers=0,this._serializedLayers={},this._sourceCaches={},this._otherSourceCaches={},this._symbolSourceCaches={},this.zoomHistory=new e.ZoomHistory,this._loaded=!1,this._availableImages=[],this._order=[],this._drapedFirstOrder=[],this._markersNeedUpdate=!1,this._resetUpdates(),this.dispatcher.broadcast("setReferrer",e.getReferrer());const n=this;this._rtlTextPluginCallback=ei.registerForPluginStateChange((t=>{n.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:t.pluginStatus,pluginURL:t.pluginURL},((t,i)=>{if(e.triggerPluginCompletionEvent(t),i&&i.every((e=>e)))for(const e in n._sourceCaches){const t=n._sourceCaches[e],i=t.getSource().type;"vector"!==i&&"geojson"!==i||t.reload()}}))})),this.on("data",(e=>{if("source"!==e.dataType||"metadata"!==e.sourceDataType)return;const t=this.getSource(e.sourceId);if(t&&t.vectorLayerIds)for(const e in this._layers){const i=this._layers[e];i.source===t.id&&this._validateLayer(i)}}))}loadURL(t,i={}){this.fire(new e.Event("dataloading",{dataType:"style"}));const n="boolean"==typeof i.validate?i.validate:!e.isMapboxURL(t);t=this.map._requestManager.normalizeStyleURL(t,i.accessToken);const r=this.map._requestManager.transformRequest(t,e.ResourceType.Style);this._request=e.getJSON(r,((t,i)=>{this._request=null,t?this.fire(new e.ErrorEvent(t)):i&&this._load(i,n)}))}loadJSON(t,i={}){this.fire(new e.Event("dataloading",{dataType:"style"})),this._request=e.exported.frame((()=>{this._request=null,this._load(t,!1!==i.validate)}))}loadEmpty(){this.fire(new e.Event("dataloading",{dataType:"style"})),this._load(Jt,!1)}_updateLayerCount(e,t){const i=t?1:-1;e.is3D()&&(this._num3DLayers+=i),"circle"===e.type&&(this._numCircleLayers+=i),"symbol"===e.type&&(this._numSymbolLayers+=i)}_load(t,i){if(i&&Xt(this,e.validateStyle(t)))return;this._loaded=!0,this.stylesheet=e.clone$1(t),this._updateMapProjection();for(const e in t.sources)this.addSource(e,t.sources[e],{validate:!1});this._changed=!1,t.sprite?this._loadSprite(t.sprite):(this.imageManager.setLoaded(!0),this.dispatcher.broadcast("spriteLoaded",!0)),this.glyphManager.setURL(t.glyphs);const n=Ve(this.stylesheet.layers);this._order=n.map((e=>e.id)),this._layers={},this._serializedLayers={};for(let t of n)t=e.createStyleLayer(t),t.setEventedParent(this,{layer:{id:t.id}}),this._layers[t.id]=t,this._serializedLayers[t.id]=t.serialize(),this._updateLayerCount(t,!0);this.dispatcher.broadcast("setLayers",this._serializeLayers(this._order)),this.light=new T(this.stylesheet.light),this.stylesheet.terrain&&!this.terrainSetForDrapingOnly()&&this._createTerrain(this.stylesheet.terrain,1),this.stylesheet.fog&&this._createFog(this.stylesheet.fog),this._updateDrapeFirstLayers(),this.fire(new e.Event("data",{dataType:"style"})),this.fire(new e.Event("style.load"))}terrainSetForDrapingOnly(){return!!this.terrain&&0===this.terrain.drapeRenderMode}setProjection(e){e?this.stylesheet.projection=e:delete this.stylesheet.projection,this._updateMapProjection()}applyProjectionUpdate(){this._loaded&&(this.dispatcher.broadcast("setProjection",this.map.transform.projectionOptions),this.map.transform.projection.requiresDraping?this.getTerrain()||this.stylesheet.terrain||this.setTerrainForDraping():this.terrainSetForDrapingOnly()&&this.setTerrain(null))}_updateMapProjection(){this.map._useExplicitProjection?this.applyProjectionUpdate():this.map._prioritizeAndUpdateProjection(null,this.stylesheet.projection)}_loadSprite(t){this._spriteRequest=function(t,i,n){let r,o,a;const s=e.exported.devicePixelRatio>1?"@2x":"";let l=e.getJSON(i.transformRequest(i.normalizeSpriteURL(t,s,".json"),e.ResourceType.SpriteJSON),((e,t)=>{l=null,a||(a=e,r=t,u())})),c=e.getImage(i.transformRequest(i.normalizeSpriteURL(t,s,".png"),e.ResourceType.SpriteImage),((e,t)=>{c=null,a||(a=e,o=t,u())}));function u(){if(a)n(a);else if(r&&o){const t=e.exported.getImageData(o),i={};for(const n in r){const{width:o,height:a,x:s,y:l,sdf:c,pixelRatio:u,stretchX:h,stretchY:d,content:p}=r[n],f=new e.RGBAImage({width:o,height:a});e.RGBAImage.copy(t,f,{x:s,y:l},{x:0,y:0},{width:o,height:a}),i[n]={data:f,pixelRatio:u,sdf:c,stretchX:h,stretchY:d,content:p}}n(null,i)}}return{cancel(){l&&(l.cancel(),l=null),c&&(c.cancel(),c=null)}}}(t,this.map._requestManager,((t,i)=>{if(this._spriteRequest=null,t)this.fire(new e.ErrorEvent(t));else if(i)for(const e in i)this.imageManager.addImage(e,i[e]);this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),this.dispatcher.broadcast("setImages",this._availableImages),this.dispatcher.broadcast("spriteLoaded",!0),this.fire(new e.Event("data",{dataType:"style"}))}))}_validateLayer(t){const i=this.getSource(t.source);if(!i)return;const n=t.sourceLayer;n&&("geojson"===i.type||i.vectorLayerIds&&-1===i.vectorLayerIds.indexOf(n))&&this.fire(new e.ErrorEvent(new Error(`Source layer "${n}" does not exist on source "${i.id}" as specified by style layer "${t.id}"`)))}loaded(){if(!this._loaded)return!1;if(Object.keys(this._updatedSources).length)return!1;for(const e in this._sourceCaches)if(!this._sourceCaches[e].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeLayers(e){const t=[];for(const i of e){const e=this._layers[i];"custom"!==e.type&&t.push(e.serialize())}return t}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;if(this.fog&&this.fog.hasTransition())return!0;for(const e in this._sourceCaches)if(this._sourceCaches[e].hasTransition())return!0;for(const e in this._layers)if(this._layers[e].hasTransition())return!0;return!1}get order(){return this.map._optimizeForTerrain&&this.terrain?this._drapedFirstOrder:this._order}isLayerDraped(e){return!!this.terrain&&Qt[e.type]}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading")}update(t){if(!this._loaded)return;const i=this._changed;if(this._changed){const e=Object.keys(this._updatedLayers),i=Object.keys(this._removedLayers);(e.length||i.length)&&this._updateWorkerLayers(e,i);for(const e in this._updatedSources){const t=this._updatedSources[e];"reload"===t?this._reloadSource(e):"clear"===t&&this._clearSource(e)}this._updateTilesForChangedImages();for(const e in this._updatedPaintProps)this._layers[e].updateTransitions(t);this.light.updateTransitions(t),this.fog&&this.fog.updateTransitions(t),this._resetUpdates()}const n={};for(const e in this._sourceCaches){const t=this._sourceCaches[e];n[e]=t.used,t.used=!1}for(const e of this._order){const i=this._layers[e];if(i.recalculate(t,this._availableImages),!i.isHidden(t.zoom)){const e=this._getLayerSourceCache(i);e&&(e.used=!0)}const n=this.map.painter;if(n){const e=i.getProgramIds();if(!e)continue;const r=i.getProgramConfiguration(t.zoom);for(const t of e)n.useProgram(t,r)}}for(const t in n){const i=this._sourceCaches[t];n[t]!==i.used&&i.getSource().fire(new e.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:i.getSource().id}))}this.light.recalculate(t),this.terrain&&this.terrain.recalculate(t),this.fog&&this.fog.recalculate(t),this.z=t.zoom,this._markersNeedUpdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),i&&this.fire(new e.Event("data",{dataType:"style"}))}_updateTilesForChangedImages(){const e=Object.keys(this._changedImages);if(e.length){for(const t in this._sourceCaches)this._sourceCaches[t].reloadTilesForDependencies(["icons","patterns"],e);this._changedImages={}}}_updateWorkerLayers(e,t){this.dispatcher.broadcast("updateLayers",{layers:this._serializeLayers(e),removedIds:t})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={}}setState(i){if(this._checkLoaded(),Xt(this,e.validateStyle(i)))return!1;(i=e.clone$1(i)).layers=Ve(i.layers);const n=function(e,i){if(!e)return[{command:Ge.setStyle,args:[i]}];let n=[];try{if(!t(e.version,i.version))return[{command:Ge.setStyle,args:[i]}];t(e.center,i.center)||n.push({command:Ge.setCenter,args:[i.center]}),t(e.zoom,i.zoom)||n.push({command:Ge.setZoom,args:[i.zoom]}),t(e.bearing,i.bearing)||n.push({command:Ge.setBearing,args:[i.bearing]}),t(e.pitch,i.pitch)||n.push({command:Ge.setPitch,args:[i.pitch]}),t(e.sprite,i.sprite)||n.push({command:Ge.setSprite,args:[i.sprite]}),t(e.glyphs,i.glyphs)||n.push({command:Ge.setGlyphs,args:[i.glyphs]}),t(e.transition,i.transition)||n.push({command:Ge.setTransition,args:[i.transition]}),t(e.light,i.light)||n.push({command:Ge.setLight,args:[i.light]}),t(e.fog,i.fog)||n.push({command:Ge.setFog,args:[i.fog]}),t(e.projection,i.projection)||n.push({command:Ge.setProjection,args:[i.projection]});const r={},o=[];!function(e,i,n,r){let o;for(o in i=i||{},e=e||{})e.hasOwnProperty(o)&&(i.hasOwnProperty(o)||We(o,n,r));for(o in i)i.hasOwnProperty(o)&&(e.hasOwnProperty(o)?t(e[o],i[o])||("geojson"===e[o].type&&"geojson"===i[o].type&&He(e,i,o)?n.push({command:Ge.setGeoJSONSourceData,args:[o,i[o].data]}):Ze(o,i,n,r)):qe(o,i,n))}(e.sources,i.sources,o,r);const a=[];e.layers&&e.layers.forEach((e=>{e.source&&r[e.source]?n.push({command:Ge.removeLayer,args:[e.id]}):a.push(e)}));let s=e.terrain;s&&r[s.source]&&(n.push({command:Ge.setTerrain,args:[void 0]}),s=void 0),n=n.concat(o),t(s,i.terrain)||n.push({command:Ge.setTerrain,args:[i.terrain]}),function(e,i,n){i=i||[];const r=(e=e||[]).map(Ye),o=i.map(Ye),a=e.reduce(Ke,{}),s=i.reduce(Ke,{}),l=r.slice(),c=Object.create(null);let u,h,d,p,f,m,g;for(u=0,h=0;u!(e.command in Kt)));if(0===n.length)return!1;const r=n.filter((e=>!(e.command in Yt)));if(r.length>0)throw new Error(`Unimplemented: ${r.map((e=>e.command)).join(", ")}.`);return n.forEach((e=>{"setTransition"!==e.command&&"setProjection"!==e.command&&this[e.command].apply(this,e.args)})),this.stylesheet=i,this._updateMapProjection(),!0}addImage(t,i){return this.getImage(t)?this.fire(new e.ErrorEvent(new Error("An image with this name already exists."))):(this.imageManager.addImage(t,i),this._afterImageUpdated(t),this)}updateImage(e,t){this.imageManager.updateImage(e,t)}getImage(e){return this.imageManager.getImage(e)}removeImage(t){return this.getImage(t)?(this.imageManager.removeImage(t),this._afterImageUpdated(t),this):this.fire(new e.ErrorEvent(new Error("No image with this name exists.")))}_afterImageUpdated(t){this._availableImages=this.imageManager.listImages(),this._changedImages[t]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new e.Event("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this._availableImages.slice()}addSource(t,i,n={}){if(this._checkLoaded(),void 0!==this.getSource(t))throw new Error("There is already a source with this ID");if(!i.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(i).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(i.type)>=0&&this._validate(e.validateSource,`sources.${t}`,i,null,n))return;this.map&&this.map._collectResourceTiming&&(i.collectResourceTiming=!0);const r=De(t,i,this.dispatcher,this);r.setEventedParent(this,(()=>({isSourceLoaded:this._isSourceCacheLoaded(t),source:r.serialize(),sourceId:t})));const o=i=>{const n=(i?"symbol:":"other:")+t,o=this._sourceCaches[n]=new e.SourceCache(n,r,i);(i?this._symbolSourceCaches:this._otherSourceCaches)[t]=o,o.style=this,o.onAdd(this.map)};o(!1),"vector"!==i.type&&"geojson"!==i.type||o(!0),r.onAdd&&r.onAdd(this.map),this._changed=!0}removeSource(t){this._checkLoaded();const i=this.getSource(t);if(!i)throw new Error("There is no source with this ID");for(const i in this._layers)if(this._layers[i].source===t)return this.fire(new e.ErrorEvent(new Error(`Source "${t}" cannot be removed while layer "${i}" is using it.`)));if(this.terrain&&this.terrain.get().source===t)return this.fire(new e.ErrorEvent(new Error(`Source "${t}" cannot be removed while terrain is using it.`)));const n=this._getSourceCaches(t);for(const t of n)delete this._sourceCaches[t.id],delete this._updatedSources[t.id],t.fire(new e.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:t.getSource().id})),t.setEventedParent(null),t.clearTiles();return delete this._otherSourceCaches[t],delete this._symbolSourceCaches[t],i.setEventedParent(null),i.onRemove&&i.onRemove(this.map),this._changed=!0,this}setGeoJSONSourceData(e,t){this._checkLoaded(),this.getSource(e).setData(t),this._changed=!0}getSource(e){const t=this._getSourceCache(e);return t&&t.getSource()}_getSources(){const e=[];for(const t in this._otherSourceCaches){const i=this._getSourceCache(t);i&&e.push(i.getSource())}return e}addLayer(t,i,n={}){this._checkLoaded();const r=t.id;if(this.getLayer(r))return void this.fire(new e.ErrorEvent(new Error(`Layer with id "${r}" already exists on this map`)));let o;if("custom"===t.type){if(Xt(this,e.validateCustomStyleLayer(t)))return;o=e.createStyleLayer(t)}else{if("object"==typeof t.source&&(this.addSource(r,t.source),t=e.clone$1(t),t=e.extend(t,{source:r})),this._validate(e.validateLayer,`layers.${r}`,t,{arrayIndex:-1},n))return;o=e.createStyleLayer(t),this._validateLayer(o),o.setEventedParent(this,{layer:{id:r}}),this._serializedLayers[o.id]=o.serialize(),this._updateLayerCount(o,!0)}const a=i?this._order.indexOf(i):this._order.length;if(i&&-1===a)return void this.fire(new e.ErrorEvent(new Error(`Layer with id "${i}" does not exist on this map.`)));this._order.splice(a,0,r),this._layerOrderChanged=!0,this._layers[r]=o;const s=this._getLayerSourceCache(o);if(this._removedLayers[r]&&o.source&&s&&"custom"!==o.type){const e=this._removedLayers[r];delete this._removedLayers[r],e.type!==o.type?this._updatedSources[o.source]="clear":(this._updatedSources[o.source]="reload",s.pause())}this._updateLayer(o),o.onAdd&&o.onAdd(this.map),this._updateDrapeFirstLayers()}moveLayer(t,i){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new e.ErrorEvent(new Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===i)return;const n=this._order.indexOf(t);this._order.splice(n,1);const r=i?this._order.indexOf(i):this._order.length;i&&-1===r?this.fire(new e.ErrorEvent(new Error(`Layer with id "${i}" does not exist on this map.`))):(this._order.splice(r,0,t),this._layerOrderChanged=!0,this._updateDrapeFirstLayers())}removeLayer(t){this._checkLoaded();const i=this._layers[t];if(!i)return void this.fire(new e.ErrorEvent(new Error(`The layer '${t}' does not exist in the map's style and cannot be removed.`)));i.setEventedParent(null),this._updateLayerCount(i,!1);const n=this._order.indexOf(t);this._order.splice(n,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=i,delete this._layers[t],delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],i.onRemove&&i.onRemove(this.map),this._updateDrapeFirstLayers()}getLayer(e){return this._layers[e]}hasLayer(e){return e in this._layers}hasLayerType(e){for(const t in this._layers)if(this._layers[t].type===e)return!0;return!1}setLayerZoomRange(t,i,n){this._checkLoaded();const r=this.getLayer(t);r?r.minzoom===i&&r.maxzoom===n||(null!=i&&(r.minzoom=i),null!=n&&(r.maxzoom=n),this._updateLayer(r)):this.fire(new e.ErrorEvent(new Error(`The layer '${t}' does not exist in the map's style and cannot have zoom extent.`)))}setFilter(i,n,r={}){this._checkLoaded();const o=this.getLayer(i);if(o){if(!t(o.filter,n))return null==n?(o.filter=void 0,void this._updateLayer(o)):void(this._validate(e.validateFilter,`layers.${o.id}.filter`,n,{layerType:o.type},r)||(o.filter=e.clone$1(n),this._updateLayer(o)))}else this.fire(new e.ErrorEvent(new Error(`The layer '${i}' does not exist in the map's style and cannot be filtered.`)))}getFilter(t){const i=this.getLayer(t);return i&&e.clone$1(i.filter)}setLayoutProperty(i,n,r,o={}){this._checkLoaded();const a=this.getLayer(i);a?t(a.getLayoutProperty(n),r)||(a.setLayoutProperty(n,r,o),this._updateLayer(a)):this.fire(new e.ErrorEvent(new Error(`The layer '${i}' does not exist in the map's style and cannot be styled.`)))}getLayoutProperty(t,i){const n=this.getLayer(t);if(n)return n.getLayoutProperty(i);this.fire(new e.ErrorEvent(new Error(`The layer '${t}' does not exist in the map's style.`)))}setPaintProperty(i,n,r,o={}){this._checkLoaded();const a=this.getLayer(i);a?t(a.getPaintProperty(n),r)||(a.setPaintProperty(n,r,o)&&this._updateLayer(a),this._changed=!0,this._updatedPaintProps[i]=!0):this.fire(new e.ErrorEvent(new Error(`The layer '${i}' does not exist in the map's style and cannot be styled.`)))}getPaintProperty(e,t){const i=this.getLayer(e);return i&&i.getPaintProperty(t)}setFeatureState(t,i){this._checkLoaded();const n=t.source,r=t.sourceLayer,o=this.getSource(n);if(!o)return void this.fire(new e.ErrorEvent(new Error(`The source '${n}' does not exist in the map's style.`)));const a=o.type;if("geojson"===a&&r)return void this.fire(new e.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));if("vector"===a&&!r)return void this.fire(new e.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));void 0===t.id&&this.fire(new e.ErrorEvent(new Error("The feature id parameter must be provided.")));const s=this._getSourceCaches(n);for(const e of s)e.setFeatureState(r,t.id,i)}removeFeatureState(t,i){this._checkLoaded();const n=t.source,r=this.getSource(n);if(!r)return void this.fire(new e.ErrorEvent(new Error(`The source '${n}' does not exist in the map's style.`)));const o=r.type,a="vector"===o?t.sourceLayer:void 0;if("vector"===o&&!a)return void this.fire(new e.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));if(i&&"string"!=typeof t.id&&"number"!=typeof t.id)return void this.fire(new e.ErrorEvent(new Error("A feature id is required to remove its specific state property.")));const s=this._getSourceCaches(n);for(const e of s)e.removeFeatureState(a,t.id,i)}getFeatureState(t){this._checkLoaded();const i=t.source,n=t.sourceLayer,r=this.getSource(i);if(r){if("vector"!==r.type||n)return void 0===t.id&&this.fire(new e.ErrorEvent(new Error("The feature id parameter must be provided."))),this._getSourceCaches(i)[0].getFeatureState(n,t.id);this.fire(new e.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new e.ErrorEvent(new Error(`The source '${i}' does not exist in the map's style.`)))}getTransition(){return e.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){const t={};for(const e in this._sourceCaches){const i=this._sourceCaches[e].getSource();t[i.id]||(t[i.id]=i.serialize())}return e.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,terrain:this.getTerrain()||void 0,fog:this.stylesheet.fog,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,projection:this.stylesheet.projection,sources:t,layers:this._serializeLayers(this._order)},(e=>void 0!==e))}_updateLayer(e){this._updatedLayers[e.id]=!0;const t=this._getLayerSourceCache(e);e.source&&!this._updatedSources[e.source]&&t&&"raster"!==t.getSource().type&&(this._updatedSources[e.source]="reload",t.pause()),this._changed=!0,e.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(e){const t=e=>"fill-extrusion"===this._layers[e].type,i={},n=[];for(let r=this._order.length-1;r>=0;r--){const o=this._order[r];if(t(o)){i[o]=r;for(const t of e){const e=t[o];if(e)for(const t of e)n.push(t)}}}n.sort(((e,t)=>t.intersectionZ-e.intersectionZ));const r=[];for(let o=this._order.length-1;o>=0;o--){const a=this._order[o];if(t(a))for(let e=n.length-1;e>=0;e--){const t=n[e].feature;if(i[t.layer.id]{const t=this.getLayer(e);return t&&t.is3D()})):this.has3DLayers(),s=O.createFromScreenPoints(t,n);for(const e in this._sourceCaches){const t=this._sourceCaches[e].getSource().id;i.layers&&!r[t]||o.push(Oe(this._sourceCaches[e],this._layers,this._serializedLayers,s,i,n,a,!!this.map._showQueryGeometry))}return this.placement&&o.push(function(e,t,i,n,r,o,a){const s={},l=o.queryRenderedSymbols(n),c=[];for(const e of Object.keys(l).map(Number))c.push(a[e]);c.sort(Re);for(const i of c){const n=i.featureIndex.lookupSymbolFeatures(l[i.bucketInstanceId],t,i.bucketIndex,i.sourceLayerIndex,r.filter,r.layers,r.availableImages,e);for(const e in n){const t=s[e]=s[e]||[],r=n[e];r.sort(((e,t)=>{const n=i.featureSortOrder;if(n){const i=n.indexOf(e.featureIndex);return n.indexOf(t.featureIndex)-i}return t.featureIndex-e.featureIndex}));for(const e of r)t.push(e)}}for(const t in s)s[t].forEach((n=>{const r=n.feature,o=i(e[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=o}));return s}(this._layers,this._serializedLayers,this._getLayerSourceCache.bind(this),s.screenGeometry,i,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(o)}querySourceFeatures(t,i){i&&i.filter&&this._validate(e.validateFilter,"querySourceFeatures.filter",i.filter,null,i);const n=this._getSourceCaches(t);let r=[];for(const e of n)r=r.concat(Le(e,i));return r}addSourceType(e,t,i){return ei.getSourceType(e)?i(new Error(`A source type called "${e}" already exists.`)):(ei.setSourceType(e,t),t.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:e,url:t.workerSourceURL},i):i(null,null))}getLight(){return this.light.getLight()}setLight(e,i={}){this._checkLoaded();const n=this.light.getLight();let r=!1;for(const i in e)if(!t(e[i],n[i])){r=!0;break}if(!r)return;const o=this._setTransitionParameters({duration:300,delay:0});this.light.setLight(e,i),this.light.updateTransitions(o)}getTerrain(){return this.terrain&&1===this.terrain.drapeRenderMode?this.terrain.get():null}setTerrainForDraping(){this.setTerrain({source:"",exaggeration:0},0)}setTerrain(i,n=1){if(this._checkLoaded(),!i)return delete this.terrain,delete this.stylesheet.terrain,this.dispatcher.broadcast("enableTerrain",!1),this._force3DLayerUpdate(),void(this._markersNeedUpdate=!0);if(1===n){if("object"==typeof i.source){const t="terrain-dem-src";this.addSource(t,i.source),i=e.clone$1(i),i=e.extend(i,{source:t})}if(this._validate(e.validateTerrain,"terrain",i))return}if(!this.terrain||this.terrain&&n!==this.terrain.drapeRenderMode)this._createTerrain(i,n);else{const n=this.terrain,r=n.get();for(const t of Object.keys(e.spec.terrain))!i.hasOwnProperty(t)&&e.spec.terrain[t].default&&(i[t]=e.spec.terrain[t].default);for(const e in i)if(!t(i[e],r[e])){n.set(i),this.stylesheet.terrain=i;const e=this._setTransitionParameters({duration:0});n.updateTransitions(e);break}}this._updateDrapeFirstLayers(),this._markersNeedUpdate=!0}_createFog(e){const t=this.fog=new P(e,this.map.transform);this.stylesheet.fog=e;const i=this._setTransitionParameters({duration:0});t.updateTransitions(i)}_updateMarkersOpacity(){0!==this.map._markers.length&&this.map._requestDomTask((()=>{for(const e of this.map._markers)e._evaluateOpacity()}))}getFog(){return this.fog?this.fog.get():null}setFog(e){if(this._checkLoaded(),!e)return delete this.fog,delete this.stylesheet.fog,void(this._markersNeedUpdate=!0);if(this.fog){const i=this.fog,n=i.get();0===Object.keys(e).length&&i.set(e);for(const r in e)if(!t(e[r],n[r])){i.set(e),this.stylesheet.fog=e;const t=this._setTransitionParameters({duration:0});i.updateTransitions(t);break}}else this._createFog(e);this._markersNeedUpdate=!0}_setTransitionParameters(t){return{now:e.exported.now(),transition:e.extend(t,this.stylesheet.transition)}}_updateDrapeFirstLayers(){if(!this.map._optimizeForTerrain||!this.terrain)return;const e=this._order.filter((e=>this.isLayerDraped(this._layers[e]))),t=this._order.filter((e=>!this.isLayerDraped(this._layers[e])));this._drapedFirstOrder=[],this._drapedFirstOrder.push(...e),this._drapedFirstOrder.push(...t)}_createTerrain(e,t){const i=this.terrain=new E(e,t);this.stylesheet.terrain=e,this.dispatcher.broadcast("enableTerrain",!this.terrainSetForDrapingOnly()),this._force3DLayerUpdate();const n=this._setTransitionParameters({duration:0});i.updateTransitions(n)}_force3DLayerUpdate(){for(const e in this._layers){const t=this._layers[e];"fill-extrusion"===t.type&&this._updateLayer(t)}}_forceSymbolLayerUpdate(){for(const e in this._layers){const t=this._layers[e];"symbol"===t.type&&this._updateLayer(t)}}_validate(t,i,n,r,o={}){return(!o||!1!==o.validate)&&Xt(this,t.call(e.validateStyle,e.extend({key:i,style:this.serialize(),value:n,styleSpec:e.spec},r)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),e.evented.off("pluginStateChange",this._rtlTextPluginCallback);for(const e in this._layers)this._layers[e].setEventedParent(null);for(const e in this._sourceCaches)this._sourceCaches[e].clearTiles(),this._sourceCaches[e].setEventedParent(null);this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove()}_clearSource(e){const t=this._getSourceCaches(e);for(const e of t)e.clearTiles()}_reloadSource(e){const t=this._getSourceCaches(e);for(const e of t)e.resume(),e.reload()}_reloadSources(){for(const e of this._getSources())e.reload&&e.reload()}_updateSources(e){for(const t in this._sourceCaches)this._sourceCaches[t].update(e)}_generateCollisionBoxes(){for(const e in this._sourceCaches){const t=this._sourceCaches[e];t.resume(),t.reload()}}_updatePlacement(t,i,n,r,o=!1){let a=!1,s=!1;const l={};for(const e of this._order){const i=this._layers[e];if("symbol"!==i.type)continue;if(!l[i.source]){const e=this._getLayerSourceCache(i);if(!e)continue;l[i.source]=e.getRenderableIds(!0).map((t=>e.getTileByID(t))).sort(((e,t)=>t.tileID.overscaledZ-e.tileID.overscaledZ||(e.tileID.isLessThan(t.tileID)?-1:1)))}const n=this.crossTileSymbolIndex.addLayer(i,l[i.source],t.center.lng,t.projection);a=a||n}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),o=o||this._layerOrderChanged||0===n,this._layerOrderChanged&&this.fire(new e.Event("neworder")),(o||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(e.exported.now(),t.zoom))&&(this.pauseablePlacement=new Vt(t,this._order,o,i,n,r,this.placement,this.fog&&t.projection.supportsFog?this.fog.state:null),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,l),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(e.exported.now()),s=!0),a&&this.pauseablePlacement.placement.setStale()),s||a)for(const e of this._order){const t=this._layers[e];"symbol"===t.type&&this.placement.updateLayerOpacities(t,l[t.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(e.exported.now())}_releaseSymbolFadeTiles(){for(const e in this._sourceCaches)this._sourceCaches[e].releaseSymbolFadeTiles()}getImages(e,t,i){this.imageManager.getImages(t.icons,i),this._updateTilesForChangedImages();const n=e=>{e&&e.setDependencies(t.tileID.key,t.type,t.icons)};n(this._otherSourceCaches[t.source]),n(this._symbolSourceCaches[t.source])}getGlyphs(e,t,i){this.glyphManager.getGlyphs(t.stacks,i)}getResource(t,i,n){return e.makeRequest(i,n)}_getSourceCache(e){return this._otherSourceCaches[e]}_getLayerSourceCache(e){return"symbol"===e.type?this._symbolSourceCaches[e.source]:this._otherSourceCaches[e.source]}_getSourceCaches(e){const t=[];return this._otherSourceCaches[e]&&t.push(this._otherSourceCaches[e]),this._symbolSourceCaches[e]&&t.push(this._symbolSourceCaches[e]),t}_isSourceCacheLoaded(t){const i=this._getSourceCaches(t);return 0===i.length?(this.fire(new e.ErrorEvent(new Error(`There is no source with ID '${t}'`))),!1):i.every((e=>e.loaded()))}has3DLayers(){return this._num3DLayers>0}hasSymbolLayers(){return this._numSymbolLayers>0}hasCircleLayers(){return this._numCircleLayers>0}_clearWorkerCaches(){this.dispatcher.broadcast("clearCaches")}destroy(){this._clearWorkerCaches(),this.terrainSetForDrapingOnly()&&(delete this.terrain,delete this.stylesheet.terrain)}}ei.getSourceType=function(e){return Pe[e]},ei.setSourceType=function(e,t){Pe[e]=t},ei.registerForPluginStateChange=e.registerForPluginStateChange;var ti="\n#define EPSILON 0.0000001\n#define PI 3.141592653589793\n#define EXTENT 8192.0\n#define HALF_PI PI/2.0\n#define QUARTER_PI PI/4.0\n#define RAD_TO_DEG 180.0/PI\n#define DEG_TO_RAD PI/180.0\n#define GLOBE_RADIUS EXTENT/PI/2.0",ii="attribute highp vec3 a_pos_3f;uniform lowp mat4 u_matrix;varying highp vec3 v_uv;void main() {const mat3 half_neg_pi_around_x=mat3(1.0,0.0, 0.0,0.0,0.0,-1.0,0.0,1.0, 0.0);v_uv=half_neg_pi_around_x*a_pos_3f;vec4 pos=u_matrix*vec4(a_pos_3f,1.0);gl_Position=pos.xyww;}",ni="\n#define ELEVATION_SCALE 7.0\n#define ELEVATION_OFFSET 450.0\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_tl_up;uniform vec3 u_tile_tr_up;uniform vec3 u_tile_br_up;uniform vec3 u_tile_bl_up;uniform float u_tile_up_scale;vec3 elevationVector(vec2 pos) {vec2 uv=pos/EXTENT;vec3 up=normalize(mix(\nmix(u_tile_tl_up,u_tile_tr_up,uv.xxx),mix(u_tile_bl_up,u_tile_br_up,uv.xxx),uv.yyy));return up*u_tile_up_scale;}\n#else\nvec3 elevationVector(vec2 pos) { return vec3(0,0,1); }\n#endif\n#ifdef TERRAIN\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nuniform highp sampler2D u_dem;uniform highp sampler2D u_dem_prev;\n#else\nuniform sampler2D u_dem;uniform sampler2D u_dem_prev;\n#endif\nuniform vec4 u_dem_unpack;uniform vec2 u_dem_tl;uniform vec2 u_dem_tl_prev;uniform float u_dem_scale;uniform float u_dem_scale_prev;uniform float u_dem_size;uniform float u_dem_lerp;uniform float u_exaggeration;uniform float u_meter_to_dem;uniform mat4 u_label_plane_matrix_inv;uniform sampler2D u_depth;uniform vec2 u_depth_size_inv;vec4 tileUvToDemSample(vec2 uv,float dem_size,float dem_scale,vec2 dem_tl) {vec2 pos=dem_size*(uv*dem_scale+dem_tl)+1.0;vec2 f=fract(pos);return vec4((pos-f+0.5)/(dem_size+2.0),f);}float decodeElevation(vec4 v) {return dot(vec4(v.xyz*255.0,-1.0),u_dem_unpack);}float currentElevation(vec2 apos) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nvec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale+u_dem_tl)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture2D(u_dem,pos).a;\n#else\nfloat dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale,u_dem_tl);vec2 pos=r.xy;vec2 f=r.zw;float tl=decodeElevation(texture2D(u_dem,pos));\n#ifdef TERRAIN_DEM_NEAREST_FILTER\nreturn u_exaggeration*tl;\n#endif\nfloat tr=decodeElevation(texture2D(u_dem,pos+vec2(dd,0.0)));float bl=decodeElevation(texture2D(u_dem,pos+vec2(0.0,dd)));float br=decodeElevation(texture2D(u_dem,pos+vec2(dd,dd)));return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);\n#endif\n}float prevElevation(vec2 apos) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nvec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale_prev+u_dem_tl_prev)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture2D(u_dem_prev,pos).a;\n#else\nfloat dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale_prev,u_dem_tl_prev);vec2 pos=r.xy;vec2 f=r.zw;float tl=decodeElevation(texture2D(u_dem_prev,pos));float tr=decodeElevation(texture2D(u_dem_prev,pos+vec2(dd,0.0)));float bl=decodeElevation(texture2D(u_dem_prev,pos+vec2(0.0,dd)));float br=decodeElevation(texture2D(u_dem_prev,pos+vec2(dd,dd)));return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);\n#endif\n}\n#ifdef TERRAIN_VERTEX_MORPHING\nfloat elevation(vec2 apos) {float nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);}\n#else\nfloat elevation(vec2 apos) {return currentElevation(apos);}\n#endif\nhighp float unpack_depth(highp vec4 rgba_depth)\n{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}bool isOccluded(vec4 frag) {vec3 coord=frag.xyz/frag.w;float depth=unpack_depth(texture2D(u_depth,(coord.xy+1.0)*0.5));return coord.z > depth+0.0005;}float occlusionFade(vec4 frag) {vec3 coord=frag.xyz/frag.w;vec3 df=vec3(5.0*u_depth_size_inv,0.0);vec2 uv=0.5*coord.xy+0.5;vec4 depth=vec4(\nunpack_depth(texture2D(u_depth,uv-df.xz)),unpack_depth(texture2D(u_depth,uv+df.xz)),unpack_depth(texture2D(u_depth,uv-df.zy)),unpack_depth(texture2D(u_depth,uv+df.zy))\n);return dot(vec4(0.25),vec4(1.0)-clamp(300.0*(vec4(coord.z-0.001)-depth),0.0,1.0));}vec4 fourSample(vec2 pos,vec2 off) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nfloat tl=texture2D(u_dem,pos).a;float tr=texture2D(u_dem,pos+vec2(off.x,0.0)).a;float bl=texture2D(u_dem,pos+vec2(0.0,off.y)).a;float br=texture2D(u_dem,pos+off).a;\n#else\nvec4 demtl=vec4(texture2D(u_dem,pos).xyz*255.0,-1.0);float tl=dot(demtl,u_dem_unpack);vec4 demtr=vec4(texture2D(u_dem,pos+vec2(off.x,0.0)).xyz*255.0,-1.0);float tr=dot(demtr,u_dem_unpack);vec4 dembl=vec4(texture2D(u_dem,pos+vec2(0.0,off.y)).xyz*255.0,-1.0);float bl=dot(dembl,u_dem_unpack);vec4 dembr=vec4(texture2D(u_dem,pos+off).xyz*255.0,-1.0);float br=dot(dembr,u_dem_unpack);\n#endif\nreturn vec4(tl,tr,bl,br);}float flatElevation(vec2 pack) {vec2 apos=floor(pack/8.0);vec2 span=10.0*(pack-apos*8.0);vec2 uvTex=(apos-vec2(1.0,1.0))/8190.0;float size=u_dem_size+2.0;float dd=1.0/size;vec2 pos=u_dem_size*(uvTex*u_dem_scale+u_dem_tl)+1.0;vec2 f=fract(pos);pos=(pos-f+0.5)*dd;vec4 h=fourSample(pos,vec2(dd));float z=mix(mix(h.x,h.y,f.x),mix(h.z,h.w,f.x),f.y);vec2 w=floor(0.5*(span*u_meter_to_dem-1.0));vec2 d=dd*w;vec4 bounds=vec4(d,vec2(1.0)-d);h=fourSample(pos-d,2.0*d+vec2(dd));vec4 diff=abs(h.xzxy-h.ywzw);vec2 slope=min(vec2(0.25),u_meter_to_dem*0.5*(diff.xz+diff.yw)/(2.0*w+vec2(1.0)));vec2 fix=slope*span;float base=z+max(fix.x,fix.y);return u_exaggeration*base;}float elevationFromUint16(float word) {return u_exaggeration*(word/ELEVATION_SCALE-ELEVATION_OFFSET);}\n#else\nfloat elevation(vec2 pos) { return 0.0; }bool isOccluded(vec4 frag) { return false; }float occlusionFade(vec4 frag) { return 1.0; }\n#endif",ri="#ifdef FOG\nuniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump mat4 u_fog_matrix;varying vec3 v_fog_pos;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}vec3 fog_position(vec3 pos) {return (u_fog_matrix*vec4(pos,1.0)).xyz;}vec3 fog_position(vec2 pos) {return fog_position(vec3(pos,0.0));}float fog(vec3 pos) {float depth=length(pos);float opacity=fog_opacity(fog_range(depth));return opacity*fog_horizon_blending(pos/depth);}\n#endif",oi="#ifdef FOG\nuniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump float u_fog_temporal_offset;varying vec3 v_fog_pos;uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform highp vec2 u_viewport;uniform float u_globe_transition;uniform int u_is_globe;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}float globe_glow_progress() {highp vec2 uv=gl_FragCoord.xy/u_viewport;highp vec3 ray_dir=mix(\nmix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float sdf=length(closest_point-u_globe_pos)/u_globe_radius;return sdf+PI*0.5;}float fog_opacity(vec3 pos) {float depth=length(pos);return fog_opacity(fog_range(depth));}vec3 fog_apply(vec3 color,vec3 pos) {float depth=length(pos);float opacity;if (u_is_globe==1) {float glow_progress=globe_glow_progress();float t=mix(glow_progress,depth,u_globe_transition);opacity=fog_opacity(fog_range(t));} else {opacity=fog_opacity(fog_range(depth));opacity*=fog_horizon_blending(pos/depth);}return mix(color,u_fog_color.rgb,opacity);}vec4 fog_apply_from_vert(vec4 color,float fog_opac) {float alpha=EPSILON+color.a;color.rgb=mix(color.rgb/alpha,u_fog_color.rgb,fog_opac)*alpha;return color;}vec3 fog_apply_sky_gradient(vec3 camera_ray,vec3 sky_color) {float horizon_blend=fog_horizon_blending(normalize(camera_ray));return mix(sky_color,u_fog_color.rgb,horizon_blend);}vec4 fog_apply_premultiplied(vec4 color,vec3 pos) {float alpha=EPSILON+color.a;color.rgb=fog_apply(color.rgb/alpha,pos)*alpha;return color;}vec3 fog_dither(vec3 color) {vec2 dither_seed=gl_FragCoord.xy+u_fog_temporal_offset;return dither(color,dither_seed);}vec4 fog_dither(vec4 color) {return vec4(fog_dither(color.rgb),color.a);}\n#endif";let ai={},si={};const li=[];pi(ti,li),pi(ni,li),pi(ri,li),pi(oi,li),ai=fi("",ni),si=fi(oi,ri);const ci=fi("\nhighp vec3 hash(highp vec2 p) {highp vec3 p3=fract(p.xyx*vec3(443.8975,397.2973,491.1871));p3+=dot(p3,p3.yxz+19.19);return fract((p3.xxy+p3.yzz)*p3.zyx);}vec3 dither(vec3 color,highp vec2 seed) {vec3 rnd=hash(seed)+hash(seed+0.59374)-0.5;return color+rnd/255.0;}highp float unpack_depth(highp vec4 rgba_depth)\n{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}highp vec4 pack_depth(highp float ndc_z) {highp float depth=ndc_z*0.5+0.5;const highp vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);const highp vec4 bit_mask =vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);highp vec4 res=fract(depth*bit_shift);res-=res.xxyz*bit_mask;return res;}","\nfloat wrap(float n,float min,float max) {float d=max-min;float w=mod(mod(n-min,d)+d,d)+min;return (w==min) ? max : w;}\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 mercator_tile_position(mat4 matrix,vec2 tile_anchor,vec3 tile_id,vec2 mercator_center) {\n#ifndef PROJECTED_POS_ON_VIEWPORT\nfloat tiles=tile_id.z;vec2 mercator=(tile_anchor/EXTENT+tile_id.xy)/tiles;mercator-=mercator_center;mercator.x=wrap(mercator.x,-0.5,0.5);vec4 mercator_tile=vec4(mercator.xy*EXTENT,EXTENT/(2.0*PI),1.0);mercator_tile=matrix*mercator_tile;return mercator_tile.xyz;\n#else\nreturn vec3(0.0);\n#endif\n}vec3 mix_globe_mercator(vec3 globe,vec3 mercator,float t) {return mix(globe,mercator,t);}mat3 globe_mercator_surface_vectors(vec3 pos_normal,vec3 up_dir,float zoom_transition) {vec3 normal=zoom_transition==0.0 ? pos_normal : normalize(mix(pos_normal,up_dir,zoom_transition));vec3 xAxis=normalize(vec3(normal.z,0.0,-normal.x));vec3 yAxis=normalize(cross(normal,xAxis));return mat3(xAxis,yAxis,normal);}\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(\nunpack_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;}const vec4 AWAY=vec4(-1000.0,-1000.0,-1000.0,1);//Normalized device coordinate that is not rendered."),ui=ti,hi="\n#ifdef GL_ES\nprecision mediump float;\n#else\n\n#if !defined(lowp)\n#define lowp\n#endif\n\n#if !defined(mediump)\n#define mediump\n#endif\n\n#if !defined(highp)\n#define highp\n#endif\n\n#endif";var di={background:fi("uniform vec4 u_color;uniform float u_opacity;void main() {vec4 out_color=u_color;\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_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);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),backgroundPattern:fi("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);vec4 out_color=mix(color1,color2,u_mix);\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*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);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),circle:fi("varying vec3 v_data;varying float v_visibility;\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(\nantialiased_blur,0.0,extrude_length-radius/(radius+stroke_width)\n);vec4 out_color=mix(color*opacity,stroke_color*stroke_opacity,color_t);\n#ifdef FOG\nout_color=fog_apply_premultiplied(out_color,v_fog_pos);\n#endif\ngl_FragColor=out_color*(v_visibility*opacity_t);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","#define NUM_VISIBILITY_RINGS 2\n#define INV_SQRT2 0.70710678\n#define ELEVATION_BIAS 0.0001\n#define NUM_SAMPLES_PER_RING 16\nuniform mat4 u_matrix;uniform mat2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_pos_3;attribute vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;\n#endif\nvarying vec3 v_data;varying float v_visibility;\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\nvec2 calc_offset(vec2 extrusion,float radius,float stroke_width, float view_scale) {return extrusion*(radius+stroke_width)*u_extrude_scale*view_scale;}float cantilevered_elevation(vec2 pos,float radius,float stroke_width,float view_scale) {vec2 c1=pos+calc_offset(vec2(-1,-1),radius,stroke_width,view_scale);vec2 c2=pos+calc_offset(vec2(1,-1),radius,stroke_width,view_scale);vec2 c3=pos+calc_offset(vec2(1,1),radius,stroke_width,view_scale);vec2 c4=pos+calc_offset(vec2(-1,1),radius,stroke_width,view_scale);float h1=elevation(c1)+ELEVATION_BIAS;float h2=elevation(c2)+ELEVATION_BIAS;float h3=elevation(c3)+ELEVATION_BIAS;float h4=elevation(c4)+ELEVATION_BIAS;return max(h4,max(h3,max(h1,h2)));}float circle_elevation(vec2 pos) {\n#if defined(TERRAIN)\nreturn elevation(pos)+ELEVATION_BIAS;\n#else\nreturn 0.0;\n#endif\n}vec4 project_vertex(vec2 extrusion,vec4 world_center,vec4 projected_center,float radius,float stroke_width, float view_scale,mat3 surface_vectors) {vec2 sample_offset=calc_offset(extrusion,radius,stroke_width,view_scale);\n#ifdef PITCH_WITH_MAP\n#ifdef PROJECTION_GLOBE_VIEW\nreturn u_matrix*( world_center+vec4(sample_offset.x*surface_vectors[0]+sample_offset.y*surface_vectors[1],0) );\n#else\nreturn u_matrix*( world_center+vec4(sample_offset,0,0) );\n#endif\n#else\nreturn projected_center+vec4(sample_offset,0,0);\n#endif\n}float get_sample_step() {\n#ifdef PITCH_WITH_MAP\nreturn 2.0*PI/float(NUM_SAMPLES_PER_RING);\n#else\nreturn PI/float(NUM_SAMPLES_PER_RING);\n#endif\n}void 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);vec4 world_center;mat3 surface_vectors;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 pos_normal_3=a_pos_normal_3/16384.0;surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(circle_center)*circle_elevation(circle_center);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*circle_elevation(circle_center);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,circle_center,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;vec3 pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);world_center=vec4(pos,1);\n#else \nsurface_vectors=mat3(1.0);float height=circle_elevation(circle_center);world_center=vec4(circle_center,height,1);\n#endif\nvec4 projected_center=u_matrix*world_center;float view_scale=0.0;\n#ifdef PITCH_WITH_MAP\n#ifdef SCALE_WITH_MAP\nview_scale=1.0;\n#else\nview_scale=projected_center.w/u_camera_to_center_distance;\n#endif\n#else\n#ifdef SCALE_WITH_MAP\nview_scale=u_camera_to_center_distance;\n#else\nview_scale=projected_center.w;\n#endif\n#endif\ngl_Position=project_vertex(extrude,world_center,projected_center,radius,stroke_width,view_scale,surface_vectors);float visibility=0.0;\n#ifdef TERRAIN\nfloat step=get_sample_step();vec4 occlusion_world_center;vec4 occlusion_projected_center;\n#ifdef PITCH_WITH_MAP\nfloat cantilevered_height=cantilevered_elevation(circle_center,radius,stroke_width,view_scale);occlusion_world_center=vec4(circle_center,cantilevered_height,1);occlusion_projected_center=u_matrix*occlusion_world_center;\n#else\nocclusion_world_center=world_center;occlusion_projected_center=projected_center;\n#endif\nfor(int ring=0; ring < NUM_VISIBILITY_RINGS; ring++) {float scale=(float(ring)+1.0)/float(NUM_VISIBILITY_RINGS);for(int i=0; i < NUM_SAMPLES_PER_RING; i++) {vec2 extrusion=vec2(cos(step*float(i)),-sin(step*float(i)))*scale;vec4 frag_pos=project_vertex(extrusion,occlusion_world_center,occlusion_projected_center,radius,stroke_width,view_scale,surface_vectors);visibility+=float(!isOccluded(frag_pos));}}visibility/=float(NUM_VISIBILITY_RINGS)*float(NUM_SAMPLES_PER_RING);\n#else\nvisibility=1.0;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nvisibility=1.0;\n#endif\nv_visibility=visibility;lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);\n#ifdef FOG\nv_fog_pos=fog_position(world_center.xyz);\n#endif\n}"),clippingMask:fi("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);}"),heatmap:fi("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 FOG\nif (u_is_globe==0) {gl_FragColor.r*=pow(1.0-fog_opacity(v_fog_pos),2.0);}\n#endif\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;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_pos_3;attribute vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;\n#endif\nvarying 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;vec2 tilePos=floor(a_pos*0.5);vec3 pos;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 pos_normal_3=a_pos_normal_3/16384.0;mat3 surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(tilePos)*elevation(tilePos);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*elevation(tilePos);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,tilePos,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#else\npos=vec3(tilePos+extrude,elevation(tilePos));\n#endif\ngl_Position=u_matrix*vec4(pos,1);\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}"),heatmapTexture:fi("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}","attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=a_pos*0.5+0.5;}"),collisionBox:fi("varying float v_placed;varying float v_notUsed;void main() {vec4 red =vec4(1.0,0.0,0.0,1.0);vec4 blue=vec4(0.0,0.0,1.0,0.5);gl_FragColor =mix(red,blue,step(0.5,v_placed))*0.5;gl_FragColor*=mix(1.0,0.1,step(0.5,v_notUsed));}","attribute vec3 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;attribute float a_size_scale;attribute vec2 a_padding;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_pos+elevationVector(a_anchor_pos)*elevation(a_anchor_pos),1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(\n0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,1.5);gl_Position=projectedPoint;gl_Position.xy+=(a_extrude*a_size_scale+a_shift+a_padding)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:fi("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_2f;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_2f;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(\nmix(-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(\n0.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);}"),debug:fi("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;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_pos_3;\n#endif\nvarying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {float h=elevation(a_pos);v_uv=a_pos/8192.0;\n#ifdef PROJECTION_GLOBE_VIEW\ngl_Position=u_matrix*vec4(a_pos_3+elevationVector(a_pos)*h,1);\n#else\ngl_Position=u_matrix*vec4(a_pos*u_overlay_scale,h,1);\n#endif\n}"),fill:fi("#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\nvec4 out_color=color;\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_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);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),fillOutline:fi("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);vec4 out_color=outline_color;\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_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;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),fillOutlinePattern:fi("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);vec4 out_color=mix(color1,color2,u_fade);\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*(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;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),fillPattern:fi("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);vec4 out_color=mix(color1,color2,u_fade);\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*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);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),fillExtrusion:fi("varying vec4 v_color;\n#ifdef RENDER_SHADOWS\nvarying highp vec4 v_pos_light_view_0;varying highp vec4 v_pos_light_view_1;varying float v_depth;\n#endif\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;varying vec3 v_ao;\n#endif\n#ifdef ZERO_ROOF_RADIUS\nvarying vec4 v_roof_color;\n#endif\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS)\nvarying highp vec3 v_normal;\n#endif\nvoid main() {\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS)\nvec3 normal=v_normal;\n#endif\nfloat z;vec4 color;\n#ifdef ZERO_ROOF_RADIUS\nz=float(normal.z > 0.00001);color=mix(v_color,v_roof_color,z);\n#else\ncolor=v_color;\n#endif\n#ifdef FAUX_AO\nfloat intensity=u_ao[0];float h=max(0.0,v_ao.z);float h_floors=h/u_ao[1];float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);float shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;\n#ifdef ZERO_ROOF_RADIUS\nconcave*=(1.0-z);\n#endif\nfloat x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);shade*=mix(1.0,x_shade*x_shade*x_shade,concave);color.rgb=color.rgb*shade;\n#endif\n#ifdef RENDER_SHADOWS\n#ifdef ZERO_ROOF_RADIUS\nnormal=mix(normal,vec3(0.0,0.0,1.0),z);\n#endif\ncolor.xyz=shadowed_color_normal(color.xyz,normalize(normal),v_pos_light_view_0,v_pos_light_view_1,v_depth);\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ngl_FragColor=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;uniform float u_edge_radius;attribute vec4 a_pos_normal_ed;attribute vec2 a_centroid_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_pos_3;attribute vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;\n#endif\nvarying vec4 v_color;\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;varying highp vec4 v_pos_light_view_0;varying highp vec4 v_pos_light_view_1;varying float v_depth;\n#endif\n#ifdef ZERO_ROOF_RADIUS\nvarying vec4 v_roof_color;\n#endif\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS)\nvarying highp vec3 v_normal;\n#endif\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;varying vec3 v_ao;\n#endif\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\nvec4 pos_nx=floor(a_pos_normal_ed*0.5);vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS)\nv_normal=normal;\n#endif\nbase=max(0.0,base);height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=a_centroid_pos;\n#endif\nfloat ele=0.0;float h=0.0;float c_ele;vec3 pos;\n#ifdef TERRAIN\nbool flat_roof=centroid_pos.x !=0.0 && t > 0.0;ele=elevation(pos_nx.xy);c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base==0.0 ?-5.0 : base);pos=vec3(pos_nx.xy,h);\n#else\nh=t > 0.0 ? height : base;pos=vec3(pos_nx.xy,h);\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nfloat lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*h);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,pos.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*pos.z;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#endif\nfloat hidden=float(centroid_pos.x==0.0 && centroid_pos.y==1.0);gl_Position=mix(u_matrix*vec4(pos,1),AWAY,hidden);\n#ifdef RENDER_SHADOWS\nv_pos_light_view_0=u_light_matrix_0*vec4(pos,1);v_pos_light_view_1=u_light_matrix_1*vec4(pos,1);v_depth=gl_Position.w;\n#endif\nfloat 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,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*=(\n(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)));}\n#ifdef FAUX_AO\nfloat concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;\n#ifdef TERRAIN\ntop_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);\n#endif\nv_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);directional*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]);\n#ifdef PROJECTION_GLOBE_VIEW\ntop_height+=u_height_lift;\n#endif\ngl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;\n#endif\nv_color.rgb+=clamp(color.rgb*directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_color*=u_opacity;\n#ifdef ZERO_ROOF_RADIUS\nv_roof_color=vec4(0.0,0.0,0.0,1.0);float roof_radiance=clamp(u_lightpos.z,0.0,1.0);roof_radiance=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),roof_radiance);v_roof_color.rgb+=clamp(color.rgb*roof_radiance*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_roof_color*=u_opacity;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}"),fillExtrusionPattern:fi("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;varying vec3 v_ao;\n#endif\nvarying 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 out_color=mix(color1,color2,u_fade);out_color=out_color*v_lighting;\n#ifdef FAUX_AO\nfloat intensity=u_ao[0];float h=max(0.0,v_ao.z);float h_floors=h/u_ao[1];float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);float shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);shade*=mix(1.0,x_shade*x_shade*x_shade,concave);out_color.rgb=out_color.rgb*shade;\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color;\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 vec4 a_pos_normal_ed;attribute vec2 a_centroid_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_pos_3;attribute vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;\n#endif\nvarying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;varying vec3 v_ao;\n#endif\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;vec4 pos_nx=floor(a_pos_normal_ed*0.5);mediump vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;mediump vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));float edgedistance=a_pos_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=top_up_ny.x;float z=t > 0.0 ? height : base;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=a_centroid_pos;\n#endif\nfloat ele=0.0;float h=z;vec3 p;float c_ele;\n#ifdef TERRAIN\nbool flat_roof=centroid_pos.x !=0.0 && t > 0.0;ele=elevation(pos_nx.xy);c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base==0.0 ?-5.0 : base);p=vec3(pos_nx.xy,h);\n#else\np=vec3(pos_nx.xy,z);\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nfloat lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*(p.z+lift));vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,p.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*p.z;p=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#endif\nfloat hidden=float(centroid_pos.x==0.0 && centroid_pos.y==1.0);gl_Position=mix(u_matrix*vec4(p,1),AWAY,hidden);vec2 pos=normal.z==1.0\n? pos_nx.xy\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,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*=(\n(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)));}\n#ifdef FAUX_AO\nfloat concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;\n#ifdef TERRAIN\ntop_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);\n#endif\nv_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);directional*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]);\n#ifdef PROJECTION_GLOBE_VIEW\ntop_height+=u_height_lift;\n#endif\ngl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;\n#endif\nv_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;\n#ifdef FOG\nv_fog_pos=fog_position(p);\n#endif\n}"),hillshadePrepare:fi("#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) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nreturn texture2D(u_image,coord).a/4.0;\n#else\nvec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;\n#endif\n}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y));float b=getElevation(v_pos+vec2(0,-epsilon.y));float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y));float d=getElevation(v_pos+vec2(-epsilon.x,0));float e=getElevation(v_pos);float f=getElevation(v_pos+vec2(epsilon.x,0));float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y));float h=getElevation(v_pos+vec2(0,epsilon.y));float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y));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(\n(c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c)\n)/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(\nderiv.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;}"),hillshade:fi("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;void 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 FOG\ngl_FragColor=fog_dither(fog_apply_premultiplied(gl_FragColor,v_fog_pos));\n#endif\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;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),line:fi("uniform lowp float u_device_pixel_ratio;uniform float u_alpha_discard_threshold;uniform highp vec2 u_trim_offset;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec4 v_uv;\n#ifdef RENDER_LINE_DASH\nuniform sampler2D u_dash_image;uniform float u_mix;uniform vec3 u_scale;varying vec2 v_tex_a;varying vec2 v_tex_b;\n#endif\n#ifdef RENDER_LINE_GRADIENT\nuniform sampler2D u_gradient_image;\n#endif\nuniform float u_border_width;uniform vec4 u_border_color;float luminance(vec3 c) {return (c.r+c.r+c.b+c.g+c.g+c.g)*0.1667;}\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 dash_from\n#pragma mapbox: define lowp vec4 dash_to\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 floorwidth\n#pragma mapbox: initialize lowp vec4 dash_from\n#pragma mapbox: initialize lowp vec4 dash_to\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);\n#ifdef RENDER_LINE_DASH\nfloat sdfdist_a=texture2D(u_dash_image,v_tex_a).a;float sdfdist_b=texture2D(u_dash_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);float sdfwidth=min(dash_from.z*u_scale.y,dash_to.z*u_scale.z);float sdfgamma=1.0/(2.0*u_device_pixel_ratio)/sdfwidth;alpha*=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);\n#endif\n#ifdef RENDER_LINE_GRADIENT\nhighp vec4 out_color=texture2D(u_gradient_image,v_uv.xy);\n#else\nvec4 out_color=color;\n#endif\n#ifdef RENDER_LINE_TRIM_OFFSET\nhighp float start=v_uv[2];highp float end=v_uv[3];highp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=(start+(v_uv.x)*(end-start));if (trim_end > trim_start) {if (line_progress <=trim_end && line_progress >=trim_start) {out_color=vec4(0,0,0,0);}}\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\n#ifdef RENDER_LINE_ALPHA_DISCARD\nif (alpha < u_alpha_discard_threshold) {discard;}\n#endif\n#ifdef RENDER_LINE_BORDER\nfloat edgeBlur=(u_border_width+1.0/u_device_pixel_ratio);float alpha2=clamp(min(dist-(v_width2.t-edgeBlur),v_width2.s-dist)/edgeBlur,0.0,1.0);if (alpha2 < 1.) {float smoothAlpha=smoothstep(0.6,1.0,alpha2);\n#ifdef RENDER_LINE_BORDER_AUTO\nfloat Y=(out_color.a > 0.01) ? luminance(out_color.rgb/out_color.a) : 1.;float adjustment=(Y > 0.) ? 0.5/Y : 0.45;if (out_color.a > 0.25 && Y < 0.25) {vec3 borderColor=(Y > 0.) ? out_color.rgb : vec3(1,1,1)*out_color.a;out_color.rgb=out_color.rgb+borderColor*(adjustment*(1.0-smoothAlpha));} else {out_color.rgb*=(0.6 +0.4*smoothAlpha);}\n#else\nout_color.rgb=mix(u_border_color.rgb,out_color.rgb,smoothAlpha);\n#endif\n}\n#endif\ngl_FragColor=out_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define EXTRUDE_SCALE 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)\nattribute highp vec4 a_packed;\n#endif\n#ifdef RENDER_LINE_DASH\nattribute float a_linesofar;\n#endif\nuniform mat4 u_matrix;uniform mat2 u_pixels_to_tile_units;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 vec4 v_uv;\n#ifdef RENDER_LINE_DASH\nuniform vec2 u_texsize;uniform mediump vec3 u_scale;varying vec2 v_tex_a;varying vec2 v_tex_b;\n#endif\n#ifdef RENDER_LINE_GRADIENT\nuniform float u_image_height;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 dash_from\n#pragma mapbox: define lowp vec4 dash_to\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 floorwidth\n#pragma mapbox: initialize lowp vec4 dash_from\n#pragma mapbox: initialize lowp vec4 dash_to\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;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*EXTRUDE_SCALE;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*EXTRUDE_SCALE*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist*u_pixels_to_tile_units,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude;\n#ifndef RENDER_TO_TEXTURE\nfloat 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;\n#else\nv_gamma_scale=1.0;\n#endif\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)\nfloat a_uv_x=a_packed[0];float a_split_index=a_packed[1];highp float a_clip_start=a_packed[2];highp float a_clip_end=a_packed[3];\n#ifdef RENDER_LINE_GRADIENT\nhighp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec4(a_uv_x,a_split_index*texel_height-half_texel_height,a_clip_start,a_clip_end);\n#else\nv_uv=vec4(a_uv_x,0.0,a_clip_start,a_clip_end);\n#endif\n#endif\n#ifdef RENDER_LINE_DASH\nfloat tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;float scaleA=dash_from.z==0.0 ? 0.0 : tileZoomRatio/(dash_from.z*fromScale);float scaleB=dash_to.z==0.0 ? 0.0 : tileZoomRatio/(dash_to.z*toScale);float heightA=dash_from.y;float heightB=dash_to.y;v_tex_a=vec2(a_linesofar*scaleA/floorwidth,(-normal.y*heightA+dash_from.x+0.5)/u_texsize.y);v_tex_b=vec2(a_linesofar*scaleB/floorwidth,(-normal.y*heightB+dash_to.x+0.5)/u_texsize.y);\n#endif\nv_width2=vec2(outset,inset);\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}"),linePattern:fi("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);\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ngl_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_linesofar;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mat2 u_pixels_to_tile_units;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;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_pixels_to_tile_units,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude;\n#ifndef RENDER_TO_TEXTURE\nfloat 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;\n#else\nv_gamma_scale=1.0;\n#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}"),raster:fi("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(\ndot(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);vec3 out_color=mix(u_high_vec,u_low_vec,rgb);\n#ifdef FOG\nout_color=fog_dither(fog_apply(out_color,v_fog_pos));\n#endif\ngl_FragColor=vec4(out_color*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 vec2 u_perspective_transform;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {float w=1.0+dot(a_texture_pos,u_perspective_transform);gl_Position=u_matrix*vec4(a_pos*w,0,w);v_pos0=a_texture_pos/8192.0;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),symbolIcon:fi("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}","attribute vec4 a_pos_offset;attribute vec4 a_tex_size;attribute vec4 a_pixeloffset;attribute vec4 a_projected_pos;attribute float a_fade_opacity;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_globe_anchor;attribute vec3 a_globe_normal;\n#endif\nuniform 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 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;uniform vec3 u_up_vector;\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix;\n#endif\nvarying 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_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_min_font_scale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[3];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;}vec2 tile_anchor=a_pos;vec3 h=elevationVector(tile_anchor)*elevation(tile_anchor);float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nmercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos=mix_globe_mercator(a_globe_anchor+h,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0;\n#else\nworld_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;\n#endif\nvec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.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(\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float font_scale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjected_point;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);offsetProjected_point=u_matrix*vec4(a_globe_anchor+displacement,1);\n#else\noffsetProjected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);\n#endif\nvec2 a=projected_point.xy/projected_point.w;vec2 b=offsetProjected_point.xy/offsetProjected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);\n#else\nprojected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);\n#endif\nhighp 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);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*max(a_min_font_scale,font_scale)+a_pxoffset/16.0);\n#ifdef TERRAIN\n#ifdef PITCH_WITH_MAP_TERRAIN\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\n#endif\n#endif\nfloat occlusion_fade=occlusionFade(projected_point)*globe_occlusion_fade;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0));\n#else\ngl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0));\n#endif\nfloat projection_transition_fade=1.0;\n#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)\nprojection_transition_fade=1.0-step(EPSILON,u_zoom_transition);\n#endif\nv_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(occlusion_fade,fade_opacity[0]+fade_change))*projection_transition_fade;}"),symbolSDF:fi("#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}","attribute vec4 a_pos_offset;attribute vec4 a_tex_size;attribute vec4 a_pixeloffset;attribute vec4 a_projected_pos;attribute float a_fade_opacity;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_globe_anchor;attribute vec3 a_globe_normal;\n#endif\nuniform 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 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 vec3 u_up_vector;\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix;\n#endif\nvarying 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_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;highp float segment_angle=-a_projected_pos[3];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;}vec2 tile_anchor=a_pos;vec3 h=elevationVector(tile_anchor)*elevation(tile_anchor);float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nmercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos=mix_globe_mercator(a_globe_anchor+h,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0;\n#else\nworld_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;\n#endif\nvec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.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(\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetprojected_point;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);offsetprojected_point=u_matrix*vec4(a_globe_anchor+displacement,1);\n#else\noffsetprojected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);\n#endif\nvec2 a=projected_point.xy/projected_point.w;vec2 b=offsetprojected_point.xy/offsetprojected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);\n#else\nprojected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);\n#endif\nhighp 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);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset);\n#ifdef TERRAIN\n#ifdef PITCH_WITH_MAP_TERRAIN\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\n#endif\n#endif\nfloat occlusion_fade=occlusionFade(projected_point)*globe_occlusion_fade;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0));\n#else\ngl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0));\n#endif\nfloat gamma_scale=gl_Position.w;float projection_transition_fade=1.0;\n#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)\nprojection_transition_fade=1.0-step(EPSILON,u_zoom_transition);\n#endif\nvec2 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(occlusion_fade,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity*projection_transition_fade);}"),symbolTextAndIcon:fi("#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}","attribute vec4 a_pos_offset;attribute vec4 a_tex_size;attribute vec4 a_projected_pos;attribute float a_fade_opacity;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_globe_anchor;attribute vec3 a_globe_normal;\n#endif\nuniform 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 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 vec3 u_up_vector;uniform vec2 u_texsize_icon;\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix;\n#endif\nvarying 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_tex_size.xy;vec2 a_size=a_tex_size.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[3];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;}vec2 tile_anchor=a_pos;vec3 h=elevationVector(tile_anchor)*elevation(tile_anchor);float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nmercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos=mix_globe_mercator(a_globe_anchor+h,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0;\n#else\nworld_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;\n#endif\nvec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.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(\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float font_scale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offset_projected_point=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projected_point.xy/projected_point.w;vec2 b=offset_projected_point.xy/offset_projected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);\n#else\nprojected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);\n#endif\nhighp 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);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*font_scale);\n#ifdef TERRAIN\n#ifdef PITCH_WITH_MAP_TERRAIN\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\n#endif\n#endif\nfloat occlusion_fade=occlusionFade(projected_point)*globe_occlusion_fade;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0));\n#else\ngl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0));\n#endif\nfloat 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(occlusion_fade,fade_opacity[0]+fade_change));float projection_transition_fade=1.0;\n#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)\nprojection_transition_fade=1.0-step(EPSILON,u_zoom_transition);\n#endif\nv_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity*projection_transition_fade,is_sdf);}"),terrainRaster:fi("uniform sampler2D u_image0;varying vec2 v_pos0;\n#ifdef FOG\nvarying float v_fog_opacity;\n#endif\n#ifdef RENDER_SHADOWS\nvarying vec4 v_pos_light_view_0;varying vec4 v_pos_light_view_1;varying float v_depth;\n#endif\nvoid main() {vec4 color=texture2D(u_image0,v_pos0);\n#ifdef RENDER_SHADOWS\ncolor.xyz=shadowed_color(color.xyz,v_pos_light_view_0,v_pos_light_view_1,v_depth);\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_from_vert(color,v_fog_opacity));\n#endif\ngl_FragColor=color;\n#ifdef TERRAIN_WIREFRAME\ngl_FragColor=vec4(1.0,0.0,0.0,0.8);\n#endif\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform float u_skirt_height;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;\n#ifdef FOG\nvarying float v_fog_opacity;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;varying vec4 v_pos_light_view_0;varying vec4 v_pos_light_view_1;varying float v_depth;\n#endif\nconst float skirtOffset=24575.0;const float wireframeOffset=0.00015;void main() {v_pos0=a_texture_pos/8192.0;float skirt=float(a_pos.x >=skirtOffset);float elevation=elevation(a_texture_pos)-skirt*u_skirt_height;\n#ifdef TERRAIN_WIREFRAME\nelevation+=u_skirt_height*u_skirt_height*wireframeOffset;\n#endif\nvec2 decodedPos=a_pos-vec2(skirt*skirtOffset,0.0);gl_Position=u_matrix*vec4(decodedPos,elevation,1.0);\n#ifdef FOG\nv_fog_opacity=fog(fog_position(vec3(decodedPos,elevation)));\n#endif\n#ifdef RENDER_SHADOWS\nvec3 pos=vec3(decodedPos,elevation);v_pos_light_view_0=u_light_matrix_0*vec4(pos,1.);v_pos_light_view_1=u_light_matrix_1*vec4(pos,1.);v_depth=gl_Position.w;\n#endif\n}"),terrainDepth:fi("#ifdef GL_ES\nprecision highp float;\n#endif\nvarying float v_depth;void main() {gl_FragColor=pack_depth(v_depth);}","uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying float v_depth;void main() {float elevation=elevation(a_texture_pos);gl_Position=u_matrix*vec4(a_pos,elevation,1.0);v_depth=gl_Position.z/gl_Position.w;}"),skybox:fi("\nvarying lowp vec3 v_uv;uniform lowp samplerCube u_cubemap;uniform lowp float u_opacity;uniform highp float u_temporal_offset;uniform highp vec3 u_sun_direction;float sun_disk(highp vec3 ray_direction,highp vec3 sun_direction) {highp float cos_angle=dot(normalize(ray_direction),sun_direction);const highp float cos_sun_angular_diameter=0.99996192306;const highp float smoothstep_delta=1e-5;return smoothstep(\ncos_sun_angular_diameter-smoothstep_delta,cos_sun_angular_diameter+smoothstep_delta,cos_angle);}float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec3 uv=v_uv;const float y_bias=0.015;uv.y+=y_bias;uv.y=pow(abs(uv.y),1.0/5.0);uv.y=map(uv.y,0.0,1.0,-1.0,1.0);vec3 sky_color=textureCube(u_cubemap,uv).rgb;\n#ifdef FOG\nsky_color=fog_apply_sky_gradient(v_uv.xzy,sky_color);\n#endif\nsky_color.rgb=dither(sky_color.rgb,gl_FragCoord.xy+u_temporal_offset);sky_color+=0.1*sun_disk(v_uv,u_sun_direction);gl_FragColor=vec4(sky_color*u_opacity,u_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}",ii),skyboxGradient:fi("varying highp vec3 v_uv;uniform lowp sampler2D u_color_ramp;uniform highp vec3 u_center_direction;uniform lowp float u_radius;uniform lowp float u_opacity;uniform highp float u_temporal_offset;void main() {float progress=acos(dot(normalize(v_uv),u_center_direction))/u_radius;vec4 color=texture2D(u_color_ramp,vec2(progress,0.5));\n#ifdef FOG\ncolor.rgb=fog_apply_sky_gradient(v_uv.xzy,color.rgb/color.a)*color.a;\n#endif\ncolor*=u_opacity;color.rgb=dither(color.rgb,gl_FragCoord.xy+u_temporal_offset);gl_FragColor=color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}",ii),skyboxCapture:fi("\nvarying highp vec3 v_position;uniform highp float u_sun_intensity;uniform highp float u_luminance;uniform lowp vec3 u_sun_direction;uniform highp vec4 u_color_tint_r;uniform highp vec4 u_color_tint_m;\n#ifdef GL_ES\nprecision highp float;\n#endif\n#define BETA_R vec3(5.5e-6,13.0e-6,22.4e-6)\n#define BETA_M vec3(21e-6,21e-6,21e-6)\n#define MIE_G 0.76\n#define DENSITY_HEIGHT_SCALE_R 8000.0\n#define DENSITY_HEIGHT_SCALE_M 1200.0\n#define PLANET_RADIUS 6360e3\n#define ATMOSPHERE_RADIUS 6420e3\n#define SAMPLE_STEPS 10\n#define DENSITY_STEPS 4\nfloat ray_sphere_exit(vec3 orig,vec3 dir,float radius) {float a=dot(dir,dir);float b=2.0*dot(dir,orig);float c=dot(orig,orig)-radius*radius;float d=sqrt(b*b-4.0*a*c);return (-b+d)/(2.0*a);}vec3 extinction(vec2 density) {return exp(-vec3(BETA_R*u_color_tint_r.a*density.x+BETA_M*u_color_tint_m.a*density.y));}vec2 local_density(vec3 point) {float height=max(length(point)-PLANET_RADIUS,0.0);float exp_r=exp(-height/DENSITY_HEIGHT_SCALE_R);float exp_m=exp(-height/DENSITY_HEIGHT_SCALE_M);return vec2(exp_r,exp_m);}float phase_ray(float cos_angle) {return (3.0/(16.0*PI))*(1.0+cos_angle*cos_angle);}float phase_mie(float cos_angle) {return (3.0/(8.0*PI))*((1.0-MIE_G*MIE_G)*(1.0+cos_angle*cos_angle))/((2.0+MIE_G*MIE_G)*pow(1.0+MIE_G*MIE_G-2.0*MIE_G*cos_angle,1.5));}vec2 density_to_atmosphere(vec3 point,vec3 light_dir) {float ray_len=ray_sphere_exit(point,light_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(DENSITY_STEPS);vec2 density_point_to_atmosphere=vec2(0.0);for (int i=0; i < DENSITY_STEPS;++i) {vec3 point_on_ray=point+light_dir*((float(i)+0.5)*step_len);density_point_to_atmosphere+=local_density(point_on_ray)*step_len;;}return density_point_to_atmosphere;}vec3 atmosphere(vec3 ray_dir,vec3 sun_direction,float sun_intensity) {vec2 density_orig_to_point=vec2(0.0);vec3 scatter_r=vec3(0.0);vec3 scatter_m=vec3(0.0);vec3 origin=vec3(0.0,PLANET_RADIUS,0.0);float ray_len=ray_sphere_exit(origin,ray_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(SAMPLE_STEPS);for (int i=0; i < SAMPLE_STEPS;++i) {vec3 point_on_ray=origin+ray_dir*((float(i)+0.5)*step_len);vec2 density=local_density(point_on_ray)*step_len;density_orig_to_point+=density;vec2 density_point_to_atmosphere=density_to_atmosphere(point_on_ray,sun_direction);vec2 density_orig_to_atmosphere=density_orig_to_point+density_point_to_atmosphere;vec3 extinction=extinction(density_orig_to_atmosphere);scatter_r+=density.x*extinction;scatter_m+=density.y*extinction;}float cos_angle=dot(ray_dir,sun_direction);float phase_r=phase_ray(cos_angle);float phase_m=phase_mie(cos_angle);vec3 beta_r=BETA_R*u_color_tint_r.rgb*u_color_tint_r.a;vec3 beta_m=BETA_M*u_color_tint_m.rgb*u_color_tint_m.a;return (scatter_r*phase_r*beta_r+scatter_m*phase_m*beta_m)*sun_intensity;}const float A=0.15;const float B=0.50;const float C=0.10;const float D=0.20;const float E=0.02;const float F=0.30;vec3 uncharted2_tonemap(vec3 x) {return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;}void main() {vec3 ray_direction=v_position;ray_direction.y=pow(ray_direction.y,5.0);const float y_bias=0.015;ray_direction.y+=y_bias;vec3 color=atmosphere(normalize(ray_direction),u_sun_direction,u_sun_intensity);float white_scale=1.0748724675633854;color=uncharted2_tonemap((log2(2.0/pow(u_luminance,4.0)))*color)*white_scale;gl_FragColor=vec4(color,1.0);}","attribute highp vec3 a_pos_3f;uniform mat3 u_matrix_3f;varying highp vec3 v_position;float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec4 pos=vec4(u_matrix_3f*a_pos_3f,1.0);v_position=pos.xyz;v_position.y*=-1.0;v_position.y=map(v_position.y,-1.0,1.0,0.0,1.0);gl_Position=vec4(a_pos_3f.xy,0.0,1.0);}"),globeRaster:fi("uniform sampler2D u_image0;varying vec2 v_pos0;\n#ifndef FOG\nuniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform vec2 u_viewport;\n#endif\nvoid main() {vec4 color;\n#ifdef CUSTOM_ANTIALIASING\nvec2 uv=gl_FragCoord.xy/u_viewport;highp vec3 ray_dir=mix(\nmix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);vec3 dir=normalize(ray_dir);vec3 closest_point=dot(u_globe_pos,dir)*dir;float norm_dist_from_center=1.0-length(closest_point-u_globe_pos)/u_globe_radius;const float antialias_pixel=2.0;float antialias_factor=antialias_pixel*fwidth(norm_dist_from_center);float antialias=smoothstep(0.0,antialias_factor,norm_dist_from_center);vec4 raster=texture2D(u_image0,v_pos0);color=vec4(raster.rgb*antialias,raster.a*antialias);\n#else\ncolor=texture2D(u_image0,v_pos0);\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ngl_FragColor=color;\n#ifdef TERRAIN_WIREFRAME\ngl_FragColor=vec4(1.0,0.0,0.0,0.8);\n#endif\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_proj_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform float u_zoom_transition;uniform vec2 u_merc_center;uniform mat3 u_grid_matrix;\n#ifdef GLOBE_POLES\nattribute vec3 a_globe_pos;attribute vec2 a_uv;\n#else\nattribute vec2 a_pos;\n#endif\nvarying vec2 v_pos0;const float wireframeOffset=1e3;float mercatorXfromLng(float lng) {return (180.0+lng)/360.0;}float mercatorYfromLat(float lat) {return (180.0-(RAD_TO_DEG*log(tan(QUARTER_PI+lat/2.0*DEG_TO_RAD))))/360.0;}vec3 latLngToECEF(vec2 latLng) {latLng=DEG_TO_RAD*latLng;float cosLat=cos(latLng[0]);float sinLat=sin(latLng[0]);float cosLng=cos(latLng[1]);float sinLng=sin(latLng[1]);float sx=cosLat*sinLng*GLOBE_RADIUS;float sy=-sinLat*GLOBE_RADIUS;float sz=cosLat*cosLng*GLOBE_RADIUS;return vec3(sx,sy,sz);}void main() {\n#ifdef GLOBE_POLES\nvec3 globe_pos=a_globe_pos;vec2 uv=a_uv;\n#else\nfloat tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];vec3 latLng=u_grid_matrix*vec3(a_pos,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float uvY=mercatorY*tiles-idy;float mercatorX=mercatorXfromLng(latLng[1]);float uvX=mercatorX*tiles-idx;vec3 globe_pos=latLngToECEF(latLng.xy);vec2 merc_pos=vec2(mercatorX,mercatorY);vec2 uv=vec2(uvX,uvY);\n#endif\nv_pos0=uv;vec2 tile_pos=uv*EXTENT;\n#ifdef GLOBE_POLES\nvec3 up_vector=normalize(globe_pos)*u_tile_up_scale;\n#else\nvec3 up_vector=elevationVector(tile_pos);\n#endif\nfloat height=elevation(tile_pos);\n#ifdef TERRAIN_WIREFRAME\nheight+=wireframeOffset;\n#endif\nglobe_pos+=up_vector*height;\n#ifdef GLOBE_POLES\nvec4 interpolated_pos=u_globe_matrix*vec4(globe_pos,1.0);\n#else\nvec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {merc_world_pos=vec4(merc_pos,height,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition),1.0);\n#endif\ngl_Position=u_proj_matrix*interpolated_pos;\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);\n#endif\n}"),globeAtmosphere:fi("uniform float u_transition;uniform highp float u_fadeout_range;uniform highp float u_temporal_offset;uniform vec3 u_start_color;uniform vec4 u_color;uniform vec4 u_space_color;uniform vec4 u_high_color;uniform float u_star_intensity;uniform float u_star_size;uniform float u_star_density;uniform float u_horizon_angle;uniform mat4 u_rotation_matrix;varying highp vec3 v_ray_dir;varying highp vec3 v_horizon_dir;highp float random(highp vec3 p) {p=fract(p*vec3(23.2342,97.1231,91.2342));p+=dot(p.zxy,p.yxz+123.1234);return fract(p.x*p.y);}float stars(vec3 p,float scale,vec2 offset) {vec2 uv_scale=(u_viewport/u_star_size)*scale;vec3 position=vec3(p.xy*uv_scale+offset*u_viewport,p.z);vec3 q=fract(position)-0.5;vec3 id=floor(position);float random_visibility=step(random(id),u_star_density);float circle=smoothstep(0.5+u_star_intensity,0.5,length(q));return circle*random_visibility;}void main() {highp vec3 dir=normalize(v_ray_dir);float globe_pos_dot_dir;\n#ifdef PROJECTION_GLOBE_VIEW\nglobe_pos_dot_dir=dot(u_globe_pos,dir);highp vec3 closest_point_forward=abs(globe_pos_dot_dir)*dir;float norm_dist_from_center=length(closest_point_forward-u_globe_pos)/u_globe_radius;if (norm_dist_from_center < 0.98) {discard;return;}\n#endif\nhighp vec3 horizon_dir=normalize(v_horizon_dir);float horizon_angle_mercator=dir.y < horizon_dir.y ?\n0.0 : max(acos(dot(dir,horizon_dir)),0.0);float horizon_angle;\n#ifdef PROJECTION_GLOBE_VIEW\nhighp vec3 closest_point=globe_pos_dot_dir*dir;float closest_point_to_center=length(closest_point-u_globe_pos);float theta=asin(clamp(closest_point_to_center/length(u_globe_pos),-1.0,1.0));horizon_angle=globe_pos_dot_dir < 0.0 ?\nPI-theta-u_horizon_angle : theta-u_horizon_angle;float angle_t=pow(u_transition,10.0);horizon_angle=mix(horizon_angle,horizon_angle_mercator,angle_t);\n#else\nhorizon_angle=horizon_angle_mercator;\n#endif\nhorizon_angle/=PI;float t=exp(-horizon_angle/u_fadeout_range);float alpha_0=u_color.a;float alpha_1=u_high_color.a;float alpha_2=u_space_color.a;vec3 color_stop_0=u_color.rgb;vec3 color_stop_1=u_high_color.rgb;vec3 color_stop_2=u_space_color.rgb;vec3 c0=mix(color_stop_2,color_stop_1,alpha_1);vec3 c1=mix(c0,color_stop_0,alpha_0);vec3 c2=mix(c0,c1,t);vec3 c =mix(color_stop_2,c2,t);float a0=mix(alpha_2,1.0,alpha_1);float a1=mix(a0,1.0,alpha_0);float a2=mix(a0,a1,t);float a =mix(alpha_2,a2,t);vec2 uv=gl_FragCoord.xy/u_viewport-0.5;float aspect_ratio=u_viewport.x/u_viewport.y;vec4 uv_dir=vec4(normalize(vec3(uv.x*aspect_ratio,uv.y,1.0)),1.0);uv_dir=u_rotation_matrix*uv_dir;vec3 n=abs(uv_dir.xyz);vec2 uv_remap=(n.x > n.y && n.x > n.z) ? uv_dir.yz/uv_dir.x:\n(n.y > n.x && n.y > n.z) ? uv_dir.zx/uv_dir.y:\nuv_dir.xy/uv_dir.z;uv_remap.x/=aspect_ratio;vec3 D=vec3(uv_remap,1.0);highp float star_field=0.0;if (u_star_intensity > 0.0) {star_field+=stars(D,1.2,vec2(0.0,0.0));star_field+=stars(D,1.0,vec2(1.0,0.0));star_field+=stars(D,0.8,vec2(0.0,1.0));star_field+=stars(D,0.6,vec2(1.0,1.0));star_field*=(1.0-pow(t,0.25+(1.0-u_high_color.a)*0.75));c+=star_field*alpha_2;}c=dither(c,gl_FragCoord.xy+u_temporal_offset);gl_FragColor=vec4(c,a);}","attribute vec3 a_pos;attribute vec2 a_uv;uniform vec3 u_frustum_tl;uniform vec3 u_frustum_tr;uniform vec3 u_frustum_br;uniform vec3 u_frustum_bl;uniform float u_horizon;varying highp vec3 v_ray_dir;varying highp vec3 v_horizon_dir;void main() {v_ray_dir=mix(\nmix(u_frustum_tl,u_frustum_tr,a_uv.x),mix(u_frustum_bl,u_frustum_br,a_uv.x),a_uv.y);v_horizon_dir=mix(\nmix(u_frustum_tl,u_frustum_bl,u_horizon),mix(u_frustum_tr,u_frustum_br,u_horizon),a_uv.x);gl_Position=vec4(a_pos,1.0);}")};function pi(e,t){const i=e.replace(/\s*\/\/[^\n]*\n/g,"\n").split("\n");for(let e of i)if(e=e.trim(),"#"===e[0]&&e.includes("if")&&!e.includes("endif")){e=e.replace("#","").replace(/ifdef|ifndef|elif|if/g,"").replace(/!|defined|\(|\)|\|\||&&/g,"").replace(/\s+/g," ").trim();const i=e.split(" ");for(const e of i)t.includes(e)||t.push(e)}}function fi(e,t){const i=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,n=t.match(/attribute (highp |mediump |lowp )?([\w]+) ([\w]+)/g),r={},o=[...li];return pi(e,o),pi(t,o),{fragmentSource:e=e.replace(i,((e,t,i,n,o)=>(r[o]=!0,"define"===t?`\n#ifndef HAS_UNIFORM_u_${o}\nvarying ${i} ${n} ${o};\n#else\nuniform ${i} ${n} u_${o};\n#endif\n`:`\n#ifdef HAS_UNIFORM_u_${o}\n ${i} ${n} ${o} = u_${o};\n#endif\n`))),vertexSource:t=t.replace(i,((e,t,i,n,o)=>{const a="float"===n?"vec2":"vec4",s=o.match(/color/)?"color":a;return r[o]?"define"===t?`\n#ifndef HAS_UNIFORM_u_${o}\nuniform lowp float u_${o}_t;\nattribute ${i} ${a} a_${o};\nvarying ${i} ${n} ${o};\n#else\nuniform ${i} ${n} u_${o};\n#endif\n`:"vec4"===s?`\n#ifndef HAS_UNIFORM_u_${o}\n ${o} = a_${o};\n#else\n ${i} ${n} ${o} = u_${o};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${o}\n ${o} = unpack_mix_${s}(a_${o}, u_${o}_t);\n#else\n ${i} ${n} ${o} = u_${o};\n#endif\n`:"define"===t?`\n#ifndef HAS_UNIFORM_u_${o}\nuniform lowp float u_${o}_t;\nattribute ${i} ${a} a_${o};\n#else\nuniform ${i} ${n} u_${o};\n#endif\n`:"vec4"===s?`\n#ifndef HAS_UNIFORM_u_${o}\n ${i} ${n} ${o} = a_${o};\n#else\n ${i} ${n} ${o} = u_${o};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${o}\n ${i} ${n} ${o} = unpack_mix_${s}(a_${o}, u_${o}_t);\n#else\n ${i} ${n} ${o} = u_${o};\n#endif\n`})),staticAttributes:n,usedDefines:o}}class mi{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffers=[],this.vao=null}bind(e,t,i,n,r,o,a){this.context=e;let s=this.boundPaintVertexBuffers.length!==n.length;for(let e=0;!s&&e{const r=i.paint.get("hillshade-shadow-color"),o=i.paint.get("hillshade-highlight-color"),a=i.paint.get("hillshade-accent-color");let s=i.paint.get("hillshade-illumination-direction")*(Math.PI/180);"viewport"===i.paint.get("hillshade-illumination-anchor")&&(s-=e.transform.angle);const l=!e.options.moving;return{u_matrix:n||e.transform.calculateProjMatrix(t.tileID.toUnwrapped(),l),u_image:0,u_latrange:gi(0,t.tileID),u_light:[i.paint.get("hillshade-exaggeration"),s],u_shadow:r,u_highlight:o,u_accent:a}})(t,n,r,t.terrain?i.projMatrix:null);t.prepareDrawProgram(l,h,i.toUnwrapped());const{tileBoundsBuffer:p,tileBoundsIndexBuffer:f,tileBoundsSegments:m}=t.getTileBoundsBuffers(n);h.draw(l,c.TRIANGLES,o,a,s,e.CullFaceMode.disabled,d,r.id,p,f,m)}function vi(t,i,n){if(!i.needsDEMTextureUpload)return;const r=t.context,o=r.gl;r.pixelStoreUnpackPremultiplyAlpha.set(!1),i.demTexture=i.demTexture||t.getTileTexture(n.stride);const a=n.getPixels();i.demTexture?i.demTexture.update(a,{premultiply:!1}):i.demTexture=new e.Texture(r,a,o.RGBA,{premultiply:!1}),i.needsDEMTextureUpload=!1}function yi(t,i,n,r,o,a){const s=t.context,l=s.gl;if(!i.dem)return;const c=i.dem;if(s.activeTexture.set(l.TEXTURE1),vi(t,i,c),!i.demTexture)return;i.demTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE);const u=c.dim;s.activeTexture.set(l.TEXTURE0);let h=i.fbo;if(!h){const t=new e.Texture(s,{width:u,height:u,data:null},l.RGBA);t.bind(l.LINEAR,l.CLAMP_TO_EDGE),h=i.fbo=s.createFramebuffer(u,u,!0),h.colorAttachment.set(t.texture)}s.bindFramebuffer.set(h.framebuffer),s.viewport.set([0,0,u,u]);const{tileBoundsBuffer:d,tileBoundsIndexBuffer:p,tileBoundsSegments:f}=t.getMercatorTileBoundsBuffers();t.useProgram("hillshadePrepare").draw(s,l.TRIANGLES,r,o,a,e.CullFaceMode.disabled,((t,i)=>{const n=i.stride,r=e.create();return e.ortho(r,0,e.EXTENT,-e.EXTENT,0,0,1),e.translate(r,r,[0,-e.EXTENT,0]),{u_matrix:r,u_image:1,u_dimension:[n,n],u_zoom:t.overscaledZ,u_unpack:i.unpackVector}})(i.tileID,c),n.id,d,p,f),i.needsHillshadePrepare=!1}const xi=t=>({u_matrix:new e.UniformMatrix4f(t),u_image0:new e.Uniform1i(t),u_skirt_height:new e.Uniform1f(t)}),bi=(e,t)=>({u_matrix:e,u_image0:0,u_skirt_height:t}),wi=(e,t,i,n,r,o,a,s,l,c,u,h,d,p)=>({u_proj_matrix:Float32Array.from(e),u_globe_matrix:t,u_normalize_matrix:Float32Array.from(n),u_merc_matrix:i,u_zoom_transition:r,u_merc_center:o,u_image0:0,u_frustum_tl:a,u_frustum_tr:s,u_frustum_br:l,u_frustum_bl:c,u_globe_pos:u,u_globe_radius:h,u_viewport:d,u_grid_matrix:p?Float32Array.from(p):new Float32Array(9)});function Ti(e,t){return null!=e&&null!=t&&!(!e.hasData()||!t.hasData())&&null!=e.demTexture&&null!=t.demTexture&&e.tileID.key!==t.tileID.key}const Ci=new class{constructor(){this.operations={}}newMorphing(e,t,i,n,r){if(e in this.operations){const t=this.operations[e];t.to.tileID.key!==i.tileID.key&&(t.queued=i)}else this.operations[e]={startTime:n,phase:0,duration:r,from:t,to:i,queued:null}}getMorphValuesForProxy(e){if(!(e in this.operations))return null;const t=this.operations[e];return{from:t.from,to:t.to,phase:t.phase}}update(e){for(const t in this.operations){const i=this.operations[t];for(i.phase=(e-i.startTime)/i.duration;i.phase>=1||!this._validOp(i);)if(!this._nextOp(i,e)){delete this.operations[t];break}}}_nextOp(e,t){return!!e.queued&&(e.from=e.to,e.to=e.queued,e.queued=null,e.phase=0,e.startTime=t,!0)}_validOp(e){return e.from.hasData()&&e.to.hasData()}},Si={0:null,1:"TERRAIN_VERTEX_MORPHING",2:"TERRAIN_WIREFRAME"};function Ei(e,t){const i=1<({u_matrix:e});function Ai(t,i,n,r,o){if(o>0){const a=e.exported.now(),s=(a-t.timeAdded)/o,l=i?(a-i.timeAdded)/o:-1,c=n.getSource(),u=r.coveringZoomLevel({tileSize:c.tileSize,roundZoom:c.roundZoom}),h=!i||Math.abs(i.tileID.overscaledZ-u)>Math.abs(t.tileID.overscaledZ-u),d=h&&t.refreshedUponExpiration?1:e.clamp(h?s:1-l,0,1);return t.refreshedUponExpiration&&s>=1&&(t.refreshedUponExpiration=!1),i?{opacity:1,mix:1-d}:{opacity:d,mix:0}}return{opacity:1,mix:0}}class Mi extends e.SourceCache{constructor(e){const t={type:"raster-dem",maxzoom:e.transform.maxZoom},i=new D(Ne(),null),n=De("mock-dem",t,i,e.style);super("mock-dem",n,!1),n.setEventedParent(this),this._sourceLoaded=!0}_loadTile(e,t){e.state="loaded",t(null)}}class Ii extends e.SourceCache{constructor(e){const t=De("proxy",{type:"geojson",maxzoom:e.transform.maxZoom},new D(Ne(),null),e.style);super("proxy",t,!1),t.setEventedParent(this),this.map=this.getSource().map=e,this.used=this._sourceLoaded=!0,this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}update(t,i,n){if(t.freezeTileCoverage)return;this.transform=t;const r=t.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}).reduce(((i,n)=>{if(i[n.key]="",!this._tiles[n.key]){const i=new e.Tile(n,this._source.tileSize*n.overscaleFactor(),t.tileZoom);i.state="loaded",this._tiles[n.key]=i}return i}),{});for(const e in this._tiles)e in r||(this.freeFBO(e),this._tiles[e].unloadVectorData(),delete this._tiles[e])}freeFBO(e){const t=this.proxyCachedFBO[e];if(void 0!==t){const i=Object.values(t);this.renderCachePool.push(...i),delete this.proxyCachedFBO[e]}}deallocRenderCache(){this.renderCache.forEach((e=>e.fb.destroy())),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}class Pi extends e.OverscaledTileID{constructor(e,t,i){super(e.overscaledZ,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y),this.proxyTileKey=t,this.projMatrix=i}}class Di extends e.Elevation{constructor(t,i){super(),this.painter=t,this.terrainTileForTile={},this.prevTerrainTileForTile={};const[n,r,o]=function(t){const i=new e.StructArrayLayout4i8,n=new e.StructArrayLayout3ui6,r=131;i.reserve(17161),n.reserve(33800);const o=e.EXTENT/128,a=e.EXTENT+o/2,s=a+o;for(let t=-o;ta||t<0||t>a?24575:0,o=e.clamp(Math.round(n),0,e.EXTENT),s=e.clamp(Math.round(t),0,e.EXTENT);i.emplaceBack(o+r,s,o,s)}const l=(e,t)=>{const i=t*r+e;n.emplaceBack(i+1,i,i+r),n.emplaceBack(i+r,i+r+1,i+1)};for(let e=1;e<129;e++)for(let t=1;t<129;t++)l(t,e);return[0,129].forEach((e=>{for(let t=0;t<130;t++)l(t,e),l(e,t)})),[i,n,32768]}(),a=t.context;this.gridBuffer=a.createVertexBuffer(n,e.boundsAttributes.members),this.gridIndexBuffer=a.createIndexBuffer(r),this.gridSegments=e.SegmentVector.simpleSegment(0,0,n.length,r.length),this.gridNoSkirtSegments=e.SegmentVector.simpleSegment(0,0,n.length,o),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new Ii(i.map),this.orthoMatrix=e.create(),e.ortho(this.orthoMatrix,"globe"===this.painter.transform.projection.name?.015:0,e.EXTENT,0,e.EXTENT,0,1);const s=a.gl;this._overlapStencilMode=new e.StencilMode({func:s.GEQUAL,mask:255},0,255,s.KEEP,s.KEEP,s.REPLACE),this._previousZoom=t.transform.zoom,this.pool=[],this._findCoveringTileCache={},this._tilesDirty={},this.style=i,this._useVertexMorphing=!0,this._exaggeration=1,this._mockSourceCache=new Mi(i.map)}set style(e){e.on("data",this._onStyleDataEvent.bind(this)),e.on("neworder",this._checkRenderCacheEfficiency.bind(this)),this._style=e,this._checkRenderCacheEfficiency()}update(t,i,n){if(t&&t.terrain){this._style!==t&&(this.style=t),this.enabled=!0;const r=t.terrain.properties;this.sourceCache=0===t.terrain.drapeRenderMode?this._mockSourceCache:t._getSourceCache(r.get("source")),this._exaggeration=r.get("exaggeration");const o=()=>{this.sourceCache.used&&e.warnOnce(`Raster DEM source '${this.sourceCache.id}' is used both for terrain and as layer source.\nThis leads to lower resolution of hillshade. For full hillshade resolution but higher memory consumption, define another raster DEM source.`);const t=this.getScaledDemTileSize();this.sourceCache.update(i,t,!0),this.resetTileLookupCache(this.sourceCache.id)};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,o(),this._initializing=!0),o(),i.updateElevation(!n),this.resetTileLookupCache(this.proxySourceCache.id),this.proxySourceCache.update(i),this._emptyDEMTextureDirty=!0}else this._disable()}resetTileLookupCache(e){this._findCoveringTileCache[e]={}}getScaledDemTileSize(){return this.sourceCache.getSource().tileSize/128*this.proxySourceCache.getSource().tileSize}_checkRenderCacheEfficiency(){const t=this.renderCacheEfficiency(this._style);this._style.map._optimizeForTerrain||100!==t.efficiency&&e.warnOnce(`Terrain render cache efficiency is not optimal (${t.efficiency}%) and performance\n may be affected negatively, consider placing all background, fill and line layers before layer\n with id '${t.firstUndrapedLayer}' or create a map using optimizeForTerrain: true option.`)}_onStyleDataEvent(e){e.coord&&"source"===e.dataType?this._clearRenderCacheForTile(e.sourceCacheId,e.coord):"style"===e.dataType&&(this._invalidateRenderCache=!0)}_disable(){if(this.enabled&&(this.enabled=!1,this._sharedDepthStencil=void 0,this.proxySourceCache.deallocRenderCache(),this._style))for(const e in this._style._sourceCaches)this._style._sourceCaches[e].usedForTerrain=!1}destroy(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this._emptyDepthBufferTexture&&this._emptyDepthBufferTexture.destroy(),this.pool.forEach((e=>e.fb.destroy())),this.pool=[],this._depthFBO&&(this._depthFBO.destroy(),this._depthFBO=void 0,this._depthTexture=void 0)}_source(){return this.enabled?this.sourceCache:null}isUsingMockSource(){return this.sourceCache===this._mockSourceCache}exaggeration(){return this._exaggeration}get visibleDemTiles(){return this._visibleDemTiles}get drapeBufferSize(){const e=2*this.proxySourceCache.getSource().tileSize;return[e,e]}set useVertexMorphing(e){this._useVertexMorphing=e}updateTileBinding(t){if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;const i=this.proxySourceCache,n=this.painter.transform;this._initializing&&(this._initializing=0===n._centerAltitude&&-1===this.getAtPointOrZero(e.MercatorCoordinate.fromLngLat(n.center),-1),this._emptyDEMTextureDirty=!this._initializing);const r=this.proxyCoords=i.getIds().map((e=>{const t=i.getTileByID(e).tileID;return t.projMatrix=n.calculateProjMatrix(t.toUnwrapped()),t}));!function(t,i){const n=i.transform.pointCoordinate(i.transform.getCameraPoint()),r=new e.pointGeometry(n.x,n.y);t.sort(((t,i)=>{if(i.overscaledZ-t.overscaledZ)return i.overscaledZ-t.overscaledZ;const n=new e.pointGeometry(t.canonical.x+(1<{this.proxyToSource[e.key]={}})),this.terrainTileForTile={};const a=this._style._sourceCaches;for(const e in a){const i=a[e];if(!i.used)continue;if(i!==this.sourceCache&&this.resetTileLookupCache(i.id),this._setupProxiedCoordsForOrtho(i,t[e],o),i.usedForTerrain)continue;const n=t[e];i.getSource().reparseOverscaled&&this._assignTerrainTiles(n)}this.proxiedCoords[i.id]=r.map((e=>new Pi(e,e.key,this.orthoMatrix))),this._assignTerrainTiles(r),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(o),this.renderingToTexture=!1,this._updateTimestamp=e.exported.now();const s={};this._visibleDemTiles=[];for(const e of this.proxyCoords){const t=this.terrainTileForTile[e.key];if(!t)continue;const i=t.tileID.key;i in s||(this._visibleDemTiles.push(t),s[i]=i)}}_assignTerrainTiles(e){this._initializing||e.forEach((e=>{if(this.terrainTileForTile[e.key])return;const t=this._findTileCoveringTileID(e,this.sourceCache);t&&(this.terrainTileForTile[e.key]=t)}))}_prepareDEMTextures(){const e=this.painter.context,t=e.gl;for(const i in this.terrainTileForTile){const n=this.terrainTileForTile[i],r=n.dem;!r||n.demTexture&&!n.needsDEMTextureUpload||(e.activeTexture.set(t.TEXTURE1),vi(this.painter,n,r))}}_prepareDemTileUniforms(e,t,i,n){if(!t||null==t.demTexture)return!1;const r=e.tileID.canonical,o=Math.pow(2,t.tileID.canonical.z-r.z),a=n||"";return i[`u_dem_tl${a}`]=[r.x*o%1,r.y*o%1],i[`u_dem_scale${a}`]=o,!0}get emptyDEMTexture(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}get emptyDepthBufferTexture(){const t=this.painter.context,i=t.gl;if(!this._emptyDepthBufferTexture){const n=new e.RGBAImage({width:1,height:1},Uint8Array.of(255,255,255,255));this._emptyDepthBufferTexture=new e.Texture(t,n,i.RGBA,{premultiply:!1})}return this._emptyDepthBufferTexture}_getLoadedAreaMinimum(){let e=0;const t=this._visibleDemTiles.reduce(((t,i)=>{if(!i.dem)return t;const n=i.dem.tree.minimums[0];return n>0&&e++,t+n}),0);return e?t/e:0}_updateEmptyDEMTexture(){const t=this.painter.context,i=t.gl;t.activeTexture.set(i.TEXTURE2);const n=this._getLoadedAreaMinimum(),r=new e.RGBAImage({width:1,height:1},new Uint8Array(e.DEMData.pack(n,this.sourceCache.getSource().encoding)));this._emptyDEMTextureDirty=!1;let o=this._emptyDEMTexture;return o?o.update(r,{premultiply:!1}):o=this._emptyDEMTexture=new e.Texture(t,r,i.RGBA,{premultiply:!1}),o}setupElevationDraw(t,i,n){const r=this.painter.context,o=r.gl,a=(s=this.sourceCache.getSource().encoding,{u_dem:2,u_dem_prev:4,u_dem_unpack:e.DEMData.getUnpackVector(s),u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_exaggeration:0});var s;a.u_dem_size=this.sourceCache.getSource().tileSize,a.u_exaggeration=this.exaggeration();let l=null,c=null,u=1;if(n&&n.morphing&&this._useVertexMorphing){const e=n.morphing.srcDemTile,i=n.morphing.dstDemTile;u=n.morphing.phase,e&&i&&(this._prepareDemTileUniforms(t,e,a,"_prev")&&(c=e),this._prepareDemTileUniforms(t,i,a)&&(l=i))}if(c&&l?(r.activeTexture.set(o.TEXTURE2),l.demTexture.bind(o.NEAREST,o.CLAMP_TO_EDGE,o.NEAREST),r.activeTexture.set(o.TEXTURE4),c.demTexture.bind(o.NEAREST,o.CLAMP_TO_EDGE,o.NEAREST),a.u_dem_lerp=u):(l=this.terrainTileForTile[t.tileID.key],r.activeTexture.set(o.TEXTURE2),(this._prepareDemTileUniforms(t,l,a)?l.demTexture:this.emptyDEMTexture).bind(o.NEAREST,o.CLAMP_TO_EDGE)),r.activeTexture.set(o.TEXTURE3),n&&n.useDepthForOcclusion?(this._depthTexture&&this._depthTexture.bind(o.NEAREST,o.CLAMP_TO_EDGE),this._depthFBO&&(a.u_depth_size_inv=[1/this._depthFBO.width,1/this._depthFBO.height])):(this.emptyDepthBufferTexture.bind(o.NEAREST,o.CLAMP_TO_EDGE),a.u_depth_size_inv=[1,1]),n&&n.useMeterToDem&&l){const t=(1<{if(c===e)return;const n=[Si[e],"PROJECTION_GLOBE_VIEW"];d&&n.push("CUSTOM_ANTIALIASING"),i&&n.push(Si[u]),l=t.useProgram("globeRaster",null,n),c=e},f=t.colorModeForRenderPass(),m=new e.DepthMode(s.LEQUAL,e.DepthMode.ReadWrite,t.depthRangeFor3D);Ci.update(o);const g=e.calculateGlobeMercatorMatrix(h),_=[e.mercatorXfromLng(h.center.lng),e.mercatorYfromLat(h.center.lat)],v=u?[!1,!0]:[!1],y=t.globeSharedBuffers,x=[h.width*e.exported.devicePixelRatio,h.height*e.exported.devicePixelRatio],b=Float32Array.from(h.globeMatrix),w={useDenormalizedUpVectorScale:!0};if(v.forEach((u=>{c=-1;const d=u?s.LINES:s.TRIANGLES;for(const c of r){const r=n.getTile(c),v=e.StencilMode.disabled,T=i.prevTerrainTileForTile[c.key],C=i.terrainTileForTile[c.key];Ti(T,C)&&Ci.newMorphing(c.key,T,C,o,250),a.activeTexture.set(s.TEXTURE0),r.texture.bind(s.LINEAR,s.CLAMP_TO_EDGE);const S=Ci.getMorphValuesForProxy(c.key),E=S?1:0;S&&e.extend$1(w,{morphing:{srcDemTile:S.from,dstDemTile:S.to,phase:e.easeCubicInOut(S.phase)}});const k=e.tileCornersToBounds(c.canonical),A=e.getLatitudinalLod(k.getCenter().lat),M=e.getGridMatrix(c.canonical,k,A,h.worldSize/h._pixelsPerMercatorPixel),I=e.globeNormalizeECEF(e.globeTileBounds(c.canonical)),P=wi(h.projMatrix,b,g,I,e.globeToMercatorTransition(h.zoom),_,h.frustumCorners.TL,h.frustumCorners.TR,h.frustumCorners.BR,h.frustumCorners.BL,h.globeCenterInViewSpace,h.globeRadius,x,M);if(p(E,u),i.setupElevationDraw(r,l,w),t.prepareDrawProgram(a,l,c.toUnwrapped()),y){const[i,n,r]=u?y.getWirefameBuffers(t.context,A):y.getGridBuffers(A);l.draw(a,d,m,v,f,e.CullFaceMode.backCCW,P,"globe_raster",i,n,r)}}})),y){const o=["GLOBE_POLES","PROJECTION_GLOBE_VIEW"];d&&o.push("CUSTOM_ANTIALIASING"),l=t.useProgram("globeRaster",null,o);for(const o of r){const{x:r,y:c,z:u}=o.canonical,d=0===c,p=c===(1<t.draw(a,s.TRIANGLES,m,e.StencilMode.disabled,f,e.CullFaceMode.disabled,wi(h.projMatrix,y,y,C,0,_,h.frustumCorners.TL,h.frustumCorners.TR,h.frustumCorners.BR,h.frustumCorners.BL,h.globeCenterInViewSpace,h.globeRadius,x),"globe_pole_raster",i,b,T);i.setupElevationDraw(c,l,w),t.prepareDrawProgram(a,l,o.toUnwrapped()),d&&S(l,g),p&&(y=e.scale(e.create(),y,[1,-1,1]),S(l,v))}}}}(t,i,n,r,o);else{const a=t.context,s=a.gl;let l,c;const u=t.options.showTerrainWireframe?2:0,h=(e,i)=>{if(c===e)return;const n=[Si[e]];i&&n.push(Si[u]),l=t.useProgram("terrainRaster",null,n),c=e},d=t.colorModeForRenderPass(),p=new e.DepthMode(s.LEQUAL,e.DepthMode.ReadWrite,t.depthRangeFor3D);Ci.update(o);const f=t.transform,m=6*Math.pow(1.5,22-f.zoom)*i.exaggeration();(u?[!1,!0]:[!1]).forEach((u=>{c=-1;const g=u?s.LINES:s.TRIANGLES,[_,v]=u?i.getWirefameBuffer():[i.gridIndexBuffer,i.gridSegments];for(const c of r){const r=n.getTile(c),y=e.StencilMode.disabled,x=i.prevTerrainTileForTile[c.key],b=i.terrainTileForTile[c.key];Ti(x,b)&&Ci.newMorphing(c.key,x,b,o,250),a.activeTexture.set(s.TEXTURE0),r.texture.bind(s.LINEAR,s.CLAMP_TO_EDGE,s.LINEAR_MIPMAP_NEAREST);const w=Ci.getMorphValuesForProxy(c.key),T=w?1:0;let C;w&&(C={morphing:{srcDemTile:w.from,dstDemTile:w.to,phase:e.easeCubicInOut(w.phase)}});const S=bi(c.projMatrix,Ei(c.canonical,f.renderWorldCopies)?m/10:m);h(T,u),i.setupElevationDraw(r,l,C),t.prepareDrawProgram(a,l,c.toUnwrapped()),l.draw(a,g,p,y,d,e.CullFaceMode.backCCW,S,"terrain_raster",i.gridBuffer,_,v)}}))}}(i,this,this.proxySourceCache,t,this._updateTimestamp),this.renderingToTexture=!0,i.gpuTimingDeferredRenderEnd(),t.splice(0,t.length))}renderBatch(t){if(0===this._drapedRenderBatches.length)return t+1;this.renderingToTexture=!0;const i=this.painter,n=this.painter.context,r=this.proxySourceCache,o=this.proxiedCoords[r.id],a=this._drapedRenderBatches.shift(),s=[],l=i.style.order;let c=0;for(const u of o){const o=r.getTileByID(u.proxyTileKey),h=r.proxyCachedFBO[u.key]?r.proxyCachedFBO[u.key][t]:void 0,d=void 0!==h?r.renderCache[h]:this.pool[c++],p=void 0!==h;if(o.texture=d.tex,p&&!d.dirty){s.push(o.tileID);continue}let f;n.bindFramebuffer.set(d.fb.framebuffer),this.renderedToTile=!1,d.dirty&&(n.clear({color:e.Color.transparent,stencil:0}),d.dirty=!1);for(let e=a.start;e<=a.end;++e){const t=i.style._layers[l[e]];if(t.isHidden(i.transform.zoom))continue;const r=i.style._getLayerSourceCache(t),o=r?this.proxyToSource[u.key][r.id]:[u];if(!o)continue;const a=o;n.viewport.set([0,0,d.fb.width,d.fb.height]),f!==(r?r.id:null)&&(this._setupStencil(d,o,t,r),f=r?r.id:null),i.renderLayer(i,r,t,a)}this.renderedToTile?(d.dirty=!0,s.push(o.tileID)):p||--c,5===c&&(c=0,this.renderToBackBuffer(s))}return this.renderToBackBuffer(s),this.renderingToTexture=!1,n.bindFramebuffer.set(null),n.viewport.set([0,0,i.width,i.height]),a.end+1}postRender(){}renderCacheEfficiency(e){const t=e.order.length;if(0===t)return{efficiency:100};let i,n=0,r=0,o=!1;for(let a=0;ae.dem)).forEach((t=>{e=Math.min(e,t.dem.tree.minimums[0])})),0===e?e:(e-30)*this._exaggeration}raycast(e,t,i){if(!this._visibleDemTiles)return null;const n=this._visibleDemTiles.filter((e=>e.dem)).map((n=>{const r=n.tileID,o=1<(null!==e.t?e.t:Number.MAX_VALUE)-(null!==t.t?t.t:Number.MAX_VALUE)));for(const r of n){if(null==r.t)return null;const n=r.tile.dem.tree.raycast(r.minx,r.miny,r.maxx,r.maxy,e,t,i);if(null!=n)return n}return null}_createFBO(){const t=this.painter.context,i=t.gl,n=this.drapeBufferSize;t.activeTexture.set(i.TEXTURE0);const r=new e.Texture(t,{width:n[0],height:n[1],data:null},i.RGBA);r.bind(i.LINEAR,i.CLAMP_TO_EDGE);const o=t.createFramebuffer(n[0],n[1],!1);return o.colorAttachment.set(r.texture),o.depthAttachment=new Ce(t,o.framebuffer),void 0===this._sharedDepthStencil?(this._sharedDepthStencil=t.createRenderbuffer(t.gl.DEPTH_STENCIL,n[0],n[1]),this._stencilRef=0,o.depthAttachment.set(this._sharedDepthStencil),t.clear({stencil:0})):o.depthAttachment.set(this._sharedDepthStencil),t.extTextureFilterAnisotropic&&!t.extTextureFilterAnisotropicForceOff&&i.texParameterf(i.TEXTURE_2D,t.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,t.extTextureFilterAnisotropicMax),{fb:o,tex:r,dirty:!1}}_initFBOPool(){for(;this.pool.length{const t=this._style._layers[e],i=t.isHidden(this.painter.transform.zoom),n=t.getCrossfadeParameters(),r=!!n&&1!==n.t,o=t.hasTransition();return"custom"!==t.type&&!i&&(r||o)}))}_clearRasterFadeFromRenderCache(){let e=!1;for(const t in this._style._sourceCaches)if(this._style._sourceCaches[t]._source instanceof ke){e=!0;break}if(e)for(let e=0;et.renderCachePool.length){const e=Object.values(t.proxyCachedFBO);t.proxyCachedFBO={};for(let i=0;i=0;r--){const o=i[r];if(t.getTileByID(o.key),void 0!==t.proxyCachedFBO[o.key]){const i=e[o.key],r=this.proxyToSource[o.key];let a=0;for(const e in r){const t=r[e],o=i[e];if(!o||o.length!==t.length||t.some(((t,i)=>t!==o[i]||n[e]&&n[e].hasOwnProperty(t.key)))){a=-1;break}++a}for(const e in t.proxyCachedFBO[o.key])t.renderCache[t.proxyCachedFBO[o.key][e]].dirty=a<0||a!==Object.values(i).length}}const r=[...this._drapedRenderBatches];r.sort(((e,t)=>t.end-t.start-(e.end-e.start)));for(const e of r)for(const n of i){if(t.proxyCachedFBO[n.key])continue;let i=t.renderCachePool.pop();void 0===i&&t.renderCache.length<50&&(i=t.renderCache.length,t.renderCache.push(this._createFBO())),void 0!==i&&(t.proxyCachedFBO[n.key]={},t.proxyCachedFBO[n.key][e.start]=i,t.renderCache[i].dirty=!0)}this._tilesDirty={}}_setupStencil(e,t,i,n){if(!n||!this._sourceTilesOverlap[n.id])return void(this._overlapStencilType&&(this._overlapStencilType=!1));const r=this.painter.context,o=r.gl;if(t.length<=1)return void(this._overlapStencilType=!1);let a;if(i.isTileClipped())a=t.length,this._overlapStencilMode.test={func:o.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(t[0].overscaledZ>t[t.length-1].overscaledZ))return void(this._overlapStencilType=!1);a=1,this._overlapStencilMode.test={func:o.GREATER,mask:255},this._overlapStencilType="Mask"}this._stencilRef+a>255&&(r.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=a,this._overlapStencilMode.ref=this._stencilRef,i.isTileClipped()&&this._renderTileClippingMasks(t,this._overlapStencilMode.ref)}clipOrMaskOverlapStencilType(){return"Clip"===this._overlapStencilType||"Mask"===this._overlapStencilType}stencilModeForRTTOverlap(t){return this.renderingToTexture&&this._overlapStencilType?("Clip"===this._overlapStencilType&&(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[t.key]),this._overlapStencilMode):e.StencilMode.disabled}_renderTileClippingMasks(t,i){const n=this.painter,r=this.painter.context,o=r.gl;n._tileClippingMaskIDs={},r.setColorMode(e.ColorMode.disabled),r.setDepthMode(e.DepthMode.disabled);const a=n.useProgram("clippingMask");for(const s of t){const t=n._tileClippingMaskIDs[s.key]=--i;a.draw(r,o.TRIANGLES,e.DepthMode.disabled,new e.StencilMode({func:o.ALWAYS,mask:0},t,255,o.KEEP,o.KEEP,o.REPLACE),e.ColorMode.disabled,e.CullFaceMode.disabled,ki(s.projMatrix),"$clipping",n.tileExtentBuffer,n.quadTriangleIndexBuffer,n.tileExtentSegments)}}pointCoordinate(t){const i=this.painter.transform;if(t.x<0||t.x>i.width||t.y<0||t.y>i.height)return null;const n=[t.x,t.y,1,1];e.transformMat4$1(n,n,i.pixelMatrixInverse),e.scale$1(n,n,1/n[3]),n[0]/=i.worldSize,n[1]/=i.worldSize;const r=i._camera.position,o=e.mercatorZfromAltitude(1,i.center.lat),a=[r[0],r[1],r[2]/o,0],s=e.subtract([],n.slice(0,3),a);e.normalize(s,s);const l=this.raycast(a,s,this._exaggeration);return null!==l&&l?(e.scaleAndAdd(a,a,s,l),a[3]=a[2],a[2]*=o,a):null}drawDepth(){const t=this.painter,i=t.context,n=this.proxySourceCache,r=Math.ceil(t.width),o=Math.ceil(t.height);if(!this._depthFBO||this._depthFBO.width===r&&this._depthFBO.height===o||(this._depthFBO.destroy(),this._depthFBO=void 0,this._depthTexture=void 0),!this._depthFBO){const t=i.gl,n=i.createFramebuffer(r,o,!0);i.activeTexture.set(t.TEXTURE0);const a=new e.Texture(i,{width:r,height:o,data:null},t.RGBA);a.bind(t.NEAREST,t.CLAMP_TO_EDGE),n.colorAttachment.set(a.texture);const s=i.createRenderbuffer(i.gl.DEPTH_COMPONENT16,r,o);n.depthAttachment.set(s),this._depthFBO=n,this._depthTexture=a}i.bindFramebuffer.set(this._depthFBO.framebuffer),i.viewport.set([0,0,r,o]),function(t,i,n,r){if("globe"===t.transform.projection.name)return;const o=t.context,a=o.gl;o.clear({depth:1});const s=t.useProgram("terrainDepth"),l=new e.DepthMode(a.LESS,e.DepthMode.ReadWrite,t.depthRangeFor3D);for(const t of r){const r=n.getTile(t),c=bi(t.projMatrix,0);i.setupElevationDraw(r,s),s.draw(o,a.TRIANGLES,l,e.StencilMode.disabled,e.ColorMode.unblended,e.CullFaceMode.backCCW,c,"terrain_depth",i.gridBuffer,i.gridIndexBuffer,i.gridNoSkirtSegments)}}(t,this,n,this.proxyCoords)}_setupProxiedCoordsForOrtho(e,t,i){if(e.getSource()instanceof Ie)return this._setupProxiedCoordsForImageSource(e,t,i);this._findCoveringTileCache[e.id]=this._findCoveringTileCache[e.id]||{};const n=this.proxiedCoords[e.id]=[],r=this.proxyCoords;for(let t=0;t(e.min.x=Math.min(e.min.x,t.x-s.x),e.min.y=Math.min(e.min.y,t.y-s.y),e.max.x=Math.max(e.max.x,t.x-s.x),e.max.y=Math.max(e.max.y,t.y-s.y),e)),{min:new e.pointGeometry(Number.MAX_VALUE,Number.MAX_VALUE),max:new e.pointGeometry(-Number.MAX_VALUE,-Number.MAX_VALUE)}),c=(t,i)=>{const n=t.wrap+t.canonical.x/(1<a+l.max.x||r+os+l.max.y};for(let e=0;ee.key===i.tileID.key));if(e)return e}if(i.tileID.key!==t.key){const n=t.canonical.z-i.tileID.canonical.z;let o,a,s;r=e.create();const l=i.tileID.wrap-t.wrap<0?(o=e.EXTENT>>n,a=o*((i.tileID.canonical.x<=r){const n=t.canonical.z-r;i.getSource().reparseOverscaled?(s=Math.max(t.canonical.z+2,i.transform.tileZoom),a=new e.OverscaledTileID(s,t.wrap,r,t.canonical.x>>n,t.canonical.y>>n)):0!==n&&(s=r,a=new e.OverscaledTileID(s,t.wrap,r,t.canonical.x>>n,t.canonical.y>>n))}a.key!==t.key&&(c.push(a.key),n=i.getTile(a))}const u=e=>{c.forEach((t=>{r[t]=e})),c.length=0};for(s-=1;s>=l&&(!n||!n.hasData());s--){n&&u(n.tileID.key);const e=a.calculateScaledKey(s);if(n=i.getTileByID(e),n&&n.hasData())break;const t=r[e];if(null===t)break;void 0===t?c.push(e):n=i.getTileByID(t)}return u(n?n.tileID.key:null),n&&n.hasData()?n:null}findDEMTileFor(e){return this.enabled?this._findTileCoveringTileID(e,this.sourceCache):null}prepareDrawTile(){this.renderedToTile=!0}_clearRenderCacheForTile(e,t){let i=this._tilesDirty[e];i||(i=this._tilesDirty[e]={}),i[t.key]=!0}getWirefameBuffer(){if(!this.wireframeSegments){const t=function(t){let i=0;const n=new e.StructArrayLayout2ui4,r=131;for(let e=1;e<129;e++){for(let t=1;t<129;t++)i=e*r+t,n.emplaceBack(i,i+1),n.emplaceBack(i,i+r),n.emplaceBack(i+1,i+r),128===e&&n.emplaceBack(i+r,i+r+1);n.emplaceBack(i+1,i+1+r)}return n}();this.wireframeIndexBuffer=this.painter.context.createIndexBuffer(t),this.wireframeSegments=e.SegmentVector.simpleSegment(0,0,this.gridBuffer.length,t.length)}return[this.wireframeIndexBuffer,this.wireframeSegments]}}class zi{static cacheKey(e,t,i,n){let r=`${t}${n?n.cacheKey:""}`;for(const t of i)e.usedDefines.includes(t)&&(r+=`/${t}`);return r}constructor(t,i,n,r,o,a){const s=t.gl;this.program=s.createProgram();const l=function(e){const t=[];for(let i=0;i`#define ${e}`)));const d=h.concat(t.extStandardDerivatives?"#extension GL_OES_standard_derivatives : enable\n".concat(hi):hi,hi,ui,ci.fragmentSource,si.fragmentSource,n.fragmentSource).join("\n"),p=h.concat("\n#ifdef GL_ES\nprecision highp float;\n#else\n\n#if !defined(lowp)\n#define lowp\n#endif\n\n#if !defined(mediump)\n#define mediump\n#endif\n\n#if !defined(highp)\n#define highp\n#endif\n\n#endif",ui,ci.vertexSource,si.vertexSource,ai.vertexSource,n.vertexSource).join("\n"),f=s.createShader(s.FRAGMENT_SHADER);if(s.isContextLost())return void(this.failedToCreate=!0);s.shaderSource(f,d),s.compileShader(f),s.attachShader(this.program,f);const m=s.createShader(s.VERTEX_SHADER);if(s.isContextLost())this.failedToCreate=!0;else{s.shaderSource(m,p),s.compileShader(m),s.attachShader(this.program,m),this.attributes={},this.numAttributes=u.length;for(let e=0;e({u_dem:new e.Uniform1i(t),u_dem_prev:new e.Uniform1i(t),u_dem_unpack:new e.Uniform4f(t),u_dem_tl:new e.Uniform2f(t),u_dem_scale:new e.Uniform1f(t),u_dem_tl_prev:new e.Uniform2f(t),u_dem_scale_prev:new e.Uniform1f(t),u_dem_size:new e.Uniform1f(t),u_dem_lerp:new e.Uniform1f(t),u_exaggeration:new e.Uniform1f(t),u_depth:new e.Uniform1i(t),u_depth_size_inv:new e.Uniform2f(t),u_meter_to_dem:new e.Uniform1f(t),u_label_plane_matrix_inv:new e.UniformMatrix4f(t)}))(t)),a.includes("GLOBE")&&(this.globeUniforms=(t=>({u_tile_tl_up:new e.Uniform3f(t),u_tile_tr_up:new e.Uniform3f(t),u_tile_br_up:new e.Uniform3f(t),u_tile_bl_up:new e.Uniform3f(t),u_tile_up_scale:new e.Uniform1f(t)}))(t)),a.includes("FOG")&&(this.fogUniforms=(t=>({u_fog_matrix:new e.UniformMatrix4f(t),u_fog_range:new e.Uniform2f(t),u_fog_color:new e.Uniform4f(t),u_fog_horizon_blend:new e.Uniform1f(t),u_fog_temporal_offset:new e.Uniform1f(t),u_frustum_tl:new e.Uniform3f(t),u_frustum_tr:new e.Uniform3f(t),u_frustum_br:new e.Uniform3f(t),u_frustum_bl:new e.Uniform3f(t),u_globe_pos:new e.Uniform3f(t),u_globe_radius:new e.Uniform1f(t),u_globe_transition:new e.Uniform1f(t),u_is_globe:new e.Uniform1i(t),u_viewport:new e.Uniform2f(t)}))(t))}}setTerrainUniformValues(e,t){if(!this.terrainUniforms)return;const i=this.terrainUniforms;if(!this.failedToCreate){e.program.set(this.program);for(const e in t)i[e]&&i[e].set(this.program,e,t[e])}}setGlobeUniformValues(e,t){if(!this.globeUniforms)return;const i=this.globeUniforms;if(!this.failedToCreate){e.program.set(this.program);for(const e in t)i[e]&&i[e].set(this.program,e,t[e])}}setFogUniformValues(e,t){if(!this.fogUniforms)return;const i=this.fogUniforms;if(!this.failedToCreate){e.program.set(this.program);for(const e in t)i[e].set(this.program,e,t[e])}}draw(e,t,i,n,r,o,a,s,l,c,u,h,d,p,f){const m=e.gl;if(this.failedToCreate)return;e.program.set(this.program),e.setDepthMode(i),e.setStencilMode(n),e.setColorMode(r),e.setCullFace(o);for(const e of Object.keys(this.fixedUniforms))this.fixedUniforms[e].set(this.program,e,a[e]);p&&p.setUniforms(this.program,e,this.binderUniforms,h,{zoom:d});const g={[m.LINES]:2,[m.TRIANGLES]:3,[m.LINE_STRIP]:1}[t];for(const i of u.get()){const n=i.vaos||(i.vaos={});(n[s]||(n[s]=new mi)).bind(e,this,l,p?p.getPaintVertexBuffers():[],c,i.vertexOffset,f||[]),m.drawElements(t,i.primitiveLength*g,m.UNSIGNED_SHORT,i.primitiveOffset*g*2)}}}function Oi(e,t,i){const n=1/z(i,1,t.transform.tileZoom),r=Math.pow(2,i.tileID.overscaledZ),o=i.tileSize*Math.pow(2,t.transform.tileZoom)/r,a=o*(i.tileID.canonical.x+i.tileID.wrap*r),s=o*i.tileID.canonical.y;return{u_image:0,u_texsize:i.imageAtlasTexture.size,u_scale:[n,e.fromScale,e.toScale],u_fade:e.t,u_pixel_coord_upper:[a>>16,s>>16],u_pixel_coord_lower:[65535&a,65535&s]}}const Li=e.create(),Ri=(t,i,n,r,o,a,s,l,c,u,h)=>{const d=i.style.light,p=d.properties.get("position"),f=[p.x,p.y,p.z],m=e.create$1();"viewport"===d.properties.get("anchor")&&(e.fromRotation(m,-i.transform.angle),e.transformMat3(f,f,m));const g=d.properties.get("color"),_=i.transform,v={u_matrix:t,u_lightpos:f,u_lightintensity:d.properties.get("intensity"),u_lightcolor:[g.r,g.g,g.b],u_vertical_gradient:+n,u_opacity:r,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:Li,u_merc_center:[0,0],u_up_dir:[0,0,0],u_height_lift:0,u_ao:o,u_edge_radius:a};return"globe"===_.projection.name&&(v.u_tile_id=[s.canonical.x,s.canonical.y,1<{const f=Ri(t,i,n,r,o,a,s,u,h,d,p),m={u_height_factor:-Math.pow(2,s.overscaledZ)/c.tileSize/8};return e.extend(f,Oi(l,i,c),m)},Fi=e=>({u_matrix:e}),$i=(t,i,n,r)=>e.extend(Fi(t),Oi(n,i,r)),ji=(e,t)=>({u_matrix:e,u_world:t}),Ni=(t,i,n,r,o)=>e.extend($i(t,i,n,r),{u_world:o}),Ui=e.create(),Vi=(t,i,n,r,o,a)=>{const s=t.transform,l="globe"===s.projection.name;let c;if("map"===a.paint.get("circle-pitch-alignment"))if(l){const t=e.globePixelsToTileUnits(s.zoom,i.canonical)*s._pixelsPerMercatorPixel;c=Float32Array.from([t,0,0,t])}else c=s.calculatePixelsToTileUnitsMatrix(n);else c=new Float32Array([s.pixelsToGLUnits[0],0,0,s.pixelsToGLUnits[1]]);const u={u_camera_to_center_distance:s.cameraToCenterDistance,u_matrix:t.translatePosMatrix(i.projMatrix,n,a.paint.get("circle-translate"),a.paint.get("circle-translate-anchor")),u_device_pixel_ratio:e.exported.devicePixelRatio,u_extrude_scale:c,u_inv_rot_matrix:Ui,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(l){u.u_inv_rot_matrix=r,u.u_merc_center=o,u.u_tile_id=[i.canonical.x,i.canonical.y,1<{const t=[];return"map"===e.paint.get("circle-pitch-alignment")&&t.push("PITCH_WITH_MAP"),"map"===e.paint.get("circle-pitch-scale")&&t.push("SCALE_WITH_MAP"),t},qi=(t,i,n,r)=>{const o=e.EXTENT/n.tileSize;return{u_matrix:t,u_camera_to_center_distance:i.getCameraToCenterDistance(r),u_extrude_scale:[i.pixelsToGLUnits[0]/o,i.pixelsToGLUnits[1]/o]}},Wi=(e,t,i=1)=>({u_matrix:e,u_color:t,u_overlay:0,u_overlay_scale:i}),Zi=e.create(),Hi=(t,i,n,r,o,a,s)=>{const l=t.transform,c="globe"===l.projection.name,u=c?e.globePixelsToTileUnits(l.zoom,i.canonical)*l._pixelsPerMercatorPixel:z(n,1,a),h={u_matrix:i.projMatrix,u_extrude_scale:u,u_intensity:s,u_inv_rot_matrix:Zi,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(c){h.u_inv_rot_matrix=r,h.u_merc_center=o,h.u_tile_id=[i.canonical.x,i.canonical.y,1<{const l=e.transform,c=l.calculatePixelsToTileUnitsMatrix(t),u={u_matrix:Ji(e,t,i,r),u_pixels_to_tile_units:c,u_device_pixel_ratio:a,u_units_to_pixels:[1/l.pixelsToGLUnits[0],1/l.pixelsToGLUnits[1]],u_dash_image:0,u_gradient_image:1,u_image_height:o,u_texsize:[0,0],u_scale:[0,0,0],u_mix:0,u_alpha_discard_threshold:0,u_trim_offset:s};if(Qi(i)){const i=Ki(t,e.transform);u.u_texsize=t.lineAtlasTexture.size,u.u_scale=[i,n.fromScale,n.toScale],u.u_mix=n.t}return u},Yi=(e,t,i,n,r,o)=>{const a=e.transform,s=Ki(t,a);return{u_matrix:Ji(e,t,i,r),u_texsize:t.imageAtlasTexture.size,u_pixels_to_tile_units:a.calculatePixelsToTileUnitsMatrix(t),u_device_pixel_ratio:o,u_image:0,u_scale:[s,n.fromScale,n.toScale],u_fade:n.t,u_units_to_pixels:[1/a.pixelsToGLUnits[0],1/a.pixelsToGLUnits[1]],u_alpha_discard_threshold:0}};function Ki(e,t){return 1/z(e,1,t.tileZoom)}function Ji(e,t,i,n){return e.translatePosMatrix(n||t.tileID.projMatrix,t,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}function Qi(e){const t=e.paint.get("line-dasharray").value;return t.value||"constant"!==t.kind}const en=(e,t,i,n,r,o)=>{return{u_matrix:e,u_tl_parent:t,u_scale_parent:i,u_fade_t:n.mix,u_opacity:n.opacity*r.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:r.paint.get("raster-brightness-min"),u_brightness_high:r.paint.get("raster-brightness-max"),u_saturation_factor:(s=r.paint.get("raster-saturation"),s>0?1-1/(1.001-s):-s),u_contrast_factor:(a=r.paint.get("raster-contrast"),a>0?1/(1-a):1+a),u_spin_weights:tn(r.paint.get("raster-hue-rotate")),u_perspective_transform:o};var a,s};function tn(e){e*=Math.PI/180;const t=Math.sin(e),i=Math.cos(e);return[(2*i+1)/3,(-Math.sqrt(3)*t-i+1)/3,(Math.sqrt(3)*t-i+1)/3]}const nn=e.create(),rn=(t,i,n,r,o,a,s,l,c,u,h,d,p,f,m,g)=>{const _=o.transform,v={u_is_size_zoom_constant:+("constant"===t||"source"===t),u_is_size_feature_constant:+("constant"===t||"camera"===t),u_size_t:i?i.uSizeT:0,u_size:i?i.uSize:0,u_camera_to_center_distance:_.cameraToCenterDistance,u_rotate_symbol:+n,u_aspect_ratio:_.width/_.height,u_fade_change:o.options.fadeDuration?o.symbolFadeChange:1,u_matrix:a,u_label_plane_matrix:s,u_coord_matrix:l,u_is_text:+c,u_pitch_with_map:+r,u_texsize:u,u_texture:0,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:nn,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:nn,u_up_vector:[0,-1,0]};return"globe"===g.name&&(v.u_tile_id=[h.canonical.x,h.canonical.y,1<e.extend(rn(t,i,n,r,o,a,s,l,c,u,d,p,f,m,g,_),{u_gamma_scale:r?o.transform.cameraToCenterDistance*Math.cos(o.terrain?0:o.transform._pitch):1,u_device_pixel_ratio:e.exported.devicePixelRatio,u_is_halo:+h}),an=(t,i,n,r,o,a,s,l,c,u,h,d,p,f,m,g)=>e.extend(on(t,i,n,r,o,a,s,l,!0,c,!0,h,d,p,f,m,g),{u_texsize_icon:u,u_texture_icon:1}),sn=(e,t,i)=>({u_matrix:e,u_opacity:t,u_color:i}),ln=(t,i,n,r,o,a)=>e.extend(function(e,t,i,n){const r=i.imageManager.getPattern(e.from.toString()),o=i.imageManager.getPattern(e.to.toString()),{width:a,height:s}=i.imageManager.getPixelSize(),l=Math.pow(2,n.tileID.overscaledZ),c=n.tileSize*Math.pow(2,i.transform.tileZoom)/l,u=c*(n.tileID.canonical.x+n.tileID.wrap*l),h=c*n.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:r.tl,u_pattern_br_a:r.br,u_pattern_tl_b:o.tl,u_pattern_br_b:o.br,u_texsize:[a,s],u_mix:t.t,u_pattern_size_a:r.displaySize,u_pattern_size_b:o.displaySize,u_scale_a:t.fromScale,u_scale_b:t.toScale,u_tile_units_to_pixels:1/z(n,1,i.transform.tileZoom),u_pixel_coord_upper:[u>>16,h>>16],u_pixel_coord_lower:[65535&u,65535&h]}}(r,a,n,o),{u_matrix:t,u_opacity:i}),cn={fillExtrusion:t=>({u_matrix:new e.UniformMatrix4f(t),u_lightpos:new e.Uniform3f(t),u_lightintensity:new e.Uniform1f(t),u_lightcolor:new e.Uniform3f(t),u_vertical_gradient:new e.Uniform1f(t),u_opacity:new e.Uniform1f(t),u_edge_radius:new e.Uniform1f(t),u_ao:new e.Uniform2f(t),u_tile_id:new e.Uniform3f(t),u_zoom_transition:new e.Uniform1f(t),u_inv_rot_matrix:new e.UniformMatrix4f(t),u_merc_center:new e.Uniform2f(t),u_up_dir:new e.Uniform3f(t),u_height_lift:new e.Uniform1f(t)}),fillExtrusionPattern:t=>({u_matrix:new e.UniformMatrix4f(t),u_lightpos:new e.Uniform3f(t),u_lightintensity:new e.Uniform1f(t),u_lightcolor:new e.Uniform3f(t),u_vertical_gradient:new e.Uniform1f(t),u_height_factor:new e.Uniform1f(t),u_edge_radius:new e.Uniform1f(t),u_ao:new e.Uniform2f(t),u_tile_id:new e.Uniform3f(t),u_zoom_transition:new e.Uniform1f(t),u_inv_rot_matrix:new e.UniformMatrix4f(t),u_merc_center:new e.Uniform2f(t),u_up_dir:new e.Uniform3f(t),u_height_lift:new e.Uniform1f(t),u_image:new e.Uniform1i(t),u_texsize:new e.Uniform2f(t),u_pixel_coord_upper:new e.Uniform2f(t),u_pixel_coord_lower:new e.Uniform2f(t),u_scale:new e.Uniform3f(t),u_fade:new e.Uniform1f(t),u_opacity:new e.Uniform1f(t)}),fill:t=>({u_matrix:new e.UniformMatrix4f(t)}),fillPattern:t=>({u_matrix:new e.UniformMatrix4f(t),u_image:new e.Uniform1i(t),u_texsize:new e.Uniform2f(t),u_pixel_coord_upper:new e.Uniform2f(t),u_pixel_coord_lower:new e.Uniform2f(t),u_scale:new e.Uniform3f(t),u_fade:new e.Uniform1f(t)}),fillOutline:t=>({u_matrix:new e.UniformMatrix4f(t),u_world:new e.Uniform2f(t)}),fillOutlinePattern:t=>({u_matrix:new e.UniformMatrix4f(t),u_world:new e.Uniform2f(t),u_image:new e.Uniform1i(t),u_texsize:new e.Uniform2f(t),u_pixel_coord_upper:new e.Uniform2f(t),u_pixel_coord_lower:new e.Uniform2f(t),u_scale:new e.Uniform3f(t),u_fade:new e.Uniform1f(t)}),circle:t=>({u_camera_to_center_distance:new e.Uniform1f(t),u_extrude_scale:new e.UniformMatrix2f(t),u_device_pixel_ratio:new e.Uniform1f(t),u_matrix:new e.UniformMatrix4f(t),u_inv_rot_matrix:new e.UniformMatrix4f(t),u_merc_center:new e.Uniform2f(t),u_tile_id:new e.Uniform3f(t),u_zoom_transition:new e.Uniform1f(t),u_up_dir:new e.Uniform3f(t)}),collisionBox:t=>({u_matrix:new e.UniformMatrix4f(t),u_camera_to_center_distance:new e.Uniform1f(t),u_extrude_scale:new e.Uniform2f(t)}),collisionCircle:t=>({u_matrix:new e.UniformMatrix4f(t),u_inv_matrix:new e.UniformMatrix4f(t),u_camera_to_center_distance:new e.Uniform1f(t),u_viewport_size:new e.Uniform2f(t)}),debug:t=>({u_color:new e.UniformColor(t),u_matrix:new e.UniformMatrix4f(t),u_overlay:new e.Uniform1i(t),u_overlay_scale:new e.Uniform1f(t)}),clippingMask:t=>({u_matrix:new e.UniformMatrix4f(t)}),heatmap:t=>({u_extrude_scale:new e.Uniform1f(t),u_intensity:new e.Uniform1f(t),u_matrix:new e.UniformMatrix4f(t),u_inv_rot_matrix:new e.UniformMatrix4f(t),u_merc_center:new e.Uniform2f(t),u_tile_id:new e.Uniform3f(t),u_zoom_transition:new e.Uniform1f(t),u_up_dir:new e.Uniform3f(t)}),heatmapTexture:t=>({u_image:new e.Uniform1i(t),u_color_ramp:new e.Uniform1i(t),u_opacity:new e.Uniform1f(t)}),hillshade:t=>({u_matrix:new e.UniformMatrix4f(t),u_image:new e.Uniform1i(t),u_latrange:new e.Uniform2f(t),u_light:new e.Uniform2f(t),u_shadow:new e.UniformColor(t),u_highlight:new e.UniformColor(t),u_accent:new e.UniformColor(t)}),hillshadePrepare:t=>({u_matrix:new e.UniformMatrix4f(t),u_image:new e.Uniform1i(t),u_dimension:new e.Uniform2f(t),u_zoom:new e.Uniform1f(t),u_unpack:new e.Uniform4f(t)}),line:t=>({u_matrix:new e.UniformMatrix4f(t),u_pixels_to_tile_units:new e.UniformMatrix2f(t),u_device_pixel_ratio:new e.Uniform1f(t),u_units_to_pixels:new e.Uniform2f(t),u_dash_image:new e.Uniform1i(t),u_gradient_image:new e.Uniform1i(t),u_image_height:new e.Uniform1f(t),u_texsize:new e.Uniform2f(t),u_scale:new e.Uniform3f(t),u_mix:new e.Uniform1f(t),u_alpha_discard_threshold:new e.Uniform1f(t),u_trim_offset:new e.Uniform2f(t)}),linePattern:t=>({u_matrix:new e.UniformMatrix4f(t),u_texsize:new e.Uniform2f(t),u_pixels_to_tile_units:new e.UniformMatrix2f(t),u_device_pixel_ratio:new e.Uniform1f(t),u_image:new e.Uniform1i(t),u_units_to_pixels:new e.Uniform2f(t),u_scale:new e.Uniform3f(t),u_fade:new e.Uniform1f(t),u_alpha_discard_threshold:new e.Uniform1f(t)}),raster:t=>({u_matrix:new e.UniformMatrix4f(t),u_tl_parent:new e.Uniform2f(t),u_scale_parent:new e.Uniform1f(t),u_fade_t:new e.Uniform1f(t),u_opacity:new e.Uniform1f(t),u_image0:new e.Uniform1i(t),u_image1:new e.Uniform1i(t),u_brightness_low:new e.Uniform1f(t),u_brightness_high:new e.Uniform1f(t),u_saturation_factor:new e.Uniform1f(t),u_contrast_factor:new e.Uniform1f(t),u_spin_weights:new e.Uniform3f(t),u_perspective_transform:new e.Uniform2f(t)}),symbolIcon:t=>({u_is_size_zoom_constant:new e.Uniform1i(t),u_is_size_feature_constant:new e.Uniform1i(t),u_size_t:new e.Uniform1f(t),u_size:new e.Uniform1f(t),u_camera_to_center_distance:new e.Uniform1f(t),u_rotate_symbol:new e.Uniform1i(t),u_aspect_ratio:new e.Uniform1f(t),u_fade_change:new e.Uniform1f(t),u_matrix:new e.UniformMatrix4f(t),u_label_plane_matrix:new e.UniformMatrix4f(t),u_coord_matrix:new e.UniformMatrix4f(t),u_is_text:new e.Uniform1i(t),u_pitch_with_map:new e.Uniform1i(t),u_texsize:new e.Uniform2f(t),u_tile_id:new e.Uniform3f(t),u_zoom_transition:new e.Uniform1f(t),u_inv_rot_matrix:new e.UniformMatrix4f(t),u_merc_center:new e.Uniform2f(t),u_camera_forward:new e.Uniform3f(t),u_tile_matrix:new e.UniformMatrix4f(t),u_up_vector:new e.Uniform3f(t),u_ecef_origin:new e.Uniform3f(t),u_texture:new e.Uniform1i(t)}),symbolSDF:t=>({u_is_size_zoom_constant:new e.Uniform1i(t),u_is_size_feature_constant:new e.Uniform1i(t),u_size_t:new e.Uniform1f(t),u_size:new e.Uniform1f(t),u_camera_to_center_distance:new e.Uniform1f(t),u_rotate_symbol:new e.Uniform1i(t),u_aspect_ratio:new e.Uniform1f(t),u_fade_change:new e.Uniform1f(t),u_matrix:new e.UniformMatrix4f(t),u_label_plane_matrix:new e.UniformMatrix4f(t),u_coord_matrix:new e.UniformMatrix4f(t),u_is_text:new e.Uniform1i(t),u_pitch_with_map:new e.Uniform1i(t),u_texsize:new e.Uniform2f(t),u_texture:new e.Uniform1i(t),u_gamma_scale:new e.Uniform1f(t),u_device_pixel_ratio:new e.Uniform1f(t),u_tile_id:new e.Uniform3f(t),u_zoom_transition:new e.Uniform1f(t),u_inv_rot_matrix:new e.UniformMatrix4f(t),u_merc_center:new e.Uniform2f(t),u_camera_forward:new e.Uniform3f(t),u_tile_matrix:new e.UniformMatrix4f(t),u_up_vector:new e.Uniform3f(t),u_ecef_origin:new e.Uniform3f(t),u_is_halo:new e.Uniform1i(t)}),symbolTextAndIcon:t=>({u_is_size_zoom_constant:new e.Uniform1i(t),u_is_size_feature_constant:new e.Uniform1i(t),u_size_t:new e.Uniform1f(t),u_size:new e.Uniform1f(t),u_camera_to_center_distance:new e.Uniform1f(t),u_rotate_symbol:new e.Uniform1i(t),u_aspect_ratio:new e.Uniform1f(t),u_fade_change:new e.Uniform1f(t),u_matrix:new e.UniformMatrix4f(t),u_label_plane_matrix:new e.UniformMatrix4f(t),u_coord_matrix:new e.UniformMatrix4f(t),u_is_text:new e.Uniform1i(t),u_pitch_with_map:new e.Uniform1i(t),u_texsize:new e.Uniform2f(t),u_texsize_icon:new e.Uniform2f(t),u_texture:new e.Uniform1i(t),u_texture_icon:new e.Uniform1i(t),u_gamma_scale:new e.Uniform1f(t),u_device_pixel_ratio:new e.Uniform1f(t),u_is_halo:new e.Uniform1i(t)}),background:t=>({u_matrix:new e.UniformMatrix4f(t),u_opacity:new e.Uniform1f(t),u_color:new e.UniformColor(t)}),backgroundPattern:t=>({u_matrix:new e.UniformMatrix4f(t),u_opacity:new e.Uniform1f(t),u_image:new e.Uniform1i(t),u_pattern_tl_a:new e.Uniform2f(t),u_pattern_br_a:new e.Uniform2f(t),u_pattern_tl_b:new e.Uniform2f(t),u_pattern_br_b:new e.Uniform2f(t),u_texsize:new e.Uniform2f(t),u_mix:new e.Uniform1f(t),u_pattern_size_a:new e.Uniform2f(t),u_pattern_size_b:new e.Uniform2f(t),u_scale_a:new e.Uniform1f(t),u_scale_b:new e.Uniform1f(t),u_pixel_coord_upper:new e.Uniform2f(t),u_pixel_coord_lower:new e.Uniform2f(t),u_tile_units_to_pixels:new e.Uniform1f(t)}),terrainRaster:xi,terrainDepth:xi,skybox:t=>({u_matrix:new e.UniformMatrix4f(t),u_sun_direction:new e.Uniform3f(t),u_cubemap:new e.Uniform1i(t),u_opacity:new e.Uniform1f(t),u_temporal_offset:new e.Uniform1f(t)}),skyboxGradient:t=>({u_matrix:new e.UniformMatrix4f(t),u_color_ramp:new e.Uniform1i(t),u_center_direction:new e.Uniform3f(t),u_radius:new e.Uniform1f(t),u_opacity:new e.Uniform1f(t),u_temporal_offset:new e.Uniform1f(t)}),skyboxCapture:t=>({u_matrix_3f:new e.UniformMatrix3f(t),u_sun_direction:new e.Uniform3f(t),u_sun_intensity:new e.Uniform1f(t),u_color_tint_r:new e.Uniform4f(t),u_color_tint_m:new e.Uniform4f(t),u_luminance:new e.Uniform1f(t)}),globeRaster:t=>({u_proj_matrix:new e.UniformMatrix4f(t),u_globe_matrix:new e.UniformMatrix4f(t),u_normalize_matrix:new e.UniformMatrix4f(t),u_merc_matrix:new e.UniformMatrix4f(t),u_zoom_transition:new e.Uniform1f(t),u_merc_center:new e.Uniform2f(t),u_image0:new e.Uniform1i(t),u_grid_matrix:new e.UniformMatrix3f(t),u_frustum_tl:new e.Uniform3f(t),u_frustum_tr:new e.Uniform3f(t),u_frustum_br:new e.Uniform3f(t),u_frustum_bl:new e.Uniform3f(t),u_globe_pos:new e.Uniform3f(t),u_globe_radius:new e.Uniform1f(t),u_viewport:new e.Uniform2f(t)}),globeAtmosphere:t=>({u_frustum_tl:new e.Uniform3f(t),u_frustum_tr:new e.Uniform3f(t),u_frustum_br:new e.Uniform3f(t),u_frustum_bl:new e.Uniform3f(t),u_horizon:new e.Uniform1f(t),u_transition:new e.Uniform1f(t),u_fadeout_range:new e.Uniform1f(t),u_color:new e.Uniform4f(t),u_high_color:new e.Uniform4f(t),u_space_color:new e.Uniform4f(t),u_star_intensity:new e.Uniform1f(t),u_star_density:new e.Uniform1f(t),u_star_size:new e.Uniform1f(t),u_temporal_offset:new e.Uniform1f(t),u_horizon_angle:new e.Uniform1f(t),u_rotation_matrix:new e.UniformMatrix4f(t)})};let un;function hn(t,i,n,r,o,a,s){const l=t.context,c=l.gl,u=t.transform,h=t.useProgram("collisionBox"),d=[];let p=0,f=0;for(let m=0;m0){const t=e.create(),i=x;e.mul(t,v.placementInvProjMatrix,u.glCoordMatrix),e.mul(t,t,v.placementViewportMatrix),d.push({circleArray:w,circleOffset:f,transform:i,invTransform:t,projection:v.getProjection()}),p+=w.length/4,f=p}b&&(t.terrain&&t.terrain.setupElevationDraw(_,h),h.draw(l,c.LINES,e.DepthMode.disabled,e.StencilMode.disabled,t.colorModeForRenderPass(),e.CullFaceMode.disabled,qi(x,u,_,v.getProjection()),n.id,b.layoutVertexBuffer,b.indexBuffer,b.segments,null,u.zoom,null,[b.collisionVertexBuffer,b.collisionVertexBufferExt]))}if(!s||!d.length)return;const m=t.useProgram("collisionCircle"),g=new e.StructArrayLayout2f1f2i16;g.resize(4*p),g._trim();let _=0;for(const e of d)for(let t=0;t=0&&(m[y.associatedIconIndex]={shiftedAnchor:I,angle:P})}else gt(y.numGlyphs,p)}if(h){f.clear();const i=t.icon.placedSymbolArray;for(let t=0;t[0,0,0],n=it(j,r.tileID.canonical,_,g,m,c.getProjection(),N);lt(c,j,t,o,n,G,_,u,i,l)}const Z=v||o&&C||W,H=t.translatePosMatrix(j,r,a,s),X=Z?dn:U,Y=t.translatePosMatrix(G,r,a,s,!0),K=c.getProjection().createInversionMatrix(m,l.canonical),J=[];t.terrainRenderModeElevated()&&_&&J.push("PITCH_WITH_MAP_TERRAIN"),B&&J.push("PROJECTION_GLOBE_VIEW"),Z&&J.push("PROJECTED_POS_ON_VIEWPORT");const Q=p&&0!==n.paint.get(o?"text-halo-width":"icon-halo-width").constantOr(1);let ee;ee=p?c.iconsInText?an(w.kind,I,y,_,t,H,X,Y,P,L,l,$,T,K,F,c.getProjection()):on(w.kind,I,y,_,t,H,X,Y,o,P,!0,l,$,T,K,F,c.getProjection()):rn(w.kind,I,y,_,t,H,X,Y,o,P,l,$,T,K,F,c.getProjection());const te={program:t.useProgram(mn(p,o,c),d,J),buffers:h,uniformValues:ee,atlasTexture:D,atlasTextureIcon:R,atlasInterpolation:z,atlasInterpolationIcon:O,isSDF:p,hasHalo:Q,tile:r,labelPlaneMatrixInv:V};if(x&&c.canOverlap){b=!0;const t=h.segments.get();for(const i of t)E.push({segments:new e.SegmentVector([i]),sortKey:i.sortKey,state:te})}else E.push({segments:h.segments,sortKey:0,state:te})}b&&E.sort(((e,t)=>e.sortKey-t.sortKey));for(const e of E){const i=e.state;if(t.terrain&&t.terrain.setupElevationDraw(i.tile,i.program,{useDepthForOcclusion:!S,labelPlaneMatrixInv:i.labelPlaneMatrixInv}),p.activeTexture.set(f.TEXTURE0),i.atlasTexture.bind(i.atlasInterpolation,f.CLAMP_TO_EDGE),i.atlasTextureIcon&&(p.activeTexture.set(f.TEXTURE1),i.atlasTextureIcon&&i.atlasTextureIcon.bind(i.atlasInterpolationIcon,f.CLAMP_TO_EDGE)),i.isSDF){const r=i.uniformValues;i.hasHalo&&(r.u_is_halo=1,_n(i.buffers,e.segments,n,t,i.program,w,h,d,r)),r.u_is_halo=0}_n(i.buffers,e.segments,n,t,i.program,w,h,d,i.uniformValues)}}function _n(t,i,n,r,o,a,s,l,c){const u=r.context,h=[t.dynamicLayoutVertexBuffer,t.opacityVertexBuffer,t.globeExtVertexBuffer];o.draw(u,u.gl.TRIANGLES,a,s,l,e.CullFaceMode.disabled,c,n.id,t.layoutVertexBuffer,t.indexBuffer,i,n.paint,r.transform.zoom,t.programConfigurations.get(n.id),h)}function vn(t,i,n,r,o,a,s){const l=t.context.gl,c=n.paint.get("fill-pattern"),u=c&&c.constantOr(1),h=n.getCrossfadeParameters();let d,p,f,m,g;s?(p=u&&!n.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",d=l.LINES):(p=u?"fillPattern":"fill",d=l.TRIANGLES);for(const _ of r){const r=i.getTile(_);if(u&&!r.patternsLoaded())continue;const v=r.getBucket(n);if(!v)continue;t.prepareDrawTile();const y=v.programConfigurations.get(n.id),x=t.useProgram(p,y);u&&(t.context.activeTexture.set(l.TEXTURE0),r.imageAtlasTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),y.updatePaintBuffers(h));const b=c.constantOr(null);if(b&&r.imageAtlas){const e=r.imageAtlas,t=e.patternPositions[b.to.toString()],i=e.patternPositions[b.from.toString()];t&&i&&y.setConstantPatternPositions(t,i)}const w=t.translatePosMatrix(_.projMatrix,r,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor"));if(s){m=v.indexBuffer2,g=v.segments2;const e=t.terrain&&t.terrain.renderingToTexture?t.terrain.drapeBufferSize:[l.drawingBufferWidth,l.drawingBufferHeight];f="fillOutlinePattern"===p&&u?Ni(w,t,h,r,e):ji(w,e)}else m=v.indexBuffer,g=v.segments,f=u?$i(w,t,h,r):Fi(w);t.prepareDrawProgram(t.context,x,_.toUnwrapped()),x.draw(t.context,d,o,t.stencilModeForClipping(_),a,e.CullFaceMode.disabled,f,n.id,v.layoutVertexBuffer,m,g,n.paint,t.transform.zoom,y)}}function yn(t,i,n,r,o,a,s){const l=t.context,c=l.gl,u=t.transform,h=n.paint.get("fill-extrusion-pattern"),d=h.constantOr(1),p=n.getCrossfadeParameters(),f=n.paint.get("fill-extrusion-opacity"),m=[n.paint.get("fill-extrusion-ambient-occlusion-intensity"),n.paint.get("fill-extrusion-ambient-occlusion-radius")],g=n.layout.get("fill-extrusion-edge-radius"),_="globe"===u.projection.name?e.fillExtrusionHeightLift():0,v="globe"===u.projection.name,y=v?e.globeToMercatorTransition(u.zoom):0,x=[e.mercatorXfromLng(u.center.lng),e.mercatorYfromLat(u.center.lat)],b=[];v&&(b.push("PROJECTION_GLOBE_VIEW"),t.style.terrainSetForDrapingOnly()&&b.push("TERRAIN")),m[0]>0&&b.push("FAUX_AO");for(const w of r){const r=i.getTile(w),T=r.getBucket(n);if(!T||T.projection.name!==u.projection.name)continue;const C=T.programConfigurations.get(n.id),S=t.useProgram(d?"fillExtrusionPattern":"fillExtrusion",C,b);if(t.terrain){const e=t.terrain;if(t.style.terrainSetForDrapingOnly())e.setupElevationDraw(r,S,{useMeterToDem:!0});else{if(!T.enableTerrain)continue;if(e.setupElevationDraw(r,S,{useMeterToDem:!0}),xn(l,i,w,T,n,e),!T.centroidVertexBuffer){const e=S.attributes.a_centroid_pos;void 0!==e&&c.vertexAttrib2f(e,0,0)}}}d&&(t.context.activeTexture.set(c.TEXTURE0),r.imageAtlasTexture.bind(c.LINEAR,c.CLAMP_TO_EDGE),C.updatePaintBuffers(p));const E=h.constantOr(null);if(E&&r.imageAtlas){const e=r.imageAtlas,t=e.patternPositions[E.to.toString()],i=e.patternPositions[E.from.toString()];t&&i&&C.setConstantPatternPositions(t,i)}const k=t.translatePosMatrix(w.projMatrix,r,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),A=u.projection.createInversionMatrix(u,w.canonical),M=n.paint.get("fill-extrusion-vertical-gradient"),I=d?Bi(k,t,M,f,m,g,w,p,r,_,y,x,A):Ri(k,t,M,f,m,g,w,_,y,x,A);t.prepareDrawProgram(l,S,w.toUnwrapped());const P=[];t.terrain&&P.push(T.centroidVertexBuffer),v&&P.push(T.layoutVertexExtBuffer),S.draw(l,l.gl.TRIANGLES,o,a,s,e.CullFaceMode.backCCW,I,n.id,T.layoutVertexBuffer,T.indexBuffer,T.segments,n.paint,t.transform.zoom,C,P)}}function xn(t,i,n,r,o,a){const s=[t=>{let i=t.canonical.x-1,n=t.wrap;return i<0&&(i=(1<{let i=t.canonical.x+1,n=t.wrap;return i===1<new e.OverscaledTileID(t.overscaledZ,t.wrap,t.canonical.z,t.canonical.x,(0===t.canonical.y?1<new e.OverscaledTileID(t.overscaledZ,t.wrap,t.canonical.z,t.canonical.x,t.canonical.y===(1<{const t=i.getSource().minzoom,n=e=>{const t=i.getTileByID(e);if(t&&t.hasData())return t.getBucket(o)},r=[0,-1,1];for(const i of r){if(e.overscaledZ+i(c[0]=Math.min(t.min.y,i.min.y),c[1]=Math.max(t.max.y,i.max.y),c[2]=e.EXTENT-i.min.x>t.max.x?i.min.x-e.EXTENT:t.max.x,c),h=(t,i)=>(c[0]=Math.min(t.min.x,i.min.x),c[1]=Math.max(t.max.x,i.max.x),c[2]=e.EXTENT-i.min.y>t.max.y?i.min.y-e.EXTENT:t.max.y,c),d=[(e,t)=>u(e,t),(e,t)=>u(t,e),(e,t)=>h(e,t),(e,t)=>h(t,e)],p=new e.pointGeometry(0,0);let f,m,g;const _=(t,i,r,o,s)=>{const l=[[o?r:t,o?t:r,0],[o?r:i,o?i:r,0]],c=s<0?e.EXTENT+s:s,u=[o?c:(t+i)/2,o?(t+i)/2:c,0];return 0===r&&s<0||0!==r&&s>0?a.getForTilePoints(g,[u],!0,m):l.push(u),a.getForTilePoints(n,l,!0,f),Math.max(l[0][2],l[1][2],u[2])/a.exaggeration()};for(let t=0;t<4;t++){const i=(t<2?1:5)-t,o=r.borders[t];if(0===o.length)continue;const c=g=s[t](n),u=l(c);if(!(u&&u instanceof e.FillExtrusionBucket&&u.enableTerrain))continue;if(r.borderDoneWithNeighborZ[t]===u.canonical.z&&u.borderDoneWithNeighborZ[i]===r.canonical.z)continue;if(m=a.findDEMTileFor(c),!m||!m.dem)continue;if(!f){const e=a.findDEMTileFor(n);if(!e||!e.dem)return;f=e}const h=u.borders[i];let v=0;const y=u.borderDoneWithNeighborZ[i]!==r.canonical.z;if(r.canonical.z===u.canonical.z){for(let n=0;ns[0]+3));)y&&u.encodeCentroid(void 0,l,!1),v++;if(l&&vs[1]-3)&&(o++,++v!==h.length);)l=u.featuresOnBorder[h[v]];if(l=u.featuresOnBorder[h[n]],a.intersectsCount()>1||l.intersectsCount()>1||1!==o){1!==o&&(v=n),r.encodeCentroid(void 0,a,!1),y&&u.encodeCentroid(void 0,l,!1);continue}const c=d[t](a,l),f=t%2?e.EXTENT-1:0;p.x=_(c[0],Math.min(e.EXTENT-1,c[1]),f,t<2,c[2]),p.y=0,r.encodeCentroid(p,a,!1),y&&u.encodeCentroid(p,l,!1)}else r.encodeCentroid(void 0,a,!1)}r.borderDoneWithNeighborZ[t]=u.canonical.z,r.needsCentroidUpdate=!0,y&&(u.borderDoneWithNeighborZ[i]=r.canonical.z,u.needsCentroidUpdate=!0)}else{for(const e of o)r.encodeCentroid(void 0,r.featuresOnBorder[e],!1);if(y){for(const e of h)u.encodeCentroid(void 0,u.featuresOnBorder[e],!1);u.borderDoneWithNeighborZ[i]=r.canonical.z,u.needsCentroidUpdate=!0}r.borderDoneWithNeighborZ[t]=u.canonical.z,r.needsCentroidUpdate=!0}}(r.needsCentroidUpdate||!r.centroidVertexBuffer&&0!==r.centroidVertexArray.length)&&r.uploadCentroid(t)}const bn=new e.Color(1,0,0,1),wn=new e.Color(0,1,0,1),Tn=new e.Color(0,0,1,1),Cn=new e.Color(1,0,1,1),Sn=new e.Color(0,1,1,1);function En(t,i,n){const r=t.context,o=t.transform,a=r.gl,s="globe"===o.projection.name,l=s?["PROJECTION_GLOBE_VIEW"]:null;let c=n.projMatrix;if(s&&e.globeToMercatorTransition(o.zoom)>0){const t=e.transitionTileAABBinECEF(n.canonical,o),i=e.globeDenormalizeECEF(t);c=e.multiply(new Float32Array(16),o.globeMatrix,i),e.multiply(c,o.projMatrix,c)}const u=t.useProgram("debug",null,l),h=i.getTileByID(n.key);t.terrain&&t.terrain.setupElevationDraw(h,u);const d=e.DepthMode.disabled,p=e.StencilMode.disabled,f=t.colorModeForRenderPass(),m="$debug";r.activeTexture.set(a.TEXTURE0),t.emptyTexture.bind(a.LINEAR,a.CLAMP_TO_EDGE),s?h._makeGlobeTileDebugBuffers(t.context,o):h._makeDebugTileBoundsBuffers(t.context,o.projection);const g=h._tileDebugBuffer||t.debugBuffer,_=h._tileDebugIndexBuffer||t.debugIndexBuffer,v=h._tileDebugSegments||t.debugSegments;u.draw(r,a.LINE_STRIP,d,p,f,e.CullFaceMode.disabled,Wi(c,e.Color.red),m,g,_,v,null,null,null,[h._globeTileDebugBorderBuffer]);const y=h.latestRawTileData,x=Math.floor((y&&y.byteLength||0)/1024),b=i.getTile(n).tileSize,w=512/Math.min(b,512)*(n.overscaledZ/o.zoom)*.5;let T=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(T+=` => ${n.overscaledZ}`),T+=` ${x}kb`,function(e,t){e.initDebugOverlayCanvas();const i=e.debugOverlayCanvas,n=e.context.gl,r=e.debugOverlayCanvas.getContext("2d");r.clearRect(0,0,i.width,i.height),r.shadowColor="white",r.shadowBlur=2,r.lineWidth=1.5,r.strokeStyle="white",r.textBaseline="top",r.font="bold 36px Open Sans, sans-serif",r.fillText(t,5,5),r.strokeText(t,5,5),e.debugOverlayTexture.update(i),e.debugOverlayTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}(t,T);const C=h._tileDebugTextBuffer||t.debugBuffer,S=h._tileDebugTextIndexBuffer||t.quadTriangleIndexBuffer,E=h._tileDebugTextSegments||t.debugSegments;u.draw(r,a.TRIANGLES,d,p,e.ColorMode.alphaBlended,e.CullFaceMode.disabled,Wi(c,e.Color.transparent,w),m,C,S,E,null,null,null,[h._globeTileDebugTextBuffer])}function kn(e,t,i,n){Mn(e,0,t+i/2,e.transform.width,i,n)}function An(e,t,i,n){Mn(e,t-i/2,0,i,e.transform.height,n)}function Mn(t,i,n,r,o,a){const s=t.context,l=s.gl;l.enable(l.SCISSOR_TEST),l.scissor(i*e.exported.devicePixelRatio,n*e.exported.devicePixelRatio,r*e.exported.devicePixelRatio,o*e.exported.devicePixelRatio),s.clear({color:a}),l.disable(l.SCISSOR_TEST)}const In=e.createLayout([{name:"a_pos_3f",components:3,type:"Float32"}]),{members:Pn}=In;function Dn(e,t,i,n){e.emplaceBack(t,i,n)}class zn{constructor(t){this.vertexArray=new e.StructArrayLayout3f12,this.indices=new e.StructArrayLayout3ui6,Dn(this.vertexArray,-1,-1,1),Dn(this.vertexArray,1,-1,1),Dn(this.vertexArray,-1,1,1),Dn(this.vertexArray,1,1,1),Dn(this.vertexArray,-1,-1,-1),Dn(this.vertexArray,1,-1,-1),Dn(this.vertexArray,-1,1,-1),Dn(this.vertexArray,1,1,-1),this.indices.emplaceBack(5,1,3),this.indices.emplaceBack(3,7,5),this.indices.emplaceBack(6,2,0),this.indices.emplaceBack(0,4,6),this.indices.emplaceBack(2,6,7),this.indices.emplaceBack(7,3,2),this.indices.emplaceBack(5,4,0),this.indices.emplaceBack(0,1,5),this.indices.emplaceBack(0,2,3),this.indices.emplaceBack(3,1,0),this.indices.emplaceBack(7,6,4),this.indices.emplaceBack(4,5,7),this.vertexBuffer=t.createVertexBuffer(this.vertexArray,Pn),this.indexBuffer=t.createIndexBuffer(this.indices),this.segment=e.SegmentVector.simpleSegment(0,0,36,12)}}function On(t,i,n,r,o,a){const s=t.gl,l=i.paint.get("sky-atmosphere-color"),c=i.paint.get("sky-atmosphere-halo-color"),u=i.paint.get("sky-atmosphere-sun-intensity"),h=((e,t,i,n,r)=>({u_matrix_3f:e,u_sun_direction:t,u_sun_intensity:i,u_color_tint_r:[n.r,n.g,n.b,n.a],u_color_tint_m:[r.r,r.g,r.b,r.a],u_luminance:5e-5}))(e.fromMat4(e.create$1(),r),o,u,l,c);s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.TEXTURE_CUBE_MAP_POSITIVE_X+a,i.skyboxTexture,0),n.draw(t,s.TRIANGLES,e.DepthMode.disabled,e.StencilMode.disabled,e.ColorMode.unblended,e.CullFaceMode.frontCW,h,"skyboxCapture",i.skyboxGeometry.vertexBuffer,i.skyboxGeometry.indexBuffer,i.skyboxGeometry.segment)}const Ln=e.createLayout([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]);class Rn{constructor(t){const i=new e.StructArrayLayout5f20;i.emplaceBack(-1,1,1,0,0),i.emplaceBack(1,1,1,1,0),i.emplaceBack(1,-1,1,1,1),i.emplaceBack(-1,-1,1,0,1);const n=new e.StructArrayLayout3ui6;n.emplaceBack(0,1,2),n.emplaceBack(2,3,0),this.vertexBuffer=t.createVertexBuffer(i,Ln.members),this.indexBuffer=t.createIndexBuffer(n),this.segments=e.SegmentVector.simpleSegment(0,0,4,2)}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy()}}const Bn={symbol:function(t,i,n,r,o){if("translucent"!==t.renderPass)return;const a=e.StencilMode.disabled,s=t.colorModeForRenderPass();n.layout.get("text-variable-anchor")&&function(t,i,n,r,o,a,s){const l=i.transform,c="map"===o,u="map"===a;for(const i of t){const t=r.getTile(i),o=t.getBucket(n);if(!o||!o.text||!o.text.segments.get().length)continue;const a=e.evaluateSizeForZoom(o.textSizeData,l.zoom),h=wt(i,o.getProjection(),l),d=l.calculatePixelsToTileUnitsMatrix(t),p=tt(h,t.tileID.canonical,u,c,l,o.getProjection(),d),f="none"!==n.layout.get("icon-text-fit")&&o.hasIconData();if(a){const n=Math.pow(2,l.zoom-t.tileID.overscaledZ);fn(o,c,u,s,e.symbolSize,l,p,i,n,a,f)}}}(r,t,n,i,n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),o),0!==n.paint.get("icon-opacity").constantOr(1)&&gn(t,i,n,r,!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)&&gn(t,i,n,r,!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),i.map.showCollisionBoxes&&(hn(t,i,n,r,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),!0),hn(t,i,n,r,n.paint.get("icon-translate"),n.paint.get("icon-translate-anchor"),!1))},circle:function(t,i,n,r){if("translucent"!==t.renderPass)return;const o=n.paint.get("circle-opacity"),a=n.paint.get("circle-stroke-width"),s=n.paint.get("circle-stroke-opacity"),l=void 0!==n.layout.get("circle-sort-key").constantOr(1);if(0===o.constantOr(1)&&(0===a.constantOr(1)||0===s.constantOr(1)))return;const c=t.context,u=c.gl,h=t.transform,d=t.depthModeForSublayer(0,e.DepthMode.ReadOnly),p=e.StencilMode.disabled,f=t.colorModeForRenderPass(),m="globe"===h.projection.name,g=[e.mercatorXfromLng(h.center.lng),e.mercatorYfromLat(h.center.lat)],_=[];for(let o=0;oe.sortKey-t.sortKey));const v={useDepthForOcclusion:!m};for(const i of _){const{programConfiguration:r,program:o,layoutVertexBuffer:a,globeExtVertexBuffer:s,indexBuffer:l,uniformValues:m,tile:g}=i.state,_=i.segments;t.terrain&&t.terrain.setupElevationDraw(g,o,v),t.prepareDrawProgram(c,o,g.tileID.toUnwrapped()),o.draw(c,u.TRIANGLES,d,p,f,e.CullFaceMode.disabled,m,n.id,a,l,_,n.paint,h.zoom,r,[s])}},heatmap:function(t,i,n,r){if(0!==n.paint.get("heatmap-opacity"))if("offscreen"===t.renderPass){const o=t.context,a=o.gl,s=e.StencilMode.disabled,l=new e.ColorMode([a.ONE,a.ONE],e.Color.transparent,[!0,!0,!0,!0]);!function(e,t,i,n){const r=e.gl,o=t.width*n,a=t.height*n;e.activeTexture.set(r.TEXTURE1),e.viewport.set([0,0,o,a]);let s=i.heatmapFbo;if(!s||s&&(s.width!==o||s.height!==a)){s&&s.destroy();const t=r.createTexture();r.bindTexture(r.TEXTURE_2D,t),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR),s=i.heatmapFbo=e.createFramebuffer(o,a,!1),function(e,t,i,n,r,o){const a=e.gl;a.texImage2D(a.TEXTURE_2D,0,a.RGBA,r,o,0,a.RGBA,e.extRenderToTextureHalfFloat?e.extTextureHalfFloat.HALF_FLOAT_OES:a.UNSIGNED_BYTE,null),n.colorAttachment.set(i)}(e,0,t,s,o,a)}else r.bindTexture(r.TEXTURE_2D,s.colorAttachment.get()),e.bindFramebuffer.set(s.framebuffer)}(o,t,n,"globe"===t.transform.projection.name?.5:.25),o.clear({color:e.Color.transparent});const c=t.transform,u="globe"===c.projection.name,h=u?["PROJECTION_GLOBE_VIEW"]:null,d=u?e.CullFaceMode.frontCCW:e.CullFaceMode.disabled,p=[e.mercatorXfromLng(c.center.lng),e.mercatorYfromLat(c.center.lat)];for(let f=0;f({u_image:0,u_color_ramp:1,u_opacity:t.paint.get("heatmap-opacity")}))(0,i),i.id,t.viewportBuffer,t.quadTriangleIndexBuffer,t.viewportSegments,i.paint,t.transform.zoom)}(t,n))},line:function(t,i,n,r){if("translucent"!==t.renderPass)return;const o=n.paint.get("line-opacity"),a=n.paint.get("line-width");if(0===o.constantOr(1)||0===a.constantOr(1))return;const s=t.depthModeForSublayer(0,e.DepthMode.ReadOnly),l=t.colorModeForRenderPass(),c=t.terrain&&t.terrain.renderingToTexture?1:e.exported.devicePixelRatio,u=n.paint.get("line-dasharray"),h=u.constantOr(1),d=n.layout.get("line-cap"),p=n.paint.get("line-pattern"),f=p.constantOr(1),m=n.paint.get("line-gradient"),g=n.getCrossfadeParameters(),_=f?"linePattern":"line",v=t.context,y=v.gl,x=(e=>{const t=[];Qi(e)&&t.push("RENDER_LINE_DASH"),e.paint.get("line-gradient")&&t.push("RENDER_LINE_GRADIENT");const i=e.paint.get("line-trim-offset");0===i[0]&&0===i[1]||t.push("RENDER_LINE_TRIM_OFFSET");const n=e.paint.get("line-pattern").constantOr(1),r=1!==e.paint.get("line-opacity").constantOr(1);return!n&&r&&t.push("RENDER_LINE_ALPHA_DISCARD"),t})(n);let b=x.includes("RENDER_LINE_ALPHA_DISCARD");t.terrain&&t.terrain.clipOrMaskOverlapStencilType()&&(b=!1);for(const o of r){const r=i.getTile(o);if(f&&!r.patternsLoaded())continue;const a=r.getBucket(n);if(!a)continue;t.prepareDrawTile();const w=a.programConfigurations.get(n.id),T=t.useProgram(_,w,x),C=p.constantOr(null);if(C&&r.imageAtlas){const e=r.imageAtlas,t=e.patternPositions[C.to.toString()],i=e.patternPositions[C.from.toString()];t&&i&&w.setConstantPatternPositions(t,i)}const S=u.constantOr(null),E=d.constantOr(null);if(!f&&S&&E&&r.lineAtlas){const e=r.lineAtlas,t=e.getDash(S.to,E),i=e.getDash(S.from,E);t&&i&&w.setConstantPatternPositions(t,i)}let[k,A]=n.paint.get("line-trim-offset");if("round"===E||"square"===E){const e=1;k!==A&&(0===k&&(k-=e),1===A&&(A+=e))}const M=t.terrain?o.projMatrix:null,I=f?Yi(t,r,n,g,M,c):Xi(t,r,n,g,M,a.lineClipsArray.length,c,[k,A]);if(m){const r=a.gradients[n.id];let s=r.texture;if(n.gradientVersion!==r.version){let l=256;if(n.stepInterpolant){const n=i.getSource().maxzoom,r=o.canonical.z===n?Math.ceil(1<{T.draw(v,y.TRIANGLES,s,i,l,e.CullFaceMode.disabled,I,n.id,a.layoutVertexBuffer,a.indexBuffer,a.segments,n.paint,t.transform.zoom,w,[a.layoutVertexBuffer2])};if(b){const i=t.stencilModeForClipping(o).ref;0===i&&t.terrain&&v.clear({stencil:0});const n={func:y.EQUAL,mask:255};I.u_alpha_discard_threshold=.8,P(new e.StencilMode(n,i,255,y.KEEP,y.KEEP,y.INVERT)),I.u_alpha_discard_threshold=0,P(new e.StencilMode(n,i,255,y.KEEP,y.KEEP,y.KEEP))}else P(t.stencilModeForClipping(o))}b&&(t.resetStencilClippingMasks(),t.terrain&&v.clear({stencil:0}))},fill:function(t,i,n,r){const o=n.paint.get("fill-color"),a=n.paint.get("fill-opacity");if(0===a.constantOr(1))return;const s=t.colorModeForRenderPass(),l=n.paint.get("fill-pattern"),c=t.opaquePassEnabledForLayer()&&!l.constantOr(1)&&1===o.constantOr(e.Color.transparent).a&&1===a.constantOr(0)?"opaque":"translucent";if(t.renderPass===c){const o=t.depthModeForSublayer(1,"opaque"===t.renderPass?e.DepthMode.ReadWrite:e.DepthMode.ReadOnly);vn(t,i,n,r,o,s,!1)}if("translucent"===t.renderPass&&n.paint.get("fill-antialias")){const o=t.depthModeForSublayer(n.getPaintProperty("fill-outline-color")?2:0,e.DepthMode.ReadOnly);vn(t,i,n,r,o,s,!0)}},"fill-extrusion":function(t,i,n,r){const o=n.paint.get("fill-extrusion-opacity");if(0!==o&&"translucent"===t.renderPass){const a=new e.DepthMode(t.context.gl.LEQUAL,e.DepthMode.ReadWrite,t.depthRangeFor3D);if(1!==o||n.paint.get("fill-extrusion-pattern").constantOr(1))yn(t,i,n,r,a,e.StencilMode.disabled,e.ColorMode.disabled),yn(t,i,n,r,a,t.stencilModeFor3D(),t.colorModeForRenderPass()),t.resetStencilClippingMasks();else{const o=t.colorModeForRenderPass();yn(t,i,n,r,a,e.StencilMode.disabled,o)}}},hillshade:function(t,i,n,r){if("offscreen"!==t.renderPass&&"translucent"!==t.renderPass)return;const o=t.context,a=t.depthModeForSublayer(0,e.DepthMode.ReadOnly),s=t.colorModeForRenderPass(),l=t.terrain&&t.terrain.renderingToTexture,[c,u]="translucent"!==t.renderPass||l?[{},r]:t.stencilConfigForOverlap(r);for(const r of u){const o=i.getTile(r);if(o.needsHillshadePrepare&&"offscreen"===t.renderPass)yi(t,o,n,a,e.StencilMode.disabled,s);else if("translucent"===t.renderPass){const e=l&&t.terrain?t.terrain.stencilModeForRTTOverlap(r):c[r.overscaledZ];_i(t,r,o,n,a,e,s)}}o.viewport.set([0,0,t.width,t.height]),t.resetStencilClippingMasks()},raster:function(t,i,n,r,o,a){if("translucent"!==t.renderPass)return;if(0===n.paint.get("raster-opacity"))return;if(!r.length)return;const s=t.context,l=s.gl,c=i.getSource(),u=t.useProgram("raster"),h=t.colorModeForRenderPass(),d=t.terrain&&t.terrain.renderingToTexture,[p,f]=c instanceof Ie||d?[{},r]:t.stencilConfigForOverlap(r),m=f[f.length-1].overscaledZ,g=!t.options.moving;for(const r of f){const o=d?e.DepthMode.disabled:t.depthModeForSublayer(r.overscaledZ-m,1===n.paint.get("raster-opacity")?e.DepthMode.ReadWrite:e.DepthMode.ReadOnly,l.LESS),f=r.toUnwrapped(),_=i.getTile(r);if(d&&(!_||!_.hasData()))continue;const v=d?r.projMatrix:t.transform.calculateProjMatrix(f,g),y=t.terrain&&d?t.terrain.stencilModeForRTTOverlap(r):p[r.overscaledZ],x=a?0:n.paint.get("raster-fade-duration");_.registerFadeDuration(x);const b=i.findLoadedParent(r,0),w=Ai(_,b,i,t.transform,x);let T,C;t.terrain&&t.terrain.prepareDrawTile();const S="nearest"===n.paint.get("raster-resampling")?l.NEAREST:l.LINEAR;s.activeTexture.set(l.TEXTURE0),_.texture.bind(S,l.CLAMP_TO_EDGE),s.activeTexture.set(l.TEXTURE1),b?(b.texture.bind(S,l.CLAMP_TO_EDGE),T=Math.pow(2,b.tileID.overscaledZ-_.tileID.overscaledZ),C=[_.tileID.canonical.x*T%1,_.tileID.canonical.y*T%1]):_.texture.bind(S,l.CLAMP_TO_EDGE);const E=en(v,C||[0,0],T||1,w,n,c instanceof Ie?c.perspectiveTransform:[0,0]);if(t.prepareDrawProgram(s,u,f),c instanceof Ie)c.boundsBuffer&&c.boundsSegments&&u.draw(s,l.TRIANGLES,o,e.StencilMode.disabled,h,e.CullFaceMode.disabled,E,n.id,c.boundsBuffer,t.quadTriangleIndexBuffer,c.boundsSegments);else{const{tileBoundsBuffer:i,tileBoundsIndexBuffer:r,tileBoundsSegments:a}=t.getTileBoundsBuffers(_);u.draw(s,l.TRIANGLES,o,y,h,e.CullFaceMode.disabled,E,n.id,i,r,a)}}t.resetStencilClippingMasks()},background:function(t,i,n,r){const o=n.paint.get("background-color"),a=n.paint.get("background-opacity");if(0===a)return;const s=t.context,l=s.gl,c=t.transform,u=c.tileSize,h=n.paint.get("background-pattern");if(t.isPatternMissing(h))return;const d=!h&&1===o.a&&1===a&&t.opaquePassEnabledForLayer()?"opaque":"translucent";if(t.renderPass!==d)return;const p=e.StencilMode.disabled,f=t.depthModeForSublayer(0,"opaque"===d?e.DepthMode.ReadWrite:e.DepthMode.ReadOnly),m=t.colorModeForRenderPass(),g=t.useProgram(h?"backgroundPattern":"background");let _,v=r;v||(_=t.getBackgroundTiles(),v=Object.values(_).map((e=>e.tileID))),h&&(s.activeTexture.set(l.TEXTURE0),t.imageManager.bind(t.context));const y=n.getCrossfadeParameters();for(const d of v){const v=d.toUnwrapped(),x=r?d.projMatrix:t.transform.calculateProjMatrix(v);t.prepareDrawTile();const b=i?i.getTile(d):_?_[d.key]:new e.Tile(d,u,c.zoom,t),w=h?ln(x,a,t,h,{tileID:d,tileSize:u},y):sn(x,a,o);t.prepareDrawProgram(s,g,v);const{tileBoundsBuffer:T,tileBoundsIndexBuffer:C,tileBoundsSegments:S}=t.getTileBoundsBuffers(b);g.draw(s,l.TRIANGLES,f,p,m,e.CullFaceMode.disabled,w,n.id,T,C,S)}},sky:function(t,i,n){const r=t.transform,o="mercator"===r.projection.name||"globe"===r.projection.name?1:e.smoothstep(7,8,r.zoom),a=n.paint.get("sky-opacity")*o;if(0===a)return;const s=t.context,l=n.paint.get("sky-type"),c=new e.DepthMode(s.gl.LEQUAL,e.DepthMode.ReadOnly,[0,1]),u=t.frameCounter/1e3%1;"atmosphere"===l?"offscreen"===t.renderPass?n.needsSkyboxCapture(t)&&(function(t,i,n,r){const o=t.context,a=o.gl;let s=i.skyboxFbo;if(!s){s=i.skyboxFbo=o.createFramebuffer(32,32,!1),i.skyboxGeometry=new zn(o),i.skyboxTexture=o.gl.createTexture(),a.bindTexture(a.TEXTURE_CUBE_MAP,i.skyboxTexture),a.texParameteri(a.TEXTURE_CUBE_MAP,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_CUBE_MAP,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_CUBE_MAP,a.TEXTURE_MIN_FILTER,a.LINEAR),a.texParameteri(a.TEXTURE_CUBE_MAP,a.TEXTURE_MAG_FILTER,a.LINEAR);for(let e=0;e<6;++e)a.texImage2D(a.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,a.RGBA,32,32,0,a.RGBA,a.UNSIGNED_BYTE,null)}o.bindFramebuffer.set(s.framebuffer),o.viewport.set([0,0,32,32]);const l=i.getCenter(t,!0),c=t.useProgram("skyboxCapture"),u=new Float64Array(16);e.identity(u),e.rotateY(u,u,.5*-Math.PI),On(o,i,c,u,l,0),e.identity(u),e.rotateY(u,u,.5*Math.PI),On(o,i,c,u,l,1),e.identity(u),e.rotateX(u,u,.5*-Math.PI),On(o,i,c,u,l,2),e.identity(u),e.rotateX(u,u,.5*Math.PI),On(o,i,c,u,l,3),e.identity(u),On(o,i,c,u,l,4),e.identity(u),e.rotateY(u,u,Math.PI),On(o,i,c,u,l,5),o.viewport.set([0,0,t.width,t.height])}(t,n),n.markSkyboxValid(t)):"sky"===t.renderPass&&function(t,i,n,r,o){const a=t.context,s=a.gl,l=t.transform,c=t.useProgram("skybox");a.activeTexture.set(s.TEXTURE0),s.bindTexture(s.TEXTURE_CUBE_MAP,i.skyboxTexture);const u=((e,t,i,n,r)=>({u_matrix:e,u_sun_direction:t,u_cubemap:0,u_opacity:n,u_temporal_offset:r}))(l.skyboxMatrix,i.getCenter(t,!1),0,r,o);t.prepareDrawProgram(a,c),c.draw(a,s.TRIANGLES,n,e.StencilMode.disabled,t.colorModeForRenderPass(),e.CullFaceMode.backCW,u,"skybox",i.skyboxGeometry.vertexBuffer,i.skyboxGeometry.indexBuffer,i.skyboxGeometry.segment)}(t,n,c,a,u):"gradient"===l&&"sky"===t.renderPass&&function(t,i,n,r,o){const a=t.context,s=a.gl,l=t.transform,c=t.useProgram("skyboxGradient");i.skyboxGeometry||(i.skyboxGeometry=new zn(a)),a.activeTexture.set(s.TEXTURE0);let u=i.colorRampTexture;u||(u=i.colorRampTexture=new e.Texture(a,i.colorRamp,s.RGBA)),u.bind(s.LINEAR,s.CLAMP_TO_EDGE);const h=((t,i,n,r,o)=>({u_matrix:t,u_color_ramp:0,u_center_direction:i,u_radius:e.degToRad(n),u_opacity:r,u_temporal_offset:o}))(l.skyboxMatrix,i.getCenter(t,!1),i.paint.get("sky-gradient-radius"),r,o);t.prepareDrawProgram(a,c),c.draw(a,s.TRIANGLES,n,e.StencilMode.disabled,t.colorModeForRenderPass(),e.CullFaceMode.backCW,h,"skyboxGradient",i.skyboxGeometry.vertexBuffer,i.skyboxGeometry.indexBuffer,i.skyboxGeometry.segment)}(t,n,c,a,u)},debug:function(e,t,i){for(let n=0;nn)return void(this.transform.fogCullDistSq=null);const r=i+.78*(n-i);this.transform.fogCullDistSq=r*r}get terrain(){return this.transform._terrainEnabled()&&this._terrain&&this._terrain.enabled?this._terrain:null}resize(t,i){if(this.width=t*e.exported.devicePixelRatio,this.height=i*e.exported.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const e of this.style.order)this.style._layers[e].resize()}setup(){const t=this.context,i=new e.StructArrayLayout2i4;i.emplaceBack(0,0),i.emplaceBack(e.EXTENT,0),i.emplaceBack(0,e.EXTENT),i.emplaceBack(e.EXTENT,e.EXTENT),this.tileExtentBuffer=t.createVertexBuffer(i,e.posAttributes.members),this.tileExtentSegments=e.SegmentVector.simpleSegment(0,0,4,2);const n=new e.StructArrayLayout2i4;n.emplaceBack(0,0),n.emplaceBack(e.EXTENT,0),n.emplaceBack(0,e.EXTENT),n.emplaceBack(e.EXTENT,e.EXTENT),this.debugBuffer=t.createVertexBuffer(n,e.posAttributes.members),this.debugSegments=e.SegmentVector.simpleSegment(0,0,4,5);const r=new e.StructArrayLayout2i4;r.emplaceBack(-1,-1),r.emplaceBack(1,-1),r.emplaceBack(-1,1),r.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(r,e.posAttributes.members),this.viewportSegments=e.SegmentVector.simpleSegment(0,0,4,2);const o=new e.StructArrayLayout4i8;o.emplaceBack(0,0,0,0),o.emplaceBack(e.EXTENT,0,e.EXTENT,0),o.emplaceBack(0,e.EXTENT,0,e.EXTENT),o.emplaceBack(e.EXTENT,e.EXTENT,e.EXTENT,e.EXTENT),this.mercatorBoundsBuffer=t.createVertexBuffer(o,e.boundsAttributes.members),this.mercatorBoundsSegments=e.SegmentVector.simpleSegment(0,0,4,2);const a=new e.StructArrayLayout3ui6;a.emplaceBack(0,1,2),a.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(a);const s=new e.StructArrayLayout1ui2;for(const e of[0,1,3,2,0])s.emplaceBack(e);this.debugIndexBuffer=t.createIndexBuffer(s),this.emptyTexture=new e.Texture(t,new e.RGBAImage({width:1,height:1},Uint8Array.of(0,0,0,0)),t.gl.RGBA),this.identityMat=e.create();const l=this.context.gl;this.stencilClearMode=new e.StencilMode({func:l.ALWAYS,mask:0},0,255,l.ZERO,l.ZERO,l.ZERO),this.loadTimeStamps.push(e.window.performance.now()),this.atmosphereBuffer=new Rn(this.context)}getMercatorTileBoundsBuffers(){return{tileBoundsBuffer:this.mercatorBoundsBuffer,tileBoundsIndexBuffer:this.quadTriangleIndexBuffer,tileBoundsSegments:this.mercatorBoundsSegments}}getTileBoundsBuffers(e){return e._makeTileBoundsBuffers(this.context,this.transform.projection),e._tileBoundsBuffer?{tileBoundsBuffer:e._tileBoundsBuffer,tileBoundsIndexBuffer:e._tileBoundsIndexBuffer,tileBoundsSegments:e._tileBoundsSegments}:this.getMercatorTileBoundsBuffers()}clearStencil(){const t=this.context,i=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0,this._tileClippingMaskIDs={},this.useProgram("clippingMask").draw(t,i.TRIANGLES,e.DepthMode.disabled,this.stencilClearMode,e.ColorMode.disabled,e.CullFaceMode.disabled,ki(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}_renderTileClippingMasks(t,i,n){if(!i||this.currentStencilSource===i.id||!t.isTileClipped()||!n||0===n.length)return;if(this._tileClippingMaskIDs&&!this.terrain){let e=!1;for(const t of n)if(void 0===this._tileClippingMaskIDs[t.key]){e=!0;break}if(!e)return}this.currentStencilSource=i.id;const r=this.context,o=r.gl;this.nextStencilID+n.length>256&&this.clearStencil(),r.setColorMode(e.ColorMode.disabled),r.setDepthMode(e.DepthMode.disabled);const a=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const t of n){const n=i.getTile(t),s=this._tileClippingMaskIDs[t.key]=this.nextStencilID++,{tileBoundsBuffer:l,tileBoundsIndexBuffer:c,tileBoundsSegments:u}=this.getTileBoundsBuffers(n);a.draw(r,o.TRIANGLES,e.DepthMode.disabled,new e.StencilMode({func:o.ALWAYS,mask:0},s,255,o.KEEP,o.KEEP,o.REPLACE),e.ColorMode.disabled,e.CullFaceMode.disabled,ki(t.projMatrix),"$clipping",l,c,u)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,i=this.context.gl;return new e.StencilMode({func:i.NOTEQUAL,mask:255},t,255,i.KEEP,i.KEEP,i.REPLACE)}stencilModeForClipping(t){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(t);const i=this.context.gl;return new e.StencilMode({func:i.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,i.KEEP,i.KEEP,i.REPLACE)}stencilConfigForOverlap(t){const i=this.context.gl,n=t.sort(((e,t)=>t.overscaledZ-e.overscaledZ)),r=n[n.length-1].overscaledZ,o=n[0].overscaledZ-r+1;if(o>1){this.currentStencilSource=void 0,this.nextStencilID+o>256&&this.clearStencil();const t={};for(let n=0;n=0;this.currentLayer--){const e=this.style._layers[n[this.currentLayer]],i=t._getLayerSourceCache(e);if(e.isSky())continue;const r=i?a[i.id]:void 0;this._renderTileClippingMasks(e,i,r),this.renderLayer(this,i,e,r)}if(this.style.fog&&this.transform.projection.supportsFog&&function(t,i){const n=t.context,r=n.gl,o=t.transform,a=new e.DepthMode(r.LEQUAL,e.DepthMode.ReadOnly,[0,1]),s=t.useProgram("globeAtmosphere",null,"globe"===o.projection.name?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"]),l=e.globeToMercatorTransition(o.zoom),c=i.properties.get("color").toArray01(),u=i.properties.get("high-color").toArray01(),h=i.properties.get("space-color").toArray01PremultipliedAlpha(),d=e.identity$1([]);e.rotateY$1(d,d,-e.degToRad(o._center.lng)),e.rotateX$1(d,d,e.degToRad(o._center.lat)),e.rotateZ$1(d,d,o.angle),e.rotateX$1(d,d,-o._pitch);const p=e.fromQuat(new Float32Array(16),d),f=e.mapValue(i.properties.get("star-intensity"),0,1,0,.25),m=5e-4,g=e.mapValue(i.properties.get("horizon-blend"),0,1,m,.25),_=e.globeUseCustomAntiAliasing(t,n,o)&&g===m?o.worldSize/(2*Math.PI*1.025)-1:o.globeRadius,v=t.frameCounter/1e3%1,y=e.length(o.globeCenterInViewSpace),x=Math.sqrt(Math.pow(y,2)-Math.pow(_,2)),b=Math.acos(x/y),w=((t,i,n,r,o,a,s,l,c,u,h,d,p,f)=>({u_frustum_tl:t,u_frustum_tr:i,u_frustum_br:n,u_frustum_bl:r,u_horizon:o,u_transition:a,u_fadeout_range:s,u_color:l,u_high_color:c,u_space_color:u,u_star_intensity:h,u_star_size:5*e.exported.devicePixelRatio,u_star_density:0,u_temporal_offset:d,u_horizon_angle:p,u_rotation_matrix:f}))(o.frustumCorners.TL,o.frustumCorners.TR,o.frustumCorners.BR,o.frustumCorners.BL,o.frustumCorners.horizon,l,g,c,u,h,f,v,b,p);t.prepareDrawProgram(n,s);const T=t.atmosphereBuffer;T&&s.draw(n,r.TRIANGLES,a,e.StencilMode.disabled,e.ColorMode.alphaBlended,e.CullFaceMode.backCW,w,"skybox",T.vertexBuffer,T.indexBuffer,T.segments)}(this,this.style.fog),this.renderPass="sky",(e.globeToMercatorTransition(this.transform.zoom)>0||"globe"!==this.transform.projection.name)&&this.transform.isHorizonVisible())for(this.currentLayer=0;this.currentLayer{const n=t._getLayerSourceCache(e);n&&!e.isHidden(this.transform.zoom)&&(!i||i.getSource().maxzoom0?t.pop():null}isPatternMissing(e){if(!e)return!1;if(!e.from||!e.to)return!0;const t=this.imageManager.getPattern(e.from.toString()),i=this.imageManager.getPattern(e.to.toString());return!t||!i}terrainRenderModeElevated(){return this.style&&!!this.style.getTerrain()&&!!this.terrain&&!this.terrain.renderingToTexture}currentGlobalDefines(){const e=this.terrain&&this.terrain.renderingToTexture,t=this.style&&this.style.fog,i=[];return this.terrainRenderModeElevated()&&i.push("TERRAIN"),"globe"===this.transform.projection.name&&i.push("GLOBE"),t&&!e&&0!==t.getOpacity(this.transform.pitch)&&i.push("FOG"),e&&i.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&i.push("OVERDRAW_INSPECTOR"),i}useProgram(e,t,i){this.cache=this.cache||{};const n=i||[],r=this.currentGlobalDefines().concat(n),o=zi.cacheKey(di[e],e,r,t);return this.cache[o]||(this.cache[o]=new zi(this.context,e,di[e],t,cn[e],r)),this.cache[o]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.frontFace.setDefault(),this.context.cullFaceSide.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}initDebugOverlayCanvas(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=e.window.document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new e.Texture(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this._terrain&&this._terrain.destroy(),this.globeSharedBuffers&&this.globeSharedBuffers.destroy(),this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this.atmosphereBuffer&&this.atmosphereBuffer.destroy()}prepareDrawTile(){this.terrain&&this.terrain.prepareDrawTile()}prepareDrawProgram(t,i,n){if(this.terrain&&this.terrain.renderingToTexture)return;const r=this.style.fog;if(r){const o=r.getOpacity(this.transform.pitch),a=((t,i,n,r,o,a,s,l,c,u,h)=>{const d=t.transform,p=i.properties.get("color").toArray01();p[3]=r;const f=t.frameCounter/1e3%1;return{u_fog_matrix:n?d.calculateFogTileMatrix(n):t.identityMat,u_fog_range:i.getFovAdjustedRange(d._fov),u_fog_color:p,u_fog_horizon_blend:i.properties.get("horizon-blend"),u_fog_temporal_offset:f,u_frustum_tl:o,u_frustum_tr:a,u_frustum_br:s,u_frustum_bl:l,u_globe_pos:c,u_globe_radius:u,u_viewport:h,u_globe_transition:e.globeToMercatorTransition(d.zoom),u_is_globe:+("globe"===d.projection.name)}})(this,r,n,o,this.transform.frustumCorners.TL,this.transform.frustumCorners.TR,this.transform.frustumCorners.BR,this.transform.frustumCorners.BL,this.transform.globeCenterInViewSpace,this.transform.globeRadius,[this.transform.width*e.exported.devicePixelRatio,this.transform.height*e.exported.devicePixelRatio]);i.setFogUniformValues(t,a)}}setTileLoadedFlag(e){this.tileLoaded=e}saveCanvasCopy(){this.frameCopies.push(this.canvasCopy()),this.tileLoaded=!1}canvasCopy(){const e=this.context.gl,t=e.createTexture();return e.bindTexture(e.TEXTURE_2D,t),e.copyTexImage2D(e.TEXTURE_2D,0,e.RGBA,0,0,e.drawingBufferWidth,e.drawingBufferHeight,0),t}getCanvasCopiesAndTimestamps(){return{canvasCopies:this.frameCopies,timeStamps:this.loadTimeStamps}}averageElevationNeedsEasing(){if(!this.transform._elevation)return!1;const e=this.style&&this.style.fog;return!!e&&0!==e.getOpacity(this.transform.pitch)}getBackgroundTiles(){const t=this._backgroundTiles,i=this._backgroundTiles={},n=this.transform.coveringTiles({tileSize:512});for(const r of n)i[r.key]=t[r.key]||new e.Tile(r,512,this.transform.tileZoom,this);return i}clearBackgroundTiles(){this._backgroundTiles={}}}class $n{constructor(e=0,t=0,i=0,n=0){if(isNaN(e)||e<0||isNaN(t)||t<0||isNaN(i)||i<0||isNaN(n)||n<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=e,this.bottom=t,this.left=i,this.right=n}interpolate(t,i,n){return null!=i.top&&null!=t.top&&(this.top=e.number(t.top,i.top,n)),null!=i.bottom&&null!=t.bottom&&(this.bottom=e.number(t.bottom,i.bottom,n)),null!=i.left&&null!=t.left&&(this.left=e.number(t.left,i.left,n)),null!=i.right&&null!=t.right&&(this.right=e.number(t.right,i.right,n)),this}getCenter(t,i){const n=e.clamp((this.left+t-this.right)/2,0,t),r=e.clamp((this.top+i-this.bottom)/2,0,i);return new e.pointGeometry(n,r)}equals(e){return this.top===e.top&&this.bottom===e.bottom&&this.left===e.left&&this.right===e.right}clone(){return new $n(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function jn(t,i){const n=e.getColumn(t,3);e.fromQuat(t,i),e.setColumn(t,3,n)}function Nn(t,i){const n=e.identity$1([]);return e.rotateZ$1(n,n,-i),e.rotateX$1(n,n,-t),n}function Un(t,i){const n=[t[0],t[1],0],r=[i[0],i[1],0];if(e.length(n)>=1e-15){const t=e.normalize([],n);e.scale$2(r,t,e.dot(r,t)),i[0]=r[0],i[1]=r[1]}const o=e.cross([],i,t);if(e.len(o)<1e-15)return null;const a=Math.atan2(-o[1],o[0]);return Nn(Math.atan2(Math.sqrt(t[0]*t[0]+t[1]*t[1]),-t[2]),a)}class Vn{constructor(e,t){this.position=e,this.orientation=t}get position(){return this._position}set position(t){if(t){const i=t instanceof e.MercatorCoordinate?t:new e.MercatorCoordinate(t[0],t[1],t[2]);this._renderWorldCopies&&(i.x=e.wrap(i.x,0,1)),this._position=i}else this._position=null}lookAtPoint(t,i){if(this.orientation=null,!this.position)return;const n=this._elevation?this._elevation.getAtPointOrZero(e.MercatorCoordinate.fromLngLat(t)):0,r=this.position,o=e.MercatorCoordinate.fromLngLat(t,n),a=[o.x-r.x,o.y-r.y,o.z-r.z];i||(i=[0,0,1]),i[2]=Math.abs(i[2]),this.orientation=Un(a,i)}setPitchBearing(t,i){this.orientation=Nn(e.degToRad(t),e.degToRad(-i))}}class Gn{constructor(t,i){this._transform=e.identity([]),this.orientation=i,this.position=t}get mercatorPosition(){const t=this.position;return new e.MercatorCoordinate(t[0],t[1],t[2])}get position(){const t=e.getColumn(this._transform,3);return[t[0],t[1],t[2]]}set position(t){var i;t&&e.setColumn(this._transform,3,[(i=t)[0],i[1],i[2],1])}get orientation(){return this._orientation}set orientation(t){this._orientation=t||e.identity$1([]),t&&jn(this._transform,this._orientation)}getPitchBearing(){const e=this.forward(),t=this.right();return{bearing:Math.atan2(-t[1],t[0]),pitch:Math.atan2(Math.sqrt(e[0]*e[0]+e[1]*e[1]),-e[2])}}setPitchBearing(e,t){this._orientation=Nn(e,t),jn(this._transform,this._orientation)}forward(){const t=e.getColumn(this._transform,2);return[-t[0],-t[1],-t[2]]}up(){const t=e.getColumn(this._transform,1);return[-t[0],-t[1],-t[2]]}right(){const t=e.getColumn(this._transform,0);return[t[0],t[1],t[2]]}getCameraToWorld(t,i){const n=new Float64Array(16);return e.invert(n,this.getWorldToCamera(t,i)),n}getWorldToCameraPosition(t,i,n){const r=this.position;e.scale$2(r,r,-t);const o=new Float64Array(16);return e.fromScaling(o,[n,n,n]),e.translate(o,o,r),o[10]*=i,o}getWorldToCamera(t,i){const n=new Float64Array(16),r=new Float64Array(4),o=this.position;return e.conjugate(r,this._orientation),e.scale$2(o,o,-t),e.fromQuat(n,r),e.translate(n,n,o),n[1]*=-1,n[5]*=-1,n[9]*=-1,n[13]*=-1,n[8]*=i,n[9]*=i,n[10]*=i,n[11]*=i,n}getCameraToClipPerspective(t,i,n,r){const o=new Float64Array(16);return e.perspective(o,t,i,n,r),o}getDistanceToElevation(t){const i=0===t?0:e.mercatorZfromAltitude(t,this.position[1]),n=this.forward();return(i-this.position[2])/n[2]}clone(){return new Gn([...this.position],[...this.orientation])}}function qn(t,i){const n=Zn(t.projection,t.zoom,t.width,t.height),r=function(t,i,n,r,o){const a=new e.LngLat(n.lng-180*Hn,n.lat),s=new e.LngLat(n.lng+180*Hn,n.lat),l=t.project(a.lng,a.lat),c=t.project(s.lng,s.lat),u=-Math.atan2(c.y-l.y,c.x-l.x),h=e.MercatorCoordinate.fromLngLat(n);h.y=e.clamp(h.y,-.999975,.999975);const d=h.toLngLat(),p=t.project(d.lng,d.lat),f=e.MercatorCoordinate.fromLngLat(d);f.x+=Hn;const m=f.toLngLat(),g=t.project(m.lng,m.lat),_=Yn(g.x-p.x,g.y-p.y,u),v=e.MercatorCoordinate.fromLngLat(d);v.y+=Hn;const y=v.toLngLat(),x=t.project(y.lng,y.lat),b=Yn(x.x-p.x,x.y-p.y,u),w=Math.abs(_.x)/Math.abs(b.y),T=e.identity([]);e.rotateZ(T,T,-u*(1-(o?0:r)));const C=e.identity([]);return e.scale(C,C,[1,1-(1-w)*r,1]),C[4]=-b.x/b.y*r,e.rotateZ(C,C,u),e.multiply(C,T,C),C}(t.projection,0,t.center,n,i),o=Wn(t);return e.scale(r,r,[o,o,1]),r}function Wn(t){const i=t.projection,n=Zn(t.projection,t.zoom,t.width,t.height),r=Xn(i,t.center),o=Xn(i,e.LngLat.convert(i.center));return Math.pow(2,r*n+(1-n)*o)}function Zn(t,i,n,r,o=1/0){const a=t.range;if(!a)return 0;const s=Math.min(o,Math.max(n,r)),l=Math.log(s/1024)/Math.LN2;return e.smoothstep(a[0]+l,a[1]+l,i)}const Hn=1/4e4;function Xn(t,i){const n=e.clamp(i.lat,-e.MAX_MERCATOR_LATITUDE,e.MAX_MERCATOR_LATITUDE),r=new e.LngLat(i.lng-180*Hn,n),o=new e.LngLat(i.lng+180*Hn,n),a=t.project(r.lng,n),s=t.project(o.lng,n),l=e.MercatorCoordinate.fromLngLat(r),c=e.MercatorCoordinate.fromLngLat(o),u=s.x-a.x,h=s.y-a.y,d=c.x-l.x,p=c.y-l.y,f=Math.sqrt((d*d+p*p)/(u*u+h*h));return Math.log(f)/Math.LN2}function Yn(e,t,i){const n=Math.cos(i),r=Math.sin(i);return{x:e*n-t*r,y:e*r+t*n}}class Kn{constructor(t,i,n,r,o,a,s){this.tileSize=512,this._renderWorldCopies=void 0===o||o,this._minZoom=t||0,this._maxZoom=i||22,this._minPitch=null==n?0:n,this._maxPitch=null==r?60:r,this.setProjection(a),this.setMaxBounds(s),this.width=0,this.height=0,this._center=new e.LngLat(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._nearZ=0,this._farZ=0,this._unmodified=!0,this._edgeInsets=new $n,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._distanceTileDataCache={},this._camera=new Gn,this._centerAltitude=0,this._averageElevation=0,this.cameraElevationReference="ground",this._pixelsPerMercatorPixel=1,this.globeRadius=0,this.globeCenterInViewSpace=[0,0,0],this._horizonShift=.1}clone(){const e=new Kn(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies,this.getProjection());return e._elevation=this._elevation,e._centerAltitude=this._centerAltitude,e._centerAltitudeValidForExaggeration=this._centerAltitudeValidForExaggeration,e.tileSize=this.tileSize,e.mercatorFromTransition=this.mercatorFromTransition,e.width=this.width,e.height=this.height,e.cameraElevationReference=this.cameraElevationReference,e._center=this._center,e._setZoom(this.zoom),e._seaLevelZoom=this._seaLevelZoom,e.angle=this.angle,e._fov=this._fov,e._pitch=this._pitch,e._nearZ=this._nearZ,e._farZ=this._farZ,e._averageElevation=this._averageElevation,e._unmodified=this._unmodified,e._edgeInsets=this._edgeInsets.clone(),e._camera=this._camera.clone(),e._calcMatrices(),e.freezeTileCoverage=this.freezeTileCoverage,e.frustumCorners=this.frustumCorners,e}get elevation(){return this._elevation}set elevation(e){this._elevation!==e&&(this._elevation=e,this._updateCameraOnTerrain(),this._calcMatrices())}updateElevation(e){const t=this._elevation&&this._elevation.exaggeration()!==this._centerAltitudeValidForExaggeration;(null==this._seaLevelZoom||t)&&this._updateCameraOnTerrain(),(e||t)&&this._constrainCameraAltitude(),this._calcMatrices()}getProjection(){return e.pick(this.projection,["name","center","parallels"])}setProjection(i){this.projectionOptions=i||{name:"mercator"};const n=this.projection?this.getProjection():void 0;this.projection=e.getProjection(this.projectionOptions);const r=!t(n,this.getProjection());return r&&this._calcMatrices(),this.mercatorFromTransition=!1,r}setMercatorFromTransition(){const t=this.projection.name;this.mercatorFromTransition=!0,this.projectionOptions={name:"mercator"},this.projection=e.getProjection({name:"mercator"});const i=t!==this.projection.name;return i&&this._calcMatrices(),i}get minZoom(){return this._minZoom}set minZoom(e){this._minZoom!==e&&(this._minZoom=e,this.zoom=Math.max(this.zoom,e))}get maxZoom(){return this._maxZoom}set maxZoom(e){this._maxZoom!==e&&(this._maxZoom=e,this.zoom=Math.min(this.zoom,e))}get minPitch(){return this._minPitch}set minPitch(e){this._minPitch!==e&&(this._minPitch=e,this.pitch=Math.max(this.pitch,e))}get maxPitch(){return this._maxPitch}set maxPitch(e){this._maxPitch!==e&&(this._maxPitch=e,this.pitch=Math.min(this.pitch,e))}get renderWorldCopies(){return this._renderWorldCopies&&!0===this.projection.supportsWorldCopies}set renderWorldCopies(e){void 0===e?e=!0:null===e&&(e=!1),this._renderWorldCopies=e}get worldSize(){return this.tileSize*this.scale}get cameraWorldSize(){const e=Math.max(this._camera.getDistanceToElevation(this._averageElevation),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(e))}get pixelsPerMeter(){return this.projection.pixelsPerMeter(this.center.lat,this.worldSize)}get cameraPixelsPerMeter(){return e.mercatorZfromAltitude(this.center.lat,this.cameraWorldSize)}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new e.pointGeometry(this.width,this.height)}get bearing(){return e.wrap(this.rotation,-180,180)}set bearing(e){this.rotation=e}get rotation(){return-this.angle/Math.PI*180}set rotation(t){const i=-t*Math.PI/180;var n;this.angle!==i&&(this._unmodified=!1,this.angle=i,this._calcMatrices(),this.rotationMatrix=(n=new e.ARRAY_TYPE(4),e.ARRAY_TYPE!=Float32Array&&(n[1]=0,n[2]=0),n[0]=1,n[3]=1,n),function(e,t,i){var n=t[0],r=t[1],o=t[2],a=t[3],s=Math.sin(i),l=Math.cos(i);e[0]=n*l+o*s,e[1]=r*l+a*s,e[2]=n*-s+o*l,e[3]=r*-s+a*l}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const i=e.clamp(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==i&&(this._unmodified=!1,this._pitch=i,this._calcMatrices())}get aspect(){return this.width/this.height}get fovX(){return this._fov}get fovY(){const e=1/Math.tan(.5*this.fovX);return 2*Math.atan(1/this.aspect/e)}set fov(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=e.degToRad(t),this._calcMatrices())}get averageElevation(){return this._averageElevation}set averageElevation(e){this._averageElevation=e,this._calcFogMatrices(),this._distanceTileDataCache={}}get zoom(){return this._zoom}set zoom(e){const t=Math.min(Math.max(e,this.minZoom),this.maxZoom);this._zoom!==t&&(this._unmodified=!1,this._setZoom(t),this._updateSeaLevelZoom(),this._constrain(),this._calcMatrices())}_setZoom(e){this._zoom=e,this.scale=this.zoomScale(e),this.tileZoom=Math.floor(e),this.zoomFraction=e-this.tileZoom}_updateCameraOnTerrain(){if(!this._elevation||!this._elevation.isDataAvailableAtPoint(this.locationCoordinate(this.center)))return this._centerAltitude=0,this._seaLevelZoom=null,void(this._centerAltitudeValidForExaggeration=void 0);const e=this._elevation;this._centerAltitude=e.getAtPointOrZero(this.locationCoordinate(this.center)),this._centerAltitudeValidForExaggeration=e.exaggeration(),this._updateSeaLevelZoom()}_updateSeaLevelZoom(){void 0!==this._centerAltitudeValidForExaggeration&&(this._seaLevelZoom=this._zoomFromMercatorZ((this.pixelsPerMeter*this._centerAltitude+this.cameraToCenterDistance)/this.worldSize))}sampleAverageElevation(){if(!this._elevation)return 0;const t=this._elevation,i=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8]],n=this.horizonLineFromTop();let r=0,o=0;for(let a=0;at.maxzoom&&(i=t.maxzoom);const a=this.locationCoordinate(this.center),s=this.center.lat,l=1<{const i=1/4e4,n=new e.MercatorCoordinate(t.x+i,t.y,t.z),r=new e.MercatorCoordinate(t.x,t.y+i,t.z),o=t.toLngLat(),a=n.toLngLat(),s=r.toLngLat(),l=this.locationCoordinate(o),c=this.locationCoordinate(a),u=this.locationCoordinate(s),h=Math.hypot(c.x-l.x,c.y-l.y),d=Math.hypot(u.x-l.x,u.y-l.y);return Math.sqrt(h*d)*b/i},T=t=>{const i=y,n=x;return{aabb:e.tileAABB(this,l,0,0,0,t,n,i,this.projection),zoom:0,x:0,y:0,minZ:n,maxZ:i,wrap:t,fullyVisible:!1}},C=[];let S=[];const E=i,k=t.reparseOverscaled?n:i,A=e=>e*e,M=A((m-this._centerAltitude)*f),I=e=>{if(!this._elevation||!e.tileID||!o)return;const t=this._elevation.getMinMaxForTile(e.tileID),i=e.aabb;t?(i.min[2]=t.min,i.max[2]=t.max,i.center[2]=(i.min[2]+i.max[2])/2):(e.shouldSplit=P(e),e.shouldSplit||(i.min[2]=i.max[2]=i.center[2]=this._centerAltitude))},P=t=>{if(t.zoom=.9)return!0}else if(r&&(a=A(t.aabb.distanceZ(g)*f)),this.projection.isReprojectedInTileSpace&&n<=5){const i=Math.pow(2,t.zoom),n=w(new e.MercatorCoordinate((t.x+.5)/i,(t.y+.5)/i));l=n>.85?1:n}const c=i*i+o*o+a,h=A((1<{if(t*A(.707)0;){const n=C.pop(),a=n.x,s=n.y;let h=n.fullyVisible;if(!h){const e=n.aabb.intersects(d);if(0===e)continue;h=2===e}if(n.zoom!==E&&P(n))for(let t=0;t<4;t++){const i=(a<<1)+t%2,c=(s<<1)+(t>>1),d={aabb:o?n.aabb.quadrant(t):e.tileAABB(this,l,n.zoom+1,i,c,n.wrap,n.minZ,n.maxZ,this.projection),zoom:n.zoom+1,x:i,y:c,wrap:n.wrap,fullyVisible:h,tileID:void 0,shouldSplit:void 0,minZ:n.minZ,maxZ:n.maxZ};r&&!u&&(d.tileID=new e.OverscaledTileID(n.zoom+1===E?k:n.zoom+1,n.wrap,n.zoom+1,i,c),I(d)),C.push(d)}else{const r=n.zoom===E?k:n.zoom;if(t.minzoom&&t.minzoom>r)continue;const o=c[0]-(.5+a+(n.wrap<{const o=[0,0,0,1],a=[e.EXTENT,e.EXTENT,0,1],s=this.calculateFogTileMatrix(r.tileID.toUnwrapped());e.transformMat4$1(o,o,s),e.transformMat4$1(a,a,s);const l=e.getAABBPointSquareDist(o,a);if(0===l)return!0;let c=!1;const u=this._elevation;if(u&&l>i&&0!==n){const i=this.calculateProjMatrix(r.tileID.toUnwrapped());let o;t.isTerrainDEM||(o=u.getMinMaxForTile(r.tileID)),o||(o={min:x,max:y});const a=e.furthestTileCorner(this.rotation),s=[a[0]*e.EXTENT,a[1]*e.EXTENT,o.max];e.transformMat4(s,s,i),c=(1-s[1])*this.height*.5e.distanceSq-t.distanceSq)).map((e=>e.tileID))}resize(e,t){this.width=e,this.height=t,this.pixelsToGLUnits=[2/e,-2/t],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(e){return Math.pow(2,e)}scaleZoom(e){return Math.log(e)/Math.LN2}project(t){const i=e.clamp(t.lat,-e.MAX_MERCATOR_LATITUDE,e.MAX_MERCATOR_LATITUDE),n=this.projection.project(t.lng,i);return new e.pointGeometry(n.x*this.worldSize,n.y*this.worldSize)}unproject(e){return this.projection.unproject(e.x/this.worldSize,e.y/this.worldSize)}get point(){return this.project(this.center)}setLocationAtPoint(t,i){let n,r;const o=this.centerPoint;if("globe"===this.projection.name){const e=this.worldSize;n=(i.x-o.x)/e,r=(i.y-o.y)/e}else{const e=this.pointCoordinate(i),t=this.pointCoordinate(o);n=e.x-t.x,r=e.y-t.y}const a=this.locationCoordinate(t);this.setLocation(new e.MercatorCoordinate(a.x-n,a.y-r))}setLocation(e){this.center=this.coordinateLocation(e),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(e){return this.projection.locationPoint(this,e)}locationPoint3D(e){return this.projection.locationPoint(this,e,!0)}pointLocation(e){return this.coordinateLocation(this.pointCoordinate(e))}pointLocation3D(e){return this.coordinateLocation(this.pointCoordinate3D(e))}locationCoordinate(t,i){const n=i?e.mercatorZfromAltitude(i,t.lat):void 0,r=this.projection.project(t.lng,t.lat);return new e.MercatorCoordinate(r.x,r.y,n)}coordinateLocation(e){return this.projection.unproject(e.x,e.y)}pointRayIntersection(t,i){const n=null!=i?i:this._centerAltitude,r=[t.x,t.y,0,1],o=[t.x,t.y,1,1];e.transformMat4$1(r,r,this.pixelMatrixInverse),e.transformMat4$1(o,o,this.pixelMatrixInverse);const a=o[3];e.scale$1(r,r,1/r[3]),e.scale$1(o,o,1/a);const s=r[2],l=o[2];return{p0:r,p1:o,t:s===l?0:(n-s)/(l-s)}}screenPointToMercatorRay(t){const i=[t.x,t.y,0,1],n=[t.x,t.y,1,1];return e.transformMat4$1(i,i,this.pixelMatrixInverse),e.transformMat4$1(n,n,this.pixelMatrixInverse),e.scale$1(i,i,1/i[3]),e.scale$1(n,n,1/n[3]),i[2]=e.mercatorZfromAltitude(i[2],this._center.lat)*this.worldSize,n[2]=e.mercatorZfromAltitude(n[2],this._center.lat)*this.worldSize,e.scale$1(i,i,1/this.worldSize),e.scale$1(n,n,1/this.worldSize),new e.Ray([i[0],i[1],i[2]],e.normalize([],e.sub([],n,i)))}rayIntersectionCoordinate(t){const{p0:i,p1:n,t:r}=t,o=e.mercatorZfromAltitude(i[2],this._center.lat),a=e.mercatorZfromAltitude(n[2],this._center.lat);return new e.MercatorCoordinate(e.number(i[0],n[0],r)/this.worldSize,e.number(i[1],n[1],r)/this.worldSize,e.number(o,a,r))}pointCoordinate(e,t=this._centerAltitude){return this.projection.pointCoordinate(this,e.x,e.y,t)}pointCoordinate3D(t){if(!this.elevation)return this.pointCoordinate(t);let i=this.projection.pointCoordinate3D(this,t.x,t.y);if(i)return new e.MercatorCoordinate(i[0],i[1],i[2]);let n=0,r=this.horizonLineFromTop();if(t.y>r)return this.pointCoordinate(t);const o=.02*r,a=t.clone();for(let t=0;t<10&&r-n>o;t++){a.y=e.number(n,r,.66);const t=this.projection.pointCoordinate3D(this,a.x,a.y);t?(r=a.y,i=t):n=a.y}return i?new e.MercatorCoordinate(i[0],i[1],i[2]):this.pointCoordinate(t)}isPointAboveHorizon(e){return this.projection.isPointAboveHorizon(this,e)}_coordinatePoint(t,i){const n=i&&this.elevation?this.elevation.getAtPointOrZero(t,this._centerAltitude):this._centerAltitude,r=[t.x*this.worldSize,t.y*this.worldSize,n+t.toAltitude(),1];return e.transformMat4$1(r,r,this.pixelMatrix),r[3]>0?new e.pointGeometry(r[0]/r[3],r[1]/r[3]):new e.pointGeometry(Number.MAX_VALUE,Number.MAX_VALUE)}_getGlobeBounds(){const{top:t,left:i}=this._edgeInsets,n=this.height-this._edgeInsets.bottom,r=this.width-this._edgeInsets.right,o=this.pointCoordinate3D(new e.pointGeometry(i,t)),a=this.pointCoordinate3D(new e.pointGeometry(r,t)),s=this.pointCoordinate3D(new e.pointGeometry(r,n)),l=this.pointCoordinate3D(new e.pointGeometry(i,n));let c=Math.min(o.x,l.x),u=Math.max(a.x,s.x),h=Math.min(o.y,a.y),d=Math.max(l.y,s.y);const p=Math.pow(2,-this.zoom)/16,f=(t,i,n,r)=>{const o=(t+n)/2,a=(i+r)/2,s=new e.pointGeometry(o,a),l=this.pointCoordinate3D(s),m=Math.max(0,c-l.x,h-l.y,l.x-u,l.y-d);c=Math.min(c,l.x),u=Math.max(u,l.x),h=Math.min(h,l.y),d=Math.max(d,l.y),m>p&&(f(t,i,o,a),f(o,a,n,r))};f(i,t,r,t),f(r,t,r,n),f(r,n,i,n),f(i,n,i,t);const m=new e.LngLat(e.lngFromMercatorX(u),e.latFromMercatorY(h)),g=new e.LngLat(e.lngFromMercatorX(c),e.latFromMercatorY(d));return new e.LngLatBounds(g,m)}_getBounds(t,i){if("globe"===this.projection.name)return this._getGlobeBounds();const n=new e.pointGeometry(this._edgeInsets.left,this._edgeInsets.top),r=new e.pointGeometry(this.width-this._edgeInsets.right,this._edgeInsets.top),o=new e.pointGeometry(this.width-this._edgeInsets.right,this.height-this._edgeInsets.bottom),a=new e.pointGeometry(this._edgeInsets.left,this.height-this._edgeInsets.bottom);let s=this.pointCoordinate(n,t),l=this.pointCoordinate(r,t);const c=this.pointCoordinate(o,i),u=this.pointCoordinate(a,i),h=(e,t)=>(t.y-e.y)/(t.x-e.x);return s.y>1&&l.y>=0?s=new e.MercatorCoordinate((1-u.y)/h(u,s)+u.x,1):s.y<0&&l.y<=1&&(s=new e.MercatorCoordinate(-u.y/h(u,s)+u.x,0)),l.y>1&&s.y>=0?l=new e.MercatorCoordinate((1-c.y)/h(c,l)+c.x,1):l.y<0&&s.y<=1&&(l=new e.MercatorCoordinate(-c.y/h(c,l)+c.x,0)),(new e.LngLatBounds).extend(this.coordinateLocation(s)).extend(this.coordinateLocation(l)).extend(this.coordinateLocation(u)).extend(this.coordinateLocation(c))}_getBounds3D(){const e=this.elevation;if(!e.visibleDemTiles.length||e.isUsingMockSource())return this._getBounds(0,0);const t=e.visibleDemTiles.reduce(((e,t)=>{if(t.dem){const i=t.dem.tree;e.min=Math.min(e.min,i.minimums[0]),e.max=Math.max(e.max,i.maximums[0])}return e}),{min:Number.MAX_VALUE,max:0});return this._getBounds(t.min*e.exaggeration(),t.max*e.exaggeration())}getBounds(){return this._terrainEnabled()?this._getBounds3D():this._getBounds(0,0)}horizonLineFromTop(e=!0){const t=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))+this.centerOffset.y,i=this.height/2-t*(1-this._horizonShift);return e?Math.max(0,i):i}getMaxBounds(){return this.maxBounds}setMaxBounds(t){this.maxBounds=t,this.minLat=-e.MAX_MERCATOR_LATITUDE,this.maxLat=e.MAX_MERCATOR_LATITUDE,this.minLng=-180,this.maxLng=180,t&&(this.minLat=t.getSouth(),this.maxLat=t.getNorth(),this.minLng=t.getWest(),this.maxLng=t.getEast(),this.maxLngh&&(s=h-c),h-ut&&(a=t-l),t-e.5?y-1:y,x>.5?x-1:x,0]),this.alignedProjMatrix=b,a=e.create(),e.scale(a,a,[this.width/2,-this.height/2,1]),e.translate(a,a,[1,-1,0]),this.labelPlaneMatrix=a,a=e.create(),e.scale(a,a,[1,-1,1]),e.translate(a,a,[-1,-1,0]),e.scale(a,a,[2/this.width,2/this.height,1]),this.glCoordMatrix=a,this.pixelMatrix=e.multiply(new Float64Array(16),this.labelPlaneMatrix,this.projMatrix),this._calcFogMatrices(),this._distanceTileDataCache={},a=e.invert(new Float64Array(16),this.pixelMatrix),!a)throw new Error("failed to invert matrix");if(this.pixelMatrixInverse=a,"globe"===this.projection.name||this.mercatorFromTransition){this.globeMatrix=e.calculateGlobeMatrix(this);const t=[this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]];this.globeCenterInViewSpace=e.transformMat4(t,t,r),this.globeRadius=this.worldSize/2/Math.PI-1}else this.globeMatrix=a;this._projMatrixCache={},this._alignedProjMatrixCache={},this._pixelsToTileUnitsCache={}}_calcFogMatrices(){this._fogTileMatrixCache={};const t=this.cameraWorldSize,i=this.cameraPixelsPerMeter,n=this._camera.position,r=1/this.height/this._pixelsPerMercatorPixel,o=[t,t,i];e.scale$2(o,o,r),e.scale$2(n,n,-1),e.multiply$2(n,n,o);const a=e.create();e.translate(a,a,n),e.scale(a,a,o),this.mercatorFogMatrix=a,this.worldToFogMatrix=this._camera.getWorldToCameraPosition(t,i,r)}_computeCameraPosition(e){const t=(e=e||this.pixelsPerMeter)/this.pixelsPerMeter,i=this._camera.forward(),n=this.point,r=this._mercatorZfromZoom(this._seaLevelZoom?this._seaLevelZoom:this._zoom)*t-e/this.worldSize*this._centerAltitude;return[n.x/this.worldSize-i[0]*r,n.y/this.worldSize-i[1]*r,e/this.worldSize*this._centerAltitude-i[2]*r]}_updateCameraState(){this.height&&(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition())}_translateCameraConstrained(t){const i=this._maxCameraBoundsDistance()*Math.cos(this._pitch),n=this._camera.position[2],r=t[2];let o=1;this.projection.wrap&&(this.center=this.center.wrap()),r>0&&(o=Math.min((i-n)/r,1)),this._camera.position=e.scaleAndAdd([],this._camera.position,t,o),this._updateStateFromCamera()}_updateStateFromCamera(){const t=this._camera.position,i=this._camera.forward(),{pitch:n,bearing:r}=this._camera.getPitchBearing(),o=e.mercatorZfromAltitude(this._centerAltitude,this.center.lat)*this._pixelsPerMercatorPixel,a=this._mercatorZfromZoom(this._maxZoom)*Math.cos(e.degToRad(this._maxPitch)),s=Math.max((t[2]-o)/Math.cos(n),a),l=this._zoomFromMercatorZ(s);e.scaleAndAdd(t,t,i,s),this._pitch=e.clamp(n,e.degToRad(this.minPitch),e.degToRad(this.maxPitch)),this.angle=e.wrap(r,-Math.PI,Math.PI),this._setZoom(e.clamp(l,this._minZoom,this._maxZoom)),this._updateSeaLevelZoom(),this._center=this.coordinateLocation(new e.MercatorCoordinate(t[0],t[1],t[2])),this._unmodified=!1,this._constrain(),this._calcMatrices()}_worldSizeFromZoom(e){return Math.pow(2,e)*this.tileSize}_mercatorZfromZoom(e){return this.cameraToCenterDistance/this._worldSizeFromZoom(e)}_minimumHeightOverTerrain(){const e=Math.min((null!=this._seaLevelZoom?this._seaLevelZoom:this._zoom)+2,this._maxZoom);return this._mercatorZfromZoom(e)}_zoomFromMercatorZ(e){return this.scaleZoom(this.cameraToCenterDistance/(e*this.tileSize))}zoomFromMercatorZAdjusted(e){const t=t=>{const i=this.getCameraToCenterDistance(this.projection,t);return this.scaleZoom(i/(e*this.tileSize))};let i,n=t(this.zoom),r=Math.abs(n-t(n));for(;i!==r;)n=t(n),i=r,r=Math.abs(n-t(n));return n}_terrainEnabled(){return!(!this._elevation||!this.projection.supportsTerrain&&(e.warnOnce("Terrain is not yet supported with alternate projections. Use mercator or globe to enable terrain."),1))}anyCornerOffEdge(t,i){const n=Math.min(t.x,i.x),r=Math.max(t.x,i.x),o=Math.min(t.y,i.y),a=Math.max(t.y,i.y);if(oc||i.y>1)return!0}return!1}isHorizonVisible(){return this.pitch+e.radToDeg(this.fovAboveCenter)>88||this.anyCornerOffEdge(new e.pointGeometry(0,0),new e.pointGeometry(this.width,this.height))}zoomDeltaToMovement(t,i){const n=e.length(e.sub([],this._camera.position,t)),r=this._zoomFromMercatorZ(n)+i;return n-this._mercatorZfromZoom(r)}getCameraPoint(){if("globe"===this.projection.name){const t=function(t,i){const n=[t[0],t[1],t[2],1];e.transformMat4$1(n,n,i);const r=Math.max(n[3],1e-6);return[n[0]/r,n[1]/r,n[2]/r,r]}([this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]],this.pixelMatrix);return new e.pointGeometry(t[0],t[1])}{const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new e.pointGeometry(0,t))}}getCameraToCenterDistance(e,t=this.zoom){const i=Zn(e,t,this.width,this.height,1024),n=e.pixelSpaceConversion(this.center.lat,this.worldSize,i);return.5/Math.tan(.5*this._fov)*this.height*n}getWorldToCameraMatrix(){const t=this._camera.getWorldToCamera(this.worldSize,"meters"===this.projection.zAxisUnit?this.pixelsPerMeter:1);return"globe"===this.projection.name&&e.multiply(t,t,this.globeMatrix),t}}function Jn(e,t){let i=!1,n=null;const r=()=>{n=null,i&&(e(),n=setTimeout(r,t),i=!1)};return()=>(i=!0,n||r(),n)}class Qn{constructor(t){this._hashName=t&&encodeURIComponent(t),e.bindAll(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=Jn(this._updateHashUnthrottled.bind(this),300)}addTo(t){return this._map=t,e.window.addEventListener("hashchange",this._onHashChange,!1),t.on("moveend",this._updateHash),this}remove(){return this._map?(this._map.off("moveend",this._updateHash),e.window.removeEventListener("hashchange",this._onHashChange,!1),clearTimeout(this._updateHash()),this._map=void 0,this):this}getHashString(){const t=this._map;if(!t)return"";const i=er(t);if(this._hashName){const t=this._hashName;let n=!1;const r=e.window.location.hash.slice(1).split("&").map((e=>{const r=e.split("=")[0];return r===t?(n=!0,`${r}=${i}`):e})).filter((e=>e));return n||r.push(`${t}=${i}`),`#${r.join("&")}`}return`#${i}`}_getCurrentHash(){const t=e.window.location.hash.replace("#","");if(this._hashName){let e;return t.split("&").map((e=>e.split("="))).forEach((t=>{t[0]===this._hashName&&(e=t)})),(e&&e[1]||"").split("/")}return t.split("/")}_onHashChange(){const e=this._map;if(!e)return!1;const t=this._getCurrentHash();if(t.length>=3&&!t.some((e=>isNaN(e)))){const i=e.dragRotate.isEnabled()&&e.touchZoomRotate.isEnabled()?+(t[3]||0):e.getBearing();return e.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:i,pitch:+(t[4]||0)}),!0}return!1}_updateHashUnthrottled(){const t=e.window.location.href.replace(/(#.+)?$/,this.getHashString());e.window.history.replaceState(e.window.history.state,null,t)}}function er(e,t){const i=e.getCenter(),n=Math.round(100*e.getZoom())/100,r=Math.ceil((n*Math.LN2+Math.log(512/360/.5))/Math.LN10),o=Math.pow(10,r),a=Math.round(i.lng*o)/o,s=Math.round(i.lat*o)/o,l=e.getBearing(),c=e.getPitch();let u=t?`/${a}/${s}/${n}`:`${n}/${s}/${a}`;return(l||c)&&(u+="/"+Math.round(10*l)/10),c&&(u+=`/${Math.round(c)}`),u}const tr={linearity:.3,easing:e.bezier(0,0,.3,1)},ir=e.extend({deceleration:2500,maxSpeed:1400},tr),nr=e.extend({deceleration:20,maxSpeed:1400},tr),rr=e.extend({deceleration:1e3,maxSpeed:360},tr),or=e.extend({deceleration:1e3,maxSpeed:90},tr);class ar{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:e.exported.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,i=e.exported.now();for(;t.length>0&&i-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const i={zoom:0,bearing:0,pitch:0,pan:new e.pointGeometry(0,0),pinchAround:void 0,around:void 0};for(const{settings:e}of this._inertiaBuffer)i.zoom+=e.zoomDelta||0,i.bearing+=e.bearingDelta||0,i.pitch+=e.pitchDelta||0,e.panDelta&&i.pan._add(e.panDelta),e.around&&(i.around=e.around),e.pinchAround&&(i.pinchAround=e.pinchAround);const n=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,r={};if(i.pan.mag()){const o=lr(i.pan.mag(),n,e.extend({},ir,t||{}));r.offset=i.pan.mult(o.amount/i.pan.mag()),r.center=this._map.transform.center,sr(r,o)}if(i.zoom){const e=lr(i.zoom,n,nr);r.zoom=this._map.transform.zoom+e.amount,sr(r,e)}if(i.bearing){const t=lr(i.bearing,n,rr);r.bearing=this._map.transform.bearing+e.clamp(t.amount,-179,179),sr(r,t)}if(i.pitch){const e=lr(i.pitch,n,or);r.pitch=this._map.transform.pitch+e.amount,sr(r,e)}if(r.zoom||r.bearing){const e=void 0===i.pinchAround?i.around:i.pinchAround;r.around=e?this._map.unproject(e):this._map.getCenter()}return this.clear(),r.noMoveStart=!0,r}}function sr(e,t){(!e.duration||e.durationi.unproject(e))),s=o.reduce(((e,t,i,n)=>e.add(t.div(n.length))),new e.pointGeometry(0,0));super(t,{points:o,point:s,lngLats:a,lngLat:i.unproject(s),originalEvent:n}),this._defaultPrevented=!1}}class hr extends e.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t,i){super(e,{originalEvent:i}),this._defaultPrevented=!1}}class dr{constructor(e,t){this._map=e,this._clickTolerance=t.clickTolerance}reset(){this._mousedownPos=void 0}wheel(e){return this._firePreventable(new hr(e.type,this._map,e))}mousedown(e,t){return this._mousedownPos=t,this._firePreventable(new cr(e.type,this._map,e))}mouseup(e){this._map.fire(new cr(e.type,this._map,e))}preclick(t){const i=e.extend({},t);i.type="preclick",this._map.fire(new cr(i.type,this._map,i))}click(e,t){this._mousedownPos&&this._mousedownPos.dist(t)>=this._clickTolerance||(this.preclick(e),this._map.fire(new cr(e.type,this._map,e)))}dblclick(e){return this._firePreventable(new cr(e.type,this._map,e))}mouseover(e){this._map.fire(new cr(e.type,this._map,e))}mouseout(e){this._map.fire(new cr(e.type,this._map,e))}touchstart(e){return this._firePreventable(new ur(e.type,this._map,e))}touchmove(e){this._map.fire(new ur(e.type,this._map,e))}touchend(e){this._map.fire(new ur(e.type,this._map,e))}touchcancel(e){this._map.fire(new ur(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class pr{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._contextMenuEvent=void 0}mousemove(e){this._map.fire(new cr(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new cr("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._map.fire(new cr(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class fr{constructor(e,t){this._map=e,this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=t.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,t){this.isEnabled()&&e.shiftKey&&0===e.button&&(u(),this._startPos=this._lastPos=t,this._active=!0)}mousemoveWindow(e,t){if(!this._active)return;const i=t,n=this._startPos,r=this._lastPos;if(!n||!r||r.equals(i)||!this._box&&i.dist(n){this._box&&(this._box.style.transform=`translate(${a}px,${l}px)`,this._box.style.width=s-a+"px",this._box.style.height=c-l+"px")}))}mouseupWindow(t,i){if(!this._active)return;const n=this._startPos,r=i;if(n&&0===t.button){if(this.reset(),p(),n.x!==r.x||n.y!==r.y)return this._map.fire(new e.Event("boxzoomend",{originalEvent:t})),{cameraAnimation:e=>e.fitScreenCoordinates(n,r,this._map.getBearing(),{linear:!1})};this._fireEvent("boxzoomcancel",t)}}keydown(e){this._active&&27===e.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",e))}blur(){this.reset()}reset(){this._active=!1,this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.remove(),this._box=null),h(),delete this._startPos,delete this._lastPos}_fireEvent(t,i){return this._map.fire(new e.Event(t,{originalEvent:i}))}}function mr(e,t){const i={};for(let n=0;nthis.numTouches)&&(this.aborted=!0),this.aborted||(0===this.startTime&&(this.startTime=t.timeStamp),n.length===this.numTouches&&(this.centroid=function(t){const i=new e.pointGeometry(0,0);for(const e of t)i._add(e);return i.div(t.length)}(i),this.touches=mr(n,i)))}touchmove(e,t,i){if(this.aborted||!this.centroid)return;const n=mr(i,t);for(const e in this.touches){const t=this.touches[e],i=n[e];(!i||i.dist(t)>30)&&(this.aborted=!0)}}touchend(e,t,i){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),0===i.length){const e=!this.aborted&&this.centroid;if(this.reset(),e)return e}}}class _r{constructor(e){this.singleTap=new gr(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,this.lastTap=void 0,this.count=0,this.singleTap.reset()}touchstart(e,t,i){this.singleTap.touchstart(e,t,i)}touchmove(e,t,i){this.singleTap.touchmove(e,t,i)}touchend(e,t,i){const n=this.singleTap.touchend(e,t,i);if(n){const t=e.timeStamp-this.lastTime<500,i=!this.lastTap||this.lastTap.dist(n)<30;if(t&&i||this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=n,this.count===this.numTaps)return this.reset(),n}}}class vr{constructor(){this._zoomIn=new _r({numTouches:1,numTaps:2}),this._zoomOut=new _r({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,t,i){this._zoomIn.touchstart(e,t,i),this._zoomOut.touchstart(e,t,i)}touchmove(e,t,i){this._zoomIn.touchmove(e,t,i),this._zoomOut.touchmove(e,t,i)}touchend(e,t,i){const n=this._zoomIn.touchend(e,t,i),r=this._zoomOut.touchend(e,t,i);return n?(this._active=!0,e.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:t=>t.easeTo({duration:300,zoom:t.getZoom()+1,around:t.unproject(n)},{originalEvent:e})}):r?(this._active=!0,e.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:t=>t.easeTo({duration:300,zoom:t.getZoom()-1,around:t.unproject(r)},{originalEvent:e})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}const yr={0:1,2:2};class xr{constructor(e){this.reset(),this._clickTolerance=e.clickTolerance||1}blur(){this.reset()}reset(){this._active=!1,this._moved=!1,this._lastPoint=void 0,this._eventButton=void 0}_correctButton(e,t){return!1}_move(e,t){return{}}mousedown(e,t){if(this._lastPoint)return;const i=g(e);this._correctButton(e,i)&&(this._lastPoint=t,this._eventButton=i)}mousemoveWindow(e,t){const i=this._lastPoint;if(i)if(e.preventDefault(),null!=this._eventButton&&function(e,t){const i=yr[t];return void 0===e.buttons||(e.buttons&i)!==i}(e,this._eventButton))this.reset();else if(this._moved||!(t.dist(i)0&&(this._active=!0);const r=mr(n,i),o=new e.pointGeometry(0,0),a=new e.pointGeometry(0,0);let s=0;for(const e in r){const t=r[e],i=this._touches[e];i&&(o._add(t),a._add(t.sub(i)),s++,r[e]=t)}if(this._touches=r,s{this._alertContainer.classList.remove("mapboxgl-touch-pan-blocker-show"),this._alertContainer.setAttribute("role","null")}),500)}}class Sr{constructor(){this.reset()}reset(){this._active=!1,this._firstTwoTouches=void 0}_start(e){}_move(e,t,i){return{}}touchstart(e,t,i){this._firstTwoTouches||i.length<2||(this._firstTwoTouches=[i[0].identifier,i[1].identifier],this._start([t[0],t[1]]))}touchmove(e,t,i){const n=this._firstTwoTouches;if(!n)return;e.preventDefault();const[r,o]=n,a=Er(i,t,r),s=Er(i,t,o);if(!a||!s)return;const l=this._aroundCenter?null:a.add(s).div(2);return this._move([a,s],l,e)}touchend(e,t,i){if(!this._firstTwoTouches)return;const[n,r]=this._firstTwoTouches,o=Er(i,t,n),a=Er(i,t,r);o&&a||(this._active&&p(),this.reset())}touchcancel(){this.reset()}enable(e){this._enabled=!0,this._aroundCenter=!!e&&"center"===e.around}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function Er(e,t,i){for(let n=0;nMath.abs(e.x)}class Dr extends Sr{constructor(e){super(),this._map=e}reset(){super.reset(),this._valid=void 0,this._firstMove=void 0,this._lastPoints=void 0}_start(e){this._lastPoints=e,Pr(e[0].sub(e[1]))&&(this._valid=!1)}_move(t,i,n){const r=this._lastPoints;if(!r)return;const o=t[0].sub(r[0]),a=t[1].sub(r[1]);return this._map._cooperativeGestures&&!e.isFullscreen()&&n.touches.length<3||(this._valid=this.gestureBeginsVertically(o,a,n.timeStamp),!this._valid)?void 0:(this._lastPoints=t,this._active=!0,{pitchDelta:(o.y+a.y)/2*-.5})}gestureBeginsVertically(e,t,i){if(void 0!==this._valid)return this._valid;const n=e.mag()>=2,r=t.mag()>=2;if(!n&&!r)return;if(!n||!r)return null==this._firstMove&&(this._firstMove=i),i-this._firstMove<100&&void 0;const o=e.y>0==t.y>0;return Pr(e)&&Pr(t)&&o}}const zr={panStep:100,bearingStep:15,pitchStep:10};class Or{constructor(){const e=zr;this._panStep=e.panStep,this._bearingStep=e.bearingStep,this._pitchStep=e.pitchStep,this._rotationDisabled=!1}blur(){this.reset()}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let t=0,i=0,n=0,r=0,o=0;switch(e.keyCode){case 61:case 107:case 171:case 187:t=1;break;case 189:case 109:case 173:t=-1;break;case 37:e.shiftKey?i=-1:(e.preventDefault(),r=-1);break;case 39:e.shiftKey?i=1:(e.preventDefault(),r=1);break;case 38:e.shiftKey?n=1:(e.preventDefault(),o=-1);break;case 40:e.shiftKey?n=-1:(e.preventDefault(),o=1);break;default:return}return this._rotationDisabled&&(i=0,n=0),{cameraAnimation:a=>{const s=a.getZoom();a.easeTo({duration:300,easeId:"keyboardHandler",easing:Lr,zoom:t?Math.round(s)+t*(e.shiftKey?2:1):s,bearing:a.getBearing()+i*this._bearingStep,pitch:a.getPitch()+n*this._pitchStep,offset:[-r*this._panStep,-o*this._panStep],center:a.getCenter()},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function Lr(e){return e*(2-e)}const Rr=4.000244140625;class Br{constructor(t,i){this._map=t,this._el=t.getCanvasContainer(),this._handler=i,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222,e.bindAll(["_onTimeout","_addScrollZoomBlocker","_showBlockerAlert"],this)}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return this._active||void 0!==this._finishTimeout}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!e&&"center"===e.around,this._map._cooperativeGestures&&this._addScrollZoomBlocker())}disable(){this.isEnabled()&&(this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove()))}wheel(t){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!(t.ctrlKey||t.metaKey||this.isZooming()||e.isFullscreen()))return void this._showBlockerAlert();"hidden"!==this._alertContainer.style.visibility&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}let i=t.deltaMode===e.window.WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const n=e.exported.now(),r=n-(this._lastWheelEventTime||0);this._lastWheelEventTime=n,0!==i&&i%Rr==0?this._type="wheel":0!==i&&Math.abs(i)<4?this._type="trackpad":r>400?(this._type=null,this._lastValue=i,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(r*i)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,i+=this._lastValue)),t.shiftKey&&i&&(i/=4),this._type&&(this._lastWheelEvent=t,this._delta-=i,this._active||this._start(t)),t.preventDefault()}_onTimeout(e){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(e)}_start(e){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const t=f(this._el,e);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:t,this._aroundCoord=this._map.transform.pointCoordinate3D(this._aroundPoint),this._targetZoom=void 0,this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId)return;if(this._frameId=null,!this.isActive())return;const t=this._map.transform;"wheel"===this._type&&t.projection.wrap&&(t._center.lng>=180||t._center.lng<=-180)&&(this._prevEase=null,this._easing=null,this._lastWheelEvent=null,this._lastWheelEventTime=0);const i=()=>t._terrainEnabled()&&this._aroundCoord?t.computeZoomRelativeTo(this._aroundCoord):t.zoom;if(0!==this._delta){const e="wheel"===this._type&&Math.abs(this._delta)>Rr?this._wheelZoomRate:this._defaultZoomRate;let n=2/(1+Math.exp(-Math.abs(this._delta*e)));this._delta<0&&0!==n&&(n=1/n);const r=i(),o=Math.pow(2,r),a="number"==typeof this._targetZoom?t.zoomScale(this._targetZoom):o;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(a*n))),"wheel"===this._type&&(this._startZoom=r,this._easing=this._smoothOutEasing(200)),this._delta=0}const n="number"==typeof this._targetZoom?this._targetZoom:i(),r=this._startZoom,o=this._easing;let a,s=!1;if("wheel"===this._type&&r&&o){const t=Math.min((e.exported.now()-this._lastWheelEventTime)/200,1),i=o(t);a=e.number(r,n,i),t<1?this._frameId||(this._frameId=!0):s=!0}else a=n,s=!0;return this._active=!0,s&&(this._active=!1,this._finishTimeout=setTimeout((()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout}),200)),{noInertia:!0,needsRenderFrame:!s,zoomDelta:a-i(),around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let i=e.ease;if(this._prevEase){const t=this._prevEase,n=(e.exported.now()-t.start)/t.duration,r=t.easing(n+.01)-t.easing(n),o=.27/Math.sqrt(r*r+1e-4)*.01,a=Math.sqrt(.0729-o*o);i=e.bezier(o,a,.25,1)}return this._prevEase={start:e.exported.now(),duration:t,easing:i},i}blur(){this.reset()}reset(){this._active=!1}_addScrollZoomBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=o("div","mapboxgl-scroll-zoom-blocker",this._map._container),this._alertContainer.textContent=/(Mac|iPad)/i.test(e.window.navigator.userAgent)?this._map._getUIString("ScrollZoomBlocker.CmdMessage"):this._map._getUIString("ScrollZoomBlocker.CtrlMessage"),this._alertContainer.style.fontSize=`${Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth)))}px`)}_showBlockerAlert(){this._alertContainer.style.visibility="visible",this._alertContainer.classList.add("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.setAttribute("role","alert"),clearTimeout(this._alertTimer),this._alertTimer=setTimeout((()=>{this._alertContainer.classList.remove("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.setAttribute("role","null")}),200)}}class Fr{constructor(e,t){this._clickZoom=e,this._tapZoom=t}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class $r{constructor(){this.reset()}reset(){this._active=!1}blur(){this.reset()}dblclick(e,t){return e.preventDefault(),{cameraAnimation:i=>{i.easeTo({duration:300,zoom:i.getZoom()+(e.shiftKey?-1:1),around:i.unproject(t)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class jr{constructor(){this._tap=new _r({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,this._swipePoint=void 0,this._swipeTouch=0,this._tapTime=0,this._tap.reset()}touchstart(e,t,i){this._swipePoint||(this._tapTime&&e.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?i.length>0&&(this._swipePoint=t[0],this._swipeTouch=i[0].identifier):this._tap.touchstart(e,t,i))}touchmove(e,t,i){if(this._tapTime){if(this._swipePoint){if(i[0].identifier!==this._swipeTouch)return;const n=t[0],r=n.y-this._swipePoint.y;return this._swipePoint=n,e.preventDefault(),this._active=!0,{zoomDelta:r/128}}}else this._tap.touchmove(e,t,i)}touchend(e,t,i){this._tapTime?this._swipePoint&&0===i.length&&this.reset():this._tap.touchend(e,t,i)&&(this._tapTime=e.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Nr{constructor(e,t,i){this._el=e,this._mousePan=t,this._touchPan=i}enable(e){this._inertiaOptions=e||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("mapboxgl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("mapboxgl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class Ur{constructor(e,t,i){this._pitchWithRotate=e.pitchWithRotate,this._mouseRotate=t,this._mousePitch=i}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class Vr{constructor(e,t,i,n){this._el=e,this._touchZoom=t,this._touchRotate=i,this._tapDragZoom=n,this._rotationDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),this._tapDragZoom.enable(),this._el.classList.add("mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("mapboxgl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}const Gr=e=>e.zoom||e.drag||e.pitch||e.rotate;class qr extends e.Event{}class Wr{constructor(){this.constants=[1,1,.01],this.radius=0}setup(t,i){const n=e.sub([],i,t);this.radius=e.length(n[2]<0?e.div([],n,this.constants):[n[0],n[1],0])}projectRay(t){e.div(t,t,this.constants),e.normalize(t,t),e.mul$1(t,t,this.constants);const i=e.scale$2([],t,this.radius);if(i[2]>0){const t=e.scale$2([],[0,0,1],e.dot(i,[0,0,1])),n=e.scale$2([],e.normalize([],[i[0],i[1],0]),this.radius),r=e.add([],i,e.scale$2([],e.sub([],e.add([],n,t),i),2));i[0]=r[0],i[1]=r[1]}return i}}function Zr(e){return e.panDelta&&e.panDelta.mag()||e.zoomDelta||e.bearingDelta||e.pitchDelta}class Hr{constructor(t,i){this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new ar(t),this._bearingSnap=i.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new Wr,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(i),e.bindAll(["handleEvent","handleWindowEvent"],this);const n=this._el;this._listeners=[[n,"touchstart",{passive:!0}],[n,"touchmove",{passive:!1}],[n,"touchend",void 0],[n,"touchcancel",void 0],[n,"mousedown",void 0],[n,"mousemove",void 0],[n,"mouseup",void 0],[e.window.document,"mousemove",{capture:!0}],[e.window.document,"mouseup",void 0],[n,"mouseover",void 0],[n,"mouseout",void 0],[n,"dblclick",void 0],[n,"click",void 0],[n,"keydown",{capture:!1}],[n,"keyup",void 0],[n,"wheel",{passive:!1}],[n,"contextmenu",void 0],[e.window,"blur",void 0]];for(const[t,i,n]of this._listeners)t.addEventListener(i,t===e.window.document?this.handleWindowEvent:this.handleEvent,n)}destroy(){for(const[t,i,n]of this._listeners)t.removeEventListener(i,t===e.window.document?this.handleWindowEvent:this.handleEvent,n)}_addDefaultHandlers(e){const t=this._map,i=t.getCanvasContainer();this._add("mapEvent",new dr(t,e));const n=t.boxZoom=new fr(t,e);this._add("boxZoom",n);const r=new vr,o=new $r;t.doubleClickZoom=new Fr(o,r),this._add("tapZoom",r),this._add("clickZoom",o);const a=new jr;this._add("tapDragZoom",a);const s=t.touchPitch=new Dr(t);this._add("touchPitch",s);const l=new wr(e),c=new Tr(e);t.dragRotate=new Ur(e,l,c),this._add("mouseRotate",l,["mousePitch"]),this._add("mousePitch",c,["mouseRotate"]);const u=new br(e),h=new Cr(t,e);t.dragPan=new Nr(i,u,h),this._add("mousePan",u),this._add("touchPan",h,["touchZoom","touchRotate"]);const d=new Ir,p=new Ar;t.touchZoomRotate=new Vr(i,p,d,a),this._add("touchRotate",d,["touchPan","touchZoom"]),this._add("touchZoom",p,["touchPan","touchRotate"]),this._add("blockableMapEvent",new pr(t));const f=t.scrollZoom=new Br(t,this);this._add("scrollZoom",f,["mousePan"]);const m=t.keyboard=new Or;this._add("keyboard",m);for(const i of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])e.interactive&&e[i]&&t[i].enable(e[i])}_add(e,t,i){this._handlers.push({handlerName:e,handler:t,allowed:i}),this._handlersById[e]=t}stop(e){if(!this._updatingCamera){for(const{handler:e}of this._handlers)e.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[]}}isActive(){for(const{handler:e}of this._handlers)if(e.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Gr(this._eventsInProgress)||this.isZooming()}_blockedByActive(e,t,i){for(const n in e)if(n!==i&&(!t||t.indexOf(n)<0))return!0;return!1}handleWindowEvent(e){this.handleEvent(e,`${e.type}Window`)}_getMapTouches(e){const t=[];for(const i of e)this._el.contains(i.target)&&t.push(i);return t}handleEvent(e,t){this._updatingCamera=!0;const i="renderFrame"===e.type,n=i?void 0:e,r={needsRenderFrame:!1},o={},a={},s=e.touches?this._getMapTouches(e.touches):void 0,l=s?m(this._el,s):i?void 0:f(this._el,e);for(const{handlerName:i,handler:c,allowed:u}of this._handlers){if(!c.isEnabled())continue;let h;this._blockedByActive(a,u,i)?c.reset():c[t||e.type]&&(h=c[t||e.type](e,l,s),this.mergeHandlerResult(r,o,h,i,n),h&&h.needsRenderFrame&&this._triggerRenderFrame()),(h||c.isActive())&&(a[i]=c)}const c={};for(const e in this._previousActiveHandlers)a[e]||(c[e]=n);this._previousActiveHandlers=a,(Object.keys(c).length||Zr(r))&&(this._changes.push([r,o,c]),this._triggerRenderFrame()),(Object.keys(a).length||Zr(r))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:u}=r;u&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],u(this._map))}mergeHandlerResult(t,i,n,r,o){if(!n)return;e.extend(t,n);const a={handlerName:r,originalEvent:n.originalEvent||o};void 0!==n.zoomDelta&&(i.zoom=a),void 0!==n.panDelta&&(i.drag=a),void 0!==n.pitchDelta&&(i.pitch=a),void 0!==n.bearingDelta&&(i.rotate=a)}_applyChanges(){const t={},i={},n={};for(const[r,o,a]of this._changes)r.panDelta&&(t.panDelta=(t.panDelta||new e.pointGeometry(0,0))._add(r.panDelta)),r.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+r.zoomDelta),r.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+r.bearingDelta),r.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+r.pitchDelta),void 0!==r.around&&(t.around=r.around),void 0!==r.aroundCoord&&(t.aroundCoord=r.aroundCoord),void 0!==r.pinchAround&&(t.pinchAround=r.pinchAround),r.noInertia&&(t.noInertia=r.noInertia),e.extend(i,o),e.extend(n,a);this._updateMapTransform(t,i,n),this._changes=[]}_updateMapTransform(t,i,n){const r=this._map,o=r.transform,a=e=>[e.x,e.y,e.z];if((e=>{const t=this._eventsInProgress.drag;return t&&!this._handlersById[t.handlerName].isActive()})()&&!Zr(t)){const e=o.zoom;o.cameraElevationReference="sea",o.recenterOnTerrain(),o.cameraElevationReference="ground",e!==o.zoom&&this._map._update(!0)}if(!Zr(t))return void this._fireEvents(i,n,!0);let{panDelta:s,zoomDelta:l,bearingDelta:c,pitchDelta:u,around:h,aroundCoord:d,pinchAround:p}=t;void 0!==p&&(h=p),(e=>i.drag&&!this._eventsInProgress.drag)()&&h&&(this._dragOrigin=a(o.pointCoordinate3D(h)),this._trackingEllipsoid.setup(o._camera.position,this._dragOrigin)),o.cameraElevationReference="sea",r._stop(!0),h=h||r.transform.centerPoint,c&&(o.bearing+=c),u&&(o.pitch+=u),o._updateCameraState();const f=[0,0,0];if(s)if("mercator"===o.projection.name){const e=this._trackingEllipsoid.projectRay(o.screenPointToMercatorRay(h).dir),t=this._trackingEllipsoid.projectRay(o.screenPointToMercatorRay(h.sub(s)).dir);f[0]=t[0]-e[0],f[1]=t[1]-e[1]}else{const t=o.pointCoordinate(h);if("globe"===o.projection.name){s=s.rotate(-o.angle);const i=o._pixelsPerMercatorPixel/o.worldSize;f[0]=-s.x*e.mercatorScale(e.latFromMercatorY(t.y))*i,f[1]=-s.y*e.mercatorScale(o.center.lat)*i}else{const e=o.pointCoordinate(h.sub(s));t&&e&&(f[0]=e.x-t.x,f[1]=e.y-t.y)}}const m=o.zoom,g=[0,0,0];if(l){const t=a(d||o.pointCoordinate3D(h)),i={dir:e.normalize([],e.sub([],t,o._camera.position))};if(i.dir[2]<0){const n=o.zoomDeltaToMovement(t,l);e.scale$2(g,i.dir,n)}}const _=e.add(f,f,g);o._translateCameraConstrained(_),l&&Math.abs(o.zoom-m)>1e-4&&o.recenterOnTerrain(),o.cameraElevationReference="ground",this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(i,n,!0)}_fireEvents(t,i,n){const r=Gr(this._eventsInProgress),o=Gr(t),a={};for(const e in t){const{originalEvent:i}=t[e];this._eventsInProgress[e]||(a[`${e}start`]=i),this._eventsInProgress[e]=t[e]}!r&&o&&this._fireEvent("movestart",o.originalEvent);for(const e in a)this._fireEvent(e,a[e]);o&&this._fireEvent("move",o.originalEvent);for(const e in t){const{originalEvent:i}=t[e];this._fireEvent(e,i)}const s={};let l;for(const e in this._eventsInProgress){const{handlerName:t,originalEvent:n}=this._eventsInProgress[e];this._handlersById[t].isActive()||(delete this._eventsInProgress[e],l=i[t]||n,s[`${e}end`]=l)}for(const e in s)this._fireEvent(e,s[e]);const c=Gr(this._eventsInProgress);if(n&&(r||o)&&!c){this._updatingCamera=!0;const t=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),i=e=>0!==e&&-this._bearingSnap{this._frameId=void 0,this.handleEvent(new qr("renderFrame",{timeStamp:e})),this._applyChanges()}))}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}}const Xr="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class Yr extends e.Evented{constructor(t,i){super(),this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=i.bearingSnap,e.bindAll(["_renderFrameCallback"],this)}getCenter(){return new e.LngLat(this.transform.center.lng,this.transform.center.lat)}setCenter(e,t){return this.jumpTo({center:e},t)}panBy(t,i,n){return t=e.pointGeometry.convert(t).mult(-1),this.panTo(this.transform.center,e.extend({offset:t},i),n)}panTo(t,i,n){return this.easeTo(e.extend({center:t},i),n)}getZoom(){return this.transform.zoom}setZoom(e,t){return this.jumpTo({zoom:e},t),this}zoomTo(t,i,n){return this.easeTo(e.extend({zoom:t},i),n)}zoomIn(e,t){return this.zoomTo(this.getZoom()+1,e,t),this}zoomOut(e,t){return this.zoomTo(this.getZoom()-1,e,t),this}getBearing(){return this.transform.bearing}setBearing(e,t){return this.jumpTo({bearing:e},t),this}getPadding(){return this.transform.padding}setPadding(e,t){return this.jumpTo({padding:e},t),this}rotateTo(t,i,n){return this.easeTo(e.extend({bearing:t},i),n)}resetNorth(t,i){return this.rotateTo(0,e.extend({duration:1e3},t),i),this}resetNorthPitch(t,i){return this.easeTo(e.extend({bearing:0,pitch:0,duration:1e3},t),i),this}snapToNorth(e,t){return Math.abs(this.getBearing())e.aspect?i/(2*Math.tan(.5*e.fovX)*e.aspect):n/(2*Math.tan(.5*e.fovY)*e.aspect)}_cameraForBoundsOnGlobe(t,i,n,r,o){const a=t.clone(),s=this._extendCameraOptions(o);a.bearing=r;const l=e.LngLat.convert(i),c=e.LngLat.convert(n),u=.5*(l.lat+c.lat),h=.5*(l.lng+c.lng),d=e.latLngToECEF(u,h),p=e.normalize([],d),f=e.normalize([],e.cross([],p,[0,1,0])),m=e.cross([],f,p),g=[f[0],f[1],f[2],0,m[0],m[1],m[2],0,p[0],p[1],p[2],0,0,0,0,1],_=[d,e.latLngToECEF(l.lat,l.lng),e.latLngToECEF(c.lat,l.lng),e.latLngToECEF(c.lat,c.lng),e.latLngToECEF(l.lat,c.lng),e.latLngToECEF(u,l.lng),e.latLngToECEF(u,c.lng),e.latLngToECEF(l.lat,h),e.latLngToECEF(c.lat,h)];let v=e.Aabb.fromPoints(_.map((t=>[e.dot(f,t),e.dot(m,t),e.dot(p,t)])));const y=e.transformMat4([],v.center,g);0===e.squaredLength(y)&&e.set(y,0,0,1),e.normalize(y,y),e.scale$2(y,y,e.GLOBE_RADIUS),a.center=e.ecefToLatLng(y);const x=a.getWorldToCameraMatrix(),b=e.invert(new Float64Array(16),x);v=e.Aabb.applyTransform(v,e.multiply([],x,g)),e.transformMat4(y,y,x);const w=.5*(v.max[2]-v.min[2]),T=this._minimumAABBFrustumDistance(a,v),C=e.scale$2([],[0,0,1],w),S=e.add(C,y,C),E=T+(0===a.pitch?0:e.distance(y,S)),k=a.globeCenterInViewSpace,A=e.sub([],y,[k[0],k[1],k[2]]);e.normalize(A,A),e.scale$2(A,A,E);const M=e.add([],y,A);e.transformMat4(M,M,b);const I=e.earthRadius/e.GLOBE_RADIUS,P=e.length(M),D=e.mercatorZfromAltitude(P*I-e.earthRadius,0),z=Math.min(a.zoomFromMercatorZAdjusted(D),s.maxZoom);return z>.5*(e.GLOBE_ZOOM_THRESHOLD_MIN+e.GLOBE_ZOOM_THRESHOLD_MAX)?(a.setProjection({name:"mercator"}),a.zoom=z,this._cameraForBounds(a,i,n,r,o)):{center:a.center,zoom:z,bearing:r}}queryTerrainElevation(t,i){const n=this.transform.elevation;return n?(i=e.extend({},{exaggerated:!0},i),n.getAtPoint(e.MercatorCoordinate.fromLngLat(t),null,i.exaggerated)):null}_cameraForBounds(t,i,n,r,o){if("globe"===t.projection.name)return this._cameraForBoundsOnGlobe(t,i,n,r,o);const a=t.clone(),s=this._extendCameraOptions(o),l=a.padding;a.bearing=r;const c=e.LngLat.convert(i),u=e.LngLat.convert(n),h=new e.LngLat(c.lng,u.lat),d=new e.LngLat(u.lng,c.lat),p=a.project(c),f=a.project(u),m=this.queryTerrainElevation(c),g=this.queryTerrainElevation(u),_=this.queryTerrainElevation(h),v=this.queryTerrainElevation(d),y=[[p.x,p.y,Math.min(m||0,g||0,_||0,v||0)],[f.x,f.y,Math.max(m||0,g||0,_||0,v||0)]];let x=e.Aabb.fromPoints(y);const b=a.getWorldToCameraMatrix(),w=e.invert(new Float64Array(16),b);x=e.Aabb.applyTransform(x,b);const T=e.sub([],x.max,x.min),C=l.left||0,S=l.right||0,E=l.bottom||0,k=l.top||0,{left:A,right:M,top:I,bottom:P}=s.padding,D=.5*(C+S),z=.5*(k+E),O=Math.min(a.scaleZoom(a.scale*Math.min((a.width-(C+S+A+M))/T[0],(a.height-(E+k+P+I))/T[1])),s.maxZoom),L=a.scale/a.zoomScale(O);x=new e.Aabb([x.min[0]-(A+D)*L,x.min[1]-(P+z)*L,x.min[2]],[x.max[0]+(M+D)*L,x.max[1]+(I+z)*L,x.max[2]]);const R=.5*T[2],B=this._minimumAABBFrustumDistance(a,x),F=[0,0,1,0];e.transformMat4$1(F,F,b),e.normalize$2(F,F);const $=e.scale$2([],F,B+R),j=e.add([],x.center,$),N=("number"==typeof s.offset.x&&"number"==typeof s.offset.y?new e.pointGeometry(s.offset.x,s.offset.y):e.pointGeometry.convert(s.offset)).rotate(-e.degToRad(r));x.center[0]-=N.x*L,x.center[1]+=N.y*L,e.transformMat4(x.center,x.center,w),e.transformMat4(j,j,w);const U=[x.center[0],x.center[1],j[2]*a.pixelsPerMeter];e.scale$2(U,U,1/a.worldSize);const V=e.lngFromMercatorX(U[0]),G=e.latFromMercatorY(U[1]),q=Math.min(a._zoomFromMercatorZ(U[2]),s.maxZoom),W=new e.LngLat(V,G);return a.mercatorFromTransition&&q<.5*(e.GLOBE_ZOOM_THRESHOLD_MIN+e.GLOBE_ZOOM_THRESHOLD_MAX)?(a.setProjection({name:"globe"}),a.zoom=q,this._cameraForBounds(a,i,n,r,o)):{center:W,zoom:q,bearing:r}}fitBounds(e,t,i){const n=this.cameraForBounds(e,t);return this._fitInternal(n,t,i)}fitScreenCoordinates(t,i,n,r,o){const a=e.pointGeometry.convert(t),s=e.pointGeometry.convert(i),l=new e.pointGeometry(Math.min(a.x,s.x),Math.min(a.y,s.y)),c=new e.pointGeometry(Math.max(a.x,s.x),Math.max(a.y,s.y));if("mercator"===this.transform.projection.name&&this.transform.anyCornerOffEdge(a,s))return this;const u=this.transform.pointLocation3D(l),h=this.transform.pointLocation3D(c),d=this.transform.pointLocation3D(new e.pointGeometry(l.x,c.y)),p=this.transform.pointLocation3D(new e.pointGeometry(c.x,l.y)),f=[Math.min(u.lng,h.lng,d.lng,p.lng),Math.min(u.lat,h.lat,d.lat,p.lat)],m=[Math.max(u.lng,h.lng,d.lng,p.lng),Math.max(u.lat,h.lat,d.lat,p.lat)],g=this._cameraForBounds(this.transform,f,m,n,r);return this._fitInternal(g,r,o)}_fitInternal(t,i,n){return t?(delete(i=e.extend(t,i)).padding,i.linear?this.easeTo(i,n):this.flyTo(i,n)):this}jumpTo(t,i){this.stop();const n=t.preloadOnly?this.transform.clone():this.transform;let r=!1,o=!1,a=!1;return"zoom"in t&&n.zoom!==+t.zoom&&(r=!0,n.zoom=+t.zoom),void 0!==t.center&&(n.center=e.LngLat.convert(t.center)),"bearing"in t&&n.bearing!==+t.bearing&&(o=!0,n.bearing=+t.bearing),"pitch"in t&&n.pitch!==+t.pitch&&(a=!0,n.pitch=+t.pitch),null==t.padding||n.isPaddingEqual(t.padding)||(n.padding=t.padding),t.preloadOnly?(this._preloadTiles(n),this):(this.fire(new e.Event("movestart",i)).fire(new e.Event("move",i)),r&&this.fire(new e.Event("zoomstart",i)).fire(new e.Event("zoom",i)).fire(new e.Event("zoomend",i)),o&&this.fire(new e.Event("rotatestart",i)).fire(new e.Event("rotate",i)).fire(new e.Event("rotateend",i)),a&&this.fire(new e.Event("pitchstart",i)).fire(new e.Event("pitch",i)).fire(new e.Event("pitchend",i)),this.fire(new e.Event("moveend",i)))}getFreeCameraOptions(){return this.transform.projection.supportsFreeCamera||e.warnOnce(Xr),this.transform.getFreeCameraOptions()}setFreeCameraOptions(t,i){const n=this.transform;if(!n.projection.supportsFreeCamera)return e.warnOnce(Xr),this;this.stop();const r=n.zoom,o=n.pitch,a=n.bearing;n.setFreeCameraOptions(t);const s=r!==n.zoom,l=o!==n.pitch,c=a!==n.bearing;return this.fire(new e.Event("movestart",i)).fire(new e.Event("move",i)),s&&this.fire(new e.Event("zoomstart",i)).fire(new e.Event("zoom",i)).fire(new e.Event("zoomend",i)),c&&this.fire(new e.Event("rotatestart",i)).fire(new e.Event("rotate",i)).fire(new e.Event("rotateend",i)),l&&this.fire(new e.Event("pitchstart",i)).fire(new e.Event("pitch",i)).fire(new e.Event("pitchend",i)),this.fire(new e.Event("moveend",i)),this}easeTo(t,i){this._stop(!1,t.easeId),(!1===(t=e.extend({offset:[0,0],duration:500,easing:e.ease},t)).animate||!t.essential&&e.exported.prefersReducedMotion)&&(t.duration=0);const n=this.transform,r=this.getZoom(),o=this.getBearing(),a=this.getPitch(),s=this.getPadding(),l="zoom"in t?+t.zoom:r,c="bearing"in t?this._normalizeBearing(t.bearing,o):o,u="pitch"in t?+t.pitch:a,h="padding"in t?t.padding:n.padding,d=e.pointGeometry.convert(t.offset);let p,f,m;if("globe"===n.projection.name){const i=e.MercatorCoordinate.fromLngLat(n.center),r=d.rotate(-n.angle);i.x+=r.x/n.worldSize,i.y+=r.y/n.worldSize;const o=i.toLngLat(),a=e.LngLat.convert(t.center||o);this._normalizeCenter(a),p=n.centerPoint.add(r),f=new e.pointGeometry(i.x,i.y).mult(n.worldSize),m=new e.pointGeometry(e.mercatorXfromLng(a.lng),e.mercatorYfromLat(a.lat)).mult(n.worldSize).sub(f)}else{p=n.centerPoint.add(d);const i=n.pointLocation(p),r=e.LngLat.convert(t.center||i);this._normalizeCenter(r),f=n.project(i),m=n.project(r).sub(f)}const g=n.zoomScale(l-r);let _,v;t.around&&(_=e.LngLat.convert(t.around),v=n.locationPoint(_));const y=this._zooming||l!==r,x=this._rotating||o!==c,b=this._pitching||u!==a,w=!n.isPaddingEqual(h),T=n=>T=>{if(y&&(n.zoom=e.number(r,l,T)),x&&(n.bearing=e.number(o,c,T)),b&&(n.pitch=e.number(a,u,T)),w&&(n.interpolatePadding(s,h,T),p=n.centerPoint.add(d)),_)n.setLocationAtPoint(_,v);else{const e=n.zoomScale(n.zoom-r),t=l>r?Math.min(2,g):Math.max(.5,g),i=Math.pow(t,1-T),o=n.unproject(f.add(m.mult(T*i)).mult(e));n.setLocationAtPoint(n.renderWorldCopies?o.wrap():o,p)}return t.preloadOnly||this._fireMoveEvents(i),n};if(t.preloadOnly){const e=this._emulate(T,t.duration,n);return this._preloadTiles(e),this}const C={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=y,this._rotating=x,this._pitching=b,this._padding=w,this._easeId=t.easeId,this._prepareEase(i,t.noMoveStart,C),this._ease(T(n),(e=>{n.recenterOnTerrain(),this._afterEase(i,e)}),t),this}_prepareEase(t,i,n={}){this._moving=!0,this.transform.cameraElevationReference="sea",i||n.moving||this.fire(new e.Event("movestart",t)),this._zooming&&!n.zooming&&this.fire(new e.Event("zoomstart",t)),this._rotating&&!n.rotating&&this.fire(new e.Event("rotatestart",t)),this._pitching&&!n.pitching&&this.fire(new e.Event("pitchstart",t))}_fireMoveEvents(t){this.fire(new e.Event("move",t)),this._zooming&&this.fire(new e.Event("zoom",t)),this._rotating&&this.fire(new e.Event("rotate",t)),this._pitching&&this.fire(new e.Event("pitch",t))}_afterEase(t,i){if(this._easeId&&i&&this._easeId===i)return;this._easeId=void 0,this.transform.cameraElevationReference="ground";const n=this._zooming,r=this._rotating,o=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,n&&this.fire(new e.Event("zoomend",t)),r&&this.fire(new e.Event("rotateend",t)),o&&this.fire(new e.Event("pitchend",t)),this.fire(new e.Event("moveend",t))}flyTo(t,i){if(!t.essential&&e.exported.prefersReducedMotion){const n=e.pick(t,["center","zoom","bearing","pitch","around"]);return this.jumpTo(n,i)}this.stop(),t=e.extend({offset:[0,0],speed:1.2,curve:1.42,easing:e.ease},t);const n=this.transform,r=this.getZoom(),o=this.getBearing(),a=this.getPitch(),s=this.getPadding(),l="zoom"in t?e.clamp(+t.zoom,n.minZoom,n.maxZoom):r,c="bearing"in t?this._normalizeBearing(t.bearing,o):o,u="pitch"in t?+t.pitch:a,h="padding"in t?t.padding:n.padding,d=n.zoomScale(l-r),p=e.pointGeometry.convert(t.offset);let f=n.centerPoint.add(p);const m=n.pointLocation(f),g=e.LngLat.convert(t.center||m);this._normalizeCenter(g);const _=n.project(m),v=n.project(g).sub(_);let y=t.curve;const x=Math.max(n.width,n.height),b=x/d,w=v.mag();if("minZoom"in t){const i=e.clamp(Math.min(t.minZoom,r,l),n.minZoom,n.maxZoom),o=x/n.zoomScale(i-r);y=Math.sqrt(o/w*2)}const T=y*y;function C(e){const t=(b*b-x*x+(e?-1:1)*T*T*w*w)/(2*(e?b:x)*T*w);return Math.log(Math.sqrt(t*t+1)-t)}function S(e){return(Math.exp(e)-Math.exp(-e))/2}function E(e){return(Math.exp(e)+Math.exp(-e))/2}const k=C(0);let A=function(e){return E(k)/E(k+y*e)},M=function(e){return x*((E(k)*(S(t=k+y*e)/E(t))-S(k))/T)/w;var t},I=(C(1)-k)/y;if(Math.abs(w)<1e-6||!isFinite(I)){if(Math.abs(x-b)<1e-6)return this.easeTo(t,i);const e=bt.maxDuration&&(t.duration=0);const P=o!==c,D=u!==a,z=!n.isPaddingEqual(h),O=n=>d=>{const m=d*I,y=1/A(m);n.zoom=1===d?l:r+n.scaleZoom(y),P&&(n.bearing=e.number(o,c,d)),D&&(n.pitch=e.number(a,u,d)),z&&(n.interpolatePadding(s,h,d),f=n.centerPoint.add(p));const x=1===d?g:n.unproject(_.add(v.mult(M(m))).mult(y));return n.setLocationAtPoint(n.renderWorldCopies?x.wrap():x,f),n._updateCameraOnTerrain(),t.preloadOnly||this._fireMoveEvents(i),n};if(t.preloadOnly){const e=this._emulate(O,t.duration,n);return this._preloadTiles(e),this}return this._zooming=!0,this._rotating=P,this._pitching=D,this._padding=z,this._prepareEase(i,!1),this._ease(O(n),(()=>this._afterEase(i)),t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(e,t){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),this._easeFrameId=void 0,this._onEaseFrame=void 0),this._onEaseEnd){const e=this._onEaseEnd;this._onEaseEnd=void 0,e.call(this,t)}if(!e){const e=this.handlers;e&&e.stop(!1)}return this}_ease(t,i,n){!1===n.animate||0===n.duration?(t(1),i()):(this._easeStart=e.exported.now(),this._easeOptions=n,this._onEaseFrame=t,this._onEaseEnd=i,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const t=Math.min((e.exported.now()-this._easeStart)/this._easeOptions.duration,1),i=this._onEaseFrame;i&&i(this._easeOptions.easing(t)),t<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(t,i){t=e.wrap(t,-180,180);const n=Math.abs(t-i);return Math.abs(t-360-i)180?-360:i<-180?360:0}_emulate(e,t,i){const n=Math.ceil(15*t/1e3),r=[],o=e(i.clone());for(let e=0;e<=n;e++){const t=o(e/n);r.push(t.clone())}return r}}class Kr{constructor(t={}){this.options=t,e.bindAll(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)}getDefaultPosition(){return"bottom-right"}onAdd(e){const t=this.options&&this.options.compact;return this._map=e,this._container=o("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=o("button","mapboxgl-ctrl-attrib-button",this._container),o("span","mapboxgl-ctrl-icon",this._compactButton).setAttribute("aria-hidden","true"),this._compactButton.type="button",this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=o("div","mapboxgl-ctrl-attrib-inner",this._container),this._innerContainer.setAttribute("role","list"),t&&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===t&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container}onRemove(){this._container.remove(),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}_setElementTitle(e,t){const i=this._map._getUIString(`AttributionControl.${t}`);e.setAttribute("aria-label",i),e.removeAttribute("title"),e.firstElementChild&&e.firstElementChild.setAttribute("title",i)}_toggleAttribution(){this._container.classList.contains("mapboxgl-compact-show")?(this._container.classList.remove("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","false")):(this._container.classList.add("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","true"))}_updateEditLink(){let t=this._editLink;t||(t=this._editLink=this._container.querySelector(".mapbox-improve-map"));const i=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||e.config.ACCESS_TOKEN}];if(t){const n=i.reduce(((e,t,n)=>(t.value&&(e+=`${t.key}=${t.value}${ne.length-t.length)),e=e.filter(((t,i)=>{for(let n=i+1;n=0)return!1;return!0})),this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=[...this.options.customAttribution,...e]:e.unshift(this.options.customAttribution));const i=e.join(" | ");i!==this._attribHTML&&(this._attribHTML=i,e.length?(this._innerContainer.innerHTML=i,this._container.classList.remove("mapboxgl-attrib-empty")):this._container.classList.add("mapboxgl-attrib-empty"),this._editLink=null)}_updateCompact(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("mapboxgl-compact"):this._container.classList.remove("mapboxgl-compact","mapboxgl-compact-show")}}class Jr{constructor(){e.bindAll(["_updateLogo","_updateCompact"],this)}onAdd(e){this._map=e,this._container=o("div","mapboxgl-ctrl");const t=o("a","mapboxgl-ctrl-logo");return t.target="_blank",t.rel="noopener nofollow",t.href="https://www.mapbox.com/",t.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),t.setAttribute("rel","noopener nofollow"),this._container.appendChild(t),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact)}getDefaultPosition(){return"bottom-left"}_updateLogo(e){e&&"metadata"!==e.sourceDataType||(this._container.style.display=this._logoRequired()?"block":"none")}_logoRequired(){if(!this._map.style)return!0;const e=this._map.style._sourceCaches;if(0===Object.entries(e).length)return!0;for(const t in e){const i=e[t].getSource();if(i.hasOwnProperty("mapbox_logo")&&!i.mapbox_logo)return!1}return!0}_updateCompact(){const e=this._container.children;if(e.length){const t=e[0];this._map.getCanvasContainer().offsetWidth<250?t.classList.add("mapboxgl-compact"):t.classList.remove("mapboxgl-compact")}}}class Qr{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){const t=++this._id;return this._queue.push({callback:e,id:t,cancelled:!1}),t}remove(e){const t=this._currentlyRunning,i=t?this._queue.concat(t):this._queue;for(const t of i)if(t.id===e)return void(t.cancelled=!0)}run(e=0){const t=this._currentlyRunning=this._queue;this._queue=[];for(const i of t)if(!i.cancelled&&(i.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}function eo(t,i,n){if(t=new e.LngLat(t.lng,t.lat),i){const r=new e.LngLat(t.lng-360,t.lat),o=new e.LngLat(t.lng+360,t.lat),a=360*Math.ceil(Math.abs(t.lng-n.center.lng)/360),s=n.locationPoint(t).distSqr(i),l=i.x<0||i.y<0||i.x>n.width||i.y>n.height;n.locationPoint(r).distSqr(i)180;){const e=n.locationPoint(t);if(e.x>=0&&e.y>=0&&e.x<=n.width&&e.y<=n.height)break;t.lng>n.center.lng?t.lng-=360:t.lng+=360}return t}const to={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%)"};class io extends e.Evented{constructor(t,i){if(super(),(t instanceof e.window.HTMLElement||i)&&(t=e.extend({element:t},i)),e.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer"],this),this._anchor=t&&t.anchor||"center",this._color=t&&t.color||"#3FB1CE",this._scale=t&&t.scale||1,this._draggable=t&&t.draggable||!1,this._clickTolerance=t&&t.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=t&&t.rotation||0,this._rotationAlignment=t&&t.rotationAlignment||"auto",this._pitchAlignment=t&&t.pitchAlignment&&t.pitchAlignment||"auto",this._updateMoving=()=>this._update(!0),this._occludedOpacity=t&&t.occludedOpacity||.2,t&&t.element)this._element=t.element,this._offset=e.pointGeometry.convert(t&&t.offset||[0,0]);else{this._defaultMarker=!0,this._element=o("div");const i=41,n=27,r=a("svg",{display:"block",height:i*this._scale+"px",width:n*this._scale+"px",viewBox:`0 0 ${n} ${i}`},this._element),s=a("radialGradient",{id:"shadowGradient"},a("defs",{},r));a("stop",{offset:"10%","stop-opacity":.4},s),a("stop",{offset:"100%","stop-opacity":.05},s),a("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"},r),a("path",{fill:this._color,d:"M27,13.5C27,19.07 20.25,27 14.75,34.5C14.02,35.5 12.98,35.5 12.25,34.5C6.75,27 0,19.22 0,13.5C0,6.04 6.04,0 13.5,0C20.96,0 27,6.04 27,13.5Z"},r),a("path",{opacity:.25,d:"M13.5,0C6.04,0 0,6.04 0,13.5C0,19.22 6.75,27 12.25,34.5C13,35.52 14.02,35.5 14.75,34.5C20.25,27 27,19.07 27,13.5C27,6.04 20.96,0 13.5,0ZM13.5,1C20.42,1 26,6.58 26,13.5C26,15.9 24.5,19.18 22.22,22.74C19.95,26.3 16.71,30.14 13.94,33.91C13.74,34.18 13.61,34.32 13.5,34.44C13.39,34.32 13.26,34.18 13.06,33.91C10.28,30.13 7.41,26.31 5.02,22.77C2.62,19.23 1,15.95 1,13.5C1,6.58 6.58,1 13.5,1Z"},r),a("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},r),this._offset=e.pointGeometry.convert(t&&t.offset||[0,-14])}this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label","Map marker"),this._element.classList.add("mapboxgl-marker"),this._element.addEventListener("dragstart",(e=>{e.preventDefault()})),this._element.addEventListener("mousedown",(e=>{e.preventDefault()}));const n=this._element.classList;for(const e in to)n.remove(`mapboxgl-marker-anchor-${e}`);n.add(`mapboxgl-marker-anchor-${this._anchor}`),this._popup=null}addTo(e){return e===this._map||(this.remove(),this._map=e,e.getCanvasContainer().appendChild(this._element),e.on("move",this._updateMoving),e.on("moveend",this._update),e.on("remove",this._clearFadeTimer),e._addMarker(this),this.setDraggable(this._draggable),this._update(),e.on("click",this._onMapClick)),this}remove(){const e=this._map;return e&&(e.off("click",this._onMapClick),e.off("move",this._updateMoving),e.off("moveend",this._update),e.off("mousedown",this._addDragHandler),e.off("touchstart",this._addDragHandler),e.off("mouseup",this._onUp),e.off("touchend",this._onUp),e.off("mousemove",this._onMove),e.off("touchmove",this._onMove),e.off("remove",this._clearFadeTimer),e._removeMarker(this),this._map=void 0),this._clearFadeTimer(),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=e.LngLat.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(!0),this}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeAttribute("role"),this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),e){if(!("offset"in e.options)){const t=38.1,i=13.5,n=Math.sqrt(Math.pow(i,2)/2);e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-t],"bottom-left":[n,-1*(t-i+n)],"bottom-right":[-n,-1*(t-i+n)],left:[i,-1*(t-i)],right:[-i,-1*(t-i)]}:this._offset}this._popup=e,e._marker=this,this._lngLat&&this._popup.setLngLat(this._lngLat),this._element.setAttribute("role","button"),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress),this._element.setAttribute("aria-expanded","false")}return this}_onKeyPress(e){const t=e.code,i=e.charCode||e.keyCode;"Space"!==t&&"Enter"!==t&&32!==i&&13!==i||this.togglePopup()}_onMapClick(e){const t=e.originalEvent.target,i=this._element;this._popup&&(t===i||i.contains(t))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const e=this._popup;return e?(e.isOpen()?(e.remove(),this._element.setAttribute("aria-expanded","false")):this._map&&(e.addTo(this._map),this._element.setAttribute("aria-expanded","true")),this):this}_behindTerrain(){const e=this._map,t=this._pos;if(!e||!t)return!1;const i=e.unproject(t),n=e.getFreeCameraOptions();if(!n.position)return!1;const r=n.position.toLngLat();return r.distanceTo(i)<.9*r.distanceTo(this._lngLat)}_evaluateOpacity(){const t=this._map;if(!t)return;const i=this._pos;if(!i||i.x<0||i.x>t.transform.width||i.y<0||i.y>t.transform.height)return void this._clearFadeTimer();const n=t.unproject(i);let r;t._showingGlobe()&&e.isLngLatBehindGlobe(t.transform,this._lngLat)?r=0:(r=1-t._queryFogOpacity(n),t.transform._terrainEnabled()&&t.getTerrain()&&this._behindTerrain()&&(r*=this._occludedOpacity)),this._element.style.opacity=`${r}`,this._element.style.pointerEvents=r>0?"auto":"none",this._popup&&this._popup._setOpacity(r),this._fadeTimer=null}_clearFadeTimer(){this._fadeTimer&&(clearTimeout(this._fadeTimer),this._fadeTimer=null)}_updateDOM(){const e=this._pos;if(!e||!this._map)return;const t=this._offset.mult(this._scale);this._element.style.transform=`\n translate(${e.x}px,${e.y}px)\n ${to[this._anchor]}\n ${this._calculateXYTransform()} ${this._calculateZTransform()}\n translate(${t.x}px,${t.y}px)\n `}_calculateXYTransform(){const t=this._pos,i=this._map,n=this.getPitchAlignment();if(!i||!t||"map"!==n)return"";if(!i._showingGlobe()){const e=i.getPitch();return e?`rotateX(${e}deg)`:""}const r=e.radToDeg(e.globeTiltAtLngLat(i.transform,this._lngLat)),o=t.sub(e.globeCenterToScreenPoint(i.transform)),a=Math.abs(o.x)+Math.abs(o.y);if(0===a)return"";const s=r/a;return`rotateX(${-o.y*s}deg) rotateY(${o.x*s}deg)`}_calculateZTransform(){const t=this._pos,i=this._map;if(!i||!t)return"";let n=0;const r=this.getRotationAlignment();if("map"===r)if(i._showingGlobe()){const t=i.project(new e.LngLat(this._lngLat.lng,this._lngLat.lat+.001)),r=i.project(new e.LngLat(this._lngLat.lng,this._lngLat.lat-.001)).sub(t);n=e.radToDeg(Math.atan2(r.y,r.x))-90}else n=-i.getBearing();else if("horizon"===r){const r=e.smoothstep(4,6,i.getZoom()),o=e.globeCenterToScreenPoint(i.transform);o.y+=r*i.transform.height;const a=t.sub(o),s=e.radToDeg(Math.atan2(a.y,a.x));n=(s>90?s-270:s+90)*(1-r)}return n+=this._rotation,n?`rotateZ(${n}deg)`:""}_update(t){e.window.cancelAnimationFrame(this._updateFrameId);const i=this._map;i&&(i.transform.renderWorldCopies&&(this._lngLat=eo(this._lngLat,this._pos,i.transform)),this._pos=i.project(this._lngLat),!0===t?this._updateFrameId=e.window.requestAnimationFrame((()=>{this._element&&this._pos&&this._anchor&&(this._pos=this._pos.round(),this._updateDOM())})):this._pos=this._pos.round(),i._requestDomTask((()=>{this._map&&(this._element&&this._pos&&this._anchor&&this._updateDOM(),(i._showingGlobe()||i.getTerrain()||i.getFog())&&!this._fadeTimer&&(this._fadeTimer=setTimeout(this._evaluateOpacity.bind(this),60)))})))}getOffset(){return this._offset}setOffset(t){return this._offset=e.pointGeometry.convert(t),this._update(),this}_onMove(t){const i=this._map;if(!i)return;const n=this._pointerdownPos,r=this._positionDelta;if(n&&r){if(!this._isDragging){const e=this._clickTolerance||i._clickTolerance;if(t.point.dist(n)=this._endTime)return this._end;const i=e.easeCubicInOut((t-this._startTime)/(this._endTime-this._startTime));return this._start*(1-i)+this._end*i}isEasing(e){return e>=this._startTime&&e<=this._endTime}jumpTo(e){this._startTime=-1/0,this._endTime=-1/0,this._start=e,this._end=e}easeTo(e,t,i){this._start=this.getValue(t),this._end=e,this._startTime=t,this._endTime=t+i}}const so={"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","Map.Title":"Map","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScrollZoomBlocker.CtrlMessage":"Use ctrl + scroll to zoom the map","ScrollZoomBlocker.CmdMessage":"Use ⌘ + scroll to zoom the map","TouchPanBlocker.Message":"Use two fingers to move the map"},lo={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:85,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,performanceMetricsCollection:!0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,optimizeForTerrain:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,minTileCacheSize:null,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",localFontFamily:null,transformRequest:null,accessToken:null,fadeDuration:300,crossSourceCollisions:!0};function co(e){e.parentNode&&e.parentNode.removeChild(e)}const uo={showCompass:!0,showZoom:!0,visualizePitch:!1};class ho{constructor(t,i,n=!1){this._clickTolerance=10,this.element=i,this.mouseRotate=new wr({clickTolerance:t.dragRotate._mouseRotate._clickTolerance}),this.map=t,n&&(this.mousePitch=new Tr({clickTolerance:t.dragRotate._mousePitch._clickTolerance})),e.bindAll(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),i.addEventListener("mousedown",this.mousedown),i.addEventListener("touchstart",this.touchstart,{passive:!1}),i.addEventListener("touchmove",this.touchmove),i.addEventListener("touchend",this.touchend),i.addEventListener("touchcancel",this.reset)}down(e,t){this.mouseRotate.mousedown(e,t),this.mousePitch&&this.mousePitch.mousedown(e,t),u()}move(e,t){const i=this.map,n=this.mouseRotate.mousemoveWindow(e,t),r=n&&n.bearingDelta;if(r&&i.setBearing(i.getBearing()+r),this.mousePitch){const n=this.mousePitch.mousemoveWindow(e,t),r=n&&n.pitchDelta;r&&i.setPitch(i.getPitch()+r)}}off(){const e=this.element;e.removeEventListener("mousedown",this.mousedown),e.removeEventListener("touchstart",this.touchstart,{passive:!1}),e.removeEventListener("touchmove",this.touchmove),e.removeEventListener("touchend",this.touchend),e.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){h(),e.window.removeEventListener("mousemove",this.mousemove),e.window.removeEventListener("mouseup",this.mouseup)}mousedown(t){this.down(e.extend({},t,{ctrlKey:!0,preventDefault:()=>t.preventDefault()}),f(this.element,t)),e.window.addEventListener("mousemove",this.mousemove),e.window.addEventListener("mouseup",this.mouseup)}mousemove(e){this.move(e,f(this.element,e))}mouseup(e){this.mouseRotate.mouseupWindow(e),this.mousePitch&&this.mousePitch.mouseupWindow(e),this.offTemp()}touchstart(e){1!==e.targetTouches.length?this.reset():(this._startPos=this._lastPos=m(this.element,e.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>e.preventDefault()},this._startPos))}touchmove(e){1!==e.targetTouches.length?this.reset():(this._lastPos=m(this.element,e.targetTouches)[0],this.move({preventDefault:()=>e.preventDefault()},this._lastPos))}touchend(e){0===e.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos){this._container.style.width=e*r+"px",this._container.innerHTML=`${n} ${o}`}))}function go(e){const t=Math.pow(10,`${Math.floor(e)}`.length-1);let i=e/t;return i=i>=10?10:i>=5?5:i>=3?3:i>=2?2:i>=1?1:function(e){const t=Math.pow(10,Math.ceil(-Math.log(e)/Math.LN10));return Math.round(e*t)/t}(i),t*i}const _o={version:e.version,supported:i,setRTLTextPlugin:e.setRTLTextPlugin,getRTLTextPluginStatus:e.getRTLTextPluginStatus,Map:class extends Yr{constructor(t){if(e.LivePerformanceUtils.mark(e.PerformanceMarkers.create),null!=(t=e.extend({},lo,t)).minZoom&&null!=t.maxZoom&&t.minZoom>t.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(null!=t.minPitch&&null!=t.maxPitch&&t.minPitch>t.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(null!=t.minPitch&&t.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(null!=t.maxPitch&&t.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(t.antialias&&e.isSafariWithAntialiasingBug(e.window)&&(t.antialias=!1,e.warnOnce("Antialiasing is disabled for this WebGL context to avoid browser bug: https://github.com/mapbox/mapbox-gl-js/issues/11609")),super(new Kn(t.minZoom,t.maxZoom,t.minPitch,t.maxPitch,t.renderWorldCopies),t),this._interactive=t.interactive,this._minTileCacheSize=t.minTileCacheSize,this._maxTileCacheSize=t.maxTileCacheSize,this._failIfMajorPerformanceCaveat=t.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=t.preserveDrawingBuffer,this._antialias=t.antialias,this._trackResize=t.trackResize,this._bearingSnap=t.bearingSnap,this._refreshExpiredTiles=t.refreshExpiredTiles,this._fadeDuration=t.fadeDuration,this._isInitialLoad=!0,this._crossSourceCollisions=t.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=t.collectResourceTiming,this._optimizeForTerrain=t.optimizeForTerrain,this._language=this._parseLanguage(t.language),this._worldview=t.worldview,this._renderTaskQueue=new Qr,this._domRenderTaskQueue=new Qr,this._controls=[],this._markers=[],this._popups=[],this._mapId=e.uniqueId(),this._locale=e.extend({},so,t.locale),this._clickTolerance=t.clickTolerance,this._cooperativeGestures=t.cooperativeGestures,this._performanceMetricsCollection=t.performanceMetricsCollection,this._containerWidth=0,this._containerHeight=0,this._averageElevationLastSampledAt=-1/0,this._averageElevationExaggeration=0,this._averageElevation=new ao(0),this._interactionRange=[1/0,-1/0],this._useExplicitProjection=!1,this._requestManager=new e.RequestManager(t.transformRequest,t.accessToken,t.testMode),this._silenceAuthErrors=!!t.testMode,"string"==typeof t.container){if(this._container=e.window.document.getElementById(t.container),!this._container)throw new Error(`Container '${t.container}' not found.`)}else{if(!(t.container instanceof e.window.HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=t.container}if(this._container.childNodes.length>0&&e.warnOnce("The map container element should be empty, otherwise the map's interactivity will be negatively impacted. If you want to display a message when WebGL is not supported, use the Mapbox GL Supported plugin instead."),t.maxBounds&&this.setMaxBounds(t.maxBounds),e.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",(()=>this._update(!1))),this.on("moveend",(()=>this._update(!1))),this.on("zoom",(()=>this._update(!0))),void 0!==e.window&&(e.window.addEventListener("online",this._onWindowOnline,!1),e.window.addEventListener("resize",this._onWindowResize,!1),e.window.addEventListener("orientationchange",this._onWindowResize,!1),e.window.addEventListener("webkitfullscreenchange",this._onWindowResize,!1)),this.handlers=new Hr(this,t),this._localFontFamily=t.localFontFamily,this._localIdeographFontFamily=t.localIdeographFontFamily,t.style&&this.setStyle(t.style,{localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily}),t.projection&&this.setProjection(t.projection),this._hash=t.hash&&new Qn("string"==typeof t.hash&&t.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:t.center,zoom:t.zoom,bearing:t.bearing,pitch:t.pitch}),t.bounds&&(this.resize(),this.fitBounds(t.bounds,e.extend({},t.fitBoundsOptions,{duration:0})))),this.resize(),t.attributionControl&&this.addControl(new Kr({customAttribution:t.customAttribution})),this._logoControl=new Jr,this.addControl(this._logoControl,t.logoPosition),this.on("style.load",(()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)})),this.on("data",(t=>{this._update("style"===t.dataType),this.fire(new e.Event(`${t.dataType}data`,t))})),this.on("dataloading",(t=>{this.fire(new e.Event(`${t.dataType}dataloading`,t))}))}_getMapId(){return this._mapId}addControl(t,i){if(void 0===i&&(i=t.getDefaultPosition?t.getDefaultPosition():"top-right"),!t||!t.onAdd)return this.fire(new e.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const n=t.onAdd(this);this._controls.push(t);const r=this._controlPositions[i];return-1!==i.indexOf("bottom")?r.insertBefore(n,r.firstChild):r.appendChild(n),this}removeControl(t){if(!t||!t.onRemove)return this.fire(new e.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const i=this._controls.indexOf(t);return i>-1&&this._controls.splice(i,1),t.onRemove(this),this}hasControl(e){return this._controls.indexOf(e)>-1}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}resize(t){if(this._updateContainerDimensions(),this._containerWidth===this.transform.width&&this._containerHeight===this.transform.height)return this;this._resizeCanvas(this._containerWidth,this._containerHeight),this.transform.resize(this._containerWidth,this._containerHeight),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight));const i=!this._moving;return i&&this.fire(new e.Event("movestart",t)).fire(new e.Event("move",t)),this.fire(new e.Event("resize",t)),i&&this.fire(new e.Event("moveend",t)),this}getBounds(){return"globe"===this.transform.projection.name&&e.warnOnce('Globe projection does not support getBounds API, this API may behave unexpectedly when viewing the poles."'),this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(t){return this.transform.setMaxBounds(e.LngLatBounds.convert(t)),this._update()}setMinZoom(t){if((t=null==t?-2:t)>=-2&&t<=this.transform.maxZoom)return this.transform.minZoom=t,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=t,this._update(),this.getZoom()>t?this.setZoom(t):this.fire(new e.Event("zoomstart")).fire(new e.Event("zoom")).fire(new e.Event("zoomend")),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(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()85)throw new Error("maxPitch must be less than or equal to 85");if(t>=this.transform.minPitch)return this.transform.maxPitch=t,this._update(),this.getPitch()>t?this.setPitch(t):this.fire(new e.Event("pitchstart")).fire(new e.Event("pitch")).fire(new e.Event("pitchend")),this;throw new Error("maxPitch must be greater than or equal to minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(e){return this.transform.renderWorldCopies=e,this.transform.renderWorldCopies||this._forceMarkerAndPopupUpdate(!0),this._update()}getLanguage(){return this._language}_parseLanguage(t){return"auto"===t?e.window.navigator.language:Array.isArray(t)?0===t.length?void 0:t.map((t=>"auto"===t?e.window.navigator.language:t)):t}setLanguage(e){const t=this._parseLanguage(e);if(!this.style||t===this._language)return this;this._language=t,this.style._reloadSources();for(const e of this._controls)e._setLanguage&&e._setLanguage(this._language);return this}getWorldview(){return this._worldview}setWorldview(e){return this.style&&e!==this._worldview?(this._worldview=e,this.style._reloadSources(),this):this}getProjection(){return this.transform.mercatorFromTransition?{name:"globe",center:[0,0]}:this.transform.getProjection()}_showingGlobe(){return"globe"===this.transform.projection.name}setProjection(e){return this._lazyInitEmptyStyle(),e?"string"==typeof e&&(e={name:e}):e=null,this._useExplicitProjection=!!e,this._prioritizeAndUpdateProjection(e,this.style.stylesheet?this.style.stylesheet.projection:null)}_updateProjectionTransition(){if("globe"!==this.getProjection().name)return;const t=this.transform,i=t.projection.name;let n;"globe"===i&&t.zoom>=e.GLOBE_ZOOM_THRESHOLD_MAX?(t.setMercatorFromTransition(),n=!0):"mercator"===i&&t.zoom=e.GLOBE_ZOOM_THRESHOLD_MAX?this.transform.setMercatorFromTransition():this.transform.setProjection(t),this.style.applyProjectionUpdate(),i){this.painter.clearBackgroundTiles();for(const e in this.style._sourceCaches)this.style._sourceCaches[e].clearTiles();this._update(!0),this._forceMarkerAndPopupUpdate(!0)}return this}project(t){return this.transform.locationPoint3D(e.LngLat.convert(t))}unproject(t){return this.transform.pointLocation3D(e.pointGeometry.convert(t))}isMoving(){return this._moving||this.handlers&&this.handlers.isMoving()||!1}isZooming(){return this._zooming||this.handlers&&this.handlers.isZooming()||!1}isRotating(){return this._rotating||this.handlers&&this.handlers.isRotating()||!1}_createDelegatedListener(e,t,i){if("mouseenter"===e||"mouseover"===e){let n=!1;const r=r=>{const o=t.filter((e=>this.getLayer(e))),a=o.length?this.queryRenderedFeatures(r.point,{layers:o}):[];a.length?n||(n=!0,i.call(this,new cr(e,this,r.originalEvent,{features:a}))):n=!1},o=()=>{n=!1};return{layers:new Set(t),listener:i,delegates:{mousemove:r,mouseout:o}}}if("mouseleave"===e||"mouseout"===e){let n=!1;const r=r=>{const o=t.filter((e=>this.getLayer(e)));(o.length?this.queryRenderedFeatures(r.point,{layers:o}):[]).length?n=!0:n&&(n=!1,i.call(this,new cr(e,this,r.originalEvent)))},o=t=>{n&&(n=!1,i.call(this,new cr(e,this,t.originalEvent)))};return{layers:new Set(t),listener:i,delegates:{mousemove:r,mouseout:o}}}{const n=e=>{const n=t.filter((e=>this.getLayer(e))),r=n.length?this.queryRenderedFeatures(e.point,{layers:n}):[];r.length&&(e.features=r,i.call(this,e),delete e.features)};return{layers:new Set(t),listener:i,delegates:{[e]:n}}}}on(e,t,i){if(void 0===i)return super.on(e,t);Array.isArray(t)||(t=[t]);const n=this._createDelegatedListener(e,t,i);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[e]=this._delegatedListeners[e]||[],this._delegatedListeners[e].push(n);for(const e in n.delegates)this.on(e,n.delegates[e]);return this}once(e,t,i){if(void 0===i)return super.once(e,t);Array.isArray(t)||(t=[t]);const n=this._createDelegatedListener(e,t,i);for(const e in n.delegates)this.once(e,n.delegates[e]);return this}off(e,t,i){if(void 0===i)return super.off(e,t);t=new Set(Array.isArray(t)?t:[t]);const n=(e,t)=>{if(e.size!==t.size)return!1;for(const i of e)if(!t.has(i))return!1;return!0},r=this._delegatedListeners?this._delegatedListeners[e]:void 0;return r&&(e=>{for(let r=0;r{t?this.fire(new e.ErrorEvent(t)):n&&this._updateDiff(n,i)}))}else"object"==typeof t&&this._updateDiff(t,i)}_updateDiff(t,i){try{this.style.setState(t)&&this._update(!0)}catch(n){e.warnOnce(`Unable to perform style diff: ${n.message||n.error||n}. Rebuilding the style from scratch.`),this._updateStyle(t,i)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():(e.warnOnce("There is no style added to the map."),!1)}addSource(e,t){return this._lazyInitEmptyStyle(),this.style.addSource(e,t),this._update(!0)}isSourceLoaded(e){return!!this.style&&this.style._isSourceCacheLoaded(e)}areTilesLoaded(){const e=this.style&&this.style._sourceCaches;for(const t in e){const i=e[t]._tiles;for(const e in i){const t=i[e];if("loaded"!==t.state&&"errored"!==t.state)return!1}}return!0}addSourceType(e,t,i){this._lazyInitEmptyStyle(),this.style.addSourceType(e,t,i)}removeSource(e){return this.style.removeSource(e),this._updateTerrain(),this._update(!0)}getSource(e){return this.style.getSource(e)}addImage(t,i,{pixelRatio:n=1,sdf:r=!1,stretchX:o,stretchY:a,content:s}={}){if(this._lazyInitEmptyStyle(),i instanceof e.window.HTMLImageElement||e.window.ImageBitmap&&i instanceof e.window.ImageBitmap){const{width:l,height:c,data:u}=e.exported.getImageData(i);this.style.addImage(t,{data:new e.RGBAImage({width:l,height:c},u),pixelRatio:n,stretchX:o,stretchY:a,content:s,sdf:r,version:0})}else if(void 0===i.width||void 0===i.height)this.fire(new e.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`")));else{const{width:l,height:c}=i,u=i;this.style.addImage(t,{data:new e.RGBAImage({width:l,height:c},new Uint8Array(u.data)),pixelRatio:n,stretchX:o,stretchY:a,content:s,sdf:r,version:0,userImage:u}),u.onAdd&&u.onAdd(this,t)}}updateImage(t,i){const n=this.style.getImage(t);if(!n)return void this.fire(new e.ErrorEvent(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const r=i instanceof e.window.HTMLImageElement||e.window.ImageBitmap&&i instanceof e.window.ImageBitmap?e.exported.getImageData(i):i,{width:o,height:a}=r;void 0!==o&&void 0!==a?o===n.data.width&&a===n.data.height?(n.data.replace(r.data,!(i instanceof e.window.HTMLImageElement||e.window.ImageBitmap&&i instanceof e.window.ImageBitmap)),this.style.updateImage(t,n)):this.fire(new e.ErrorEvent(new Error(`The width and height of the updated image (${o}, ${a})\n must be that same as the previous version of the image\n (${n.data.width}, ${n.data.height})`))):this.fire(new e.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`")))}hasImage(t){return t?!!this.style.getImage(t):(this.fire(new e.ErrorEvent(new Error("Missing required image id"))),!1)}removeImage(e){this.style.removeImage(e)}loadImage(t,i){e.getImage(this._requestManager.transformRequest(t,e.ResourceType.Image),((t,n)=>{i(t,n instanceof e.window.HTMLImageElement?e.exported.getImageData(n):n)}))}listImages(){return this.style.listImages()}addLayer(e,t){return this._lazyInitEmptyStyle(),this.style.addLayer(e,t),this._update(!0)}moveLayer(e,t){return this.style.moveLayer(e,t),this._update(!0)}removeLayer(e){return this.style.removeLayer(e),this._update(!0)}getLayer(e){return this.style.getLayer(e)}setLayerZoomRange(e,t,i){return this.style.setLayerZoomRange(e,t,i),this._update(!0)}setFilter(e,t,i={}){return this.style.setFilter(e,t,i),this._update(!0)}getFilter(e){return this.style.getFilter(e)}setPaintProperty(e,t,i,n={}){return this.style.setPaintProperty(e,t,i,n),this._update(!0)}getPaintProperty(e,t){return this.style.getPaintProperty(e,t)}setLayoutProperty(e,t,i,n={}){return this.style.setLayoutProperty(e,t,i,n),this._update(!0)}getLayoutProperty(e,t){return this.style.getLayoutProperty(e,t)}setLight(e,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(e,t),this._update(!0)}getLight(){return this.style.getLight()}setTerrain(e){return this._lazyInitEmptyStyle(),!e&&this.transform.projection.requiresDraping?this.style.setTerrainForDraping():this.style.setTerrain(e),this._averageElevationLastSampledAt=-1/0,this._update(!0)}getTerrain(){return this.style?this.style.getTerrain():null}setFog(e){return this._lazyInitEmptyStyle(),this.style.setFog(e),this._update(!0)}getFog(){return this.style?this.style.getFog():null}_queryFogOpacity(t){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(e.LngLat.convert(t),this.transform):0}setFeatureState(e,t){return this.style.setFeatureState(e,t),this._update()}removeFeatureState(e,t){return this.style.removeFeatureState(e,t),this._update()}getFeatureState(e){return this.style.getFeatureState(e)}_updateContainerDimensions(){if(!this._container)return;const t=this._container.getBoundingClientRect().width||400,i=this._container.getBoundingClientRect().height||300;let n,r,o,a=this._container;for(;a&&(!r||!o);){const t=e.window.getComputedStyle(a).transform;t&&"none"!==t&&(n=t.match(/matrix.*\((.+)\)/)[1].split(", "),n[0]&&"0"!==n[0]&&"1"!==n[0]&&(r=n[0]),n[3]&&"0"!==n[3]&&"1"!==n[3]&&(o=n[3])),a=a.parentElement}this._containerWidth=r?Math.abs(t/r):t,this._containerHeight=o?Math.abs(i/o):i}_detectMissingCSS(){"rgb(250, 128, 114)"!==e.window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")&&e.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/.")}_setupContainer(){const e=this._container;e.classList.add("mapboxgl-map"),(this._missingCSSCanary=o("div","mapboxgl-canary",e)).style.visibility="hidden",this._detectMissingCSS();const t=this._canvasContainer=o("div","mapboxgl-canvas-container",e);this._interactive&&t.classList.add("mapboxgl-interactive"),this._canvas=o("canvas","mapboxgl-canvas",t),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region"),this._updateContainerDimensions(),this._resizeCanvas(this._containerWidth,this._containerHeight);const i=this._controlContainer=o("div","mapboxgl-control-container",e),n=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach((e=>{n[e]=o("div",`mapboxgl-ctrl-${e}`,i)})),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(t,i){const n=e.exported.devicePixelRatio||1;this._canvas.width=n*Math.ceil(t),this._canvas.height=n*Math.ceil(i),this._canvas.style.width=`${t}px`,this._canvas.style.height=`${i}px`}_addMarker(e){this._markers.push(e)}_removeMarker(e){const t=this._markers.indexOf(e);-1!==t&&this._markers.splice(t,1)}_addPopup(e){this._popups.push(e)}_removePopup(e){const t=this._popups.indexOf(e);-1!==t&&this._popups.splice(t,1)}_setupPainter(){const t=e.extend({},i.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),n=this._canvas.getContext("webgl",t)||this._canvas.getContext("experimental-webgl",t);n?(e.storeAuthState(n,!0),this.painter=new Fn(n,this.transform),this.on("data",(e=>{"source"===e.dataType&&this.painter.setTileLoadedFlag(!0)})),e.exported$1.testSupport(n)):this.fire(new e.ErrorEvent(new Error("Failed to initialize WebGL")))}_contextLost(t){t.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new e.Event("webglcontextlost",{originalEvent:t}))}_contextRestored(t){this._setupPainter(),this.resize(),this._update(),this.fire(new e.Event("webglcontextrestored",{originalEvent:t}))}_onMapScroll(e){if(e.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(e){return this.style?(this._styleDirty=this._styleDirty||e,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(e){return this._update(),this._renderTaskQueue.add(e)}_cancelRenderFrame(e){this._renderTaskQueue.remove(e)}_requestDomTask(e){!this.loaded()||this.loaded()&&!this.isMoving()?e():this._domRenderTaskQueue.add(e)}_render(t){let i;const n=this.painter.context.extTimerQuery,r=e.exported.now();if(this.listens("gpu-timing-frame")&&(i=n.createQueryEXT(),n.beginQueryEXT(n.TIME_ELAPSED_EXT,i)),this.painter.context.setDirty(),this.painter.setBaseState(),(this.isMoving()||this.isRotating()||this.isZooming())&&(this._interactionRange[0]=Math.min(this._interactionRange[0],e.window.performance.now()),this._interactionRange[1]=Math.max(this._interactionRange[1],e.window.performance.now())),this._renderTaskQueue.run(t),this._domRenderTaskQueue.run(t),this._removed)return;this._updateProjectionTransition();let o=!1;const a=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;const t=this.transform.zoom,i=this.transform.pitch,n=e.exported.now();this.style.zoomHistory.update(t,n);const r=new e.EvaluationParameters(t,{now:n,fadeDuration:a,pitch:i,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),s=r.crossFadingFactor();1===s&&s===this._crossFadingFactor||(o=!0,this._crossFadingFactor=s),this.style.update(r)}this.style&&this.style.fog&&this.style.fog.hasTransition()&&(this.style._markersNeedUpdate=!0,this._sourcesDirty=!0);let s=!1;if(this.style&&this._sourcesDirty?(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),s=this._updateAverageElevation(r),this.style._updateSources(this.transform),this._forceMarkerAndPopupUpdate()):s=this._updateAverageElevation(r),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,a,this._crossSourceCollisions),this.style&&this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showTerrainWireframe:this.showTerrainWireframe,showOverdrawInspector:this._showOverdrawInspector,showQueryGeometry:!!this._showQueryGeometry,showTileAABBs:this.showTileAABBs,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:a,isInitialLoad:this._isInitialLoad,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer"),gpuTimingDeferredRender:!!this.listens("gpu-timing-deferred-render"),speedIndexTiming:this.speedIndexTiming}),this.fire(new e.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new e.Event("load"))),this.style&&(this.style.hasTransitions()||o)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),i){const t=e.exported.now()-r;n.endQueryEXT(n.TIME_ELAPSED_EXT,i),setTimeout((()=>{const o=n.getQueryObjectEXT(i,n.QUERY_RESULT_EXT)/1e6;n.deleteQueryEXT(i),this.fire(new e.Event("gpu-timing-frame",{cpuTime:t,gpuTime:o})),e.window.performance.mark("frame-gpu",{startTime:r,detail:{gpuTime:o}})}),50)}if(this.listens("gpu-timing-layer")){const t=this.painter.collectGpuTimers();setTimeout((()=>{const i=this.painter.queryGpuTimers(t);this.fire(new e.Event("gpu-timing-layer",{layerTimes:i}))}),50)}if(this.listens("gpu-timing-deferred-render")){const t=this.painter.collectDeferredRenderGpuQueries();setTimeout((()=>{const i=this.painter.queryGpuTimeDeferredRender(t);this.fire(new e.Event("gpu-timing-deferred-render",{gpuTime:i}))}),50)}const l=this._sourcesDirty||this._styleDirty||this._placementDirty||s;if(l||this._repaint)this.triggerRepaint();else{const t=!this.isMoving()&&this.loaded();if(t&&(s=this._updateAverageElevation(r,!0)),s)this.triggerRepaint();else if(this._triggerFrame(!1),t&&(this.fire(new e.Event("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){const t=this._calculateSpeedIndex();this.fire(new e.Event("speedindexcompleted",{speedIndex:t})),this.speedIndexTiming=!1}}!this._loaded||this._fullyLoaded||l||(this._fullyLoaded=!0,e.LivePerformanceUtils.mark(e.PerformanceMarkers.fullLoad),this._performanceMetricsCollection&&e.postPerformanceEvent(this._requestManager._customAccessToken,{width:this.painter.width,height:this.painter.height,interactionRange:this._interactionRange,terrainEnabled:!!this.painter.style.getTerrain(),fogEnabled:!!this.painter.style.getFog(),projection:this.painter.transform.projection,zoom:this.transform.zoom,renderer:this.painter.context.renderer,vendor:this.painter.context.vendor}),this._authenticate())}_forceMarkerAndPopupUpdate(e){for(const t of this._markers)e&&!this.getRenderWorldCopies()&&(t._lngLat=t._lngLat.wrap()),t._update();for(const t of this._popups)!e||this.getRenderWorldCopies()||t._trackPointer||(t._lngLat=t._lngLat.wrap()),t._update()}_updateAverageElevation(e,t=!1){const i=e=>(this.transform.averageElevation=e,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return 0!==this.transform.averageElevation&&i(0);if((t||e-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(e)){const t=this.transform.averageElevation;let n=this.transform.sampleAverageElevation(),r=!1;this.transform.elevation&&(r=this.transform.elevation.exaggeration()!==this._averageElevationExaggeration,this._averageElevationExaggeration=this.transform.elevation.exaggeration()),isNaN(n)?n=0:this._averageElevationLastSampledAt=e;const o=Math.abs(t-n);if(o>1){if(this._isInitialLoad||r)return this._averageElevation.jumpTo(n),i(n);this._averageElevation.easeTo(n,e,300)}else if(o>1e-4)return this._averageElevation.jumpTo(n),i(n)}return!!this._averageElevation.isEasing(e)&&i(this._averageElevation.getValue(e))}_authenticate(){e.getMapSessionAPI(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,(t=>{if(t&&(t.message===e.AUTH_ERR_MSG||401===t.status)){const t=this.painter.context.gl;e.storeAuthState(t,!1),this._logoControl instanceof Jr&&this._logoControl._updateLogo(),t&&t.clear(t.DEPTH_BUFFER_BIT|t.COLOR_BUFFER_BIT|t.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new e.ErrorEvent(new Error("A valid Mapbox access token is required to use Mapbox GL JS. To create an account or a new access token, visit https://account.mapbox.com/")))}})),e.postMapLoadEvent(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,(()=>{}))}_updateTerrain(){this.painter.updateTerrain(this.style,this.isMoving()||this.isRotating()||this.isZooming())}_calculateSpeedIndex(){const e=this.painter.canvasCopy(),t=this.painter.getCanvasCopiesAndTimestamps();t.timeStamps.push(performance.now());const i=this.painter.context.gl,n=i.createFramebuffer();function r(e){i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,e,0);const t=new Uint8Array(i.drawingBufferWidth*i.drawingBufferHeight*4);return i.readPixels(0,0,i.drawingBufferWidth,i.drawingBufferHeight,i.RGBA,i.UNSIGNED_BYTE,t),t}return i.bindFramebuffer(i.FRAMEBUFFER,n),this._canvasPixelComparison(r(e),t.canvasCopies.map(r),t.timeStamps)}_canvasPixelComparison(e,t,i){let n=i[1]-i[0];const r=e.length/4;for(let o=0;o{const t=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,t&&this._render(e)})))}_preloadTiles(t){const i=this.style?Object.values(this.style._sourceCaches):[];return e.asyncAll(i,((e,i)=>e._preloadTiles(t,i)),(()=>{this.triggerRepaint()})),this}_onWindowOnline(){this._update()}_onWindowResize(e){this._trackResize&&this.resize({originalEvent:e})._update()}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(e){this._showTileBoundaries!==e&&(this._showTileBoundaries=e,this._update())}get showTerrainWireframe(){return!!this._showTerrainWireframe}set showTerrainWireframe(e){this._showTerrainWireframe!==e&&(this._showTerrainWireframe=e,this._update())}get speedIndexTiming(){return!!this._speedIndexTiming}set speedIndexTiming(e){this._speedIndexTiming!==e&&(this._speedIndexTiming=e,this._update())}get showPadding(){return!!this._showPadding}set showPadding(e){this._showPadding!==e&&(this._showPadding=e,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(e){this._showCollisionBoxes!==e&&(this._showCollisionBoxes=e,e?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(e){this._showOverdrawInspector!==e&&(this._showOverdrawInspector=e,this._update())}get repaint(){return!!this._repaint}set repaint(e){this._repaint!==e&&(this._repaint=e,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(e){this._vertices=e,this._update()}get showTileAABBs(){return!!this._showTileAABBs}set showTileAABBs(e){this._showTileAABBs!==e&&(this._showTileAABBs=e,e&&this._update())}_setCacheLimits(t,i){e.setCacheLimits(t,i)}get version(){return e.version}},NavigationControl:class{constructor(t){this.options=e.extend({},uo,t),this._container=o("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",(e=>e.preventDefault())),this.options.showZoom&&(e.bindAll(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",(e=>{this._map&&this._map.zoomIn({},{originalEvent:e})})),o("span","mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("mapboxgl-ctrl-zoom-out",(e=>{this._map&&this._map.zoomOut({},{originalEvent:e})})),o("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(e.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",(e=>{const t=this._map;t&&(this.options.visualizePitch?t.resetNorthPitch({},{originalEvent:e}):t.resetNorth({},{originalEvent:e}))})),this._compassIcon=o("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const e=this._map;if(!e)return;const t=e.getZoom(),i=t===e.getMaxZoom(),n=t===e.getMinZoom();this._zoomInButton.disabled=i,this._zoomOutButton.disabled=n,this._zoomInButton.setAttribute("aria-disabled",i.toString()),this._zoomOutButton.setAttribute("aria-disabled",n.toString())}_rotateCompassArrow(){const e=this._map;if(!e)return;const t=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(e.transform.pitch*(Math.PI/180)),.5)}) rotateX(${e.transform.pitch}deg) rotateZ(${e.transform.angle*(180/Math.PI)}deg)`:`rotate(${e.transform.angle*(180/Math.PI)}deg)`;e._requestDomTask((()=>{this._compassIcon&&(this._compassIcon.style.transform=t)}))}onAdd(e){return this._map=e,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),e.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&e.on("pitch",this._rotateCompassArrow),e.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new ho(e,this._compass,this.options.visualizePitch)),this._container}onRemove(){const e=this._map;e&&(this._container.remove(),this.options.showZoom&&e.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&e.off("pitch",this._rotateCompassArrow),e.off("rotate",this._rotateCompassArrow),this._handler&&this._handler.off(),this._handler=void 0),this._map=void 0)}_createButton(e,t){const i=o("button",e,this._container);return i.type="button",i.addEventListener("click",t),i}_setButtonTitle(e,t){if(!this._map)return;const i=this._map._getUIString(`NavigationControl.${t}`);e.setAttribute("aria-label",i),e.firstElementChild&&e.firstElementChild.setAttribute("title",i)}},GeolocateControl:class extends e.Evented{constructor(t){super(),this.options=e.extend({geolocation:e.window.navigator.geolocation},po,t),e.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation","_onDeviceOrientation"],this),this._updateMarkerRotationThrottled=Jn(this._updateMarkerRotation,20),this._numberOfWatches=0}onAdd(e){return this._map=e,this._container=o("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkGeolocationSupport(this._setupUI),this._container}onRemove(){void 0!==this._geolocationWatchID&&(this.options.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),this._container.remove(),this._map.off("zoom",this._onZoom),this._map=void 0,this._numberOfWatches=0,this._noTimeout=!1}_checkGeolocationSupport(t){const i=(e=!!this.options.geolocation)=>{this._supportsGeolocation=e,t(e)};void 0!==this._supportsGeolocation?t(this._supportsGeolocation):void 0!==e.window.navigator.permissions?e.window.navigator.permissions.query({name:"geolocation"}).then((e=>i("denied"!==e.state))).catch((()=>i())):i()}_isOutOfMapMaxBounds(e){const t=this._map.getMaxBounds(),i=e.coords;return!!t&&(i.longitudet.getEast()||i.latitudet.getNorth())}_setErrorState(){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")}}_onSuccess(t){if(this._map){if(this._isOutOfMapMaxBounds(t))return this._setErrorState(),this.fire(new e.Event("outofmaxbounds",t)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=t,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(t),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(t),this.options.showUserLocation&&this._dotElement.classList.remove("mapboxgl-user-location-dot-stale"),this.fire(new e.Event("geolocate",t)),this._finish()}}_updateCamera(t){const i=new e.LngLat(t.coords.longitude,t.coords.latitude),n=t.coords.accuracy,r=this._map.getBearing(),o=e.extend({bearing:r},this.options.fitBoundsOptions);this._map.fitBounds(i.toBounds(n),o,{geolocateSource:!0})}_updateMarker(t){if(t){const i=new e.LngLat(t.coords.longitude,t.coords.latitude);this._accuracyCircleMarker.setLngLat(i).addTo(this._map),this._userLocationDotMarker.setLngLat(i).addTo(this._map),this._accuracy=t.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const t=this._map.transform,i=e.mercatorZfromAltitude(1,t._center.lat)*t.worldSize,n=Math.ceil(2*this._accuracy*i);this._circleElement.style.width=`${n}px`,this._circleElement.style.height=`${n}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_updateMarkerRotation(){this._userLocationDotMarker&&"number"==typeof this._heading?(this._userLocationDotMarker.setRotation(this._heading),this._dotElement.classList.add("mapboxgl-user-location-show-heading")):(this._dotElement.classList.remove("mapboxgl-user-location-show-heading"),this._userLocationDotMarker.setRotation(0))}_onError(t){if(this._map){if(this.options.trackUserLocation)if(1===t.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;const e=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.setAttribute("aria-label",e),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",e),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===t.code&&this._noTimeout)return;this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("mapboxgl-user-location-dot-stale"),this.fire(new e.Event("error",t)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(t){if(this._container.addEventListener("contextmenu",(e=>e.preventDefault())),this._geolocateButton=o("button","mapboxgl-ctrl-geolocate",this._container),o("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",!1===t){e.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.setAttribute("aria-label",t),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",t)}else{const e=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.setAttribute("aria-label",e),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",e)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=o("div","mapboxgl-user-location"),this._dotElement.appendChild(o("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(o("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new io({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=o("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new io({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",(t=>{t.geolocateSource||"ACTIVE_LOCK"!==this._watchState||t.originalEvent&&"resize"===t.originalEvent.type||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this.fire(new e.Event("trackuserlocationend")))}))}_onDeviceOrientation(e){this._userLocationDotMarker&&(e.webkitCompassHeading?this._heading=e.webkitCompassHeading:!0===e.absolute&&(this._heading=-1*e.alpha),this._updateMarkerRotationThrottled())}trigger(){if(!this._setup)return e.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 e.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":this._numberOfWatches--,this._noTimeout=!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 e.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 e.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){let e;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),this._numberOfWatches++,this._numberOfWatches>1?(e={maximumAge:6e5,timeout:0},this._noTimeout=!0):(e=this.options.positionOptions,this._noTimeout=!1),this._geolocationWatchID=this.options.geolocation.watchPosition(this._onSuccess,this._onError,e),this.options.showUserHeading&&this._addDeviceOrientationListener()}}else this.options.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_addDeviceOrientationListener(){const t=()=>{e.window.addEventListener("ondeviceorientationabsolute"in e.window?"deviceorientationabsolute":"deviceorientation",this._onDeviceOrientation)};void 0!==e.window.DeviceMotionEvent&&"function"==typeof e.window.DeviceMotionEvent.requestPermission?DeviceOrientationEvent.requestPermission().then((e=>{"granted"===e&&t()})).catch(console.error):t()}_clearWatch(){this.options.geolocation.clearWatch(this._geolocationWatchID),e.window.removeEventListener("deviceorientation",this._onDeviceOrientation),e.window.removeEventListener("deviceorientationabsolute",this._onDeviceOrientation),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:Kr,ScaleControl:class{constructor(t){this.options=e.extend({},fo,t),function(){try{return new Intl.NumberFormat("en",{style:"unit",unitDisplay:"narrow",unit:"meter"}),!0}catch(e){return!1}}()||(this._setScale=mo.bind(this)),e.bindAll(["_update","_setScale","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_update(){const e=this.options.maxWidth||100,t=this._map,i=t._containerHeight/2,n=t._containerWidth/2-e/2,r=t.unproject([n,i]),o=t.unproject([n+e,i]),a=r.distanceTo(o);if("imperial"===this.options.unit){const t=3.2808*a;t>5280?this._setScale(e,t/5280,"mile"):this._setScale(e,t,"foot")}else"nautical"===this.options.unit?this._setScale(e,a/1852,"nautical-mile"):a>=1e3?this._setScale(e,a/1e3,"kilometer"):this._setScale(e,a,"meter")}_setScale(e,t,i){const n=go(t),r=n/t;this._map._requestDomTask((()=>{this._container.style.width=e*r+"px",this._container.innerHTML="nautical-mile"!==i?new Intl.NumberFormat(this._language,{style:"unit",unitDisplay:"narrow",unit:i}).format(n):`${n} nm`}))}onAdd(e){return this._map=e,this._language=e.getLanguage(),this._container=o("div","mapboxgl-ctrl mapboxgl-ctrl-scale",e.getContainer()),this._container.dir="auto",this._map.on("move",this._update),this._update(),this._container}onRemove(){this._container.remove(),this._map.off("move",this._update),this._map=void 0}_setLanguage(e){this._language=e,this._update()}setUnit(e){this.options.unit=e,this._update()}},FullscreenControl:class{constructor(t){this._fullscreen=!1,t&&t.container&&(t.container instanceof e.window.HTMLElement?this._container=t.container:e.warnOnce("Full screen control 'container' must be a DOM element.")),e.bindAll(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in e.window.document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in e.window.document&&(this._fullscreenchange="webkitfullscreenchange")}onAdd(t){return this._map=t,this._container||(this._container=this._map.getContainer()),this._controlContainer=o("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",e.warnOnce("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,e.window.document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!(!e.window.document.fullscreenEnabled&&!e.window.document.webkitFullscreenEnabled)}_setupUI(){const t=this._fullscreenButton=o("button","mapboxgl-ctrl-fullscreen",this._controlContainer);o("span","mapboxgl-ctrl-icon",t).setAttribute("aria-hidden","true"),t.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),e.window.document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const e=this._getTitle();this._fullscreenButton.setAttribute("aria-label",e),this._fullscreenButton.firstElementChild&&this._fullscreenButton.firstElementChild.setAttribute("title",e)}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(e.window.document.fullscreenElement||e.window.document.webkitFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}_onClickFullscreen(){this._isFullscreen()?e.window.document.exitFullscreen?e.window.document.exitFullscreen():e.window.document.webkitCancelFullScreen&&e.window.document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},Popup:class extends e.Evented{constructor(t){super(),this.options=e.extend(Object.create(no),t),e.bindAll(["_update","_onClose","remove","_onMouseEvent"],this),this._classList=new Set(t&&t.className?t.className.trim().split(/\s+/):[])}addTo(t){return this._map&&this.remove(),this._map=t,this.options.closeOnClick&&t.on("preclick",this._onClose),this.options.closeOnMove&&t.on("move",this._onClose),t.on("remove",this.remove),this._update(),t._addPopup(this),this._focusFirstElement(),this._trackPointer?(t.on("mousemove",this._onMouseEvent),t.on("mouseup",this._onMouseEvent),t._canvasContainer.classList.add("mapboxgl-track-pointer")):t.on("move",this._update),this.fire(new e.Event("open")),this}isOpen(){return!!this._map}remove(){this._content&&this._content.remove(),this._container&&(this._container.remove(),this._container=void 0);const t=this._map;return t&&(t.off("move",this._update),t.off("move",this._onClose),t.off("preclick",this._onClose),t.off("click",this._onClose),t.off("remove",this.remove),t.off("mousemove",this._onMouseEvent),t.off("mouseup",this._onMouseEvent),t.off("drag",this._onMouseEvent),t._canvasContainer&&t._canvasContainer.classList.remove("mapboxgl-track-pointer"),t._removePopup(this),this._map=void 0),this.fire(new e.Event("close")),this}getLngLat(){return this._lngLat}setLngLat(t){this._lngLat=e.LngLat.convert(t),this._pos=null,this._trackPointer=!1,this._update();const i=this._map;return i&&(i.on("move",this._update),i.off("mousemove",this._onMouseEvent),i._canvasContainer.classList.remove("mapboxgl-track-pointer")),this}trackPointer(){this._trackPointer=!0,this._pos=null,this._update();const e=this._map;return e&&(e.off("move",this._update),e.on("mousemove",this._onMouseEvent),e.on("drag",this._onMouseEvent),e._canvasContainer.classList.add("mapboxgl-track-pointer")),this}getElement(){return this._container}setText(t){return this.setDOMContent(e.window.document.createTextNode(t))}setHTML(t){const i=e.window.document.createDocumentFragment(),n=e.window.document.createElement("body");let r;for(n.innerHTML=t;r=n.firstChild,r;)i.appendChild(r);return this.setDOMContent(i)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(e){return this.options.maxWidth=e,this._update(),this}setDOMContent(e){let t=this._content;if(t)for(;t.hasChildNodes();)t.firstChild&&t.removeChild(t.firstChild);else t=this._content=o("div","mapboxgl-popup-content",this._container||void 0);if(t.appendChild(e),this.options.closeButton){const e=this._closeButton=o("button","mapboxgl-popup-close-button",t);e.type="button",e.setAttribute("aria-label","Close popup"),e.setAttribute("aria-hidden","true"),e.innerHTML="×",e.addEventListener("click",this._onClose)}return this._update(),this._focusFirstElement(),this}addClassName(e){return this._classList.add(e),this._updateClassList(),this}removeClassName(e){return this._classList.delete(e),this._updateClassList(),this}setOffset(e){return this.options.offset=e,this._update(),this}toggleClassName(e){let t;return this._classList.delete(e)?t=!1:(this._classList.add(e),t=!0),this._updateClassList(),t}_onMouseEvent(e){this._update(e.point)}_getAnchor(e){if(this.options.anchor)return this.options.anchor;const t=this._map,i=this._container,n=this._pos;if(!t||!i||!n)return"bottom";const r=i.offsetWidth,o=i.offsetHeight,a=n.xt.transform.width-r/2;if(n.y+et.transform.height-o){if(a)return"bottom-left";if(s)return"bottom-right"}return a?"left":s?"right":"bottom"}_updateClassList(){const e=this._container;if(!e)return;const t=[...this._classList];t.push("mapboxgl-popup"),this._anchor&&t.push(`mapboxgl-popup-anchor-${this._anchor}`),this._trackPointer&&t.push("mapboxgl-popup-track-pointer"),e.className=t.join(" ")}_update(t){const i=this._map,n=this._content;if(!i||!this._lngLat&&!this._trackPointer||!n)return;let r=this._container;if(r||(r=this._container=o("div","mapboxgl-popup",i.getContainer()),this._tip=o("div","mapboxgl-popup-tip",r),r.appendChild(n)),this.options.maxWidth&&r.style.maxWidth!==this.options.maxWidth&&(r.style.maxWidth=this.options.maxWidth),i.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=eo(this._lngLat,this._pos,i.transform)),!this._trackPointer||t){const e=this._pos=this._trackPointer&&t?t:i.project(this._lngLat),n=oo(this.options.offset),r=this._anchor=this._getAnchor(n.y),o=oo(this.options.offset,r),a=e.add(o).round();i._requestDomTask((()=>{this._container&&r&&(this._container.style.transform=`${to[r]} translate(${a.x}px,${a.y}px)`)}))}if(!this._marker&&i._showingGlobe()){const t=e.isLngLatBehindGlobe(i.transform,this._lngLat)?0:1;this._setOpacity(t)}this._updateClassList()}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const e=this._container.querySelector(ro);e&&e.focus()}_onClose(){this.remove()}_setOpacity(e){this._container&&(this._container.style.opacity=`${e}`),this._content&&(this._content.style.pointerEvents=e?"auto":"none")}},Marker:io,Style:ei,LngLat:e.LngLat,LngLatBounds:e.LngLatBounds,Point:e.pointGeometry,MercatorCoordinate:e.MercatorCoordinate,FreeCameraOptions:Vn,Evented:e.Evented,config:e.config,prewarm:function(){Ne().acquire(Fe)},clearPrewarmedResources:function(){const e=je;e&&e.isPreloaded()&&1===e.numActive()&&(e.release(Fe),je=null)},get accessToken(){return e.config.ACCESS_TOKEN},set accessToken(t){e.config.ACCESS_TOKEN=t},get baseApiUrl(){return e.config.API_URL},set baseApiUrl(t){e.config.API_URL=t},get workerCount(){return $e.workerCount},set workerCount(e){$e.workerCount=e},get maxParallelImageRequests(){return e.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(t){e.config.MAX_PARALLEL_IMAGE_REQUESTS=t},clearStorage(t){e.clearTileCache(t)},workerUrl:"",workerClass:null,setNow:e.exported.setNow,restoreNow:e.exported.restoreNow};return _o})),n}))}).call(this)}).call(this,e("_process"))},{_process:7}],7:[function(e,t,i){var n,r,o=t.exports={};function a(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function l(e){if(n===setTimeout)return setTimeout(e,0);if((n===a||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:a}catch(e){n=a}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(e){r=s}}();var c,u=[],h=!1,d=-1;function p(){h&&c&&(h=!1,c.length?u=c.concat(u):d=-1,u.length&&f())}function f(){if(!h){var e=l(p);h=!0;for(var t=u.length;t;){for(c=u,u=[];++d1)for(var i=1;i As of ScrollMagic 2.0.0 you need to use 'new ScrollMagic.Controller()' to create a new controller instance. Use 'new ScrollMagic.Scene()' to instance a scene.")};e.version="2.0.8","undefined"!=typeof window&&window.addEventListener("mousewheel",void 0);var t="data-scrollmagic-pin-spacer";e.Controller=function(n){var o,a,s="ScrollMagic.Controller",l="REVERSE",c="PAUSED",u=i.defaults,h=this,d=r.extend({},u,n),p=[],f=!1,m=0,g=c,_=!0,v=0,y=!0,x=function(){d.refreshInterval>0&&(a=window.setTimeout(k,d.refreshInterval))},b=function(){return d.vertical?r.get.scrollTop(d.container):r.get.scrollLeft(d.container)},w=function(){return d.vertical?r.get.height(d.container):r.get.width(d.container)},T=this._setScrollPos=function(e){d.vertical?_?window.scrollTo(r.get.scrollLeft(),e):d.container.scrollTop=e:_?window.scrollTo(e,r.get.scrollTop()):d.container.scrollLeft=e},C=function(){if(y&&f){var e=r.type.Array(f)?f:p.slice(0);f=!1;var t=m,i=(m=h.scrollPos())-t;0!==i&&(g=i>0?"FORWARD":l),g===l&&e.reverse(),e.forEach((function(t,i){A(3,"updating Scene "+(i+1)+"/"+e.length+" ("+p.length+" total)"),t.update(!0)})),0===e.length&&d.loglevel>=3&&A(3,"updating 0 Scenes (nothing added to controller)")}},S=function(){o=r.rAF(C)},E=function(e){A(3,"event fired causing an update:",e.type),"resize"==e.type&&(v=w(),g=c),!0!==f&&(f=!0,S())},k=function(){if(!_&&v!=w()){var e;try{e=new Event("resize",{bubbles:!1,cancelable:!1})}catch(t){(e=document.createEvent("Event")).initEvent("resize",!1,!1)}d.container.dispatchEvent(e)}p.forEach((function(e,t){e.refresh()})),x()},A=this._log=function(e,t){d.loglevel>=e&&(Array.prototype.splice.call(arguments,1,0,"("+s+") ->"),r.log.apply(window,arguments))};this._options=d;var M=function(e){if(e.length<=1)return e;var t=e.slice(0);return t.sort((function(e,t){return e.scrollOffset()>t.scrollOffset()?1:-1})),t};return this.addScene=function(t){if(r.type.Array(t))t.forEach((function(e,t){h.addScene(e)}));else if(t instanceof e.Scene){if(t.controller()!==h)t.addTo(h);else if(p.indexOf(t)<0){for(var i in p.push(t),p=M(p),t.on("shift.controller_sort",(function(){p=M(p)})),d.globalSceneOptions)t[i]&&t[i].call(t,d.globalSceneOptions[i]);A(3,"adding Scene (now "+p.length+" total)")}}else A(1,"ERROR: invalid argument supplied for '.addScene()'");return h},this.removeScene=function(e){if(r.type.Array(e))e.forEach((function(e,t){h.removeScene(e)}));else{var t=p.indexOf(e);t>-1&&(e.off("shift.controller_sort"),p.splice(t,1),A(3,"removing Scene (now "+p.length+" left)"),e.remove())}return h},this.updateScene=function(t,i){return r.type.Array(t)?t.forEach((function(e,t){h.updateScene(e,i)})):i?t.update(!0):!0!==f&&t instanceof e.Scene&&(-1==(f=f||[]).indexOf(t)&&f.push(t),f=M(f),S()),h},this.update=function(e){return E({type:"resize"}),e&&C(),h},this.scrollTo=function(i,n){if(r.type.Number(i))T.call(d.container,i,n);else if(i instanceof e.Scene)i.controller()===h?h.scrollTo(i.scrollOffset(),n):A(2,"scrollTo(): The supplied scene does not belong to this controller. Scroll cancelled.",i);else if(r.type.Function(i))T=i;else{var o=r.get.elements(i)[0];if(o){for(;o.parentNode.hasAttribute(t);)o=o.parentNode;var a=d.vertical?"top":"left",s=r.get.offset(d.container),l=r.get.offset(o);_||(s[a]-=h.scrollPos()),h.scrollTo(l[a]-s[a],n)}else A(2,"scrollTo(): The supplied argument is invalid. Scroll cancelled.",i)}return h},this.scrollPos=function(e){return arguments.length?(r.type.Function(e)?b=e:A(2,"Provided value for method 'scrollPos' is not a function. To change the current scroll position use 'scrollTo()'."),h):b.call(h)},this.info=function(e){var t={size:v,vertical:d.vertical,scrollPos:m,scrollDirection:g,container:d.container,isDocument:_};return arguments.length?void 0!==t[e]?t[e]:void A(1,'ERROR: option "'+e+'" is not available'):t},this.loglevel=function(e){return arguments.length?(d.loglevel!=e&&(d.loglevel=e),h):d.loglevel},this.enabled=function(e){return arguments.length?(y!=e&&(y=!!e,h.updateScene(p,!0)),h):y},this.destroy=function(e){window.clearTimeout(a);for(var t=p.length;t--;)p[t].destroy(e);return d.container.removeEventListener("resize",E),d.container.removeEventListener("scroll",E),r.cAF(o),A(3,"destroyed "+s+" (reset: "+(e?"true":"false")+")"),null},function(){for(var t in d)u.hasOwnProperty(t)||(A(2,'WARNING: Unknown option "'+t+'"'),delete d[t]);if(d.container=r.get.elements(d.container)[0],!d.container)throw A(1,"ERROR creating object "+s+": No valid scroll container supplied"),s+" init failed.";(_=d.container===window||d.container===document.body||!document.body.contains(d.container))&&(d.container=window),v=w(),d.container.addEventListener("resize",E),d.container.addEventListener("scroll",E);var i=parseInt(d.refreshInterval,10);d.refreshInterval=r.type.Number(i)?i:u.refreshInterval,x(),A(3,"added new "+s+" controller (v"+e.version+")")}(),h};var i={defaults:{container:window,vertical:!0,globalSceneOptions:{},loglevel:2,refreshInterval:100}};e.Controller.addOption=function(e,t){i.defaults[e]=t},e.Controller.extend=function(t){var i=this;e.Controller=function(){return i.apply(this,arguments),this.$super=r.extend({},this),t.apply(this,arguments)||this},r.extend(e.Controller,i),e.Controller.prototype=i.prototype,e.Controller.prototype.constructor=e.Controller},e.Scene=function(i){var o,a,s="ScrollMagic.Scene",l="BEFORE",c="DURING",u="AFTER",h=n.defaults,d=this,p=r.extend({},h,i),f=l,m=0,g={start:0,end:0},_=0,v=!0,y={};this.on=function(e,t){return r.type.Function(t)?(e=e.trim().split(" ")).forEach((function(e){var i=e.split("."),n=i[0],r=i[1];"*"!=n&&(y[n]||(y[n]=[]),y[n].push({namespace:r||"",callback:t}))})):x(1,"ERROR when calling '.on()': Supplied callback for '"+e+"' is not a valid function!"),d},this.off=function(e,t){return e?((e=e.trim().split(" ")).forEach((function(e,i){var n=e.split("."),r=n[0],o=n[1]||"";("*"===r?Object.keys(y):[r]).forEach((function(e){for(var i=y[e]||[],n=i.length;n--;){var r=i[n];!r||o!==r.namespace&&"*"!==o||t&&t!=r.callback||i.splice(n,1)}i.length||delete y[e]}))})),d):(x(1,"ERROR: Invalid event name supplied."),d)},this.trigger=function(t,i){if(t){var n=t.trim().split("."),r=n[0],o=n[1],a=y[r];x(3,"event fired:",r,i?"->":"",i||""),a&&a.forEach((function(t,n){o&&o!==t.namespace||t.callback.call(d,new e.Event(r,t.namespace,d,i))}))}else x(1,"ERROR: Invalid event name supplied.");return d},d.on("change.internal",(function(e){"loglevel"!==e.what&&"tweenChanges"!==e.what&&("triggerElement"===e.what?S():"reverse"===e.what&&d.update())})).on("shift.internal",(function(e){T(),d.update()}));var x=this._log=function(e,t){p.loglevel>=e&&(Array.prototype.splice.call(arguments,1,0,"("+s+") ->"),r.log.apply(window,arguments))};this.addTo=function(t){return t instanceof e.Controller?a!=t&&(a&&a.removeScene(d),a=t,A(),C(!0),S(!0),T(),a.info("container").addEventListener("resize",E),t.addScene(d),d.trigger("add",{controller:a}),x(3,"added "+s+" to controller"),d.update()):x(1,"ERROR: supplied argument of 'addTo()' is not a valid ScrollMagic Controller"),d},this.enabled=function(e){return arguments.length?(v!=e&&(v=!!e,d.update(!0)),d):v},this.remove=function(){if(a){a.info("container").removeEventListener("resize",E);var e=a;a=void 0,e.removeScene(d),d.trigger("remove"),x(3,"removed "+s+" from controller")}return d},this.destroy=function(e){return d.trigger("destroy",{reset:e}),d.remove(),d.off("*.*"),x(3,"destroyed "+s+" (reset: "+(e?"true":"false")+")"),null},this.update=function(e){if(a)if(e)if(a.enabled()&&v){var t,i=a.info("scrollPos");t=p.duration>0?(i-g.start)/(g.end-g.start):i>=g.start?1:0,d.trigger("update",{startPos:g.start,endPos:g.end,scrollPos:i}),d.progress(t)}else b&&f===c&&P(!0);else a.updateScene(d,!1);return d},this.refresh=function(){return C(),S(),d},this.progress=function(e){if(arguments.length){var t=!1,i=f,n=a?a.info("scrollDirection"):"PAUSED",r=p.reverse||e>=m;if(0===p.duration?(t=m!=e,f=0==(m=e<1&&r?0:1)?l:c):e<0&&f!==l&&r?(m=0,f=l,t=!0):e>=0&&e<1&&r?(m=e,f=c,t=!0):e>=1&&f!==u?(m=1,f=u,t=!0):f!==c||r||P(),t){var o={progress:m,state:f,scrollDirection:n},s=f!=i,h=function(e){d.trigger(e,o)};s&&i!==c&&(h("enter"),h(i===l?"start":"end")),h("progress"),s&&f!==c&&(h(f===l?"start":"end"),h("leave"))}return d}return m};var b,w,T=function(){g={start:_+p.offset},a&&p.triggerElement&&(g.start-=a.info("size")*p.triggerHook),g.end=g.start+p.duration},C=function(e){if(o){var t="duration";M(t,o.call(d))&&!e&&(d.trigger("change",{what:t,newval:p.duration}),d.trigger("shift",{reason:t}))}},S=function(e){var i=0,n=p.triggerElement;if(a&&(n||_>0)){if(n)if(n.parentNode){for(var o=a.info(),s=r.get.offset(o.container),l=o.vertical?"top":"left";n.parentNode.hasAttribute(t);)n=n.parentNode;var c=r.get.offset(n);o.isDocument||(s[l]-=a.scrollPos()),i=c[l]-s[l]}else x(2,"WARNING: triggerElement was removed from DOM and will be reset to",void 0),d.triggerElement(void 0);var u=i!=_;_=i,u&&!e&&d.trigger("shift",{reason:"triggerElementPosition"})}},E=function(e){p.triggerHook>0&&d.trigger("shift",{reason:"containerResize"})},k=r.extend(n.validate,{duration:function(e){if(r.type.String(e)&&e.match(/^(\.|\d)*\d+%$/)){var t=parseFloat(e)/100;e=function(){return a?a.info("size")*t:0}}if(r.type.Function(e)){o=e;try{e=parseFloat(o.call(d))}catch(t){e=-1}}if(e=parseFloat(e),!r.type.Number(e)||e<0)throw o?(o=void 0,['Invalid return value of supplied function for option "duration":',e]):['Invalid value for option "duration":',e];return e}}),A=function(e){(e=arguments.length?[e]:Object.keys(k)).forEach((function(e,t){var i;if(k[e])try{i=k[e](p[e])}catch(t){i=h[e];var n=r.type.String(t)?[t]:t;r.type.Array(n)?(n[0]="ERROR: "+n[0],n.unshift(1),x.apply(this,n)):x(1,"ERROR: Problem executing validation callback for option '"+e+"':",t.message)}finally{p[e]=i}}))},M=function(e,t){var i=!1,n=p[e];return p[e]!=t&&(p[e]=t,A(e),i=n!=p[e]),i},I=function(e){d[e]||(d[e]=function(t){return arguments.length?("duration"===e&&(o=void 0),M(e,t)&&(d.trigger("change",{what:e,newval:p[e]}),n.shifts.indexOf(e)>-1&&d.trigger("shift",{reason:e})),d):p[e]})};this.controller=function(){return a},this.state=function(){return f},this.scrollOffset=function(){return g.start},this.triggerPosition=function(){var e=p.offset;return a&&(p.triggerElement?e+=_:e+=a.info("size")*d.triggerHook()),e},d.on("shift.internal",(function(e){var t="duration"===e.reason;(f===u&&t||f===c&&0===p.duration)&&P(),t&&D()})).on("progress.internal",(function(e){P()})).on("add.internal",(function(e){D()})).on("destroy.internal",(function(e){d.removePin(e.reset)}));var P=function(e){if(b&&a){var t=a.info(),i=w.spacer.firstChild;if(e||f!==c){var n={position:w.inFlow?"relative":"absolute",top:0,left:0},o=r.css(i,"position")!=n.position;w.pushFollowers?p.duration>0&&(f===u&&0===parseFloat(r.css(w.spacer,"padding-top"))||f===l&&0===parseFloat(r.css(w.spacer,"padding-bottom")))&&(o=!0):n[t.vertical?"top":"left"]=p.duration*m,r.css(i,n),o&&D()}else{"fixed"!=r.css(i,"position")&&(r.css(i,{position:"fixed"}),D());var s=r.get.offset(w.spacer,!0),h=p.reverse||0===p.duration?t.scrollPos-g.start:Math.round(m*p.duration*10)/10;s[t.vertical?"top":"left"]+=h,r.css(w.spacer.firstChild,{top:s.top,left:s.left})}}},D=function(){if(b&&a&&w.inFlow){var e=f===c,t=a.info("vertical"),i=w.spacer.firstChild,n=r.isMarginCollapseType(r.css(w.spacer,"display")),o={};w.relSize.width||w.relSize.autoFullWidth?e?r.css(b,{width:r.get.width(w.spacer)}):r.css(b,{width:"100%"}):(o["min-width"]=r.get.width(t?b:i,!0,!0),o.width=e?o["min-width"]:"auto"),w.relSize.height?e?r.css(b,{height:r.get.height(w.spacer)-(w.pushFollowers?p.duration:0)}):r.css(b,{height:"100%"}):(o["min-height"]=r.get.height(t?i:b,!0,!n),o.height=e?o["min-height"]:"auto"),w.pushFollowers&&(o["padding"+(t?"Top":"Left")]=p.duration*m,o["padding"+(t?"Bottom":"Right")]=p.duration*(1-m)),r.css(w.spacer,o)}},z=function(){a&&b&&f===c&&!a.info("isDocument")&&P()},O=function(){a&&b&&f===c&&((w.relSize.width||w.relSize.autoFullWidth)&&r.get.width(window)!=r.get.width(w.spacer.parentNode)||w.relSize.height&&r.get.height(window)!=r.get.height(w.spacer.parentNode))&&D()},L=function(e){a&&b&&f===c&&!a.info("isDocument")&&(e.preventDefault(),a._setScrollPos(a.info("scrollPos")-((e.wheelDelta||e[a.info("vertical")?"wheelDeltaY":"wheelDeltaX"])/3||30*-e.detail)))};this.setPin=function(e,i){var n=i&&i.hasOwnProperty("pushFollowers");if(i=r.extend({},{pushFollowers:!0,spacerClass:"scrollmagic-pin-spacer"},i),!(e=r.get.elements(e)[0]))return x(1,"ERROR calling method 'setPin()': Invalid pin element supplied."),d;if("fixed"===r.css(e,"position"))return x(1,"ERROR calling method 'setPin()': Pin does not work with elements that are positioned 'fixed'."),d;if(b){if(b===e)return d;d.removePin()}var o=(b=e).parentNode.style.display,a=["top","left","bottom","right","margin","marginLeft","marginRight","marginTop","marginBottom"];b.parentNode.style.display="none";var s="absolute"!=r.css(b,"position"),l=r.css(b,a.concat(["display"])),c=r.css(b,["width","height"]);b.parentNode.style.display=o,!s&&i.pushFollowers&&(x(2,"WARNING: If the pinned element is positioned absolutely pushFollowers will be disabled."),i.pushFollowers=!1),window.setTimeout((function(){b&&0===p.duration&&n&&i.pushFollowers&&x(2,"WARNING: pushFollowers =",!0,"has no effect, when scene duration is 0.")}),0);var u=b.parentNode.insertBefore(document.createElement("div"),b),h=r.extend(l,{position:s?"relative":"absolute",boxSizing:"content-box",mozBoxSizing:"content-box",webkitBoxSizing:"content-box"});if(s||r.extend(h,r.css(b,["width","height"])),r.css(u,h),u.setAttribute(t,""),r.addClass(u,i.spacerClass),w={spacer:u,relSize:{width:"%"===c.width.slice(-1),height:"%"===c.height.slice(-1),autoFullWidth:"auto"===c.width&&s&&r.isMarginCollapseType(l.display)},pushFollowers:i.pushFollowers,inFlow:s},!b.___origStyle){b.___origStyle={};var f=b.style;a.concat(["width","height","position","boxSizing","mozBoxSizing","webkitBoxSizing"]).forEach((function(e){b.___origStyle[e]=f[e]||""}))}return w.relSize.width&&r.css(u,{width:c.width}),w.relSize.height&&r.css(u,{height:c.height}),u.appendChild(b),r.css(b,{position:s?"relative":"absolute",margin:"auto",top:"auto",left:"auto",bottom:"auto",right:"auto"}),(w.relSize.width||w.relSize.autoFullWidth)&&r.css(b,{boxSizing:"border-box",mozBoxSizing:"border-box",webkitBoxSizing:"border-box"}),window.addEventListener("scroll",z),window.addEventListener("resize",z),window.addEventListener("resize",O),b.addEventListener("mousewheel",L),b.addEventListener("DOMMouseScroll",L),x(3,"added pin"),P(),d},this.removePin=function(e){if(b){if(f===c&&P(!0),e||!a){var i=w.spacer.firstChild;if(i.hasAttribute(t)){var n=w.spacer.style,o={};["margin","marginLeft","marginRight","marginTop","marginBottom"].forEach((function(e){o[e]=n[e]||""})),r.css(i,o)}w.spacer.parentNode.insertBefore(i,w.spacer),w.spacer.parentNode.removeChild(w.spacer),b.parentNode.hasAttribute(t)||(r.css(b,b.___origStyle),delete b.___origStyle)}window.removeEventListener("scroll",z),window.removeEventListener("resize",z),window.removeEventListener("resize",O),b.removeEventListener("mousewheel",L),b.removeEventListener("DOMMouseScroll",L),b=void 0,x(3,"removed pin (reset: "+(e?"true":"false")+")")}return d};var R,B=[];return d.on("destroy.internal",(function(e){d.removeClassToggle(e.reset)})),this.setClassToggle=function(e,t){var i=r.get.elements(e);return 0!==i.length&&r.type.String(t)?(B.length>0&&d.removeClassToggle(),R=t,B=i,d.on("enter.internal_class leave.internal_class",(function(e){var t="enter"===e.type?r.addClass:r.removeClass;B.forEach((function(e,i){t(e,R)}))})),d):(x(1,"ERROR calling method 'setClassToggle()': Invalid "+(0===i.length?"element":"classes")+" supplied."),d)},this.removeClassToggle=function(e){return e&&B.forEach((function(e,t){r.removeClass(e,R)})),d.off("start.internal_class end.internal_class"),R=void 0,B=[],d},function(){for(var e in p)h.hasOwnProperty(e)||(x(2,'WARNING: Unknown option "'+e+'"'),delete p[e]);for(var t in h)I(t);A()}(),d};var n={defaults:{duration:0,offset:0,triggerElement:void 0,triggerHook:.5,reverse:!0,loglevel:2},validate:{offset:function(e){if(e=parseFloat(e),!r.type.Number(e))throw['Invalid value for option "offset":',e];return e},triggerElement:function(e){if(e=e||void 0){var t=r.get.elements(e)[0];if(!t||!t.parentNode)throw['Element defined in option "triggerElement" was not found:',e];e=t}return e},triggerHook:function(e){var t={onCenter:.5,onEnter:1,onLeave:0};if(r.type.Number(e))e=Math.max(0,Math.min(parseFloat(e),1));else{if(!(e in t))throw['Invalid value for option "triggerHook": ',e];e=t[e]}return e},reverse:function(e){return!!e},loglevel:function(e){if(e=parseInt(e),!r.type.Number(e)||e<0||e>3)throw['Invalid value for option "loglevel":',e];return e}},shifts:["duration","offset","triggerHook"]};e.Scene.addOption=function(t,i,r,o){t in n.defaults?e._util.log(1,"[static] ScrollMagic.Scene -> Cannot add Scene option '"+t+"', because it already exists."):(n.defaults[t]=i,n.validate[t]=r,o&&n.shifts.push(t))},e.Scene.extend=function(t){var i=this;e.Scene=function(){return i.apply(this,arguments),this.$super=r.extend({},this),t.apply(this,arguments)||this},r.extend(e.Scene,i),e.Scene.prototype=i.prototype,e.Scene.prototype.constructor=e.Scene},e.Event=function(e,t,i,n){for(var r in n=n||{})this[r]=n[r];return this.type=e,this.target=this.currentTarget=i,this.namespace=t||"",this.timeStamp=this.timestamp=Date.now(),this};var r=e._util=function(e){var t,i={},n=function(e){return parseFloat(e)||0},r=function(t){return t.currentStyle?t.currentStyle:e.getComputedStyle(t)},o=function(t,i,o,a){if((i=i===document?e:i)===e)a=!1;else if(!f.DomElement(i))return 0;t=t.charAt(0).toUpperCase()+t.substr(1).toLowerCase();var s=(o?i["offset"+t]||i["outer"+t]:i["client"+t]||i["inner"+t])||0;if(o&&a){var l=r(i);s+="Height"===t?n(l.marginTop)+n(l.marginBottom):n(l.marginLeft)+n(l.marginRight)}return s},a=function(e){return e.replace(/^[^a-z]+([a-z])/g,"$1").replace(/-([a-z])/g,(function(e){return e[1].toUpperCase()}))};i.extend=function(e){for(e=e||{},t=1;t-1};var s=0,l=["ms","moz","webkit","o"],c=e.requestAnimationFrame,u=e.cancelAnimationFrame;for(t=0;!c&&th.length||e<=0)&&(e=h.length);var t=new Date,i=("0"+t.getHours()).slice(-2)+":"+("0"+t.getMinutes()).slice(-2)+":"+("0"+t.getSeconds()).slice(-2)+":"+("00"+t.getMilliseconds()).slice(-3),n=h[e-1],r=Array.prototype.splice.call(arguments,1),o=Function.prototype.bind.call(d[n],d);r.unshift(i),o.apply(d,r)};var f=i.type=function(e){return Object.prototype.toString.call(e).replace(/^\[object (.+)\]$/,"$1").toLowerCase()};f.String=function(e){return"string"===f(e)},f.Function=function(e){return"function"===f(e)},f.Array=function(e){return Array.isArray(e)},f.Number=function(e){return!f.Array(e)&&e-parseFloat(e)+1>=0},f.DomElement=function(e){return"object"==typeof HTMLElement||"function"==typeof HTMLElement?e instanceof HTMLElement||e instanceof SVGElement:e&&"object"==typeof e&&null!==e&&1===e.nodeType&&"string"==typeof e.nodeName};var m=i.get={};return m.elements=function(t){var i=[];if(f.String(t))try{t=document.querySelectorAll(t)}catch(e){return i}if("nodelist"===f(t)||f.Array(t)||t instanceof NodeList)for(var n=0,r=i.length=t.length;n ERROR calling addIndicators() due to missing Plugin 'debug.addIndicators'. Please make sure to include plugins/debug.addIndicators.js"),this},e.Scene.prototype.removeIndicators=function(){return e._util.log(1,"(ScrollMagic.Scene) -> ERROR calling removeIndicators() due to missing Plugin 'debug.addIndicators'. Please make sure to include plugins/debug.addIndicators.js"),this},e.Scene.prototype.setTween=function(){return e._util.log(1,"(ScrollMagic.Scene) -> ERROR calling setTween() due to missing Plugin 'animation.gsap'. Please make sure to include plugins/animation.gsap.js"),this},e.Scene.prototype.removeTween=function(){return e._util.log(1,"(ScrollMagic.Scene) -> ERROR calling removeTween() due to missing Plugin 'animation.gsap'. Please make sure to include plugins/animation.gsap.js"),this},e.Scene.prototype.setVelocity=function(){return e._util.log(1,"(ScrollMagic.Scene) -> ERROR calling setVelocity() due to missing Plugin 'animation.velocity'. Please make sure to include plugins/animation.velocity.js"),this},e.Scene.prototype.removeVelocity=function(){return e._util.log(1,"(ScrollMagic.Scene) -> ERROR calling removeVelocity() due to missing Plugin 'animation.velocity'. Please make sure to include plugins/animation.velocity.js"),this},e},"function"==typeof define&&define.amd?define(r):"object"==typeof i?t.exports=r():n.ScrollMagic=r()},{}],9:[function(e,t,i){ /*! * ScrollMagic v2.0.8 (2020-08-14) * The javascript library for magical scroll interactions. * (c) 2020 Jan Paepke (@janpaepke) * Project Website: http://scrollmagic.io * * @version 2.0.8 * @license Dual licensed under MIT license and GPL. * @author Jan Paepke - e-mail@janpaepke.de * * @file ScrollMagic GSAP Animation Plugin. * * requires: GSAP ~1.14 * Powered by the Greensock Animation Platform (GSAP): http://www.greensock.com/js * Greensock License info at http://www.greensock.com/licensing/ */ !function(t,n){if("function"==typeof define&&define.amd)define(["ScrollMagic","gsap","TweenMax","TimelineMax"],n);else if("object"==typeof i){var r=e("gsap/dist/gsap")||e("gsap");n(e("scrollmagic"),r,TweenMax||r,TimelineMax||r)}else n(t.ScrollMagic||t.jQuery&&t.jQuery.ScrollMagic,t.gsap,t.gsap||t.TweenMax||t.TweenLite,t.gsap||t.TimelineMax||t.TimelineLite)}(this,(function(e,t,i,n){"use strict";var r="animation.gsap",o=t&&parseFloat(t.version)>=3,a=window.console||{},s=Function.prototype.bind.call(a.error||a.log||function(){},a);e||s("("+r+") -> ERROR: The ScrollMagic main module could not be found. Please make sure it's loaded before this plugin or use an asynchronous loader like requirejs."),i||s("("+r+") -> ERROR: TweenLite or TweenMax could not be found. Please make sure GSAP is loaded before ScrollMagic or use an asynchronous loader like requirejs."),e.Scene.addOption("tweenChanges",!1,(function(e){return!!e})),e.Scene.extend((function(){var e,t=this,a=function(){t._log&&(Array.prototype.splice.call(arguments,1,0,"("+r+")","->"),t._log.apply(this,arguments))};t.on("progress.plugin_gsap",(function(){s()})),t.on("destroy.plugin_gsap",(function(e){t.removeTween(e.reset)}));var s=function(){if(e){var i=t.progress(),n=t.state();e.repeat&&-1===e.repeat()?"DURING"===n&&e.paused()?e.play():"DURING"===n||e.paused()||e.pause():i!=e.progress()&&(0===t.duration()?i>0?e.play():e.reverse():t.tweenChanges()&&e.tweenTo?e.tweenTo(i*e.duration()):e.progress(i).pause())}};t.setTween=function(r,l,c){var u;if(arguments.length>1){var h="number"==typeof arguments[1];o?(h||(c=l),c.hasOwnProperty("duration")||(c.duration=h?l:1)):arguments.length<3&&(c=l,l=1),r=o?i.to(r,c):i.to(r,l,c)}try{(u=n&&!o?new n({smoothChildTiming:!0}).add(r):r).pause()}catch(e){return a(1,"ERROR calling method 'setTween()': Supplied argument is not a valid TweenObject"),t}if(e&&t.removeTween(),e=u,r.repeat&&-1===r.repeat()&&(e.repeat(-1),e.yoyo(r.yoyo())),t.tweenChanges()&&!e.tweenTo&&a(2,"WARNING: tweenChanges will only work if the TimelineMax object is available for ScrollMagic."),e&&t.controller()&&t.triggerElement()&&t.loglevel()>=2){var d=i.getTweensOf(t.triggerElement()),p=t.controller().info("vertical");d.forEach((function(e,t){var i=e.vars.css||e.vars;if(p?void 0!==i.top||void 0!==i.bottom:void 0!==i.left||void 0!==i.right)return a(2,"WARNING: Tweening the position of the trigger element affects the scene timing and should be avoided!"),!1}))}if(parseFloat(TweenLite.version)>=1.14)for(var f,m,g=o?"onInterrupt":"onOverwrite",_=e.getChildren?e.getChildren(!0,!0,!1):[e],v=function(){a(2,"WARNING: tween was overwritten by another. To learn how to avoid this issue see here: https://github.com/janpaepke/ScrollMagic/wiki/WARNING:-tween-was-overwritten-by-another")},y=0;y<_.length;y++)f=_[y],m!==v&&(m=f.vars[g],f.vars[g]=function(){m&&m.apply(this,arguments),v.apply(this,arguments)});return a(3,"added tween"),s(),t},t.removeTween=function(i){return e&&(i&&e.progress(0).pause(),e.kill(),e=void 0,a(3,"removed tween (reset: "+(i?"true":"false")+")")),t}}))}))},{gsap:5,"gsap/dist/gsap":5,scrollmagic:8}],10:[function(e,t,i){(function(t,n){(function(){var r=e("process/browser.js").nextTick,o=Function.prototype.apply,a=Array.prototype.slice,s={},l=0;function c(e,t){this._id=e,this._clearFn=t}i.setTimeout=function(){return new c(o.call(setTimeout,window,arguments),clearTimeout)},i.setInterval=function(){return new c(o.call(setInterval,window,arguments),clearInterval)},i.clearTimeout=i.clearInterval=function(e){e.close()},c.prototype.unref=c.prototype.ref=function(){},c.prototype.close=function(){this._clearFn.call(window,this._id)},i.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},i.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},i._unrefActive=i.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout((function(){e._onTimeout&&e._onTimeout()}),t))},i.setImmediate="function"==typeof t?t:function(e){var t=l++,n=!(arguments.length<2)&&a.call(arguments,1);return s[t]=!0,r((function(){s[t]&&(n?e.apply(null,n):e.call(null),i.clearImmediate(t))})),t},i.clearImmediate="function"==typeof n?n:function(e){delete s[e]}}).call(this)}).call(this,e("timers").setImmediate,e("timers").clearImmediate)},{"process/browser.js":7,timers:10}],11:[function(e,t,i){ /*! * viewport-units-buggyfill v0.6.2 * @web: https://github.com/rodneyrehm/viewport-units-buggyfill/ * @author: Rodney Rehm - http://rodneyrehm.de/en/ */ !function(){!function(e,n){"use strict";"function"==typeof define&&define.amd?define([],n):"object"==typeof i?t.exports=n():e.viewportUnitsBuggyfill=n()}(this,(function(){"use strict";var e,t,i,n,r,o=!1,a=window.navigator.userAgent,s=/([+-]?[0-9.]+)(vh|vw|vmin|vmax)/g,l=/(https?:)?\/\//,c=[].forEach,u=/MSIE [0-9]\./i.test(a),h=/MSIE [0-8]\./i.test(a),d=a.indexOf("Opera Mini")>-1,p=/(iPhone|iPod|iPad).+AppleWebKit/i.test(a)&&((r=a.match(/OS (\d)/))&&r.length>1&&parseInt(r[1])<10),f=a.indexOf(" Android ")>-1&&a.indexOf("Version/")>-1&&parseFloat((a.match("Android ([0-9.]+)")||[])[1])<=4.4;u||(u=!!navigator.userAgent.match(/MSIE 10\.|Trident.*rv[ :]*1[01]\.| Edge\/1\d\./));try{new m("test")}catch(e){var m=function(e,t){var i;return t=t||{bubbles:!1,cancelable:!1,detail:void 0},(i=document.createEvent("CustomEvent")).initCustomEvent(e,t.bubbles,t.cancelable,t.detail),i};m.prototype=window.Event.prototype,window.CustomEvent=m}function g(){o&&(_(),setTimeout((function(){n.textContent=y(),n.parentNode.appendChild(n),window.dispatchEvent(new m("viewport-units-buggyfill-style"))}),1))}function _(){return i=[],c.call(document.styleSheets,(function(e){var t=function(e){try{if(!e.cssRules)return}catch(e){if("SecurityError"!==e.name)throw e;return}for(var t=[],i=0;i1&&void 0!==arguments[1]?arguments[1]:{},i=Object.assign({},n,t),r=i.host,o=i.trackerFileName;(function(e){var t=new Promise((function(t,i){var n=document.createElement("script");n.async=!0,n.defer=!0,n.src=e,(document.head||document.getElementsByTagName("head")[0]).appendChild(n),n.onload=t,n.onerror=i}));return t.catch((function(e){e.target.src})),t})("".concat(r,"/").concat(o,".js")).then((function(){return function(e,t){var i=t.host,n=t.siteId,r=t.trackerFileName,o=t.trackerUrl||"".concat(i,"/").concat(r,".php"),a=window.Piwik.getTracker(o,n);e.prototype.$piwik=a,e.prototype.$matomo=a,t.requireConsent&&a.requireConsent(),t.trackInitialView&&a.trackPageView(),t.enableLinkTracking&&a.enableLinkTracking(),t.router&&t.router.afterEach((function(e,i){var n=window.location,r=n.protocol;":"!==r.slice(-1)&&(r+=":");var o="hash"===t.router.mode?"/#":"",s=r+"//"+n.host+o+e.path;e.meta.analyticsIgnore?t.debug:(t.debug,a.setCustomUrl(s),a.trackPageView())}))}(e,i)}))}}])}))},{}],13:[function(e,t,i){ /*! * vue-resource v1.5.1 * https://github.com/pagekit/vue-resource * Released under the MIT License. */ "use strict";function n(e){this.state=2,this.value=void 0,this.deferred=[];var t=this;try{e((function(e){t.resolve(e)}),(function(e){t.reject(e)}))}catch(e){t.reject(e)}}n.reject=function(e){return new n((function(t,i){i(e)}))},n.resolve=function(e){return new n((function(t,i){t(e)}))},n.all=function(e){return new n((function(t,i){var r=0,o=[];function a(i){return function(n){o[i]=n,(r+=1)===e.length&&t(o)}}0===e.length&&t(o);for(var s=0;s=200&&a<300,this.status=a||0,this.statusText=s||"",this.headers=new B(r),this.body=e,f(e)?this.bodyText=e:(i=e,"undefined"!=typeof Blob&&i instanceof Blob&&(this.bodyBlob=e,function(e){return 0===e.type.indexOf("text")||-1!==e.type.indexOf("json")}(e)&&(this.bodyText=function(e){return new o((function(t){var i=new FileReader;i.readAsText(e),i.onload=function(){t(i.result)}}))}(e))))};$.prototype.blob=function(){return v(this.bodyBlob)},$.prototype.text=function(){return v(this.bodyText)},$.prototype.json=function(){return v(this.text(),(function(e){return JSON.parse(e)}))},Object.defineProperty($.prototype,"data",{get:function(){return this.body},set:function(e){this.body=e}});var j=function(e){var t;this.body=null,this.params={},b(this,e,{method:(t=e.method||"GET",t?t.toUpperCase():"")}),this.headers instanceof B||(this.headers=new B(this.headers))};j.prototype.getUrl=function(){return M(this)},j.prototype.getBody=function(){return this.body},j.prototype.respondWith=function(e,t){return new $(e,b(t||{},{url:this.getUrl()}))};var N={"Content-Type":"application/json;charset=utf-8"};function U(e){var t=this||{},i=function(e){var t=[R],i=[];function n(n){for(;t.length;){var r=t.pop();if(m(r)){var a=void 0,s=void 0;if(g(a=r.call(e,n,(function(e){return s=e}))||s))return new o((function(t,n){i.forEach((function(t){a=v(a,(function(i){return t.call(e,i)||i}),n)})),v(a,t,n)}),e);m(a)&&i.unshift(a)}}}return g(e)||(e=null),n.use=function(e){t.push(e)},n}(t.$vm);return function(e){c.call(arguments,1).forEach((function(t){for(var i in t)void 0===e[i]&&(e[i]=t[i])}))}(e||{},t.$options,U.options),U.interceptors.forEach((function(e){f(e)&&(e=U.interceptor[e]),m(e)&&i.use(e)})),i(new j(e)).then((function(e){return e.ok?e:o.reject(e)}),(function(e){return Error,o.reject(e)}))}function V(e,t,i,n){var r=this||{},o={};return x(i=b({},V.actions,i),(function(i,a){i=w({url:e,params:b({},t)},n,i),o[a]=function(){return(r.$http||U)(G(i,arguments))}})),o}function G(e,t){var i,n=b({},e),r={};switch(t.length){case 2:r=t[0],i=t[1];break;case 1:/^(POST|PUT|PATCH)$/i.test(n.method)?i=t[0]:r=t[0];break;case 0:break;default:throw"Expected up to 2 arguments [params, body], got "+t.length+" arguments"}return n.body=i,n.params=b({},n.params,r),n}function q(e){q.installed||(!function(e){var t=e.config,i=e.nextTick;s=i,t.debug||!t.silent}(e),e.url=M,e.http=U,e.resource=V,e.Promise=o,Object.defineProperties(e.prototype,{$url:{get:function(){return y(e.url,this,this.$options.url)}},$http:{get:function(){return y(e.http,this,this.$options.http)}},$resource:{get:function(){return e.resource.bind(this)}},$promise:{get:function(){var t=this;return function(i){return new e.Promise(i,t)}}}}))}U.options={},U.headers={put:N,post:N,patch:N,delete:N,common:{Accept:"application/json, text/plain, */*"},custom:{}},U.interceptor={before:function(e){m(e.before)&&e.before.call(this,e)},method:function(e){e.emulateHTTP&&/^(PUT|PATCH|DELETE)$/i.test(e.method)&&(e.headers.set("X-HTTP-Method-Override",e.method),e.method="POST")},jsonp:function(e){"JSONP"==e.method&&(e.client=z)},json:function(e){var t=e.headers.get("Content-Type")||"";return g(e.body)&&0===t.indexOf("application/json")&&(e.body=JSON.stringify(e.body)),function(e){return e.bodyText?v(e.text(),(function(t){var i,n,r;if(0===(e.headers.get("Content-Type")||"").indexOf("application/json")||(n=(i=t).match(/^\s*(\[|\{)/),r={"[":/]\s*$/,"{":/}\s*$/},n&&r[n[1]].test(i)))try{e.body=JSON.parse(t)}catch(t){e.body=null}else e.body=t;return e})):e}},form:function(e){var t;t=e.body,"undefined"!=typeof FormData&&t instanceof FormData?e.headers.delete("Content-Type"):g(e.body)&&e.emulateJSON&&(e.body=M.params(e.body),e.headers.set("Content-Type","application/x-www-form-urlencoded"))},header:function(e){x(b({},U.headers.common,e.crossOrigin?{}:U.headers.custom,U.headers[d(e.method)]),(function(t,i){e.headers.has(i)||e.headers.set(i,t)}))},cors:function(e){if(u){var t=M.parse(location.href),i=M.parse(e.getUrl());i.protocol===t.protocol&&i.host===t.host||(e.crossOrigin=!0,e.emulateHTTP=!1,D||(e.client=P))}}},U.interceptors=["before","method","jsonp","json","form","header","cors"],["get","delete","head","jsonp"].forEach((function(e){U[e]=function(t,i){return this(b(i||{},{url:t,method:e}))}})),["post","put","patch"].forEach((function(e){U[e]=function(t,i,n){return this(b(n||{},{url:t,method:e,body:i}))}})),V.actions={get:{method:"GET"},save:{method:"POST"},query:{method:"GET"},update:{method:"PUT"},remove:{method:"DELETE"},delete:{method:"DELETE"}},"undefined"!=typeof window&&window.Vue&&window.Vue.use(q),t.exports=q},{got:1}],14:[function(e,t,i){(function(e){(function(){ /*! * vue-router v3.4.9 * (c) 2020 Evan You * @license MIT */ "use strict";function i(e,t){if(!e)throw new Error("[vue-router] "+t)}function n(t,i){e.env.NODE_ENV}function r(e,t){for(var i in t)e[i]=t[i];return e}var o=/[!'()*]/g,a=function(e){return"%"+e.charCodeAt(0).toString(16)},s=/%2C/g,l=function(e){return encodeURIComponent(e).replace(o,a).replace(s,",")};function c(t){try{return decodeURIComponent(t)}catch(t){"production"!==e.env.NODE_ENV&&n()}return t}var u=function(e){return null==e||"object"==typeof e?e:String(e)};function h(e){var t={};return(e=e.trim().replace(/^(\?|#|&)/,""))?(e.split("&").forEach((function(e){var i=e.replace(/\+/g," ").split("="),n=c(i.shift()),r=i.length>0?c(i.join("=")):null;void 0===t[n]?t[n]=r:Array.isArray(t[n])?t[n].push(r):t[n]=[t[n],r]})),t):t}function d(e){var t=e?Object.keys(e).map((function(t){var i=e[t];if(void 0===i)return"";if(null===i)return l(t);if(Array.isArray(i)){var n=[];return i.forEach((function(e){void 0!==e&&(null===e?n.push(l(t)):n.push(l(t)+"="+l(e)))})),n.join("&")}return l(t)+"="+l(i)})).filter((function(e){return e.length>0})).join("&"):null;return t?"?"+t:""}var p=/\/?$/;function f(e,t,i,n){var r=n&&n.options.stringifyQuery,o=t.query||{};try{o=m(o)}catch(e){}var a={name:t.name||e&&e.name,meta:e&&e.meta||{},path:t.path||"/",hash:t.hash||"",query:o,params:t.params||{},fullPath:v(t,r),matched:e?_(e):[]};return i&&(a.redirectedFrom=v(i,r)),Object.freeze(a)}function m(e){if(Array.isArray(e))return e.map(m);if(e&&"object"==typeof e){var t={};for(var i in e)t[i]=m(e[i]);return t}return e}var g=f(null,{path:"/"});function _(e){for(var t=[];e;)t.unshift(e),e=e.parent;return t}function v(e,t){var i=e.path,n=e.query;void 0===n&&(n={});var r=e.hash;return void 0===r&&(r=""),(i||"/")+(t||d)(n)+r}function y(e,t){return t===g?e===t:!!t&&(e.path&&t.path?e.path.replace(p,"")===t.path.replace(p,"")&&e.hash===t.hash&&x(e.query,t.query):!(!e.name||!t.name)&&(e.name===t.name&&e.hash===t.hash&&x(e.query,t.query)&&x(e.params,t.params)))}function x(e,t){if(void 0===e&&(e={}),void 0===t&&(t={}),!e||!t)return e===t;var i=Object.keys(e).sort(),n=Object.keys(t).sort();return i.length===n.length&&i.every((function(i,r){var o=e[i];if(n[r]!==i)return!1;var a=t[i];return null==o||null==a?o===a:"object"==typeof o&&"object"==typeof a?x(o,a):String(o)===String(a)}))}function b(e){for(var t=0;t=0&&(t=e.slice(n),e=e.slice(0,n));var r=e.indexOf("?");return r>=0&&(i=e.slice(r+1),e=e.slice(0,r)),{path:e,query:i,hash:t}}(s.path||""),f=i&&i.path||"/",m=p.path?C(p.path,f,o||s.append):f,g=function(t,i,r){void 0===i&&(i={});var o,a=r||h;try{o=a(t||"")}catch(t){"production"!==e.env.NODE_ENV&&n(0,t.message),o={}}for(var s in i){var l=i[s];o[s]=Array.isArray(l)?l.map(u):u(l)}return o}(p.query,s.query,a&&a.options.parseQuery),_=s.hash||p.hash;return _&&"#"!==_.charAt(0)&&(_="#"+_),{_normalized:!0,path:m,query:g,hash:_}}var q,W=function(){},Z={name:"RouterLink",props:{to:{type:[String,Object],required:!0},tag:{type:String,default:"a"},exact:Boolean,append:Boolean,replace:Boolean,activeClass:String,exactActiveClass:String,ariaCurrentValue:{type:String,default:"page"},event:{type:[String,Array],default:"click"}},render:function(t){var i=this,o=this.$router,a=this.$route,s=o.resolve(this.to,a,this.append),l=s.location,c=s.route,u=s.href,h={},d=o.options.linkActiveClass,m=o.options.linkExactActiveClass,g=null==d?"router-link-active":d,_=null==m?"router-link-exact-active":m,v=null==this.activeClass?g:this.activeClass,x=null==this.exactActiveClass?_:this.exactActiveClass,b=c.redirectedFrom?f(null,G(c.redirectedFrom),null,o):c;h[x]=y(a,b),h[v]=this.exact?h[x]:function(e,t){return 0===e.path.replace(p,"/").indexOf(t.path.replace(p,"/"))&&(!t.hash||e.hash===t.hash)&&function(e,t){for(var i in t)if(!(i in e))return!1;return!0}(e.query,t.query)}(a,b);var w=h[x]?this.ariaCurrentValue:null,T=function(e){H(e)&&(i.replace?o.replace(l,W):o.push(l,W))},C={click:H};Array.isArray(this.event)?this.event.forEach((function(e){C[e]=T})):C[this.event]=T;var S={class:h},E=!this.$scopedSlots.$hasNormal&&this.$scopedSlots.default&&this.$scopedSlots.default({href:u,route:c,navigate:T,isActive:h[v],isExactActive:h[x]});if(E){if(1===E.length)return E[0];if(E.length>1||!E.length)return"production"!==e.env.NODE_ENV&&n(0,this.to),0===E.length?t():t("span",{},E)}if("a"===this.tag)S.on=C,S.attrs={href:u,"aria-current":w};else{var k=X(this.$slots.default);if(k){k.isStatic=!1;var A=k.data=r({},k.data);for(var M in A.on=A.on||{},A.on){var I=A.on[M];M in C&&(A.on[M]=Array.isArray(I)?I:[I])}for(var P in C)P in A.on?A.on[P].push(C[P]):A.on[P]=T;var D=k.data.attrs=r({},k.data.attrs);D.href=u,D["aria-current"]=w}else S.on=C}return t(this.tag,S,this.$slots.default)}};function H(e){if(!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey||e.defaultPrevented||void 0!==e.button&&0!==e.button)){if(e.currentTarget&&e.currentTarget.getAttribute){var t=e.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(t))return}return e.preventDefault&&e.preventDefault(),!0}}function X(e){if(e)for(var t,i=0;i0){h.map((function(e){return"- "+e})).join("\n");n()}}return{pathList:a,pathMap:s,nameMap:l}}function Q(t,r,o,a,s,l){var c=a.path,u=a.name;"production"!==e.env.NODE_ENV&&(i(null!=c,'"path" is required in a route configuration.'),i("string"!=typeof a.component,'route config "component" for path: '+String(c||u)+" cannot be a string id. Use an actual component instead."),n(/[^\u0000-\u007F]+/.test(c)));var h=a.pathToRegexpOptions||{},d=function(e,t,i){i||(e=e.replace(/\/$/,""));if("/"===e[0])return e;if(null==t)return e;return S(t.path+"/"+e)}(c,s,h.strict);"boolean"==typeof a.caseSensitive&&(h.sensitive=a.caseSensitive);var p={path:d,regex:ee(d,h),components:a.components||{default:a.component},instances:{},enteredCbs:{},name:u,parent:s,matchAs:l,redirect:a.redirect,beforeEnter:a.beforeEnter,meta:a.meta||{},props:null==a.props?{}:a.components?a.props:{default:a.props}};if(a.children&&("production"!==e.env.NODE_ENV&&a.name&&!a.redirect&&a.children.some((function(e){return/^\/?$/.test(e.path)}))&&n(0,(a.name,a.name)),a.children.forEach((function(e){var i=l?S(l+"/"+e.path):void 0;Q(t,r,o,e,p,i)}))),r[p.path]||(t.push(p.path),r[p.path]=p),void 0!==a.alias)for(var f=Array.isArray(a.alias)?a.alias:[a.alias],m=0;m-1&&(c.params[f]=i.params[f]);return c.path=V(d.path,c.params),h(d,c,o)}if(c.path){c.params={};for(var m=0;m=e.length?i():e[r]?t(e[r],(function(){n(r+1)})):n(r+1)};n(0)}var Te={redirected:2,aborted:4,cancelled:8,duplicated:16};function Ce(e,t){return Ee(e,t,Te.redirected,'Redirected when going from "'+e.fullPath+'" to "'+function(e){if("string"==typeof e)return e;if("path"in e)return e.path;var t={};return ke.forEach((function(i){i in e&&(t[i]=e[i])})),JSON.stringify(t,null,2)}(t)+'" via a navigation guard.')}function Se(e,t){return Ee(e,t,Te.cancelled,'Navigation cancelled from "'+e.fullPath+'" to "'+t.fullPath+'" with a new navigation.')}function Ee(e,t,i,n){var r=new Error(n);return r._isRouter=!0,r.from=e,r.to=t,r.type=i,r}var ke=["params","query","hash"];function Ae(e){return Object.prototype.toString.call(e).indexOf("Error")>-1}function Me(e,t){return Ae(e)&&e._isRouter&&(null==t||e.type===t)}function Ie(t){return function(i,r,o){var a=!1,s=0,l=null;Pe(t,(function(t,i,r,c){if("function"==typeof t&&void 0===t.cid){a=!0,s++;var u,h=Oe((function(e){var i;((i=e).__esModule||ze&&"Module"===i[Symbol.toStringTag])&&(e=e.default),t.resolved="function"==typeof e?e:q.extend(e),r.components[c]=e,--s<=0&&o()})),d=Oe((function(t){var i="Failed to resolve async component "+c+": "+t;"production"!==e.env.NODE_ENV&&n(),l||(l=Ae(t)?t:new Error(i),o(l))}));try{u=t(h,d)}catch(e){d(e)}if(u)if("function"==typeof u.then)u.then(h,d);else{var p=u.component;p&&"function"==typeof p.then&&p.then(h,d)}}})),a||o()}}function Pe(e,t){return De(e.map((function(e){return Object.keys(e.components).map((function(i){return t(e.components[i],e.instances[i],e,i)}))})))}function De(e){return Array.prototype.concat.apply([],e)}var ze="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;function Oe(e){var t=!1;return function(){for(var i=[],n=arguments.length;n--;)i[n]=arguments[n];if(!t)return t=!0,e.apply(this,i)}}var Le=function(e,t){this.router=e,this.base=function(e){if(!e)if(K){var t=document.querySelector("base");e=(e=t&&t.getAttribute("href")||"/").replace(/^https?:\/\/[^\/]+/,"")}else e="/";"/"!==e.charAt(0)&&(e="/"+e);return e.replace(/\/$/,"")}(t),this.current=g,this.pending=null,this.ready=!1,this.readyCbs=[],this.readyErrorCbs=[],this.errorCbs=[],this.listeners=[]};function Re(e,t,i,n){var r=Pe(e,(function(e,n,r,o){var a=function(e,t){"function"!=typeof e&&(e=q.extend(e));return e.options[t]}(e,t);if(a)return Array.isArray(a)?a.map((function(e){return i(e,n,r,o)})):i(a,n,r,o)}));return De(n?r.reverse():r)}function Be(e,t){if(t)return function(){return e.apply(t,arguments)}}Le.prototype.listen=function(e){this.cb=e},Le.prototype.onReady=function(e,t){this.ready?e():(this.readyCbs.push(e),t&&this.readyErrorCbs.push(t))},Le.prototype.onError=function(e){this.errorCbs.push(e)},Le.prototype.transitionTo=function(e,t,i){var n,r=this;try{n=this.router.match(e,this.current)}catch(e){throw this.errorCbs.forEach((function(t){t(e)})),e}var o=this.current;this.confirmTransition(n,(function(){r.updateRoute(n),t&&t(n),r.ensureURL(),r.router.afterHooks.forEach((function(e){e&&e(n,o)})),r.ready||(r.ready=!0,r.readyCbs.forEach((function(e){e(n)})))}),(function(e){i&&i(e),e&&!r.ready&&(Me(e,Te.redirected)&&o===g||(r.ready=!0,r.readyErrorCbs.forEach((function(t){t(e)}))))}))},Le.prototype.confirmTransition=function(e,t,i){var r=this,o=this.current;this.pending=e;var a,s,l=function(e){!Me(e)&&Ae(e)&&(r.errorCbs.length?r.errorCbs.forEach((function(t){t(e)})):n()),i&&i(e)},c=e.matched.length-1,u=o.matched.length-1;if(y(e,o)&&c===u&&e.matched[c]===o.matched[u])return this.ensureURL(),l(((s=Ee(a=o,e,Te.duplicated,'Avoided redundant navigation to current location: "'+a.fullPath+'".')).name="NavigationDuplicated",s));var h=function(e,t){var i,n=Math.max(e.length,t.length);for(i=0;i0)){var t=this.router,i=t.options.scrollBehavior,n=ye&&i;n&&this.listeners.push(ce());var r=function(){var i=e.current,r=$e(e.base);e.current===g&&r===e._startLocation||e.transitionTo(r,(function(e){n&&ue(t,e,i,!0)}))};window.addEventListener("popstate",r),this.listeners.push((function(){window.removeEventListener("popstate",r)}))}},t.prototype.go=function(e){window.history.go(e)},t.prototype.push=function(e,t,i){var n=this,r=this.current;this.transitionTo(e,(function(e){xe(S(n.base+e.fullPath)),ue(n.router,e,r,!1),t&&t(e)}),i)},t.prototype.replace=function(e,t,i){var n=this,r=this.current;this.transitionTo(e,(function(e){be(S(n.base+e.fullPath)),ue(n.router,e,r,!1),t&&t(e)}),i)},t.prototype.ensureURL=function(e){if($e(this.base)!==this.current.fullPath){var t=S(this.base+this.current.fullPath);e?xe(t):be(t)}},t.prototype.getCurrentLocation=function(){return $e(this.base)},t}(Le);function $e(e){var t=window.location.pathname;return e&&0===t.toLowerCase().indexOf(e.toLowerCase())&&(t=t.slice(e.length)),(t||"/")+window.location.search+window.location.hash}var je=function(e){function t(t,i,n){e.call(this,t,i),n&&function(e){var t=$e(e);if(!/^\/#/.test(t))return window.location.replace(S(e+"/#"+t)),!0}(this.base)||Ne()}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.setupListeners=function(){var e=this;if(!(this.listeners.length>0)){var t=this.router.options.scrollBehavior,i=ye&&t;i&&this.listeners.push(ce());var n=function(){var t=e.current;Ne()&&e.transitionTo(Ue(),(function(n){i&&ue(e.router,n,t,!0),ye||qe(n.fullPath)}))},r=ye?"popstate":"hashchange";window.addEventListener(r,n),this.listeners.push((function(){window.removeEventListener(r,n)}))}},t.prototype.push=function(e,t,i){var n=this,r=this.current;this.transitionTo(e,(function(e){Ge(e.fullPath),ue(n.router,e,r,!1),t&&t(e)}),i)},t.prototype.replace=function(e,t,i){var n=this,r=this.current;this.transitionTo(e,(function(e){qe(e.fullPath),ue(n.router,e,r,!1),t&&t(e)}),i)},t.prototype.go=function(e){window.history.go(e)},t.prototype.ensureURL=function(e){var t=this.current.fullPath;Ue()!==t&&(e?Ge(t):qe(t))},t.prototype.getCurrentLocation=function(){return Ue()},t}(Le);function Ne(){var e=Ue();return"/"===e.charAt(0)||(qe("/"+e),!1)}function Ue(){var e=window.location.href,t=e.indexOf("#");return t<0?"":e=e.slice(t+1)}function Ve(e){var t=window.location.href,i=t.indexOf("#");return(i>=0?t.slice(0,i):t)+"#"+e}function Ge(e){ye?xe(Ve(e)):window.location.hash=e}function qe(e){ye?be(Ve(e)):window.location.replace(Ve(e))}var We=function(e){function t(t,i){e.call(this,t,i),this.stack=[],this.index=-1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.push=function(e,t,i){var n=this;this.transitionTo(e,(function(e){n.stack=n.stack.slice(0,n.index+1).concat(e),n.index++,t&&t(e)}),i)},t.prototype.replace=function(e,t,i){var n=this;this.transitionTo(e,(function(e){n.stack=n.stack.slice(0,n.index).concat(e),t&&t(e)}),i)},t.prototype.go=function(e){var t=this,i=this.index+e;if(!(i<0||i>=this.stack.length)){var n=this.stack[i];this.confirmTransition(n,(function(){var e=t.current;t.index=i,t.updateRoute(n),t.router.afterHooks.forEach((function(t){t&&t(n,e)}))}),(function(e){Me(e,Te.duplicated)&&(t.index=i)}))}},t.prototype.getCurrentLocation=function(){var e=this.stack[this.stack.length-1];return e?e.fullPath:"/"},t.prototype.ensureURL=function(){},t}(Le),Ze=function(t){void 0===t&&(t={}),this.app=null,this.apps=[],this.options=t,this.beforeHooks=[],this.resolveHooks=[],this.afterHooks=[],this.matcher=te(t.routes||[],this);var n=t.mode||"hash";switch(this.fallback="history"===n&&!ye&&!1!==t.fallback,this.fallback&&(n="hash"),K||(n="abstract"),this.mode=n,n){case"history":this.history=new Fe(this,t.base);break;case"hash":this.history=new je(this,t.base,this.fallback);break;case"abstract":this.history=new We(this,t.base);break;default:"production"!==e.env.NODE_ENV&&i(!1,"invalid mode: "+n)}},He={currentRoute:{configurable:!0}};function Xe(e,t){return e.push(t),function(){var i=e.indexOf(t);i>-1&&e.splice(i,1)}}Ze.prototype.match=function(e,t,i){return this.matcher.match(e,t,i)},He.currentRoute.get=function(){return this.history&&this.history.current},Ze.prototype.init=function(t){var n=this;if("production"!==e.env.NODE_ENV&&i(Y.installed,"not installed. Make sure to call `Vue.use(VueRouter)` before creating root instance."),this.apps.push(t),t.$once("hook:destroyed",(function(){var e=n.apps.indexOf(t);e>-1&&n.apps.splice(e,1),n.app===t&&(n.app=n.apps[0]||null),n.app||n.history.teardown()})),!this.app){this.app=t;var r=this.history;if(r instanceof Fe||r instanceof je){var o=function(e){r.setupListeners(),function(e){var t=r.current,i=n.options.scrollBehavior;ye&&i&&"fullPath"in e&&ue(n,e,t,!1)}(e)};r.transitionTo(r.getCurrentLocation(),o,o)}r.listen((function(e){n.apps.forEach((function(t){t._route=e}))}))}},Ze.prototype.beforeEach=function(e){return Xe(this.beforeHooks,e)},Ze.prototype.beforeResolve=function(e){return Xe(this.resolveHooks,e)},Ze.prototype.afterEach=function(e){return Xe(this.afterHooks,e)},Ze.prototype.onReady=function(e,t){this.history.onReady(e,t)},Ze.prototype.onError=function(e){this.history.onError(e)},Ze.prototype.push=function(e,t,i){var n=this;if(!t&&!i&&"undefined"!=typeof Promise)return new Promise((function(t,i){n.history.push(e,t,i)}));this.history.push(e,t,i)},Ze.prototype.replace=function(e,t,i){var n=this;if(!t&&!i&&"undefined"!=typeof Promise)return new Promise((function(t,i){n.history.replace(e,t,i)}));this.history.replace(e,t,i)},Ze.prototype.go=function(e){this.history.go(e)},Ze.prototype.back=function(){this.go(-1)},Ze.prototype.forward=function(){this.go(1)},Ze.prototype.getMatchedComponents=function(e){var t=e?e.matched?e:this.resolve(e).route:this.currentRoute;return t?[].concat.apply([],t.matched.map((function(e){return Object.keys(e.components).map((function(t){return e.components[t]}))}))):[]},Ze.prototype.resolve=function(e,t,i){var n=G(e,t=t||this.history.current,i,this),r=this.match(n,t),o=r.redirectedFrom||r.fullPath,a=function(e,t,i){var n="hash"===i?"#"+t:t;return e?S(e+"/"+n):n}(this.history.base,o,this.mode);return{location:n,route:r,href:a,normalizedTo:n,resolved:r}},Ze.prototype.addRoutes=function(e){this.matcher.addRoutes(e),this.history.current!==g&&this.history.transitionTo(this.history.getCurrentLocation())},Object.defineProperties(Ze.prototype,He),Ze.install=Y,Ze.version="3.4.9",Ze.isNavigationFailure=Me,Ze.NavigationFailureType=Te,K&&window.Vue&&window.Vue.use(Ze),t.exports=Ze}).call(this)}).call(this,e("_process"))},{_process:7}],15:[function(e,t,i){ /*! * vue-social-sharing v2.4.6 * (c) 2019 nicolasbeauvais * Released under the MIT License. */ "use strict";var n,r=(n=e("vue"))&&"object"==typeof n&&"default"in n?n.default:n,o={functional:!0,props:{network:{type:String,default:""}},render:function(e,t){var i=t.parent._data.baseNetworks[t.props.network];if(i)return e(t.parent.networkTag,{staticClass:t.data.staticClass||null,staticStyle:t.data.staticStyle||null,class:t.data.class||null,style:t.data.style||null,attrs:{id:t.data.attrs.id||null,tabindex:t.data.attrs.tabindex||0,"data-link":"popup"===i.type?"#share-"+t.props.network:t.parent.createSharingUrl(t.props.network),"data-action":"popup"===i.type?null:i.action},on:{click:"popup"===i.type?function(){t.parent.share(t.props.network)}:function(){t.parent.touch(t.props.network)}}},t.children)}},a={email:{sharer:"mailto:?subject=@title&body=@url%0D%0A%0D%0A@description",type:"direct"},facebook:{sharer:"https://www.facebook.com/sharer/sharer.php?u=@url&title=@title&description=@description"e=@quote&hashtag=@hashtags",type:"popup"},googleplus:{sharer:"https://plus.google.com/share?url=@url",type:"popup"},line:{sharer:"http://line.me/R/msg/text/?@description%0D%0A@url",type:"popup"},linkedin:{sharer:"https://www.linkedin.com/shareArticle?mini=true&url=@url&title=@title&summary=@description",type:"popup"},odnoklassniki:{sharer:"https://connect.ok.ru/dk?st.cmd=WidgetSharePreview&st.shareUrl=@url&st.comments=@description",type:"popup"},pinterest:{sharer:"https://pinterest.com/pin/create/button/?url=@url&media=@media&description=@title",type:"popup"},reddit:{sharer:"https://www.reddit.com/submit?url=@url&title=@title",type:"popup"},skype:{sharer:"https://web.skype.com/share?url=@description%0D%0A@url",type:"popup"},telegram:{sharer:"https://t.me/share/url?url=@url&text=@description",type:"popup"},twitter:{sharer:"https://twitter.com/intent/tweet?text=@title&url=@url&hashtags=@hashtags@twitteruser",type:"popup"},viber:{sharer:"viber://forward?text=@url @description",type:"direct"},vk:{sharer:"https://vk.com/share.php?url=@url&title=@title&description=@description&image=@media&noparse=true",type:"popup"},weibo:{sharer:"http://service.weibo.com/share/share.php?url=@url&title=@title",type:"popup"},whatsapp:{sharer:"https://api.whatsapp.com/send?text=@description%0D%0A@url",type:"popup",action:"share/whatsapp/share"},sms:{sharer:"sms:?body=@url%20@description",type:"direct"},sms_ios:{sharer:"sms:;body=@url%20@description",type:"direct"}},s="undefined"!=typeof window,l=s?window:null,c={props:{url:{type:String,default:s?window.location.href:""},title:{type:String,default:""},description:{type:String,default:""},quote:{type:String,default:""},hashtags:{type:String,default:""},twitterUser:{type:String,default:""},withCounts:{type:[String,Boolean],default:!1},googleKey:{type:String,default:void 0},media:{type:String,default:""},networkTag:{type:String,default:"span"},networks:{type:Object,default:function(){return{}}}},data:function(){return{baseNetworks:a,popup:{status:!1,resizable:!0,toolbar:!1,menubar:!1,scrollbars:!1,location:!1,directories:!1,width:626,height:436,top:0,left:0,window:void 0,interval:null}}},methods:{createSharingUrl:function(e){var t=navigator.userAgent.toLowerCase();"sms"===e&&(t.indexOf("iphone")>-1||t.indexOf("ipad")>-1)&&(e+="_ios");var i=this.baseNetworks[e].sharer;return"twitter"===e&&0===this.hashtags.length&&(i=i.replace("&hashtags=@hashtags","")),i.replace(/@url/g,encodeURIComponent(this.url)).replace(/@title/g,encodeURIComponent(this.title)).replace(/@description/g,encodeURIComponent(this.description)).replace(/@quote/g,encodeURIComponent(this.quote)).replace(/@hashtags/g,this.generateHashtags(e,this.hashtags)).replace(/@media/g,this.media).replace(/@twitteruser/g,this.twitterUser?"&via="+this.twitterUser:"")},generateHashtags:function(e,t){return"facebook"===e&&t.length>0?"%23"+t.split(",")[0]:t},share:function(e){this.openSharer(e,this.createSharingUrl(e)),this.$root.$emit("social_shares_open",e,this.url),this.$emit("open",e,this.url)},touch:function(e){window.open(this.createSharingUrl(e),"_self"),this.$root.$emit("social_shares_open",e,this.url),this.$emit("open",e,this.url)},openSharer:function(e,t){var i=this,n=null;n&&this.popup.interval&&(clearInterval(this.popup.interval),n.close(),this.$root.$emit("social_shares_change",e,this.url),this.$emit("change",e,this.url)),(n=window.open(t,"sharer","status="+(this.popup.status?"yes":"no")+",height="+this.popup.height+",width="+this.popup.width+",resizable="+(this.popup.resizable?"yes":"no")+",left="+this.popup.left+",top="+this.popup.top+",screenX="+this.popup.left+",screenY="+this.popup.top+",toolbar="+(this.popup.toolbar?"yes":"no")+",menubar="+(this.popup.menubar?"yes":"no")+",scrollbars="+(this.popup.scrollbars?"yes":"no")+",location="+(this.popup.location?"yes":"no")+",directories="+(this.popup.directories?"yes":"no"))).focus(),this.popup.interval=setInterval((function(){n.closed&&(clearInterval(i.popup.interval),n=void 0,i.$root.$emit("social_shares_close",e,i.url),i.$emit("close",e,i.url))}),500)}},beforeMount:function(){this.baseNetworks=r.util.extend(this.baseNetworks,this.networks)},mounted:function(){if(s){var e=void 0!==l.screenLeft?l.screenLeft:screen.left,t=void 0!==l.screenTop?l.screenTop:screen.top,i=l.innerWidth?l.innerWidth:document.documentElement.clientWidth?document.documentElement.clientWidth:screen.width,n=l.innerHeight?l.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:screen.height;this.popup.left=i/2-this.popup.width/2+e,this.popup.top=n/2-this.popup.height/2+t}},components:{network:o},version:"2.4.6",install:function(e){e.component("social-sharing",c)}};"undefined"!=typeof window&&(window.SocialSharing=c),t.exports=c},{vue:18}],16:[function(e,t,i){(function(e,n){(function(){var r,o;r=this,o=function(){"use strict";var t=Object.freeze({});function i(e){return null==e}function r(e){return null!=e}function o(e){return!0===e}function a(e){return"string"==typeof e||"number"==typeof e||"symbol"==typeof e||"boolean"==typeof e}function s(e){return null!==e&&"object"==typeof e}var l=Object.prototype.toString;function c(e){return"[object Object]"===l.call(e)}function u(e){var t=parseFloat(String(e));return t>=0&&Math.floor(t)===t&&isFinite(e)}function h(e){return r(e)&&"function"==typeof e.then&&"function"==typeof e.catch}function d(e){return null==e?"":Array.isArray(e)||c(e)&&e.toString===l?JSON.stringify(e,null,2):String(e)}function p(e){var t=parseFloat(e);return isNaN(t)?e:t}function f(e,t){for(var i=Object.create(null),n=e.split(","),r=0;r-1)return e.splice(i,1)}}var v=Object.prototype.hasOwnProperty;function y(e,t){return v.call(e,t)}function x(e){var t=Object.create(null);return function(i){return t[i]||(t[i]=e(i))}}var b=/-(\w)/g,w=x((function(e){return e.replace(b,(function(e,t){return t?t.toUpperCase():""}))})),T=x((function(e){return e.charAt(0).toUpperCase()+e.slice(1)})),C=/\B([A-Z])/g,S=x((function(e){return e.replace(C,"-$1").toLowerCase()})),E=Function.prototype.bind?function(e,t){return e.bind(t)}:function(e,t){function i(i){var n=arguments.length;return n?n>1?e.apply(t,arguments):e.call(t,i):e.call(t)}return i._length=e.length,i};function k(e,t){t=t||0;for(var i=e.length-t,n=new Array(i);i--;)n[i]=e[i+t];return n}function A(e,t){for(var i in t)e[i]=t[i];return e}function M(e){for(var t={},i=0;i0,K=H&&H.indexOf("edge/")>0,J=(H&&H.indexOf("android"),H&&/iphone|ipad|ipod|ios/.test(H)||"ios"===Z),Q=(H&&/chrome\/\d+/.test(H),H&&/phantomjs/.test(H),H&&H.match(/firefox\/(\d+)/)),ee={}.watch,te=!1;if(q)try{var ie={};Object.defineProperty(ie,"passive",{get:function(){te=!0}}),window.addEventListener("test-passive",null,ie)}catch(t){}var ne=function(){return void 0===U&&(U=!q&&!W&&void 0!==e&&e.process&&"server"===e.process.env.VUE_ENV),U},re=q&&window.__VUE_DEVTOOLS_GLOBAL_HOOK__;function oe(e){return"function"==typeof e&&/native code/.test(e.toString())}var ae,se="undefined"!=typeof Symbol&&oe(Symbol)&&"undefined"!=typeof Reflect&&oe(Reflect.ownKeys);ae="undefined"!=typeof Set&&oe(Set)?Set:function(){function e(){this.set=Object.create(null)}return e.prototype.has=function(e){return!0===this.set[e]},e.prototype.add=function(e){this.set[e]=!0},e.prototype.clear=function(){this.set=Object.create(null)},e}();var le=I,ce=0,ue=function(){this.id=ce++,this.subs=[]};ue.prototype.addSub=function(e){this.subs.push(e)},ue.prototype.removeSub=function(e){_(this.subs,e)},ue.prototype.depend=function(){ue.target&&ue.target.addDep(this)},ue.prototype.notify=function(){for(var e=this.subs.slice(),t=0,i=e.length;t-1)if(o&&!y(r,"default"))a=!1;else if(""===a||a===S(e)){var l=je(String,r.type);(l<0||s0&&(ct((l=e(l,(n||"")+"_"+s))[0])&&ct(u)&&(h[c]=_e(u.text+l[0].text),l.shift()),h.push.apply(h,l)):a(l)?ct(u)?h[c]=_e(u.text+l):""!==l&&h.push(_e(l)):ct(l)&&ct(u)?h[c]=_e(u.text+l.text):(o(t._isVList)&&r(l.tag)&&i(l.key)&&r(n)&&(l.key="__vlist"+n+"_"+s+"__"),h.push(l)));return h}(e):void 0}function ct(e){return r(e)&&r(e.text)&&!1===e.isComment}function ut(e,t){if(e){for(var i=Object.create(null),n=se?Reflect.ownKeys(e):Object.keys(e),r=0;r0,a=e?!!e.$stable:!o,s=e&&e.$key;if(e){if(e._normalized)return e._normalized;if(a&&n&&n!==t&&s===n.$key&&!o&&!n.$hasNormal)return n;for(var l in r={},e)e[l]&&"$"!==l[0]&&(r[l]=ft(i,l,e[l]))}else r={};for(var c in i)c in r||(r[c]=mt(i,c));return e&&Object.isExtensible(e)&&(e._normalized=r),N(r,"$stable",a),N(r,"$key",s),N(r,"$hasNormal",o),r}function ft(e,t,i){var n=function(){var e=arguments.length?i.apply(null,arguments):i({});return(e=e&&"object"==typeof e&&!Array.isArray(e)?[e]:lt(e))&&(0===e.length||1===e.length&&e[0].isComment)?void 0:e};return i.proxy&&Object.defineProperty(e,t,{get:n,enumerable:!0,configurable:!0}),n}function mt(e,t){return function(){return e[t]}}function gt(e,t){var i,n,o,a,l;if(Array.isArray(e)||"string"==typeof e)for(i=new Array(e.length),n=0,o=e.length;ndocument.createEvent("Event").timeStamp&&(ai=function(){return si.now()})}function li(){var e,t;for(oi=ai(),ni=!0,Qt.sort((function(e,t){return e.id-t.id})),ri=0;riri&&Qt[i].id>e.id;)i--;Qt.splice(i+1,0,e)}else Qt.push(e);ii||(ii=!0,et(li))}}(this)},ui.prototype.run=function(){if(this.active){var e=this.get();if(e!==this.value||s(e)||this.deep){var t=this.value;if(this.value=e,this.user)try{this.cb.call(this.vm,e,t)}catch(e){Ne(e,this.vm,'callback for watcher "'+this.expression+'"')}else this.cb.call(this.vm,e,t)}}},ui.prototype.evaluate=function(){this.value=this.get(),this.dirty=!1},ui.prototype.depend=function(){for(var e=this.deps.length;e--;)this.deps[e].depend()},ui.prototype.teardown=function(){if(this.active){this.vm._isBeingDestroyed||_(this.vm._watchers,this);for(var e=this.deps.length;e--;)this.deps[e].removeSub(this);this.active=!1}};var hi={enumerable:!0,configurable:!0,get:I,set:I};function di(e,t,i){hi.get=function(){return this[t][i]},hi.set=function(e){this[t][i]=e},Object.defineProperty(e,i,hi)}var pi={lazy:!0};function fi(e,t,i){var n=!ne();"function"==typeof i?(hi.get=n?mi(t):gi(i),hi.set=I):(hi.get=i.get?n&&!1!==i.cache?mi(t):gi(i.get):I,hi.set=i.set||I),Object.defineProperty(e,t,hi)}function mi(e){return function(){var t=this._computedWatchers&&this._computedWatchers[e];if(t)return t.dirty&&t.evaluate(),ue.target&&t.depend(),t.value}}function gi(e){return function(){return e.call(this,this)}}function _i(e,t,i,n){return c(i)&&(n=i,i=i.handler),"string"==typeof i&&(i=e[i]),e.$watch(t,i,n)}var vi=0;function yi(e){var t=e.options;if(e.super){var i=yi(e.super);if(i!==e.superOptions){e.superOptions=i;var n=function(e){var t,i=e.options,n=e.sealedOptions;for(var r in i)i[r]!==n[r]&&(t||(t={}),t[r]=i[r]);return t}(e);n&&A(e.extendOptions,n),(t=e.options=Le(i,e.extendOptions)).name&&(t.components[t.name]=e)}}return t}function xi(e){this._init(e)}function bi(e){return e&&(e.Ctor.options.name||e.tag)}function wi(e,t){return Array.isArray(e)?e.indexOf(t)>-1:"string"==typeof e?e.split(",").indexOf(t)>-1:(i=e,"[object RegExp]"===l.call(i)&&e.test(t));var i}function Ti(e,t){var i=e.cache,n=e.keys,r=e._vnode;for(var o in i){var a=i[o];if(a){var s=bi(a.componentOptions);s&&!t(s)&&Ci(i,o,n,r)}}}function Ci(e,t,i,n){var r=e[t];!r||n&&r.tag===n.tag||r.componentInstance.$destroy(),e[t]=null,_(i,t)}!function(e){e.prototype._init=function(e){var i=this;i._uid=vi++,i._isVue=!0,e&&e._isComponent?function(e,t){var i=e.$options=Object.create(e.constructor.options),n=t._parentVnode;i.parent=t.parent,i._parentVnode=n;var r=n.componentOptions;i.propsData=r.propsData,i._parentListeners=r.listeners,i._renderChildren=r.children,i._componentTag=r.tag,t.render&&(i.render=t.render,i.staticRenderFns=t.staticRenderFns)}(i,e):i.$options=Le(yi(i.constructor),e||{},i),i._renderProxy=i,i._self=i,function(e){var t=e.$options,i=t.parent;if(i&&!t.abstract){for(;i.$options.abstract&&i.$parent;)i=i.$parent;i.$children.push(e)}e.$parent=i,e.$root=i?i.$root:e,e.$children=[],e.$refs={},e._watcher=null,e._inactive=null,e._directInactive=!1,e._isMounted=!1,e._isDestroyed=!1,e._isBeingDestroyed=!1}(i),function(e){e._events=Object.create(null),e._hasHookEvent=!1;var t=e.$options._parentListeners;t&&Zt(e,t)}(i),function(e){e._vnode=null,e._staticTrees=null;var i=e.$options,n=e.$vnode=i._parentVnode,r=n&&n.context;e.$slots=ht(i._renderChildren,r),e.$scopedSlots=t,e._c=function(t,i,n,r){return Ft(e,t,i,n,r,!1)},e.$createElement=function(t,i,n,r){return Ft(e,t,i,n,r,!0)};var o=n&&n.data;Ee(e,"$attrs",o&&o.attrs||t,null,!0),Ee(e,"$listeners",i._parentListeners||t,null,!0)}(i),Jt(i,"beforeCreate"),function(e){var t=ut(e.$options.inject,e);t&&(Te(!1),Object.keys(t).forEach((function(i){Ee(e,i,t[i])})),Te(!0))}(i),function(e){e._watchers=[];var t=e.$options;t.props&&function(e,t){var i=e.$options.propsData||{},n=e._props={},r=e.$options._propKeys=[];e.$parent&&Te(!1);var o=function(o){r.push(o);var a=Be(o,t,i,e);Ee(n,o,a),o in e||di(e,"_props",o)};for(var a in t)o(a);Te(!0)}(e,t.props),t.methods&&function(e,t){for(var i in e.$options.props,t)e[i]="function"!=typeof t[i]?I:E(t[i],e)}(e,t.methods),t.data?function(e){var t=e.$options.data;c(t=e._data="function"==typeof t?function(e,t){de();try{return e.call(t,t)}catch(e){return Ne(e,t,"data()"),{}}finally{pe()}}(t,e):t||{})||(t={});for(var i,n=Object.keys(t),r=e.$options.props,o=(e.$options.methods,n.length);o--;){var a=n[o];r&&y(r,a)||36!==(i=(a+"").charCodeAt(0))&&95!==i&&di(e,"_data",a)}Se(t,!0)}(e):Se(e._data={},!0),t.computed&&function(e,t){var i=e._computedWatchers=Object.create(null),n=ne();for(var r in t){var o=t[r],a="function"==typeof o?o:o.get;n||(i[r]=new ui(e,a||I,I,pi)),r in e||fi(e,r,o)}}(e,t.computed),t.watch&&t.watch!==ee&&function(e,t){for(var i in t){var n=t[i];if(Array.isArray(n))for(var r=0;r1?k(t):t;for(var i=k(arguments,1),n='event handler for "'+e+'"',r=0,o=t.length;rparseInt(this.max)&&Ci(a,s[0],s,this._vnode)),t.data.keepAlive=!0}return t||e&&e[0]}}};!function(e){var t={get:function(){return $}};Object.defineProperty(e,"config",t),e.util={warn:le,extend:A,mergeOptions:Le,defineReactive:Ee},e.set=ke,e.delete=Ae,e.nextTick=et,e.observable=function(e){return Se(e),e},e.options=Object.create(null),B.forEach((function(t){e.options[t+"s"]=Object.create(null)})),e.options._base=e,A(e.options.components,Ei),function(e){e.use=function(e){var t=this._installedPlugins||(this._installedPlugins=[]);if(t.indexOf(e)>-1)return this;var i=k(arguments,1);return i.unshift(this),"function"==typeof e.install?e.install.apply(e,i):"function"==typeof e&&e.apply(null,i),t.push(e),this}}(e),function(e){e.mixin=function(e){return this.options=Le(this.options,e),this}}(e),function(e){e.cid=0;var t=1;e.extend=function(e){e=e||{};var i=this,n=i.cid,r=e._Ctor||(e._Ctor={});if(r[n])return r[n];var o=e.name||i.options.name,a=function(e){this._init(e)};return(a.prototype=Object.create(i.prototype)).constructor=a,a.cid=t++,a.options=Le(i.options,e),a.super=i,a.options.props&&function(e){var t=e.options.props;for(var i in t)di(e.prototype,"_props",i)}(a),a.options.computed&&function(e){var t=e.options.computed;for(var i in t)fi(e.prototype,i,t[i])}(a),a.extend=i.extend,a.mixin=i.mixin,a.use=i.use,B.forEach((function(e){a[e]=i[e]})),o&&(a.options.components[o]=a),a.superOptions=i.options,a.extendOptions=e,a.sealedOptions=A({},a.options),r[n]=a,a}}(e),function(e){B.forEach((function(t){e[t]=function(e,i){return i?("component"===t&&c(i)&&(i.name=i.name||e,i=this.options._base.extend(i)),"directive"===t&&"function"==typeof i&&(i={bind:i,update:i}),this.options[t+"s"][e]=i,i):this.options[t+"s"][e]}}))}(e)}(xi),Object.defineProperty(xi.prototype,"$isServer",{get:ne}),Object.defineProperty(xi.prototype,"$ssrContext",{get:function(){return this.$vnode&&this.$vnode.ssrContext}}),Object.defineProperty(xi,"FunctionalRenderContext",{value:Pt}),xi.version="2.6.12";var ki=f("style,class"),Ai=f("input,textarea,option,select,progress"),Mi=function(e,t,i){return"value"===i&&Ai(e)&&"button"!==t||"selected"===i&&"option"===e||"checked"===i&&"input"===e||"muted"===i&&"video"===e},Ii=f("contenteditable,draggable,spellcheck"),Pi=f("events,caret,typing,plaintext-only"),Di=f("allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,default,defaultchecked,defaultmuted,defaultselected,defer,disabled,enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,required,reversed,scoped,seamless,selected,sortable,translate,truespeed,typemustmatch,visible"),zi="http://www.w3.org/1999/xlink",Oi=function(e){return":"===e.charAt(5)&&"xlink"===e.slice(0,5)},Li=function(e){return Oi(e)?e.slice(6,e.length):""},Ri=function(e){return null==e||!1===e};function Bi(e,t){return{staticClass:Fi(e.staticClass,t.staticClass),class:r(e.class)?[e.class,t.class]:t.class}}function Fi(e,t){return e?t?e+" "+t:e:t||""}function $i(e){return Array.isArray(e)?function(e){for(var t,i="",n=0,o=e.length;n-1?hn(e,t,i):Di(t)?Ri(i)?e.removeAttribute(t):(i="allowfullscreen"===t&&"EMBED"===e.tagName?"true":t,e.setAttribute(t,i)):Ii(t)?e.setAttribute(t,function(e,t){return Ri(t)||"false"===t?"false":"contenteditable"===e&&Pi(t)?t:"true"}(t,i)):Oi(t)?Ri(i)?e.removeAttributeNS(zi,Li(t)):e.setAttributeNS(zi,t,i):hn(e,t,i)}function hn(e,t,i){if(Ri(i))e.removeAttribute(t);else{if(X&&!Y&&"TEXTAREA"===e.tagName&&"placeholder"===t&&""!==i&&!e.__ieph){var n=function(t){t.stopImmediatePropagation(),e.removeEventListener("input",n)};e.addEventListener("input",n),e.__ieph=!0}e.setAttribute(t,i)}}var dn={create:cn,update:cn};function pn(e,t){var n=t.elm,o=t.data,a=e.data;if(!(i(o.staticClass)&&i(o.class)&&(i(a)||i(a.staticClass)&&i(a.class)))){var s=function(e){for(var t=e.data,i=e,n=e;r(n.componentInstance);)(n=n.componentInstance._vnode)&&n.data&&(t=Bi(n.data,t));for(;r(i=i.parent);)i&&i.data&&(t=Bi(t,i.data));return function(e,t){return r(e)||r(t)?Fi(e,$i(t)):""}(t.staticClass,t.class)}(t),l=n._transitionClasses;r(l)&&(s=Fi(s,$i(l))),s!==n._prevClass&&(n.setAttribute("class",s),n._prevClass=s)}}var fn,mn,gn,_n,vn,yn,xn={create:pn,update:pn},bn=/[\w).+\-_$\]]/;function wn(e){var t,i,n,r,o,a=!1,s=!1,l=!1,c=!1,u=0,h=0,d=0,p=0;for(n=0;n=0&&" "===(m=e.charAt(f));f--);m&&bn.test(m)||(c=!0)}}else void 0===r?(p=n+1,r=e.slice(0,n).trim()):g();function g(){(o||(o=[])).push(e.slice(p,n).trim()),p=n+1}if(void 0===r?r=e.slice(0,n).trim():0!==p&&g(),o)for(n=0;n-1?{exp:e.slice(0,_n),key:'"'+e.slice(_n+1)+'"'}:{exp:e,key:null};for(mn=e,_n=vn=yn=0;!$n();)jn(gn=Fn())?Un(gn):91===gn&&Nn(gn);return{exp:e.slice(0,vn),key:e.slice(vn+1,yn)}}(e);return null===i.key?e+"="+t:"$set("+i.exp+", "+i.key+", "+t+")"}function Fn(){return mn.charCodeAt(++_n)}function $n(){return _n>=fn}function jn(e){return 34===e||39===e}function Nn(e){var t=1;for(vn=_n;!$n();)if(jn(e=Fn()))Un(e);else if(91===e&&t++,93===e&&t--,0===t){yn=_n;break}}function Un(e){for(var t=e;!$n()&&(e=Fn())!==t;);}var Vn,Gn="__r";function qn(e,t,i){var n=Vn;return function r(){null!==t.apply(null,arguments)&&Hn(e,r,i,n)}}var Wn=We&&!(Q&&Number(Q[1])<=53);function Zn(e,t,i,n){if(Wn){var r=oi,o=t;t=o._wrapper=function(e){if(e.target===e.currentTarget||e.timeStamp>=r||e.timeStamp<=0||e.target.ownerDocument!==document)return o.apply(this,arguments)}}Vn.addEventListener(e,t,te?{capture:i,passive:n}:i)}function Hn(e,t,i,n){(n||Vn).removeEventListener(e,t._wrapper||t,i)}function Xn(e,t){if(!i(e.data.on)||!i(t.data.on)){var n=t.data.on||{},o=e.data.on||{};Vn=t.elm,function(e){if(r(e.__r)){var t=X?"change":"input";e[t]=[].concat(e.__r,e[t]||[]),delete e.__r}r(e.__c)&&(e.change=[].concat(e.__c,e.change||[]),delete e.__c)}(n),ot(n,o,Zn,Hn,qn,t.context),Vn=void 0}}var Yn,Kn={create:Xn,update:Xn};function Jn(e,t){if(!i(e.data.domProps)||!i(t.data.domProps)){var n,o,a=t.elm,s=e.data.domProps||{},l=t.data.domProps||{};for(n in r(l.__ob__)&&(l=t.data.domProps=A({},l)),s)n in l||(a[n]="");for(n in l){if(o=l[n],"textContent"===n||"innerHTML"===n){if(t.children&&(t.children.length=0),o===s[n])continue;1===a.childNodes.length&&a.removeChild(a.childNodes[0])}if("value"===n&&"PROGRESS"!==a.tagName){a._value=o;var c=i(o)?"":String(o);Qn(a,c)&&(a.value=c)}else if("innerHTML"===n&&Ui(a.tagName)&&i(a.innerHTML)){(Yn=Yn||document.createElement("div")).innerHTML=""+o+"";for(var u=Yn.firstChild;a.firstChild;)a.removeChild(a.firstChild);for(;u.firstChild;)a.appendChild(u.firstChild)}else if(o!==s[n])try{a[n]=o}catch(e){}}}}function Qn(e,t){return!e.composing&&("OPTION"===e.tagName||function(e,t){var i=!0;try{i=document.activeElement!==e}catch(e){}return i&&e.value!==t}(e,t)||function(e,t){var i=e.value,n=e._vModifiers;if(r(n)){if(n.number)return p(i)!==p(t);if(n.trim)return i.trim()!==t.trim()}return i!==t}(e,t))}var er={create:Jn,update:Jn},tr=x((function(e){var t={},i=/:(.+)/;return e.split(/;(?![^(]*\))/g).forEach((function(e){if(e){var n=e.split(i);n.length>1&&(t[n[0].trim()]=n[1].trim())}})),t}));function ir(e){var t=nr(e.style);return e.staticStyle?A(e.staticStyle,t):t}function nr(e){return Array.isArray(e)?M(e):"string"==typeof e?tr(e):e}var rr,or=/^--/,ar=/\s*!important$/,sr=function(e,t,i){if(or.test(t))e.style.setProperty(t,i);else if(ar.test(i))e.style.setProperty(S(t),i.replace(ar,""),"important");else{var n=cr(t);if(Array.isArray(i))for(var r=0,o=i.length;r-1?t.split(dr).forEach((function(t){return e.classList.add(t)})):e.classList.add(t);else{var i=" "+(e.getAttribute("class")||"")+" ";i.indexOf(" "+t+" ")<0&&e.setAttribute("class",(i+t).trim())}}function fr(e,t){if(t&&(t=t.trim()))if(e.classList)t.indexOf(" ")>-1?t.split(dr).forEach((function(t){return e.classList.remove(t)})):e.classList.remove(t),e.classList.length||e.removeAttribute("class");else{for(var i=" "+(e.getAttribute("class")||"")+" ",n=" "+t+" ";i.indexOf(n)>=0;)i=i.replace(n," ");(i=i.trim())?e.setAttribute("class",i):e.removeAttribute("class")}}function mr(e){if(e){if("object"==typeof e){var t={};return!1!==e.css&&A(t,gr(e.name||"v")),A(t,e),t}return"string"==typeof e?gr(e):void 0}}var gr=x((function(e){return{enterClass:e+"-enter",enterToClass:e+"-enter-to",enterActiveClass:e+"-enter-active",leaveClass:e+"-leave",leaveToClass:e+"-leave-to",leaveActiveClass:e+"-leave-active"}})),_r=q&&!Y,vr="transition",yr="animation",xr="transition",br="transitionend",wr="animation",Tr="animationend";_r&&(void 0===window.ontransitionend&&void 0!==window.onwebkittransitionend&&(xr="WebkitTransition",br="webkitTransitionEnd"),void 0===window.onanimationend&&void 0!==window.onwebkitanimationend&&(wr="WebkitAnimation",Tr="webkitAnimationEnd"));var Cr=q?window.requestAnimationFrame?window.requestAnimationFrame.bind(window):setTimeout:function(e){return e()};function Sr(e){Cr((function(){Cr(e)}))}function Er(e,t){var i=e._transitionClasses||(e._transitionClasses=[]);i.indexOf(t)<0&&(i.push(t),pr(e,t))}function kr(e,t){e._transitionClasses&&_(e._transitionClasses,t),fr(e,t)}function Ar(e,t,i){var n=Ir(e,t),r=n.type,o=n.timeout,a=n.propCount;if(!r)return i();var s=r===vr?br:Tr,l=0,c=function(){e.removeEventListener(s,u),i()},u=function(t){t.target===e&&++l>=a&&c()};setTimeout((function(){l0&&(i=vr,u=a,h=o.length):t===yr?c>0&&(i=yr,u=c,h=l.length):h=(i=(u=Math.max(a,c))>0?a>c?vr:yr:null)?i===vr?o.length:l.length:0,{type:i,timeout:u,propCount:h,hasTransform:i===vr&&Mr.test(n[xr+"Property"])}}function Pr(e,t){for(;e.length1}function Br(e,t){!0!==t.data.show&&zr(t)}var Fr=function(e){var t,n,s={},l=e.modules,c=e.nodeOps;for(t=0;tf?y(e,i(n[_+1])?null:n[_+1].elm,n,p,_,o):p>_&&b(t,d,f)}(d,m,_,n,u):r(_)?(r(e.text)&&c.setTextContent(d,""),y(d,null,_,0,_.length-1,n)):r(m)?b(m,0,m.length-1):r(e.text)&&c.setTextContent(d,""):e.text!==t.text&&c.setTextContent(d,t.text),r(f)&&r(p=f.hook)&&r(p=p.postpatch)&&p(e,t)}}}function S(e,t,i){if(o(i)&&r(e.parent))e.parent.data.pendingInsert=t;else for(var n=0;n-1,a.selected!==o&&(a.selected=o);else if(z(Vr(a),n))return void(e.selectedIndex!==s&&(e.selectedIndex=s));r||(e.selectedIndex=-1)}}function Ur(e,t){return t.every((function(t){return!z(t,e)}))}function Vr(e){return"_value"in e?e._value:e.value}function Gr(e){e.target.composing=!0}function qr(e){e.target.composing&&(e.target.composing=!1,Wr(e.target,"input"))}function Wr(e,t){var i=document.createEvent("HTMLEvents");i.initEvent(t,!0,!0),e.dispatchEvent(i)}function Zr(e){return!e.componentInstance||e.data&&e.data.transition?e:Zr(e.componentInstance._vnode)}var Hr={model:$r,show:{bind:function(e,t,i){var n=t.value,r=(i=Zr(i)).data&&i.data.transition,o=e.__vOriginalDisplay="none"===e.style.display?"":e.style.display;n&&r?(i.data.show=!0,zr(i,(function(){e.style.display=o}))):e.style.display=n?o:"none"},update:function(e,t,i){var n=t.value;!n!=!t.oldValue&&((i=Zr(i)).data&&i.data.transition?(i.data.show=!0,n?zr(i,(function(){e.style.display=e.__vOriginalDisplay})):Or(i,(function(){e.style.display="none"}))):e.style.display=n?e.__vOriginalDisplay:"none")},unbind:function(e,t,i,n,r){r||(e.style.display=e.__vOriginalDisplay)}}},Xr={name:String,appear:Boolean,css:Boolean,mode:String,type:String,enterClass:String,leaveClass:String,enterToClass:String,leaveToClass:String,enterActiveClass:String,leaveActiveClass:String,appearClass:String,appearActiveClass:String,appearToClass:String,duration:[Number,String,Object]};function Yr(e){var t=e&&e.componentOptions;return t&&t.Ctor.options.abstract?Yr(Vt(t.children)):e}function Kr(e){var t={},i=e.$options;for(var n in i.propsData)t[n]=e[n];var r=i._parentListeners;for(var o in r)t[w(o)]=r[o];return t}function Jr(e,t){if(/\d-keep-alive$/.test(t.tag))return e("keep-alive",{props:t.componentOptions.propsData})}var Qr=function(e){return e.tag||Ut(e)},eo=function(e){return"show"===e.name},to={name:"transition",props:Xr,abstract:!0,render:function(e){var t=this,i=this.$slots.default;if(i&&(i=i.filter(Qr)).length){var n=this.mode,r=i[0];if(function(e){for(;e=e.parent;)if(e.data.transition)return!0}(this.$vnode))return r;var o=Yr(r);if(!o)return r;if(this._leaving)return Jr(e,r);var s="__transition-"+this._uid+"-";o.key=null==o.key?o.isComment?s+"comment":s+o.tag:a(o.key)?0===String(o.key).indexOf(s)?o.key:s+o.key:o.key;var l=(o.data||(o.data={})).transition=Kr(this),c=this._vnode,u=Yr(c);if(o.data.directives&&o.data.directives.some(eo)&&(o.data.show=!0),u&&u.data&&!function(e,t){return t.key===e.key&&t.tag===e.tag}(o,u)&&!Ut(u)&&(!u.componentInstance||!u.componentInstance._vnode.isComment)){var h=u.data.transition=A({},l);if("out-in"===n)return this._leaving=!0,at(h,"afterLeave",(function(){t._leaving=!1,t.$forceUpdate()})),Jr(e,r);if("in-out"===n){if(Ut(o))return c;var d,p=function(){d()};at(l,"afterEnter",p),at(l,"enterCancelled",p),at(h,"delayLeave",(function(e){d=e}))}}return r}}},io=A({tag:String,moveClass:String},Xr);function no(e){e.elm._moveCb&&e.elm._moveCb(),e.elm._enterCb&&e.elm._enterCb()}function ro(e){e.data.newPos=e.elm.getBoundingClientRect()}function oo(e){var t=e.data.pos,i=e.data.newPos,n=t.left-i.left,r=t.top-i.top;if(n||r){e.data.moved=!0;var o=e.elm.style;o.transform=o.WebkitTransform="translate("+n+"px,"+r+"px)",o.transitionDuration="0s"}}delete io.mode;var ao={Transition:to,TransitionGroup:{props:io,beforeMount:function(){var e=this,t=this._update;this._update=function(i,n){var r=Xt(e);e.__patch__(e._vnode,e.kept,!1,!0),e._vnode=e.kept,r(),t.call(e,i,n)}},render:function(e){for(var t=this.tag||this.$vnode.data.tag||"span",i=Object.create(null),n=this.prevChildren=this.children,r=this.$slots.default||[],o=this.children=[],a=Kr(this),s=0;s-1?qi[e]=t.constructor===window.HTMLUnknownElement||t.constructor===window.HTMLElement:qi[e]=/HTMLUnknownElement/.test(t.toString())},A(xi.options.directives,Hr),A(xi.options.components,ao),xi.prototype.__patch__=q?Fr:I,xi.prototype.$mount=function(e,t){return function(e,t,i){var n;return e.$el=t,e.$options.render||(e.$options.render=ge),Jt(e,"beforeMount"),n=function(){e._update(e._render(),i)},new ui(e,n,I,{before:function(){e._isMounted&&!e._isDestroyed&&Jt(e,"beforeUpdate")}},!0),i=!1,null==e.$vnode&&(e._isMounted=!0,Jt(e,"mounted")),e}(this,e=e&&q?Zi(e):void 0,t)},q&&setTimeout((function(){$.devtools&&re&&re.emit("init",xi)}),0);var so,lo=/\{\{((?:.|\r?\n)+?)\}\}/g,co=/[-.*+?^${}()|[\]\/\\]/g,uo=x((function(e){var t=e[0].replace(co,"\\$&"),i=e[1].replace(co,"\\$&");return new RegExp(t+"((?:.|\\n)+?)"+i,"g")})),ho={staticKeys:["staticClass"],transformNode:function(e,t){t.warn;var i=zn(e,"class");i&&(e.staticClass=JSON.stringify(i));var n=Dn(e,"class",!1);n&&(e.classBinding=n)},genData:function(e){var t="";return e.staticClass&&(t+="staticClass:"+e.staticClass+","),e.classBinding&&(t+="class:"+e.classBinding+","),t}},po={staticKeys:["staticStyle"],transformNode:function(e,t){t.warn;var i=zn(e,"style");i&&(e.staticStyle=JSON.stringify(tr(i)));var n=Dn(e,"style",!1);n&&(e.styleBinding=n)},genData:function(e){var t="";return e.staticStyle&&(t+="staticStyle:"+e.staticStyle+","),e.styleBinding&&(t+="style:("+e.styleBinding+"),"),t}},fo=f("area,base,br,col,embed,frame,hr,img,input,isindex,keygen,link,meta,param,source,track,wbr"),mo=f("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source"),go=f("address,article,aside,base,blockquote,body,caption,col,colgroup,dd,details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,title,tr,track"),_o=/^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/,vo=/^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/,yo="[a-zA-Z_][\\-\\.0-9_a-zA-Z"+j.source+"]*",xo="((?:"+yo+"\\:)?"+yo+")",bo=new RegExp("^<"+xo),wo=/^\s*(\/?)>/,To=new RegExp("^<\\/"+xo+"[^>]*>"),Co=/^]+>/i,So=/^",""":'"',"&":"&"," ":"\n"," ":"\t","'":"'"},Io=/&(?:lt|gt|quot|amp|#39);/g,Po=/&(?:lt|gt|quot|amp|#39|#10|#9);/g,Do=f("pre,textarea",!0),zo=function(e,t){return e&&Do(e)&&"\n"===t[0]};function Oo(e,t){var i=t?Po:Io;return e.replace(i,(function(e){return Mo[e]}))}var Lo,Ro,Bo,Fo,$o,jo,No,Uo,Vo=/^@|^v-on:/,Go=/^v-|^@|^:|^#/,qo=/([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/,Wo=/,([^,\}\]]*)(?:,([^,\}\]]*))?$/,Zo=/^\(|\)$/g,Ho=/^\[.*\]$/,Xo=/:(.*)$/,Yo=/^:|^\.|^v-bind:/,Ko=/\.[^.\]]+(?=[^\]]*$)/g,Jo=/^v-slot(:|$)|^#/,Qo=/[\r\n]/,ea=/\s+/g,ta=x((function(e){return(so=so||document.createElement("div")).innerHTML=e,so.textContent})),ia="_empty_";function na(e,t,i){return{type:1,tag:e,attrsList:t,attrsMap:ca(t),rawAttrsMap:{},parent:i,children:[]}}function ra(e,t){var i,n;(n=Dn(i=e,"key"))&&(i.key=n),e.plain=!e.key&&!e.scopedSlots&&!e.attrsList.length,function(e){var t=Dn(e,"ref");t&&(e.ref=t,e.refInFor=function(e){for(var t=e;t;){if(void 0!==t.for)return!0;t=t.parent}return!1}(e))}(e),function(e){var t;"template"===e.tag?(t=zn(e,"scope"),e.slotScope=t||zn(e,"slot-scope")):(t=zn(e,"slot-scope"))&&(e.slotScope=t);var i=Dn(e,"slot");if(i&&(e.slotTarget='""'===i?'"default"':i,e.slotTargetDynamic=!(!e.attrsMap[":slot"]&&!e.attrsMap["v-bind:slot"]),"template"===e.tag||e.slotScope||kn(e,"slot",i,function(e,t){return e.rawAttrsMap[":"+t]||e.rawAttrsMap["v-bind:"+t]||e.rawAttrsMap[t]}(e,"slot"))),"template"===e.tag){var n=On(e,Jo);if(n){var r=sa(n),o=r.name,a=r.dynamic;e.slotTarget=o,e.slotTargetDynamic=a,e.slotScope=n.value||ia}}else{var s=On(e,Jo);if(s){var l=e.scopedSlots||(e.scopedSlots={}),c=sa(s),u=c.name,h=c.dynamic,d=l[u]=na("template",[],e);d.slotTarget=u,d.slotTargetDynamic=h,d.children=e.children.filter((function(e){if(!e.slotScope)return e.parent=d,!0})),d.slotScope=s.value||ia,e.children=[],e.plain=!1}}}(e),function(e){"slot"===e.tag&&(e.slotName=Dn(e,"name"))}(e),function(e){var t;(t=Dn(e,"is"))&&(e.component=t),null!=zn(e,"inline-template")&&(e.inlineTemplate=!0)}(e);for(var r=0;r-1"+("true"===o?":("+t+")":":_q("+t+","+o+")")),Pn(e,"change","var $$a="+t+",$$el=$event.target,$$c=$$el.checked?("+o+"):("+a+");if(Array.isArray($$a)){var $$v="+(n?"_n("+r+")":r)+",$$i=_i($$a,$$v);if($$el.checked){$$i<0&&("+Bn(t,"$$a.concat([$$v])")+")}else{$$i>-1&&("+Bn(t,"$$a.slice(0,$$i).concat($$a.slice($$i+1))")+")}}else{"+Bn(t,"$$c")+"}",null,!0)}(e,n,r);else if("input"===o&&"radio"===a)!function(e,t,i){var n=i&&i.number,r=Dn(e,"value")||"null";En(e,"checked","_q("+t+","+(r=n?"_n("+r+")":r)+")"),Pn(e,"change",Bn(t,r),null,!0)}(e,n,r);else if("input"===o||"textarea"===o)!function(e,t,i){var n=e.attrsMap.type,r=i||{},o=r.lazy,a=r.number,s=r.trim,l=!o&&"range"!==n,c=o?"change":"range"===n?Gn:"input",u="$event.target.value";s&&(u="$event.target.value.trim()"),a&&(u="_n("+u+")");var h=Bn(t,u);l&&(h="if($event.target.composing)return;"+h),En(e,"value","("+t+")"),Pn(e,c,h,null,!0),(s||a)&&Pn(e,"blur","$forceUpdate()")}(e,n,r);else if(!$.isReservedTag(o))return Rn(e,n,r),!1;return!0},text:function(e,t){t.value&&En(e,"textContent","_s("+t.value+")",t)},html:function(e,t){t.value&&En(e,"innerHTML","_s("+t.value+")",t)}},isPreTag:function(e){return"pre"===e},isUnaryTag:fo,mustUseProp:Mi,canBeLeftOpenTag:mo,isReservedTag:Vi,getTagNamespace:Gi,staticKeys:function(e){return e.reduce((function(e,t){return e.concat(t.staticKeys||[])}),[]).join(",")}(ma)},_a=x((function(e){return f("type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap"+(e?","+e:""))})),va=/^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/,ya=/\([^)]*?\);*$/,xa=/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/,ba={esc:27,tab:9,enter:13,space:32,up:38,left:37,right:39,down:40,delete:[8,46]},wa={esc:["Esc","Escape"],tab:"Tab",enter:"Enter",space:[" ","Spacebar"],up:["Up","ArrowUp"],left:["Left","ArrowLeft"],right:["Right","ArrowRight"],down:["Down","ArrowDown"],delete:["Backspace","Delete","Del"]},Ta=function(e){return"if("+e+")return null;"},Ca={stop:"$event.stopPropagation();",prevent:"$event.preventDefault();",self:Ta("$event.target !== $event.currentTarget"),ctrl:Ta("!$event.ctrlKey"),shift:Ta("!$event.shiftKey"),alt:Ta("!$event.altKey"),meta:Ta("!$event.metaKey"),left:Ta("'button' in $event && $event.button !== 0"),middle:Ta("'button' in $event && $event.button !== 1"),right:Ta("'button' in $event && $event.button !== 2")};function Sa(e,t){var i=t?"nativeOn:":"on:",n="",r="";for(var o in e){var a=Ea(e[o]);e[o]&&e[o].dynamic?r+=o+","+a+",":n+='"'+o+'":'+a+","}return n="{"+n.slice(0,-1)+"}",r?i+"_d("+n+",["+r.slice(0,-1)+"])":i+n}function Ea(e){if(!e)return"function(){}";if(Array.isArray(e))return"["+e.map((function(e){return Ea(e)})).join(",")+"]";var t=xa.test(e.value),i=va.test(e.value),n=xa.test(e.value.replace(ya,""));if(e.modifiers){var r="",o="",a=[];for(var s in e.modifiers)if(Ca[s])o+=Ca[s],ba[s]&&a.push(s);else if("exact"===s){var l=e.modifiers;o+=Ta(["ctrl","shift","alt","meta"].filter((function(e){return!l[e]})).map((function(e){return"$event."+e+"Key"})).join("||"))}else a.push(s);return a.length&&(r+=function(e){return"if(!$event.type.indexOf('key')&&"+e.map(ka).join("&&")+")return null;"}(a)),o&&(r+=o),"function($event){"+r+(t?"return "+e.value+"($event)":i?"return ("+e.value+")($event)":n?"return "+e.value:e.value)+"}"}return t||i?e.value:"function($event){"+(n?"return "+e.value:e.value)+"}"}function ka(e){var t=parseInt(e,10);if(t)return"$event.keyCode!=="+t;var i=ba[e],n=wa[e];return"_k($event.keyCode,"+JSON.stringify(e)+","+JSON.stringify(i)+",$event.key,"+JSON.stringify(n)+")"}var Aa={on:function(e,t){e.wrapListeners=function(e){return"_g("+e+","+t.value+")"}},bind:function(e,t){e.wrapData=function(i){return"_b("+i+",'"+e.tag+"',"+t.value+","+(t.modifiers&&t.modifiers.prop?"true":"false")+(t.modifiers&&t.modifiers.sync?",true":"")+")"}},cloak:I},Ma=function(e){this.options=e,this.warn=e.warn||Cn,this.transforms=Sn(e.modules,"transformCode"),this.dataGenFns=Sn(e.modules,"genData"),this.directives=A(A({},Aa),e.directives);var t=e.isReservedTag||P;this.maybeComponent=function(e){return!!e.component||!t(e.tag)},this.onceId=0,this.staticRenderFns=[],this.pre=!1};function Ia(e,t){var i=new Ma(t);return{render:"with(this){return "+(e?Pa(e,i):'_c("div")')+"}",staticRenderFns:i.staticRenderFns}}function Pa(e,t){if(e.parent&&(e.pre=e.pre||e.parent.pre),e.staticRoot&&!e.staticProcessed)return Da(e,t);if(e.once&&!e.onceProcessed)return za(e,t);if(e.for&&!e.forProcessed)return La(e,t);if(e.if&&!e.ifProcessed)return Oa(e,t);if("template"!==e.tag||e.slotTarget||t.pre){if("slot"===e.tag)return function(e,t){var i=e.slotName||'"default"',n=$a(e,t),r="_t("+i+(n?","+n:""),o=e.attrs||e.dynamicAttrs?Ua((e.attrs||[]).concat(e.dynamicAttrs||[]).map((function(e){return{name:w(e.name),value:e.value,dynamic:e.dynamic}}))):null,a=e.attrsMap["v-bind"];return!o&&!a||n||(r+=",null"),o&&(r+=","+o),a&&(r+=(o?"":",null")+","+a),r+")"}(e,t);var i;if(e.component)i=function(e,t,i){var n=t.inlineTemplate?null:$a(t,i,!0);return"_c("+e+","+Ra(t,i)+(n?","+n:"")+")"}(e.component,e,t);else{var n;(!e.plain||e.pre&&t.maybeComponent(e))&&(n=Ra(e,t));var r=e.inlineTemplate?null:$a(e,t,!0);i="_c('"+e.tag+"'"+(n?","+n:"")+(r?","+r:"")+")"}for(var o=0;o>>0}(a):"")+")"}(e,e.scopedSlots,t)+","),e.model&&(i+="model:{value:"+e.model.value+",callback:"+e.model.callback+",expression:"+e.model.expression+"},"),e.inlineTemplate){var o=function(e,t){var i=e.children[0];if(i&&1===i.type){var n=Ia(i,t.options);return"inlineTemplate:{render:function(){"+n.render+"},staticRenderFns:["+n.staticRenderFns.map((function(e){return"function(){"+e+"}"})).join(",")+"]}"}}(e,t);o&&(i+=o+",")}return i=i.replace(/,$/,"")+"}",e.dynamicAttrs&&(i="_b("+i+',"'+e.tag+'",'+Ua(e.dynamicAttrs)+")"),e.wrapData&&(i=e.wrapData(i)),e.wrapListeners&&(i=e.wrapListeners(i)),i}function Ba(e){return 1===e.type&&("slot"===e.tag||e.children.some(Ba))}function Fa(e,t){var i=e.attrsMap["slot-scope"];if(e.if&&!e.ifProcessed&&!i)return Oa(e,t,Fa,"null");if(e.for&&!e.forProcessed)return La(e,t,Fa);var n=e.slotScope===ia?"":String(e.slotScope),r="function("+n+"){return "+("template"===e.tag?e.if&&i?"("+e.if+")?"+($a(e,t)||"undefined")+":undefined":$a(e,t)||"undefined":Pa(e,t))+"}",o=n?"":",proxy:true";return"{key:"+(e.slotTarget||'"default"')+",fn:"+r+o+"}"}function $a(e,t,i,n,r){var o=e.children;if(o.length){var a=o[0];if(1===o.length&&a.for&&"template"!==a.tag&&"slot"!==a.tag){var s=i?t.maybeComponent(a)?",1":",0":"";return""+(n||Pa)(a,t)+s}var l=i?function(e,t){for(var i=0,n=0;n]*>)","i")),d=e.replace(h,(function(e,i,n){return c=n.length,ko(u)||"noscript"===u||(i=i.replace(//g,"$1").replace(//g,"$1")),zo(u,i)&&(i=i.slice(1)),t.chars&&t.chars(i),""}));l+=e.length-d.length,e=d,E(u,l-c,l)}else{var p=e.indexOf("<");if(0===p){if(So.test(e)){var f=e.indexOf("--\x3e");if(f>=0){t.shouldKeepComment&&t.comment(e.substring(4,f),l,l+f+3),T(f+3);continue}}if(Eo.test(e)){var m=e.indexOf("]>");if(m>=0){T(m+2);continue}}var g=e.match(Co);if(g){T(g[0].length);continue}var _=e.match(To);if(_){var v=l;T(_[0].length),E(_[1],v,l);continue}var y=C();if(y){S(y),zo(y.tagName,e)&&T(1);continue}}var x=void 0,b=void 0,w=void 0;if(p>=0){for(b=e.slice(p);!(To.test(b)||bo.test(b)||So.test(b)||Eo.test(b)||(w=b.indexOf("<",1))<0);)p+=w,b=e.slice(p);x=e.substring(0,p)}p<0&&(x=e),x&&T(x.length),t.chars&&x&&t.chars(x,l-x.length,l)}if(e===i){t.chars&&t.chars(e);break}}function T(t){l+=t,e=e.substring(t)}function C(){var t=e.match(bo);if(t){var i,n,r={tagName:t[1],attrs:[],start:l};for(T(t[0].length);!(i=e.match(wo))&&(n=e.match(vo)||e.match(_o));)n.start=l,T(n[0].length),n.end=l,r.attrs.push(n);if(i)return r.unarySlash=i[1],T(i[0].length),r.end=l,r}}function S(e){var i=e.tagName,l=e.unarySlash;o&&("p"===n&&go(i)&&E(n),s(i)&&n===i&&E(i));for(var c=a(i)||!!l,u=e.attrs.length,h=new Array(u),d=0;d=0&&r[a].lowerCasedTag!==s;a--);else a=0;if(a>=0){for(var c=r.length-1;c>=a;c--)t.end&&t.end(r[c].tag,i,o);r.length=a,n=a&&r[a-1].tag}else"br"===s?t.start&&t.start(e,[],!0,i,o):"p"===s&&(t.start&&t.start(e,[],!1,i,o),t.end&&t.end(e,i,o))}E()}(e,{warn:Lo,expectHTML:t.expectHTML,isUnaryTag:t.isUnaryTag,canBeLeftOpenTag:t.canBeLeftOpenTag,shouldDecodeNewlines:t.shouldDecodeNewlines,shouldDecodeNewlinesForHref:t.shouldDecodeNewlinesForHref,shouldKeepComment:t.comments,outputSourceRange:t.outputSourceRange,start:function(e,o,a,u,h){var d=n&&n.ns||Uo(e);X&&"svg"===d&&(o=function(e){for(var t=[],i=0;il&&(s.push(o=e.slice(l,r)),a.push(JSON.stringify(o)));var c=wn(n[1].trim());a.push("_s("+c+")"),s.push({"@binding":c}),l=r+n[0].length}return l':'
',Za.innerHTML.indexOf(" ")>0}var Ka=!!q&&Ya(!1),Ja=!!q&&Ya(!0),Qa=x((function(e){var t=Zi(e);return t&&t.innerHTML})),es=xi.prototype.$mount;return xi.prototype.$mount=function(e,t){if((e=e&&Zi(e))===document.body||e===document.documentElement)return this;var i=this.$options;if(!i.render){var n=i.template;if(n)if("string"==typeof n)"#"===n.charAt(0)&&(n=Qa(n));else{if(!n.nodeType)return this;n=n.innerHTML}else e&&(n=function(e){if(e.outerHTML)return e.outerHTML;var t=document.createElement("div");return t.appendChild(e.cloneNode(!0)),t.innerHTML}(e));if(n){var r=Xa(n,{outputSourceRange:!1,shouldDecodeNewlines:Ka,shouldDecodeNewlinesForHref:Ja,delimiters:i.delimiters,comments:i.comments},this),o=r.render,a=r.staticRenderFns;i.render=o,i.staticRenderFns=a}}return es.call(this,e,t)},xi.compile=Xa,xi},"object"==typeof i&&void 0!==t?t.exports=o():"function"==typeof define&&define.amd?define(o):(r=r||self).Vue=o()}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("timers").setImmediate)},{timers:10}],17:[function(e,t,i){(function(e,i){(function(){ /*! * Vue.js v2.6.12 * (c) 2014-2020 Evan You * Released under the MIT License. */ "use strict";var n=Object.freeze({});function r(e){return null==e}function o(e){return null!=e}function a(e){return!0===e}function s(e){return"string"==typeof e||"number"==typeof e||"symbol"==typeof e||"boolean"==typeof e}function l(e){return null!==e&&"object"==typeof e}var c=Object.prototype.toString;function u(e){return c.call(e).slice(8,-1)}function h(e){return"[object Object]"===c.call(e)}function d(e){return"[object RegExp]"===c.call(e)}function p(e){var t=parseFloat(String(e));return t>=0&&Math.floor(t)===t&&isFinite(e)}function f(e){return o(e)&&"function"==typeof e.then&&"function"==typeof e.catch}function m(e){return null==e?"":Array.isArray(e)||h(e)&&e.toString===c?JSON.stringify(e,null,2):String(e)}function g(e){var t=parseFloat(e);return isNaN(t)?e:t}function _(e,t){for(var i=Object.create(null),n=e.split(","),r=0;r-1)return e.splice(i,1)}}var b=Object.prototype.hasOwnProperty;function w(e,t){return b.call(e,t)}function T(e){var t=Object.create(null);return function(i){return t[i]||(t[i]=e(i))}}var C=/-(\w)/g,S=T((function(e){return e.replace(C,(function(e,t){return t?t.toUpperCase():""}))})),E=T((function(e){return e.charAt(0).toUpperCase()+e.slice(1)})),k=/\B([A-Z])/g,A=T((function(e){return e.replace(k,"-$1").toLowerCase()}));var M=Function.prototype.bind?function(e,t){return e.bind(t)}:function(e,t){function i(i){var n=arguments.length;return n?n>1?e.apply(t,arguments):e.call(t,i):e.call(t)}return i._length=e.length,i};function I(e,t){t=t||0;for(var i=e.length-t,n=new Array(i);i--;)n[i]=e[i+t];return n}function P(e,t){for(var i in t)e[i]=t[i];return e}function D(e){for(var t={},i=0;i0,te=J&&J.indexOf("edge/")>0,ie=(J&&J.indexOf("android"),J&&/iphone|ipad|ipod|ios/.test(J)||"ios"===K),ne=(J&&/chrome\/\d+/.test(J),J&&/phantomjs/.test(J),J&&J.match(/firefox\/(\d+)/)),re={}.watch,oe=!1;if(X)try{var ae={};Object.defineProperty(ae,"passive",{get:function(){oe=!0}}),window.addEventListener("test-passive",null,ae)}catch(e){}var se=function(){return void 0===Z&&(Z=!X&&!Y&&void 0!==e&&(e.process&&"server"===e.process.env.VUE_ENV)),Z},le=X&&window.__VUE_DEVTOOLS_GLOBAL_HOOK__;function ce(e){return"function"==typeof e&&/native code/.test(e.toString())}var ue,he="undefined"!=typeof Symbol&&ce(Symbol)&&"undefined"!=typeof Reflect&&ce(Reflect.ownKeys);ue="undefined"!=typeof Set&&ce(Set)?Set:function(){function e(){this.set=Object.create(null)}return e.prototype.has=function(e){return!0===this.set[e]},e.prototype.add=function(e){this.set[e]=!0},e.prototype.clear=function(){this.set=Object.create(null)},e}();var de,pe,fe,me=z,ge="undefined"!=typeof console,_e=/(?:^|[-_])(\w)/g;de=function(e,t){var i=t?me(t):"";U.warnHandler?U.warnHandler.call(null,e,t,i):ge&&U.silent},pe=function(e,t){ge&&U.silent},fe=function(e,t){if(e.$root===e)return"";var i="function"==typeof e&&null!=e.cid?e.options:e._isVue?e.$options||e.constructor.options:e,n=i.name||i._componentTag,r=i.__file;if(!n&&r){var o=r.match(/([^/\\]+)\.vue$/);n=o&&o[1]}return(n?"<"+(n.replace(_e,(function(e){return e.toUpperCase()})).replace(/[-_]/g,"")+">"):"")+(r&&!1!==t?" at "+r:"")};me=function(e){if(e._isVue&&e.$parent){for(var t=[],i=0;e;){if(t.length>0){var n=t[t.length-1];if(n.constructor===e.constructor){i++,e=e.$parent;continue}i>0&&(t[t.length-1]=[n,i],i=0)}t.push(e),e=e.$parent}return"\n\nfound in\n\n"+t.map((function(e,t){return""+(0===t?"---\x3e ":function(e,t){for(var i="";t;)t%2==1&&(i+=e),t>1&&(e+=e),t>>=1;return i}(" ",5+2*t))+(Array.isArray(e)?fe(e[0])+"... ("+e[1]+" recursive calls)":fe(e))})).join("\n")}return"\n\n(found in "+fe(e)+")"};var ve=0,ye=function(){this.id=ve++,this.subs=[]};ye.prototype.addSub=function(e){this.subs.push(e)},ye.prototype.removeSub=function(e){x(this.subs,e)},ye.prototype.depend=function(){ye.target&&ye.target.addDep(this)},ye.prototype.notify=function(){var e=this.subs.slice();U.async||e.sort((function(e,t){return e.id-t.id}));for(var t=0,i=e.length;t-1)if(o&&!w(r,"default"))a=!1;else if(""===a||a===A(e)){var c=et(String,r.type);(c<0||s0&&(Bt((n=Ft(n,(t||"")+"_"+i))[0])&&Bt(c)&&(u[l]=Ee(c.text+n[0].text),n.shift()),u.push.apply(u,n)):s(n)?Bt(c)?u[l]=Ee(c.text+n):""!==n&&u.push(Ee(n)):Bt(n)&&Bt(c)?u[l]=Ee(c.text+n.text):(a(e._isVList)&&o(n.tag)&&r(n.key)&&o(t)&&(n.key="__vlist"+t+"_"+i+"__"),u.push(n)));return u}function $t(e,t){if(e){for(var i=Object.create(null),n=he?Reflect.ownKeys(e):Object.keys(e),r=0;r0,a=e?!!e.$stable:!o,s=e&&e.$key;if(e){if(e._normalized)return e._normalized;if(a&&i&&i!==n&&s===i.$key&&!o&&!i.$hasNormal)return i;for(var l in r={},e)e[l]&&"$"!==l[0]&&(r[l]=Vt(t,l,e[l]))}else r={};for(var c in t)c in r||(r[c]=Gt(t,c));return e&&Object.isExtensible(e)&&(e._normalized=r),q(r,"$stable",a),q(r,"$key",s),q(r,"$hasNormal",o),r}function Vt(e,t,i){var n=function(){var e=arguments.length?i.apply(null,arguments):i({});return(e=e&&"object"==typeof e&&!Array.isArray(e)?[e]:Rt(e))&&(0===e.length||1===e.length&&e[0].isComment)?void 0:e};return i.proxy&&Object.defineProperty(e,t,{get:n,enumerable:!0,configurable:!0}),n}function Gt(e,t){return function(){return e[t]}}function qt(e,t){var i,n,r,a,s;if(Array.isArray(e)||"string"==typeof e)for(i=new Array(e.length),n=0,r=e.length;n.",e),a=new Te(U.parsePlatformTagName(t),i,n,void 0,void 0,e)):a=i&&i.pre||!o(u=He(e.$options,"components",t))?new Te(t,i,n,void 0,void 0,e):hi(u,i,e,n,t)}else a=hi(t,i,e,n);return Array.isArray(a)?a:o(a)?(o(c)&&fi(a,c),o(i)&&function(e){l(e.style)&&At(e.style);l(e.class)&&At(e.class)}(i),a):Se()}(e,t,i,n,r)}function fi(e,t,i){if(e.ns=t,"foreignObject"===e.tag&&(t=void 0,i=!0),o(e.children))for(var n=0,s=e.children.length;ndocument.createEvent("Event").timeStamp&&($i=function(){return ji.now()})}function Ni(){var e,t;for(Fi=$i(),Ri=!0,Pi.sort((function(e,t){return e.id-t.id})),Bi=0;Bi100)){de("You may have an infinite update loop "+(e.user?'in watcher with expression "'+e.expression+'"':"in a component render function."),e.vm);break}var i=Di.slice(),n=Pi.slice();Bi=Pi.length=Di.length=0,zi={},Oi={},Li=Ri=!1,function(e){for(var t=0;tBi&&Pi[i].id>e.id;)i--;Pi.splice(i+1,0,e)}else Pi.push(e);if(!Li){if(Li=!0,!U.async)return void Ni();_t(Ni)}}}(this)},Vi.prototype.run=function(){if(this.active){var e=this.get();if(e!==this.value||l(e)||this.deep){var t=this.value;if(this.value=e,this.user)try{this.cb.call(this.vm,e,t)}catch(e){nt(e,this.vm,'callback for watcher "'+this.expression+'"')}else this.cb.call(this.vm,e,t)}}},Vi.prototype.evaluate=function(){this.value=this.get(),this.dirty=!1},Vi.prototype.depend=function(){for(var e=this.deps.length;e--;)this.deps[e].depend()},Vi.prototype.teardown=function(){if(this.active){this.vm._isBeingDestroyed||x(this.vm._watchers,this);for(var e=this.deps.length;e--;)this.deps[e].removeSub(this);this.active=!1}};var Gi={enumerable:!0,configurable:!0,get:z,set:z};function qi(e,t,i){Gi.get=function(){return this[t][i]},Gi.set=function(e){this[t][i]=e},Object.defineProperty(e,i,Gi)}function Wi(e){e._watchers=[];var t=e.$options;t.props&&function(e,t){var i=e.$options.propsData||{},n=e._props={},r=e.$options._propKeys=[],o=!e.$parent;o||De(!1);var a=function(a){r.push(a);var s=Xe(a,t,i,e),l=A(a);(y(l)||U.isReservedAttr(l))&&de('"'+l+'" is a reserved attribute and cannot be used as component prop.',e),Le(n,a,s,(function(){o||Si||de("Avoid mutating a prop directly since the value will be overwritten whenever the parent component re-renders. Instead, use a data or computed property based on the prop's value. Prop being mutated: \""+a+'"',e)})),a in e||qi(e,"_props",a)};for(var s in t)a(s);De(!0)}(e,t.props),t.methods&&function(e,t){var i=e.$options.props;for(var n in t)"function"!=typeof t[n]&&de('Method "'+n+'" has type "'+typeof t[n]+'" in the component definition. Did you reference the function correctly?',e),i&&w(i,n)&&de('Method "'+n+'" has already been defined as a prop.',e),n in e&&G(n)&&de('Method "'+n+'" conflicts with an existing Vue instance method. Avoid defining component methods that start with _ or $.'),e[n]="function"!=typeof t[n]?z:M(t[n],e)}(e,t.methods),t.data?function(e){var t=e.$options.data;h(t=e._data="function"==typeof t?function(e,t){be();try{return e.call(t,t)}catch(e){return nt(e,t,"data()"),{}}finally{we()}}(t,e):t||{})||(t={},de("data functions should return an object:\nhttps://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function",e));var i=Object.keys(t),n=e.$options.props,r=e.$options.methods,o=i.length;for(;o--;){var a=i[o];r&&w(r,a)&&de('Method "'+a+'" has already been defined as a data property.',e),n&&w(n,a)?de('The data property "'+a+'" is already declared as a prop. Use prop default value instead.',e):G(a)||qi(e,"_data",a)}Oe(t,!0)}(e):Oe(e._data={},!0),t.computed&&function(e,t){var i=e._computedWatchers=Object.create(null),n=se();for(var r in t){var o=t[r],a="function"==typeof o?o:o.get;null==a&&de('Getter is missing for computed property "'+r+'".',e),n||(i[r]=new Vi(e,a||z,z,Zi)),r in e?r in e.$data?de('The computed property "'+r+'" is already defined in data.',e):e.$options.props&&r in e.$options.props&&de('The computed property "'+r+'" is already defined as a prop.',e):Hi(e,r,o)}}(e,t.computed),t.watch&&t.watch!==re&&function(e,t){for(var i in t){var n=t[i];if(Array.isArray(n))for(var r=0;r-1:"string"==typeof e?e.split(",").indexOf(t)>-1:!!d(e)&&e.test(t)}function on(e,t){var i=e.cache,n=e.keys,r=e._vnode;for(var o in i){var a=i[o];if(a){var s=nn(a.componentOptions);s&&!t(s)&&an(i,o,n,r)}}}function an(e,t,i,n){var r=e[t];!r||n&&r.tag===n.tag||r.componentInstance.$destroy(),e[t]=null,x(i,t)}!function(e){e.prototype._init=function(e){var t,i,r=this;r._uid=Ji++,U.performance&&St&&(t="vue-perf-start:"+r._uid,i="vue-perf-end:"+r._uid,St(t)),r._isVue=!0,e&&e._isComponent?function(e,t){var i=e.$options=Object.create(e.constructor.options),n=t._parentVnode;i.parent=t.parent,i._parentVnode=n;var r=n.componentOptions;i.propsData=r.propsData,i._parentListeners=r.listeners,i._renderChildren=r.children,i._componentTag=r.tag,t.render&&(i.render=t.render,i.staticRenderFns=t.staticRenderFns)}(r,e):r.$options=Ze(Qi(r.constructor),e||{},r),lt(r),r._self=r,function(e){var t=e.$options,i=t.parent;if(i&&!t.abstract){for(;i.$options.abstract&&i.$parent;)i=i.$parent;i.$children.push(e)}e.$parent=i,e.$root=i?i.$root:e,e.$children=[],e.$refs={},e._watcher=null,e._inactive=null,e._directInactive=!1,e._isMounted=!1,e._isDestroyed=!1,e._isBeingDestroyed=!1}(r),function(e){e._events=Object.create(null),e._hasHookEvent=!1;var t=e.$options._parentListeners;t&&Ti(e,t)}(r),function(e){e._vnode=null,e._staticTrees=null;var t=e.$options,i=e.$vnode=t._parentVnode,r=i&&i.context;e.$slots=jt(t._renderChildren,r),e.$scopedSlots=n,e._c=function(t,i,n,r){return pi(e,t,i,n,r,!1)},e.$createElement=function(t,i,n,r){return pi(e,t,i,n,r,!0)};var o=i&&i.data;Le(e,"$attrs",o&&o.attrs||n,(function(){!Si&&de("$attrs is readonly.",e)}),!0),Le(e,"$listeners",t._parentListeners||n,(function(){!Si&&de("$listeners is readonly.",e)}),!0)}(r),Ii(r,"beforeCreate"),function(e){var t=$t(e.$options.inject,e);t&&(De(!1),Object.keys(t).forEach((function(i){Le(e,i,t[i],(function(){de('Avoid mutating an injected value directly since the changes will be overwritten whenever the provided component re-renders. injection being mutated: "'+i+'"',e)}))})),De(!0))}(r),Wi(r),function(e){var t=e.$options.provide;t&&(e._provided="function"==typeof t?t.call(e):t)}(r),Ii(r,"created"),U.performance&&St&&(r._name=fe(r,!1),St(i),Et("vue "+r._name+" init",t,i)),r.$options.el&&r.$mount(r.$options.el)}}(en),function(e){var t={get:function(){return this._data}},i={get:function(){return this._props}};t.set=function(){de("Avoid replacing instance root $data. Use nested data properties instead.",this)},i.set=function(){de("$props is readonly.",this)},Object.defineProperty(e.prototype,"$data",t),Object.defineProperty(e.prototype,"$props",i),e.prototype.$set=Re,e.prototype.$delete=Be,e.prototype.$watch=function(e,t,i){var n=this;if(h(t))return Ki(n,e,t,i);(i=i||{}).user=!0;var r=new Vi(n,e,t,i);if(i.immediate)try{t.call(n,r.value)}catch(e){nt(e,n,'callback for immediate watcher "'+r.expression+'"')}return function(){r.teardown()}}}(en),function(e){var t=/^hook:/;e.prototype.$on=function(e,i){var n=this;if(Array.isArray(e))for(var r=0,o=e.length;r1?I(n):n;for(var r=I(arguments,1),o='event handler for "'+e+'"',a=0,s=n.length;aparseInt(this.max)&&an(a,s[0],s,this._vnode)),t.data.keepAlive=!0}return t||e&&e[0]}}};!function(e){var t={get:function(){return U},set:function(){de("Do not replace the Vue.config object, set individual fields instead.")}};Object.defineProperty(e,"config",t),e.util={warn:de,extend:P,mergeOptions:Ze,defineReactive:Le},e.set=Re,e.delete=Be,e.nextTick=_t,e.observable=function(e){return Oe(e),e},e.options=Object.create(null),j.forEach((function(t){e.options[t+"s"]=Object.create(null)})),e.options._base=e,P(e.options.components,ln),function(e){e.use=function(e){var t=this._installedPlugins||(this._installedPlugins=[]);if(t.indexOf(e)>-1)return this;var i=I(arguments,1);return i.unshift(this),"function"==typeof e.install?e.install.apply(e,i):"function"==typeof e&&e.apply(null,i),t.push(e),this}}(e),function(e){e.mixin=function(e){return this.options=Ze(this.options,e),this}}(e),tn(e),function(e){j.forEach((function(t){e[t]=function(e,i){return i?("component"===t&&qe(e),"component"===t&&h(i)&&(i.name=i.name||e,i=this.options._base.extend(i)),"directive"===t&&"function"==typeof i&&(i={bind:i,update:i}),this.options[t+"s"][e]=i,i):this.options[t+"s"][e]}}))}(e)}(en),Object.defineProperty(en.prototype,"$isServer",{get:se}),Object.defineProperty(en.prototype,"$ssrContext",{get:function(){return this.$vnode&&this.$vnode.ssrContext}}),Object.defineProperty(en,"FunctionalRenderContext",{value:ai}),en.version="2.6.12";var cn=_("style,class"),un=_("input,textarea,option,select,progress"),hn=_("contenteditable,draggable,spellcheck"),dn=_("events,caret,typing,plaintext-only"),pn=_("allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,default,defaultchecked,defaultmuted,defaultselected,defer,disabled,enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,required,reversed,scoped,seamless,selected,sortable,translate,truespeed,typemustmatch,visible"),fn="http://www.w3.org/1999/xlink",mn=function(e){return":"===e.charAt(5)&&"xlink"===e.slice(0,5)},gn=function(e){return mn(e)?e.slice(6,e.length):""},_n=function(e){return null==e||!1===e};function vn(e){for(var t=e.data,i=e,n=e;o(n.componentInstance);)(n=n.componentInstance._vnode)&&n.data&&(t=yn(n.data,t));for(;o(i=i.parent);)i&&i.data&&(t=yn(t,i.data));return function(e,t){if(o(e)||o(t))return xn(e,bn(t));return""}(t.staticClass,t.class)}function yn(e,t){return{staticClass:xn(e.staticClass,t.staticClass),class:o(e.class)?[e.class,t.class]:t.class}}function xn(e,t){return e?t?e+" "+t:e:t||""}function bn(e){return Array.isArray(e)?function(e){for(var t,i="",n=0,r=e.length;n-1?Gn(e,t,i):pn(t)?_n(i)?e.removeAttribute(t):(i="allowfullscreen"===t&&"EMBED"===e.tagName?"true":t,e.setAttribute(t,i)):hn(t)?e.setAttribute(t,function(e,t){return _n(t)||"false"===t?"false":"contenteditable"===e&&dn(t)?t:"true"}(t,i)):mn(t)?_n(i)?e.removeAttributeNS(fn,gn(t)):e.setAttributeNS(fn,t,i):Gn(e,t,i)}function Gn(e,t,i){if(_n(i))e.removeAttribute(t);else{if(Q&&!ee&&"TEXTAREA"===e.tagName&&"placeholder"===t&&""!==i&&!e.__ieph){var n=function(t){t.stopImmediatePropagation(),e.removeEventListener("input",n)};e.addEventListener("input",n),e.__ieph=!0}e.setAttribute(t,i)}}var qn={create:Un,update:Un};function Wn(e,t){var i=t.elm,n=t.data,a=e.data;if(!(r(n.staticClass)&&r(n.class)&&(r(a)||r(a.staticClass)&&r(a.class)))){var s=vn(t),l=i._transitionClasses;o(l)&&(s=xn(s,bn(l))),s!==i._prevClass&&(i.setAttribute("class",s),i._prevClass=s)}}var Zn,Hn={create:Wn,update:Wn};function Xn(e,t,i){var n=Zn;return function r(){var o=t.apply(null,arguments);null!==o&&Jn(e,r,i,n)}}var Yn=ct&&!(ne&&Number(ne[1])<=53);function Kn(e,t,i,n){if(Yn){var r=Fi,o=t;t=o._wrapper=function(e){if(e.target===e.currentTarget||e.timeStamp>=r||e.timeStamp<=0||e.target.ownerDocument!==document)return o.apply(this,arguments)}}Zn.addEventListener(e,t,oe?{capture:i,passive:n}:i)}function Jn(e,t,i,n){(n||Zn).removeEventListener(e,t._wrapper||t,i)}function Qn(e,t){if(!r(e.data.on)||!r(t.data.on)){var i=t.data.on||{},n=e.data.on||{};Zn=t.elm,function(e){if(o(e.__r)){var t=Q?"change":"input";e[t]=[].concat(e.__r,e[t]||[]),delete e.__r}o(e.__c)&&(e.change=[].concat(e.__c,e.change||[]),delete e.__c)}(i),zt(i,n,Kn,Jn,Xn,t.context),Zn=void 0}}var er,tr={create:Qn,update:Qn};function ir(e,t){if(!r(e.data.domProps)||!r(t.data.domProps)){var i,n,a=t.elm,s=e.data.domProps||{},l=t.data.domProps||{};for(i in o(l.__ob__)&&(l=t.data.domProps=P({},l)),s)i in l||(a[i]="");for(i in l){if(n=l[i],"textContent"===i||"innerHTML"===i){if(t.children&&(t.children.length=0),n===s[i])continue;1===a.childNodes.length&&a.removeChild(a.childNodes[0])}if("value"===i&&"PROGRESS"!==a.tagName){a._value=n;var c=r(n)?"":String(n);nr(a,c)&&(a.value=c)}else if("innerHTML"===i&&Cn(a.tagName)&&r(a.innerHTML)){(er=er||document.createElement("div")).innerHTML=""+n+"";for(var u=er.firstChild;a.firstChild;)a.removeChild(a.firstChild);for(;u.firstChild;)a.appendChild(u.firstChild)}else if(n!==s[i])try{a[i]=n}catch(e){}}}}function nr(e,t){return!e.composing&&("OPTION"===e.tagName||function(e,t){var i=!0;try{i=document.activeElement!==e}catch(e){}return i&&e.value!==t}(e,t)||function(e,t){var i=e.value,n=e._vModifiers;if(o(n)){if(n.number)return g(i)!==g(t);if(n.trim)return i.trim()!==t.trim()}return i!==t}(e,t))}var rr={create:ir,update:ir},or=T((function(e){var t={},i=/:(.+)/;return e.split(/;(?![^(]*\))/g).forEach((function(e){if(e){var n=e.split(i);n.length>1&&(t[n[0].trim()]=n[1].trim())}})),t}));function ar(e){var t=sr(e.style);return e.staticStyle?P(e.staticStyle,t):t}function sr(e){return Array.isArray(e)?D(e):"string"==typeof e?or(e):e}var lr,cr=/^--/,ur=/\s*!important$/,hr=function(e,t,i){if(cr.test(t))e.style.setProperty(t,i);else if(ur.test(i))e.style.setProperty(A(t),i.replace(ur,""),"important");else{var n=pr(t);if(Array.isArray(i))for(var r=0,o=i.length;r-1?t.split(gr).forEach((function(t){return e.classList.add(t)})):e.classList.add(t);else{var i=" "+(e.getAttribute("class")||"")+" ";i.indexOf(" "+t+" ")<0&&e.setAttribute("class",(i+t).trim())}}function vr(e,t){if(t&&(t=t.trim()))if(e.classList)t.indexOf(" ")>-1?t.split(gr).forEach((function(t){return e.classList.remove(t)})):e.classList.remove(t),e.classList.length||e.removeAttribute("class");else{for(var i=" "+(e.getAttribute("class")||"")+" ",n=" "+t+" ";i.indexOf(n)>=0;)i=i.replace(n," ");(i=i.trim())?e.setAttribute("class",i):e.removeAttribute("class")}}function yr(e){if(e){if("object"==typeof e){var t={};return!1!==e.css&&P(t,xr(e.name||"v")),P(t,e),t}return"string"==typeof e?xr(e):void 0}}var xr=T((function(e){return{enterClass:e+"-enter",enterToClass:e+"-enter-to",enterActiveClass:e+"-enter-active",leaveClass:e+"-leave",leaveToClass:e+"-leave-to",leaveActiveClass:e+"-leave-active"}})),br=X&&!ee,wr="transition",Tr="animation",Cr="transition",Sr="transitionend",Er="animation",kr="animationend";br&&(void 0===window.ontransitionend&&void 0!==window.onwebkittransitionend&&(Cr="WebkitTransition",Sr="webkitTransitionEnd"),void 0===window.onanimationend&&void 0!==window.onwebkitanimationend&&(Er="WebkitAnimation",kr="webkitAnimationEnd"));var Ar=X?window.requestAnimationFrame?window.requestAnimationFrame.bind(window):setTimeout:function(e){return e()};function Mr(e){Ar((function(){Ar(e)}))}function Ir(e,t){var i=e._transitionClasses||(e._transitionClasses=[]);i.indexOf(t)<0&&(i.push(t),_r(e,t))}function Pr(e,t){e._transitionClasses&&x(e._transitionClasses,t),vr(e,t)}function Dr(e,t,i){var n=Or(e,t),r=n.type,o=n.timeout,a=n.propCount;if(!r)return i();var s=r===wr?Sr:kr,l=0,c=function(){e.removeEventListener(s,u),i()},u=function(t){t.target===e&&++l>=a&&c()};setTimeout((function(){l0&&(i=wr,u=a,h=o.length):t===Tr?c>0&&(i=Tr,u=c,h=l.length):h=(i=(u=Math.max(a,c))>0?a>c?wr:Tr:null)?i===wr?o.length:l.length:0,{type:i,timeout:u,propCount:h,hasTransform:i===wr&&zr.test(n[Cr+"Property"])}}function Lr(e,t){for(;e.length explicit "+t+" duration is not a valid number - got "+JSON.stringify(e)+".",i.context):isNaN(e)&&de(" explicit "+t+" duration is NaN - the duration expression might be incorrect.",i.context)}function jr(e){return"number"==typeof e&&!isNaN(e)}function Nr(e){if(r(e))return!1;var t=e.fns;return o(t)?Nr(Array.isArray(t)?t[0]:t):(e._length||e.length)>1}function Ur(e,t){!0!==t.data.show&&Br(t)}var Vr=function(e){var t,i,n={},l=e.modules,c=e.nodeOps;for(t=0;t - did you register the component correctly? For recursive components, make sure to provide the "name" option.',e.context),e.elm=e.ns?c.createElementNS(e.ns,_):c.createElement(_,e),b(e),v(e,f,t),o(d)&&x(e,t),g(i,e.elm,r),d&&d.pre&&p--):a(e.isComment)?(e.elm=c.createComment(e.text),g(i,e.elm,r)):(e.elm=c.createTextNode(e.text),g(i,e.elm,r))}}function m(e,t){o(e.data.pendingInsert)&&(t.push.apply(t,e.data.pendingInsert),e.data.pendingInsert=null),e.elm=e.componentInstance.$el,y(e)?(x(e,t),b(e)):(In(e),t.push(e))}function g(e,t,i){o(e)&&(o(i)?c.parentNode(i)===e&&c.insertBefore(e,t,i):c.appendChild(e,t))}function v(e,t,i){if(Array.isArray(t)){E(t);for(var n=0;np?w(e,r(i[_+1])?null:i[_+1].elm,i,d,_,n):d>_&&C(t,h,p)}(h,m,g,i,u):o(g)?(E(g),o(e.text)&&c.setTextContent(h,""),w(h,null,g,0,g.length-1,i)):o(m)?C(m,0,m.length-1):o(e.text)&&c.setTextContent(h,""):e.text!==t.text&&c.setTextContent(h,t.text),o(p)&&o(d=p.hook)&&o(d=d.postpatch)&&d(e,t)}}}function M(e,t,i){if(a(i)&&o(e.parent))e.parent.data.pendingInsert=t;else for(var n=0;n, or missing . Bailing hydration and performing full client-side render.")}l=e,e=new Te(c.tagName(l).toLowerCase(),{},[],void 0,l)}var p=e.elm,m=c.parentNode(p);if(f(t,h,p._leaveCb?null:m,c.nextSibling(p)),o(t.parent))for(var g=t.parent,_=y(t);g;){for(var v=0;v-1,a.selected!==o&&(a.selected=o);else if(R(Hr(a),n))return void(e.selectedIndex!==s&&(e.selectedIndex=s));r||(e.selectedIndex=-1)}else de('