!function t(e,n,i){function r(a,s){if(!n[a]){if(!e[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=n[a]={exports:{}};e[a][0].call(u.exports,(function(t){return r(e[a][1][t]||t)}),u,u.exports,t,e,n,i)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;ac/r*i?t/i:c/r:"contain"===s?c>t/i*r?t/i:c/r:1,l?n.style.transform="scale("+e+")":(n.style.width=i*e+"px",n.style.height=r*e+"px"),n.style.left=t!==i*e?u*a+"px":"0px",n.style.top=c!==r*e?d*o+"px":"0px"):setTimeout(h,30)}n.style.position="absolute",n.parentElement.style.overflow="hidden",l&&(n.style.transformOrigin="left top"),-1===["relative","absolute","fixed"].indexOf(window.getComputedStyle(n.parentElement,null).getPropertyValue("position"))&&(n.parentElement.style.position="relative"),c(),u(),h(),this.update=h,this.setWidth=function(t){i=Number(t)},this.setHeight=function(t){r=Number(t)},this.setValign=function(t){o=t,c()},this.setHalign=function(t){a=t,u()},this.setFit=function(t){s=t},this.getWidth=function(){return Number(i)},this.getHeight=function(){return Number(r)},this.getCurrentWidth=function(){return e*i},this.getCurrentHeight=function(){return e*r},this.getValign=function(){return o},this.getHalign=function(){return a},this.getFit=function(){return s},this.getScale=function(){return e}}},{}],3:[function(t,e,n){"use strict";t("./index").polyfill()},{"./index":4}],4:[function(t,e,n){"use strict";function i(t,e){if(null==t)throw new TypeError("Cannot convert first argument to object");for(var n=Object(t),i=1;it._dur||e._start<0))for(var n=t;n;)n._dirty=1,n=n.parent;return t},Ft=function(t){for(var e=t.parent;e&&e.parent;)e._dirty=1,e.totalDuration(),e=e.parent;return t},$t=function t(e){return!e||e._ts&&t(e.parent)},Bt=function(t){return t._repeat?Nt(t._tTime,t=t.duration()+t._rDelay)*t:0},Nt=function(t,e){var n=Math.floor(t/=e);return t&&n===t?n-1:n},jt=function(t,e){return(t-e._start)*e._ts+(e._ts>=0?0:e._dirty?e.totalDuration():e._tDur)},Ut=function(t){return t._end=wt(t._start+(t._tDur/Math.abs(t._ts||t._rts||O)||0))},Vt=function(t,e){var n=t._dp;return n&&n.smoothChildTiming&&t._ts&&(t._start=wt(n._time-(t._ts>0?e/t._ts:((t._dirty?t.totalDuration():t._tDur)-e)/-t._ts)),Ut(t),n._dirty||Lt(n,t)),t},Gt=function(t,e){var n;if((e._time||e._initted&&!e._dur)&&(n=jt(t.rawTime(),e),(!e._dur||ne(0,e.totalDuration(),n)-e._tTime>O)&&e.render(n,!0)),Lt(t,e)._dp&&t._initted&&t._time>=t._dur&&t._ts){if(t._dur=0&&n.totalTime(n._tTime),n=n._dp;t._zTime=-1e-8}},qt=function(t,e,n,i){return e.parent&&Rt(e),e._start=wt((V(n)?n:n||t!==r?Qt(t,n,e):t._time)+e._delay),e._end=wt(e._start+(e.totalDuration()/Math.abs(e.timeScale())||0)),function(t,e,n,i,r){void 0===n&&(n="_first"),void 0===i&&(i="_last");var o,a=t[i];if(r)for(o=e[r];a&&a[r]>o;)a=a._prev;a?(e._next=a._next,a._next=e):(e._next=t[n],t[n]=e),e._next?e._next._prev=e:t[i]=e,e._prev=a,e.parent=e._dp=t}(t,e,"_first","_last",t._sort?"_start":0),Xt(e)||(t._recent=e),i||Gt(t,e),t},Zt=function(t,e){return rt.ScrollTrigger?rt.ScrollTrigger.create(e,t):void 0},Ht=function(t,e,n,i){return Xe(t,e),t._initted?!n&&t._pt&&(t._dur&&!1!==t.vars.lazy||!t._dur&&t.vars.lazy)&&c!==Ie.frame?(ht.push(t),t._lazy=[e,i],1):void 0:1},Wt=function t(e){var n=e.parent;return n&&n._ts&&n._initted&&!n._lock&&(n.rawTime()<0||t(n))},Xt=function(t){var e=t.data;return"isFromStart"===e||"isStart"===e},Kt=function(t,e,n,i){var r=t._repeat,o=wt(e)||0,a=t._tTime/t._tDur;return a&&!i&&(t._time*=o/t._dur),t._dur=o,t._tDur=r?r<0?1e10:wt(o*(r+1)+t._rDelay*r):o,a&&!i?Vt(t,t._tTime=t._tDur*a):t.parent&&Ut(t),n||Lt(t.parent,t),t},Yt=function(t){return t instanceof Ge?Lt(t):Kt(t,t._dur)},Jt={_start:0,endTime:ct,totalDuration:ct},Qt=function t(e,n,i){var r,o,a,s=e.labels,l=e._recent||Jt,c=e.duration()>=z?l.endTime(!1):e._dur;return j(n)&&(isNaN(n)||n in s)?(o=n.charAt(0),a="%"===n.substr(-1),r=n.indexOf("="),"<"===o||">"===o?(r>=0&&(n=n.replace(/=/,"")),("<"===o?l._start:l.endTime(l._repeat>=0))+(parseFloat(n.substr(1))||0)*(a?(r<0?l:i).totalDuration()/100:1)):r<0?(n in s||(s[n]=c),s[n]):(o=parseFloat(n.charAt(r-1)+n.substr(r+1)),a&&i&&(o=o/100*(K(i)?i[0]:i).totalDuration()),r>1?t(e,n.substr(0,r-1),i)+o:c+o)):null==n?c:+n},te=function(t,e,n){var i,r,o=V(e[1]),a=(o?2:1)+(t<2?0:1),s=e[a];if(o&&(s.duration=e[1]),s.parent=n,t){for(i=s,r=n;r&&!("immediateRender"in i);)i=r.vars.defaults||{},r=Z(r.vars.inherit)&&r.parent;s.immediateRender=Z(i.immediateRender),t<2?s.runBackwards=1:s.startAt=e[a-1]}return new Qe(e[0],s,e[a+1])},ee=function(t,e){return t||0===t?e(t):e},ne=function(t,e,n){return ne?e:n},ie=function(t){if("string"!=typeof t)return"";var e=it.exec(t);return e?t.substr(e.index+e[0].length):""},re=[].slice,oe=function(t,e){return t&&q(t)&&"length"in t&&(!e&&!t.length||t.length-1 in t&&q(t[0]))&&!t.nodeType&&t!==o},ae=function(t,e,n){return void 0===n&&(n=[]),t.forEach((function(t){var i;return j(t)&&!e||oe(t,1)?(i=n).push.apply(i,se(t)):n.push(t)}))||n},se=function(t,e,n){return!j(t)||n||!a&&Me()?K(t)?ae(t,n):oe(t)?re.call(t,0):t?[t]:[]:re.call((e||s).querySelectorAll(t),0)},le=function(t){return t.sort((function(){return.5-Math.random()}))},ce=function(t){if(U(t))return t;var e=q(t)?t:{each:t},n=Fe(e.ease),i=e.from||0,r=parseFloat(e.base)||0,o={},a=i>0&&i<1,s=isNaN(i)||a,l=e.axis,c=i,u=i;return j(i)?c=u={center:.5,edges:.5,end:1}[i]||0:!a&&s&&(c=i[0],u=i[1]),function(t,a,h){var d,p,f,m,g,_,v,y,x,b=(h||e).length,w=o[b];if(!w){if(!(x="auto"===e.grid?0:(e.grid||[1,z])[1])){for(v=-z;v<(v=h[x++].getBoundingClientRect().left)&&xv&&(v=g),gb?b-1:l?"y"===l?b/x:x:Math.max(x,b/x))||0)*("edges"===i?-1:1),w.b=b<0?r-b:r,w.u=ie(e.amount||e.each)||0,n=n&&b<0?Re(n):n}return b=(w[t]-w.min)/w.max||0,wt(w.b+(n?n(b):b)*w.v)+w.u}},ue=function(t){var e=t<1?Math.pow(10,(t+"").length-2):1;return function(n){var i=Math.round(parseFloat(n)/t)*t*e;return(i-i%1)/e+(V(n)?0:ie(n))}},he=function(t,e){var n,i,r=K(t);return!r&&q(t)&&(n=r=t.radius||z,t.values?(t=se(t.values),(i=!V(t[0]))&&(n*=n)):t=ue(t.increment)),ee(e,r?U(t)?function(e){return i=t(e),Math.abs(i-e)<=n?i:e}:function(e){for(var r,o,a=parseFloat(i?e.x:e),s=parseFloat(i?e.y:0),l=z,c=0,u=t.length;u--;)(r=i?(r=t[u].x-a)*r+(o=t[u].y-s)*o:Math.abs(t[u]-a))(r=Math.abs(r))&&(o=i,s=r);return o},_e=function(t,e,n){var i,r,o=t.vars,a=o[e];if(a)return i=o[e+"Params"],r=o.callbackScope||t,n&&ht.length&&Ct(),i?a.apply(r,i):a.call(r)},ve=function(t){return Rt(t),t.scrollTrigger&&t.scrollTrigger.kill(!1),t.progress()<1&&_e(t,"onInterrupt"),t},ye=function(t){var e=(t=!t.name&&t.default||t).name,n=U(t),i=e&&!n&&t.init?function(){this._props=[]}:t,r={init:ct,render:cn,add:He,kill:hn,modifier:un,rawVars:0},o={targetTest:0,get:0,getSetter:on,aliases:{},register:0};if(Me(),t!==i){if(pt[e])return;kt(i,kt(Dt(t,r),o)),Mt(i.prototype,Mt(r,Dt(t,o))),pt[i.prop=e]=i,t.targetTest&&(gt.push(i),ut[e]=1),e=("css"===e?"CSS":e.charAt(0).toUpperCase()+e.substr(1))+"Plugin"}lt(e,i),t.register&&t.register(vn,i,fn)},xe=255,be={aqua:[0,xe,xe],lime:[0,xe,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,xe],navy:[0,0,128],white:[xe,xe,xe],olive:[128,128,0],yellow:[xe,xe,0],orange:[xe,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[xe,0,0],pink:[xe,192,203],cyan:[0,xe,xe],transparent:[xe,xe,xe,0]},we=function(t,e,n){return(6*(t=t<0?t+1:t>1?t-1:t)<1?e+(n-e)*t*6:t<.5?n:3*t<2?e+(n-e)*(2/3-t)*6:e)*xe+.5|0},Te=function(t,e,n){var i,r,o,a,s,l,c,u,h,d,p=t?V(t)?[t>>16,t>>8&xe,t&xe]:0:be.black;if(!p){if(","===t.substr(-1)&&(t=t.substr(0,t.length-1)),be[t])p=be[t];else if("#"===t.charAt(0)){if(t.length<6&&(i=t.charAt(1),r=t.charAt(2),o=t.charAt(3),t="#"+i+i+r+r+o+o+(5===t.length?t.charAt(4)+t.charAt(4):"")),9===t.length)return[(p=parseInt(t.substr(1,6),16))>>16,p>>8&xe,p&xe,parseInt(t.substr(7),16)/255];p=[(t=parseInt(t.substr(1),16))>>16,t>>8&xe,t&xe]}else if("hsl"===t.substr(0,3))if(p=d=t.match(Y),e){if(~t.indexOf("="))return p=t.match(J),n&&p.length<4&&(p[3]=1),p}else a=+p[0]%360/360,s=+p[1]/100,i=2*(l=+p[2]/100)-(r=l<=.5?l*(s+1):l+s-l*s),p.length>3&&(p[3]*=1),p[0]=we(a+1/3,i,r),p[1]=we(a,i,r),p[2]=we(a-1/3,i,r);else p=t.match(Y)||be.transparent;p=p.map(Number)}return e&&!d&&(i=p[0]/xe,r=p[1]/xe,o=p[2]/xe,l=((c=Math.max(i,r,o))+(u=Math.min(i,r,o)))/2,c===u?a=s=0:(h=c-u,s=l>.5?h/(2-c-u):h/(c+u),a=c===i?(r-o)/h+(ry&&(b+=a-x),((n=(r=(w+=a)-b)-C)>0||s)&&(o=++m.frame,g=r-1e3*m.time,m.time=r/=1e3,C+=n+(n>=T?4:T-n),i=1),s||(d=p(t)),i)for(_=0;_=e&&_--},_listeners:E=[]}),Me=function(){return!h&&Ie.wake()},Pe={},De=/^[\d.\-M][\d.\-,\s]/,ze=/["']/g,Oe=function(t){for(var e,n,i,r={},o=t.substr(1,t.length-3).split(":"),a=o[0],s=1,l=o.length;s1&&a.config?a.config.apply(null,~t.indexOf("{")?[Oe(o[1])]:(e=t,n=e.indexOf("(")+1,i=e.indexOf(")"),r=e.indexOf("(",n),e.substring(n,~r&&r=1?n:1,o=(i||(e?.3:.45))/(n<1?n:1),a=o/R*(Math.asin(1/r)||0),s=function(t){return 1===t?1:r*Math.pow(2,-10*t)*N((t-a)*o)+1},l="out"===e?s:"in"===e?function(t){return 1-s(1-t)}:Be(s);return o=R/o,l.config=function(n,i){return t(e,n,i)},l},je=function t(e,n){void 0===n&&(n=1.70158);var i=function(t){return t?--t*t*((n+1)*t+n)+1:0},r="out"===e?i:"in"===e?function(t){return 1-i(1-t)}:Be(i);return r.config=function(n){return t(e,n)},r};bt("Linear,Quad,Cubic,Quart,Quint,Strong",(function(t,e){var n=e<5?e+1:e;$e(t+",Power"+(n-1),e?function(t){return Math.pow(t,n)}:function(t){return t},(function(t){return 1-Math.pow(1-t,n)}),(function(t){return t<.5?Math.pow(2*t,n)/2:1-Math.pow(2*(1-t),n)/2}))})),Pe.Linear.easeNone=Pe.none=Pe.Linear.easeIn,$e("Elastic",Ne("in"),Ne("out"),Ne()),A=7.5625,I=1/(k=2.75),$e("Bounce",(function(t){return 1-M(1-t)}),M=function(t){return t0?t+(t+this._rDelay)*this._repeat:t):this.totalDuration()&&this._dur},e.totalDuration=function(t){return arguments.length?(this._dirty=0,Kt(this,this._repeat<0?t:(t-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur},e.totalTime=function(t,e){if(Me(),!arguments.length)return this._tTime;var n=this._dp;if(n&&n.smoothChildTiming&&this._ts){for(Vt(this,t),!n._dp||n.parent||Gt(n,this);n.parent;)n.parent._time!==n._start+(n._ts>=0?n._tTime/n._ts:(n.totalDuration()-n._tTime)/-n._ts)&&n.totalTime(n._tTime,!0),n=n.parent;!this.parent&&this._dp.autoRemoveChildren&&(this._ts>0&&t0||!this._tDur&&!t)&&qt(this._dp,this,this._start-this._delay)}return(this._tTime!==t||!this._dur&&!e||this._initted&&Math.abs(this._zTime)===O||!t&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=t),Et(this,t,e)),this},e.time=function(t,e){return arguments.length?this.totalTime(Math.min(this.totalDuration(),t+Bt(this))%(this._dur+this._rDelay)||(t?this._dur:0),e):this._time},e.totalProgress=function(t,e){return arguments.length?this.totalTime(this.totalDuration()*t,e):this.totalDuration()?Math.min(1,this._tTime/this._tDur):this.ratio},e.progress=function(t,e){return arguments.length?this.totalTime(this.duration()*(!this._yoyo||1&this.iteration()?t:1-t)+Bt(this),e):this.duration()?Math.min(1,this._time/this._dur):this.ratio},e.iteration=function(t,e){var n=this.duration()+this._rDelay;return arguments.length?this.totalTime(this._time+(t-1)*n,e):this._repeat?Nt(this._tTime,n)+1:1},e.timeScale=function(t){if(!arguments.length)return-1e-8===this._rts?0:this._rts;if(this._rts===t)return this;var e=this.parent&&this._ts?jt(this.parent._time,this):this._tTime;return this._rts=+t||0,this._ts=this._ps||-1e-8===t?0:this._rts,Ft(this.totalTime(ne(-this._delay,this._tDur,e),!0))},e.paused=function(t){return arguments.length?(this._ps!==t&&(this._ps=t,t?(this._pTime=this._tTime||Math.max(-this._delay,this.rawTime()),this._ts=this._act=0):(Me(),this._ts=this._rts,this.totalTime(this.parent&&!this.parent.smoothChildTiming?this.rawTime():this._tTime||this._pTime,1===this.progress()&&Math.abs(this._zTime)!==O&&(this._tTime-=O)))),this):this._ps},e.startTime=function(t){if(arguments.length){this._start=t;var e=this.parent||this._dp;return e&&(e._sort||!this.parent)&&qt(e,this,t-this._delay),this}return this._start},e.endTime=function(t){return this._start+(Z(t)?this.totalDuration():this.duration())/Math.abs(this._ts)},e.rawTime=function(t){var e=this.parent||this._dp;return e?t&&(!this._ts||this._repeat&&this._time&&this.totalProgress()<1)?this._tTime%(this._dur+this._rDelay):this._ts?jt(e.rawTime(t),this):this._tTime:this._tTime},e.globalTime=function(t){for(var e=this,n=arguments.length?t:e.rawTime();e;)n=e._start+n/(e._ts||1),e=e._dp;return n},e.repeat=function(t){return arguments.length?(this._repeat=t===1/0?-2:t,Yt(this)):-2===this._repeat?1/0:this._repeat},e.repeatDelay=function(t){if(arguments.length){var e=this._time;return this._rDelay=t,Yt(this),e?this.time(e):this}return this._rDelay},e.yoyo=function(t){return arguments.length?(this._yoyo=t,this):this._yoyo},e.seek=function(t,e){return this.totalTime(Qt(this,t),Z(e))},e.restart=function(t,e){return this.play().totalTime(t?-this._delay:0,Z(e))},e.play=function(t,e){return null!=t&&this.seek(t,e),this.reversed(!1).paused(!1)},e.reverse=function(t,e){return null!=t&&this.seek(t||this.totalDuration(),e),this.reversed(!0).paused(!1)},e.pause=function(t,e){return null!=t&&this.seek(t,e),this.paused(!0)},e.resume=function(){return this.paused(!1)},e.reversed=function(t){return arguments.length?(!!t!==this.reversed()&&this.timeScale(-this._rts||(t?-1e-8:0)),this):this._rts<0},e.invalidate=function(){return this._initted=this._act=0,this._zTime=-1e-8,this},e.isActive=function(){var t,e=this.parent||this._dp,n=this._start;return!(e&&!(this._ts&&this._initted&&e.isActive()&&(t=e.rawTime(!0))>=n&&t1?(e?(i[t]=e,n&&(i[t+"Params"]=n),"onUpdate"===t&&(this._onUpdate=e)):delete i[t],this):i[t]},e.then=function(t){var e=this;return new Promise((function(n){var i=U(t)?t:At,r=function(){var t=e.then;e.then=null,U(i)&&(i=i(e))&&(i.then||i===e)&&(e.then=t),n(i),e.then=t};e._initted&&1===e.totalProgress()&&e._ts>=0||!e._tTime&&e._ts<0?r():e._prom=r}))},e.kill=function(){ve(this)},t}();kt(Ve.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 Ge=function(t){function i(e,i){var o;return void 0===e&&(e={}),(o=t.call(this,e)||this).labels={},o.smoothChildTiming=!!e.smoothChildTiming,o.autoRemoveChildren=!!e.autoRemoveChildren,o._sort=Z(e.sortChildren),r&&qt(e.parent||r,n(o),i),e.reversed&&o.reverse(),e.paused&&o.paused(!0),e.scrollTrigger&&Zt(n(o),e.scrollTrigger),o}e(i,t);var o=i.prototype;return o.to=function(t,e,n){return te(0,arguments,this),this},o.from=function(t,e,n){return te(1,arguments,this),this},o.fromTo=function(t,e,n,i){return te(2,arguments,this),this},o.set=function(t,e,n){return e.duration=0,e.parent=this,zt(e).repeatDelay||(e.repeat=0),e.immediateRender=!!e.immediateRender,new Qe(t,e,Qt(this,n),1),this},o.call=function(t,e,n){return qt(this,Qe.delayedCall(0,t,e),n)},o.staggerTo=function(t,e,n,i,r,o,a){return n.duration=e,n.stagger=n.stagger||i,n.onComplete=o,n.onCompleteParams=a,n.parent=this,new Qe(t,n,Qt(this,r)),this},o.staggerFrom=function(t,e,n,i,r,o,a){return n.runBackwards=1,zt(n).immediateRender=Z(n.immediateRender),this.staggerTo(t,e,n,i,r,o,a)},o.staggerFromTo=function(t,e,n,i,r,o,a,s){return i.startAt=n,zt(i).immediateRender=Z(i.immediateRender),this.staggerTo(t,e,i,r,o,a,s)},o.render=function(t,e,n){var i,o,a,s,l,c,u,h,d,p,f,m,g=this._time,_=this._dirty?this.totalDuration():this._tDur,v=this._dur,y=this!==r&&t>_-O&&t>=0?_:tv&&(i=v)),p=Nt(this._tTime,l),!g&&this._tTime&&p!==s&&(p=s),f&&1&s&&(i=v-i,m=1),s!==p&&!this._lock){var b=f&&1&p,w=b===(f&&1&s);if(se)for(i=t._first;i&&i._start<=n;){if(!i._dur&&"isPause"===i.data&&i._start>e)return i;i=i._next}else for(i=t._last;i&&i._start>=n;){if(!i._dur&&"isPause"===i.data&&i._start=g&&t>=0)for(o=this._first;o;){if(a=o._next,(o._act||i>=o._start)&&o._ts&&u!==o){if(o.parent!==this)return this.render(t,e,n);if(o.render(o._ts>0?(i-o._start)*o._ts:(o._dirty?o.totalDuration():o._tDur)+(i-o._start)*o._ts,e,n),i!==this._time||!this._ts&&!c){u=0,a&&(y+=this._zTime=-1e-8);break}}o=a}else{o=this._last;for(var T=t<0?t:i;o;){if(a=o._prev,(o._act||T<=o._end)&&o._ts&&u!==o){if(o.parent!==this)return this.render(t,e,n);if(o.render(o._ts>0?(T-o._start)*o._ts:(o._dirty?o.totalDuration():o._tDur)+(T-o._start)*o._ts,e,n),i!==this._time||!this._ts&&!c){u=0,a&&(y+=this._zTime=T?-1e-8:O);break}}o=a}}if(u&&!e&&(this.pause(),u.render(i>=g?0:-1e-8)._zTime=i>=g?1:-1,this._ts))return this._start=d,Ut(this),this.render(t,e,n);this._onUpdate&&!e&&_e(this,"onUpdate",!0),(y===_&&_>=this.totalDuration()||!y&&g)&&(d!==this._start&&Math.abs(h)===Math.abs(this._ts)||this._lock||((t||!v)&&(y===_&&this._ts>0||!y&&this._ts<0)&&Rt(this,1),e||t<0&&!g||!y&&!g&&_||(_e(this,y===_&&t>=0?"onComplete":"onReverseComplete",!0),this._prom&&!(y<_&&this.timeScale()>0)&&this._prom())))}return this},o.add=function(t,e){var n=this;if(V(e)||(e=Qt(this,e,t)),!(t instanceof Ve)){if(K(t))return t.forEach((function(t){return n.add(t,e)})),this;if(j(t))return this.addLabel(t,e);if(!U(t))return this;t=Qe.delayedCall(0,t)}return this!==t?qt(this,t,e):this},o.getChildren=function(t,e,n,i){void 0===t&&(t=!0),void 0===e&&(e=!0),void 0===n&&(n=!0),void 0===i&&(i=-z);for(var r=[],o=this._first;o;)o._start>=i&&(o instanceof Qe?e&&r.push(o):(n&&r.push(o),t&&r.push.apply(r,o.getChildren(!0,e,n)))),o=o._next;return r},o.getById=function(t){for(var e=this.getChildren(1,1,1),n=e.length;n--;)if(e[n].vars.id===t)return e[n]},o.remove=function(t){return j(t)?this.removeLabel(t):U(t)?this.killTweensOf(t):(Ot(this,t),t===this._recent&&(this._recent=this._last),Lt(this))},o.totalTime=function(e,n){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=wt(Ie.time-(this._ts>0?e/this._ts:(this.totalDuration()-e)/-this._ts))),t.prototype.totalTime.call(this,e,n),this._forcing=0,this):this._tTime},o.addLabel=function(t,e){return this.labels[t]=Qt(this,e),this},o.removeLabel=function(t){return delete this.labels[t],this},o.addPause=function(t,e,n){var i=Qe.delayedCall(0,e||ct,n);return i.data="isPause",this._hasPause=1,qt(this,i,Qt(this,t))},o.removePause=function(t){var e=this._first;for(t=Qt(this,t);e;)e._start===t&&"isPause"===e.data&&Rt(e),e=e._next},o.killTweensOf=function(t,e,n){for(var i=this.getTweensOf(t,n),r=i.length;r--;)qe!==i[r]&&i[r].kill(t,e);return this},o.getTweensOf=function(t,e){for(var n,i=[],r=se(t),o=this._first,a=V(e);o;)o instanceof Qe?Tt(o._targets,r)&&(a?(!qe||o._initted&&o._ts)&&o.globalTime(0)<=e&&o.globalTime(o.totalDuration())>e:!e||o.isActive())&&i.push(o):(n=o.getTweensOf(r,e)).length&&i.push.apply(i,n),o=o._next;return i},o.tweenTo=function(t,e){e=e||{};var n,i=this,r=Qt(i,t),o=e,a=o.startAt,s=o.onStart,l=o.onStartParams,c=o.immediateRender,u=Qe.to(i,kt({ease:e.ease||"none",lazy:!1,immediateRender:!1,time:r,overwrite:"auto",duration:e.duration||Math.abs((r-(a&&"time"in a?a.time:i._time))/i.timeScale())||O,onStart:function(){if(i.pause(),!n){var t=e.duration||Math.abs((r-(a&&"time"in a?a.time:i._time))/i.timeScale());u._dur!==t&&Kt(u,t,0,1).render(u._time,!0,!0),n=1}s&&s.apply(u,l||[])}},e));return c?u.render(0):u},o.tweenFromTo=function(t,e,n){return this.tweenTo(e,kt({startAt:{time:Qt(this,t)}},n))},o.recent=function(){return this._recent},o.nextLabel=function(t){return void 0===t&&(t=this._time),ge(this,Qt(this,t))},o.previousLabel=function(t){return void 0===t&&(t=this._time),ge(this,Qt(this,t),1)},o.currentLabel=function(t){return arguments.length?this.seek(t,!0):this.previousLabel(this._time+O)},o.shiftChildren=function(t,e,n){void 0===n&&(n=0);for(var i,r=this._first,o=this.labels;r;)r._start>=n&&(r._start+=t,r._end+=t),r=r._next;if(e)for(i in o)o[i]>=n&&(o[i]+=t);return Lt(this)},o.invalidate=function(){var e=this._first;for(this._lock=0;e;)e.invalidate(),e=e._next;return t.prototype.invalidate.call(this)},o.clear=function(t){void 0===t&&(t=!0);for(var e,n=this._first;n;)e=n._next,this.remove(n),n=e;return this._dp&&(this._time=this._tTime=this._pTime=0),t&&(this.labels={}),Lt(this)},o.totalDuration=function(t){var e,n,i,o=0,a=this,s=a._last,l=z;if(arguments.length)return a.timeScale((a._repeat<0?a.duration():a.totalDuration())/(a.reversed()?-t:t));if(a._dirty){for(i=a.parent;s;)e=s._prev,s._dirty&&s.totalDuration(),(n=s._start)>l&&a._sort&&s._ts&&!a._lock?(a._lock=1,qt(a,s,n-s._delay,1)._lock=0):l=n,n<0&&s._ts&&(o-=n,(!i&&!a._dp||i&&i.smoothChildTiming)&&(a._start+=n/a._ts,a._time-=n,a._tTime-=n),a.shiftChildren(-n,!1,-Infinity),l=0),s._end>o&&s._ts&&(o=s._end),s=e;Kt(a,a===r&&a._time>o?a._time:o,1,1),a._dirty=0}return a._tDur},i.updateRoot=function(t){if(r._ts&&(Et(r,jt(t,r)),c=Ie.frame),Ie.frame>=mt){mt+=P.autoSleep||120;var e=r._first;if((!e||!e._ts)&&P.autoSleep&&Ie._listeners.length<2){for(;e&&!e._ts;)e=e._next;e||Ie.sleep()}}},i}(Ve);kt(Ge.prototype,{_lock:0,_hasPause:0,_forcing:0});var qe,Ze=function(t,e,n,i,r,o,a){var s,l,c,u,h,d,p,f,m=new fn(this._pt,t,e,0,1,ln,null,r),g=0,_=0;for(m.b=n,m.e=i,n+="",(p=~(i+="").indexOf("random("))&&(i=fe(i)),o&&(o(f=[n,i],t,e),n=f[0],i=f[1]),l=n.match(tt)||[];s=tt.exec(i);)u=s[0],h=i.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)?parseFloat(u.substr(2))*("-"===u.charAt(0)?-1:1):parseFloat(u)-d,m:c&&c<4?Math.round:0},g=tt.lastIndex);return m.c=g0&&!I&&(e._startAt=0),M&&n<=0)return void(n&&(e._zTime=n))}else!1===I&&(e._startAt=0);else if(S&&M)if(P)!I&&(e._startAt=0);else if(n&&(b=!1),s=kt({overwrite:!1,data:"isFromStart",lazy:b&&Z(w),immediateRender:b,stagger:0,parent:R},o),g&&(s[d.prop]=g),Rt(e._startAt=Qe.set(z,s)),n<0&&e._startAt.render(-1,!0),b){if(!n)return}else t(e._startAt,O);for(e._pt=0,w=M&&Z(w)||w&&!M,a=0;a":e*b)}))})):T.forEach((function(t){return c.to(k,t,">")}));else{if(d=k.length,m=b?ce(b):ct,q(b))for(p in b)~Ye.indexOf(p)&&(g||(g={}),g[p]=b[p]);for(u=0;up-O&&t>=0?p:tf&&(i=f)),(l=this._yoyo&&1&o)&&(h=this._yEase,i=f-i),s=Nt(this._tTime,a),i===d&&!n&&this._initted)return this;o!==s&&(u&&this._yEase&&Le(u,l),!this.vars.repeatRefresh||l||this._lock||(this._lock=n=1,this.render(wt(a*o),!0).invalidate()._lock=0))}if(!this._initted){if(Ht(this,t<0?t:i,n,e))return this._tTime=0,this;if(f!==this._dur)return this.render(t,e,n)}if(this._tTime=m,this._time=i,!this._act&&this._ts&&(this._act=1,this._lazy=0),this.ratio=c=(h||this._ease)(i/f),this._from&&(this.ratio=c=1-c),i&&!d&&!e&&(_e(this,"onStart"),this._tTime!==m))return this;for(r=this._pt;r;)r.r(c,r.d),r=r._next;u&&u.render(t<0?t:!i&&l?-1e-8:u._dur*c,e,n)||this._startAt&&(this._zTime=t),this._onUpdate&&!e&&(t<0&&this._startAt&&this._startAt.render(t,!0,n),_e(this,"onUpdate")),this._repeat&&o!==s&&this.vars.onRepeat&&!e&&this.parent&&_e(this,"onRepeat"),m!==this._tDur&&m||this._tTime!==m||(t<0&&this._startAt&&!this._onUpdate&&this._startAt.render(t,!0,!0),(t||!f)&&(m===this._tDur&&this._ts>0||!m&&this._ts<0)&&Rt(this,1),e||t<0&&!d||!m&&!d||(_e(this,m===p?"onComplete":"onReverseComplete",!0),this._prom&&!(m0)&&this._prom()))}}else!function(t,e,n,i){var r,o,a,s=t.ratio,l=e<0||!e&&(!t._start&&Wt(t)&&(t._initted||!Xt(t))||(t._ts<0||t._dp._ts<0)&&!Xt(t))?0:1,c=t._rDelay,u=0;if(c&&t._repeat&&(u=ne(0,t._tDur,e),o=Nt(u,c),a=Nt(t._tTime,c),t._yoyo&&1&o&&(l=1-l),o!==a&&(s=1-l,t.vars.repeatRefresh&&t._initted&&t.invalidate())),l!==s||i||t._zTime===O||!e&&t._zTime){if(!t._initted&&Ht(t,e,i,n))return;for(a=t._zTime,t._zTime=e||(n?O:0),n||(n=e&&!a),t.ratio=l,t._from&&(l=1-l),t._time=0,t._tTime=u,r=t._pt;r;)r.r(l,r.d),r=r._next;t._startAt&&e<0&&t._startAt.render(e,!0,!0),t._onUpdate&&!n&&_e(t,"onUpdate"),u&&t._repeat&&!n&&t.parent&&_e(t,"onRepeat"),(e>=t._tDur||e<0)&&t.ratio===l&&(l&&Rt(t,1),n||(_e(t,l?"onComplete":"onReverseComplete",!0),t._prom&&t._prom()))}else t._zTime||(t._zTime=e)}(this,t,e,n);return this},a.targets=function(){return this._targets},a.invalidate=function(){return this._pt=this._op=this._startAt=this._onUpdate=this._lazy=this.ratio=0,this._ptLookup=[],this.timeline&&this.timeline.invalidate(),t.prototype.invalidate.call(this)},a.kill=function(t,e){if(void 0===e&&(e="all"),!(t||e&&"all"!==e))return this._lazy=this._pt=0,this.parent?ve(this):this;if(this.timeline){var n=this.timeline.totalDuration();return this.timeline.killTweensOf(t,e,qe&&!0!==qe.vars.overwrite)._first||ve(this),this.parent&&n!==this.timeline.totalDuration()&&Kt(this,this._dur*this.timeline._tDur/n,0,1),this}var i,r,o,a,s,l,c,u=this._targets,h=t?se(t):u,d=this._ptLookup,p=this._pt;if((!e||"all"===e)&&function(t,e){for(var n=t.length,i=n===e.length;i&&n--&&t[n]===e[n];);return n<0}(u,h))return"all"===e&&(this._pt=0),ve(this);for(i=this._op=this._op||[],"all"!==e&&(j(e)&&(s={},bt(e,(function(t){return s[t]=1})),e=s),e=function(t,e){var n,i,r,o,a=t[0]?yt(t[0]).harness:0,s=a&&a.aliases;if(!s)return e;for(i in n=Mt({},e),s)if(i in n)for(r=(o=s[i].split(",")).length;r--;)n[o[r]]=n[i];return n}(u,e)),c=u.length;c--;)if(~h.indexOf(u[c]))for(s in r=d[c],"all"===e?(i[c]=e,a=r,o={}):(o=i[c]=i[c]||{},a=e),a)(l=r&&r[s])&&("kill"in l.d&&!0!==l.d.kill(s)||Ot(this,l,"_pt"),delete r[s]),"all"!==o&&(o[s]=1);return this._initted&&!this._pt&&p&&ve(this),this},o.to=function(t,e){return new o(t,e,arguments[2])},o.from=function(t,e){return te(1,arguments)},o.delayedCall=function(t,e,n,i){return new o(e,0,{immediateRender:!1,lazy:!1,overwrite:!1,delay:t,onComplete:e,onReverseComplete:e,onCompleteParams:n,onReverseCompleteParams:n,callbackScope:i})},o.fromTo=function(t,e,n){return te(2,arguments)},o.set=function(t,e){return e.duration=0,e.repeatDelay||(e.repeat=0),new o(t,e)},o.killTweensOf=function(t,e,n){return r.killTweensOf(t,e,n)},o}(Ve);kt(Qe.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0}),bt("staggerTo,staggerFrom,staggerFromTo",(function(t){Qe[t]=function(){var e=new Ge,n=re.call(arguments,0);return n.splice("staggerFromTo"===t?5:4,0,0),e[t].apply(e,n)}}));var tn=function(t,e,n){return t[e]=n},en=function(t,e,n){return t[e](n)},nn=function(t,e,n,i){return t[e](i.fp,n)},rn=function(t,e,n){return t.setAttribute(e,n)},on=function(t,e){return U(t[e])?en:G(t[e])&&t.setAttribute?rn:tn},an=function(t,e){return e.set(e.t,e.p,Math.round(1e6*(e.s+e.c*t))/1e6,e)},sn=function(t,e){return e.set(e.t,e.p,!!(e.s+e.c*t),e)},ln=function(t,e){var n=e._pt,i="";if(!t&&e.b)i=e.b;else if(1===t&&e.e)i=e.e;else{for(;n;)i=n.p+(n.m?n.m(n.s+n.c*t):Math.round(1e4*(n.s+n.c*t))/1e4)+i,n=n._next;i+=e.c}e.set(e.t,e.p,i,e)},cn=function(t,e){for(var n=e._pt;n;)n.r(t,n.d),n=n._next},un=function(t,e,n,i){for(var r,o=this._pt;o;)r=o._next,o.p===i&&o.modifier(t,e,n),o=r},hn=function(t){for(var e,n,i=this._pt;i;)n=i._next,i.p===t&&!i.op||i.op===t?Ot(this,i,"_pt"):i.dep||(e=1),i=n;return!e},dn=function(t,e,n,i){i.mSet(t,e,i.m.call(i.tween,n,i.mt),i)},pn=function(t){for(var e,n,i,r,o=t._pt;o;){for(e=o._next,n=i;n&&n.pr>o.pr;)n=n._next;(o._prev=n?n._prev:r)?o._prev._next=o:i=o,(o._next=n)?n._prev=o:r=o,o=e}t._pt=i},fn=function(){function t(t,e,n,i,r,o,a,s,l){this.t=e,this.s=i,this.c=r,this.p=n,this.r=o||an,this.d=a||this,this.set=s||tn,this.pr=l||0,this._next=t,t&&(t._prev=this)}return t.prototype.modifier=function(t,e,n){this.mSet=this.mSet||this.set,this.set=dn,this.m=t,this.mt=n,this.tween=e},t}();bt(_t+"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(t){return ut[t]=1})),rt.TweenMax=rt.TweenLite=Qe,rt.TimelineLite=rt.TimelineMax=Ge,r=new Ge({sortChildren:!1,defaults:D,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0}),P.stringFilter=ke;var mn={registerPlugin:function(){for(var t=arguments.length,e=new Array(t),n=0;n1){var i=t.map((function(t){return vn.quickSetter(t,e,n)})),r=i.length;return function(t){for(var e=r;e--;)i[e](t)}}t=t[0]||{};var o=pt[e],a=yt(t),s=a.harness&&(a.harness.aliases||{})[e]||e,l=o?function(e){var i=new o;u._pt=0,i.init(t,n?e+n:e,u,0,[t]),i.render(1,i),u._pt&&cn(1,u)}:a.set(t,s);return o?l:function(e){return l(t,s,n?e+n:e,a,1)}},isTweening:function(t){return r.getTweensOf(t,!0).length>0},defaults:function(t){return t&&t.ease&&(t.ease=Fe(t.ease,D.ease)),Pt(D,t||{})},config:function(t){return Pt(P,t||{})},registerEffect:function(t){var e=t.name,n=t.effect,i=t.plugins,r=t.defaults,o=t.extendTimeline;(i||"").split(",").forEach((function(t){return t&&!pt[t]&&!rt[t]&&st()})),ft[e]=function(t,e,i){return n(se(t),kt(e||{},r),i)},o&&(Ge.prototype[e]=function(t,n,i){return this.add(ft[e](t,q(n)?n:(i=n)&&{},this),i)})},registerEase:function(t,e){Pe[t]=Fe(e)},parseEase:function(t,e){return arguments.length?Fe(t,e):Pe},getById:function(t){return r.getById(t)},exportRoot:function(t,e){void 0===t&&(t={});var n,i,o=new Ge(t);for(o.smoothChildTiming=Z(t.smoothChildTiming),r.remove(o),o._dp=0,o._time=o._tTime=r._time,n=r._first;n;)i=n._next,!e&&!n._dur&&n instanceof Qe&&n.vars.onComplete===n._targets[0]||qt(o,n,n._start-n._delay),n=i;return qt(r,o,0),o},utils:{wrap:function t(e,n,i){var r=n-e;return K(e)?pe(e,t(0,e.length),n):ee(i,(function(t){return(r+(t-e)%r)%r+e}))},wrapYoyo:function t(e,n,i){var r=n-e,o=2*r;return K(e)?pe(e,t(0,e.length-1),n):ee(i,(function(t){return e+((t=(o+(t-e)%o)%o||0)>r?o-t:t)}))},distribute:ce,random:de,snap:he,normalize:function(t,e,n){return me(t,e,0,1,n)},getUnit:ie,clamp:function(t,e,n){return ee(n,(function(n){return ne(t,e,n)}))},splitColor:Te,toArray:se,selector:function(t){return t=se(t)[0]||st()||{},function(e){var n=t.current||t.nativeElement||t;return se(e,n.querySelectorAll?n:n===t?st()||s.createElement("div"):t)}},mapRange:me,pipe:function(){for(var t=arguments.length,e=new Array(t),n=0;n=0?fi[r]:"")+t},gi=function(){"undefined"!=typeof window&&window.document&&(yn=window,xn=yn.document,bn=xn.documentElement,Tn=di("div")||{style:{}},di("div"),ui=mi(ui),hi=ui+"Origin",Tn.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",En=!!mi("perspective"),wn=1)},_i=function t(e){var n,i=di("svg",this.ownerSVGElement&&this.ownerSVGElement.getAttribute("xmlns")||"http://www.w3.org/2000/svg"),r=this.parentNode,o=this.nextSibling,a=this.style.cssText;if(bn.appendChild(i),i.appendChild(this),this.style.display="block",e)try{n=this.getBBox(),this._gsapBBox=this.getBBox,this.getBBox=t}catch(t){}else this._gsapBBox&&(n=this._gsapBBox());return r&&(o?r.insertBefore(this,o):r.appendChild(this)),bn.removeChild(i),this.style.cssText=a,n},vi=function(t,e){for(var n=e.length;n--;)if(t.hasAttribute(e[n]))return t.getAttribute(e[n])},yi=function(t){var e;try{e=t.getBBox()}catch(n){e=_i.call(t,!0)}return e&&(e.width||e.height)||t.getBBox===_i||(e=_i.call(t,!0)),!e||e.width||e.x||e.y?e:{x:+vi(t,["x","cx","x1"])||0,y:+vi(t,["y","cy","y1"])||0,width:0,height:0}},xi=function(t){return!(!t.getCTM||t.parentNode&&!t.ownerSVGElement||!yi(t))},bi=function(t,e){if(e){var n=t.style;e in Gn&&e!==hi&&(e=ui),n.removeProperty?("ms"!==e.substr(0,2)&&"webkit"!==e.substr(0,6)||(e="-"+e),n.removeProperty(e.replace(Wn,"-$1").toLowerCase())):n.removeAttribute(e)}},wi=function(t,e,n,i,r,o){var a=new fn(t._pt,e,n,0,1,o?ii:ni);return t._pt=a,a.b=i,a.e=r,t._props.push(n),a},Ti={deg:1,rad:1,turn:1},Ci=function t(e,n,i,r){var o,a,s,l,c=parseFloat(i)||0,u=(i+"").trim().substr((c+"").length)||"px",h=Tn.style,d=Xn.test(n),p="svg"===e.tagName.toLowerCase(),f=(p?"client":"offset")+(d?"Width":"Height"),m=100,g="px"===r,_="%"===r;return r===u||!c||Ti[r]||Ti[u]?c:("px"!==u&&!g&&(c=t(e,n,i,"px")),l=e.getCTM&&xi(e),!_&&"%"!==u||!Gn[n]&&!~n.indexOf("adius")?(h[d?"width":"height"]=m+(g?u:r),a=~n.indexOf("adius")||"em"===r&&e.appendChild&&!p?e:e.parentNode,l&&(a=(e.ownerSVGElement||{}).parentNode),a&&a!==xn&&a.appendChild||(a=xn.body),(s=a._gsap)&&_&&s.width&&d&&s.time===Ie.time?wt(c/s.width*m):((_||"%"===u)&&(h.position=pi(e,"position")),a===e&&(h.position="static"),a.appendChild(Tn),o=Tn[f],a.removeChild(Tn),h.position="absolute",d&&_&&((s=yt(a)).time=Ie.time,s.width=a[f]),wt(g?o*c/m:o&&c?m/o*c:0))):(o=l?e.getBBox()[d?"width":"height"]:e[f],wt(_?c/o*m:c/100*o)))},Ei=function(t,e,n,i){var r;return wn||gi(),e in Yn&&"transform"!==e&&~(e=Yn[e]).indexOf(",")&&(e=e.split(",")[0]),Gn[e]&&"transform"!==e?(r=Li(t,i),r="transformOrigin"!==e?r[e]:r.svg?r.origin:Fi(pi(t,hi))+" "+r.zOrigin+"px"):(!(r=t.style[e])||"auto"===r||i||~(r+"").indexOf("calc("))&&(r=Ii[e]&&Ii[e](t,e,n)||pi(t,e)||xt(t,e)||("opacity"===e?1:0)),n&&!~(r+"").trim().indexOf(" ")?Ci(t,e,r,n)+n:r},Si=function(t,e,n,i){if(!n||"none"===n){var r=mi(e,t,1),o=r&&pi(t,r,1);o&&o!==n?(e=r,n=o):"borderColor"===e&&(n=pi(t,"borderTopColor"))}var a,s,l,c,u,h,d,p,f,m,g,_,v=new fn(this._pt,t.style,e,0,1,ln),y=0,x=0;if(v.b=n,v.e=i,n+="","auto"===(i+="")&&(t.style[e]=i,i=pi(t,e)||i,t.style[e]=n),ke(a=[n,i]),i=a[1],l=(n=a[0]).match(Q)||[],(i.match(Q)||[]).length){for(;s=Q.exec(i);)d=s[0],f=i.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.charAt(0)+"1"):0)&&(d=d.substr(2)),p=parseFloat(d),m=d.substr((p+"").length),y=Q.lastIndex-m.length,m||(m=m||P.units[e]||g,y===i.length&&(i+=m,v.e+=m)),g!==m&&(c=Ci(t,e,h,m)||0),v._pt={_next:v._pt,p:f||1===x?f:",",s:c,c:_?_*p:p-c,m:u&&u<4||"zIndex"===e?Math.round:0});v.c=y-1;)n=s[r],Gn[n]&&(i=1,n="transformOrigin"===n?hi:ui),bi(o,n);i&&(bi(o,ui),l&&(l.svg&&o.removeAttribute("transform"),Li(o,1),l.uncache=1))}},Ii={clearProps:function(t,e,n,i,r){if("isFromStart"!==r.data){var o=t._pt=new fn(t._pt,e,n,0,0,ki);return o.u=i,o.pr=-10,o.tween=r,t._props.push(n),1}}},Mi=[1,0,0,1,0,0],Pi={},Di=function(t){return"matrix(1, 0, 0, 1, 0, 0)"===t||"none"===t||!t},zi=function(t){var e=pi(t,ui);return Di(e)?Mi:e.substr(7).match(J).map(wt)},Oi=function(t,e){var n,i,r,o,a=t._gsap||yt(t),s=t.style,l=zi(t);return a.svg&&t.getAttribute("transform")?"1,0,0,1,0,0"===(l=[(r=t.transform.baseVal.consolidate().matrix).a,r.b,r.c,r.d,r.e,r.f]).join(",")?Mi:l:(l!==Mi||t.offsetParent||t===bn||a.svg||(r=s.display,s.display="block",(n=t.parentNode)&&t.offsetParent||(o=1,i=t.nextSibling,bn.appendChild(t)),l=zi(t),r?s.display=r:bi(t,"display"),o&&(i?n.insertBefore(t,i):n?n.appendChild(t):bn.removeChild(t))),e&&l.length>6?[l[0],l[1],l[4],l[5],l[12],l[13]]:l)},Ri=function(t,e,n,i,r,o){var a,s,l,c=t._gsap,u=r||Oi(t,!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=e.split(" "),w=parseFloat(b[0])||0,T=parseFloat(b[1])||0;n?u!==Mi&&(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=yi(t)).x+(~b[0].indexOf("%")?w/100*a.width:w),T=a.y+(~(b[1]||b[0]).indexOf("%")?T/100*a.height:T)),i||!1!==i&&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=!!i,c.origin=e,c.originIsAbsolute=!!n,t.style[hi]="0px 0px",o&&(wi(o,c,"xOrigin",h,w),wi(o,c,"yOrigin",d,T),wi(o,c,"xOffset",p,c.xOffset),wi(o,c,"yOffset",f,c.yOffset)),t.setAttribute("data-svg-origin",w+" "+T)},Li=function(t,e){var n=t._gsap||new Ue(t);if("x"in n&&!e&&!n.uncache)return n;var i,r,o,a,s,l,c,u,h,d,p,f,m,g,_,v,y,x,b,w,T,C,E,S,A,k,I,M,D,z,O,R,L=t.style,F=n.scaleX<0,$="px",B="deg",N=pi(t,hi)||"0";return i=r=o=l=c=u=h=d=p=0,a=s=1,n.svg=!(!t.getCTM||!xi(t)),g=Oi(t,n.svg),n.svg&&(S=(!n.uncache||"0px 0px"===N)&&!e&&t.getAttribute("data-svg-origin"),Ri(t,S||N,!!S||n.originIsAbsolute,!1!==n.smooth,g)),f=n.xOrigin||0,m=n.yOrigin||0,g!==Mi&&(x=g[0],b=g[1],w=g[2],T=g[3],i=C=g[4],r=E=g[5],6===g.length?(a=Math.sqrt(x*x+b*b),s=Math.sqrt(T*T+w*w),l=x||b?Hn(b,x)*qn:0,(h=w||T?Hn(w,T)*qn+l:0)&&(s*=Math.abs(Math.cos(h*Zn))),n.svg&&(i-=f-(f*x+m*w),r-=m-(f*b+m*T))):(R=g[6],z=g[7],I=g[8],M=g[9],D=g[10],O=g[11],i=g[12],r=g[13],o=g[14],c=(_=Hn(R,D))*qn,_&&(S=C*(v=Math.cos(-_))+I*(y=Math.sin(-_)),A=E*v+M*y,k=R*v+D*y,I=C*-y+I*v,M=E*-y+M*v,D=R*-y+D*v,O=z*-y+O*v,C=S,E=A,R=k),u=(_=Hn(-w,D))*qn,_&&(v=Math.cos(-_),O=T*(y=Math.sin(-_))+O*v,x=S=x*v-I*y,b=A=b*v-M*y,w=k=w*v-D*y),l=(_=Hn(b,x))*qn,_&&(S=x*(v=Math.cos(_))+b*(y=Math.sin(_)),A=C*v+E*y,b=b*v-x*y,E=E*v-C*y,x=S,C=A),c&&Math.abs(c)+Math.abs(l)>359.9&&(c=l=0,u=180-u),a=wt(Math.sqrt(x*x+b*b+w*w)),s=wt(Math.sqrt(E*E+R*R)),_=Hn(C,E),h=Math.abs(_)>2e-4?_*qn:0,p=O?1/(O<0?-O:O):0),n.svg&&(S=t.getAttribute("transform"),n.forceCSS=t.setAttribute("transform","")||!Di(pi(t,ui)),S&&t.setAttribute("transform",S))),Math.abs(h)>90&&Math.abs(h)<270&&(F?(a*=-1,h+=l<=0?180:-180,l+=l<=0?180:-180):(s*=-1,h+=h<=0?180:-180)),n.x=i-((n.xPercent=i&&(n.xPercent||(Math.round(t.offsetWidth/2)===Math.round(-i)?-50:0)))?t.offsetWidth*n.xPercent/100:0)+$,n.y=r-((n.yPercent=r&&(n.yPercent||(Math.round(t.offsetHeight/2)===Math.round(-r)?-50:0)))?t.offsetHeight*n.yPercent/100:0)+$,n.z=o+$,n.scaleX=wt(a),n.scaleY=wt(s),n.rotation=wt(l)+B,n.rotationX=wt(c)+B,n.rotationY=wt(u)+B,n.skewX=h+B,n.skewY=d+B,n.transformPerspective=p+$,(n.zOrigin=parseFloat(N.split(" ")[2])||0)&&(L[hi]=Fi(N)),n.xOffset=n.yOffset=0,n.force3D=P.force3D,n.renderTransform=n.svg?Gi:En?Vi:Bi,n.uncache=0,n},Fi=function(t){return(t=t.split(" "))[0]+" "+t[1]},$i=function(t,e,n){var i=ie(e);return wt(parseFloat(e)+parseFloat(Ci(t,"x",n+"px",i)))+i},Bi=function(t,e){e.z="0px",e.rotationY=e.rotationX="0deg",e.force3D=0,Vi(t,e)},Ni="0deg",ji="0px",Ui=") ",Vi=function(t,e){var n=e||this,i=n.xPercent,r=n.yPercent,o=n.x,a=n.y,s=n.z,l=n.rotation,c=n.rotationY,u=n.rotationX,h=n.skewX,d=n.skewY,p=n.scaleX,f=n.scaleY,m=n.transformPerspective,g=n.force3D,_=n.target,v=n.zOrigin,y="",x="auto"===g&&t&&1!==t||!0===g;if(v&&(u!==Ni||c!==Ni)){var b,w=parseFloat(c)*Zn,T=Math.sin(w),C=Math.cos(w);w=parseFloat(u)*Zn,b=Math.cos(w),o=$i(_,o,T*b*-v),a=$i(_,a,-Math.sin(w)*-v),s=$i(_,s,C*b*-v+v)}m!==ji&&(y+="perspective("+m+Ui),(i||r)&&(y+="translate("+i+"%, "+r+"%) "),(x||o!==ji||a!==ji||s!==ji)&&(y+=s!==ji||x?"translate3d("+o+", "+a+", "+s+") ":"translate("+o+", "+a+Ui),l!==Ni&&(y+="rotate("+l+Ui),c!==Ni&&(y+="rotateY("+c+Ui),u!==Ni&&(y+="rotateX("+u+Ui),h===Ni&&d===Ni||(y+="skew("+h+", "+d+Ui),1===p&&1===f||(y+="scale("+p+", "+f+Ui),_.style[ui]=y||"translate(0, 0)"},Gi=function(t,e){var n,i,r,o,a,s=e||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*=Zn,p*=Zn,n=Math.cos(d)*m,i=Math.sin(d)*m,r=Math.sin(d-p)*-g,o=Math.cos(d-p)*g,p&&(f*=Zn,a=Math.tan(p-f),r*=a=Math.sqrt(1+a*a),o*=a,f&&(a=Math.tan(f),n*=a=Math.sqrt(1+a*a),i*=a)),n=wt(n),i=wt(i),r=wt(r),o=wt(o)):(n=m,o=g,i=r=0),(T&&!~(u+"").indexOf("px")||C&&!~(h+"").indexOf("px"))&&(T=Ci(_,"x",u,"px"),C=Ci(_,"y",h,"px")),(v||y||x||b)&&(T=wt(T+v-(v*n+y*r)+x),C=wt(C+y-(v*i+y*o)+b)),(l||c)&&(a=_.getBBox(),T=wt(T+l/100*a.width),C=wt(C+c/100*a.height)),a="matrix("+n+","+i+","+r+","+o+","+T+","+C+")",_.setAttribute("transform",a),w&&(_.style[ui]=a)},qi=function(t,e,n,i,r,o){var a,s,l=360,c=j(r),u=parseFloat(r)*(c&&~r.indexOf("rad")?qn:1),h=o?u*o:u-i,d=i+h+"deg";return c&&("short"===(a=r.split("_")[1])&&(h%=l)!==h%180&&(h+=h<0?l:-360),"cw"===a&&h<0?h=(h+36e9)%l-~~(h/l)*l:"ccw"===a&&h>0&&(h=(h-36e9)%l-~~(h/l)*l)),t._pt=s=new fn(t._pt,e,n,i,h,Qn),s.e=d,s.u="deg",t._props.push(n),s},Zi=function(t,e){for(var n in e)t[n]=e[n];return t},Hi=function(t,e,n){var i,r,o,a,s,l,c,u=Zi({},n._gsap),h=n.style;for(r in u.svg?(o=n.getAttribute("transform"),n.setAttribute("transform",""),h[ui]=e,i=Li(n,1),bi(n,ui),n.setAttribute("transform",o)):(o=getComputedStyle(n)[ui],h[ui]=e,i=Li(n,1),h[ui]=o),Gn)(o=u[r])!==(a=i[r])&&"perspective,force3D,transformOrigin,svgOrigin".indexOf(r)<0&&(s=ie(o)!==(c=ie(a))?Ci(n,r,o,c):parseFloat(o),l=parseFloat(a),t._pt=new fn(t._pt,i,r,s,l-s,Jn),t._pt.u=c||0,t._props.push(r));Zi(i,u)};bt("padding,margin,Width,Radius",(function(t,e){var n="Top",i="Right",r="Bottom",o="Left",a=(e<3?[n,i,r,o]:[n+o,n+i,r+i,r+o]).map((function(n){return e<2?t+n:"border"+n+t}));Ii[e>1?"border"+t:t]=function(t,e,n,i,r){var o,s;if(arguments.length<4)return o=a.map((function(e){return Ei(t,e,n)})),5===(s=o.join(" ")).split(o[0]).length?o[0]:s;o=(i+"").split(" "),s={},a.forEach((function(t,e){return s[t]=o[e]=o[e]||o[(e-1)/2|0]})),t.init(e,s,r)}}));var Wi,Xi,Ki,Yi={name:"css",register:gi,targetTest:function(t){return t.style&&t.nodeType},init:function(t,e,n,i,r){var o,a,s,l,c,u,h,d,p,f,m,g,_,v,y,x,b,w,T,C=this._props,E=t.style,S=n.vars.startAt;for(h in wn||gi(),e)if("autoRound"!==h&&(a=e[h],!pt[h]||!We(h,e,n,i,t,r)))if(c=typeof a,u=Ii[h],"function"===c&&(c=typeof(a=a.call(n,i,t,r))),"string"===c&&~a.indexOf("random(")&&(a=fe(a)),u)u(this,t,h,a,n)&&(y=1);else if("--"===h.substr(0,2))o=(getComputedStyle(t).getPropertyValue(h)+"").trim(),a+="",Se.lastIndex=0,Se.test(o)||(d=ie(o),p=ie(a)),p?d!==p&&(o=Ci(t,h,o,p)+p):d&&(a+=d),this.add(E,"setProperty",o,a,i,r,0,0,h),C.push(h);else if("undefined"!==c){if(S&&h in S?(o="function"==typeof S[h]?S[h].call(n,i,t,r):S[h],h in P.units&&!ie(o)&&(o+=P.units[h]),"="===(o+"").charAt(1)&&(o=Ei(t,h))):o=Ei(t,h),l=parseFloat(o),(f="string"===c&&"="===a.charAt(1)?+(a.charAt(0)+"1"):0)&&(a=a.substr(2)),s=parseFloat(a),h in Yn&&("autoAlpha"===h&&(1===l&&"hidden"===Ei(t,"visibility")&&s&&(l=0),wi(this,E,"visibility",l?"inherit":"hidden",s?"inherit":"hidden",!s)),"scale"!==h&&"transform"!==h&&~(h=Yn[h]).indexOf(",")&&(h=h.split(",")[0])),m=h in Gn)if(g||((_=t._gsap).renderTransform&&!e.parseTransform||Li(t,e.parseTransform),v=!1!==e.smoothOrigin&&_.smooth,(g=this._pt=new fn(this._pt,E,ui,0,1,_.renderTransform,_,0,-1)).dep=1),"scale"===h)this._pt=new fn(this._pt,_,"scaleY",_.scaleY,(f?f*s:s-_.scaleY)||0),C.push("scaleY",h),h+="X";else{if("transformOrigin"===h){b=void 0,w=void 0,T=void 0,b=(x=a).split(" "),w=b[0],T=b[1]||"50%","top"!==w&&"bottom"!==w&&"left"!==T&&"right"!==T||(x=w,w=T,T=x),b[0]=Ai[w]||w,b[1]=Ai[T]||T,a=b.join(" "),_.svg?Ri(t,a,0,v,0,this):((p=parseFloat(a.split(" ")[2])||0)!==_.zOrigin&&wi(this,_,"zOrigin",_.zOrigin,p),wi(this,E,h,Fi(o),Fi(a)));continue}if("svgOrigin"===h){Ri(t,a,1,v,0,this);continue}if(h in Pi){qi(this,_,h,l,a,f);continue}if("smoothOrigin"===h){wi(this,_,"smooth",_.smooth,a);continue}if("force3D"===h){_[h]=a;continue}if("transform"===h){Hi(this,a,t);continue}}else h in E||(h=mi(h)||h);if(m||(s||0===s)&&(l||0===l)&&!Kn.test(a)&&h in E)s||(s=0),(d=(o+"").substr((l+"").length))!==(p=ie(a)||(h in P.units?P.units[h]:d))&&(l=Ci(t,h,o,p)),this._pt=new fn(this._pt,m?_:E,h,l,f?f*s:s-l,m||"px"!==p&&"zIndex"!==h||!1===e.autoRound?Jn:ei),this._pt.u=p||0,d!==p&&(this._pt.b=o,this._pt.r=ti);else if(h in E)Si.call(this,t,h,o,a);else{if(!(h in t))continue;this.add(t,h,o||t[h],a,i,r)}C.push(h)}y&&pn(this)},get:Ei,aliases:Yn,getSetter:function(t,e,n){var i=Yn[e];return i&&i.indexOf(",")<0&&(e=i),e in Gn&&e!==hi&&(t._gsap.x||Ei(t,"x"))?n&&Cn===n?"scale"===e?si:ai:(Cn=n||{})&&("scale"===e?li:ci):t.style&&!G(t.style[e])?ri:~e.indexOf("-")?oi:on(t,e)},core:{_removeProperty:bi,_getMatrix:Oi}};vn.utils.checkPrefix=mi,Ki=bt((Wi="x,y,z,scale,scaleX,scaleY,xPercent,yPercent")+","+(Xi="rotation,rotationX,rotationY,skewX,skewY")+",transform,transformOrigin,svgOrigin,force3D,smoothOrigin,transformPerspective",(function(t){Gn[t]=1})),bt(Xi,(function(t){P.units[t]="deg",Pi[t]=1})),Yn[Ki[13]]=Wi+","+Xi,bt("0:translateX,1:translateY,2:translateZ,8:rotate,8:rotationZ,8:rotateZ,9:rotateX,10:rotateY",(function(t){var e=t.split(":");Yn[e[1]]=Ki[e[0]]})),bt("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",(function(t){P.units[t]="px"})),vn.registerPlugin(Yi);var Ji=vn.registerPlugin(Yi)||vn,Qi=Ji.core.Tween;t.Back=$n,t.Bounce=Nn,t.CSSPlugin=Yi,t.Circ=Vn,t.Cubic=zn,t.Elastic=Fn,t.Expo=Un,t.Linear=Pn,t.Power0=Sn,t.Power1=An,t.Power2=kn,t.Power3=In,t.Power4=Mn,t.Quad=Dn,t.Quart=On,t.Quint=Rn,t.Sine=jn,t.SteppedEase=Bn,t.Strong=Ln,t.TimelineLite=Ge,t.TimelineMax=Ge,t.TweenLite=Qe,t.TweenMax=Qi,t.default=Ji,t.gsap=Ji,"undefined"==typeof window||window!==t?Object.defineProperty(t,"__esModule",{value:!0}):delete window.default}))},{}],6:[function(t,e,n){(function(t){(function(){!function(t,i){"object"==typeof n&&void 0!==e?e.exports=i():"function"==typeof define&&define.amd?define(i):(t="undefined"!=typeof globalThis?globalThis:t||self).mapboxgl=i()}(this,(function(){"use strict";var e,n,i;function r(t,r){if(e)if(n){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/api/#transpiling-v2'); }; var sharedChunk = {}; ("+e+")(sharedChunk); ("+n+")(sharedChunk); self.onerror = null;",a={};e(a),i=r(a),"undefined"!=typeof window&&(i.workerUrl=window.URL.createObjectURL(new Blob([o],{type:"text/javascript"})))}else n=r;else e=r}return r(0,(function(e){var n="2.4.1",i=r;function r(t,e,n,i){this.cx=3*t,this.bx=3*(n-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(i-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=i,this.p2x=n,this.p2y=i}r.prototype.sampleCurveX=function(t){return((this.ax*t+this.bx)*t+this.cx)*t},r.prototype.sampleCurveY=function(t){return((this.ay*t+this.by)*t+this.cy)*t},r.prototype.sampleCurveDerivativeX=function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},r.prototype.solveCurveX=function(t,e){var n,i,r,o,a;for(void 0===e&&(e=1e-6),r=t,a=0;a<8;a++){if(o=this.sampleCurveX(r)-t,Math.abs(o)(i=1))return i;for(;no?n=r:i=r,r=.5*(i-n)+n}return r},r.prototype.solve=function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))};var o=a;function a(t,e){this.x=t,this.y=e}a.prototype={clone:function(){return new a(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,n=t.y-this.y;return e*e+n*n},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[2]*this.x+t[3]*this.y;return this.x=t[0]*this.x+t[1]*this.y,this.y=e,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),n=Math.sin(t),i=n*this.x+e*this.y;return this.x=e*this.x-n*this.y,this.y=i,this},_rotateAround:function(t,e){var n=Math.cos(t),i=Math.sin(t),r=e.y+i*(this.x-e.x)+n*(this.y-e.y);return this.x=e.x+n*(this.x-e.x)-i*(this.y-e.y),this.y=r,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},a.convert=function(t){return t instanceof a?t:Array.isArray(t)?new a(t[0],t[1]):t};var s="undefined"!=typeof self?self:{};const l=Math.pow(2,53)-1,c=Math.PI/180,u=180/Math.PI;function h(t){return t*c}const d=[[0,0],[1,0],[1,1],[0,1]];function p(t){if(t<=0)return 0;if(t>=1)return 1;const e=t*t,n=e*t;return 4*(t<.5?n:3*(t-e)+n-.75)}function f(t,e,n,r){const o=new i(t,e,n,r);return function(t){return o.solve(t)}}const m=f(.25,.1,.25,1);function g(t,e,n){return Math.min(n,Math.max(e,t))}function _(t,e,n){const i=n-e,r=((t-e)%i+i)%i+e;return r===e?n:r}function v(t,e,n){if(!t.length)return n(null,[]);let i=t.length;const r=new Array(t.length);let o=null;t.forEach(((t,a)=>{e(t,((t,e)=>{t&&(o=t),r[a]=e,0==--i&&n(o,r)}))}))}function y(t){const e=[];for(const n in t)e.push(t[n]);return e}function x(t,...e){for(const n of e)for(const e in n)t[e]=n[e];return t}let b=1;function w(){return b++}function T(){return function t(e){return e?(e^16*Math.random()>>e/4).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,t)}()}function C(t){return t<=1?1:Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function E(t){return!!t&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(t)}function S(t,e){t.forEach((t=>{e[t]&&(e[t]=e[t].bind(e))}))}function A(t,e){return-1!==t.indexOf(e,t.length-e.length)}function k(t,e,n){const i={};for(const r in t)i[r]=e.call(n||this,t[r],r,t);return i}function I(t,e,n){const i={};for(const r in t)e.call(n||this,t[r],r,t)&&(i[r]=t[r]);return i}function M(t){return Array.isArray(t)?t.map(M):"object"==typeof t&&t?k(t,M):t}const P={};function D(t){P[t]||(P[t]=!0)}function z(t,e,n){return(n.y-t.y)*(e.x-t.x)>(e.y-t.y)*(n.x-t.x)}function O(t){let e=0;for(let n,i,r=0,o=t.length,a=o-1;r@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,((t,n,i,r)=>{const o=i||r;return e[n]=!o||o.toLowerCase(),""})),e["max-age"]){const t=parseInt(e["max-age"],10);isNaN(t)?delete e["max-age"]:e["max-age"]=t}return e}let F,$,B,N=null;function j(t){if(null==N){const e=t.navigator?t.navigator.userAgent:null;N=!!t.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return N}function U(t){try{const e=s[t];return e.setItem("_mapbox_test_",1),e.removeItem("_mapbox_test_"),!0}catch(t){return!1}}const V={now:()=>void 0!==B?B:s.performance.now(),setNow(t){B=t},restoreNow(){B=void 0},frame(t){const e=s.requestAnimationFrame(t);return{cancel:()=>s.cancelAnimationFrame(e)}},getImageData(t,e=0){const n=s.document.createElement("canvas"),i=n.getContext("2d");if(!i)throw new Error("failed to create canvas 2d context");return n.width=t.width,n.height=t.height,i.drawImage(t,0,0,t.width,t.height),i.getImageData(-e,-e,t.width+2*e,t.height+2*e)},resolveURL:t=>(F||(F=s.document.createElement("a")),F.href=t,F.href),get devicePixelRatio(){return s.devicePixelRatio},get prefersReducedMotion(){return!!s.matchMedia&&(null==$&&($=s.matchMedia("(prefers-reduced-motion: reduce)")),$.matches)}};let G;const q={API_URL:"https://api.mapbox.com",get API_URL_REGEX(){if(null==G){const e=/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i;try{G=null!=t.env.API_URL_REGEX?new RegExp(t.env.API_URL_REGEX):e}catch(t){G=e}}return G},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},Z={supported:!1,testSupport:function(t){!X&&W&&(K?Y(t):H=t)}};let H,W,X=!1,K=!1;function Y(t){const e=t.createTexture();t.bindTexture(t.TEXTURE_2D,e);try{if(t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,W),t.isContextLost())return;Z.supported=!0}catch(t){}t.deleteTexture(e),X=!0}s.document&&(W=s.document.createElement("img"),W.onload=function(){H&&Y(H),H=null,K=!0},W.onerror=function(){X=!0,H=null},W.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const J="01",Q="NO_ACCESS_TOKEN";function tt(t){return 0===t.indexOf("mapbox:")}function et(t){return q.API_URL_REGEX.test(t)}const nt=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function it(t){const e=t.match(nt);if(!e)throw new Error("Unable to parse URL object");return{protocol:e[1],authority:e[2],path:e[3]||"/",params:e[4]?e[4].split("&"):[]}}function rt(t){const e=t.params.length?`?${t.params.join("&")}`:"";return`${t.protocol}://${t.authority}${t.path}${e}`}function ot(t){if(!t)return null;const e=t.split(".");if(!e||3!==e.length)return null;try{return JSON.parse(decodeURIComponent(s.atob(e[1]).split("").map((t=>"%"+("00"+t.charCodeAt(0).toString(16)).slice(-2))).join("")))}catch(t){return null}}class at{constructor(t){this.type=t,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(t){const e=ot(q.ACCESS_TOKEN);let n="";return n=e&&e.u?s.btoa(encodeURIComponent(e.u).replace(/%([0-9A-F]{2})/g,((t,e)=>String.fromCharCode(Number("0x"+e))))):q.ACCESS_TOKEN||"",t?`mapbox.eventData.${t}:${n}`:`mapbox.eventData:${n}`}fetchEventData(){const t=U("localStorage"),e=this.getStorageKey(),n=this.getStorageKey("uuid");if(t)try{const t=s.localStorage.getItem(e);t&&(this.eventData=JSON.parse(t));const i=s.localStorage.getItem(n);i&&(this.anonId=i)}catch(t){D("Unable to read from LocalStorage")}}saveEventData(){const t=U("localStorage"),e=this.getStorageKey(),n=this.getStorageKey("uuid");if(t)try{s.localStorage.setItem(n,this.anonId),Object.keys(this.eventData).length>=1&&s.localStorage.setItem(e,JSON.stringify(this.eventData))}catch(t){D("Unable to write to LocalStorage")}}processRequests(t){}postEvent(t,e,i,r){if(!q.EVENTS_URL)return;const o=it(q.EVENTS_URL);o.params.push(`access_token=${r||q.ACCESS_TOKEN||""}`);const a={event:this.type,created:new Date(t).toISOString(),sdkIdentifier:"mapbox-gl-js",sdkVersion:n,skuId:J,userId:this.anonId},s=e?x(a,e):a,l={url:rt(o),headers:{"Content-Type":"text/plain"},body:JSON.stringify([s])};this.pendingRequest=At(l,(t=>{this.pendingRequest=null,i(t),this.saveEventData(),this.processRequests(r)}))}queueRequest(t,e){this.queue.push(t),this.processRequests(e)}}const st=new class extends at{constructor(t){super("appUserTurnstile"),this._customAccessToken=t}postTurnstileEvent(t,e){q.EVENTS_URL&&q.ACCESS_TOKEN&&Array.isArray(t)&&t.some((t=>tt(t)||et(t)))&&this.queueRequest(Date.now(),e)}processRequests(t){if(this.pendingRequest||0===this.queue.length)return;this.anonId&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();const e=ot(q.ACCESS_TOKEN),n=e?e.u:q.ACCESS_TOKEN;let i=n!==this.eventData.tokenU;E(this.anonId)||(this.anonId=T(),i=!0);const r=this.queue.shift();if(this.eventData.lastSuccess){const t=new Date(this.eventData.lastSuccess),e=new Date(r),n=(r-this.eventData.lastSuccess)/864e5;i=i||n>=1||n<-1||t.getDate()!==e.getDate()}else i=!0;if(!i)return this.processRequests();this.postEvent(r,{"enabled.telemetry":!1},(t=>{t||(this.eventData.lastSuccess=r,this.eventData.tokenU=n)}),t)}},lt=st.postTurnstileEvent.bind(st),ct=new class extends at{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(t,e,n,i){this.skuToken=e,this.errorCb=i,q.EVENTS_URL&&(n||q.ACCESS_TOKEN?this.queueRequest({id:t,timestamp:Date.now()},n):this.errorCb(new Error(Q)))}processRequests(t){if(this.pendingRequest||0===this.queue.length)return;const{id:e,timestamp:n}=this.queue.shift();e&&this.success[e]||(this.anonId||this.fetchEventData(),E(this.anonId)||(this.anonId=T()),this.postEvent(n,{skuToken:this.skuToken},(t=>{t?this.errorCb(t):e&&(this.success[e]=!0)}),t))}},ut=ct.postMapLoadEvent.bind(ct),ht=new class extends at{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(t,e,n,i){if(!q.API_URL||!q.SESSION_PATH)return;const r=it(q.API_URL+q.SESSION_PATH);r.params.push(`sku=${e||""}`),r.params.push(`access_token=${i||q.ACCESS_TOKEN||""}`);const o={url:rt(r),headers:{"Content-Type":"text/plain"}};this.pendingRequest=kt(o,(t=>{this.pendingRequest=null,n(t),this.saveEventData(),this.processRequests(i)}))}getSessionAPI(t,e,n,i){this.skuToken=e,this.errorCb=i,q.SESSION_PATH&&q.API_URL&&(n||q.ACCESS_TOKEN?this.queueRequest({id:t,timestamp:Date.now()},n):this.errorCb(new Error(Q)))}processRequests(t){if(this.pendingRequest||0===this.queue.length)return;const{id:e,timestamp:n}=this.queue.shift();e&&this.success[e]||this.getSession(n,this.skuToken,(t=>{t?this.errorCb(t):e&&(this.success[e]=!0)}),t)}},dt=ht.getSessionAPI.bind(ht),pt=new Set,ft="mapbox-tiles";let mt,gt,_t=500,vt=50;function yt(){s.caches&&!mt&&(mt=s.caches.open(ft))}function xt(t){const e=t.indexOf("?");return e<0?t:t.slice(0,e)}let bt=1/0;const wt={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};"function"==typeof Object.freeze&&Object.freeze(wt);class Tt extends Error{constructor(t,e,n){401===e&&et(n)&&(t+=": you may have provided an invalid Mapbox access token. See https://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes"),super(t),this.status=e,this.url=n}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}const Ct=R()?()=>self.worker&&self.worker.referrer:()=>("blob:"===s.location.protocol?s.parent:s).location.href,Et=function(t,e){if(!(/^file:/.test(n=t.url)||/^file:/.test(Ct())&&!/^\w+:/.test(n))){if(s.fetch&&s.Request&&s.AbortController&&s.Request.prototype.hasOwnProperty("signal"))return function(t,e){const n=new s.AbortController,i=new s.Request(t.url,{method:t.method||"GET",body:t.body,credentials:t.credentials,headers:t.headers,referrer:Ct(),signal:n.signal});let r=!1,o=!1;const a=(l=i.url).indexOf("sku=")>0&&et(l);var l;"json"===t.type&&i.headers.set("Accept","application/json");const c=(n,r,l)=>{if(o)return;if(n&&"SecurityError"!==n.message&&D(n),r&&l)return u(r);const c=Date.now();s.fetch(i).then((n=>{if(n.ok){const t=a?n.clone():null;return u(n,t,c)}return e(new Tt(n.statusText,n.status,t.url))})).catch((t=>{20!==t.code&&e(new Error(t.message))}))},u=(n,a,l)=>{("arrayBuffer"===t.type?n.arrayBuffer():"json"===t.type?n.json():n.text()).then((t=>{o||(a&&l&&function(t,e,n){if(yt(),!mt)return;const i={status:e.status,statusText:e.statusText,headers:new s.Headers};e.headers.forEach(((t,e)=>i.headers.set(e,t)));const r=L(e.headers.get("Cache-Control")||"");r["no-store"]||(r["max-age"]&&i.headers.set("Expires",new Date(n+1e3*r["max-age"]).toUTCString()),new Date(i.headers.get("Expires")).getTime()-n<42e4||function(t,e){if(void 0===gt)try{new Response(new ReadableStream),gt=!0}catch(t){gt=!1}gt?e(t.body):t.blob().then(e)}(e,(e=>{const n=new s.Response(e,i);yt(),mt&&mt.then((e=>e.put(xt(t.url),n))).catch((t=>D(t.message)))})))}(i,a,l),r=!0,e(null,t,n.headers.get("Cache-Control"),n.headers.get("Expires")))})).catch((t=>{o||e(new Error(t.message))}))};return a?function(t,e){if(yt(),!mt)return e(null);const n=xt(t.url);mt.then((t=>{t.match(n).then((i=>{const r=function(t){if(!t)return!1;const e=new Date(t.headers.get("Expires")||0),n=L(t.headers.get("Cache-Control")||"");return e>Date.now()&&!n["no-cache"]}(i);t.delete(n),r&&t.put(n,i.clone()),e(null,i,r)})).catch(e)})).catch(e)}(i,c):c(null,null),{cancel:()=>{o=!0,r||n.abort()}}}(t,e);if(R()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",t,e,void 0,!0)}var n;return function(t,e){const n=new s.XMLHttpRequest;n.open(t.method||"GET",t.url,!0),"arrayBuffer"===t.type&&(n.responseType="arraybuffer");for(const e in t.headers)n.setRequestHeader(e,t.headers[e]);return"json"===t.type&&(n.responseType="text",n.setRequestHeader("Accept","application/json")),n.withCredentials="include"===t.credentials,n.onerror=()=>{e(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"===t.type)try{i=JSON.parse(n.response)}catch(t){return e(t)}e(null,i,n.getResponseHeader("Cache-Control"),n.getResponseHeader("Expires"))}else e(new Tt(n.statusText,n.status,t.url))},n.send(t.body),{cancel:()=>n.abort()}}(t,e)},St=function(t,e){return Et(x(t,{type:"arrayBuffer"}),e)},At=function(t,e){return Et(x(t,{method:"POST"}),e)},kt=function(t,e){return Et(x(t,{method:"GET"}),e)};function It(t){const e=s.document.createElement("a");return e.href=t,e.protocol===s.document.location.protocol&&e.host===s.document.location.host}const Mt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let Pt,Dt;Pt=[],Dt=0;const zt=function(t,e){if(Z.supported&&(t.headers||(t.headers={}),t.headers.accept="image/webp,*/*"),Dt>=q.MAX_PARALLEL_IMAGE_REQUESTS){const n={requestParameters:t,callback:e,cancelled:!1,cancel(){this.cancelled=!0}};return Pt.push(n),n}Dt++;let n=!1;const i=()=>{if(!n)for(n=!0,Dt--;Pt.length&&Dt{i(),t?e(t):n&&(s.createImageBitmap?function(t,e){const n=new s.Blob([new Uint8Array(t)],{type:"image/png"});s.createImageBitmap(n).then((t=>{e(null,t)})).catch((t=>{e(new Error(`Could not load image because of ${t.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))}))}(n,((t,n)=>e(t,n,r,o))):function(t,e){const n=new s.Image,i=s.URL;n.onload=()=>{e(null,n),i.revokeObjectURL(n.src),n.onload=null,s.requestAnimationFrame((()=>{n.src=Mt}))},n.onerror=()=>e(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const r=new s.Blob([new Uint8Array(t)],{type:"image/png"});n.src=t.byteLength?i.createObjectURL(r):Mt}(n,((t,n)=>e(t,n,r,o))))}));return{cancel:()=>{r.cancel(),i()}}};function Ot(t,e,n){n[t]&&-1!==n[t].indexOf(e)||(n[t]=n[t]||[],n[t].push(e))}function Rt(t,e,n){if(n&&n[t]){const i=n[t].indexOf(e);-1!==i&&n[t].splice(i,1)}}class Lt{constructor(t,e={}){x(this,e),this.type=t}}class Ft extends Lt{constructor(t,e={}){super("error",x({error:t},e))}}class $t{on(t,e){return this._listeners=this._listeners||{},Ot(t,e,this._listeners),this}off(t,e){return Rt(t,e,this._listeners),Rt(t,e,this._oneTimeListeners),this}once(t,e){return e?(this._oneTimeListeners=this._oneTimeListeners||{},Ot(t,e,this._oneTimeListeners),this):new Promise((e=>this.once(t,e)))}fire(t,e){"string"==typeof t&&(t=new Lt(t,e||{}));const n=t.type;if(this.listens(n)){t.target=this;const e=this._listeners&&this._listeners[n]?this._listeners[n].slice():[];for(const n of e)n.call(this,t);const i=this._oneTimeListeners&&this._oneTimeListeners[n]?this._oneTimeListeners[n].slice():[];for(const e of i)Rt(n,e,this._oneTimeListeners),e.call(this,t);const r=this._eventedParent;r&&(x(t,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),r.fire(t))}return this}listens(t){return!!(this._listeners&&this._listeners[t]&&this._listeners[t].length>0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t))}setEventedParent(t,e){return this._eventedParent=t,this._eventedParentData=e,this}}var Bt={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},terrain:{type:"terrain"},fog:{type:"fog"},sources:{required:!0,type:"sources"},sprite:{type:"string"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{}},default:"mapbox"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{},sky:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background","layout_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:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},fog:{range:{type:"array",default:[.5,10],minimum:-20,maximum:20,length:2,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-blend":{type:"number","property-type":"data-constant",default:.1,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number","property-type":"data-constant",default:1,minimum:0,maximum:1e3,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background","paint_sky"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_sky:{"sky-type":{type:"enum",values:{gradient:{},atmosphere:{}},default:"atmosphere",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun":{type:"array",value:"number",length:2,units:"degrees",minimum:[0,0],maximum:[360,180],transition:!1,requires:[{"sky-type":"atmosphere"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun-intensity":{type:"number",requires:[{"sky-type":"atmosphere"}],default:10,minimum:0,maximum:100,transition:!1,"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:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"sky-gradient-radius":{type:"number",requires:[{"sky-type":"gradient"}],default:90,minimum:0,maximum:180,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"sky-gradient":{type:"color",default:["interpolate",["linear"],["sky-radial-progress"],.8,"#87ceeb",1,"white"],transition:!1,requires:[{"sky-type":"gradient"}],expression:{interpolated:!0,parameters:["sky-radial-progress"]},"property-type":"color-ramp"},"sky-atmosphere-halo-color":{type:"color",default:"white",transition:!1,requires:[{"sky-type":"atmosphere"}],"property-type":"data-constant"},"sky-atmosphere-color":{type:"color",default:"white",transition:!1,requires:[{"sky-type":"atmosphere"}],"property-type":"data-constant"},"sky-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};class Nt{constructor(t,e,n,i){this.message=(t?`${t}: `:"")+n,i&&(this.identifier=i),null!=e&&e.__line__&&(this.line=e.__line__)}}function jt(t){const e=t.value;return e?[new Nt(t.key,e,"constants have been deprecated as of v8")]:[]}function Ut(t,...e){for(const n of e)for(const e in n)t[e]=n[e];return t}function Vt(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function Gt(t){if(Array.isArray(t))return t.map(Gt);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){const e={};for(const n in t)e[n]=Gt(t[n]);return e}return Vt(t)}class qt extends Error{constructor(t,e){super(e),this.message=e,this.key=t}}class Zt{constructor(t,e=[]){this.parent=t,this.bindings={};for(const[t,n]of e)this.bindings[t]=n}concat(t){return new Zt(this,t)}get(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw new Error(`${t} not found in scope.`)}has(t){return!!this.bindings[t]||!!this.parent&&this.parent.has(t)}}const Ht={kind:"null"},Wt={kind:"number"},Xt={kind:"string"},Kt={kind:"boolean"},Yt={kind:"color"},Jt={kind:"object"},Qt={kind:"value"},te={kind:"collator"},ee={kind:"formatted"},ne={kind:"resolvedImage"};function ie(t,e){return{kind:"array",itemType:t,N:e}}function re(t){if("array"===t.kind){const e=re(t.itemType);return"number"==typeof t.N?`array<${e}, ${t.N}>`:"value"===t.itemType.kind?"array":`array<${e}>`}return t.kind}const oe=[Ht,Wt,Xt,Kt,Yt,ee,Jt,ie(Qt),ne];function ae(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&(0===e.N&&"value"===e.itemType.kind||!ae(t.itemType,e.itemType))&&("number"!=typeof t.N||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if("value"===t.kind)for(const t of oe)if(!ae(t,e))return null}return`Expected ${re(t)} but found ${re(e)} instead.`}function se(t,e){return e.some((e=>e.kind===t.kind))}function le(t,e){return e.some((e=>"null"===e?null===t:"array"===e?Array.isArray(t):"object"===e?t&&!Array.isArray(t)&&"object"==typeof t:e===typeof t))}function ce(t){var e={exports:{}};return t(e,e.exports),e.exports}var ue=ce((function(t,e){var n={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 i(t){return(t=Math.round(t))<0?0:t>255?255:t}function r(t){return i("%"===t[t.length-1]?parseFloat(t)/100*255:parseInt(t))}function o(t){return(e="%"===t[t.length-1]?parseFloat(t)/100:parseFloat(t))<0?0:e>1?1:e;var e}function a(t,e,n){return n<0?n+=1:n>1&&(n-=1),6*n<1?t+(e-t)*n*6:2*n<1?e:3*n<2?t+(e-t)*(2/3-n)*6:t}try{e.parseCSSColor=function(t){var e,s=t.replace(/ /g,"").toLowerCase();if(s in n)return n[s].slice();if("#"===s[0])return 4===s.length?(e=parseInt(s.substr(1),16))>=0&&e<=4095?[(3840&e)>>4|(3840&e)>>8,240&e|(240&e)>>4,15&e|(15&e)<<4,1]:null:7===s.length&&(e=parseInt(s.substr(1),16))>=0&&e<=16777215?[(16711680&e)>>16,(65280&e)>>8,255&e,1]:null;var l=s.indexOf("("),c=s.indexOf(")");if(-1!==l&&c+1===s.length){var u=s.substr(0,l),h=s.substr(l+1,c-(l+1)).split(","),d=1;switch(u){case"rgba":if(4!==h.length)return null;d=o(h.pop());case"rgb":return 3!==h.length?null:[r(h[0]),r(h[1]),r(h[2]),d];case"hsla":if(4!==h.length)return null;d=o(h.pop());case"hsl":if(3!==h.length)return null;var p=(parseFloat(h[0])%360+360)%360/360,f=o(h[1]),m=o(h[2]),g=m<=.5?m*(f+1):m+f-m*f,_=2*m-g;return[i(255*a(_,g,p+1/3)),i(255*a(_,g,p)),i(255*a(_,g,p-1/3)),d];default:return null}}return null}}catch(t){}}));class he{constructor(t,e,n,i=1){this.r=t,this.g=e,this.b=n,this.a=i}static parse(t){if(!t)return;if(t instanceof he)return t;if("string"!=typeof t)return;const e=ue.parseCSSColor(t);return e?new he(e[0]/255*e[3],e[1]/255*e[3],e[2]/255*e[3],e[3]):void 0}toString(){const[t,e,n,i]=this.toArray();return`rgba(${Math.round(t)},${Math.round(e)},${Math.round(n)},${i})`}toArray(){const{r:t,g:e,b:n,a:i}=this;return 0===i?[0,0,0,0]:[255*t/i,255*e/i,255*n/i,i]}}he.black=new he(0,0,0,1),he.white=new he(1,1,1,1),he.transparent=new he(0,0,0,0),he.red=new he(1,0,0,1),he.blue=new he(0,0,1,1);class de{constructor(t,e,n){this.sensitivity=t?e?"variant":"case":e?"accent":"base",this.locale=n,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,e){return this.collator.compare(t,e)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class pe{constructor(t,e,n,i,r){this.text=t,this.image=e,this.scale=n,this.fontStack=i,this.textColor=r}}class fe{constructor(t){this.sections=t}static fromString(t){return new fe([new pe(t,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some((t=>0!==t.text.length||t.image&&0!==t.image.name.length))}static factory(t){return t instanceof fe?t:fe.fromString(t)}toString(){return 0===this.sections.length?"":this.sections.map((t=>t.text)).join("")}serialize(){const t=["format"];for(const e of this.sections){if(e.image){t.push(["image",e.image.name]);continue}t.push(e.text);const n={};e.fontStack&&(n["text-font"]=["literal",e.fontStack.split(",")]),e.scale&&(n["font-scale"]=e.scale),e.textColor&&(n["text-color"]=["rgba"].concat(e.textColor.toArray())),t.push(n)}return t}}class me{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new me({name:t,available:!1}):null}serialize(){return["image",this.name]}}function ge(t,e,n,i){return"number"==typeof t&&t>=0&&t<=255&&"number"==typeof e&&e>=0&&e<=255&&"number"==typeof n&&n>=0&&n<=255?void 0===i||"number"==typeof i&&i>=0&&i<=1?null:`Invalid rgba value [${[t,e,n,i].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof i?[t,e,n,i]:[t,e,n]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function _e(t){if(null===t)return!0;if("string"==typeof t)return!0;if("boolean"==typeof t)return!0;if("number"==typeof t)return!0;if(t instanceof he)return!0;if(t instanceof de)return!0;if(t instanceof fe)return!0;if(t instanceof me)return!0;if(Array.isArray(t)){for(const e of t)if(!_e(e))return!1;return!0}if("object"==typeof t){for(const e in t)if(!_e(t[e]))return!1;return!0}return!1}function ve(t){if(null===t)return Ht;if("string"==typeof t)return Xt;if("boolean"==typeof t)return Kt;if("number"==typeof t)return Wt;if(t instanceof he)return Yt;if(t instanceof de)return te;if(t instanceof fe)return ee;if(t instanceof me)return ne;if(Array.isArray(t)){const e=t.length;let n;for(const e of t){const t=ve(e);if(n){if(n===t)continue;n=Qt;break}n=t}return ie(n||Qt,e)}return Jt}function ye(t){const e=typeof t;return null===t?"":"string"===e||"number"===e||"boolean"===e?String(t):t instanceof he||t instanceof fe||t instanceof me?t.toString():JSON.stringify(t)}class xe{constructor(t,e){this.type=t,this.value=e}static parse(t,e){if(2!==t.length)return e.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!_e(t[1]))return e.error("invalid value");const n=t[1];let i=ve(n);const r=e.expectedType;return"array"!==i.kind||0!==i.N||!r||"array"!==r.kind||"number"==typeof r.N&&0!==r.N||(i=r),new xe(i,n)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return"array"===this.type.kind||"object"===this.type.kind?["literal",this.value]:this.value instanceof he?["rgba"].concat(this.value.toArray()):this.value instanceof fe?this.value.serialize():this.value}}class be{constructor(t){this.name="ExpressionEvaluationError",this.message=t}toJSON(){return this.message}}const we={string:Xt,number:Wt,boolean:Kt,object:Jt};class Te{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");let n,i=1;const r=t[0];if("array"===r){let r,o;if(t.length>2){const n=t[1];if("string"!=typeof n||!(n in we)||"object"===n)return e.error('The item type argument of "array" must be one of string, number, boolean',1);r=we[n],i++}else r=Qt;if(t.length>3){if(null!==t[2]&&("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2])))return e.error('The length argument to "array" must be a positive integer literal',2);o=t[2],i++}n=ie(r,o)}else n=we[r];const o=[];for(;it.outputDefined()))}serialize(){const t=this.type,e=[t.kind];if("array"===t.kind){const n=t.itemType;if("string"===n.kind||"number"===n.kind||"boolean"===n.kind){e.push(n.kind);const i=t.N;("number"==typeof i||this.args.length>1)&&e.push(i)}}return e.concat(this.args.map((t=>t.serialize())))}}class Ce{constructor(t){this.type=ee,this.sections=t}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const n=t[1];if(!Array.isArray(n)&&"object"==typeof n)return e.error("First argument must be an image or text section.");const i=[];let r=!1;for(let n=1;n<=t.length-1;++n){const o=t[n];if(r&&"object"==typeof o&&!Array.isArray(o)){r=!1;let t=null;if(o["font-scale"]&&(t=e.parse(o["font-scale"],1,Wt),!t))return null;let n=null;if(o["text-font"]&&(n=e.parse(o["text-font"],1,ie(Xt)),!n))return null;let a=null;if(o["text-color"]&&(a=e.parse(o["text-color"],1,Yt),!a))return null;const s=i[i.length-1];s.scale=t,s.font=n,s.textColor=a}else{const o=e.parse(t[n],1,Qt);if(!o)return null;const a=o.type.kind;if("string"!==a&&"value"!==a&&"null"!==a&&"resolvedImage"!==a)return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");r=!0,i.push({content:o,scale:null,font:null,textColor:null})}}return new Ce(i)}evaluate(t){return new fe(this.sections.map((e=>{const n=e.content.evaluate(t);return ve(n)===ne?new pe("",n,null,null,null):new pe(ye(n),null,e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(","):null,e.textColor?e.textColor.evaluate(t):null)})))}eachChild(t){for(const e of this.sections)t(e.content),e.scale&&t(e.scale),e.font&&t(e.font),e.textColor&&t(e.textColor)}outputDefined(){return!1}serialize(){const t=["format"];for(const e of this.sections){t.push(e.content.serialize());const n={};e.scale&&(n["font-scale"]=e.scale.serialize()),e.font&&(n["text-font"]=e.font.serialize()),e.textColor&&(n["text-color"]=e.textColor.serialize()),t.push(n)}return t}}class Ee{constructor(t){this.type=ne,this.input=t}static parse(t,e){if(2!==t.length)return e.error("Expected two arguments.");const n=e.parse(t[1],1,Xt);return n?new Ee(n):e.error("No image name provided.")}evaluate(t){const e=this.input.evaluate(t),n=me.fromString(e);return n&&t.availableImages&&(n.available=t.availableImages.indexOf(e)>-1),n}eachChild(t){t(this.input)}outputDefined(){return!1}serialize(){return["image",this.input.serialize()]}}const Se={"to-boolean":Kt,"to-color":Yt,"to-number":Wt,"to-string":Xt};class Ae{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const n=t[0];if(("to-boolean"===n||"to-string"===n)&&2!==t.length)return e.error("Expected one argument.");const i=Se[n],r=[];for(let n=1;n4?`Invalid rbga value ${JSON.stringify(e)}: expected an array containing either three or four numeric values.`:ge(e[0],e[1],e[2],e[3]),!n))return new he(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new be(n||`Could not parse color from value '${"string"==typeof e?e:String(JSON.stringify(e))}'`)}if("number"===this.type.kind){let e=null;for(const n of this.args){if(e=n.evaluate(t),null===e)return 0;const i=Number(e);if(!isNaN(i))return i}throw new be(`Could not convert ${JSON.stringify(e)} to number.`)}return"formatted"===this.type.kind?fe.fromString(ye(this.args[0].evaluate(t))):"resolvedImage"===this.type.kind?me.fromString(ye(this.args[0].evaluate(t))):ye(this.args[0].evaluate(t))}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}serialize(){if("formatted"===this.type.kind)return new Ce([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if("resolvedImage"===this.type.kind)return new Ee(this.args[0]).serialize();const t=[`to-${this.type.kind}`];return this.eachChild((e=>{t.push(e.serialize())})),t}}const ke=["Unknown","Point","LineString","Polygon"];class Ie{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?ke[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||{}}parseColor(t){let e=this._parseColorCache[t];return e||(e=this._parseColorCache[t]=he.parse(t)),e}}class Me{constructor(t,e,n,i){this.name=t,this.type=e,this._evaluate=n,this.args=i}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map((t=>t.serialize())))}static parse(t,e){const n=t[0],i=Me.definitions[n];if(!i)return e.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0);const r=Array.isArray(i)?i[0]:i.type,o=Array.isArray(i)?[[i[1],i[2]]]:i.overloads,a=o.filter((([e])=>!Array.isArray(e)||e.length===t.length-1));let s=null;for(const[i,o]of a){s=new Qe(e.registry,e.path,null,e.scope);const a=[];let l=!1;for(let e=1;e{return e=t,Array.isArray(e)?`(${e.map(re).join(", ")})`:`(${re(e.type)}...)`;var e})).join(" | "),i=[];for(let n=1;n=e[2]||t[1]<=e[1]||t[3]>=e[3])}function Re(t,e){const n=(180+t[0])/360,i=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t[1]*Math.PI/360)))/360,r=Math.pow(2,e.z);return[Math.round(n*r*De),Math.round(i*r*De)]}function Le(t,e,n){const i=t[0]-e[0],r=t[1]-e[1],o=t[0]-n[0],a=t[1]-n[1];return i*a-o*r==0&&i*o<=0&&r*a<=0}function Fe(t,e){let n=!1;for(let a=0,s=e.length;a(i=t)[1]!=(o=s[e+1])[1]>i[1]&&i[0]<(o[0]-r[0])*(i[1]-r[1])/(o[1]-r[1])+r[0]&&(n=!n)}}var i,r,o;return n}function $e(t,e){for(let n=0;n0&&s<0||a<0&&s>0}function Ne(t,e,n){for(const c of n)for(let n=0;nn[2]){const e=.5*i;let r=t[0]-n[0]>e?-i:n[0]-t[0]>e?i:0;0===r&&(r=t[0]-n[2]>e?-i:n[2]-t[0]>e?i:0),t[0]+=r}ze(e,t)}function Ze(t,e,n,i){const r=Math.pow(2,i.z)*De,o=[i.x*De,i.y*De],a=[];for(const i of t)for(const t of i){const i=[t.x+o[0],t.y+o[1]];qe(i,e,n,r),a.push(i)}return a}function He(t,e,n,i){const r=Math.pow(2,i.z)*De,o=[i.x*De,i.y*De],a=[];for(const n of t){const t=[];for(const i of n){const n=[i.x+o[0],i.y+o[1]];ze(e,n),t.push(n)}a.push(t)}if(e[2]-e[0]<=r/2){(s=e)[0]=s[1]=1/0,s[2]=s[3]=-1/0;for(const t of a)for(const i of t)qe(i,e,n,r)}var s;return a}class We{constructor(t,e){this.type=Kt,this.geojson=t,this.geometries=e}static parse(t,e){if(2!==t.length)return e.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(_e(t[1])){const e=t[1];if("FeatureCollection"===e.type)for(let t=0;t{e&&!Xe(t)&&(e=!1)})),e}function Ke(t){if(t instanceof Me&&"feature-state"===t.name)return!1;let e=!0;return t.eachChild((t=>{e&&!Ke(t)&&(e=!1)})),e}function Ye(t,e){if(t instanceof Me&&e.indexOf(t.name)>=0)return!1;let n=!0;return t.eachChild((t=>{n&&!Ye(t,e)&&(n=!1)})),n}class Je{constructor(t,e){this.type=e.type,this.name=t,this.boundExpression=e}static parse(t,e){if(2!==t.length||"string"!=typeof t[1])return e.error("'var' expression requires exactly one string literal argument.");const n=t[1];return e.scope.has(n)?new Je(n,e.scope.get(n)):e.error(`Unknown variable "${n}". Make sure "${n}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}class Qe{constructor(t,e=[],n,i=new Zt,r=[]){this.registry=t,this.path=e,this.key=e.map((t=>`[${t}]`)).join(""),this.scope=i,this.errors=r,this.expectedType=n}parse(t,e,n,i,r={}){return e?this.concat(e,n,i)._parse(t,r):this._parse(t,r)}_parse(t,e){function n(t,e,n){return"assert"===n?new Te(e,[t]):"coerce"===n?new Ae(e,[t]):t}if(null!==t&&"string"!=typeof t&&"boolean"!=typeof t&&"number"!=typeof t||(t=["literal",t]),Array.isArray(t)){if(0===t.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const i=t[0];if("string"!=typeof i)return this.error(`Expression name must be a string, but found ${typeof i} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const r=this.registry[i];if(r){let i=r.parse(t,this);if(!i)return null;if(this.expectedType){const t=this.expectedType,r=i.type;if("string"!==t.kind&&"number"!==t.kind&&"boolean"!==t.kind&&"object"!==t.kind&&"array"!==t.kind||"value"!==r.kind)if("color"!==t.kind&&"formatted"!==t.kind&&"resolvedImage"!==t.kind||"value"!==r.kind&&"string"!==r.kind){if(this.checkSubtype(t,r))return null}else i=n(i,t,e.typeAnnotation||"coerce");else i=n(i,t,e.typeAnnotation||"assert")}if(!(i instanceof xe)&&"resolvedImage"!==i.type.kind&&tn(i)){const e=new Ie;try{i=new xe(i.type,i.evaluate(e))}catch(t){return this.error(t.message),null}}return i}return this.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(void 0===t?"'undefined' value invalid. Use null instead.":"object"==typeof t?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof t} instead.`)}concat(t,e,n){const i="number"==typeof t?this.path.concat(t):this.path,r=n?this.scope.concat(n):this.scope;return new Qe(this.registry,i,e||null,r,this.errors)}error(t,...e){const n=`${this.key}${e.map((t=>`[${t}]`)).join("")}`;this.errors.push(new qt(n,t))}checkSubtype(t,e){const n=ae(t,e);return n&&this.error(n),n}}function tn(t){if(t instanceof Je)return tn(t.boundExpression);if(t instanceof Me&&"error"===t.name)return!1;if(t instanceof Pe)return!1;if(t instanceof We)return!1;const e=t instanceof Ae||t instanceof Te;let n=!0;return t.eachChild((t=>{n=e?n&&tn(t):n&&t instanceof xe})),!!n&&Xe(t)&&Ye(t,["zoom","heatmap-density","line-progress","sky-radial-progress","accumulated","is-supported-script"])}function en(t,e){const n=t.length-1;let i,r,o=0,a=n,s=0;for(;o<=a;)if(s=Math.floor((o+a)/2),i=t[s],r=t[s+1],i<=e){if(s===n||ee))throw new be("Input is not a number.");a=s-1}return 0}class nn{constructor(t,e,n){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(const[t,e]of n)this.labels.push(t),this.outputs.push(e)}static parse(t,e){if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");const n=e.parse(t[1],1,Wt);if(!n)return null;const i=[];let r=null;e.expectedType&&"value"!==e.expectedType.kind&&(r=e.expectedType);for(let n=1;n=o)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',s);const c=e.parse(a,l,r);if(!c)return null;r=r||c.type,i.push([o,c])}return new nn(r,n,i)}evaluate(t){const e=this.labels,n=this.outputs;if(1===e.length)return n[0].evaluate(t);const i=this.input.evaluate(t);if(i<=e[0])return n[0].evaluate(t);const r=e.length;return i>=e[r-1]?n[r-1].evaluate(t):n[en(e,i)].evaluate(t)}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}serialize(){const t=["step",this.input.serialize()];for(let e=0;e0&&t.push(this.labels[e]),t.push(this.outputs[e].serialize());return t}}function rn(t,e,n){return t*(1-n)+e*n}var on=Object.freeze({__proto__:null,number:rn,color:function(t,e,n){return new he(rn(t.r,e.r,n),rn(t.g,e.g,n),rn(t.b,e.b,n),rn(t.a,e.a,n))},array:function(t,e,n){return t.map(((t,i)=>rn(t,e[i],n)))}});const an=.95047,sn=1.08883,ln=4/29,cn=6/29,un=3*cn*cn,hn=Math.PI/180,dn=180/Math.PI;function pn(t){return t>.008856451679035631?Math.pow(t,1/3):t/un+ln}function fn(t){return t>cn?t*t*t:un*(t-ln)}function mn(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function gn(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function _n(t){const e=gn(t.r),n=gn(t.g),i=gn(t.b),r=pn((.4124564*e+.3575761*n+.1804375*i)/an),o=pn((.2126729*e+.7151522*n+.072175*i)/1);return{l:116*o-16,a:500*(r-o),b:200*(o-pn((.0193339*e+.119192*n+.9503041*i)/sn)),alpha:t.a}}function vn(t){let e=(t.l+16)/116,n=isNaN(t.a)?e:e+t.a/500,i=isNaN(t.b)?e:e-t.b/200;return e=1*fn(e),n=an*fn(n),i=sn*fn(i),new he(mn(3.2404542*n-1.5371385*e-.4985314*i),mn(-.969266*n+1.8760108*e+.041556*i),mn(.0556434*n-.2040259*e+1.0572252*i),t.alpha)}function yn(t,e,n){const i=e-t;return t+n*(i>180||i<-180?i-360*Math.round(i/360):i)}const xn={forward:_n,reverse:vn,interpolate:function(t,e,n){return{l:rn(t.l,e.l,n),a:rn(t.a,e.a,n),b:rn(t.b,e.b,n),alpha:rn(t.alpha,e.alpha,n)}}},bn={forward:function(t){const{l:e,a:n,b:i}=_n(t),r=Math.atan2(i,n)*dn;return{h:r<0?r+360:r,c:Math.sqrt(n*n+i*i),l:e,alpha:t.a}},reverse:function(t){const e=t.h*hn,n=t.c;return vn({l:t.l,a:Math.cos(e)*n,b:Math.sin(e)*n,alpha:t.alpha})},interpolate:function(t,e,n){return{h:yn(t.h,e.h,n),c:rn(t.c,e.c,n),l:rn(t.l,e.l,n),alpha:rn(t.alpha,e.alpha,n)}}};var wn=Object.freeze({__proto__:null,lab:xn,hcl:bn});class Tn{constructor(t,e,n,i,r){this.type=t,this.operator=e,this.interpolation=n,this.input=i,this.labels=[],this.outputs=[];for(const[t,e]of r)this.labels.push(t),this.outputs.push(e)}static interpolationFactor(t,e,n,r){let o=0;if("exponential"===t.name)o=Cn(e,t.base,n,r);else if("linear"===t.name)o=Cn(e,1,n,r);else if("cubic-bezier"===t.name){const a=t.controlPoints;o=new i(a[0],a[1],a[2],a[3]).solve(Cn(e,1,n,r))}return o}static parse(t,e){let[n,i,r,...o]=t;if(!Array.isArray(i)||0===i.length)return e.error("Expected an interpolation type expression.",1);if("linear"===i[0])i={name:"linear"};else if("exponential"===i[0]){const t=i[1];if("number"!=typeof t)return e.error("Exponential interpolation requires a numeric base.",1,1);i={name:"exponential",base:t}}else{if("cubic-bezier"!==i[0])return e.error(`Unknown interpolation type ${String(i[0])}`,1,0);{const t=i.slice(1);if(4!==t.length||t.some((t=>"number"!=typeof t||t<0||t>1)))return e.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);i={name:"cubic-bezier",controlPoints:t}}}if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");if(r=e.parse(r,2,Wt),!r)return null;const a=[];let s=null;"interpolate-hcl"===n||"interpolate-lab"===n?s=Yt:e.expectedType&&"value"!==e.expectedType.kind&&(s=e.expectedType);for(let t=0;t=n)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',r);const c=e.parse(i,l,s);if(!c)return null;s=s||c.type,a.push([n,c])}return"number"===s.kind||"color"===s.kind||"array"===s.kind&&"number"===s.itemType.kind&&"number"==typeof s.N?new Tn(s,n,i,r,a):e.error(`Type ${re(s)} is not interpolatable.`)}evaluate(t){const e=this.labels,n=this.outputs;if(1===e.length)return n[0].evaluate(t);const i=this.input.evaluate(t);if(i<=e[0])return n[0].evaluate(t);const r=e.length;if(i>=e[r-1])return n[r-1].evaluate(t);const o=en(e,i),a=Tn.interpolationFactor(this.interpolation,i,e[o],e[o+1]),s=n[o].evaluate(t),l=n[o+1].evaluate(t);return"interpolate"===this.operator?on[this.type.kind.toLowerCase()](s,l,a):"interpolate-hcl"===this.operator?bn.reverse(bn.interpolate(bn.forward(s),bn.forward(l),a)):xn.reverse(xn.interpolate(xn.forward(s),xn.forward(l),a))}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}serialize(){let t;t="linear"===this.interpolation.name?["linear"]:"exponential"===this.interpolation.name?1===this.interpolation.base?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier"].concat(this.interpolation.controlPoints);const e=[this.operator,t,this.input.serialize()];for(let t=0;tae(i,t.type)));return new En(o?Qt:n,r)}evaluate(t){let e,n=null,i=0;for(const r of this.args)if(i++,n=r.evaluate(t),n&&n instanceof me&&!n.available&&(e||(e=n.name),n=null,i===this.args.length&&(n=e)),null!==n)break;return n}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}serialize(){const t=["coalesce"];return this.eachChild((e=>{t.push(e.serialize())})),t}}class Sn{constructor(t,e){this.type=e.type,this.bindings=[].concat(t),this.result=e}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(const e of this.bindings)t(e[1]);t(this.result)}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);const n=[];for(let i=1;i=n.length)throw new be(`Array index out of bounds: ${e} > ${n.length-1}.`);if(e!==Math.floor(e))throw new be(`Array index must be an integer, but found ${e} instead.`);return n[e]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class kn{constructor(t,e){this.type=Kt,this.needle=t,this.haystack=e}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const n=e.parse(t[1],1,Qt),i=e.parse(t[2],2,Qt);return n&&i?se(n.type,[Kt,Xt,Wt,Ht,Qt])?new kn(n,i):e.error(`Expected first argument to be of type boolean, string, number or null, but found ${re(n.type)} instead`):null}evaluate(t){const e=this.needle.evaluate(t),n=this.haystack.evaluate(t);if(!n)return!1;if(!le(e,["boolean","string","number","null"]))throw new be(`Expected first argument to be of type boolean, string, number or null, but found ${re(ve(e))} instead.`);if(!le(n,["string","array"]))throw new be(`Expected second argument to be of type array or string, but found ${re(ve(n))} instead.`);return n.indexOf(e)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}class In{constructor(t,e,n){this.type=Wt,this.needle=t,this.haystack=e,this.fromIndex=n}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const n=e.parse(t[1],1,Qt),i=e.parse(t[2],2,Qt);if(!n||!i)return null;if(!se(n.type,[Kt,Xt,Wt,Ht,Qt]))return e.error(`Expected first argument to be of type boolean, string, number or null, but found ${re(n.type)} instead`);if(4===t.length){const r=e.parse(t[3],3,Wt);return r?new In(n,i,r):null}return new In(n,i)}evaluate(t){const e=this.needle.evaluate(t),n=this.haystack.evaluate(t);if(!le(e,["boolean","string","number","null"]))throw new be(`Expected first argument to be of type boolean, string, number or null, but found ${re(ve(e))} instead.`);if(!le(n,["string","array"]))throw new be(`Expected second argument to be of type array or string, but found ${re(ve(n))} instead.`);if(this.fromIndex){const i=this.fromIndex.evaluate(t);return n.indexOf(e,i)}return n.indexOf(e)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}serialize(){if(null!=this.fromIndex&&void 0!==this.fromIndex){const t=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),t]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}class Mn{constructor(t,e,n,i,r,o){this.inputType=t,this.type=e,this.input=n,this.cases=i,this.outputs=r,this.otherwise=o}static parse(t,e){if(t.length<5)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return e.error("Expected an even number of arguments.");let n,i;e.expectedType&&"value"!==e.expectedType.kind&&(i=e.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 t&&Math.floor(t)!==t)return c.error("Numeric branch labels must be integer values.");if(n){if(c.checkSubtype(n,ve(t)))return null}else n=ve(t);if(void 0!==r[String(t)])return c.error("Branch labels must be unique.");r[String(t)]=o.length}const u=e.parse(l,a,i);if(!u)return null;i=i||u.type,o.push(u)}const a=e.parse(t[1],1,Qt);if(!a)return null;const s=e.parse(t[t.length-1],t.length-1,i);return s?"value"!==a.type.kind&&e.concat(1).checkSubtype(n,a.type)?null:new Mn(n,i,a,r,o,s):null}evaluate(t){const e=this.input.evaluate(t);return(ve(e)===this.inputType&&this.outputs[this.cases[e]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))&&this.otherwise.outputDefined()}serialize(){const t=["match",this.input.serialize()],e=Object.keys(this.cases).sort(),n=[],i={};for(const t of e){const e=i[this.cases[t]];void 0===e?(i[this.cases[t]]=n.length,n.push([this.cases[t],[t]])):n[e][1].push(t)}const r=t=>"number"===this.inputType.kind?Number(t):t;for(const[e,i]of n)t.push(1===i.length?r(i[0]):i.map(r)),t.push(this.outputs[e].serialize());return t.push(this.otherwise.serialize()),t}}class Pn{constructor(t,e,n){this.type=t,this.branches=e,this.otherwise=n}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return e.error("Expected an odd number of arguments.");let n;e.expectedType&&"value"!==e.expectedType.kind&&(n=e.expectedType);const i=[];for(let r=1;re.outputDefined()))&&this.otherwise.outputDefined()}serialize(){const t=["case"];return this.eachChild((e=>{t.push(e.serialize())})),t}}class Dn{constructor(t,e,n,i){this.type=t,this.input=e,this.beginIndex=n,this.endIndex=i}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const n=e.parse(t[1],1,Qt),i=e.parse(t[2],2,Wt);if(!n||!i)return null;if(!se(n.type,[ie(Qt),Xt,Qt]))return e.error(`Expected first argument to be of type array or string, but found ${re(n.type)} instead`);if(4===t.length){const r=e.parse(t[3],3,Wt);return r?new Dn(n.type,n,i,r):null}return new Dn(n.type,n,i)}evaluate(t){const e=this.input.evaluate(t),n=this.beginIndex.evaluate(t);if(!le(e,["string","array"]))throw new be(`Expected first argument to be of type array or string, but found ${re(ve(e))} instead.`);if(this.endIndex){const i=this.endIndex.evaluate(t);return e.slice(n,i)}return e.slice(n)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}serialize(){if(null!=this.endIndex&&void 0!==this.endIndex){const t=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),t]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}function zn(t,e){return"=="===t||"!="===t?"boolean"===e.kind||"string"===e.kind||"number"===e.kind||"null"===e.kind||"value"===e.kind:"string"===e.kind||"number"===e.kind||"value"===e.kind}function On(t,e,n,i){return 0===i.compare(e,n)}function Rn(t,e,n){const i="=="!==t&&"!="!==t;return class r{constructor(t,e,n){this.type=Kt,this.lhs=t,this.rhs=e,this.collator=n,this.hasUntypedArgument="value"===t.type.kind||"value"===e.type.kind}static parse(t,e){if(3!==t.length&&4!==t.length)return e.error("Expected two or three arguments.");const n=t[0];let o=e.parse(t[1],1,Qt);if(!o)return null;if(!zn(n,o.type))return e.concat(1).error(`"${n}" comparisons are not supported for type '${re(o.type)}'.`);let a=e.parse(t[2],2,Qt);if(!a)return null;if(!zn(n,a.type))return e.concat(2).error(`"${n}" comparisons are not supported for type '${re(a.type)}'.`);if(o.type.kind!==a.type.kind&&"value"!==o.type.kind&&"value"!==a.type.kind)return e.error(`Cannot compare types '${re(o.type)}' and '${re(a.type)}'.`);i&&("value"===o.type.kind&&"value"!==a.type.kind?o=new Te(a.type,[o]):"value"!==o.type.kind&&"value"===a.type.kind&&(a=new Te(o.type,[a])));let s=null;if(4===t.length){if("string"!==o.type.kind&&"string"!==a.type.kind&&"value"!==o.type.kind&&"value"!==a.type.kind)return e.error("Cannot use collator to compare non-string types.");if(s=e.parse(t[3],3,te),!s)return null}return new r(o,a,s)}evaluate(r){const o=this.lhs.evaluate(r),a=this.rhs.evaluate(r);if(i&&this.hasUntypedArgument){const e=ve(o),n=ve(a);if(e.kind!==n.kind||"string"!==e.kind&&"number"!==e.kind)throw new be(`Expected arguments for "${t}" to be (string, string) or (number, number), but found (${e.kind}, ${n.kind}) instead.`)}if(this.collator&&!i&&this.hasUntypedArgument){const t=ve(o),n=ve(a);if("string"!==t.kind||"string"!==n.kind)return e(r,o,a)}return this.collator?n(r,o,a,this.collator.evaluate(r)):e(r,o,a)}eachChild(t){t(this.lhs),t(this.rhs),this.collator&&t(this.collator)}outputDefined(){return!0}serialize(){const e=[t];return this.eachChild((t=>{e.push(t.serialize())})),e}}}const Ln=Rn("==",(function(t,e,n){return e===n}),On),Fn=Rn("!=",(function(t,e,n){return e!==n}),(function(t,e,n,i){return!On(0,e,n,i)})),$n=Rn("<",(function(t,e,n){return e",(function(t,e,n){return e>n}),(function(t,e,n,i){return i.compare(e,n)>0})),Nn=Rn("<=",(function(t,e,n){return e<=n}),(function(t,e,n,i){return i.compare(e,n)<=0})),jn=Rn(">=",(function(t,e,n){return e>=n}),(function(t,e,n,i){return i.compare(e,n)>=0}));class Un{constructor(t,e,n,i,r){this.type=Xt,this.number=t,this.locale=e,this.currency=n,this.minFractionDigits=i,this.maxFractionDigits=r}static parse(t,e){if(3!==t.length)return e.error("Expected two arguments.");const n=e.parse(t[1],1,Wt);if(!n)return null;const i=t[2];if("object"!=typeof i||Array.isArray(i))return e.error("NumberFormat options argument must be an object.");let r=null;if(i.locale&&(r=e.parse(i.locale,1,Xt),!r))return null;let o=null;if(i.currency&&(o=e.parse(i.currency,1,Xt),!o))return null;let a=null;if(i["min-fraction-digits"]&&(a=e.parse(i["min-fraction-digits"],1,Wt),!a))return null;let s=null;return i["max-fraction-digits"]&&(s=e.parse(i["max-fraction-digits"],1,Wt),!s)?null:new Un(n,r,o,a,s)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}serialize(){const t={};return this.locale&&(t.locale=this.locale.serialize()),this.currency&&(t.currency=this.currency.serialize()),this.minFractionDigits&&(t["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(t["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),t]}}class Vn{constructor(t){this.type=Wt,this.input=t}static parse(t,e){if(2!==t.length)return e.error(`Expected 1 argument, but found ${t.length-1} instead.`);const n=e.parse(t[1],1);return n?"array"!==n.type.kind&&"string"!==n.type.kind&&"value"!==n.type.kind?e.error(`Expected argument of type string or array, but found ${re(n.type)} instead.`):new Vn(n):null}evaluate(t){const e=this.input.evaluate(t);if("string"==typeof e)return e.length;if(Array.isArray(e))return e.length;throw new be(`Expected value to be of type string or array, but found ${re(ve(e))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}serialize(){const t=["length"];return this.eachChild((e=>{t.push(e.serialize())})),t}}const Gn={"==":Ln,"!=":Fn,">":Bn,"<":$n,">=":jn,"<=":Nn,array:Te,at:An,boolean:Te,case:Pn,coalesce:En,collator:Pe,format:Ce,image:Ee,in:kn,"index-of":In,interpolate:Tn,"interpolate-hcl":Tn,"interpolate-lab":Tn,length:Vn,let:Sn,literal:xe,match:Mn,number:Te,"number-format":Un,object:Te,slice:Dn,step:nn,string:Te,"to-boolean":Ae,"to-color":Ae,"to-number":Ae,"to-string":Ae,var:Je,within:We};function qn(t,[e,n,i,r]){e=e.evaluate(t),n=n.evaluate(t),i=i.evaluate(t);const o=r?r.evaluate(t):1,a=ge(e,n,i,o);if(a)throw new be(a);return new he(e/255*o,n/255*o,i/255*o,o)}function Zn(t,e){return t in e}function Hn(t,e){const n=e[t];return void 0===n?null:n}function Wn(t){return{type:t}}function Xn(t){return{result:"success",value:t}}function Kn(t){return{result:"error",value:t}}function Yn(t){return"data-driven"===t["property-type"]||"cross-faded-data-driven"===t["property-type"]}function Jn(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function Qn(t){return!!t.expression&&t.expression.interpolated}function ti(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":null===t?"null":typeof t}function ei(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function ni(t){return t}function ii(t,e){const n="color"===e.type,i=t.stops&&"object"==typeof t.stops[0][0],r=i||!(i||void 0!==t.property),o=t.type||(Qn(e)?"exponential":"interval");if(n&&((t=Ut({},t)).stops&&(t.stops=t.stops.map((t=>[t[0],he.parse(t[1])]))),t.default=he.parse(t.default?t.default:e.default)),t.colorSpace&&"rgb"!==t.colorSpace&&!wn[t.colorSpace])throw new Error(`Unknown color space: ${t.colorSpace}`);let a,s,l;if("exponential"===o)a=si;else if("interval"===o)a=ai;else if("categorical"===o){a=oi,s=Object.create(null);for(const e of t.stops)s[e[0]]=e[1];l=typeof t.stops[0][0]}else{if("identity"!==o)throw new Error(`Unknown function type "${o}"`);a=li}if(i){const n={},i=[];for(let e=0;et[0])),evaluate:({zoom:n},i)=>si({stops:r,base:t.base},e,n).evaluate(n,i)}}if(r){const n="exponential"===o?{name:"exponential",base:void 0!==t.base?t.base:1}:null;return{kind:"camera",interpolationType:n,interpolationFactor:Tn.interpolationFactor.bind(void 0,n),zoomStops:t.stops.map((t=>t[0])),evaluate:({zoom:n})=>a(t,e,n,s,l)}}return{kind:"source",evaluate(n,i){const r=i&&i.properties?i.properties[t.property]:void 0;return void 0===r?ri(t.default,e.default):a(t,e,r,s,l)}}}function ri(t,e,n){return void 0!==t?t:void 0!==e?e:void 0!==n?n:void 0}function oi(t,e,n,i,r){return ri(typeof n===r?i[n]:void 0,t.default,e.default)}function ai(t,e,n){if("number"!==ti(n))return ri(t.default,e.default);const i=t.stops.length;if(1===i)return t.stops[0][1];if(n<=t.stops[0][0])return t.stops[0][1];if(n>=t.stops[i-1][0])return t.stops[i-1][1];const r=en(t.stops.map((t=>t[0])),n);return t.stops[r][1]}function si(t,e,n){const i=void 0!==t.base?t.base:1;if("number"!==ti(n))return ri(t.default,e.default);const r=t.stops.length;if(1===r)return t.stops[0][1];if(n<=t.stops[0][0])return t.stops[0][1];if(n>=t.stops[r-1][0])return t.stops[r-1][1];const o=en(t.stops.map((t=>t[0])),n),a=function(t,e,n,i){const r=i-n,o=t-n;return 0===r?0:1===e?o/r:(Math.pow(e,o)-1)/(Math.pow(e,r)-1)}(n,i,t.stops[o][0],t.stops[o+1][0]),s=t.stops[o][1],l=t.stops[o+1][1];let c=on[e.type]||ni;if(t.colorSpace&&"rgb"!==t.colorSpace){const e=wn[t.colorSpace];c=(t,n)=>e.reverse(e.interpolate(e.forward(t),e.forward(n),a))}return"function"==typeof s.evaluate?{evaluate(...t){const e=s.evaluate.apply(void 0,t),n=l.evaluate.apply(void 0,t);if(void 0!==e&&void 0!==n)return c(e,n,a)}}:c(s,l,a)}function li(t,e,n){return"color"===e.type?n=he.parse(n):"formatted"===e.type?n=fe.fromString(n.toString()):"resolvedImage"===e.type?n=me.fromString(n.toString()):ti(n)===e.type||"enum"===e.type&&e.values[n]||(n=void 0),ri(n,t.default,e.default)}Me.register(Gn,{error:[{kind:"error"},[Xt],(t,[e])=>{throw new be(e.evaluate(t))}],typeof:[Xt,[Qt],(t,[e])=>re(ve(e.evaluate(t)))],"to-rgba":[ie(Wt,4),[Yt],(t,[e])=>e.evaluate(t).toArray()],rgb:[Yt,[Wt,Wt,Wt],qn],rgba:[Yt,[Wt,Wt,Wt,Wt],qn],has:{type:Kt,overloads:[[[Xt],(t,[e])=>Zn(e.evaluate(t),t.properties())],[[Xt,Jt],(t,[e,n])=>Zn(e.evaluate(t),n.evaluate(t))]]},get:{type:Qt,overloads:[[[Xt],(t,[e])=>Hn(e.evaluate(t),t.properties())],[[Xt,Jt],(t,[e,n])=>Hn(e.evaluate(t),n.evaluate(t))]]},"feature-state":[Qt,[Xt],(t,[e])=>Hn(e.evaluate(t),t.featureState||{})],properties:[Jt,[],t=>t.properties()],"geometry-type":[Xt,[],t=>t.geometryType()],id:[Qt,[],t=>t.id()],zoom:[Wt,[],t=>t.globals.zoom],"heatmap-density":[Wt,[],t=>t.globals.heatmapDensity||0],"line-progress":[Wt,[],t=>t.globals.lineProgress||0],"sky-radial-progress":[Wt,[],t=>t.globals.skyRadialProgress||0],accumulated:[Qt,[],t=>void 0===t.globals.accumulated?null:t.globals.accumulated],"+":[Wt,Wn(Wt),(t,e)=>{let n=0;for(const i of e)n+=i.evaluate(t);return n}],"*":[Wt,Wn(Wt),(t,e)=>{let n=1;for(const i of e)n*=i.evaluate(t);return n}],"-":{type:Wt,overloads:[[[Wt,Wt],(t,[e,n])=>e.evaluate(t)-n.evaluate(t)],[[Wt],(t,[e])=>-e.evaluate(t)]]},"/":[Wt,[Wt,Wt],(t,[e,n])=>e.evaluate(t)/n.evaluate(t)],"%":[Wt,[Wt,Wt],(t,[e,n])=>e.evaluate(t)%n.evaluate(t)],ln2:[Wt,[],()=>Math.LN2],pi:[Wt,[],()=>Math.PI],e:[Wt,[],()=>Math.E],"^":[Wt,[Wt,Wt],(t,[e,n])=>Math.pow(e.evaluate(t),n.evaluate(t))],sqrt:[Wt,[Wt],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[Wt,[Wt],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[Wt,[Wt],(t,[e])=>Math.log(e.evaluate(t))],log2:[Wt,[Wt],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[Wt,[Wt],(t,[e])=>Math.sin(e.evaluate(t))],cos:[Wt,[Wt],(t,[e])=>Math.cos(e.evaluate(t))],tan:[Wt,[Wt],(t,[e])=>Math.tan(e.evaluate(t))],asin:[Wt,[Wt],(t,[e])=>Math.asin(e.evaluate(t))],acos:[Wt,[Wt],(t,[e])=>Math.acos(e.evaluate(t))],atan:[Wt,[Wt],(t,[e])=>Math.atan(e.evaluate(t))],min:[Wt,Wn(Wt),(t,e)=>Math.min(...e.map((e=>e.evaluate(t))))],max:[Wt,Wn(Wt),(t,e)=>Math.max(...e.map((e=>e.evaluate(t))))],abs:[Wt,[Wt],(t,[e])=>Math.abs(e.evaluate(t))],round:[Wt,[Wt],(t,[e])=>{const n=e.evaluate(t);return n<0?-Math.round(-n):Math.round(n)}],floor:[Wt,[Wt],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[Wt,[Wt],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[Kt,[Xt,Qt],(t,[e,n])=>t.properties()[e.value]===n.value],"filter-id-==":[Kt,[Qt],(t,[e])=>t.id()===e.value],"filter-type-==":[Kt,[Xt],(t,[e])=>t.geometryType()===e.value],"filter-<":[Kt,[Xt,Qt],(t,[e,n])=>{const i=t.properties()[e.value],r=n.value;return typeof i==typeof r&&i{const n=t.id(),i=e.value;return typeof n==typeof i&&n":[Kt,[Xt,Qt],(t,[e,n])=>{const i=t.properties()[e.value],r=n.value;return typeof i==typeof r&&i>r}],"filter-id->":[Kt,[Qt],(t,[e])=>{const n=t.id(),i=e.value;return typeof n==typeof i&&n>i}],"filter-<=":[Kt,[Xt,Qt],(t,[e,n])=>{const i=t.properties()[e.value],r=n.value;return typeof i==typeof r&&i<=r}],"filter-id-<=":[Kt,[Qt],(t,[e])=>{const n=t.id(),i=e.value;return typeof n==typeof i&&n<=i}],"filter->=":[Kt,[Xt,Qt],(t,[e,n])=>{const i=t.properties()[e.value],r=n.value;return typeof i==typeof r&&i>=r}],"filter-id->=":[Kt,[Qt],(t,[e])=>{const n=t.id(),i=e.value;return typeof n==typeof i&&n>=i}],"filter-has":[Kt,[Qt],(t,[e])=>e.value in t.properties()],"filter-has-id":[Kt,[],t=>null!==t.id()&&void 0!==t.id()],"filter-type-in":[Kt,[ie(Xt)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[Kt,[ie(Qt)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[Kt,[Xt,ie(Qt)],(t,[e,n])=>n.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[Kt,[Xt,ie(Qt)],(t,[e,n])=>function(t,e,n,i){for(;n<=i;){const r=n+i>>1;if(e[r]===t)return!0;e[r]>t?i=r-1:n=r+1}return!1}(t.properties()[e.value],n.value,0,n.value.length-1)],all:{type:Kt,overloads:[[[Kt,Kt],(t,[e,n])=>e.evaluate(t)&&n.evaluate(t)],[Wn(Kt),(t,e)=>{for(const n of e)if(!n.evaluate(t))return!1;return!0}]]},any:{type:Kt,overloads:[[[Kt,Kt],(t,[e,n])=>e.evaluate(t)||n.evaluate(t)],[Wn(Kt),(t,e)=>{for(const n of e)if(n.evaluate(t))return!0;return!1}]]},"!":[Kt,[Kt],(t,[e])=>!e.evaluate(t)],"is-supported-script":[Kt,[Xt],(t,[e])=>{const n=t.globals&&t.globals.isSupportedScript;return!n||n(e.evaluate(t))}],upcase:[Xt,[Xt],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[Xt,[Xt],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[Xt,Wn(Qt),(t,e)=>e.map((e=>ye(e.evaluate(t)))).join("")],"resolved-locale":[Xt,[te],(t,[e])=>e.evaluate(t).resolvedLocale()]});class ci{constructor(t,e){this.expression=t,this._warningHistory={},this._evaluator=new Ie,this._defaultValue=e?function(t){return"color"===t.type&&ei(t.default)?new he(0,0,0,0):"color"===t.type?he.parse(t.default)||null:void 0===t.default?null:t.default}(e):null,this._enumValues=e&&"enum"===e.type?e.values:null}evaluateWithoutErrorHandling(t,e,n,i,r,o){return this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=n,this._evaluator.canonical=i,this._evaluator.availableImages=r||null,this._evaluator.formattedSection=o,this.expression.evaluate(this._evaluator)}evaluate(t,e,n,i,r,o){this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=n||null,this._evaluator.canonical=i,this._evaluator.availableImages=r||null,this._evaluator.formattedSection=o||null;try{const t=this.expression.evaluate(this._evaluator);if(null==t||"number"==typeof t&&t!=t)return this._defaultValue;if(this._enumValues&&!(t in this._enumValues))throw new be(`Expected value to be one of ${Object.keys(this._enumValues).map((t=>JSON.stringify(t))).join(", ")}, but found ${JSON.stringify(t)} instead.`);return t}catch(t){return this._warningHistory[t.message]||(this._warningHistory[t.message]=!0),this._defaultValue}}}function ui(t){return Array.isArray(t)&&t.length>0&&"string"==typeof t[0]&&t[0]in Gn}function hi(t,e){const n=new Qe(Gn,[],e?function(t){const e={color:Yt,string:Xt,number:Wt,enum:Xt,boolean:Kt,formatted:ee,resolvedImage:ne};return"array"===t.type?ie(e[t.value]||Qt,t.length):e[t.type]}(e):void 0),i=n.parse(t,void 0,void 0,void 0,e&&"string"===e.type?{typeAnnotation:"coerce"}:void 0);return i?Xn(new ci(i,e)):Kn(n.errors)}class di{constructor(t,e){this.kind=t,this._styleExpression=e,this.isStateDependent="constant"!==t&&!Ke(e.expression)}evaluateWithoutErrorHandling(t,e,n,i,r,o){return this._styleExpression.evaluateWithoutErrorHandling(t,e,n,i,r,o)}evaluate(t,e,n,i,r,o){return this._styleExpression.evaluate(t,e,n,i,r,o)}}class pi{constructor(t,e,n,i){this.kind=t,this.zoomStops=n,this._styleExpression=e,this.isStateDependent="camera"!==t&&!Ke(e.expression),this.interpolationType=i}evaluateWithoutErrorHandling(t,e,n,i,r,o){return this._styleExpression.evaluateWithoutErrorHandling(t,e,n,i,r,o)}evaluate(t,e,n,i,r,o){return this._styleExpression.evaluate(t,e,n,i,r,o)}interpolationFactor(t,e,n){return this.interpolationType?Tn.interpolationFactor(this.interpolationType,t,e,n):0}}function fi(t,e){if("error"===(t=hi(t,e)).result)return t;const n=t.value.expression,i=Xe(n);if(!i&&!Yn(e))return Kn([new qt("","data expressions not supported")]);const r=Ye(n,["zoom"]);if(!r&&!Jn(e))return Kn([new qt("","zoom expressions not supported")]);const o=gi(n);return o||r?o instanceof qt?Kn([o]):o instanceof Tn&&!Qn(e)?Kn([new qt("",'"interpolate" expressions cannot be used with this property')]):Xn(o?new pi(i?"camera":"composite",t.value,o.labels,o instanceof Tn?o.interpolation:void 0):new di(i?"constant":"source",t.value)):Kn([new qt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class mi{constructor(t,e){this._parameters=t,this._specification=e,Ut(this,ii(this._parameters,this._specification))}static deserialize(t){return new mi(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function gi(t){let e=null;if(t instanceof Sn)e=gi(t.result);else if(t instanceof En){for(const n of t.args)if(e=gi(n),e)break}else(t instanceof nn||t instanceof Tn)&&t.input instanceof Me&&"zoom"===t.input.name&&(e=t);return e instanceof qt||t.eachChild((t=>{const n=gi(t);n instanceof qt?e=n:!e&&n?e=new qt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&n&&e!==n&&(e=new qt("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),e}function _i(t){const e=t.key,n=t.value,i=t.valueSpec||{},r=t.objectElementValidators||{},o=t.style,a=t.styleSpec;let s=[];const l=ti(n);if("object"!==l)return[new Nt(e,n,`object expected, ${l} found`)];for(const t in n){const l=t.split(".")[0],c=i[l]||i["*"];let u;if(r[l])u=r[l];else if(i[l])u=Zi;else if(r["*"])u=r["*"];else{if(!i["*"]){s.push(new Nt(e,n[t],`unknown property "${t}"`));continue}u=Zi}s=s.concat(u({key:(e?`${e}.`:e)+t,value:n[t],valueSpec:c,style:o,styleSpec:a,object:n,objectKey:t},n))}for(const t in i)r[t]||i[t].required&&void 0===i[t].default&&void 0===n[t]&&s.push(new Nt(e,n,`missing required property "${t}"`));return s}function vi(t){const e=t.value,n=t.valueSpec,i=t.style,r=t.styleSpec,o=t.key,a=t.arrayElementValidator||Zi;if("array"!==ti(e))return[new Nt(o,e,`array expected, ${ti(e)} found`)];if(n.length&&e.length!==n.length)return[new Nt(o,e,`array length ${n.length} expected, length ${e.length} found`)];if(n["min-length"]&&e.lengthr)return[new Nt(e,n,`${n} is greater than the maximum value ${r}`)]}return[]}function xi(t){const e=t.valueSpec,n=Vt(t.value.type);let i,r,o,a={};const s="categorical"!==n&&void 0===t.value.property,l=!s,c="array"===ti(t.value.stops)&&"array"===ti(t.value.stops[0])&&"object"===ti(t.value.stops[0][0]),u=_i({key:t.key,value:t.value,valueSpec:t.styleSpec.function,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:function(t){if("identity"===n)return[new Nt(t.key,t.value,'identity function may not have a "stops" property')];let e=[];const i=t.value;return e=e.concat(vi({key:t.key,value:i,valueSpec:t.valueSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:h})),"array"===ti(i)&&0===i.length&&e.push(new Nt(t.key,i,"array must have at least one stop")),e},default:function(t){return Zi({key:t.key,value:t.value,valueSpec:e,style:t.style,styleSpec:t.styleSpec})}}});return"identity"===n&&s&&u.push(new Nt(t.key,t.value,'missing required property "property"')),"identity"===n||t.value.stops||u.push(new Nt(t.key,t.value,'missing required property "stops"')),"exponential"===n&&t.valueSpec.expression&&!Qn(t.valueSpec)&&u.push(new Nt(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!Yn(t.valueSpec)?u.push(new Nt(t.key,t.value,"property functions not supported")):s&&!Jn(t.valueSpec)&&u.push(new Nt(t.key,t.value,"zoom functions not supported"))),"categorical"!==n&&!c||void 0!==t.value.property||u.push(new Nt(t.key,t.value,'"property" property is required')),u;function h(t){let n=[];const i=t.value,s=t.key;if("array"!==ti(i))return[new Nt(s,i,`array expected, ${ti(i)} found`)];if(2!==i.length)return[new Nt(s,i,`array length 2 expected, length ${i.length} found`)];if(c){if("object"!==ti(i[0]))return[new Nt(s,i,`object expected, ${ti(i[0])} found`)];if(void 0===i[0].zoom)return[new Nt(s,i,"object stop key must have zoom")];if(void 0===i[0].value)return[new Nt(s,i,"object stop key must have value")];if(o&&o>Vt(i[0].zoom))return[new Nt(s,i[0].zoom,"stop zoom values must appear in ascending order")];Vt(i[0].zoom)!==o&&(o=Vt(i[0].zoom),r=void 0,a={}),n=n.concat(_i({key:`${s}[0]`,value:i[0],valueSpec:{zoom:{}},style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:yi,value:d}}))}else n=n.concat(d({key:`${s}[0]`,value:i[0],valueSpec:{},style:t.style,styleSpec:t.styleSpec},i));return ui(Gt(i[1]))?n.concat([new Nt(`${s}[1]`,i[1],"expressions are not allowed in function stops.")]):n.concat(Zi({key:`${s}[1]`,value:i[1],valueSpec:e,style:t.style,styleSpec:t.styleSpec}))}function d(t,o){const s=ti(t.value),l=Vt(t.value),c=null!==t.value?t.value:o;if(i){if(s!==i)return[new Nt(t.key,c,`${s} stop domain type must match previous stop domain type ${i}`)]}else i=s;if("number"!==s&&"string"!==s&&"boolean"!==s)return[new Nt(t.key,c,"stop domain value must be a number, string, or boolean")];if("number"!==s&&"categorical"!==n){let i=`number expected, ${s} found`;return Yn(e)&&void 0===n&&(i+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Nt(t.key,c,i)]}return"categorical"!==n||"number"!==s||isFinite(l)&&Math.floor(l)===l?"categorical"!==n&&"number"===s&&void 0!==r&&lnew Nt(`${t.key}${e.key}`,t.value,e.message)));const n=e.value.expression||e.value._styleExpression.expression;if("property"===t.expressionContext&&"text-font"===t.propertyKey&&!n.outputDefined())return[new Nt(t.key,t.value,`Invalid data expression for "${t.propertyKey}". Output values must be contained as literals within the expression.`)];if("property"===t.expressionContext&&"layout"===t.propertyType&&!Ke(n))return[new Nt(t.key,t.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===t.expressionContext&&!Ke(n))return[new Nt(t.key,t.value,'"feature-state" data expressions are not supported with filters.')];if(t.expressionContext&&0===t.expressionContext.indexOf("cluster")){if(!Ye(n,["zoom","feature-state"]))return[new Nt(t.key,t.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===t.expressionContext&&!Xe(n))return[new Nt(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function wi(t){const e=t.key,n=t.value,i=t.valueSpec,r=[];return Array.isArray(i.values)?-1===i.values.indexOf(Vt(n))&&r.push(new Nt(e,n,`expected one of [${i.values.join(", ")}], ${JSON.stringify(n)} found`)):-1===Object.keys(i.values).indexOf(Vt(n))&&r.push(new Nt(e,n,`expected one of [${Object.keys(i.values).join(", ")}], ${JSON.stringify(n)} found`)),r}function Ti(t){if(!0===t||!1===t)return!0;if(!Array.isArray(t)||0===t.length)return!1;switch(t[0]){case"has":return t.length>=2&&"$id"!==t[1]&&"$type"!==t[1];case"in":return t.length>=3&&("string"!=typeof t[1]||Array.isArray(t[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==t.length||Array.isArray(t[1])||Array.isArray(t[2]);case"any":case"all":for(const e of t.slice(1))if(!Ti(e)&&"boolean"!=typeof e)return!1;return!0;default:return!0}}const Ci={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Ei(t){if(null==t)return{filter:()=>!0,needGeometry:!1};Ti(t)||(t=ki(t));const e=hi(t,Ci);if("error"===e.result)throw new Error(e.value.map((t=>`${t.key}: ${t.message}`)).join(", "));return{filter:(t,n,i)=>e.value.evaluate(t,n,{},i),needGeometry:Ai(t)}}function Si(t,e){return te?1:0}function Ai(t){if(!Array.isArray(t))return!1;if("within"===t[0])return!0;for(let e=1;e"===e||"<="===e||">="===e?Ii(t[1],t[2],e):"any"===e?(n=t.slice(1),["any"].concat(n.map(ki))):"all"===e?["all"].concat(t.slice(1).map(ki)):"none"===e?["all"].concat(t.slice(1).map(ki).map(Di)):"in"===e?Mi(t[1],t.slice(2)):"!in"===e?Di(Mi(t[1],t.slice(2))):"has"===e?Pi(t[1]):"!has"===e?Di(Pi(t[1])):"within"!==e||t;var n}function Ii(t,e,n){switch(t){case"$type":return[`filter-type-${n}`,e];case"$id":return[`filter-id-${n}`,e];default:return[`filter-${n}`,t,e]}}function Mi(t,e){if(0===e.length)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some((t=>typeof t!=typeof e[0]))?["filter-in-large",t,["literal",e.sort(Si)]]:["filter-in-small",t,["literal",e]]}}function Pi(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function Di(t){return["!",t]}function zi(t){return Ti(Gt(t.value))?bi(Ut({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Oi(t)}function Oi(t){const e=t.value,n=t.key;if("array"!==ti(e))return[new Nt(n,e,`array expected, ${ti(e)} found`)];const i=t.styleSpec;let r,o=[];if(e.length<1)return[new Nt(n,e,"filter array must have at least 1 element")];switch(o=o.concat(wi({key:`${n}[0]`,value:e[0],valueSpec:i.filter_operator,style:t.style,styleSpec:t.styleSpec})),Vt(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&"$type"===Vt(e[1])&&o.push(new Nt(n,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":3!==e.length&&o.push(new Nt(n,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(r=ti(e[1]),"string"!==r&&o.push(new Nt(`${n}[1]`,e[1],`string expected, ${r} found`)));for(let a=2;a{t in n&&e.push(new Nt(i,n[t],`"${t}" is prohibited for ref layers`))})),r.layers.forEach((e=>{Vt(e.id)===s&&(t=e)})),t?t.ref?e.push(new Nt(i,n.ref,"ref cannot reference another ref layer")):a=Vt(t.type):e.push(new Nt(i,n.ref,`ref layer "${s}" not found`))}else if("background"!==a&&"sky"!==a)if(n.source){const t=r.sources&&r.sources[n.source],o=t&&Vt(t.type);t?"vector"===o&&"raster"===a?e.push(new Nt(i,n.source,`layer "${n.id}" requires a raster source`)):"raster"===o&&"raster"!==a?e.push(new Nt(i,n.source,`layer "${n.id}" requires a vector source`)):"vector"!==o||n["source-layer"]?"raster-dem"===o&&"hillshade"!==a?e.push(new Nt(i,n.source,"raster-dem source can only be used with layer type 'hillshade'.")):"line"!==a||!n.paint||!n.paint["line-gradient"]||"geojson"===o&&t.lineMetrics||e.push(new Nt(i,n,`layer "${n.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new Nt(i,n,`layer "${n.id}" must specify a "source-layer"`)):e.push(new Nt(i,n.source,`source "${n.source}" not found`))}else e.push(new Nt(i,n,'missing required property "source"'));return e=e.concat(_i({key:i,value:n,valueSpec:o.layer,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":()=>[],type:()=>Zi({key:`${i}.type`,value:n.type,valueSpec:o.layer.type,style:t.style,styleSpec:t.styleSpec,object:n,objectKey:"type"}),filter:zi,layout:t=>_i({layer:n,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":t=>Fi(Ut({layerType:a},t))}}),paint:t=>_i({layer:n,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":t=>Li(Ut({layerType:a},t))}})}})),e}function Bi(t){const e=t.value,n=t.key,i=ti(e);return"string"!==i?[new Nt(n,e,`string expected, ${i} found`)]:[]}const Ni={promoteId:function({key:t,value:e}){if("string"===ti(e))return Bi({key:t,value:e});{const n=[];for(const i in e)n.push(...Bi({key:`${t}.${i}`,value:e[i]}));return n}}};function ji(t){const e=t.value,n=t.key,i=t.styleSpec,r=t.style;if(!e.type)return[new Nt(n,e,'"type" is required')];const o=Vt(e.type);let a;switch(o){case"vector":case"raster":case"raster-dem":return a=_i({key:n,value:e,valueSpec:i[`source_${o.replace("-","_")}`],style:t.style,styleSpec:i,objectElementValidators:Ni}),a;case"geojson":if(a=_i({key:n,value:e,valueSpec:i.source_geojson,style:r,styleSpec:i,objectElementValidators:Ni}),e.cluster)for(const t in e.clusterProperties){const[i,r]=e.clusterProperties[t],o="string"==typeof i?[i,["accumulated"],["get",t]]:i;a.push(...bi({key:`${n}.${t}.map`,value:r,expressionContext:"cluster-map"})),a.push(...bi({key:`${n}.${t}.reduce`,value:o,expressionContext:"cluster-reduce"}))}return a;case"video":return _i({key:n,value:e,valueSpec:i.source_video,style:r,styleSpec:i});case"image":return _i({key:n,value:e,valueSpec:i.source_image,style:r,styleSpec:i});case"canvas":return[new Nt(n,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return wi({key:`${n}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:r,styleSpec:i})}}function Ui(t){const e=t.value,n=t.styleSpec,i=n.light,r=t.style;let o=[];const a=ti(e);if(void 0===e)return o;if("object"!==a)return o=o.concat([new Nt("light",e,`object expected, ${a} found`)]),o;for(const t in e){const a=t.match(/^(.*)-transition$/);o=o.concat(a&&i[a[1]]&&i[a[1]].transition?Zi({key:t,value:e[t],valueSpec:n.transition,style:r,styleSpec:n}):i[t]?Zi({key:t,value:e[t],valueSpec:i[t],style:r,styleSpec:n}):[new Nt(t,e[t],`unknown property "${t}"`)])}return o}function Vi(t){const e=t.value,n=t.key,i=t.style,r=t.styleSpec,o=r.terrain;let a=[];const s=ti(e);if(void 0===e)return a;if("object"!==s)return a=a.concat([new Nt("terrain",e,`object expected, ${s} found`)]),a;for(const t in e){const n=t.match(/^(.*)-transition$/);a=a.concat(n&&o[n[1]]&&o[n[1]].transition?Zi({key:t,value:e[t],valueSpec:r.transition,style:i,styleSpec:r}):o[t]?Zi({key:t,value:e[t],valueSpec:o[t],style:i,styleSpec:r}):[new Nt(t,e[t],`unknown property "${t}"`)])}if(e.source){const t=i.sources&&i.sources[e.source],r=t&&Vt(t.type);t?"raster-dem"!==r&&a.push(new Nt(n,e.source,`terrain cannot be used with a source of type ${r}, it only be used with a "raster-dem" source type`)):a.push(new Nt(n,e.source,`source "${e.source}" not found`))}else a.push(new Nt(n,e,'terrain is missing required property "source"'));return a}function Gi(t){const e=t.value,n=t.style,i=t.styleSpec,r=i.fog;let o=[];const a=ti(e);if(void 0===e)return o;if("object"!==a)return o=o.concat([new Nt("fog",e,`object expected, ${a} found`)]),o;for(const t in e){const a=t.match(/^(.*)-transition$/);o=o.concat(a&&r[a[1]]&&r[a[1]].transition?Zi({key:t,value:e[t],valueSpec:i.transition,style:n,styleSpec:i}):r[t]?Zi({key:t,value:e[t],valueSpec:r[t],style:n,styleSpec:i}):[new Nt(t,e[t],`unknown property "${t}"`)])}return o}const qi={"*":()=>[],array:vi,boolean:function(t){const e=t.value,n=t.key,i=ti(e);return"boolean"!==i?[new Nt(n,e,`boolean expected, ${i} found`)]:[]},number:yi,color:function(t){const e=t.key,n=t.value,i=ti(n);return"string"!==i?[new Nt(e,n,`color expected, ${i} found`)]:null===ue.parseCSSColor(n)?[new Nt(e,n,`color expected, "${n}" found`)]:[]},constants:jt,enum:wi,filter:zi,function:xi,layer:$i,object:_i,source:ji,light:Ui,terrain:Vi,fog:Gi,string:Bi,formatted:function(t){return 0===Bi(t).length?[]:bi(t)},resolvedImage:function(t){return 0===Bi(t).length?[]:bi(t)}};function Zi(t){const e=t.value,n=t.valueSpec,i=t.styleSpec;return n.expression&&ei(Vt(e))?xi(t):n.expression&&ui(Gt(e))?bi(t):n.type&&qi[n.type]?qi[n.type](t):_i(Ut({},t,{valueSpec:n.type?i[n.type]:n}))}function Hi(t){const e=t.value,n=t.key,i=Bi(t);return i.length||(-1===e.indexOf("{fontstack}")&&i.push(new Nt(n,e,'"glyphs" url must include a "{fontstack}" token')),-1===e.indexOf("{range}")&&i.push(new Nt(n,e,'"glyphs" url must include a "{range}" token'))),i}function Wi(t,e=Bt){let n=[];return n=n.concat(Zi({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,objectElementValidators:{glyphs:Hi,"*":()=>[]}})),t.constants&&(n=n.concat(jt({key:"constants",value:t.constants,style:t,styleSpec:e}))),Xi(n)}function Xi(t){return[].concat(t).sort(((t,e)=>t.line-e.line))}function Ki(t){return function(...e){return Xi(t.apply(this,e))}}Wi.source=Ki(ji),Wi.light=Ki(Ui),Wi.terrain=Ki(Vi),Wi.fog=Ki(Gi),Wi.layer=Ki($i),Wi.filter=Ki(zi),Wi.paintProperty=Ki(Li),Wi.layoutProperty=Ki(Fi);const Yi=Wi,Ji=Yi.light,Qi=Yi.fog,tr=Yi.paintProperty,er=Yi.layoutProperty;function nr(t,e){let n=!1;if(e&&e.length)for(const i of e)t.fire(new Ft(new Error(i.message))),n=!0;return n}var ir=rr;function rr(t,e,n){var i=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;var r=new Int32Array(this.arrayBuffer);t=r[0],this.d=(e=r[1])+2*(n=r[2]);for(var o=0;o=u[p+0]&&i>=u[p+1])?(a[d]=!0,o.push(c[d])):a[d]=!1}}},rr.prototype._forEachCell=function(t,e,n,i,r,o,a,s){for(var l=this._convertToCellCoord(t),c=this._convertToCellCoord(e),u=this._convertToCellCoord(n),h=this._convertToCellCoord(i),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,t,e,n,i,f,o,a,s))return}},rr.prototype._convertFromCellCoord=function(t){return(t-this.padding)/this.scale},rr.prototype._convertToCellCoord=function(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))},rr.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var t=this.cells,e=3+this.cells.length+1+1,n=0,i=0;i=0)continue;const o=t[n];r[n]=sr[i].shallow.indexOf(n)>=0?o:hr(o,e)}t instanceof Error&&(r.message=t.message)}if(r.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==i&&(r.$name=i),r}throw new Error("can't serialize object of type "+typeof t)}function dr(t){if(null==t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||cr(t)||ur(t)||ArrayBuffer.isView(t)||t instanceof or)return t;if(Array.isArray(t))return t.map(dr);if("object"==typeof t){const e=t.$name||"Object",{klass:n}=sr[e];if(!n)throw new Error(`can't deserialize unregistered class ${e}`);if(n.deserialize)return n.deserialize(t);const i=Object.create(n.prototype);for(const n of Object.keys(t)){if("$name"===n)continue;const r=t[n];i[n]=sr[e].shallow.indexOf(n)>=0?r:dr(r)}return i}throw new Error("can't deserialize object of type "+typeof t)}class pr{constructor(){this.first=!0}update(t,e){const n=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=n,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=n,!0):(this.lastFloorZoom>n?(this.lastIntegerZoom=n+1,this.lastIntegerZoomTime=e):this.lastFloorZoomt>=1536&&t<=1791,mr=t=>t>=1872&&t<=1919,gr=t=>t>=2208&&t<=2303,_r=t=>t>=11904&&t<=12031,vr=t=>t>=12032&&t<=12255,yr=t=>t>=12272&&t<=12287,xr=t=>t>=12288&&t<=12351,br=t=>t>=12352&&t<=12447,wr=t=>t>=12448&&t<=12543,Tr=t=>t>=12544&&t<=12591,Cr=t=>t>=12704&&t<=12735,Er=t=>t>=12736&&t<=12783,Sr=t=>t>=12784&&t<=12799,Ar=t=>t>=12800&&t<=13055,kr=t=>t>=13056&&t<=13311,Ir=t=>t>=13312&&t<=19903,Mr=t=>t>=19968&&t<=40959,Pr=t=>t>=40960&&t<=42127,Dr=t=>t>=42128&&t<=42191,zr=t=>t>=44032&&t<=55215,Or=t=>t>=63744&&t<=64255,Rr=t=>t>=64336&&t<=65023,Lr=t=>t>=65040&&t<=65055,Fr=t=>t>=65072&&t<=65103,$r=t=>t>=65104&&t<=65135,Br=t=>t>=65136&&t<=65279,Nr=t=>t>=65280&&t<=65519;function jr(t){for(const e of t)if(Gr(e.charCodeAt(0)))return!0;return!1}function Ur(t){for(const e of t)if(!Vr(e.charCodeAt(0)))return!1;return!0}function Vr(t){return!(fr(t)||mr(t)||gr(t)||Rr(t)||Br(t))}function Gr(t){return!(746!==t&&747!==t&&(t<4352||!(Cr(t)||Tr(t)||Fr(t)&&!(t>=65097&&t<=65103)||Or(t)||kr(t)||_r(t)||Er(t)||!(!xr(t)||t>=12296&&t<=12305||t>=12308&&t<=12319||12336===t)||Ir(t)||Mr(t)||Ar(t)||(t=>t>=12592&&t<=12687)(t)||(t=>t>=43360&&t<=43391)(t)||(t=>t>=55216&&t<=55295)(t)||(t=>t>=4352&&t<=4607)(t)||zr(t)||br(t)||yr(t)||(t=>t>=12688&&t<=12703)(t)||vr(t)||Sr(t)||wr(t)&&12540!==t||!(!Nr(t)||65288===t||65289===t||65293===t||t>=65306&&t<=65310||65339===t||65341===t||65343===t||t>=65371&&t<=65503||65507===t||t>=65512&&t<=65519)||!(!$r(t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||(t=>t>=5120&&t<=5759)(t)||(t=>t>=6320&&t<=6399)(t)||Lr(t)||(t=>t>=19904&&t<=19967)(t)||Pr(t)||Dr(t))))}function qr(t){return!(Gr(t)||function(t){return!!((t=>t>=128&&t<=255)(t)&&(167===t||169===t||174===t||177===t||188===t||189===t||190===t||215===t||247===t)||(t=>t>=8192&&t<=8303)(t)&&(8214===t||8224===t||8225===t||8240===t||8241===t||8251===t||8252===t||8258===t||8263===t||8264===t||8265===t||8273===t)||(t=>t>=8448&&t<=8527)(t)||(t=>t>=8528&&t<=8591)(t)||(t=>t>=8960&&t<=9215)(t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||9003===t||t>=9085&&t<=9114||t>=9150&&t<=9165||9167===t||t>=9169&&t<=9179||t>=9186&&t<=9215)||(t=>t>=9216&&t<=9279)(t)&&9251!==t||(t=>t>=9280&&t<=9311)(t)||(t=>t>=9312&&t<=9471)(t)||(t=>t>=9632&&t<=9727)(t)||(t=>t>=9728&&t<=9983)(t)&&!(t>=9754&&t<=9759)||(t=>t>=11008&&t<=11263)(t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||xr(t)||wr(t)||(t=>t>=57344&&t<=63743)(t)||Fr(t)||$r(t)||Nr(t)||8734===t||8756===t||8757===t||t>=9984&&t<=10087||t>=10102&&t<=10131||65532===t||65533===t)}(t))}function Zr(t){return t>=1424&&t<=2303||Rr(t)||Br(t)}function Hr(t,e){return!(!e&&Zr(t)||t>=2304&&t<=3583||t>=3840&&t<=4255||(t=>t>=6016&&t<=6143)(t))}function Wr(t){for(const e of t)if(Zr(e.charCodeAt(0)))return!0;return!1}const Xr="deferred",Kr="loading",Yr="loaded";let Jr=null,Qr="unavailable",to=null;const eo=function(t){t&&"string"==typeof t&&t.indexOf("NetworkError")>-1&&(Qr="error"),Jr&&Jr(t)};function no(){io.fire(new Lt("pluginStateChange",{pluginStatus:Qr,pluginURL:to}))}const io=new $t,ro=function(){return Qr},oo=function(){if(Qr!==Xr||!to)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Qr=Kr,no(),to&&St({url:to},(t=>{t?eo(t):(Qr=Yr,no())}))},ao={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>Qr===Yr||null!=ao.applyArabicShaping,isLoading:()=>Qr===Kr,setState(t){Qr=t.pluginStatus,to=t.pluginURL},isParsed:()=>null!=ao.applyArabicShaping&&null!=ao.processBidirectionalText&&null!=ao.processStyledBidirectionalText,getPluginURL:()=>to};class so{constructor(t,e){this.zoom=t,e?(this.now=e.now,this.fadeDuration=e.fadeDuration,this.zoomHistory=e.zoomHistory,this.transition=e.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new pr,this.transition={})}isSupportedScript(t){return function(t,e){for(const n of t)if(!Hr(n.charCodeAt(0),e))return!1;return!0}(t,ao.isLoaded())}crossFadingFactor(){return 0===this.fadeDuration?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const t=this.zoom,e=t-Math.floor(t),n=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:e+(1-e)*n}:{fromScale:.5,toScale:1,t:1-(1-n)*e}}}class lo{constructor(t,e){this.property=t,this.value=e,this.expression=function(t,e){if(ei(t))return new mi(t,e);if(ui(t)){const n=fi(t,e);if("error"===n.result)throw new Error(n.value.map((t=>`${t.key}: ${t.message}`)).join(", "));return n.value}{let n=t;return"string"==typeof t&&"color"===e.type&&(n=he.parse(t)),{kind:"constant",evaluate:()=>n}}}(void 0===e?t.specification.default:e,t.specification)}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}possiblyEvaluate(t,e,n){return this.property.possiblyEvaluate(this,t,e,n)}}class co{constructor(t){this.property=t,this.value=new lo(t,void 0)}transitioned(t,e){return new ho(this.property,this.value,e,x({},t.transition,this.transition),t.now)}untransitioned(){return new ho(this.property,this.value,null,{},0)}}class uo{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)}getValue(t){return M(this._values[t].value.value)}setValue(t,e){this._values.hasOwnProperty(t)||(this._values[t]=new co(this._values[t].property)),this._values[t].value=new lo(this._values[t].property,null===e?void 0:M(e))}getTransition(t){return M(this._values[t].transition)}setTransition(t,e){this._values.hasOwnProperty(t)||(this._values[t]=new co(this._values[t].property)),this._values[t].transition=M(e)||void 0}serialize(){const t={};for(const e of Object.keys(this._values)){const n=this.getValue(e);void 0!==n&&(t[e]=n);const i=this.getTransition(e);void 0!==i&&(t[`${e}-transition`]=i)}return t}transitioned(t,e){const n=new po(this._properties);for(const i of Object.keys(this._values))n._values[i]=this._values[i].transitioned(t,e._values[i]);return n}untransitioned(){const t=new po(this._properties);for(const e of Object.keys(this._values))t._values[e]=this._values[e].untransitioned();return t}}class ho{constructor(t,e,n,i,r){const o=i.delay||0,a=i.duration||0;r=r||0,this.property=t,this.value=e,this.begin=r+o,this.end=this.begin+a,t.specification.transition&&(i.delay||i.duration)&&(this.prior=n)}possiblyEvaluate(t,e,n){const i=t.now||0,r=this.value.possiblyEvaluate(t,e,n),o=this.prior;if(o){if(i>this.end)return this.prior=null,r;if(this.value.isDataDriven())return this.prior=null,r;if(ii.zoomHistory.lastIntegerZoom?{from:t,to:e,other:n}:{from:n,to:e,other:t}}interpolate(t){return t}}class xo{constructor(t){this.specification=t}possiblyEvaluate(t,e,n,i){if(void 0!==t.value){if("constant"===t.expression.kind){const r=t.expression.evaluate(e,null,{},n,i);return this._calculate(r,r,r,e)}return this._calculate(t.expression.evaluate(new so(Math.floor(e.zoom-1),e)),t.expression.evaluate(new so(Math.floor(e.zoom),e)),t.expression.evaluate(new so(Math.floor(e.zoom+1),e)),e)}}_calculate(t,e,n,i){return i.zoom>i.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:n,to:e}}interpolate(t){return t}}class bo{constructor(t){this.specification=t}possiblyEvaluate(t,e,n,i){return!!t.expression.evaluate(e,null,{},n,i)}interpolate(){return!1}}class wo{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const e in t){const n=t[e];n.specification.overridable&&this.overridableProperties.push(e);const i=this.defaultPropertyValues[e]=new lo(n,void 0),r=this.defaultTransitionablePropertyValues[e]=new co(n);this.defaultTransitioningPropertyValues[e]=r.untransitioned(),this.defaultPossiblyEvaluatedValues[e]=i.possiblyEvaluate({})}}}function To(t,e){return 256*(t=g(Math.floor(t),0,255))+g(Math.floor(e),0,255)}lr("DataDrivenProperty",vo),lr("DataConstantProperty",_o),lr("CrossFadedDataDrivenProperty",yo),lr("CrossFadedProperty",xo),lr("ColorRampProperty",bo);const Co={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Eo{constructor(t,e){this._structArray=t,this._pos1=e*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class So{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,e){return t._trim(),e&&(t.isTransferred=!0,e.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){const e=Object.create(this.prototype);return e.arrayBuffer=t.arrayBuffer,e.length=t.length,e.capacity=t.arrayBuffer.byteLength/e.bytesPerElement,e._refreshViews(),e}_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(t){this.reserve(t),this.length=t}reserve(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const e=this.uint8;this._refreshViews(),e&&this.uint8.set(e)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function Ao(t,e=1){let n=0,i=0;return{members:t.map((t=>{const r=Co[t.type].BYTES_PER_ELEMENT,o=n=ko(n,Math.max(e,r)),a=t.components||1;return i=Math.max(i,r),n+=r*a,{name:t.name,type:t.type,components:a,offset:o}})),size:ko(n,Math.max(i,e)),alignment:e}}function ko(t,e){return Math.ceil(t/e)*e}class Io extends So{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e){const n=this.length;return this.resize(n+1),this.emplace(n,t,e)}emplace(t,e,n){const i=2*t;return this.int16[i+0]=e,this.int16[i+1]=n,t}}Io.prototype.bytesPerElement=4,lr("StructArrayLayout2i4",Io);class Mo extends So{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,n,i){const r=this.length;return this.resize(r+1),this.emplace(r,t,e,n,i)}emplace(t,e,n,i,r){const o=4*t;return this.int16[o+0]=e,this.int16[o+1]=n,this.int16[o+2]=i,this.int16[o+3]=r,t}}Mo.prototype.bytesPerElement=8,lr("StructArrayLayout4i8",Mo);class Po extends So{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,n,i,r,o,a){const s=this.length;return this.resize(s+1),this.emplace(s,t,e,n,i,r,o,a)}emplace(t,e,n,i,r,o,a,s){const l=6*t,c=12*t,u=3*t;return this.int16[l+0]=e,this.int16[l+1]=n,this.uint8[c+4]=i,this.uint8[c+5]=r,this.uint8[c+6]=o,this.uint8[c+7]=a,this.float32[u+2]=s,t}}Po.prototype.bytesPerElement=12,lr("StructArrayLayout2i4ub1f12",Po);class Do extends So{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e){const n=this.length;return this.resize(n+1),this.emplace(n,t,e)}emplace(t,e,n){const i=2*t;return this.float32[i+0]=e,this.float32[i+1]=n,t}}Do.prototype.bytesPerElement=8,lr("StructArrayLayout2f8",Do);class zo extends So{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,n,i,r,o,a,s,l,c){const u=this.length;return this.resize(u+1),this.emplace(u,t,e,n,i,r,o,a,s,l,c)}emplace(t,e,n,i,r,o,a,s,l,c,u){const h=10*t;return this.uint16[h+0]=e,this.uint16[h+1]=n,this.uint16[h+2]=i,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,t}}zo.prototype.bytesPerElement=20,lr("StructArrayLayout10ui20",zo);class Oo extends So{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,n,i,r,o,a,s){const l=this.length;return this.resize(l+1),this.emplace(l,t,e,n,i,r,o,a,s)}emplace(t,e,n,i,r,o,a,s,l){const c=8*t;return this.uint16[c+0]=e,this.uint16[c+1]=n,this.uint16[c+2]=i,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,t}}Oo.prototype.bytesPerElement=16,lr("StructArrayLayout8ui16",Oo);class Ro extends So{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,n,i,r,o,a,s,l,c,u,h){const d=this.length;return this.resize(d+1),this.emplace(d,t,e,n,i,r,o,a,s,l,c,u,h)}emplace(t,e,n,i,r,o,a,s,l,c,u,h,d){const p=12*t;return this.int16[p+0]=e,this.int16[p+1]=n,this.int16[p+2]=i,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,t}}Ro.prototype.bytesPerElement=24,lr("StructArrayLayout4i4ui4i24",Ro);class Lo extends So{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,n){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,n)}emplace(t,e,n,i){const r=3*t;return this.float32[r+0]=e,this.float32[r+1]=n,this.float32[r+2]=i,t}}Lo.prototype.bytesPerElement=12,lr("StructArrayLayout3f12",Lo);class Fo extends So{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint32[1*t+0]=e,t}}Fo.prototype.bytesPerElement=4,lr("StructArrayLayout1ul4",Fo);class $o extends So{_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(t,e,n,i,r,o,a,s,l,c){const u=this.length;return this.resize(u+1),this.emplace(u,t,e,n,i,r,o,a,s,l,c)}emplace(t,e,n,i,r,o,a,s,l,c,u){const h=16*t,d=8*t;return this.int16[h+0]=e,this.int16[h+1]=n,this.float32[d+1]=i,this.float32[d+2]=r,this.float32[d+3]=o,this.float32[d+4]=a,this.int16[h+10]=s,this.uint32[d+6]=l,this.uint16[h+14]=c,this.uint16[h+15]=u,t}}$o.prototype.bytesPerElement=32,lr("StructArrayLayout2i4f1i1ul2ui32",$o);class Bo extends So{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,n,i,r,o){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,n,i,r,o)}emplace(t,e,n,i,r,o,a){const s=6*t;return this.int16[s+0]=e,this.int16[s+1]=n,this.int16[s+2]=i,this.int16[s+3]=r,this.int16[s+4]=o,this.int16[s+5]=a,t}}Bo.prototype.bytesPerElement=12,lr("StructArrayLayout2i2i2i12",Bo);class No extends So{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,n,i,r){const o=this.length;return this.resize(o+1),this.emplace(o,t,e,n,i,r)}emplace(t,e,n,i,r,o){const a=4*t,s=8*t;return this.float32[a+0]=e,this.float32[a+1]=n,this.float32[a+2]=i,this.int16[s+6]=r,this.int16[s+7]=o,t}}No.prototype.bytesPerElement=16,lr("StructArrayLayout2f1f2i16",No);class jo extends So{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,n,i){const r=this.length;return this.resize(r+1),this.emplace(r,t,e,n,i)}emplace(t,e,n,i,r){const o=12*t,a=3*t;return this.uint8[o+0]=e,this.uint8[o+1]=n,this.float32[a+1]=i,this.float32[a+2]=r,t}}jo.prototype.bytesPerElement=12,lr("StructArrayLayout2ub2f12",jo);class Uo extends So{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,n){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,n)}emplace(t,e,n,i){const r=3*t;return this.uint16[r+0]=e,this.uint16[r+1]=n,this.uint16[r+2]=i,t}}Uo.prototype.bytesPerElement=6,lr("StructArrayLayout3ui6",Uo);class Vo extends So{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,n,i,r,o,a,s,l,c,u,h,d,p,f,m,g,_){const v=this.length;return this.resize(v+1),this.emplace(v,t,e,n,i,r,o,a,s,l,c,u,h,d,p,f,m,g,_)}emplace(t,e,n,i,r,o,a,s,l,c,u,h,d,p,f,m,g,_,v){const y=13*t,x=26*t,b=52*t;return this.float32[y+0]=e,this.float32[y+1]=n,this.uint16[x+4]=i,this.uint16[x+5]=r,this.uint32[y+3]=o,this.uint32[y+4]=a,this.uint32[y+5]=s,this.uint16[x+12]=l,this.uint16[x+13]=c,this.uint16[x+14]=u,this.float32[y+8]=h,this.float32[y+9]=d,this.uint8[b+40]=p,this.uint8[b+41]=f,this.uint8[b+42]=m,this.uint32[y+11]=g,this.int16[x+24]=_,this.uint8[b+50]=v,t}}Vo.prototype.bytesPerElement=52,lr("StructArrayLayout2f2ui3ul3ui2f3ub1ul1i1ub52",Vo);class Go extends So{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t,e,n,i,r,o,a,s,l,c,u,h,d,p,f,m,g,_,v,y,x,b,w,T,C,E,S){const A=this.length;return this.resize(A+1),this.emplace(A,t,e,n,i,r,o,a,s,l,c,u,h,d,p,f,m,g,_,v,y,x,b,w,T,C,E,S)}emplace(t,e,n,i,r,o,a,s,l,c,u,h,d,p,f,m,g,_,v,y,x,b,w,T,C,E,S,A){const k=17*t,I=34*t;return this.float32[k+0]=e,this.float32[k+1]=n,this.int16[I+4]=i,this.int16[I+5]=r,this.int16[I+6]=o,this.int16[I+7]=a,this.int16[I+8]=s,this.int16[I+9]=l,this.uint16[I+10]=c,this.uint16[I+11]=u,this.uint16[I+12]=h,this.uint16[I+13]=d,this.uint16[I+14]=p,this.uint16[I+15]=f,this.uint16[I+16]=m,this.uint16[I+17]=g,this.uint16[I+18]=_,this.uint16[I+19]=v,this.uint16[I+20]=y,this.uint16[I+21]=x,this.uint16[I+22]=b,this.uint16[I+23]=w,this.uint16[I+24]=T,this.uint32[k+13]=C,this.float32[k+14]=E,this.float32[k+15]=S,this.float32[k+16]=A,t}}Go.prototype.bytesPerElement=68,lr("StructArrayLayout2f6i15ui1ul3f68",Go);class qo extends So{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.float32[1*t+0]=e,t}}qo.prototype.bytesPerElement=4,lr("StructArrayLayout1f4",qo);class Zo extends So{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,n){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,n)}emplace(t,e,n,i){const r=3*t;return this.int16[r+0]=e,this.int16[r+1]=n,this.int16[r+2]=i,t}}Zo.prototype.bytesPerElement=6,lr("StructArrayLayout3i6",Zo);class Ho extends So{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,n,i){const r=this.length;return this.resize(r+1),this.emplace(r,t,e,n,i)}emplace(t,e,n,i,r){const o=6*t;return this.uint32[3*t+0]=e,this.uint16[o+2]=n,this.uint16[o+3]=i,this.uint16[o+4]=r,t}}Ho.prototype.bytesPerElement=12,lr("StructArrayLayout1ul3ui12",Ho);class Wo extends So{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e){const n=this.length;return this.resize(n+1),this.emplace(n,t,e)}emplace(t,e,n){const i=2*t;return this.uint16[i+0]=e,this.uint16[i+1]=n,t}}Wo.prototype.bytesPerElement=4,lr("StructArrayLayout2ui4",Wo);class Xo extends So{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint16[1*t+0]=e,t}}Xo.prototype.bytesPerElement=2,lr("StructArrayLayout1ui2",Xo);class Ko extends So{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,n,i){const r=this.length;return this.resize(r+1),this.emplace(r,t,e,n,i)}emplace(t,e,n,i,r){const o=4*t;return this.float32[o+0]=e,this.float32[o+1]=n,this.float32[o+2]=i,this.float32[o+3]=r,t}}Ko.prototype.bytesPerElement=16,lr("StructArrayLayout4f16",Ko);class Yo extends Eo{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.float32[this._pos4+1]}get y1(){return this._structArray.float32[this._pos4+2]}get x2(){return this._structArray.float32[this._pos4+3]}get y2(){return this._structArray.float32[this._pos4+4]}get padding(){return this._structArray.int16[this._pos2+10]}get featureIndex(){return this._structArray.uint32[this._pos4+6]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+14]}get bucketIndex(){return this._structArray.uint16[this._pos2+15]}get anchorPoint(){return new o(this.anchorPointX,this.anchorPointY)}}Yo.prototype.size=32;class Jo extends $o{get(t){return new Yo(this,t)}}lr("CollisionBoxArray",Jo);class Qo extends Eo{get anchorX(){return this._structArray.float32[this._pos4+0]}get anchorY(){return this._structArray.float32[this._pos4+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+4]}get numGlyphs(){return this._structArray.uint16[this._pos2+5]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineStartIndex(){return this._structArray.uint32[this._pos4+4]}get lineLength(){return this._structArray.uint32[this._pos4+5]}get segment(){return this._structArray.uint16[this._pos2+12]}get lowerSize(){return this._structArray.uint16[this._pos2+13]}get upperSize(){return this._structArray.uint16[this._pos2+14]}get lineOffsetX(){return this._structArray.float32[this._pos4+8]}get lineOffsetY(){return this._structArray.float32[this._pos4+9]}get writingMode(){return this._structArray.uint8[this._pos1+40]}get placedOrientation(){return this._structArray.uint8[this._pos1+41]}set placedOrientation(t){this._structArray.uint8[this._pos1+41]=t}get hidden(){return this._structArray.uint8[this._pos1+42]}set hidden(t){this._structArray.uint8[this._pos1+42]=t}get crossTileID(){return this._structArray.uint32[this._pos4+11]}set crossTileID(t){this._structArray.uint32[this._pos4+11]=t}get associatedIconIndex(){return this._structArray.int16[this._pos2+24]}get flipState(){return this._structArray.uint8[this._pos1+50]}set flipState(t){this._structArray.uint8[this._pos1+50]=t}}Qo.prototype.size=52;class ta extends Vo{get(t){return new Qo(this,t)}}lr("PlacedSymbolArray",ta);class ea extends Eo{get anchorX(){return this._structArray.float32[this._pos4+0]}get anchorY(){return this._structArray.float32[this._pos4+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+7]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+8]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+9]}get key(){return this._structArray.uint16[this._pos2+10]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+17]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+18]}get featureIndex(){return this._structArray.uint16[this._pos2+19]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+21]}get numIconVertices(){return this._structArray.uint16[this._pos2+22]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+23]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+24]}get crossTileID(){return this._structArray.uint32[this._pos4+13]}set crossTileID(t){this._structArray.uint32[this._pos4+13]=t}get textOffset0(){return this._structArray.float32[this._pos4+14]}get textOffset1(){return this._structArray.float32[this._pos4+15]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+16]}}ea.prototype.size=68;class na extends Go{get(t){return new ea(this,t)}}lr("SymbolInstanceArray",na);class ia extends qo{getoffsetX(t){return this.float32[1*t+0]}}lr("GlyphOffsetArray",ia);class ra extends Zo{getx(t){return this.int16[3*t+0]}gety(t){return this.int16[3*t+1]}gettileUnitDistanceFromAnchor(t){return this.int16[3*t+2]}}lr("SymbolLineVertexArray",ra);class oa extends Eo{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]}}oa.prototype.size=12;class aa extends Ho{get(t){return new oa(this,t)}}lr("FeatureIndexArray",aa);class sa extends Eo{get a_centroid_pos0(){return this._structArray.uint16[this._pos2+0]}get a_centroid_pos1(){return this._structArray.uint16[this._pos2+1]}}sa.prototype.size=4;class la extends Wo{get(t){return new sa(this,t)}}lr("FillExtrusionCentroidArray",la);const ca=Ao([{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"}]),ua=Ao([{name:"a_dash_to",components:4,type:"Uint16"},{name:"a_dash_from",components:4,type:"Uint16"}]);var ha=ce((function(t){t.exports=function(t,e){var n,i,r,o,a,s,l,c;for(i=t.length-(n=3&t.length),r=e,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,n){case 3:l^=(255&t.charCodeAt(c+2))<<16;case 2:l^=(255&t.charCodeAt(c+1))<<8;case 1:r^=l=(65535&(l=(l=(65535&(l^=255&t.charCodeAt(c)))*a+(((l>>>16)*a&65535)<<16)&4294967295)<<15|l>>>17))*s+(((l>>>16)*s&65535)<<16)&4294967295}return r^=t.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}})),da=ce((function(t){t.exports=function(t,e){for(var n,i=t.length,r=e^i,o=0;i>=4;)n=1540483477*(65535&(n=255&t.charCodeAt(o)|(255&t.charCodeAt(++o))<<8|(255&t.charCodeAt(++o))<<16|(255&t.charCodeAt(++o))<<24))+((1540483477*(n>>>16)&65535)<<16),r=1540483477*(65535&r)+((1540483477*(r>>>16)&65535)<<16)^(n=1540483477*(65535&(n^=n>>>24))+((1540483477*(n>>>16)&65535)<<16)),i-=4,++o;switch(i){case 3:r^=(255&t.charCodeAt(o+2))<<16;case 2:r^=(255&t.charCodeAt(o+1))<<8;case 1:r=1540483477*(65535&(r^=255&t.charCodeAt(o)))+((1540483477*(r>>>16)&65535)<<16)}return r=1540483477*(65535&(r^=r>>>13))+((1540483477*(r>>>16)&65535)<<16),(r^=r>>>15)>>>0}})),pa=ha,fa=da;pa.murmur3=ha,pa.murmur2=fa;class ma{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,e,n,i){this.ids.push(ga(t)),this.positions.push(e,n,i)}getPositions(t){const e=ga(t);let n=0,i=this.ids.length-1;for(;n>1;this.ids[t]>=e?i=t:n=t+1}const r=[];for(;this.ids[n]===e;)r.push({index:this.positions[3*n],start:this.positions[3*n+1],end:this.positions[3*n+2]}),n++;return r}static serialize(t,e){const n=new Float64Array(t.ids),i=new Uint32Array(t.positions);return _a(n,i,0,n.length-1),e&&e.push(n.buffer,i.buffer),{ids:n,positions:i}}static deserialize(t){const e=new ma;return e.ids=t.ids,e.positions=t.positions,e.indexed=!0,e}}function ga(t){const e=+t;return!isNaN(e)&&e<=l?e:pa(String(t))}function _a(t,e,n,i){for(;n>1];let o=n-1,a=i+1;for(;;){do{o++}while(t[o]r);if(o>=a)break;va(t,o,a),va(e,3*o,3*a),va(e,3*o+1,3*a+1),va(e,3*o+2,3*a+2)}a-n`u_${t}`)),this.type=n}setUniform(t,e,n){t.set(n.constantOr(this.value))}getBinding(t,e,n){return"color"===this.type?new wa(t,e):new xa(t,e)}}class Aa{constructor(t,e){this.uniformNames=e.map((t=>`u_${t}`)),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,e){this.pixelRatioFrom=e.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=e.tl.concat(e.br),this.patternTo=t.tl.concat(t.br)}setUniform(t,e,n,i){const r="u_pattern_to"===i||"u_dash_to"===i?this.patternTo:"u_pattern_from"===i||"u_dash_from"===i?this.patternFrom:"u_pixel_ratio_to"===i?this.pixelRatioTo:"u_pixel_ratio_from"===i?this.pixelRatioFrom:null;r&&t.set(r)}getBinding(t,e,n){return"u_pattern_from"===n||"u_pattern_to"===n||"u_dash_from"===n||"u_dash_to"===n?new ba(t,e):new xa(t,e)}}class ka{constructor(t,e,n,i){this.expression=t,this.type=n,this.maxValue=0,this.paintVertexAttributes=e.map((t=>({name:`a_${t}`,type:"Float32",components:"color"===n?2:1,offset:0}))),this.paintVertexArray=new i}populatePaintArray(t,e,n,i,r){const o=this.paintVertexArray.length,a=this.expression.evaluate(new so(0),e,{},i,[],r);this.paintVertexArray.resize(t),this._setPaintValue(o,t,a)}updatePaintArray(t,e,n,i){const r=this.expression.evaluate({zoom:0},n,i);this._setPaintValue(t,e,r)}_setPaintValue(t,e,n){if("color"===this.type){const i=Ea(n);for(let n=t;n`u_${t}_t`)),this.type=n,this.useIntegerZoom=i,this.zoom=r,this.maxValue=0,this.paintVertexAttributes=e.map((t=>({name:`a_${t}`,type:"Float32",components:"color"===n?4:2,offset:0}))),this.paintVertexArray=new o}populatePaintArray(t,e,n,i,r){const o=this.expression.evaluate(new so(this.zoom),e,{},i,[],r),a=this.expression.evaluate(new so(this.zoom+1),e,{},i,[],r),s=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(s,t,o,a)}updatePaintArray(t,e,n,i){const r=this.expression.evaluate({zoom:this.zoom},n,i),o=this.expression.evaluate({zoom:this.zoom+1},n,i);this._setPaintValue(t,e,r,o)}_setPaintValue(t,e,n,i){if("color"===this.type){const r=Ea(n),o=Ea(i);for(let n=t;n!0)){this.binders={},this._buffers=[];const i=[];for(const r in t.paint._values){if(!n(r))continue;const o=t.paint.get(r);if(!(o instanceof mo&&Yn(o.property.specification)))continue;const a=Oa(r,t.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"!==t.layout.get("line-cap").value.kind;if("constant"!==s.kind||d)if("source"===s.kind||d||h){const n=Fa(r,l,"source");this.binders[r]=h?new Ma(s,a,l,c,e,n,t.id):new ka(s,a,l,n),i.push(`/a_${r}`)}else{const t=Fa(r,l,"composite");this.binders[r]=new Ia(s,a,l,c,e,t),i.push(`/z_${r}`)}else this.binders[r]=h?new Aa(s.value,a):new Sa(s.value,a,l),i.push(`/u_${r}`)}this.cacheKey=i.sort().join("")}getMaxValue(t){const e=this.binders[t];return e instanceof ka||e instanceof Ia?e.maxValue:0}populatePaintArrays(t,e,n,i,r){for(const o in this.binders){const a=this.binders[o];(a instanceof ka||a instanceof Ia||a instanceof Ma)&&a.populatePaintArray(t,e,n,i,r)}}setConstantPatternPositions(t,e){for(const n in this.binders){const i=this.binders[n];i instanceof Aa&&i.setConstantPatternPositions(t,e)}}updatePaintArrays(t,e,n,i,r){let o=!1;for(const a in t){const s=e.getPositions(a);for(const e of s){const s=n.feature(e.index);for(const n in this.binders){const l=this.binders[n];if((l instanceof ka||l instanceof Ia||l instanceof Ma)&&!0===l.expression.isStateDependent){const c=i.paint.get(n);l.expression=c.value,l.updatePaintArray(e.start,e.end,s,t[a],r),o=!0}}}}return o}defines(){const t=[];for(const e in this.binders){const n=this.binders[e];(n instanceof Sa||n instanceof Aa)&&t.push(...n.uniformNames.map((t=>`#define HAS_UNIFORM_${t}`)))}return t}getBinderAttributes(){const t=[];for(const e in this.binders){const n=this.binders[e];if(n instanceof ka||n instanceof Ia||n instanceof Ma)for(let e=0;e!0)){this.programConfigurations={};for(const i of t)this.programConfigurations[i.id]=new Pa(i,e,n);this.needsUpload=!1,this._featureMap=new ma,this._bufferOffset=0}populatePaintArrays(t,e,n,i,r,o){for(const n in this.programConfigurations)this.programConfigurations[n].populatePaintArrays(t,e,i,r,o);void 0!==e.id&&this._featureMap.add(e.id,n,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,e,n,i){for(const r of n)this.needsUpload=this.programConfigurations[r.id].updatePaintArrays(t,this._featureMap,e,r,i)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(const e in this.programConfigurations)this.programConfigurations[e].upload(t);this.needsUpload=!1}}destroy(){for(const t in this.programConfigurations)this.programConfigurations[t].destroy()}}const za={"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 Oa(t,e){return za[t]||[t.replace(`${e}-`,"").replace(/-/g,"_")]}const Ra={"line-pattern":{source:zo,composite:zo},"fill-pattern":{source:zo,composite:zo},"fill-extrusion-pattern":{source:zo,composite:zo},"line-dasharray":{source:Oo,composite:Oo}},La={color:{source:Do,composite:Ko},number:{source:qo,composite:Do}};function Fa(t,e,n){const i=Ra[t];return i&&i[n]||La[e][n]}lr("ConstantBinder",Sa),lr("CrossFadedConstantBinder",Aa),lr("SourceExpressionBinder",ka),lr("CrossFadedCompositeBinder",Ma),lr("CompositeExpressionBinder",Ia),lr("ProgramConfiguration",Pa,{omit:["_buffers"]}),lr("ProgramConfigurationSet",Da);const $a="-transition";class Ba extends $t{constructor(t,e){if(super(),this.id=t.id,this.type=t.type,this._featureFilter={filter:()=>!0,needGeometry:!1},"custom"!==t.type&&(this.metadata=(t=t).metadata,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,"background"!==t.type&&"sky"!==t.type&&(this.source=t.source,this.sourceLayer=t["source-layer"],this.filter=t.filter),e.layout&&(this._unevaluatedLayout=new fo(e.layout)),e.paint)){this._transitionablePaint=new uo(e.paint);for(const e in t.paint)this.setPaintProperty(e,t.paint[e],{validate:!1});for(const e in t.layout)this.setLayoutProperty(e,t.layout[e],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new go(e.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){return"visibility"===t?this.visibility:this._unevaluatedLayout.getValue(t)}setLayoutProperty(t,e,n={}){null!=e&&this._validate(er,`layers.${this.id}.layout.${t}`,t,e,n)||("visibility"!==t?this._unevaluatedLayout.setValue(t,e):this.visibility=e)}getPaintProperty(t){return A(t,$a)?this._transitionablePaint.getTransition(t.slice(0,-$a.length)):this._transitionablePaint.getValue(t)}setPaintProperty(t,e,n={}){if(null!=e&&this._validate(tr,`layers.${this.id}.paint.${t}`,t,e,n))return!1;if(A(t,$a))return this._transitionablePaint.setTransition(t.slice(0,-$a.length),e||void 0),!1;{const n=this._transitionablePaint._values[t],i="cross-faded-data-driven"===n.property.specification["property-type"],r=n.value.isDataDriven(),o=n.value;this._transitionablePaint.setValue(t,e),this._handleSpecialPaintPropertyUpdate(t);const a=this._transitionablePaint._values[t].value;return a.isDataDriven()||r||i||this._handleOverridablePaintPropertyUpdate(t,o,a)}}_handleSpecialPaintPropertyUpdate(t){}getProgramIds(){return null}getProgramConfiguration(t){return null}_handleOverridablePaintPropertyUpdate(t,e,n){return!1}isHidden(t){return!!(this.minzoom&&t=this.maxzoom)||"none"===this.visibility}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(t,e){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,e)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,e)}serialize(){const t={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(t.layout=t.layout||{},t.layout.visibility=this.visibility),I(t,((t,e)=>!(void 0===t||"layout"===e&&!Object.keys(t).length||"paint"===e&&!Object.keys(t).length)))}_validate(t,e,n,i,r={}){return(!r||!1!==r.validate)&&nr(this,t.call(Yi,{key:e,layerType:this.type,objectKey:n,value:i,styleSpec:Bt,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isSky(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const t in this.paint._values){const e=this.paint.get(t);if(e instanceof mo&&Yn(e.property.specification)&&("source"===e.value.kind||"composite"===e.value.kind)&&e.value.isStateDependent)return!0}return!1}}const Na=Ao([{name:"a_pos",components:2,type:"Int16"}],4),{members:ja}=Na;class Ua{constructor(t=[]){this.segments=t}prepareSegment(t,e,n,i){let r=this.segments[this.segments.length-1];return t>Ua.MAX_VERTEX_ARRAY_LENGTH&&D(`Max vertices per segment is ${Ua.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}`),(!r||r.vertexLength+t>Ua.MAX_VERTEX_ARRAY_LENGTH||r.sortKey!==i)&&(r={vertexOffset:e.length,primitiveOffset:n.length,vertexLength:0,primitiveLength:0},void 0!==i&&(r.sortKey=i),this.segments.push(r)),r}get(){return this.segments}destroy(){for(const t of this.segments)for(const e in t.vaos)t.vaos[e].destroy()}static simpleSegment(t,e,n,i){return new Ua([{vertexOffset:t,primitiveOffset:e,vertexLength:n,primitiveLength:i,vaos:{},sortKey:0}])}}Ua.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,lr("SegmentVector",Ua);var Va=8192;const Ga=Math.pow(2,14)-1,qa=-Ga-1;function Za(t){const e=Va/t.extent,n=t.loadGeometry();for(let t=0;tn.x+1||on.y+1)&&D("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return n}function Ha(t,e){return{type:t.type,id:t.id,properties:t.properties,geometry:e?Za(t):[]}}function Wa(t,e,n,i,r){t.emplaceBack(2*e+(i+1)/2,2*n+(r+1)/2)}class Xa{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new Io,this.indexArray=new Uo,this.segments=new Ua,this.programConfigurations=new Da(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,n){const i=this.layers[0],r=[];let o=null;"circle"===i.type&&(o=i.layout.get("circle-sort-key"));for(const{feature:e,id:i,index:a,sourceLayerIndex:s}of t){const t=this.layers[0]._featureFilter.needGeometry,l=Ha(e,t);if(!this.layers[0]._featureFilter.filter(new so(this.zoom),l,n))continue;const c=o?o.evaluate(l,{},n):void 0,u={id:i,properties:e.properties,type:e.type,sourceLayerIndex:s,index:a,geometry:t?l.geometry:Za(e),patterns:{},sortKey:c};r.push(u)}o&&r.sort(((t,e)=>t.sortKey-e.sortKey));for(const i of r){const{geometry:r,index:o,sourceLayerIndex:a}=i,s=t[o].feature;this.addFeature(i,r,o,n),e.featureIndex.insert(s,r,o,a,this.index)}}update(t,e,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,n)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,ja),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,e,n,i){for(const n of e)for(const e of n){const n=e.x,i=e.y;if(n<0||n>=Va||i<0||i>=Va)continue;const r=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,t.sortKey),o=r.vertexLength;Wa(this.layoutVertexArray,n,i,-1,-1),Wa(this.layoutVertexArray,n,i,1,-1),Wa(this.layoutVertexArray,n,i,1,1),Wa(this.layoutVertexArray,n,i,-1,1),this.indexArray.emplaceBack(o,o+1,o+2),this.indexArray.emplaceBack(o,o+3,o+2),r.vertexLength+=4,r.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,n,{},i)}}function Ka(t,e){for(let n=0;n1){if(ts(t,e))return!0;for(let i=0;i1?n:n.sub(e)._mult(r)._add(e))}function rs(t,e){let n,i,r,o=!1;for(let a=0;ae.y!=r.y>e.y&&e.x<(r.x-i.x)*(e.y-i.y)/(r.y-i.y)+i.x&&(o=!o)}return o}function os(t,e){let n=!1;for(let i=0,r=t.length-1;ie.y!=a.y>e.y&&e.x<(a.x-o.x)*(e.y-o.y)/(a.y-o.y)+o.x&&(n=!n)}return n}function as(t,e,n,i,r){for(const o of t)if(e<=o.x&&n<=o.y&&i>=o.x&&r>=o.y)return!0;const a=[new o(e,n),new o(e,r),new o(i,r),new o(i,n)];if(t.length>2)for(const e of a)if(os(t,e))return!0;for(let e=0;er.x&&e.x>r.x||t.yr.y&&e.y>r.y)return!1;const o=z(t,e,n[0]);return o!==z(t,e,n[1])||o!==z(t,e,n[2])||o!==z(t,e,n[3])}function ls(t,e,n){const i=e.paint.get(t).value;return"constant"===i.kind?i.value:n.programConfigurations.get(e.id).getMaxValue(t)}function cs(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function us(t,e,n,i,r){if(!e[0]&&!e[1])return t;const a=o.convert(e)._mult(r);"viewport"===n&&a._rotate(-i);const s=[];for(let e=0;e0&&(o=1/Math.sqrt(o)),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o,t}function Ss(t,e,n){var i=n[0],r=n[1],o=n[2],a=e[0],s=e[1],l=e[2],c=r*l-o*s,u=o*a-i*l,h=i*s-r*a,d=r*h-o*u,p=o*c-i*h,f=i*u-r*c,m=2*n[3];return u*=m,h*=m,p*=2,f*=2,t[0]=a+(c*=m)+(d*=2),t[1]=s+u+p,t[2]=l+h+f,t}var As,ks=ws,Is=Ts,Ms=xs;function Ps(t,e,n){var i=e[0],r=e[1],o=e[2],a=e[3];return t[0]=n[0]*i+n[4]*r+n[8]*o+n[12]*a,t[1]=n[1]*i+n[5]*r+n[9]*o+n[13]*a,t[2]=n[2]*i+n[6]*r+n[10]*o+n[14]*a,t[3]=n[3]*i+n[7]*r+n[11]*o+n[15]*a,t}function Ds(){var t=new fs(4);return fs!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function zs(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t}function Os(t,e,n){n*=.5;var i=e[0],r=e[1],o=e[2],a=e[3],s=Math.sin(n),l=Math.cos(n);return t[0]=i*l+a*s,t[1]=r*l+o*s,t[2]=o*l-r*s,t[3]=a*l-i*s,t}function Rs(t,e,n){const i=Ps([],[t.x,t.y,e,1],n);return new o(i[0]/i[3],i[1]/i[3])}ys(),As=new fs(4),fs!=Float32Array&&(As[0]=0,As[1]=0,As[2]=0,As[3]=0),ys(),bs(1,0,0),bs(0,1,0),Ds(),Ds(),ms();const Ls=bs(0,0,0),Fs=bs(0,0,1);function $s(t,e){const n=ys();return Ls[2]=e,t.intersectsPlane(Ls,Fs,n),new o(n[0],n[1])}class Bs extends Xa{}function Ns(t,{width:e,height:n},i,r){if(r){if(r instanceof Uint8ClampedArray)r=new Uint8Array(r.buffer);else if(r.length!==e*n*i)throw new RangeError("mismatched image size")}else r=new Uint8Array(e*n*i);return t.width=e,t.height=n,t.data=r,t}function js(t,{width:e,height:n},i){if(e===t.width&&n===t.height)return;const r=Ns({},{width:e,height:n},i);Us(t,r,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,e),height:Math.min(t.height,n)},i),t.width=e,t.height=n,t.data=r.data}function Us(t,e,n,i,r,o){if(0===r.width||0===r.height)return e;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 source coordinates for image copy");if(r.width>e.width||r.height>e.height||i.x>e.width-r.width||i.y>e.height-r.height)throw new RangeError("out of range destination coordinates for image copy");const a=t.data,s=e.data;for(let l=0;l{e[t.evaluationKey]=o;const a=t.expression.evaluate(e);r.data[n+i+0]=Math.floor(255*a.r/a.a),r.data[n+i+1]=Math.floor(255*a.g/a.a),r.data[n+i+2]=Math.floor(255*a.b/a.a),r.data[n+i+3]=Math.floor(255*a.a)};if(t.clips)for(let e=0,r=0;e80*n){i=o=t[0],r=a=t[1];for(var f=n;fo&&(o=s),l>a&&(a=l);c=0!==(c=Math.max(o-i,a-r))?1/c:0}return el(d,p,n,i,r,c),p}function Qs(t,e,n,i,r){var o,a;if(r===Tl(t,e,n,i)>0)for(o=e;o=e;o-=i)a=xl(o,t[o],t[o+1],a);return a&&fl(a,a.next)&&(bl(a),a=a.next),a}function tl(t,e){if(!t)return t;e||(e=t);var n,i=t;do{if(n=!1,i.steiner||!fl(i,i.next)&&0!==pl(i.prev,i,i.next))i=i.next;else{if(bl(i),(i=e=i.prev)===i.next)break;n=!0}}while(n||i!==e);return e}function el(t,e,n,i,r,o,a){if(t){!a&&o&&function(t,e,n,i){var r=t;do{null===r.z&&(r.z=cl(r.x,r.y,e,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){var e,n,i,r,o,a,s,l,c=1;do{for(n=t,t=null,o=null,a=0;n;){for(a++,i=n,s=0,e=0;e0||l>0&&i;)0!==s&&(0===l||!i||n.z<=i.z)?(r=n,n=n.nextZ,s--):(r=i,i=i.nextZ,l--),o?o.nextZ=r:t=r,r.prevZ=o,o=r;n=i}o.nextZ=null,c*=2}while(a>1)}(r)}(t,i,r,o);for(var s,l,c=t;t.prev!==t.next;)if(s=t.prev,l=t.next,o?il(t,i,r,o):nl(t))e.push(s.i/n),e.push(t.i/n),e.push(l.i/n),bl(t),t=l.next,c=l.next;else if((t=l)===c){a?1===a?el(t=rl(tl(t),e,n),e,n,i,r,o,2):2===a&&ol(t,e,n,i,r,o):el(tl(t),e,n,i,r,o,1);break}}}function nl(t){var e=t.prev,n=t,i=t.next;if(pl(e,n,i)>=0)return!1;for(var r=t.next.next;r!==t.prev;){if(hl(e.x,e.y,n.x,n.y,i.x,i.y,r.x,r.y)&&pl(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function il(t,e,n,i){var r=t.prev,o=t,a=t.next;if(pl(r,o,a)>=0)return!1;for(var s=r.x>o.x?r.x>a.x?r.x:a.x:o.x>a.x?o.x:a.x,l=r.y>o.y?r.y>a.y?r.y:a.y:o.y>a.y?o.y:a.y,c=cl(r.x=c&&d&&d.z<=u;){if(h!==t.prev&&h!==t.next&&hl(r.x,r.y,o.x,o.y,a.x,a.y,h.x,h.y)&&pl(h.prev,h,h.next)>=0)return!1;if(h=h.prevZ,d!==t.prev&&d!==t.next&&hl(r.x,r.y,o.x,o.y,a.x,a.y,d.x,d.y)&&pl(d.prev,d,d.next)>=0)return!1;d=d.nextZ}for(;h&&h.z>=c;){if(h!==t.prev&&h!==t.next&&hl(r.x,r.y,o.x,o.y,a.x,a.y,h.x,h.y)&&pl(h.prev,h,h.next)>=0)return!1;h=h.prevZ}for(;d&&d.z<=u;){if(d!==t.prev&&d!==t.next&&hl(r.x,r.y,o.x,o.y,a.x,a.y,d.x,d.y)&&pl(d.prev,d,d.next)>=0)return!1;d=d.nextZ}return!0}function rl(t,e,n){var i=t;do{var r=i.prev,o=i.next.next;!fl(r,o)&&ml(r,i,i.next,o)&&vl(r,o)&&vl(o,r)&&(e.push(r.i/n),e.push(i.i/n),e.push(o.i/n),bl(i),bl(i.next),i=t=o),i=i.next}while(i!==t);return tl(i)}function ol(t,e,n,i,r,o){var a=t;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&dl(a,s)){var l=yl(a,s);return a=tl(a,a.next),l=tl(l,l.next),el(a,e,n,i,r,o),void el(l,e,n,i,r,o)}s=s.next}a=a.next}while(a!==t)}function al(t,e){return t.x-e.x}function sl(t,e){if(e=function(t,e){var n,i=e,r=t.x,o=t.y,a=-1/0;do{if(o<=i.y&&o>=i.next.y&&i.next.y!==i.y){var s=i.x+(o-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(s<=r&&s>a){if(a=s,s===r){if(o===i.y)return i;if(o===i.next.y)return i.next}n=i.x=i.x&&i.x>=u&&r!==i.x&&hl(on.x||i.x===n.x&&ll(n,i)))&&(n=i,d=l)),i=i.next}while(i!==c);return n}(t,e)){var n=yl(e,t);tl(e,e.next),tl(n,n.next)}}function ll(t,e){return pl(t.prev,t,e.prev)<0&&pl(e.next,t,t.next)<0}function cl(t,e,n,i,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-n)*r)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-i)*r)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function ul(t){var e=t,n=t;do{(e.x=0&&(t-a)*(i-s)-(n-a)*(e-s)>=0&&(n-a)*(o-s)-(r-a)*(i-s)>=0}function dl(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&ml(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&(vl(t,e)&&vl(e,t)&&function(t,e){var n=t,i=!1,r=(t.x+e.x)/2,o=(t.y+e.y)/2;do{n.y>o!=n.next.y>o&&n.next.y!==n.y&&r<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next}while(n!==t);return i}(t,e)&&(pl(t.prev,t,e.prev)||pl(t,e.prev,e))||fl(t,e)&&pl(t.prev,t,t.next)>0&&pl(e.prev,e,e.next)>0)}function pl(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function fl(t,e){return t.x===e.x&&t.y===e.y}function ml(t,e,n,i){var r=_l(pl(t,e,n)),o=_l(pl(t,e,i)),a=_l(pl(n,i,t)),s=_l(pl(n,i,e));return r!==o&&a!==s||!(0!==r||!gl(t,n,e))||!(0!==o||!gl(t,i,e))||!(0!==a||!gl(n,t,i))||!(0!==s||!gl(n,e,i))}function gl(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function _l(t){return t>0?1:t<0?-1:0}function vl(t,e){return pl(t.prev,t,t.next)<0?pl(t,e,t.next)>=0&&pl(t,t.prev,e)>=0:pl(t,e,t.prev)<0||pl(t,t.next,e)<0}function yl(t,e){var n=new wl(t.i,t.x,t.y),i=new wl(e.i,e.x,e.y),r=t.next,o=e.prev;return t.next=e,e.prev=t,n.next=r,r.prev=n,i.next=n,n.prev=i,o.next=i,i.prev=o,i}function xl(t,e,n,i){var r=new wl(t,e,n);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function bl(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function wl(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Tl(t,e,n,i){for(var r=0,o=e,a=n-i;on;){if(i-n>600){var o=i-n+1,a=e-n+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);El(t,e,Math.max(n,Math.floor(e-a*l/o+c)),Math.min(i,Math.floor(e+(o-a)*l/o+c)),r)}var u=t[e],h=n,d=i;for(Sl(t,n,e),r(t[i],u)>0&&Sl(t,n,i);h0;)d--}0===r(t[n],u)?Sl(t,n,d):Sl(t,++d,i),d<=e&&(n=d+1),e<=d&&(i=d-1)}}function Sl(t,e,n){var i=t[e];t[e]=t[n],t[n]=i}function Al(t,e){return te?1:0}function kl(t,e){const n=t.length;if(n<=1)return[t];const i=[];let r,o;for(let e=0;e1)for(let t=0;t0&&n.holes.push(i+=t[r-1].length)}return n},Ks.default=Ys;class Dl{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Io,this.indexArray=new Uo,this.indexArray2=new Wo,this.programConfigurations=new Da(t.layers,t.zoom),this.segments=new Ua,this.segments2=new Ua,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,n){this.hasPattern=Ml("fill",this.layers,e);const i=this.layers[0].layout.get("fill-sort-key"),r=[];for(const{feature:o,id:a,index:s,sourceLayerIndex:l}of t){const t=this.layers[0]._featureFilter.needGeometry,c=Ha(o,t);if(!this.layers[0]._featureFilter.filter(new so(this.zoom),c,n))continue;const u=i?i.evaluate(c,{},n,e.availableImages):void 0,h={id:a,properties:o.properties,type:o.type,sourceLayerIndex:l,index:s,geometry:t?c.geometry:Za(o),patterns:{},sortKey:u};r.push(h)}i&&r.sort(((t,e)=>t.sortKey-e.sortKey));for(const i of r){const{geometry:r,index:o,sourceLayerIndex:a}=i;if(this.hasPattern){const t=Pl("fill",this.layers,i,this.zoom,e);this.patternFeatures.push(t)}else this.addFeature(i,r,o,n,{});e.featureIndex.insert(t[o].feature,r,o,a,this.index)}}update(t,e,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,n)}addFeatures(t,e,n){for(const t of this.patternFeatures)this.addFeature(t,t.geometry,t.index,e,n)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Xs),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),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(t,e,n,i,r){for(const t of kl(e,500)){let e=0;for(const n of t)e+=n.length;const n=this.segments.prepareSegment(e,this.layoutVertexArray,this.indexArray),i=n.vertexLength,r=[],o=[];for(const e of t){if(0===e.length)continue;e!==t[0]&&o.push(r.length/2);const n=this.segments2.prepareSegment(e.length,this.layoutVertexArray,this.indexArray2),i=n.vertexLength;this.layoutVertexArray.emplaceBack(e[0].x,e[0].y),this.indexArray2.emplaceBack(i+e.length-1,i),r.push(e[0].x),r.push(e[0].y);for(let t=1;t>3}if(r--,1===i||2===i)a+=t.readSVarint(),s+=t.readSVarint(),1===i&&(e&&l.push(e),e=[]),e.push(new o(a,s));else{if(7!==i)throw new Error("unknown command "+i);e&&e.push(e[0].clone())}}return e&&l.push(e),l},Bl.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,n=1,i=0,r=0,o=0,a=1/0,s=-1/0,l=1/0,c=-1/0;t.pos>3}if(i--,1===n||2===n)(r+=t.readSVarint())s&&(s=r),(o+=t.readSVarint())c&&(c=o);else if(7!==n)throw new Error("unknown command "+n)}return[a,l,s,c]},Bl.prototype.toGeoJSON=function(t,e,n){var i,r,o=this.extent*Math.pow(2,n),a=this.extent*t,s=this.extent*e,l=this.loadGeometry(),c=Bl.types[this.type];function u(t){for(var e=0;e>3;e=1===i?t.readString():2===i?t.readFloat():3===i?t.readDouble():4===i?t.readVarint64():5===i?t.readVarint():6===i?t.readSVarint():7===i?t.readBoolean():null}return e}(n))}function ql(t,e,n){if(3===t){var i=new Ul(n,n.readVarint()+n.pos);i.length&&(e[i.name]=i)}}Vl.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var e=this._pbf.readVarint()+this._pbf.pos;return new $l(this._pbf,e,this.extent,this._keys,this._values)};var Zl={VectorTile:function(t,e){this.layers=t.readFields(ql,{},e)},VectorTileFeature:$l,VectorTileLayer:Ul};const Hl=Zl.VectorTileFeature.types,Wl=Math.pow(2,13);function Xl(t,e,n,i,r,o,a,s){t.emplaceBack((e<<1)+a,(n<<1)+o,(Math.floor(i*Wl)<<1)+r,Math.round(s))}class Kl{constructor(){this.acc=new o(0,0),this.polyCount=[]}startRing(t){this.currentPolyCount={edges:0,top:0},this.polyCount.push(this.currentPolyCount),this.min||(this.min=new o(t.x,t.y),this.max=new o(t.x,t.y))}append(t,e){this.currentPolyCount.edges++,this.acc._add(t);let n=!!this.borders;const i=this.min,r=this.max;t.xr.x&&(r.x=t.x,n=!0),t.yr.y&&(r.y=t.y,n=!0),((0===t.x||t.x===Va)&&t.x===e.x)!=((0===t.y||t.y===Va)&&t.y===e.y)&&this.processBorderOverlap(t,e),n&&this.checkBorderIntersection(t,e)}checkBorderIntersection(t,e){e.x<0!=t.x<0&&this.addBorderIntersection(0,rn(e.y,t.y,(0-e.x)/(t.x-e.x))),e.x>Va!=t.x>Va&&this.addBorderIntersection(1,rn(e.y,t.y,(Va-e.x)/(t.x-e.x))),e.y<0!=t.y<0&&this.addBorderIntersection(2,rn(e.x,t.x,(0-e.y)/(t.y-e.y))),e.y>Va!=t.y>Va&&this.addBorderIntersection(3,rn(e.x,t.x,(Va-e.y)/(t.y-e.y)))}addBorderIntersection(t,e){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 n=this.borders[t];en[1]&&(n[1]=e)}processBorderOverlap(t,e){if(t.x===e.x){if(t.y===e.y)return;const n=0===t.x?0:1;this.addBorderIntersection(n,e.y),this.addBorderIntersection(n,t.y)}else{const n=0===t.y?2:3;this.addBorderIntersection(n,e.x),this.addBorderIntersection(n,t.x)}}centroid(){const t=this.polyCount.reduce(((t,e)=>t+e.edges),0);return 0!==t?this.acc.div(t)._round():new o(0,0)}span(){return new o(this.max.x-this.min.x,this.max.y-this.min.y)}intersectsCount(){return this.borders.reduce(((t,e)=>t+ +(e[0]!==Number.MAX_VALUE)),0)}}class Yl{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new Mo,this.centroidVertexArray=new la,this.indexArray=new Uo,this.programConfigurations=new Da(t.layers,t.zoom),this.segments=new Ua,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id)),this.enableTerrain=t.enableTerrain}populate(t,e,n){this.features=[],this.hasPattern=Ml("fill-extrusion",this.layers,e),this.featuresOnBorder=[],this.borders=[[],[],[],[]],this.borderDone=[!1,!1,!1,!1],this.tileToMeter=function(t){const e=Math.exp(Math.PI*(1-t.y/(1<t.x<=0))||a.every((t=>t.x>=Va))||a.every((t=>t.y<=0))||a.every((t=>t.y>=Va)))continue;for(let t=0;t=1){const n=r[t-1];if(!Jl(e,n)){o&&o.append(e,n),i.vertexLength+4>Ua.MAX_VERTEX_ARRAY_LENGTH&&(i=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const t=e.sub(n)._perp(),r=t.x/(Math.abs(t.x)+Math.abs(t.y)),s=t.y>0?1:0,l=n.dist(e);a+l>32768&&(a=0),Xl(this.layoutVertexArray,e.x,e.y,r,s,0,0,a),Xl(this.layoutVertexArray,e.x,e.y,r,s,0,1,a),a+=l,Xl(this.layoutVertexArray,n.x,n.y,r,s,0,0,a),Xl(this.layoutVertexArray,n.x,n.y,r,s,0,1,a);const c=i.vertexLength;this.indexArray.emplaceBack(c,c+2,c+1),this.indexArray.emplaceBack(c+1,c+2,c+3),i.vertexLength+=4,i.primitiveLength+=2}}}}if(i.vertexLength+e>Ua.MAX_VERTEX_ARRAY_LENGTH&&(i=this.segments.prepareSegment(e,this.layoutVertexArray,this.indexArray)),"Polygon"!==Hl[t.type])continue;const r=[],s=[],l=i.vertexLength;for(let t=0;t0){if(o.borders){o.vertexArrayOffset=this.centroidVertexArray.length;const t=o.borders,e=this.featuresOnBorder.push(o)-1;for(let n=0;n<4;n++)t[n][0]!==Number.MAX_VALUE&&this.borders[n].push(e)}this.encodeCentroid(o.borders?void 0:o.centroid(),o)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,n,r,i)}sortBorders(){for(let t=0;t<4;t++)this.borders[t].sort(((e,n)=>this.featuresOnBorder[e].borders[t][0]-this.featuresOnBorder[n].borders[t][0]))}encodeCentroid(t,e,n=!0){let i,r;if(t)if(0!==t.y){const n=e.span()._mult(this.tileToMeter);i=(Math.max(t.x,1)<<3)+Math.min(7,Math.round(n.x/10)),r=(Math.max(t.y,1)<<3)+Math.min(7,Math.round(n.y/10))}else i=Math.ceil(7*(t.x+450)),r=0;else i=0,r=+n;let o=n?this.centroidVertexArray.length:e.vertexArrayOffset;for(const t of e.polyCount){n&&this.centroidVertexArray.resize(this.centroidVertexArray.length+4*t.edges+t.top);for(let e=0;e<2*t.edges;e++)this.centroidVertexArray.emplace(o++,0,r),this.centroidVertexArray.emplace(o++,i,r);for(let e=0;eVa)||t.y===e.y&&(t.y<0||t.y>Va)}lr("FillExtrusionBucket",Yl,{omit:["layers","features"]}),lr("PartMetadata",Kl);var Ql={paint:new wo({"fill-extrusion-opacity":new _o(Bt["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new vo(Bt["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new _o(Bt["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new _o(Bt["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new yo(Bt["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new vo(Bt["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new vo(Bt["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new _o(Bt["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})};function tc(t,e){return t.x*e.x+t.y*e.y}function ec(t,e){if(1===t.length){let n=0;const i=e[n++];let r;for(;!r||i.equals(r);)if(r=e[n++],!r)return 1/0;for(;nt.id)),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach((t=>{this.gradients[t.id]={}})),this.layoutVertexArray=new Po,this.layoutVertexArray2=new Do,this.indexArray=new Uo,this.programConfigurations=new Da(t.layers,t.zoom),this.segments=new Ua,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,n){this.hasPattern=Ml("line",this.layers,e);const i=this.layers[0].layout.get("line-sort-key"),r=[];for(const{feature:e,id:o,index:a,sourceLayerIndex:s}of t){const t=this.layers[0]._featureFilter.needGeometry,l=Ha(e,t);if(!this.layers[0]._featureFilter.filter(new so(this.zoom),l,n))continue;const c=i?i.evaluate(l,{},n):void 0,u={id:o,properties:e.properties,type:e.type,sourceLayerIndex:s,index:a,geometry:t?l.geometry:Za(e),patterns:{},sortKey:c};r.push(u)}i&&r.sort(((t,e)=>t.sortKey-e.sortKey));const{lineAtlas:o,featureIndex:a}=e,s=this.addConstantDashes(o);for(const i of r){const{geometry:r,index:l,sourceLayerIndex:c}=i;if(s&&this.addFeatureDashes(i,o),this.hasPattern){const t=Pl("line",this.layers,i,this.zoom,e);this.patternFeatures.push(t)}else this.addFeature(i,r,l,n,o.positions);a.insert(t[l].feature,r,l,c,this.index)}}addConstantDashes(t){let e=!1;for(const n of this.layers){const i=n.paint.get("line-dasharray").value,r=n.layout.get("line-cap").value;if("constant"!==i.kind||"constant"!==r.kind)e=!0;else{const e=r.value,n=i.value;if(!n)continue;t.addDash(n.from,e),t.addDash(n.to,e),n.other&&t.addDash(n.other,e)}}return e}addFeatureDashes(t,e){const n=this.zoom;for(const i of this.layers){const r=i.paint.get("line-dasharray").value,o=i.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 t=r.value;if(!t)continue;a=t.other||t.to,s=t.to,l=t.from}else a=r.evaluate({zoom:n-1},t),s=r.evaluate({zoom:n},t),l=r.evaluate({zoom:n+1},t);"constant"===o.kind?c=u=h=o.value:(c=o.evaluate({zoom:n-1},t),u=o.evaluate({zoom:n},t),h=o.evaluate({zoom:n+1},t)),e.addDash(a,c),e.addDash(s,u),e.addDash(l,h);const d=e.getKey(a,c),p=e.getKey(s,u),f=e.getKey(l,h);t.patterns[i.id]={min:d,mid:p,max:f}}}update(t,e,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,n)}addFeatures(t,e,n){for(const t of this.patternFeatures)this.addFeature(t,t.geometry,t.index,e,n)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,sc)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,oc),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(t){if(t.properties&&t.properties.hasOwnProperty("mapbox_clip_start")&&t.properties.hasOwnProperty("mapbox_clip_end"))return{start:+t.properties.mapbox_clip_start,end:+t.properties.mapbox_clip_end}}addFeature(t,e,n,i,r){const o=this.layers[0].layout,a=o.get("line-join").evaluate(t,{}),s=o.get("line-cap").evaluate(t,{}),l=o.get("line-miter-limit"),c=o.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(const n of e)this.addLine(n,t,a,s,l,c);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,n,r,i)}addLine(t,e,n,i,r,o){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineSoFar=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let e=0;e=2&&t[s-1].equals(t[s-2]);)s--;let l=0;for(;l0;if(b&&e>l){const t=h.dist(d);if(t>2*c){const e=h.sub(h.sub(d)._mult(c/t)._round());this.updateDistance(d,e),this.addCurrentVertex(e,f,0,0,u),d=e}}const T=d&&p;let C=T?n:a?"butt":i;if(T&&"round"===C&&(yr&&(C="bevel"),"bevel"===C&&(y>2&&(C="flipbevel"),y100)g=m.mult(-1);else{const t=y*f.add(m).mag()/f.sub(m).mag();g._perp()._mult(t*(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 t=-Math.sqrt(y*y-1),e=w?t:0,n=w?0:t;if(d&&this.addCurrentVertex(h,f,e,n,u),"fakeround"===C){const t=Math.round(180*x/Math.PI/20);for(let e=1;e2*c){const e=h.add(p.sub(h)._mult(c/t)._round());this.updateDistance(h,e),this.addCurrentVertex(e,m,0,0,u),h=e}}}}addCurrentVertex(t,e,n,i,r,o=!1){const a=e.y*i-e.x,s=-e.y-e.x*i;this.addHalfVertex(t,e.x+e.y*n,e.y-e.x*n,o,!1,n,r),this.addHalfVertex(t,a,s,o,!0,-i,r)}addHalfVertex({x:t,y:e},n,i,r,o,a,s){this.layoutVertexArray.emplaceBack((t<<1)+(r?1:0),(e<<1)+(o?1:0),Math.round(63*n)+128,Math.round(63*i)+128,1+(0===a?0:a<0?-1:1),0,this.lineSoFar),this.lineClips&&this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length);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 t=this.totalDistance/(this.lineClips.end-this.lineClips.start);this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=t*this.lineClips.start+this.distance}else this.lineSoFar=this.distance}updateDistance(t,e){this.distance+=t.dist(e),this.updateScaledDistance()}}lr("LineBucket",uc,{omit:["layers","patternFeatures"]});const hc=new wo({"line-cap":new vo(Bt.layout_line["line-cap"]),"line-join":new vo(Bt.layout_line["line-join"]),"line-miter-limit":new _o(Bt.layout_line["line-miter-limit"]),"line-round-limit":new _o(Bt.layout_line["line-round-limit"]),"line-sort-key":new vo(Bt.layout_line["line-sort-key"])});var dc={paint:new wo({"line-opacity":new vo(Bt.paint_line["line-opacity"]),"line-color":new vo(Bt.paint_line["line-color"]),"line-translate":new _o(Bt.paint_line["line-translate"]),"line-translate-anchor":new _o(Bt.paint_line["line-translate-anchor"]),"line-width":new vo(Bt.paint_line["line-width"]),"line-gap-width":new vo(Bt.paint_line["line-gap-width"]),"line-offset":new vo(Bt.paint_line["line-offset"]),"line-blur":new vo(Bt.paint_line["line-blur"]),"line-dasharray":new yo(Bt.paint_line["line-dasharray"]),"line-pattern":new yo(Bt.paint_line["line-pattern"]),"line-gradient":new bo(Bt.paint_line["line-gradient"])}),layout:hc};const pc=new class extends vo{possiblyEvaluate(t,e){return e=new so(Math.floor(e.zoom),{now:e.now,fadeDuration:e.fadeDuration,zoomHistory:e.zoomHistory,transition:e.transition}),super.possiblyEvaluate(t,e)}evaluate(t,e,n,i){return e=x({},e,{zoom:Math.floor(e.zoom)}),super.evaluate(t,e,n,i)}}(dc.paint.properties["line-width"].specification);function fc(t,e){return e>0?e+2*t:t}pc.useIntegerZoom=!0;const mc=Ao([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),gc=Ao([{name:"a_projected_pos",components:3,type:"Float32"}],4);Ao([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const _c=Ao([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]),vc=Ao([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"}]);Ao([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{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 yc=Ao([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),xc=Ao([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);Ao([{name:"triangle",components:3,type:"Uint16"}]),Ao([{type:"Float32",name:"anchorX"},{type:"Float32",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"},{type:"Uint8",name:"flipState"}]),Ao([{type:"Float32",name:"anchorX"},{type:"Float32",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"}]),Ao([{type:"Float32",name:"offsetX"}]),Ao([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);var bc=24;const wc=128;function Tc(t,e){const{expression:n}=e;if("constant"===n.kind)return{kind:"constant",layoutSize:n.evaluate(new so(t+1))};if("source"===n.kind)return{kind:"source"};{const{zoomStops:e,interpolationType:i}=n;let r=0;for(;r{t.text=function(t,e,n){const i=e.layout.get("text-transform").evaluate(n,{});return"uppercase"===i?t=t.toLocaleUpperCase():"lowercase"===i&&(t=t.toLocaleLowerCase()),ao.applyArabicShaping&&(t=ao.applyArabicShaping(t)),t}(t.text,e,n)})),t}const kc={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};function Ic(t){return"︶"===t||"﹈"===t||"︸"===t||"﹄"===t||"﹂"===t||"︾"===t||"︼"===t||"︺"===t||"︘"===t||"﹀"===t||"︐"===t||"︓"===t||"︔"===t||"`"===t||" ̄"===t||"︑"===t||"︒"===t}function Mc(t){return"︵"===t||"﹇"===t||"︷"===t||"﹃"===t||"﹁"===t||"︽"===t||"︻"===t||"︹"===t||"︗"===t||"︿"===t}var Pc=function(t,e,n,i,r){var o,a,s=8*r-i-1,l=(1<>1,u=-7,h=n?r-1:0,d=n?-1:1,p=t[e+h];for(h+=d,o=p&(1<<-u)-1,p>>=-u,u+=s;u>0;o=256*o+t[e+h],h+=d,u-=8);for(a=o&(1<<-u)-1,o>>=-u,u+=i;u>0;a=256*a+t[e+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,i),o-=c}return(p?-1:1)*a*Math.pow(2,o-i)},Dc=function(t,e,n,i,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=i?0:o-1,f=i?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=u):(a=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-a))<1&&(a--,l*=2),(e+=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=(e*l-1)*Math.pow(2,r),a+=h):(s=e*Math.pow(2,h-1)*Math.pow(2,r),a=0));r>=8;t[n+p]=255&s,p+=f,s/=256,r-=8);for(a=a<0;t[n+p]=255&a,p+=f,a/=256,c-=8);t[n+p-f]|=128*m},zc=Oc;function Oc(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}Oc.Varint=0,Oc.Fixed64=1,Oc.Bytes=2,Oc.Fixed32=5;var Rc=4294967296,Lc=1/Rc,Fc="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function $c(t){return t.type===Oc.Bytes?t.readVarint()+t.pos:t.pos+1}function Bc(t,e,n){return n?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function Nc(t,e,n){var i=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));n.realloc(i);for(var r=n.pos-1;r>=t;r--)n.buf[r+i]=n.buf[r]}function jc(t,e){for(var n=0;n>>8,t[n+2]=e>>>16,t[n+3]=e>>>24}function Jc(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}function Qc(t,e,n){e.glyphs=[],1===t&&n.readMessage(tu,e)}function tu(t,e,n){if(3===t){const{id:t,bitmap:i,width:r,height:o,left:a,top:s,advance:l}=n.readMessage(eu,{});e.glyphs.push({id:t,bitmap:new Vs({width:r+6,height:o+6},i),metrics:{width:r,height:o,left:a,top:s,advance:l}})}else 4===t?e.ascender=n.readSVarint():5===t&&(e.descender=n.readSVarint())}function eu(t,e,n){1===t?e.id=n.readVarint():2===t?e.bitmap=n.readBytes():3===t?e.width=n.readVarint():4===t?e.height=n.readVarint():5===t?e.left=n.readSVarint():6===t?e.top=n.readSVarint():7===t&&(e.advance=n.readVarint())}function nu(t){let e=0,n=0;for(const i of t)e+=i.w*i.h,n=Math.max(n,i.w);t.sort(((t,e)=>e.h-t.h));const i=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),n),h:1/0}];let r=0,o=0;for(const e of t)for(let t=i.length-1;t>=0;t--){const n=i[t];if(!(e.w>n.w||e.h>n.h)){if(e.x=n.x,e.y=n.y,o=Math.max(o,e.y+e.h),r=Math.max(r,e.x+e.w),e.w===n.w&&e.h===n.h){const e=i.pop();t>3,o=this.pos;this.type=7&i,t(r,e,this),this.pos===o&&this.skip(i)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=Kc(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=Jc(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=Kc(this.buf,this.pos)+Kc(this.buf,this.pos+4)*Rc;return this.pos+=8,t},readSFixed64:function(){var t=Kc(this.buf,this.pos)+Jc(this.buf,this.pos+4)*Rc;return this.pos+=8,t},readFloat:function(){var t=Pc(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=Pc(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,n,i=this.buf;return e=127&(n=i[this.pos++]),n<128?e:(e|=(127&(n=i[this.pos++]))<<7,n<128?e:(e|=(127&(n=i[this.pos++]))<<14,n<128?e:(e|=(127&(n=i[this.pos++]))<<21,n<128?e:function(t,e,n){var i,r,o=n.buf;if(i=(112&(r=o[n.pos++]))>>4,r<128)return Bc(t,i,e);if(i|=(127&(r=o[n.pos++]))<<3,r<128)return Bc(t,i,e);if(i|=(127&(r=o[n.pos++]))<<10,r<128)return Bc(t,i,e);if(i|=(127&(r=o[n.pos++]))<<17,r<128)return Bc(t,i,e);if(i|=(127&(r=o[n.pos++]))<<24,r<128)return Bc(t,i,e);if(i|=(1&(r=o[n.pos++]))<<31,r<128)return Bc(t,i,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(n=i[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&Fc?function(t,e,n){return Fc.decode(t.subarray(e,n))}(this.buf,e,t):function(t,e,n){for(var i="",r=e;r239?4:l>223?3:l>191?2:1;if(r+u>n)break;1===u?l<128&&(c=l):2===u?128==(192&(o=t[r+1]))&&(c=(31&l)<<6|63&o)<=127&&(c=null):3===u?(a=t[r+2],128==(192&(o=t[r+1]))&&128==(192&a)&&((c=(15&l)<<12|(63&o)<<6|63&a)<=2047||c>=55296&&c<=57343)&&(c=null)):4===u&&(a=t[r+2],s=t[r+3],128==(192&(o=t[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,i+=String.fromCharCode(c>>>10&1023|55296),c=56320|1023&c),i+=String.fromCharCode(c),r+=u}return i}(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==Oc.Bytes)return t.push(this.readVarint(e));var n=$c(this);for(t=t||[];this.pos127;);else if(e===Oc.Bytes)this.pos=this.readVarint()+this.pos;else if(e===Oc.Fixed32)this.pos+=4;else{if(e!==Oc.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e268435455||t<0?function(t,e){var n,i;if(t>=0?(n=t%4294967296|0,i=t/4294967296|0):(i=~(-t/4294967296),4294967295^(n=~(-t%4294967296))?n=n+1|0:(n=0,i=i+1|0)),t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,n){n.buf[n.pos++]=127&t|128,t>>>=7,n.buf[n.pos++]=127&t|128,t>>>=7,n.buf[n.pos++]=127&t|128,t>>>=7,n.buf[n.pos++]=127&t|128,n.buf[n.pos]=127&(t>>>=7)}(n,0,e),function(t,e){var n=(7&t)<<4;e.buf[e.pos++]|=n|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t)))))}(i,e)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var e=this.pos;this.pos=function(t,e,n){for(var i,r,o=0;o55295&&i<57344){if(!r){i>56319||o+1===e.length?(t[n++]=239,t[n++]=191,t[n++]=189):r=i;continue}if(i<56320){t[n++]=239,t[n++]=191,t[n++]=189,r=i;continue}i=r-55296<<10|i-56320|65536,r=null}else r&&(t[n++]=239,t[n++]=191,t[n++]=189,r=null);i<128?t[n++]=i:(i<2048?t[n++]=i>>6|192:(i<65536?t[n++]=i>>12|224:(t[n++]=i>>18|240,t[n++]=i>>12&63|128),t[n++]=i>>6&63|128),t[n++]=63&i|128)}return n}(this.buf,t,this.pos);var n=this.pos-e;n>=128&&Nc(e,n,this),this.pos=e-1,this.writeVarint(n),this.pos+=n},writeFloat:function(t){this.realloc(4),Dc(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),Dc(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var n=0;n=128&&Nc(n,i,this),this.pos=n-1,this.writeVarint(i),this.pos+=i},writeMessage:function(t,e,n){this.writeTag(t,Oc.Bytes),this.writeRawMessage(e,n)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,jc,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,Uc,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,qc,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,Vc,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,Gc,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,Zc,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,Hc,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,Wc,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,Xc,e)},writeBytesField:function(t,e){this.writeTag(t,Oc.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,Oc.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,Oc.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,Oc.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,Oc.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,Oc.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,Oc.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,Oc.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,Oc.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,Oc.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}};class iu{constructor(t,{pixelRatio:e,version:n,stretchX:i,stretchY:r,content:o}){this.paddedRect=t,this.pixelRatio=e,this.stretchX=i,this.stretchY=r,this.content=o,this.version=n}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 ru{constructor(t,e){const n={},i={};this.haveRenderCallbacks=[];const r=[];this.addImages(t,n,r),this.addImages(e,i,r);const{w:o,h:a}=nu(r),s=new Gs({width:o||1,height:a||1});for(const e in t){const i=t[e],r=n[e].paddedRect;Gs.copy(i.data,s,{x:0,y:0},{x:r.x+1,y:r.y+1},i.data)}for(const t in e){const n=e[t],r=i[t].paddedRect,o=r.x+1,a=r.y+1,l=n.data.width,c=n.data.height;Gs.copy(n.data,s,{x:0,y:0},{x:o,y:a},n.data),Gs.copy(n.data,s,{x:0,y:c-1},{x:o,y:a-1},{width:l,height:1}),Gs.copy(n.data,s,{x:0,y:0},{x:o,y:a+c},{width:l,height:1}),Gs.copy(n.data,s,{x:l-1,y:0},{x:o-1,y:a},{width:1,height:c}),Gs.copy(n.data,s,{x:0,y:0},{x:o+l,y:a},{width:1,height:c})}this.image=s,this.iconPositions=n,this.patternPositions=i}addImages(t,e,n){for(const i in t){const r=t[i],o={x:0,y:0,w:r.data.width+2,h:r.data.height+2};n.push(o),e[i]=new iu(o,r),r.hasRenderCallback&&this.haveRenderCallbacks.push(i)}}patchUpdatedImages(t,e){t.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const n in t.updatedImages)this.patchUpdatedImage(this.iconPositions[n],t.getImage(n),e),this.patchUpdatedImage(this.patternPositions[n],t.getImage(n),e)}patchUpdatedImage(t,e,n){if(!t||!e)return;if(t.version===e.version)return;t.version=e.version;const[i,r]=t.tl;n.update(e.data,void 0,{x:i,y:r})}}lr("ImagePosition",iu),lr("ImageAtlas",ru);const ou={horizontal:1,vertical:2,horizontalOnly:3};class au{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(t,e){const n=new au;return n.scale=t||1,n.fontStack=e,n}static forImage(t){const e=new au;return e.imageName=t,e}}class su{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(t,e){const n=new su;for(let i=0;i=0&&n>=t&&cu[this.text.charCodeAt(n)];n--)e--;this.text=this.text.substring(t,e),this.sectionIndex=this.sectionIndex.slice(t,e)}substring(t,e){const n=new su;return n.text=this.text.substring(t,e),n.sectionIndex=this.sectionIndex.slice(t,e),n.sections=this.sections,n}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce(((t,e)=>Math.max(t,this.sections[e].scale)),0)}addTextSection(t,e){this.text+=t.text,this.sections.push(au.forText(t.scale,t.fontStack||e));const n=this.sections.length-1;for(let e=0;e=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function lu(t,e,n,i,r,o,a,s,l,c,u,h,d,p,f,m){const g=su.fromFeature(t,r);let _;h===ou.vertical&&g.verticalizePunctuation(d);const{processBidirectionalText:v,processStyledBidirectionalText:y}=ao;if(v&&1===g.sections.length){_=[];const t=v(g.toString(),gu(g,c,o,e,i,p,f));for(const e of t){const t=new su;t.text=e,t.sections=g.sections;for(let n=0;n0&&o>b&&(b=o)}else{const t=n[s.fontStack];if(!t)continue;t[m]&&(C=t[m]);const i=e[s.fontStack];if(!i)continue;const o=i.glyphs[m];if(!o)continue;if(y=o.metrics,S=8203!==m?bc:0,g){const t=void 0!==i.ascender?Math.abs(i.ascender):0,e=void 0!==i.descender?Math.abs(i.descender):0,n=(t+e)*_;w=0;let u=0;for(let n=0;n-n/2;){if(a--,a<0)return!1;s-=t[a].dist(o),o=t[a]}s+=t[a].dist(t[a+1]),a++;const l=[];let c=0;for(;si;)c-=l.shift().angleDelta;if(c>r)return!1;a++,s+=e.dist(n)}return!0}function Tu(t){let e=0;for(let n=0;nc){const u=(c-l)/o,h=rn(i.x,r.x,u),d=rn(i.y,r.y,u),p=new bu(h,d,r.angleTo(i),n);return!a||wu(t,p,s,a,e)?p:void 0}l+=o}}function Au(t,e,n,i,r,o,a,s,l){const c=Cu(i,o,a),u=Eu(i,r),h=u*a,d=0===t[0].x||t[0].x===l||0===t[0].y||t[0].y===l;return e-h=0&&_=0&&v=0&&d+c<=u){const n=new bu(_,v,m,e);n._round(),i&&!wu(t,n,o,i,r)||p.push(n)}}h+=f}return s||p.length||a||(p=ku(t,h/2,n,i,r,o,a,!0,l)),p}function Iu(t,e,n,i,r){const a=[];for(let s=0;s=i&&u.x>=i||(s.x>=i?s=new o(i,s.y+(i-s.x)/(u.x-s.x)*(u.y-s.y))._round():u.x>=i&&(u=new o(i,s.y+(i-s.x)/(u.x-s.x)*(u.y-s.y))._round()),s.y>=r&&u.y>=r||(s.y>=r?s=new o(s.x+(r-s.y)/(u.y-s.y)*(u.x-s.x),r)._round():u.y>=r&&(u=new o(s.x+(r-s.y)/(u.y-s.y)*(u.x-s.x),r)._round()),c&&s.equals(c[c.length-1])||(c=[s],a.push(c)),c.push(u)))))}}return a}lr("Anchor",bu);var Mu=zu,Pu=zu,Du=1e20;function zu(t,e,n,i,r,o){this.fontSize=t||24,this.buffer=void 0===e?3:e,this.cutoff=i||.25,this.fontFamily=r||"sans-serif",this.fontWeight=o||"normal",this.radius=n||8;var a=this.size=this.fontSize+2*this.buffer,s=a+2*this.buffer;this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=a,this.ctx=this.canvas.getContext("2d"),this.ctx.font=this.fontWeight+" "+this.fontSize+"px "+this.fontFamily,this.ctx.textAlign="left",this.ctx.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),this.useMetrics=void 0!==this.ctx.measureText("A").actualBoundingBoxLeft,this.middle=Math.round(a/2*(navigator.userAgent.indexOf("Gecko/")>=0?1.2:1))}function Ou(t,e,n,i,r,o){for(var a=0;a-1);o[++l]=s,a[l]=c,a[l+1]=Du}for(s=0,l=0;s{let i=this.entries[t];i||(i=this.entries[t]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let r=i.glyphs[e];if(void 0!==r)return void n(null,{stack:t,id:e,glyph:r});if(r=this._tinySDF(i,t,e),r)return i.glyphs[e]=r,void n(null,{stack:t,id:e,glyph:r});const o=Math.floor(e/256);if(256*o>65535)return void n(new Error("glyphs > 65535 not supported"));if(i.ranges[o])return void n(null,{stack:t,id:e,glyph:r});let a=i.requests[o];a||(a=i.requests[o]=[],Fu.loadGlyphRange(t,o,this.url,this.requestManager,((t,e)=>{if(e){i.ascender=e.ascender,i.descender=e.descender;for(const t in e.glyphs)this._doesCharSupportLocalGlyph(+t)||(i.glyphs[+t]=e.glyphs[+t]);i.ranges[o]=!0}for(const n of a)n(t,e);delete i.requests[o]}))),a.push(((i,r)=>{i?n(i):r&&n(null,{stack:t,id:e,glyph:r.glyphs[e]||null})}))}),((t,n)=>{if(t)e(t);else if(n){const t={};for(const{stack:e,id:i,glyph:r}of n)void 0===t[e]&&(t[e]={}),void 0===t[e].glyphs&&(t[e].glyphs={}),t[e].glyphs[i]=r&&{id:r.id,bitmap:r.bitmap.clone(),metrics:r.metrics},t[e].ascender=this.entries[e].ascender,t[e].descender=this.entries[e].descender;e(null,t)}}))}_doesCharSupportLocalGlyph(t){return this.localGlyphMode!==Lu.none&&(this.localGlyphMode===Lu.all?!!this.localFontFamily:!!this.localFontFamily&&(Mr(t)||zr(t)||br(t)||wr(t))||xr(t))}_tinySDF(t,e,n){const i=this.localFontFamily;if(!i)return;if(!this._doesCharSupportLocalGlyph(n))return;let r=t.tinySDF;if(!r){let n="400";/bold/i.test(e)?n="900":/medium/i.test(e)?n="500":/light/i.test(e)&&(n="200"),r=t.tinySDF=new Fu.TinySDF(48,6,16,.25,i,n)}if(this.localGlyphs[r.fontWeight][n])return this.localGlyphs[r.fontWeight][n];const{data:o,metrics:a}=r.drawWithMetrics(String.fromCharCode(n)),{sdfWidth:s,sdfHeight:l,width:c,height:u,left:h,top:d,advance:p}=a;return this.localGlyphs[r.fontWeight][n]={id:n,bitmap:new Vs({width:s,height:l},o),metrics:{width:c/2,height:u/2,left:h/2,top:d/2-27,advance:p/2,localGlyph:!0}}}}function $u(t,e,n,i){const r=[],a=t.image,s=a.pixelRatio,l=a.paddedRect.w-2,c=a.paddedRect.h-2,u=t.right-t.left,h=t.bottom-t.top,d=a.stretchX||[[0,l]],p=a.stretchY||[[0,c]],f=(t,e)=>t+e[1]-e[0],m=d.reduce(f,0),g=p.reduce(f,0),_=l-m,v=c-g;let y=0,x=m,b=0,w=g,T=0,C=_,E=0,S=v;if(a.content&&i){const t=a.content;y=Bu(d,0,t[0]),b=Bu(p,0,t[1]),x=Bu(d,t[0],t[2]),w=Bu(p,t[1],t[3]),T=t[0]-y,E=t[1]-b,C=t[2]-t[0]-x,S=t[3]-t[1]-w}const A=(i,r,l,c)=>{const d=ju(i.stretch-y,x,u,t.left),p=Uu(i.fixed-T,C,i.stretch,m),f=ju(r.stretch-b,w,h,t.top),_=Uu(r.fixed-E,S,r.stretch,g),v=ju(l.stretch-y,x,u,t.left),A=Uu(l.fixed-T,C,l.stretch,m),k=ju(c.stretch-b,w,h,t.top),I=Uu(c.fixed-E,S,c.stretch,g),M=new o(d,f),P=new o(v,f),D=new o(v,k),z=new o(d,k),O=new o(p/s,_/s),R=new o(A/s,I/s),L=e*Math.PI/180;if(L){const t=Math.sin(L),e=Math.cos(L),n=[e,-t,t,e];M._matMult(n),P._matMult(n),z._matMult(n),D._matMult(n)}const F=i.stretch+i.fixed,$=r.stretch+r.fixed;return{tl:M,tr:P,bl:z,br:D,tex:{x:a.paddedRect.x+1+F,y:a.paddedRect.y+1+$,w:l.stretch+l.fixed-F,h:c.stretch+c.fixed-$},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:O,pixelOffsetBR:R,minFontScaleX:C/s/u,minFontScaleY:S/s/h,isSDF:n}};if(i&&(a.stretchX||a.stretchY)){const t=Nu(d,_,m),e=Nu(p,v,g);for(let n=0;n{if(t)r(t);else if(e){const t={},n=function(t){return new zc(t).readFields(Qc,{})}(e);for(const e of n.glyphs)t[e.id]=e;r(null,{glyphs:t,ascender:n.ascender,descender:n.descender})}}))},Fu.TinySDF=Mu;class Gu{constructor(t=[],e=qu){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this._down(t)}push(t){this.data.push(t),this.length++,this._up(this.length-1)}pop(){if(0===this.length)return;const t=this.data[0],e=this.data.pop();return this.length--,this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:e,compare:n}=this,i=e[t];for(;t>0;){const r=t-1>>1,o=e[r];if(n(i,o)>=0)break;e[t]=o,t=r}e[t]=i}_down(t){const{data:e,compare:n}=this,i=this.length>>1,r=e[t];for(;t=0)break;e[t]=o,t=i}e[t]=r}}function qu(t,e){return te?1:0}function Zu(t,e=1,n=!1){let i=1/0,r=1/0,a=-1/0,s=-1/0;const l=t[0];for(let t=0;ta)&&(a=e.x),(!t||e.y>s)&&(s=e.y)}const c=Math.min(a-i,s-r);let u=c/2;const h=new Gu([],Hu);if(0===c)return new o(i,r);for(let e=i;ed.d||!d.d)&&(d=n),n.max-d.d<=e||(u=n.h/2,h.push(new Wu(n.p.x-u,n.p.y-u,u,t)),h.push(new Wu(n.p.x+u,n.p.y-u,u,t)),h.push(new Wu(n.p.x-u,n.p.y+u,u,t)),h.push(new Wu(n.p.x+u,n.p.y+u,u,t)),p+=4)}return d.p}function Hu(t,e){return e.max-t.max}function Wu(t,e,n,i){this.p=new o(t,e),this.h=n,this.d=function(t,e){let n=!1,i=1/0;for(let r=0;rt.y!=s.y>t.y&&t.x<(s.x-r.x)*(t.y-r.y)/(s.y-r.y)+r.x&&(n=!n),i=Math.min(i,is(t,r,s))}}return(n?1:-1)*Math.sqrt(i)}(this.p,i),this.max=this.d+this.h*Math.SQRT2}const Xu=Number.POSITIVE_INFINITY,Ku=Math.sqrt(2);function Yu(t,e){return e[1]!==Xu?function(t,e,n){let i=0,r=0;switch(e=Math.abs(e),n=Math.abs(n),t){case"top-right":case"top-left":case"top":r=n-7;break;case"bottom-right":case"bottom-left":case"bottom":r=7-n}switch(t){case"top-right":case"bottom-right":case"right":i=-e;break;case"top-left":case"bottom-left":case"left":i=e}return[i,r]}(t,e[0],e[1]):function(t,e){let n=0,i=0;e<0&&(e=0);const r=e/Ku;switch(t){case"top-right":case"top-left":i=r-7;break;case"bottom-right":case"bottom-left":i=7-r;break;case"bottom":i=7-e;break;case"top":i=e-7}switch(t){case"top-right":case"bottom-right":n=-r;break;case"top-left":case"bottom-left":n=r;break;case"left":n=e;break;case"right":n=-e}return[n,i]}(t,e[0])}function Ju(t,e,n,i,r,o,a,s){t.createArrays(),t.tilePixelRatio=Va/(512*t.overscaling),t.compareText={},t.iconsNeedLinear=!1;const l=t.layers[0].layout,c=t.layers[0]._unevaluatedLayout._values,u={};if("composite"===t.textSizeData.kind){const{minZoom:e,maxZoom:n}=t.textSizeData;u.compositeTextSizes=[c["text-size"].possiblyEvaluate(new so(e),a),c["text-size"].possiblyEvaluate(new so(n),a)]}if("composite"===t.iconSizeData.kind){const{minZoom:e,maxZoom:n}=t.iconSizeData;u.compositeIconSizes=[c["icon-size"].possiblyEvaluate(new so(e),a),c["icon-size"].possiblyEvaluate(new so(n),a)]}u.layoutTextSize=c["text-size"].possiblyEvaluate(new so(s+1),a),u.layoutIconSize=c["icon-size"].possiblyEvaluate(new so(s+1),a),u.textMaxSize=c["text-size"].possiblyEvaluate(new so(18),a);const h="map"===l.get("text-rotation-alignment")&&"point"!==l.get("symbol-placement"),d=l.get("text-size");for(const o of t.features){const s=l.get("text-font").evaluate(o,{},a).join(","),c=d.evaluate(o,{},a),p=u.layoutTextSize.evaluate(o,{},a),f=(u.layoutIconSize.evaluate(o,{},a),{horizontal:{},vertical:void 0}),m=o.text;let g,_=[0,0];if(m){const i=m.toString(),u=l.get("text-letter-spacing").evaluate(o,{},a)*bc,d=l.get("text-line-height").evaluate(o,{},a)*bc,g=Ur(i)?u:0,v=l.get("text-anchor").evaluate(o,{},a),y=l.get("text-variable-anchor");if(!y){const t=l.get("text-radial-offset").evaluate(o,{},a);_=t?Yu(v,[t*bc,Xu]):l.get("text-offset").evaluate(o,{},a).map((t=>t*bc))}let x=h?"center":l.get("text-justify").evaluate(o,{},a);const b=l.get("symbol-placement"),w="point"===b,T="point"===b?l.get("text-max-width").evaluate(o,{},a)*bc:0,C=o=>{t.allowVerticalPlacement&&jr(i)&&(f.vertical=lu(m,e,n,r,s,T,d,v,o,g,_,ou.vertical,!0,b,p,c))};if(!h&&y){const t="auto"===x?y.map((t=>Qu(t))):[x];let i=!1;for(let o=0;o=0||!jr(i)){const t=lu(m,e,n,r,s,T,d,v,x,g,_,ou.horizontal,!1,b,p,c);t&&(f.horizontal[x]=t)}C("point"===b?"left":x)}}let v=!1;if(o.icon&&o.icon.name){const e=i[o.icon.name];e&&(g=yu(r[o.icon.name],l.get("icon-offset").evaluate(o,{},a),l.get("icon-anchor").evaluate(o,{},a)),v=e.sdf,void 0===t.sdfIcons?t.sdfIcons=e.sdf:t.sdfIcons!==e.sdf&&D("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(e.pixelRatio!==t.pixelRatio||0!==l.get("icon-rotate").constantOr(1))&&(t.iconsNeedLinear=!0))}const y=ih(f.horizontal)||f.vertical;t.iconsInText||(t.iconsInText=!!y&&y.iconsInText),(y||g)&&th(t,o,f,g,i,u,p,0,_,v,a)}o&&t.generateCollisionDebugBuffers(s,t.collisionBoxArray)}function Qu(t){switch(t){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function th(t,e,n,i,r,o,a,s,l,c,u){let d=o.textMaxSize.evaluate(e,{},u);void 0===d&&(d=a);const p=t.layers[0].layout,f=p.get("icon-offset").evaluate(e,{},u),m=ih(n.horizontal)||n.vertical,g=a/24,_=t.tilePixelRatio*d/24,v=t.tilePixelRatio*p.get("symbol-spacing"),y=p.get("text-padding")*t.tilePixelRatio,x=p.get("icon-padding")*t.tilePixelRatio,b=h(p.get("text-max-angle")),w="map"===p.get("text-rotation-alignment")&&"point"!==p.get("symbol-placement"),T="map"===p.get("icon-rotation-alignment")&&"point"!==p.get("symbol-placement"),C=p.get("symbol-placement"),E=v/2,S=p.get("icon-text-fit");let A;i&&"none"!==S&&(t.allowVerticalPlacement&&n.vertical&&(A=xu(i,n.vertical,S,p.get("icon-text-fit-padding"),f,g)),m&&(i=xu(i,m,S,p.get("icon-text-fit-padding"),f,g)));const k=(s,h)=>{h.x<0||h.x>=Va||h.y<0||h.y>=Va||function(t,e,n,i,r,o,a,s,l,c,u,h,d,p,f,m,g,_,v,y,x,b,w,T){const C=t.addToLineVertexArray(e,n);let E,S,A,k,I,M,P,z=0,O=0,R=0,L=0,F=-1,$=-1;const B={};let N=pa(""),j=0,U=0;if(void 0===s._unevaluatedLayout.getValue("text-radial-offset")?[j,U]=s.layout.get("text-offset").evaluate(y,{},w).map((t=>t*bc)):(j=s.layout.get("text-radial-offset").evaluate(y,{},w)*bc,U=Xu),t.allowVerticalPlacement&&i.vertical){const t=i.vertical;if(p)M=oh(t),a&&(P=oh(a));else{const n=s.layout.get("text-rotate").evaluate(y,{},w)+90;A=rh(l,e,c,u,h,t,d,n,f),a&&(k=rh(l,e,c,u,h,a,g,n))}}if(r){const n=s.layout.get("icon-rotate").evaluate(y,{},w),i="none"!==s.layout.get("icon-text-fit"),o=$u(r,n,b,i),d=a?$u(a,n,b,i):void 0;S=rh(l,e,c,u,h,r,g,n),z=4*o.length;const p=t.iconSizeData;let f=null;"source"===p.kind?(f=[wc*s.layout.get("icon-size").evaluate(y,{},w)],f[0]>eh&&D(`${t.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):"composite"===p.kind&&(f=[wc*x.compositeIconSizes[0].evaluate(y,{},w),wc*x.compositeIconSizes[1].evaluate(y,{},w)],(f[0]>eh||f[1]>eh)&&D(`${t.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),t.addSymbols(t.icon,o,f,v,_,y,!1,e,C.lineStartIndex,C.lineLength,-1,w),F=t.icon.placedSymbolArray.length-1,d&&(O=4*d.length,t.addSymbols(t.icon,d,f,v,_,y,ou.vertical,e,C.lineStartIndex,C.lineLength,-1,w),$=t.icon.placedSymbolArray.length-1)}for(const n in i.horizontal){const r=i.horizontal[n];E||(N=pa(r.text),p?I=oh(r):E=rh(l,e,c,u,h,r,d,s.layout.get("text-rotate").evaluate(y,{},w),f));const a=1===r.positionedLines.length;if(R+=nh(t,e,r,o,s,p,y,f,C,i.vertical?ou.horizontal:ou.horizontalOnly,a?Object.keys(i.horizontal):[n],B,F,x,w),a)break}i.vertical&&(L+=nh(t,e,i.vertical,o,s,p,y,f,C,ou.vertical,["vertical"],B,$,x,w));let V=-1;const G=(t,e)=>t?Math.max(t,e):e;V=G(I,V),V=G(M,V),V=G(P,V);const q=V>-1?1:0;q&&(V*=T/bc),t.glyphOffsetArray.length>=fh.MAX_GLYPHS&&D("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==y.sortKey&&t.addToSortKeyRanges(t.symbolInstances.length,y.sortKey),t.symbolInstances.emplaceBack(e.x,e.y,B.right>=0?B.right:-1,B.center>=0?B.center:-1,B.left>=0?B.left:-1,B.vertical>=0?B.vertical:-1,F,$,N,void 0!==E?E:t.collisionBoxArray.length,void 0!==E?E+1:t.collisionBoxArray.length,void 0!==A?A:t.collisionBoxArray.length,void 0!==A?A+1:t.collisionBoxArray.length,void 0!==S?S:t.collisionBoxArray.length,void 0!==S?S+1:t.collisionBoxArray.length,k||t.collisionBoxArray.length,k?k+1:t.collisionBoxArray.length,c,R,L,z,O,q,0,j,U,V)}(t,h,s,n,i,r,A,t.layers[0],t.collisionBoxArray,e.index,e.sourceLayerIndex,t.index,y,w,l,0,x,T,f,e,o,c,u,a)};if("line"===C)for(const r of Iu(e.geometry,0,0,Va,Va)){const e=Au(r,v,b,n.vertical||m,i,24,_,t.overscaling,Va);for(const n of e){const e=m;e&&ah(t,e.text,E,n)||k(r,n)}}else if("line-center"===C){for(const t of e.geometry)if(t.length>1){const e=Su(t,b,n.vertical||m,i,24,_);e&&k(t,e)}}else if("Polygon"===e.type)for(const t of kl(e.geometry,0)){const e=Zu(t,16);k(t[0],new bu(e.x,e.y,0))}else if("LineString"===e.type)for(const t of e.geometry)k(t,new bu(t[0].x,t[0].y,0));else if("Point"===e.type)for(const t of e.geometry)for(const e of t)k([e],new bu(e.x,e.y,0))}const eh=32640;function nh(t,e,n,i,r,a,s,l,c,u,h,d,p,f,m){const g=function(t,e,n,i,r,a,s,l){const c=[];if(0===e.positionedLines.length)return c;const u=i.layout.get("text-rotate").evaluate(a,{})*Math.PI/180,h=function(t){const e=t[0],n=t[1],i=e*n;return i>0?[e,-n]:i<0?[-e,n]:0===e?[n,e]:[n,-e]}(n);let d=Math.abs(e.top-e.bottom);for(const t of e.positionedLines)d-=t.lineOffset;const p=e.positionedLines.length,f=d/p;let m=e.top-n[1];for(let t=0;teh&&D(`${t.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):"composite"===_.kind&&(v=[wc*f.compositeTextSizes[0].evaluate(s,{},m),wc*f.compositeTextSizes[1].evaluate(s,{},m)],(v[0]>eh||v[1]>eh)&&D(`${t.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),t.addSymbols(t.text,g,v,l,a,s,u,e,c.lineStartIndex,c.lineLength,p,m);for(const e of h)d[e]=t.text.placedSymbolArray.length-1;return 4*g.length}function ih(t){for(const e in t)return t[e];return null}function rh(t,e,n,i,r,a,s,l,c){let u=a.top,d=a.bottom,p=a.left,f=a.right;const m=a.collisionPadding;if(m&&(p-=m[0],u-=m[1],f+=m[2],d+=m[3]),l){const t=new o(p,u),e=new o(f,u),n=new o(p,d),i=new o(f,d),r=h(l);let a=new o(0,0);c&&(a=new o(c[0],c[1])),t._rotateAround(r,a),e._rotateAround(r,a),n._rotateAround(r,a),i._rotateAround(r,a),p=Math.min(t.x,e.x,n.x,i.x),f=Math.max(t.x,e.x,n.x,i.x),u=Math.min(t.y,e.y,n.y,i.y),d=Math.max(t.y,e.y,n.y,i.y)}return t.emplaceBack(e.x,e.y,p,u,f,d,s,n,i,r),t.length-1}function oh(t){t.collisionPadding&&(t.top-=t.collisionPadding[1],t.bottom+=t.collisionPadding[3]);const e=t.bottom-t.top;return e>0?Math.max(10,e):null}function ah(t,e,n,i){const r=t.compareText;if(e in r){const t=r[e];for(let e=t.length-1;e>=0;e--)if(i.dist(t[e])t.id)),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=gs([]),this.placementViewportMatrix=gs([]);const e=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Tc(this.zoom,e["text-size"]),this.iconSizeData=Tc(this.zoom,e["icon-size"]);const n=this.layers[0].layout,i=n.get("symbol-sort-key"),r=n.get("symbol-z-order");this.canOverlap=n.get("text-allow-overlap")||n.get("icon-allow-overlap")||n.get("text-ignore-placement")||n.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==r&&void 0!==i.constantOr(1),this.sortFeaturesByY=("viewport-y"===r||"auto"===r&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=n.get("text-writing-mode").map((t=>ou[t])),this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id)),this.sourceID=t.sourceID}createArrays(){this.text=new dh(new Da(this.layers,this.zoom,(t=>/^text/.test(t)))),this.icon=new dh(new Da(this.layers,this.zoom,(t=>/^icon/.test(t)))),this.glyphOffsetArray=new ia,this.lineVertexArray=new ra,this.symbolInstances=new na}calculateGlyphDependencies(t,e,n,i,r){for(let n=0;n0)&&("constant"!==o.value.kind||o.value.value.length>0),c="constant"!==s.value.kind||!!s.value.value||Object.keys(s.parameters).length>0,u=r.get("symbol-sort-key");if(this.features=[],!l&&!c)return;const h=e.iconDependencies,d=e.glyphDependencies,p=e.availableImages,f=new so(this.zoom);for(const{feature:e,id:a,index:s,sourceLayerIndex:m}of t){const t=i._featureFilter.needGeometry,g=Ha(e,t);if(!i._featureFilter.filter(f,g,n))continue;let _,v;if(t||(g.geometry=Za(e)),l){const t=i.getValueAndResolveTokens("text-field",g,n,p),e=fe.factory(t);hh(e)&&(this.hasRTLText=!0),(!this.hasRTLText||"unavailable"===ro()||this.hasRTLText&&ao.isParsed())&&(_=Ac(e,i,g))}if(c){const t=i.getValueAndResolveTokens("icon-image",g,n,p);v=t instanceof me?t:me.fromString(t)}if(!_&&!v)continue;const y=this.sortFeaturesByKey?u.evaluate(g,{},n):void 0;if(this.features.push({id:a,text:_,icon:v,index:s,sourceLayerIndex:m,geometry:g.geometry,properties:e.properties,type:sh[e.type],sortKey:y}),v&&(h[v.name]=!0),_){const t=o.evaluate(g,{},n).join(","),e="map"===r.get("text-rotation-alignment")&&"point"!==r.get("symbol-placement");this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(ou.vertical)>=0;for(const n of _.sections)if(n.image)h[n.image.name]=!0;else{const i=jr(_.toString()),r=n.fontStack||t,o=d[r]=d[r]||{};this.calculateGlyphDependencies(n.text,o,e,this.allowVerticalPlacement,i)}}}"line"===r.get("symbol-placement")&&(this.features=function(t){const e={},n={},i=[];let r=0;function o(e){i.push(t[e]),r++}function a(t,e,r){const o=n[t];return delete n[t],n[e]=o,i[o].geometry[0].pop(),i[o].geometry[0]=i[o].geometry[0].concat(r[0]),o}function s(t,n,r){const o=e[n];return delete e[n],e[t]=o,i[o].geometry[0].shift(),i[o].geometry[0]=r[0].concat(i[o].geometry[0]),o}function l(t,e,n){const i=n?e[0][e[0].length-1]:e[0][0];return`${t}:${i.x}:${i.y}`}for(let c=0;ct.geometry))}(this.features)),this.sortFeaturesByKey&&this.features.sort(((t,e)=>t.sortKey-e.sortKey))}update(t,e,n){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,e,this.layers,n),this.icon.programConfigurations.updatePaintArrays(t,e,this.layers,n))}isEmpty(){return 0===this.symbolInstances.length&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(t,e){const n=this.lineVertexArray.length;if(void 0!==t.segment){let n=t.dist(e[t.segment+1]),i=t.dist(e[t.segment]);const r={};for(let i=t.segment+1;i=0;n--)r[n]={x:e[n].x,y:e[n].y,tileUnitDistanceFromAnchor:i},n>0&&(i+=e[n-1].dist(e[n]));for(let t=0;t=0?e.rightJustifiedTextSymbolIndex:e.centerJustifiedTextSymbolIndex>=0?e.centerJustifiedTextSymbolIndex:e.leftJustifiedTextSymbolIndex>=0?e.leftJustifiedTextSymbolIndex:e.verticalPlacedTextSymbolIndex>=0?e.verticalPlacedTextSymbolIndex:i),o=Cc(this.textSizeData,t,r)/bc;return this.tilePixelRatio*o}getSymbolInstanceIconSize(t,e,n){const i=this.icon.placedSymbolArray.get(n),r=Cc(this.iconSizeData,t,i);return this.tilePixelRatio*r}_commitDebugCollisionVertexUpdate(t,e,n){t.emplaceBack(e,-n,-n),t.emplaceBack(e,n,-n),t.emplaceBack(e,n,n),t.emplaceBack(e,-n,n)}_updateTextDebugCollisionBoxes(t,e,n,i,r,o){for(let a=i;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(t,e){const n=t.placedSymbolArray.get(e),i=n.vertexStartIndex+4*n.numGlyphs;for(let e=n.vertexStartIndex;ei[t]-i[e]||r[e]-r[t])),o}addToSortKeyRanges(t,e){const n=this.sortKeyRanges[this.sortKeyRanges.length-1];n&&n.sortKey===e?n.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:e,symbolInstanceStart:t,symbolInstanceEnd:t+1})}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const t of this.symbolInstanceIndexes){const e=this.symbolInstances.get(t);this.featureSortOrder.push(e.featureIndex),[e.rightJustifiedTextSymbolIndex,e.centerJustifiedTextSymbolIndex,e.leftJustifiedTextSymbolIndex].forEach(((t,e,n)=>{t>=0&&n.indexOf(t)===e&&this.addIndicesForPlacedSymbol(this.text,t)})),e.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,e.verticalPlacedTextSymbolIndex),e.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,e.placedIconSymbolIndex),e.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,e.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}lr("SymbolBucket",fh,{omit:["layers","collisionBoxArray","features","compareText"]}),fh.MAX_GLYPHS=65535,fh.addDynamicAttributes=uh;const mh=new wo({"symbol-placement":new _o(Bt.layout_symbol["symbol-placement"]),"symbol-spacing":new _o(Bt.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new _o(Bt.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new vo(Bt.layout_symbol["symbol-sort-key"]),"symbol-z-order":new _o(Bt.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new _o(Bt.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new _o(Bt.layout_symbol["icon-ignore-placement"]),"icon-optional":new _o(Bt.layout_symbol["icon-optional"]),"icon-rotation-alignment":new _o(Bt.layout_symbol["icon-rotation-alignment"]),"icon-size":new vo(Bt.layout_symbol["icon-size"]),"icon-text-fit":new _o(Bt.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new _o(Bt.layout_symbol["icon-text-fit-padding"]),"icon-image":new vo(Bt.layout_symbol["icon-image"]),"icon-rotate":new vo(Bt.layout_symbol["icon-rotate"]),"icon-padding":new _o(Bt.layout_symbol["icon-padding"]),"icon-keep-upright":new _o(Bt.layout_symbol["icon-keep-upright"]),"icon-offset":new vo(Bt.layout_symbol["icon-offset"]),"icon-anchor":new vo(Bt.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new _o(Bt.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new _o(Bt.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new _o(Bt.layout_symbol["text-rotation-alignment"]),"text-field":new vo(Bt.layout_symbol["text-field"]),"text-font":new vo(Bt.layout_symbol["text-font"]),"text-size":new vo(Bt.layout_symbol["text-size"]),"text-max-width":new vo(Bt.layout_symbol["text-max-width"]),"text-line-height":new vo(Bt.layout_symbol["text-line-height"]),"text-letter-spacing":new vo(Bt.layout_symbol["text-letter-spacing"]),"text-justify":new vo(Bt.layout_symbol["text-justify"]),"text-radial-offset":new vo(Bt.layout_symbol["text-radial-offset"]),"text-variable-anchor":new _o(Bt.layout_symbol["text-variable-anchor"]),"text-anchor":new vo(Bt.layout_symbol["text-anchor"]),"text-max-angle":new _o(Bt.layout_symbol["text-max-angle"]),"text-writing-mode":new _o(Bt.layout_symbol["text-writing-mode"]),"text-rotate":new vo(Bt.layout_symbol["text-rotate"]),"text-padding":new _o(Bt.layout_symbol["text-padding"]),"text-keep-upright":new _o(Bt.layout_symbol["text-keep-upright"]),"text-transform":new vo(Bt.layout_symbol["text-transform"]),"text-offset":new vo(Bt.layout_symbol["text-offset"]),"text-allow-overlap":new _o(Bt.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new _o(Bt.layout_symbol["text-ignore-placement"]),"text-optional":new _o(Bt.layout_symbol["text-optional"])});var gh={paint:new wo({"icon-opacity":new vo(Bt.paint_symbol["icon-opacity"]),"icon-color":new vo(Bt.paint_symbol["icon-color"]),"icon-halo-color":new vo(Bt.paint_symbol["icon-halo-color"]),"icon-halo-width":new vo(Bt.paint_symbol["icon-halo-width"]),"icon-halo-blur":new vo(Bt.paint_symbol["icon-halo-blur"]),"icon-translate":new _o(Bt.paint_symbol["icon-translate"]),"icon-translate-anchor":new _o(Bt.paint_symbol["icon-translate-anchor"]),"text-opacity":new vo(Bt.paint_symbol["text-opacity"]),"text-color":new vo(Bt.paint_symbol["text-color"],{runtimeType:Yt,getOverride:t=>t.textColor,hasOverride:t=>!!t.textColor}),"text-halo-color":new vo(Bt.paint_symbol["text-halo-color"]),"text-halo-width":new vo(Bt.paint_symbol["text-halo-width"]),"text-halo-blur":new vo(Bt.paint_symbol["text-halo-blur"]),"text-translate":new _o(Bt.paint_symbol["text-translate"]),"text-translate-anchor":new _o(Bt.paint_symbol["text-translate-anchor"])}),layout:mh};class _h{constructor(t){this.type=t.property.overrides?t.property.overrides.runtimeType:Ht,this.defaultValue=t}evaluate(t){if(t.formattedSection){const e=this.defaultValue.property.overrides;if(e&&e.hasOverride(t.formattedSection))return e.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}lr("FormatSectionOverride",_h,{omit:["defaultValue"]});class vh extends Ba{constructor(t){super(t,gh)}recalculate(t,e){super.recalculate(t,e),"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 n=this.layout.get("text-writing-mode");if(n){const t=[];for(const e of n)t.indexOf(e)<0&&t.push(e);this.layout._values["text-writing-mode"]=t}else this.layout._values["text-writing-mode"]="point"===this.layout.get("symbol-placement")?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getValueAndResolveTokens(t,e,n,i){const r=this.layout.get(t).evaluate(e,{},n,i),o=this._unevaluatedLayout._values[t];return o.isDataDriven()||ui(o.value)||!r?r:function(t,e){return e.replace(/{([^{}]+)}/g,((e,n)=>n in t?String(t[n]):""))}(e.properties,r)}createBucket(t){return new fh(t)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const t of gh.paint.overridableProperties){if(!vh.hasPaintOverride(this.layout,t))continue;const e=this.paint.get(t),n=new _h(e),i=new ci(n,e.property.specification);let r=null;r="constant"===e.value.kind||"source"===e.value.kind?new di("source",i):new pi("composite",i,e.value.zoomStops,e.value._interpolationType),this.paint._values[t]=new mo(e.property,r,e.parameters)}}_handleOverridablePaintPropertyUpdate(t,e,n){return!(!this.layout||e.isDataDriven()||n.isDataDriven())&&vh.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,e){const n=t.get("text-field"),i=gh.paint.properties[e];let r=!1;const o=t=>{for(const e of t)if(i.overrides&&i.overrides.hasOverride(e))return void(r=!0)};if("constant"===n.value.kind&&n.value.value instanceof fe)o(n.value.value.sections);else if("source"===n.value.kind){const t=e=>{r||(e instanceof xe&&ve(e.value)===ee?o(e.value.sections):e instanceof Ce?o(e.sections):e.eachChild(t))},e=n.value;e._styleExpression&&t(e._styleExpression.expression)}return r}getProgramConfiguration(t){return new Pa(this,t)}}var yh={paint:new wo({"background-color":new _o(Bt.paint_background["background-color"]),"background-pattern":new xo(Bt.paint_background["background-pattern"]),"background-opacity":new _o(Bt.paint_background["background-opacity"])})},xh={paint:new wo({"raster-opacity":new _o(Bt.paint_raster["raster-opacity"]),"raster-hue-rotate":new _o(Bt.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new _o(Bt.paint_raster["raster-brightness-min"]),"raster-brightness-max":new _o(Bt.paint_raster["raster-brightness-max"]),"raster-saturation":new _o(Bt.paint_raster["raster-saturation"]),"raster-contrast":new _o(Bt.paint_raster["raster-contrast"]),"raster-resampling":new _o(Bt.paint_raster["raster-resampling"]),"raster-fade-duration":new _o(Bt.paint_raster["raster-fade-duration"])})};class bh extends Ba{constructor(t){super(t,{}),this.implementation=t}is3D(){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}recalculate(){}updateTransitions(){}hasTransition(){}serialize(){}onAdd(t){this.implementation.onAdd&&this.implementation.onAdd(t,t.painter.context.gl)}onRemove(t){this.implementation.onRemove&&this.implementation.onRemove(t,t.painter.context.gl)}}var wh={paint:new wo({"sky-type":new _o(Bt.paint_sky["sky-type"]),"sky-atmosphere-sun":new _o(Bt.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new _o(Bt.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new _o(Bt.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new _o(Bt.paint_sky["sky-gradient-radius"]),"sky-gradient":new bo(Bt.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new _o(Bt.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new _o(Bt.paint_sky["sky-atmosphere-color"]),"sky-opacity":new _o(Bt.paint_sky["sky-opacity"])})};function Th(t,e,n){const i=bs(0,0,1),r=zs(Ds());return function(t,e,n){n*=.5;var i=e[0],r=e[1],o=e[2],a=e[3],s=Math.sin(n),l=Math.cos(n);t[0]=i*l-o*s,t[1]=r*l+a*s,t[2]=o*l+i*s,t[3]=a*l-r*s}(r,r,n?-h(t)+Math.PI:h(t)),Os(r,r,-h(e)),Ss(i,i,r),Es(i,i)}const Ch={circle:class extends Ba{constructor(t){super(t,ps)}createBucket(t){return new Xa(t)}queryRadius(t){const e=t;return ls("circle-radius",this,e)+ls("circle-stroke-width",this,e)+cs(this.paint.get("circle-translate"))}queryIntersectsFeature(t,e,n,i,r,o,a,s){const l="map"===this.paint.get("circle-pitch-alignment");if(l&&t.queryGeometry.isAboveHorizon)return!1;const c=hs(this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),o.angle,t.pixelToTileUnitsFactor),u=this.paint.get("circle-radius").evaluate(e,n)+this.paint.get("circle-stroke-width").evaluate(e,n),h=l?u*t.pixelToTileUnitsFactor:u;for(const e of i)for(const n of e){const e=n.add(c),i=s&&o.elevation?o.elevation.exaggeration()*s.getElevationAt(e.x,e.y,!0):0,r=l?e:Rs(e,i,a),u=l?t.tilespaceRays.map((t=>$s(t,i))):t.queryGeometry.screenGeometry;let d=h;const p=Ps([],[n.x,n.y,i,1],a);if("viewport"===this.paint.get("circle-pitch-scale")&&"map"===this.paint.get("circle-pitch-alignment")?d*=p[3]/o.cameraToCenterDistance:"map"===this.paint.get("circle-pitch-scale")&&"viewport"===this.paint.get("circle-pitch-alignment")&&(d*=o.cameraToCenterDistance/p[3]),Ya(u,r,d))return!0}return!1}getProgramIds(){return["circle"]}getProgramConfiguration(t){return new Pa(this,t)}},heatmap:class extends Ba{createBucket(t){return new Bs(t)}constructor(t){super(t,qs),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(t){"heatmap-color"===t&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Zs({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(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&"none"!==this.visibility}getProgramIds(){return["heatmap","heatmapTexture"]}getProgramConfiguration(t){return new Pa(this,t)}},hillshade:class extends Ba{constructor(t){super(t,Hs)}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility}getProgramIds(){return["hillshade","hillshadePrepare"]}getProgramConfiguration(t){return new Pa(this,t)}},fill:class extends Ba{constructor(t){super(t,Ol)}getProgramIds(){const t=this.paint.get("fill-pattern"),e=t&&t.constantOr(1),n=[e?"fillPattern":"fill"];return this.paint.get("fill-antialias")&&n.push(e&&!this.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline"),n}getProgramConfiguration(t){return new Pa(this,t)}recalculate(t,e){super.recalculate(t,e);const n=this.paint._values["fill-outline-color"];"constant"===n.value.kind&&void 0===n.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(t){return new Dl(t)}queryRadius(){return cs(this.paint.get("fill-translate"))}queryIntersectsFeature(t,e,n,i,r,o){return!t.queryGeometry.isAboveHorizon&&Ja(us(t.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),o.angle,t.pixelToTileUnitsFactor),i)}isTileClipped(){return!0}},"fill-extrusion":class extends Ba{constructor(t){super(t,Ql)}createBucket(t){return new Yl(t)}queryRadius(){return cs(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}getProgramIds(){return[this.paint.get("fill-extrusion-pattern").constantOr(1)?"fillExtrusionPattern":"fillExtrusion"]}getProgramConfiguration(t){return new Pa(this,t)}queryIntersectsFeature(t,e,n,i,r,a,s,l,c){const u=hs(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),a.angle,t.pixelToTileUnitsFactor),h=this.paint.get("fill-extrusion-height").evaluate(e,n),d=this.paint.get("fill-extrusion-base").evaluate(e,n),p=[0,0],f=l&&a.elevation,m=a.elevation?a.elevation.exaggeration():1;if(f){const e=t.tile.getBucket(this).centroidVertexArray,n=c+1;if(n=3)for(let e=0;ethis._ne.lng&&(i=this._sw.lng>=e&&e>=this._ne.lng),this._sw.lat<=n&&n<=this._ne.lat&&i}static convert(t){return!t||t instanceof Ph?t:new Ph(t)}}const Dh=6371008.8;class zh{constructor(t,e){if(isNaN(t)||isNaN(e))throw new Error(`Invalid LngLat object: (${t}, ${e})`);if(this.lng=+t,this.lat=+e,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new zh(_(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(t){const e=Math.PI/180,n=this.lat*e,i=t.lat*e,r=Math.sin(n)*Math.sin(i)+Math.cos(n)*Math.cos(i)*Math.cos((t.lng-this.lng)*e);return Dh*Math.acos(Math.min(r,1))}toBounds(t=0){const e=360*t/40075017,n=e/Math.cos(Math.PI/180*this.lat);return new Ph(new zh(this.lng-n,this.lat-e),new zh(this.lng+n,this.lat+e))}static convert(t){if(t instanceof zh)return t;if(Array.isArray(t)&&(2===t.length||3===t.length))return new zh(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&"object"==typeof t&&null!==t)return new zh(Number("lng"in t?t.lng:t.lon),Number(t.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")}}const Oh=2*Math.PI*Dh;function Rh(t){return Oh*Math.cos(t*Math.PI/180)}function Lh(t){return(180+t)/360}function Fh(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function $h(t,e){return t/Rh(e)}function Bh(t){return 360/Math.PI*Math.atan(Math.exp((180-360*t)*Math.PI/180))-90}function Nh(t,e){return t*Rh(Bh(e))}class jh{constructor(t,e,n=0){this.x=+t,this.y=+e,this.z=+n}static fromLngLat(t,e=0){const n=zh.convert(t);return new jh(Lh(n.lng),Fh(n.lat),$h(e,n.lat))}toLngLat(){return new zh(360*this.x-180,Bh(this.y))}toAltitude(){return Nh(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/Oh*(t=Bh(this.y),1/Math.cos(t*Math.PI/180));var t}}class Uh{constructor(t,e){this.width=t,this.height=e,this.nextRow=0,this.image=new Vs({width:t,height:e}),this.positions={},this.uploaded=!1}getDash(t,e){const n=this.getKey(t,e);return this.positions[n]}trim(){const t=this.width,e=this.height=C(this.nextRow);this.image.resize({width:t,height:e})}getKey(t,e){return t.join(",")+e}getDashRanges(t,e,n){const i=[];let r=t.length%2==1?-t[t.length-1]*n:0,o=t[0]*n,a=!0;i.push({left:r,right:o,isDash:a,zeroLength:0===t[0]});let s=t[0];for(let e=1;e1&&(a=t[++o]);const l=Math.abs(s-a.left),c=Math.abs(s-a.right),u=Math.min(l,c);let h;const d=e/n*(i+1);if(a.isDash){const t=i-Math.abs(d);h=Math.sqrt(u*u+t*t)}else h=i-Math.sqrt(u*u+d*d);this.image.data[r+s]=Math.max(0,Math.min(255,h+128))}}}addRegularDash(t,e){for(let e=t.length-1;e>=0;--e){const n=t[e],i=t[e+1];n.zeroLength?t.splice(e,1):i&&i.isDash===n.isDash&&(i.left=n.left,t.splice(e,1))}const n=t[0],i=t[t.length-1];n.isDash===i.isDash&&(n.left=i.left-this.width,i.right=n.right+this.width);const r=this.width*this.nextRow;let o=0,a=t[o];for(let n=0;n1&&(a=t[++o]);const i=Math.abs(n-a.left),s=Math.abs(n-a.right),l=Math.min(i,s);this.image.data[r+n]=Math.max(0,Math.min(255,(a.isDash?l:-l)+e+128))}}addDash(t,e){const n=this.getKey(t,e);if(this.positions[n])return this.positions[n];const i="round"===e,r=i?7:0,o=2*r+1;if(this.nextRow+o>this.height)return D("LineAtlas out of space"),null;0===t.length&&t.push(1);let a=0;for(let e=0;e{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(){delete this._channel,this._callback=()=>{}}}const Gh=s.performance;function qh(t){const e=t?t.url.toString():void 0;return Gh.getEntriesByName(e)}class Zh{constructor(){this.tasks={},this.taskQueue=[],S(["process"],this),this.invoker=new Vh(this.process),this.nextId=0}add(t,e){const n=this.nextId++,i=function({type:t,isSymbolTile:e,zoom:n}){return n=n||0,"message"===t?0:"maybePrepare"!==t||e?"parseTile"!==t||e?"parseTile"===t&&e?300-n:"maybePrepare"===t&&e?400-n:500:200-n:100-n}(e);if(0===i){R();try{t()}finally{}return{cancel:()=>{}}}return this.tasks[n]={fn:t,metadata:e,priority:i,id:n},this.taskQueue.push(n),this.invoker.trigger(),{cancel:()=>{delete this.tasks[n]}}}process(){R();try{if(this.taskQueue=this.taskQueue.filter((t=>!!this.tasks[t])),!this.taskQueue.length)return;const t=this.pick();if(null===t)return;const e=this.tasks[t];if(delete this.tasks[t],this.taskQueue.length&&this.invoker.trigger(),!e)return;e.fn()}finally{}}pick(){let t=null,e=1/0;for(let n=0;n0;o--)i=1<this.canonical.z?new Kh(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Kh(t,this.wrap,t,this.canonical.x>>e,this.canonical.y>>e)}calculateScaledKey(t,e=!0){if(this.overscaledZ===t&&e)return this.key;if(t>this.canonical.z)return Yh(this.wrap*+e,t,this.canonical.z,this.canonical.x,this.canonical.y);{const n=this.canonical.z-t;return Yh(this.wrap*+e,t,t,this.canonical.x>>n,this.canonical.y>>n)}}isChildOf(t){if(t.wrap!==this.wrap)return!1;const e=this.canonical.z-t.canonical.z;return 0===t.overscaledZ||t.overscaledZ>e&&t.canonical.y===this.canonical.y>>e}children(t){if(this.overscaledZ>=t)return[new Kh(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const e=this.canonical.z+1,n=2*this.canonical.x,i=2*this.canonical.y;return[new Kh(e,this.wrap,e,n,i),new Kh(e,this.wrap,e,n+1,i),new Kh(e,this.wrap,e,n,i+1),new Kh(e,this.wrap,e,n+1,i+1)]}isLessThan(t){return this.wrapt.wrap)&&(this.overscaledZt.overscaledZ)&&(this.canonical.xt.canonical.x)&&this.canonical.ye.getLayer(t))).filter(Boolean);if(0!==t.length){i.layers=t,i.stateDependentLayerIds&&(i.stateDependentLayers=i.stateDependentLayerIds.map((e=>t.filter((t=>t.id===e))[0])));for(const e of t)n[e.id]=i}}return n}(t.buckets,e.style),this.hasSymbolBuckets=!1;for(const t in this.buckets){const e=this.buckets[t];if(e instanceof fh){if(this.hasSymbolBuckets=!0,!n)break;e.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const t in this.buckets){const e=this.buckets[t];if(e instanceof fh&&e.hasRTLText){this.hasRTLText=!0,ao.isLoading()||ao.isLoaded()||"deferred"!==ro()||oo();break}}this.queryPadding=0;for(const t in this.buckets){const n=this.buckets[t];this.queryPadding=Math.max(this.queryPadding,e.style.getLayer(t).queryRadius(n))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage),t.lineAtlas&&(this.lineAtlas=t.lineAtlas)}else this.collisionBoxArray=new Jo}unloadVectorData(){for(const t in this.buckets)this.buckets[t].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.latestFeatureIndex=null,this.state="unloaded"}getBucket(t){return this.buckets[t.id]}upload(t){for(const e in this.buckets){const n=this.buckets[e];n.uploadPending()&&n.upload(t)}const e=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new Mh(t,this.imageAtlas.image,e.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Mh(t,this.glyphAtlasImage,e.ALPHA),this.glyphAtlasImage=null),this.lineAtlas&&!this.lineAtlas.uploaded&&(this.lineAtlasTexture=new Mh(t,this.lineAtlas.image,e.ALPHA),this.lineAtlas.uploaded=!0)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,e,n,i,r,o,a,s){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({tileResult:i,pixelPosMatrix:a,transform:o,params:r},t,e,n):{}}querySourceFeatures(t,e){const n=this.latestFeatureIndex;if(!n||!n.rawTileData)return;const i=n.loadVTLayers(),r=e?e.sourceLayer:"",o=i._geojsonTileLayer||i[r];if(!o)return;const a=Ei(e&&e.filter),{z:s,x:l,y:c}=this.tileID.canonical,u={z:s,x:l,y:c};for(let e=0;et)n=!1;else if(e)if(this.expirationTimee[a])return null}else{const s=1/i[a];let l=(t[a]-n[a])*s,c=(e[a]-n[a])*s;if(l>c){const t=l;l=c,c=t}if(l>r&&(r=l),co)return null}return r}function od(t,e,n,i,r,o,a,s,l,c,u){const h=i-t,d=r-e,p=o-n,f=a-t,m=s-e,g=l-n,_=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]-t,T=c[1]-e,C=c[2]-n,E=(w*_+T*v+C*y)*b;if(E<0||E>1)return null;const S=T*p-C*d,A=C*h-w*p,k=w*d-T*h,I=(u[0]*S+u[1]*A+u[2]*k)*b;return I<0||E+I>1?null:(f*S+m*A+g*k)*b}function ad(t,e,n){return(t-e)/(n-e)}function sd(t,e,n,i,r,o,a,s,l){const c=1<{const o=i?1:0,a=(t+1)*n-o,s=e*n,l=(e+1)*n-o;r[0]=t*n,r[1]=s,r[2]=a,r[3]=l};let a=new id(i);const s=[];for(let e=0;e=1;i/=2){const t=n[n.length-1];a=new id(i);for(let e=0;e0;){const{idx:s,t:p,nodex:f,nodey:m,depth:g}=d.pop();if(this.leaves[s]){sd(f,m,g,t,e,n,i,u,h);const s=1<=t[2])return p}continue}let _=0;for(let d=0;d=l[c[n]]&&(c.splice(n,0,d),e=!0);e||(c[_]=d),_++}}for(let t=0;t<_;t++){const e=c[t];d.push({idx:this.childOffsets[s]+e,t:l[e],nodex:(f<<1)+this._siblingOffset[e][0],nodey:(m<<1)+this._siblingOffset[e][1],depth:g+1})}}return null}_addNode(t,e,n){return this.minimums.push(t),this.maximums.push(e),this.leaves.push(n),this.childOffsets.push(0),this.nodeCount++}_construct(t,e,n,i,r){if(1===t[i].isLeaf(e,n))return;this.childOffsets[r]||(this.childOffsets[r]=this.nodeCount);const o=i-1,a=t[o];let s,l=0;for(let t=0;t=this.dim+1||e<-1||e>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(e+1)*this.stride+(t+1)}_unpackMapbox(t,e,n){return(256*t*256+256*e+n)/10-1e4}_unpackTerrarium(t,e,n){return 256*t+e+n/256-32768}static pack(t,e){const n=[0,0,0,0],i=dd.getUnpackVector(e);let r=Math.floor((t+i[3])/i[2]);return n[2]=r%256,r=Math.floor(r/256),n[1]=r%256,r=Math.floor(r/256),n[0]=r,n}getPixels(){return new Gs({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(t,e,n){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");let i=e*this.dim,r=e*this.dim+this.dim,o=n*this.dim,a=n*this.dim+this.dim;switch(e){case-1:i=r-1;break;case 1:r=i+1}switch(n){case-1:o=a-1;break;case 1:a=o+1}const s=-e*this.dim,l=-n*this.dim;for(let e=o;e{this.remove(t,r)}),n)),this.data[i].push(r),this.order.push(i),this.order.length>this.max){const t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t)}return this}has(t){return t.wrapped().key in this.data}getAndRemove(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null}_getAndRemoveByKey(t){const e=this.data[t].shift();return e.timeout&&clearTimeout(e.timeout),0===this.data[t].length&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),e.value}getByKey(t){const e=this.data[t];return e?e[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,e){if(!this.has(t))return this;const n=t.wrapped().key,i=void 0===e?0:this.data[n].indexOf(e),r=this.data[n][i];return this.data[n].splice(i,1),r.timeout&&clearTimeout(r.timeout),0===this.data[n].length&&delete this.data[n],this.onRemove(r.value),this.order.splice(this.order.indexOf(n),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){const t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t)}return this}filter(t){const e=[];for(const n in this.data)for(const i of this.data[n])t(i.value)||e.push(i);for(const t of e)this.remove(t.value.tileID,t)}}class fd{constructor(t,e,n){this.func=t,this.mask=e,this.range=n}}fd.ReadOnly=!1,fd.ReadWrite=!0,fd.disabled=new fd(519,fd.ReadOnly,[0,1]);const md=7680;class gd{constructor(t,e,n,i,r,o){this.test=t,this.ref=e,this.mask=n,this.fail=i,this.depthFail=r,this.pass=o}}gd.disabled=new gd({func:519,mask:0},0,0,md,md,md);class _d{constructor(t,e,n){this.blendFunction=t,this.blendColor=e,this.mask=n}}_d.Replace=[1,0],_d.disabled=new _d(_d.Replace,he.transparent,[!1,!1,!1,!1]),_d.unblended=new _d(_d.Replace,he.transparent,[!0,!0,!0,!0]),_d.alphaBlended=new _d([1,771],he.transparent,[!0,!0,!0,!0]);const vd=1029,yd=2305;class xd{constructor(t,e,n){this.enable=t,this.mode=e,this.frontFace=n}}xd.disabled=new xd(!1,vd,yd),xd.backCCW=new xd(!0,vd,yd),xd.backCW=new xd(!0,vd,2304),xd.frontCW=new xd(!0,1028,2304),xd.frontCCW=new xd(!0,1028,yd);class bd extends $t{constructor(t,e,n){super(),this.id=t,this._onlySymbols=n,e.on("data",(t=>{"source"===t.dataType&&"metadata"===t.sourceDataType&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&"source"===t.dataType&&"content"===t.sourceDataType&&(this.reload(),this.transform&&this.update(this.transform))})),e.on("error",(()=>{this._sourceErrored=!0})),this._source=e,this._tiles={},this._cache=new pd(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new nd}onAdd(t){this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded)return!1;if(!this._source.loaded())return!1;for(const t in this._tiles){const e=this._tiles[t];if("loaded"!==e.state&&"errored"!==e.state)return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform)}_loadTile(t,e){return t.isSymbolTile=this._onlySymbols,this._source.loadTile(t,e)}_unloadTile(t){if(this._source.unloadTile)return this._source.unloadTile(t,(()=>{}))}_abortTile(t){if(this._source.abortTile)return this._source.abortTile(t,(()=>{}))}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const e in this._tiles){const n=this._tiles[e];n.upload(t),n.prepare(this.map.style.imageManager)}}getIds(){return y(this._tiles).map((t=>t.tileID)).sort(wd).map((t=>t.key))}getRenderableIds(t){const e=[];for(const n in this._tiles)this._isIdRenderable(+n,t)&&e.push(this._tiles[n]);return t?e.sort(((t,e)=>{const n=t.tileID,i=e.tileID,r=new o(n.canonical.x,n.canonical.y)._rotate(this.transform.angle),a=new o(i.canonical.x,i.canonical.y)._rotate(this.transform.angle);return n.overscaledZ-i.overscaledZ||a.y-r.y||a.x-r.x})).map((t=>t.tileID.key)):e.map((t=>t.tileID)).sort(wd).map((t=>t.key))}hasRenderableParent(t){const e=this.findLoadedParent(t,0);return!!e&&this._isIdRenderable(e.tileID.key)}_isIdRenderable(t,e){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(e||!this._tiles[t].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const t in this._tiles)"errored"!==this._tiles[t].state&&this._reloadTile(+t,"reloading")}}_reloadTile(t,e){const n=this._tiles[t];n&&("loading"!==n.state&&(n.state=e),this._loadTile(n,this._tileLoaded.bind(this,n,t,e)))}_tileLoaded(t,e,n,i){if(i)return t.state="errored",void(404!==i.status?this._source.fire(new Ft(i,{tile:t})):this.update(this.transform));t.timeAdded=V.now(),"expired"===n&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(e,t),"raster-dem"===this.getSource().type&&t.dem&&this._backfillDEM(t),this._state.initializeTileState(t,this.map?this.map.painter:null),this._source.fire(new Lt("data",{dataType:"source",tile:t,coord:t.tileID,sourceCacheId:this.id}))}_backfillDEM(t){const e=this.getRenderableIds();for(let i=0;i1||(Math.abs(n)>1&&(1===Math.abs(n+r)?n+=r:1===Math.abs(n-r)&&(n-=r)),e.dem&&t.dem&&(t.dem.backfillBorder(e.dem,n,i),t.neighboringTiles&&t.neighboringTiles[o]&&(t.neighboringTiles[o].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,e,n,i){for(const r in this._tiles){let o=this._tiles[r];if(i[r]||!o.hasData()||o.tileID.overscaledZ<=e||o.tileID.overscaledZ>n)continue;let a=o.tileID;for(;o&&o.tileID.overscaledZ>e+1;){const t=o.tileID.scaledTo(o.tileID.overscaledZ-1);o=this._tiles[t.key],o&&o.hasData()&&(a=t)}let s=a;for(;s.overscaledZ>e;)if(s=s.scaledTo(s.overscaledZ-1),t[s.key]){i[a.key]=a;break}}}findLoadedParent(t,e){if(t.key in this._loadedParentTiles){const n=this._loadedParentTiles[t.key];return n&&n.tileID.overscaledZ>=e?n:null}for(let n=t.overscaledZ-1;n>=e;n--){const e=t.scaledTo(n),i=this._getLoadedTile(e);if(i)return i}}_getLoadedTile(t){const e=this._tiles[t.key];return e&&e.hasData()?e:this._cache.getByKey(this._source.reparseOverscaled?t.wrapped().key:t.canonical.key)}updateCacheSize(t,e){e=e||this._source.tileSize;const n=Math.ceil(t.width/e)+1,i=Math.ceil(t.height/e)+1,r=Math.floor(n*i*5),o="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,r):r;this._cache.setMaxSize(o)}handleWrapJump(t){const e=Math.round((t-(void 0===this._prevLng?t:this._prevLng))/360);if(this._prevLng=t,e){const t={};for(const n in this._tiles){const i=this._tiles[n];i.tileID=i.tileID.unwrapTo(i.tileID.wrap+e),t[i.tileID.key]=i}this._tiles=t;for(const t in this._timers)clearTimeout(this._timers[t]),delete this._timers[t];for(const t in this._tiles)this._setTileReloadTimer(+t,this._tiles[t])}}update(t,e,n){if(this.transform=t,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage)return;if(this.usedForTerrain&&!n)return;let i;this.updateCacheSize(t,e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?i=t.getVisibleUnwrappedCoordinates(this._source.tileID).map((t=>new Kh(t.canonical.z,t.wrap,t.canonical.z,t.canonical.x,t.canonical.y))):(i=t.coveringTiles({tileSize:e||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!n,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain}),this._source.hasTile&&(i=i.filter((t=>this._source.hasTile(t))))):i=[];const r=this._updateRetainedTiles(i);if(Td(this._source.type)&&0!==i.length){const t={},e={},n=Object.keys(r);for(const i of n){const n=r[i],o=this._tiles[i];if(!o||o.fadeEndTime&&o.fadeEndTime<=V.now())continue;const a=this.findLoadedParent(n,Math.max(n.overscaledZ-bd.maxOverzooming,this._source.minzoom));a&&(this._addTile(a.tileID),t[a.tileID.key]=a.tileID),e[i]=n}const o=i[i.length-1].overscaledZ;for(const t in this._tiles){const n=this._tiles[t];if(r[t]||!n.hasData())continue;let i=n.tileID;for(;i.overscaledZ>o;){i=i.scaledTo(i.overscaledZ-1);const o=this._tiles[i.key];if(o&&o.hasData()&&e[i.key]){r[t]=n.tileID;break}}}for(const e in t)r[e]||(this._coveredTiles[e]=!0,r[e]=t[e])}for(const t in r)this._tiles[t].clearFadeHold();const o=function(t,e){const n=[];for(const i in t)i in e||n.push(i);return n}(this._tiles,r);for(const t of o){const e=this._tiles[t];e.hasSymbolBuckets&&!e.holdingForFade()?e.setHoldDuration(this.map._fadeDuration):e.hasSymbolBuckets&&!e.symbolFadeFinished()||this._removeTile(+t)}this._updateLoadedParentTileCache(),this._onlySymbols&&this._source.afterUpdate&&this._source.afterUpdate()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(+t)}_updateRetainedTiles(t){const e={};if(0===t.length)return e;const n={},i=t[t.length-1].overscaledZ,r=t[0].overscaledZ,o=Math.max(r-bd.maxOverzooming,this._source.minzoom),a=Math.max(r+bd.maxUnderzooming,this._source.minzoom),s={};for(const n of t){const t=this._addTile(n);e[n.key]=n,t.hasData()||i=this._source.maxzoom){const t=i.children(this._source.maxzoom)[0],n=this.getTile(t);if(n&&n.hasData()){e[t.key]=t;continue}}else{const t=i.children(this._source.maxzoom);if(e[t[0].key]&&e[t[1].key]&&e[t[2].key]&&e[t[3].key])continue}let r=t.wasRequested();for(let a=i.overscaledZ-1;a>=o;--a){const o=i.scaledTo(a);if(n[o.key])break;if(n[o.key]=!0,t=this.getTile(o),!t&&r&&(t=this._addTile(o)),t&&(e[o.key]=o,r=t.wasRequested(),t.hasData()))break}}return e}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const e=[];let n,i=this._tiles[t].tileID;for(;i.overscaledZ>0;){if(i.key in this._loadedParentTiles){n=this._loadedParentTiles[i.key];break}e.push(i.key);const t=i.scaledTo(i.overscaledZ-1);if(n=this._getLoadedTile(t),n)break;i=t}for(const t of e)this._loadedParentTiles[t]=n}}_addTile(t){let e=this._tiles[t.key];if(e)return e;e=this._cache.getAndRemove(t),e&&(this._setTileReloadTimer(t.key,e),e.tileID=t,this._state.initializeTileState(e,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,e)));const n=Boolean(e);return n||(e=new ed(t,this._source.tileSize*t.overscaleFactor(),this.transform.tileZoom),this._loadTile(e,this._tileLoaded.bind(this,e,t.key,e.state))),e?(e.uses++,this._tiles[t.key]=e,n||this._source.fire(new Lt("dataloading",{tile:e,coord:e.tileID,dataType:"source"})),e):null}_setTileReloadTimer(t,e){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);const n=e.getExpiryTimeout();n&&(this._timers[t]=setTimeout((()=>{this._reloadTile(t,"expired"),delete this._timers[t]}),n))}_removeTile(t){const e=this._tiles[t];e&&(e.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),e.uses>0||(e.hasData()&&"reloading"!==e.state?this._cache.add(e.tileID,e,e.getExpiryTimeout()):(e.aborted=!0,this._abortTile(e),this._unloadTile(e))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(+t);this._cache.reset()}tilesIn(t,e,n){const i=[],r=this.transform;if(!r)return i;for(const o in this._tiles){const a=this._tiles[o];if(n&&a.clearQueryDebugViz(),a.holdingForFade())continue;const s=t.containsTile(a,r,e);s&&i.push(s)}return i}getVisibleCoordinates(t){const e=this.getRenderableIds(t).map((t=>this._tiles[t].tileID));for(const t of e)t.projMatrix=this.transform.calculateProjMatrix(t.toUnwrapped());return e}hasTransition(){if(this._source.hasTransition())return!0;if(Td(this._source.type))for(const t in this._tiles){const e=this._tiles[t];if(void 0!==e.fadeEndTime&&e.fadeEndTime>=V.now())return!0}return!1}setFeatureState(t,e,n){this._state.updateState(t=t||"_geojsonTileLayer",e,n)}removeFeatureState(t,e,n){this._state.removeFeatureState(t=t||"_geojsonTileLayer",e,n)}getFeatureState(t,e){return this._state.getState(t=t||"_geojsonTileLayer",e)}setDependencies(t,e,n){const i=this._tiles[t];i&&i.setDependencies(e,n)}reloadTilesForDependencies(t,e){for(const n in this._tiles)this._tiles[n].hasDependency(t,e)&&this._reloadTile(+n,"reloading");this._cache.filter((n=>!n.hasDependency(t,e)))}}function wd(t,e){const n=Math.abs(2*t.wrap)-+(t.wrap<0),i=Math.abs(2*e.wrap)-+(e.wrap<0);return t.overscaledZ-e.overscaledZ||i-n||e.canonical.y-t.canonical.y||e.canonical.x-t.canonical.x}function Td(t){return"raster"===t||"image"===t||"video"===t}bd.maxOverzooming=10,bd.maxUnderzooming=3;class Cd{constructor(t,e,n){this._demTile=t,this._dem=this._demTile.dem,this._scale=e,this._offset=n}static create(t,e,n){const i=n||t.findDEMTileFor(e);if(!i||!i.dem)return;const r=i.dem,o=i.tileID,a=1<=0&&i[3]>=0&&s.insert(a,i[0],i[1],i[2],i[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Zl.VectorTile(new zc(this.rawTileData)).layers,this.sourceLayerCoder=new Jh(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(t,e,n,i){this.loadVTLayers();const r=t.params||{},o=Ei(r.filter),a=t.tileResult,s=t.transform,l=a.bufferedTilespaceBounds,c=this.grid.query(l.min.x,l.min.y,l.max.x,l.max.y,((t,e,n,i)=>as(a.bufferedTilespaceGeometry,t,e,n,i)));c.sort(Ad);let u=null;s.elevation&&c.length>0&&(u=Cd.create(s.elevation,this.tileID));const h={};let d;for(let s=0;s(f||(f=Za(e)),n.queryIntersectsFeature(a,e,i,f,this.z,t.transform,t.pixelPosMatrix,u,r))))}return h}loadMatchingFeature(t,e,n,i,r,o,a,s,l){const{featureIndex:c,bucketIndex:u,sourceLayerIndex:h,layoutVertexArrayOffset:d}=e,p=this.bucketLayerIDs[u];if(i&&!function(t,e){for(let n=0;n=0)return!0;return!1}(i,p))return;const f=this.sourceLayerCoder.decode(h),m=this.vtLayers[f].feature(c);if(n.needGeometry){const t=Ha(m,!0);if(!n.filter(new so(this.tileID.overscaledZ),t,this.tileID.canonical))return}else if(!n.filter(new so(this.tileID.overscaledZ),m))return;const g=this.getId(m,f);for(let e=0;e{const a=e instanceof go?e.get(o):null;return a&&a.evaluate?a.evaluate(n,i,r):a}))}function Ad(t,e){return e-t}lr("FeatureIndex",Ed,{omit:["rawTileData","sourceLayerCoder"]});class kd{constructor(t){const e={},n=[];for(const i in t){const r=t[i],o=e[i]={};for(const t in r.glyphs){const e=r.glyphs[+t];if(!e||0===e.bitmap.width||0===e.bitmap.height)continue;const i=e.metrics.localGlyph?2:1,a={x:0,y:0,w:e.bitmap.width+2*i,h:e.bitmap.height+2*i};n.push(a),o[t]=a}}const{w:i,h:r}=nu(n),o=new Vs({width:i||1,height:r||1});for(const n in t){const i=t[n];for(const t in i.glyphs){const r=i.glyphs[+t];if(!r||0===r.bitmap.width||0===r.bitmap.height)continue;const a=e[n][t],s=r.metrics.localGlyph?2:1;Vs.copy(r.bitmap,o,{x:0,y:0},{x:a.x+s,y:a.y+s},r.bitmap)}}this.image=o,this.positions=e}}lr("GlyphAtlas",kd);class Id{constructor(t){this.tileID=new Kh(t.tileID.overscaledZ,t.tileID.wrap,t.tileID.canonical.z,t.tileID.canonical.x,t.tileID.canonical.y),this.tileZoom=t.tileZoom,this.uid=t.uid,this.zoom=t.zoom,this.pixelRatio=t.pixelRatio,this.tileSize=t.tileSize,this.source=t.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=t.showCollisionBoxes,this.collectResourceTiming=!!t.collectResourceTiming,this.returnDependencies=!!t.returnDependencies,this.promoteId=t.promoteId,this.enableTerrain=!!t.enableTerrain,this.isSymbolTile=t.isSymbolTile}parse(t,e,n,i,r){this.status="parsing",this.data=t,this.collisionBoxArray=new Jo;const o=new Jh(Object.keys(t.layers).sort()),a=new Ed(this.tileID,this.promoteId);a.bucketLayerIDs=[];const s={},l=new Uh(256,256),c={featureIndex:a,iconDependencies:{},patternDependencies:{},glyphDependencies:{},lineAtlas:l,availableImages:n},u=e.familiesBySource[this.source];for(const e in u){const i=t.layers[e];if(!i)continue;let r=!1,l=!1;for(const t of u[e])"symbol"===t[0].type?r=!0:l=!0;if(!0===this.isSymbolTile&&!r)continue;if(!1===this.isSymbolTile&&!l)continue;1===i.version&&D(`Vector tile source "${this.source}" layer "${e}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const h=o.encode(e),d=[];for(let t=0;t=e.maxzoom||"none"!==e.visibility&&(Md(t,this.zoom,n),(s[e.id]=e.createBucket({index:a.bucketLayerIDs.length,layers:t,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:h,sourceID:this.source,enableTerrain:this.enableTerrain})).populate(d,c,this.tileID.canonical),a.bucketLayerIDs.push(t.map((t=>t.id))))}}let h,d,p,f;l.trim();const m={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},g=k(c.glyphDependencies,(t=>Object.keys(t).map(Number)));Object.keys(g).length?i.send("getGlyphs",{uid:this.uid,stacks:g},((t,e)=>{h||(h=t,d=e,x.call(this))}),void 0,!1,m):d={};const _=Object.keys(c.iconDependencies);_.length?i.send("getImages",{icons:_,source:this.source,tileID:this.tileID,type:"icons"},((t,e)=>{h||(h=t,p=e,x.call(this))}),void 0,!1,m):p={};const v=Object.keys(c.patternDependencies);function x(){if(h)return r(h);if(d&&p&&f){const t=new kd(d),e=new ru(p,f);for(const i in s){const r=s[i];r instanceof fh?(Md(r.layers,this.zoom,n),Ju(r,d,t.positions,p,e.iconPositions,this.showCollisionBoxes,this.tileID.canonical,this.tileZoom)):r.hasPattern&&(r instanceof uc||r instanceof Dl||r instanceof Yl)&&(Md(r.layers,this.zoom,n),r.addFeatures(c,this.tileID.canonical,e.patternPositions))}this.status="done",r(null,{buckets:y(s).filter((t=>!t.isEmpty())),featureIndex:a,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:t.image,lineAtlas:l,imageAtlas:e,glyphMap:this.returnDependencies?d:null,iconMap:this.returnDependencies?p:null,glyphPositions:this.returnDependencies?t.positions:null})}}v.length?i.send("getImages",{icons:v,source:this.source,tileID:this.tileID,type:"patterns"},((t,e)=>{h||(h=t,f=e,x.call(this))}),void 0,!1,m):f={},x.call(this)}}function Md(t,e,n){const i=new so(e);for(const e of t)e.recalculate(i,n)}class Pd{constructor(t){this.entries={},this.scheduler=t}request(t,e,n,i){const r=this.entries[t]=this.entries[t]||{callbacks:[]};if(r.result){const[t,n]=r.result;return this.scheduler?this.scheduler.add((()=>{i(t,n)}),e):i(t,n),()=>{}}return r.callbacks.push(i),r.cancel||(r.cancel=n(((n,i)=>{r.result=[n,i];for(const t of r.callbacks)this.scheduler?this.scheduler.add((()=>{t(n,i)}),e):t(n,i);setTimeout((()=>delete this.entries[t]),3e3)}))),()=>{r.result||(r.callbacks=r.callbacks.filter((t=>t!==i)),r.callbacks.length||(r.cancel(),delete this.entries[t]))}}}function Dd(t,e,n){const i=JSON.stringify(t.request);return t.data&&(this.deduped.entries[i]={result:[null,t.data]}),this.deduped.request(i,{type:"parseTile",isSymbolTile:t.isSymbolTile,zoom:t.tileZoom},(e=>{const i=St(t.request,((t,i,r,o)=>{t?e(t):i&&e(null,{vectorTile:n?void 0:new Zl.VectorTile(new zc(i)),rawData:i,cacheControl:r,expires:o})}));return()=>{i.cancel(),e()}}),e)}e.ARRAY_TYPE=fs,e.AUTH_ERR_MSG=Q,e.Actor=class{constructor(t,e,n){this.target=t,this.parent=e,this.mapId=n,this.callbacks={},this.cancelCallbacks={},S(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.globalScope=R()?t:s,this.scheduler=new Zh}send(t,e,n,i,r=!1,o){const a=Math.round(1e18*Math.random()).toString(36).substring(0,10);n&&(n.metadata=o,this.callbacks[a]=n);const s=j(this.globalScope)?void 0:[];return this.target.postMessage({id:a,type:t,hasCallback:!!n,targetMapId:i,mustQueue:r,sourceMapId:this.mapId,data:hr(e,s)},s),{cancel:()=>{n&&delete this.callbacks[a],this.target.postMessage({id:a,type:"",targetMapId:i,sourceMapId:this.mapId})}}}receive(t){const e=t.data,n=e.id;if(n&&(!e.targetMapId||this.mapId===e.targetMapId))if(""===e.type){const t=this.cancelCallbacks[n];delete this.cancelCallbacks[n],t&&t.cancel()}else if(e.mustQueue||R()){const t=this.callbacks[n];this.cancelCallbacks[n]=this.scheduler.add((()=>this.processTask(n,e)),t&&t.metadata||{type:"message"})}else this.processTask(n,e)}processTask(t,e){if(""===e.type){const n=this.callbacks[t];delete this.callbacks[t],n&&(e.error?n(dr(e.error)):n(null,dr(e.data)))}else{const n=j(this.globalScope)?void 0:[],i=e.hasCallback?(e,i)=>{delete this.cancelCallbacks[t],this.target.postMessage({id:t,type:"",sourceMapId:this.mapId,error:e?hr(e):null,data:hr(i,n)},n)}:t=>{},r=dr(e.data);if(this.parent[e.type])this.parent[e.type](e.sourceMapId,r,i);else if(this.parent.getWorkerSource){const t=e.type.split(".");this.parent.getWorkerSource(e.sourceMapId,t[0],r.source)[t[1]](r,i)}else i(new Error(`Could not find function ${e.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}},e.CanonicalTileID=Wh,e.Color=he,e.ColorMode=_d,e.CullFaceMode=xd,e.DEMData=dd,e.DataConstantProperty=_o,e.DedupedRequest=Pd,e.DepthMode=fd,e.EXTENT=Va,e.Elevation=class{getAtPointOrZero(t,e=0){return this.getAtPoint(t,e)||0}getAtPoint(t,e,n=!0){null==e&&(e=null);const i=this._source();if(!i)return e;if(t.y<0||t.y>1)return e;const r=i.getSource().maxzoom,o=1<{t[2]=this.exaggeration()*r.getElevationAt(t[0],t[1],n)})),!0)}getMinMaxForTile(t){const e=this.findDEMTileFor(t);if(!e||!e.dem)return null;const n=e.dem.tree,i=e.tileID,r=1<this._skuTokenExpiresAt}transformRequest(t,e){return this._transformRequestFn&&this._transformRequestFn(t,e)||{url:t}}normalizeStyleURL(t,e){if(!tt(t))return t;const n=it(t);return n.path=`/styles/v1${n.path}`,this._makeAPIURL(n,this._customAccessToken||e)}normalizeGlyphsURL(t,e){if(!tt(t))return t;const n=it(t);return n.path=`/fonts/v1${n.path}`,this._makeAPIURL(n,this._customAccessToken||e)}normalizeSourceURL(t,e){if(!tt(t))return t;const n=it(t);return n.path=`/v4/${n.authority}.json`,n.params.push("secure"),this._makeAPIURL(n,this._customAccessToken||e)}normalizeSpriteURL(t,e,n,i){const r=it(t);return tt(t)?(r.path=`/styles/v1${r.path}/sprite${e}${n}`,this._makeAPIURL(r,this._customAccessToken||i)):(r.path+=`${e}${n}`,rt(r))}normalizeTileURL(t,e,n){if(this._isSkuTokenExpired()&&this._createSkuToken(),t&&!tt(t))return t;const i=it(t);i.path=i.path.replace(/(\.(png|jpg)\d*)(?=$)/,`${e||n&&"raster"!==i.authority&&512===n?"@2x":""}${Z.supported?".webp":"$1"}`),"raster"===i.authority?i.path=`/${q.RASTER_URL_PREFIX}${i.path}`:(i.path=i.path.replace(/^.+\/v4\//,"/"),i.path=`/${q.TILE_URL_VERSION}${i.path}`);const r=this._customAccessToken||function(t){for(const e of t){const t=e.match(/^access_token=(.*)$/);if(t)return t[1]}return null}(i.params)||q.ACCESS_TOKEN;return q.REQUIRE_ACCESS_TOKEN&&r&&this._skuToken&&i.params.push(`sku=${this._skuToken}`),this._makeAPIURL(i,r)}canonicalizeTileURL(t,e){const n=it(t);if(!n.path.match(/^(\/v4\/|\/raster\/v1\/)/)||!n.path.match(/\.[\w]+$/))return t;let i="mapbox://";n.path.match(/^\/raster\/v1\//)?i+=`raster/${n.path.replace(`/${q.RASTER_URL_PREFIX}/`,"")}`:i+=`tiles/${n.path.replace(`/${q.TILE_URL_VERSION}/`,"")}`;let r=n.params;return e&&(r=r.filter((t=>!t.match(/^access_token=/)))),r.length&&(i+=`?${r.join("&")}`),i}canonicalizeTileset(t,e){const n=!!e&&tt(e),i=[];for(const e of t.tiles||[])et(e)?i.push(this.canonicalizeTileURL(e,n)):i.push(e);return i}_makeAPIURL(t,e){const n="See https://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes",i=it(q.API_URL);if(t.protocol=i.protocol,t.authority=i.authority,"http"===t.protocol){const e=t.params.indexOf("secure");e>=0&&t.params.splice(e,1)}if("/"!==i.path&&(t.path=`${i.path}${t.path}`),!q.REQUIRE_ACCESS_TOKEN)return rt(t);if(e=e||q.ACCESS_TOKEN,!this._silenceAuthErrors){if(!e)throw new Error(`An API access token is required to use Mapbox GL. ${n}`);if("s"===e[0])throw new Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${n}`)}return t.params=t.params.filter((t=>-1===t.indexOf("access_token"))),t.params.push(`access_token=${e||""}`),rt(t)}},e.ResourceType=wt,e.SegmentVector=Ua,e.SourceCache=bd,e.StencilMode=gd,e.StructArrayLayout1ui2=Xo,e.StructArrayLayout2f1f2i16=No,e.StructArrayLayout2i4=Io,e.StructArrayLayout2ui4=Wo,e.StructArrayLayout3f12=Lo,e.StructArrayLayout3ui6=Uo,e.StructArrayLayout4i8=Mo,e.Texture=Mh,e.Tile=ed,e.Transitionable=uo,e.Uniform1f=xa,e.Uniform1i=class extends ya{constructor(t,e){super(t,e),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1i(this.location,t))}},e.Uniform2f=class extends ya{constructor(t,e){super(t,e),this.current=[0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]||(this.current=t,this.gl.uniform2f(this.location,t[0],t[1]))}},e.Uniform3f=class extends ya{constructor(t,e){super(t,e),this.current=[0,0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]||(this.current=t,this.gl.uniform3f(this.location,t[0],t[1],t[2]))}},e.Uniform4f=ba,e.UniformColor=wa,e.UniformMatrix3f=class extends ya{constructor(t,e){super(t,e),this.current=Ca}set(t){for(let e=0;e<9;e++)if(t[e]!==this.current[e]){this.current=t,this.gl.uniformMatrix3fv(this.location,!1,t);break}}},e.UniformMatrix4f=class extends ya{constructor(t,e){super(t,e),this.current=Ta}set(t){if(t[12]!==this.current[12]||t[0]!==this.current[0])return this.current=t,void this.gl.uniformMatrix4fv(this.location,!1,t);for(let e=1;e<16;e++)if(t[e]!==this.current[e]){this.current=t,this.gl.uniformMatrix4fv(this.location,!1,t);break}}},e.UnwrappedTileID=Xh,e.ValidationError=Nt,e.VectorTileWorkerSource=class extends $t{constructor(t,e,n,i,r){super(),this.actor=t,this.layerIndex=e,this.availableImages=n,this.loadVectorData=r||Dd,this.loading={},this.loaded={},this.deduped=new Pd(t.scheduler),this.isSpriteLoaded=i,this.scheduler=t.scheduler}loadTile(t,e){const n=t.uid,i=t&&t.request,r=i&&i.collectResourceTiming,o=this.loading[n]=new Id(t);o.abort=this.loadVectorData(t,((a,s)=>{const l=!this.loading[n];if(delete this.loading[n],l||a||!s)return o.status="done",l||(this.loaded[n]=o),e(a);const c=s.rawData,u={};s.expires&&(u.expires=s.expires),s.cacheControl&&(u.cacheControl=s.cacheControl),o.vectorTile=s.vectorTile||new Zl.VectorTile(new zc(c));const h=()=>{o.parse(o.vectorTile,this.layerIndex,this.availableImages,this.actor,((t,n)=>{if(t||!n)return e(t);const o={};if(r){const t=qh(i);t.length>0&&(o.resourceTiming=JSON.parse(JSON.stringify(t)))}e(null,x({rawTileData:c.slice(0)},n,u,o))}))};this.isSpriteLoaded?h():this.once("isSpriteLoaded",(()=>{this.scheduler?this.scheduler.add(h,{type:"parseTile",isSymbolTile:t.isSymbolTile,zoom:t.tileZoom}):h()})),this.loaded=this.loaded||{},this.loaded[n]=o}))}reloadTile(t,e){const n=this.loaded,i=t.uid,r=this;if(n&&n[i]){const o=n[i];o.showCollisionBoxes=t.showCollisionBoxes,o.enableTerrain=!!t.enableTerrain;const a=(t,n)=>{const i=o.reloadCallback;i&&(delete o.reloadCallback,o.parse(o.vectorTile,r.layerIndex,this.availableImages,r.actor,i)),e(t,n)};"parsing"===o.status?o.reloadCallback=a:"done"===o.status&&(o.vectorTile?o.parse(o.vectorTile,this.layerIndex,this.availableImages,this.actor,a):a())}}abortTile(t,e){const n=t.uid,i=this.loading[n];i&&(i.abort&&i.abort(),delete this.loading[n]),e()}removeTile(t,e){const n=this.loaded,i=t.uid;n&&n[i]&&delete n[i],e()}},e.WritingMode=ou,e.ZoomHistory=pr,e.add=function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t},e.addDynamicAttributes=uh,e.altitudeFromMercatorZ=Nh,e.asyncAll=v,e.bezier=f,e.bindAll=S,e.bufferConvexPolygon=function(t,e){const n=[];for(let i=0;ivt&&(t.getActor().send("enforceCacheSizeLimit",_t),bt=0)},e.clamp=g,e.clearTileCache=function(t){const e=s.caches.delete(ft);t&&e.catch(t).then((()=>t()))},e.clipLine=Iu,e.clone=function(t){var e=new fs(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e},e.clone$1=function(t){var e=new fs(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},e.clone$2=M,e.collisionCircleLayout=xc,e.config=q,e.conjugate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t},e.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t},e.create=ys,e.create$1=function(){var t=new fs(16);return fs!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t},e.create$2=ms,e.createExpression=hi,e.createFilter=Ei,e.createLayout=Ao,e.createStyleLayer=function(t){return"custom"===t.type?new bh(t):new Ch[t.type](t)},e.cross=function(t,e,n){var i=e[0],r=e[1],o=e[2],a=n[0],s=n[1],l=n[2];return t[0]=r*l-o*s,t[1]=o*a-i*l,t[2]=i*s-r*a,t},e.degToRad=h,e.div=function(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t[2]=e[2]/n[2],t},e.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]},e.dot$1=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]},e.ease=m,e.easeCubicInOut=p,e.emitValidationErrors=nr,e.endsWith=A,e.enforceCacheSizeLimit=function(t){yt(),mt&&mt.then((e=>{e.keys().then((n=>{for(let i=0;io&&(i+=(t[r]-o)*(t[r]-o)),e[r]{}}},e.identity=gs,e.identity$1=zs,e.invert=function(t,e){var n=e[0],i=e[1],r=e[2],o=e[3],a=e[4],s=e[5],l=e[6],c=e[7],u=e[8],h=e[9],d=e[10],p=e[11],f=e[12],m=e[13],g=e[14],_=e[15],v=n*s-i*a,y=n*l-r*a,x=n*c-o*a,b=i*l-r*s,w=i*c-o*s,T=r*c-o*l,C=u*m-h*f,E=u*g-d*f,S=u*_-p*f,A=h*g-d*m,k=h*_-p*m,I=d*_-p*g,M=v*I-y*k+x*A+b*S-w*E+T*C;return M?(t[0]=(s*I-l*k+c*A)*(M=1/M),t[1]=(r*k-i*I-o*A)*M,t[2]=(m*T-g*w+_*b)*M,t[3]=(d*w-h*T-p*b)*M,t[4]=(l*S-a*I-c*E)*M,t[5]=(n*I-r*S+o*E)*M,t[6]=(g*x-f*T-_*y)*M,t[7]=(u*T-d*x+p*y)*M,t[8]=(a*k-s*S+c*C)*M,t[9]=(i*S-n*k-o*C)*M,t[10]=(f*w-m*x+_*v)*M,t[11]=(h*x-u*w-p*v)*M,t[12]=(s*E-a*A-l*C)*M,t[13]=(n*A-i*E+r*C)*M,t[14]=(m*y-f*b-g*v)*M,t[15]=(u*b-h*y+d*v)*M,t):null},e.isMapAuthenticated=function(t){return pt.has(t)},e.isMapboxURL=tt,e.latFromMercatorY=Bh,e.len=Ms,e.length=xs,e.length$1=function(t){return Math.hypot(t[0],t[1],t[2],t[3])},e.loadVectorTile=Dd,e.makeRequest=Et,e.mercatorXfromLng=Lh,e.mercatorYfromLat=Fh,e.mercatorZfromAltitude=$h,e.mul=function(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t[2]=e[2]*n[2],t[3]=e[3]*n[3],t},e.mul$1=vs,e.mul$2=Is,e.multiply=_s,e.multiply$1=Ts,e.nextPowerOfTwo=C,e.normalize=Es,e.normalize$1=function(t,e){var n=e[0],i=e[1],r=e[2],o=e[3],a=n*n+i*i+r*r+o*o;return a>0&&(a=1/Math.sqrt(a)),t[0]=n*a,t[1]=i*a,t[2]=r*a,t[3]=o*a,t},e.number=rn,e.ortho=function(t,e,n,i,r,o,a){var s=1/(e-n),l=1/(i-r),c=1/(o-a);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*l,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*c,t[11]=0,t[12]=(e+n)*s,t[13]=(r+i)*l,t[14]=(a+o)*c,t[15]=1,t},e.pbf=zc,e.perspective=function(t,e,n,i,r){var o,a=1/Math.tan(e/2);return t[0]=a/n,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=r&&r!==1/0?(t[10]=(r+i)*(o=1/(i-r)),t[14]=2*r*i*o):(t[10]=-1,t[14]=-2*i),t},e.pick=function(t,e){const n={};for(let i=0;ithis._layers[t.id])),n=e[0];if("none"===n.visibility)continue;const i=n.source||"";let r=this.familiesBySource[i];r||(r=this.familiesBySource[i]={});const o=n.sourceLayer||"_geojsonTileLayer";let a=r[o];a||(a=r[o]=[]),a.push(e)}}}const{ImageBitmap:r}=t.window;class o{loadTile(e,n){const{uid:i,encoding:o,rawImageData:a,padding:s,buildQuadTree:l}=e,c=r&&a instanceof r?this.getImageData(a,s):a;n(null,new t.DEMData(i,c,o,s<1,l))}getImageData(e,n){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(-n,-n,e.width+2*n,e.height+2*n);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new t.RGBAImage({width:i.width,height:i.height},i.data)}}var a=function t(e,n){var i,r=e&&e.type;if("FeatureCollection"===r)for(i=0;i=0!=!!e&&t.reverse()}const c=t.vectorTile.VectorTileFeature.prototype.toGeoJSON;class u{constructor(e){this._feature=e,this.extent=t.EXTENT,this.type=e.type,this.properties=e.tags,"id"in e&&!isNaN(e.id)&&(this.id=parseInt(e.id,10))}loadGeometry(){if(1===this._feature.type){const e=[];for(const n of this._feature.geometry)e.push([new t.pointGeometry(n[0],n[1])]);return e}{const e=[];for(const n of this._feature.geometry){const i=[];for(const e of n)i.push(new t.pointGeometry(e[0],e[1]));e.push(i)}return e}}toGeoJSON(t,e,n){return c.call(this,t,e,n)}}class h{constructor(e){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=t.EXTENT,this.length=e.length,this._features=e}feature(t){return new u(this._features[t])}}var d=t.vectorTile.VectorTileFeature,p=f;function f(t,e){this.options=e||{},this.features=t,this.length=t.length}function m(t,e){this.id="number"==typeof t.id?t.id:void 0,this.type=t.type,this.rawGeometry=1===t.type?[t.geometry]:t.geometry,this.properties=t.tags,this.extent=e||4096}f.prototype.feature=function(t){return new m(this.features[t],this.options.extent)},m.prototype.loadGeometry=function(){var e=this.rawGeometry;this.geometry=[];for(var n=0;n>31}function C(t,e){for(var n=t.loadGeometry(),i=t.type,r=0,o=0,a=n.length,s=0;s>1;A(t,e,a,i,r,o%2),S(t,e,n,i,a-1,o+1),S(t,e,n,a+1,r,o+1)}function A(t,e,n,i,r,o){for(;r>i;){if(r-i>600){const a=r-i+1,s=n-i+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(t,e,n,Math.max(i,Math.floor(n-s*c/a+u)),Math.min(r,Math.floor(n+(a-s)*c/a+u)),o)}const a=e[2*n+o];let s=i,l=r;for(k(t,e,i,n),e[2*r+o]>a&&k(t,e,i,r);sa;)l--}e[2*i+o]===a?k(t,e,i,l):(l++,k(t,e,l,r)),l<=n&&(i=l+1),n<=l&&(r=l-1)}}function k(t,e,n,i){I(t,n,i),I(e,2*n,2*i),I(e,2*n+1,2*i+1)}function I(t,e,n){const i=t[e];t[e]=t[n],t[n]=i}function M(t,e,n,i){const r=t-n,o=e-i;return r*r+o*o}g.fromVectorTileJs=v,g.fromGeojsonVt=function(t,e){e=e||{};var n={};for(var i in t)n[i]=new p(t[i].features,e),n[i].name=i,n[i].version=e.version,n[i].extent=e.extent;return v({layers:n})},g.GeoJSONWrapper=_;const P=t=>t[0],D=t=>t[1];class z{constructor(t,e=P,n=D,i=64,r=Float64Array){this.nodeSize=i,this.points=t;const o=t.length<65536?Uint16Array:Uint32Array,a=this.ids=new o(t.length),s=this.coords=new r(2*t.length);for(let i=0;i=n&&c<=r&&u>=i&&u<=o&&l.push(t[a]);continue}const f=Math.floor((p+d)/2);c=e[2*f],u=e[2*f+1],c>=n&&c<=r&&u>=i&&u<=o&&l.push(t[f]);const m=(h+1)%2;(0===h?n<=c:i<=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,t,e,n,i,this.nodeSize)}within(t,e,n){return function(t,e,n,i,r,o){const a=[0,t.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++)M(e[2*r],e[2*r+1],n,i)<=l&&s.push(t[r]);continue}const d=Math.floor((h+u)/2),p=e[2*d],f=e[2*d+1];M(p,f,n,i)<=l&&s.push(t[d]);const m=(c+1)%2;(0===c?n-r<=p:i-r<=f)&&(a.push(h),a.push(d-1),a.push(m)),(0===c?n+r>=p:i+r>=f)&&(a.push(d+1),a.push(u),a.push(m))}return s}(this.ids,this.coords,t,e,n,this.nodeSize)}}const O={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:t=>t},R=Math.fround||(L=new Float32Array(1),t=>(L[0]=+t,L[0]));var L;class F{constructor(t){this.options=q(Object.create(O),t),this.trees=new Array(this.options.maxZoom+1)}load(t){const{log:e,minZoom:n,maxZoom:i,nodeSize:r}=this.options;t.length;this.points=t;let o=[];for(let e=0;e=n;t--){Date.now();o=this._cluster(o,t),this.trees[t]=new z(o,Z,H,r,Float32Array)}return this}getClusters(t,e){let n=((t[0]+180)%360+360)%360-180;const i=Math.max(-90,Math.min(90,t[1]));let r=180===t[2]?180:((t[2]+180)%360+360)%360-180;const o=Math.max(-90,Math.min(90,t[3]));if(t[2]-t[0]>=360)n=-180,r=180;else if(n>r){const t=this.getClusters([n,i,180,o],e),a=this.getClusters([-180,i,r,o],e);return t.concat(a)}const a=this.trees[this._limitZoom(e)],s=a.range(U(n),V(o),U(r),V(i)),l=[];for(const t of s){const e=a.points[t];l.push(e.numPoints?N(e):this.points[e.index])}return l}getChildren(t){const e=this._getOriginId(t),n=this._getOriginZoom(t),i="No cluster with the specified id.",r=this.trees[n];if(!r)throw new Error(i);const o=r.points[e];if(!o)throw new Error(i);const a=this.options.radius/(this.options.extent*Math.pow(2,n-1)),s=r.within(o.x,o.y,a),l=[];for(const e of s){const n=r.points[e];n.parentId===t&&l.push(n.numPoints?N(n):this.points[n.index])}if(0===l.length)throw new Error(i);return l}getLeaves(t,e,n){const i=[];return this._appendLeaves(i,t,e=e||10,n=n||0,0),i}getTile(t,e,n){const i=this.trees[this._limitZoom(t)],r=Math.pow(2,t),{extent:o,radius:a}=this.options,s=a/o,l=(n-s)/r,c=(n+1+s)/r,u={features:[]};return this._addTileFeatures(i.range((e-s)/r,l,(e+1+s)/r,c),i.points,e,n,r,u),0===e&&this._addTileFeatures(i.range(1-s/r,l,1,c),i.points,r,n,r,u),e===r-1&&this._addTileFeatures(i.range(0,l,s/r,c),i.points,-1,n,r,u),u.features.length?u:null}getClusterExpansionZoom(t){let e=this._getOriginZoom(t)-1;for(;e<=this.options.maxZoom;){const n=this.getChildren(t);if(e++,1!==n.length)break;t=n[0].properties.cluster_id}return e}_appendLeaves(t,e,n,i,r){const o=this.getChildren(e);for(const e of o){const o=e.properties;if(o&&o.cluster?r+o.point_count<=i?r+=o.point_count:r=this._appendLeaves(t,o.cluster_id,n,i,r):re&&(h+=n.numPoints||1)}if(h>=a){let t=r.x*u,a=r.y*u,s=o&&u>1?this._map(r,!0):null;const d=(i<<5)+(e+1)+this.points.length;for(const n of c){const i=l.points[n];if(i.zoom<=e)continue;i.zoom=e;const c=i.numPoints||1;t+=i.x*c,a+=i.y*c,i.parentId=d,o&&(s||(s=this._map(r,!0)),o(s,this._map(i)))}r.parentId=d,n.push($(t/h,a/h,d,h,s))}else if(n.push(r),h>1)for(const t of c){const i=l.points[t];i.zoom<=e||(i.zoom=e,n.push(i))}}return n}_getOriginId(t){return t-this.points.length>>5}_getOriginZoom(t){return(t-this.points.length)%32}_map(t,e){if(t.numPoints)return e?q({},t.properties):t.properties;const n=this.points[t.index].properties,i=this.options.map(n);return e&&i===n?q({},i):i}}function $(t,e,n,i,r){return{x:R(t),y:R(e),zoom:1/0,id:n,parentId:-1,numPoints:i,properties:r}}function B(t,e){const[n,i]=t.geometry.coordinates;return{x:R(U(n)),y:R(V(i)),zoom:1/0,index:e,parentId:-1}}function N(t){return{type:"Feature",id:t.id,properties:j(t),geometry:{type:"Point",coordinates:[(e=t.x,360*(e-.5)),G(t.y)]}};var e}function j(t){const e=t.numPoints,n=e>=1e4?`${Math.round(e/1e3)}k`:e>=1e3?Math.round(e/100)/10+"k":e;return q(q({},t.properties),{cluster:!0,cluster_id:t.id,point_count:e,point_count_abbreviated:n})}function U(t){return t/360+.5}function V(t){const e=Math.sin(t*Math.PI/180),n=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return n<0?0:n>1?1:n}function G(t){const e=(180-360*t)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}function q(t,e){for(const n in e)t[n]=e[n];return t}function Z(t){return t.x}function H(t){return t.y}function W(t,e,n,i){for(var r,o=i,a=n-e>>1,s=n-e,l=t[e],c=t[e+1],u=t[n],h=t[n+1],d=e+3;do)r=d,o=p;else if(p===o){var f=Math.abs(d-a);fi&&(r-e>3&&W(t,e,r,i),t[r+2]=o,n-r>3&&W(t,r,n,i))}function X(t,e,n,i,r,o){var a=r-n,s=o-i;if(0!==a||0!==s){var l=((t-n)*a+(e-i)*s)/(a*a+s*s);l>1?(n=r,i=o):l>0&&(n+=a*l,i+=s*l)}return(a=t-n)*a+(s=e-i)*s}function K(t,e,n,i){var r={id:void 0===t?null:t,type:e,geometry:n,tags:i,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(t){var e=t.geometry,n=t.type;if("Point"===n||"MultiPoint"===n||"LineString"===n)Y(t,e);else if("Polygon"===n||"MultiLineString"===n)for(var i=0;i0&&(a+=i?(r*c-l*o)/2:Math.sqrt(Math.pow(l-r,2)+Math.pow(c-o,2))),r=l,o=c}var u=e.length-3;e[2]=1,W(e,0,u,n),e[u+2]=1,e.size=Math.abs(a),e.start=0,e.end=e.size}function et(t,e,n,i){for(var r=0;r1?1:n}function rt(t,e,n,i,r,o,a,s){if(i/=e,o>=(n/=e)&&a=i)return null;for(var l=[],c=0;c=n&&f=i)){var m=[];if("Point"===d||"MultiPoint"===d)ot(h,m,n,i,r);else if("LineString"===d)at(h,m,n,i,r,!1,s.lineMetrics);else if("MultiLineString"===d)lt(h,m,n,i,r,!1);else if("Polygon"===d)lt(h,m,n,i,r,!0);else if("MultiPolygon"===d)for(var g=0;g=n&&a<=i&&(e.push(t[o]),e.push(t[o+1]),e.push(t[o+2]))}}function at(t,e,n,i,r,o,a){for(var s,l,c=st(t),u=0===r?ut:ht,h=t.start,d=0;dn&&(l=u(c,p,f,g,_,n),a&&(c.start=h+s*l)):v>i?y=n&&(l=u(c,p,f,g,_,n),x=!0),y>i&&v<=i&&(l=u(c,p,f,g,_,i),x=!0),!o&&x&&(a&&(c.end=h+s*l),e.push(c),c=st(t)),a&&(h+=s)}var b=t.length-3;p=t[b],f=t[b+1],m=t[b+2],(v=0===r?p:f)>=n&&v<=i&&ct(c,p,f,m),b=c.length-3,o&&b>=3&&(c[b]!==c[0]||c[b+1]!==c[1])&&ct(c,c[0],c[1],c[2]),c.length&&e.push(c)}function st(t){var e=[];return e.size=t.size,e.start=t.start,e.end=t.end,e}function lt(t,e,n,i,r,o){for(var a=0;aa.maxX&&(a.maxX=u),h>a.maxY&&(a.maxY=h)}return a}function _t(t,e,n,i){var r=e.geometry,o=e.type,a=[];if("Point"===o||"MultiPoint"===o)for(var s=0;s0&&e.size<(r?a:i))n.numPoints+=e.length/3;else{for(var s=[],l=0;la)&&(n.numSimplified++,s.push(e[l]),s.push(e[l+1])),n.numPoints++;r&&function(t,e){for(var n=0,i=0,r=t.length,o=r-2;i0===e)for(i=0,r=t.length;i24)throw new Error("maxZoom should be in the 0-24 range");if(e.promoteId&&e.generateId)throw new Error("promoteId and generateId cannot be used together.");var i=function(t,e){var n=[];if("FeatureCollection"===t.type)for(var i=0;i24)return null;var o=1<0;)l--,c=Math.floor(c/2),u=Math.floor(u/2),s=this.tiles[xt(l,c,u)];return s&&s.source?(this.splitTile(s.source,l,c,u,t,e,n),this.tiles[a]?ft(this.tiles[a],r):null):null};class wt extends t.VectorTileWorkerSource{constructor(t,e,n,i,r){super(t,e,n,i,bt),r&&(this.loadGeoJSON=r)}loadData(e,n){const i=e&&e.request,r=i&&i.collectResourceTiming;this.loadGeoJSON(e,((o,s)=>{if(o||!s)return n(o);if("object"!=typeof s)return n(new Error(`Input data given to '${e.source}' is not a valid GeoJSON object.`));{a(s,!0);try{if(e.filter){const n=t.createExpression(e.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===n.result)throw new Error(n.value.map((t=>`${t.key}: ${t.message}`)).join(", "));const i=s.features.filter((t=>n.value.evaluate({zoom:0},t)));s={type:"FeatureCollection",features:i}}this._geoJSONIndex=e.cluster?new F(function({superclusterOptions:e,clusterProperties:n}){if(!n||!e)return e;const i={},r={},o={accumulated:null,zoom:0},a={properties:null},s=Object.keys(n);for(const e of s){const[o,a]=n[e],s=t.createExpression(a),l=t.createExpression("string"==typeof o?[o,["accumulated"],["get",e]]:o);i[e]=s.value,r[e]=l.value}return e.map=t=>{a.properties=t;const e={};for(const t of s)e[t]=i[t].evaluate(o,a);return e},e.reduce=(t,e)=>{a.properties=e;for(const e of s)o.accumulated=t[e],t[e]=r[e].evaluate(o,a)},e}(e)).load(s.features):function(t,e){return new yt(t,e)}(s,e.geojsonVtOptions)}catch(o){return n(o)}this.loaded={};const l={};if(r){const n=t.getPerformanceMeasurement(i);n&&(l.resourceTiming={},l.resourceTiming[e.source]=JSON.parse(JSON.stringify(n)))}n(null,l)}}))}reloadTile(t,e){const n=this.loaded;return n&&n[t.uid]?super.reloadTile(t,e):this.loadTile(t,e)}loadGeoJSON(e,n){if(e.request)t.getJSON(e.request,n);else{if("string"!=typeof e.data)return n(new Error(`Input data given to '${e.source}' is not a valid GeoJSON object.`));try{return n(null,JSON.parse(e.data))}catch(t){return n(new Error(`Input data given to '${e.source}' is not a valid GeoJSON object.`))}}}getClusterExpansionZoom(t,e){try{e(null,this._geoJSONIndex.getClusterExpansionZoom(t.clusterId))}catch(t){e(t)}}getClusterChildren(t,e){try{e(null,this._geoJSONIndex.getChildren(t.clusterId))}catch(t){e(t)}}getClusterLeaves(t,e){try{e(null,this._geoJSONIndex.getLeaves(t.clusterId,t.limit,t.offset))}catch(t){e(t)}}}class Tt{constructor(e){this.self=e,this.actor=new t.Actor(e,this),this.layerIndexes={},this.availableImages={},this.isSpriteLoaded=!1,this.workerSourceTypes={vector:t.VectorTileWorkerSource,geojson:wt},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(t,e)=>{if(this.workerSourceTypes[t])throw new Error(`Worker source with name "${t}" already registered.`);this.workerSourceTypes[t]=e},this.self.registerRTLTextPlugin=e=>{if(t.plugin.isParsed())throw new Error("RTL text plugin already registered.");t.plugin.applyArabicShaping=e.applyArabicShaping,t.plugin.processBidirectionalText=e.processBidirectionalText,t.plugin.processStyledBidirectionalText=e.processStyledBidirectionalText}}checkIfReady(t,e,n){n()}setReferrer(t,e){this.referrer=e}spriteLoaded(e,n){this.isSpriteLoaded=n;for(const i in this.workerSources[e]){const r=this.workerSources[e][i];for(const e in r)r[e]instanceof t.VectorTileWorkerSource&&(r[e].isSpriteLoaded=n,r[e].fire(new t.Event("isSpriteLoaded")))}}setImages(t,e,n){this.availableImages[t]=e;for(const n in this.workerSources[t]){const i=this.workerSources[t][n];for(const t in i)i[t].availableImages=e}n()}enableTerrain(t,e,n){this.terrain=e,n()}setLayers(t,e,n){this.getLayerIndex(t).replace(e),n()}updateLayers(t,e,n){this.getLayerIndex(t).update(e.layers,e.removedIds),n()}loadTile(e,n,i){const r=this.enableTerrain?t.extend({enableTerrain:this.terrain},n):n;this.getWorkerSource(e,n.type,n.source).loadTile(r,i)}loadDEMTile(e,n,i){const r=this.enableTerrain?t.extend({buildQuadTree:this.terrain},n):n;this.getDEMWorkerSource(e,n.source).loadTile(r,i)}reloadTile(e,n,i){const r=this.enableTerrain?t.extend({enableTerrain:this.terrain},n):n;this.getWorkerSource(e,n.type,n.source).reloadTile(r,i)}abortTile(t,e,n){this.getWorkerSource(t,e.type,e.source).abortTile(e,n)}removeTile(t,e,n){this.getWorkerSource(t,e.type,e.source).removeTile(e,n)}removeSource(t,e,n){if(!this.workerSources[t]||!this.workerSources[t][e.type]||!this.workerSources[t][e.type][e.source])return;const i=this.workerSources[t][e.type][e.source];delete this.workerSources[t][e.type][e.source],void 0!==i.removeSource?i.removeSource(e,n):n()}loadWorkerSource(t,e,n){try{this.self.importScripts(e.url),n()}catch(t){n(t.toString())}}syncRTLPluginState(e,n,i){try{t.plugin.setState(n);const e=t.plugin.getPluginURL();if(t.plugin.isLoaded()&&!t.plugin.isParsed()&&null!=e){this.self.importScripts(e);const n=t.plugin.isParsed();i(n?void 0:new Error(`RTL Text Plugin failed to import scripts from ${e}`),n)}}catch(t){i(t.toString())}}getAvailableImages(t){let e=this.availableImages[t];return e||(e=[]),e}getLayerIndex(t){let e=this.layerIndexes[t];return e||(e=this.layerIndexes[t]=new i),e}getWorkerSource(t,e,n){return this.workerSources[t]||(this.workerSources[t]={}),this.workerSources[t][e]||(this.workerSources[t][e]={}),this.workerSources[t][e][n]||(this.workerSources[t][e][n]=new this.workerSourceTypes[e]({send:(e,n,i,r,o,a)=>{this.actor.send(e,n,i,t,o,a)},scheduler:this.actor.scheduler},this.getLayerIndex(t),this.getAvailableImages(t),this.isSpriteLoaded)),this.workerSources[t][e][n]}getDEMWorkerSource(t,e){return this.demWorkerSources[t]||(this.demWorkerSources[t]={}),this.demWorkerSources[t][e]||(this.demWorkerSources[t][e]=new o),this.demWorkerSources[t][e]}enforceCacheSizeLimit(e,n){t.enforceCacheSizeLimit(n)}getWorkerPerformanceMetrics(t,e,n){n(void 0,void 0)}}return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope&&(self.worker=new Tt(self)),Tt})),r(0,(function(t){var e=n;function n(t){return!function(t){return"undefined"==typeof window||"undefined"==typeof document?"not a browser":Array.prototype&&Array.prototype.every&&Array.prototype.filter&&Array.prototype.forEach&&Array.prototype.indexOf&&Array.prototype.lastIndexOf&&Array.prototype.map&&Array.prototype.some&&Array.prototype.reduce&&Array.prototype.reduceRight&&Array.isArray?Function.prototype&&Function.prototype.bind?Object.keys&&Object.create&&Object.getPrototypeOf&&Object.getOwnPropertyNames&&Object.isSealed&&Object.isFrozen&&Object.isExtensible&&Object.getOwnPropertyDescriptor&&Object.defineProperty&&Object.defineProperties&&Object.seal&&Object.freeze&&Object.preventExtensions?"JSON"in window&&"parse"in JSON&&"stringify"in JSON?function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var t,e,n=new Blob([""],{type:"text/javascript"}),i=URL.createObjectURL(n);try{e=new Worker(i),t=!0}catch(e){t=!1}return e&&e.terminate(),URL.revokeObjectURL(i),t}()?"Uint8ClampedArray"in window?ArrayBuffer.isView?function(){var t=document.createElement("canvas");t.width=t.height=1;var e=t.getContext("2d");if(!e)return!1;var n=e.getImageData(0,0,1,1);return n&&n.width===t.width}()?(void 0===i[e=t&&t.failIfMajorPerformanceCaveat]&&(i[e]=function(t){var e,i=function(t){var e=document.createElement("canvas"),i=Object.create(n.webGLContextAttributes);return i.failIfMajorPerformanceCaveat=t,e.getContext("webgl",i)||e.getContext("experimental-webgl",i)}(t);if(!i)return!1;try{e=i.createShader(i.VERTEX_SHADER)}catch(t){return!1}return!(!e||i.isContextLost())&&(i.shaderSource(e,"void main() {}"),i.compileShader(e),!0===i.getShaderParameter(e,i.COMPILE_STATUS))}(e)),i[e]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL support"):"insufficient Canvas/getImageData support":"insufficient ArrayBuffer support":"insufficient Uint8ClampedArray support":"insufficient worker support":"insufficient JSON support":"insufficient Object support":"insufficient Function support":"insufficent Array support";var e}(t)}var i={};function r(t,e){if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(let n=0;n{t.window.removeEventListener("click",u,!0)}),0)},o.mousePos=function(t,e){const n=t.getBoundingClientRect();return h(t,n,e)},o.touchPos=function(t,e){const n=t.getBoundingClientRect(),i=[];for(let r=0;r=0?0:e.button},o.remove=function(t){t.parentNode&&t.parentNode.removeChild(t)};class d{constructor(t,e){this.pos=t,this.dir=e}intersectsPlane(e,n,i){const r=t.dot(n,this.dir);if(Math.abs(r)<1e-6)return!1;const o=t.dot(t.sub(t.create(),e,this.pos),n)/r,a=t.scaleAndAdd(t.create(),this.pos,this.dir,o);return t.copy(i,a),!0}}class p{constructor(t,e){this.points=t,this.planes=e}static fromInvProjectionMatrix(e,n,i){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=t.transformMat4([],i,e),a=1/o[3]/n*r;return t.mul(o,o,[a,a,1/o[3],a])})),a=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map((e=>{const n=t.sub([],o[e[0]],o[e[1]]),i=t.sub([],o[e[2]],o[e[1]]),r=t.normalize([],t.cross([],n,i)),a=-t.dot(r,o[e[1]]);return r.concat(a)}));return new p(o,a)}}class f{constructor(e,n){this.min=e,this.max=n,this.center=t.scale([],t.add([],this.min,this.max),.5)}quadrant(e){const n=[e%2==0,e<2],i=t.clone(this.min),r=t.clone(this.max);for(let t=0;t=0;if(0===a)return 0;a!==n.length&&(i=!1)}if(i)return 2;for(let t=0;t<3;t++){let n=Number.MAX_VALUE,i=-Number.MAX_VALUE;for(let r=0;rthis.max[t]-this.min[t])return 0}return 1}}function m(t){const{userImage:e}=t;return!!(e&&e.render&&e.render())&&(t.data.replace(new Uint8Array(e.data.buffer)),!0)}class g extends t.Evented{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new t.RGBAImage({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(t){if(this.loaded!==t&&(this.loaded=t,t)){for(const{ids:t,callback:e}of this.requestors)this._notify(t,e);this.requestors=[]}}getImage(t){return this.images[t]}addImage(t,e){this._validate(t,e)&&(this.images[t]=e)}_validate(e,n){let i=!0;return this._validateStretch(n.stretchX,n.data&&n.data.width)||(this.fire(new t.ErrorEvent(new Error(`Image "${e}" has invalid "stretchX" value`))),i=!1),this._validateStretch(n.stretchY,n.data&&n.data.height)||(this.fire(new t.ErrorEvent(new Error(`Image "${e}" has invalid "stretchY" value`))),i=!1),this._validateContent(n.content,n)||(this.fire(new t.ErrorEvent(new Error(`Image "${e}" has invalid "content" value`))),i=!1),i}_validateStretch(t,e){if(!t)return!0;let n=0;for(const i of t){if(i[0]{this.ready=!0}))}broadcast(e,n,i){t.asyncAll(this.actors,((t,i)=>{t.send(e,n,i)}),i=i||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach((t=>{t.remove()})),this.actors=[],this.workerPool.release(this.id)}}function I(e,n,i){return n*(t.EXTENT/(e.tileSize*Math.pow(2,i-e.tileID.overscaledZ)))}k.Actor=t.Actor;class M{constructor(t,e,n,i){this.screenBounds=t,this.cameraPoint=e,this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=n,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this.screenGeometry.map((t=>i.pointCoordinate3D(t))),this.cameraGeometry=this.bufferedCameraGeometry(0)}static createFromScreenPoints(e,n){let i,r;if(e instanceof t.pointGeometry||"number"==typeof e[0]){const o=t.pointGeometry.convert(e);i=[t.pointGeometry.convert(e)],r=n.isPointAboveHorizon(o)}else{const o=t.pointGeometry.convert(e[0]),a=t.pointGeometry.convert(e[1]);i=[o,a],r=t.polygonizeBounds(o,a).every((t=>n.isPointAboveHorizon(t)))}return new M(i,n.getCameraPoint(),r,n)}isPointQuery(){return 1===this.screenBounds.length}bufferedScreenGeometry(e){return t.polygonizeBounds(this.screenBounds[0],1===this.screenBounds.length?this.screenBounds[0]:this.screenBounds[1],e)}bufferedCameraGeometry(e){const n=this.screenBounds[0],i=1===this.screenBounds.length?this.screenBounds[0].add(new t.pointGeometry(1,1)):this.screenBounds[1],r=t.polygonizeBounds(n,i,0,!1);return this.cameraPoint.y>i.y&&(this.cameraPoint.x>n.x&&this.cameraPoint.x=i.x?r[2]=this.cameraPoint:this.cameraPoint.x<=n.x&&(r[3]=this.cameraPoint)),t.bufferConvexPolygon(r,e)}containsTile(e,n,i){const r=e.queryPadding+1,o=i?this._bufferedCameraMercator(r,n).map((t=>e.tileID.getTilePoint(t))):this._bufferedScreenMercator(r,n).map((t=>e.tileID.getTilePoint(t))),a=this.screenGeometryMercator.map((t=>e.tileID.getTileVec3(t))),s=a.map((e=>new t.pointGeometry(e[0],e[1]))),l=n.getFreeCameraOptions().position||new t.MercatorCoordinate(0,0,0),c=e.tileID.getTileVec3(l),u=a.map((e=>{const n=t.sub(e,e,c);return t.normalize(n,n),new d(c,n)})),h=I(e,1,n.zoom);if(t.polygonIntersectsBox(o,0,0,t.EXTENT,t.EXTENT))return{queryGeometry:this,tilespaceGeometry:s,tilespaceRays:u,bufferedTilespaceGeometry:o,bufferedTilespaceBounds:(p=t.getBounds(o),p.min.x=t.clamp(p.min.x,0,t.EXTENT),p.min.y=t.clamp(p.min.y,0,t.EXTENT),p.max.x=t.clamp(p.max.x,0,t.EXTENT),p.max.y=t.clamp(p.max.y,0,t.EXTENT),p),tile:e,tileID:e.tileID,pixelToTileUnitsFactor:h};var p}_bufferedScreenMercator(t,e){const n=P(t);if(this._screenRaycastCache[n])return this._screenRaycastCache[n];{const i=this.bufferedScreenGeometry(t).map((t=>e.pointCoordinate3D(t)));return this._screenRaycastCache[n]=i,i}}_bufferedCameraMercator(t,e){const n=P(t);if(this._cameraRaycastCache[n])return this._cameraRaycastCache[n];{const i=this.bufferedCameraGeometry(t).map((t=>e.pointCoordinate3D(t)));return this._cameraRaycastCache[n]=i,i}}}function P(t){return 100*t|0}function D(e,n,i){const r=function(r,o){if(r)return i(r);if(o){const r=t.pick(t.extend(o,e),["tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","scheme","tileSize","encoding"]);o.vector_layers&&(r.vectorLayers=o.vector_layers,r.vectorLayerIds=r.vectorLayers.map((t=>t.id))),r.tiles=n.canonicalizeTileset(r,e.url),i(null,r)}};return e.url?t.getJSON(n.transformRequest(n.normalizeSourceURL(e.url),t.ResourceType.Source),r):t.exported.frame((()=>r(null,e)))}class z{constructor(e,n,i){this.bounds=t.LngLatBounds.convert(this.validateBounds(e)),this.minzoom=n||0,this.maxzoom=i||24}validateBounds(t){return Array.isArray(t)&&4===t.length?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]}contains(e){const n=Math.pow(2,e.z),i=Math.floor(t.mercatorXfromLng(this.bounds.getWest())*n),r=Math.floor(t.mercatorYfromLat(this.bounds.getNorth())*n),o=Math.ceil(t.mercatorXfromLng(this.bounds.getEast())*n),a=Math.ceil(t.mercatorYfromLat(this.bounds.getSouth())*n);return e.x>=i&&e.x=r&&e.y{this._tileJSONRequest=null,this._loaded=!0,e?this.fire(new t.ErrorEvent(e)):n&&(t.extend(this,n),n.bounds&&(this.tileBounds=new z(n.bounds,this.minzoom,this.maxzoom)),t.postTurnstileEvent(n.tiles),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"content"})))}))}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return t.extend({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(e,n){const i=t.exported.devicePixelRatio>=2,r=this.map._requestManager.normalizeTileURL(e.tileID.canonical.url(this.tiles,this.scheme),i,this.tileSize);e.request=t.getImage(this.map._requestManager.transformRequest(r,t.ResourceType.Tile),((i,r,o,a)=>{if(delete e.request,e.aborted)e.state="unloaded",n(null);else if(i)e.state="errored",n(i);else if(r){this.map._refreshExpiredTiles&&e.setExpiryData({cacheControl:o,expires:a});const i=this.map.painter.context,s=i.gl;e.texture=this.map.painter.getTileTexture(r.width),e.texture?e.texture.update(r,{useMipmap:!0}):(e.texture=new t.Texture(i,r,s.RGBA,{useMipmap:!0}),e.texture.bind(s.LINEAR,s.CLAMP_TO_EDGE,s.LINEAR_MIPMAP_NEAREST),i.extTextureFilterAnisotropic&&s.texParameterf(s.TEXTURE_2D,i.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,i.extTextureFilterAnisotropicMax)),e.state="loaded",t.cacheEntryPossiblyAdded(this.dispatcher),n(null)}}))}abortTile(t,e){t.request&&(t.request.cancel(),delete t.request),e()}unloadTile(t,e){t.texture&&this.map.painter.saveTileTexture(t.texture),e()}hasTransition(){return!1}}let wt;var Tt=t.createLayout([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class Ct extends t.Evented{constructor(t,e,n,i){super(),this.id=t,this.dispatcher=n,this.coordinates=e.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(i),this.options=e}load(e,n){this._loaded=!1,this.fire(new t.Event("dataloading",{dataType:"source"})),this.url=this.options.url,t.getImage(this.map._requestManager.transformRequest(this.url,t.ResourceType.Image),((i,r)=>{this._loaded=!0,i?this.fire(new t.ErrorEvent(i)):r&&(this.image=t.exported.getImageData(r),e&&(this.coordinates=e),n&&n(),this._finishLoading())}))}loaded(){return this._loaded}updateImage(t){return this.image&&t.url?(this.options.url=t.url,this.load(t.coordinates,(()=>{this.texture=null})),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}setCoordinates(e){this.coordinates=e;const n=e.map(t.MercatorCoordinate.fromLngLat);this.tileID=function(e){let n=1/0,i=1/0,r=-1/0,o=-1/0;for(const t of e)n=Math.min(n,t.x),i=Math.min(i,t.y),r=Math.max(r,t.x),o=Math.max(o,t.y);const a=Math.max(r-n,o-i),s=Math.max(0,Math.floor(-Math.log(a)/Math.LN2)),l=Math.pow(2,s);return new t.CanonicalTileID(s,Math.floor((n+r)/2*l),Math.floor((i+o)/2*l))}(n),this.minzoom=this.maxzoom=this.tileID.z;const i=n.map((t=>this.tileID.getTilePoint(t)._round()));return this._boundsArray=new t.StructArrayLayout4i8,this._boundsArray.emplaceBack(i[0].x,i[0].y,0,0),this._boundsArray.emplaceBack(i[1].x,i[1].y,t.EXTENT,0),this._boundsArray.emplaceBack(i[3].x,i[3].y,0,t.EXTENT),this._boundsArray.emplaceBack(i[2].x,i[2].y,t.EXTENT,t.EXTENT),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(0===Object.keys(this.tiles).length||!this.image)return;const e=this.map.painter.context,n=e.gl;this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,Tt.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture||(this.texture=new t.Texture(e,this.image,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));for(const t in this.tiles){const e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture)}}loadTile(t,e){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={},e(null)):(t.state="errored",e(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}const Et={vector:class extends t.Evented{constructor(e,n,i,r){if(super(),this.id=e,this.dispatcher=i,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,t.extend(this,t.pick(n,["url","scheme","tileSize","promoteId"])),this._options=t.extend({type:"vector"},n),this._collectResourceTiming=n.collectResourceTiming,512!==this.tileSize)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(r),this._tileWorkers={},this._deduped=new t.DedupedRequest}load(){this._loaded=!1,this.fire(new t.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=D(this._options,this.map._requestManager,((e,n)=>{this._tileJSONRequest=null,this._loaded=!0,e?this.fire(new t.ErrorEvent(e)):n&&(t.extend(this,n),n.bounds&&(this.tileBounds=new z(n.bounds,this.minzoom,this.maxzoom)),t.postTurnstileEvent(n.tiles,this.map._requestManager._customAccessToken),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"content"})))}))}loaded(){return this._loaded}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}onAdd(t){this.map=t,this.load()}setSourceProperty(t){this._tileJSONRequest&&this._tileJSONRequest.cancel(),t();const e=this.map.style._getSourceCaches(this.id);for(const t of e)t.clearTiles();this.load()}setTiles(t){return this.setSourceProperty((()=>{this._options.tiles=t})),this}setUrl(t){return this.setSourceProperty((()=>{this.url=t,this._options.url=t})),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return t.extend({},this._options)}loadTile(e,n){const i=this.map._requestManager.normalizeTileURL(e.tileID.canonical.url(this.tiles,this.scheme)),r={request:this.map._requestManager.transformRequest(i,t.ResourceType.Tile),data:void 0,uid:e.uid,tileID:e.tileID,tileZoom:e.tileZoom,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:t.exported.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,isSymbolTile:e.isSymbolTile};if(r.request.collectResourceTiming=this._collectResourceTiming,e.actor&&"expired"!==e.state)"loading"===e.state?e.reloadCallback=n:e.request=e.actor.send("reloadTile",r,o.bind(this));else if(e.actor=this._tileWorkers[i]=this._tileWorkers[i]||this.dispatcher.getActor(),this.dispatcher.ready)e.request=e.actor.send("loadTile",r,o.bind(this),void 0,!0);else{const n=t.loadVectorTile.call({deduped:this._deduped},r,((t,n)=>{t||!n?o.call(this,t):(r.data={cacheControl:n.cacheControl,expires:n.expires,rawData:n.rawData.slice(0)},e.actor&&e.actor.send("loadTile",r,o.bind(this),void 0,!0))}),!0);e.request={cancel:n}}function o(i,r){return delete e.request,e.aborted?n(null):i&&404!==i.status?n(i):(r&&r.resourceTiming&&(e.resourceTiming=r.resourceTiming),this.map._refreshExpiredTiles&&r&&e.setExpiryData(r),e.loadVectorData(r,this.map.painter),t.cacheEntryPossiblyAdded(this.dispatcher),n(null),void(e.reloadCallback&&(this.loadTile(e,e.reloadCallback),e.reloadCallback=null)))}}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.actor&&t.actor.send("abortTile",{uid:t.uid,type:this.type,source:this.id})}unloadTile(t){t.unloadVectorData(),t.actor&&t.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id})}hasTransition(){return!1}afterUpdate(){this._tileWorkers={}}},raster:bt,"raster-dem":class extends bt{constructor(e,n,i,r){super(e,n,i,r),this.type="raster-dem",this.maxzoom=22,this._options=t.extend({type:"raster-dem"},n),this.encoding=n.encoding||"mapbox"}loadTile(e,n){const i=this.map._requestManager.normalizeTileURL(e.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);function r(t,i){t&&(e.state="errored",n(t)),i&&(e.dem=i,e.dem.onDeserialize(),e.needsHillshadePrepare=!0,e.needsDEMTextureUpload=!0,e.state="loaded",n(null))}e.request=t.getImage(this.map._requestManager.transformRequest(i,t.ResourceType.Tile),function(i,o,a,s){if(delete e.request,e.aborted)e.state="unloaded",n(null);else if(i)e.state="errored",n(i);else if(o){this.map._refreshExpiredTiles&&e.setExpiryData({cacheControl:a,expires:s});const n=t.window.ImageBitmap&&o instanceof t.window.ImageBitmap&&(null==wt&&(wt=t.window.OffscreenCanvas&&new t.window.OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof t.window.createImageBitmap),wt),i=1-(o.width-t.prevPowerOfTwo(o.width))/2;i<1||e.neighboringTiles||(e.neighboringTiles=this._getNeighboringTiles(e.tileID));const l=n?o:t.exported.getImageData(o,i),c={uid:e.uid,coord:e.tileID,source:this.id,rawImageData:l,encoding:this.encoding,padding:i};e.actor&&"expired"!==e.state||(e.actor=this.dispatcher.getActor(),e.actor.send("loadDEMTile",c,r.bind(this),void 0,!0))}}.bind(this))}_getNeighboringTiles(e){const n=e.canonical,i=Math.pow(2,n.z),r=(n.x-1+i)%i,o=0===n.x?e.wrap-1:e.wrap,a=(n.x+1+i)%i,s=n.x+1===i?e.wrap+1:e.wrap,l={};return l[new t.OverscaledTileID(e.overscaledZ,o,n.z,r,n.y).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,s,n.z,a,n.y).key]={backfilled:!1},n.y>0&&(l[new t.OverscaledTileID(e.overscaledZ,o,n.z,r,n.y-1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,e.wrap,n.z,n.x,n.y-1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,s,n.z,a,n.y-1).key]={backfilled:!1}),n.y+1{if(this._loaded=!0,this._pendingLoad=null,e)this.fire(new t.ErrorEvent(e));else{const e={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&n&&n.resourceTiming&&n.resourceTiming[this.id]&&(e.resourceTiming=n.resourceTiming[this.id]),this.fire(new t.Event("data",e)),this._metadataFired=!0}this._coalesce&&(this._updateWorkerData(),this._coalesce=!1)}))}loaded(){return this._loaded}loadTile(e,n){const i=e.actor?"reloadTile":"loadTile";e.actor=this.actor,e.request=this.actor.send(i,{type:this.type,uid:e.uid,tileID:e.tileID,tileZoom:e.tileZoom,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:t.exported.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId},((t,r)=>(delete e.request,e.unloadVectorData(),e.aborted?n(null):t?n(t):(e.loadVectorData(r,this.map.painter,"reloadTile"===i),n(null)))),void 0,"loadTile"===i)}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.aborted=!0}unloadTile(t){t.unloadVectorData(),this.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id})}onRemove(){this._pendingLoad&&this._pendingLoad.cancel()}serialize(){return t.extend({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},video:class extends Ct{constructor(t,e,n,i){super(t,e,n,i),this.roundZoom=!0,this.type="video",this.options=e}load(){this._loaded=!1;const e=this.options;this.urls=[];for(const n of e.urls)this.urls.push(this.map._requestManager.transformRequest(n,t.ResourceType.Source).url);t.getVideo(this.urls,((e,n)=>{this._loaded=!0,e?this.fire(new t.ErrorEvent(e)):n&&(this.video=n,this.video.loop=!0,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(e){if(this.video){const n=this.video.seekable;en.end(0)?this.fire(new t.ErrorEvent(new t.ValidationError(`sources.${this.id}`,null,`Playback for this video can be set only between the ${n.start(0)} and ${n.end(0)}-second mark.`))):this.video.currentTime=e}}getVideo(){return this.video}onAdd(t){this.map||(this.map=t,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 e=this.map.painter.context,n=e.gl;this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,Tt.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE),n.texSubImage2D(n.TEXTURE_2D,0,0,0,n.RGBA,n.UNSIGNED_BYTE,this.video)):(this.texture=new t.Texture(e,this.video,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));for(const t in this.tiles){const e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture)}}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:Ct,canvas:class extends Ct{constructor(e,n,i,r){super(e,n,i,r),n.coordinates?Array.isArray(n.coordinates)&&4===n.coordinates.length&&!n.coordinates.some((t=>!Array.isArray(t)||2!==t.length||t.some((t=>"number"!=typeof t))))||this.fire(new t.ErrorEvent(new t.ValidationError(`sources.${e}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new t.ErrorEvent(new t.ValidationError(`sources.${e}`,null,'missing required property "coordinates"'))),n.animate&&"boolean"!=typeof n.animate&&this.fire(new t.ErrorEvent(new t.ValidationError(`sources.${e}`,null,'optional "animate" property must be a boolean value'))),n.canvas?"string"==typeof n.canvas||n.canvas instanceof t.window.HTMLCanvasElement||this.fire(new t.ErrorEvent(new t.ValidationError(`sources.${e}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new t.ErrorEvent(new t.ValidationError(`sources.${e}`,null,'missing required property "canvas"'))),this.options=n,this.animate=void 0===n.animate||n.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof t.window.HTMLCanvasElement?this.options.canvas:t.window.document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new t.ErrorEvent(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),this._hasInvalidDimensions())return;if(0===Object.keys(this.tiles).length)return;const n=this.map.painter.context,i=n.gl;this.boundsBuffer||(this.boundsBuffer=n.createVertexBuffer(this._boundsArray,Tt.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new t.Texture(n,this.canvas,i.RGBA,{premultiply:!0});for(const t in this.tiles){const e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture)}}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const t of[this.canvas.width,this.canvas.height])if(isNaN(t)||t<=0)return!0;return!1}}},St=function(e,n,i,r){const o=new Et[n.type](e,n,i,r);if(o.id!==e)throw new Error(`Expected Source id to be ${e} instead of ${o.id}`);return t.bindAll(["load","abort","unload","serialize","prepare"],o),o};function At(e,n){const i=t.identity([]);return t.scale$1(i,i,[.5*e.width,.5*-e.height,1]),t.translate(i,i,[1,-1,0]),t.multiply(i,i,e.calculateProjMatrix(n.toUnwrapped()))}function kt(t,e,n,i,r,o,a,s=!1){const l=t.tilesIn(i,a,s);l.sort(Mt);const c=[];for(const i of l)c.push({wrappedTileID:i.tile.tileID.wrapped().key,queryResults:i.tile.queryRenderedFeatures(e,n,t._state,i,r,o,At(t.transform,i.tile.tileID),s)});const u=function(t){const e={},n={};for(const i of t){const t=i.queryResults,r=i.wrappedTileID,o=n[r]=n[r]||{};for(const n in t){const i=t[n],r=o[n]=o[n]||{},a=e[n]=e[n]||[];for(const t of i)r[t.featureIndex]||(r[t.featureIndex]=!0,a.push(t))}}return e}(c);for(const e in u)u[e].forEach((e=>{const n=e.feature,i=t.getFeatureState(n.layer["source-layer"],n.id);n.source=n.layer.source,n.layer["source-layer"]&&(n.sourceLayer=n.layer["source-layer"]),n.state=i}));return u}function It(t,e){const n=t.getRenderableIds().map((e=>t.getTileByID(e))),i=[],r={};for(let t=0;t{t.terminate()})),this.workers=null)}isPreloaded(){return!!this.active[Dt]}numActive(){return Object.keys(this.active).length}}let Ot;function Rt(){return Ot||(Ot=new zt),Ot}function Lt(e,n){const i={};for(const t in e)"ref"!==t&&(i[t]=e[t]);return t.refProperties.forEach((t=>{t in n&&(i[t]=n[t])})),i}function Ft(t){t=t.slice();const e=Object.create(null);for(let n=0;n0?(r-a)/s:0;return this.points[o].mult(1-l).add(this.points[n].mult(l))}}class Ht{constructor(t,e,n){const i=this.boxCells=[],r=this.circleCells=[];this.xCellCount=Math.ceil(t/n),this.yCellCount=Math.ceil(e/n);for(let t=0;tthis.width||i<0||e>this.height)return!r&&[];const a=[];if(t<=0&&e<=0&&this.width<=n&&this.height<=i){if(r)return!0;for(let t=0;t0:a}_queryCircle(t,e,n,i,r){const o=t-n,a=t+n,s=e-n,l=e+n;if(a<0||o>this.width||l<0||s>this.height)return!i&&[];const c=[];return this._forEachCell(o,s,a,l,this._queryCellCircle,c,{hitTest:i,circle:{x:t,y:e,radius:n},seenUids:{box:{},circle:{}}},r),i?c.length>0:c}query(t,e,n,i,r){return this._query(t,e,n,i,!1,r)}hitTest(t,e,n,i,r){return this._query(t,e,n,i,!0,r)}hitTestCircle(t,e,n,i){return this._queryCircle(t,e,n,!0,i)}_queryCell(t,e,n,i,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(t<=r[c+2]&&e<=r[c+3]&&n>=r[c+0]&&i>=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],t,e,n,i)&&(!s||s(this.circleKeys[c]))){if(a.hitTest)return o.push(!0),!0;{const t=r[u],e=r[u+1],n=r[u+2];o.push({key:this.circleKeys[c],x1:t-n,y1:e-n,x2:t+n,y2:e+n})}}}}}_queryCellCircle(t,e,n,i,r,o,a,s){const l=a.circle,c=a.seenUids,u=this.boxCells[r];if(null!==u){const t=this.bboxes;for(const e of u)if(!c.box[e]){c.box[e]=!0;const n=4*e;if(this._circleAndRectCollide(l.x,l.y,l.radius,t[n+0],t[n+1],t[n+2],t[n+3])&&(!s||s(this.boxKeys[e])))return o.push(!0),!0}}const h=this.circleCells[r];if(null!==h){const t=this.circles;for(const e of h)if(!c.circle[e]){c.circle[e]=!0;const n=3*e;if(this._circlesCollide(t[n],t[n+1],t[n+2],l.x,l.y,l.radius)&&(!s||s(this.circleKeys[e])))return o.push(!0),!0}}}_forEachCell(t,e,n,i,r,o,a,s){const l=this._convertToXCellCoord(t),c=this._convertToYCellCoord(e),u=this._convertToXCellCoord(n),h=this._convertToYCellCoord(i);for(let d=l;d<=u;d++)for(let l=c;l<=h;l++)if(r.call(this,t,e,n,i,this.xCellCount*l+d,o,a,s))return}_convertToXCellCoord(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))}_convertToYCellCoord(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))}_circlesCollide(t,e,n,i,r,o){const a=i-t,s=r-e,l=n+o;return l*l>a*a+s*s}_circleAndRectCollide(t,e,n,i,r,o,a){const s=(o-i)/2,l=Math.abs(t-(i+s));if(l>s+n)return!1;const c=(a-r)/2,u=Math.abs(e-(r+c));if(u>c+n)return!1;if(l<=s||u<=c)return!0;const h=l-s,d=u-c;return h*h+d*d<=n*n}}const Wt=Math.tan(85*Math.PI/180);function Xt(e,n,i,r,o){const a=t.create$1();return n?(t.scale$1(a,a,[1/o,1/o,1]),i||t.rotateZ(a,a,r.angle)):t.multiply(a,r.labelPlaneMatrix,e),a}function Kt(e,n,i,r,o){if(n){const n=t.clone$1(e);return t.scale$1(n,n,[o,o,1]),i||t.rotateZ(n,n,-r.angle),n}return r.glCoordMatrix}function Yt(e,n,i=0){const r=[e.x,e.y,i,1];i?t.transformMat4(r,r,n):le(r,r,n);const o=r[3];return{point:new t.pointGeometry(r[0]/o,r[1]/o),signedDistanceFromCamera:o}}function Jt(t,e){return Math.min(.5+t/e*.5,1.5)}function Qt(t,e){const n=t[0]/t[3],i=t[1]/t[3];return n>=-e[0]&&n<=e[0]&&i>=-e[1]&&i<=e[1]}function te(e,n,i,r,o,a,s,l,c){const u=r?e.textSizeData:e.iconSizeData,h=t.evaluateSizeForZoom(u,i.transform.zoom),d=[256/i.width*2+1,256/i.height*2+1],p=r?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;p.clear();const f=e.lineVertexArray,m=r?e.text.placedSymbolArray:e.icon.placedSymbolArray,g=i.transform.width/i.transform.height;let _=!1;for(let r=0;rMath.abs(i.x-n.x)*r?{useVertical:!0}:e.writingMode===t.WritingMode.vertical?n.yWt}(n,i,r)?1===e.flipState?{needsFlipping:!0}:null:n.x>i.x?{needsFlipping:!0}:null}function ie(e,n,i,r,o,a,s,l,c,u,h,d,p,f,m){const g=n/24,_=e.lineOffsetX*g,v=e.lineOffsetY*g;let y;if(e.numGlyphs>1){const t=e.glyphStartIndex+e.numGlyphs,n=e.lineStartIndex,o=e.lineStartIndex+e.lineLength,u=ee(g,l,_,v,i,h,d,e,c,a,p,m);if(!u)return{notEnoughRoom:!0};const x=Yt(u.first.point,s).point,b=Yt(u.last.point,s).point;if(r&&!i){const t=ne(e,x,b,f);if(e.flipState=t&&t.needsFlipping?1:2,t)return t}y=[u.first];for(let r=e.glyphStartIndex+1;r0?a.point:re(d,r,n,1,o),f);if(e.flipState=s&&s.needsFlipping?1:2,s)return s}const n=oe(g*l.getoffsetX(e.glyphStartIndex),_,v,i,h,d,e.segment,e.lineStartIndex,e.lineStartIndex+e.lineLength,c,a,p,m);if(!n)return{notEnoughRoom:!0};y=[n]}for(const e of y)t.addDynamicAttributes(u,e.point,e.angle);return{}}function re(t,e,n,i,r,o){const a=t.add(t.sub(e)._unit()),s=Yt(a,r,o?o(a):0).point,l=n.sub(s);return n.add(l._mult(i/l.mag()))}function oe(e,n,i,r,o,a,s,l,c,u,h,d,p,f,m){const g=r?e-n:e+n;let _=g>0?1:-1,v=0;r&&(_*=-1,v=Math.PI),_<0&&(v+=Math.PI);let y=_>0?l+s:l+s+1,x=o,b=o,w=0,T=0;const C=Math.abs(g),E=[],S=[];let A=a;const k=()=>{const e=y-_;return 0===w?a:new t.pointGeometry(u.getx(e),u.gety(e))},I=()=>re(k(),A,b,C-w+1,h,p);for(;w+T<=C;){if(y+=_,y=c)return null;if(b=x,E.push(x),f&&S.push(A||k()),x=d[y],void 0===x){A=new t.pointGeometry(u.getx(y),u.gety(y));const e=Yt(A,h,p?p(A):0);x=e.signedDistanceFromCamera>0?d[y]=e.point:I()}else A=null;w+=T,T=b.dist(x)}m&&p&&(A=A||new t.pointGeometry(u.getx(y),u.gety(y)),d[y]=x=void 0===d[y]?x:I(),T=b.dist(x));const M=(C-w)/T,P=x.sub(b),D=P.mult(M)._add(b);i&&D._add(P._unit()._perp()._mult(i*_));const z=v+Math.atan2(x.y-b.y,x.x-b.x);return E.push(D),f&&(A=A||new t.pointGeometry(u.getx(y),u.gety(y)),S.push(function(e,n,i){const r=1-i;return new t.pointGeometry(e.x*r+n.x*i,e.y*r+n.y*i)}(S.length>0?S[S.length-1]:A,A,M))),{point:D,angle:z,path:E,tilePath:S}}const ae=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function se(t,e){for(let n=0;ng.getAtTileOffset(f,t.x,t.y):t=>0,v=new t.pointGeometry(n.anchorX,n.anchorY),y=_(v),x=this.projectAndGetPerspectiveRatio(a,v.x,v.y,y,f),{perspectiveRatio:b}=x,w=(u?o/b:o*b)/t.ONE_EM,T=Yt(v,s,y).point,C=x.signedDistanceFromCamera>0?ee(w,r,n.lineOffsetX*w,n.lineOffsetY*w,!1,T,v,n,i,s,{},g&&!u?_:null,u&&!!g):null;let E=!1,S=!1,A=!0;if(C&&!x.aboveHorizon){const n=.5*d*b+p,i=new t.pointGeometry(-100,-100),r=new t.pointGeometry(this.screenRightBoundary,this.screenBottomBoundary),o=new Zt,a=C.first,s=C.last;let u=[];for(let t=a.path.length-1;t>=1;t--)u.push(a.path[t]);for(let t=1;t{const n=_(eYt(t,l));u=t.some((t=>t.signedDistanceFromCamera<=0))?[]:t.map((t=>t.point))}let v=[];if(u.length>0){const e=u[0].clone(),n=u[0].clone();for(let t=1;t=i.x&&n.x<=r.x&&e.y>=i.y&&n.y<=r.y?[u]:n.xr.x||n.yr.y?[]:t.clipLine([u],i.x,i.y,r.x,r.y)}for(const t of v){o.reset(t,.25*n);let i=0;i=o.length<=.5*n?1:Math.ceil(o.paddedLength/f)+1;for(let t=0;t0){t.transformMat4(a,a,e);let l=!1;this.fogState&&o&&(l=function(e,n,i,r,o,a){const s=a.calculateFogTileMatrix(o),l=[n,i,r];return t.transformMat4$1(l,l,s),T(e,l,a.pitch,a._fov)}(this.fogState,n,i,r||0,o.toUnwrapped(),this.transform)>.9),s=a[2]>a[3]||l}else le(a,a,e);return{point:new t.pointGeometry((a[0]/a[3]+1)/2*this.transform.width+ce,(-a[1]/a[3]+1)/2*this.transform.height+ce),perspectiveRatio:Math.min(.5+this.transform.cameraToCenterDistance/a[3]*.5,1.5),signedDistanceFromCamera:a[3],aboveHorizon:s}}isOffscreen(t,e,n,i){return n=this.screenRightBoundary||ithis.screenBottomBoundary}isInsideGrid(t,e,n,i){return n>=0&&t=0&&et.collisionGroupID===e}}return this.collisionGroups[t]}}function _e(e,n,i,r,o){const{horizontalAlign:a,verticalAlign:s}=t.getAnchorAlignment(e),l=-(a-.5)*n,c=-(s-.5)*i,u=t.evaluateVariableOffset(e,r);return new t.pointGeometry(l+u[0]*o,c+u[1]*o)}function ve(e,n,i,r,o){const a=new t.pointGeometry(e,n);return i&&a._rotate(r?o:-o),a}class ye{constructor(t,e,n,i,r){this.transform=t.clone(),this.collisionIndex=new ue(this.transform,r),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=e,this.retainedQueryData={},this.collisionGroups=new ge(n),this.collisionCircleArrays={},this.prevPlacement=i,i&&(i.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(e,n,i,r){const o=i.getBucket(n),a=i.latestFeatureIndex;if(!o||!a||n.id!==o.layerIds[0])return;const s=i.collisionBoxArray,l=o.layers[0].layout,c=Math.pow(2,this.transform.zoom-i.tileID.overscaledZ),u=i.tileSize/t.EXTENT,h=this.transform.calculateProjMatrix(i.tileID.toUnwrapped()),d="map"===l.get("text-pitch-alignment"),p="map"===l.get("text-rotation-alignment"),f=I(i,1,this.transform.zoom),m=Xt(h,d,p,this.transform,f);let g=null;if(d){const e=Kt(h,d,p,this.transform,f);g=t.multiply([],this.transform.labelPlaneMatrix,e)}this.retainedQueryData[o.bucketInstanceId]=new me(o.bucketInstanceId,a,o.sourceLayerIndex,o.index,i.tileID);const _={bucket:o,layout:l,posMatrix:h,textLabelPlaneMatrix:m,labelToScreenMatrix:g,scale:c,textPixelRatio:u,holdingForFade:i.holdingForFade(),collisionBoxArray:s,partiallyEvaluatedTextSize:t.evaluateSizeForZoom(o.textSizeData,this.transform.zoom),partiallyEvaluatedIconSize:t.evaluateSizeForZoom(o.iconSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(o.sourceID)};if(r)for(const t of o.sortKeyRanges){const{sortKey:n,symbolInstanceStart:i,symbolInstanceEnd:r}=t;e.push({sortKey:n,symbolInstanceStart:i,symbolInstanceEnd:r,parameters:_})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:o.symbolInstances.length,parameters:_})}attemptAnchorPlacement(t,e,n,i,r,o,a,s,l,c,u,h,d,p,f,m,g,_){const v=[h.textOffset0,h.textOffset1],y=_e(t,n,i,v,r),x=this.collisionIndex.placeCollisionBox(r,e,ve(y.x,y.y,o,a,this.transform.angle),u,s,l,c.predicate);if((!m||0!==this.collisionIndex.placeCollisionBox(p.getSymbolInstanceIconSize(_,this.transform.zoom,d),m,ve(y.x,y.y,o,a,this.transform.angle),u,s,l,c.predicate).box.length)&&x.box.length>0){let e;return this.prevPlacement&&this.prevPlacement.variableOffsets[h.crossTileID]&&this.prevPlacement.placements[h.crossTileID]&&this.prevPlacement.placements[h.crossTileID].text&&(e=this.prevPlacement.variableOffsets[h.crossTileID].anchor),this.variableOffsets[h.crossTileID]={textOffset:v,width:n,height:i,anchor:t,textScale:r,prevAnchor:e},this.markUsedJustification(p,t,h,f),p.allowVerticalPlacement&&(this.markUsedOrientation(p,f,h),this.placedOrientations[h.crossTileID]=f),{shift:y,placedGlyphBoxes:x}}}placeLayerBucketPart(e,n,i){const{bucket:r,layout:o,posMatrix:a,textLabelPlaneMatrix:s,labelToScreenMatrix:l,textPixelRatio:c,holdingForFade:u,collisionBoxArray:h,partiallyEvaluatedTextSize:d,partiallyEvaluatedIconSize:p,collisionGroup:f}=e.parameters,m=o.get("text-optional"),g=o.get("icon-optional"),_=o.get("text-allow-overlap"),v=o.get("icon-allow-overlap"),y="map"===o.get("text-rotation-alignment"),x="map"===o.get("text-pitch-alignment"),b="none"!==o.get("icon-text-fit"),w="viewport-y"===o.get("symbol-z-order"),T=_&&(v||!r.hasIconData()||g),C=v&&(_||!r.hasTextData()||m);!r.collisionArrays&&h&&r.deserializeCollisionBoxes(h),i&&r.updateCollisionDebugBuffers(this.transform.zoom,h);const E=(e,h,w)=>{if(n[e.crossTileID])return;if(u)return void(this.placements[e.crossTileID]=new pe(!1,!1,!1));let E=!1,S=!1,A=!0,k=null,I={box:null,offscreen:null},M={box:null,offscreen:null},P=null,D=null,z=null,O=0,R=0,L=0;w.textFeatureIndex?O=w.textFeatureIndex:e.useRuntimeCollisionCircles&&(O=e.featureIndex),w.verticalTextFeatureIndex&&(R=w.verticalTextFeatureIndex);const F=t=>{t.tileID=this.retainedQueryData[r.bucketInstanceId].tileID,(this.transform.elevation||t.elevation)&&(t.elevation=this.transform.elevation?this.transform.elevation.getAtTileOffset(this.retainedQueryData[r.bucketInstanceId].tileID,t.anchorPointX,t.anchorPointY):0)},$=w.textBox;if($){F($);const n=n=>{let i=t.WritingMode.horizontal;if(r.allowVerticalPlacement&&!n&&this.prevPlacement){const t=this.prevPlacement.placedOrientations[e.crossTileID];t&&(this.placedOrientations[e.crossTileID]=t,i=t,this.markUsedOrientation(r,i,e))}return i},i=(n,i)=>{if(r.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&w.verticalTextBox){for(const e of r.writingModes)if(e===t.WritingMode.vertical?(I=i(),M=I):I=n(),I&&I.box&&I.box.length)break}else I=n()};if(o.get("text-variable-anchor")){let s=o.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[e.crossTileID]){const t=this.prevPlacement.variableOffsets[e.crossTileID];s.indexOf(t.anchor)>0&&(s=s.filter((e=>e!==t.anchor)),s.unshift(t.anchor))}const l=(t,n,i)=>{const o=r.getSymbolInstanceTextSize(d,e,this.transform.zoom,h),l=(t.x2-t.x1)*o+2*t.padding,u=(t.y2-t.y1)*o+2*t.padding,m=b&&!v?n:null;m&&F(m);let g={box:[],offscreen:!1};const w=_?2*s.length:s.length;for(let n=0;n=s.length,e,h,r,i,m,d,p);if(_&&(g=_.placedGlyphBoxes,g&&g.box&&g.box.length)){E=!0,k=_.shift;break}}return g};i((()=>l($,w.iconBox,t.WritingMode.horizontal)),(()=>{const n=w.verticalTextBox;return n&&F(n),r.allowVerticalPlacement&&!(I&&I.box&&I.box.length)&&e.numVerticalGlyphVertices>0&&n?l(n,w.verticalIconBox,t.WritingMode.vertical):{box:null,offscreen:null}})),I&&(E=I.box,A=I.offscreen);const u=n(I&&I.box);if(!E&&this.prevPlacement){const t=this.prevPlacement.variableOffsets[e.crossTileID];t&&(this.variableOffsets[e.crossTileID]=t,this.markUsedJustification(r,t.anchor,e,u))}}else{const o=(n,i)=>{const o=r.getSymbolInstanceTextSize(d,e,this.transform.zoom,h),s=this.collisionIndex.placeCollisionBox(o,n,new t.pointGeometry(0,0),_,c,a,f.predicate);return s&&s.box&&s.box.length&&(this.markUsedOrientation(r,i,e),this.placedOrientations[e.crossTileID]=i),s};i((()=>o($,t.WritingMode.horizontal)),(()=>{const n=w.verticalTextBox;return r.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&n?(F(n),o(n,t.WritingMode.vertical)):{box:null,offscreen:null}})),n(I&&I.box&&I.box.length)}}if(P=I,E=P&&P.box&&P.box.length>0,A=P&&P.offscreen,e.useRuntimeCollisionCircles){const n=r.text.placedSymbolArray.get(e.centerJustifiedTextSymbolIndex>=0?e.centerJustifiedTextSymbolIndex:e.verticalPlacedTextSymbolIndex),c=t.evaluateSizeForFeature(r.textSizeData,d,n),u=o.get("text-padding");D=this.collisionIndex.placeCollisionCircles(_,n,r.lineVertexArray,r.glyphOffsetArray,c,a,s,l,i,x,f.predicate,e.collisionCircleDiameter,u,this.retainedQueryData[r.bucketInstanceId].tileID),E=_||D.circles.length>0&&!D.collisionDetected,A=A&&D.offscreen}if(w.iconFeatureIndex&&(L=w.iconFeatureIndex),w.iconBox){const e=e=>{F(e);const n=b&&k?ve(k.x,k.y,y,x,this.transform.angle):new t.pointGeometry(0,0),i=r.getSymbolInstanceIconSize(p,this.transform.zoom,h);return this.collisionIndex.placeCollisionBox(i,e,n,v,c,a,f.predicate)};M&&M.box&&M.box.length&&w.verticalIconBox?(z=e(w.verticalIconBox),S=z.box.length>0):(z=e(w.iconBox),S=z.box.length>0),A=A&&z.offscreen}const B=m||0===e.numHorizontalGlyphVertices&&0===e.numVerticalGlyphVertices,N=g||0===e.numIconVertices;if(B||N?N?B||(S=S&&E):E=S&&E:S=E=S&&E,E&&P&&P.box&&this.collisionIndex.insertCollisionBox(P.box,o.get("text-ignore-placement"),r.bucketInstanceId,M&&M.box&&R?R:O,f.ID),S&&z&&this.collisionIndex.insertCollisionBox(z.box,o.get("icon-ignore-placement"),r.bucketInstanceId,L,f.ID),D&&(E&&this.collisionIndex.insertCollisionCircles(D.circles,o.get("text-ignore-placement"),r.bucketInstanceId,O,f.ID),i)){const t=r.bucketInstanceId;let e=this.collisionCircleArrays[t];void 0===e&&(e=this.collisionCircleArrays[t]=new fe);for(let t=0;t=0;--e){const n=t[e];E(r.symbolInstances.get(n),n,r.collisionArrays[n])}}else for(let t=e.symbolInstanceStart;t=0&&(e.text.placedSymbolArray.get(t).crossTileID=o>=0&&t!==o?0:i.crossTileID)}markUsedOrientation(e,n,i){const r=n===t.WritingMode.horizontal||n===t.WritingMode.horizontalOnly?n:0,o=n===t.WritingMode.vertical?n:0,a=[i.leftJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.rightJustifiedTextSymbolIndex];for(const t of a)e.text.placedSymbolArray.get(t).placedOrientation=r;i.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(i.verticalPlacedTextSymbolIndex).placedOrientation=o)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const e=this.prevPlacement;let n=!1;this.prevZoomAdjustment=e?e.zoomAdjustment(this.transform.zoom):0;const i=e?e.symbolFadeChange(t):1,r=e?e.opacities:{},o=e?e.variableOffsets:{},a=e?e.placedOrientations:{};for(const t in this.placements){const e=this.placements[t],o=r[t];o?(this.opacities[t]=new de(o,i,e.text,e.icon),n=n||e.text!==o.text.placed||e.icon!==o.icon.placed):(this.opacities[t]=new de(null,i,e.text,e.icon,e.skipFade),n=n||e.text||e.icon)}for(const t in r){const e=r[t];if(!this.opacities[t]){const r=new de(e,i,!1,!1);r.isHidden()||(this.opacities[t]=r,n=n||e.text.placed||e.icon.placed)}}for(const t in o)this.variableOffsets[t]||!this.opacities[t]||this.opacities[t].isHidden()||(this.variableOffsets[t]=o[t]);for(const t in a)this.placedOrientations[t]||!this.opacities[t]||this.opacities[t].isHidden()||(this.placedOrientations[t]=a[t]);n?this.lastPlacementChangeTime=t:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=e?e.lastPlacementChangeTime:t)}updateLayerOpacities(t,e){const n={};for(const i of e){const e=i.getBucket(t);e&&i.latestFeatureIndex&&t.id===e.layerIds[0]&&this.updateBucketOpacities(e,n,i.collisionBoxArray)}}updateBucketOpacities(e,n,i){e.hasTextData()&&e.text.opacityVertexArray.clear(),e.hasIconData()&&e.icon.opacityVertexArray.clear(),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();const r=e.layers[0].layout,o=new de(null,0,!1,!1,!0),a=r.get("text-allow-overlap"),s=r.get("icon-allow-overlap"),l=r.get("text-variable-anchor"),c="map"===r.get("text-rotation-alignment"),u="map"===r.get("text-pitch-alignment"),h="none"!==r.get("icon-text-fit"),d=new de(null,0,a&&(s||!e.hasIconData()||r.get("icon-optional")),s&&(a||!e.hasTextData()||r.get("text-optional")),!0);!e.collisionArrays&&i&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(i);const p=(t,e,n)=>{for(let i=0;i0,_=this.placedOrientations[r.crossTileID],v=_===t.WritingMode.vertical,y=_===t.WritingMode.horizontal||_===t.WritingMode.horizontalOnly;if(a>0||s>0){const t=ke(m.text);p(e.text,a,v?Ie:t),p(e.text,s,y?Ie:t);const n=m.text.isHidden();[r.rightJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.leftJustifiedTextSymbolIndex].forEach((t=>{t>=0&&(e.text.placedSymbolArray.get(t).hidden=n||v?1:0)})),r.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(r.verticalPlacedTextSymbolIndex).hidden=n||y?1:0);const i=this.variableOffsets[r.crossTileID];i&&this.markUsedJustification(e,i.anchor,r,_);const o=this.placedOrientations[r.crossTileID];o&&(this.markUsedJustification(e,"left",r,o),this.markUsedOrientation(e,o,r))}if(g){const t=ke(m.icon);r.placedIconSymbolIndex>=0&&(p(e.icon,r.numIconVertices,v?Ie:t),e.icon.placedSymbolArray.get(r.placedIconSymbolIndex).hidden=m.icon.isHidden()),r.verticalPlacedIconSymbolIndex>=0&&(p(e.icon,r.numVerticalIconVertices,y?Ie:t),e.icon.placedSymbolArray.get(r.verticalPlacedIconSymbolIndex).hidden=m.icon.isHidden())}if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){const n=e.collisionArrays[i];if(n){let i=new t.pointGeometry(0,0);if(n.textBox||n.verticalTextBox){let t=!0;if(l){const e=this.variableOffsets[f];e?(i=_e(e.anchor,e.width,e.height,e.textOffset,e.textScale),c&&i._rotate(u?this.transform.angle:-this.transform.angle)):t=!1}n.textBox&&xe(e.textCollisionBox.collisionVertexArray,m.text.placed,!t||v,i.x,i.y),n.verticalTextBox&&xe(e.textCollisionBox.collisionVertexArray,m.text.placed,!t||y,i.x,i.y)}const r=Boolean(!y&&n.verticalIconBox);n.iconBox&&xe(e.iconCollisionBox.collisionVertexArray,m.icon.placed,r,h?i.x:0,h?i.y:0),n.verticalIconBox&&xe(e.iconCollisionBox.collisionVertexArray,m.icon.placed,!r,h?i.x:0,h?i.y:0)}}}if(e.sortFeatures(this.transform.angle),this.retainedQueryData[e.bucketInstanceId]&&(this.retainedQueryData[e.bucketInstanceId].featureSortOrder=e.featureSortOrder),e.hasTextData()&&e.text.opacityVertexBuffer&&e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray),e.hasIconData()&&e.icon.opacityVertexBuffer&&e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexBuffer&&e.iconCollisionBox.collisionVertexBuffer.updateData(e.iconCollisionBox.collisionVertexArray),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexBuffer&&e.textCollisionBox.collisionVertexBuffer.updateData(e.textCollisionBox.collisionVertexArray),e.bucketInstanceId in this.collisionCircleArrays){const t=this.collisionCircleArrays[e.bucketInstanceId];e.placementInvProjMatrix=t.invProjMatrix,e.placementViewportMatrix=t.viewportMatrix,e.collisionCircleArray=t.circles,delete this.collisionCircleArrays[e.bucketInstanceId]}}symbolFadeChange(t){return 0===this.fadeDuration?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(t){return Math.max(0,(this.transform.zoom-t)/1.5)}hasTransitions(t){return this.stale||t-this.lastPlacementChangeTimet}setStale(){this.stale=!0}}function xe(t,e,n,i,r){t.emplaceBack(e?1:0,n?1:0,i||0,r||0),t.emplaceBack(e?1:0,n?1:0,i||0,r||0),t.emplaceBack(e?1:0,n?1:0,i||0,r||0),t.emplaceBack(e?1:0,n?1:0,i||0,r||0)}const be=Math.pow(2,25),we=Math.pow(2,24),Te=Math.pow(2,17),Ce=Math.pow(2,16),Ee=Math.pow(2,9),Se=Math.pow(2,8),Ae=Math.pow(2,1);function ke(t){if(0===t.opacity&&!t.placed)return 0;if(1===t.opacity&&t.placed)return 4294967295;const e=t.placed?1:0,n=Math.floor(127*t.opacity);return n*be+e*we+n*Te+e*Ce+n*Ee+e*Se+n*Ae+e}const Ie=0;class Me{constructor(t){this._sortAcrossTiles="viewport-y"!==t.layout.get("symbol-z-order")&&void 0!==t.layout.get("symbol-sort-key").constantOr(1),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(t,e,n,i,r){const o=this._bucketParts;for(;this._currentTileIndext.sortKey-e.sortKey)));this._currentPartIndex{const e=t.exported.now()-r;return!this._forceFullPlacement&&e>2};for(;this._currentPlacementIndex>=0;){const t=n[e[this._currentPlacementIndex]],r=this.placement.collisionIndex.transform.zoom;if("symbol"===t.type&&(!t.minzoom||t.minzoom<=r)&&(!t.maxzoom||t.maxzoom>r)){if(this._inProgressLayer||(this._inProgressLayer=new Me(t)),this._inProgressLayer.continuePlacement(i[t.source],this.placement,this._showCollisionBoxes,t,o))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const De=512/t.EXTENT/2;class ze{constructor(t,e,n){this.tileID=t,this.indexedSymbolInstances={},this.bucketInstanceId=n;for(let n=0;nt.overscaledZ)for(const n in r){const o=r[n];o.tileID.isChildOf(t)&&o.findMatches(e.symbolInstances,t,i)}else{const o=r[t.scaledTo(Number(n)).key];o&&o.findMatches(e.symbolInstances,t,i)}}for(let t=0;t{e[t]=!0}));for(const t in this.layerIndexes)e[t]||delete this.layerIndexes[t]}}const Fe=(e,n)=>t.emitValidationErrors(e,n&&n.filter((t=>"source.canvas"!==t.identifier))),$e=t.pick($t,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setTerrain","setFog"]),Be=t.pick($t,["setCenter","setZoom","setBearing","setPitch"]),Ne=function(){const e={},n=t.spec.$version;for(const i in t.spec.$root){const r=t.spec.$root[i];if(r.required){let t=null;t="version"===i?n:"array"===r.type?[]:{},null!=t&&(e[i]=t)}}return e}(),je={fill:!0,line:!0,background:!0,hillshade:!0,raster:!0};class Ue extends t.Evented{constructor(e,n={}){super(),this.map=e,this.dispatcher=new k(Rt(),this),this.imageManager=new g,this.imageManager.setEventedParent(this),this.glyphManager=new t.GlyphManager(e._requestManager,n.localFontFamily?t.LocalGlyphMode.all:n.localIdeographFontFamily?t.LocalGlyphMode.ideographs:t.LocalGlyphMode.none,n.localFontFamily||n.localIdeographFontFamily),this.lineAtlas=new t.LineAtlas(256,512),this.crossTileSymbolIndex=new Le,this._layers={},this._num3DLayers=0,this._numSymbolLayers=0,this._numCircleLayers=0,this._serializedLayers={},this._sourceCaches={},this._otherSourceCaches={},this._symbolSourceCaches={},this.zoomHistory=new t.ZoomHistory,this._loaded=!1,this._availableImages=[],this._order=[],this._drapedFirstOrder=[],this._markersNeedUpdate=!1,this._resetUpdates(),this.dispatcher.broadcast("setReferrer",t.getReferrer());const i=this;this._rtlTextPluginCallback=Ue.registerForPluginStateChange((e=>{i.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:e.pluginStatus,pluginURL:e.pluginURL},((e,n)=>{if(t.triggerPluginCompletionEvent(e),n&&n.every((t=>t)))for(const t in i._sourceCaches){const e=i._sourceCaches[t],n=e.getSource().type;"vector"!==n&&"geojson"!==n||e.reload()}}))})),this.on("data",(t=>{if("source"!==t.dataType||"metadata"!==t.sourceDataType)return;const e=this.getSource(t.sourceId);if(e&&e.vectorLayerIds)for(const t in this._layers){const n=this._layers[t];n.source===e.id&&this._validateLayer(n)}}))}loadURL(e,n={}){this.fire(new t.Event("dataloading",{dataType:"style"}));const i="boolean"==typeof n.validate?n.validate:!t.isMapboxURL(e);e=this.map._requestManager.normalizeStyleURL(e,n.accessToken);const r=this.map._requestManager.transformRequest(e,t.ResourceType.Style);this._request=t.getJSON(r,((e,n)=>{this._request=null,e?this.fire(new t.ErrorEvent(e)):n&&this._load(n,i)}))}loadJSON(e,n={}){this.fire(new t.Event("dataloading",{dataType:"style"})),this._request=t.exported.frame((()=>{this._request=null,this._load(e,!1!==n.validate)}))}loadEmpty(){this.fire(new t.Event("dataloading",{dataType:"style"})),this._load(Ne,!1)}_updateLayerCount(t,e){const n=e?1:-1;t.is3D()&&(this._num3DLayers+=n),"circle"===t.type&&(this._numCircleLayers+=n),"symbol"===t.type&&(this._numSymbolLayers+=n)}_load(e,n){if(n&&Fe(this,t.validateStyle(e)))return;this._loaded=!0,this.stylesheet=e;for(const t in e.sources)this.addSource(t,e.sources[t],{validate:!1});this._changed=!1,e.sprite?this._loadSprite(e.sprite):(this.imageManager.setLoaded(!0),this.dispatcher.broadcast("spriteLoaded",!0)),this.glyphManager.setURL(e.glyphs);const i=Ft(this.stylesheet.layers);this._order=i.map((t=>t.id)),this._layers={},this._serializedLayers={};for(let e of i)e=t.createStyleLayer(e),e.setEventedParent(this,{layer:{id:e.id}}),this._layers[e.id]=e,this._serializedLayers[e.id]=e.serialize(),this._updateLayerCount(e,!0);this.dispatcher.broadcast("setLayers",this._serializeLayers(this._order)),this.light=new y(this.stylesheet.light),this.stylesheet.terrain&&this._createTerrain(this.stylesheet.terrain),this.stylesheet.fog&&this._createFog(this.stylesheet.fog),this._updateDrapeFirstLayers(),this.fire(new t.Event("data",{dataType:"style"})),this.fire(new t.Event("style.load"))}_loadSprite(e){this._spriteRequest=function(e,n,i){let r,o,a;const s=t.exported.devicePixelRatio>1?"@2x":"";let l=t.getJSON(n.transformRequest(n.normalizeSpriteURL(e,s,".json"),t.ResourceType.SpriteJSON),((t,e)=>{l=null,a||(a=t,r=e,u())})),c=t.getImage(n.transformRequest(n.normalizeSpriteURL(e,s,".png"),t.ResourceType.SpriteImage),((t,e)=>{c=null,a||(a=t,o=e,u())}));function u(){if(a)i(a);else if(r&&o){const e=t.exported.getImageData(o),n={};for(const i in r){const{width:o,height:a,x:s,y:l,sdf:c,pixelRatio:u,stretchX:h,stretchY:d,content:p}=r[i],f=new t.RGBAImage({width:o,height:a});t.RGBAImage.copy(e,f,{x:s,y:l},{x:0,y:0},{width:o,height:a}),n[i]={data:f,pixelRatio:u,sdf:c,stretchX:h,stretchY:d,content:p}}i(null,n)}}return{cancel(){l&&(l.cancel(),l=null),c&&(c.cancel(),c=null)}}}(e,this.map._requestManager,((e,n)=>{if(this._spriteRequest=null,e)this.fire(new t.ErrorEvent(e));else if(n)for(const t in n)this.imageManager.addImage(t,n[t]);this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),this.dispatcher.broadcast("setImages",this._availableImages),this.dispatcher.broadcast("spriteLoaded",!0),this.fire(new t.Event("data",{dataType:"style"}))}))}_validateLayer(e){const n=this.getSource(e.source);if(!n)return;const i=e.sourceLayer;i&&("geojson"===n.type||n.vectorLayerIds&&-1===n.vectorLayerIds.indexOf(i))&&this.fire(new t.ErrorEvent(new Error(`Source layer "${i}" does not exist on source "${n.id}" as specified by style layer "${e.id}"`)))}loaded(){if(!this._loaded)return!1;if(Object.keys(this._updatedSources).length)return!1;for(const t in this._sourceCaches)if(!this._sourceCaches[t].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeLayers(t){const e=[];for(const n of t){const t=this._layers[n];"custom"!==t.type&&e.push(t.serialize())}return e}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;if(this.fog&&this.fog.hasTransition())return!0;for(const t in this._sourceCaches)if(this._sourceCaches[t].hasTransition())return!0;for(const t in this._layers)if(this._layers[t].hasTransition())return!0;return!1}get order(){return this.map._optimizeForTerrain&&this.terrain?this._drapedFirstOrder:this._order}isLayerDraped(t){return!!this.terrain&&je[t.type]}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading")}update(e){if(!this._loaded)return;const n=this._changed;if(this._changed){const t=Object.keys(this._updatedLayers),n=Object.keys(this._removedLayers);(t.length||n.length)&&this._updateWorkerLayers(t,n);for(const t in this._updatedSources){const e=this._updatedSources[t];"reload"===e?this._reloadSource(t):"clear"===e&&this._clearSource(t)}this._updateTilesForChangedImages();for(const t in this._updatedPaintProps)this._layers[t].updateTransitions(e);this.light.updateTransitions(e),this.fog&&this.fog.updateTransitions(e),this._resetUpdates()}const i={};for(const t in this._sourceCaches){const e=this._sourceCaches[t];i[t]=e.used,e.used=!1}for(const t of this._order){const n=this._layers[t];if(n.recalculate(e,this._availableImages),!n.isHidden(e.zoom)){const t=this._getLayerSourceCache(n);t&&(t.used=!0)}const i=this.map.painter;if(i){const t=n.getProgramIds();if(!t)continue;const r=n.getProgramConfiguration(e.zoom);for(const e of t)i.useProgram(e,r)}}for(const e in i){const n=this._sourceCaches[e];i[e]!==n.used&&n.getSource().fire(new t.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:n.getSource().id}))}this.light.recalculate(e),this.terrain&&this.terrain.recalculate(e),this.fog&&this.fog.recalculate(e),this.z=e.zoom,this._markersNeedUpdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),n&&this.fire(new t.Event("data",{dataType:"style"}))}_updateTilesForChangedImages(){const t=Object.keys(this._changedImages);if(t.length){for(const e in this._sourceCaches)this._sourceCaches[e].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}}_updateWorkerLayers(t,e){this.dispatcher.broadcast("updateLayers",{layers:this._serializeLayers(t),removedIds:e})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={}}setState(e){if(this._checkLoaded(),Fe(this,t.validateStyle(e)))return!1;(e=t.clone$2(e)).layers=Ft(e.layers);const n=function(t,e){if(!t)return[{command:$t.setStyle,args:[e]}];let n=[];try{if(!r(t.version,e.version))return[{command:$t.setStyle,args:[e]}];r(t.center,e.center)||n.push({command:$t.setCenter,args:[e.center]}),r(t.zoom,e.zoom)||n.push({command:$t.setZoom,args:[e.zoom]}),r(t.bearing,e.bearing)||n.push({command:$t.setBearing,args:[e.bearing]}),r(t.pitch,e.pitch)||n.push({command:$t.setPitch,args:[e.pitch]}),r(t.sprite,e.sprite)||n.push({command:$t.setSprite,args:[e.sprite]}),r(t.glyphs,e.glyphs)||n.push({command:$t.setGlyphs,args:[e.glyphs]}),r(t.transition,e.transition)||n.push({command:$t.setTransition,args:[e.transition]}),r(t.light,e.light)||n.push({command:$t.setLight,args:[e.light]}),r(t.fog,e.fog)||n.push({command:$t.setFog,args:[e.fog]});const i={},o=[];!function(t,e,n,i){let o;for(o in e=e||{},t=t||{})t.hasOwnProperty(o)&&(e.hasOwnProperty(o)||Nt(o,n,i));for(o in e)e.hasOwnProperty(o)&&(t.hasOwnProperty(o)?r(t[o],e[o])||("geojson"===t[o].type&&"geojson"===e[o].type&&Ut(t,e,o)?n.push({command:$t.setGeoJSONSourceData,args:[o,e[o].data]}):jt(o,e,n,i)):Bt(o,e,n))}(t.sources,e.sources,o,i);const a=[];t.layers&&t.layers.forEach((t=>{i[t.source]?n.push({command:$t.removeLayer,args:[t.id]}):a.push(t)}));let s=t.terrain;s&&i[s.source]&&(n.push({command:$t.setTerrain,args:[void 0]}),s=void 0),n=n.concat(o),r(s,e.terrain)||n.push({command:$t.setTerrain,args:[e.terrain]}),function(t,e,n){e=e||[];const i=(t=t||[]).map(Gt),o=e.map(Gt),a=t.reduce(qt,{}),s=e.reduce(qt,{}),l=i.slice(),c=Object.create(null);let u,h,d,p,f,m,g;for(u=0,h=0;u!(t.command in Be)));if(0===n.length)return!1;const i=n.filter((t=>!(t.command in $e)));if(i.length>0)throw new Error(`Unimplemented: ${i.map((t=>t.command)).join(", ")}.`);return n.forEach((t=>{"setTransition"!==t.command&&this[t.command].apply(this,t.args)})),this.stylesheet=e,!0}addImage(e,n){if(this.getImage(e))return this.fire(new t.ErrorEvent(new Error("An image with this name already exists.")));this.imageManager.addImage(e,n),this._afterImageUpdated(e)}updateImage(t,e){this.imageManager.updateImage(t,e)}getImage(t){return this.imageManager.getImage(t)}removeImage(e){if(!this.getImage(e))return this.fire(new t.ErrorEvent(new Error("No image with this name exists.")));this.imageManager.removeImage(e),this._afterImageUpdated(e)}_afterImageUpdated(e){this._availableImages=this.imageManager.listImages(),this._changedImages[e]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new t.Event("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(e,n,i={}){if(this._checkLoaded(),void 0!==this.getSource(e))throw new Error("There is already a source with this ID");if(!n.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(n).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(n.type)>=0&&this._validate(t.validateStyle.source,`sources.${e}`,n,null,i))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);const r=St(e,n,this.dispatcher,this);r.setEventedParent(this,(()=>({isSourceLoaded:this.loaded(),source:r.serialize(),sourceId:e})));const o=n=>{const i=(n?"symbol:":"other:")+e,o=this._sourceCaches[i]=new t.SourceCache(i,r,n);(n?this._symbolSourceCaches:this._otherSourceCaches)[e]=o,o.style=this,o.onAdd(this.map)};o(!1),"vector"!==n.type&&"geojson"!==n.type||o(!0),r.onAdd&&r.onAdd(this.map),this._changed=!0}removeSource(e){this._checkLoaded();const n=this.getSource(e);if(void 0===n)throw new Error("There is no source with this ID");for(const n in this._layers)if(this._layers[n].source===e)return this.fire(new t.ErrorEvent(new Error(`Source "${e}" cannot be removed while layer "${n}" is using it.`)));if(this.terrain&&this.terrain.get().source===e)return this.fire(new t.ErrorEvent(new Error(`Source "${e}" cannot be removed while terrain is using it.`)));const i=this._getSourceCaches(e);for(const e of i)delete this._sourceCaches[e.id],delete this._updatedSources[e.id],e.fire(new t.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:e.getSource().id})),e.setEventedParent(null),e.clearTiles();delete this._otherSourceCaches[e],delete this._symbolSourceCaches[e],n.setEventedParent(null),n.onRemove&&n.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,e){this._checkLoaded(),this.getSource(t).setData(e),this._changed=!0}getSource(t){const e=this._getSourceCache(t);return e&&e.getSource()}addLayer(e,n,i={}){this._checkLoaded();const r=e.id;if(this.getLayer(r))return void this.fire(new t.ErrorEvent(new Error(`Layer with id "${r}" already exists on this map`)));let o;if("custom"===e.type){if(Fe(this,t.validateCustomStyleLayer(e)))return;o=t.createStyleLayer(e)}else{if("object"==typeof e.source&&(this.addSource(r,e.source),e=t.clone$2(e),e=t.extend(e,{source:r})),this._validate(t.validateStyle.layer,`layers.${r}`,e,{arrayIndex:-1},i))return;o=t.createStyleLayer(e),this._validateLayer(o),o.setEventedParent(this,{layer:{id:r}}),this._serializedLayers[o.id]=o.serialize(),this._updateLayerCount(o,!0)}const a=n?this._order.indexOf(n):this._order.length;if(n&&-1===a)return void this.fire(new t.ErrorEvent(new Error(`Layer with id "${n}" 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 t=this._removedLayers[r];delete this._removedLayers[r],t.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(e,n){if(this._checkLoaded(),this._changed=!0,!this._layers[e])return void this.fire(new t.ErrorEvent(new Error(`The layer '${e}' does not exist in the map's style and cannot be moved.`)));if(e===n)return;const i=this._order.indexOf(e);this._order.splice(i,1);const r=n?this._order.indexOf(n):this._order.length;n&&-1===r?this.fire(new t.ErrorEvent(new Error(`Layer with id "${n}" does not exist on this map.`))):(this._order.splice(r,0,e),this._layerOrderChanged=!0,this._updateDrapeFirstLayers())}removeLayer(e){this._checkLoaded();const n=this._layers[e];if(!n)return void this.fire(new t.ErrorEvent(new Error(`The layer '${e}' does not exist in the map's style and cannot be removed.`)));n.setEventedParent(null),this._updateLayerCount(n,!1);const i=this._order.indexOf(e);this._order.splice(i,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=n,delete this._layers[e],delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],n.onRemove&&n.onRemove(this.map),this._updateDrapeFirstLayers()}getLayer(t){return this._layers[t]}hasLayer(t){return t in this._layers}hasLayerType(t){for(const e in this._layers)if(this._layers[e].type===t)return!0;return!1}setLayerZoomRange(e,n,i){this._checkLoaded();const r=this.getLayer(e);r?r.minzoom===n&&r.maxzoom===i||(null!=n&&(r.minzoom=n),null!=i&&(r.maxzoom=i),this._updateLayer(r)):this.fire(new t.ErrorEvent(new Error(`The layer '${e}' does not exist in the map's style and cannot have zoom extent.`)))}setFilter(e,n,i={}){this._checkLoaded();const o=this.getLayer(e);if(o){if(!r(o.filter,n))return null==n?(o.filter=void 0,void this._updateLayer(o)):void(this._validate(t.validateStyle.filter,`layers.${o.id}.filter`,n,null,i)||(o.filter=t.clone$2(n),this._updateLayer(o)))}else this.fire(new t.ErrorEvent(new Error(`The layer '${e}' does not exist in the map's style and cannot be filtered.`)))}getFilter(e){return t.clone$2(this.getLayer(e).filter)}setLayoutProperty(e,n,i,o={}){this._checkLoaded();const a=this.getLayer(e);a?r(a.getLayoutProperty(n),i)||(a.setLayoutProperty(n,i,o),this._updateLayer(a)):this.fire(new t.ErrorEvent(new Error(`The layer '${e}' does not exist in the map's style and cannot be styled.`)))}getLayoutProperty(e,n){const i=this.getLayer(e);if(i)return i.getLayoutProperty(n);this.fire(new t.ErrorEvent(new Error(`The layer '${e}' does not exist in the map's style.`)))}setPaintProperty(e,n,i,o={}){this._checkLoaded();const a=this.getLayer(e);a?r(a.getPaintProperty(n),i)||(a.setPaintProperty(n,i,o)&&this._updateLayer(a),this._changed=!0,this._updatedPaintProps[e]=!0):this.fire(new t.ErrorEvent(new Error(`The layer '${e}' does not exist in the map's style and cannot be styled.`)))}getPaintProperty(t,e){return this.getLayer(t).getPaintProperty(e)}setFeatureState(e,n){this._checkLoaded();const i=e.source,r=e.sourceLayer,o=this.getSource(i);if(void 0===o)return void this.fire(new t.ErrorEvent(new Error(`The source '${i}' does not exist in the map's style.`)));const a=o.type;if("geojson"===a&&r)return void this.fire(new t.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));if("vector"===a&&!r)return void this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));void 0===e.id&&this.fire(new t.ErrorEvent(new Error("The feature id parameter must be provided.")));const s=this._getSourceCaches(i);for(const t of s)t.setFeatureState(r,e.id,n)}removeFeatureState(e,n){this._checkLoaded();const i=e.source,r=this.getSource(i);if(void 0===r)return void this.fire(new t.ErrorEvent(new Error(`The source '${i}' does not exist in the map's style.`)));const o=r.type,a="vector"===o?e.sourceLayer:void 0;if("vector"===o&&!a)return void this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));if(n&&"string"!=typeof e.id&&"number"!=typeof e.id)return void this.fire(new t.ErrorEvent(new Error("A feature id is required to remove its specific state property.")));const s=this._getSourceCaches(i);for(const t of s)t.removeFeatureState(a,e.id,n)}getFeatureState(e){this._checkLoaded();const n=e.source,i=e.sourceLayer,r=this.getSource(n);if(void 0!==r){if("vector"!==r.type||i)return void 0===e.id&&this.fire(new t.ErrorEvent(new Error("The feature id parameter must be provided."))),this._getSourceCaches(n)[0].getFeatureState(i,e.id);this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new t.ErrorEvent(new Error(`The source '${n}' does not exist in the map's style.`)))}getTransition(){return t.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){const e={};for(const t in this._sourceCaches){const n=this._sourceCaches[t].getSource();e[n.id]||(e[n.id]=n.serialize())}return t.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,terrain:this.stylesheet.terrain,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,sources:e,layers:this._serializeLayers(this._order)},(t=>void 0!==t))}_updateLayer(t){this._updatedLayers[t.id]=!0;const e=this._getLayerSourceCache(t);t.source&&!this._updatedSources[t.source]&&e&&"raster"!==e.getSource().type&&(this._updatedSources[t.source]="reload",e.pause()),this._changed=!0}_flattenAndSortRenderedFeatures(t){const e=t=>"fill-extrusion"===this._layers[t].type,n={},i=[];for(let r=this._order.length-1;r>=0;r--){const o=this._order[r];if(e(o)){n[o]=r;for(const e of t){const t=e[o];if(t)for(const e of t)i.push(e)}}}i.sort(((t,e)=>e.intersectionZ-t.intersectionZ));const r=[];for(let o=this._order.length-1;o>=0;o--){const a=this._order[o];if(e(a))for(let t=i.length-1;t>=0;t--){const e=i[t].feature;if(n[e.layer.id]{const e=this.getLayer(t);return e&&e.is3D()})):this.has3DLayers(),s=M.createFromScreenPoints(e,i);for(const t in this._sourceCaches){const e=this._sourceCaches[t].getSource().id;n.layers&&!r[e]||o.push(kt(this._sourceCaches[t],this._layers,this._serializedLayers,s,n,i,a,!!this.map._showQueryGeometry))}return this.placement&&o.push(function(t,e,n,i,r,o,a){const s={},l=o.queryRenderedSymbols(i),c=[];for(const t of Object.keys(l).map(Number))c.push(a[t]);c.sort(Mt);for(const n of c){const i=n.featureIndex.lookupSymbolFeatures(l[n.bucketInstanceId],e,n.bucketIndex,n.sourceLayerIndex,r.filter,r.layers,r.availableImages,t);for(const t in i){const e=s[t]=s[t]||[],r=i[t];r.sort(((t,e)=>{const i=n.featureSortOrder;if(i){const n=i.indexOf(t.featureIndex);return i.indexOf(e.featureIndex)-n}return e.featureIndex-t.featureIndex}));for(const t of r)e.push(t)}}for(const e in s)s[e].forEach((i=>{const r=i.feature,o=n(t[e]).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,n,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(o)}querySourceFeatures(e,n){n&&n.filter&&this._validate(t.validateStyle.filter,"querySourceFeatures.filter",n.filter,null,n);const i=this._getSourceCaches(e);let r=[];for(const t of i)r=r.concat(It(t,n));return r}addSourceType(t,e,n){return Ue.getSourceType(t)?n(new Error(`A source type called "${t}" already exists.`)):(Ue.setSourceType(t,e),e.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:t,url:e.workerSourceURL},n):n(null,null))}getLight(){return this.light.getLight()}setLight(e,n={}){this._checkLoaded();const i=this.light.getLight();let o=!1;for(const t in e)if(!r(e[t],i[t])){o=!0;break}if(!o)return;const a={now:t.exported.now(),transition:t.extend({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(e,n),this.light.updateTransitions(a)}getTerrain(){return this.terrain?this.terrain.get():null}setTerrain(e){if(this._checkLoaded(),!e)return delete this.terrain,delete this.stylesheet.terrain,this.dispatcher.broadcast("enableTerrain",!1),this._force3DLayerUpdate(),void(this._markersNeedUpdate=!0);if("object"==typeof e.source){const n="terrain-dem-src";this.addSource(n,e.source),e=t.clone$2(e),e=t.extend(e,{source:n})}if(!this._validate(t.validateStyle.terrain,"terrain",e)){if(this.terrain){const n=this.terrain,i=n.get();for(const o in e)if(!r(e[o],i[o])){n.set(e),this.stylesheet.terrain=e;const i={now:t.exported.now(),transition:t.extend({duration:0},this.stylesheet.transition)};n.updateTransitions(i);break}}else this._createTerrain(e);this._updateDrapeFirstLayers(),this._markersNeedUpdate=!0}}_createFog(e){const n=this.fog=new A(e);this.stylesheet.fog=e;const i={now:t.exported.now(),transition:t.extend({duration:0},this.stylesheet.transition)};n.updateTransitions(i)}_updateMarkersOpacity(){0!==this.map._markers.length&&this.map._requestDomTask((()=>{for(const t of this.map._markers)t._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 n=this.fog,i=n.get();for(const o in e)if(!r(e[o],i[o])){n.set(e),this.stylesheet.fog=e;const i={now:t.exported.now(),transition:t.extend({duration:0},this.stylesheet.transition)};n.updateTransitions(i);break}}else this._createFog(e);this._markersNeedUpdate=!0}_updateDrapeFirstLayers(){if(!this.map._optimizeForTerrain||!this.terrain)return;const t=this._order.filter((t=>this.isLayerDraped(this._layers[t]))),e=this._order.filter((t=>!this.isLayerDraped(this._layers[t])));this._drapedFirstOrder=[],this._drapedFirstOrder.push(...t),this._drapedFirstOrder.push(...e)}_createTerrain(e){const n=this.terrain=new w(e);this.stylesheet.terrain=e,this.dispatcher.broadcast("enableTerrain",!0),this._force3DLayerUpdate();const i={now:t.exported.now(),transition:t.extend({duration:0},this.stylesheet.transition)};n.updateTransitions(i)}_force3DLayerUpdate(){for(const t in this._layers){const e=this._layers[t];"fill-extrusion"===e.type&&this._updateLayer(e)}}_validate(e,n,i,r,o={}){return(!o||!1!==o.validate)&&Fe(this,e.call(t.validateStyle,t.extend({key:n,style:this.serialize(),value:i,styleSpec:t.spec},r)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),t.evented.off("pluginStateChange",this._rtlTextPluginCallback);for(const t in this._layers)this._layers[t].setEventedParent(null);for(const t in this._sourceCaches)this._sourceCaches[t].clearTiles(),this._sourceCaches[t].setEventedParent(null);this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove()}_clearSource(t){const e=this._getSourceCaches(t);for(const t of e)t.clearTiles()}_reloadSource(t){const e=this._getSourceCaches(t);for(const t of e)t.resume(),t.reload()}_updateSources(t){for(const e in this._sourceCaches)this._sourceCaches[e].update(t)}_generateCollisionBoxes(){for(const t in this._sourceCaches){const e=this._sourceCaches[t];e.resume(),e.reload()}}_updatePlacement(e,n,i,r,o=!1){let a=!1,s=!1;const l={};for(const t of this._order){const n=this._layers[t];if("symbol"!==n.type)continue;if(!l[n.source]){const t=this._getLayerSourceCache(n);if(!t)continue;l[n.source]=t.getRenderableIds(!0).map((e=>t.getTileByID(e))).sort(((t,e)=>e.tileID.overscaledZ-t.tileID.overscaledZ||(t.tileID.isLessThan(e.tileID)?-1:1)))}const i=this.crossTileSymbolIndex.addLayer(n,l[n.source],e.center.lng);a=a||i}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),o=o||this._layerOrderChanged||0===i,this._layerOrderChanged&&this.fire(new t.Event("neworder")),(o||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(t.exported.now(),e.zoom))&&(this.pauseablePlacement=new Pe(e,this._order,o,n,i,r,this.placement,this.fog?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(t.exported.now()),s=!0),a&&this.pauseablePlacement.placement.setStale()),s||a)for(const t of this._order){const e=this._layers[t];"symbol"===e.type&&this.placement.updateLayerOpacities(e,l[e.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(t.exported.now())}_releaseSymbolFadeTiles(){for(const t in this._sourceCaches)this._sourceCaches[t].releaseSymbolFadeTiles()}getImages(t,e,n){this.imageManager.getImages(e.icons,n),this._updateTilesForChangedImages();const i=t=>{t&&t.setDependencies(e.tileID.key,e.type,e.icons)};i(this._otherSourceCaches[e.source]),i(this._symbolSourceCaches[e.source])}getGlyphs(t,e,n){this.glyphManager.getGlyphs(e.stacks,n)}getResource(e,n,i){return t.makeRequest(n,i)}_getSourceCache(t){return this._otherSourceCaches[t]}_getLayerSourceCache(t){return"symbol"===t.type?this._symbolSourceCaches[t.source]:this._otherSourceCaches[t.source]}_getSourceCaches(t){const e=[];return this._otherSourceCaches[t]&&e.push(this._otherSourceCaches[t]),this._symbolSourceCaches[t]&&e.push(this._symbolSourceCaches[t]),e}has3DLayers(){return this._num3DLayers>0}hasSymbolLayers(){return this._numSymbolLayers>0}hasCircleLayers(){return this._numCircleLayers>0}}Ue.getSourceType=function(t){return Et[t]},Ue.setSourceType=function(t,e){Et[t]=e},Ue.registerForPluginStateChange=t.registerForPluginStateChange;var Ve="\n#define EPSILON 0.0000001\n#define PI 3.141592653589793\n#ifdef FOG\nuniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;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);}\n#endif",Ge="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;}";let qe={},Ze={};qe=Ke("","\n#define ELEVATION_SCALE 7.0\n#define ELEVATION_OFFSET 450.0\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\nfloat unpack_depth(vec4 rgba_depth)\n{const vec4 bit_shift=vec4(1.0/(256.0*256.0*256.0),1.0/(256.0*256.0),1.0/256.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",!0),Ze=Ke("#ifdef FOG\nuniform float u_fog_temporal_offset;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=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","#ifdef FOG\nuniform mat4 u_fog_matrix;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",!0);const He=Ke("#ifdef GL_ES\nprecision mediump float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\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;}","#ifdef GL_ES\nprecision highp float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(\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."),We=Ve;var Xe={background:Ke("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:Ke("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:Ke("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 vec2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;varying vec3 v_data;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) {vec2 sample_offset=calc_offset(extrusion,radius,stroke_width,view_scale);\n#ifdef PITCH_WITH_MAP\nreturn u_matrix*( world_center+vec4(sample_offset,0,0) );\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);float height=circle_elevation(circle_center);vec4 world_center=vec4(circle_center,height,1);vec4 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);float visibility=0.0;\n#ifdef TERRAIN\nfloat step=get_sample_step();\n#ifdef PITCH_WITH_MAP\nfloat cantilevered_height=cantilevered_elevation(circle_center,radius,stroke_width,view_scale);vec4 occlusion_world_center=vec4(circle_center,cantilevered_height,1);vec4 occlusion_projected_center=u_matrix*occlusion_world_center;\n#else\nvec4 occlusion_world_center=world_center;vec4 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);visibility+=float(!isOccluded(frag_pos));}}visibility/=float(NUM_VISIBILITY_RINGS)*float(NUM_SAMPLES_PER_RING);\n#else\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:Ke("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:Ke("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\ngl_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;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec3 pos=vec3(floor(a_pos*0.5)+extrude,elevation(floor(a_pos*0.5)));gl_Position=u_matrix*vec4(pos,1);\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}"),heatmapTexture:Ke("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:Ke("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 vec2 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_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=u_matrix*vec4(a_pos,elevation(a_pos),1.0);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:Ke("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:Ke("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}","attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {float h=elevation(a_pos);v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,h,1);}"),fill:Ke("#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:Ke("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:Ke("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:Ke("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:Ke("varying vec4 v_color;void main() {vec4 color=v_color;\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;attribute vec4 a_pos_normal_ed;attribute vec2 a_centroid_pos;varying vec4 v_color;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\nvec3 pos_nx=floor(a_pos_normal_ed.xyz*0.5);mediump vec3 top_up_ny=a_pos_normal_ed.xyz-2.0*pos_nx;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));base=max(0.0,base);height=max(0.0,height);float t=top_up_ny.x;\n#ifdef TERRAIN\nvec2 centroid_pos=a_centroid_pos;bool flat_roof=centroid_pos.x !=0.0;float ele=elevation(pos_nx.xy);float hidden=float(centroid_pos.x==0.0 && centroid_pos.y==1.0);float c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;float h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base==0.0 ?-5.0 : base);vec3 pos=vec3(pos_nx.xy,h);gl_Position=mix(u_matrix*vec4(pos,1),AWAY,hidden);\n#else\nvec3 pos=vec3(pos_nx.xy,t > 0.0 ? height : base);gl_Position=u_matrix*vec4(pos,1);\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)));}v_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 FOG\nv_fog_pos=fog_position(pos);\n#endif\n}"),fillExtrusionPattern:Ke("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 out_color=mix(color1,color2,u_fade);out_color=out_color*v_lighting;\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;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 pos_nx=floor(a_pos_normal_ed.xyz*0.5);mediump vec3 top_up_ny=a_pos_normal_ed.xyz-2.0*pos_nx;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;\n#ifdef TERRAIN\nvec2 centroid_pos=a_centroid_pos;bool flat_roof=centroid_pos.x !=0.0;float ele=elevation(pos_nx.xy);float hidden=float(centroid_pos.x==0.0 && centroid_pos.y==1.0);float c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;float h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base==0.0 ?-5.0 : base);vec3 p=vec3(pos_nx.xy,h);gl_Position=mix(u_matrix*vec4(p,1),AWAY,hidden);\n#else\nvec3 p=vec3(pos_nx.xy,z);gl_Position=u_matrix*vec4(p,1);\n#endif\nvec2 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)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;\n#ifdef FOG\nv_fog_pos=fog_position(p);\n#endif\n}"),hillshadePrepare:Ke("#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:Ke("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:Ke("uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 out_color=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}","\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\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_width2=vec2(outset,inset);\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}"),lineGradient:Ke("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture2D(u_image,v_uv);\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_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\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_width2=vec2(outset,inset);\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}"),linePattern:Ke("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 mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\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}"),lineSDF:Ke("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_mix;uniform vec3 u_scale;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 dash_from\n#pragma mapbox: define lowp vec4 dash_to\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 dash_from\n#pragma mapbox: initialize mediump vec4 dash_to\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);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);vec4 out_color=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}","\n#define EXTRUDE_SCALE 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_linesofar;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform vec2 u_texsize;uniform mediump vec3 u_scale;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 dash_from\n#pragma mapbox: define lowp vec4 dash_to\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 dash_from\n#pragma mapbox: initialize mediump vec4 dash_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*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_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,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\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);v_width2=vec2(outset,inset);\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}"),raster:Ke("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 float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),symbolIcon:Ke("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_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}float h=elevation(a_pos);vec4 projectedPoint=u_matrix*vec4(a_pos,h,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\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 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),h,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h,1.0);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0);\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\nfloat occlusion_fade=occlusionFade(projectedPoint);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projectedPoint.w <=0.0 || occlusion_fade==0.0));v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;v_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));}"),symbolSDF:Ke("#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_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}float h=elevation(a_pos);vec4 projectedPoint=u_matrix*vec4(a_pos,h,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\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 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),h,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h,1.0);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset);\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\nfloat occlusion_fade=occlusionFade(projectedPoint);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projectedPoint.w <=0.0 || occlusion_fade==0.0));float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}"),symbolTextAndIcon:Ke("#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_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}float h=elevation(a_pos);vec4 projectedPoint=u_matrix*vec4(a_pos,h,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),h,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h,1.0);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*fontScale);\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\nfloat occlusion_fade=occlusionFade(projectedPoint);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projectedPoint.w <=0.0 || occlusion_fade==0.0));float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}"),terrainRaster:Ke("uniform sampler2D u_image0;varying vec2 v_pos0;\n#ifdef FOG\nvarying float v_fog_opacity;\n#endif\nvoid main() {vec4 color=texture2D(u_image0,v_pos0);\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\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}"),terrainDepth:Ke("#ifdef GL_ES\nprecision highp float;\n#endif\nvec4 pack_depth(float ndc_z) {float depth=ndc_z*0.5+0.5;const vec4 bit_shift=vec4(256.0*256.0*256.0,256.0*256.0,256.0,1.0);const vec4 bit_mask =vec4(0.0,1.0/256.0,1.0/256.0,1.0/256.0);vec4 res=fract(depth*bit_shift);res-=res.xxyz*bit_mask;return res;}varying 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:Ke("\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}",Ge),skyboxGradient:Ke("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}",Ge),skyboxCapture:Ke("\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);}")};function Ke(t,e,n){const i=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,r=/uniform (highp |mediump |lowp )?([\w]+) ([\w]+)([\s]*)([\w]*)/g,o=e.match(/attribute (highp |mediump |lowp )?([\w]+) ([\w]+)/g),a=t.match(r),s=e.match(r),l=Ve.match(r);let c=s?s.concat(a):a;n||(qe.staticUniforms&&(c=qe.staticUniforms.concat(c)),Ze.staticUniforms&&(c=Ze.staticUniforms.concat(c))),c&&(c=c.concat(l));const u={};return{fragmentSource:t=t.replace(i,((t,e,n,i,r)=>(u[r]=!0,"define"===e?`\n#ifndef HAS_UNIFORM_u_${r}\nvarying ${n} ${i} ${r};\n#else\nuniform ${n} ${i} u_${r};\n#endif\n`:`\n#ifdef HAS_UNIFORM_u_${r}\n ${n} ${i} ${r} = u_${r};\n#endif\n`))),vertexSource:e=e.replace(i,((t,e,n,i,r)=>{const o="float"===i?"vec2":"vec4",a=r.match(/color/)?"color":o;return u[r]?"define"===e?`\n#ifndef HAS_UNIFORM_u_${r}\nuniform lowp float u_${r}_t;\nattribute ${n} ${o} a_${r};\nvarying ${n} ${i} ${r};\n#else\nuniform ${n} ${i} u_${r};\n#endif\n`:"vec4"===a?`\n#ifndef HAS_UNIFORM_u_${r}\n ${r} = a_${r};\n#else\n ${n} ${i} ${r} = u_${r};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${r}\n ${r} = unpack_mix_${a}(a_${r}, u_${r}_t);\n#else\n ${n} ${i} ${r} = u_${r};\n#endif\n`:"define"===e?`\n#ifndef HAS_UNIFORM_u_${r}\nuniform lowp float u_${r}_t;\nattribute ${n} ${o} a_${r};\n#else\nuniform ${n} ${i} u_${r};\n#endif\n`:"vec4"===a?`\n#ifndef HAS_UNIFORM_u_${r}\n ${n} ${i} ${r} = a_${r};\n#else\n ${n} ${i} ${r} = u_${r};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${r}\n ${n} ${i} ${r} = unpack_mix_${a}(a_${r}, u_${r}_t);\n#else\n ${n} ${i} ${r} = u_${r};\n#endif\n`})),staticAttributes:o,staticUniforms:c}}class Ye{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,e,n,i,r,o,a,s){this.context=t;let l=this.boundPaintVertexBuffers.length!==i.length;for(let t=0;!l&&t{const r=n.paint.get("hillshade-shadow-color"),o=n.paint.get("hillshade-highlight-color"),a=n.paint.get("hillshade-accent-color");let s=n.paint.get("hillshade-illumination-direction")*(Math.PI/180);"viewport"===n.paint.get("hillshade-illumination-anchor")&&(s-=t.transform.angle);const l=!t.options.moving;return{u_matrix:i||t.transform.calculateProjMatrix(e.tileID.toUnwrapped(),l),u_image:0,u_latrange:Je(0,e.tileID),u_light:[n.paint.get("hillshade-exaggeration"),s],u_shadow:r,u_highlight:o,u_accent:a}})(e,i,r,e.terrain?n.projMatrix:null);e.prepareDrawProgram(l,h,n.toUnwrapped()),h.draw(l,c.TRIANGLES,o,a,s,t.CullFaceMode.disabled,d,r.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments)}function tn(e,n,i){if(!n.needsDEMTextureUpload)return;const r=e.context,o=r.gl;r.pixelStoreUnpackPremultiplyAlpha.set(!1),n.demTexture=n.demTexture||e.getTileTexture(i.stride);const a=i.getPixels();n.demTexture?n.demTexture.update(a,{premultiply:!1}):n.demTexture=new t.Texture(r,a,o.RGBA,{premultiply:!1}),n.needsDEMTextureUpload=!1}function en(e,n,i,r,o,a){const s=e.context,l=s.gl;if(!n.dem)return;const c=n.dem;if(s.activeTexture.set(l.TEXTURE1),tn(e,n,c),!n.demTexture)return;n.demTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE);const u=c.dim;s.activeTexture.set(l.TEXTURE0);let h=n.fbo;if(!h){const e=new t.Texture(s,{width:u,height:u,data:null},l.RGBA);e.bind(l.LINEAR,l.CLAMP_TO_EDGE),h=n.fbo=s.createFramebuffer(u,u,!0),h.colorAttachment.set(e.texture)}s.bindFramebuffer.set(h.framebuffer),s.viewport.set([0,0,u,u]),e.useProgram("hillshadePrepare").draw(s,l.TRIANGLES,r,o,a,t.CullFaceMode.disabled,((e,n)=>{const i=n.stride,r=t.create$1();return t.ortho(r,0,t.EXTENT,-t.EXTENT,0,0,1),t.translate(r,r,[0,-t.EXTENT,0]),{u_matrix:r,u_image:1,u_dimension:[i,i],u_zoom:e.overscaledZ,u_unpack:n.unpackVector}})(n.tileID,c),i.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments),n.needsHillshadePrepare=!1}const nn=(e,n)=>({u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_image0:new t.Uniform1i(e,n.u_image0),u_skirt_height:new t.Uniform1f(e,n.u_skirt_height)}),rn=(t,e)=>({u_matrix:t,u_image0:0,u_skirt_height:e}),on=new class{constructor(){this.operations={}}newMorphing(t,e,n,i,r){if(t in this.operations){const e=this.operations[t];e.to.tileID.key!==n.tileID.key&&(e.queued=n)}else this.operations[t]={startTime:i,phase:0,duration:r,from:e,to:n,queued:null}}getMorphValuesForProxy(t){if(!(t in this.operations))return null;const e=this.operations[t];return{from:e.from,to:e.to,phase:e.phase}}update(t){for(const e in this.operations){const n=this.operations[e];for(n.phase=(t-n.startTime)/n.duration;n.phase>=1||!this._validOp(n);)if(!this._nextOp(n,t)){delete this.operations[e];break}}}_nextOp(t,e){return!!t.queued&&(t.from=t.to,t.to=t.queued,t.queued=null,t.phase=0,t.startTime=e,!0)}_validOp(t){return t.from.hasData()&&t.to.hasData()}},an={0:null,1:"TERRAIN_VERTEX_MORPHING",2:"TERRAIN_WIREFRAME"};function sn(t,e){const n=1<({u_matrix:t});function cn(e,n,i,r,o){if(o>0){const a=t.exported.now(),s=(a-e.timeAdded)/o,l=n?(a-n.timeAdded)/o:-1,c=i.getSource(),u=r.coveringZoomLevel({tileSize:c.tileSize,roundZoom:c.roundZoom}),h=!n||Math.abs(n.tileID.overscaledZ-u)>Math.abs(e.tileID.overscaledZ-u),d=h&&e.refreshedUponExpiration?1:t.clamp(h?s:1-l,0,1);return e.refreshedUponExpiration&&s>=1&&(e.refreshedUponExpiration=!1),n?{opacity:1,mix:1-d}:{opacity:d,mix:0}}return{opacity:1,mix:0}}class un extends t.SourceCache{constructor(t){const e=St("proxy",{type:"geojson",maxzoom:t.transform.maxZoom},new k(Rt(),null),t.style);super("proxy",e,!1),e.setEventedParent(this),this.map=this.getSource().map=t,this.used=this._sourceLoaded=!0,this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}update(e,n,i){if(e.freezeTileCoverage)return;this.transform=e;const r=e.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}).reduce(((n,i)=>{if(n[i.key]="",!this._tiles[i.key]){const n=new t.Tile(i,this._source.tileSize*i.overscaleFactor(),e.tileZoom);n.state="loaded",this._tiles[i.key]=n}return n}),{});for(const t in this._tiles)t in r||(this.freeFBO(t),this._tiles[t].state="unloaded",delete this._tiles[t])}freeFBO(t){const e=this.proxyCachedFBO[t];if(void 0!==e){const n=Object.values(e);this.renderCachePool.push(...n),delete this.proxyCachedFBO[t]}}deallocRenderCache(){this.renderCache.forEach((t=>t.fb.destroy())),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}class hn extends t.OverscaledTileID{constructor(t,e,n){super(t.overscaledZ,t.wrap,t.canonical.z,t.canonical.x,t.canonical.y),this.proxyTileKey=e,this.projMatrix=n}}class dn extends t.Elevation{constructor(e,n){super(),this.painter=e,this.terrainTileForTile={},this.prevTerrainTileForTile={};const[i,r,o]=function(e){const n=new t.StructArrayLayout4i8,i=new t.StructArrayLayout3ui6,r=131;n.reserve(17161),i.reserve(33800);const o=t.EXTENT/128,a=t.EXTENT+o/2,s=a+o;for(let e=-o;ea||e<0||e>a?24575:0,o=t.clamp(Math.round(i),0,t.EXTENT),s=t.clamp(Math.round(e),0,t.EXTENT);n.emplaceBack(o+r,s,o,s)}const l=(t,e)=>{const n=e*r+t;i.emplaceBack(n+1,n,n+r),i.emplaceBack(n+r,n+r+1,n+1)};for(let t=1;t<129;t++)for(let e=1;e<129;e++)l(e,t);return[0,129].forEach((t=>{for(let e=0;e<130;e++)l(e,t),l(t,e)})),[n,i,32768]}(),a=e.context;this.gridBuffer=a.createVertexBuffer(i,Tt.members),this.gridIndexBuffer=a.createIndexBuffer(r),this.gridSegments=t.SegmentVector.simpleSegment(0,0,i.length,r.length),this.gridNoSkirtSegments=t.SegmentVector.simpleSegment(0,0,i.length,o),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new un(n.map),this.orthoMatrix=t.create$1(),t.ortho(this.orthoMatrix,0,t.EXTENT,0,t.EXTENT,0,1);const s=a.gl;this._overlapStencilMode=new t.StencilMode({func:s.GEQUAL,mask:255},0,255,s.KEEP,s.KEEP,s.REPLACE),this._previousZoom=e.transform.zoom,this.pool=[],this._findCoveringTileCache={},this._tilesDirty={},this.style=n,this._useVertexMorphing=!0,this._exaggeration=1}set style(t){t.on("data",this._onStyleDataEvent.bind(this)),t.on("neworder",this._checkRenderCacheEfficiency.bind(this)),this._style=t,this._checkRenderCacheEfficiency()}update(e,n,i){if(e&&e.terrain){this._style!==e&&(this.style=e),this.enabled=!0;const r=e.terrain.properties;this.sourceCache=e._getSourceCache(r.get("source")),this._exaggeration=r.get("exaggeration");const o=()=>{this.sourceCache.used&&t.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 e=this.sourceCache.getSource().tileSize/128,i=this.proxySourceCache.getSource().tileSize;this.sourceCache.update(n,e*i,!0),this._findCoveringTileCache[this.sourceCache.id]={}};this.sourceCache.usedForTerrain||(this._findCoveringTileCache[this.sourceCache.id]={},this.sourceCache.usedForTerrain=!0,o(),this._initializing=!0),o(),n.updateElevation(!i),this._findCoveringTileCache[this.proxySourceCache.id]={},this.proxySourceCache.update(n),this._emptyDEMTextureDirty=!0}else this._disable()}_checkRenderCacheEfficiency(){const e=this.renderCacheEfficiency(this._style);this._style.map._optimizeForTerrain||100!==e.efficiency&&t.warnOnce(`Terrain render cache efficiency is not optimal (${e.efficiency}%) and performance\n may be affected negatively, consider placing all background, fill and line layers before layer\n with id '${e.firstUndrapedLayer}' or create a map using optimizeForTerrain: true option.`)}_onStyleDataEvent(t){t.coord&&"source"===t.dataType?this._clearRenderCacheForTile(t.sourceCacheId,t.coord):"style"===t.dataType&&(this._invalidateRenderCache=!0)}_disable(){if(this.enabled&&(this.enabled=!1,this._sharedDepthStencil=void 0,this.proxySourceCache.deallocRenderCache(),this._style))for(const t in this._style._sourceCaches)this._style._sourceCaches[t].usedForTerrain=!1}destroy(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this.pool.forEach((t=>t.fb.destroy())),this.pool=[],this._depthFBO&&(this._depthFBO.destroy(),delete this._depthFBO,delete this._depthTexture)}_source(){return this.enabled?this.sourceCache:null}exaggeration(){return this._exaggeration}get visibleDemTiles(){return this._visibleDemTiles}get drapeBufferSize(){const t=2*this.proxySourceCache.getSource().tileSize;return[t,t]}set useVertexMorphing(t){this._useVertexMorphing=t}updateTileBinding(e){if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;const n=this.proxySourceCache,i=this.painter.transform;this._initializing&&(this._initializing=0===i._centerAltitude&&-1===this.getAtPointOrZero(t.MercatorCoordinate.fromLngLat(i.center),-1),this._emptyDEMTextureDirty=!this._initializing);const r=this.proxyCoords=n.getIds().map((t=>{const e=n.getTileByID(t).tileID;return e.projMatrix=i.calculateProjMatrix(e.toUnwrapped()),e}));!function(e,n){const i=n.transform.pointCoordinate(n.transform.getCameraPoint()),r=new t.pointGeometry(i.x,i.y);e.sort(((e,n)=>{if(n.overscaledZ-e.overscaledZ)return n.overscaledZ-e.overscaledZ;const i=new t.pointGeometry(e.canonical.x+(1<{this.proxyToSource[t.key]={}})),this.terrainTileForTile={};const a=this._style._sourceCaches;for(const t in a){const n=a[t];if(!n.used)continue;if(n!==this.sourceCache&&(this._findCoveringTileCache[n.id]={}),this._setupProxiedCoordsForOrtho(n,e[t],o),n.usedForTerrain)continue;const i=e[t];n.getSource().reparseOverscaled&&this._assignTerrainTiles(i)}this.proxiedCoords[n.id]=r.map((t=>new hn(t,t.key,this.orthoMatrix))),this._assignTerrainTiles(r),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(o),this.renderingToTexture=!1,this._updateTimestamp=t.exported.now();const s={};this._visibleDemTiles=[];for(const t of this.proxyCoords){const e=this.terrainTileForTile[t.key];if(!e)continue;const n=e.tileID.key;n in s||(this._visibleDemTiles.push(e),s[n]=n)}}_assignTerrainTiles(t){this._initializing||t.forEach((t=>{if(this.terrainTileForTile[t.key])return;const e=this._findTileCoveringTileID(t,this.sourceCache);e&&(this.terrainTileForTile[t.key]=e)}))}_prepareDEMTextures(){const t=this.painter.context,e=t.gl;for(const n in this.terrainTileForTile){const i=this.terrainTileForTile[n],r=i.dem;!r||i.demTexture&&!i.needsDEMTextureUpload||(t.activeTexture.set(e.TEXTURE1),tn(this.painter,i,r))}}_prepareDemTileUniforms(t,e,n,i){if(!e||null==e.demTexture)return!1;const r=t.tileID.canonical,o=Math.pow(2,e.tileID.canonical.z-r.z),a=i||"";return n[`u_dem_tl${a}`]=[r.x*o%1,r.y*o%1],n[`u_dem_scale${a}`]=o,!0}get emptyDEMTexture(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}_getLoadedAreaMinimum(){let t=0;const e=this._visibleDemTiles.reduce(((e,n)=>{if(!n.dem)return e;const i=n.dem.tree.minimums[0];return i>0&&t++,e+i}),0);return t?e/t:0}_updateEmptyDEMTexture(){const e=this.painter.context,n=e.gl;e.activeTexture.set(n.TEXTURE2);const i=this._getLoadedAreaMinimum(),r={width:1,height:1,data:new Uint8Array(t.DEMData.pack(i,this.sourceCache.getSource().encoding))};this._emptyDEMTextureDirty=!1;let o=this._emptyDEMTexture;return o?o.update(r,{premultiply:!1}):o=this._emptyDEMTexture=new t.Texture(e,r,n.RGBA,{premultiply:!1}),o}setupElevationDraw(e,n,i){const r=this.painter.context,o=r.gl,a=(s=this.sourceCache.getSource().encoding,{u_dem:2,u_dem_prev:4,u_dem_unpack:t.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(i&&i.morphing&&this._useVertexMorphing){const t=i.morphing.srcDemTile,n=i.morphing.dstDemTile;u=i.morphing.phase,t&&n&&(this._prepareDemTileUniforms(e,t,a,"_prev")&&(c=t),this._prepareDemTileUniforms(e,n,a)&&(l=n))}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[e.tileID.key],r.activeTexture.set(o.TEXTURE2),(this._prepareDemTileUniforms(e,l,a)?l.demTexture:this.emptyDEMTexture).bind(o.NEAREST,o.CLAMP_TO_EDGE,o.NEAREST)),i&&i.useDepthForOcclusion&&(r.activeTexture.set(o.TEXTURE3),this._depthTexture.bind(o.NEAREST,o.CLAMP_TO_EDGE,o.NEAREST),a.u_depth_size_inv=[1/this._depthFBO.width,1/this._depthFBO.height]),i&&i.useMeterToDem&&l){const e=(1<{if(c===t)return;const i=[an[t]];n&&i.push(an[u]),l=e.useProgram("terrainRaster",null,i),c=t},d=e.colorModeForRenderPass(),p=new t.DepthMode(s.LEQUAL,t.DepthMode.ReadWrite,e.depthRangeFor3D);on.update(o);const f=e.transform,m=6*Math.pow(1.5,22-f.zoom)*n.exaggeration();(u?[!1,!0]:[!1]).forEach((u=>{c=-1;const g=u?s.LINES:s.TRIANGLES,[_,v]=u?n.getWirefameBuffer():[n.gridIndexBuffer,n.gridSegments];for(const c of r){const r=i.getTile(c),b=t.StencilMode.disabled,w=n.prevTerrainTileForTile[c.key],T=n.terrainTileForTile[c.key];x=T,null!=(y=w)&&null!=x&&y.hasData()&&x.hasData()&&null!=y.demTexture&&null!=x.demTexture&&y.tileID.key!==x.tileID.key&&on.newMorphing(c.key,w,T,o,250),a.activeTexture.set(s.TEXTURE0),r.texture.bind(s.LINEAR,s.CLAMP_TO_EDGE,s.LINEAR_MIPMAP_NEAREST);const C=on.getMorphValuesForProxy(c.key),E=C?1:0;let S;C&&(S={morphing:{srcDemTile:C.from,dstDemTile:C.to,phase:t.easeCubicInOut(C.phase)}});const A=rn(c.projMatrix,sn(c.canonical,f.renderWorldCopies)?m/10:m);h(E,u),n.setupElevationDraw(r,l,S),e.prepareDrawProgram(a,l,c.toUnwrapped()),l.draw(a,g,p,b,d,t.CullFaceMode.backCCW,A,"terrain_raster",n.gridBuffer,_,v)}var y,x}))}(n,this,this.proxySourceCache,e,this._updateTimestamp),this.renderingToTexture=!0,e.splice(0,e.length))}renderBatch(e){if(0===this._drapedRenderBatches.length)return e+1;this.renderingToTexture=!0;const n=this.painter,i=this.painter.context,r=this.proxySourceCache,o=this.proxiedCoords[r.id],a=this._drapedRenderBatches.shift(),s=[],l=n.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][e]: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;i.bindFramebuffer.set(d.fb.framebuffer),this.renderedToTile=!1,d.dirty&&(i.clear({color:t.Color.transparent}),d.dirty=!1);for(let t=a.start;t<=a.end;++t){const e=n.style._layers[l[t]];if(e.isHidden(n.transform.zoom))continue;const r=n.style._getLayerSourceCache(e),o=r?this.proxyToSource[u.key][r.id]:[u];if(!o)continue;const a=o;i.viewport.set([0,0,d.fb.width,d.fb.height]),f!==(r?r.id:null)&&(this._setupStencil(d,o,e,r),f=r?r.id:null),n.renderLayer(n,r,e,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,i.bindFramebuffer.set(null),i.viewport.set([0,0,n.width,n.height]),a.end+1}postRender(){}renderCacheEfficiency(t){const e=t.order.length;if(0===e)return{efficiency:100};let n,i=0,r=0,o=!1;for(let a=0;at.dem)).forEach((e=>{t=Math.min(t,e.dem.tree.minimums[0])})),0===t?t:(t-30)*this._exaggeration}raycast(t,e,n){if(!this._visibleDemTiles)return null;const i=this._visibleDemTiles.filter((t=>t.dem)).map((i=>{const r=i.tileID,o=Math.pow(2,r.overscaledZ),{x:a,y:s}=r.canonical,l=a/o,c=(a+1)/o,u=s/o,h=(s+1)/o;return{minx:l,miny:u,maxx:c,maxy:h,t:i.dem.tree.raycastRoot(l,u,c,h,t,e,n),tile:i}}));i.sort(((t,e)=>(null!==t.t?t.t:Number.MAX_VALUE)-(null!==e.t?e.t:Number.MAX_VALUE)));for(const r of i){if(null==r.t)return null;const i=r.tile.dem.tree.raycast(r.minx,r.miny,r.maxx,r.maxy,t,e,n);if(null!=i)return i}return null}_createFBO(){const e=this.painter.context,n=e.gl,i=this.drapeBufferSize;e.activeTexture.set(n.TEXTURE0);const r=new t.Texture(e,{width:i[0],height:i[1],data:null},n.RGBA);r.bind(n.LINEAR,n.CLAMP_TO_EDGE);const o=e.createFramebuffer(i[0],i[1],!1);return o.colorAttachment.set(r.texture),o.depthAttachment=new vt(e,o.framebuffer),void 0===this._sharedDepthStencil?(this._sharedDepthStencil=e.createRenderbuffer(e.gl.DEPTH_STENCIL,i[0],i[1]),this._stencilRef=0,o.depthAttachment.set(this._sharedDepthStencil),e.clear({stencil:0})):o.depthAttachment.set(this._sharedDepthStencil),e.extTextureFilterAnisotropic&&!e.extTextureFilterAnisotropicForceOff&&n.texParameterf(n.TEXTURE_2D,e.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,e.extTextureFilterAnisotropicMax),{fb:o,tex:r,dirty:!1}}_initFBOPool(){for(;this.pool.length{const e=this._style._layers[t],n=e.isHidden(this.painter.transform.zoom),i=e.getCrossfadeParameters(),r=!!i&&1!==i.t,o=e.hasTransition();return"custom"!==e.type&&!n&&(r||o)}))}_clearRasterFadeFromRenderCache(){let t=!1;for(const e in this._style._sourceCaches)if(this._style._sourceCaches[e]._source instanceof bt){t=!0;break}if(t)for(let t=0;te.renderCachePool.length){const t=Object.values(e.proxyCachedFBO);e.proxyCachedFBO={};for(let n=0;n=0;r--){const o=n[r];if(e.getTileByID(o.key),void 0!==e.proxyCachedFBO[o.key]){const n=t[o.key],r=this.proxyToSource[o.key];let a=0;for(const t in r){const e=r[t],o=n[t];if(!o||o.length!==e.length||e.some(((e,n)=>e!==o[n]||i[t]&&i[t].hasOwnProperty(e.key)))){a=-1;break}++a}for(const t in e.proxyCachedFBO[o.key])e.renderCache[e.proxyCachedFBO[o.key][t]].dirty=a<0||a!==Object.values(n).length}}const r=[...this._drapedRenderBatches];r.sort(((t,e)=>e.end-e.start-(t.end-t.start)));for(const t of r)for(const i of n){if(e.proxyCachedFBO[i.key])continue;let n=e.renderCachePool.pop();void 0===n&&e.renderCache.length<50&&(n=e.renderCache.length,e.renderCache.push(this._createFBO())),void 0!==n&&(e.proxyCachedFBO[i.key]={},e.proxyCachedFBO[i.key][t.start]=n,e.renderCache[n].dirty=!0)}this._tilesDirty={}}_setupStencil(t,e,n,i){if(!i||!this._sourceTilesOverlap[i.id])return void(this._overlapStencilType&&(this._overlapStencilType=!1));const r=this.painter.context,o=r.gl;if(e.length<=1)return void(this._overlapStencilType=!1);let a;if(n.isTileClipped())a=e.length,this._overlapStencilMode.test={func:o.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(e[0].overscaledZ>e[e.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,n.isTileClipped()&&this._renderTileClippingMasks(e,this._overlapStencilMode.ref)}stencilModeForRTTOverlap(e){return this.renderingToTexture&&this._overlapStencilType?("Clip"===this._overlapStencilType&&(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[e.key]),this._overlapStencilMode):t.StencilMode.disabled}_renderTileClippingMasks(e,n){const i=this.painter,r=this.painter.context,o=r.gl;i._tileClippingMaskIDs={},r.setColorMode(t.ColorMode.disabled),r.setDepthMode(t.DepthMode.disabled);const a=i.useProgram("clippingMask");for(const s of e){const e=i._tileClippingMaskIDs[s.key]=--n;a.draw(r,o.TRIANGLES,t.DepthMode.disabled,new t.StencilMode({func:o.ALWAYS,mask:0},e,255,o.KEEP,o.KEEP,o.REPLACE),t.ColorMode.disabled,t.CullFaceMode.disabled,ln(s.projMatrix),"$clipping",i.tileExtentBuffer,i.quadTriangleIndexBuffer,i.tileExtentSegments)}}pointCoordinate(e){const n=this.painter.transform;if(e.x<0||e.x>n.width||e.y<0||e.y>n.height)return null;const i=[e.x,e.y,1,1];t.transformMat4(i,i,n.pixelMatrixInverse),t.scale$2(i,i,1/i[3]),i[0]/=n.worldSize,i[1]/=n.worldSize;const r=n._camera.position,o=t.mercatorZfromAltitude(1,n.center.lat),a=[r[0],r[1],r[2]/o,0],s=t.subtract([],i.slice(0,3),a);t.normalize(s,s);const l=this.raycast(a,s,this._exaggeration);return null!==l&&l?(t.scaleAndAdd(a,a,s,l),a[3]=a[2],a[2]*=o,a):null}drawDepth(){const e=this.painter,n=e.context,i=this.proxySourceCache,r=Math.ceil(e.width),o=Math.ceil(e.height);if(!this._depthFBO||this._depthFBO.width===r&&this._depthFBO.height===o||(this._depthFBO.destroy(),delete this._depthFBO,delete this._depthTexture),!this._depthFBO){const e=n.gl,i=n.createFramebuffer(r,o,!0);n.activeTexture.set(e.TEXTURE0);const a=new t.Texture(n,{width:r,height:o,data:null},e.RGBA);a.bind(e.NEAREST,e.CLAMP_TO_EDGE),i.colorAttachment.set(a.texture);const s=n.createRenderbuffer(n.gl.DEPTH_COMPONENT16,r,o);i.depthAttachment.set(s),this._depthFBO=i,this._depthTexture=a}n.bindFramebuffer.set(this._depthFBO.framebuffer),n.viewport.set([0,0,r,o]),function(e,n,i,r){const o=e.context,a=o.gl;o.clear({depth:1});const s=e.useProgram("terrainDepth"),l=new t.DepthMode(a.LESS,t.DepthMode.ReadWrite,e.depthRangeFor3D);for(const e of r){const r=i.getTile(e),c=rn(e.projMatrix,0);n.setupElevationDraw(r,s),s.draw(o,a.TRIANGLES,l,t.StencilMode.disabled,t.ColorMode.unblended,t.CullFaceMode.backCCW,c,"terrain_depth",n.gridBuffer,n.gridIndexBuffer,n.gridNoSkirtSegments)}}(e,this,i,this.proxyCoords)}_setupProxiedCoordsForOrtho(t,e,n){if(t.getSource()instanceof Ct)return this._setupProxiedCoordsForImageSource(t,e,n);this._findCoveringTileCache[t.id]=this._findCoveringTileCache[t.id]||{};const i=this.proxiedCoords[t.id]=[],r=this.proxyCoords;for(let e=0;e(t.min.x=Math.min(t.min.x,e.x-s.x),t.min.y=Math.min(t.min.y,e.y-s.y),t.max.x=Math.max(t.max.x,e.x-s.x),t.max.y=Math.max(t.max.y,e.y-s.y),t)),{min:new t.pointGeometry(Number.MAX_VALUE,Number.MAX_VALUE),max:new t.pointGeometry(-Number.MAX_VALUE,-Number.MAX_VALUE)}),c=(e,n)=>{const i=e.wrap+e.canonical.x/(1<a+l.max.x||r+os+l.max.y};for(let t=0;tt.key===n.tileID.key));if(t)return t}if(n.tileID.key!==e.key){const i=e.canonical.z-n.tileID.canonical.z;let o,a,s;r=t.create$1();const l=n.tileID.wrap-e.wrap<0?(o=t.EXTENT>>i,a=o*((n.tileID.canonical.x<=r){const i=e.canonical.z-r;n.getSource().reparseOverscaled?(s=Math.max(e.canonical.z+2,n.transform.tileZoom),a=new t.OverscaledTileID(s,e.wrap,r,e.canonical.x>>i,e.canonical.y>>i)):0!==i&&(s=r,a=new t.OverscaledTileID(s,e.wrap,r,e.canonical.x>>i,e.canonical.y>>i))}a.key!==e.key&&(c.push(a.key),i=n.getTile(a))}const u=t=>{c.forEach((e=>{r[e]=t})),c.length=0};for(s-=1;s>=l&&(!i||!i.hasData());s--){i&&u(i.tileID.key);const t=a.calculateScaledKey(s);if(i=n.getTileByID(t),i&&i.hasData())break;const e=r[t];if(null===e)break;void 0===e?c.push(t):i=n.getTileByID(e)}return u(i?i.tileID.key:null),i&&i.hasData()?i:null}findDEMTileFor(t){return this.enabled?this._findTileCoveringTileID(t,this.sourceCache):null}prepareDrawTile(t){this.renderedToTile=!0}_clearRenderCacheForTile(t,e){let n=this._tilesDirty[t];n||(n=this._tilesDirty[t]={}),n[e.key]=!0}getWirefameBuffer(){if(!this.wireframeSegments){const e=function(e){let n,i,r;const o=new t.StructArrayLayout2ui4,a=131;for(i=1;i<129;i++){for(n=1;n<129;n++)r=i*a+n,o.emplaceBack(r,r+1),o.emplaceBack(r,r+a),o.emplaceBack(r+1,r+a),128===i&&o.emplaceBack(r+a,r+a+1);o.emplaceBack(r+1,r+1+a)}return o}();this.wireframeIndexBuffer=this.painter.context.createIndexBuffer(e),this.wireframeSegments=t.SegmentVector.simpleSegment(0,0,this.gridBuffer.length,e.length)}return[this.wireframeIndexBuffer,this.wireframeSegments]}}function pn(t){const e=[];for(let n=0;n`#define ${t}`)));const g=m.concat(He.fragmentSource,We,Ze.fragmentSource,i.fragmentSource).join("\n"),_=m.concat(He.vertexSource,We,Ze.vertexSource,qe.vertexSource,i.vertexSource).join("\n"),v=s.createShader(s.FRAGMENT_SHADER);if(s.isContextLost())return void(this.failedToCreate=!0);s.shaderSource(v,g),s.compileShader(v),s.attachShader(this.program,v);const y=s.createShader(s.VERTEX_SHADER);if(s.isContextLost())return void(this.failedToCreate=!0);s.shaderSource(y,_),s.compileShader(y),s.attachShader(this.program,y),this.attributes={};const x={};this.numAttributes=u.length;for(let t=0;t({u_dem:new t.Uniform1i(e,n.u_dem),u_dem_prev:new t.Uniform1i(e,n.u_dem_prev),u_dem_unpack:new t.Uniform4f(e,n.u_dem_unpack),u_dem_tl:new t.Uniform2f(e,n.u_dem_tl),u_dem_scale:new t.Uniform1f(e,n.u_dem_scale),u_dem_tl_prev:new t.Uniform2f(e,n.u_dem_tl_prev),u_dem_scale_prev:new t.Uniform1f(e,n.u_dem_scale_prev),u_dem_size:new t.Uniform1f(e,n.u_dem_size),u_dem_lerp:new t.Uniform1f(e,n.u_dem_lerp),u_exaggeration:new t.Uniform1f(e,n.u_exaggeration),u_depth:new t.Uniform1i(e,n.u_depth),u_depth_size_inv:new t.Uniform2f(e,n.u_depth_size_inv),u_meter_to_dem:new t.Uniform1f(e,n.u_meter_to_dem),u_label_plane_matrix_inv:new t.UniformMatrix4f(e,n.u_label_plane_matrix_inv)}))(e,x)),-1!==a.indexOf("FOG")&&(this.fogUniforms=((e,n)=>({u_fog_matrix:new t.UniformMatrix4f(e,n.u_fog_matrix),u_fog_range:new t.Uniform2f(e,n.u_fog_range),u_fog_color:new t.Uniform4f(e,n.u_fog_color),u_fog_horizon_blend:new t.Uniform1f(e,n.u_fog_horizon_blend),u_fog_temporal_offset:new t.Uniform1f(e,n.u_fog_temporal_offset)}))(e,x))}setTerrainUniformValues(t,e){if(!this.terrainUniforms)return;const n=this.terrainUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const t in e)n[t].set(e[t])}}setFogUniformValues(t,e){if(!this.fogUniforms)return;const n=this.fogUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const t in e)n[t].location&&n[t].set(e[t])}}draw(t,e,n,i,r,o,a,s,l,c,u,h,d,p,f,m){const g=t.gl;if(this.failedToCreate)return;t.program.set(this.program),t.setDepthMode(n),t.setStencilMode(i),t.setColorMode(r),t.setCullFace(o);for(const t in this.fixedUniforms)this.fixedUniforms[t].set(a[t]);p&&p.setUniforms(t,this.binderUniforms,h,{zoom:d});const _={[g.LINES]:2,[g.TRIANGLES]:3,[g.LINE_STRIP]:1}[e];for(const n of u.get()){const i=n.vaos||(n.vaos={});(i[s]||(i[s]=new Ye)).bind(t,this,l,p?p.getPaintVertexBuffers():[],c,n.vertexOffset,f,m),g.drawElements(e,n.primitiveLength*_,g.UNSIGNED_SHORT,n.primitiveOffset*_*2)}}}function mn(t,e,n){const i=1/I(n,1,e.transform.tileZoom),r=Math.pow(2,n.tileID.overscaledZ),o=n.tileSize*Math.pow(2,e.transform.tileZoom)/r,a=o*(n.tileID.canonical.x+n.tileID.wrap*r),s=o*n.tileID.canonical.y;return{u_image:0,u_texsize:n.imageAtlasTexture.size,u_scale:[i,t.fromScale,t.toScale],u_fade:t.t,u_pixel_coord_upper:[a>>16,s>>16],u_pixel_coord_lower:[65535&a,65535&s]}}const gn=(e,n,i,r)=>{const o=n.style.light,a=o.properties.get("position"),s=[a.x,a.y,a.z],l=t.create$2();"viewport"===o.properties.get("anchor")&&(t.fromRotation(l,-n.transform.angle),t.transformMat3(s,s,l));const c=o.properties.get("color");return{u_matrix:e,u_lightpos:s,u_lightintensity:o.properties.get("intensity"),u_lightcolor:[c.r,c.g,c.b],u_vertical_gradient:+i,u_opacity:r}},_n=(e,n,i,r,o,a,s)=>t.extend(gn(e,n,i,r),mn(a,n,s),{u_height_factor:-Math.pow(2,o.overscaledZ)/s.tileSize/8}),vn=t=>({u_matrix:t}),yn=(e,n,i,r)=>t.extend(vn(e),mn(i,n,r)),xn=(t,e)=>({u_matrix:t,u_world:e}),bn=(e,n,i,r,o)=>t.extend(yn(e,n,i,r),{u_world:o}),wn=(e,n,i,r)=>{const o=e.transform;let a;if("map"===r.paint.get("circle-pitch-alignment")){const t=I(i,1,o.zoom);a=[t,t]}else a=o.pixelsToGLUnits;return{u_camera_to_center_distance:o.cameraToCenterDistance,u_matrix:e.translatePosMatrix(n.projMatrix,i,r.paint.get("circle-translate"),r.paint.get("circle-translate-anchor")),u_device_pixel_ratio:t.exported.devicePixelRatio,u_extrude_scale:a}},Tn=t=>{const e=[];return"map"===t.paint.get("circle-pitch-alignment")&&e.push("PITCH_WITH_MAP"),"map"===t.paint.get("circle-pitch-scale")&&e.push("SCALE_WITH_MAP"),e},Cn=(e,n,i)=>{const r=t.EXTENT/i.tileSize;return{u_matrix:e,u_camera_to_center_distance:n.cameraToCenterDistance,u_extrude_scale:[n.pixelsToGLUnits[0]/r,n.pixelsToGLUnits[1]/r]}},En=(t,e,n=1)=>({u_matrix:t,u_color:e,u_overlay:0,u_overlay_scale:n}),Sn=(t,e,n,i)=>({u_matrix:t,u_extrude_scale:I(e,1,n),u_intensity:i}),An=(e,n,i,r)=>{const o=e.transform;return{u_matrix:Dn(e,n,i,r),u_ratio:1/I(n,1,o.zoom),u_device_pixel_ratio:t.exported.devicePixelRatio,u_units_to_pixels:[1/o.pixelsToGLUnits[0],1/o.pixelsToGLUnits[1]]}},kn=(e,n,i,r,o)=>t.extend(An(e,n,i,r),{u_image:0,u_image_height:o}),In=(e,n,i,r,o)=>{const a=e.transform,s=Pn(n,a);return{u_matrix:Dn(e,n,i,o),u_texsize:n.imageAtlasTexture.size,u_ratio:1/I(n,1,a.zoom),u_device_pixel_ratio:t.exported.devicePixelRatio,u_image:0,u_scale:[s,r.fromScale,r.toScale],u_fade:r.t,u_units_to_pixels:[1/a.pixelsToGLUnits[0],1/a.pixelsToGLUnits[1]]}},Mn=(e,n,i,r,o)=>{const a=Pn(n,e.transform);return t.extend(An(e,n,i,o),{u_texsize:n.lineAtlasTexture.size,u_scale:[a,r.fromScale,r.toScale],u_image:0,u_mix:r.t})};function Pn(t,e){return 1/I(t,1,e.tileZoom)}function Dn(t,e,n,i){return t.translatePosMatrix(i||e.tileID.projMatrix,e,n.paint.get("line-translate"),n.paint.get("line-translate-anchor"))}const zn=(t,e,n,i,r)=>{return{u_matrix:t,u_tl_parent:e,u_scale_parent:n,u_buffer_scale:1,u_fade_t:i.mix,u_opacity:i.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:(a=r.paint.get("raster-saturation"),a>0?1-1/(1.001-a):-a),u_contrast_factor:(o=r.paint.get("raster-contrast"),o>0?1/(1-o):1+o),u_spin_weights:On(r.paint.get("raster-hue-rotate"))};var o,a};function On(t){t*=Math.PI/180;const e=Math.sin(t),n=Math.cos(t);return[(2*n+1)/3,(-Math.sqrt(3)*e-n+1)/3,(Math.sqrt(3)*e-n+1)/3]}const Rn=(t,e,n,i,r,o,a,s,l,c)=>{const u=r.transform;return{u_is_size_zoom_constant:+("constant"===t||"source"===t),u_is_size_feature_constant:+("constant"===t||"camera"===t),u_size_t:e?e.uSizeT:0,u_size:e?e.uSize:0,u_camera_to_center_distance:u.cameraToCenterDistance,u_pitch:u.pitch/360*2*Math.PI,u_rotate_symbol:+n,u_aspect_ratio:u.width/u.height,u_fade_change:r.options.fadeDuration?r.symbolFadeChange:1,u_matrix:o,u_label_plane_matrix:a,u_coord_matrix:s,u_is_text:+l,u_pitch_with_map:+i,u_texsize:c,u_texture:0}},Ln=(e,n,i,r,o,a,s,l,c,u,h)=>{const{cameraToCenterDistance:d,_pitch:p}=o.transform;return t.extend(Rn(e,n,i,r,o,a,s,l,c,u),{u_gamma_scale:r?d*Math.cos(o.terrain?0:p):1,u_device_pixel_ratio:t.exported.devicePixelRatio,u_is_halo:+h})},Fn=(e,n,i,r,o,a,s,l,c,u)=>t.extend(Ln(e,n,i,r,o,a,s,l,!0,c,!0),{u_texsize_icon:u,u_texture_icon:1}),$n=(t,e,n)=>({u_matrix:t,u_opacity:e,u_color:n}),Bn=(e,n,i,r,o,a)=>t.extend(function(t,e,n,i){const r=n.imageManager.getPattern(t.from.toString()),o=n.imageManager.getPattern(t.to.toString()),{width:a,height:s}=n.imageManager.getPixelSize(),l=Math.pow(2,i.tileID.overscaledZ),c=i.tileSize*Math.pow(2,n.transform.tileZoom)/l,u=c*(i.tileID.canonical.x+i.tileID.wrap*l),h=c*i.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:e.t,u_pattern_size_a:r.displaySize,u_pattern_size_b:o.displaySize,u_scale_a:e.fromScale,u_scale_b:e.toScale,u_tile_units_to_pixels:1/I(i,1,n.transform.tileZoom),u_pixel_coord_upper:[u>>16,h>>16],u_pixel_coord_lower:[65535&u,65535&h]}}(r,a,i,o),{u_matrix:e,u_opacity:n}),Nn={fillExtrusion:(e,n)=>({u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_lightpos:new t.Uniform3f(e,n.u_lightpos),u_lightintensity:new t.Uniform1f(e,n.u_lightintensity),u_lightcolor:new t.Uniform3f(e,n.u_lightcolor),u_vertical_gradient:new t.Uniform1f(e,n.u_vertical_gradient),u_opacity:new t.Uniform1f(e,n.u_opacity)}),fillExtrusionPattern:(e,n)=>({u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_lightpos:new t.Uniform3f(e,n.u_lightpos),u_lightintensity:new t.Uniform1f(e,n.u_lightintensity),u_lightcolor:new t.Uniform3f(e,n.u_lightcolor),u_vertical_gradient:new t.Uniform1f(e,n.u_vertical_gradient),u_height_factor:new t.Uniform1f(e,n.u_height_factor),u_image:new t.Uniform1i(e,n.u_image),u_texsize:new t.Uniform2f(e,n.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,n.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,n.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,n.u_scale),u_fade:new t.Uniform1f(e,n.u_fade),u_opacity:new t.Uniform1f(e,n.u_opacity)}),fill:(e,n)=>({u_matrix:new t.UniformMatrix4f(e,n.u_matrix)}),fillPattern:(e,n)=>({u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_image:new t.Uniform1i(e,n.u_image),u_texsize:new t.Uniform2f(e,n.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,n.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,n.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,n.u_scale),u_fade:new t.Uniform1f(e,n.u_fade)}),fillOutline:(e,n)=>({u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_world:new t.Uniform2f(e,n.u_world)}),fillOutlinePattern:(e,n)=>({u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_world:new t.Uniform2f(e,n.u_world),u_image:new t.Uniform1i(e,n.u_image),u_texsize:new t.Uniform2f(e,n.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,n.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,n.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,n.u_scale),u_fade:new t.Uniform1f(e,n.u_fade)}),circle:(e,n)=>({u_camera_to_center_distance:new t.Uniform1f(e,n.u_camera_to_center_distance),u_extrude_scale:new t.Uniform2f(e,n.u_extrude_scale),u_device_pixel_ratio:new t.Uniform1f(e,n.u_device_pixel_ratio),u_matrix:new t.UniformMatrix4f(e,n.u_matrix)}),collisionBox:(e,n)=>({u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_camera_to_center_distance:new t.Uniform1f(e,n.u_camera_to_center_distance),u_extrude_scale:new t.Uniform2f(e,n.u_extrude_scale)}),collisionCircle:(e,n)=>({u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_inv_matrix:new t.UniformMatrix4f(e,n.u_inv_matrix),u_camera_to_center_distance:new t.Uniform1f(e,n.u_camera_to_center_distance),u_viewport_size:new t.Uniform2f(e,n.u_viewport_size)}),debug:(e,n)=>({u_color:new t.UniformColor(e,n.u_color),u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_overlay:new t.Uniform1i(e,n.u_overlay),u_overlay_scale:new t.Uniform1f(e,n.u_overlay_scale)}),clippingMask:(e,n)=>({u_matrix:new t.UniformMatrix4f(e,n.u_matrix)}),heatmap:(e,n)=>({u_extrude_scale:new t.Uniform1f(e,n.u_extrude_scale),u_intensity:new t.Uniform1f(e,n.u_intensity),u_matrix:new t.UniformMatrix4f(e,n.u_matrix)}),heatmapTexture:(e,n)=>({u_image:new t.Uniform1i(e,n.u_image),u_color_ramp:new t.Uniform1i(e,n.u_color_ramp),u_opacity:new t.Uniform1f(e,n.u_opacity)}),hillshade:(e,n)=>({u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_image:new t.Uniform1i(e,n.u_image),u_latrange:new t.Uniform2f(e,n.u_latrange),u_light:new t.Uniform2f(e,n.u_light),u_shadow:new t.UniformColor(e,n.u_shadow),u_highlight:new t.UniformColor(e,n.u_highlight),u_accent:new t.UniformColor(e,n.u_accent)}),hillshadePrepare:(e,n)=>({u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_image:new t.Uniform1i(e,n.u_image),u_dimension:new t.Uniform2f(e,n.u_dimension),u_zoom:new t.Uniform1f(e,n.u_zoom),u_unpack:new t.Uniform4f(e,n.u_unpack)}),line:(e,n)=>({u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_ratio:new t.Uniform1f(e,n.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,n.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,n.u_units_to_pixels)}),lineGradient:(e,n)=>({u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_ratio:new t.Uniform1f(e,n.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,n.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,n.u_units_to_pixels),u_image:new t.Uniform1i(e,n.u_image),u_image_height:new t.Uniform1f(e,n.u_image_height)}),linePattern:(e,n)=>({u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_texsize:new t.Uniform2f(e,n.u_texsize),u_ratio:new t.Uniform1f(e,n.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,n.u_device_pixel_ratio),u_image:new t.Uniform1i(e,n.u_image),u_units_to_pixels:new t.Uniform2f(e,n.u_units_to_pixels),u_scale:new t.Uniform3f(e,n.u_scale),u_fade:new t.Uniform1f(e,n.u_fade)}),lineSDF:(e,n)=>({u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_texsize:new t.Uniform2f(e,n.u_texsize),u_ratio:new t.Uniform1f(e,n.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,n.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,n.u_units_to_pixels),u_image:new t.Uniform1i(e,n.u_image),u_scale:new t.Uniform3f(e,n.u_scale),u_mix:new t.Uniform1f(e,n.u_mix)}),raster:(e,n)=>({u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_tl_parent:new t.Uniform2f(e,n.u_tl_parent),u_scale_parent:new t.Uniform1f(e,n.u_scale_parent),u_buffer_scale:new t.Uniform1f(e,n.u_buffer_scale),u_fade_t:new t.Uniform1f(e,n.u_fade_t),u_opacity:new t.Uniform1f(e,n.u_opacity),u_image0:new t.Uniform1i(e,n.u_image0),u_image1:new t.Uniform1i(e,n.u_image1),u_brightness_low:new t.Uniform1f(e,n.u_brightness_low),u_brightness_high:new t.Uniform1f(e,n.u_brightness_high),u_saturation_factor:new t.Uniform1f(e,n.u_saturation_factor),u_contrast_factor:new t.Uniform1f(e,n.u_contrast_factor),u_spin_weights:new t.Uniform3f(e,n.u_spin_weights)}),symbolIcon:(e,n)=>({u_is_size_zoom_constant:new t.Uniform1i(e,n.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,n.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,n.u_size_t),u_size:new t.Uniform1f(e,n.u_size),u_camera_to_center_distance:new t.Uniform1f(e,n.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,n.u_pitch),u_rotate_symbol:new t.Uniform1i(e,n.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,n.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,n.u_fade_change),u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,n.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,n.u_coord_matrix),u_is_text:new t.Uniform1i(e,n.u_is_text),u_pitch_with_map:new t.Uniform1i(e,n.u_pitch_with_map),u_texsize:new t.Uniform2f(e,n.u_texsize),u_texture:new t.Uniform1i(e,n.u_texture)}),symbolSDF:(e,n)=>({u_is_size_zoom_constant:new t.Uniform1i(e,n.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,n.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,n.u_size_t),u_size:new t.Uniform1f(e,n.u_size),u_camera_to_center_distance:new t.Uniform1f(e,n.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,n.u_pitch),u_rotate_symbol:new t.Uniform1i(e,n.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,n.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,n.u_fade_change),u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,n.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,n.u_coord_matrix),u_is_text:new t.Uniform1i(e,n.u_is_text),u_pitch_with_map:new t.Uniform1i(e,n.u_pitch_with_map),u_texsize:new t.Uniform2f(e,n.u_texsize),u_texture:new t.Uniform1i(e,n.u_texture),u_gamma_scale:new t.Uniform1f(e,n.u_gamma_scale),u_device_pixel_ratio:new t.Uniform1f(e,n.u_device_pixel_ratio),u_is_halo:new t.Uniform1i(e,n.u_is_halo)}),symbolTextAndIcon:(e,n)=>({u_is_size_zoom_constant:new t.Uniform1i(e,n.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,n.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,n.u_size_t),u_size:new t.Uniform1f(e,n.u_size),u_camera_to_center_distance:new t.Uniform1f(e,n.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,n.u_pitch),u_rotate_symbol:new t.Uniform1i(e,n.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,n.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,n.u_fade_change),u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,n.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,n.u_coord_matrix),u_is_text:new t.Uniform1i(e,n.u_is_text),u_pitch_with_map:new t.Uniform1i(e,n.u_pitch_with_map),u_texsize:new t.Uniform2f(e,n.u_texsize),u_texsize_icon:new t.Uniform2f(e,n.u_texsize_icon),u_texture:new t.Uniform1i(e,n.u_texture),u_texture_icon:new t.Uniform1i(e,n.u_texture_icon),u_gamma_scale:new t.Uniform1f(e,n.u_gamma_scale),u_device_pixel_ratio:new t.Uniform1f(e,n.u_device_pixel_ratio),u_is_halo:new t.Uniform1i(e,n.u_is_halo)}),background:(e,n)=>({u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_opacity:new t.Uniform1f(e,n.u_opacity),u_color:new t.UniformColor(e,n.u_color)}),backgroundPattern:(e,n)=>({u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_opacity:new t.Uniform1f(e,n.u_opacity),u_image:new t.Uniform1i(e,n.u_image),u_pattern_tl_a:new t.Uniform2f(e,n.u_pattern_tl_a),u_pattern_br_a:new t.Uniform2f(e,n.u_pattern_br_a),u_pattern_tl_b:new t.Uniform2f(e,n.u_pattern_tl_b),u_pattern_br_b:new t.Uniform2f(e,n.u_pattern_br_b),u_texsize:new t.Uniform2f(e,n.u_texsize),u_mix:new t.Uniform1f(e,n.u_mix),u_pattern_size_a:new t.Uniform2f(e,n.u_pattern_size_a),u_pattern_size_b:new t.Uniform2f(e,n.u_pattern_size_b),u_scale_a:new t.Uniform1f(e,n.u_scale_a),u_scale_b:new t.Uniform1f(e,n.u_scale_b),u_pixel_coord_upper:new t.Uniform2f(e,n.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,n.u_pixel_coord_lower),u_tile_units_to_pixels:new t.Uniform1f(e,n.u_tile_units_to_pixels)}),terrainRaster:nn,terrainDepth:nn,skybox:(e,n)=>({u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_sun_direction:new t.Uniform3f(e,n.u_sun_direction),u_cubemap:new t.Uniform1i(e,n.u_cubemap),u_opacity:new t.Uniform1f(e,n.u_opacity),u_temporal_offset:new t.Uniform1f(e,n.u_temporal_offset)}),skyboxGradient:(e,n)=>({u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_color_ramp:new t.Uniform1i(e,n.u_color_ramp),u_center_direction:new t.Uniform3f(e,n.u_center_direction),u_radius:new t.Uniform1f(e,n.u_radius),u_opacity:new t.Uniform1f(e,n.u_opacity),u_temporal_offset:new t.Uniform1f(e,n.u_temporal_offset)}),skyboxCapture:(e,n)=>({u_matrix_3f:new t.UniformMatrix3f(e,n.u_matrix_3f),u_sun_direction:new t.Uniform3f(e,n.u_sun_direction),u_sun_intensity:new t.Uniform1f(e,n.u_sun_intensity),u_color_tint_r:new t.Uniform4f(e,n.u_color_tint_r),u_color_tint_m:new t.Uniform4f(e,n.u_color_tint_m),u_luminance:new t.Uniform1f(e,n.u_luminance)})};let jn;function Un(e,n,i,r,o,a,s){const l=e.context,c=l.gl,u=e.useProgram("collisionBox"),h=[];let d=0,p=0;for(let f=0;f0){const n=t.create$1(),i=v;t.mul$1(n,_.placementInvProjMatrix,e.transform.glCoordMatrix),t.mul$1(n,n,_.placementViewportMatrix),h.push({circleArray:x,circleOffset:p,transform:i,invTransform:n}),d+=x.length/4,p=d}y&&(e.terrain&&e.terrain.setupElevationDraw(g,u),u.draw(l,c.LINES,t.DepthMode.disabled,t.StencilMode.disabled,e.colorModeForRenderPass(),t.CullFaceMode.disabled,Cn(v,e.transform,g),i.id,y.layoutVertexBuffer,y.indexBuffer,y.segments,null,e.transform.zoom,null,y.collisionVertexBuffer,y.collisionVertexBufferExt))}if(!s||!h.length)return;const f=e.useProgram("collisionCircle"),m=new t.StructArrayLayout2f1f2i16;m.resize(4*d),m._trim();let g=0;for(const t of h)for(let e=0;e=0&&(g[_.associatedIconIndex]={shiftedAnchor:A,angle:k})}else se(_.numGlyphs,f)}if(h){m.clear();const n=e.icon.placedSymbolArray;for(let e=0;et.getAtTileOffset(l,e.x,e.y):null)}const U=e.translatePosMatrix(l.projMatrix,r,a,s),V=v||o&&T||j?Vn:F,G=e.translatePosMatrix(B,r,a,s,!0),q=p&&0!==i.paint.get(o?"text-halo-width":"icon-halo-width").constantOr(1);let Z;Z=p?c.iconsInText?Fn(w.kind,k,y,_,e,U,V,G,M,O):Ln(w.kind,k,y,_,e,U,V,G,o,M,!0):Rn(w.kind,k,y,_,e,U,V,G,o,M);const H={program:A,buffers:h,uniformValues:Z,atlasTexture:P,atlasTextureIcon:R,atlasInterpolation:D,atlasInterpolationIcon:z,isSDF:p,hasHalo:q,tile:r,labelPlaneMatrixInv:$};if(x&&c.canOverlap){b=!0;const e=h.segments.get();for(const n of e)C.push({segments:new t.SegmentVector([n]),sortKey:n.sortKey,state:H})}else C.push({segments:h.segments,sortKey:0,state:H})}b&&C.sort(((t,e)=>t.sortKey-e.sortKey));for(const t of C){const n=t.state;if(e.terrain&&e.terrain.setupElevationDraw(n.tile,n.program,{useDepthForOcclusion:!0,labelPlaneMatrixInv:n.labelPlaneMatrixInv}),p.activeTexture.set(f.TEXTURE0),n.atlasTexture.bind(n.atlasInterpolation,f.CLAMP_TO_EDGE),n.atlasTextureIcon&&(p.activeTexture.set(f.TEXTURE1),n.atlasTextureIcon&&n.atlasTextureIcon.bind(n.atlasInterpolationIcon,f.CLAMP_TO_EDGE)),n.isSDF){const r=n.uniformValues;n.hasHalo&&(r.u_is_halo=1,Wn(n.buffers,t.segments,i,e,n.program,w,h,d,r)),r.u_is_halo=0}Wn(n.buffers,t.segments,i,e,n.program,w,h,d,n.uniformValues)}}function Wn(e,n,i,r,o,a,s,l,c){const u=r.context;o.draw(u,u.gl.TRIANGLES,a,s,l,t.CullFaceMode.disabled,c,i.id,e.layoutVertexBuffer,e.indexBuffer,n,i.paint,r.transform.zoom,e.programConfigurations.get(i.id),e.dynamicLayoutVertexBuffer,e.opacityVertexBuffer)}function Xn(e,n,i,r,o,a,s){const l=e.context.gl,c=i.paint.get("fill-pattern"),u=c&&c.constantOr(1),h=i.getCrossfadeParameters();let d,p,f,m,g;s?(p=u&&!i.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",d=l.LINES):(p=u?"fillPattern":"fill",d=l.TRIANGLES);for(const _ of r){const r=n.getTile(_);if(u&&!r.patternsLoaded())continue;const v=r.getBucket(i);if(!v)continue;e.prepareDrawTile(_);const y=v.programConfigurations.get(i.id),x=e.useProgram(p,y);u&&(e.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 t=r.imageAtlas,e=t.patternPositions[b.to.toString()],n=t.patternPositions[b.from.toString()];e&&n&&y.setConstantPatternPositions(e,n)}const w=e.translatePosMatrix(_.projMatrix,r,i.paint.get("fill-translate"),i.paint.get("fill-translate-anchor"));if(s){m=v.indexBuffer2,g=v.segments2;const t=e.terrain&&e.terrain.renderingToTexture?e.terrain.drapeBufferSize:[l.drawingBufferWidth,l.drawingBufferHeight];f="fillOutlinePattern"===p&&u?bn(w,e,h,r,t):xn(w,t)}else m=v.indexBuffer,g=v.segments,f=u?yn(w,e,h,r):vn(w);e.prepareDrawProgram(e.context,x,_.toUnwrapped()),x.draw(e.context,d,o,e.stencilModeForClipping(_),a,t.CullFaceMode.disabled,f,i.id,v.layoutVertexBuffer,m,g,i.paint,e.transform.zoom,y)}}function Kn(e,n,i,r,o,a,s){const l=e.context,c=l.gl,u=i.paint.get("fill-extrusion-pattern"),h=u.constantOr(1),d=i.getCrossfadeParameters(),p=i.paint.get("fill-extrusion-opacity");for(const f of r){const r=n.getTile(f),m=r.getBucket(i);if(!m)continue;const g=m.programConfigurations.get(i.id),_=e.useProgram(h?"fillExtrusionPattern":"fillExtrusion",g);if(e.terrain){const t=e.terrain;if(!m.enableTerrain)continue;if(t.setupElevationDraw(r,_,{useMeterToDem:!0}),Yn(l,n,f,m,i,t),!m.centroidVertexBuffer){const t=_.attributes.a_centroid_pos;void 0!==t&&c.vertexAttrib2f(t,0,0)}}h&&(e.context.activeTexture.set(c.TEXTURE0),r.imageAtlasTexture.bind(c.LINEAR,c.CLAMP_TO_EDGE),g.updatePaintBuffers(d));const v=u.constantOr(null);if(v&&r.imageAtlas){const t=r.imageAtlas,e=t.patternPositions[v.to.toString()],n=t.patternPositions[v.from.toString()];e&&n&&g.setConstantPatternPositions(e,n)}const y=e.translatePosMatrix(f.projMatrix,r,i.paint.get("fill-extrusion-translate"),i.paint.get("fill-extrusion-translate-anchor")),x=i.paint.get("fill-extrusion-vertical-gradient"),b=h?_n(y,e,x,p,f,d,r):gn(y,e,x,p);e.prepareDrawProgram(l,_,f.toUnwrapped()),_.draw(l,l.gl.TRIANGLES,o,a,s,t.CullFaceMode.backCCW,b,i.id,m.layoutVertexBuffer,m.indexBuffer,m.segments,i.paint,e.transform.zoom,g,e.terrain?m.centroidVertexBuffer:null)}}function Yn(e,n,i,r,o,a){const s=[e=>{let n=e.canonical.x-1,i=e.wrap;return n<0&&(n=(1<{let n=e.canonical.x+1,i=e.wrap;return n===1<new t.OverscaledTileID(e.overscaledZ,e.wrap,e.canonical.z,e.canonical.x,(0===e.canonical.y?1<new t.OverscaledTileID(e.overscaledZ,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y===(1<{const e=n.getSource().maxzoom,i=t=>{const e=n.getTileByID(t);if(e&&e.hasData())return e.getBucket(o)};let r,a,s;return(t.overscaledZ===t.canonical.z||t.overscaledZ>=e)&&(r=i(t.key)),t.overscaledZ>=e&&(a=i(t.calculateScaledKey(t.overscaledZ+1))),t.overscaledZ>e&&(s=i(t.calculateScaledKey(t.overscaledZ-1))),r||a||s},c=[0,0,0],u=(e,n)=>(c[0]=Math.min(e.min.y,n.min.y),c[1]=Math.max(e.max.y,n.max.y),c[2]=t.EXTENT-n.min.x>e.max.x?n.min.x-t.EXTENT:e.max.x,c),h=(e,n)=>(c[0]=Math.min(e.min.x,n.min.x),c[1]=Math.max(e.max.x,n.max.x),c[2]=t.EXTENT-n.min.y>e.max.y?n.min.y-t.EXTENT:e.max.y,c),d=[(t,e)=>u(t,e),(t,e)=>u(e,t),(t,e)=>h(t,e),(t,e)=>h(e,t)],p=new t.pointGeometry(0,0);let f,m,g;const _=(e,n,r,o,s)=>{const l=[[o?r:e,o?e:r,0],[o?r:n,o?n:r,0]],c=s<0?t.EXTENT+s:s,u=[o?c:(e+n)/2,o?(e+n)/2:c,0];return 0===r&&s<0||0!==r&&s>0?a.getForTilePoints(g,[u],!0,m):l.push(u),a.getForTilePoints(i,l,!0,f),Math.max(l[0][2],l[1][2],u[2])/a.exaggeration()};for(let e=0;e<4;e++){const n=r.borders[e];if(0===n.length&&(r.borderDone[e]=!0),r.borderDone[e])continue;const o=g=s[e](i),c=l(o);if(!c||!c.enableTerrain)continue;if(m=a.findDEMTileFor(o),!m||!m.dem)continue;if(!f){const t=a.findDEMTileFor(i);if(!t||!t.dem)return;f=t}const u=(e<2?1:5)-e,h=c.borders[u];let v=0;for(let i=0;ia[0]+3));)c.borderDone[u]||c.encodeCentroid(void 0,s,!1),v++;if(s&&va[1]-3)&&(i++,++v!==h.length);)s=c.featuresOnBorder[h[v]];if(s=c.featuresOnBorder[h[n]],o.intersectsCount()>1||s.intersectsCount()>1||1!==i){1!==i&&(v=n),r.encodeCentroid(void 0,o,!1),c.borderDone[u]||c.encodeCentroid(void 0,s,!1);continue}const l=d[e](o,s),f=e%2?t.EXTENT-1:0;p.x=_(l[0],Math.min(t.EXTENT-1,l[1]),f,e<2,l[2]),p.y=0,r.encodeCentroid(p,o,!1),c.borderDone[u]||c.encodeCentroid(p,s,!1)}else r.encodeCentroid(void 0,o,!1)}r.borderDone[e]=r.needsCentroidUpdate=!0,c.borderDone[u]||(c.borderDone[u]=c.needsCentroidUpdate=!0)}(r.needsCentroidUpdate||!r.centroidVertexBuffer&&0!==r.centroidVertexArray.length)&&r.uploadCentroid(e)}const Jn=new t.Color(1,0,0,1),Qn=new t.Color(0,1,0,1),ti=new t.Color(0,0,1,1),ei=new t.Color(1,0,1,1),ni=new t.Color(0,1,1,1);function ii(t,e,n,i){oi(t,0,e+n/2,t.transform.width,n,i)}function ri(t,e,n,i){oi(t,e-n/2,0,n,t.transform.height,i)}function oi(e,n,i,r,o,a){const s=e.context,l=s.gl;l.enable(l.SCISSOR_TEST),l.scissor(n*t.exported.devicePixelRatio,i*t.exported.devicePixelRatio,r*t.exported.devicePixelRatio,o*t.exported.devicePixelRatio),s.clear({color:a}),l.disable(l.SCISSOR_TEST)}function ai(e,n,i){const r=e.context,o=r.gl,a=i.projMatrix,s=e.useProgram("debug"),l=n.getTileByID(i.key);e.terrain&&e.terrain.setupElevationDraw(l,s);const c=t.DepthMode.disabled,u=t.StencilMode.disabled,h=e.colorModeForRenderPass(),d="$debug";r.activeTexture.set(o.TEXTURE0),e.emptyTexture.bind(o.LINEAR,o.CLAMP_TO_EDGE),s.draw(r,o.LINE_STRIP,c,u,h,t.CullFaceMode.disabled,En(a,t.Color.red),d,e.debugBuffer,e.tileBorderIndexBuffer,e.debugSegments);const p=l.latestRawTileData,f=Math.floor((p&&p.byteLength||0)/1024),m=n.getTile(i).tileSize,g=512/Math.min(m,512)*(i.overscaledZ/e.transform.zoom)*.5;let _=i.canonical.toString();i.overscaledZ!==i.canonical.z&&(_+=` => ${i.overscaledZ}`),function(t,e){t.initDebugOverlayCanvas();const n=t.debugOverlayCanvas,i=t.context.gl,r=t.debugOverlayCanvas.getContext("2d");r.clearRect(0,0,n.width,n.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(e,5,5),r.strokeText(e,5,5),t.debugOverlayTexture.update(n),t.debugOverlayTexture.bind(i.LINEAR,i.CLAMP_TO_EDGE)}(e,`${_} ${f}kb`),s.draw(r,o.TRIANGLES,c,u,t.ColorMode.alphaBlended,t.CullFaceMode.disabled,En(a,t.Color.transparent,g),d,e.debugBuffer,e.quadTriangleIndexBuffer,e.debugSegments)}const si=t.createLayout([{name:"a_pos_3f",components:3,type:"Float32"}]),{members:li}=si;function ci(t,e,n,i){t.emplaceBack(e,n,i)}class ui{constructor(e){this.vertexArray=new t.StructArrayLayout3f12,this.indices=new t.StructArrayLayout3ui6,ci(this.vertexArray,-1,-1,1),ci(this.vertexArray,1,-1,1),ci(this.vertexArray,-1,1,1),ci(this.vertexArray,1,1,1),ci(this.vertexArray,-1,-1,-1),ci(this.vertexArray,1,-1,-1),ci(this.vertexArray,-1,1,-1),ci(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=e.createVertexBuffer(this.vertexArray,li),this.indexBuffer=e.createIndexBuffer(this.indices),this.segment=t.SegmentVector.simpleSegment(0,0,36,12)}}function hi(e,n,i,r,o,a){const s=e.gl,l=n.paint.get("sky-atmosphere-color"),c=n.paint.get("sky-atmosphere-halo-color"),u=n.paint.get("sky-atmosphere-sun-intensity"),h=((t,e,n,i,r)=>({u_matrix_3f:t,u_sun_direction:e,u_sun_intensity:n,u_color_tint_r:[i.r,i.g,i.b,i.a],u_color_tint_m:[r.r,r.g,r.b,r.a],u_luminance:5e-5}))(t.fromMat4([],r),o,u,l,c);s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.TEXTURE_CUBE_MAP_POSITIVE_X+a,n.skyboxTexture,0),i.draw(e,s.TRIANGLES,t.DepthMode.disabled,t.StencilMode.disabled,t.ColorMode.unblended,t.CullFaceMode.frontCW,h,"skyboxCapture",n.skyboxGeometry.vertexBuffer,n.skyboxGeometry.indexBuffer,n.skyboxGeometry.segment)}const di={symbol:function(e,n,i,r,o){if("translucent"!==e.renderPass)return;const a=t.StencilMode.disabled,s=e.colorModeForRenderPass();i.layout.get("text-variable-anchor")&&function(e,n,i,r,o,a,s){const l=n.transform,c="map"===o,u="map"===a;for(const o of e){const e=r.getTile(o),a=e.getBucket(i);if(!a||!a.text||!a.text.segments.get().length)continue;const h=t.evaluateSizeForZoom(a.textSizeData,l.zoom),d=I(e,1,n.transform.zoom),p=Xt(o.projMatrix,u,c,n.transform,d),f="none"!==i.layout.get("icon-text-fit")&&a.hasIconData();if(h){const n=Math.pow(2,l.zoom-e.tileID.overscaledZ),i=l.elevation;qn(a,c,u,s,t.symbolSize,l,p,o.projMatrix,n,h,f,i?t=>i.getAtTileOffset(o,t.x,t.y):t=>0)}}}(r,e,i,n,i.layout.get("text-rotation-alignment"),i.layout.get("text-pitch-alignment"),o),0!==i.paint.get("icon-opacity").constantOr(1)&&Hn(e,n,i,r,!1,i.paint.get("icon-translate"),i.paint.get("icon-translate-anchor"),i.layout.get("icon-rotation-alignment"),i.layout.get("icon-pitch-alignment"),i.layout.get("icon-keep-upright"),a,s),0!==i.paint.get("text-opacity").constantOr(1)&&Hn(e,n,i,r,!0,i.paint.get("text-translate"),i.paint.get("text-translate-anchor"),i.layout.get("text-rotation-alignment"),i.layout.get("text-pitch-alignment"),i.layout.get("text-keep-upright"),a,s),n.map.showCollisionBoxes&&(Un(e,n,i,r,i.paint.get("text-translate"),i.paint.get("text-translate-anchor"),!0),Un(e,n,i,r,i.paint.get("icon-translate"),i.paint.get("icon-translate-anchor"),!1))},circle:function(e,n,i,r){if("translucent"!==e.renderPass)return;const o=i.paint.get("circle-opacity"),a=i.paint.get("circle-stroke-width"),s=i.paint.get("circle-stroke-opacity"),l=void 0!==i.layout.get("circle-sort-key").constantOr(1);if(0===o.constantOr(1)&&(0===a.constantOr(1)||0===s.constantOr(1)))return;const c=e.context,u=c.gl,h=e.depthModeForSublayer(0,t.DepthMode.ReadOnly),d=t.StencilMode.disabled,p=e.colorModeForRenderPass(),f=[];for(let o=0;ot.sortKey-e.sortKey));for(const n of f){const{programConfiguration:r,program:o,layoutVertexBuffer:a,indexBuffer:s,uniformValues:l,tile:f}=n.state,m=n.segments;e.terrain&&e.terrain.setupElevationDraw(f,o,{useDepthForOcclusion:!0}),e.prepareDrawProgram(c,o,f.tileID.toUnwrapped()),o.draw(c,u.TRIANGLES,h,d,p,t.CullFaceMode.disabled,l,i.id,a,s,m,i.paint,e.transform.zoom,r)}},heatmap:function(e,n,i,r){if(0!==i.paint.get("heatmap-opacity"))if("offscreen"===e.renderPass){const o=e.context,a=o.gl,s=t.StencilMode.disabled,l=new t.ColorMode([a.ONE,a.ONE],t.Color.transparent,[!0,!0,!0,!0]);!function(t,e,n){const i=t.gl;t.activeTexture.set(i.TEXTURE1),t.viewport.set([0,0,e.width/4,e.height/4]);let r=n.heatmapFbo;if(r)i.bindTexture(i.TEXTURE_2D,r.colorAttachment.get()),t.bindFramebuffer.set(r.framebuffer);else{const o=i.createTexture();i.bindTexture(i.TEXTURE_2D,o),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),r=n.heatmapFbo=t.createFramebuffer(e.width/4,e.height/4,!1),function(t,e,n,i){const r=t.gl;r.texImage2D(r.TEXTURE_2D,0,r.RGBA,e.width/4,e.height/4,0,r.RGBA,t.extRenderToTextureHalfFloat?t.extTextureHalfFloat.HALF_FLOAT_OES:r.UNSIGNED_BYTE,null),i.colorAttachment.set(n)}(t,e,o,r)}}(o,e,i),o.clear({color:t.Color.transparent});for(let c=0;c({u_image:0,u_color_ramp:1,u_opacity:e.paint.get("heatmap-opacity")}))(0,n),n.id,e.viewportBuffer,e.quadTriangleIndexBuffer,e.viewportSegments,n.paint,e.transform.zoom)}(e,i))},line:function(e,n,i,r){if("translucent"!==e.renderPass)return;const o=i.paint.get("line-opacity"),a=i.paint.get("line-width");if(0===o.constantOr(1)||0===a.constantOr(1))return;const s=e.depthModeForSublayer(0,t.DepthMode.ReadOnly),l=e.colorModeForRenderPass(),c=i.paint.get("line-dasharray"),u=c.constantOr(1),h=i.layout.get("line-cap"),d=i.paint.get("line-pattern"),p=d.constantOr(1),f=i.paint.get("line-gradient"),m=i.getCrossfadeParameters(),g=p?"linePattern":u?"lineSDF":f?"lineGradient":"line",_=e.context,v=_.gl;for(const o of r){const r=n.getTile(o);if(p&&!r.patternsLoaded())continue;const a=r.getBucket(i);if(!a)continue;e.prepareDrawTile(o);const y=a.programConfigurations.get(i.id),x=e.useProgram(g,y),b=d.constantOr(null);if(b&&r.imageAtlas){const t=r.imageAtlas,e=t.patternPositions[b.to.toString()],n=t.patternPositions[b.from.toString()];e&&n&&y.setConstantPatternPositions(e,n)}const w=c.constantOr(null),T=h.constantOr(null);if(!p&&w&&T&&r.lineAtlas){const t=r.lineAtlas,e=t.getDash(w.to,T),n=t.getDash(w.from,T);e&&n&&y.setConstantPatternPositions(e,n)}const C=e.terrain?o.projMatrix:null,E=p?In(e,r,i,m,C):u?Mn(e,r,i,m,C):f?kn(e,r,i,C,a.lineClipsArray.length):An(e,r,i,C);if(p)_.activeTexture.set(v.TEXTURE0),r.imageAtlasTexture.bind(v.LINEAR,v.CLAMP_TO_EDGE),y.updatePaintBuffers(m);else if(u)_.activeTexture.set(v.TEXTURE0),r.lineAtlasTexture.bind(v.LINEAR,v.REPEAT),y.updatePaintBuffers(m);else if(f){const r=a.gradients[i.id];let s=r.texture;if(i.gradientVersion!==r.version){let l=256;if(i.stepInterpolant){const i=n.getSource().maxzoom,r=o.canonical.z===i?Math.ceil(1<({u_matrix:t,u_sun_direction:e,u_cubemap:0,u_opacity:i,u_temporal_offset:r}))(l.skyboxMatrix,n.getCenter(e,!1),0,r,o);e.prepareDrawProgram(a,c),c.draw(a,s.TRIANGLES,i,t.StencilMode.disabled,e.colorModeForRenderPass(),t.CullFaceMode.backCW,u,"skybox",n.skyboxGeometry.vertexBuffer,n.skyboxGeometry.indexBuffer,n.skyboxGeometry.segment)}(e,i,s,r,l):"gradient"===a&&"sky"===e.renderPass&&function(e,n,i,r,o){const a=e.context,s=a.gl,l=e.transform,c=e.useProgram("skyboxGradient");n.skyboxGeometry||(n.skyboxGeometry=new ui(a)),a.activeTexture.set(s.TEXTURE0);let u=n.colorRampTexture;u||(u=n.colorRampTexture=new t.Texture(a,n.colorRamp,s.RGBA)),u.bind(s.LINEAR,s.CLAMP_TO_EDGE);const h=((e,n,i,r,o)=>({u_matrix:e,u_color_ramp:0,u_center_direction:n,u_radius:t.degToRad(i),u_opacity:r,u_temporal_offset:o}))(l.skyboxMatrix,n.getCenter(e,!1),n.paint.get("sky-gradient-radius"),r,o);e.prepareDrawProgram(a,c),c.draw(a,s.TRIANGLES,i,t.StencilMode.disabled,e.colorModeForRenderPass(),t.CullFaceMode.backCW,h,"skyboxGradient",n.skyboxGeometry.vertexBuffer,n.skyboxGeometry.indexBuffer,n.skyboxGeometry.segment)}(e,i,s,r,l)},debug:function(t,e,n){for(let i=0;ii)return void(this.transform.fogCullDistSq=null);const r=n+.78*(i-n);this.transform.fogCullDistSq=r*r}get terrain(){return this._terrain&&this._terrain.enabled?this._terrain:null}resize(e,n){if(this.width=e*t.exported.devicePixelRatio,this.height=n*t.exported.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const t of this.style.order)this.style._layers[t].resize()}setup(){const e=this.context,n=new t.StructArrayLayout2i4;n.emplaceBack(0,0),n.emplaceBack(t.EXTENT,0),n.emplaceBack(0,t.EXTENT),n.emplaceBack(t.EXTENT,t.EXTENT),this.tileExtentBuffer=e.createVertexBuffer(n,t.posAttributes.members),this.tileExtentSegments=t.SegmentVector.simpleSegment(0,0,4,2);const i=new t.StructArrayLayout2i4;i.emplaceBack(0,0),i.emplaceBack(t.EXTENT,0),i.emplaceBack(0,t.EXTENT),i.emplaceBack(t.EXTENT,t.EXTENT),this.debugBuffer=e.createVertexBuffer(i,t.posAttributes.members),this.debugSegments=t.SegmentVector.simpleSegment(0,0,4,5);const r=new t.StructArrayLayout4i8;r.emplaceBack(0,0,0,0),r.emplaceBack(t.EXTENT,0,t.EXTENT,0),r.emplaceBack(0,t.EXTENT,0,t.EXTENT),r.emplaceBack(t.EXTENT,t.EXTENT,t.EXTENT,t.EXTENT),this.rasterBoundsBuffer=e.createVertexBuffer(r,Tt.members),this.rasterBoundsSegments=t.SegmentVector.simpleSegment(0,0,4,2);const o=new t.StructArrayLayout2i4;o.emplaceBack(-1,-1),o.emplaceBack(1,-1),o.emplaceBack(-1,1),o.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(o,t.posAttributes.members),this.viewportSegments=t.SegmentVector.simpleSegment(0,0,4,2);const a=new t.StructArrayLayout1ui2;a.emplaceBack(0),a.emplaceBack(1),a.emplaceBack(3),a.emplaceBack(2),a.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(a);const s=new t.StructArrayLayout3ui6;s.emplaceBack(0,1,2),s.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(s),this.emptyTexture=new t.Texture(e,{width:1,height:1,data:new Uint8Array([0,0,0,0])},e.gl.RGBA),this.identityMat=t.create$1();const l=this.context.gl;this.stencilClearMode=new t.StencilMode({func:l.ALWAYS,mask:0},0,255,l.ZERO,l.ZERO,l.ZERO),this.loadTimeStamps.push(t.window.performance.now())}clearStencil(){const e=this.context,n=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0,this.useProgram("clippingMask").draw(e,n.TRIANGLES,t.DepthMode.disabled,this.stencilClearMode,t.ColorMode.disabled,t.CullFaceMode.disabled,ln(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(e,n,i){if(!(n&&this.currentStencilSource!==n.id&&e.isTileClipped()&&i&&i.length))return;this.currentStencilSource=n.id;const r=this.context,o=r.gl;this.nextStencilID+i.length>256&&this.clearStencil(),r.setColorMode(t.ColorMode.disabled),r.setDepthMode(t.DepthMode.disabled);const a=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const e of i){const n=this._tileClippingMaskIDs[e.key]=this.nextStencilID++;a.draw(r,o.TRIANGLES,t.DepthMode.disabled,new t.StencilMode({func:o.ALWAYS,mask:0},n,255,o.KEEP,o.KEEP,o.REPLACE),t.ColorMode.disabled,t.CullFaceMode.disabled,ln(e.projMatrix),"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const e=this.nextStencilID++,n=this.context.gl;return new t.StencilMode({func:n.NOTEQUAL,mask:255},e,255,n.KEEP,n.KEEP,n.REPLACE)}stencilModeForClipping(e){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(e);const n=this.context.gl;return new t.StencilMode({func:n.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,n.KEEP,n.KEEP,n.REPLACE)}stencilConfigForOverlap(e){const n=this.context.gl,i=e.sort(((t,e)=>e.overscaledZ-t.overscaledZ)),r=i[i.length-1].overscaledZ,o=i[0].overscaledZ-r+1;if(o>1){this.currentStencilSource=void 0,this.nextStencilID+o>256&&this.clearStencil();const e={};for(let i=0;i=0;this.currentLayer--){const t=this.style._layers[i[this.currentLayer]],n=e._getLayerSourceCache(t);if(t.isSky())continue;const r=n?a[n.id]:void 0;this._renderTileClippingMasks(t,n,r),this.renderLayer(this,n,t,r)}if(this.renderPass="sky",this.transform.isHorizonVisible())for(this.currentLayer=0;this.currentLayer{const i=e._getLayerSourceCache(t);i&&!t.isHidden(this.transform.zoom)&&(!n||n.getSource().maxzoom0?e.pop():null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;const e=this.imageManager.getPattern(t.from.toString()),n=this.imageManager.getPattern(t.to.toString());return!e||!n}currentGlobalDefines(){const t=this.terrain&&this.terrain.renderingToTexture,e=this.style&&this.style.fog,n=[];return this.terrain&&!this.terrain.renderingToTexture&&n.push("TERRAIN"),e&&!t&&0!==e.getOpacity(this.transform.pitch)&&n.push("FOG"),t&&n.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&n.push("OVERDRAW_INSPECTOR"),n}useProgram(t,e,n){this.cache=this.cache||{};const i=n||[],r=this.currentGlobalDefines().concat(i),o=fn.cacheKey(t,r,e);return this.cache[o]||(this.cache[o]=new fn(this.context,t,Xe[t],e,Nn[t],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 t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=t.window.document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new t.Texture(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this._terrain&&this._terrain.destroy(),this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}prepareDrawTile(t){this.terrain&&this.terrain.prepareDrawTile(t)}prepareDrawProgram(t,e,n){if(this.terrain&&this.terrain.renderingToTexture)return;const i=this.style.fog;if(i){const r=i.getOpacity(this.transform.pitch);0!==r&&e.setFogUniformValues(t,((t,e,n,i)=>{const r=e.properties.get("color"),o=t.frameCounter/1e3%1,a=[r.r/r.a,r.g/r.a,r.b/r.a,i];return{u_fog_matrix:n?t.transform.calculateFogTileMatrix(n):t.identityMat,u_fog_range:e.getFovAdjustedRange(t.transform._fov),u_fog_color:a,u_fog_horizon_blend:e.properties.get("horizon-blend"),u_fog_temporal_offset:o}})(this,i,n,r))}}setTileLoadedFlag(t){this.tileLoaded=t}saveCanvasCopy(){this.frameCopies.push(this.canvasCopy()),this.tileLoaded=!1}canvasCopy(){const t=this.context.gl,e=t.createTexture();return t.bindTexture(t.TEXTURE_2D,e),t.copyTexImage2D(t.TEXTURE_2D,0,t.RGBA,0,0,t.drawingBufferWidth,t.drawingBufferHeight,0),e}getCanvasCopiesAndTimestamps(){return{canvasCopies:this.frameCopies,timeStamps:this.loadTimeStamps}}averageElevationNeedsEasing(){if(!this.transform._elevation)return!1;const t=this.style&&this.style.fog;return!!t&&0!==t.getOpacity(this.transform.pitch)}}class fi{constructor(t=0,e=0,n=0,i=0){if(isNaN(t)||t<0||isNaN(e)||e<0||isNaN(n)||n<0||isNaN(i)||i<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=e,this.left=n,this.right=i}interpolate(e,n,i){return null!=n.top&&null!=e.top&&(this.top=t.number(e.top,n.top,i)),null!=n.bottom&&null!=e.bottom&&(this.bottom=t.number(e.bottom,n.bottom,i)),null!=n.left&&null!=e.left&&(this.left=t.number(e.left,n.left,i)),null!=n.right&&null!=e.right&&(this.right=t.number(e.right,n.right,i)),this}getCenter(e,n){const i=t.clamp((this.left+e-this.right)/2,0,e),r=t.clamp((this.top+n-this.bottom)/2,0,n);return new t.pointGeometry(i,r)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new fi(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function mi(t,e){return[t[4*e],t[4*e+1],t[4*e+2],t[4*e+3]]}function gi(t,e,n){t[4*e+0]=n[0],t[4*e+1]=n[1],t[4*e+2]=n[2],t[4*e+3]=n[3]}function _i(e,n){const i=mi(e,3);t.fromQuat(e,n),gi(e,3,i)}function vi(t,e){gi(t,3,[e[0],e[1],e[2],1])}function yi(e,n){const i=t.identity$1([]);return t.rotateZ$1(i,i,-n),t.rotateX$1(i,i,-e),i}function xi(e,n){const i=[e[0],e[1],0],r=[n[0],n[1],0];if(t.length(i)>=1e-15){const e=t.normalize([],i);t.scale(r,e,t.dot(r,e)),n[0]=r[0],n[1]=r[1]}const o=t.cross([],n,e);if(t.len(o)<1e-15)return null;const a=Math.atan2(-o[1],o[0]);return yi(Math.atan2(Math.sqrt(e[0]*e[0]+e[1]*e[1]),-e[2]),a)}class bi{constructor(t,e){this.position=t,this.orientation=e}get position(){return this._position}set position(e){this._position=this._renderWorldCopies?function(e){if(!e)return;const n=Array.isArray(e)?new t.MercatorCoordinate(e[0],e[1],e[2]):e;return n.x=t.wrap(n.x,0,1),n}(e):e}lookAtPoint(e,n){if(this.orientation=null,!this.position)return;const i=this._elevation?this._elevation.getAtPointOrZero(t.MercatorCoordinate.fromLngLat(e)):0,r=this.position,o=t.MercatorCoordinate.fromLngLat(e,i),a=[o.x-r.x,o.y-r.y,o.z-r.z];n||(n=[0,0,1]),n[2]=Math.abs(n[2]),this.orientation=xi(a,n)}setPitchBearing(e,n){this.orientation=yi(t.degToRad(e),t.degToRad(-n))}}class wi{constructor(e,n){this._transform=t.identity([]),this._orientation=t.identity$1([]),n&&(this._orientation=n,_i(this._transform,this._orientation)),e&&vi(this._transform,e)}get mercatorPosition(){const e=this.position;return new t.MercatorCoordinate(e[0],e[1],e[2])}get position(){const t=mi(this._transform,3);return[t[0],t[1],t[2]]}set position(t){vi(this._transform,t)}get orientation(){return this._orientation}set orientation(t){this._orientation=t,_i(this._transform,this._orientation)}getPitchBearing(){const t=this.forward(),e=this.right();return{bearing:Math.atan2(-e[1],e[0]),pitch:Math.atan2(Math.sqrt(t[0]*t[0]+t[1]*t[1]),-t[2])}}setPitchBearing(t,e){this._orientation=yi(t,e),_i(this._transform,this._orientation)}forward(){const t=mi(this._transform,2);return[-t[0],-t[1],-t[2]]}up(){const t=mi(this._transform,1);return[-t[0],-t[1],-t[2]]}right(){const t=mi(this._transform,0);return[t[0],t[1],t[2]]}getCameraToWorld(e,n){const i=new Float64Array(16);return t.invert(i,this.getWorldToCamera(e,n)),i}getWorldToCameraPosition(e,n,i){const r=this.position;t.scale(r,r,-e);const o=new Float64Array(16);return t.fromScaling(o,[i,i,i]),t.translate(o,o,r),o[10]*=n,o}getWorldToCamera(e,n){const i=new Float64Array(16),r=new Float64Array(4),o=this.position;return t.conjugate(r,this._orientation),t.scale(o,o,-e),t.fromQuat(i,r),t.translate(i,i,o),i[1]*=-1,i[5]*=-1,i[9]*=-1,i[13]*=-1,i[8]*=n,i[9]*=n,i[10]*=n,i[11]*=n,i}getCameraToClipPerspective(e,n,i,r){const o=new Float64Array(16);return t.perspective(o,e,n,i,r),o}getDistanceToElevation(e){const n=0===e?0:t.mercatorZfromAltitude(e,this.position[1]),i=this.forward();return(n-this.position[2])/i[2]}clone(){return new wi([...this.position],[...this.orientation])}}class Ti{constructor(e,n,i,r,o){this.tileSize=512,this.maxValidLatitude=85.051129,this._renderWorldCopies=void 0===o||o,this._minZoom=e||0,this._maxZoom=n||22,this._minPitch=null==i?0:i,this._maxPitch=null==r?60:r,this.setMaxBounds(),this.width=0,this.height=0,this._center=new t.LngLat(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new fi,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._camera=new wi,this._centerAltitude=0,this._averageElevation=0,this.cameraElevationReference="ground",this._horizonShift=.1}clone(){const t=new Ti(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return t._elevation=this._elevation,t._centerAltitude=this._centerAltitude,t.tileSize=this.tileSize,t.latRange=this.latRange,t.width=this.width,t.height=this.height,t.cameraElevationReference=this.cameraElevationReference,t._center=this._center,t._setZoom(this.zoom),t._cameraZoom=this._cameraZoom,t.angle=this.angle,t._fov=this._fov,t._pitch=this._pitch,t._averageElevation=this._averageElevation,t._unmodified=this._unmodified,t._edgeInsets=this._edgeInsets.clone(),t._camera=this._camera.clone(),t._calcMatrices(),t.freezeTileCoverage=this.freezeTileCoverage,t}get elevation(){return this._elevation}set elevation(t){this._elevation!==t&&(this._elevation=t,t?this._updateCenterElevation()&&this._updateCameraOnTerrain():(this._cameraZoom=null,this._centerAltitude=0),this._calcMatrices())}updateElevation(t){this._terrainEnabled()&&null==this._cameraZoom&&this._updateCenterElevation()&&this._updateCameraOnTerrain(),t&&this._constrainCameraAltitude(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))}get maxZoom(){return this._maxZoom}set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))}get minPitch(){return this._minPitch}set minPitch(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))}get maxPitch(){return this._maxPitch}set maxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(t){void 0===t?t=!0:null===t&&(t=!1),this._renderWorldCopies=t}get worldSize(){return this.tileSize*this.scale}get cameraWorldSize(){const t=Math.max(this._camera.getDistanceToElevation(this._averageElevation),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(t))}get pixelsPerMeter(){return t.mercatorZfromAltitude(1,this.center.lat)*this.worldSize}get cameraPixelsPerMeter(){return t.mercatorZfromAltitude(1,this.center.lat)*this.cameraWorldSize}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new t.pointGeometry(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(e){const n=-t.wrap(e,-180,180)*Math.PI/180;var i;this.angle!==n&&(this._unmodified=!1,this.angle=n,this._calcMatrices(),this.rotationMatrix=(i=new t.ARRAY_TYPE(4),t.ARRAY_TYPE!=Float32Array&&(i[1]=0,i[2]=0),i[0]=1,i[3]=1,i),function(t,e,n){var i=e[0],r=e[1],o=e[2],a=e[3],s=Math.sin(n),l=Math.cos(n);t[0]=i*l+o*s,t[1]=r*l+a*s,t[2]=i*-s+o*l,t[3]=r*-s+a*l}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(e){const n=t.clamp(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==n&&(this._unmodified=!1,this._pitch=n,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=t/180*Math.PI,this._calcMatrices())}get averageElevation(){return this._averageElevation}set averageElevation(t){this._averageElevation=t,this._calcFogMatrices()}get zoom(){return this._zoom}set zoom(t){const e=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==e&&(this._unmodified=!1,this._setZoom(e),this._terrainEnabled()&&this._updateCameraOnTerrain(),this._constrain(),this._calcMatrices())}_setZoom(t){this._zoom=t,this.scale=this.zoomScale(t),this.tileZoom=Math.floor(t),this.zoomFraction=t-this.tileZoom}_updateCenterElevation(){if(!this._elevation)return!1;const e=this._elevation.getAtPointOrZero(t.MercatorCoordinate.fromLngLat(this.center),-1);return-1===e?(this._cameraZoom=null,!1):(this._centerAltitude=e,!0)}_updateCameraOnTerrain(){const e=this.cameraToCenterDistance/this.worldSize,n=t.mercatorZfromAltitude(this._centerAltitude,this.center.lat);this._cameraZoom=this._zoomFromMercatorZ(n+e)}sampleAverageElevation(){if(!this._elevation)return 0;const e=this._elevation,n=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8]],i=this.horizonLineFromTop();let r=0,o=0;for(let a=0;ae.maxzoom&&(n=e.maxzoom);const o=t.MercatorCoordinate.fromLngLat(this.center),a=1<({aabb:new f([t*a,0,v],[(t+1)*a,a,_]),zoom:0,x:0,y:0,wrap:t,fullyVisible:!1}),x=[],b=[],w=n,T=e.reparseOverscaled?i:n,C=t=>{if(!this._elevation||!t.tileID)return;const e=this._elevation.getMinMaxForTile(t.tileID),n=t.aabb;e?(n.min[2]=e.min,n.max[2]=e.max,n.center[2]=(n.min[2]+n.max[2])/2):(t.shouldSplit=A(t),t.shouldSplit||(n.min[2]=n.max[2]=n.center[2]=this._centerAltitude))},E=t=>t*t,S=E((h-this._centerAltitude)*u),A=t=>{if(t.zoom{if(e*E(.707)0;){const i=x.pop(),o=i.x,a=i.y;let c=i.fullyVisible;if(!c){const t=i.aabb.intersects(l);if(0===t)continue;c=2===t}if(i.zoom!==w&&A(i))for(let e=0;e<4;e++){const n=(o<<1)+e%2,s=(a<<1)+(e>>1),l={aabb:i.aabb.quadrant(e),zoom:i.zoom+1,x:n,y:s,wrap:i.wrap,fullyVisible:c,tileID:void 0,shouldSplit:void 0};r&&(l.tileID=new t.OverscaledTileID(i.zoom+1===w?T:i.zoom+1,i.wrap,i.zoom+1,n,s),C(l)),x.push(l)}else{const r=i.zoom===w?T:i.zoom;if(e.minzoom&&e.minzoom>r)continue;const l=s[0]-(.5+o+(i.wrap<{const i=[0,0,0,1],o=[t.EXTENT,t.EXTENT,0,1],a=this.calculateFogTileMatrix(n.tileID.toUnwrapped());t.transformMat4(i,i,a),t.transformMat4(o,o,a);const s=t.getAABBPointSquareDist(i,o);if(0===s)return!0;let l=!1;const c=this.horizonLineFromTop();if(s>e&&0!==c){const e=this.calculateProjMatrix(n.tileID.toUnwrapped());let i;r&&this._elevation&&(i=this._elevation.getMinMaxForTile(n.tileID)),i||(i={min:v,max:_});const o=t.furthestTileCorner(this.bearing),a=[o[0]*t.EXTENT,o[1]*t.EXTENT,i.max];t.transformMat4$1(a,a,e),l=(1-a[1])*this.height*.5t.distanceSq-e.distanceSq)).map((t=>t.tileID))}resize(t,e){this.width=t,this.height=e,this.pixelsToGLUnits=[2/t,-2/e],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(t){return Math.pow(2,t)}scaleZoom(t){return Math.log(t)/Math.LN2}project(e){const n=t.clamp(e.lat,-this.maxValidLatitude,this.maxValidLatitude);return new t.pointGeometry(t.mercatorXfromLng(e.lng)*this.worldSize,t.mercatorYfromLat(n)*this.worldSize)}unproject(e){return new t.MercatorCoordinate(e.x/this.worldSize,e.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}setLocationAtPoint(e,n){const i=this.pointCoordinate(n),r=this.pointCoordinate(this.centerPoint),o=this.locationCoordinate(e),a=new t.MercatorCoordinate(o.x-(i.x-r.x),o.y-(i.y-r.y));this.center=this.coordinateLocation(a),this._renderWorldCopies&&(this.center=this.center.wrap())}setLocation(t){this.center=this.coordinateLocation(t),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(t){return this._coordinatePoint(this.locationCoordinate(t),!1)}locationPoint3D(t){return this._coordinatePoint(this.locationCoordinate(t),!0)}pointLocation(t){return this.coordinateLocation(this.pointCoordinate(t))}pointLocation3D(t){return this.coordinateLocation(this.pointCoordinate3D(t))}locationCoordinate(e){return t.MercatorCoordinate.fromLngLat(e)}coordinateLocation(t){return t.toLngLat()}pointRayIntersection(e,n){const i=null!=n?n:this._centerAltitude,r=[e.x,e.y,0,1],o=[e.x,e.y,1,1];t.transformMat4(r,r,this.pixelMatrixInverse),t.transformMat4(o,o,this.pixelMatrixInverse);const a=o[3];t.scale$2(r,r,1/r[3]),t.scale$2(o,o,1/a);const s=r[2],l=o[2];return{p0:r,p1:o,t:s===l?0:(i-s)/(l-s)}}screenPointToMercatorRay(e){const n=[e.x,e.y,0,1],i=[e.x,e.y,1,1];return t.transformMat4(n,n,this.pixelMatrixInverse),t.transformMat4(i,i,this.pixelMatrixInverse),t.scale$2(n,n,1/n[3]),t.scale$2(i,i,1/i[3]),n[2]=t.mercatorZfromAltitude(n[2],this._center.lat)*this.worldSize,i[2]=t.mercatorZfromAltitude(i[2],this._center.lat)*this.worldSize,t.scale$2(n,n,1/this.worldSize),t.scale$2(i,i,1/this.worldSize),new d([n[0],n[1],n[2]],t.normalize([],t.sub([],i,n)))}rayIntersectionCoordinate(e){const{p0:n,p1:i,t:r}=e,o=t.mercatorZfromAltitude(n[2],this._center.lat),a=t.mercatorZfromAltitude(i[2],this._center.lat);return new t.MercatorCoordinate(t.number(n[0],i[0],r)/this.worldSize,t.number(n[1],i[1],r)/this.worldSize,t.number(o,a,r))}pointCoordinate(e){const n=this.horizonLineFromTop(!1),i=new t.pointGeometry(e.x,Math.max(n,e.y));return this.rayIntersectionCoordinate(this.pointRayIntersection(i))}pointCoordinate3D(e){if(!this.elevation)return this.pointCoordinate(e);const n=this.elevation;let i=this.elevation.pointCoordinate(e);if(i)return new t.MercatorCoordinate(i[0],i[1],i[2]);let r=0,o=this.horizonLineFromTop();if(e.y>o)return this.pointCoordinate(e);const a=.02*o,s=e.clone();for(let e=0;e<10&&o-r>a;e++){s.y=t.number(r,o,.66);const e=n.pointCoordinate(s);e?(o=s.y,i=e):r=s.y}return i?new t.MercatorCoordinate(i[0],i[1],i[2]):this.pointCoordinate(e)}isPointAboveHorizon(t){if(this.elevation)return!this.elevation.pointCoordinate(t);{const e=this.horizonLineFromTop();return t.y0?new t.pointGeometry(r[0]/r[3],r[1]/r[3]):new t.pointGeometry(Number.MAX_VALUE,Number.MAX_VALUE)}getBounds(){return this._terrainEnabled()?this._getBounds3D():(new t.LngLatBounds).extend(this.pointLocation(new t.pointGeometry(this._edgeInsets.left,this._edgeInsets.top))).extend(this.pointLocation(new t.pointGeometry(this.width-this._edgeInsets.right,this._edgeInsets.top))).extend(this.pointLocation(new t.pointGeometry(this.width-this._edgeInsets.right,this.height-this._edgeInsets.bottom))).extend(this.pointLocation(new t.pointGeometry(this._edgeInsets.left,this.height-this._edgeInsets.bottom)))}_getBounds3D(){const e=this.elevation,n=e.visibleDemTiles.reduce(((t,e)=>{if(e.dem){const n=e.dem.tree;t.min=Math.min(t.min,n.minimums[0]),t.max=Math.max(t.max,n.maximums[0])}return t}),{min:Number.MAX_VALUE,max:0});n.min*=e.exaggeration(),n.max*=e.exaggeration();const i=this.horizonLineFromTop();return[new t.pointGeometry(0,i),new t.pointGeometry(this.width,i),new t.pointGeometry(this.width,this.height),new t.pointGeometry(0,this.height)].reduce(((t,e)=>t.extend(this.coordinateLocation(this.rayIntersectionCoordinate(this.pointRayIntersection(e,n.min)))).extend(this.coordinateLocation(this.rayIntersectionCoordinate(this.pointRayIntersection(e,n.max))))),new t.LngLatBounds)}horizonLineFromTop(t=!0){const e=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))+this.centerOffset.y,n=this.height/2-.97*e;return t?Math.max(0,n):n}getMaxBounds(){return this.latRange&&2===this.latRange.length&&this.lngRange&&2===this.lngRange.length?new t.LngLatBounds([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}setMaxBounds(t){t?(this.lngRange=[t.getWest(),t.getEast()],this.latRange=[t.getSouth(),t.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])}calculatePosMatrix(e,n){const i=e.canonical,r=n/this.zoomScale(i.z),o=i.x+Math.pow(2,i.z)*e.wrap,a=t.identity(new Float64Array(16));return t.translate(a,a,[o*r,i.y*r,0]),t.scale$1(a,a,[r/t.EXTENT,r/t.EXTENT,1]),a}calculateFogTileMatrix(e){const n=e.key,i=this._fogTileMatrixCache;if(i[n])return i[n];const r=this.calculatePosMatrix(e,this.cameraWorldSize);return t.multiply(r,this.worldToFogMatrix,r),i[n]=new Float32Array(r),i[n]}calculateProjMatrix(e,n=!1){const i=e.key,r=n?this._alignedProjMatrixCache:this._projMatrixCache;if(r[i])return r[i];const o=this.calculatePosMatrix(e,this.worldSize);return t.multiply(o,n?this.alignedProjMatrix:this.projMatrix,o),r[i]=new Float32Array(o),r[i]}customLayerMatrix(){return this.mercatorMatrix.slice()}recenterOnTerrain(){if(!this._elevation)return;const e=this._elevation;this._updateCameraState();const n=this._camera.position,i=this._camera.forward();if(n[2]<=0||i[2]>=0)return;const r=t.mercatorZfromAltitude(1,this._center.lat);n[2]/=r,i[2]/=r,t.normalize(i,i);const o=e.raycast(n,i,e.exaggeration());if(o){const e=t.scaleAndAdd([],n,i,o),r=new t.MercatorCoordinate(e[0],e[1],t.mercatorZfromAltitude(e[2],t.latFromMercatorY(e[1]))),a=this._camera.position,s=r.z+t.length([r.x-a[0],r.y-a[1],r.z-a[2]]);this._cameraZoom=this._zoomFromMercatorZ(s),this._centerAltitude=r.toAltitude(),this._center=r.toLngLat(),this._updateZoomFromElevation(),this._constrain(),this._calcMatrices()}}_constrainCameraAltitude(){if(!this._elevation)return;const e=this._elevation;this._updateCameraState();const n=e.getAtPointOrZero(this._camera.mercatorPosition),i=this._minimumHeightOverTerrain()*Math.cos(t.degToRad(this._maxPitch)),r=t.mercatorZfromAltitude(n,this._center.lat),o=this._camera.position[2]-r;if(oa&&(r=a-e)}if(this.lngRange){const t=h.x,e=c.x/2;t-el&&(i=l-e)}void 0===i&&void 0===r||(this.center=this.unproject(new t.pointGeometry(void 0!==i?i:h.x,void 0!==r?r:h.y))),this._constrainCameraAltitude(),this._unmodified=u,this._constraining=!1}_minZoomForBounds(){const e=(t,e)=>Math.log2(t/(this.tileSize*Math.abs(e[1]-e[0])));let n=0;if(this.latRange){const i=this.latRange;n=e(this.height,[t.mercatorYfromLat(i[0]),t.mercatorYfromLat(i[1])])}let i=0;if(this.lngRange){const n=this.lngRange;i=e(this.width,[t.mercatorXfromLng(n[0]),t.mercatorXfromLng(n[1])])}return Math.max(n,i)}_maxCameraBoundsDistance(){return this._mercatorZfromZoom(this._minZoomForBounds())}_calcMatrices(){if(!this.height)return;const e=this.centerOffset;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height;const n=this.pixelsPerMeter;this._updateCameraState();const i=Math.PI/2+this._pitch,r=this.fovAboveCenter,o=this.elevation?this.elevation.getMinElevationBelowMSL()*n:0,a=(this._camera.position[2]*this.worldSize-o)/Math.cos(this._pitch),s=Math.sin(r)*a/Math.sin(t.clamp(Math.PI-i-r,.01,Math.PI-.01)),l=this.point,c=l.x,u=l.y,h=Math.cos(Math.PI/2-this._pitch)*s+a,d=Math.min(1.01*h,a*(1/this._horizonShift)),p=this.height/50,f=this._camera.getWorldToCamera(this.worldSize,n),m=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,p,d);m[8]=2*-e.x/this.width,m[9]=2*e.y/this.height;let g=t.mul$1([],m,f);this.mercatorMatrix=t.scale$1([],g,[this.worldSize,this.worldSize,this.worldSize/n]),this.projMatrix=g,this.invProjMatrix=t.invert(new Float64Array(16),this.projMatrix);const _=new Float32Array(16);t.identity(_),t.scale$1(_,_,[1,-1,1]),t.rotateX(_,_,this._pitch),t.rotateZ(_,_,this.angle);const v=t.perspective(new Float32Array(16),this._fov,this.width/this.height,p,d),y=(Math.PI/2-this._pitch)*(this.height/this._fov)*this._horizonShift;v[8]=2*-e.x/this.width,v[9]=2*(e.y+y)/this.height,this.skyboxMatrix=t.multiply(_,v,_);const x=this.width%2/2,b=this.height%2/2,w=Math.cos(this.angle),T=Math.sin(this.angle),C=c-Math.round(c)+w*x+T*b,E=u-Math.round(u)+w*b+T*x,S=new Float64Array(g);if(t.translate(S,S,[C>.5?C-1:C,E>.5?E-1:E,0]),this.alignedProjMatrix=S,g=t.create$1(),t.scale$1(g,g,[this.width/2,-this.height/2,1]),t.translate(g,g,[1,-1,0]),this.labelPlaneMatrix=g,g=t.create$1(),t.scale$1(g,g,[1,-1,1]),t.translate(g,g,[-1,-1,0]),t.scale$1(g,g,[2/this.width,2/this.height,1]),this.glCoordMatrix=g,this.pixelMatrix=t.multiply(new Float64Array(16),this.labelPlaneMatrix,this.projMatrix),this._calcFogMatrices(),g=t.invert(new Float64Array(16),this.pixelMatrix),!g)throw new Error("failed to invert matrix");this.pixelMatrixInverse=g,this._projMatrixCache={},this._alignedProjMatrixCache={}}_calcFogMatrices(){this._fogTileMatrixCache={};const e=this.cameraWorldSize,n=this.cameraPixelsPerMeter,i=this._camera.position,r=1/this.height,o=[e,e,n];t.scale(o,o,r),t.scale(i,i,-1),t.multiply$1(i,i,o);const a=t.create$1();t.translate(a,a,i),t.scale$1(a,a,o),this.mercatorFogMatrix=a,this.worldToFogMatrix=this._camera.getWorldToCameraPosition(e,n,r)}_updateCameraState(){if(!this.height)return;this._camera.setPitchBearing(this._pitch,this.angle);const e=this._camera.forward(),n=this.cameraToCenterDistance,i=this.point,r=this._mercatorZfromZoom(this._cameraZoom?this._cameraZoom:this._zoom)-t.mercatorZfromAltitude(this._centerAltitude,this.center.lat),o=this.cameraToCenterDistance/r;this._camera.position=[i.x/this.worldSize-e[0]*n/o,i.y/this.worldSize-e[1]*n/o,t.mercatorZfromAltitude(this._centerAltitude,this._center.lat)+-e[2]*n/o]}_translateCameraConstrained(e){const n=this._maxCameraBoundsDistance()*Math.cos(this._pitch),i=e[2];let r=1;i>0&&(r=Math.min((n-this._camera.position[2])/i,1)),this._camera.position=t.scaleAndAdd([],this._camera.position,e,r),this._updateStateFromCamera()}_updateStateFromCamera(){const e=this._camera.position,n=this._camera.forward(),{pitch:i,bearing:r}=this._camera.getPitchBearing(),o=t.mercatorZfromAltitude(this._centerAltitude,this.center.lat),a=this._mercatorZfromZoom(this._maxZoom)*Math.cos(t.degToRad(this._maxPitch)),s=Math.max((e[2]-o)/Math.cos(i),a),l=this._zoomFromMercatorZ(s);t.scaleAndAdd(e,e,n,s),this._pitch=t.clamp(i,t.degToRad(this.minPitch),t.degToRad(this.maxPitch)),this.angle=t.wrap(r,-Math.PI,Math.PI),this._setZoom(t.clamp(l,this._minZoom,this._maxZoom)),this._terrainEnabled()&&this._updateCameraOnTerrain(),this._center=new t.MercatorCoordinate(e[0],e[1],e[2]).toLngLat(),this._unmodified=!1,this._constrain(),this._calcMatrices()}_worldSizeFromZoom(t){return Math.pow(2,t)*this.tileSize}_mercatorZfromZoom(t){return this.cameraToCenterDistance/this._worldSizeFromZoom(t)}_minimumHeightOverTerrain(){const t=Math.min((null!=this._cameraZoom?this._cameraZoom:this._zoom)+2,this._maxZoom);return this._mercatorZfromZoom(t)}_zoomFromMercatorZ(t){return this.scaleZoom(this.cameraToCenterDistance/(t*this.tileSize))}_terrainEnabled(){return!!this._elevation}isHorizonVisibleForPoints(e,n){const i=Math.min(e.x,n.x),r=Math.max(e.x,n.x),o=Math.min(e.y,n.y),a=Math.max(e.y,n.y),s=[new t.pointGeometry(i,o),new t.pointGeometry(r,a),new t.pointGeometry(i,a),new t.pointGeometry(r,o)],l=this._renderWorldCopies?-3:0,c=this._renderWorldCopies?4:1;for(const t of s){const e=this.pointRayIntersection(t);if(e.t<0)return!0;const n=this.rayIntersectionCoordinate(e);if(n.xc||n.y>1)return!0}return!1}isHorizonVisible(){return this.pitch+t.radToDeg(this.fovAboveCenter)>88||this.isHorizonVisibleForPoints(new t.pointGeometry(0,0),new t.pointGeometry(this.width,this.height))}zoomDeltaToMovement(e,n){const i=t.length(t.sub([],this._camera.position,e)),r=this._zoomFromMercatorZ(i)+n;return i-this._mercatorZfromZoom(r)}getCameraPoint(){const e=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new t.pointGeometry(0,e))}}function Ci(t,e){let n=!1,i=null;const r=()=>{i=null,n&&(t(),i=setTimeout(r,e),n=!1)};return()=>(n=!0,i||r(),i)}class Ei{constructor(e){this._hashName=e&&encodeURIComponent(e),t.bindAll(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=Ci(this._updateHashUnthrottled.bind(this),300)}addTo(e){return this._map=e,t.window.addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return t.window.removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this}getHashString(e){const n=this._map.getCenter(),i=Math.round(100*this._map.getZoom())/100,r=Math.ceil((i*Math.LN2+Math.log(512/360/.5))/Math.LN10),o=Math.pow(10,r),a=Math.round(n.lng*o)/o,s=Math.round(n.lat*o)/o,l=this._map.getBearing(),c=this._map.getPitch();let u="";if(u+=e?`/${a}/${s}/${i}`:`${i}/${s}/${a}`,(l||c)&&(u+="/"+Math.round(10*l)/10),c&&(u+=`/${Math.round(c)}`),this._hashName){const e=this._hashName;let n=!1;const i=t.window.location.hash.slice(1).split("&").map((t=>{const i=t.split("=")[0];return i===e?(n=!0,`${i}=${u}`):t})).filter((t=>t));return n||i.push(`${e}=${u}`),`#${i.join("&")}`}return`#${u}`}_getCurrentHash(){const e=t.window.location.hash.replace("#","");if(this._hashName){let t;return e.split("&").map((t=>t.split("="))).forEach((e=>{e[0]===this._hashName&&(t=e)})),(t&&t[1]||"").split("/")}return e.split("/")}_onHashChange(){const t=this._getCurrentHash();if(t.length>=3&&!t.some((t=>isNaN(t)))){const e=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(t[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:e,pitch:+(t[4]||0)}),!0}return!1}_updateHashUnthrottled(){const e=t.window.location.href.replace(/(#.+)?$/,this.getHashString());t.window.history.replaceState(t.window.history.state,null,e)}}const Si={linearity:.3,easing:t.bezier(0,0,.3,1)},Ai=t.extend({deceleration:2500,maxSpeed:1400},Si),ki=t.extend({deceleration:20,maxSpeed:1400},Si),Ii=t.extend({deceleration:1e3,maxSpeed:360},Si),Mi=t.extend({deceleration:1e3,maxSpeed:90},Si);class Pi{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:t.exported.now(),settings:e})}_drainInertiaBuffer(){const e=this._inertiaBuffer,n=t.exported.now();for(;e.length>0&&n-e[0].time>160;)e.shift()}_onMoveEnd(e){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const n={zoom:0,bearing:0,pitch:0,pan:new t.pointGeometry(0,0),pinchAround:void 0,around:void 0};for(const{settings:t}of this._inertiaBuffer)n.zoom+=t.zoomDelta||0,n.bearing+=t.bearingDelta||0,n.pitch+=t.pitchDelta||0,t.panDelta&&n.pan._add(t.panDelta),t.around&&(n.around=t.around),t.pinchAround&&(n.pinchAround=t.pinchAround);const i=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,r={};if(n.pan.mag()){const o=zi(n.pan.mag(),i,t.extend({},Ai,e||{}));r.offset=n.pan.mult(o.amount/n.pan.mag()),r.center=this._map.transform.center,Di(r,o)}if(n.zoom){const t=zi(n.zoom,i,ki);r.zoom=this._map.transform.zoom+t.amount,Di(r,t)}if(n.bearing){const e=zi(n.bearing,i,Ii);r.bearing=this._map.transform.bearing+t.clamp(e.amount,-179,179),Di(r,e)}if(n.pitch){const t=zi(n.pitch,i,Mi);r.pitch=this._map.transform.pitch+t.amount,Di(r,t)}if(r.zoom||r.bearing){const t=void 0===n.pinchAround?n.around:n.pinchAround;r.around=t?this._map.unproject(t):this._map.getCenter()}return this.clear(),t.extend(r,{noMoveStart:!0})}}function Di(t,e){(!t.duration||t.durationn.unproject(t))),l=a.reduce(((t,e,n,i)=>t.add(e.div(i.length))),new t.pointGeometry(0,0));super(e,{points:a,point:l,lngLats:s,lngLat:n.unproject(l),originalEvent:i}),this._defaultPrevented=!1}}class Li extends t.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,e,n){super(t,{originalEvent:n}),this._defaultPrevented=!1}}class Fi{constructor(t,e){this._map=t,this._clickTolerance=e.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new Li(t.type,this._map,t))}mousedown(t,e){return this._mousedownPos=e,this._firePreventable(new Oi(t.type,this._map,t))}mouseup(t){this._map.fire(new Oi(t.type,this._map,t))}click(t,e){this._mousedownPos&&this._mousedownPos.dist(e)>=this._clickTolerance||this._map.fire(new Oi(t.type,this._map,t))}dblclick(t){return this._firePreventable(new Oi(t.type,this._map,t))}mouseover(t){this._map.fire(new Oi(t.type,this._map,t))}mouseout(t){this._map.fire(new Oi(t.type,this._map,t))}touchstart(t){return this._firePreventable(new Ri(t.type,this._map,t))}touchmove(t){this._map.fire(new Ri(t.type,this._map,t))}touchend(t){this._map.fire(new Ri(t.type,this._map,t))}touchcancel(t){this._map.fire(new Ri(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class $i{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,delete this._contextMenuEvent}mousemove(t){this._map.fire(new Oi(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Oi("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._map.fire(new Oi(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Bi{constructor(t,e){this._map=t,this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=e.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,e){this.isEnabled()&&t.shiftKey&&0===t.button&&(o.disableDrag(),this._startPos=this._lastPos=e,this._active=!0)}mousemoveWindow(t,e){if(!this._active)return;const n=e;if(this._lastPos.equals(n)||!this._box&&n.dist(this._startPos){this._box&&(o.setTransform(this._box,`translate(${r}px,${s}px)`),this._box.style.width=a-r+"px",this._box.style.height=l-s+"px")}))}mouseupWindow(e,n){if(!this._active)return;if(0!==e.button)return;const i=this._startPos,r=n;if(this.reset(),o.suppressClick(),i.x!==r.x||i.y!==r.y)return this._map.fire(new t.Event("boxzoomend",{originalEvent:e})),{cameraAnimation:t=>t.fitScreenCoordinates(i,r,this._map.getBearing(),{linear:!1})};this._fireEvent("boxzoomcancel",e)}keydown(t){this._active&&27===t.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",t))}reset(){this._active=!1,this._container.classList.remove("mapboxgl-crosshair"),this._box&&(o.remove(this._box),this._box=null),o.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,n){return this._map.fire(new t.Event(e,{originalEvent:n}))}}function Ni(t,e){const n={};for(let i=0;ithis.numTouches)&&(this.aborted=!0),this.aborted||(void 0===this.startTime&&(this.startTime=e.timeStamp),i.length===this.numTouches&&(this.centroid=function(e){const n=new t.pointGeometry(0,0);for(const t of e)n._add(t);return n.div(e.length)}(n),this.touches=Ni(i,n)))}touchmove(t,e,n){if(this.aborted||!this.centroid)return;const i=Ni(n,e);for(const t in this.touches){const e=this.touches[t],n=i[t];(!n||n.dist(e)>30)&&(this.aborted=!0)}}touchend(t,e,n){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),0===n.length){const t=!this.aborted&&this.centroid;if(this.reset(),t)return t}}}class Ui{constructor(t){this.singleTap=new ji(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,e,n){this.singleTap.touchstart(t,e,n)}touchmove(t,e,n){this.singleTap.touchmove(t,e,n)}touchend(t,e,n){const i=this.singleTap.touchend(t,e,n);if(i){const e=t.timeStamp-this.lastTime<500,n=!this.lastTap||this.lastTap.dist(i)<30;if(e&&n||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=i,this.count===this.numTaps)return this.reset(),i}}}class Vi{constructor(){this._zoomIn=new Ui({numTouches:1,numTaps:2}),this._zoomOut=new Ui({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,e,n){this._zoomIn.touchstart(t,e,n),this._zoomOut.touchstart(t,e,n)}touchmove(t,e,n){this._zoomIn.touchmove(t,e,n),this._zoomOut.touchmove(t,e,n)}touchend(t,e,n){const i=this._zoomIn.touchend(t,e,n),r=this._zoomOut.touchend(t,e,n);return i?(this._active=!0,t.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:e=>e.easeTo({duration:300,zoom:e.getZoom()+1,around:e.unproject(i)},{originalEvent:t})}):r?(this._active=!0,t.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:e=>e.easeTo({duration:300,zoom:e.getZoom()-1,around:e.unproject(r)},{originalEvent:t})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}const Gi={0:1,2:2};class qi{constructor(t){this.reset(),this._clickTolerance=t.clickTolerance||1}reset(){this._active=!1,this._moved=!1,delete this._lastPoint,delete this._eventButton}_correctButton(t,e){return!1}_move(t,e){return{}}mousedown(t,e){if(this._lastPoint)return;const n=o.mouseButton(t);this._correctButton(t,n)&&(this._lastPoint=e,this._eventButton=n)}mousemoveWindow(t,e){const n=this._lastPoint;if(n)if(t.preventDefault(),function(t,e){const n=Gi[e];return void 0===t.buttons||(t.buttons&n)!==n}(t,this._eventButton))this.reset();else if(this._moved||!(e.dist(n)0&&(this._active=!0);const r=Ni(i,n),o=new t.pointGeometry(0,0),a=new t.pointGeometry(0,0);let s=0;for(const t in r){const e=r[t],n=this._touches[t];n&&(o._add(e),a._add(e.sub(n)),s++,r[t]=e)}if(this._touches=r,sMath.abs(t.x)}class ir extends Ki{reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}_start(t){this._lastPoints=t,nr(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,e,n){const i=t[0].sub(this._lastPoints[0]),r=t[1].sub(this._lastPoints[1]);if(this._valid=this.gestureBeginsVertically(i,r,n.timeStamp),this._valid)return this._lastPoints=t,this._active=!0,{pitchDelta:(i.y+r.y)/2*-.5}}gestureBeginsVertically(t,e,n){if(void 0!==this._valid)return this._valid;const i=t.mag()>=2,r=e.mag()>=2;if(!i&&!r)return;if(!i||!r)return void 0===this._firstMove&&(this._firstMove=n),n-this._firstMove<100&&void 0;const o=t.y>0==e.y>0;return nr(t)&&nr(e)&&o}}const rr={panStep:100,bearingStep:15,pitchStep:10};class or{constructor(){const t=rr;this._panStep=t.panStep,this._bearingStep=t.bearingStep,this._pitchStep=t.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let e=0,n=0,i=0,r=0,o=0;switch(t.keyCode){case 61:case 107:case 171:case 187:e=1;break;case 189:case 109:case 173:e=-1;break;case 37:t.shiftKey?n=-1:(t.preventDefault(),r=-1);break;case 39:t.shiftKey?n=1:(t.preventDefault(),r=1);break;case 38:t.shiftKey?i=1:(t.preventDefault(),o=-1);break;case 40:t.shiftKey?i=-1:(t.preventDefault(),o=1);break;default:return}return this._rotationDisabled&&(n=0,i=0),{cameraAnimation:a=>{const s=a.getZoom();a.easeTo({duration:300,easeId:"keyboardHandler",easing:ar,zoom:e?Math.round(s)+e*(t.shiftKey?2:1):s,bearing:a.getBearing()+n*this._bearingStep,pitch:a.getPitch()+i*this._pitchStep,offset:[-r*this._panStep,-o*this._panStep],center:a.getCenter()},{originalEvent:t})}}}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 ar(t){return t*(2-t)}const sr=4.000244140625;class lr{constructor(e,n){this._map=e,this._el=e.getCanvasContainer(),this._handler=n,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222,t.bindAll(["_onTimeout"],this)}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return!!this._active||void 0!==this._finishTimeout}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=t&&"center"===t.around)}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(e){if(!this.isEnabled())return;let n=e.deltaMode===t.window.WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY;const i=t.exported.now(),r=i-(this._lastWheelEventTime||0);this._lastWheelEventTime=i,0!==n&&n%sr==0?this._type="wheel":0!==n&&Math.abs(n)<4?this._type="trackpad":r>400?(this._type=null,this._lastValue=n,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(r*n)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,n+=this._lastValue)),e.shiftKey&&n&&(n/=4),this._type&&(this._lastWheelEvent=e,this._delta-=n,this._active||this._start(e)),e.preventDefault()}_onTimeout(t){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(t)}_start(t){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 e=o.mousePos(this._el,t);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:e,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 e=this._map.transform,n=()=>e._terrainEnabled()?e.computeZoomRelativeTo(this._aroundCoord):e.zoom;if(0!==this._delta){const t="wheel"===this._type&&Math.abs(this._delta)>sr?this._wheelZoomRate:this._defaultZoomRate;let i=2/(1+Math.exp(-Math.abs(this._delta*t)));this._delta<0&&0!==i&&(i=1/i);const r=n(),o=Math.pow(2,r),a="number"==typeof this._targetZoom?e.zoomScale(this._targetZoom):o;this._targetZoom=Math.min(e.maxZoom,Math.max(e.minZoom,e.scaleZoom(a*i))),"wheel"===this._type&&(this._startZoom=n(),this._easing=this._smoothOutEasing(200)),this._delta=0}const i="number"==typeof this._targetZoom?this._targetZoom:n(),r=this._startZoom,o=this._easing;let a,s=!1;if("wheel"===this._type&&r&&o){const e=Math.min((t.exported.now()-this._lastWheelEventTime)/200,1),n=o(e);a=t.number(r,i,n),e<1?this._frameId||(this._frameId=!0):s=!0}else a=i,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-n(),around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let n=t.ease;if(this._prevEase){const e=this._prevEase,i=(t.exported.now()-e.start)/e.duration,r=e.easing(i+.01)-e.easing(i),o=.27/Math.sqrt(r*r+1e-4)*.01,a=Math.sqrt(.0729-o*o);n=t.bezier(o,a,.25,1)}return this._prevEase={start:t.exported.now(),duration:e,easing:n},n}reset(){this._active=!1}}class cr{constructor(t,e){this._clickZoom=t,this._tapZoom=e}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 ur{constructor(){this.reset()}reset(){this._active=!1}dblclick(t,e){return t.preventDefault(),{cameraAnimation:n=>{n.easeTo({duration:300,zoom:n.getZoom()+(t.shiftKey?-1:1),around:n.unproject(e)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class hr{constructor(){this._tap=new Ui({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,this._tap.reset()}touchstart(t,e,n){this._swipePoint||(this._tapTime&&t.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?n.length>0&&(this._swipePoint=e[0],this._swipeTouch=n[0].identifier):this._tap.touchstart(t,e,n))}touchmove(t,e,n){if(this._tapTime){if(this._swipePoint){if(n[0].identifier!==this._swipeTouch)return;const i=e[0],r=i.y-this._swipePoint.y;return this._swipePoint=i,t.preventDefault(),this._active=!0,{zoomDelta:r/128}}}else this._tap.touchmove(t,e,n)}touchend(t,e,n){this._tapTime?this._swipePoint&&0===n.length&&this.reset():this._tap.touchend(t,e,n)&&(this._tapTime=t.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class dr{constructor(t,e,n){this._el=t,this._mousePan=e,this._touchPan=n}enable(t){this._inertiaOptions=t||{},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 pr{constructor(t,e,n){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=e,this._mousePitch=n}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 fr{constructor(t,e,n,i){this._el=t,this._touchZoom=e,this._touchRotate=n,this._tapDragZoom=i,this._rotationDisabled=!1,this._enabled=!0}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),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 mr=t=>t.zoom||t.drag||t.pitch||t.rotate;class gr extends t.Event{}class _r{constructor(){this.constants=[1,1,.01],this.radius=0}setup(e,n){const i=t.sub([],n,e);this.radius=t.length(i[2]<0?t.div([],i,this.constants):[i[0],i[1],0])}projectRay(e){t.div(e,e,this.constants),t.normalize(e,e),t.mul$2(e,e,this.constants);const n=t.scale([],e,this.radius);if(n[2]>0){const e=t.scale([],[0,0,1],t.dot(n,[0,0,1])),i=t.scale([],t.normalize([],[n[0],n[1],0]),this.radius),r=t.add([],n,t.scale([],t.sub([],t.add([],i,e),n),2));n[0]=r[0],n[1]=r[1]}return n}}function vr(t){return t.panDelta&&t.panDelta.mag()||t.zoomDelta||t.bearingDelta||t.pitchDelta}class yr{constructor(e,n){this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Pi(e),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new _r,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(n),t.bindAll(["handleEvent","handleWindowEvent"],this);const i=this._el;this._listeners=[[i,"touchstart",{passive:!0}],[i,"touchmove",{passive:!1}],[i,"touchend",void 0],[i,"touchcancel",void 0],[i,"mousedown",void 0],[i,"mousemove",void 0],[i,"mouseup",void 0],[t.window.document,"mousemove",{capture:!0}],[t.window.document,"mouseup",void 0],[i,"mouseover",void 0],[i,"mouseout",void 0],[i,"dblclick",void 0],[i,"click",void 0],[i,"keydown",{capture:!1}],[i,"keyup",void 0],[i,"wheel",{passive:!1}],[i,"contextmenu",void 0],[t.window,"blur",void 0]];for(const[e,n,i]of this._listeners)o.addEventListener(e,n,e===t.window.document?this.handleWindowEvent:this.handleEvent,i)}destroy(){for(const[e,n,i]of this._listeners)o.removeEventListener(e,n,e===t.window.document?this.handleWindowEvent:this.handleEvent,i)}_addDefaultHandlers(t){const e=this._map,n=e.getCanvasContainer();this._add("mapEvent",new Fi(e,t));const i=e.boxZoom=new Bi(e,t);this._add("boxZoom",i);const r=new Vi,o=new ur;e.doubleClickZoom=new cr(o,r),this._add("tapZoom",r),this._add("clickZoom",o);const a=new hr;this._add("tapDragZoom",a);const s=e.touchPitch=new ir;this._add("touchPitch",s);const l=new Hi(t),c=new Wi(t);e.dragRotate=new pr(t,l,c),this._add("mouseRotate",l,["mousePitch"]),this._add("mousePitch",c,["mouseRotate"]);const u=new Zi(t),h=new Xi(t);e.dragPan=new dr(n,u,h),this._add("mousePan",u),this._add("touchPan",h,["touchZoom","touchRotate"]);const d=new er,p=new Qi;e.touchZoomRotate=new fr(n,p,d,a),this._add("touchRotate",d,["touchPan","touchZoom"]),this._add("touchZoom",p,["touchPan","touchRotate"]),this._add("blockableMapEvent",new $i(e));const f=e.scrollZoom=new lr(e,this);this._add("scrollZoom",f,["mousePan"]);const m=e.keyboard=new or;this._add("keyboard",m);for(const n of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])t.interactive&&t[n]&&e[n].enable(t[n])}_add(t,e,n){this._handlers.push({handlerName:t,handler:e,allowed:n}),this._handlersById[t]=e}stop(t){if(!this._updatingCamera){for(const{handler:t}of this._handlers)t.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}}isActive(){for(const{handler:t}of this._handlers)if(t.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return Boolean(mr(this._eventsInProgress))||this.isZooming()}_blockedByActive(t,e,n){for(const i in t)if(i!==n&&(!e||e.indexOf(i)<0))return!0;return!1}handleWindowEvent(t){this.handleEvent(t,`${t.type}Window`)}_getMapTouches(t){const e=[];for(const n of t)this._el.contains(n.target)&&e.push(n);return e}handleEvent(t,e){if("blur"===t.type)return void this.stop(!0);this._updatingCamera=!0;const n="renderFrame"===t.type,i=n?void 0:t,r={needsRenderFrame:!1},a={},s={},l=t.touches?this._getMapTouches(t.touches):void 0,c=l?o.touchPos(this._el,l):n?void 0:o.mousePos(this._el,t);for(const{handlerName:n,handler:o,allowed:u}of this._handlers){if(!o.isEnabled())continue;let h;this._blockedByActive(s,u,n)?o.reset():o[e||t.type]&&(h=o[e||t.type](t,c,l),this.mergeHandlerResult(r,a,h,n,i),h&&h.needsRenderFrame&&this._triggerRenderFrame()),(h||o.isActive())&&(s[n]=o)}const u={};for(const t in this._previousActiveHandlers)s[t]||(u[t]=i);this._previousActiveHandlers=s,(Object.keys(u).length||vr(r))&&(this._changes.push([r,a,u]),this._triggerRenderFrame()),(Object.keys(s).length||vr(r))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:h}=r;h&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],h(this._map))}mergeHandlerResult(e,n,i,r,o){if(!i)return;t.extend(e,i);const a={handlerName:r,originalEvent:i.originalEvent||o};void 0!==i.zoomDelta&&(n.zoom=a),void 0!==i.panDelta&&(n.drag=a),void 0!==i.pitchDelta&&(n.pitch=a),void 0!==i.bearingDelta&&(n.rotate=a)}_applyChanges(){const e={},n={},i={};for(const[r,o,a]of this._changes)r.panDelta&&(e.panDelta=(e.panDelta||new t.pointGeometry(0,0))._add(r.panDelta)),r.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+r.zoomDelta),r.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+r.bearingDelta),r.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+r.pitchDelta),void 0!==r.around&&(e.around=r.around),void 0!==r.aroundCoord&&(e.aroundCoord=r.aroundCoord),void 0!==r.pinchAround&&(e.pinchAround=r.pinchAround),r.noInertia&&(e.noInertia=r.noInertia),t.extend(n,o),t.extend(i,a);this._updateMapTransform(e,n,i),this._changes=[]}_updateMapTransform(e,n,i){const r=this._map,o=r.transform,a=t=>[t.x,t.y,t.z];if((t=>{const e=this._eventsInProgress.drag;return e&&!this._handlersById[e.handlerName].isActive()})()&&!vr(e)){const t=o.zoom;o.cameraElevationReference="sea",o.recenterOnTerrain(),o.cameraElevationReference="ground",t!==o.zoom&&this._map._update(!0)}if(!vr(e))return this._fireEvents(n,i,!0);let{panDelta:s,zoomDelta:l,bearingDelta:c,pitchDelta:u,around:h,aroundCoord:d,pinchAround:p}=e;void 0!==p&&(h=p),(t=>n.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){const t=o.screenPointToMercatorRay(h),e=o.screenPointToMercatorRay(h.sub(s)),n=this._trackingEllipsoid.projectRay(t.dir),i=this._trackingEllipsoid.projectRay(e.dir);f[0]=i[0]-n[0],f[1]=i[1]-n[1]}const m=o.zoom,g=[0,0,0];if(l){const e=a(d||o.pointCoordinate3D(h)),n={dir:t.normalize([],t.sub([],e,o._camera.position))},i=o.screenPointToMercatorRay(o.centerPoint);if(n.dir[2]<0){const r=t.altitudeFromMercatorZ(e[2],e[1]),s=o.rayIntersectionCoordinate(o.pointRayIntersection(o.centerPoint,r)),c=o.zoomDeltaToMovement(a(s),l)*(i.dir[2]/n.dir[2]);t.scale(g,n.dir,c)}else if(o._terrainEnabled()){const i=o.zoomDeltaToMovement(e,l);t.scale(g,n.dir,i)}}const _=t.add(f,f,g);o._translateCameraConstrained(_),l&&Math.abs(o.zoom-m)>1e-4&&o.recenterOnTerrain(),o.cameraElevationReference="ground",this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(n,i,!0)}_fireEvents(e,n,i){const r=mr(this._eventsInProgress),o=mr(e),a={};for(const t in e){const{originalEvent:n}=e[t];this._eventsInProgress[t]||(a[`${t}start`]=n),this._eventsInProgress[t]=e[t]}!r&&o&&this._fireEvent("movestart",o.originalEvent);for(const t in a)this._fireEvent(t,a[t]);o&&this._fireEvent("move",o.originalEvent);for(const t in e){const{originalEvent:n}=e[t];this._fireEvent(t,n)}const s={};let l;for(const t in this._eventsInProgress){const{handlerName:e,originalEvent:i}=this._eventsInProgress[t];this._handlersById[e].isActive()||(delete this._eventsInProgress[t],l=n[e]||i,s[`${t}end`]=l)}for(const t in s)this._fireEvent(t,s[t]);const c=mr(this._eventsInProgress);if(i&&(r||o)&&!c){this._updatingCamera=!0;const e=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),n=t=>0!==t&&-this._bearingSnap{delete this._frameId,this.handleEvent(new gr("renderFrame",{timeStamp:t})),this._applyChanges()}))}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}}class xr extends t.Evented{constructor(e,n){super(),this._moving=!1,this._zooming=!1,this.transform=e,this._bearingSnap=n.bearingSnap,t.bindAll(["_renderFrameCallback"],this)}getCenter(){return new t.LngLat(this.transform.center.lng,this.transform.center.lat)}setCenter(t,e){return this.jumpTo({center:t},e)}panBy(e,n,i){return e=t.pointGeometry.convert(e).mult(-1),this.panTo(this.transform.center,t.extend({offset:e},n),i)}panTo(e,n,i){return this.easeTo(t.extend({center:e},n),i)}getZoom(){return this.transform.zoom}setZoom(t,e){return this.jumpTo({zoom:t},e),this}zoomTo(e,n,i){return this.easeTo(t.extend({zoom:e},n),i)}zoomIn(t,e){return this.zoomTo(this.getZoom()+1,t,e),this}zoomOut(t,e){return this.zoomTo(this.getZoom()-1,t,e),this}getBearing(){return this.transform.bearing}setBearing(t,e){return this.jumpTo({bearing:t},e),this}getPadding(){return this.transform.padding}setPadding(t,e){return this.jumpTo({padding:t},e),this}rotateTo(e,n,i){return this.easeTo(t.extend({bearing:e},n),i)}resetNorth(e,n){return this.rotateTo(0,t.extend({duration:1e3},e),n),this}resetNorthPitch(e,n){return this.easeTo(t.extend({bearing:0,pitch:0,duration:1e3},e),n),this}snapToNorth(t,e){return Math.abs(this.getBearing()){if(this._zooming&&(i.zoom=t.number(r,l,e)),this._rotating&&(i.bearing=t.number(o,c,e)),this._pitching&&(i.pitch=t.number(a,u,e)),this._padding&&(i.interpolatePadding(s,h,e),p=i.centerPoint.add(d)),y)i.setLocationAtPoint(y,x);else{const t=i.zoomScale(i.zoom-r),n=l>r?Math.min(2,v):Math.max(.5,v),o=Math.pow(n,1-e),a=i.unproject(g.add(_.mult(e*o)).mult(t));i.setLocationAtPoint(i.renderWorldCopies?a.wrap():a,p)}this._fireMoveEvents(n)}),(t=>{i.recenterOnTerrain(),this._afterEase(n,t)}),e),this}_prepareEase(e,n,i={}){this._moving=!0,this.transform.cameraElevationReference="sea",n||i.moving||this.fire(new t.Event("movestart",e)),this._zooming&&!i.zooming&&this.fire(new t.Event("zoomstart",e)),this._rotating&&!i.rotating&&this.fire(new t.Event("rotatestart",e)),this._pitching&&!i.pitching&&this.fire(new t.Event("pitchstart",e))}_fireMoveEvents(e){this.fire(new t.Event("move",e)),this._zooming&&this.fire(new t.Event("zoom",e)),this._rotating&&this.fire(new t.Event("rotate",e)),this._pitching&&this.fire(new t.Event("pitch",e))}_afterEase(e,n){if(this._easeId&&n&&this._easeId===n)return;delete this._easeId,this.transform.cameraElevationReference="ground";const i=this._zooming,r=this._rotating,o=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,i&&this.fire(new t.Event("zoomend",e)),r&&this.fire(new t.Event("rotateend",e)),o&&this.fire(new t.Event("pitchend",e)),this.fire(new t.Event("moveend",e))}flyTo(e,n){if(!e.essential&&t.exported.prefersReducedMotion){const i=t.pick(e,["center","zoom","bearing","pitch","around"]);return this.jumpTo(i,n)}this.stop(),e=t.extend({offset:[0,0],speed:1.2,curve:1.42,easing:t.ease},e);const i=this.transform,r=this.getZoom(),o=this.getBearing(),a=this.getPitch(),s=this.getPadding(),l="zoom"in e?t.clamp(+e.zoom,i.minZoom,i.maxZoom):r,c="bearing"in e?this._normalizeBearing(e.bearing,o):o,u="pitch"in e?+e.pitch:a,h="padding"in e?e.padding:i.padding,d=i.zoomScale(l-r),p=t.pointGeometry.convert(e.offset);let f=i.centerPoint.add(p);const m=i.pointLocation(f),g=t.LngLat.convert(e.center||m);this._normalizeCenter(g);const _=i.project(m),v=i.project(g).sub(_);let y=e.curve;const x=Math.max(i.width,i.height),b=x/d,w=v.mag();if("minZoom"in e){const n=t.clamp(Math.min(e.minZoom,r,l),i.minZoom,i.maxZoom),o=x/i.zoomScale(n-r);y=Math.sqrt(o/w*2)}const T=y*y;function C(t){const e=(b*b-x*x+(t?-1:1)*T*T*w*w)/(2*(t?b:x)*T*w);return Math.log(Math.sqrt(e*e+1)-e)}function E(t){return(Math.exp(t)-Math.exp(-t))/2}function S(t){return(Math.exp(t)+Math.exp(-t))/2}const A=C(0);let k=function(t){return S(A)/S(A+y*t)},I=function(t){return x*((S(A)*(E(e=A+y*t)/S(e))-E(A))/T)/w;var e},M=(C(1)-A)/y;if(Math.abs(w)<1e-6||!isFinite(M)){if(Math.abs(x-b)<1e-6)return this.easeTo(e,n);const t=be.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=o!==c,this._pitching=u!==a,this._padding=!i.isPaddingEqual(h),this._prepareEase(n,!1),this._ease((e=>{const d=e*M,m=1/k(d);i.zoom=1===e?l:r+i.scaleZoom(m),this._rotating&&(i.bearing=t.number(o,c,e)),this._pitching&&(i.pitch=t.number(a,u,e)),this._padding&&(i.interpolatePadding(s,h,e),f=i.centerPoint.add(p));const y=1===e?g:i.unproject(_.add(v.mult(I(d))).mult(m));i.setLocationAtPoint(i.renderWorldCopies?y.wrap():y,f),i._updateCenterElevation(),this._fireMoveEvents(n)}),(()=>this._afterEase(n)),e),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,e){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const t=this._onEaseEnd;delete this._onEaseEnd,t.call(this,e)}if(!t){const t=this.handlers;t&&t.stop(!1)}return this}_ease(e,n,i){!1===i.animate||0===i.duration?(e(1),n()):(this._easeStart=t.exported.now(),this._easeOptions=i,this._onEaseFrame=e,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const e=Math.min((t.exported.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(e)),e<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(e,n){e=t.wrap(e,-180,180);const i=Math.abs(e-n);return Math.abs(e-360-n)180?-360:n<-180?360:0}}class br{constructor(e={}){this.options=e,t.bindAll(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)}getDefaultPosition(){return"bottom-right"}onAdd(t){const e=this.options&&this.options.compact;return this._map=t,this._container=o.create("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=o.create("button","mapboxgl-ctrl-attrib-button",this._container),this._compactButton.type="button",this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=o.create("div","mapboxgl-ctrl-attrib-inner",this._container),this._innerContainer.setAttribute("role","list"),e&&this._container.classList.add("mapboxgl-compact"),this._updateAttributions(),this._updateEditLink(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("moveend",this._updateEditLink),void 0===e&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container}onRemove(){o.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0,this._attribHTML=void 0}_setElementTitle(t,e){const n=this._map._getUIString(`AttributionControl.${e}`);t.title=n,t.setAttribute("aria-label",n)}_toggleAttribution(){this._container.classList.contains("mapboxgl-compact-show")?(this._container.classList.remove("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-pressed","false")):(this._container.classList.add("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-pressed","true"))}_updateEditLink(){let e=this._editLink;e||(e=this._editLink=this._container.querySelector(".mapbox-improve-map"));const n=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||t.config.ACCESS_TOKEN}];if(e){const i=n.reduce(((t,e,i)=>(e.value&&(t+=`${e.key}=${e.value}${i"string"!=typeof t?"":t))):"string"==typeof this.options.customAttribution&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const t=this._map.style.stylesheet;this.styleOwner=t.owner,this.styleId=t.id}const e=this._map.style._sourceCaches;for(const n in e){const i=e[n];if(i.used){const e=i.getSource();e.attribution&&t.indexOf(e.attribution)<0&&t.push(e.attribution)}}t.sort(((t,e)=>t.length-e.length)),t=t.filter(((e,n)=>{for(let i=n+1;i=0)return!1;return!0}));const n=t.join(" | ");n!==this._attribHTML&&(this._attribHTML=n,t.length?(this._innerContainer.innerHTML=n,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 wr{constructor(){t.bindAll(["_updateLogo"],this),t.bindAll(["_updateCompact"],this)}onAdd(t){this._map=t,this._container=o.create("div","mapboxgl-ctrl");const e=o.create("a","mapboxgl-ctrl-logo");return e.target="_blank",e.rel="noopener nofollow",e.href="https://www.mapbox.com/",e.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),e.setAttribute("rel","noopener nofollow"),this._container.appendChild(e),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){o.remove(this._container),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact)}getDefaultPosition(){return"bottom-left"}_updateLogo(t){t&&"metadata"!==t.sourceDataType||(this._container.style.display=this._logoRequired()?"block":"none")}_logoRequired(){if(!this._map.style)return!0;const t=this._map.style._sourceCaches;if(0===Object.entries(t).length)return!0;for(const e in t){const n=t[e].getSource();if(n.hasOwnProperty("mapbox_logo")&&!n.mapbox_logo)return!1}return!0}_updateCompact(){const t=this._container.children;if(t.length){const e=t[0];this._map.getCanvasContainer().offsetWidth<250?e.classList.add("mapboxgl-compact"):e.classList.remove("mapboxgl-compact")}}}class Tr{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const e=++this._id;return this._queue.push({callback:t,id:e,cancelled:!1}),e}remove(t){const e=this._currentlyRunning,n=e?this._queue.concat(e):this._queue;for(const e of n)if(e.id===t)return void(e.cancelled=!0)}run(t=0){const e=this._currentlyRunning=this._queue;this._queue=[];for(const n of e)if(!n.cancelled&&(n.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}function Cr(e,n,i){if(e=new t.LngLat(e.lng,e.lat),n){const r=new t.LngLat(e.lng-360,e.lat),o=new t.LngLat(e.lng+360,e.lat),a=360*Math.ceil(Math.abs(e.lng-i.center.lng)/360),s=i.locationPoint(e).distSqr(n),l=n.x<0||n.y<0||n.x>i.width||n.y>i.height;i.locationPoint(r).distSqr(n)180;){const t=i.locationPoint(e);if(t.x>=0&&t.y>=0&&t.x<=i.width&&t.y<=i.height)break;e.lng>i.center.lng?e.lng-=360:e.lng+=360}return e}const Er={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function Sr(t,e,n){const i=t.classList;for(const t in Er)i.remove(`mapboxgl-${n}-anchor-${t}`);i.add(`mapboxgl-${n}-anchor-${e}`)}class Ar extends t.Evented{constructor(e,n){if(super(),(e instanceof t.window.HTMLElement||n)&&(e=t.extend({element:e},n)),t.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer"],this),this._anchor=e&&e.anchor||"center",this._color=e&&e.color||"#3FB1CE",this._scale=e&&e.scale||1,this._draggable=e&&e.draggable||!1,this._clickTolerance=e&&e.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=e&&e.rotation||0,this._rotationAlignment=e&&e.rotationAlignment||"auto",this._pitchAlignment=e&&e.pitchAlignment&&"auto"!==e.pitchAlignment?e.pitchAlignment:this._rotationAlignment,e&&e.element)this._element=e.element,this._offset=t.pointGeometry.convert(e&&e.offset||[0,0]);else{this._defaultMarker=!0,this._element=o.create("div"),this._element.setAttribute("aria-label","Map marker");const n=o.createNS("http://www.w3.org/2000/svg","svg"),i=41,r=27;n.setAttributeNS(null,"display","block"),n.setAttributeNS(null,"height",`${i}px`),n.setAttributeNS(null,"width",`${r}px`),n.setAttributeNS(null,"viewBox",`0 0 ${r} ${i}`);const a=o.createNS("http://www.w3.org/2000/svg","g");a.setAttributeNS(null,"stroke","none"),a.setAttributeNS(null,"stroke-width","1"),a.setAttributeNS(null,"fill","none"),a.setAttributeNS(null,"fill-rule","evenodd");const s=o.createNS("http://www.w3.org/2000/svg","g");s.setAttributeNS(null,"fill-rule","nonzero");const l=o.createNS("http://www.w3.org/2000/svg","g");l.setAttributeNS(null,"transform","translate(3.0, 29.0)"),l.setAttributeNS(null,"fill","#000000");const c=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const t of c){const e=o.createNS("http://www.w3.org/2000/svg","ellipse");e.setAttributeNS(null,"opacity","0.04"),e.setAttributeNS(null,"cx","10.5"),e.setAttributeNS(null,"cy","5.80029008"),e.setAttributeNS(null,"rx",t.rx),e.setAttributeNS(null,"ry",t.ry),l.appendChild(e)}const u=o.createNS("http://www.w3.org/2000/svg","g");u.setAttributeNS(null,"fill",this._color);const h=o.createNS("http://www.w3.org/2000/svg","path");h.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),u.appendChild(h);const d=o.createNS("http://www.w3.org/2000/svg","g");d.setAttributeNS(null,"opacity","0.25"),d.setAttributeNS(null,"fill","#000000");const p=o.createNS("http://www.w3.org/2000/svg","path");p.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),d.appendChild(p);const f=o.createNS("http://www.w3.org/2000/svg","g");f.setAttributeNS(null,"transform","translate(6.0, 7.0)"),f.setAttributeNS(null,"fill","#FFFFFF");const m=o.createNS("http://www.w3.org/2000/svg","g");m.setAttributeNS(null,"transform","translate(8.0, 8.0)");const g=o.createNS("http://www.w3.org/2000/svg","circle");g.setAttributeNS(null,"fill","#000000"),g.setAttributeNS(null,"opacity","0.25"),g.setAttributeNS(null,"cx","5.5"),g.setAttributeNS(null,"cy","5.5"),g.setAttributeNS(null,"r","5.4999962");const _=o.createNS("http://www.w3.org/2000/svg","circle");_.setAttributeNS(null,"fill","#FFFFFF"),_.setAttributeNS(null,"cx","5.5"),_.setAttributeNS(null,"cy","5.5"),_.setAttributeNS(null,"r","5.4999962"),m.appendChild(g),m.appendChild(_),s.appendChild(l),s.appendChild(u),s.appendChild(d),s.appendChild(f),s.appendChild(m),n.appendChild(s),n.setAttributeNS(null,"height",i*this._scale+"px"),n.setAttributeNS(null,"width",r*this._scale+"px"),this._element.appendChild(n),this._offset=t.pointGeometry.convert(e&&e.offset||[0,-14])}this._element.classList.add("mapboxgl-marker"),this._element.addEventListener("dragstart",(t=>{t.preventDefault()})),this._element.addEventListener("mousedown",(t=>{t.preventDefault()})),Sr(this._element,this._anchor,"marker"),this._popup=null}addTo(t){return this.remove(),this._map=t,t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),t.on("remove",this._clearFadeTimer),t._addMarker(this),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._map.off("remove",this._clearFadeTimer),this._map._removeMarker(this),delete this._map),this._clearFadeTimer(),o.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=t.LngLat.convert(e),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){const e=38.1,n=13.5,i=Math.sqrt(Math.pow(n,2)/2);t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-e],"bottom-left":[i,-1*(e-n+i)],"bottom-right":[-i,-1*(e-n+i)],left:[n,-1*(e-n)],right:[-n,-1*(e-n)]}:this._offset}this._popup=t,this._lngLat&&this._popup.setLngLat(this._lngLat),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}_onKeyPress(t){const e=t.code,n=t.charCode||t.keyCode;"Space"!==e&&"Enter"!==e&&32!==n&&13!==n||this.togglePopup()}_onMapClick(t){const e=t.originalEvent.target,n=this._element;this._popup&&(e===n||n.contains(e))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const t=this._popup;return t?(t.isOpen()?t.remove():t.addTo(this._map),this):this}_evaluateOpacity(){const t=this._pos?this._pos.sub(this._transformedOffset()):null;if(!this._withinScreenBounds(t))return void this._clearFadeTimer();const e=this._map.unproject(t);let n=!1;if(this._map.getTerrain()){const t=this._map.getFreeCameraOptions();if(t.position){const i=t.position.toLngLat();n=i.distanceTo(e)<.9*i.distanceTo(this._lngLat)}}const i=(1-this._map._queryFogOpacity(e))*(n?.2:1);this._element.style.opacity=`${i}`,this._popup&&this._popup._setOpacity(`${i}`),this._fadeTimer=null}_clearFadeTimer(){this._fadeTimer&&(clearTimeout(this._fadeTimer),this._fadeTimer=null)}_withinScreenBounds(t){const e=this._map.transform;return!!t&&t.x>=0&&t.x=0&&t.y{this._map&&(this._element&&this._pos&&this._anchor&&o.setTransform(this._element,`${Er[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${n} ${e}`),!this._map.getTerrain()&&!this._map.getFog()||this._fadeTimer||(this._fadeTimer=setTimeout(this._evaluateOpacity.bind(this),60)))}))}_transformedOffset(){if(!this._defaultMarker)return this._offset;const t=this._map.transform,e=this._offset.mult(this._scale);return"map"===this._rotationAlignment&&e._rotate(t.angle),"map"===this._pitchAlignment&&(e.y*=Math.cos(t._pitch)),e}getOffset(){return this._offset}setOffset(e){return this._offset=t.pointGeometry.convert(e),this._update(),this}_onMove(e){if(!this._isDragging){const t=this._clickTolerance||this._map._clickTolerance;this._isDragging=e.point.dist(this._pointerdownPos)>=t}this._isDragging&&(this._pos=e.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none","pending"===this._state&&(this._state="active",this.fire(new t.Event("dragstart"))),this.fire(new t.Event("drag")))}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),"active"===this._state&&this.fire(new t.Event("dragend")),this._state="inactive"}_addDragHandler(t){this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(this._pos).add(this._transformedOffset()),this._pointerdownPos=t.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))}setDraggable(t){return this._draggable=!!t,this._map&&(t?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&"auto"!==t?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}}class kr{constructor(t){this.jumpTo(t)}getValue(e){if(e<=this._startTime)return this._start;if(e>=this._endTime)return this._end;const n=t.easeCubicInOut((e-this._startTime)/(this._endTime-this._startTime));return this._start*(1-n)+this._end*n}isEasing(t){return t>=this._startTime&&t<=this._endTime}jumpTo(t){this._startTime=-1/0,this._endTime=-1/0,this._start=t,this._end=t}easeTo(t,e,n){this._start=this.getValue(e),this._end=t,this._startTime=e,this._endTime=e+n}}const Ir={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox logo","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm"},{HTMLImageElement:Mr,HTMLElement:Pr,ImageBitmap:Dr}=t.window,zr={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,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,optimizeForTerrain:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",localFontFamily:null,transformRequest:null,accessToken:null,fadeDuration:300,crossSourceCollisions:!0};function Or(t){t.parentNode&&t.parentNode.removeChild(t)}const Rr={showCompass:!0,showZoom:!0,visualizePitch:!1};class Lr{constructor(e,n,i=!1){this._clickTolerance=10,this.element=n,this.mouseRotate=new Hi({clickTolerance:e.dragRotate._mouseRotate._clickTolerance}),this.map=e,i&&(this.mousePitch=new Wi({clickTolerance:e.dragRotate._mousePitch._clickTolerance})),t.bindAll(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),o.addEventListener(n,"mousedown",this.mousedown),o.addEventListener(n,"touchstart",this.touchstart,{passive:!1}),o.addEventListener(n,"touchmove",this.touchmove),o.addEventListener(n,"touchend",this.touchend),o.addEventListener(n,"touchcancel",this.reset)}down(t,e){this.mouseRotate.mousedown(t,e),this.mousePitch&&this.mousePitch.mousedown(t,e),o.disableDrag()}move(t,e){const n=this.map,i=this.mouseRotate.mousemoveWindow(t,e);if(i&&i.bearingDelta&&n.setBearing(n.getBearing()+i.bearingDelta),this.mousePitch){const i=this.mousePitch.mousemoveWindow(t,e);i&&i.pitchDelta&&n.setPitch(n.getPitch()+i.pitchDelta)}}off(){const t=this.element;o.removeEventListener(t,"mousedown",this.mousedown),o.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),o.removeEventListener(t,"touchmove",this.touchmove),o.removeEventListener(t,"touchend",this.touchend),o.removeEventListener(t,"touchcancel",this.reset),this.offTemp()}offTemp(){o.enableDrag(),o.removeEventListener(t.window,"mousemove",this.mousemove),o.removeEventListener(t.window,"mouseup",this.mouseup)}mousedown(e){this.down(t.extend({},e,{ctrlKey:!0,preventDefault:()=>e.preventDefault()}),o.mousePos(this.element,e)),o.addEventListener(t.window,"mousemove",this.mousemove),o.addEventListener(t.window,"mouseup",this.mouseup)}mousemove(t){this.move(t,o.mousePos(this.element,t))}mouseup(t){this.mouseRotate.mouseupWindow(t),this.mousePitch&&this.mousePitch.mouseupWindow(t),this.offTemp()}touchstart(t){1!==t.targetTouches.length?this.reset():(this._startPos=this._lastPos=o.touchPos(this.element,t.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>t.preventDefault()},this._startPos))}touchmove(t){1!==t.targetTouches.length?this.reset():(this._lastPos=o.touchPos(this.element,t.targetTouches)[0],this.move({preventDefault:()=>t.preventDefault()},this._lastPos))}touchend(t){0===t.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)5280?Vr(e,i,n/5280,t._getUIString("ScaleControl.Miles"),t):Vr(e,i,n,t._getUIString("ScaleControl.Feet"),t)}else n&&"nautical"===n.unit?Vr(e,i,s/1852,t._getUIString("ScaleControl.NauticalMiles"),t):s>=1e3?Vr(e,i,s/1e3,t._getUIString("ScaleControl.Kilometers"),t):Vr(e,i,s,t._getUIString("ScaleControl.Meters"),t)}function Vr(t,e,n,i,r){const o=function(t){const e=Math.pow(10,`${Math.floor(t)}`.length-1);let n=t/e;return n=n>=10?10:n>=5?5:n>=3?3:n>=2?2:n>=1?1:function(t){const e=Math.pow(10,Math.ceil(-Math.log(t)/Math.LN10));return Math.round(t*e)/e}(n),e*n}(n),a=o/n;r._requestDomTask((()=>{t.style.width=e*a+"px",t.innerHTML=`${o} ${i}`}))}const Gr={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},qr=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Zr(e){if(e){if("number"==typeof e){const n=Math.round(Math.sqrt(.5*Math.pow(e,2)));return{center:new t.pointGeometry(0,0),top:new t.pointGeometry(0,e),"top-left":new t.pointGeometry(n,n),"top-right":new t.pointGeometry(-n,n),bottom:new t.pointGeometry(0,-e),"bottom-left":new t.pointGeometry(n,-n),"bottom-right":new t.pointGeometry(-n,-n),left:new t.pointGeometry(e,0),right:new t.pointGeometry(-e,0)}}if(e instanceof t.pointGeometry||Array.isArray(e)){const n=t.pointGeometry.convert(e);return{center:n,top:n,"top-left":n,"top-right":n,bottom:n,"bottom-left":n,"bottom-right":n,left:n,right:n}}return{center:t.pointGeometry.convert(e.center||[0,0]),top:t.pointGeometry.convert(e.top||[0,0]),"top-left":t.pointGeometry.convert(e["top-left"]||[0,0]),"top-right":t.pointGeometry.convert(e["top-right"]||[0,0]),bottom:t.pointGeometry.convert(e.bottom||[0,0]),"bottom-left":t.pointGeometry.convert(e["bottom-left"]||[0,0]),"bottom-right":t.pointGeometry.convert(e["bottom-right"]||[0,0]),left:t.pointGeometry.convert(e.left||[0,0]),right:t.pointGeometry.convert(e.right||[0,0])}}return Zr(new t.pointGeometry(0,0))}const Hr={version:t.version,supported:e,setRTLTextPlugin:t.setRTLTextPlugin,getRTLTextPluginStatus:t.getRTLTextPluginStatus,Map:class extends xr{constructor(e){if(null!=(e=t.extend({},zr,e)).minZoom&&null!=e.maxZoom&&e.minZoom>e.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(null!=e.minPitch&&null!=e.maxPitch&&e.minPitch>e.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(null!=e.minPitch&&e.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(null!=e.maxPitch&&e.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new Ti(e.minZoom,e.maxZoom,e.minPitch,e.maxPitch,e.renderWorldCopies),e),this._interactive=e.interactive,this._maxTileCacheSize=e.maxTileCacheSize,this._failIfMajorPerformanceCaveat=e.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=e.preserveDrawingBuffer,this._antialias=e.antialias,this._trackResize=e.trackResize,this._bearingSnap=e.bearingSnap,this._refreshExpiredTiles=e.refreshExpiredTiles,this._fadeDuration=e.fadeDuration,this._isInitialLoad=!0,this._crossSourceCollisions=e.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=e.collectResourceTiming,this._optimizeForTerrain=e.optimizeForTerrain,this._renderTaskQueue=new Tr,this._domRenderTaskQueue=new Tr,this._controls=[],this._markers=[],this._mapId=t.uniqueId(),this._locale=t.extend({},Ir,e.locale),this._clickTolerance=e.clickTolerance,this._averageElevationLastSampledAt=-1/0,this._averageElevation=new kr(0),this._requestManager=new t.RequestManager(e.transformRequest,e.accessToken,e.testMode),this._silenceAuthErrors=!!e.testMode,"string"==typeof e.container){if(this._container=t.window.document.getElementById(e.container),!this._container)throw new Error(`Container '${e.container}' not found.`)}else{if(!(e.container instanceof Pr))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=e.container}if(e.maxBounds&&this.setMaxBounds(e.maxBounds),t.bindAll(["_onWindowOnline","_onWindowResize","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),void 0===this.painter)throw new Error("Failed to initialize WebGL.");this.on("move",(()=>this._update(!1))),this.on("moveend",(()=>this._update(!1))),this.on("zoom",(()=>this._update(!0))),void 0!==t.window&&(t.window.addEventListener("online",this._onWindowOnline,!1),t.window.addEventListener("resize",this._onWindowResize,!1),t.window.addEventListener("orientationchange",this._onWindowResize,!1),t.window.addEventListener("webkitfullscreenchange",this._onWindowResize,!1)),this.handlers=new yr(this,e),this._hash=e.hash&&new Ei("string"==typeof e.hash&&e.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:e.center,zoom:e.zoom,bearing:e.bearing,pitch:e.pitch}),e.bounds&&(this.resize(),this.fitBounds(e.bounds,t.extend({},e.fitBoundsOptions,{duration:0})))),this.resize(),this._localFontFamily=e.localFontFamily,this._localIdeographFontFamily=e.localIdeographFontFamily,e.style&&this.setStyle(e.style,{localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily}),e.attributionControl&&this.addControl(new br({customAttribution:e.customAttribution})),this._logoControl=new wr,this.addControl(this._logoControl,e.logoPosition),this.on("style.load",(()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)})),this.on("data",(e=>{this._update("style"===e.dataType),this.fire(new t.Event(`${e.dataType}data`,e))})),this.on("dataloading",(e=>{this.fire(new t.Event(`${e.dataType}dataloading`,e))}))}_getMapId(){return this._mapId}addControl(e,n){if(void 0===n&&(n=e.getDefaultPosition?e.getDefaultPosition():"top-right"),!e||!e.onAdd)return this.fire(new t.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const i=e.onAdd(this);this._controls.push(e);const r=this._controlPositions[n];return-1!==n.indexOf("bottom")?r.insertBefore(i,r.firstChild):r.appendChild(i),this}removeControl(e){if(!e||!e.onRemove)return this.fire(new t.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const n=this._controls.indexOf(e);return n>-1&&this._controls.splice(n,1),e.onRemove(this),this}hasControl(t){return this._controls.indexOf(t)>-1}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}resize(e){const n=this._containerDimensions(),i=n[0],r=n[1];this._resizeCanvas(i,r),this.transform.resize(i,r),this.painter.resize(i,r);const o=!this._moving;return o&&(this.stop(),this.fire(new t.Event("movestart",e)).fire(new t.Event("move",e))),this.fire(new t.Event("resize",e)),o&&this.fire(new t.Event("moveend",e)),this}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(e){return this.transform.setMaxBounds(t.LngLatBounds.convert(e)),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;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;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(t){return this.transform.renderWorldCopies=t,this._update()}project(e){return this.transform.locationPoint3D(t.LngLat.convert(e))}unproject(e){return this.transform.pointLocation3D(t.pointGeometry.convert(e))}isMoving(){return this._moving||this.handlers&&this.handlers.isMoving()}isZooming(){return this._zooming||this.handlers&&this.handlers.isZooming()}isRotating(){return this._rotating||this.handlers&&this.handlers.isRotating()}_createDelegatedListener(t,e,n){if("mouseenter"===t||"mouseover"===t){let i=!1;const r=r=>{const o=this.getLayer(e)?this.queryRenderedFeatures(r.point,{layers:[e]}):[];o.length?i||(i=!0,n.call(this,new Oi(t,this,r.originalEvent,{features:o}))):i=!1};return{layer:e,listener:n,delegates:{mousemove:r,mouseout:()=>{i=!1}}}}if("mouseleave"===t||"mouseout"===t){let i=!1;const r=r=>{(this.getLayer(e)?this.queryRenderedFeatures(r.point,{layers:[e]}):[]).length?i=!0:i&&(i=!1,n.call(this,new Oi(t,this,r.originalEvent)))},o=e=>{i&&(i=!1,n.call(this,new Oi(t,this,e.originalEvent)))};return{layer:e,listener:n,delegates:{mousemove:r,mouseout:o}}}{const i=t=>{const i=this.getLayer(e)?this.queryRenderedFeatures(t.point,{layers:[e]}):[];i.length&&(t.features=i,n.call(this,t),delete t.features)};return{layer:e,listener:n,delegates:{[t]:i}}}}on(t,e,n){if(void 0===n)return super.on(t,e);const i=this._createDelegatedListener(t,e,n);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[t]=this._delegatedListeners[t]||[],this._delegatedListeners[t].push(i);for(const t in i.delegates)this.on(t,i.delegates[t]);return this}once(t,e,n){if(void 0===n)return super.once(t,e);const i=this._createDelegatedListener(t,e,n);for(const t in i.delegates)this.once(t,i.delegates[t]);return this}off(t,e,n){return void 0===n?super.off(t,e):(this._delegatedListeners&&this._delegatedListeners[t]&&(i=>{const r=this._delegatedListeners[t];for(let t=0;t{e?this.fire(new t.ErrorEvent(e)):i&&this._updateDiff(i,n)}))}else"object"==typeof e&&this._updateDiff(e,n)}_updateDiff(e,n){try{this.style.setState(e)&&this._update(!0)}catch(i){t.warnOnce(`Unable to perform style diff: ${i.message||i.error||i}. Rebuilding the style from scratch.`),this._updateStyle(e,n)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():t.warnOnce("There is no style added to the map.")}addSource(t,e){return this._lazyInitEmptyStyle(),this.style.addSource(t,e),this._update(!0)}isSourceLoaded(e){const n=this.style&&this.style._getSourceCaches(e);if(0!==n.length)return n.every((t=>t.loaded()));this.fire(new t.ErrorEvent(new Error(`There is no source with ID '${e}'`)))}areTilesLoaded(){const t=this.style&&this.style._sourceCaches;for(const e in t){const n=t[e]._tiles;for(const t in n){const e=n[t];if("loaded"!==e.state&&"errored"!==e.state)return!1}}return!0}addSourceType(t,e,n){return this._lazyInitEmptyStyle(),this.style.addSourceType(t,e,n)}removeSource(t){return this.style.removeSource(t),this._updateTerrain(),this._update(!0)}getSource(t){return this.style.getSource(t)}addImage(e,n,{pixelRatio:i=1,sdf:r=!1,stretchX:o,stretchY:a,content:s}={}){if(this._lazyInitEmptyStyle(),n instanceof Mr||Dr&&n instanceof Dr){const{width:l,height:c,data:u}=t.exported.getImageData(n);this.style.addImage(e,{data:new t.RGBAImage({width:l,height:c},u),pixelRatio:i,stretchX:o,stretchY:a,content:s,sdf:r,version:0})}else{if(void 0===n.width||void 0===n.height)return this.fire(new t.ErrorEvent(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:l,height:c,data:u}=n,h=n;this.style.addImage(e,{data:new t.RGBAImage({width:l,height:c},new Uint8Array(u)),pixelRatio:i,stretchX:o,stretchY:a,content:s,sdf:r,version:0,userImage:h}),h.onAdd&&h.onAdd(this,e)}}}updateImage(e,n){const i=this.style.getImage(e);if(!i)return this.fire(new t.ErrorEvent(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const r=n instanceof Mr||Dr&&n instanceof Dr?t.exported.getImageData(n):n,{width:o,height:a,data:s}=r;return void 0===o||void 0===a?this.fire(new t.ErrorEvent(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`"))):o!==i.data.width||a!==i.data.height?this.fire(new t.ErrorEvent(new Error("The width and height of the updated image must be that same as the previous version of the image"))):(i.data.replace(s,!(n instanceof Mr||Dr&&n instanceof Dr)),void this.style.updateImage(e,i))}hasImage(e){return e?!!this.style.getImage(e):(this.fire(new t.ErrorEvent(new Error("Missing required image id"))),!1)}removeImage(t){this.style.removeImage(t)}loadImage(e,n){t.getImage(this._requestManager.transformRequest(e,t.ResourceType.Image),((e,i)=>{n(e,i instanceof Mr?t.exported.getImageData(i):i)}))}listImages(){return this.style.listImages()}addLayer(t,e){return this._lazyInitEmptyStyle(),this.style.addLayer(t,e),this._update(!0)}moveLayer(t,e){return this.style.moveLayer(t,e),this._update(!0)}removeLayer(t){return this.style.removeLayer(t),this._update(!0)}getLayer(t){return this.style.getLayer(t)}setLayerZoomRange(t,e,n){return this.style.setLayerZoomRange(t,e,n),this._update(!0)}setFilter(t,e,n={}){return this.style.setFilter(t,e,n),this._update(!0)}getFilter(t){return this.style.getFilter(t)}setPaintProperty(t,e,n,i={}){return this.style.setPaintProperty(t,e,n,i),this._update(!0)}getPaintProperty(t,e){return this.style.getPaintProperty(t,e)}setLayoutProperty(t,e,n,i={}){return this.style.setLayoutProperty(t,e,n,i),this._update(!0)}getLayoutProperty(t,e){return this.style.getLayoutProperty(t,e)}setLight(t,e={}){return this._lazyInitEmptyStyle(),this.style.setLight(t,e),this._update(!0)}getLight(){return this.style.getLight()}setTerrain(t){return this._lazyInitEmptyStyle(),this.style.setTerrain(t),this._averageElevationLastSampledAt=-1/0,this._update(!0)}getTerrain(){return this.style?this.style.getTerrain():null}setFog(t){return this._lazyInitEmptyStyle(),this.style.setFog(t),this._update(!0)}getFog(){return this.style?this.style.getFog():null}_queryFogOpacity(e){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(t.LngLat.convert(e),this.transform):0}setFeatureState(t,e){return this.style.setFeatureState(t,e),this._update()}removeFeatureState(t,e){return this.style.removeFeatureState(t,e),this._update()}getFeatureState(t){return this.style.getFeatureState(t)}_containerDimensions(){let t=0,e=0;return this._container&&(t=this._container.clientWidth||400,e=this._container.clientHeight||300),[t,e]}_detectMissingCSS(){"rgb(250, 128, 114)"!==t.window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")&&t.warnOnce("This page appears to be missing CSS declarations for Mapbox GL JS, which may cause the map to display incorrectly. Please ensure your page includes mapbox-gl.css, as described in https://www.mapbox.com/mapbox-gl-js/api/.")}_setupContainer(){const t=this._container;t.classList.add("mapboxgl-map"),(this._missingCSSCanary=o.create("div","mapboxgl-canary",t)).style.visibility="hidden",this._detectMissingCSS();const e=this._canvasContainer=o.create("div","mapboxgl-canvas-container",t);this._interactive&&e.classList.add("mapboxgl-interactive"),this._canvas=o.create("canvas","mapboxgl-canvas",e),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");const n=this._containerDimensions();this._resizeCanvas(n[0],n[1]);const i=this._controlContainer=o.create("div","mapboxgl-control-container",t),r=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach((t=>{r[t]=o.create("div",`mapboxgl-ctrl-${t}`,i)})),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(e,n){const i=t.exported.devicePixelRatio||1;this._canvas.width=i*e,this._canvas.height=i*n,this._canvas.style.width=`${e}px`,this._canvas.style.height=`${n}px`}_addMarker(t){this._markers.push(t)}_removeMarker(t){const e=this._markers.indexOf(t);-1!==e&&this._markers.splice(e,1)}_setupPainter(){const n=t.extend({},e.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),i=this._canvas.getContext("webgl",n)||this._canvas.getContext("experimental-webgl",n);i?(t.storeAuthState(i,!0),this.painter=new pi(i,this.transform),this.on("data",(t=>{"source"===t.dataType&&this.painter.setTileLoadedFlag(!0)})),t.exported$1.testSupport(i)):this.fire(new t.ErrorEvent(new Error("Failed to initialize WebGL")))}_contextLost(e){e.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new t.Event("webglcontextlost",{originalEvent:e}))}_contextRestored(e){this._setupPainter(),this.resize(),this._update(),this.fire(new t.Event("webglcontextrestored",{originalEvent:e}))}_onMapScroll(t){if(t.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(t){return this.style?(this._styleDirty=this._styleDirty||t,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(t){return this._update(),this._renderTaskQueue.add(t)}_cancelRenderFrame(t){this._renderTaskQueue.remove(t)}_requestDomTask(t){!this.isMoving()&&this.loaded()?t():this._domRenderTaskQueue.add(t)}_render(e){let n;const i=this.painter.context.extTimerQuery,r=t.exported.now();this.listens("gpu-timing-frame")&&(n=i.createQueryEXT(),i.beginQueryEXT(i.TIME_ELAPSED_EXT,n));let o=this._updateAverageElevation(r);if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(e),this._domRenderTaskQueue.run(e),this._removed)return;let a=!1;const s=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;const e=this.transform.zoom,n=t.exported.now();this.style.zoomHistory.update(e,n);const i=new t.EvaluationParameters(e,{now:n,fadeDuration:s,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),r=i.crossFadingFactor();1===r&&r===this._crossFadingFactor||(a=!0,this._crossFadingFactor=r),this.style.update(i)}if(this.style&&this.style.fog&&this.style.fog.hasTransition()&&(this.style._markersNeedUpdate=!0,this._sourcesDirty=!0),this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),this.style._updateSources(this.transform)),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,s,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showTerrainWireframe:this.showTerrainWireframe,showOverdrawInspector:this._showOverdrawInspector,showQueryGeometry:!!this._showQueryGeometry,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:s,isInitialLoad:this._isInitialLoad,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer"),speedIndexTiming:this.speedIndexTiming}),this.fire(new t.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new t.Event("load"))),this.style&&(this.style.hasTransitions()||a)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),this.listens("gpu-timing-frame")){const e=t.exported.now()-r;i.endQueryEXT(i.TIME_ELAPSED_EXT,n),setTimeout((()=>{const r=i.getQueryObjectEXT(n,i.QUERY_RESULT_EXT)/1e6;i.deleteQueryEXT(n),this.fire(new t.Event("gpu-timing-frame",{cpuTime:e,gpuTime:r}))}),50)}if(this.listens("gpu-timing-layer")){const e=this.painter.collectGpuTimers();setTimeout((()=>{const n=this.painter.queryGpuTimers(e);this.fire(new t.Event("gpu-timing-layer",{layerTimes:n}))}),50)}const l=this._sourcesDirty||this._styleDirty||this._placementDirty||o;if(l||this._repaint)this.triggerRepaint();else{const e=!this.isMoving()&&this.loaded();if(e&&(o=this._updateAverageElevation(r,!0)),o)this.triggerRepaint();else if(this._triggerFrame(!1),e&&(this.fire(new t.Event("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){const e=this._calculateSpeedIndex();this.fire(new t.Event("speedindexcompleted",{speedIndex:e})),this.speedIndexTiming=!1}}return!this._loaded||this._fullyLoaded||l||(this._fullyLoaded=!0,this._authenticate()),this}_updateAverageElevation(t,e=!1){const n=t=>(this.transform.averageElevation=t,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return 0!==this.transform.averageElevation&&n(0);if((e||t-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(t)){const e=this.transform.averageElevation;let i=this.transform.sampleAverageElevation();isNaN(i)?i=0:this._averageElevationLastSampledAt=t;const r=Math.abs(e-i);if(r>1){if(this._isInitialLoad)return this._averageElevation.jumpTo(i),n(i);this._averageElevation.easeTo(i,t,300)}else if(r>1e-4)return this._averageElevation.jumpTo(i),n(i)}return!!this._averageElevation.isEasing(t)&&n(this._averageElevation.getValue(t))}_authenticate(){t.getMapSessionAPI(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,(e=>{if(e&&(e.message===t.AUTH_ERR_MSG||401===e.status)){const e=this.painter.context.gl;t.storeAuthState(e,!1),this._logoControl instanceof wr&&this._logoControl._updateLogo(),e&&e.clear(e.DEPTH_BUFFER_BIT|e.COLOR_BUFFER_BIT|e.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new t.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/")))}})),t.postMapLoadEvent(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,(()=>{}))}_updateTerrain(){this.painter.updateTerrain(this.style,this.isMoving()||this.isRotating()||this.isZooming())}_calculateSpeedIndex(){const t=this.painter.canvasCopy(),e=this.painter.getCanvasCopiesAndTimestamps();e.timeStamps.push(performance.now());const n=this.painter.context.gl,i=n.createFramebuffer();function r(t){n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,t,0);const e=new Uint8Array(n.drawingBufferWidth*n.drawingBufferHeight*4);return n.readPixels(0,0,n.drawingBufferWidth,n.drawingBufferHeight,n.RGBA,n.UNSIGNED_BYTE,e),e}return n.bindFramebuffer(n.FRAMEBUFFER,i),this._canvasPixelComparison(r(t),e.canvasCopies.map(r),e.timeStamps)}_canvasPixelComparison(t,e,n){let i=n[1]-n[0];const r=t.length/4;for(let o=0;o{const e=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,e&&this._render(t)})))}_onWindowOnline(){this._update()}_onWindowResize(t){this._trackResize&&this.resize({originalEvent:t})._update()}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(t){this._showTileBoundaries!==t&&(this._showTileBoundaries=t,this._update())}get showTerrainWireframe(){return!!this._showTerrainWireframe}set showTerrainWireframe(t){this._showTerrainWireframe!==t&&(this._showTerrainWireframe=t,this._update())}get speedIndexTiming(){return!!this._speedIndexTiming}set speedIndexTiming(t){this._speedIndexTiming!==t&&(this._speedIndexTiming=t,this._update())}get showPadding(){return!!this._showPadding}set showPadding(t){this._showPadding!==t&&(this._showPadding=t,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(t){this._showCollisionBoxes!==t&&(this._showCollisionBoxes=t,t?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(t){this._showOverdrawInspector!==t&&(this._showOverdrawInspector=t,this._update())}get repaint(){return!!this._repaint}set repaint(t){this._repaint!==t&&(this._repaint=t,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(t){this._vertices=t,this._update()}_setCacheLimits(e,n){t.setCacheLimits(e,n)}get version(){return t.version}},NavigationControl:class{constructor(e){this.options=t.extend({},Rr,e),this._container=o.create("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",(t=>t.preventDefault())),this.options.showZoom&&(t.bindAll(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",(t=>this._map.zoomIn({},{originalEvent:t}))),o.create("span","mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden",!0),this._zoomOutButton=this._createButton("mapboxgl-ctrl-zoom-out",(t=>this._map.zoomOut({},{originalEvent:t}))),o.create("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden",!0)),this.options.showCompass&&(t.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",(t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})})),this._compassIcon=o.create("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden",!0))}_updateZoomButtons(){const t=this._map.getZoom(),e=t===this._map.getMaxZoom(),n=t===this._map.getMinZoom();this._zoomInButton.disabled=e,this._zoomOutButton.disabled=n,this._zoomInButton.setAttribute("aria-disabled",e.toString()),this._zoomOutButton.setAttribute("aria-disabled",n.toString())}_rotateCompassArrow(){const t=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._map._requestDomTask((()=>{this._compassIcon&&(this._compassIcon.style.transform=t)}))}onAdd(t){return this._map=t,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Lr(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){o.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(t,e){const n=o.create("button",t,this._container);return n.type="button",n.addEventListener("click",e),n}_setButtonTitle(t,e){const n=this._map._getUIString(`NavigationControl.${e}`);t.title=n,t.setAttribute("aria-label",n)}},GeolocateControl:class extends t.Evented{constructor(e){super(),this.options=t.extend({},Fr,e),t.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation"],this),this._onDeviceOrientationListener=this._onDeviceOrientation.bind(this),this._updateMarkerRotationThrottled=Ci(this._updateMarkerRotation,20)}onAdd(e){var n;return this._map=e,this._container=o.create("div","mapboxgl-ctrl mapboxgl-ctrl-group"),n=this._setupUI,void 0!==$r?n($r):void 0!==t.window.navigator.permissions?t.window.navigator.permissions.query({name:"geolocation"}).then((t=>{$r="denied"!==t.state,n($r)})):($r=!!t.window.navigator.geolocation,n($r)),this._container}onRemove(){void 0!==this._geolocationWatchID&&(t.window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),o.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Br=0,Nr=!1}_isOutOfMapMaxBounds(t){const e=this._map.getMaxBounds(),n=t.coords;return e&&(n.longitudee.getEast()||n.latitudee.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(e){if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new t.Event("outofmaxbounds",e)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background")}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(e),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove("mapboxgl-user-location-dot-stale"),this.fire(new t.Event("geolocate",e)),this._finish()}}_updateCamera(e){const n=new t.LngLat(e.coords.longitude,e.coords.latitude),i=e.coords.accuracy,r=this._map.getBearing(),o=t.extend({bearing:r},this.options.fitBoundsOptions);this._map.fitBounds(n.toBounds(i),o,{geolocateSource:!0})}_updateMarker(e){if(e){const n=new t.LngLat(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(n).addTo(this._map),this._userLocationDotMarker.setLngLat(n).addTo(this._map),this._accuracy=e.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const t=this._map._container.clientHeight/2,e=this._map.unproject([0,t]),n=this._map.unproject([100,t]),i=e.distanceTo(n)/100,r=Math.ceil(2*this._accuracy/i);this._circleElement.style.width=`${r}px`,this._circleElement.style.height=`${r}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(e){if(this._map){if(this.options.trackUserLocation)if(1===e.code){this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===e.code&&Nr)return;this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("mapboxgl-user-location-dot-stale"),this.fire(new t.Event("error",e)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(e){if(this._container.addEventListener("contextmenu",(t=>t.preventDefault())),this._geolocateButton=o.create("button","mapboxgl-ctrl-geolocate",this._container),o.create("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden",!0),this._geolocateButton.type="button",!1===e){t.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");const e=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e)}else{const t=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=o.create("div","mapboxgl-user-location"),this._dotElement.appendChild(o.create("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(o.create("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new Ar({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=o.create("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Ar({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",(e=>{e.geolocateSource||"ACTIVE_LOCK"!==this._watchState||e.originalEvent&&"resize"===e.originalEvent.type||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this.fire(new t.Event("trackuserlocationend")))}))}_onDeviceOrientation(t){this._userLocationDotMarker&&(t.webkitCompassHeading?this._heading=t.webkitCompassHeading:!0===t.absolute&&(this._heading=-1*t.alpha),this._updateMarkerRotationThrottled())}trigger(){if(!this._setup)return t.warnOnce("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new t.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Br--,Nr=!1,this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this.fire(new t.Event("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new t.Event("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error")}if("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){let e;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Br++,Br>1?(e={maximumAge:6e5,timeout:0},Nr=!0):(e=this.options.positionOptions,Nr=!1),this._geolocationWatchID=t.window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,e),this.options.showUserHeading&&this._addDeviceOrientationListener()}}else t.window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_addDeviceOrientationListener(){const e=()=>{t.window.addEventListener("ondeviceorientationabsolute"in t.window?"deviceorientationabsolute":"deviceorientation",this._onDeviceOrientationListener)};void 0!==t.window.DeviceMotionEvent&&"function"==typeof t.window.DeviceMotionEvent.requestPermission?DeviceOrientationEvent.requestPermission().then((t=>{"granted"===t&&e()})).catch(console.error):e()}_clearWatch(){t.window.navigator.geolocation.clearWatch(this._geolocationWatchID),t.window.removeEventListener("deviceorientation",this._onDeviceOrientationListener),t.window.removeEventListener("deviceorientationabsolute",this._onDeviceOrientationListener),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:br,ScaleControl:class{constructor(e){this.options=t.extend({},jr,e),t.bindAll(["_onMove","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_onMove(){Ur(this._map,this._container,this.options)}onAdd(t){return this._map=t,this._container=o.create("div","mapboxgl-ctrl mapboxgl-ctrl-scale",t.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){o.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}setUnit(t){this.options.unit=t,Ur(this._map,this._container,this.options)}},FullscreenControl:class{constructor(e){this._fullscreen=!1,e&&e.container&&(e.container instanceof t.window.HTMLElement?this._container=e.container:t.warnOnce("Full screen control 'container' must be a DOM element.")),t.bindAll(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in t.window.document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in t.window.document&&(this._fullscreenchange="webkitfullscreenchange")}onAdd(e){return this._map=e,this._container||(this._container=this._map.getContainer()),this._controlContainer=o.create("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",t.warnOnce("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){o.remove(this._controlContainer),this._map=null,t.window.document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!(!t.window.document.fullscreenEnabled&&!t.window.document.webkitFullscreenEnabled)}_setupUI(){const e=this._fullscreenButton=o.create("button","mapboxgl-ctrl-fullscreen",this._controlContainer);o.create("span","mapboxgl-ctrl-icon",e).setAttribute("aria-hidden",!0),e.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),t.window.document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const t=this._getTitle();this._fullscreenButton.setAttribute("aria-label",t),this._fullscreenButton.title=t}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(t.window.document.fullscreenElement||t.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()?t.window.document.exitFullscreen?t.window.document.exitFullscreen():t.window.document.webkitCancelFullScreen&&t.window.document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},Popup:class extends t.Evented{constructor(e){super(),this.options=t.extend(Object.create(Gr),e),t.bindAll(["_update","_onClose","remove","_onMouseMove","_onMouseUp","_onDrag"],this)}addTo(e){return this._map&&this.remove(),this._map=e,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("mapboxgl-track-pointer")):this._map.on("move",this._update),this.fire(new t.Event("open")),this}isOpen(){return!!this._map}remove(){return this._content&&o.remove(this._content),this._container&&(o.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),delete this._map),this.fire(new t.Event("close")),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=t.LngLat.convert(e),this._pos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.remove("mapboxgl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("mapboxgl-track-pointer")),this}getElement(){return this._container}setText(e){return this.setDOMContent(t.window.document.createTextNode(e))}setHTML(e){const n=t.window.document.createDocumentFragment(),i=t.window.document.createElement("body");let r;for(i.innerHTML=e;r=i.firstChild,r;)n.appendChild(r);return this.setDOMContent(n)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(t){return this.options.maxWidth=t,this._update(),this}setDOMContent(t){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=o.create("div","mapboxgl-popup-content",this._container);return this._content.appendChild(t),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(t){this._container&&this._container.classList.add(t)}removeClassName(t){this._container&&this._container.classList.remove(t)}setOffset(t){return this.options.offset=t,this._update(),this}toggleClassName(t){if(this._container)return this._container.classList.toggle(t)}_createCloseButton(){this.options.closeButton&&(this._closeButton=o.create("button","mapboxgl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_onMouseUp(t){this._update(t.point)}_onMouseMove(t){this._update(t.point)}_onDrag(t){this._update(t.point)}_update(t){if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(this._container||(this._container=o.create("div","mapboxgl-popup",this._map.getContainer()),this._tip=o.create("div","mapboxgl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className&&this.options.className.split(" ").forEach((t=>this._container.classList.add(t))),this._trackPointer&&this._container.classList.add("mapboxgl-popup-track-pointer")),this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=Cr(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!t)return;const e=this._pos=this._trackPointer&&t?t:this._map.project(this._lngLat);let n=this.options.anchor;const i=Zr(this.options.offset);if(!n){const t=this._container.offsetWidth,r=this._container.offsetHeight;let o;o=e.y+i.bottom.ythis._map.transform.height-r?["bottom"]:[],e.xthis._map.transform.width-t/2&&o.push("right"),n=0===o.length?"bottom":o.join("-")}const r=e.add(i[n]).round();this._map._requestDomTask((()=>{this._container&&n&&(o.setTransform(this._container,`${Er[n]} translate(${r.x}px,${r.y}px)`),Sr(this._container,n,"popup"))}))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const t=this._container.querySelector(qr);t&&t.focus()}_onClose(){this.remove()}_setOpacity(t){this._content&&(this._content.style.opacity=t),this._tip&&(this._tip.style.opacity=t)}},Marker:Ar,Style:Ue,LngLat:t.LngLat,LngLatBounds:t.LngLatBounds,Point:t.pointGeometry,MercatorCoordinate:t.MercatorCoordinate,FreeCameraOptions:bi,Evented:t.Evented,config:t.config,prewarm:function(){Rt().acquire(Dt)},clearPrewarmedResources:function(){const t=Ot;t&&t.isPreloaded()&&1===t.numActive()&&(t.release(Dt),Ot=null)},get accessToken(){return t.config.ACCESS_TOKEN},set accessToken(e){t.config.ACCESS_TOKEN=e},get baseApiUrl(){return t.config.API_URL},set baseApiUrl(e){t.config.API_URL=e},get workerCount(){return zt.workerCount},set workerCount(t){zt.workerCount=t},get maxParallelImageRequests(){return t.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(e){t.config.MAX_PARALLEL_IMAGE_REQUESTS=e},clearStorage(e){t.clearTileCache(e)},workerUrl:"",workerClass:null,setNow:t.exported.setNow,restoreNow:t.exported.restoreNow};return Hr})),i}))}).call(this)}).call(this,t("_process"))},{_process:7}],7:[function(t,e,n){var i,r,o=e.exports={};function a(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function l(t){if(i===setTimeout)return setTimeout(t,0);if((i===a||!i)&&setTimeout)return i=setTimeout,setTimeout(t,0);try{return i(t,0)}catch(e){try{return i.call(null,t,0)}catch(e){return i.call(this,t,0)}}}!function(){try{i="function"==typeof setTimeout?setTimeout:a}catch(t){i=a}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(t){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 t=l(p);h=!0;for(var e=u.length;e;){for(c=u,u=[];++d1)for(var n=1;n 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.")};t.version="2.0.8","undefined"!=typeof window&&window.addEventListener("mousewheel",void 0);var e="data-scrollmagic-pin-spacer";t.Controller=function(i){var o,a,s="ScrollMagic.Controller",l="REVERSE",c="PAUSED",u=n.defaults,h=this,d=r.extend({},u,i),p=[],f=!1,m=0,g=c,_=!0,v=0,y=!0,x=function(){d.refreshInterval>0&&(a=window.setTimeout(A,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(t){d.vertical?_?window.scrollTo(r.get.scrollLeft(),t):d.container.scrollTop=t:_?window.scrollTo(t,r.get.scrollTop()):d.container.scrollLeft=t},C=function(){if(y&&f){var t=r.type.Array(f)?f:p.slice(0);f=!1;var e=m,n=(m=h.scrollPos())-e;0!==n&&(g=n>0?"FORWARD":l),g===l&&t.reverse(),t.forEach((function(e,n){k(3,"updating Scene "+(n+1)+"/"+t.length+" ("+p.length+" total)"),e.update(!0)})),0===t.length&&d.loglevel>=3&&k(3,"updating 0 Scenes (nothing added to controller)")}},E=function(){o=r.rAF(C)},S=function(t){k(3,"event fired causing an update:",t.type),"resize"==t.type&&(v=w(),g=c),!0!==f&&(f=!0,E())},A=function(){if(!_&&v!=w()){var t;try{t=new Event("resize",{bubbles:!1,cancelable:!1})}catch(e){(t=document.createEvent("Event")).initEvent("resize",!1,!1)}d.container.dispatchEvent(t)}p.forEach((function(t,e){t.refresh()})),x()},k=this._log=function(t,e){d.loglevel>=t&&(Array.prototype.splice.call(arguments,1,0,"("+s+") ->"),r.log.apply(window,arguments))};this._options=d;var I=function(t){if(t.length<=1)return t;var e=t.slice(0);return e.sort((function(t,e){return t.scrollOffset()>e.scrollOffset()?1:-1})),e};return this.addScene=function(e){if(r.type.Array(e))e.forEach((function(t,e){h.addScene(t)}));else if(e instanceof t.Scene){if(e.controller()!==h)e.addTo(h);else if(p.indexOf(e)<0){for(var n in p.push(e),p=I(p),e.on("shift.controller_sort",(function(){p=I(p)})),d.globalSceneOptions)e[n]&&e[n].call(e,d.globalSceneOptions[n]);k(3,"adding Scene (now "+p.length+" total)")}}else k(1,"ERROR: invalid argument supplied for '.addScene()'");return h},this.removeScene=function(t){if(r.type.Array(t))t.forEach((function(t,e){h.removeScene(t)}));else{var e=p.indexOf(t);e>-1&&(t.off("shift.controller_sort"),p.splice(e,1),k(3,"removing Scene (now "+p.length+" left)"),t.remove())}return h},this.updateScene=function(e,n){return r.type.Array(e)?e.forEach((function(t,e){h.updateScene(t,n)})):n?e.update(!0):!0!==f&&e instanceof t.Scene&&(-1==(f=f||[]).indexOf(e)&&f.push(e),f=I(f),E()),h},this.update=function(t){return S({type:"resize"}),t&&C(),h},this.scrollTo=function(n,i){if(r.type.Number(n))T.call(d.container,n,i);else if(n instanceof t.Scene)n.controller()===h?h.scrollTo(n.scrollOffset(),i):k(2,"scrollTo(): The supplied scene does not belong to this controller. Scroll cancelled.",n);else if(r.type.Function(n))T=n;else{var o=r.get.elements(n)[0];if(o){for(;o.parentNode.hasAttribute(e);)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],i)}else k(2,"scrollTo(): The supplied argument is invalid. Scroll cancelled.",n)}return h},this.scrollPos=function(t){return arguments.length?(r.type.Function(t)?b=t:k(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(t){var e={size:v,vertical:d.vertical,scrollPos:m,scrollDirection:g,container:d.container,isDocument:_};return arguments.length?void 0!==e[t]?e[t]:void k(1,'ERROR: option "'+t+'" is not available'):e},this.loglevel=function(t){return arguments.length?(d.loglevel!=t&&(d.loglevel=t),h):d.loglevel},this.enabled=function(t){return arguments.length?(y!=t&&(y=!!t,h.updateScene(p,!0)),h):y},this.destroy=function(t){window.clearTimeout(a);for(var e=p.length;e--;)p[e].destroy(t);return d.container.removeEventListener("resize",S),d.container.removeEventListener("scroll",S),r.cAF(o),k(3,"destroyed "+s+" (reset: "+(t?"true":"false")+")"),null},function(){for(var e in d)u.hasOwnProperty(e)||(k(2,'WARNING: Unknown option "'+e+'"'),delete d[e]);if(d.container=r.get.elements(d.container)[0],!d.container)throw k(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",S),d.container.addEventListener("scroll",S);var n=parseInt(d.refreshInterval,10);d.refreshInterval=r.type.Number(n)?n:u.refreshInterval,x(),k(3,"added new "+s+" controller (v"+t.version+")")}(),h};var n={defaults:{container:window,vertical:!0,globalSceneOptions:{},loglevel:2,refreshInterval:100}};t.Controller.addOption=function(t,e){n.defaults[t]=e},t.Controller.extend=function(e){var n=this;t.Controller=function(){return n.apply(this,arguments),this.$super=r.extend({},this),e.apply(this,arguments)||this},r.extend(t.Controller,n),t.Controller.prototype=n.prototype,t.Controller.prototype.constructor=t.Controller},t.Scene=function(n){var o,a,s="ScrollMagic.Scene",l="BEFORE",c="DURING",u="AFTER",h=i.defaults,d=this,p=r.extend({},h,n),f=l,m=0,g={start:0,end:0},_=0,v=!0,y={};this.on=function(t,e){return r.type.Function(e)?(t=t.trim().split(" ")).forEach((function(t){var n=t.split("."),i=n[0],r=n[1];"*"!=i&&(y[i]||(y[i]=[]),y[i].push({namespace:r||"",callback:e}))})):x(1,"ERROR when calling '.on()': Supplied callback for '"+t+"' is not a valid function!"),d},this.off=function(t,e){return t?((t=t.trim().split(" ")).forEach((function(t,n){var i=t.split("."),r=i[0],o=i[1]||"";("*"===r?Object.keys(y):[r]).forEach((function(t){for(var n=y[t]||[],i=n.length;i--;){var r=n[i];!r||o!==r.namespace&&"*"!==o||e&&e!=r.callback||n.splice(i,1)}n.length||delete y[t]}))})),d):(x(1,"ERROR: Invalid event name supplied."),d)},this.trigger=function(e,n){if(e){var i=e.trim().split("."),r=i[0],o=i[1],a=y[r];x(3,"event fired:",r,n?"->":"",n||""),a&&a.forEach((function(e,i){o&&o!==e.namespace||e.callback.call(d,new t.Event(r,e.namespace,d,n))}))}else x(1,"ERROR: Invalid event name supplied.");return d},d.on("change.internal",(function(t){"loglevel"!==t.what&&"tweenChanges"!==t.what&&("triggerElement"===t.what?E():"reverse"===t.what&&d.update())})).on("shift.internal",(function(t){T(),d.update()}));var x=this._log=function(t,e){p.loglevel>=t&&(Array.prototype.splice.call(arguments,1,0,"("+s+") ->"),r.log.apply(window,arguments))};this.addTo=function(e){return e instanceof t.Controller?a!=e&&(a&&a.removeScene(d),a=e,k(),C(!0),E(!0),T(),a.info("container").addEventListener("resize",S),e.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(t){return arguments.length?(v!=t&&(v=!!t,d.update(!0)),d):v},this.remove=function(){if(a){a.info("container").removeEventListener("resize",S);var t=a;a=void 0,t.removeScene(d),d.trigger("remove"),x(3,"removed "+s+" from controller")}return d},this.destroy=function(t){return d.trigger("destroy",{reset:t}),d.remove(),d.off("*.*"),x(3,"destroyed "+s+" (reset: "+(t?"true":"false")+")"),null},this.update=function(t){if(a)if(t)if(a.enabled()&&v){var e,n=a.info("scrollPos");e=p.duration>0?(n-g.start)/(g.end-g.start):n>=g.start?1:0,d.trigger("update",{startPos:g.start,endPos:g.end,scrollPos:n}),d.progress(e)}else b&&f===c&&P(!0);else a.updateScene(d,!1);return d},this.refresh=function(){return C(),E(),d},this.progress=function(t){if(arguments.length){var e=!1,n=f,i=a?a.info("scrollDirection"):"PAUSED",r=p.reverse||t>=m;if(0===p.duration?(e=m!=t,f=0==(m=t<1&&r?0:1)?l:c):t<0&&f!==l&&r?(m=0,f=l,e=!0):t>=0&&t<1&&r?(m=t,f=c,e=!0):t>=1&&f!==u?(m=1,f=u,e=!0):f!==c||r||P(),e){var o={progress:m,state:f,scrollDirection:i},s=f!=n,h=function(t){d.trigger(t,o)};s&&n!==c&&(h("enter"),h(n===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(t){if(o){var e="duration";I(e,o.call(d))&&!t&&(d.trigger("change",{what:e,newval:p.duration}),d.trigger("shift",{reason:e}))}},E=function(t){var n=0,i=p.triggerElement;if(a&&(i||_>0)){if(i)if(i.parentNode){for(var o=a.info(),s=r.get.offset(o.container),l=o.vertical?"top":"left";i.parentNode.hasAttribute(e);)i=i.parentNode;var c=r.get.offset(i);o.isDocument||(s[l]-=a.scrollPos()),n=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=n!=_;_=n,u&&!t&&d.trigger("shift",{reason:"triggerElementPosition"})}},S=function(t){p.triggerHook>0&&d.trigger("shift",{reason:"containerResize"})},A=r.extend(i.validate,{duration:function(t){if(r.type.String(t)&&t.match(/^(\.|\d)*\d+%$/)){var e=parseFloat(t)/100;t=function(){return a?a.info("size")*e:0}}if(r.type.Function(t)){o=t;try{t=parseFloat(o.call(d))}catch(e){t=-1}}if(t=parseFloat(t),!r.type.Number(t)||t<0)throw o?(o=void 0,['Invalid return value of supplied function for option "duration":',t]):['Invalid value for option "duration":',t];return t}}),k=function(t){(t=arguments.length?[t]:Object.keys(A)).forEach((function(t,e){var n;if(A[t])try{n=A[t](p[t])}catch(e){n=h[t];var i=r.type.String(e)?[e]:e;r.type.Array(i)?(i[0]="ERROR: "+i[0],i.unshift(1),x.apply(this,i)):x(1,"ERROR: Problem executing validation callback for option '"+t+"':",e.message)}finally{p[t]=n}}))},I=function(t,e){var n=!1,i=p[t];return p[t]!=e&&(p[t]=e,k(t),n=i!=p[t]),n},M=function(t){d[t]||(d[t]=function(e){return arguments.length?("duration"===t&&(o=void 0),I(t,e)&&(d.trigger("change",{what:t,newval:p[t]}),i.shifts.indexOf(t)>-1&&d.trigger("shift",{reason:t})),d):p[t]})};this.controller=function(){return a},this.state=function(){return f},this.scrollOffset=function(){return g.start},this.triggerPosition=function(){var t=p.offset;return a&&(p.triggerElement?t+=_:t+=a.info("size")*d.triggerHook()),t},d.on("shift.internal",(function(t){var e="duration"===t.reason;(f===u&&e||f===c&&0===p.duration)&&P(),e&&D()})).on("progress.internal",(function(t){P()})).on("add.internal",(function(t){D()})).on("destroy.internal",(function(t){d.removePin(t.reset)}));var P=function(t){if(b&&a){var e=a.info(),n=w.spacer.firstChild;if(t||f!==c){var i={position:w.inFlow?"relative":"absolute",top:0,left:0},o=r.css(n,"position")!=i.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):i[e.vertical?"top":"left"]=p.duration*m,r.css(n,i),o&&D()}else{"fixed"!=r.css(n,"position")&&(r.css(n,{position:"fixed"}),D());var s=r.get.offset(w.spacer,!0),h=p.reverse||0===p.duration?e.scrollPos-g.start:Math.round(m*p.duration*10)/10;s[e.vertical?"top":"left"]+=h,r.css(w.spacer.firstChild,{top:s.top,left:s.left})}}},D=function(){if(b&&a&&w.inFlow){var t=f===c,e=a.info("vertical"),n=w.spacer.firstChild,i=r.isMarginCollapseType(r.css(w.spacer,"display")),o={};w.relSize.width||w.relSize.autoFullWidth?t?r.css(b,{width:r.get.width(w.spacer)}):r.css(b,{width:"100%"}):(o["min-width"]=r.get.width(e?b:n,!0,!0),o.width=t?o["min-width"]:"auto"),w.relSize.height?t?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(e?n:b,!0,!i),o.height=t?o["min-height"]:"auto"),w.pushFollowers&&(o["padding"+(e?"Top":"Left")]=p.duration*m,o["padding"+(e?"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()},R=function(t){a&&b&&f===c&&!a.info("isDocument")&&(t.preventDefault(),a._setScrollPos(a.info("scrollPos")-((t.wheelDelta||t[a.info("vertical")?"wheelDeltaY":"wheelDeltaX"])/3||30*-t.detail)))};this.setPin=function(t,n){var i=n&&n.hasOwnProperty("pushFollowers");if(n=r.extend({},{pushFollowers:!0,spacerClass:"scrollmagic-pin-spacer"},n),!(t=r.get.elements(t)[0]))return x(1,"ERROR calling method 'setPin()': Invalid pin element supplied."),d;if("fixed"===r.css(t,"position"))return x(1,"ERROR calling method 'setPin()': Pin does not work with elements that are positioned 'fixed'."),d;if(b){if(b===t)return d;d.removePin()}var o=(b=t).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&&n.pushFollowers&&(x(2,"WARNING: If the pinned element is positioned absolutely pushFollowers will be disabled."),n.pushFollowers=!1),window.setTimeout((function(){b&&0===p.duration&&i&&n.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(e,""),r.addClass(u,n.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:n.pushFollowers,inFlow:s},!b.___origStyle){b.___origStyle={};var f=b.style;a.concat(["width","height","position","boxSizing","mozBoxSizing","webkitBoxSizing"]).forEach((function(t){b.___origStyle[t]=f[t]||""}))}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",R),b.addEventListener("DOMMouseScroll",R),x(3,"added pin"),P(),d},this.removePin=function(t){if(b){if(f===c&&P(!0),t||!a){var n=w.spacer.firstChild;if(n.hasAttribute(e)){var i=w.spacer.style,o={};["margin","marginLeft","marginRight","marginTop","marginBottom"].forEach((function(t){o[t]=i[t]||""})),r.css(n,o)}w.spacer.parentNode.insertBefore(n,w.spacer),w.spacer.parentNode.removeChild(w.spacer),b.parentNode.hasAttribute(e)||(r.css(b,b.___origStyle),delete b.___origStyle)}window.removeEventListener("scroll",z),window.removeEventListener("resize",z),window.removeEventListener("resize",O),b.removeEventListener("mousewheel",R),b.removeEventListener("DOMMouseScroll",R),b=void 0,x(3,"removed pin (reset: "+(t?"true":"false")+")")}return d};var L,F=[];return d.on("destroy.internal",(function(t){d.removeClassToggle(t.reset)})),this.setClassToggle=function(t,e){var n=r.get.elements(t);return 0!==n.length&&r.type.String(e)?(F.length>0&&d.removeClassToggle(),L=e,F=n,d.on("enter.internal_class leave.internal_class",(function(t){var e="enter"===t.type?r.addClass:r.removeClass;F.forEach((function(t,n){e(t,L)}))})),d):(x(1,"ERROR calling method 'setClassToggle()': Invalid "+(0===n.length?"element":"classes")+" supplied."),d)},this.removeClassToggle=function(t){return t&&F.forEach((function(t,e){r.removeClass(t,L)})),d.off("start.internal_class end.internal_class"),L=void 0,F=[],d},function(){for(var t in p)h.hasOwnProperty(t)||(x(2,'WARNING: Unknown option "'+t+'"'),delete p[t]);for(var e in h)M(e);k()}(),d};var i={defaults:{duration:0,offset:0,triggerElement:void 0,triggerHook:.5,reverse:!0,loglevel:2},validate:{offset:function(t){if(t=parseFloat(t),!r.type.Number(t))throw['Invalid value for option "offset":',t];return t},triggerElement:function(t){if(t=t||void 0){var e=r.get.elements(t)[0];if(!e||!e.parentNode)throw['Element defined in option "triggerElement" was not found:',t];t=e}return t},triggerHook:function(t){var e={onCenter:.5,onEnter:1,onLeave:0};if(r.type.Number(t))t=Math.max(0,Math.min(parseFloat(t),1));else{if(!(t in e))throw['Invalid value for option "triggerHook": ',t];t=e[t]}return t},reverse:function(t){return!!t},loglevel:function(t){if(t=parseInt(t),!r.type.Number(t)||t<0||t>3)throw['Invalid value for option "loglevel":',t];return t}},shifts:["duration","offset","triggerHook"]};t.Scene.addOption=function(e,n,r,o){e in i.defaults?t._util.log(1,"[static] ScrollMagic.Scene -> Cannot add Scene option '"+e+"', because it already exists."):(i.defaults[e]=n,i.validate[e]=r,o&&i.shifts.push(e))},t.Scene.extend=function(e){var n=this;t.Scene=function(){return n.apply(this,arguments),this.$super=r.extend({},this),e.apply(this,arguments)||this},r.extend(t.Scene,n),t.Scene.prototype=n.prototype,t.Scene.prototype.constructor=t.Scene},t.Event=function(t,e,n,i){for(var r in i=i||{})this[r]=i[r];return this.type=t,this.target=this.currentTarget=n,this.namespace=e||"",this.timeStamp=this.timestamp=Date.now(),this};var r=t._util=function(t){var e,n={},i=function(t){return parseFloat(t)||0},r=function(e){return e.currentStyle?e.currentStyle:t.getComputedStyle(e)},o=function(e,n,o,a){if((n=n===document?t:n)===t)a=!1;else if(!f.DomElement(n))return 0;e=e.charAt(0).toUpperCase()+e.substr(1).toLowerCase();var s=(o?n["offset"+e]||n["outer"+e]:n["client"+e]||n["inner"+e])||0;if(o&&a){var l=r(n);s+="Height"===e?i(l.marginTop)+i(l.marginBottom):i(l.marginLeft)+i(l.marginRight)}return s},a=function(t){return t.replace(/^[^a-z]+([a-z])/g,"$1").replace(/-([a-z])/g,(function(t){return t[1].toUpperCase()}))};n.extend=function(t){for(t=t||{},e=1;e-1};var s=0,l=["ms","moz","webkit","o"],c=t.requestAnimationFrame,u=t.cancelAnimationFrame;for(e=0;!c&&eh.length||t<=0)&&(t=h.length);var e=new Date,n=("0"+e.getHours()).slice(-2)+":"+("0"+e.getMinutes()).slice(-2)+":"+("0"+e.getSeconds()).slice(-2)+":"+("00"+e.getMilliseconds()).slice(-3),i=h[t-1],r=Array.prototype.splice.call(arguments,1),o=Function.prototype.bind.call(d[i],d);r.unshift(n),o.apply(d,r)};var f=n.type=function(t){return Object.prototype.toString.call(t).replace(/^\[object (.+)\]$/,"$1").toLowerCase()};f.String=function(t){return"string"===f(t)},f.Function=function(t){return"function"===f(t)},f.Array=function(t){return Array.isArray(t)},f.Number=function(t){return!f.Array(t)&&t-parseFloat(t)+1>=0},f.DomElement=function(t){return"object"==typeof HTMLElement||"function"==typeof HTMLElement?t instanceof HTMLElement||t instanceof SVGElement:t&&"object"==typeof t&&null!==t&&1===t.nodeType&&"string"==typeof t.nodeName};var m=n.get={};return m.elements=function(e){var n=[];if(f.String(e))try{e=document.querySelectorAll(e)}catch(t){return n}if("nodelist"===f(e)||f.Array(e)||e instanceof NodeList)for(var i=0,r=n.length=e.length;i ERROR calling addIndicators() due to missing Plugin 'debug.addIndicators'. Please make sure to include plugins/debug.addIndicators.js"),this},t.Scene.prototype.removeIndicators=function(){return t._util.log(1,"(ScrollMagic.Scene) -> ERROR calling removeIndicators() due to missing Plugin 'debug.addIndicators'. Please make sure to include plugins/debug.addIndicators.js"),this},t.Scene.prototype.setTween=function(){return t._util.log(1,"(ScrollMagic.Scene) -> ERROR calling setTween() due to missing Plugin 'animation.gsap'. Please make sure to include plugins/animation.gsap.js"),this},t.Scene.prototype.removeTween=function(){return t._util.log(1,"(ScrollMagic.Scene) -> ERROR calling removeTween() due to missing Plugin 'animation.gsap'. Please make sure to include plugins/animation.gsap.js"),this},t.Scene.prototype.setVelocity=function(){return t._util.log(1,"(ScrollMagic.Scene) -> ERROR calling setVelocity() due to missing Plugin 'animation.velocity'. Please make sure to include plugins/animation.velocity.js"),this},t.Scene.prototype.removeVelocity=function(){return t._util.log(1,"(ScrollMagic.Scene) -> ERROR calling removeVelocity() due to missing Plugin 'animation.velocity'. Please make sure to include plugins/animation.velocity.js"),this},t},"function"==typeof define&&define.amd?define(r):"object"==typeof n?e.exports=r():i.ScrollMagic=r()},{}],9:[function(t,e,n){ /*! * 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(e,i){if("function"==typeof define&&define.amd)define(["ScrollMagic","gsap","TweenMax","TimelineMax"],i);else if("object"==typeof n){var r=t("gsap/dist/gsap")||t("gsap");i(t("scrollmagic"),r,TweenMax||r,TimelineMax||r)}else i(e.ScrollMagic||e.jQuery&&e.jQuery.ScrollMagic,e.gsap,e.gsap||e.TweenMax||e.TweenLite,e.gsap||e.TimelineMax||e.TimelineLite)}(this,(function(t,e,n,i){"use strict";var r="animation.gsap",o=e&&parseFloat(e.version)>=3,a=window.console||{},s=Function.prototype.bind.call(a.error||a.log||function(){},a);t||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."),n||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."),t.Scene.addOption("tweenChanges",!1,(function(t){return!!t})),t.Scene.extend((function(){var t,e=this,a=function(){e._log&&(Array.prototype.splice.call(arguments,1,0,"("+r+")","->"),e._log.apply(this,arguments))};e.on("progress.plugin_gsap",(function(){s()})),e.on("destroy.plugin_gsap",(function(t){e.removeTween(t.reset)}));var s=function(){if(t){var n=e.progress(),i=e.state();t.repeat&&-1===t.repeat()?"DURING"===i&&t.paused()?t.play():"DURING"===i||t.paused()||t.pause():n!=t.progress()&&(0===e.duration()?n>0?t.play():t.reverse():e.tweenChanges()&&t.tweenTo?t.tweenTo(n*t.duration()):t.progress(n).pause())}};e.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?n.to(r,c):n.to(r,l,c)}try{(u=i&&!o?new i({smoothChildTiming:!0}).add(r):r).pause()}catch(t){return a(1,"ERROR calling method 'setTween()': Supplied argument is not a valid TweenObject"),e}if(t&&e.removeTween(),t=u,r.repeat&&-1===r.repeat()&&(t.repeat(-1),t.yoyo(r.yoyo())),e.tweenChanges()&&!t.tweenTo&&a(2,"WARNING: tweenChanges will only work if the TimelineMax object is available for ScrollMagic."),t&&e.controller()&&e.triggerElement()&&e.loglevel()>=2){var d=n.getTweensOf(e.triggerElement()),p=e.controller().info("vertical");d.forEach((function(t,e){var n=t.vars.css||t.vars;if(p?void 0!==n.top||void 0!==n.bottom:void 0!==n.left||void 0!==n.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",_=t.getChildren?t.getChildren(!0,!0,!1):[t],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(),e},e.removeTween=function(n){return t&&(n&&t.progress(0).pause(),t.kill(),t=void 0,a(3,"removed tween (reset: "+(n?"true":"false")+")")),e}}))}))},{gsap:5,"gsap/dist/gsap":5,scrollmagic:8}],10:[function(t,e,n){(function(e,i){(function(){var r=t("process/browser.js").nextTick,o=Function.prototype.apply,a=Array.prototype.slice,s={},l=0;function c(t,e){this._id=t,this._clearFn=e}n.setTimeout=function(){return new c(o.call(setTimeout,window,arguments),clearTimeout)},n.setInterval=function(){return new c(o.call(setInterval,window,arguments),clearInterval)},n.clearTimeout=n.clearInterval=function(t){t.close()},c.prototype.unref=c.prototype.ref=function(){},c.prototype.close=function(){this._clearFn.call(window,this._id)},n.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},n.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},n._unrefActive=n.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout((function(){t._onTimeout&&t._onTimeout()}),e))},n.setImmediate="function"==typeof e?e:function(t){var e=l++,i=!(arguments.length<2)&&a.call(arguments,1);return s[e]=!0,r((function(){s[e]&&(i?t.apply(null,i):t.call(null),n.clearImmediate(e))})),e},n.clearImmediate="function"==typeof i?i:function(t){delete s[t]}}).call(this)}).call(this,t("timers").setImmediate,t("timers").clearImmediate)},{"process/browser.js":7,timers:10}],11:[function(t,e,n){ /*! * viewport-units-buggyfill v0.6.2 * @web: https://github.com/rodneyrehm/viewport-units-buggyfill/ * @author: Rodney Rehm - http://rodneyrehm.de/en/ */ !function(){!function(t,i){"use strict";"function"==typeof define&&define.amd?define([],i):"object"==typeof n?e.exports=i():t.viewportUnitsBuggyfill=i()}(this,(function(){"use strict";var t,e,n,i,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(t){var m=function(t,e){var n;return e=e||{bubbles:!1,cancelable:!1,detail:void 0},(n=document.createEvent("CustomEvent")).initCustomEvent(t,e.bubbles,e.cancelable,e.detail),n};m.prototype=window.Event.prototype,window.CustomEvent=m}function g(){o&&(_(),setTimeout((function(){i.textContent=y(),i.parentNode.appendChild(i),window.dispatchEvent(new m("viewport-units-buggyfill-style"))}),1))}function _(){return n=[],c.call(document.styleSheets,(function(t){var e=function(t){try{if(!t.cssRules)return}catch(t){if("SecurityError"!==t.name)throw t;return}for(var e=[],n=0;n-1&&(s="init"),n.compatible=r[0]>=2,n.compatible)},n.createRecord=function(t,e){if(!o[t]){var n=null;"function"==typeof e&&(e=(n=e).options),l(t,e),o[t]={Ctor:n,options:e,instances:[]}}},n.isRecorded=function(t){return void 0!==o[t]},n.rerender=u((function(t,e){var n=o[t];if(e){if("function"==typeof e&&(e=e.options),n.Ctor)n.Ctor.options.render=e.render,n.Ctor.options.staticRenderFns=e.staticRenderFns,n.instances.slice().forEach((function(t){t.$options.render=e.render,t.$options.staticRenderFns=e.staticRenderFns,t._staticTrees&&(t._staticTrees=[]),Array.isArray(n.Ctor.options.cached)&&(n.Ctor.options.cached=[]),Array.isArray(t.$options.cached)&&(t.$options.cached=[]);var i=function(t){if(!t._u)return;var e=t._u;return t._u=function(t){try{return e(t,!0)}catch(n){return e(t,null,!0)}},function(){t._u=e}}(t);t.$forceUpdate(),t.$nextTick(i)}));else if(n.options.render=e.render,n.options.staticRenderFns=e.staticRenderFns,n.options.functional){if(Object.keys(e).length>2)h(n.options,e);else{var i=n.options._injectStyles;if(i){var r=e.render;n.options.render=function(t,e){return i.call(e),r(t,e)}}}n.options._Ctor=null,Array.isArray(n.options.cached)&&(n.options.cached=[]),n.instances.slice().forEach((function(t){t.$forceUpdate()}))}}else n.instances.slice().forEach((function(t){t.$forceUpdate()}))})),n.reload=u((function(t,e){var n=o[t];if(e)if("function"==typeof e&&(e=e.options),l(t,e),n.Ctor){r[1]<2&&(n.Ctor.extendOptions=e);var i=n.Ctor.super.extend(e);i.options._Ctor=n.options._Ctor,n.Ctor.options=i.options,n.Ctor.cid=i.cid,n.Ctor.prototype=i.prototype,i.release&&i.release()}else h(n.options,e);n.instances.slice().forEach((function(t){t.$vnode&&t.$vnode.context&&t.$vnode.context.$forceUpdate()}))}))},{}],13:[function(t,e,n){!function(t,i){if("object"==typeof n&&"object"==typeof e)e.exports=i();else if("function"==typeof define&&define.amd)define([],i);else{var r=i();for(var o in r)("object"==typeof n?n:t)[o]=r[o]}}(window,(function(){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=0)}([function(t,e,n){"use strict";function i(){return window.Piwik.getAsyncTracker()}function r(t){return new Promise((function(e,n){var i=document.createElement("script");i.async=!0,i.defer=!0,i.src=t,(document.head||document.getElementsByTagName("head")[0]).appendChild(i),i.onload=e,i.onerror=n}))}function o(t,e){return t.resolve(e).href}n.r(e),n.d(e,"matomoKey",(function(){return s})),n.d(e,"default",(function(){return h}));var a={debug:!1,disableCookies:!1,requireCookieConsent:!1,enableHeartBeatTimer:!1,enableLinkTracking:!0,heartBeatTimerInterval:15,requireConsent:!1,trackInitialView:!0,trackSiteSearch:!1,trackerFileName:"matomo",trackerUrl:void 0,trackerScriptUrl:void 0,userId:void 0,cookieDomain:void 0,domains:void 0,preInitActions:[]},s="Matomo";function l(t,e,n){if("function"==typeof t.trackSiteSearch){var r=t.trackSiteSearch(e);if(r)return void function(t,e){var n=e.keyword,r=e.category,o=e.resultsCount,a=i();t.debug,a.trackSiteSearch(n,r,o)}(t,r)}!function(t,e,n){var r,a,s,l=i();if(t.router){if(a=o(t.router,e.fullPath),s=n&&n.fullPath?o(t.router,n.fullPath):void 0,e.meta.analyticsIgnore)return void t.debug;t.debug,r=e.meta.title||a}s&&l.setReferrerUrl(s),a&&l.setCustomUrl(a),l.trackPageView(r)}(t,e,n)}function c(t,e){var n=i();if(Number(t.version.split(".")[0])>2?(t.config.globalProperties.$piwik=n,t.config.globalProperties.$matomo=n,t.provide(s,n)):(t.prototype.$piwik=n,t.prototype.$matomo=n),e.trackInitialView&&e.router){var r=e.router.currentRoute.value?e.router.currentRoute.value:e.router.currentRoute;l(e,r)}e.router&&e.router.afterEach((function(t,i){l(e,t,i),e.enableLinkTracking&&n.enableLinkTracking()}))}function u(){return new Promise((function(t,e){var n=Date.now(),i=setInterval((function(){if(window.Piwik)return clearInterval(i),t();if(Date.now()>=n+3e3)throw clearInterval(i),new Error("[vue-matomo]: window.Piwik undefined after waiting for ".concat(3e3,"ms"))}),50)}))}function h(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=Object.assign({},a,e),i=n.host,o=n.siteId,s=n.trackerFileName,l=n.trackerUrl,h=n.trackerScriptUrl,d=h||"".concat(i,"/").concat(s,".js"),p=l||"".concat(i,"/").concat(s,".php");window._paq=window._paq||[],window._paq.push(["setTrackerUrl",p]),window._paq.push(["setSiteId",o]),n.requireConsent&&window._paq.push(["requireConsent"]),n.userId&&window._paq.push(["setUserId",n.userId]),n.enableLinkTracking&&window._paq.push(["enableLinkTracking"]),n.disableCookies&&window._paq.push(["disableCookies"]),n.requireCookieConsent&&window._paq.push(["requireCookieConsent"]),n.enableHeartBeatTimer&&window._paq.push(["enableHeartBeatTimer",n.heartBeatTimerInterval]),n.cookieDomain&&window._paq.push(["setCookieDomain",n.cookieDomain]),n.domains&&window._paq.push(["setDomains",n.domains]),n.preInitActions.forEach((function(t){return window._paq.push(t)})),r(d).then((function(){return u()})).then((function(){return c(t,n)})).catch((function(t){t.target}))}}])}))},{}],14:[function(t,e,n){ /*! * vue-resource v1.5.3 * https://github.com/pagekit/vue-resource * Released under the MIT License. */ "use strict";function i(t){this.state=2,this.value=void 0,this.deferred=[];var e=this;try{t((function(t){e.resolve(t)}),(function(t){e.reject(t)}))}catch(t){e.reject(t)}}i.reject=function(t){return new i((function(e,n){n(t)}))},i.resolve=function(t){return new i((function(e,n){e(t)}))},i.all=function(t){return new i((function(e,n){var r=0,o=[];function a(n){return function(i){o[n]=i,(r+=1)===t.length&&e(o)}}0===t.length&&e(o);for(var s=0;s=200&&a<300,this.status=a||0,this.statusText=s||"",this.headers=new F(r),this.body=t,f(t)?this.bodyText=t:(n=t,"undefined"!=typeof Blob&&n instanceof Blob&&(this.bodyBlob=t,function(t){return 0===t.type.indexOf("text")||-1!==t.type.indexOf("json")}(t)&&(this.bodyText=function(t){return new o((function(e){var n=new FileReader;n.readAsText(t),n.onload=function(){e(n.result)}}))}(t))))}var e=t.prototype;return e.blob=function(){return v(this.bodyBlob)},e.text=function(){return v(this.bodyText)},e.json=function(){return v(this.text(),(function(t){return JSON.parse(t)}))},t}();Object.defineProperty(B.prototype,"data",{get:function(){return this.body},set:function(t){this.body=t}});var N=function(){function t(t){var e;this.body=null,this.params={},b(this,t,{method:(e=t.method||"GET",e?e.toUpperCase():"")}),this.headers instanceof F||(this.headers=new F(this.headers))}var e=t.prototype;return e.getUrl=function(){return I(this)},e.getBody=function(){return this.body},e.respondWith=function(t,e){return new B(t,b(e||{},{url:this.getUrl()}))},t}(),j={"Content-Type":"application/json;charset=utf-8"};function U(t){var e=this||{},n=function(t){var e=[L],n=[];function i(i){for(;e.length;){var r=e.pop();if(m(r)){var a=function(){var e=void 0,a=void 0;if(g(e=r.call(t,i,(function(t){return a=t}))||a))return{v:new o((function(i,r){n.forEach((function(n){e=v(e,(function(e){return n.call(t,e)||e}),r)})),v(e,i,r)}),t)};m(e)&&n.unshift(e)}();if("object"==typeof a)return a.v}}}return g(t)||(t=null),i.use=function(t){e.push(t)},i}(e.$vm);return function(t){c.call(arguments,1).forEach((function(e){for(var n in e)void 0===t[n]&&(t[n]=e[n])}))}(t||{},e.$options,U.options),U.interceptors.forEach((function(t){f(t)&&(t=U.interceptor[t]),m(t)&&n.use(t)})),n(new N(t)).then((function(t){return t.ok?t:o.reject(t)}),(function(t){return Error,o.reject(t)}))}function V(t,e,n,i){var r=this||{},o={};return x(n=b({},V.actions,n),(function(n,a){n=w({url:t,params:b({},e)},i,n),o[a]=function(){return(r.$http||U)(G(n,arguments))}})),o}function G(t,e){var n,i=b({},t),r={};switch(e.length){case 2:r=e[0],n=e[1];break;case 1:/^(POST|PUT|PATCH)$/i.test(i.method)?n=e[0]:r=e[0];break;case 0:break;default:throw"Expected up to 2 arguments [params, body], got "+e.length+" arguments"}return i.body=n,i.params=b({},i.params,r),i}function q(t){q.installed||(!function(t){var e=t.config,n=t.nextTick;s=n,e.debug||!e.silent}(t),t.url=I,t.http=U,t.resource=V,t.Promise=o,Object.defineProperties(t.prototype,{$url:{get:function(){return y(t.url,this,this.$options.url)}},$http:{get:function(){return y(t.http,this,this.$options.http)}},$resource:{get:function(){return t.resource.bind(this)}},$promise:{get:function(){var e=this;return function(n){return new t.Promise(n,e)}}}}))}U.options={},U.headers={put:j,post:j,patch:j,delete:j,common:{Accept:"application/json, text/plain, */*"},custom:{}},U.interceptor={before:function(t){m(t.before)&&t.before.call(this,t)},method:function(t){t.emulateHTTP&&/^(PUT|PATCH|DELETE)$/i.test(t.method)&&(t.headers.set("X-HTTP-Method-Override",t.method),t.method="POST")},jsonp:function(t){"JSONP"==t.method&&(t.client=z)},json:function(t){var e=t.headers.get("Content-Type")||"";return g(t.body)&&0===e.indexOf("application/json")&&(t.body=JSON.stringify(t.body)),function(t){return t.bodyText?v(t.text(),(function(e){var n,i,r;if(0===(t.headers.get("Content-Type")||"").indexOf("application/json")||(i=(n=e).match(/^\s*(\[|\{)/),r={"[":/]\s*$/,"{":/}\s*$/},i&&r[i[1]].test(n)))try{t.body=JSON.parse(e)}catch(e){t.body=null}else t.body=e;return t})):t}},form:function(t){var e;e=t.body,"undefined"!=typeof FormData&&e instanceof FormData?t.headers.delete("Content-Type"):g(t.body)&&t.emulateJSON&&(t.body=I.params(t.body),t.headers.set("Content-Type","application/x-www-form-urlencoded"))},header:function(t){x(b({},U.headers.common,t.crossOrigin?{}:U.headers.custom,U.headers[d(t.method)]),(function(e,n){t.headers.has(n)||t.headers.set(n,e)}))},cors:function(t){if(u){var e=I.parse(location.href),n=I.parse(t.getUrl());n.protocol===e.protocol&&n.host===e.host||(t.crossOrigin=!0,t.emulateHTTP=!1,D||(t.client=P))}}},U.interceptors=["before","method","jsonp","json","form","header","cors"],["get","delete","head","jsonp"].forEach((function(t){U[t]=function(e,n){return this(b(n||{},{url:e,method:t}))}})),["post","put","patch"].forEach((function(t){U[t]=function(e,n,i){return this(b(i||{},{url:e,method:t,body:n}))}})),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.resource&&window.Vue.use(q),e.exports=q},{got:1}],15:[function(t,e,n){(function(t){(function(){ /*! * vue-router v3.5.2 * (c) 2021 Evan You * @license MIT */ "use strict";function n(t,e){if(!t)throw new Error("[vue-router] "+e)}function i(e,n){t.env.NODE_ENV}function r(t,e){for(var n in e)t[n]=e[n];return t}var o=/[!'()*]/g,a=function(t){return"%"+t.charCodeAt(0).toString(16)},s=/%2C/g,l=function(t){return encodeURIComponent(t).replace(o,a).replace(s,",")};function c(e){try{return decodeURIComponent(e)}catch(e){"production"!==t.env.NODE_ENV&&i()}return e}var u=function(t){return null==t||"object"==typeof t?t:String(t)};function h(t){var e={};return(t=t.trim().replace(/^(\?|#|&)/,""))?(t.split("&").forEach((function(t){var n=t.replace(/\+/g," ").split("="),i=c(n.shift()),r=n.length>0?c(n.join("=")):null;void 0===e[i]?e[i]=r:Array.isArray(e[i])?e[i].push(r):e[i]=[e[i],r]})),e):e}function d(t){var e=t?Object.keys(t).map((function(e){var n=t[e];if(void 0===n)return"";if(null===n)return l(e);if(Array.isArray(n)){var i=[];return n.forEach((function(t){void 0!==t&&(null===t?i.push(l(e)):i.push(l(e)+"="+l(t)))})),i.join("&")}return l(e)+"="+l(n)})).filter((function(t){return t.length>0})).join("&"):null;return e?"?"+e:""}var p=/\/?$/;function f(t,e,n,i){var r=i&&i.options.stringifyQuery,o=e.query||{};try{o=m(o)}catch(t){}var a={name:e.name||t&&t.name,meta:t&&t.meta||{},path:e.path||"/",hash:e.hash||"",query:o,params:e.params||{},fullPath:v(e,r),matched:t?_(t):[]};return n&&(a.redirectedFrom=v(n,r)),Object.freeze(a)}function m(t){if(Array.isArray(t))return t.map(m);if(t&&"object"==typeof t){var e={};for(var n in t)e[n]=m(t[n]);return e}return t}var g=f(null,{path:"/"});function _(t){for(var e=[];t;)e.unshift(t),t=t.parent;return e}function v(t,e){var n=t.path,i=t.query;void 0===i&&(i={});var r=t.hash;return void 0===r&&(r=""),(n||"/")+(e||d)(i)+r}function y(t,e,n){return e===g?t===e:!!e&&(t.path&&e.path?t.path.replace(p,"")===e.path.replace(p,"")&&(n||t.hash===e.hash&&x(t.query,e.query)):!(!t.name||!e.name)&&(t.name===e.name&&(n||t.hash===e.hash&&x(t.query,e.query)&&x(t.params,e.params))))}function x(t,e){if(void 0===t&&(t={}),void 0===e&&(e={}),!t||!e)return t===e;var n=Object.keys(t).sort(),i=Object.keys(e).sort();return n.length===i.length&&n.every((function(n,r){var o=t[n];if(i[r]!==n)return!1;var a=e[n];return null==o||null==a?o===a:"object"==typeof o&&"object"==typeof a?x(o,a):String(o)===String(a)}))}function b(t){for(var e=0;e=0&&(e=t.slice(i),t=t.slice(0,i));var r=t.indexOf("?");return r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),{path:t,query:n,hash:e}}(s.path||""),f=n&&n.path||"/",m=p.path?C(p.path,f,o||s.append):f,g=function(e,n,r){void 0===n&&(n={});var o,a=r||h;try{o=a(e||"")}catch(e){"production"!==t.env.NODE_ENV&&i(0,e.message),o={}}for(var s in n){var l=n[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,Z,H,W,X=function(){},K={name:"RouterLink",props:{to:{type:[String,Object],required:!0},tag:{type:String,default:"a"},custom:Boolean,exact:Boolean,exactPath:Boolean,append:Boolean,replace:Boolean,activeClass:String,exactActiveClass:String,ariaCurrentValue:{type:String,default:"page"},event:{type:[String,Array],default:"click"}},render:function(e){var n=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,this.exactPath),h[v]=this.exact||this.exactPath?h[x]:function(t,e){return 0===t.path.replace(p,"/").indexOf(e.path.replace(p,"/"))&&(!e.hash||t.hash===e.hash)&&function(t,e){for(var n in e)if(!(n in t))return!1;return!0}(t.query,e.query)}(a,b);var w=h[x]?this.ariaCurrentValue:null,T=function(t){Y(t)&&(n.replace?o.replace(l,X):o.push(l,X))},C={click:Y};Array.isArray(this.event)?this.event.forEach((function(t){C[t]=T})):C[this.event]=T;var E={class:h},S=!this.$scopedSlots.$hasNormal&&this.$scopedSlots.default&&this.$scopedSlots.default({href:u,route:c,navigate:T,isActive:h[v],isExactActive:h[x]});if(S){if("production"===t.env.NODE_ENV||this.custom||(!q&&i(),q=!0),1===S.length)return S[0];if(S.length>1||!S.length)return"production"!==t.env.NODE_ENV&&i(0,this.to),0===S.length?e():e("span",{},S)}if("production"!==t.env.NODE_ENV&&("tag"in this.$options.propsData&&!Z&&(i(),Z=!0),"event"in this.$options.propsData&&!H&&(i(),H=!0)),"a"===this.tag)E.on=C,E.attrs={href:u,"aria-current":w};else{var A=J(this.$slots.default);if(A){A.isStatic=!1;var k=A.data=r({},A.data);for(var I in k.on=k.on||{},k.on){var M=k.on[I];I in C&&(k.on[I]=Array.isArray(M)?M:[M])}for(var P in C)P in k.on?k.on[P].push(C[P]):k.on[P]=T;var D=A.data.attrs=r({},A.data.attrs);D.href=u,D["aria-current"]=w}else E.on=C}return e(this.tag,E,this.$slots.default)}};function Y(t){if(!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey||t.defaultPrevented||void 0!==t.button&&0!==t.button)){if(t.currentTarget&&t.currentTarget.getAttribute){var e=t.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(e))return}return t.preventDefault&&t.preventDefault(),!0}}function J(t){if(t)for(var e,n=0;n0){d.map((function(t){return"- "+t})).join("\n");i()}}return{pathList:s,pathMap:l,nameMap:c}}function nt(e,r,o,a,s,l){var c=a.path,u=a.name;"production"!==t.env.NODE_ENV&&(n(null!=c,'"path" is required in a route configuration.'),n("string"!=typeof a.component,'route config "component" for path: '+String(c||u)+" cannot be a string id. Use an actual component instead."),i(/[^\u0000-\u007F]+/.test(c)));var h=a.pathToRegexpOptions||{},d=function(t,e,n){n||(t=t.replace(/\/$/,""));if("/"===t[0])return t;if(null==e)return t;return E(e.path+"/"+t)}(c,s,h.strict);"boolean"==typeof a.caseSensitive&&(h.sensitive=a.caseSensitive);var p={path:d,regex:it(d,h),components:a.components||{default:a.component},alias:a.alias?"string"==typeof a.alias?[a.alias]:a.alias:[],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"!==t.env.NODE_ENV&&a.name&&!a.redirect&&a.children.some((function(t){return/^\/?$/.test(t.path)}))&&i(0,(a.name,a.name)),a.children.forEach((function(t){var n=l?E(l+"/"+t.path):void 0;nt(e,r,o,t,p,n)}))),r[p.path]||(e.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]=n.params[f]);return c.path=V(d.path,c.params),h(d,c,o)}if(c.path){c.params={};for(var m=0;m=t.length?n():t[r]?e(t[r],(function(){i(r+1)})):i(r+1)};i(0)}var St={redirected:2,aborted:4,cancelled:8,duplicated:16};function At(t,e){return It(t,e,St.redirected,'Redirected when going from "'+t.fullPath+'" to "'+function(t){if("string"==typeof t)return t;if("path"in t)return t.path;var e={};return Mt.forEach((function(n){n in t&&(e[n]=t[n])})),JSON.stringify(e,null,2)}(e)+'" via a navigation guard.')}function kt(t,e){return It(t,e,St.cancelled,'Navigation cancelled from "'+t.fullPath+'" to "'+e.fullPath+'" with a new navigation.')}function It(t,e,n,i){var r=new Error(i);return r._isRouter=!0,r.from=t,r.to=e,r.type=n,r}var Mt=["params","query","hash"];function Pt(t){return Object.prototype.toString.call(t).indexOf("Error")>-1}function Dt(t,e){return Pt(t)&&t._isRouter&&(null==e||t.type===e)}function zt(e){return function(n,r,o){var a=!1,s=0,l=null;Ot(e,(function(e,n,r,c){if("function"==typeof e&&void 0===e.cid){a=!0,s++;var u,h=Ft((function(t){var n;((n=t).__esModule||Lt&&"Module"===n[Symbol.toStringTag])&&(t=t.default),e.resolved="function"==typeof t?t:W.extend(t),r.components[c]=t,--s<=0&&o()})),d=Ft((function(e){var n="Failed to resolve async component "+c+": "+e;"production"!==t.env.NODE_ENV&&i(),l||(l=Pt(e)?e:new Error(n),o(l))}));try{u=e(h,d)}catch(t){d(t)}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 Ot(t,e){return Rt(t.map((function(t){return Object.keys(t.components).map((function(n){return e(t.components[n],t.instances[n],t,n)}))})))}function Rt(t){return Array.prototype.concat.apply([],t)}var Lt="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;function Ft(t){var e=!1;return function(){for(var n=[],i=arguments.length;i--;)n[i]=arguments[i];if(!e)return e=!0,t.apply(this,n)}}var $t=function(t,e){this.router=t,this.base=function(t){if(!t)if(tt){var e=document.querySelector("base");t=(t=e&&e.getAttribute("href")||"/").replace(/^https?:\/\/[^\/]+/,"")}else t="/";"/"!==t.charAt(0)&&(t="/"+t);return t.replace(/\/$/,"")}(e),this.current=g,this.pending=null,this.ready=!1,this.readyCbs=[],this.readyErrorCbs=[],this.errorCbs=[],this.listeners=[]};function Bt(t,e,n,i){var r=Ot(t,(function(t,i,r,o){var a=function(t,e){"function"!=typeof t&&(t=W.extend(t));return t.options[e]}(t,e);if(a)return Array.isArray(a)?a.map((function(t){return n(t,i,r,o)})):n(a,i,r,o)}));return Rt(i?r.reverse():r)}function Nt(t,e){if(e)return function(){return t.apply(e,arguments)}}$t.prototype.listen=function(t){this.cb=t},$t.prototype.onReady=function(t,e){this.ready?t():(this.readyCbs.push(t),e&&this.readyErrorCbs.push(e))},$t.prototype.onError=function(t){this.errorCbs.push(t)},$t.prototype.transitionTo=function(t,e,n){var i,r=this;try{i=this.router.match(t,this.current)}catch(t){throw this.errorCbs.forEach((function(e){e(t)})),t}var o=this.current;this.confirmTransition(i,(function(){r.updateRoute(i),e&&e(i),r.ensureURL(),r.router.afterHooks.forEach((function(t){t&&t(i,o)})),r.ready||(r.ready=!0,r.readyCbs.forEach((function(t){t(i)})))}),(function(t){n&&n(t),t&&!r.ready&&(Dt(t,St.redirected)&&o===g||(r.ready=!0,r.readyErrorCbs.forEach((function(e){e(t)}))))}))},$t.prototype.confirmTransition=function(t,e,n){var r=this,o=this.current;this.pending=t;var a,s,l=function(t){!Dt(t)&&Pt(t)&&(r.errorCbs.length?r.errorCbs.forEach((function(e){e(t)})):i()),n&&n(t)},c=t.matched.length-1,u=o.matched.length-1;if(y(t,o)&&c===u&&t.matched[c]===o.matched[u])return this.ensureURL(),l(((s=It(a=o,t,St.duplicated,'Avoided redundant navigation to current location: "'+a.fullPath+'".')).name="NavigationDuplicated",s));var h=function(t,e){var n,i=Math.max(t.length,e.length);for(n=0;n0)){var e=this.router,n=e.options.scrollBehavior,i=wt&&n;i&&this.listeners.push(dt());var r=function(){var n=t.current,r=Ut(t.base);t.current===g&&r===t._startLocation||t.transitionTo(r,(function(t){i&&pt(e,t,n,!0)}))};window.addEventListener("popstate",r),this.listeners.push((function(){window.removeEventListener("popstate",r)}))}},e.prototype.go=function(t){window.history.go(t)},e.prototype.push=function(t,e,n){var i=this,r=this.current;this.transitionTo(t,(function(t){Tt(E(i.base+t.fullPath)),pt(i.router,t,r,!1),e&&e(t)}),n)},e.prototype.replace=function(t,e,n){var i=this,r=this.current;this.transitionTo(t,(function(t){Ct(E(i.base+t.fullPath)),pt(i.router,t,r,!1),e&&e(t)}),n)},e.prototype.ensureURL=function(t){if(Ut(this.base)!==this.current.fullPath){var e=E(this.base+this.current.fullPath);t?Tt(e):Ct(e)}},e.prototype.getCurrentLocation=function(){return Ut(this.base)},e}($t);function Ut(t){var e=window.location.pathname,n=e.toLowerCase(),i=t.toLowerCase();return!t||n!==i&&0!==n.indexOf(E(i+"/"))||(e=e.slice(t.length)),(e||"/")+window.location.search+window.location.hash}var Vt=function(t){function e(e,n,i){t.call(this,e,n),i&&function(t){var e=Ut(t);if(!/^\/#/.test(e))return window.location.replace(E(t+"/#"+e)),!0}(this.base)||Gt()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setupListeners=function(){var t=this;if(!(this.listeners.length>0)){var e=this.router.options.scrollBehavior,n=wt&&e;n&&this.listeners.push(dt());var i=function(){var e=t.current;Gt()&&t.transitionTo(qt(),(function(i){n&&pt(t.router,i,e,!0),wt||Wt(i.fullPath)}))},r=wt?"popstate":"hashchange";window.addEventListener(r,i),this.listeners.push((function(){window.removeEventListener(r,i)}))}},e.prototype.push=function(t,e,n){var i=this,r=this.current;this.transitionTo(t,(function(t){Ht(t.fullPath),pt(i.router,t,r,!1),e&&e(t)}),n)},e.prototype.replace=function(t,e,n){var i=this,r=this.current;this.transitionTo(t,(function(t){Wt(t.fullPath),pt(i.router,t,r,!1),e&&e(t)}),n)},e.prototype.go=function(t){window.history.go(t)},e.prototype.ensureURL=function(t){var e=this.current.fullPath;qt()!==e&&(t?Ht(e):Wt(e))},e.prototype.getCurrentLocation=function(){return qt()},e}($t);function Gt(){var t=qt();return"/"===t.charAt(0)||(Wt("/"+t),!1)}function qt(){var t=window.location.href,e=t.indexOf("#");return e<0?"":t=t.slice(e+1)}function Zt(t){var e=window.location.href,n=e.indexOf("#");return(n>=0?e.slice(0,n):e)+"#"+t}function Ht(t){wt?Tt(Zt(t)):window.location.hash=t}function Wt(t){wt?Ct(Zt(t)):window.location.replace(Zt(t))}var Xt=function(t){function e(e,n){t.call(this,e,n),this.stack=[],this.index=-1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.push=function(t,e,n){var i=this;this.transitionTo(t,(function(t){i.stack=i.stack.slice(0,i.index+1).concat(t),i.index++,e&&e(t)}),n)},e.prototype.replace=function(t,e,n){var i=this;this.transitionTo(t,(function(t){i.stack=i.stack.slice(0,i.index).concat(t),e&&e(t)}),n)},e.prototype.go=function(t){var e=this,n=this.index+t;if(!(n<0||n>=this.stack.length)){var i=this.stack[n];this.confirmTransition(i,(function(){var t=e.current;e.index=n,e.updateRoute(i),e.router.afterHooks.forEach((function(e){e&&e(i,t)}))}),(function(t){Dt(t,St.duplicated)&&(e.index=n)}))}},e.prototype.getCurrentLocation=function(){var t=this.stack[this.stack.length-1];return t?t.fullPath:"/"},e.prototype.ensureURL=function(){},e}($t),Kt=function(e){void 0===e&&(e={}),this.app=null,this.apps=[],this.options=e,this.beforeHooks=[],this.resolveHooks=[],this.afterHooks=[],this.matcher=rt(e.routes||[],this);var i=e.mode||"hash";switch(this.fallback="history"===i&&!wt&&!1!==e.fallback,this.fallback&&(i="hash"),tt||(i="abstract"),this.mode=i,i){case"history":this.history=new jt(this,e.base);break;case"hash":this.history=new Vt(this,e.base,this.fallback);break;case"abstract":this.history=new Xt(this,e.base);break;default:"production"!==t.env.NODE_ENV&&n(!1,"invalid mode: "+i)}},Yt={currentRoute:{configurable:!0}};function Jt(t,e){return t.push(e),function(){var n=t.indexOf(e);n>-1&&t.splice(n,1)}}Kt.prototype.match=function(t,e,n){return this.matcher.match(t,e,n)},Yt.currentRoute.get=function(){return this.history&&this.history.current},Kt.prototype.init=function(e){var i=this;if("production"!==t.env.NODE_ENV&&n(Q.installed,"not installed. Make sure to call `Vue.use(VueRouter)` before creating root instance."),this.apps.push(e),e.$once("hook:destroyed",(function(){var t=i.apps.indexOf(e);t>-1&&i.apps.splice(t,1),i.app===e&&(i.app=i.apps[0]||null),i.app||i.history.teardown()})),!this.app){this.app=e;var r=this.history;if(r instanceof jt||r instanceof Vt){var o=function(t){r.setupListeners(),function(t){var e=r.current,n=i.options.scrollBehavior;wt&&n&&"fullPath"in t&&pt(i,t,e,!1)}(t)};r.transitionTo(r.getCurrentLocation(),o,o)}r.listen((function(t){i.apps.forEach((function(e){e._route=t}))}))}},Kt.prototype.beforeEach=function(t){return Jt(this.beforeHooks,t)},Kt.prototype.beforeResolve=function(t){return Jt(this.resolveHooks,t)},Kt.prototype.afterEach=function(t){return Jt(this.afterHooks,t)},Kt.prototype.onReady=function(t,e){this.history.onReady(t,e)},Kt.prototype.onError=function(t){this.history.onError(t)},Kt.prototype.push=function(t,e,n){var i=this;if(!e&&!n&&"undefined"!=typeof Promise)return new Promise((function(e,n){i.history.push(t,e,n)}));this.history.push(t,e,n)},Kt.prototype.replace=function(t,e,n){var i=this;if(!e&&!n&&"undefined"!=typeof Promise)return new Promise((function(e,n){i.history.replace(t,e,n)}));this.history.replace(t,e,n)},Kt.prototype.go=function(t){this.history.go(t)},Kt.prototype.back=function(){this.go(-1)},Kt.prototype.forward=function(){this.go(1)},Kt.prototype.getMatchedComponents=function(t){var e=t?t.matched?t:this.resolve(t).route:this.currentRoute;return e?[].concat.apply([],e.matched.map((function(t){return Object.keys(t.components).map((function(e){return t.components[e]}))}))):[]},Kt.prototype.resolve=function(t,e,n){var i=G(t,e=e||this.history.current,n,this),r=this.match(i,e),o=r.redirectedFrom||r.fullPath;return{location:i,route:r,href:function(t,e,n){var i="hash"===n?"#"+e:e;return t?E(t+"/"+i):i}(this.history.base,o,this.mode),normalizedTo:i,resolved:r}},Kt.prototype.getRoutes=function(){return this.matcher.getRoutes()},Kt.prototype.addRoute=function(t,e){this.matcher.addRoute(t,e),this.history.current!==g&&this.history.transitionTo(this.history.getCurrentLocation())},Kt.prototype.addRoutes=function(e){"production"!==t.env.NODE_ENV&&i(),this.matcher.addRoutes(e),this.history.current!==g&&this.history.transitionTo(this.history.getCurrentLocation())},Object.defineProperties(Kt.prototype,Yt),Kt.install=Q,Kt.version="3.5.2",Kt.isNavigationFailure=Dt,Kt.NavigationFailureType=St,Kt.START_LOCATION=g,tt&&window.Vue&&window.Vue.use(Kt),e.exports=Kt}).call(this)}).call(this,t("_process"))},{_process:7}],16:[function(t,e,n){(function(t,i){(function(){var r,o;r=this,o=function(){"use strict";var e=Object.freeze({});function n(t){return null==t}function r(t){return null!=t}function o(t){return!0===t}function a(t){return"string"==typeof t||"number"==typeof t||"symbol"==typeof t||"boolean"==typeof t}function s(t){return null!==t&&"object"==typeof t}var l=Object.prototype.toString;function c(t){return"[object Object]"===l.call(t)}function u(t){var e=parseFloat(String(t));return e>=0&&Math.floor(e)===e&&isFinite(t)}function h(t){return r(t)&&"function"==typeof t.then&&"function"==typeof t.catch}function d(t){return null==t?"":Array.isArray(t)||c(t)&&t.toString===l?JSON.stringify(t,null,2):String(t)}function p(t){var e=parseFloat(t);return isNaN(e)?t:e}function f(t,e){for(var n=Object.create(null),i=t.split(","),r=0;r-1)return t.splice(n,1)}}var v=Object.prototype.hasOwnProperty;function y(t,e){return v.call(t,e)}function x(t){var e=Object.create(null);return function(n){return e[n]||(e[n]=t(n))}}var b=/-(\w)/g,w=x((function(t){return t.replace(b,(function(t,e){return e?e.toUpperCase():""}))})),T=x((function(t){return t.charAt(0).toUpperCase()+t.slice(1)})),C=/\B([A-Z])/g,E=x((function(t){return t.replace(C,"-$1").toLowerCase()})),S=Function.prototype.bind?function(t,e){return t.bind(e)}:function(t,e){function n(n){var i=arguments.length;return i?i>1?t.apply(e,arguments):t.call(e,n):t.call(e)}return n._length=t.length,n};function A(t,e){e=e||0;for(var n=t.length-e,i=new Array(n);n--;)i[n]=t[n+e];return i}function k(t,e){for(var n in e)t[n]=e[n];return t}function I(t){for(var e={},n=0;n0,Y=W&&W.indexOf("edge/")>0,J=(W&&W.indexOf("android"),W&&/iphone|ipad|ipod|ios/.test(W)||"ios"===H),Q=(W&&/chrome\/\d+/.test(W),W&&/phantomjs/.test(W),W&&W.match(/firefox\/(\d+)/)),tt={}.watch,et=!1;if(q)try{var nt={};Object.defineProperty(nt,"passive",{get:function(){et=!0}}),window.addEventListener("test-passive",null,nt)}catch(e){}var it=function(){return void 0===U&&(U=!q&&!Z&&void 0!==t&&t.process&&"server"===t.process.env.VUE_ENV),U},rt=q&&window.__VUE_DEVTOOLS_GLOBAL_HOOK__;function ot(t){return"function"==typeof t&&/native code/.test(t.toString())}var at,st="undefined"!=typeof Symbol&&ot(Symbol)&&"undefined"!=typeof Reflect&&ot(Reflect.ownKeys);at="undefined"!=typeof Set&&ot(Set)?Set:function(){function t(){this.set=Object.create(null)}return t.prototype.has=function(t){return!0===this.set[t]},t.prototype.add=function(t){this.set[t]=!0},t.prototype.clear=function(){this.set=Object.create(null)},t}();var lt=M,ct=0,ut=function(){this.id=ct++,this.subs=[]};ut.prototype.addSub=function(t){this.subs.push(t)},ut.prototype.removeSub=function(t){_(this.subs,t)},ut.prototype.depend=function(){ut.target&&ut.target.addDep(this)},ut.prototype.notify=function(){for(var t=this.subs.slice(),e=0,n=t.length;e-1)if(o&&!y(r,"default"))a=!1;else if(""===a||a===E(t)){var l=jt(String,r.type);(l<0||s0&&(ue((l=t(l,(i||"")+"_"+s))[0])&&ue(u)&&(h[c]=_t(u.text+l[0].text),l.shift()),h.push.apply(h,l)):a(l)?ue(u)?h[c]=_t(u.text+l):""!==l&&h.push(_t(l)):ue(l)&&ue(u)?h[c]=_t(u.text+l.text):(o(e._isVList)&&r(l.tag)&&n(l.key)&&r(i)&&(l.key="__vlist"+i+"_"+s+"__"),h.push(l)));return h}(t):void 0}function ue(t){return r(t)&&r(t.text)&&!1===t.isComment}function he(t,e){if(t){for(var n=Object.create(null),i=st?Reflect.ownKeys(t):Object.keys(t),r=0;r0,a=t?!!t.$stable:!o,s=t&&t.$key;if(t){if(t._normalized)return t._normalized;if(a&&i&&i!==e&&s===i.$key&&!o&&!i.$hasNormal)return i;for(var l in r={},t)t[l]&&"$"!==l[0]&&(r[l]=ge(n,l,t[l]))}else r={};for(var c in n)c in r||(r[c]=_e(n,c));return t&&Object.isExtensible(t)&&(t._normalized=r),j(r,"$stable",a),j(r,"$key",s),j(r,"$hasNormal",o),r}function ge(t,e,n){var i=function(){var t=arguments.length?n.apply(null,arguments):n({}),e=(t=t&&"object"==typeof t&&!Array.isArray(t)?[t]:ce(t))&&t[0];return t&&(!e||1===t.length&&e.isComment&&!fe(e))?void 0:t};return n.proxy&&Object.defineProperty(t,e,{get:i,enumerable:!0,configurable:!0}),i}function _e(t,e){return function(){return t[e]}}function ve(t,e){var n,i,o,a,l;if(Array.isArray(t)||"string"==typeof t)for(n=new Array(t.length),i=0,o=t.length;idocument.createEvent("Event").timeStamp&&(ln=function(){return cn.now()})}function un(){var t,e;for(sn=ln(),on=!0,tn.sort((function(t,e){return t.id-e.id})),an=0;anan&&tn[n].id>t.id;)n--;tn.splice(n+1,0,t)}else tn.push(t);rn||(rn=!0,ee(un))}}(this)},dn.prototype.run=function(){if(this.active){var t=this.get();if(t!==this.value||s(t)||this.deep){var e=this.value;if(this.value=t,this.user){var n='callback for watcher "'+this.expression+'"';Vt(this.cb,this.vm,[t,e],this.vm,n)}else this.cb.call(this.vm,t,e)}}},dn.prototype.evaluate=function(){this.value=this.get(),this.dirty=!1},dn.prototype.depend=function(){for(var t=this.deps.length;t--;)this.deps[t].depend()},dn.prototype.teardown=function(){if(this.active){this.vm._isBeingDestroyed||_(this.vm._watchers,this);for(var t=this.deps.length;t--;)this.deps[t].removeSub(this);this.active=!1}};var pn={enumerable:!0,configurable:!0,get:M,set:M};function fn(t,e,n){pn.get=function(){return this[e][n]},pn.set=function(t){this[e][n]=t},Object.defineProperty(t,n,pn)}var mn={lazy:!0};function gn(t,e,n){var i=!it();"function"==typeof n?(pn.get=i?_n(e):vn(n),pn.set=M):(pn.get=n.get?i&&!1!==n.cache?_n(e):vn(n.get):M,pn.set=n.set||M),Object.defineProperty(t,e,pn)}function _n(t){return function(){var e=this._computedWatchers&&this._computedWatchers[t];if(e)return e.dirty&&e.evaluate(),ut.target&&e.depend(),e.value}}function vn(t){return function(){return t.call(this,this)}}function yn(t,e,n,i){return c(n)&&(i=n,n=n.handler),"string"==typeof n&&(n=t[n]),t.$watch(e,n,i)}var xn=0;function bn(t){var e=t.options;if(t.super){var n=bn(t.super);if(n!==t.superOptions){t.superOptions=n;var i=function(t){var e,n=t.options,i=t.sealedOptions;for(var r in n)n[r]!==i[r]&&(e||(e={}),e[r]=n[r]);return e}(t);i&&k(t.extendOptions,i),(e=t.options=Rt(n,t.extendOptions)).name&&(e.components[e.name]=t)}}return e}function wn(t){this._init(t)}function Tn(t){return t&&(t.Ctor.options.name||t.tag)}function Cn(t,e){return Array.isArray(t)?t.indexOf(e)>-1:"string"==typeof t?t.split(",").indexOf(e)>-1:(n=t,"[object RegExp]"===l.call(n)&&t.test(e));var n}function En(t,e){var n=t.cache,i=t.keys,r=t._vnode;for(var o in n){var a=n[o];if(a){var s=a.name;s&&!e(s)&&Sn(n,o,i,r)}}}function Sn(t,e,n,i){var r=t[e];!r||i&&r.tag===i.tag||r.componentInstance.$destroy(),t[e]=null,_(n,e)}!function(t){t.prototype._init=function(t){var n=this;n._uid=xn++,n._isVue=!0,t&&t._isComponent?function(t,e){var n=t.$options=Object.create(t.constructor.options),i=e._parentVnode;n.parent=e.parent,n._parentVnode=i;var r=i.componentOptions;n.propsData=r.propsData,n._parentListeners=r.listeners,n._renderChildren=r.children,n._componentTag=r.tag,e.render&&(n.render=e.render,n.staticRenderFns=e.staticRenderFns)}(n,t):n.$options=Rt(bn(n.constructor),t||{},n),n._renderProxy=n,n._self=n,function(t){var e=t.$options,n=e.parent;if(n&&!e.abstract){for(;n.$options.abstract&&n.$parent;)n=n.$parent;n.$children.push(t)}t.$parent=n,t.$root=n?n.$root:t,t.$children=[],t.$refs={},t._watcher=null,t._inactive=null,t._directInactive=!1,t._isMounted=!1,t._isDestroyed=!1,t._isBeingDestroyed=!1}(n),function(t){t._events=Object.create(null),t._hasHookEvent=!1;var e=t.$options._parentListeners;e&&We(t,e)}(n),function(t){t._vnode=null,t._staticTrees=null;var n=t.$options,i=t.$vnode=n._parentVnode,r=i&&i.context;t.$slots=de(n._renderChildren,r),t.$scopedSlots=e,t._c=function(e,n,i,r){return Ne(t,e,n,i,r,!1)},t.$createElement=function(e,n,i,r){return Ne(t,e,n,i,r,!0)};var o=i&&i.data;St(t,"$attrs",o&&o.attrs||e,null,!0),St(t,"$listeners",n._parentListeners||e,null,!0)}(n),Qe(n,"beforeCreate"),function(t){var e=he(t.$options.inject,t);e&&(Tt(!1),Object.keys(e).forEach((function(n){St(t,n,e[n])})),Tt(!0))}(n),function(t){t._watchers=[];var e=t.$options;e.props&&function(t,e){var n=t.$options.propsData||{},i=t._props={},r=t.$options._propKeys=[];t.$parent&&Tt(!1);var o=function(o){r.push(o);var a=Ft(o,e,n,t);St(i,o,a),o in t||fn(t,"_props",o)};for(var a in e)o(a);Tt(!0)}(t,e.props),e.methods&&function(t,e){for(var n in t.$options.props,e)t[n]="function"!=typeof e[n]?M:S(e[n],t)}(t,e.methods),e.data?function(t){var e=t.$options.data;c(e=t._data="function"==typeof e?function(t,e){dt();try{return t.call(e,e)}catch(t){return Ut(t,e,"data()"),{}}finally{pt()}}(e,t):e||{})||(e={});for(var n,i=Object.keys(e),r=t.$options.props,o=(t.$options.methods,i.length);o--;){var a=i[o];r&&y(r,a)||36!==(n=(a+"").charCodeAt(0))&&95!==n&&fn(t,"_data",a)}Et(e,!0)}(t):Et(t._data={},!0),e.computed&&function(t,e){var n=t._computedWatchers=Object.create(null),i=it();for(var r in e){var o=e[r],a="function"==typeof o?o:o.get;i||(n[r]=new dn(t,a||M,M,mn)),r in t||gn(t,r,o)}}(t,e.computed),e.watch&&e.watch!==tt&&function(t,e){for(var n in e){var i=e[n];if(Array.isArray(i))for(var r=0;r1?A(e):e;for(var n=A(arguments,1),i='event handler for "'+t+'"',r=0,o=e.length;rparseInt(this.max)&&Sn(t,e[0],e,this._vnode),this.vnodeToCache=null}}},created:function(){this.cache=Object.create(null),this.keys=[]},destroyed:function(){for(var t in this.cache)Sn(this.cache,t,this.keys)},mounted:function(){var t=this;this.cacheVNode(),this.$watch("include",(function(e){En(t,(function(t){return Cn(e,t)}))})),this.$watch("exclude",(function(e){En(t,(function(t){return!Cn(e,t)}))}))},updated:function(){this.cacheVNode()},render:function(){var t=this.$slots.default,e=Ge(t),n=e&&e.componentOptions;if(n){var i=Tn(n),r=this.include,o=this.exclude;if(r&&(!i||!Cn(r,i))||o&&i&&Cn(o,i))return e;var a=this.cache,s=this.keys,l=null==e.key?n.Ctor.cid+(n.tag?"::"+n.tag:""):e.key;a[l]?(e.componentInstance=a[l].componentInstance,_(s,l),s.push(l)):(this.vnodeToCache=e,this.keyToCache=l),e.data.keepAlive=!0}return e||t&&t[0]}}};!function(t){var e={get:function(){return B}};Object.defineProperty(t,"config",e),t.util={warn:lt,extend:k,mergeOptions:Rt,defineReactive:St},t.set=At,t.delete=kt,t.nextTick=ee,t.observable=function(t){return Et(t),t},t.options=Object.create(null),F.forEach((function(e){t.options[e+"s"]=Object.create(null)})),t.options._base=t,k(t.options.components,kn),function(t){t.use=function(t){var e=this._installedPlugins||(this._installedPlugins=[]);if(e.indexOf(t)>-1)return this;var n=A(arguments,1);return n.unshift(this),"function"==typeof t.install?t.install.apply(t,n):"function"==typeof t&&t.apply(null,n),e.push(t),this}}(t),function(t){t.mixin=function(t){return this.options=Rt(this.options,t),this}}(t),function(t){t.cid=0;var e=1;t.extend=function(t){t=t||{};var n=this,i=n.cid,r=t._Ctor||(t._Ctor={});if(r[i])return r[i];var o=t.name||n.options.name,a=function(t){this._init(t)};return(a.prototype=Object.create(n.prototype)).constructor=a,a.cid=e++,a.options=Rt(n.options,t),a.super=n,a.options.props&&function(t){var e=t.options.props;for(var n in e)fn(t.prototype,"_props",n)}(a),a.options.computed&&function(t){var e=t.options.computed;for(var n in e)gn(t.prototype,n,e[n])}(a),a.extend=n.extend,a.mixin=n.mixin,a.use=n.use,F.forEach((function(t){a[t]=n[t]})),o&&(a.options.components[o]=a),a.superOptions=n.options,a.extendOptions=t,a.sealedOptions=k({},a.options),r[i]=a,a}}(t),function(t){F.forEach((function(e){t[e]=function(t,n){return n?("component"===e&&c(n)&&(n.name=n.name||t,n=this.options._base.extend(n)),"directive"===e&&"function"==typeof n&&(n={bind:n,update:n}),this.options[e+"s"][t]=n,n):this.options[e+"s"][t]}}))}(t)}(wn),Object.defineProperty(wn.prototype,"$isServer",{get:it}),Object.defineProperty(wn.prototype,"$ssrContext",{get:function(){return this.$vnode&&this.$vnode.ssrContext}}),Object.defineProperty(wn,"FunctionalRenderContext",{value:ze}),wn.version="2.6.14";var In=f("style,class"),Mn=f("input,textarea,option,select,progress"),Pn=function(t,e,n){return"value"===n&&Mn(t)&&"button"!==e||"selected"===n&&"option"===t||"checked"===n&&"input"===t||"muted"===n&&"video"===t},Dn=f("contenteditable,draggable,spellcheck"),zn=f("events,caret,typing,plaintext-only"),On=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,truespeed,typemustmatch,visible"),Rn="http://www.w3.org/1999/xlink",Ln=function(t){return":"===t.charAt(5)&&"xlink"===t.slice(0,5)},Fn=function(t){return Ln(t)?t.slice(6,t.length):""},$n=function(t){return null==t||!1===t};function Bn(t,e){return{staticClass:Nn(t.staticClass,e.staticClass),class:r(t.class)?[t.class,e.class]:e.class}}function Nn(t,e){return t?e?t+" "+e:t:e||""}function jn(t){return Array.isArray(t)?function(t){for(var e,n="",i=0,o=t.length;i-1?di(t,e,n):On(e)?$n(n)?t.removeAttribute(e):(n="allowfullscreen"===e&&"EMBED"===t.tagName?"true":e,t.setAttribute(e,n)):Dn(e)?t.setAttribute(e,function(t,e){return $n(e)||"false"===e?"false":"contenteditable"===t&&zn(e)?e:"true"}(e,n)):Ln(e)?$n(n)?t.removeAttributeNS(Rn,Fn(e)):t.setAttributeNS(Rn,e,n):di(t,e,n)}function di(t,e,n){if($n(n))t.removeAttribute(e);else{if(X&&!K&&"TEXTAREA"===t.tagName&&"placeholder"===e&&""!==n&&!t.__ieph){var i=function(e){e.stopImmediatePropagation(),t.removeEventListener("input",i)};t.addEventListener("input",i),t.__ieph=!0}t.setAttribute(e,n)}}var pi={create:ui,update:ui};function fi(t,e){var i=e.elm,o=e.data,a=t.data;if(!(n(o.staticClass)&&n(o.class)&&(n(a)||n(a.staticClass)&&n(a.class)))){var s=function(t){for(var e=t.data,n=t,i=t;r(i.componentInstance);)(i=i.componentInstance._vnode)&&i.data&&(e=Bn(i.data,e));for(;r(n=n.parent);)n&&n.data&&(e=Bn(e,n.data));return function(t,e){return r(t)||r(e)?Nn(t,jn(e)):""}(e.staticClass,e.class)}(e),l=i._transitionClasses;r(l)&&(s=Nn(s,jn(l))),s!==i._prevClass&&(i.setAttribute("class",s),i._prevClass=s)}}var mi,gi,_i,vi,yi,xi,bi={create:fi,update:fi},wi=/[\w).+\-_$\]]/;function Ti(t){var e,n,i,r,o,a=!1,s=!1,l=!1,c=!1,u=0,h=0,d=0,p=0;for(i=0;i=0&&" "===(m=t.charAt(f));f--);m&&wi.test(m)||(c=!0)}}else void 0===r?(p=i+1,r=t.slice(0,i).trim()):g();function g(){(o||(o=[])).push(t.slice(p,i).trim()),p=i+1}if(void 0===r?r=t.slice(0,i).trim():0!==p&&g(),o)for(i=0;i-1?{exp:t.slice(0,vi),key:'"'+t.slice(vi+1)+'"'}:{exp:t,key:null};for(gi=t,vi=yi=xi=0;!Ni();)ji(_i=Bi())?Vi(_i):91===_i&&Ui(_i);return{exp:t.slice(0,yi),key:t.slice(yi+1,xi)}}(t);return null===n.key?t+"="+e:"$set("+n.exp+", "+n.key+", "+e+")"}function Bi(){return gi.charCodeAt(++vi)}function Ni(){return vi>=mi}function ji(t){return 34===t||39===t}function Ui(t){var e=1;for(yi=vi;!Ni();)if(ji(t=Bi()))Vi(t);else if(91===t&&e++,93===t&&e--,0===e){xi=vi;break}}function Vi(t){for(var e=t;!Ni()&&(t=Bi())!==e;);}var Gi,qi="__r";function Zi(t,e,n){var i=Gi;return function r(){null!==e.apply(null,arguments)&&Xi(t,r,n,i)}}var Hi=Ht&&!(Q&&Number(Q[1])<=53);function Wi(t,e,n,i){if(Hi){var r=sn,o=e;e=o._wrapper=function(t){if(t.target===t.currentTarget||t.timeStamp>=r||t.timeStamp<=0||t.target.ownerDocument!==document)return o.apply(this,arguments)}}Gi.addEventListener(t,e,et?{capture:n,passive:i}:n)}function Xi(t,e,n,i){(i||Gi).removeEventListener(t,e._wrapper||e,n)}function Ki(t,e){if(!n(t.data.on)||!n(e.data.on)){var i=e.data.on||{},o=t.data.on||{};Gi=e.elm,function(t){if(r(t.__r)){var e=X?"change":"input";t[e]=[].concat(t.__r,t[e]||[]),delete t.__r}r(t.__c)&&(t.change=[].concat(t.__c,t.change||[]),delete t.__c)}(i),ae(i,o,Wi,Xi,Zi,e.context),Gi=void 0}}var Yi,Ji={create:Ki,update:Ki};function Qi(t,e){if(!n(t.data.domProps)||!n(e.data.domProps)){var i,o,a=e.elm,s=t.data.domProps||{},l=e.data.domProps||{};for(i in r(l.__ob__)&&(l=e.data.domProps=k({},l)),s)i in l||(a[i]="");for(i in l){if(o=l[i],"textContent"===i||"innerHTML"===i){if(e.children&&(e.children.length=0),o===s[i])continue;1===a.childNodes.length&&a.removeChild(a.childNodes[0])}if("value"===i&&"PROGRESS"!==a.tagName){a._value=o;var c=n(o)?"":String(o);tr(a,c)&&(a.value=c)}else if("innerHTML"===i&&Gn(a.tagName)&&n(a.innerHTML)){(Yi=Yi||document.createElement("div")).innerHTML=""+o+"";for(var u=Yi.firstChild;a.firstChild;)a.removeChild(a.firstChild);for(;u.firstChild;)a.appendChild(u.firstChild)}else if(o!==s[i])try{a[i]=o}catch(t){}}}}function tr(t,e){return!t.composing&&("OPTION"===t.tagName||function(t,e){var n=!0;try{n=document.activeElement!==t}catch(t){}return n&&t.value!==e}(t,e)||function(t,e){var n=t.value,i=t._vModifiers;if(r(i)){if(i.number)return p(n)!==p(e);if(i.trim)return n.trim()!==e.trim()}return n!==e}(t,e))}var er={create:Qi,update:Qi},nr=x((function(t){var e={},n=/:(.+)/;return t.split(/;(?![^(]*\))/g).forEach((function(t){if(t){var i=t.split(n);i.length>1&&(e[i[0].trim()]=i[1].trim())}})),e}));function ir(t){var e=rr(t.style);return t.staticStyle?k(t.staticStyle,e):e}function rr(t){return Array.isArray(t)?I(t):"string"==typeof t?nr(t):t}var or,ar=/^--/,sr=/\s*!important$/,lr=function(t,e,n){if(ar.test(e))t.style.setProperty(e,n);else if(sr.test(n))t.style.setProperty(E(e),n.replace(sr,""),"important");else{var i=ur(e);if(Array.isArray(n))for(var r=0,o=n.length;r-1?e.split(pr).forEach((function(e){return t.classList.add(e)})):t.classList.add(e);else{var n=" "+(t.getAttribute("class")||"")+" ";n.indexOf(" "+e+" ")<0&&t.setAttribute("class",(n+e).trim())}}function mr(t,e){if(e&&(e=e.trim()))if(t.classList)e.indexOf(" ")>-1?e.split(pr).forEach((function(e){return t.classList.remove(e)})):t.classList.remove(e),t.classList.length||t.removeAttribute("class");else{for(var n=" "+(t.getAttribute("class")||"")+" ",i=" "+e+" ";n.indexOf(i)>=0;)n=n.replace(i," ");(n=n.trim())?t.setAttribute("class",n):t.removeAttribute("class")}}function gr(t){if(t){if("object"==typeof t){var e={};return!1!==t.css&&k(e,_r(t.name||"v")),k(e,t),e}return"string"==typeof t?_r(t):void 0}}var _r=x((function(t){return{enterClass:t+"-enter",enterToClass:t+"-enter-to",enterActiveClass:t+"-enter-active",leaveClass:t+"-leave",leaveToClass:t+"-leave-to",leaveActiveClass:t+"-leave-active"}})),vr=q&&!K,yr="transition",xr="animation",br="transition",wr="transitionend",Tr="animation",Cr="animationend";vr&&(void 0===window.ontransitionend&&void 0!==window.onwebkittransitionend&&(br="WebkitTransition",wr="webkitTransitionEnd"),void 0===window.onanimationend&&void 0!==window.onwebkitanimationend&&(Tr="WebkitAnimation",Cr="webkitAnimationEnd"));var Er=q?window.requestAnimationFrame?window.requestAnimationFrame.bind(window):setTimeout:function(t){return t()};function Sr(t){Er((function(){Er(t)}))}function Ar(t,e){var n=t._transitionClasses||(t._transitionClasses=[]);n.indexOf(e)<0&&(n.push(e),fr(t,e))}function kr(t,e){t._transitionClasses&&_(t._transitionClasses,e),mr(t,e)}function Ir(t,e,n){var i=Pr(t,e),r=i.type,o=i.timeout,a=i.propCount;if(!r)return n();var s=r===yr?wr:Cr,l=0,c=function(){t.removeEventListener(s,u),n()},u=function(e){e.target===t&&++l>=a&&c()};setTimeout((function(){l0&&(n=yr,u=a,h=o.length):e===xr?c>0&&(n=xr,u=c,h=l.length):h=(n=(u=Math.max(a,c))>0?a>c?yr:xr:null)?n===yr?o.length:l.length:0,{type:n,timeout:u,propCount:h,hasTransform:n===yr&&Mr.test(i[br+"Property"])}}function Dr(t,e){for(;t.length1}function $r(t,e){!0!==e.data.show&&Or(e)}var Br=function(t){var e,i,s={},l=t.modules,c=t.nodeOps;for(e=0;ef?y(t,n(i[_+1])?null:i[_+1].elm,i,p,_,o):p>_&&b(e,d,f)}(d,m,_,i,u):r(_)?(r(t.text)&&c.setTextContent(d,""),y(d,null,_,0,_.length-1,i)):r(m)?b(m,0,m.length-1):r(t.text)&&c.setTextContent(d,""):t.text!==e.text&&c.setTextContent(d,e.text),r(f)&&r(p=f.hook)&&r(p=p.postpatch)&&p(t,e)}}}function E(t,e,n){if(o(n)&&r(t.parent))t.parent.data.pendingInsert=e;else for(var i=0;i-1,a.selected!==o&&(a.selected=o);else if(z(Gr(a),i))return void(t.selectedIndex!==s&&(t.selectedIndex=s));r||(t.selectedIndex=-1)}}function Vr(t,e){return e.every((function(e){return!z(e,t)}))}function Gr(t){return"_value"in t?t._value:t.value}function qr(t){t.target.composing=!0}function Zr(t){t.target.composing&&(t.target.composing=!1,Hr(t.target,"input"))}function Hr(t,e){var n=document.createEvent("HTMLEvents");n.initEvent(e,!0,!0),t.dispatchEvent(n)}function Wr(t){return!t.componentInstance||t.data&&t.data.transition?t:Wr(t.componentInstance._vnode)}var Xr={model:Nr,show:{bind:function(t,e,n){var i=e.value,r=(n=Wr(n)).data&&n.data.transition,o=t.__vOriginalDisplay="none"===t.style.display?"":t.style.display;i&&r?(n.data.show=!0,Or(n,(function(){t.style.display=o}))):t.style.display=i?o:"none"},update:function(t,e,n){var i=e.value;!i!=!e.oldValue&&((n=Wr(n)).data&&n.data.transition?(n.data.show=!0,i?Or(n,(function(){t.style.display=t.__vOriginalDisplay})):Rr(n,(function(){t.style.display="none"}))):t.style.display=i?t.__vOriginalDisplay:"none")},unbind:function(t,e,n,i,r){r||(t.style.display=t.__vOriginalDisplay)}}},Kr={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(t){var e=t&&t.componentOptions;return e&&e.Ctor.options.abstract?Yr(Ge(e.children)):t}function Jr(t){var e={},n=t.$options;for(var i in n.propsData)e[i]=t[i];var r=n._parentListeners;for(var o in r)e[w(o)]=r[o];return e}function Qr(t,e){if(/\d-keep-alive$/.test(e.tag))return t("keep-alive",{props:e.componentOptions.propsData})}var to=function(t){return t.tag||fe(t)},eo=function(t){return"show"===t.name},no={name:"transition",props:Kr,abstract:!0,render:function(t){var e=this,n=this.$slots.default;if(n&&(n=n.filter(to)).length){var i=this.mode,r=n[0];if(function(t){for(;t=t.parent;)if(t.data.transition)return!0}(this.$vnode))return r;var o=Yr(r);if(!o)return r;if(this._leaving)return Qr(t,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=Jr(this),c=this._vnode,u=Yr(c);if(o.data.directives&&o.data.directives.some(eo)&&(o.data.show=!0),u&&u.data&&!function(t,e){return e.key===t.key&&e.tag===t.tag}(o,u)&&!fe(u)&&(!u.componentInstance||!u.componentInstance._vnode.isComment)){var h=u.data.transition=k({},l);if("out-in"===i)return this._leaving=!0,se(h,"afterLeave",(function(){e._leaving=!1,e.$forceUpdate()})),Qr(t,r);if("in-out"===i){if(fe(o))return c;var d,p=function(){d()};se(l,"afterEnter",p),se(l,"enterCancelled",p),se(h,"delayLeave",(function(t){d=t}))}}return r}}},io=k({tag:String,moveClass:String},Kr);function ro(t){t.elm._moveCb&&t.elm._moveCb(),t.elm._enterCb&&t.elm._enterCb()}function oo(t){t.data.newPos=t.elm.getBoundingClientRect()}function ao(t){var e=t.data.pos,n=t.data.newPos,i=e.left-n.left,r=e.top-n.top;if(i||r){t.data.moved=!0;var o=t.elm.style;o.transform=o.WebkitTransform="translate("+i+"px,"+r+"px)",o.transitionDuration="0s"}}delete io.mode;var so={Transition:no,TransitionGroup:{props:io,beforeMount:function(){var t=this,e=this._update;this._update=function(n,i){var r=Ke(t);t.__patch__(t._vnode,t.kept,!1,!0),t._vnode=t.kept,r(),e.call(t,n,i)}},render:function(t){for(var e=this.tag||this.$vnode.data.tag||"span",n=Object.create(null),i=this.prevChildren=this.children,r=this.$slots.default||[],o=this.children=[],a=Jr(this),s=0;s-1?Hn[t]=e.constructor===window.HTMLUnknownElement||e.constructor===window.HTMLElement:Hn[t]=/HTMLUnknownElement/.test(e.toString())},k(wn.options.directives,Xr),k(wn.options.components,so),wn.prototype.__patch__=q?Br:M,wn.prototype.$mount=function(t,e){return function(t,e,n){var i;return t.$el=e,t.$options.render||(t.$options.render=gt),Qe(t,"beforeMount"),i=function(){t._update(t._render(),n)},new dn(t,i,M,{before:function(){t._isMounted&&!t._isDestroyed&&Qe(t,"beforeUpdate")}},!0),n=!1,null==t.$vnode&&(t._isMounted=!0,Qe(t,"mounted")),t}(this,t=t&&q?Xn(t):void 0,e)},q&&setTimeout((function(){B.devtools&&rt&&rt.emit("init",wn)}),0);var lo,co=/\{\{((?:.|\r?\n)+?)\}\}/g,uo=/[-.*+?^${}()|[\]\/\\]/g,ho=x((function(t){var e=t[0].replace(uo,"\\$&"),n=t[1].replace(uo,"\\$&");return new RegExp(e+"((?:.|\\n)+?)"+n,"g")})),po={staticKeys:["staticClass"],transformNode:function(t,e){e.warn;var n=Oi(t,"class");n&&(t.staticClass=JSON.stringify(n));var i=zi(t,"class",!1);i&&(t.classBinding=i)},genData:function(t){var e="";return t.staticClass&&(e+="staticClass:"+t.staticClass+","),t.classBinding&&(e+="class:"+t.classBinding+","),e}},fo={staticKeys:["staticStyle"],transformNode:function(t,e){e.warn;var n=Oi(t,"style");n&&(t.staticStyle=JSON.stringify(nr(n)));var i=zi(t,"style",!1);i&&(t.styleBinding=i)},genData:function(t){var e="";return t.staticStyle&&(e+="staticStyle:"+t.staticStyle+","),t.styleBinding&&(e+="style:("+t.styleBinding+"),"),e}},mo=f("area,base,br,col,embed,frame,hr,img,input,isindex,keygen,link,meta,param,source,track,wbr"),go=f("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source"),_o=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"),vo=/^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/,yo=/^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+?\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/,xo="[a-zA-Z_][\\-\\.0-9_a-zA-Z"+N.source+"]*",bo="((?:"+xo+"\\:)?"+xo+")",wo=new RegExp("^<"+bo),To=/^\s*(\/?)>/,Co=new RegExp("^<\\/"+bo+"[^>]*>"),Eo=/^]+>/i,So=/^",""":'"',"&":"&"," ":"\n"," ":"\t","'":"'"},Po=/&(?:lt|gt|quot|amp|#39);/g,Do=/&(?:lt|gt|quot|amp|#39|#10|#9);/g,zo=f("pre,textarea",!0),Oo=function(t,e){return t&&zo(t)&&"\n"===e[0]};function Ro(t,e){var n=e?Do:Po;return t.replace(n,(function(t){return Mo[t]}))}var Lo,Fo,$o,Bo,No,jo,Uo,Vo,Go=/^@|^v-on:/,qo=/^v-|^@|^:|^#/,Zo=/([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/,Ho=/,([^,\}\]]*)(?:,([^,\}\]]*))?$/,Wo=/^\(|\)$/g,Xo=/^\[.*\]$/,Ko=/:(.*)$/,Yo=/^:|^\.|^v-bind:/,Jo=/\.[^.\]]+(?=[^\]]*$)/g,Qo=/^v-slot(:|$)|^#/,ta=/[\r\n]/,ea=/[ \f\t\r\n]+/g,na=x((function(t){return(lo=lo||document.createElement("div")).innerHTML=t,lo.textContent})),ia="_empty_";function ra(t,e,n){return{type:1,tag:t,attrsList:e,attrsMap:ua(e),rawAttrsMap:{},parent:n,children:[]}}function oa(t,e){var n,i;(i=zi(n=t,"key"))&&(n.key=i),t.plain=!t.key&&!t.scopedSlots&&!t.attrsList.length,function(t){var e=zi(t,"ref");e&&(t.ref=e,t.refInFor=function(t){for(var e=t;e;){if(void 0!==e.for)return!0;e=e.parent}return!1}(t))}(t),function(t){var e;"template"===t.tag?(e=Oi(t,"scope"),t.slotScope=e||Oi(t,"slot-scope")):(e=Oi(t,"slot-scope"))&&(t.slotScope=e);var n=zi(t,"slot");if(n&&(t.slotTarget='""'===n?'"default"':n,t.slotTargetDynamic=!(!t.attrsMap[":slot"]&&!t.attrsMap["v-bind:slot"]),"template"===t.tag||t.slotScope||ki(t,"slot",n,function(t,e){return t.rawAttrsMap[":"+e]||t.rawAttrsMap["v-bind:"+e]||t.rawAttrsMap[e]}(t,"slot"))),"template"===t.tag){var i=Ri(t,Qo);if(i){var r=la(i),o=r.name,a=r.dynamic;t.slotTarget=o,t.slotTargetDynamic=a,t.slotScope=i.value||ia}}else{var s=Ri(t,Qo);if(s){var l=t.scopedSlots||(t.scopedSlots={}),c=la(s),u=c.name,h=c.dynamic,d=l[u]=ra("template",[],t);d.slotTarget=u,d.slotTargetDynamic=h,d.children=t.children.filter((function(t){if(!t.slotScope)return t.parent=d,!0})),d.slotScope=s.value||ia,t.children=[],t.plain=!1}}}(t),function(t){"slot"===t.tag&&(t.slotName=zi(t,"name"))}(t),function(t){var e;(e=zi(t,"is"))&&(t.component=e),null!=Oi(t,"inline-template")&&(t.inlineTemplate=!0)}(t);for(var r=0;r<$o.length;r++)t=$o[r](t,e)||t;return function(t){var e,n,i,r,o,a,s,l,c=t.attrsList;for(e=0,n=c.length;e-1"+("true"===o?":("+e+")":":_q("+e+","+o+")")),Di(t,"change","var $$a="+e+",$$el=$event.target,$$c=$$el.checked?("+o+"):("+a+");if(Array.isArray($$a)){var $$v="+(i?"_n("+r+")":r)+",$$i=_i($$a,$$v);if($$el.checked){$$i<0&&("+$i(e,"$$a.concat([$$v])")+")}else{$$i>-1&&("+$i(e,"$$a.slice(0,$$i).concat($$a.slice($$i+1))")+")}}else{"+$i(e,"$$c")+"}",null,!0)}(t,i,r);else if("input"===o&&"radio"===a)!function(t,e,n){var i=n&&n.number,r=zi(t,"value")||"null";Ai(t,"checked","_q("+e+","+(r=i?"_n("+r+")":r)+")"),Di(t,"change",$i(e,r),null,!0)}(t,i,r);else if("input"===o||"textarea"===o)!function(t,e,n){var i=t.attrsMap.type,r=n||{},o=r.lazy,a=r.number,s=r.trim,l=!o&&"range"!==i,c=o?"change":"range"===i?qi:"input",u="$event.target.value";s&&(u="$event.target.value.trim()"),a&&(u="_n("+u+")");var h=$i(e,u);l&&(h="if($event.target.composing)return;"+h),Ai(t,"value","("+e+")"),Di(t,c,h,null,!0),(s||a)&&Di(t,"blur","$forceUpdate()")}(t,i,r);else if(!B.isReservedTag(o))return Fi(t,i,r),!1;return!0},text:function(t,e){e.value&&Ai(t,"textContent","_s("+e.value+")",e)},html:function(t,e){e.value&&Ai(t,"innerHTML","_s("+e.value+")",e)}},isPreTag:function(t){return"pre"===t},isUnaryTag:mo,mustUseProp:Pn,canBeLeftOpenTag:go,isReservedTag:qn,getTagNamespace:Zn,staticKeys:function(t){return t.reduce((function(t,e){return t.concat(e.staticKeys||[])}),[]).join(",")}(ga)},va=x((function(t){return f("type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap"+(t?","+t:""))})),ya=/^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/,xa=/\([^)]*?\);*$/,ba=/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/,wa={esc:27,tab:9,enter:13,space:32,up:38,left:37,right:39,down:40,delete:[8,46]},Ta={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"]},Ca=function(t){return"if("+t+")return null;"},Ea={stop:"$event.stopPropagation();",prevent:"$event.preventDefault();",self:Ca("$event.target !== $event.currentTarget"),ctrl:Ca("!$event.ctrlKey"),shift:Ca("!$event.shiftKey"),alt:Ca("!$event.altKey"),meta:Ca("!$event.metaKey"),left:Ca("'button' in $event && $event.button !== 0"),middle:Ca("'button' in $event && $event.button !== 1"),right:Ca("'button' in $event && $event.button !== 2")};function Sa(t,e){var n=e?"nativeOn:":"on:",i="",r="";for(var o in t){var a=Aa(t[o]);t[o]&&t[o].dynamic?r+=o+","+a+",":i+='"'+o+'":'+a+","}return i="{"+i.slice(0,-1)+"}",r?n+"_d("+i+",["+r.slice(0,-1)+"])":n+i}function Aa(t){if(!t)return"function(){}";if(Array.isArray(t))return"["+t.map((function(t){return Aa(t)})).join(",")+"]";var e=ba.test(t.value),n=ya.test(t.value),i=ba.test(t.value.replace(xa,""));if(t.modifiers){var r="",o="",a=[];for(var s in t.modifiers)if(Ea[s])o+=Ea[s],wa[s]&&a.push(s);else if("exact"===s){var l=t.modifiers;o+=Ca(["ctrl","shift","alt","meta"].filter((function(t){return!l[t]})).map((function(t){return"$event."+t+"Key"})).join("||"))}else a.push(s);return a.length&&(r+=function(t){return"if(!$event.type.indexOf('key')&&"+t.map(ka).join("&&")+")return null;"}(a)),o&&(r+=o),"function($event){"+r+(e?"return "+t.value+".apply(null, arguments)":n?"return ("+t.value+").apply(null, arguments)":i?"return "+t.value:t.value)+"}"}return e||n?t.value:"function($event){"+(i?"return "+t.value:t.value)+"}"}function ka(t){var e=parseInt(t,10);if(e)return"$event.keyCode!=="+e;var n=wa[t],i=Ta[t];return"_k($event.keyCode,"+JSON.stringify(t)+","+JSON.stringify(n)+",$event.key,"+JSON.stringify(i)+")"}var Ia={on:function(t,e){t.wrapListeners=function(t){return"_g("+t+","+e.value+")"}},bind:function(t,e){t.wrapData=function(n){return"_b("+n+",'"+t.tag+"',"+e.value+","+(e.modifiers&&e.modifiers.prop?"true":"false")+(e.modifiers&&e.modifiers.sync?",true":"")+")"}},cloak:M},Ma=function(t){this.options=t,this.warn=t.warn||Ei,this.transforms=Si(t.modules,"transformCode"),this.dataGenFns=Si(t.modules,"genData"),this.directives=k(k({},Ia),t.directives);var e=t.isReservedTag||P;this.maybeComponent=function(t){return!!t.component||!e(t.tag)},this.onceId=0,this.staticRenderFns=[],this.pre=!1};function Pa(t,e){var n=new Ma(e);return{render:"with(this){return "+(t?"script"===t.tag?"null":Da(t,n):'_c("div")')+"}",staticRenderFns:n.staticRenderFns}}function Da(t,e){if(t.parent&&(t.pre=t.pre||t.parent.pre),t.staticRoot&&!t.staticProcessed)return za(t,e);if(t.once&&!t.onceProcessed)return Oa(t,e);if(t.for&&!t.forProcessed)return La(t,e);if(t.if&&!t.ifProcessed)return Ra(t,e);if("template"!==t.tag||t.slotTarget||e.pre){if("slot"===t.tag)return function(t,e){var n=t.slotName||'"default"',i=Na(t,e),r="_t("+n+(i?",function(){return "+i+"}":""),o=t.attrs||t.dynamicAttrs?Va((t.attrs||[]).concat(t.dynamicAttrs||[]).map((function(t){return{name:w(t.name),value:t.value,dynamic:t.dynamic}}))):null,a=t.attrsMap["v-bind"];return!o&&!a||i||(r+=",null"),o&&(r+=","+o),a&&(r+=(o?"":",null")+","+a),r+")"}(t,e);var n;if(t.component)n=function(t,e,n){var i=e.inlineTemplate?null:Na(e,n,!0);return"_c("+t+","+Fa(e,n)+(i?","+i:"")+")"}(t.component,t,e);else{var i;(!t.plain||t.pre&&e.maybeComponent(t))&&(i=Fa(t,e));var r=t.inlineTemplate?null:Na(t,e,!0);n="_c('"+t.tag+"'"+(i?","+i:"")+(r?","+r:"")+")"}for(var o=0;o>>0}(a):"")+")"}(t,t.scopedSlots,e)+","),t.model&&(n+="model:{value:"+t.model.value+",callback:"+t.model.callback+",expression:"+t.model.expression+"},"),t.inlineTemplate){var o=function(t,e){var n=t.children[0];if(n&&1===n.type){var i=Pa(n,e.options);return"inlineTemplate:{render:function(){"+i.render+"},staticRenderFns:["+i.staticRenderFns.map((function(t){return"function(){"+t+"}"})).join(",")+"]}"}}(t,e);o&&(n+=o+",")}return n=n.replace(/,$/,"")+"}",t.dynamicAttrs&&(n="_b("+n+',"'+t.tag+'",'+Va(t.dynamicAttrs)+")"),t.wrapData&&(n=t.wrapData(n)),t.wrapListeners&&(n=t.wrapListeners(n)),n}function $a(t){return 1===t.type&&("slot"===t.tag||t.children.some($a))}function Ba(t,e){var n=t.attrsMap["slot-scope"];if(t.if&&!t.ifProcessed&&!n)return Ra(t,e,Ba,"null");if(t.for&&!t.forProcessed)return La(t,e,Ba);var i=t.slotScope===ia?"":String(t.slotScope),r="function("+i+"){return "+("template"===t.tag?t.if&&n?"("+t.if+")?"+(Na(t,e)||"undefined")+":undefined":Na(t,e)||"undefined":Da(t,e))+"}",o=i?"":",proxy:true";return"{key:"+(t.slotTarget||'"default"')+",fn:"+r+o+"}"}function Na(t,e,n,i,r){var o=t.children;if(o.length){var a=o[0];if(1===o.length&&a.for&&"template"!==a.tag&&"slot"!==a.tag){var s=n?e.maybeComponent(a)?",1":",0":"";return""+(i||Da)(a,e)+s}var l=n?function(t,e){for(var n=0,i=0;i]*>)","i")),d=t.replace(h,(function(t,n,i){return c=i.length,ko(u)||"noscript"===u||(n=n.replace(//g,"$1").replace(//g,"$1")),Oo(u,n)&&(n=n.slice(1)),e.chars&&e.chars(n),""}));l+=t.length-d.length,t=d,S(u,l-c,l)}else{var p=t.indexOf("<");if(0===p){if(So.test(t)){var f=t.indexOf("--\x3e");if(f>=0){e.shouldKeepComment&&e.comment(t.substring(4,f),l,l+f+3),T(f+3);continue}}if(Ao.test(t)){var m=t.indexOf("]>");if(m>=0){T(m+2);continue}}var g=t.match(Eo);if(g){T(g[0].length);continue}var _=t.match(Co);if(_){var v=l;T(_[0].length),S(_[1],v,l);continue}var y=C();if(y){E(y),Oo(y.tagName,t)&&T(1);continue}}var x=void 0,b=void 0,w=void 0;if(p>=0){for(b=t.slice(p);!(Co.test(b)||wo.test(b)||So.test(b)||Ao.test(b)||(w=b.indexOf("<",1))<0);)p+=w,b=t.slice(p);x=t.substring(0,p)}p<0&&(x=t),x&&T(x.length),e.chars&&x&&e.chars(x,l-x.length,l)}if(t===n){e.chars&&e.chars(t);break}}function T(e){l+=e,t=t.substring(e)}function C(){var e=t.match(wo);if(e){var n,i,r={tagName:e[1],attrs:[],start:l};for(T(e[0].length);!(n=t.match(To))&&(i=t.match(yo)||t.match(vo));)i.start=l,T(i[0].length),i.end=l,r.attrs.push(i);if(n)return r.unarySlash=n[1],T(n[0].length),r.end=l,r}}function E(t){var n=t.tagName,l=t.unarySlash;o&&("p"===i&&_o(n)&&S(i),s(n)&&i===n&&S(n));for(var c=a(n)||!!l,u=t.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--)e.end&&e.end(r[c].tag,n,o);r.length=a,i=a&&r[a-1].tag}else"br"===s?e.start&&e.start(t,[],!0,n,o):"p"===s&&(e.start&&e.start(t,[],!1,n,o),e.end&&e.end(t,n,o))}S()}(t,{warn:Lo,expectHTML:e.expectHTML,isUnaryTag:e.isUnaryTag,canBeLeftOpenTag:e.canBeLeftOpenTag,shouldDecodeNewlines:e.shouldDecodeNewlines,shouldDecodeNewlinesForHref:e.shouldDecodeNewlinesForHref,shouldKeepComment:e.comments,outputSourceRange:e.outputSourceRange,start:function(t,o,a,u,h){var d=i&&i.ns||Vo(t);X&&"svg"===d&&(o=function(t){for(var e=[],n=0;nl&&(s.push(o=t.slice(l,r)),a.push(JSON.stringify(o)));var c=Ti(i[1].trim());a.push("_s("+c+")"),s.push({"@binding":c}),l=r+i[0].length}return l':'
',Wa.innerHTML.indexOf(" ")>0}var Ja=!!q&&Ya(!1),Qa=!!q&&Ya(!0),ts=x((function(t){var e=Xn(t);return e&&e.innerHTML})),es=wn.prototype.$mount;return wn.prototype.$mount=function(t,e){if((t=t&&Xn(t))===document.body||t===document.documentElement)return this;var n=this.$options;if(!n.render){var i=n.template;if(i)if("string"==typeof i)"#"===i.charAt(0)&&(i=ts(i));else{if(!i.nodeType)return this;i=i.innerHTML}else t&&(i=function(t){if(t.outerHTML)return t.outerHTML;var e=document.createElement("div");return e.appendChild(t.cloneNode(!0)),e.innerHTML}(t));if(i){var r=Ka(i,{outputSourceRange:!1,shouldDecodeNewlines:Ja,shouldDecodeNewlinesForHref:Qa,delimiters:n.delimiters,comments:n.comments},this),o=r.render,a=r.staticRenderFns;n.render=o,n.staticRenderFns=a}}return es.call(this,t,e)},wn.compile=Ka,wn},"object"==typeof n&&void 0!==e?e.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:{},t("timers").setImmediate)},{timers:10}],17:[function(t,e,n){(function(t,n){(function(){ /*! * Vue.js v2.6.14 * (c) 2014-2021 Evan You * Released under the MIT License. */ "use strict";var i=Object.freeze({});function r(t){return null==t}function o(t){return null!=t}function a(t){return!0===t}function s(t){return"string"==typeof t||"number"==typeof t||"symbol"==typeof t||"boolean"==typeof t}function l(t){return null!==t&&"object"==typeof t}var c=Object.prototype.toString;function u(t){return c.call(t).slice(8,-1)}function h(t){return"[object Object]"===c.call(t)}function d(t){return"[object RegExp]"===c.call(t)}function p(t){var e=parseFloat(String(t));return e>=0&&Math.floor(e)===e&&isFinite(t)}function f(t){return o(t)&&"function"==typeof t.then&&"function"==typeof t.catch}function m(t){return null==t?"":Array.isArray(t)||h(t)&&t.toString===c?JSON.stringify(t,null,2):String(t)}function g(t){var e=parseFloat(t);return isNaN(e)?t:e}function _(t,e){for(var n=Object.create(null),i=t.split(","),r=0;r-1)return t.splice(n,1)}}var b=Object.prototype.hasOwnProperty;function w(t,e){return b.call(t,e)}function T(t){var e=Object.create(null);return function(n){return e[n]||(e[n]=t(n))}}var C=/-(\w)/g,E=T((function(t){return t.replace(C,(function(t,e){return e?e.toUpperCase():""}))})),S=T((function(t){return t.charAt(0).toUpperCase()+t.slice(1)})),A=/\B([A-Z])/g,k=T((function(t){return t.replace(A,"-$1").toLowerCase()}));var I=Function.prototype.bind?function(t,e){return t.bind(e)}:function(t,e){function n(n){var i=arguments.length;return i?i>1?t.apply(e,arguments):t.call(e,n):t.call(e)}return n._length=t.length,n};function M(t,e){e=e||0;for(var n=t.length-e,i=new Array(n);n--;)i[n]=t[n+e];return i}function P(t,e){for(var n in e)t[n]=e[n];return t}function D(t){for(var e={},n=0;n0,et=J&&J.indexOf("edge/")>0,nt=(J&&J.indexOf("android"),J&&/iphone|ipad|ipod|ios/.test(J)||"ios"===Y),it=(J&&/chrome\/\d+/.test(J),J&&/phantomjs/.test(J),J&&J.match(/firefox\/(\d+)/)),rt={}.watch,ot=!1;if(X)try{var at={};Object.defineProperty(at,"passive",{get:function(){ot=!0}}),window.addEventListener("test-passive",null,at)}catch(t){}var st=function(){return void 0===H&&(H=!X&&!K&&void 0!==t&&(t.process&&"server"===t.process.env.VUE_ENV)),H},lt=X&&window.__VUE_DEVTOOLS_GLOBAL_HOOK__;function ct(t){return"function"==typeof t&&/native code/.test(t.toString())}var ut,ht="undefined"!=typeof Symbol&&ct(Symbol)&&"undefined"!=typeof Reflect&&ct(Reflect.ownKeys);ut="undefined"!=typeof Set&&ct(Set)?Set:function(){function t(){this.set=Object.create(null)}return t.prototype.has=function(t){return!0===this.set[t]},t.prototype.add=function(t){this.set[t]=!0},t.prototype.clear=function(){this.set=Object.create(null)},t}();var dt,pt,ft,mt=z,gt="undefined"!=typeof console,_t=/(?:^|[-_])(\w)/g;dt=function(t,e){var n=e?mt(e):"";U.warnHandler?U.warnHandler.call(null,t,e,n):gt&&U.silent},pt=function(t,e){gt&&U.silent},ft=function(t,e){if(t.$root===t)return"";var n="function"==typeof t&&null!=t.cid?t.options:t._isVue?t.$options||t.constructor.options:t,i=n.name||n._componentTag,r=n.__file;if(!i&&r){var o=r.match(/([^/\\]+)\.vue$/);i=o&&o[1]}return(i?"<"+(i.replace(_t,(function(t){return t.toUpperCase()})).replace(/[-_]/g,"")+">"):"")+(r&&!1!==e?" at "+r:"")};mt=function(t){if(t._isVue&&t.$parent){for(var e=[],n=0;t;){if(e.length>0){var i=e[e.length-1];if(i.constructor===t.constructor){n++,t=t.$parent;continue}n>0&&(e[e.length-1]=[i,n],n=0)}e.push(t),t=t.$parent}return"\n\nfound in\n\n"+e.map((function(t,e){return""+(0===e?"---\x3e ":function(t,e){for(var n="";e;)e%2==1&&(n+=t),e>1&&(t+=t),e>>=1;return n}(" ",5+2*e))+(Array.isArray(t)?ft(t[0])+"... ("+t[1]+" recursive calls)":ft(t))})).join("\n")}return"\n\n(found in "+ft(t)+")"};var vt=0,yt=function(){this.id=vt++,this.subs=[]};yt.prototype.addSub=function(t){this.subs.push(t)},yt.prototype.removeSub=function(t){x(this.subs,t)},yt.prototype.depend=function(){yt.target&&yt.target.addDep(this)},yt.prototype.notify=function(){var t=this.subs.slice();U.async||t.sort((function(t,e){return t.id-e.id}));for(var e=0,n=t.length;e-1)if(o&&!w(r,"default"))a=!1;else if(""===a||a===k(t)){var c=ee(String,r.type);(c<0||s0&&(Be((i=Ne(i,(e||"")+"_"+n))[0])&&Be(c)&&(u[l]=St(c.text+i[0].text),i.shift()),u.push.apply(u,i)):s(i)?Be(c)?u[l]=St(c.text+i):""!==i&&u.push(St(i)):Be(i)&&Be(c)?u[l]=St(c.text+i.text):(a(t._isVList)&&o(i.tag)&&r(i.key)&&o(e)&&(i.key="__vlist"+e+"_"+n+"__"),u.push(i)));return u}function je(t,e){if(t){for(var n=Object.create(null),i=ht?Reflect.ownKeys(t):Object.keys(t),r=0;r0,a=t?!!t.$stable:!o,s=t&&t.$key;if(t){if(t._normalized)return t._normalized;if(a&&n&&n!==i&&s===n.$key&&!o&&!n.$hasNormal)return n;for(var l in r={},t)t[l]&&"$"!==l[0]&&(r[l]=Ze(e,l,t[l]))}else r={};for(var c in e)c in r||(r[c]=He(e,c));return t&&Object.isExtensible(t)&&(t._normalized=r),q(r,"$stable",a),q(r,"$key",s),q(r,"$hasNormal",o),r}function Ze(t,e,n){var i=function(){var t=arguments.length?n.apply(null,arguments):n({}),e=(t=t&&"object"==typeof t&&!Array.isArray(t)?[t]:$e(t))&&t[0];return t&&(!e||1===t.length&&e.isComment&&!Ge(e))?void 0:t};return n.proxy&&Object.defineProperty(t,e,{get:i,enumerable:!0,configurable:!0}),i}function He(t,e){return function(){return t[e]}}function We(t,e){var n,i,r,a,s;if(Array.isArray(t)||"string"==typeof t)for(n=new Array(t.length),i=0,r=t.length;i.",t),a=new Tt(U.parsePlatformTagName(e),n,i,void 0,void 0,t)):a=n&&n.pre||!o(u=Wt(t.$options,"components",e))?new Tt(e,n,i,void 0,void 0,t):mn(u,n,t,i,e)}else a=mn(e,n,t,i);return Array.isArray(a)?a:o(a)?(o(c)&&vn(a,c),o(n)&&function(t){l(t.style)&&Me(t.style);l(t.class)&&Me(t.class)}(n),a):Et()}(t,e,n,i,r)}function vn(t,e,n){if(t.ns=e,"foreignObject"===t.tag&&(e=void 0,n=!0),o(t.children))for(var i=0,s=t.children.length;idocument.createEvent("Event").timeStamp&&(Un=function(){return Vn.now()})}function Gn(){var t,e;for(jn=Un(),Bn=!0,On.sort((function(t,e){return t.id-e.id})),Nn=0;Nn100)){dt("You may have an infinite update loop "+(t.user?'in watcher with expression "'+t.expression+'"':"in a component render function."),t.vm);break}var n=Rn.slice(),i=On.slice();Nn=On.length=Rn.length=0,Ln={},Fn={},$n=Bn=!1,function(t){for(var e=0;eNn&&On[n].id>t.id;)n--;On.splice(n+1,0,t)}else On.push(t);if(!$n){if($n=!0,!U.async)return void Gn();ye(Gn)}}}(this)},Zn.prototype.run=function(){if(this.active){var t=this.get();if(t!==this.value||l(t)||this.deep){var e=this.value;if(this.value=t,this.user){var n='callback for watcher "'+this.expression+'"';ae(this.cb,this.vm,[t,e],this.vm,n)}else this.cb.call(this.vm,t,e)}}},Zn.prototype.evaluate=function(){this.value=this.get(),this.dirty=!1},Zn.prototype.depend=function(){for(var t=this.deps.length;t--;)this.deps[t].depend()},Zn.prototype.teardown=function(){if(this.active){this.vm._isBeingDestroyed||x(this.vm._watchers,this);for(var t=this.deps.length;t--;)this.deps[t].removeSub(this);this.active=!1}};var Hn={enumerable:!0,configurable:!0,get:z,set:z};function Wn(t,e,n){Hn.get=function(){return this[e][n]},Hn.set=function(t){this[e][n]=t},Object.defineProperty(t,n,Hn)}function Xn(t){t._watchers=[];var e=t.$options;e.props&&function(t,e){var n=t.$options.propsData||{},i=t._props={},r=t.$options._propKeys=[],o=!t.$parent;o||Dt(!1);var a=function(a){r.push(a);var s=Xt(a,e,n,t),l=k(a);(y(l)||U.isReservedAttr(l))&&dt('"'+l+'" is a reserved attribute and cannot be used as component prop.',t),Rt(i,a,s,(function(){o||kn||dt("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+'"',t)})),a in t||Wn(t,"_props",a)};for(var s in e)a(s);Dt(!0)}(t,e.props),e.methods&&function(t,e){var n=t.$options.props;for(var i in e)"function"!=typeof e[i]&&dt('Method "'+i+'" has type "'+typeof e[i]+'" in the component definition. Did you reference the function correctly?',t),n&&w(n,i)&&dt('Method "'+i+'" has already been defined as a prop.',t),i in t&&G(i)&&dt('Method "'+i+'" conflicts with an existing Vue instance method. Avoid defining component methods that start with _ or $.'),t[i]="function"!=typeof e[i]?z:I(e[i],t)}(t,e.methods),e.data?function(t){var e=t.$options.data;h(e=t._data="function"==typeof e?function(t,e){bt();try{return t.call(e,e)}catch(t){return oe(t,e,"data()"),{}}finally{wt()}}(e,t):e||{})||(e={},dt("data functions should return an object:\nhttps://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function",t));var n=Object.keys(e),i=t.$options.props,r=t.$options.methods,o=n.length;for(;o--;){var a=n[o];r&&w(r,a)&&dt('Method "'+a+'" has already been defined as a data property.',t),i&&w(i,a)?dt('The data property "'+a+'" is already declared as a prop. Use prop default value instead.',t):G(a)||Wn(t,"_data",a)}Ot(e,!0)}(t):Ot(t._data={},!0),e.computed&&function(t,e){var n=t._computedWatchers=Object.create(null),i=st();for(var r in e){var o=e[r],a="function"==typeof o?o:o.get;null==a&&dt('Getter is missing for computed property "'+r+'".',t),i||(n[r]=new Zn(t,a||z,z,Kn)),r in t?r in t.$data?dt('The computed property "'+r+'" is already defined in data.',t):t.$options.props&&r in t.$options.props?dt('The computed property "'+r+'" is already defined as a prop.',t):t.$options.methods&&r in t.$options.methods&&dt('The computed property "'+r+'" is already defined as a method.',t):Yn(t,r,o)}}(t,e.computed),e.watch&&e.watch!==rt&&function(t,e){for(var n in e){var i=e[n];if(Array.isArray(i))for(var r=0;r-1:"string"==typeof t?t.split(",").indexOf(e)>-1:!!d(t)&&t.test(e)}function si(t,e){var n=t.cache,i=t.keys,r=t._vnode;for(var o in n){var a=n[o];if(a){var s=a.name;s&&!e(s)&&li(n,o,i,r)}}}function li(t,e,n,i){var r=t[e];!r||i&&r.tag===i.tag||r.componentInstance.$destroy(),t[e]=null,x(n,e)}!function(t){t.prototype._init=function(t){var e,n,r=this;r._uid=ei++,U.performance&&Ae&&(e="vue-perf-start:"+r._uid,n="vue-perf-end:"+r._uid,Ae(e)),r._isVue=!0,t&&t._isComponent?function(t,e){var n=t.$options=Object.create(t.constructor.options),i=e._parentVnode;n.parent=e.parent,n._parentVnode=i;var r=i.componentOptions;n.propsData=r.propsData,n._parentListeners=r.listeners,n._renderChildren=r.children,n._componentTag=r.tag,e.render&&(n.render=e.render,n.staticRenderFns=e.staticRenderFns)}(r,t):r.$options=Ht(ni(r.constructor),t||{},r),ue(r),r._self=r,function(t){var e=t.$options,n=e.parent;if(n&&!e.abstract){for(;n.$options.abstract&&n.$parent;)n=n.$parent;n.$children.push(t)}t.$parent=n,t.$root=n?n.$root:t,t.$children=[],t.$refs={},t._watcher=null,t._inactive=null,t._directInactive=!1,t._isMounted=!1,t._isDestroyed=!1,t._isBeingDestroyed=!1}(r),function(t){t._events=Object.create(null),t._hasHookEvent=!1;var e=t.$options._parentListeners;e&&Sn(t,e)}(r),function(t){t._vnode=null,t._staticTrees=null;var e=t.$options,n=t.$vnode=e._parentVnode,r=n&&n.context;t.$slots=Ue(e._renderChildren,r),t.$scopedSlots=i,t._c=function(e,n,i,r){return _n(t,e,n,i,r,!1)},t.$createElement=function(e,n,i,r){return _n(t,e,n,i,r,!0)};var o=n&&n.data;Rt(t,"$attrs",o&&o.attrs||i,(function(){!kn&&dt("$attrs is readonly.",t)}),!0),Rt(t,"$listeners",e._parentListeners||i,(function(){!kn&&dt("$listeners is readonly.",t)}),!0)}(r),zn(r,"beforeCreate"),function(t){var e=je(t.$options.inject,t);e&&(Dt(!1),Object.keys(e).forEach((function(n){Rt(t,n,e[n],(function(){dt('Avoid mutating an injected value directly since the changes will be overwritten whenever the provided component re-renders. injection being mutated: "'+n+'"',t)}))})),Dt(!0))}(r),Xn(r),function(t){var e=t.$options.provide;e&&(t._provided="function"==typeof e?e.call(t):e)}(r),zn(r,"created"),U.performance&&Ae&&(r._name=ft(r,!1),Ae(n),ke("vue "+r._name+" init",e,n)),r.$options.el&&r.$mount(r.$options.el)}}(ii),function(t){var e={get:function(){return this._data}},n={get:function(){return this._props}};e.set=function(){dt("Avoid replacing instance root $data. Use nested data properties instead.",this)},n.set=function(){dt("$props is readonly.",this)},Object.defineProperty(t.prototype,"$data",e),Object.defineProperty(t.prototype,"$props",n),t.prototype.$set=Lt,t.prototype.$delete=Ft,t.prototype.$watch=function(t,e,n){var i=this;if(h(e))return ti(i,t,e,n);(n=n||{}).user=!0;var r=new Zn(i,t,e,n);if(n.immediate){var o='callback for immediate watcher "'+r.expression+'"';bt(),ae(e,i,[r.value],i,o),wt()}return function(){r.teardown()}}}(ii),function(t){var e=/^hook:/;t.prototype.$on=function(t,n){var i=this;if(Array.isArray(t))for(var r=0,o=t.length;r1?M(i):i;for(var r=M(arguments,1),o='event handler for "'+t+'"',a=0,s=i.length;aparseInt(this.max)&&li(e,n[0],n,this._vnode),this.vnodeToCache=null}}},created:function(){this.cache=Object.create(null),this.keys=[]},destroyed:function(){for(var t in this.cache)li(this.cache,t,this.keys)},mounted:function(){var t=this;this.cacheVNode(),this.$watch("include",(function(e){si(t,(function(t){return ai(e,t)}))})),this.$watch("exclude",(function(e){si(t,(function(t){return!ai(e,t)}))}))},updated:function(){this.cacheVNode()},render:function(){var t=this.$slots.default,e=wn(t),n=e&&e.componentOptions;if(n){var i=oi(n),r=this.include,o=this.exclude;if(r&&(!i||!ai(r,i))||o&&i&&ai(o,i))return e;var a=this.cache,s=this.keys,l=null==e.key?n.Ctor.cid+(n.tag?"::"+n.tag:""):e.key;a[l]?(e.componentInstance=a[l].componentInstance,x(s,l),s.push(l)):(this.vnodeToCache=e,this.keyToCache=l),e.data.keepAlive=!0}return e||t&&t[0]}}};!function(t){var e={get:function(){return U},set:function(){dt("Do not replace the Vue.config object, set individual fields instead.")}};Object.defineProperty(t,"config",e),t.util={warn:dt,extend:P,mergeOptions:Ht,defineReactive:Rt},t.set=Lt,t.delete=Ft,t.nextTick=ye,t.observable=function(t){return Ot(t),t},t.options=Object.create(null),N.forEach((function(e){t.options[e+"s"]=Object.create(null)})),t.options._base=t,P(t.options.components,ui),function(t){t.use=function(t){var e=this._installedPlugins||(this._installedPlugins=[]);if(e.indexOf(t)>-1)return this;var n=M(arguments,1);return n.unshift(this),"function"==typeof t.install?t.install.apply(t,n):"function"==typeof t&&t.apply(null,n),e.push(t),this}}(t),function(t){t.mixin=function(t){return this.options=Ht(this.options,t),this}}(t),ri(t),function(t){N.forEach((function(e){t[e]=function(t,n){return n?("component"===e&&qt(t),"component"===e&&h(n)&&(n.name=n.name||t,n=this.options._base.extend(n)),"directive"===e&&"function"==typeof n&&(n={bind:n,update:n}),this.options[e+"s"][t]=n,n):this.options[e+"s"][t]}}))}(t)}(ii),Object.defineProperty(ii.prototype,"$isServer",{get:st}),Object.defineProperty(ii.prototype,"$ssrContext",{get:function(){return this.$vnode&&this.$vnode.ssrContext}}),Object.defineProperty(ii,"FunctionalRenderContext",{value:un}),ii.version="2.6.14";var hi=_("style,class"),di=_("input,textarea,option,select,progress"),pi=_("contenteditable,draggable,spellcheck"),fi=_("events,caret,typing,plaintext-only"),mi=_("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,truespeed,typemustmatch,visible"),gi="http://www.w3.org/1999/xlink",_i=function(t){return":"===t.charAt(5)&&"xlink"===t.slice(0,5)},vi=function(t){return _i(t)?t.slice(6,t.length):""},yi=function(t){return null==t||!1===t};function xi(t){for(var e=t.data,n=t,i=t;o(i.componentInstance);)(i=i.componentInstance._vnode)&&i.data&&(e=bi(i.data,e));for(;o(n=n.parent);)n&&n.data&&(e=bi(e,n.data));return function(t,e){if(o(t)||o(e))return wi(t,Ti(e));return""}(e.staticClass,e.class)}function bi(t,e){return{staticClass:wi(t.staticClass,e.staticClass),class:o(t.class)?[t.class,e.class]:e.class}}function wi(t,e){return t?e?t+" "+e:t:e||""}function Ti(t){return Array.isArray(t)?function(t){for(var e,n="",i=0,r=t.length;i-1?Zi(t,e,n):mi(e)?yi(n)?t.removeAttribute(e):(n="allowfullscreen"===e&&"EMBED"===t.tagName?"true":e,t.setAttribute(e,n)):pi(e)?t.setAttribute(e,function(t,e){return yi(e)||"false"===e?"false":"contenteditable"===t&&fi(e)?e:"true"}(e,n)):_i(e)?yi(n)?t.removeAttributeNS(gi,vi(e)):t.setAttributeNS(gi,e,n):Zi(t,e,n)}function Zi(t,e,n){if(yi(n))t.removeAttribute(e);else{if(Q&&!tt&&"TEXTAREA"===t.tagName&&"placeholder"===e&&""!==n&&!t.__ieph){var i=function(e){e.stopImmediatePropagation(),t.removeEventListener("input",i)};t.addEventListener("input",i),t.__ieph=!0}t.setAttribute(e,n)}}var Hi={create:Gi,update:Gi};function Wi(t,e){var n=e.elm,i=e.data,a=t.data;if(!(r(i.staticClass)&&r(i.class)&&(r(a)||r(a.staticClass)&&r(a.class)))){var s=xi(e),l=n._transitionClasses;o(l)&&(s=wi(s,Ti(l))),s!==n._prevClass&&(n.setAttribute("class",s),n._prevClass=s)}}var Xi,Ki={create:Wi,update:Wi};function Yi(t,e,n){var i=Xi;return function r(){var o=e.apply(null,arguments);null!==o&&tr(t,r,n,i)}}var Ji=he&&!(it&&Number(it[1])<=53);function Qi(t,e,n,i){if(Ji){var r=jn,o=e;e=o._wrapper=function(t){if(t.target===t.currentTarget||t.timeStamp>=r||t.timeStamp<=0||t.target.ownerDocument!==document)return o.apply(this,arguments)}}Xi.addEventListener(t,e,ot?{capture:n,passive:i}:n)}function tr(t,e,n,i){(i||Xi).removeEventListener(t,e._wrapper||e,n)}function er(t,e){if(!r(t.data.on)||!r(e.data.on)){var n=e.data.on||{},i=t.data.on||{};Xi=e.elm,function(t){if(o(t.__r)){var e=Q?"change":"input";t[e]=[].concat(t.__r,t[e]||[]),delete t.__r}o(t.__c)&&(t.change=[].concat(t.__c,t.change||[]),delete t.__c)}(n),Re(n,i,Qi,tr,Yi,e.context),Xi=void 0}}var nr,ir={create:er,update:er};function rr(t,e){if(!r(t.data.domProps)||!r(e.data.domProps)){var n,i,a=e.elm,s=t.data.domProps||{},l=e.data.domProps||{};for(n in o(l.__ob__)&&(l=e.data.domProps=P({},l)),s)n in l||(a[n]="");for(n in l){if(i=l[n],"textContent"===n||"innerHTML"===n){if(e.children&&(e.children.length=0),i===s[n])continue;1===a.childNodes.length&&a.removeChild(a.childNodes[0])}if("value"===n&&"PROGRESS"!==a.tagName){a._value=i;var c=r(i)?"":String(i);or(a,c)&&(a.value=c)}else if("innerHTML"===n&&Si(a.tagName)&&r(a.innerHTML)){(nr=nr||document.createElement("div")).innerHTML=""+i+"";for(var u=nr.firstChild;a.firstChild;)a.removeChild(a.firstChild);for(;u.firstChild;)a.appendChild(u.firstChild)}else if(i!==s[n])try{a[n]=i}catch(t){}}}}function or(t,e){return!t.composing&&("OPTION"===t.tagName||function(t,e){var n=!0;try{n=document.activeElement!==t}catch(t){}return n&&t.value!==e}(t,e)||function(t,e){var n=t.value,i=t._vModifiers;if(o(i)){if(i.number)return g(n)!==g(e);if(i.trim)return n.trim()!==e.trim()}return n!==e}(t,e))}var ar={create:rr,update:rr},sr=T((function(t){var e={},n=/:(.+)/;return t.split(/;(?![^(]*\))/g).forEach((function(t){if(t){var i=t.split(n);i.length>1&&(e[i[0].trim()]=i[1].trim())}})),e}));function lr(t){var e=cr(t.style);return t.staticStyle?P(t.staticStyle,e):e}function cr(t){return Array.isArray(t)?D(t):"string"==typeof t?sr(t):t}var ur,hr=/^--/,dr=/\s*!important$/,pr=function(t,e,n){if(hr.test(e))t.style.setProperty(e,n);else if(dr.test(n))t.style.setProperty(k(e),n.replace(dr,""),"important");else{var i=mr(e);if(Array.isArray(n))for(var r=0,o=n.length;r-1?e.split(vr).forEach((function(e){return t.classList.add(e)})):t.classList.add(e);else{var n=" "+(t.getAttribute("class")||"")+" ";n.indexOf(" "+e+" ")<0&&t.setAttribute("class",(n+e).trim())}}function xr(t,e){if(e&&(e=e.trim()))if(t.classList)e.indexOf(" ")>-1?e.split(vr).forEach((function(e){return t.classList.remove(e)})):t.classList.remove(e),t.classList.length||t.removeAttribute("class");else{for(var n=" "+(t.getAttribute("class")||"")+" ",i=" "+e+" ";n.indexOf(i)>=0;)n=n.replace(i," ");(n=n.trim())?t.setAttribute("class",n):t.removeAttribute("class")}}function br(t){if(t){if("object"==typeof t){var e={};return!1!==t.css&&P(e,wr(t.name||"v")),P(e,t),e}return"string"==typeof t?wr(t):void 0}}var wr=T((function(t){return{enterClass:t+"-enter",enterToClass:t+"-enter-to",enterActiveClass:t+"-enter-active",leaveClass:t+"-leave",leaveToClass:t+"-leave-to",leaveActiveClass:t+"-leave-active"}})),Tr=X&&!tt,Cr="transition",Er="animation",Sr="transition",Ar="transitionend",kr="animation",Ir="animationend";Tr&&(void 0===window.ontransitionend&&void 0!==window.onwebkittransitionend&&(Sr="WebkitTransition",Ar="webkitTransitionEnd"),void 0===window.onanimationend&&void 0!==window.onwebkitanimationend&&(kr="WebkitAnimation",Ir="webkitAnimationEnd"));var Mr=X?window.requestAnimationFrame?window.requestAnimationFrame.bind(window):setTimeout:function(t){return t()};function Pr(t){Mr((function(){Mr(t)}))}function Dr(t,e){var n=t._transitionClasses||(t._transitionClasses=[]);n.indexOf(e)<0&&(n.push(e),yr(t,e))}function zr(t,e){t._transitionClasses&&x(t._transitionClasses,e),xr(t,e)}function Or(t,e,n){var i=Lr(t,e),r=i.type,o=i.timeout,a=i.propCount;if(!r)return n();var s=r===Cr?Ar:Ir,l=0,c=function(){t.removeEventListener(s,u),n()},u=function(e){e.target===t&&++l>=a&&c()};setTimeout((function(){l0&&(n=Cr,u=a,h=o.length):e===Er?c>0&&(n=Er,u=c,h=l.length):h=(n=(u=Math.max(a,c))>0?a>c?Cr:Er:null)?n===Cr?o.length:l.length:0,{type:n,timeout:u,propCount:h,hasTransform:n===Cr&&Rr.test(i[Sr+"Property"])}}function Fr(t,e){for(;t.length explicit "+e+" duration is not a valid number - got "+JSON.stringify(t)+".",n.context):isNaN(t)&&dt(" explicit "+e+" duration is NaN - the duration expression might be incorrect.",n.context)}function Ur(t){return"number"==typeof t&&!isNaN(t)}function Vr(t){if(r(t))return!1;var e=t.fns;return o(e)?Vr(Array.isArray(e)?e[0]:e):(t._length||t.length)>1}function Gr(t,e){!0!==e.data.show&&Br(e)}var qr=function(t){var e,n,i={},l=t.modules,c=t.nodeOps;for(e=0;e - did you register the component correctly? For recursive components, make sure to provide the "name" option.',t.context),t.elm=t.ns?c.createElementNS(t.ns,_):c.createElement(_,t),b(t),v(t,f,e),o(d)&&x(t,e),g(n,t.elm,r),d&&d.pre&&p--):a(t.isComment)?(t.elm=c.createComment(t.text),g(n,t.elm,r)):(t.elm=c.createTextNode(t.text),g(n,t.elm,r))}}function m(t,e){o(t.data.pendingInsert)&&(e.push.apply(e,t.data.pendingInsert),t.data.pendingInsert=null),t.elm=t.componentInstance.$el,y(t)?(x(t,e),b(t)):(Di(t),e.push(t))}function g(t,e,n){o(t)&&(o(n)?c.parentNode(n)===t&&c.insertBefore(t,e,n):c.appendChild(t,e))}function v(t,e,n){if(Array.isArray(e)){S(e);for(var i=0;ip?w(t,r(n[_+1])?null:n[_+1].elm,n,d,_,i):d>_&&C(e,h,p)}(h,m,g,n,u):o(g)?(S(g),o(t.text)&&c.setTextContent(h,""),w(h,null,g,0,g.length-1,n)):o(m)?C(m,0,m.length-1):o(t.text)&&c.setTextContent(h,""):t.text!==e.text&&c.setTextContent(h,e.text),o(p)&&o(d=p.hook)&&o(d=d.postpatch)&&d(t,e)}}}function I(t,e,n){if(a(n)&&o(t.parent))t.parent.data.pendingInsert=e;else for(var i=0;i, or missing . Bailing hydration and performing full client-side render.")}l=t,t=new Tt(c.tagName(l).toLowerCase(),{},[],void 0,l)}var p=t.elm,m=c.parentNode(p);if(f(e,h,p._leaveCb?null:m,c.nextSibling(p)),o(e.parent))for(var g=e.parent,_=y(e);g;){for(var v=0;v-1,a.selected!==o&&(a.selected=o);else if(L(Kr(a),i))return void(t.selectedIndex!==s&&(t.selectedIndex=s));r||(t.selectedIndex=-1)}else dt('