/*! For license information please see vendors.98288b227c064e6a107f.js.LICENSE.txt */ (self.webpackChunkarchitectui_html_pro=self.webpackChunkarchitectui_html_pro||[]).push([[96],{119:function(e,t,i){!function(e){"use strict";var t={1:"۱",2:"۲",3:"۳",4:"۴",5:"۵",6:"۶",7:"۷",8:"۸",9:"۹",0:"۰"},i={"۱":"1","۲":"2","۳":"3","۴":"4","۵":"5","۶":"6","۷":"7","۸":"8","۹":"9","۰":"0"};e.defineLocale("fa",{months:"ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر".split("_"),monthsShort:"ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر".split("_"),weekdays:"یک‌شنبه_دوشنبه_سه‌شنبه_چهارشنبه_پنج‌شنبه_جمعه_شنبه".split("_"),weekdaysShort:"یک‌شنبه_دوشنبه_سه‌شنبه_چهارشنبه_پنج‌شنبه_جمعه_شنبه".split("_"),weekdaysMin:"ی_د_س_چ_پ_ج_ش".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},meridiemParse:/قبل از ظهر|بعد از ظهر/,isPM:function(e){return/بعد از ظهر/.test(e)},meridiem:function(e,t,i){return e<12?"قبل از ظهر":"بعد از ظهر"},calendar:{sameDay:"[امروز ساعت] LT",nextDay:"[فردا ساعت] LT",nextWeek:"dddd [ساعت] LT",lastDay:"[دیروز ساعت] LT",lastWeek:"dddd [پیش] [ساعت] LT",sameElse:"L"},relativeTime:{future:"در %s",past:"%s پیش",s:"چند ثانیه",ss:"%d ثانیه",m:"یک دقیقه",mm:"%d دقیقه",h:"یک ساعت",hh:"%d ساعت",d:"یک روز",dd:"%d روز",M:"یک ماه",MM:"%d ماه",y:"یک سال",yy:"%d سال"},preparse:function(e){return e.replace(/[۰-۹]/g,function(e){return i[e]}).replace(/،/g,",")},postformat:function(e){return e.replace(/\d/g,function(e){return t[e]}).replace(/,/g,"،")},dayOfMonthOrdinalParse:/\d{1,2}م/,ordinal:"%dم",week:{dow:6,doy:12}})}(i(5093))},134:(e,t,i)=>{"use strict";if(i.d(t,{A:()=>r}),/^(7(06|92|96)|140)$/.test(i.j))var n=i(271);function r(e){var t=(0,n.A)(e),i=t.overflow,r=t.overflowX,s=t.overflowY;return/auto|scroll|overlay|hidden/.test(i+s+r)}},158:function(e,t,i){!function(e){"use strict";var t=["جنوری","فروری","مارچ","اپریل","مئی","جون","جولائی","اگست","ستمبر","اکتوبر","نومبر","دسمبر"],i=["اتوار","پیر","منگل","بدھ","جمعرات","جمعہ","ہفتہ"];e.defineLocale("ur",{months:t,monthsShort:t,weekdays:i,weekdaysShort:i,weekdaysMin:i,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd، D MMMM YYYY HH:mm"},meridiemParse:/صبح|شام/,isPM:function(e){return"شام"===e},meridiem:function(e,t,i){return e<12?"صبح":"شام"},calendar:{sameDay:"[آج بوقت] LT",nextDay:"[کل بوقت] LT",nextWeek:"dddd [بوقت] LT",lastDay:"[گذشتہ روز بوقت] LT",lastWeek:"[گذشتہ] dddd [بوقت] LT",sameElse:"L"},relativeTime:{future:"%s بعد",past:"%s قبل",s:"چند سیکنڈ",ss:"%d سیکنڈ",m:"ایک منٹ",mm:"%d منٹ",h:"ایک گھنٹہ",hh:"%d گھنٹے",d:"ایک دن",dd:"%d دن",M:"ایک ماہ",MM:"%d ماہ",y:"ایک سال",yy:"%d سال"},preparse:function(e){return e.replace(/،/g,",")},postformat:function(e){return e.replace(/,/g,"،")},week:{dow:1,doy:4}})}(i(5093))},172:(e,t,i)=>{"use strict";i.d(t,{FK:()=>x,Ob:()=>W,Qv:()=>V,XX:()=>j,_3:()=>v,fF:()=>r,n:()=>_,q6:()=>U,uA:()=>k,v2:()=>P,zO:()=>o});var n,r,s,o,a,l,c,h,d,u={},f=[],p=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function m(e,t){for(var i in t)e[i]=t[i];return e}function g(e){var t=e.parentNode;t&&t.removeChild(e)}function _(e,t,i){var r,s,o,a={};for(o in t)"key"==o?r=t[o]:"ref"==o?s=t[o]:a[o]=t[o];if(arguments.length>2&&(a.children=arguments.length>3?n.call(arguments,2):i),"function"==typeof e&&null!=e.defaultProps)for(o in e.defaultProps)void 0===a[o]&&(a[o]=e.defaultProps[o]);return y(e,a,r,s,null)}function y(e,t,i,n,o){var a={type:e,props:t,key:i,ref:n,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==o?++s:o};return null==o&&null!=r.vnode&&r.vnode(a),a}function v(){return{current:null}}function x(e){return e.children}function b(e,t,i){"-"===t[0]?e.setProperty(t,null==i?"":i):e[t]=null==i?"":"number"!=typeof i||p.test(t)?i:i+"px"}function w(e,t,i,n,r){var s;e:if("style"===t)if("string"==typeof i)e.style.cssText=i;else{if("string"==typeof n&&(e.style.cssText=n=""),n)for(t in n)i&&t in i||b(e.style,t,"");if(i)for(t in i)n&&i[t]===n[t]||b(e.style,t,i[t])}else if("o"===t[0]&&"n"===t[1])s=t!==(t=t.replace(/Capture$/,"")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+s]=i,i?n||e.addEventListener(t,s?T:S,s):e.removeEventListener(t,s?T:S,s);else if("dangerouslySetInnerHTML"!==t){if(r)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!==t&&"height"!==t&&"href"!==t&&"list"!==t&&"form"!==t&&"tabIndex"!==t&&"download"!==t&&t in e)try{e[t]=null==i?"":i;break e}catch(e){}"function"==typeof i||(null==i||!1===i&&-1==t.indexOf("-")?e.removeAttribute(t):e.setAttribute(t,i))}}function S(e){a=!0;try{return this.l[e.type+!1](r.event?r.event(e):e)}finally{a=!1}}function T(e){a=!0;try{return this.l[e.type+!0](r.event?r.event(e):e)}finally{a=!1}}function k(e,t){this.props=e,this.context=t}function M(e,t){if(null==t)return e.__?M(e.__,e.__.__k.indexOf(e)+1):null;for(var i;tt&&l.sort(function(e,t){return e.__v.__b-t.__v.__b}));L.__r=0}function E(e,t,i,n,r,s,o,a,l,c){var h,d,p,m,g,_,v,b=n&&n.__k||f,w=b.length;for(i.__k=[],h=0;h0?y(m.type,m.props,m.key,m.ref?m.ref:null,m.__v):m)){if(m.__=i,m.__b=i.__b+1,null===(p=b[h])||p&&m.key==p.key&&m.type===p.type)b[h]=void 0;else for(d=0;d=0;t--)if((i=e.__k[t])&&(n=O(i)))return n;return null}function z(e,t,i,n,s,o,a,l,c){var h,d,u,f,p,g,_,y,v,b,w,S,T,M,A,C=t.type;if(void 0!==t.constructor)return null;null!=i.__h&&(c=i.__h,l=t.__e=i.__e,t.__h=null,o=[l]),(h=r.__b)&&h(t);try{e:if("function"==typeof C){if(y=t.props,v=(h=C.contextType)&&n[h.__c],b=h?v?v.props.value:h.__:n,i.__c?_=(d=t.__c=i.__c).__=d.__E:("prototype"in C&&C.prototype.render?t.__c=d=new C(y,b):(t.__c=d=new k(y,b),d.constructor=C,d.render=H),v&&v.sub(d),d.props=y,d.state||(d.state={}),d.context=b,d.__n=n,u=d.__d=!0,d.__h=[],d._sb=[]),null==d.__s&&(d.__s=d.state),null!=C.getDerivedStateFromProps&&(d.__s==d.state&&(d.__s=m({},d.__s)),m(d.__s,C.getDerivedStateFromProps(y,d.__s))),f=d.props,p=d.state,d.__v=t,u)null==C.getDerivedStateFromProps&&null!=d.componentWillMount&&d.componentWillMount(),null!=d.componentDidMount&&d.__h.push(d.componentDidMount);else{if(null==C.getDerivedStateFromProps&&y!==f&&null!=d.componentWillReceiveProps&&d.componentWillReceiveProps(y,b),!d.__e&&null!=d.shouldComponentUpdate&&!1===d.shouldComponentUpdate(y,d.__s,b)||t.__v===i.__v){for(t.__v!==i.__v&&(d.props=y,d.state=d.__s,d.__d=!1),t.__e=i.__e,t.__k=i.__k,t.__k.forEach(function(e){e&&(e.__=t)}),w=0;w2&&(a.children=arguments.length>3?n.call(arguments,2):i),y(e.type,a,r||e.key,s||e.ref,null)}function U(e,t){var i={__c:t="__cC"+d++,__:e,Consumer:function(e,t){return e.children(t)},Provider:function(e){var i,n;return this.getChildContext||(i=[],(n={})[t]=this,this.getChildContext=function(){return n},this.shouldComponentUpdate=function(e){this.props.value!==e.value&&i.some(function(e){e.__e=!0,D(e)})},this.sub=function(e){i.push(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){i.splice(i.indexOf(e),1),t&&t.call(e)}}),e.children}};return i.Provider.__=i.Consumer.contextType=i}n=f.slice,r={__e:function(e,t,i,n){for(var r,s,o;t=t.__;)if((r=t.__c)&&!r.__)try{if((s=r.constructor)&&null!=s.getDerivedStateFromError&&(r.setState(s.getDerivedStateFromError(e)),o=r.__d),null!=r.componentDidCatch&&(r.componentDidCatch(e,n||{}),o=r.__d),o)return r.__E=r}catch(t){e=t}throw e}},s=0,o=function(e){return null!=e&&void 0===e.constructor},a=!1,k.prototype.setState=function(e,t){var i;i=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=m({},this.state),"function"==typeof e&&(e=e(m({},i),this.props)),e&&m(i,e),null!=e&&this.__v&&(t&&this._sb.push(t),D(this))},k.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),D(this))},k.prototype.render=x,l=[],h="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,L.__r=0,d=0},192:(e,t,i)=>{"use strict";i.d(t,{A:()=>f});var n=i(4278),r=i(2632),s=i(9703),o=i(6523),a=i(6979),l=i(5128),c=i(9913),h=i(8101),d=i(7364),u=i(6906);const f={name:"preventOverflow",enabled:!0,phase:"main",fn:function(e){var t=e.state,i=e.options,f=e.name,p=i.mainAxis,m=void 0===p||p,g=i.altAxis,_=void 0!==g&&g,y=i.boundary,v=i.rootBoundary,x=i.altBoundary,b=i.padding,w=i.tether,S=void 0===w||w,T=i.tetherOffset,k=void 0===T?0:T,M=(0,c.A)(t,{boundary:y,rootBoundary:v,padding:b,altBoundary:x}),A=(0,r.A)(t.placement),C=(0,h.A)(t.placement),D=!C,L=(0,s.A)(A),E="x"===L?"y":"x",I=t.modifiersData.popperOffsets,P=t.rects.reference,R=t.rects.popper,O="function"==typeof k?k(Object.assign({},t.rects,{placement:t.placement})):k,z="number"==typeof O?{mainAxis:O,altAxis:O}:Object.assign({mainAxis:0,altAxis:0},O),F=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,N={x:0,y:0};if(I){if(m){var Y,B="y"===L?n.Mn:n.kb,H="y"===L?n.sQ:n.pG,j="y"===L?"height":"width",V=I[L],W=V+M[B],U=V-M[H],$=S?-R[j]/2:0,G=C===n.ni?P[j]:R[j],X=C===n.ni?-R[j]:-P[j],q=t.elements.arrow,Z=S&&q?(0,a.A)(q):{width:0,height:0},J=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:(0,d.A)(),K=J[B],Q=J[H],ee=(0,o.u)(0,P[j],Z[j]),te=D?P[j]/2-$-ee-K-z.mainAxis:G-ee-K-z.mainAxis,ie=D?-P[j]/2+$+ee+Q+z.mainAxis:X+ee+Q+z.mainAxis,ne=t.elements.arrow&&(0,l.A)(t.elements.arrow),re=ne?"y"===L?ne.clientTop||0:ne.clientLeft||0:0,se=null!=(Y=null==F?void 0:F[L])?Y:0,oe=V+te-se-re,ae=V+ie-se,le=(0,o.u)(S?(0,u.jk)(W,oe):W,V,S?(0,u.T9)(U,ae):U);I[L]=le,N[L]=le-V}if(_){var ce,he="x"===L?n.Mn:n.kb,de="x"===L?n.sQ:n.pG,ue=I[E],fe="y"===E?"height":"width",pe=ue+M[he],me=ue-M[de],ge=-1!==[n.Mn,n.kb].indexOf(A),_e=null!=(ce=null==F?void 0:F[E])?ce:0,ye=ge?pe:ue-P[fe]-R[fe]-_e+z.altAxis,ve=ge?ue+P[fe]+R[fe]-_e-z.altAxis:me,xe=S&&ge?(0,o.P)(ye,ue,ve):(0,o.u)(S?ye:pe,ue,S?ve:me);I[E]=xe,N[E]=xe-ue}t.modifiersData[f]=N}},requiresIfExists:["offset"]}},217:function(e,t,i){!function(e){"use strict";e.defineLocale("gd",{months:["Am Faoilleach","An Gearran","Am Màrt","An Giblean","An Cèitean","An t-Ògmhios","An t-Iuchar","An Lùnastal","An t-Sultain","An Dàmhair","An t-Samhain","An Dùbhlachd"],monthsShort:["Faoi","Gear","Màrt","Gibl","Cèit","Ògmh","Iuch","Lùn","Sult","Dàmh","Samh","Dùbh"],monthsParseExact:!0,weekdays:["Didòmhnaich","Diluain","Dimàirt","Diciadain","Diardaoin","Dihaoine","Disathairne"],weekdaysShort:["Did","Dil","Dim","Dic","Dia","Dih","Dis"],weekdaysMin:["Dò","Lu","Mà","Ci","Ar","Ha","Sa"],longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[An-diugh aig] LT",nextDay:"[A-màireach aig] LT",nextWeek:"dddd [aig] LT",lastDay:"[An-dè aig] LT",lastWeek:"dddd [seo chaidh] [aig] LT",sameElse:"L"},relativeTime:{future:"ann an %s",past:"bho chionn %s",s:"beagan diogan",ss:"%d diogan",m:"mionaid",mm:"%d mionaidean",h:"uair",hh:"%d uairean",d:"latha",dd:"%d latha",M:"mìos",MM:"%d mìosan",y:"bliadhna",yy:"%d bliadhna"},dayOfMonthOrdinalParse:/\d{1,2}(d|na|mh)/,ordinal:function(e){return e+(1===e?"d":e%10==2?"na":"mh")},week:{dow:1,doy:4}})}(i(5093))},222:(e,t,i)=>{"use strict";if(i.d(t,{A:()=>r}),/^(7(06|92|96)|140)$/.test(i.j))var n=i(8979);function r(e){var t=(0,n.A)(e);return{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}},232:(e,t,i)=>{"use strict";var n,r,s;function o(e,t){for(var i=0;i0?this._getShowable(-1,"forward"):t)>0&&this.options.anchor.enableDoneState&&this.options.anchor.markPreviousStepsAsDone&&this.steps.slice(0,e).addClass(this.options.style.anchorDoneCss),this._showStep(e),this._triggerEvent("loaded")}},{key:"_getFirstDescendant",value:function(t){var i=this.main.children(t);return i.length>0?i:(this.main.children().each(function(n,r){var s=e(r).children(t);if(s.length>0)return i=s,!1}),i.length>0?i:(this._showError("Element not found "+t),!1))}},{key:"_getDir",value:function(){var e=this.main.prop("dir");return 0===e.length&&(e=document.documentElement.dir,this.main.prop("dir",e)),e}},{key:"_setElements",value:function(){var t=this;this.main.removeClass(function(e,i){return(i.match(new RegExp("(^|\\s)"+t.options.style.themePrefixCss+"\\S+","g"))||[]).join(" ")}).addClass(this.options.style.mainCss+" "+this.options.style.themePrefixCss+this.options.theme),this.main.toggleClass(this.options.style.justifiedCss,this.options.justified),!0===this.options.anchor.enableNavigationAlways&&!0===this.options.anchor.enableNavigation||this.steps.addClass(this.options.style.anchorDefaultCss),e.each(this.options.disabledSteps,function(e,i){t.steps.eq(i).addClass(t.options.style.anchorDisabledCss)}),e.each(this.options.errorSteps,function(e,i){t.steps.eq(i).addClass(t.options.style.anchorErrorCss)}),e.each(this.options.warningSteps,function(e,i){t.steps.eq(i).addClass(t.options.style.anchorWarningCss)}),e.each(this.options.hiddenSteps,function(e,i){t.steps.eq(i).addClass(t.options.style.anchorHiddenCss)})}},{key:"_setEvents",value:function(){var t=this;this.steps.on("click",function(i){if(i.preventDefault(),!0===t.options.anchor.enableNavigation){var n=e(i.currentTarget);t._isShowable(n)&&t._showStep(t.steps.index(n))}}),this.main.on("click",function(i){e(i.target).hasClass(t.options.style.btnNextCss)?(i.preventDefault(),t._navigate("next")):e(i.target).hasClass(t.options.style.btnPrevCss)&&(i.preventDefault(),t._navigate("prev"))}),e(document).keyup(function(e){t._keyNav(e)}),e(window).on("hashchange",function(e){if(!0===t.options.backButtonSupport){var i=t._getURLHashIndex();!1!==i&&t._isShowable(t.steps.eq(i))&&(e.preventDefault(),t._showStep(i))}}),e(window).on("resize",function(e){t._fixHeight(t.current_index)})}},{key:"_setToolbar",value:function(){this.main.find(".sw-toolbar-elm").remove();var e=this.options.toolbar.position;"none"!==e&&("both"==e?(this.container.before(this._createToolbar("top")),this.container.after(this._createToolbar("bottom"))):"top"==e?this.container.before(this._createToolbar("top")):this.container.after(this._createToolbar("bottom")))}},{key:"_createToolbar",value:function(t){var i=e("
").addClass("sw-toolbar-elm "+this.options.style.toolbarCss+" "+this.options.style.toolbarPrefixCss+t).attr("role","toolbar"),n=!1!==this.options.toolbar.showNextButton?e("").text(this.options.lang.next).addClass("btn "+this.options.style.btnNextCss+" "+this.options.style.btnCss).attr("type","button"):null,r=!1!==this.options.toolbar.showPreviousButton?e("").text(this.options.lang.previous).addClass("btn "+this.options.style.btnPrevCss+" "+this.options.style.btnCss).attr("type","button"):null;return i.append(r,n,this.options.toolbar.extraHtml)}},{key:"_navigate",value:function(e){this._showStep(this._getShowable(this.current_index,e))}},{key:"_showStep",value:function(e){var t=this;if(-1===e||null===e)return!1;if(e==this.current_index)return!1;if(!this.steps.eq(e))return!1;if(!this._isEnabled(this.steps.eq(e)))return!1;var i=this._getStepDirection(e);if(-1!==this.current_index&&!1===this._triggerEvent("leaveStep",[this._getStepAnchor(this.current_index),this.current_index,e,i]))return!1;this._loadContent(e,function(){var n=t._getStepAnchor(e);t._setURLHash(n.attr("href")),t._setAnchor(e);var r=t._getStepPage(t.current_index),s=t._getStepPage(e);t._transit(s,r,i,function(){t._fixHeight(e),t._triggerEvent("showStep",[n,e,i,t._getStepPosition(e)])}),t.current_index=e,t._setButtons(e),t._setProgressbar(e)})}},{key:"_getShowable",value:function(t,i){var n=this,r=null;return("prev"==i?e(this.steps.slice(0,t).get().reverse()):this.steps.slice(t+1)).each(function(s,o){if(n._isEnabled(e(o)))return r="prev"==i?t-(s+1):s+t+1,!1}),r}},{key:"_isShowable",value:function(e){if(!this._isEnabled(e))return!1;var t=e.hasClass(this.options.style.anchorDoneCss);return!(!1===this.options.anchor.enableDoneStateNavigation&&t||!1===this.options.anchor.enableNavigationAlways&&!t)}},{key:"_isEnabled",value:function(e){return!e.hasClass(this.options.style.anchorDisabledCss)&&!e.hasClass(this.options.style.anchorHiddenCss)}},{key:"_getStepDirection",value:function(e){return this.current_index0?this.container.finish().animate({height:i},this.options.transition.speed):this.container.css({height:i>0?i:"auto"})}}},{key:"_setAnchor",value:function(e){if(null!==this.current_index&&this.current_index>=0){var t=this.options.style.anchorActiveCss,i="";!1!==this.options.anchor.enableDoneState&&(i+=this.options.style.anchorDoneCss,!1!==this.options.anchor.unDoneOnBackNavigation&&"backward"===this._getStepDirection(e)&&(t+=" "+this.options.style.anchorDoneCss)),this.steps.eq(this.current_index).addClass(i).removeClass(t)}this.steps.eq(e).removeClass(this.options.style.anchorDoneCss).addClass(this.options.style.anchorActiveCss)}},{key:"_setButtons",value:function(e){this.main.find("."+this.options.style.btnNextCss+", ."+this.options.style.btnPrevCss).removeClass(this.options.style.anchorDisabledCss);var t=this._getStepPosition(e);if("first"===t||"last"===t){var i="first"===t?"."+this.options.style.btnPrevCss:"."+this.options.style.btnNextCss;this.main.find(i).addClass(this.options.style.anchorDisabledCss)}else null===this._getShowable(e,"next")&&this.main.find("."+this.options.style.btnNextCss).addClass(this.options.style.anchorDisabledCss),null===this._getShowable(e,"prev")&&this.main.find("."+this.options.style.btnPrevCss).addClass(this.options.style.anchorDisabledCss)}},{key:"_setProgressbar",value:function(e){var t=this.nav.width(),i=t/this.steps.length*(e+1)/t*100;document.documentElement.style.setProperty("--sw-progress-width",i+"%"),this.progressbar.length>0&&this.progressbar.find("."+this.options.style.progressBarCss).css("width",i+"%")}},{key:"_keyNav",value:function(t){if(this.options.keyboard.keyNavigation)if(e.inArray(t.which,this.options.keyboard.keyLeft)>-1)this._navigate("prev"),t.preventDefault();else{if(!(e.inArray(t.which,this.options.keyboard.keyRight)>-1))return;this._navigate("next"),t.preventDefault()}}},{key:"_triggerEvent",value:function(t,i){var n=e.Event(t);return this.main.trigger(n,i),!n.isDefaultPrevented()&&n.result}},{key:"_setURLHash",value:function(e){this.options.enableUrlHash&&window.location.hash!==e&&history.pushState(null,null,e)}},{key:"_getURLHashIndex",value:function(){if(this.options.enableUrlHash){var e=window.location.hash;if(e.length>0){var t=this.nav.find("a[href*='"+e+"']");if(t.length>0)return this.steps.index(t)}}return!1}},{key:"_showError",value:function(e){console.error(e)}},{key:"_changeState",value:function(t,i,n){var r=this;n=!1!==n;var s="";"default"==i?s=this.options.style.anchorDefaultCss:"active"==i?s=this.options.style.anchorActiveCss:"done"==i?s=this.options.style.anchorDoneCss:"disable"==i?s=this.options.style.anchorDisabledCss:"hidden"==i?s=this.options.style.anchorHiddenCss:"error"==i?s=this.options.style.anchorErrorCss:"warning"==i&&(s=this.options.style.anchorWarningCss),e.each(t,function(e,t){r.steps.eq(t).toggleClass(s,n)})}},{key:"goToStep",value:function(e,t){(1==(t=!1!==t)||this._isShowable(this.steps.eq(e)))&&(!0===t&&e>0&&this.options.anchor.enableDoneState&&this.options.anchor.markPreviousStepsAsDone&&this.steps.slice(0,e).addClass(this.options.style.anchorDoneCss),this._showStep(e))}},{key:"next",value:function(){this._navigate("next")}},{key:"prev",value:function(){this._navigate("prev")}},{key:"reset",value:function(){this.steps.removeClass([this.options.style.anchorDoneCss,this.options.style.anchorActiveCss,this.options.style.anchorErrorCss,this.options.style.anchorWarningCss]),this._setURLHash("#"),this._init(),this._load()}},{key:"setState",value:function(e,t){this._changeState(e,t,!0)}},{key:"unsetState",value:function(e,t){this._changeState(e,t,!1)}},{key:"setOptions",value:function(t){this.options=e.extend(!0,{},this.options,t),this._init()}},{key:"getOptions",value:function(){return this.options}},{key:"getStepInfo",value:function(){return{currentStep:this.current_index?this.current_index:0,totalSteps:this.steps?this.steps.length:0}}},{key:"loader",value:function(e){this.main.toggleClass(this.options.style.loaderCss,"show"===e)}},{key:"fixHeight",value:function(){this._fixHeight(this.current_index)}}])&&o(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),i}();e.fn.smartWizard=function(t){if(void 0===t||"object"===a(t))return this.each(function(){e.data(this,"smartWizard")||e.data(this,"smartWizard",new i(this,t))});if("string"==typeof t&&"_"!==t[0]&&"init"!==t){var n=e.data(this[0],"smartWizard");return"destroy"===t&&e.data(this,"smartWizard",null),n instanceof i&&"function"==typeof n[t]?n[t].apply(n,Array.prototype.slice.call(arguments,1)):this}},e.fn.smartWizard.transitions={fade:function(t,i,n,r,s){e.isFunction(t.fadeOut)?i?i.fadeOut(r.options.transition.speed,r.options.transition.easing,function(){t.fadeIn(r.options.transition.speed,r.options.transition.easing,function(){s()})}):t.fadeIn(r.options.transition.speed,r.options.transition.easing,function(){s()}):s(!1)},slideSwing:function(t,i,n,r,s){e.isFunction(t.slideDown)?i?i.slideUp(r.options.transition.speed,r.options.transition.easing,function(){t.slideDown(r.options.transition.speed,r.options.transition.easing,function(){s()})}):t.slideDown(r.options.transition.speed,r.options.transition.easing,function(){s()}):s(!1)},slideHorizontal:function(t,i,n,r,s){if(e.isFunction(t.animate)){var o=function(e,t,i,n){e.css({position:"absolute",left:t}).show().animate({left:i},r.options.transition.speed,r.options.transition.easing,n)};-1==r.current_index&&r.container.height(t.outerHeight());var a=r.container.width();if(i){var l=i.css(["position","left"]);o(i,0,a*("backward"==n?1:-1),function(){i.hide().css(l)})}var c=t.css(["position"]);o(t,a*("backward"==n?-2:1),0,function(){t.css(c),s()})}else s(!1)},slideVertical:function(t,i,n,r,s){if(e.isFunction(t.animate)){var o=function(e,t,i,n){e.css({position:"absolute",top:t}).show().animate({top:i},r.options.transition.speed,r.options.transition.easing,n)};-1==r.current_index&&r.container.height(t.outerHeight());var a=r.container.height();if(i){var l=i.css(["position","top"]);o(i,0,a*("backward"==n?-1:1),function(){i.hide().css(l)})}var c=t.css(["position"]);o(t,a*("backward"==n?1:-2),0,function(){t.css(c),s()})}else s(!1)},css:function(t,i,n,r,s){if(0!=r.options.transition.fwdHideCss.length&&0!=r.options.transition.bckHideCss.length){var o=function(t,i,n){i&&0!=i.length||n(),t.addClass(i).one("animationend",function(t){e(t.currentTarget).removeClass(i),n()}),t.addClass(i).one("animationcancel",function(t){e(t.currentTarget).removeClass(i),n("cancel")})},a=r.options.transition.prefixCss+" "+("backward"==n?r.options.transition.bckShowCss:r.options.transition.fwdShowCss);if(i){var l=r.options.transition.prefixCss+" "+("backward"==n?r.options.transition.bckHideCss:r.options.transition.fwdHideCss);o(i,l,function(){i.hide(),o(t,a,function(){s()}),t.show()})}else o(t,a,function(){s()}),t.show()}else s(!1)}}})?n.apply(t,r):n)||(e.exports=s)},271:(e,t,i)=>{"use strict";if(i.d(t,{A:()=>r}),/^(7(06|92|96)|140)$/.test(i.j))var n=i(8979);function r(e){return(0,n.A)(e).getComputedStyle(e)}},304:function(e,t,i){!function(e){"use strict";e.defineLocale("zh-tw",{months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"週日_週一_週二_週三_週四_週五_週六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日 HH:mm",LLLL:"YYYY年M月D日dddd HH:mm",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},meridiemParse:/凌晨|早上|上午|中午|下午|晚上/,meridiemHour:function(e,t){return 12===e&&(e=0),"凌晨"===t||"早上"===t||"上午"===t?e:"中午"===t?e>=11?e:e+12:"下午"===t||"晚上"===t?e+12:void 0},meridiem:function(e,t,i){var n=100*e+t;return n<600?"凌晨":n<900?"早上":n<1130?"上午":n<1230?"中午":n<1800?"下午":"晚上"},calendar:{sameDay:"[今天] LT",nextDay:"[明天] LT",nextWeek:"[下]dddd LT",lastDay:"[昨天] LT",lastWeek:"[上]dddd LT",sameElse:"L"},dayOfMonthOrdinalParse:/\d{1,2}(日|月|週)/,ordinal:function(e,t){switch(t){case"d":case"D":case"DDD":return e+"日";case"M":return e+"月";case"w":case"W":return e+"週";default:return e}},relativeTime:{future:"%s後",past:"%s前",s:"幾秒",ss:"%d 秒",m:"1 分鐘",mm:"%d 分鐘",h:"1 小時",hh:"%d 小時",d:"1 天",dd:"%d 天",M:"1 個月",MM:"%d 個月",y:"1 年",yy:"%d 年"}})}(i(5093))},306:function(e,t,i){!function(e){"use strict";e.defineLocale("mk",{months:"јануари_февруари_март_април_мај_јуни_јули_август_септември_октомври_ноември_декември".split("_"),monthsShort:"јан_фев_мар_апр_мај_јун_јул_авг_сеп_окт_ное_дек".split("_"),weekdays:"недела_понеделник_вторник_среда_четврток_петок_сабота".split("_"),weekdaysShort:"нед_пон_вто_сре_чет_пет_саб".split("_"),weekdaysMin:"нe_пo_вт_ср_че_пе_сa".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"D.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY H:mm",LLLL:"dddd, D MMMM YYYY H:mm"},calendar:{sameDay:"[Денес во] LT",nextDay:"[Утре во] LT",nextWeek:"[Во] dddd [во] LT",lastDay:"[Вчера во] LT",lastWeek:function(){switch(this.day()){case 0:case 3:case 6:return"[Изминатата] dddd [во] LT";case 1:case 2:case 4:case 5:return"[Изминатиот] dddd [во] LT"}},sameElse:"L"},relativeTime:{future:"за %s",past:"пред %s",s:"неколку секунди",ss:"%d секунди",m:"една минута",mm:"%d минути",h:"еден час",hh:"%d часа",d:"еден ден",dd:"%d дена",M:"еден месец",MM:"%d месеци",y:"една година",yy:"%d години"},dayOfMonthOrdinalParse:/\d{1,2}-(ев|ен|ти|ви|ри|ми)/,ordinal:function(e){var t=e%10,i=e%100;return 0===e?e+"-ев":0===i?e+"-ен":i>10&&i<20?e+"-ти":1===t?e+"-ви":2===t?e+"-ри":7===t||8===t?e+"-ми":e+"-ти"},week:{dow:1,doy:7}})}(i(5093))},527:function(e,t,i){!function(e){"use strict";var t="nolla yksi kaksi kolme neljä viisi kuusi seitsemän kahdeksan yhdeksän".split(" "),i=["nolla","yhden","kahden","kolmen","neljän","viiden","kuuden",t[7],t[8],t[9]];function n(e,n,r,s){var o="";switch(r){case"s":return s?"muutaman sekunnin":"muutama sekunti";case"ss":o=s?"sekunnin":"sekuntia";break;case"m":return s?"minuutin":"minuutti";case"mm":o=s?"minuutin":"minuuttia";break;case"h":return s?"tunnin":"tunti";case"hh":o=s?"tunnin":"tuntia";break;case"d":return s?"päivän":"päivä";case"dd":o=s?"päivän":"päivää";break;case"M":return s?"kuukauden":"kuukausi";case"MM":o=s?"kuukauden":"kuukautta";break;case"y":return s?"vuoden":"vuosi";case"yy":o=s?"vuoden":"vuotta"}return function(e,n){return e<10?n?i[e]:t[e]:e}(e,s)+" "+o}e.defineLocale("fi",{months:"tammikuu_helmikuu_maaliskuu_huhtikuu_toukokuu_kesäkuu_heinäkuu_elokuu_syyskuu_lokakuu_marraskuu_joulukuu".split("_"),monthsShort:"tammi_helmi_maalis_huhti_touko_kesä_heinä_elo_syys_loka_marras_joulu".split("_"),weekdays:"sunnuntai_maanantai_tiistai_keskiviikko_torstai_perjantai_lauantai".split("_"),weekdaysShort:"su_ma_ti_ke_to_pe_la".split("_"),weekdaysMin:"su_ma_ti_ke_to_pe_la".split("_"),longDateFormat:{LT:"HH.mm",LTS:"HH.mm.ss",L:"DD.MM.YYYY",LL:"Do MMMM[ta] YYYY",LLL:"Do MMMM[ta] YYYY, [klo] HH.mm",LLLL:"dddd, Do MMMM[ta] YYYY, [klo] HH.mm",l:"D.M.YYYY",ll:"Do MMM YYYY",lll:"Do MMM YYYY, [klo] HH.mm",llll:"ddd, Do MMM YYYY, [klo] HH.mm"},calendar:{sameDay:"[tänään] [klo] LT",nextDay:"[huomenna] [klo] LT",nextWeek:"dddd [klo] LT",lastDay:"[eilen] [klo] LT",lastWeek:"[viime] dddd[na] [klo] LT",sameElse:"L"},relativeTime:{future:"%s päästä",past:"%s sitten",s:n,ss:n,m:n,mm:n,h:n,hh:n,d:n,dd:n,M:n,MM:n,y:n,yy:n},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(i(5093))},571:(e,t,i)=>{"use strict";function n(e){var t;return function(){return t||(t=new Promise(function(i){Promise.resolve().then(function(){t=void 0,i(e())})})),t}}i.d(t,{A:()=>n})},609:function(e,t,i){!function(e){"use strict";var t="vasárnap hétfőn kedden szerdán csütörtökön pénteken szombaton".split(" ");function i(e,t,i,n){var r=e;switch(i){case"s":return n||t?"néhány másodperc":"néhány másodperce";case"ss":return r+(n||t)?" másodperc":" másodperce";case"m":return"egy"+(n||t?" perc":" perce");case"mm":return r+(n||t?" perc":" perce");case"h":return"egy"+(n||t?" óra":" órája");case"hh":return r+(n||t?" óra":" órája");case"d":return"egy"+(n||t?" nap":" napja");case"dd":return r+(n||t?" nap":" napja");case"M":return"egy"+(n||t?" hónap":" hónapja");case"MM":return r+(n||t?" hónap":" hónapja");case"y":return"egy"+(n||t?" év":" éve");case"yy":return r+(n||t?" év":" éve")}return""}function n(e){return(e?"":"[múlt] ")+"["+t[this.day()]+"] LT[-kor]"}e.defineLocale("hu",{months:"január_február_március_április_május_június_július_augusztus_szeptember_október_november_december".split("_"),monthsShort:"jan._feb._márc._ápr._máj._jún._júl._aug._szept._okt._nov._dec.".split("_"),monthsParseExact:!0,weekdays:"vasárnap_hétfő_kedd_szerda_csütörtök_péntek_szombat".split("_"),weekdaysShort:"vas_hét_kedd_sze_csüt_pén_szo".split("_"),weekdaysMin:"v_h_k_sze_cs_p_szo".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"YYYY.MM.DD.",LL:"YYYY. MMMM D.",LLL:"YYYY. MMMM D. H:mm",LLLL:"YYYY. MMMM D., dddd H:mm"},meridiemParse:/de|du/i,isPM:function(e){return"u"===e.charAt(1).toLowerCase()},meridiem:function(e,t,i){return e<12?!0===i?"de":"DE":!0===i?"du":"DU"},calendar:{sameDay:"[ma] LT[-kor]",nextDay:"[holnap] LT[-kor]",nextWeek:function(){return n.call(this,!0)},lastDay:"[tegnap] LT[-kor]",lastWeek:function(){return n.call(this,!1)},sameElse:"L"},relativeTime:{future:"%s múlva",past:"%s",s:i,ss:i,m:i,mm:i,h:i,hh:i,d:i,dd:i,M:i,MM:i,y:i,yy:i},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(i(5093))},644:(e,t,i)=>{"use strict";i.d(t,{A:()=>d});var n={left:"right",right:"left",bottom:"top",top:"bottom"};function r(e){return e.replace(/left|right|bottom|top/g,function(e){return n[e]})}var s=i(2632),o={start:"end",end:"start"};function a(e){return e.replace(/start|end/g,function(e){return o[e]})}var l=i(9913),c=i(8101),h=i(4278);const d={name:"flip",enabled:!0,phase:"main",fn:function(e){var t=e.state,i=e.options,n=e.name;if(!t.modifiersData[n]._skip){for(var o=i.mainAxis,d=void 0===o||o,u=i.altAxis,f=void 0===u||u,p=i.fallbackPlacements,m=i.padding,g=i.boundary,_=i.rootBoundary,y=i.altBoundary,v=i.flipVariations,x=void 0===v||v,b=i.allowedAutoPlacements,w=t.options.placement,S=(0,s.A)(w),T=p||(S!==w&&x?function(e){if((0,s.A)(e)===h.qZ)return[];var t=r(e);return[a(e),t,a(t)]}(w):[r(w)]),k=[w].concat(T).reduce(function(e,i){return e.concat((0,s.A)(i)===h.qZ?function(e,t){void 0===t&&(t={});var i=t,n=i.placement,r=i.boundary,o=i.rootBoundary,a=i.padding,d=i.flipVariations,u=i.allowedAutoPlacements,f=void 0===u?h.DD:u,p=(0,c.A)(n),m=p?d?h.Ol:h.Ol.filter(function(e){return(0,c.A)(e)===p}):h.OM,g=m.filter(function(e){return f.indexOf(e)>=0});0===g.length&&(g=m);var _=g.reduce(function(t,i){return t[i]=(0,l.A)(e,{placement:i,boundary:r,rootBoundary:o,padding:a})[(0,s.A)(i)],t},{});return Object.keys(_).sort(function(e,t){return _[e]-_[t]})}(t,{placement:i,boundary:g,rootBoundary:_,padding:m,flipVariations:x,allowedAutoPlacements:b}):i)},[]),M=t.rects.reference,A=t.rects.popper,C=new Map,D=!0,L=k[0],E=0;E=0,z=O?"width":"height",F=(0,l.A)(t,{placement:I,boundary:g,rootBoundary:_,altBoundary:y,padding:m}),N=O?R?h.pG:h.kb:R?h.sQ:h.Mn;M[z]>A[z]&&(N=r(N));var Y=r(N),B=[];if(d&&B.push(F[P]<=0),f&&B.push(F[N]<=0,F[Y]<=0),B.every(function(e){return e})){L=I,D=!1;break}C.set(I,B)}if(D)for(var H=function(e){var t=k.find(function(t){var i=C.get(t);if(i)return i.slice(0,e).every(function(e){return e})});if(t)return L=t,"break"},j=x?3:1;j>0&&"break"!==H(j);j--);t.placement!==L&&(t.modifiersData[n]._skip=!0,t.placement=L,t.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}}},666:(e,t,i)=>{"use strict";i.d(t,{A:()=>j});var n=i(7363),r=i(9174),s=i(172),o=i(8817);class a extends r.aW{getKeyInfo(){return{allDay:{},timed:{}}}getKeysForDateSpan(e){return e.allDay?["allDay"]:["timed"]}getKeysForEventDef(e){return e.allDay?(0,r.bN)(e)?["timed","allDay"]:["allDay"]:["timed"]}}const l=(0,r.x)({hour:"numeric",minute:"2-digit",omitZeroMinute:!0,meridiem:"short"});function c(e){let t=["fc-timegrid-slot","fc-timegrid-slot-label",e.isLabeled?"fc-scrollgrid-shrink":"fc-timegrid-slot-minor"];return(0,s.n)(r.V.Consumer,null,i=>{if(!e.isLabeled)return(0,s.n)("td",{className:t.join(" "),"data-time":e.isoTimeStr});let{dateEnv:n,options:o,viewApi:a}=i,c=null==o.slotLabelFormat?l:Array.isArray(o.slotLabelFormat)?(0,r.x)(o.slotLabelFormat[0]):(0,r.x)(o.slotLabelFormat),d={level:0,time:e.time,date:n.toDate(e.date),view:a,text:n.format(e.date,c)};return(0,s.n)(r.C,{elTag:"td",elClasses:t,elAttrs:{"data-time":e.isoTimeStr},renderProps:d,generatorName:"slotLabelContent",customGenerator:o.slotLabelContent,defaultGenerator:h,classNameGenerator:o.slotLabelClassNames,didMount:o.slotLabelDidMount,willUnmount:o.slotLabelWillUnmount},e=>(0,s.n)("div",{className:"fc-timegrid-slot-label-frame fc-scrollgrid-shrink-frame"},(0,s.n)(e,{elTag:"div",elClasses:["fc-timegrid-slot-label-cushion","fc-scrollgrid-shrink-cushion"]})))})}function h(e){return e.text}class d extends r.B{render(){return this.props.slatMetas.map(e=>(0,s.n)("tr",{key:e.key},(0,s.n)(c,Object.assign({},e))))}}const u=(0,r.x)({week:"short"});class f extends r.bc{constructor(){super(...arguments),this.allDaySplitter=new a,this.headerElRef=(0,s._3)(),this.rootElRef=(0,s._3)(),this.scrollerElRef=(0,s._3)(),this.state={slatCoords:null},this.handleScrollTopRequest=e=>{let t=this.scrollerElRef.current;t&&(t.scrollTop=e)},this.renderHeadAxis=(e,t="")=>{let{options:i}=this.context,{dateProfile:n}=this.props,o=n.renderRange,a=1===(0,r.bj)(o.start,o.end)?(0,r.a_)(this.context,o.start,"week"):{};return i.weekNumbers&&"day"===e?(0,s.n)(r.cn,{elTag:"th",elClasses:["fc-timegrid-axis","fc-scrollgrid-shrink"],elAttrs:{"aria-hidden":!0},date:o.start,defaultFormat:u},e=>(0,s.n)("div",{className:["fc-timegrid-axis-frame","fc-scrollgrid-shrink-frame","fc-timegrid-axis-frame-liquid"].join(" "),style:{height:t}},(0,s.n)(e,{elTag:"a",elClasses:["fc-timegrid-axis-cushion","fc-scrollgrid-shrink-cushion","fc-scrollgrid-sync-inner"],elAttrs:a}))):(0,s.n)("th",{"aria-hidden":!0,className:"fc-timegrid-axis"},(0,s.n)("div",{className:"fc-timegrid-axis-frame",style:{height:t}}))},this.renderTableRowAxis=e=>{let{options:t,viewApi:i}=this.context,n={text:t.allDayText,view:i};return(0,s.n)(r.C,{elTag:"td",elClasses:["fc-timegrid-axis","fc-scrollgrid-shrink"],elAttrs:{"aria-hidden":!0},renderProps:n,generatorName:"allDayContent",customGenerator:t.allDayContent,defaultGenerator:p,classNameGenerator:t.allDayClassNames,didMount:t.allDayDidMount,willUnmount:t.allDayWillUnmount},t=>(0,s.n)("div",{className:["fc-timegrid-axis-frame","fc-scrollgrid-shrink-frame",null==e?" fc-timegrid-axis-frame-liquid":""].join(" "),style:{height:e}},(0,s.n)(t,{elTag:"span",elClasses:["fc-timegrid-axis-cushion","fc-scrollgrid-shrink-cushion","fc-scrollgrid-sync-inner"]})))},this.handleSlatCoords=e=>{this.setState({slatCoords:e})}}renderSimpleLayout(e,t,i){let{context:n,props:o}=this,a=[],l=(0,r.ca)(n.options);return e&&a.push({type:"header",key:"header",isSticky:l,chunk:{elRef:this.headerElRef,tableClassName:"fc-col-header",rowContent:e}}),t&&(a.push({type:"body",key:"all-day",chunk:{content:t}}),a.push({type:"body",key:"all-day-divider",outerContent:(0,s.n)("tr",{role:"presentation",className:"fc-scrollgrid-section"},(0,s.n)("td",{className:"fc-timegrid-divider "+n.theme.getClass("tableCellShaded")}))})),a.push({type:"body",key:"body",liquid:!0,expandRows:Boolean(n.options.expandRows),chunk:{scrollerElRef:this.scrollerElRef,content:i}}),(0,s.n)(r.cq,{elRef:this.rootElRef,elClasses:["fc-timegrid"],viewSpec:n.viewSpec},(0,s.n)(r.bZ,{liquid:!o.isHeightAuto&&!o.forPrint,collapsibleWidth:o.forPrint,cols:[{width:"shrink"}],sections:a}))}renderHScrollLayout(e,t,i,n,o,a,l){let c=this.context.pluginHooks.scrollGridImpl;if(!c)throw new Error("No ScrollGrid implementation");let{context:h,props:u}=this,f=!u.forPrint&&(0,r.ca)(h.options),p=!u.forPrint&&(0,r.c9)(h.options),m=[];e&&m.push({type:"header",key:"header",isSticky:f,syncRowHeights:!0,chunks:[{key:"axis",rowContent:e=>(0,s.n)("tr",{role:"presentation"},this.renderHeadAxis("day",e.rowSyncHeights[0]))},{key:"cols",elRef:this.headerElRef,tableClassName:"fc-col-header",rowContent:e}]}),t&&(m.push({type:"body",key:"all-day",syncRowHeights:!0,chunks:[{key:"axis",rowContent:e=>(0,s.n)("tr",{role:"presentation"},this.renderTableRowAxis(e.rowSyncHeights[0]))},{key:"cols",content:t}]}),m.push({key:"all-day-divider",type:"body",outerContent:(0,s.n)("tr",{role:"presentation",className:"fc-scrollgrid-section"},(0,s.n)("td",{colSpan:2,className:"fc-timegrid-divider "+h.theme.getClass("tableCellShaded")}))}));let g=h.options.nowIndicator;return m.push({type:"body",key:"body",liquid:!0,expandRows:Boolean(h.options.expandRows),chunks:[{key:"axis",content:e=>(0,s.n)("div",{className:"fc-timegrid-axis-chunk"},(0,s.n)("table",{"aria-hidden":!0,style:{height:e.expandRows?e.clientHeight:""}},e.tableColGroupNode,(0,s.n)("tbody",null,(0,s.n)(d,{slatMetas:a}))),(0,s.n)("div",{className:"fc-timegrid-now-indicator-container"},(0,s.n)(r.a6,{unit:g?"minute":"day"},e=>{let t=g&&l&&l.safeComputeTop(e);return"number"==typeof t?(0,s.n)(r.ch,{elClasses:["fc-timegrid-now-indicator-arrow"],elStyle:{top:t},isAxis:!0,date:e}):null})))},{key:"cols",scrollerElRef:this.scrollerElRef,content:i}]}),p&&m.push({key:"footer",type:"footer",isSticky:!0,chunks:[{key:"axis",content:r.c8},{key:"cols",content:r.c8}]}),(0,s.n)(r.cq,{elRef:this.rootElRef,elClasses:["fc-timegrid"],viewSpec:h.viewSpec},(0,s.n)(c,{liquid:!u.isHeightAuto&&!u.forPrint,forPrint:u.forPrint,collapsibleWidth:!1,colGroups:[{width:"shrink",cols:[{width:"shrink"}]},{cols:[{span:n,minWidth:o}]}],sections:m}))}getAllDayMaxEventProps(){let{dayMaxEvents:e,dayMaxEventRows:t}=this.context.options;return!0!==e&&!0!==t||(e=void 0,t=5),{dayMaxEvents:e,dayMaxEventRows:t}}}function p(e){return e.text}class m{constructor(e,t,i){this.positions=e,this.dateProfile=t,this.slotDuration=i}safeComputeTop(e){let{dateProfile:t}=this;if((0,r.G)(t.currentRange,e)){let i=(0,r.q)(e),n=e.valueOf()-i.valueOf();if(n>=(0,r.bq)(t.slotMinTime)&&n<(0,r.bq)(t.slotMaxTime))return this.computeTimeTop((0,r.d)(n))}return null}computeDateTop(e,t){return t||(t=(0,r.q)(e)),this.computeTimeTop((0,r.d)(e.valueOf()-t.valueOf()))}computeTimeTop(e){let t,i,{positions:n,dateProfile:s}=this,o=n.els.length,a=(e.milliseconds-(0,r.bq)(s.slotMinTime))/(0,r.bq)(this.slotDuration);return a=Math.max(0,a),a=Math.min(o,a),t=Math.floor(a),t=Math.min(t,o-1),i=a-t,n.tops[t]+n.getHeight(t)*i}}class g extends r.B{render(){let{props:e,context:t}=this,{options:i}=t,{slatElRefs:n}=e;return(0,s.n)("tbody",null,e.slatMetas.map((o,a)=>{let l={time:o.time,date:t.dateEnv.toDate(o.date),view:t.viewApi};return(0,s.n)("tr",{key:o.key,ref:n.createRef(o.key)},e.axis&&(0,s.n)(c,Object.assign({},o)),(0,s.n)(r.C,{elTag:"td",elClasses:["fc-timegrid-slot","fc-timegrid-slot-lane",!o.isLabeled&&"fc-timegrid-slot-minor"],elAttrs:{"data-time":o.isoTimeStr},renderProps:l,generatorName:"slotLaneContent",customGenerator:i.slotLaneContent,classNameGenerator:i.slotLaneClassNames,didMount:i.slotLaneDidMount,willUnmount:i.slotLaneWillUnmount}))}))}}class _ extends r.B{constructor(){super(...arguments),this.rootElRef=(0,s._3)(),this.slatElRefs=new r.cd}render(){let{props:e,context:t}=this;return(0,s.n)("div",{ref:this.rootElRef,className:"fc-timegrid-slots"},(0,s.n)("table",{"aria-hidden":!0,className:t.theme.getClass("table"),style:{minWidth:e.tableMinWidth,width:e.clientWidth,height:e.minHeight}},e.tableColGroupNode,(0,s.n)(g,{slatElRefs:this.slatElRefs,axis:e.axis,slatMetas:e.slatMetas})))}componentDidMount(){this.updateSizing()}componentDidUpdate(){this.updateSizing()}componentWillUnmount(){this.props.onCoords&&this.props.onCoords(null)}updateSizing(){let{context:e,props:t}=this;var i;t.onCoords&&null!==t.clientWidth&&this.rootElRef.current.offsetHeight&&t.onCoords(new m(new r.b8(this.rootElRef.current,(i=this.slatElRefs.currentMap,t.slatMetas.map(e=>i[e.key])),!1,!0),this.props.dateProfile,e.options.slotDuration))}}function y(e,t){let i,n=[];for(i=0;iL(e.hiddenSegs,e),defaultGenerator:b,forceTimed:!0},e=>(0,s.n)(e,{elTag:"div",elClasses:["fc-timegrid-more-link-inner","fc-sticky"]}))}}function b(e){return e.shortText}function w(e,t){if(!e)return[[],0];let{level:i,lateralStart:n,lateralEnd:r}=e,s=n,o=[];for(;s{let r=e(...n);return r in i?i[r]:i[r]=t(...n)}}function M(e,t,i=null,n=0){let r=[];if(i)for(let s=0;s(0,s.n)("div",{className:"fc-timegrid-col-frame"},(0,s.n)("div",{className:"fc-timegrid-col-bg"},this.renderFillSegs(e.businessHourSegs,"non-business"),this.renderFillSegs(e.bgEventSegs,"bg-event"),this.renderFillSegs(e.dateSelectionSegs,"highlight")),(0,s.n)("div",{className:"fc-timegrid-col-events"},this.renderFgSegs(l,a,!1,!1,!1)),(0,s.n)("div",{className:"fc-timegrid-col-events"},this.renderFgSegs(o,{},Boolean(e.eventDrag),Boolean(e.eventResize),Boolean(n),"mirror")),(0,s.n)("div",{className:"fc-timegrid-now-indicator-container"},this.renderNowIndicator(e.nowIndicatorSegs)),(0,r.cj)(i)&&(0,s.n)(t,{elTag:"div",elClasses:["fc-timegrid-col-misc"]})))}renderFgSegs(e,t,i,n,r,s){let{props:o}=this;return o.forPrint?L(e,o):this.renderPositionedFgSegs(e,t,i,n,r,s)}renderPositionedFgSegs(e,t,i,n,o,a){let{eventMaxStack:l,eventShortHeight:c,eventOrderStrict:h,eventMinHeight:d}=this.context.options,{date:u,slatCoords:f,eventSelection:p,todayRange:m,nowDate:g}=this.props,_=i||n||o,y=M(e,u,f,d),{segPlacements:v,hiddenGroups:x}=function(e,t,i,n){let s=[],o=[];for(let i=0;ie+":"+t,(n,s)=>{let o=function(e,t,i){let{levelCoords:n,entriesByLevel:s}=e,o=s[t][i],a=n[t]+o.thickness,l=n.length,c=t;for(;c(0,r.bz)(e),(e,i,n)=>{let r,{nextLevelNodes:s,thickness:o}=e,a=o+n,l=o/a,c=[];if(s.length)for(let e of s)if(void 0===r){let n=t(e,i,a);r=n[0],c.push(n[1])}else{let i=t(e,r,0);c.push(i[1])}else r=1;let h=(r-i)*l;return[r-h,Object.assign(Object.assign({},e),{thickness:h,nextLevelNodes:c})]});return e.map(e=>t(e,0,0)[1])}(a),{segRects:function(e){let t=[];const i=k((e,t,i)=>(0,r.bz)(e),(e,i,r)=>{let s=Object.assign(Object.assign({},e),{levelCoord:i,stackDepth:r,stackForward:0});return t.push(s),s.stackForward=n(e.nextLevelNodes,i+e.thickness,r+1)+1});function n(e,t,n){let r=0;for(let s of e)r=Math.max(i(s,t,n),r);return r}return n(e,0,0),t}(a),hiddenGroups:o}}(s,i,n),c=[];for(let t of a)c.push({seg:e[t.index],rect:t});for(let e of o)c.push({seg:e,rect:null});return{segPlacements:c,hiddenGroups:l}}(e,y,h,l);return(0,s.n)(s.FK,null,this.renderHiddenGroups(x,e),v.map(e=>{let{seg:l,rect:h}=e,d=l.eventRange.instance.instanceId,u=_||Boolean(!t[d]&&h),f=E(h&&h.span),y=!_&&h?this.computeSegHStyle(h):{left:0,right:0},v=Boolean(h)&&h.stackForward>0,x=Boolean(h)&&h.span.end-h.span.start{let d=E(e.span),u=(f=e.entries,p=t,f.map(e=>p[e.index]));var f,p;return(0,s.n)(x,{key:(0,r.bu)((0,r.cp)(u)),hiddenSegs:u,top:d.top,bottom:d.bottom,extraDateSpan:i,dateProfile:n,todayRange:o,nowDate:a,eventSelection:l,eventDrag:c,eventResize:h})}))}renderFillSegs(e,t){let{props:i,context:n}=this,o=M(e,i.date,i.slatCoords,n.options.eventMinHeight).map((n,o)=>{let a=e[o];return(0,s.n)("div",{key:(0,r.bR)(a.eventRange),className:"fc-timegrid-bg-harness",style:E(n)},"bg-event"===t?(0,s.n)(r.cm,Object.assign({seg:a},(0,r.bQ)(a,i.todayRange,i.nowDate))):(0,r.cl)(t))});return(0,s.n)(s.FK,null,o)}renderNowIndicator(e){let{slatCoords:t,date:i}=this.props;return t?e.map((e,n)=>(0,s.n)(r.ch,{key:n,elClasses:["fc-timegrid-now-indicator-line"],elStyle:{top:t.computeDateTop(e.start,i)},isAxis:!1,date:i})):null}computeSegHStyle(e){let t,i,{isRtl:n,options:r}=this.context,s=r.slotEventOverlap,o=e.levelCoord,a=e.levelCoord+e.thickness;s&&(a=Math.min(1,o+2*(a-o))),n?(t=1-a,i=o):(t=o,i=1-a);let l={zIndex:e.stackDepth+1,left:100*t+"%",right:100*i+"%"};return s&&!e.stackForward&&(l[n?"marginLeft":"marginRight"]=20),l}}function L(e,{todayRange:t,nowDate:i,eventSelection:n,eventDrag:o,eventResize:a}){let l=(o?o.affectedInstances:null)||(a?a.affectedInstances:null)||{};return(0,s.n)(s.FK,null,e.map(e=>{let o=e.eventRange.instance.instanceId;return(0,s.n)("div",{key:o,style:{visibility:l[o]?"hidden":""}},(0,s.n)(C,Object.assign({seg:e,isDragging:!1,isResizing:!1,isDateSelecting:!1,isSelected:o===n,isShort:!1},(0,r.bQ)(e,t,i))))}))}function E(e){return e?{top:e.start,bottom:-e.end}:{top:"",bottom:""}}class I extends r.B{constructor(){super(...arguments),this.splitFgEventSegs=(0,r.z)(y),this.splitBgEventSegs=(0,r.z)(y),this.splitBusinessHourSegs=(0,r.z)(y),this.splitNowIndicatorSegs=(0,r.z)(y),this.splitDateSelectionSegs=(0,r.z)(y),this.splitEventDrag=(0,r.z)(v),this.splitEventResize=(0,r.z)(v),this.rootElRef=(0,s._3)(),this.cellElRefs=new r.cd}render(){let{props:e,context:t}=this,i=t.options.nowIndicator&&e.slatCoords&&e.slatCoords.safeComputeTop(e.nowDate),n=e.cells.length,o=this.splitFgEventSegs(e.fgEventSegs,n),a=this.splitBgEventSegs(e.bgEventSegs,n),l=this.splitBusinessHourSegs(e.businessHourSegs,n),c=this.splitNowIndicatorSegs(e.nowIndicatorSegs,n),h=this.splitDateSelectionSegs(e.dateSelectionSegs,n),d=this.splitEventDrag(e.eventDrag,n),u=this.splitEventResize(e.eventResize,n);return(0,s.n)("div",{className:"fc-timegrid-cols",ref:this.rootElRef},(0,s.n)("table",{role:"presentation",style:{minWidth:e.tableMinWidth,width:e.clientWidth}},e.tableColGroupNode,(0,s.n)("tbody",{role:"presentation"},(0,s.n)("tr",{role:"row"},e.axis&&(0,s.n)("td",{"aria-hidden":!0,className:"fc-timegrid-col fc-timegrid-axis"},(0,s.n)("div",{className:"fc-timegrid-col-frame"},(0,s.n)("div",{className:"fc-timegrid-now-indicator-container"},"number"==typeof i&&(0,s.n)(r.ch,{elClasses:["fc-timegrid-now-indicator-arrow"],elStyle:{top:i},isAxis:!0,date:e.nowDate})))),e.cells.map((t,i)=>(0,s.n)(D,{key:t.key,elRef:this.cellElRefs.createRef(t.key),dateProfile:e.dateProfile,date:t.date,nowDate:e.nowDate,todayRange:e.todayRange,extraRenderProps:t.extraRenderProps,extraDataAttrs:t.extraDataAttrs,extraClassNames:t.extraClassNames,extraDateSpan:t.extraDateSpan,fgEventSegs:o[i],bgEventSegs:a[i],businessHourSegs:l[i],nowIndicatorSegs:c[i],dateSelectionSegs:h[i],eventDrag:d[i],eventResize:u[i],slatCoords:e.slatCoords,eventSelection:e.eventSelection,forPrint:e.forPrint}))))))}componentDidMount(){this.updateCoords()}componentDidUpdate(){this.updateCoords()}updateCoords(){let{props:e}=this;var t;e.onColCoords&&null!==e.clientWidth&&e.onColCoords(new r.b8(this.rootElRef.current,(t=this.cellElRefs.currentMap,e.cells.map(e=>t[e.key])),!0,!1))}}class P extends r.bc{constructor(){super(...arguments),this.processSlotOptions=(0,r.z)(R),this.state={slatCoords:null},this.handleRootEl=e=>{e?this.context.registerInteractiveComponent(this,{el:e,isHitComboAllowed:this.props.isHitComboAllowed}):this.context.unregisterInteractiveComponent(this)},this.handleScrollRequest=e=>{let{onScrollTopRequest:t}=this.props,{slatCoords:i}=this.state;if(t&&i){if(e.time){let n=i.computeTimeTop(e.time);n=Math.ceil(n),n&&(n+=1),t(n)}return!0}return!1},this.handleColCoords=e=>{this.colCoords=e},this.handleSlatCoords=e=>{this.setState({slatCoords:e}),this.props.onSlatCoords&&this.props.onSlatCoords(e)}}render(){let{props:e,state:t}=this;return(0,s.n)("div",{className:"fc-timegrid-body",ref:this.handleRootEl,style:{width:e.clientWidth,minWidth:e.tableMinWidth}},(0,s.n)(_,{axis:e.axis,dateProfile:e.dateProfile,slatMetas:e.slatMetas,clientWidth:e.clientWidth,minHeight:e.expandRows?e.clientHeight:"",tableMinWidth:e.tableMinWidth,tableColGroupNode:e.axis?e.tableColGroupNode:null,onCoords:this.handleSlatCoords}),(0,s.n)(I,{cells:e.cells,axis:e.axis,dateProfile:e.dateProfile,businessHourSegs:e.businessHourSegs,bgEventSegs:e.bgEventSegs,fgEventSegs:e.fgEventSegs,dateSelectionSegs:e.dateSelectionSegs,eventSelection:e.eventSelection,eventDrag:e.eventDrag,eventResize:e.eventResize,todayRange:e.todayRange,nowDate:e.nowDate,nowIndicatorSegs:e.nowIndicatorSegs,clientWidth:e.clientWidth,tableMinWidth:e.tableMinWidth,tableColGroupNode:e.tableColGroupNode,slatCoords:t.slatCoords,onColCoords:this.handleColCoords,forPrint:e.forPrint}))}componentDidMount(){this.scrollResponder=this.context.createScrollResponder(this.handleScrollRequest)}componentDidUpdate(e){this.scrollResponder.update(e.dateProfile!==this.props.dateProfile)}componentWillUnmount(){this.scrollResponder.detach()}queryHit(e,t){let{dateEnv:i,options:n}=this.context,{colCoords:s}=this,{dateProfile:o}=this.props,{slatCoords:a}=this.state,{snapDuration:l,snapsPerSlot:c}=this.processSlotOptions(this.props.slotDuration,n.snapDuration),h=s.leftToIndex(e),d=a.positions.topToIndex(t);if(null!=h&&null!=d){let e=this.props.cells[h],n=a.positions.tops[d],u=a.positions.getHeight(d),f=(t-n)/u,p=d*c+Math.floor(f*c),m=this.props.cells[h].date,g=(0,r.bn)(o.slotMinTime,(0,r.bm)(l,p)),_=i.add(m,g),y=i.add(_,l);return{dateProfile:o,dateSpan:Object.assign({range:{start:_,end:y},allDay:!1},e.extraDateSpan),dayEl:s.els[h],rect:{left:s.lefts[h],right:s.rights[h],top:n,bottom:n+u},layer:0}}return null}}function R(e,t){let i=t||e,n=(0,r.br)(e,i);return null===n&&(i=e,n=1),{snapDuration:i,snapsPerSlot:n}}class O extends r.bU{sliceRange(e,t){let i=[];for(let n=0;n(0,s.n)(P,Object.assign({ref:this.timeColsRef},this.slicer.sliceProps(e,i,null,t,l),{forPrint:e.forPrint,axis:e.axis,dateProfile:i,slatMetas:e.slatMetas,slotDuration:e.slotDuration,cells:n.cells[0],tableColGroupNode:e.tableColGroupNode,tableMinWidth:e.tableMinWidth,clientWidth:e.clientWidth,clientHeight:e.clientHeight,expandRows:e.expandRows,nowDate:r,nowIndicatorSegs:o&&this.slicer.sliceNowDate(r,i,a,t,l),todayRange:c,onScrollTopRequest:e.onScrollTopRequest,onSlatCoords:e.onSlatCoords})))}}function F(e,t,i){let n=[];for(let r of e.headerDates)n.push({start:i.add(r,t.slotMinTime),end:i.add(r,t.slotMaxTime)});return n}const N=[{hours:1},{minutes:30},{minutes:15},{seconds:30},{seconds:15}];function Y(e,t,i,n,s){let o=new Date(0),a=e,l=(0,r.d)(0),c=i||function(e){let t,i,n;for(t=N.length-1;t>=0;t-=1)if(i=(0,r.d)(N[t]),n=(0,r.br)(i,e),null!==n&&n>1)return i;return e}(n),h=[];for(;(0,r.bq)(a)<(0,r.bq)(t);){let e=s.add(o,a),t=null!==(0,r.br)(l,c);h.push({date:e,time:a,key:e.toISOString(),isoTimeStr:(0,r.bs)(e),isLabeled:t}),a=(0,r.bn)(a,n),l=(0,r.bn)(l,n)}return h}function B(e,t){let i=new r.bM(e.renderRange,t);return new r.bT(i,!1)}(0,r.ct)('.fc-v-event{background-color:var(--fc-event-bg-color);border:1px solid var(--fc-event-border-color);display:block}.fc-v-event .fc-event-main{color:var(--fc-event-text-color);height:100%}.fc-v-event .fc-event-main-frame{display:flex;flex-direction:column;height:100%}.fc-v-event .fc-event-time{flex-grow:0;flex-shrink:0;max-height:100%;overflow:hidden}.fc-v-event .fc-event-title-container{flex-grow:1;flex-shrink:1;min-height:0}.fc-v-event .fc-event-title{bottom:0;max-height:100%;overflow:hidden;top:0}.fc-v-event:not(.fc-event-start){border-top-left-radius:0;border-top-right-radius:0;border-top-width:0}.fc-v-event:not(.fc-event-end){border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom-width:0}.fc-v-event.fc-event-selected:before{left:-10px;right:-10px}.fc-v-event .fc-event-resizer-start{cursor:n-resize}.fc-v-event .fc-event-resizer-end{cursor:s-resize}.fc-v-event:not(.fc-event-selected) .fc-event-resizer{height:var(--fc-event-resizer-thickness);left:0;right:0}.fc-v-event:not(.fc-event-selected) .fc-event-resizer-start{top:calc(var(--fc-event-resizer-thickness)/-2)}.fc-v-event:not(.fc-event-selected) .fc-event-resizer-end{bottom:calc(var(--fc-event-resizer-thickness)/-2)}.fc-v-event.fc-event-selected .fc-event-resizer{left:50%;margin-left:calc(var(--fc-event-resizer-dot-total-width)/-2)}.fc-v-event.fc-event-selected .fc-event-resizer-start{top:calc(var(--fc-event-resizer-dot-total-width)/-2)}.fc-v-event.fc-event-selected .fc-event-resizer-end{bottom:calc(var(--fc-event-resizer-dot-total-width)/-2)}.fc .fc-timegrid .fc-daygrid-body{z-index:2}.fc .fc-timegrid-divider{padding:0 0 2px}.fc .fc-timegrid-body{min-height:100%;position:relative;z-index:1}.fc .fc-timegrid-axis-chunk{position:relative}.fc .fc-timegrid-axis-chunk>table,.fc .fc-timegrid-slots{position:relative;z-index:1}.fc .fc-timegrid-slot{border-bottom:0;height:1.5em}.fc .fc-timegrid-slot:empty:before{content:"\\00a0"}.fc .fc-timegrid-slot-minor{border-top-style:dotted}.fc .fc-timegrid-slot-label-cushion{display:inline-block;white-space:nowrap}.fc .fc-timegrid-slot-label{vertical-align:middle}.fc .fc-timegrid-axis-cushion,.fc .fc-timegrid-slot-label-cushion{padding:0 4px}.fc .fc-timegrid-axis-frame-liquid{height:100%}.fc .fc-timegrid-axis-frame{align-items:center;display:flex;justify-content:flex-end;overflow:hidden}.fc .fc-timegrid-axis-cushion{flex-shrink:0;max-width:60px}.fc-direction-ltr .fc-timegrid-slot-label-frame{text-align:right}.fc-direction-rtl .fc-timegrid-slot-label-frame{text-align:left}.fc-liquid-hack .fc-timegrid-axis-frame-liquid{bottom:0;height:auto;left:0;position:absolute;right:0;top:0}.fc .fc-timegrid-col.fc-day-today{background-color:var(--fc-today-bg-color)}.fc .fc-timegrid-col-frame{min-height:100%;position:relative}.fc-media-screen.fc-liquid-hack .fc-timegrid-col-frame{bottom:0;height:auto;left:0;position:absolute;right:0;top:0}.fc-media-screen .fc-timegrid-cols{bottom:0;left:0;position:absolute;right:0;top:0}.fc-media-screen .fc-timegrid-cols>table{height:100%}.fc-media-screen .fc-timegrid-col-bg,.fc-media-screen .fc-timegrid-col-events,.fc-media-screen .fc-timegrid-now-indicator-container{left:0;position:absolute;right:0;top:0}.fc .fc-timegrid-col-bg{z-index:2}.fc .fc-timegrid-col-bg .fc-non-business{z-index:1}.fc .fc-timegrid-col-bg .fc-bg-event{z-index:2}.fc .fc-timegrid-col-bg .fc-highlight{z-index:3}.fc .fc-timegrid-bg-harness{left:0;position:absolute;right:0}.fc .fc-timegrid-col-events{z-index:3}.fc .fc-timegrid-now-indicator-container{bottom:0;overflow:hidden}.fc-direction-ltr .fc-timegrid-col-events{margin:0 2.5% 0 2px}.fc-direction-rtl .fc-timegrid-col-events{margin:0 2px 0 2.5%}.fc-timegrid-event-harness{position:absolute}.fc-timegrid-event-harness>.fc-timegrid-event{bottom:0;left:0;position:absolute;right:0;top:0}.fc-timegrid-event-harness-inset .fc-timegrid-event,.fc-timegrid-event.fc-event-mirror,.fc-timegrid-more-link{box-shadow:0 0 0 1px var(--fc-page-bg-color)}.fc-timegrid-event,.fc-timegrid-more-link{border-radius:3px;font-size:var(--fc-small-font-size)}.fc-timegrid-event{margin-bottom:1px}.fc-timegrid-event .fc-event-main{padding:1px 1px 0}.fc-timegrid-event .fc-event-time{font-size:var(--fc-small-font-size);margin-bottom:1px;white-space:nowrap}.fc-timegrid-event-short .fc-event-main-frame{flex-direction:row;overflow:hidden}.fc-timegrid-event-short .fc-event-time:after{content:"\\00a0-\\00a0"}.fc-timegrid-event-short .fc-event-title{font-size:var(--fc-small-font-size)}.fc-timegrid-more-link{background:var(--fc-more-link-bg-color);color:var(--fc-more-link-text-color);cursor:pointer;margin-bottom:1px;position:absolute;z-index:9999}.fc-timegrid-more-link-inner{padding:3px 2px;top:0}.fc-direction-ltr .fc-timegrid-more-link{right:0}.fc-direction-rtl .fc-timegrid-more-link{left:0}.fc .fc-timegrid-now-indicator-arrow,.fc .fc-timegrid-now-indicator-line{pointer-events:none}.fc .fc-timegrid-now-indicator-line{border-color:var(--fc-now-indicator-color);border-style:solid;border-width:1px 0 0;left:0;position:absolute;right:0;z-index:4}.fc .fc-timegrid-now-indicator-arrow{border-color:var(--fc-now-indicator-color);border-style:solid;margin-top:-5px;position:absolute;z-index:4}.fc-direction-ltr .fc-timegrid-now-indicator-arrow{border-bottom-color:transparent;border-top-color:transparent;border-width:5px 0 5px 6px;left:0}.fc-direction-rtl .fc-timegrid-now-indicator-arrow{border-bottom-color:transparent;border-top-color:transparent;border-width:5px 6px 5px 0;right:0}');const H={allDaySlot:Boolean};var j=(0,n.i1)({name:"@fullcalendar/timegrid",initialView:"timeGridWeek",optionRefiners:H,views:{timeGrid:{component:class extends f{constructor(){super(...arguments),this.buildTimeColsModel=(0,r.z)(B),this.buildSlatMetas=(0,r.z)(Y)}render(){let{options:e,dateEnv:t,dateProfileGenerator:i}=this.context,{props:n}=this,{dateProfile:a}=n,l=this.buildTimeColsModel(a,i),c=this.allDaySplitter.splitProps(n),h=this.buildSlatMetas(a.slotMinTime,a.slotMaxTime,e.slotLabelInterval,e.slotDuration,t),{dayMinWidth:d}=e,u=!d,f=d,p=e.dayHeaders&&(0,s.n)(r.bI,{dates:l.headerDates,dateProfile:a,datesRepDistinctDays:!0,renderIntro:u?this.renderHeadAxis:null}),m=!1!==e.allDaySlot&&(t=>(0,s.n)(o.t7,Object.assign({},c.allDay,{dateProfile:a,dayTableModel:l,nextDayThreshold:e.nextDayThreshold,tableMinWidth:t.tableMinWidth,colGroupNode:t.tableColGroupNode,renderRowIntro:u?this.renderTableRowAxis:null,showWeekNumbers:!1,expandRows:!1,headerAlignElRef:this.headerElRef,clientWidth:t.clientWidth,clientHeight:t.clientHeight,forPrint:n.forPrint},this.getAllDayMaxEventProps()))),g=t=>(0,s.n)(z,Object.assign({},c.timed,{dayTableModel:l,dateProfile:a,axis:u,slotDuration:e.slotDuration,slatMetas:h,forPrint:n.forPrint,tableColGroupNode:t.tableColGroupNode,tableMinWidth:t.tableMinWidth,clientWidth:t.clientWidth,clientHeight:t.clientHeight,onSlatCoords:this.handleSlatCoords,expandRows:t.expandRows,onScrollTopRequest:this.handleScrollTopRequest}));return f?this.renderHScrollLayout(p,m,g,l.colCnt,d,h,this.state.slatCoords):this.renderSimpleLayout(p,m,g)}},usesMinMaxTime:!0,allDaySlot:!0,slotDuration:"00:30:00",slotEventOverlap:!0},timeGridDay:{type:"timeGrid",duration:{days:1}},timeGridWeek:{type:"timeGrid",duration:{weeks:1}}}})},708:function(e,t,i){!function(e){"use strict";var t=["ޖެނުއަރީ","ފެބްރުއަރީ","މާރިޗު","އޭޕްރީލު","މޭ","ޖޫން","ޖުލައި","އޯގަސްޓު","ސެޕްޓެމްބަރު","އޮކްޓޯބަރު","ނޮވެމްބަރު","ޑިސެމްބަރު"],i=["އާދިއްތަ","ހޯމަ","އަންގާރަ","ބުދަ","ބުރާސްފަތި","ހުކުރު","ހޮނިހިރު"];e.defineLocale("dv",{months:t,monthsShort:t,weekdays:i,weekdaysShort:i,weekdaysMin:"އާދި_ހޯމަ_އަން_ބުދަ_ބުރާ_ހުކު_ހޮނި".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"D/M/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},meridiemParse:/މކ|މފ/,isPM:function(e){return"މފ"===e},meridiem:function(e,t,i){return e<12?"މކ":"މފ"},calendar:{sameDay:"[މިއަދު] LT",nextDay:"[މާދަމާ] LT",nextWeek:"dddd LT",lastDay:"[އިއްޔެ] LT",lastWeek:"[ފާއިތުވި] dddd LT",sameElse:"L"},relativeTime:{future:"ތެރޭގައި %s",past:"ކުރިން %s",s:"ސިކުންތުކޮޅެއް",ss:"d% ސިކުންތު",m:"މިނިޓެއް",mm:"މިނިޓު %d",h:"ގަޑިއިރެއް",hh:"ގަޑިއިރު %d",d:"ދުވަހެއް",dd:"ދުވަސް %d",M:"މަހެއް",MM:"މަސް %d",y:"އަހަރެއް",yy:"އަހަރު %d"},preparse:function(e){return e.replace(/،/g,",")},postformat:function(e){return e.replace(/,/g,"،")},week:{dow:7,doy:12}})}(i(5093))},748:function(e,t,i){!function(e){"use strict";e.defineLocale("sw",{months:"Januari_Februari_Machi_Aprili_Mei_Juni_Julai_Agosti_Septemba_Oktoba_Novemba_Desemba".split("_"),monthsShort:"Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ago_Sep_Okt_Nov_Des".split("_"),weekdays:"Jumapili_Jumatatu_Jumanne_Jumatano_Alhamisi_Ijumaa_Jumamosi".split("_"),weekdaysShort:"Jpl_Jtat_Jnne_Jtan_Alh_Ijm_Jmos".split("_"),weekdaysMin:"J2_J3_J4_J5_Al_Ij_J1".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"hh:mm A",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[leo saa] LT",nextDay:"[kesho saa] LT",nextWeek:"[wiki ijayo] dddd [saat] LT",lastDay:"[jana] LT",lastWeek:"[wiki iliyopita] dddd [saat] LT",sameElse:"L"},relativeTime:{future:"%s baadaye",past:"tokea %s",s:"hivi punde",ss:"sekunde %d",m:"dakika moja",mm:"dakika %d",h:"saa limoja",hh:"masaa %d",d:"siku moja",dd:"siku %d",M:"mwezi mmoja",MM:"miezi %d",y:"mwaka mmoja",yy:"miaka %d"},week:{dow:1,doy:7}})}(i(5093))},793:(e,t,i)=>{"use strict";if(i.d(t,{A:()=>o}),/^(7(06|92|96)|140)$/.test(i.j))var n=i(6354);if(/^(7(06|92|96)|140)$/.test(i.j))var r=i(9760);if(/^(7(06|92|96)|140)$/.test(i.j))var s=i(222);function o(e){return(0,n.A)((0,r.A)(e)).left+(0,s.A)(e).scrollLeft}},838:function(e,t,i){!function(e){"use strict";var t="ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.".split("_"),i="ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic".split("_"),n=[/^ene/i,/^feb/i,/^mar/i,/^abr/i,/^may/i,/^jun/i,/^jul/i,/^ago/i,/^sep/i,/^oct/i,/^nov/i,/^dic/i],r=/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre|ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i;e.defineLocale("es-do",{months:"enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre".split("_"),monthsShort:function(e,n){return e?/-MMM-/.test(n)?i[e.month()]:t[e.month()]:t},monthsRegex:r,monthsShortRegex:r,monthsStrictRegex:/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i,monthsShortStrictRegex:/^(ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i,monthsParse:n,longMonthsParse:n,shortMonthsParse:n,weekdays:"domingo_lunes_martes_miércoles_jueves_viernes_sábado".split("_"),weekdaysShort:"dom._lun._mar._mié._jue._vie._sáb.".split("_"),weekdaysMin:"do_lu_ma_mi_ju_vi_sá".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY h:mm A",LLLL:"dddd, D [de] MMMM [de] YYYY h:mm A"},calendar:{sameDay:function(){return"[hoy a la"+(1!==this.hours()?"s":"")+"] LT"},nextDay:function(){return"[mañana a la"+(1!==this.hours()?"s":"")+"] LT"},nextWeek:function(){return"dddd [a la"+(1!==this.hours()?"s":"")+"] LT"},lastDay:function(){return"[ayer a la"+(1!==this.hours()?"s":"")+"] LT"},lastWeek:function(){return"[el] dddd [pasado a la"+(1!==this.hours()?"s":"")+"] LT"},sameElse:"L"},relativeTime:{future:"en %s",past:"hace %s",s:"unos segundos",ss:"%d segundos",m:"un minuto",mm:"%d minutos",h:"una hora",hh:"%d horas",d:"un día",dd:"%d días",w:"una semana",ww:"%d semanas",M:"un mes",MM:"%d meses",y:"un año",yy:"%d años"},dayOfMonthOrdinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:1,doy:4}})}(i(5093))},842:function(e){e.exports=function(){"use strict";var e,t,i;function n(n,r){if(e)if(t){var s="self.onerror = function() { console.error('An error occurred while parsing the WebWorker bundle. This is most likely due to improper transpilation by Babel; please see https://docs.mapbox.com/mapbox-gl-js/guides/install/#transpiling'); }; var sharedChunk = {}; ("+e+")(sharedChunk); ("+t+")(sharedChunk); self.onerror = null;",o={};e(o),i=r(o),"undefined"!=typeof window&&window&&window.URL&&window.URL.createObjectURL&&(i.workerUrl=window.URL.createObjectURL(new Blob([s],{type:"text/javascript"})))}else t=r;else e=r}return n(0,function(e){var t=1e-6,i="undefined"!=typeof Float32Array?Float32Array:Array;function n(e,t){var i=t[0],n=t[1],r=t[2],s=t[3],o=i*s-r*n;return o?(e[0]=s*(o=1/o),e[1]=-n*o,e[2]=-r*o,e[3]=i*o,e):null}function r(){var e=new i(9);return i!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function s(e,t){var i=t[0],n=t[1],r=t[2],s=t[3],o=t[4],a=t[5],l=t[6],c=t[7],h=t[8];return e[0]=o*h-a*c,e[1]=r*c-n*h,e[2]=n*a-r*o,e[3]=a*l-s*h,e[4]=i*h-r*l,e[5]=r*s-i*a,e[6]=s*c-o*l,e[7]=n*l-i*c,e[8]=i*o-n*s,e}function o(e,t,i){var n=t[0],r=t[1],s=t[2],o=t[3],a=t[4],l=t[5],c=t[6],h=t[7],d=t[8],u=i[0],f=i[1],p=i[2],m=i[3],g=i[4],_=i[5],y=i[6],v=i[7],x=i[8];return e[0]=u*n+f*o+p*c,e[1]=u*r+f*a+p*h,e[2]=u*s+f*l+p*d,e[3]=m*n+g*o+_*c,e[4]=m*r+g*a+_*h,e[5]=m*s+g*l+_*d,e[6]=y*n+v*o+x*c,e[7]=y*r+v*a+x*h,e[8]=y*s+v*l+x*d,e}function a(){var e=new i(16);return i!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function l(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function c(e,t){var i=t[0],n=t[1],r=t[2],s=t[3],o=t[4],a=t[5],l=t[6],c=t[7],h=t[8],d=t[9],u=t[10],f=t[11],p=t[12],m=t[13],g=t[14],_=t[15],y=i*a-n*o,v=i*l-r*o,x=i*c-s*o,b=n*l-r*a,w=n*c-s*a,S=r*c-s*l,T=h*m-d*p,k=h*g-u*p,M=h*_-f*p,A=d*g-u*m,C=d*_-f*m,D=u*_-f*g,L=y*D-v*C+x*A+b*M-w*k+S*T;return L?(e[0]=(a*D-l*C+c*A)*(L=1/L),e[1]=(r*C-n*D-s*A)*L,e[2]=(m*S-g*w+_*b)*L,e[3]=(u*w-d*S-f*b)*L,e[4]=(l*M-o*D-c*k)*L,e[5]=(i*D-r*M+s*k)*L,e[6]=(g*x-p*S-_*v)*L,e[7]=(h*S-u*x+f*v)*L,e[8]=(o*C-a*M+c*T)*L,e[9]=(n*M-i*C-s*T)*L,e[10]=(p*w-m*x+_*y)*L,e[11]=(d*x-h*w-f*y)*L,e[12]=(a*k-o*A-l*T)*L,e[13]=(i*A-n*k+r*T)*L,e[14]=(m*v-p*b-g*y)*L,e[15]=(h*b-d*v+u*y)*L,e):null}function h(e,t,i){var n=t[0],r=t[1],s=t[2],o=t[3],a=t[4],l=t[5],c=t[6],h=t[7],d=t[8],u=t[9],f=t[10],p=t[11],m=t[12],g=t[13],_=t[14],y=t[15],v=i[0],x=i[1],b=i[2],w=i[3];return e[0]=v*n+x*a+b*d+w*m,e[1]=v*r+x*l+b*u+w*g,e[2]=v*s+x*c+b*f+w*_,e[3]=v*o+x*h+b*p+w*y,e[4]=(v=i[4])*n+(x=i[5])*a+(b=i[6])*d+(w=i[7])*m,e[5]=v*r+x*l+b*u+w*g,e[6]=v*s+x*c+b*f+w*_,e[7]=v*o+x*h+b*p+w*y,e[8]=(v=i[8])*n+(x=i[9])*a+(b=i[10])*d+(w=i[11])*m,e[9]=v*r+x*l+b*u+w*g,e[10]=v*s+x*c+b*f+w*_,e[11]=v*o+x*h+b*p+w*y,e[12]=(v=i[12])*n+(x=i[13])*a+(b=i[14])*d+(w=i[15])*m,e[13]=v*r+x*l+b*u+w*g,e[14]=v*s+x*c+b*f+w*_,e[15]=v*o+x*h+b*p+w*y,e}function d(e,t,i){var n,r,s,o,a,l,c,h,d,u,f,p,m=i[0],g=i[1],_=i[2];return t===e?(e[12]=t[0]*m+t[4]*g+t[8]*_+t[12],e[13]=t[1]*m+t[5]*g+t[9]*_+t[13],e[14]=t[2]*m+t[6]*g+t[10]*_+t[14],e[15]=t[3]*m+t[7]*g+t[11]*_+t[15]):(r=t[1],s=t[2],o=t[3],a=t[4],l=t[5],c=t[6],h=t[7],d=t[8],u=t[9],f=t[10],p=t[11],e[0]=n=t[0],e[1]=r,e[2]=s,e[3]=o,e[4]=a,e[5]=l,e[6]=c,e[7]=h,e[8]=d,e[9]=u,e[10]=f,e[11]=p,e[12]=n*m+a*g+d*_+t[12],e[13]=r*m+l*g+u*_+t[13],e[14]=s*m+c*g+f*_+t[14],e[15]=o*m+h*g+p*_+t[15]),e}function u(e,t,i){var n=i[0],r=i[1],s=i[2];return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*r,e[5]=t[5]*r,e[6]=t[6]*r,e[7]=t[7]*r,e[8]=t[8]*s,e[9]=t[9]*s,e[10]=t[10]*s,e[11]=t[11]*s,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function f(e,t,i){var n=Math.sin(i),r=Math.cos(i),s=t[4],o=t[5],a=t[6],l=t[7],c=t[8],h=t[9],d=t[10],u=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=s*r+c*n,e[5]=o*r+h*n,e[6]=a*r+d*n,e[7]=l*r+u*n,e[8]=c*r-s*n,e[9]=h*r-o*n,e[10]=d*r-a*n,e[11]=u*r-l*n,e}function p(e,t,i){var n=Math.sin(i),r=Math.cos(i),s=t[0],o=t[1],a=t[2],l=t[3],c=t[8],h=t[9],d=t[10],u=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=s*r-c*n,e[1]=o*r-h*n,e[2]=a*r-d*n,e[3]=l*r-u*n,e[8]=s*n+c*r,e[9]=o*n+h*r,e[10]=a*n+d*r,e[11]=l*n+u*r,e}function m(e,t,i){var n=Math.sin(i),r=Math.cos(i),s=t[0],o=t[1],a=t[2],l=t[3],c=t[4],h=t[5],d=t[6],u=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=s*r+c*n,e[1]=o*r+h*n,e[2]=a*r+d*n,e[3]=l*r+u*n,e[4]=c*r-s*n,e[5]=h*r-o*n,e[6]=d*r-a*n,e[7]=u*r-l*n,e}function g(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function _(e,i,n){var r,s,o,a=n[0],l=n[1],c=n[2],h=Math.hypot(a,l,c);return h0&&(s=1/Math.sqrt(s)),e[0]=t[0]*s,e[1]=t[1]*s,e[2]=t[2]*s,e}function z(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function F(e,t,i){var n=t[0],r=t[1],s=t[2],o=i[0],a=i[1],l=i[2];return e[0]=r*l-s*a,e[1]=s*o-n*l,e[2]=n*a-r*o,e}function N(e,t,i,n){var r=t[0],s=t[1],o=t[2];return e[0]=r+n*(i[0]-r),e[1]=s+n*(i[1]-s),e[2]=o+n*(i[2]-o),e}function Y(e,t,i){var n=t[0],r=t[1],s=t[2],o=i[3]*n+i[7]*r+i[11]*s+i[15];return e[0]=(i[0]*n+i[4]*r+i[8]*s+i[12])/(o=o||1),e[1]=(i[1]*n+i[5]*r+i[9]*s+i[13])/o,e[2]=(i[2]*n+i[6]*r+i[10]*s+i[14])/o,e}function B(e,t,i){var n=t[0],r=t[1],s=t[2];return e[0]=n*i[0]+r*i[3]+s*i[6],e[1]=n*i[1]+r*i[4]+s*i[7],e[2]=n*i[2]+r*i[5]+s*i[8],e}function H(e,t,i){var n=i[0],r=i[1],s=i[2],o=t[0],a=t[1],l=t[2],c=r*l-s*a,h=s*o-n*l,d=n*a-r*o,u=r*d-s*h,f=s*c-n*d,p=n*h-r*c,m=2*i[3];return h*=m,d*=m,f*=2,p*=2,e[0]=o+(c*=m)+(u*=2),e[1]=a+h+f,e[2]=l+d+p,e}function j(e){return e[0]=0,e[1]=0,e[2]=0,e}function V(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}var W=M,U=A,$=w;function G(){var e=new i(4);return i!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function X(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e}function q(e,t){var i=t[0],n=t[1],r=t[2],s=t[3],o=i*i+n*n+r*r+s*s;return o>0&&(o=1/Math.sqrt(o)),e[0]=i*o,e[1]=n*o,e[2]=r*o,e[3]=s*o,e}function Z(e,t,i){var n=t[0],r=t[1],s=t[2],o=t[3];return e[0]=i[0]*n+i[4]*r+i[8]*s+i[12]*o,e[1]=i[1]*n+i[5]*r+i[9]*s+i[13]*o,e[2]=i[2]*n+i[6]*r+i[10]*s+i[14]*o,e[3]=i[3]*n+i[7]*r+i[11]*s+i[15]*o,e}function J(){var e=new i(4);return i!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function K(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function Q(e,t,i){i*=.5;var n=t[0],r=t[1],s=t[2],o=t[3],a=Math.sin(i),l=Math.cos(i);return e[0]=n*l+o*a,e[1]=r*l+s*a,e[2]=s*l-r*a,e[3]=o*l-n*a,e}function ee(e,t,i){i*=.5;var n=t[0],r=t[1],s=t[2],o=t[3],a=Math.sin(i),l=Math.cos(i);return e[0]=n*l-s*a,e[1]=r*l+o*a,e[2]=s*l+n*a,e[3]=o*l-r*a,e}x(),G();var te,ie,ne,re=q,se=(te=x(),ie=S(1,0,0),ne=S(0,1,0),function(e,t,i){var n=z(t,i);return n<-.999999?(F(te,ie,t),$(te)<1e-6&&F(te,ne,t),O(te,te),function(e,t,i){i*=.5;var n=Math.sin(i);e[0]=n*t[0],e[1]=n*t[1],e[2]=n*t[2],e[3]=Math.cos(i)}(e,te,Math.PI),e):n>.999999?(e[0]=0,e[1]=0,e[2]=0,e[3]=1,e):(F(te,t,i),e[0]=te[0],e[1]=te[1],e[2]=te[2],e[3]=1+n,re(e,e))});function oe(){var e=new i(2);return i!=Float32Array&&(e[0]=0,e[1]=0),e}function ae(e,t){var n=new i(2);return n[0]=e,n[1]=t,n}function le(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e}function ce(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e}function he(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e}function de(e){return Math.hypot(e[0],e[1])}function ue(e,t){var i=t[0],n=t[1],r=i*i+n*n;return r>0&&(r=1/Math.sqrt(r)),e[0]=t[0]*r,e[1]=t[1]*r,e}function fe(e,t){return e[0]*t[0]+e[1]*t[1]}J(),J(),r();var pe,me,ge=ce;function _e(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}oe();var ye=function(){if(me)return pe;function e(e,t,i,n){this.cx=3*e,this.bx=3*(i-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(n-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=i,this.p2y=n}return me=1,pe=e,e.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,t){if(void 0===t&&(t=1e-6),e<0)return 0;if(e>1)return 1;for(var i=e,n=0;n<8;n++){var r=this.sampleCurveX(i)-e;if(Math.abs(r)r?o=i:a=i,i=.5*(a-o)+o;return i},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}},pe}(),ve=_e(ye);function xe(e,t){this.x=e,this.y=t}function be(e,t){if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let i=0;i=1)return 1;const t=e*e,i=t*e;return 4*(e<.5?i:3*(e-t)+i-.75)}function Ce(e,t,i,n){const r=new ve(e,t,i,n);return function(e){return r.solve(e)}}const De=Ce(.25,.1,.25,1);function Le(e,t,i){return Math.min(i,Math.max(t,e))}function Ee(e,t,i){return(i=Le((i-e)/(t-e),0,1))*i*(3-2*i)}function Ie(e,t,i){const n=i-t,r=((e-t)%n+n)%n+t;return r===t?i:r}function Pe(e,t,i){if(!e.length)return i(null,[]);let n=e.length;const r=new Array(e.length);let s=null;e.forEach((e,o)=>{t(e,(e,t)=>{e&&(s=e),r[o]=t,0==--n&&i(s,r)})})}function Re(e,...t){for(const i of t)for(const t in i)e[t]=i[t];return e}let Oe=1;function ze(){return Oe++}function Fe(e){return e<=1?1:Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function Ne(e,t){e.forEach(e=>{t[e]&&(t[e]=t[e].bind(t))})}function Ye(e,t,i){const n={};for(const i in e)n[i]=t.call(this,e[i],i,e);return n}function Be(e,t,i){const n={};for(const i in e)t.call(this,e[i],i,e)&&(n[i]=e[i]);return n}function He(e){return Array.isArray(e)?e.map(He):"object"==typeof e&&e?Ye(e,He):e}function je(e,t){for(let i=0;i=0)return!0;return!1}const Ve={};function We(e){Ve[e]||("undefined"!=typeof console&&console.warn(e),Ve[e]=!0)}function Ue(e,t,i){return(i.y-e.y)*(t.x-e.x)>(t.y-e.y)*(i.x-e.x)}function $e(e){let t=0;for(let i,n,r=0,s=e.length,o=s-1;r@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(e,i,n,r)=>{const s=n||r;return t[i]=!s||s.toLowerCase(),""}),t["max-age"]){const e=parseInt(t["max-age"],10);isNaN(e)?delete t["max-age"]:t["max-age"]=e}return t}let Ze=null;function Je(e,t){return[e[4*t],e[4*t+1],e[4*t+2],e[4*t+3]]}function Ke(e,t,i,n){for(;t>1;e[r]>1;e[r]<=n?t=r+1:i=r}return t}function et(e){return e>0?1/(1.001-e):1+e}function tt(e){return e>0?1-1/(1.001-e):-e}function it(e,t,i){return(e-t.min)*(i.max-i.min)/(t.max-t.min)+i.min}const nt={API_URL:"https://api.mapbox.com",get API_URL_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i},get API_TILEJSON_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/v[0-9]*\/.*\.json.*$)/i},get API_SPRITE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*\/sprite.*\..*$)/i},get API_FONTS_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/fonts\/v[0-9]*\/)(.*\.pbf.*$)/i},get API_STYLE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*$)/i},get API_CDN_URL_REGEX(){return/^((https?:)?\/\/)?api\.mapbox\.c(n|om)(\/mapbox-gl-js\/)(.*$)/i},get EVENTS_URL(){if(!nt.API_URL)return null;try{const e=new URL(nt.API_URL);return"api.mapbox.cn"===e.hostname?"https://events.mapbox.cn/events/v2":"api.mapbox.com"===e.hostname?"https://events.mapbox.com/events/v2":null}catch(e){return null}},SESSION_PATH:"/map-sessions/v1",FEEDBACK_URL:"https://apps.mapbox.com/feedback",TILE_URL_VERSION:"v4",RASTER_URL_PREFIX:"raster/v1",RASTERARRAYS_URL_PREFIX:"rasterarrays/v1",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null,DEFAULT_STYLE:"mapbox://styles/mapbox/standard",MAX_PARALLEL_IMAGE_REQUESTS:16,DRACO_URL:"https://api.mapbox.com/mapbox-gl-js/draco_decoder_gltf_v1.5.6.wasm",MESHOPT_URL:"https://api.mapbox.com/mapbox-gl-js/meshopt_base_v0.20.wasm",MESHOPT_SIMD_URL:"https://api.mapbox.com/mapbox-gl-js/meshopt_simd_v0.20.wasm",BUILDING_GEN_URL:"https://api.mapbox.com/mapbox-gl-js/building-gen/building_gen_v1.2.1.wasm",GLYPHS_URL:"mapbox://fonts/mapbox/{fontstack}/{range}.pbf",TILES3D_URL_PREFIX:"3dtiles/v1"};function rt(e){return nt.API_URL_REGEX.test(e)}function st(e){return nt.API_SPRITE_REGEX.test(e)}let ot,at,lt,ct,ht,dt;function ut(){return null==ot&&(ot=self.OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof self.createImageBitmap),ot}const ft={now:()=>void 0!==ct?ct:performance.now(),setNow(e){ct=e},restoreNow(){ct=void 0},frame(e){const t=requestAnimationFrame(e);return{cancel:()=>cancelAnimationFrame(t)}},getImageData(e,t=0){const{width:i,height:n}=e;ht||(ht=document.createElement("canvas"));const r=ht.getContext("2d",{willReadFrequently:!0});if(!r)throw new Error("failed to create canvas 2d context");return(i>ht.width||n>ht.height)&&(ht.width=i,ht.height=n),r.clearRect(-t,-t,i+2*t,n+2*t),r.drawImage(e,0,0,i,n),r.getImageData(-t,-t,i+2*t,n+2*t)},resolveURL:e=>(at||(at=document.createElement("a")),at.href=e,at.href),get devicePixelRatio(){return window.devicePixelRatio},get prefersReducedMotion(){return!!window.matchMedia&&(null==lt&&(lt=window.matchMedia("(prefers-reduced-motion: reduce)")),lt.matches)},hasCanvasFingerprintNoise(){if(void 0!==dt)return dt;if(!ut())return dt=!1,!1;const e=new OffscreenCanvas(85,1),t=e.getContext("2d",{willReadFrequently:!0});let i=0;for(let n=0;n0?`?${s}`:""}`}const gt="mapbox-tiles";let _t=500,yt=50;const vt=["language","worldview","jobid"];let xt,bt;function wt(){try{return caches}catch(e){}}function St(){const e=wt();e&&null==xt&&(xt=e.open(gt))}let Tt=1/0;const kt={supported:!1,testSupport:function(e){!Ct&&At&&(Dt?Et(e):Mt=e)}};let Mt,At,Ct=!1,Dt=!1;const Lt="undefined"!=typeof self?self:{};function Et(e){const t=e.createTexture();e.bindTexture(e.TEXTURE_2D,t);try{if(e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,At),e.isContextLost())return;kt.supported=!0}catch(e){}e.deleteTexture(t),Ct=!0}Lt.document&&(At=Lt.document.createElement("img"),At.onload=function(){Mt&&Et(Mt),Mt=null,Dt=!0},At.onerror=function(){Ct=!0,Mt=null},At.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const It={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Iconset:"Iconset",Image:"Image",Model:"Model"};"function"==typeof Object.freeze&&Object.freeze(It);class Pt extends Error{constructor(e,t,i){401===t&&rt(i)&&(e+=": you may have provided an invalid Mapbox access token. See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes"),super(e),this.status=t,this.url=i}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}const Rt=Xe()?()=>self.worker.referrer:()=>("blob:"===location.protocol?parent:self).location.href,Ot=function(e,t){if(!(/^file:/.test(i=e.url)||/^file:/.test(Rt())&&!/^\w+:/.test(i))){if(self.fetch&&self.Request&&self.AbortController&&Request.prototype.hasOwnProperty("signal"))return function(e,t){const i=new AbortController,n=new Request(e.url,{method:e.method||"GET",body:e.body,credentials:e.credentials,headers:e.headers,referrer:Rt(),referrerPolicy:e.referrerPolicy,signal:i.signal});let r=!1,s=!1;const o=(a=n.url).indexOf("sku=")>0&&rt(a);var a;"json"===e.type&&n.headers.set("Accept","application/json");const l=(i,r,a)=>{if(s)return;if(i&&"SecurityError"!==i.message&&We(i.toString()),r&&a)return c(r);const l=Date.now();fetch(n).then(i=>{if(i.ok){const e=o?i.clone():null;return c(i,e,l)}return t(new Pt(i.statusText,i.status,e.url))}).catch(i=>{"AbortError"!==i.name&&t(new Error(`${i.message} ${e.url}`))})},c=(i,o,a)=>{("arrayBuffer"===e.type?i.arrayBuffer():"json"===e.type?i.json():i.text()).then(e=>{s||(o&&a&&function(e,t,i){if(St(),null==xt)return;const n=qe(t.headers.get("Cache-Control")||"");if(n["no-store"])return;const r={status:t.status,statusText:t.statusText,headers:new Headers};t.headers.forEach((e,t)=>r.headers.set(t,e)),n["max-age"]&&r.headers.set("Expires",new Date(i+1e3*n["max-age"]).toUTCString());const s=r.headers.get("Expires");if(!s)return;if(new Date(s).getTime()-i<42e4)return;let o=mt(e.url,{persistentParams:vt});if(206===t.status){const t=e.headers.get("Range");if(!t)return;r.status=200,o=pt(o,{range:t})}!function(e,t){if(void 0===bt)try{new Response(new ReadableStream),bt=!0}catch(e){bt=!1}bt?t(e.body):e.blob().then(t).catch(e=>We(e.message))}(t,e=>{const i=new Response(200!==(n=t.status)&&404!==n&&[101,103,204,205,304].includes(n)?null:e,r);var n;St(),null!=xt&&xt.then(e=>e.put(o,i)).catch(e=>We(e.message))})}(n,o,a),r=!0,t(null,e,i.headers.get("Cache-Control"),i.headers.get("Expires")))}).catch(e=>{s||t(new Error(e.message))})};return o?function(e,t){if(St(),null==xt)return t(null);xt.then(i=>{let n=mt(e.url,{persistentParams:vt});const r=e.headers.get("Range");r&&(n=pt(n,{range:r})),i.match(n).then(e=>{const r=function(e){if(!e)return!1;const t=new Date(e.headers.get("Expires")||0),i=qe(e.headers.get("Cache-Control")||"");return Number(t)>Date.now()&&!i["no-cache"]}(e);i.delete(n).catch(t),r&&i.put(n,e.clone()).catch(t),t(null,e,r)}).catch(t)}).catch(t)}(n,l):l(null,null),{cancel:()=>{s=!0,r||i.abort()}}}(e,t);if(Xe(self)&&self.worker.actor)return self.worker.actor.send("getResource",e,t,void 0,!0)}var i;return function(e,t){const i=new XMLHttpRequest;i.open(e.method||"GET",e.url,!0),"arrayBuffer"===e.type&&(i.responseType="arraybuffer");for(const t in e.headers)i.setRequestHeader(t,e.headers[t]);return"json"===e.type&&(i.responseType="text",i.setRequestHeader("Accept","application/json")),i.withCredentials="include"===e.credentials,i.onerror=()=>{t(new Error(i.statusText))},i.onload=()=>{if((i.status>=200&&i.status<300||0===i.status)&&null!==i.response){let n=i.response;if("json"===e.type)try{n=JSON.parse(i.response)}catch(e){return t(e)}t(null,n,i.getResponseHeader("Cache-Control"),i.getResponseHeader("Expires"))}else t(new Pt(i.statusText,i.status,e.url))},i.send(e.body),{cancel:()=>i.abort()}}(e,t)},zt=function(e,t){return Ot(Re(e,{type:"arrayBuffer"}),t)};function Ft(e){const t=document.createElement("a");return t.href=e,t.protocol===location.protocol&&t.host===location.host}const Nt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let Yt,Bt;Yt=[],Bt=0;const Ht=function(e,t){if(kt.supported&&(e.headers||(e.headers={}),e.headers.accept="image/webp,*/*"),Bt>=nt.MAX_PARALLEL_IMAGE_REQUESTS){const i={requestParameters:e,callback:t,cancelled:!1,cancel(){this.cancelled=!0}};return Yt.push(i),i}Bt++;let i=!1;const n=()=>{if(!i)for(i=!0,Bt--;Yt.length&&Bt{n(),e?t(e):i&&(self.createImageBitmap?function(e,t){const i=new Blob([new Uint8Array(e)],{type:"image/png"});createImageBitmap(i).then(e=>{t(null,e)}).catch(e=>{t(new Error(`Could not load image because of ${e.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(i,(e,i)=>t(e,i,r,s)):function(e,t){const i=new Image;i.onload=()=>{t(null,i),URL.revokeObjectURL(i.src),i.onload=null,requestAnimationFrame(()=>{i.src=Nt})},i.onerror=()=>t(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const n=new Blob([new Uint8Array(e)],{type:"image/png"});i.src=e.byteLength?URL.createObjectURL(n):Nt}(i,(e,i)=>t(e,i,r,s)))});return{cancel:()=>{r.cancel(),n()}}};var jt,Vt,Wt,Ut={exports:{}},$t={exports:{}},Gt={exports:{}},Xt=function(){if(Wt)return Ut.exports;Wt=1;var e=(jt||(jt=1,$t.exports=function(e,t){var i,n,r,s,o,a,l,c;for(n=e.length-(i=3&e.length),r=t,o=3432918353,a=461845907,c=0;c>>16)*o&65535)<<16)&4294967295)<<15|l>>>17))*a+(((l>>>16)*a&65535)<<16)&4294967295)<<13|r>>>19))+((5*(r>>>16)&65535)<<16)&4294967295))+((58964+(s>>>16)&65535)<<16);switch(l=0,i){case 3:l^=(255&e.charCodeAt(c+2))<<16;case 2:l^=(255&e.charCodeAt(c+1))<<8;case 1:r^=l=(65535&(l=(l=(65535&(l^=255&e.charCodeAt(c)))*o+(((l>>>16)*o&65535)<<16)&4294967295)<<15|l>>>17))*a+(((l>>>16)*a&65535)<<16)&4294967295}return r^=e.length,r=2246822507*(65535&(r^=r>>>16))+((2246822507*(r>>>16)&65535)<<16)&4294967295,r=3266489909*(65535&(r^=r>>>13))+((3266489909*(r>>>16)&65535)<<16)&4294967295,(r^=r>>>16)>>>0}),$t.exports),t=(Vt||(Vt=1,Gt.exports=function(e,t){for(var i,n=e.length,r=t^n,s=0;n>=4;)i=1540483477*(65535&(i=255&e.charCodeAt(s)|(255&e.charCodeAt(++s))<<8|(255&e.charCodeAt(++s))<<16|(255&e.charCodeAt(++s))<<24))+((1540483477*(i>>>16)&65535)<<16),r=1540483477*(65535&r)+((1540483477*(r>>>16)&65535)<<16)^(i=1540483477*(65535&(i^=i>>>24))+((1540483477*(i>>>16)&65535)<<16)),n-=4,++s;switch(n){case 3:r^=(255&e.charCodeAt(s+2))<<16;case 2:r^=(255&e.charCodeAt(s+1))<<8;case 1:r=1540483477*(65535&(r^=255&e.charCodeAt(s)))+((1540483477*(r>>>16)&65535)<<16)}return r=1540483477*(65535&(r^=r>>>13))+((1540483477*(r>>>16)&65535)<<16),(r^=r>>>15)>>>0}),Gt.exports);return Ut.exports=e,Ut.exports.murmur3=e,Ut.exports.murmur2=t,Ut.exports}(),qt=_e(Xt);class Zt{constructor(e,...t){Re(this,t[0]||{}),this.type=e}}class Jt extends Zt{constructor(e,t={}){super("error",Re({error:e},t))}}function Kt(e,t,i){i[e]&&-1!==i[e].indexOf(t)||(i[e]=i[e]||[],i[e].push(t))}function Qt(e,t,i){if(i&&i[e]){const n=i[e].indexOf(t);-1!==n&&i[e].splice(n,1)}}class ei{on(e,t){return this._listeners=this._listeners||{},Kt(e,t,this._listeners),this}off(e,t){return Qt(e,t,this._listeners),Qt(e,t,this._oneTimeListeners),this}once(e,t){return t?(this._oneTimeListeners=this._oneTimeListeners||{},Kt(e,t,this._oneTimeListeners),this):new Promise(t=>{this.once(e,t)})}fire(e,t){const i="string"==typeof e?new Zt(e,t):e,n=i.type;if(this.listens(n)){i.target=this;const e=this._listeners&&this._listeners[n]?this._listeners[n].slice():[];for(const t of e)t.call(this,i);const t=this._oneTimeListeners&&this._oneTimeListeners[n]?this._oneTimeListeners[n].slice():[];for(const e of t)Qt(n,e,this._oneTimeListeners),e.call(this,i);const r=this._eventedParent;r&&(Re(i,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),r.fire(i))}else i instanceof Jt&&console.error(i.error);return this}listens(e){return!!(this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e))}setEventedParent(e,t){return this._eventedParent=e,this._eventedParentData=t,this}}class ti{constructor(e){"string"==typeof e?this.name=e:(this.name=e.name,this.iconsetId=e.iconsetId)}static from(e){return new ti(e)}static toString(e){return e.iconsetId?`${e.name}${e.iconsetId}`:e.name}static parse(e){const[t,i]=e.split("");return new ti({name:t,iconsetId:i})}static isEqual(e,t){return e.name===t.name&&e.iconsetId===t.iconsetId}toString(){return ti.toString(this)}serialize(){return{name:this.name,iconsetId:this.iconsetId}}}var ii,ni={},ri=function(){if(ii)return ni;ii=1;var e={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 t(e){return(e=Math.round(e))<0?0:e>255?255:e}function i(e){return t("%"===e[e.length-1]?parseFloat(e)/100*255:parseInt(e))}function n(e){return(t="%"===e[e.length-1]?parseFloat(e)/100:parseFloat(e))<0?0:t>1?1:t;var t}function r(e,t,i){return i<0?i+=1:i>1&&(i-=1),6*i<1?e+(t-e)*i*6:2*i<1?t:3*i<2?e+(t-e)*(2/3-i)*6:e}try{ni.parseCSSColor=function(s){var o,a=s.replace(/ /g,"").toLowerCase();if(a in e)return e[a].slice();if("#"===a[0])return 4===a.length?(o=parseInt(a.substr(1),16))>=0&&o<=4095?[(3840&o)>>4|(3840&o)>>8,240&o|(240&o)>>4,15&o|(15&o)<<4,1]:null:7===a.length&&(o=parseInt(a.substr(1),16))>=0&&o<=16777215?[(16711680&o)>>16,(65280&o)>>8,255&o,1]:null;var l=a.indexOf("("),c=a.indexOf(")");if(-1!==l&&c+1===a.length){var h=a.substr(0,l),d=a.substr(l+1,c-(l+1)).split(","),u=1;switch(h){case"rgba":if(4!==d.length)return null;u=n(d.pop());case"rgb":return 3!==d.length?null:[i(d[0]),i(d[1]),i(d[2]),u];case"hsla":if(4!==d.length)return null;u=n(d.pop());case"hsl":if(3!==d.length)return null;var f=(parseFloat(d[0])%360+360)%360/360,p=n(d[1]),m=n(d[2]),g=m<=.5?m*(p+1):m+p-m*p,_=2*m-g;return[t(255*r(_,g,f+1/3)),t(255*r(_,g,f)),t(255*r(_,g,f-1/3)),u];default:return null}}return null}}catch(e){}return ni}();class si{constructor(e,t,i,n=1){this.r=e,this.g=t,this.b=i,this.a=n}static parse(e){if(!e)return;if(e instanceof si)return e;if("string"!=typeof e)return;const t=ri.parseCSSColor(e);return t?new si(t[0]/255,t[1]/255,t[2]/255,t[3]):void 0}toString(){const[e,t,i,n]=[this.r,this.g,this.b,this.a];return`rgba(${Math.round(255*e)},${Math.round(255*t)},${Math.round(255*i)},${n})`}toNonPremultipliedRenderColor(e){const{r:t,g:i,b:n,a:r}=this;return new ai(e,t,i,n,r)}toPremultipliedRenderColor(e){const{r:t,g:i,b:n,a:r}=this;return new li(e,t*r,i*r,n*r,r)}clone(){return new si(this.r,this.g,this.b,this.a)}}class oi{constructor(e,t,i,n,r,s=!1){if(this.premultiplied=!1,this.premultiplied=s,e){const s=e.image.height,o=s*s;this.premultiplied?(t=0===r?0:t/r*(s-1),i=0===r?0:i/r*(s-1),n=0===r?0:n/r*(s-1)):(t*=s-1,i*=s-1,n*=s-1);const a=Math.floor(t),l=Math.floor(i),c=Math.floor(n),h=Math.ceil(t),d=Math.ceil(i),u=Math.ceil(n),f=t-a,p=i-l,m=n-c,g=e.image.data,_=4*(a+l*o+c*s),y=4*(a+l*o+u*s),v=4*(a+d*o+c*s),x=4*(a+d*o+u*s),b=4*(h+l*o+c*s),w=4*(h+l*o+u*s),S=4*(h+d*o+c*s),T=4*(h+d*o+u*s);if(_<0||T>=g.length)throw new Error("out of range");this.r=ci(ci(ci(g[_],g[y],m),ci(g[v],g[x],m),p),ci(ci(g[b],g[w],m),ci(g[S],g[T],m),p),f)/255*(this.premultiplied?r:1),this.g=ci(ci(ci(g[_+1],g[y+1],m),ci(g[v+1],g[x+1],m),p),ci(ci(g[b+1],g[w+1],m),ci(g[S+1],g[T+1],m),p),f)/255*(this.premultiplied?r:1),this.b=ci(ci(ci(g[_+2],g[y+2],m),ci(g[v+2],g[x+2],m),p),ci(ci(g[b+2],g[w+2],m),ci(g[S+2],g[T+2],m),p),f)/255*(this.premultiplied?r:1),this.a=r}else this.r=t,this.g=i,this.b=n,this.a=r}toArray(){const{r:e,g:t,b:i,a:n}=this;return[255*e,255*t,255*i,n]}toHslaArray(){let{r:e,g:t,b:i,a:n}=this;if(this.premultiplied){if(0===n)return[0,0,0,0];e/=n,t/=n,i/=n}const r=Math.min(Math.max(e,0),1),s=Math.min(Math.max(t,0),1),o=Math.min(Math.max(i,0),1),a=Math.min(r,s,o),l=Math.max(r,s,o),c=(a+l)/2;if(a===l)return[0,0,100*c,n];const h=l-a,d=c>.5?h/(2-l-a):h/(l+a);let u=0;return l===r?u=(s-o)/h+(sci(e,t[n],i))}si.black=new si(0,0,0,1),si.white=new si(1,1,1,1),si.transparent=new si(0,0,0,0),si.red=new si(1,0,0,1),si.blue=new si(0,0,1,1);var di=Object.freeze({__proto__:null,array:hi,color:function(e,t,i){return new si(ci(e.r,t.r,i),ci(e.g,t.g,i),ci(e.b,t.b,i),ci(e.a,t.a,i))},number:ci});function ui(e,...t){for(const i of t)for(const t in i)e[t]=i[t];return e}class fi extends Error{constructor(e,t){super(t),this.message=t,this.key=e}}class pi{constructor(e,t=[]){this.parent=e,this.bindings={};for(const[e,i]of t)this.bindings[e]=i}concat(e){return new pi(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}const mi={kind:"null"},gi={kind:"number"},_i={kind:"string"},yi={kind:"boolean"},vi={kind:"color"},xi={kind:"object"},bi={kind:"value"},wi={kind:"collator"},Si={kind:"formatted"},Ti={kind:"resolvedImage"};function ki(e,t){return{kind:"array",itemType:e,N:t}}function Mi(e){if("array"===e.kind){const t=Mi(e.itemType);return"number"==typeof e.N?`array<${t}, ${e.N}>`:"value"===e.itemType.kind?"array":`array<${t}>`}return e.kind}const Ai=[mi,gi,_i,yi,vi,Si,xi,ki(bi),Ti];function Ci(e,t){if("error"===t.kind)return null;if("array"===e.kind){if("array"===t.kind&&(0===t.N&&"value"===t.itemType.kind||!Ci(e.itemType,t.itemType))&&("number"!=typeof e.N||e.N===t.N))return null}else{if(e.kind===t.kind)return null;if("value"===e.kind)for(const e of Ai)if(!Ci(e,t))return null}return`Expected ${Mi(e)} but found ${Mi(t)} instead.`}function Di(e,t){return t.some(t=>t.kind===e.kind)}function Li(e,t){return t.some(t=>"null"===t?null===e:"array"===t?Array.isArray(e):"object"===t?e&&!Array.isArray(e)&&"object"==typeof e:t===typeof e)}function Ei(e,t){return"array"===e.kind&&"array"===t.kind?e.N===t.N&&Ei(e.itemType,t.itemType):e.kind===t.kind}class Ii{constructor(e,t,i){this.sensitivity=e?t?"variant":"case":t?"accent":"base",this.locale=i,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,t){return this.collator.compare(e,t)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Pi{constructor(e,t,i,n,r){this.text=e.normalize?e.normalize():e,this.image=t,this.scale=i,this.fontStack=n,this.textColor=r}}class Ri{constructor(e){this.sections=e}static fromString(e){return new Ri([new Pi(e,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some(e=>0!==e.text.length||!!e.image&&e.image.hasPrimary())}static factory(e){return e instanceof Ri?e:Ri.fromString(e)}toString(){return 0===this.sections.length?"":this.sections.map(e=>e.text).join("")}serialize(){const e=["format"];for(const t of this.sections){if(t.image){const i=t.image.getPrimary().id.toString();e.push(["image",i]);continue}e.push(t.text);const i={};t.fontStack&&(i["text-font"]=["literal",t.fontStack.split(",")]),t.scale&&(i["font-scale"]=t.scale),t.textColor&&(i["text-color"]=["rgba"].concat(t.textColor.toNonPremultipliedRenderColor(null).toArray())),e.push(i)}return e}}class Oi{constructor(e,t={}){if(this.id=ti.from(e),this.options=Object.assign({},t),t.transform){const{a:e,b:i,c:n,d:r,e:s,f:o}=t.transform;this.options.transform=new DOMMatrix([e,i,n,r,s,o])}else this.options.transform=new DOMMatrix([1,0,0,1,0,0])}toString(){const{a:e,b:t,c:i,d:n,e:r,f:s}=this.options.transform;return JSON.stringify({name:this.id.name,iconsetId:this.id.iconsetId,params:this.options.params,transform:{a:e,b:t,c:i,d:n,e:r,f:s}})}static parse(e){let t,i,n,r;try{({name:t,iconsetId:i,params:n,transform:r}=JSON.parse(e)||{})}catch(e){return null}if(!t)return null;const{a:s,b:o,c:a,d:l,e:c,f:h}=r||{};return new Oi({name:t,iconsetId:i},{params:n,transform:new DOMMatrix([s,o,a,l,c,h])})}scaleSelf(e,t){return this.options.transform.scaleSelf(e,t),this}}class zi{constructor(e,t,i,n,r=!1){this.primaryId=ti.from(e),this.primaryOptions=t,i&&(this.secondaryId=ti.from(i)),this.secondaryOptions=n,this.available=r}toString(){return this.primaryId&&this.secondaryId?`[${this.primaryId.name},${this.secondaryId.name}]`:this.primaryId.name}hasPrimary(){return!!this.primaryId}getPrimary(){return new Oi(this.primaryId,this.primaryOptions)}hasSecondary(){return!!this.secondaryId}getSecondary(){return this.secondaryId?new Oi(this.secondaryId,this.secondaryOptions):null}static from(e){return"string"==typeof e?zi.build({name:e}):e}static build(e,t,i,n){return!e||"object"==typeof e&&!("name"in e)?null:new zi(e,i,t,n)}}function Fi(e,t,i,n){return"number"==typeof e&&e>=0&&e<=255&&"number"==typeof t&&t>=0&&t<=255&&"number"==typeof i&&i>=0&&i<=255?void 0===n||"number"==typeof n&&n>=0&&n<=1?null:`Invalid rgba value [${[e,t,i,n].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof n?[e,t,i,n]:[e,t,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Ni(e){if(null===e)return!0;if("string"==typeof e)return!0;if("boolean"==typeof e)return!0;if("number"==typeof e)return!0;if(e instanceof si)return!0;if(e instanceof Ii)return!0;if(e instanceof Ri)return!0;if(e instanceof zi)return!0;if(Array.isArray(e)){for(const t of e)if(!Ni(t))return!1;return!0}if("object"==typeof e){for(const t in e)if(!Ni(e[t]))return!1;return!0}return!1}function Yi(e){if(null===e)return mi;if("string"==typeof e)return _i;if("boolean"==typeof e)return yi;if("number"==typeof e)return gi;if(e instanceof si)return vi;if(e instanceof Ii)return wi;if(e instanceof Ri)return Si;if(e instanceof zi)return Ti;if(Array.isArray(e)){const t=e.length;let i;for(const t of e){const e=Yi(t);if(i){if(i===e)continue;i=bi;break}i=e}return ki(i||bi,t)}return xi}function Bi(e){const t=typeof e;return null===e?"":"string"===t||"number"===t||"boolean"===t?String(e):e instanceof Ri||e instanceof zi||e instanceof si?e.toString():JSON.stringify(e)}class Hi{constructor(e,t){this.type=e,this.value=t}static parse(e,t){if(2!==e.length)return t.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!Ni(e[1]))return t.error("invalid value");const i=e[1];let n=Yi(i);const r=t.expectedType;return"array"!==n.kind||0!==n.N||!r||"array"!==r.kind||"number"==typeof r.N&&0!==r.N||(n=r),new Hi(n,i)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return"array"===this.type.kind||"object"===this.type.kind?["literal",this.value]:this.value instanceof si?["rgba"].concat(this.value.toNonPremultipliedRenderColor(null).toArray()):this.value instanceof Ri?this.value.serialize():this.value}}class ji{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const Vi={string:_i,number:gi,boolean:yi,object:xi};class Wi{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let i,n=1;const r=e[0];if("array"===r){let r,s;if(e.length>2){const i=e[1];if("string"!=typeof i||!(i in Vi)||"object"===i)return t.error('The item type argument of "array" must be one of string, number, boolean',1);r=Vi[i],n++}else r=bi;if(e.length>3){if(null!==e[2]&&("number"!=typeof e[2]||e[2]<0||e[2]!==Math.floor(e[2])))return t.error('The length argument to "array" must be a positive integer literal',2);s=e[2],n++}i=ki(r,s)}else i=Vi[r];const s=[];for(;ne.outputDefined())}serialize(){const e=this.type,t=[e.kind];if("array"===e.kind){const i=e.itemType;if("string"===i.kind||"number"===i.kind||"boolean"===i.kind){t.push(i.kind);const n=e.N;("number"==typeof n||this.args.length>1)&&t.push(n)}}return t.concat(this.args.map(e=>e.serialize()))}}class Ui{constructor(e){this.type=Si,this.sections=e}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const i=e[1];if(!Array.isArray(i)&&"object"==typeof i)return t.error("First argument must be an image or text section.");const n=[];let r=!1;for(let i=1;i<=e.length-1;++i){const s=e[i];if(r&&"object"==typeof s&&!Array.isArray(s)){r=!1;let e=null;if(s["font-scale"]&&(e=t.parseObjectValue(s["font-scale"],i,"font-scale",gi),!e))return null;let o=null;if(s["text-font"]&&(o=t.parseObjectValue(s["text-font"],i,"text-font",ki(_i)),!o))return null;let a=null;if(s["text-color"]&&(a=t.parseObjectValue(s["text-color"],i,"text-color",vi),!a))return null;const l=n[n.length-1];l.scale=e,l.font=o,l.textColor=a}else{const s=t.parse(e[i],i,bi);if(!s)return null;const o=s.type.kind;if("string"!==o&&"value"!==o&&"null"!==o&&"resolvedImage"!==o)return t.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");r=!0,n.push({content:s,scale:null,font:null,textColor:null})}}return new Ui(n)}evaluate(e){return new Ri(this.sections.map(t=>{const i=t.content.evaluate(e);return Ei(Yi(i),Ti)?new Pi("",i,null,null,null):new Pi(Bi(i),null,t.scale?t.scale.evaluate(e):null,t.font?t.font.evaluate(e).join(","):null,t.textColor?t.textColor.evaluate(e):null)}))}eachChild(e){for(const t of this.sections)e(t.content),t.scale&&e(t.scale),t.font&&e(t.font),t.textColor&&e(t.textColor)}outputDefined(){return!1}serialize(){const e=["format"];for(const t of this.sections){e.push(t.content.serialize());const i={};t.scale&&(i["font-scale"]=t.scale.serialize()),t.font&&(i["text-font"]=t.font.serialize()),t.textColor&&(i["text-color"]=t.textColor.serialize()),e.push(i)}return e}}class $i{constructor(e,t,i,n){this._imageWarnHistory={},this.type=Ti,this.namePrimary=e,this.nameSecondary=t,i&&(this.paramsPrimary=i.params,this.iconsetIdPrimary=i.iconset?i.iconset.id:void 0),n&&(this.paramsSecondary=n.params,this.iconsetIdSecondary=n.iconset?n.iconset.id:void 0)}static parse(e,t){if(e.length<2)return t.error("Expected two or more arguments.");let i=1;const n=[];function r(){if(iti.isEqual(e,t)),n.available){const t=n.getSecondary()?n.getSecondary().id:null;t&&(n.available=e.availableImages.some(e=>ti.isEqual(e,t)))}}return n}eachChild(e){if(e(this.namePrimary),this.paramsPrimary)for(const t in this.paramsPrimary)this.paramsPrimary[t]&&e(this.paramsPrimary[t]);if(this.nameSecondary&&(e(this.nameSecondary),this.paramsSecondary))for(const t in this.paramsSecondary)this.paramsSecondary[t]&&e(this.paramsSecondary[t])}outputDefined(){return!1}serializeOptions(e,t){const i={};if(t&&(i.iconset={id:t}),e){i.params={};for(const t in e)e[t]&&(i.params[t]=e[t].serialize())}return Object.keys(i).length>0?i:void 0}serialize(){const e=["image",this.namePrimary.serialize()];if(this.paramsPrimary||this.iconsetIdPrimary){const t=this.serializeOptions(this.paramsPrimary,this.iconsetIdPrimary);t&&e.push(t)}if(this.nameSecondary&&(e.push(this.nameSecondary.serialize()),this.paramsSecondary||this.iconsetIdSecondary)){const t=this.serializeOptions(this.paramsSecondary,this.iconsetIdSecondary);t&&e.push(t)}return e}}function Gi(e){return e instanceof Number?"number":e instanceof String?"string":e instanceof Boolean?"boolean":Array.isArray(e)?"array":null===e?"null":typeof e}const Xi={"to-boolean":yi,"to-color":vi,"to-number":gi,"to-string":_i};class qi{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const i=e[0],n=[];let r=mi;if("to-array"===i){if(!Array.isArray(e[1]))return null;const i=e[1].length;if(t.expectedType){if("array"!==t.expectedType.kind)return t.error(`Expected ${t.expectedType.kind} but found array.`);r=ki(t.expectedType.itemType,i)}else{if(!(i>0&&Ni(e[1][0])))return null;r=ki(Yi(e[1][0]),i)}for(let s=0;s4?`Invalid rbga value ${JSON.stringify(t)}: expected an array containing either three or four numeric values.`:Fi(t[0],t[1],t[2],t[3]),!i))return new si(t[0]/255,t[1]/255,t[2]/255,t[3])}throw new ji(i||`Could not parse color from value '${"string"==typeof t?t:String(JSON.stringify(t))}'`)}if("number"===this.type.kind){let t=null;for(const i of this.args){if(t=i.evaluate(e),null===t)return 0;const n=Number(t);if(!isNaN(n))return n}throw new ji(`Could not convert ${JSON.stringify(t)} to number.`)}return"formatted"===this.type.kind?Ri.fromString(Bi(this.args[0].evaluate(e))):"resolvedImage"===this.type.kind?zi.build(Bi(this.args[0].evaluate(e))):"array"===this.type.kind?this.args.map(t=>t.evaluate(e)):Bi(this.args[0].evaluate(e))}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){if("formatted"===this.type.kind)return new Ui([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if("resolvedImage"===this.type.kind)return new $i(this.args[0]).serialize();const e="array"===this.type.kind?[]:[`to-${this.type.kind}`];return this.eachChild(t=>{e.push(t.serialize())}),e}}const Zi=["Unknown","Point","LineString","Polygon"];class Ji{constructor(e,t){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null,this.scope=e,this.options=t}id(){return this.feature&&void 0!==this.feature.id?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?Zi[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||{}}measureLight(e){return this.globals.brightness||0}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){const e=this.featureDistanceData.center,t=this.featureDistanceData.scale,{x:i,y:n}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(i*t-e[0])+this.featureDistanceData.bearing[1]*(n*t-e[1])}return 0}parseColor(e){let t=this._parseColorCache[e];return t||(t=this._parseColorCache[e]=si.parse(e)),t}getConfig(e){return this.options?this.options.get(e):null}}class Ki{constructor(e,t,i,n,r){this.name=e,this.type=t,this._evaluate=i,this.args=n,this._overloadIndex=r}evaluate(e){if(!this._evaluate){const e=Ki.definitions[this.name];this._evaluate=Array.isArray(e)?e[2]:e.overloads[this._overloadIndex][1]}return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map(e=>e.serialize()))}static parse(e,t){const i=e[0],n=Ki.definitions[i];if(!n)return t.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0);const r=Array.isArray(n)?n[0]:n.type,s=Array.isArray(n)?[[n[1],n[2]]]:n.overloads,o=[];let a=null,l=-1;for(const[n,c]of s){if(Array.isArray(n)&&n.length!==e.length-1)continue;o.push(n),l++,a=new yr(t.registry,t.path,null,t.scope,void 0,t._scope,t.options);const s=[];let h=!1;for(let t=1;te)).map(Qi).join(" | "),n=[];for(let i=1;ii;){if(n-i>600){const s=n-i+1,o=t-i+1,a=Math.log(s),l=.5*Math.exp(2*a/3),c=.5*Math.sqrt(a*l*(s-l)/s)*(o-s/2<0?-1:1);tn(e,t,Math.max(i,Math.floor(t-o*l/s+c)),Math.min(n,Math.floor(t+(s-o)*l/s+c)),r)}const s=e[t];let o=i,a=n;for(nn(e,i,t),r(e[n],s)>0&&nn(e,i,n);o0;)a--}0===r(e[i],s)?nn(e,i,a):(a++,nn(e,a,n)),a<=t&&(i=a+1),t<=a&&(n=a-1)}}function nn(e,t,i){const n=e[t];e[t]=e[i],e[i]=n}function rn(e,t){return et?1:0}function sn(e){let t=0;for(let i,n,r=0,s=e.length,o=s-1;r=t[2]||e[1]<=t[1]||e[3]>=t[3])}function ln(e,t,i){const n=e[0]-t[0],r=e[1]-t[1],s=e[0]-i[0],o=e[1]-i[1];return n*o-s*r==0&&n*s<=0&&r*o<=0}function cn(e,t,i=!1){let n=!1;for(let a=0,l=t.length;a(r=e)[1]!=(o=h)[1]>r[1]&&r[0]<(o[0]-s[0])*(r[1]-s[1])/(o[1]-s[1])+s[0]&&(n=!n)}}var r,s,o;return n}function hn(e,t,i,n){const r=n[0]-i[0],s=n[1]-i[1],o=(e[0]-i[0])*s-r*(e[1]-i[1]),a=(t[0]-i[0])*s-r*(t[1]-i[1]);return o>0&&a<0||o<0&&a>0}function dn(e,t,i,n){return 0!=(r=[n[0]-i[0],n[1]-i[1]])[0]*(s=[t[0]-e[0],t[1]-e[1]])[1]-r[1]*s[0]&&!(!hn(e,t,i,n)||!hn(i,n,e,t));var r,s}function un(e){const t=new xe(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),i=new xe(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);for(const n of e[0])t.x>n.x&&(t.x=n.x),t.y>n.y&&(t.y=n.y),i.xi[2]){const t=.5*n;let r=e[0]-i[0]>t?-n:i[0]-e[0]>t?n:0;0===r&&(r=e[0]-i[2]>t?-n:i[2]-e[0]>t?n:0),e[0]+=r}on(t,e)}function wn(e,t,i,n){const r=Math.pow(2,n.z)*fn,s=[n.x*fn,n.y*fn],o=[];if(!e)return o;for(const n of e)for(const e of n){const n=[e.x+s[0],e.y+s[1]];bn(n,t,i,r),o.push(n)}return o}function Sn(e,t,i,n){const r=Math.pow(2,n.z)*fn,s=[n.x*fn,n.y*fn],o=[];if(!e)return o;for(const i of e){const e=[];for(const n of i){const i=[n.x+s[0],n.y+s[1]];on(t,i),e.push(i)}o.push(e)}if(t[2]-t[0]<=r/2){(a=t)[0]=a[1]=1/0,a[2]=a[3]=-1/0;for(const e of o)for(const n of e)bn(n,t,i,r)}var a;return o}class Tn{constructor(e,t){this.type=yi,this.geojson=e,this.geometries=t}static parse(e,t){if(2!==e.length)return t.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Ni(e[1])){const t=e[1];if("FeatureCollection"===t.type)for(let e=0;et)return En(r,s,(t-(i-o))/o)}return e[e.length-1]}pointToSegmentDistance(e,t,i){let[n,r]=t,s=In(i[0]-n)*this.kx,o=(i[1]-r)*this.ky;if(0!==s||0!==o){const t=(In(e[0]-n)*this.kx*s+(e[1]-r)*this.ky*o)/(s*s+o*o);t>1?(n=i[0],r=i[1]):t>0&&(n+=s/this.kx*t,r+=o/this.ky*t)}return s=In(e[0]-n)*this.kx,o=(e[1]-r)*this.ky,Math.sqrt(s*s+o*o)}pointOnLine(e,t){let i=1/0,n=e[0][0],r=e[0][1],s=0,o=0;for(let a=0;a1?(l=e[a+1][0],c=e[a+1][1]):u>0&&(l+=h/this.kx*u,c+=d/this.ky*u)),h=In(t[0]-l)*this.kx,d=(t[1]-c)*this.ky;const f=h*h+d*d;fr.index||n.index===r.index&&n.t>r.t){const e=n;n=r,r=e}const s=[n.point],o=n.index+1,a=r.index;!Ln(i[o],s[0])&&o<=a&&s.push(i[o]);for(let e=o+1;e<=a;e++)s.push(i[e]);return Ln(i[a],r.point)||s.push(r.point),s}lineSliceAlong(e,t,i){let n=0;const r=[];for(let s=0;se&&0===r.length&&r.push(En(o,a,(e-(n-l))/l)),n>=t)return r.push(En(o,a,(t-(n-l))/l)),r;n>e&&r.push(a)}return r}bufferPoint(e,t){const i=t/this.ky,n=t/this.kx;return[e[0]-n,e[1]-i,e[0]+n,e[1]+i]}bufferBBox(e,t){const i=t/this.ky,n=t/this.kx;return[e[0]-n,e[1]-i,e[2]+n,e[3]+i]}insideBBox(e,t){return In(e[0]-t[0])>=0&&In(e[0]-t[2])<=0&&e[1]>=t[1]&&e[1]<=t[3]}}function Ln(e,t){return e[0]===t[0]&&e[1]===t[1]}function En(e,t,i){const n=In(t[0]-e[0]);return[e[0]+n*i,e[1]+(t[1]-e[1])*i]}function In(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}class Pn{constructor(e=[],t=(e,t)=>et?1:0){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let e=(this.length>>1)-1;e>=0;e--)this._down(e)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(0===this.length)return;const e=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:t,compare:i}=this,n=t[e];for(;e>0;){const r=e-1>>1,s=t[r];if(i(n,s)>=0)break;t[e]=s,e=r}t[e]=n}_down(e){const{data:t,compare:i}=this,n=this.length>>1,r=t[e];for(;e=0)break;t[e]=t[n],e=n}t[e]=r}}var Rn=8192;function On(e,t){return t.dist-e.dist}function zn(e){const t=[1/0,1/0,-1/0,-1/0];if(t.length!==e.length)return!1;for(let i=0;i=e[0]&&e[1]e[1])return[null,null];const i=Fn(e);if(t){if(2===i)return[e,null];const t=Math.floor(i/2);return[[e[0],e[0]+t],[e[0]+t,e[1]]]}{if(1===i)return[e,null];const t=Math.floor(i/2)-1;return[[e[0],e[0]+t],[e[0]+t+1,e[1]]]}}function Bn(e,t){const i=[1/0,1/0,-1/0,-1/0];if(!Nn(t,e.length))return i;for(let n=t[0];n<=t[1];++n)on(i,e[n]);return i}function Hn(e){const t=[1/0,1/0,-1/0,-1/0];for(let i=0;it[2]&&(n=e[0]-t[2]),e[1]>t[3]&&(r=e[1]-t[3]),e[3]=n)return n;if(an(r,s)){if(er(e,t))return 0}else if(er(t,e))return 0;let o=n;for(const n of e)for(let e=0,r=n.length,s=r-1;e=s)continue;const c=r.range1;if(Fn(c)<=a){if(!Nn(c,e.length))return NaN;if(t){const t=Qn(e,c,i,n);if(0===(s=Math.min(s,t)))return s}else for(let t=c[0];t<=c[1];++t){const r=Kn(e[t],i,n);if(0===(s=Math.min(s,r)))return s}}else{const i=Yn(c,t);if(null!==i[0]){const t=jn(Bn(e,i[0]),l,n);t=o)continue;const h=s.range1,d=s.range2;if(Fn(h)<=l&&Fn(d)<=c){if(!Nn(h,e.length)||!Nn(d,i.length))return NaN;if(t&&n?o=Math.min(o,Zn(e,h,i,d,r)):t||n?t&&!n?o=Math.min(o,Xn(i,d,e,h,r)):!t&&n&&(o=Math.min(o,Xn(e,h,i,d,r))):o=Math.min(o,Jn(e,h,i,d,r)),0===o)return o}else{const s=Yn(h,t),l=Yn(d,n);ir(a,o,r,e,i,s[0],l[0]),ir(a,o,r,e,i,s[0],l[1]),ir(a,o,r,e,i,s[1],l[0]),ir(a,o,r,e,i,s[1],l[1])}}return o}function sr(e,t,i,n,r=1/0){let s=r;const o=Bn(e,[0,e.length-1]);for(const r of i)if(!(s!==1/0&&jn(o,Bn(r,[0,r.length-1]),n)>=s)&&(s=Math.min(s,rr(e,t,r,!0,n,s)),0===s))return s;return s}function or(e,t,i,n,r=1/0){let s=r;const o=Bn(e,[0,e.length-1]);for(const r of i){if(s!==1/0&&jn(o,Hn(r),n)>=s)continue;const i=nr(e,t,r,n,s);if(isNaN(i))return i;if(0===(s=Math.min(s,i)))return s}return s}function ar(e){return"Point"===e||"MultiPoint"===e||"LineString"===e||"MultiLineString"===e||"Polygon"===e||"MultiPolygon"===e}class lr{constructor(e,t){this.type=gi,this.geojson=e,this.geometries=t}static parse(e,t){if(2!==e.length)return t.error(`'distance' expression requires either one argument, but found ' ${e.length-1} instead.`);if(Ni(e[1])){const t=e[1];if("FeatureCollection"===t.type){for(let e=0;e{t&&!cr(e)&&(t=!1)}),t}function hr(e){if(e instanceof Ki&&"feature-state"===e.name)return!1;let t=!0;return e.eachChild(e=>{t&&!hr(e)&&(t=!1)}),t}function dr(e){if(e instanceof gr)return new Set([e.key]);let t=new Set;return e.eachChild(e=>{t=new Set([...t,...dr(e)])}),t}function ur(e,t){if(e instanceof Ki&&t.indexOf(e.name)>=0)return!1;let i=!0;return e.eachChild(e=>{i&&!ur(e,t)&&(i=!1)}),i}function fr(e,t,i){return[e,t,i].filter(Boolean).join("")}function pr(e,t){switch(e){case"string":return Bi(t);case"number":return+t;case"boolean":return!!t;case"color":return si.parse(t);case"formatted":return Ri.fromString(Bi(t));case"resolvedImage":return zi.build(Bi(t))}return t}function mr(e,t,i,n){return void 0!==n&&(e=n*Math.round(e/n)),void 0!==t&&ei&&(e=i),e}class gr{constructor(e,t,i,n=!1){this.type=e,this.key=t,this.scope=i,this.featureConstant=n}static parse(e,t){let i=t.expectedType;if(null==i&&(i=bi),e.length<2||e.length>3)return t.error("Invalid number of arguments for 'config' expression.");const n=t.parse(e[1],1);if(!(n instanceof Hi))return t.error("Key name of 'config' expression must be a string literal.");let r,s=!0;const o=Bi(n.value);if(e.length>=3){const i=t.parse(e[2],2);if(!(i instanceof Hi))return t.error("Scope of 'config' expression must be a string literal.");r=Bi(i.value)}if(t.options){const e=fr(o,r,t._scope),i=t.options.get(e);i&&(s=cr(i.value||i.default))}return new gr(i,o,r,s)}evaluate(e){const t=fr(this.key,this.scope,e.scope),i=e.getConfig(t);if(!i)return null;const{type:n,value:r,values:s,minValue:o,maxValue:a,stepValue:l}=i,c=i.default.evaluate(e);let h=c;if(r){const t=e.scope;e.scope=(t||"").split("").slice(1).join(""),h=r.evaluate(e),e.scope=t}return n&&(h=pr(n,h)),void 0===h||void 0===o&&void 0===a&&void 0===l||("number"==typeof h?h=mr(h,o,a,l):Array.isArray(h)&&(h=h.map(e=>"number"==typeof e?mr(e,o,a,l):e))),void 0!==r&&void 0!==h&&s&&!s.includes(h)&&(h=c,n&&(h=pr(n,h))),(n&&n!==this.type||void 0!==h&&!Ei(Yi(h),this.type))&&(h=pr(this.type.kind,h)),h}eachChild(){}outputDefined(){return!1}serialize(){const e=["config",this.key];return this.scope&&e.concat(this.scope),e}}class _r{constructor(e,t){this.type=t.type,this.name=e,this.boundExpression=t}static parse(e,t){if(2!==e.length||"string"!=typeof e[1])return t.error("'var' expression requires exactly one string literal argument.");const i=e[1];return t.scope.has(i)?new _r(i,t.scope.get(i)):t.error(`Unknown variable "${i}". Make sure "${i}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}class yr{constructor(e,t=[],i,n=new pi,r=[],s,o){this.registry=e,this.path=t,this.key=t.map(e=>"string"==typeof e?`['${e}']`:`[${e}]`).join(""),this.scope=n,this.errors=r,this.expectedType=i,this._scope=s,this.options=o}parse(e,t,i,n,r={}){return t||i?this.concat(t,null,i,n)._parse(e,r):this._parse(e,r)}parseObjectValue(e,t,i,n,r,s={}){return this.concat(t,i,n,r)._parse(e,s)}_parse(e,t){function i(e,t,i){return"assert"===i?new Wi(t,[e]):"coerce"===i?new qi(t,[e]):e}if(null!==e&&"string"!=typeof e&&"boolean"!=typeof e&&"number"!=typeof e||(e=["literal",e]),Array.isArray(e)){if(0===e.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const n="string"==typeof e[0]?this.registry[e[0]]:void 0;if(n){let r=n.parse(e,this);if(!r)return null;if(this.expectedType){const e=this.expectedType,n=r.type;if("string"!==e.kind&&"number"!==e.kind&&"boolean"!==e.kind&&"object"!==e.kind&&"array"!==e.kind||"value"!==n.kind)if("color"!==e.kind&&"formatted"!==e.kind&&"resolvedImage"!==e.kind||"value"!==n.kind&&"string"!==n.kind){if(this.checkSubtype(e,n))return null}else r=i(r,e,t.typeAnnotation||"coerce");else r=i(r,e,t.typeAnnotation||"assert")}if(!(r instanceof Hi)&&"resolvedImage"!==r.type.kind&&vr(r)){const t=new Ji(this._scope,this.options);try{r=new Hi(r.type,r.evaluate(t))}catch(e){return this.error(e.message),null}}return r}return qi.parse(["to-array",e],this)}return this.error(void 0===e?"'undefined' value invalid. Use null instead.":"object"==typeof e?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,t,i,n){let r="number"==typeof e?this.path.concat(e):this.path;r="string"==typeof t?r.concat(t):r;const s=n?this.scope.concat(n):this.scope;return new yr(this.registry,r,i||null,s,this.errors,this._scope,this.options)}error(e,...t){const i=`${this.key}${t.map(e=>`[${e}]`).join("")}`;this.errors.push(new fi(i,e))}checkSubtype(e,t){const i=Ci(e,t);return i&&this.error(i),i}}function vr(e){if(e instanceof _r)return vr(e.boundExpression);if(e instanceof Ki&&"error"===e.name)return!1;if(e instanceof en)return!1;if(e instanceof Tn)return!1;if(e instanceof lr)return!1;if(e instanceof gr)return!1;const t=e instanceof qi||e instanceof Wi;let i=!0;return e.eachChild(e=>{i=t?i&&vr(e):i&&e instanceof Hi}),!!i&&cr(e)&&ur(e,["zoom","heatmap-density","worldview","line-progress","raster-value","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center","measure-light","raster-particle-speed"])}function xr(e,t){const i=e.length-1;let n,r,s=0,o=i,a=0;for(;s<=o;)if(a=Math.floor((s+o)/2),n=e[a],r=e[a+1],n<=t){if(a===i||tt))throw new ji("Input is not a number.");o=a-1}return 0}class br{constructor(e,t,i){this.type=e,this.input=t,this.labels=[],this.outputs=[];for(const[e,t]of i)this.labels.push(e),this.outputs.push(t)}static parse(e,t){if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return t.error("Expected an even number of arguments.");const i=t.parse(e[1],1,gi);if(!i)return null;const n=[];let r=null;t.expectedType&&"value"!==t.expectedType.kind&&(r=t.expectedType);for(let i=1;i=s)return t.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',a);const c=t.parse(o,l,r);if(!c)return null;r=r||c.type,n.push([s,c])}return new br(r,i,n)}evaluate(e){const t=this.labels,i=this.outputs;if(1===t.length)return i[0].evaluate(e);const n=this.input.evaluate(e);if(n<=t[0])return i[0].evaluate(e);const r=t.length;return n>=t[r-1]?i[r-1].evaluate(e):i[xr(t,n)].evaluate(e)}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}serialize(){const e=["step",this.input.serialize()];for(let t=0;t0&&e.push(this.labels[t]),e.push(this.outputs[t].serialize());return e}}const wr=.95047,Sr=1.08883,Tr=4/29,kr=6/29,Mr=3*kr*kr,Ar=kr*kr*kr,Cr=Math.PI/180,Dr=180/Math.PI;function Lr(e){return e>Ar?Math.pow(e,1/3):e/Mr+Tr}function Er(e){return e>kr?e*e*e:Mr*(e-Tr)}function Ir(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function Pr(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function Rr(e){const t=Pr(e.r),i=Pr(e.g),n=Pr(e.b),r=Lr((.4124564*t+.3575761*i+.1804375*n)/wr),s=Lr((.2126729*t+.7151522*i+.072175*n)/1);return{l:116*s-16,a:500*(r-s),b:200*(s-Lr((.0193339*t+.119192*i+.9503041*n)/Sr)),alpha:e.a}}function Or(e){let t=(e.l+16)/116,i=isNaN(e.a)?t:t+e.a/500,n=isNaN(e.b)?t:t-e.b/200;return t=1*Er(t),i=wr*Er(i),n=Sr*Er(n),new si(Ir(3.2404542*i-1.5371385*t-.4985314*n),Ir(-.969266*i+1.8760108*t+.041556*n),Ir(.0556434*i-.2040259*t+1.0572252*n),e.alpha)}function zr(e,t,i){const n=t-e;return e+i*(n>180||n<-180?n-360*Math.round(n/360):n)}const Fr={forward:Rr,reverse:Or,interpolate:function(e,t,i){return{l:ci(e.l,t.l,i),a:ci(e.a,t.a,i),b:ci(e.b,t.b,i),alpha:ci(e.alpha,t.alpha,i)}}},Nr={forward:function(e){const{l:t,a:i,b:n}=Rr(e),r=Math.atan2(n,i)*Dr;return{h:r<0?r+360:r,c:Math.sqrt(i*i+n*n),l:t,alpha:e.a}},reverse:function(e){const t=e.h*Cr,i=e.c;return Or({l:e.l,a:Math.cos(t)*i,b:Math.sin(t)*i,alpha:e.alpha})},interpolate:function(e,t,i){return{h:zr(e.h,t.h,i),c:ci(e.c,t.c,i),l:ci(e.l,t.l,i),alpha:ci(e.alpha,t.alpha,i)}}};var Yr=Object.freeze({__proto__:null,hcl:Nr,lab:Fr});class Br{constructor(e,t,i,n,r){this.type=e,this.operator=t,this.interpolation=i,this.input=n,this.labels=[],this.outputs=[];for(const[e,t]of r)this.labels.push(e),this.outputs.push(t)}static interpolationFactor(e,t,i,n){let r=0;if("exponential"===e.name)r=Hr(t,e.base,i,n);else if("linear"===e.name)r=Hr(t,1,i,n);else if("cubic-bezier"===e.name){const s=e.controlPoints;r=new ve(s[0],s[1],s[2],s[3]).solve(Hr(t,1,i,n))}return r}static parse(e,t){let[i,n,r,...s]=e;if(!Array.isArray(n)||0===n.length)return t.error("Expected an interpolation type expression.",1);if("linear"===n[0])n={name:"linear"};else if("exponential"===n[0]){const e=n[1];if("number"!=typeof e)return t.error("Exponential interpolation requires a numeric base.",1,1);n={name:"exponential",base:e}}else{if("cubic-bezier"!==n[0])return t.error(`Unknown interpolation type ${String(n[0])}`,1,0);{const e=n.slice(1);if(4!==e.length||e.some(e=>"number"!=typeof e||e<0||e>1))return t.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);n={name:"cubic-bezier",controlPoints:e}}}if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length-1>3&&(e.length-1)%2!=0)return t.error("Expected an even number of arguments.");if(r=t.parse(r,2,gi),!r)return null;const o=[];let a=null;"interpolate-hcl"===i||"interpolate-lab"===i?a=vi:t.expectedType&&"value"!==t.expectedType.kind&&(a=t.expectedType);for(let e=0;e=i)return t.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',r);const c=t.parse(n,l,a);if(!c)return null;a=a||c.type,o.push([i,c])}return"number"===a.kind||"color"===a.kind||"array"===a.kind&&"number"===a.itemType.kind&&"number"==typeof a.N?new Br(a,i,n,r,o):t.error(`Type ${Mi(a)} is not interpolatable.`)}evaluate(e){const t=this.labels,i=this.outputs;if(1===t.length)return i[0].evaluate(e);const n=this.input.evaluate(e);if(n<=t[0])return i[0].evaluate(e);const r=t.length;if(n>=t[r-1])return i[r-1].evaluate(e);const s=xr(t,n),o=Br.interpolationFactor(this.interpolation,n,t[s],t[s+1]),a=i[s].evaluate(e),l=i[s+1].evaluate(e);return"interpolate"===this.operator?di[this.type.kind.toLowerCase()](a,l,o):"interpolate-hcl"===this.operator?Nr.reverse(Nr.interpolate(Nr.forward(a),Nr.forward(l),o)):Fr.reverse(Fr.interpolate(Fr.forward(a),Fr.forward(l),o))}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}serialize(){let e;e="linear"===this.interpolation.name?["linear"]:"exponential"===this.interpolation.name?1===this.interpolation.base?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier",...this.interpolation.controlPoints];const t=[this.operator,e,this.input.serialize()];for(let e=0;eCi(n,e.type));return new jr(s?bi:i,r)}evaluate(e){let t,i=null,n=0;for(const r of this.args){if(n++,i=r.evaluate(e),i&&i instanceof zi&&!i.available&&(t||(t=i),i=null,n===this.args.length))return t;if(null!==i)break}return i}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){const e=["coalesce"];return this.eachChild(t=>{e.push(t.serialize())}),e}}class Vr{constructor(e,t){this.type=t.type,this.bindings=[].concat(e),this.result=t}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const t of this.bindings)e(t[1]);e(this.result)}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const i=[];for(let n=1;n=i.length)throw new ji(`Array index out of bounds: ${t} > ${i.length-1}.`);if(t!==Math.floor(t))throw new ji(`Array index must be an integer, but found ${t} instead. Use at-interpolated to retrieve interpolated result with a fractional index.`);return i[t]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class Ur{constructor(e,t,i){this.type=e,this.index=t,this.input=i}static parse(e,t){if(3!==e.length)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const i=t.parse(e[1],1,gi),n=t.parse(e[2],2,ki(t.expectedType||bi));return i&&n?new Ur(n.type.itemType,i,n):null}evaluate(e){const t=this.index.evaluate(e),i=this.input.evaluate(e);if(t<0)throw new ji(`Array index out of bounds: ${t} < 0.`);if(t>i.length-1)throw new ji(`Array index out of bounds: ${t} > ${i.length-1}.`);if(t===Math.floor(t))return i[t];const n=Math.floor(t),r=Math.ceil(t),s=i[n],o=i[r];if("number"!=typeof s||"number"!=typeof o)throw new ji(`Cannot interpolate between non-number values at index ${t}.`);const a=t-n;return s*(1-a)+o*a}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}serialize(){return["at-interpolated",this.index.serialize(),this.input.serialize()]}}class $r{constructor(e,t){this.type=yi,this.needle=e,this.haystack=t}static parse(e,t){if(3!==e.length)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const i=t.parse(e[1],1,bi),n=t.parse(e[2],2,bi);return i&&n?Di(i.type,[yi,_i,gi,mi,bi])?new $r(i,n):t.error(`Expected first argument to be of type boolean, string, number or null, but found ${Mi(i.type)} instead`):null}evaluate(e){const t=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(null==i)return!1;if(!Li(t,["boolean","string","number","null"]))throw new ji(`Expected first argument to be of type boolean, string, number or null, but found ${Mi(Yi(t))} instead.`);if(!Li(i,["string","array"]))throw new ji(`Expected second argument to be of type array or string, but found ${Mi(Yi(i))} instead.`);return i.indexOf(t)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}class Gr{constructor(e,t,i){this.type=gi,this.needle=e,this.haystack=t,this.fromIndex=i}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const i=t.parse(e[1],1,bi),n=t.parse(e[2],2,bi);if(!i||!n)return null;if(!Di(i.type,[yi,_i,gi,mi,bi]))return t.error(`Expected first argument to be of type boolean, string, number or null, but found ${Mi(i.type)} instead`);if(4===e.length){const r=t.parse(e[3],3,gi);return r?new Gr(i,n,r):null}return new Gr(i,n)}evaluate(e){const t=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(!Li(t,["boolean","string","number","null"]))throw new ji(`Expected first argument to be of type boolean, string, number or null, but found ${Mi(Yi(t))} instead.`);if(!Li(i,["string","array"]))throw new ji(`Expected second argument to be of type array or string, but found ${Mi(Yi(i))} instead.`);if(this.fromIndex){const n=this.fromIndex.evaluate(e);return i.indexOf(t,n)}return i.indexOf(t)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}serialize(){if(null!=this.fromIndex&&void 0!==this.fromIndex){const e=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),e]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}class Xr{constructor(e,t,i,n,r,s){this.inputType=e,this.type=t,this.input=i,this.cases=n,this.outputs=r,this.otherwise=s}static parse(e,t){if(e.length<5)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return t.error("Expected an even number of arguments.");let i,n;t.expectedType&&"value"!==t.expectedType.kind&&(n=t.expectedType);const r={},s=[];for(let o=2;oNumber.MAX_SAFE_INTEGER)return c.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof e&&Math.floor(e)!==e)return c.error("Numeric branch labels must be integer values.");if(i){if(c.checkSubtype(i,Yi(e)))return null}else i=Yi(e);if(void 0!==r[String(e)])return c.error("Branch labels must be unique.");r[String(e)]=s.length}const h=t.parse(l,o,n);if(!h)return null;n=n||h.type,s.push(h)}const o=t.parse(e[1],1,bi);if(!o)return null;const a=t.parse(e[e.length-1],e.length-1,n);return a?"value"!==o.type.kind&&t.concat(1).checkSubtype(i,o.type)?null:new Xr(i,n,o,r,s,a):null}evaluate(e){const t=this.input.evaluate(e);return(Ei(Yi(t),this.inputType)&&this.outputs[this.cases[t]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}serialize(){const e=["match",this.input.serialize()],t=Object.keys(this.cases).sort(),i=[],n={};for(const e of t){const t=n[this.cases[e]];void 0===t?(n[this.cases[e]]=i.length,i.push([this.cases[e],[e]])):i[t][1].push(e)}const r=e=>"number"===this.inputType.kind?Number(e):e;for(const[t,n]of i)e.push(1===n.length?r(n[0]):n.map(r)),e.push(this.outputs[t].serialize());return e.push(this.otherwise.serialize()),e}}class qr{constructor(e,t,i){this.type=e,this.branches=t,this.otherwise=i}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return t.error("Expected an odd number of arguments.");let i;t.expectedType&&"value"!==t.expectedType.kind&&(i=t.expectedType);const n=[];for(let r=1;rt.outputDefined())&&this.otherwise.outputDefined()}serialize(){const e=["case"];return this.eachChild(t=>{e.push(t.serialize())}),e}}class Zr{constructor(e,t,i,n){this.type=e,this.input=t,this.beginIndex=i,this.endIndex=n}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const i=t.parse(e[1],1,bi),n=t.parse(e[2],2,gi);if(!i||!n)return null;if(!Di(i.type,[ki(bi),_i,bi]))return t.error(`Expected first argument to be of type array or string, but found ${Mi(i.type)} instead`);if(4===e.length){const r=t.parse(e[3],3,gi);return r?new Zr(i.type,i,n,r):null}return new Zr(i.type,i,n)}evaluate(e){const t=this.input.evaluate(e),i=this.beginIndex.evaluate(e);if(!Li(t,["string","array"]))throw new ji(`Expected first argument to be of type array or string, but found ${Mi(Yi(t))} instead.`);if(this.endIndex){const n=this.endIndex.evaluate(e);return t.slice(i,n)}return t.slice(i)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}serialize(){if(null!=this.endIndex&&void 0!==this.endIndex){const e=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),e]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}class Jr{constructor(e,t){this.type=ki(_i),this.str=e,this.delimiter=t}static parse(e,t){if(3!==e.length)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const i=t.parse(e[1],1,_i),n=t.parse(e[2],2,_i);return i&&n?new Jr(i,n):void 0}evaluate(e){const t=this.str.evaluate(e),i=this.delimiter.evaluate(e);return t.split(i)}eachChild(e){e(this.str),e(this.delimiter)}outputDefined(){return!1}serialize(){return["split",this.str.serialize(),this.delimiter.serialize()]}}function Kr(e,t){return"=="===e||"!="===e?"boolean"===t.kind||"string"===t.kind||"number"===t.kind||"null"===t.kind||"value"===t.kind:"string"===t.kind||"number"===t.kind||"value"===t.kind}function Qr(e,t,i,n){return 0===n.compare(t,i)}function es(e,t,i){const n="=="!==e&&"!="!==e;return class r{constructor(e,t,i){this.type=yi,this.lhs=e,this.rhs=t,this.collator=i,this.hasUntypedArgument="value"===e.type.kind||"value"===t.type.kind}static parse(e,t){if(3!==e.length&&4!==e.length)return t.error("Expected two or three arguments.");const i=e[0];let s=t.parse(e[1],1,bi);if(!s)return null;if(!Kr(i,s.type))return t.concat(1).error(`"${i}" comparisons are not supported for type '${Mi(s.type)}'.`);let o=t.parse(e[2],2,bi);if(!o)return null;if(!Kr(i,o.type))return t.concat(2).error(`"${i}" comparisons are not supported for type '${Mi(o.type)}'.`);if(s.type.kind!==o.type.kind&&"value"!==s.type.kind&&"value"!==o.type.kind)return t.error(`Cannot compare types '${Mi(s.type)}' and '${Mi(o.type)}'.`);n&&("value"===s.type.kind&&"value"!==o.type.kind?s=new Wi(o.type,[s]):"value"!==s.type.kind&&"value"===o.type.kind&&(o=new Wi(s.type,[o])));let a=null;if(4===e.length){if("string"!==s.type.kind&&"string"!==o.type.kind&&"value"!==s.type.kind&&"value"!==o.type.kind)return t.error("Cannot use collator to compare non-string types.");if(a=t.parse(e[3],3,wi),!a)return null}return new r(s,o,a)}evaluate(r){const s=this.lhs.evaluate(r),o=this.rhs.evaluate(r);if(n&&this.hasUntypedArgument){const t=Yi(s),i=Yi(o);if(t.kind!==i.kind||"string"!==t.kind&&"number"!==t.kind)throw new ji(`Expected arguments for "${e}" to be (string, string) or (number, number), but found (${t.kind}, ${i.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){const e=Yi(s),i=Yi(o);if("string"!==e.kind||"string"!==i.kind)return t(r,s,o)}return this.collator?i(r,s,o,this.collator.evaluate(r)):t(r,s,o)}eachChild(e){e(this.lhs),e(this.rhs),this.collator&&e(this.collator)}outputDefined(){return!0}serialize(){const t=[e];return this.eachChild(e=>{t.push(e.serialize())}),t}}}const ts=es("==",function(e,t,i){return t===i},Qr),is=es("!=",function(e,t,i){return t!==i},function(e,t,i,n){return!Qr(0,t,i,n)}),ns=es("<",function(e,t,i){return t",function(e,t,i){return t>i},function(e,t,i,n){return n.compare(t,i)>0}),ss=es("<=",function(e,t,i){return t<=i},function(e,t,i,n){return n.compare(t,i)<=0}),os=es(">=",function(e,t,i){return t>=i},function(e,t,i,n){return n.compare(t,i)>=0});class as{constructor(e,t,i,n,r,s){this.type=_i,this.number=e,this.locale=t,this.currency=i,this.unit=n,this.minFractionDigits=r,this.maxFractionDigits=s}static parse(e,t){if(3!==e.length)return t.error("Expected two arguments.");const i=t.parse(e[1],1,gi);if(!i)return null;const n=e[2];if("object"!=typeof n||Array.isArray(n))return t.error("NumberFormat options argument must be an object.");let r=null;if(n.locale&&(r=t.parseObjectValue(n.locale,2,"locale",_i),!r))return null;let s=null;if(n.currency&&(s=t.parseObjectValue(n.currency,2,"currency",_i),!s))return null;let o=null;if(n.unit&&(o=t.parseObjectValue(n.unit,2,"unit",_i),!o))return null;let a=null;if(n["min-fraction-digits"]&&(a=t.parseObjectValue(n["min-fraction-digits"],2,"min-fraction-digits",gi),!a))return null;let l=null;return n["max-fraction-digits"]&&(l=t.parseObjectValue(n["max-fraction-digits"],2,"max-fraction-digits",gi),!l)?null:new as(i,r,s,o,a,l)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:(this.currency?"currency":this.unit&&"unit")||"decimal",currency:this.currency?this.currency.evaluate(e):void 0,unit:this.unit?this.unit.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.unit&&e(this.unit),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}serialize(){const e={};return this.locale&&(e.locale=this.locale.serialize()),this.currency&&(e.currency=this.currency.serialize()),this.unit&&(e.unit=this.unit.serialize()),this.minFractionDigits&&(e["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(e["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),e]}}class ls{constructor(e){this.type=gi,this.input=e}static parse(e,t){if(2!==e.length)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`);const i=t.parse(e[1],1);return i?"array"!==i.type.kind&&"string"!==i.type.kind&&"value"!==i.type.kind?t.error(`Expected argument of type string or array, but found ${Mi(i.type)} instead.`):new ls(i):null}evaluate(e){const t=this.input.evaluate(e);if("string"==typeof t)return t.length;if(Array.isArray(t))return t.length;throw new ji(`Expected value to be of type string or array, but found ${Mi(Yi(t))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}serialize(){const e=["length"];return this.eachChild(t=>{e.push(t.serialize())}),e}}function cs(e){return function(){e=1831565813+(e|=0)|0;let t=Math.imul(e^e>>>15,1|e);return t=t+Math.imul(t^t>>>7,61|t)^t,((t^t>>>14)>>>0)/4294967296}}const hs={"==":ts,"!=":is,">":rs,"<":ns,">=":os,"<=":ss,array:Wi,at:Wr,"at-interpolated":Ur,boolean:Wi,case:qr,coalesce:jr,collator:en,format:Ui,image:$i,in:$r,"index-of":Gr,interpolate:Br,"interpolate-hcl":Br,"interpolate-lab":Br,length:ls,let:Vr,literal:Hi,match:Xr,number:Wi,"number-format":as,object:Wi,slice:Zr,step:br,string:Wi,"to-boolean":qi,"to-color":qi,"to-number":qi,"to-string":qi,var:_r,within:Tn,distance:lr,config:gr,split:Jr};function ds(e,[t,i,n,r]){t=t.evaluate(e),i=i.evaluate(e),n=n.evaluate(e);const s=r?r.evaluate(e):1,o=Fi(t,i,n,s);if(o)throw new ji(o);return new si(t/255,i/255,n/255,s)}function us(e,[t,i,n,r]){t=t.evaluate(e),i=i.evaluate(e),n=n.evaluate(e);const s=r?r.evaluate(e):1,o=function(e,t,i,n){return"number"==typeof e&&e>=0&&e<=360?"number"==typeof t&&t>=0&&t<=100&&"number"==typeof i&&i>=0&&i<=100?void 0===n||"number"==typeof n&&n>=0&&n<=1?null:`Invalid hsla value [${[e,t,i,n].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid hsla value [${("number"==typeof n?[e,t,i,n]:[e,t,i]).join(", ")}]: 's', and 'l' must be between 0 and 100.`:`Invalid hsla value [${("number"==typeof n?[e,t,i,n]:[e,t,i]).join(", ")}]: 'h' must be between 0 and 360.`}(t,i,n,s);if(o)throw new ji(o);const a=`hsla(${t}, ${i}%, ${n}%, ${s})`,l=si.parse(a);if(!l)throw new ji(`Failed to parse HSLA color: ${a}`);return l}function fs(e,t){return e in t}function ps(e,t){const i=t[e];return void 0===i?null:i}function ms(e){return{type:e}}function gs(e){return{result:"success",value:e}}function _s(e){return{result:"error",value:e}}function ys(e,t){return!!e&&!!e.parameters&&e.parameters.indexOf(t)>-1}function vs(e){return"data-driven"===e["property-type"]}function xs(e){return ys(e.expression,"measure-light")}function bs(e){return ys(e.expression,"zoom")}function ws(e){return!!e.expression&&e.expression.interpolated}function Ss(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function Ts(e){return e}function ks(e,t){const i="color"===t.type,n=e.stops&&"object"==typeof e.stops[0][0],r=n||!(n||void 0!==e.property),s=e.type||(ws(t)?"exponential":"interval");if(i&&((e=ui({},e)).stops&&(e.stops=e.stops.map(e=>[e[0],si.parse(e[1])])),e.default=si.parse(e.default?e.default:t.default)),e.colorSpace&&"rgb"!==e.colorSpace&&!Yr[e.colorSpace])throw new Error(`Unknown color space: ${e.colorSpace}`);let o,a,l;if("exponential"===s)o=Ds;else if("interval"===s)o=Cs;else if("categorical"===s){o=As,a=Object.create(null);for(const t of e.stops)a[t[0]]=t[1];l=typeof e.stops[0][0]}else{if("identity"!==s)throw new Error(`Unknown function type "${s}"`);o=Ls}if(n){const i={},n=[];for(let t=0;te[0]),evaluate:({zoom:i},n)=>Ds({stops:r,base:e.base},t,i).evaluate(i,n)}}if(r){const i="exponential"===s?{name:"exponential",base:void 0!==e.base?e.base:1}:null;return{kind:"camera",interpolationType:i,interpolationFactor:Br.interpolationFactor.bind(void 0,i),zoomStops:e.stops.map(e=>e[0]),evaluate:({zoom:i})=>o(e,t,i,a,l)}}return{kind:"source",evaluate(i,n){const r=n&&n.properties?n.properties[e.property]:void 0;return void 0===r?Ms(e.default,t.default):o(e,t,r,a,l)}}}function Ms(e,t,i){return void 0!==e?e:void 0!==t?t:void 0!==i?i:void 0}function As(e,t,i,n,r){return Ms(typeof i===r?n[i]:void 0,e.default,t.default)}function Cs(e,t,i){if("number"!==Gi(i))return Ms(e.default,t.default);const n=e.stops.length;if(1===n)return e.stops[0][1];if(i<=e.stops[0][0])return e.stops[0][1];if(i>=e.stops[n-1][0])return e.stops[n-1][1];const r=xr(e.stops.map(e=>e[0]),i);return e.stops[r][1]}function Ds(e,t,i){const n=void 0!==e.base?e.base:1;if("number"!==Gi(i))return Ms(e.default,t.default);const r=e.stops.length;if(1===r)return e.stops[0][1];if(i<=e.stops[0][0])return e.stops[0][1];if(i>=e.stops[r-1][0])return e.stops[r-1][1];const s=xr(e.stops.map(e=>e[0]),i),o=function(e,t,i,n){const r=n-i,s=e-i;return 0===r?0:1===t?s/r:(Math.pow(t,s)-1)/(Math.pow(t,r)-1)}(i,n,e.stops[s][0],e.stops[s+1][0]),a=e.stops[s][1],l=e.stops[s+1][1];let c=di[t.type]||Ts;if(e.colorSpace&&"rgb"!==e.colorSpace){const t=Yr[e.colorSpace];c=(e,i)=>t.reverse(t.interpolate(t.forward(e),t.forward(i),o))}return"function"==typeof a.evaluate?{evaluate(...e){const t=a.evaluate.apply(void 0,e),i=l.evaluate.apply(void 0,e);if(void 0!==t&&void 0!==i)return c(t,i,o)}}:c(a,l,o)}function Ls(e,t,i){return"color"===t.type?i=si.parse(i):"formatted"===t.type?i=Ri.fromString(i.toString()):"resolvedImage"===t.type?i=zi.build(i.toString()):Gi(i)===t.type||"enum"===t.type&&t.values[i]||(i=void 0),Ms(i,e.default,t.default)}Ki.register(hs,{error:[{kind:"error"},[_i],(e,[t])=>{throw new ji(t.evaluate(e))}],typeof:[_i,[bi],(e,[t])=>Mi(Yi(t.evaluate(e)))],"to-rgba":[ki(gi,4),[vi],(e,[t])=>t.evaluate(e).toNonPremultipliedRenderColor(null).toArray()],"to-hsla":[ki(gi,4),[vi],(e,[t])=>t.evaluate(e).toNonPremultipliedRenderColor(null).toHslaArray()],rgb:[vi,[gi,gi,gi],ds],rgba:[vi,[gi,gi,gi,gi],ds],hsl:[vi,[gi,gi,gi],us],hsla:[vi,[gi,gi,gi,gi],us],has:{type:yi,overloads:[[[_i],(e,[t])=>fs(t.evaluate(e),e.properties())],[[_i,xi],(e,[t,i])=>fs(t.evaluate(e),i.evaluate(e))]]},get:{type:bi,overloads:[[[_i],(e,[t])=>ps(t.evaluate(e),e.properties())],[[_i,xi],(e,[t,i])=>ps(t.evaluate(e),i.evaluate(e))]]},"feature-state":[bi,[_i],(e,[t])=>ps(t.evaluate(e),e.featureState||{})],properties:[xi,[],e=>e.properties()],"geometry-type":[_i,[],e=>e.geometryType()],worldview:[_i,[],e=>e.globals.worldview||""],id:[bi,[],e=>e.id()],zoom:[gi,[],e=>e.globals.zoom],pitch:[gi,[],e=>e.globals.pitch||0],"distance-from-center":[gi,[],e=>e.distanceFromCenter()],"measure-light":[gi,[_i],(e,[t])=>e.measureLight(t.evaluate(e))],"heatmap-density":[gi,[],e=>e.globals.heatmapDensity||0],"line-progress":[gi,[],e=>e.globals.lineProgress||0],"raster-value":[gi,[],e=>e.globals.rasterValue||0],"raster-particle-speed":[gi,[],e=>e.globals.rasterParticleSpeed||0],"sky-radial-progress":[gi,[],e=>e.globals.skyRadialProgress||0],accumulated:[bi,[],e=>void 0===e.globals.accumulated?null:e.globals.accumulated],"+":[gi,ms(gi),(e,t)=>{let i=0;for(const n of t)i+=n.evaluate(e);return i}],"*":[gi,ms(gi),(e,t)=>{let i=1;for(const n of t)i*=n.evaluate(e);return i}],"-":{type:gi,overloads:[[[gi,gi],(e,[t,i])=>t.evaluate(e)-i.evaluate(e)],[[gi],(e,[t])=>-t.evaluate(e)]]},"/":[gi,[gi,gi],(e,[t,i])=>t.evaluate(e)/i.evaluate(e)],"%":[gi,[gi,gi],(e,[t,i])=>t.evaluate(e)%i.evaluate(e)],ln2:[gi,[],()=>Math.LN2],pi:[gi,[],()=>Math.PI],e:[gi,[],()=>Math.E],"^":[gi,[gi,gi],(e,[t,i])=>Math.pow(t.evaluate(e),i.evaluate(e))],sqrt:[gi,[gi],(e,[t])=>Math.sqrt(t.evaluate(e))],log10:[gi,[gi],(e,[t])=>Math.log(t.evaluate(e))/Math.LN10],ln:[gi,[gi],(e,[t])=>Math.log(t.evaluate(e))],log2:[gi,[gi],(e,[t])=>Math.log(t.evaluate(e))/Math.LN2],sin:[gi,[gi],(e,[t])=>Math.sin(t.evaluate(e))],cos:[gi,[gi],(e,[t])=>Math.cos(t.evaluate(e))],tan:[gi,[gi],(e,[t])=>Math.tan(t.evaluate(e))],asin:[gi,[gi],(e,[t])=>Math.asin(t.evaluate(e))],acos:[gi,[gi],(e,[t])=>Math.acos(t.evaluate(e))],atan:[gi,[gi],(e,[t])=>Math.atan(t.evaluate(e))],min:[gi,ms(gi),(e,t)=>Math.min(...t.map(t=>t.evaluate(e)))],max:[gi,ms(gi),(e,t)=>Math.max(...t.map(t=>t.evaluate(e)))],abs:[gi,[gi],(e,[t])=>Math.abs(t.evaluate(e))],round:[gi,[gi],(e,[t])=>{const i=t.evaluate(e);return i<0?-Math.round(-i):Math.round(i)}],floor:[gi,[gi],(e,[t])=>Math.floor(t.evaluate(e))],ceil:[gi,[gi],(e,[t])=>Math.ceil(t.evaluate(e))],"filter-==":[yi,[_i,bi],(e,[t,i])=>e.properties()[t.value]===i.value],"filter-id-==":[yi,[bi],(e,[t])=>e.id()===t.value],"filter-type-==":[yi,[_i],(e,[t])=>e.geometryType()===t.value],"filter-<":[yi,[_i,bi],(e,[t,i])=>{const n=e.properties()[t.value],r=i.value;return typeof n==typeof r&&n{const i=e.id(),n=t.value;return typeof i==typeof n&&i":[yi,[_i,bi],(e,[t,i])=>{const n=e.properties()[t.value],r=i.value;return typeof n==typeof r&&n>r}],"filter-id->":[yi,[bi],(e,[t])=>{const i=e.id(),n=t.value;return typeof i==typeof n&&i>n}],"filter-<=":[yi,[_i,bi],(e,[t,i])=>{const n=e.properties()[t.value],r=i.value;return typeof n==typeof r&&n<=r}],"filter-id-<=":[yi,[bi],(e,[t])=>{const i=e.id(),n=t.value;return typeof i==typeof n&&i<=n}],"filter->=":[yi,[_i,bi],(e,[t,i])=>{const n=e.properties()[t.value],r=i.value;return typeof n==typeof r&&n>=r}],"filter-id->=":[yi,[bi],(e,[t])=>{const i=e.id(),n=t.value;return typeof i==typeof n&&i>=n}],"filter-has":[yi,[bi],(e,[t])=>t.value in e.properties()],"filter-has-id":[yi,[],e=>null!==e.id()&&void 0!==e.id()],"filter-type-in":[yi,[ki(_i)],(e,[t])=>t.value.indexOf(e.geometryType())>=0],"filter-id-in":[yi,[ki(bi)],(e,[t])=>t.value.indexOf(e.id())>=0],"filter-in-small":[yi,[_i,ki(bi)],(e,[t,i])=>i.value.indexOf(e.properties()[t.value])>=0],"filter-in-large":[yi,[_i,ki(bi)],(e,[t,i])=>function(e,t,i,n){for(;i<=n;){const r=i+n>>1;if(t[r]===e)return!0;t[r]>e?n=r-1:i=r+1}return!1}(e.properties()[t.value],i.value,0,i.value.length-1)],all:{type:yi,overloads:[[[yi,yi],(e,[t,i])=>t.evaluate(e)&&i.evaluate(e)],[ms(yi),(e,t)=>{for(const i of t)if(!i.evaluate(e))return!1;return!0}]]},any:{type:yi,overloads:[[[yi,yi],(e,[t,i])=>t.evaluate(e)||i.evaluate(e)],[ms(yi),(e,t)=>{for(const i of t)if(i.evaluate(e))return!0;return!1}]]},"!":[yi,[yi],(e,[t])=>!t.evaluate(e)],"is-supported-script":[yi,[_i],(e,[t])=>{const i=e.globals&&e.globals.isSupportedScript;return!i||i(t.evaluate(e))}],upcase:[_i,[_i],(e,[t])=>t.evaluate(e).toUpperCase()],downcase:[_i,[_i],(e,[t])=>t.evaluate(e).toLowerCase()],concat:[_i,ms(bi),(e,t)=>t.map(t=>Bi(t.evaluate(e))).join("")],"resolved-locale":[_i,[wi],(e,[t])=>t.evaluate(e).resolvedLocale()],random:[gi,[gi,gi,bi],(e,t)=>{const[i,n,r]=t.map(t=>t.evaluate(e));if(i>n)return i;if(i===n)return i;let s;if("string"==typeof r)s=function(e){let t=0;if(0===e.length)return t;for(let i=0;iJSON.stringify(e)).join(", ")}, but found ${JSON.stringify(e)} instead.`);return e}catch(e){return this._warningHistory[e.message]||(this._warningHistory[e.message]=!0,"undefined"!=typeof console&&console.warn(`Failed to evaluate expression "${JSON.stringify(this.expression.serialize())}". ${e.message}`)),this._defaultValue}}}function Is(e){return Array.isArray(e)&&e.length>0&&"string"==typeof e[0]&&e[0]in hs}function Ps(e,t,i,n){const r=new yr(hs,[],t?function(e){const t={color:vi,string:_i,number:gi,enum:_i,boolean:yi,formatted:Si,resolvedImage:Ti};return"array"===e.type?ki(t[e.value]||bi,e.length):t[e.type]}(t):void 0,void 0,void 0,i,n),s=r.parse(e,void 0,void 0,void 0,t&&"string"===t.type?{typeAnnotation:"coerce"}:void 0);return s?gs(new Es(s,t,i,n)):_s(r.errors)}class Rs{constructor(e,t,i,n){this.kind=e,this._styleExpression=t,this.isLightConstant=i,this.isLineProgressConstant=n,this.isStateDependent="constant"!==e&&!hr(t.expression),this.configDependencies=dr(t.expression)}evaluateWithoutErrorHandling(e,t,i,n,r,s){return this._styleExpression.evaluateWithoutErrorHandling(e,t,i,n,r,s)}evaluate(e,t,i,n,r,s){return this._styleExpression.evaluate(e,t,i,n,r,s)}}class Os{constructor(e,t,i,n,r,s){this.kind=e,this.zoomStops=i,this._styleExpression=t,this.isStateDependent="camera"!==e&&!hr(t.expression),this.isLightConstant=r,this.isLineProgressConstant=s,this.configDependencies=dr(t.expression),this.interpolationType=n}evaluateWithoutErrorHandling(e,t,i,n,r,s){return this._styleExpression.evaluateWithoutErrorHandling(e,t,i,n,r,s)}evaluate(e,t,i,n,r,s){return this._styleExpression.evaluate(e,t,i,n,r,s)}interpolationFactor(e,t,i){return this.interpolationType?Br.interpolationFactor(this.interpolationType,e,t,i):0}}function zs(e,t,i,n){if("error"===(e=Ps(e,t,i,n)).result)return e;const r=e.value.expression,s=cr(r);if(!s&&!vs(t))return _s([new fi("","data expressions not supported")]);const o=ur(r,["zoom","pitch","distance-from-center"]);if(!o&&!bs(t))return _s([new fi("","zoom expressions not supported")]);const a=ur(r,["measure-light"]);if(!a&&!xs(t))return _s([new fi("","measure-light expression not supported")]);const l=ur(r,["line-progress"]);if(!l&&!function(e){return ys(e.expression,"line-progress")}(t))return _s([new fi("","line-progress expression not supported")]);const c=t.expression&&t.expression.relaxZoomRestriction,h=Ns(r);return h||o||c?h instanceof fi?_s([h]):h instanceof Br&&!ws(t)?_s([new fi("",'"interpolate" expressions cannot be used with this property')]):gs(h?new Os(s&&l?"camera":"composite",e.value,h.labels,h instanceof Br?h.interpolation:void 0,a,l):new Rs(s&&l?"constant":"source",e.value,a,l)):_s([new fi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression, or in the properties of atmosphere.')])}class Fs{constructor(e,t){this._parameters=e,this._specification=t,ui(this,ks(this._parameters,this._specification))}static deserialize(e){return new Fs(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function Ns(e){let t=null;if(e instanceof Vr)t=Ns(e.result);else if(e instanceof jr){for(const i of e.args)if(t=Ns(i),t)break}else(e instanceof br||e instanceof Br)&&e.input instanceof Ki&&"zoom"===e.input.name&&(t=e);return t instanceof fi||e.eachChild(e=>{const i=Ns(e);i instanceof fi?t=i:t&&i&&t!==i&&(t=new fi("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),t}var Ys,Bs,Hs=function(){if(Bs)return Ys;Bs=1,Ys=t;var e=3;function t(t,i,n){var r=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;var s=new Int32Array(this.arrayBuffer);t=s[0],this.d=(i=s[1])+2*(n=s[2]);for(var o=0;o=h[f+0]&&n>=h[f+1])?(o[u]=!0,s.push(c[u])):o[u]=!1}}},t.prototype._forEachCell=function(e,t,i,n,r,s,o,a){for(var l=this._convertToCellCoord(e),c=this._convertToCellCoord(t),h=this._convertToCellCoord(i),d=this._convertToCellCoord(n),u=l;u<=h;u++)for(var f=c;f<=d;f++){var p=this.d*f+u;if((!a||a(this._convertFromCellCoord(u),this._convertFromCellCoord(f),this._convertFromCellCoord(u+1),this._convertFromCellCoord(f+1)))&&r.call(this,e,t,i,n,p,s,o,a))return}},t.prototype._convertFromCellCoord=function(e){return(e-this.padding)/this.scale},t.prototype._convertToCellCoord=function(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))},t.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var t=this.cells,i=e+this.cells.length+1+1,n=0,r=0;r=0||(r[i]=Gs(e[i],t)));e instanceof Error&&(r.message=e.message)}if(r.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==n&&(r.$name=n),r}throw new Error("can't serialize object of type "+typeof e)}function Xs(e){if(null==e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||e instanceof Boolean||e instanceof Number||e instanceof String||e instanceof Date||e instanceof RegExp||Us(e)||$s(e)||ArrayBuffer.isView(e)||e instanceof ImageData)return e;if(Array.isArray(e))return e.map(Xs);if("object"==typeof e){const t=e.$name||"Object";if("Map"===t){const t=e.entries||[],i=new Map;for(let e=0;ee>=128&&e<=255,Zs=e=>e>=1536&&e<=1791,Js=e=>e>=1872&&e<=1919,Ks=e=>e>=2208&&e<=2303,Qs=e=>e>=4352&&e<=4607,eo=e=>e>=5120&&e<=5759,to=e=>e>=6016&&e<=6143,io=e=>e>=6320&&e<=6399,no=e=>e>=8192&&e<=8303,ro=e=>e>=8448&&e<=8527,so=e=>e>=8528&&e<=8591,oo=e=>e>=8960&&e<=9215,ao=e=>e>=9216&&e<=9279,lo=e=>e>=9280&&e<=9311,co=e=>e>=9312&&e<=9471,ho=e=>e>=9632&&e<=9727,uo=e=>e>=9728&&e<=9983,fo=e=>e>=11008&&e<=11263,po=e=>e>=11904&&e<=12031,mo=e=>e>=12032&&e<=12255,go=e=>e>=12272&&e<=12287,_o=e=>e>=12288&&e<=12351,yo=e=>e>=12352&&e<=12447,vo=e=>e>=12448&&e<=12543,xo=e=>e>=12544&&e<=12591,bo=e=>e>=12592&&e<=12687,wo=e=>e>=12688&&e<=12703,So=e=>e>=12704&&e<=12735,To=e=>e>=12736&&e<=12783,ko=e=>e>=12784&&e<=12799,Mo=e=>e>=12800&&e<=13055,Ao=e=>e>=13056&&e<=13311,Co=e=>e>=13312&&e<=19903,Do=e=>e>=19904&&e<=19967,Lo=e=>e>=19968&&e<=40959,Eo=e=>e>=40960&&e<=42127,Io=e=>e>=42128&&e<=42191,Po=e=>e>=43360&&e<=43391,Ro=e=>e>=44032&&e<=55215,Oo=e=>e>=55216&&e<=55295,zo=e=>e>=57344&&e<=63743,Fo=e=>e>=63744&&e<=64255,No=e=>e>=64336&&e<=65023,Yo=e=>e>=65040&&e<=65055,Bo=e=>e>=65072&&e<=65103,Ho=e=>e>=65104&&e<=65135,jo=e=>e>=65136&&e<=65279,Vo=e=>e>=65280&&e<=65519,Wo=e=>e>=66736&&e<=66815,Uo=e=>e>=131072&&e<=173791;function $o(e){for(const t of e)if(qo(t.charCodeAt(0)))return!0;return!1}function Go(e){for(const t of e)if(!Xo(t.charCodeAt(0)))return!1;return!0}function Xo(e){return!(Zs(e)||Js(e)||Ks(e)||No(e)||jo(e))}function qo(e){return!(746!==e&&747!==e&&(e<4352||!(So(e)||xo(e)||Bo(e)&&!(e>=65097&&e<=65103)||Fo(e)||Ao(e)||po(e)||To(e)||!(!_o(e)||e>=12296&&e<=12305||e>=12308&&e<=12319||12336===e)||Co(e)||Lo(e)||Mo(e)||bo(e)||Po(e)||Oo(e)||Qs(e)||Ro(e)||yo(e)||go(e)||wo(e)||mo(e)||ko(e)||vo(e)&&12540!==e||!(!Vo(e)||65288===e||65289===e||65293===e||e>=65306&&e<=65310||65339===e||65341===e||65343===e||e>=65371&&e<=65503||65507===e||e>=65512&&e<=65519)||!(!Ho(e)||e>=65112&&e<=65118||e>=65123&&e<=65126)||eo(e)||io(e)||Yo(e)||Do(e)||Eo(e)||Io(e))))}function Zo(e){return!(qo(e)||function(e){return!!(qs(e)&&(167===e||169===e||174===e||177===e||188===e||189===e||190===e||215===e||247===e)||no(e)&&(8214===e||8224===e||8225===e||8240===e||8241===e||8251===e||8252===e||8258===e||8263===e||8264===e||8265===e||8273===e)||ro(e)||so(e)||oo(e)&&(e>=8960&&e<=8967||e>=8972&&e<=8991||e>=8996&&e<=9e3||9003===e||e>=9085&&e<=9114||e>=9150&&e<=9165||9167===e||e>=9169&&e<=9179||e>=9186&&e<=9215)||ao(e)&&9251!==e||lo(e)||co(e)||ho(e)||uo(e)&&!(e>=9754&&e<=9759)||fo(e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||_o(e)||vo(e)||zo(e)||Bo(e)||Ho(e)||Vo(e)||8734===e||8756===e||8757===e||e>=9984&&e<=10087||e>=10102&&e<=10131||65532===e||65533===e)}(e))}function Jo(e){return Zs(e)||Js(e)||Ks(e)||No(e)||jo(e)}function Ko(e){return e>=1424&&e<=2303||No(e)||jo(e)}function Qo(e,t){return!(!t&&Ko(e)||e>=2304&&e<=3583||e>=3840&&e<=4255||to(e))}function ea(e){for(const t of e)if(Ko(t.charCodeAt(0)))return!0;return!1}const ta={unavailable:"unavailable",deferred:"deferred",loading:"loading",parsing:"parsing",parsed:"parsed",loaded:"loaded",error:"error"};let ia=null,na=ta.unavailable,ra=null;const sa=function(e){e&&"string"==typeof e&&e.indexOf("NetworkError")>-1&&(na=ta.error),ia&&ia(e)};function oa(){aa.fire(new Zt("pluginStateChange",{pluginStatus:na,pluginURL:ra}))}const aa=new ei,la=function(){return na},ca=function(){if(na!==ta.deferred||!ra)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");na=ta.loading,oa(),ra&&zt({url:ra},e=>{e?sa(e):(na=ta.loaded,oa())})},ha={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>na===ta.loaded||null!=ha.applyArabicShaping,isLoading:()=>na===ta.loading,setState(e){na=e.pluginStatus,ra=e.pluginURL},isParsing:()=>na===ta.parsing,isParsed:()=>na===ta.parsed,getPluginURL:()=>ra};class da{constructor(e,t){this.zoom=e,t?(this.now=t.now,this.fadeDuration=t.fadeDuration,this.transition=t.transition,this.pitch=t.pitch,this.brightness=t.brightness,this.worldview=t.worldview):(this.now=0,this.fadeDuration=0,this.transition={},this.pitch=0,this.brightness=0)}isSupportedScript(e){return function(e,t){for(const i of e)if(!Qo(i.charCodeAt(0),t))return!1;return!0}(e,ha.isLoaded())}}class ua{constructor(e,t,i,n){this.property=e,this.value=t,this.expression=function(e,t,i,n){if(Ss(e))return new Fs(e,t);if(Is(e)||Array.isArray(e)&&e.length>0){const r=zs(e,t,i,n);if("error"===r.result)throw new Error(r.value.map(e=>`${e.key}: ${e.message}`).join(", "));return r.value}{let i=e;return"string"==typeof e&&"color"===t.type&&(i=si.parse(e)),{kind:"constant",configDependencies:new Set,evaluate:()=>i}}}(void 0===t?e.specification.default:t,e.specification,i,n)}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}possiblyEvaluate(e,t,i){return this.property.possiblyEvaluate(this,e,t,i)}}class fa{constructor(e,t,i){this.property=e,this.value=new ua(e,void 0,t,i)}transitioned(e,t){return new ma(this.property,this.value,t,Re({},e.transition,this.transition),e.now)}untransitioned(){return new ma(this.property,this.value,null,{},0)}}class pa{constructor(e,t,i){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues),this._scope=t,this._options=i,this.configDependencies=new Set}getValue(e){return He(this._values[e].value.value)}setValue(e,t){this._values.hasOwnProperty(e)||(this._values[e]=new fa(this._values[e].property,this._scope,this._options)),this._values[e].value=new ua(this._values[e].property,null===t?void 0:He(t),this._scope,this._options),this._values[e].value.expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[e].value.expression.configDependencies]))}setTransitionOrValue(e,t){t&&(this._options=t);const i=this._properties.properties;if(e)for(const t in e){const n=e[t];if(t.endsWith("-transition")){const e=t.slice(0,-11);i[e]&&this.setTransition(e,n)}else i.hasOwnProperty(t)&&this.setValue(t,n)}}getTransition(e){return He(this._values[e].transition)}setTransition(e,t){this._values.hasOwnProperty(e)||(this._values[e]=new fa(this._values[e].property)),this._values[e].transition=He(t)||void 0}serialize(){const e={};for(const t of Object.keys(this._values)){const i=this.getValue(t);void 0!==i&&(e[t]=i);const n=this.getTransition(t);void 0!==n&&(e[`${t}-transition`]=n)}return e}transitioned(e,t){const i=new ga(this._properties);for(const n of Object.keys(this._values))i._values[n]=this._values[n].transitioned(e,t._values[n]);return i}untransitioned(){const e=new ga(this._properties);for(const t of Object.keys(this._values))e._values[t]=this._values[t].untransitioned();return e}}class ma{constructor(e,t,i,n,r){const s=n.delay||0,o=n.duration||0;r=r||0,this.property=e,this.value=t,this.begin=r+s,this.end=this.begin+o,e.specification.transition&&(n.delay||n.duration)&&(this.prior=i)}possiblyEvaluate(e,t,i){const n=e.now||0,r=this.value.possiblyEvaluate(e,t,i),s=this.prior;if(s){if(n>this.end)return this.prior=null,r;if(this.value.isDataDriven())return this.prior=null,r;if(n":1,">=":1,"<":1,"<=":1,"in":1,"!in":1,"all":1,"any":1,"none":1,"has":1,"!has":1}},"geometry_type":{"type":"enum","values":{"Point":1,"LineString":1,"Polygon":1}},"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":1,"exponential":1,"interval":1,"categorical":1},"default":"exponential"},"colorSpace":{"type":"enum","values":{"rgb":1,"lab":1,"hcl":1},"default":"rgb"},"default":{"type":"*"}},"function_stop":{"type":"array","minimum":0,"maximum":24,"value":["number","color"],"length":2},"expression":{"type":"array","value":"*","minimum":1},"fog":{"range":{"type":"array","default":[0.5,10],"minimum":-20,"maximum":20,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"high-color":{"type":"color","default":"#245cdf","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"space-color":{"type":"color","default":["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"horizon-blend":{"type":"number","default":["interpolate",["linear"],["zoom"],4,0.2,7,0.1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"star-intensity":{"type":"number","default":["interpolate",["linear"],["zoom"],5,0.35,6,0],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vertical-range":{"type":"array","default":[0,0],"minimum":0,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}}},"snow":{"density":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.85],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.3],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette-color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"center-thinning":{"type":"number","default":0.4,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"direction":{"type":"array","default":[0,50],"minimum":0,"maximum":360,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"flake-size":{"type":"number","default":0.71,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true}},"rain":{"density":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.5],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"color":{"type":"color","default":["interpolate",["linear"],["measure-light","brightness"],0,"#03113d",0.3,"#a8adbc"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"opacity":{"type":"number","default":["interpolate",["linear"],["measure-light","brightness"],0,0.88,1,0.7],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette-color":{"type":"color","default":["interpolate",["linear"],["measure-light","brightness"],0,"#001736",0.3,"#464646"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"center-thinning":{"type":"number","default":0.57,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"direction":{"type":"array","default":[0,80],"minimum":0,"maximum":360,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"droplet-size":{"type":"array","default":[2.6,18.2],"minimum":0,"maximum":50,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"distortion-strength":{"type":"number","default":0.7,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true}},"camera":{"camera-projection":{"type":"enum","values":{"perspective":1,"orthographic":1},"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"default":"perspective"}},"colorTheme":{"data":{"type":"string","expression":{}}},"indoor":{"floorplanFeaturesetId":{"type":"string","expression":{}},"buildingFeaturesetId":{"type":"string","expression":{}}},"light":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"projection":{"name":{"type":"enum","values":{"albers":1,"equalEarth":1,"equirectangular":1,"lambertConformalConic":1,"mercator":1,"naturalEarth":1,"winkelTripel":1,"globe":1},"default":"mercator"},"center":{"type":"array","length":2,"value":"number","minimum":[-180,-90],"maximum":[180,90]},"parallels":{"type":"array","length":2,"value":"number","minimum":[-90,-90],"maximum":[90,90]}},"terrain":{"source":{"type":"string"},"exaggeration":{"type":"number","default":1,"minimum":0,"maximum":1000,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"paint":["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_building","paint_symbol","paint_raster","paint_raster-particle","paint_hillshade","paint_background","paint_sky","paint_model"],"paint_fill":{"fill-antialias":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-outline-color":{"type":"color","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"fill-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-z-offset":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-bridge-guard-rail-color":{"type":"color","default":"rgba(241, 236, 225, 255)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature"]},"property-type":"data-driven"},"fill-tunnel-structure-color":{"type":"color","default":"rgba(241, 236, 225, 255)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature"]},"property-type":"data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-extrusion-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"fill-extrusion-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-extrusion-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-height":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-height-alignment":{"type":"enum","values":{"terrain":1,"flat":1},"default":"flat"},"fill-extrusion-base-alignment":{"type":"enum","values":{"terrain":1,"flat":1},"default":"terrain"},"fill-extrusion-vertical-gradient":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-ambient-occlusion-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-wall-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-flood-light-color":{"type":"color","default":"#ffffff","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-wall-radius":{"property-type":"data-driven","type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-radius":{"property-type":"data-driven","type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-vertical-scale":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-rounded-roof":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"fill-extrusion-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"fill-extrusion-line-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-extrusion-cast-shadows":{"type":"boolean","default":true}},"paint_building":{"building-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-ambient-occlusion-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"parameters":[]},"transition":true},"building-ambient-occlusion-ground-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"building-ambient-occlusion-ground-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"building-ambient-occlusion-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-vertical-scale":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-cast-shadows":{"type":"boolean","default":true},"building-color":{"type":"color","default":"rgba(193, 154, 127, 1)","use-theme":true,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"property-type":"data-driven"},"building-emissive-strength":{"type":"number","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"property-type":"data-driven"},"building-facade-emissive-chance":{"type":"number","default":0.35,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["measure-light","zoom"]}},"building-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"line-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"line-width":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light","line-progress"]},"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-dasharray":{"type":"array","value":"number","minimum":0,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-gradient":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["line-progress"]}},"line-trim-offset":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1]},"line-trim-fade-range":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1],"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-trim-color":{"type":"color","default":"transparent","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-border-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-border-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-occlusion-opacity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-blur":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"circle-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"circle-pitch-scale":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"circle-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]}},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-intensity":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"heatmap-color":{"type":"color","default":["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",0.1,"royalblue",0.3,"cyan",0.5,"lime",0.7,"yellow",1,"red"],"use-theme":true,"expression":{"interpolated":true,"parameters":["heatmap-density"]}},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-occlusion-opacity":{"type":"number","minimum":0,"maximum":1,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"text-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"icon-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"icon-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"icon-image-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-occlusion-opacity":{"type":"number","minimum":0,"maximum":1,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"overridable":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"text-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"icon-color-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{}},"icon-color-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{}},"icon-color-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"icon-color-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{}},"symbol-z-offset":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-color":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["raster-value"]}},"raster-color-mix":{"type":"array","default":[0.2126,0.7152,0.0722,0],"length":4,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-color-range":{"type":"array","length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-hue-rotate":{"type":"number","default":0,"period":360,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-resampling":{"type":"enum","values":{"linear":1,"nearest":1},"default":"linear","expression":{"parameters":["zoom"]}},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"raster-array-band":{"type":"string"},"raster-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_raster-particle":{"raster-particle-array-band":{"type":"string"},"raster-particle-count":{"type":"number","default":512,"minimum":1},"raster-particle-color":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["raster-particle-speed"]}},"raster-particle-max-speed":{"type":"number","default":1,"minimum":1},"raster-particle-speed-factor":{"type":"number","default":0.2,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-particle-fade-opacity-factor":{"type":"number","default":0.98,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-particle-reset-rate-factor":{"type":"number","default":0.8,"minimum":0,"maximum":1},"raster-particle-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"expression":{"interpolated":true,"parameters":["zoom"]}},"hillshade-illumination-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]}},"hillshade-exaggeration":{"type":"number","default":0.5,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"hillshade-shadow-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-accent-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_background":{"background-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":[]}},"background-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"background-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom"]}},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"background-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_sky":{"sky-type":{"type":"enum","values":{"gradient":1,"atmosphere":1},"default":"atmosphere","expression":{"parameters":["zoom"]}},"sky-atmosphere-sun":{"type":"array","value":"number","length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]}},"sky-atmosphere-sun-intensity":{"type":"number","default":10,"minimum":0,"maximum":100},"sky-gradient-center":{"type":"array","value":"number","default":[0,0],"length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]}},"sky-gradient-radius":{"type":"number","default":90,"minimum":0,"maximum":180,"expression":{"parameters":["zoom"]}},"sky-gradient":{"type":"color","default":["interpolate",["linear"],["sky-radial-progress"],0.8,"#87ceeb",1,"white"],"use-theme":true,"expression":{"interpolated":true,"parameters":["sky-radial-progress"]}},"sky-atmosphere-halo-color":{"type":"color","default":"white","use-theme":true},"sky-atmosphere-color":{"type":"color","default":"white","use-theme":true},"sky-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_model":{"model-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"property-type":"data-driven"},"model-rotation":{"type":"array","value":"number","length":3,"default":[0,0,0],"period":360,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-scale":{"type":"array","value":"number","length":3,"default":[1,1,1],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-translation":{"type":"array","value":"number","length":3,"default":[0,0,0],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-color":{"type":"color","default":"#ffffff","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light","zoom"]},"use-theme":true,"transition":true},"model-color-mix-intensity":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-type":{"type":"enum","values":{"common-3d":1,"location-indicator":1},"default":"common-3d"},"model-cast-shadows":{"type":"boolean","default":true},"model-receive-shadows":{"type":"boolean","default":true},"model-ambient-occlusion-intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"model-emissive-strength":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-roughness":{"type":"number","default":1,"minimum":0,"maximum":1,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state"]},"transition":true},"model-height-based-emissive-strength-multiplier":{"type":"array","default":[1,1,1,1,0],"length":5,"value":"number","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"model-front-cutoff":{"type":"array","value":"number","expression":{"interpolated":true,"parameters":["zoom"]},"length":3,"default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1]}},"transition":{"duration":{"type":"number","default":300,"minimum":0},"delay":{"type":"number","default":0,"minimum":0}},"promoteId":{"*":{"type":"*"}}}');function ka(e){return e instanceof Number||e instanceof String||e instanceof Boolean?e.valueOf():e}function Ma(e){if(Array.isArray(e))return e.map(Ma);if(e instanceof Object&&!(e instanceof Number||e instanceof String||e instanceof Boolean)){const t={};for(const i in e)t[i]=Ma(e[i]);return t}return ka(e)}function Aa(e){if(!0===e||!1===e)return!0;if(!Array.isArray(e)||0===e.length)return!1;switch(e[0]){case"has":return e.length>=2&&"$id"!==e[1]&&"$type"!==e[1];case"in":return e.length>=3&&("string"!=typeof e[1]||Array.isArray(e[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==e.length||Array.isArray(e[1])||Array.isArray(e[2]);case"any":case"all":for(const t of e.slice(1))if(!Aa(t)&&"boolean"!=typeof t)return!1;return!0;default:return!0}}function Ca(e,t="",i=null,n="fill"){if(null==e)return{filter:()=>!0,needGeometry:!1,needFeature:!1};Aa(e)||(e=Oa(e));const r=e;let s=!0;try{s=function(e){if(!Ea(e))return e;let t=Ma(e);return La(t),t=Da(t),t}(r)}catch(e){console.warn(`Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate.\nThis is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md\nand paste the contents of this message in the report.\nThank you!\nFilter Expression:\n${JSON.stringify(r,null,2)}\n `)}let o=null,a=null;if("background"!==n&&"sky"!==n&&"slot"!==n){a=Ta[`filter_${n}`];const e=Ps(s,a,t,i);if("error"===e.result)throw new Error(e.value.map(e=>`${e.key}: ${e.message}`).join(", "));o=(t,i,n)=>e.value.evaluate(t,i,{},n)}let l=null,c=null;if(s!==r){const e=Ps(r,a,t,i);if("error"===e.result)throw new Error(e.value.map(e=>`${e.key}: ${e.message}`).join(", "));l=(t,i,n,r,s)=>e.value.evaluate(t,i,{},n,void 0,void 0,r,s),c=!cr(e.value.expression)}return{filter:o,dynamicFilter:l||void 0,needGeometry:Ra(s),needFeature:!!c}}function Da(e){if(!Array.isArray(e))return e;const t=function(e){if(Ia.has(e[0]))for(let t=1;tDa(e))}function La(e){let t=!1;const i=[];if("case"===e[0]){for(let n=1;n",">=","<","<=","to-boolean"]);function Pa(e,t){return et?1:0}function Ra(e){if(!Array.isArray(e))return!1;if("within"===e[0]||"distance"===e[0])return!0;for(let t=1;t"===t||"<="===t||">="===t?za(e[1],e[2],t):"any"===t?(i=e.slice(1),["any"].concat(i.map(Oa))):"all"===t?["all"].concat(e.slice(1).map(Oa)):"none"===t?["all"].concat(e.slice(1).map(Oa).map(Ya)):"in"===t?Fa(e[1],e.slice(2)):"!in"===t?Ya(Fa(e[1],e.slice(2))):"has"===t?Na(e[1]):"!has"!==t||Ya(Na(e[1]));var i}function za(e,t,i){switch(e){case"$type":return[`filter-type-${i}`,t];case"$id":return[`filter-id-${i}`,t];default:return[`filter-${i}`,e,t]}}function Fa(e,t){if(0===t.length)return!1;switch(e){case"$type":return["filter-type-in",["literal",t]];case"$id":return["filter-id-in",["literal",t]];default:return t.length>200&&!t.some(e=>typeof e!=typeof t[0])?["filter-in-large",e,["literal",t.sort(Pa)]]:["filter-in-small",e,["literal",t]]}}function Na(e){switch(e){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",e]}}function Ya(e){return["!",e]}const Ba="";function Ha(e,t){return t?`${e}${Ba}${t}`:e}const ja="-transition",Va=new Set(["fill","line","background","hillshade","raster"]);class Wa extends ei{constructor(e,t,i,n,r){if(super(),this.id=e.id,this.fqid=Ha(this.id,i),this.type=e.type,this.scope=i,this.lut=n,this.options=r,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,this.configDependencies=new Set,"custom"!==e.type){if(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type&&"background"!==e.type&&"sky"!==e.type&&"slot"!==e.type){this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter;const t=Ps(this.filter,Ta[`filter_${e.type}`]);"error"!==t.result&&(this.configDependencies=new Set([...this.configDependencies,...t.value.configDependencies]))}if(e.slot&&(this.slot=e.slot),t.layout&&(this._unevaluatedLayout=new _a(t.layout,this.scope,r),this.configDependencies=new Set([...this.configDependencies,...this._unevaluatedLayout.configDependencies])),t.paint){this._transitionablePaint=new pa(t.paint,this.scope,r);for(const t in e.paint)this.setPaintProperty(t,e.paint[t]);for(const t in e.layout)this.setLayoutProperty(t,e.layout[t]);this.configDependencies=new Set([...this.configDependencies,...this._transitionablePaint.configDependencies]),this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new va(t.paint)}}}onAdd(e){}onRemove(e){}isDraped(e){return!this.is3D(!0)&&Va.has(this.type)}getLayoutProperty(e){return"visibility"===e?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,t){if("custom"===this.type&&"visibility"===e)return void(this.visibility=t);const i=this._unevaluatedLayout;i._properties.properties[e]&&(i.setValue(e,t),this.configDependencies=new Set([...this.configDependencies,...i.configDependencies]),"visibility"===e&&this.possiblyEvaluateVisibility())}possiblyEvaluateVisibility(){this._unevaluatedLayout._values.visibility&&(this.visibility=this._unevaluatedLayout._values.visibility.possiblyEvaluate({zoom:0}))}getPaintProperty(e){return e.endsWith(ja)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}setPaintProperty(e,t){const i=this._transitionablePaint,n=i._properties.properties;if(e.endsWith(ja)){const r=e.slice(0,-11);return n[r]&&i.setTransition(r,t||void 0),!1}if(!n[e])return!1;const r=i._values[e],s=r.value.isDataDriven(),o=r.value;i.setValue(e,t),this.configDependencies=new Set([...this.configDependencies,...i.configDependencies]),this._handleSpecialPaintPropertyUpdate(e);const a=i._values[e].value,l=a.isDataDriven(),c=e.endsWith("pattern")||"line-dasharray"===e;return l||s||c||this._handleOverridablePaintPropertyUpdate(e,o,a)}_handleSpecialPaintPropertyUpdate(e){}getProgramIds(){return null}getDefaultProgramParams(e,t,i){return null}_handleOverridablePaintPropertyUpdate(e,t,i){return!1}isHidden(e){return!!(this.minzoom&&e=this.maxzoom)||"none"===this.visibility}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,t){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,t)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,t)}serialize(){return Be({id:this.id,type:this.type,slot:this.slot,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()},(e,t)=>!(void 0===e||"layout"===t&&!Object.keys(e).length||"paint"===t&&!Object.keys(e).length))}is3D(e){return!1}hasElevation(){return!1}isSky(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}hasShadowPass(){return!1}canCastShadows(){return!1}hasLightBeamPass(){return!1}cutoffRange(){return 0}tileCoverLift(){return 0}resize(){}_clear(){}isStateDependent(){for(const e in this.paint._values){const t=this.paint.get(e);if(t instanceof ya&&vs(t.property.specification)&&("source"===t.value.kind||"composite"===t.value.kind)&&t.value.isStateDependent)return!0}return!1}compileFilter(e){this._filterCompiled||(this._featureFilter=Ca(this.filter,this.scope,e),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}getLayerRenderingStats(){return this._stats}resetLayerRenderingStats(e){this._stats&&("shadow"===e.renderPass?this._stats.numRenderedVerticesInShadowPass=0:this._stats.numRenderedVerticesInTransparentPass=0)}queryRadius(e){}queryIntersectsFeature(e,t,i,n,r,s,o,a,l){}}const Ua={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class $a{constructor(e,t){this._structArray=e,this._pos1=t*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class Ga{constructor(){this.capacity=-1,this.resize(0)}static serialize(e,t){return e._trim(),t&&t.add(e.arrayBuffer),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const t=Object.create(this.prototype);return t.arrayBuffer=e.arrayBuffer,t.length=e.length,t.capacity=e.arrayBuffer.byteLength/t.bytesPerElement,t._refreshViews(),t}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const t=this.uint8;this._refreshViews(),t&&this.uint8.set(t)}}_refreshViews(){throw new Error("StructArray#_refreshViews() must be implemented by each concrete StructArray layout")}emplace(...e){throw new Error("StructArray#emplace() must be implemented by each concrete StructArray layout")}emplaceBack(...e){throw new Error("StructArray#emplaceBack() must be implemented by each concrete StructArray layout")}destroy(){this.int8=this.uint8=this.int16=this.uint16=this.int32=this.uint32=this.float32=null,this.arrayBuffer=null}}function Xa(e,t=1){let i=0,n=0;return{members:e.map(e=>{const r=Ua[e.type].BYTES_PER_ELEMENT,s=i=qa(i,Math.max(t,r)),o=e.components||1;return n=Math.max(n,r),i+=r*o,{name:e.name,type:e.type,components:o,offset:s}}),size:qa(i,Math.max(n,t)),alignment:t}}function qa(e,t){return Math.ceil(e/t)*t}class Za extends Ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t){const i=this.length;return this.resize(i+1),this.emplace(i,e,t)}emplace(e,t,i){const n=2*e;return this.int16[n+0]=t,this.int16[n+1]=i,e}}Za.prototype.bytesPerElement=4,Ws(Za,"StructArrayLayout2i4");class Ja extends Ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i){const n=this.length;return this.resize(n+1),this.emplace(n,e,t,i)}emplace(e,t,i,n){const r=3*e;return this.int16[r+0]=t,this.int16[r+1]=i,this.int16[r+2]=n,e}}Ja.prototype.bytesPerElement=6,Ws(Ja,"StructArrayLayout3i6");class Ka extends Ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,n){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,i,n)}emplace(e,t,i,n,r){const s=4*e;return this.int16[s+0]=t,this.int16[s+1]=i,this.int16[s+2]=n,this.int16[s+3]=r,e}}Ka.prototype.bytesPerElement=8,Ws(Ka,"StructArrayLayout4i8");class Qa extends Ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.float32[1*e+0]=t,e}}Qa.prototype.bytesPerElement=4,Ws(Qa,"StructArrayLayout1f4");class el extends Ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i){const n=this.length;return this.resize(n+1),this.emplace(n,e,t,i)}emplace(e,t,i,n){const r=4*e,s=2*e;return this.int16[r+0]=t,this.int16[r+1]=i,this.float32[s+1]=n,e}}el.prototype.bytesPerElement=8,Ws(el,"StructArrayLayout2i1f8");class tl extends Ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i){const n=this.length;return this.resize(n+1),this.emplace(n,e,t,i)}emplace(e,t,i,n){const r=4*e;return this.int16[r+0]=t,this.int16[r+1]=i,this.int16[r+2]=n,e}}tl.prototype.bytesPerElement=8,Ws(tl,"StructArrayLayout3i8");class il extends Ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,n,r){const s=this.length;return this.resize(s+1),this.emplace(s,e,t,i,n,r)}emplace(e,t,i,n,r,s){const o=5*e;return this.int16[o+0]=t,this.int16[o+1]=i,this.int16[o+2]=n,this.int16[o+3]=r,this.int16[o+4]=s,e}}il.prototype.bytesPerElement=10,Ws(il,"StructArrayLayout5i10");class nl extends Ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,n,r,s,o){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,i,n,r,s,o)}emplace(e,t,i,n,r,s,o,a){const l=6*e,c=12*e,h=3*e;return this.int16[l+0]=t,this.int16[l+1]=i,this.uint8[c+4]=n,this.uint8[c+5]=r,this.uint8[c+6]=s,this.uint8[c+7]=o,this.float32[h+2]=a,e}}nl.prototype.bytesPerElement=12,Ws(nl,"StructArrayLayout2i4ub1f12");class rl extends Ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i){const n=this.length;return this.resize(n+1),this.emplace(n,e,t,i)}emplace(e,t,i,n){const r=3*e;return this.float32[r+0]=t,this.float32[r+1]=i,this.float32[r+2]=n,e}}rl.prototype.bytesPerElement=12,Ws(rl,"StructArrayLayout3f12");class sl extends Ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,n,r){const s=this.length;return this.resize(s+1),this.emplace(s,e,t,i,n,r)}emplace(e,t,i,n,r,s){const o=6*e,a=3*e;return this.uint16[o+0]=t,this.uint16[o+1]=i,this.uint16[o+2]=n,this.uint16[o+3]=r,this.float32[a+2]=s,e}}sl.prototype.bytesPerElement=12,Ws(sl,"StructArrayLayout4ui1f12");class ol extends Ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,n){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,i,n)}emplace(e,t,i,n,r){const s=4*e;return this.uint16[s+0]=t,this.uint16[s+1]=i,this.uint16[s+2]=n,this.uint16[s+3]=r,e}}ol.prototype.bytesPerElement=8,Ws(ol,"StructArrayLayout4ui8");class al extends Ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,n,r,s){const o=this.length;return this.resize(o+1),this.emplace(o,e,t,i,n,r,s)}emplace(e,t,i,n,r,s,o){const a=6*e;return this.int16[a+0]=t,this.int16[a+1]=i,this.int16[a+2]=n,this.int16[a+3]=r,this.int16[a+4]=s,this.int16[a+5]=o,e}}al.prototype.bytesPerElement=12,Ws(al,"StructArrayLayout6i12");class ll extends Ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,n,r,s,o,a,l,c,h,d){const u=this.length;return this.resize(u+1),this.emplace(u,e,t,i,n,r,s,o,a,l,c,h,d)}emplace(e,t,i,n,r,s,o,a,l,c,h,d,u){const f=12*e;return this.int16[f+0]=t,this.int16[f+1]=i,this.int16[f+2]=n,this.int16[f+3]=r,this.uint16[f+4]=s,this.uint16[f+5]=o,this.uint16[f+6]=a,this.uint16[f+7]=l,this.int16[f+8]=c,this.int16[f+9]=h,this.int16[f+10]=d,this.int16[f+11]=u,e}}ll.prototype.bytesPerElement=24,Ws(ll,"StructArrayLayout4i4ui4i24");class cl extends Ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,n,r,s){const o=this.length;return this.resize(o+1),this.emplace(o,e,t,i,n,r,s)}emplace(e,t,i,n,r,s,o){const a=10*e,l=5*e;return this.int16[a+0]=t,this.int16[a+1]=i,this.int16[a+2]=n,this.float32[l+2]=r,this.float32[l+3]=s,this.float32[l+4]=o,e}}cl.prototype.bytesPerElement=20,Ws(cl,"StructArrayLayout3i3f20");class hl extends Ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,n){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,i,n)}emplace(e,t,i,n,r){const s=4*e;return this.float32[s+0]=t,this.float32[s+1]=i,this.float32[s+2]=n,this.float32[s+3]=r,e}}hl.prototype.bytesPerElement=16,Ws(hl,"StructArrayLayout4f16");class dl extends Ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.uint32[1*e+0]=t,e}}dl.prototype.bytesPerElement=4,Ws(dl,"StructArrayLayout1ul4");class ul extends Ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t){const i=this.length;return this.resize(i+1),this.emplace(i,e,t)}emplace(e,t,i){const n=2*e;return this.uint16[n+0]=t,this.uint16[n+1]=i,e}}ul.prototype.bytesPerElement=4,Ws(ul,"StructArrayLayout2ui4");class fl extends Ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,n,r,s,o,a,l,c,h,d,u){const f=this.length;return this.resize(f+1),this.emplace(f,e,t,i,n,r,s,o,a,l,c,h,d,u)}emplace(e,t,i,n,r,s,o,a,l,c,h,d,u,f){const p=20*e,m=10*e;return this.int16[p+0]=t,this.int16[p+1]=i,this.int16[p+2]=n,this.int16[p+3]=r,this.int16[p+4]=s,this.float32[m+3]=o,this.float32[m+4]=a,this.float32[m+5]=l,this.float32[m+6]=c,this.int16[p+14]=h,this.uint32[m+8]=d,this.uint16[p+18]=u,this.uint16[p+19]=f,e}}fl.prototype.bytesPerElement=40,Ws(fl,"StructArrayLayout5i4f1i1ul2ui40");class pl extends Ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,n,r,s,o){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,i,n,r,s,o)}emplace(e,t,i,n,r,s,o,a){const l=8*e;return this.int16[l+0]=t,this.int16[l+1]=i,this.int16[l+2]=n,this.int16[l+4]=r,this.int16[l+5]=s,this.int16[l+6]=o,this.int16[l+7]=a,e}}pl.prototype.bytesPerElement=16,Ws(pl,"StructArrayLayout3i2i2i16");class ml extends Ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,n,r){const s=this.length;return this.resize(s+1),this.emplace(s,e,t,i,n,r)}emplace(e,t,i,n,r,s){const o=4*e,a=8*e;return this.float32[o+0]=t,this.float32[o+1]=i,this.float32[o+2]=n,this.int16[a+6]=r,this.int16[a+7]=s,e}}ml.prototype.bytesPerElement=16,Ws(ml,"StructArrayLayout2f1f2i16");class gl extends Ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,n,r,s){const o=this.length;return this.resize(o+1),this.emplace(o,e,t,i,n,r,s)}emplace(e,t,i,n,r,s,o){const a=20*e,l=5*e;return this.uint8[a+0]=t,this.uint8[a+1]=i,this.float32[l+1]=n,this.float32[l+2]=r,this.float32[l+3]=s,this.float32[l+4]=o,e}}gl.prototype.bytesPerElement=20,Ws(gl,"StructArrayLayout2ub4f20");class _l extends Ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i){const n=this.length;return this.resize(n+1),this.emplace(n,e,t,i)}emplace(e,t,i,n){const r=3*e;return this.uint16[r+0]=t,this.uint16[r+1]=i,this.uint16[r+2]=n,e}}_l.prototype.bytesPerElement=6,Ws(_l,"StructArrayLayout3ui6");class yl extends Ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e,t,i,n,r,s,o,a,l,c,h,d,u,f,p,m,g,_,y,v,x){const b=this.length;return this.resize(b+1),this.emplace(b,e,t,i,n,r,s,o,a,l,c,h,d,u,f,p,m,g,_,y,v,x)}emplace(e,t,i,n,r,s,o,a,l,c,h,d,u,f,p,m,g,_,y,v,x,b){const w=30*e,S=15*e,T=60*e;return this.int16[w+0]=t,this.int16[w+1]=i,this.int16[w+2]=n,this.float32[S+2]=r,this.float32[S+3]=s,this.uint16[w+8]=o,this.uint16[w+9]=a,this.uint32[S+5]=l,this.uint32[S+6]=c,this.uint32[S+7]=h,this.uint16[w+16]=d,this.uint16[w+17]=u,this.uint16[w+18]=f,this.float32[S+10]=p,this.float32[S+11]=m,this.uint8[T+48]=g,this.uint8[T+49]=_,this.uint8[T+50]=y,this.uint32[S+13]=v,this.int16[w+28]=x,this.uint8[T+58]=b,e}}yl.prototype.bytesPerElement=60,Ws(yl,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class vl extends Ga{_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(e,t,i,n,r,s,o,a,l,c,h,d,u,f,p,m,g,_,y,v,x,b,w,S,T,k,M,A,C,D,L,E,I){const P=this.length;return this.resize(P+1),this.emplace(P,e,t,i,n,r,s,o,a,l,c,h,d,u,f,p,m,g,_,y,v,x,b,w,S,T,k,M,A,C,D,L,E,I)}emplace(e,t,i,n,r,s,o,a,l,c,h,d,u,f,p,m,g,_,y,v,x,b,w,S,T,k,M,A,C,D,L,E,I,P){const R=20*e,O=40*e,z=80*e;return this.float32[R+0]=t,this.float32[R+1]=i,this.int16[O+4]=n,this.int16[O+5]=r,this.int16[O+6]=s,this.int16[O+7]=o,this.int16[O+8]=a,this.int16[O+9]=l,this.int16[O+10]=c,this.int16[O+11]=h,this.int16[O+12]=d,this.uint16[O+13]=u,this.uint16[O+14]=f,this.uint16[O+15]=p,this.uint16[O+16]=m,this.uint16[O+17]=g,this.uint16[O+18]=_,this.uint16[O+19]=y,this.uint16[O+20]=v,this.uint16[O+21]=x,this.uint16[O+22]=b,this.uint16[O+23]=w,this.uint16[O+24]=S,this.uint16[O+25]=T,this.uint16[O+26]=k,this.uint16[O+27]=M,this.uint32[R+14]=A,this.float32[R+15]=C,this.float32[R+16]=D,this.float32[R+17]=L,this.float32[R+18]=E,this.uint8[z+76]=I,this.uint16[O+39]=P,e}}vl.prototype.bytesPerElement=80,Ws(vl,"StructArrayLayout2f9i15ui1ul4f1ub1ui80");class xl extends Ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,n,r,s){const o=this.length;return this.resize(o+1),this.emplace(o,e,t,i,n,r,s)}emplace(e,t,i,n,r,s,o){const a=6*e;return this.float32[a+0]=t,this.float32[a+1]=i,this.float32[a+2]=n,this.float32[a+3]=r,this.float32[a+4]=s,this.float32[a+5]=o,e}}xl.prototype.bytesPerElement=24,Ws(xl,"StructArrayLayout6f24");class bl extends Ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,n,r){const s=this.length;return this.resize(s+1),this.emplace(s,e,t,i,n,r)}emplace(e,t,i,n,r,s){const o=5*e;return this.float32[o+0]=t,this.float32[o+1]=i,this.float32[o+2]=n,this.float32[o+3]=r,this.float32[o+4]=s,e}}bl.prototype.bytesPerElement=20,Ws(bl,"StructArrayLayout5f20");class wl extends Ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,n,r,s,o){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,i,n,r,s,o)}emplace(e,t,i,n,r,s,o,a){const l=7*e;return this.float32[l+0]=t,this.float32[l+1]=i,this.float32[l+2]=n,this.float32[l+3]=r,this.float32[l+4]=s,this.float32[l+5]=o,this.float32[l+6]=a,e}}wl.prototype.bytesPerElement=28,Ws(wl,"StructArrayLayout7f28");class Sl extends Ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,n,r,s,o,a,l,c,h){const d=this.length;return this.resize(d+1),this.emplace(d,e,t,i,n,r,s,o,a,l,c,h)}emplace(e,t,i,n,r,s,o,a,l,c,h,d){const u=11*e;return this.float32[u+0]=t,this.float32[u+1]=i,this.float32[u+2]=n,this.float32[u+3]=r,this.float32[u+4]=s,this.float32[u+5]=o,this.float32[u+6]=a,this.float32[u+7]=l,this.float32[u+8]=c,this.float32[u+9]=h,this.float32[u+10]=d,e}}Sl.prototype.bytesPerElement=44,Ws(Sl,"StructArrayLayout11f44");class Tl extends Ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,n,r,s,o,a,l){const c=this.length;return this.resize(c+1),this.emplace(c,e,t,i,n,r,s,o,a,l)}emplace(e,t,i,n,r,s,o,a,l,c){const h=9*e;return this.float32[h+0]=t,this.float32[h+1]=i,this.float32[h+2]=n,this.float32[h+3]=r,this.float32[h+4]=s,this.float32[h+5]=o,this.float32[h+6]=a,this.float32[h+7]=l,this.float32[h+8]=c,e}}Tl.prototype.bytesPerElement=36,Ws(Tl,"StructArrayLayout9f36");class kl extends Ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t){const i=this.length;return this.resize(i+1),this.emplace(i,e,t)}emplace(e,t,i){const n=2*e;return this.float32[n+0]=t,this.float32[n+1]=i,e}}kl.prototype.bytesPerElement=8,Ws(kl,"StructArrayLayout2f8");class Ml extends Ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,n){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,i,n)}emplace(e,t,i,n,r){const s=6*e;return this.uint32[3*e+0]=t,this.uint16[s+2]=i,this.uint16[s+3]=n,this.uint16[s+4]=r,e}}Ml.prototype.bytesPerElement=12,Ws(Ml,"StructArrayLayout1ul3ui12");class Al extends Ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.uint16[1*e+0]=t,e}}Al.prototype.bytesPerElement=2,Ws(Al,"StructArrayLayout1ui2");class Cl extends Ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,n,r,s,o,a,l,c,h,d,u,f,p,m){const g=this.length;return this.resize(g+1),this.emplace(g,e,t,i,n,r,s,o,a,l,c,h,d,u,f,p,m)}emplace(e,t,i,n,r,s,o,a,l,c,h,d,u,f,p,m,g){const _=16*e;return this.float32[_+0]=t,this.float32[_+1]=i,this.float32[_+2]=n,this.float32[_+3]=r,this.float32[_+4]=s,this.float32[_+5]=o,this.float32[_+6]=a,this.float32[_+7]=l,this.float32[_+8]=c,this.float32[_+9]=h,this.float32[_+10]=d,this.float32[_+11]=u,this.float32[_+12]=f,this.float32[_+13]=p,this.float32[_+14]=m,this.float32[_+15]=g,e}}Cl.prototype.bytesPerElement=64,Ws(Cl,"StructArrayLayout16f64");class Dl extends Ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,n,r,s,o){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,i,n,r,s,o)}emplace(e,t,i,n,r,s,o,a){const l=10*e,c=5*e;return this.uint16[l+0]=t,this.uint16[l+1]=i,this.uint16[l+2]=n,this.uint16[l+3]=r,this.float32[c+2]=s,this.float32[c+3]=o,this.float32[c+4]=a,e}}Dl.prototype.bytesPerElement=20,Ws(Dl,"StructArrayLayout4ui3f20");class Ll extends Ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.int16[1*e+0]=t,e}}Ll.prototype.bytesPerElement=2,Ws(Ll,"StructArrayLayout1i2");class El extends Ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.uint8[1*e+0]=t,e}}El.prototype.bytesPerElement=1,Ws(El,"StructArrayLayout1ub1");class Il extends $a{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.int16[this._pos2+3]}get tileAnchorY(){return this._structArray.int16[this._pos2+4]}get x1(){return this._structArray.float32[this._pos4+3]}get y1(){return this._structArray.float32[this._pos4+4]}get x2(){return this._structArray.float32[this._pos4+5]}get y2(){return this._structArray.float32[this._pos4+6]}get padding(){return this._structArray.int16[this._pos2+14]}get featureIndex(){return this._structArray.uint32[this._pos4+8]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+18]}get bucketIndex(){return this._structArray.uint16[this._pos2+19]}}Il.prototype.size=40;class Pl extends fl{get(e){return new Il(this,e)}}Ws(Pl,"CollisionBoxArray");class Rl extends $a{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.float32[this._pos4+2]}get tileAnchorY(){return this._structArray.float32[this._pos4+3]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+8]}get numGlyphs(){return this._structArray.uint16[this._pos2+9]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+5]}get lineStartIndex(){return this._structArray.uint32[this._pos4+6]}get lineLength(){return this._structArray.uint32[this._pos4+7]}get segment(){return this._structArray.uint16[this._pos2+16]}get lowerSize(){return this._structArray.uint16[this._pos2+17]}get upperSize(){return this._structArray.uint16[this._pos2+18]}get lineOffsetX(){return this._structArray.float32[this._pos4+10]}get lineOffsetY(){return this._structArray.float32[this._pos4+11]}get writingMode(){return this._structArray.uint8[this._pos1+48]}get placedOrientation(){return this._structArray.uint8[this._pos1+49]}set placedOrientation(e){this._structArray.uint8[this._pos1+49]=e}get hidden(){return this._structArray.uint8[this._pos1+50]}set hidden(e){this._structArray.uint8[this._pos1+50]=e}get crossTileID(){return this._structArray.uint32[this._pos4+13]}set crossTileID(e){this._structArray.uint32[this._pos4+13]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+28]}get flipState(){return this._structArray.uint8[this._pos1+58]}set flipState(e){this._structArray.uint8[this._pos1+58]=e}}Rl.prototype.size=60;class Ol extends yl{get(e){return new Rl(this,e)}}Ws(Ol,"PlacedSymbolArray");class zl extends $a{get tileAnchorX(){return this._structArray.float32[this._pos4+0]}get tileAnchorY(){return this._structArray.float32[this._pos4+1]}get projectedAnchorX(){return this._structArray.int16[this._pos2+4]}get projectedAnchorY(){return this._structArray.int16[this._pos2+5]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+6]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+7]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+8]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+9]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+10]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+11]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+12]}get key(){return this._structArray.uint16[this._pos2+13]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+14]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+15]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+16]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+17]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+18]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+19]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+20]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+21]}get featureIndex(){return this._structArray.uint16[this._pos2+22]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+23]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+24]}get numIconVertices(){return this._structArray.uint16[this._pos2+25]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+26]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+27]}get crossTileID(){return this._structArray.uint32[this._pos4+14]}set crossTileID(e){this._structArray.uint32[this._pos4+14]=e}get textOffset0(){return this._structArray.float32[this._pos4+15]}get textOffset1(){return this._structArray.float32[this._pos4+16]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+17]}get zOffset(){return this._structArray.float32[this._pos4+18]}set zOffset(e){this._structArray.float32[this._pos4+18]=e}get hasIconTextFit(){return this._structArray.uint8[this._pos1+76]}get elevationFeatureIndex(){return this._structArray.uint16[this._pos2+39]}}zl.prototype.size=80;class Fl extends vl{get(e){return new zl(this,e)}}Ws(Fl,"SymbolInstanceArray");class Nl extends Qa{getoffsetX(e){return this.float32[1*e+0]}}Ws(Nl,"GlyphOffsetArray");class Yl extends Za{getx(e){return this.int16[2*e+0]}gety(e){return this.int16[2*e+1]}}Ws(Yl,"SymbolLineVertexArray");class Bl extends $a{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]}}Bl.prototype.size=12;class Hl extends Ml{get(e){return new Bl(this,e)}}Ws(Hl,"FeatureIndexArray");class jl extends ul{geta_centroid_pos0(e){return this.uint16[2*e+0]}geta_centroid_pos1(e){return this.uint16[2*e+1]}}Ws(jl,"FillExtrusionCentroidArray");class Vl extends $a{get a_join_normal_inside0(){return this._structArray.int16[this._pos2+0]}get a_join_normal_inside1(){return this._structArray.int16[this._pos2+1]}get a_join_normal_inside2(){return this._structArray.int16[this._pos2+2]}}Vl.prototype.size=6;class Wl extends Ja{get(e){return new Vl(this,e)}}Ws(Wl,"FillExtrusionWallArray");const Ul=Xa([{name:"a_pos",components:2,type:"Int16"}],4),$l=Xa([{name:"a_circle_z_offset",components:1,type:"Float32"}],4),Gl=Xa([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class Xl{constructor(e=[]){this.segments=e}_prepareSegment(e,t,i,n){let r=this.segments[this.segments.length-1];return e>Xl.MAX_VERTEX_ARRAY_LENGTH&&We(`Max vertices per segment is ${Xl.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!r||r.vertexLength+e>Xl.MAX_VERTEX_ARRAY_LENGTH||r.sortKey!==n)&&(r={vertexOffset:t,primitiveOffset:i,vertexLength:0,primitiveLength:0},void 0!==n&&(r.sortKey=n),this.segments.push(r)),r}prepareSegment(e,t,i,n){return this._prepareSegment(e,t.length,i.length,n)}get(){return this.segments}destroy(){for(const e of this.segments)for(const t in e.vaos)e.vaos[t].destroy()}static simpleSegment(e,t,i,n){return new Xl([{vertexOffset:e,primitiveOffset:t,vertexLength:i,primitiveLength:n,vaos:{},sortKey:0}])}}function ql(e,t){return 256*(e=Le(Math.floor(e),0,255))+Le(Math.floor(t),0,255)}Xl.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Ws(Xl,"SegmentVector");const Zl=Xa([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),Jl=Xa([{name:"a_pattern_b",components:4,type:"Uint16"}]),Kl=Xa([{name:"a_dash",components:4,type:"Uint16"}]);class Ql{constructor(){this.ids=[],this.uniqueIds=[],this.positions=[],this.indexed=!1}add(e,t,i,n){this.ids.push(ec(e)),this.positions.push(t,i,n)}eachPosition(e,t){const i=ec(e);let n=0,r=this.ids.length-1;for(;n>1;this.ids[e]>=i?r=e:n=e+1}for(;this.ids[n]===i;)t(this.positions[3*n],this.positions[3*n+1],this.positions[3*n+2]),n++}static serialize(e,t){const i=new Float64Array(e.ids),n=new Uint32Array(e.positions);return tc(i,n,0,i.length-1),t&&(t.add(i.buffer),t.add(n.buffer)),{ids:i,positions:n}}static deserialize(e){const t=new Ql;let i;t.ids=e.ids,t.positions=e.positions;for(const e of t.ids)e!==i&&t.uniqueIds.push(e),i=e;return t.indexed=!0,t}}function ec(e){const t=+e;return!isNaN(t)&&Number.MIN_SAFE_INTEGER<=t&&t<=Number.MAX_SAFE_INTEGER?t:qt(String(e))}function tc(e,t,i,n){for(;i>1];let s=i-1,o=n+1;for(;;){do{s++}while(e[s]r);if(s>=o)break;ic(e,s,o),ic(t,3*s,3*o),ic(t,3*s+1,3*o+1),ic(t,3*s+2,3*o+2)}o-i`u_${e}`),this.type=i,this.context=n}setUniform(e,t,i,n,r){const s=n.constantOr(this.value);t.set(e,r,s instanceof si?s.toPremultipliedRenderColor(this.lutExpression&&"none"===this.lutExpression.value?null:this.context.lut):s)}getBinding(e,t){return"color"===this.type?new cc(e):new sc(e)}}class _c{constructor(e,t){this.uniformNames=t.map(e=>`u_${e}`),this.pattern=null,this.patternTransition=null,this.pixelRatio=1}setConstantPatternPositions(e,t){this.pixelRatio=e.pixelRatio||1,this.pattern=e.tl.concat(e.br),this.patternTransition=t?t.tl.concat(t.br):this.pattern}setUniform(e,t,i,n,r){let s=null;"u_pattern"!==r&&"u_dash"!==r||(s=this.pattern),"u_pattern_b"===r&&(s=this.patternTransition),"u_pixel_ratio"===r&&(s=this.pixelRatio),s&&t.set(e,r,s)}getBinding(e,t){return"u_pattern"===t||"u_pattern_b"===t||"u_dash"===t?new lc(e):new sc(e)}}class yc{constructor(e,t,i,n){this.expression=e,this.type=i,this.maxValue=0,this.paintVertexAttributes=t.map(e=>({name:`a_${e}`,type:"Float32",components:"color"===i?2:1,offset:0})),this.paintVertexArray=new n}populatePaintArray(e,t,i,n,r,s,o,a){const l=this.paintVertexArray.length,c="composite"===this.expression.kind||"source"===this.expression.kind?this.expression.evaluate(new da(0,{brightness:s,worldview:a}),t,{},r,n,o):"constant"===this.expression.kind&&this.expression.value,h=!!this.lutExpression&&"none"===("composite"===this.lutExpression.kind||"source"===this.lutExpression.kind?this.lutExpression.evaluate(new da(0,{brightness:s,worldview:a}),t,{},r,n,o):this.lutExpression.value);this.paintVertexArray.resize(e),this._setPaintValue(l,e,c,h?null:this.context.lut)}updatePaintArray(e,t,i,n,r,s,o,a){const l="composite"===this.expression.kind||"source"===this.expression.kind?this.expression.evaluate({zoom:0,brightness:o,worldview:a},i,n,void 0,r):"constant"===this.expression.kind&&this.expression.value,c=!!this.lutExpression&&"none"===("composite"===this.lutExpression.kind||"source"===this.lutExpression.kind?this.lutExpression.evaluate(new da(0,{brightness:o,worldview:a}),i,n,void 0,r):this.lutExpression.value);this._setPaintValue(e,t,l,c?null:this.context.lut)}_setPaintValue(e,t,i,n){if("color"===this.type){const r=mc(i.toPremultipliedRenderColor(n));for(let i=e;i`u_${e}_t`),this.type=i,this.useIntegerZoom=n,this.context=r,this.maxValue=0,this.paintVertexAttributes=t.map(e=>({name:`a_${e}`,type:"Float32",components:"color"===i?4:2,offset:0})),this.paintVertexArray=new s}populatePaintArray(e,t,i,n,r,s,o,a){const l=this.expression.evaluate(new da(this.context.zoom,{brightness:s,worldview:a}),t,{},r,n,o),c=this.expression.evaluate(new da(this.context.zoom+1,{brightness:s,worldview:a}),t,{},r,n,o),h=!!this.lutExpression&&"none"===("composite"===this.lutExpression.kind||"source"===this.lutExpression.kind?this.lutExpression.evaluate(new da(0,{brightness:s,worldview:a}),t,{},r,n,o):this.lutExpression.value),d=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(d,e,l,c,h?null:this.context.lut)}updatePaintArray(e,t,i,n,r,s,o,a){const l=this.expression.evaluate({zoom:this.context.zoom,brightness:o,worldview:a},i,n,void 0,r),c=this.expression.evaluate({zoom:this.context.zoom+1,brightness:o,worldview:a},i,n,void 0,r),h=!!this.lutExpression&&"none"===("composite"===this.lutExpression.kind||"source"===this.lutExpression.kind?this.lutExpression.evaluate(new da(0,{brightness:o,worldview:a}),i,n,void 0,r):this.lutExpression.value);this._setPaintValue(e,t,l,c,h?null:this.context.lut)}_setPaintValue(e,t,i,n,r){if("color"===this.type){const n=mc(i.toPremultipliedRenderColor(r)),s=mc(i.toPremultipliedRenderColor(r));for(let i=e;i!0){this.binders={},this._buffers=[],this.context=t;const n=[];for(const r in e.paint._values){const s=e.paint.get(r);if(r.endsWith("-use-theme"))continue;if(!i(r))continue;if(!(s instanceof ya&&vs(s.property.specification)))continue;const o=Tc(r,e.type),a=s.value,l=s.property.specification.type,c=!!s.property.useIntegerZoom,h="line-dasharray"===r||r.endsWith("pattern"),d=e.paint.get(`${r}-use-theme`),u="line-dasharray"===r&&"constant"!==e.layout.get("line-cap").value.kind||d&&"constant"!==d.value.kind;if("constant"!==a.kind||u)if("source"===a.kind||u||h){const t=Ac(r,l,"source");this.binders[r]=h?new xc(a,o,l,t,e.id):new yc(a,o,l,t),n.push(`/a_${r}`)}else{const e=Ac(r,l,"composite");this.binders[r]=new vc(a,o,l,c,t,e),n.push(`/z_${r}`)}else this.binders[r]=h?new _c(a.value,o):new gc(a.value,o,l,t),n.push(`/u_${r}`);d&&(this.binders[r].lutExpression=d.value)}this.cacheKey=n.sort().join("")}getMaxValue(e){const t=this.binders[e];return t instanceof yc||t instanceof vc?t.maxValue:0}populatePaintArrays(e,t,i,n,r,s,o,a){for(const l in this.binders){const c=this.binders[l];c.context=this.context,(c instanceof yc||c instanceof vc||c instanceof xc)&&c.populatePaintArray(e,t,i,n,r,s,o,a)}}setConstantPatternPositions(e,t){for(const i in this.binders){const n=this.binders[i];n instanceof _c&&n.setConstantPatternPositions(e,t)}}getPatternTransitionVertexBuffer(e){const t=this.binders[e];return t instanceof xc?t.paintTransitionVertexBuffer:null}updatePaintArrays(e,t,i,n,r,s,o,a,l,c){let h=!1;const d=Object.keys(e),u=0!==d.length&&!a,f=u?d:t.uniqueIds;this.context.lut=r.lut;for(const a in this.binders){const d=this.binders[a];if(d.context=this.context,(d instanceof yc||d instanceof vc||d instanceof xc)&&d.expression&&d.expression.kind&&"constant"!==d.expression.kind&&(!0===d.expression.isStateDependent||!1===d.expression.isLightConstant)){const p=r.paint.get(a);d.expression=p.value;for(const i of f){const r=e[i.toString()];t.eachPosition(i,(e,t,i)=>{const a=n.feature(e);d.updatePaintArray(t,i,a,r,s,o,l,c)})}if(!u)for(const t of i.uniqueIds){const r=e[t.toString()];i.eachPosition(t,(e,t,i)=>{const a=n.feature(e);d.updatePaintArray(t,i,a,r,s,o,l,c)})}h=!0}}return h}defines(){const e=[];for(const t in this.binders){const i=this.binders[t];(i instanceof gc||i instanceof _c)&&e.push(...i.uniformNames.map(e=>`#define HAS_UNIFORM_${e}`))}return e}getBinderAttributes(){const e=[];for(const t in this.binders){const i=this.binders[t];if(i instanceof yc||i instanceof vc||i instanceof xc)for(let t=0;t!0){this.programConfigurations={};for(const n of e)this.programConfigurations[n.id]=new bc(n,t,i);this.needsUpload=!1,this._featureMap=new Ql,this._featureMapWithoutIds=new Ql,this._bufferOffset=0,this._idlessCounter=0}populatePaintArrays(e,t,i,n,r,s,o,a,l){for(const i in this.programConfigurations)this.programConfigurations[i].populatePaintArrays(e,t,n,r,s,o,a,l);void 0!==t.id?this._featureMap.add(t.id,i,this._bufferOffset,e):(this._featureMapWithoutIds.add(this._idlessCounter,i,this._bufferOffset,e),this._idlessCounter+=1),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,t,i,n,r,s,o,a){for(const l of i)this.needsUpload=this.programConfigurations[l.id].updatePaintArrays(e,this._featureMap,this._featureMapWithoutIds,t,l,n,r,s,o||0,a)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const t in this.programConfigurations)this.programConfigurations[t].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}const Sc={"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-occlusion-opacity":["occlusion_opacity"],"icon-occlusion-opacity":["occlusion_opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-emissive-strength":["emissive_strength"],"icon-emissive-strength":["emissive_strength"],"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"],"symbol-z-offset":["z_offset"],"line-gap-width":["gapwidth"],"line-pattern":["pattern","pixel_ratio","pattern_b"],"fill-pattern":["pattern","pixel_ratio","pattern_b"],"fill-extrusion-pattern":["pattern","pixel_ratio","pattern_b"],"line-dasharray":["dash"],"fill-bridge-guard-rail-color":["structure_color"],"fill-tunnel-structure-color":["structure_color"]};function Tc(e,t){return Sc[e]||[e.replace(`${t}-`,"").replace(/-/g,"_")]}const kc={"line-pattern":{source:sl,composite:sl},"fill-pattern":{source:sl,composite:sl},"fill-extrusion-pattern":{source:sl,composite:sl},"line-dasharray":{source:ol,composite:ol}},Mc={color:{source:kl,composite:hl},number:{source:Qa,composite:kl}};function Ac(e,t,i){const n=kc[e];return n&&n[i]||Mc[t][i]}Ws(gc,"ConstantBinder"),Ws(_c,"PatternConstantBinder"),Ws(yc,"SourceExpressionBinder"),Ws(xc,"PatternCompositeBinder"),Ws(vc,"CompositeExpressionBinder"),Ws(bc,"ProgramConfiguration",{omit:["_buffers"]}),Ws(wc,"ProgramConfigurationSet");const Cc=Rn/Math.PI/2,Dc=64,Lc=[Dc,32,16],Ec=-Cc,Ic=Cc;function Pc(e,t,i,n=Cc){return i=Te(i),[e*Math.sin(i)*n,-t*n,e*Math.cos(i)*n]}function Rc(e,t,i){return Pc(Math.cos(Te(e)),Math.sin(Te(e)),t,i)}const Oc=6371008.8,zc=2*Math.PI*Oc;class Fc{constructor(e,t){if(isNaN(e)||isNaN(t))throw new Error(`Invalid LngLat object: (${e}, ${t})`);if(this.lng=+e,this.lat=+t,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Fc(Ie(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const t=Math.PI/180,i=this.lat*t,n=e.lat*t,r=Math.sin(i)*Math.sin(n)+Math.cos(i)*Math.cos(n)*Math.cos((e.lng-this.lng)*t);return Oc*Math.acos(Math.min(r,1))}toBounds(e=0){const t=360*e/40075017,i=t/Math.cos(Math.PI/180*this.lat);return new Nc({lng:this.lng-i,lat:this.lat-t},{lng:this.lng+i,lat:this.lat+t})}toEcef(e){return Rc(this.lat,this.lng,Cc+e*Cc/Oc)}static convert(e){if(e instanceof Fc)return e;if(Array.isArray(e)&&(2===e.length||3===e.length))return new Fc(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&"object"==typeof e&&null!==e)return new Fc(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")}}class Nc{constructor(e,t){if(e)if(t)this.setSouthWest(e).setNorthEast(t);else if(4===e.length){const t=e;this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]])}else{const t=e;this.setSouthWest(t[0]).setNorthEast(t[1])}}setNorthEast(e){return this._ne=e instanceof Fc?new Fc(e.lng,e.lat):Fc.convert(e),this}setSouthWest(e){return this._sw=e instanceof Fc?new Fc(e.lng,e.lat):Fc.convert(e),this}extend(e){const t=this._sw,i=this._ne;let n,r;if(e instanceof Fc)n=e,r=e;else{if(!(e instanceof Nc))return Array.isArray(e)?4===e.length||e.every(Array.isArray)?this.extend(Nc.convert(e)):this.extend(Fc.convert(e)):"object"==typeof e&&null!==e&&e.hasOwnProperty("lat")&&(e.hasOwnProperty("lon")||e.hasOwnProperty("lng"))?this.extend(Fc.convert(e)):this;if(n=e._sw,r=e._ne,!n||!r)return this}return t||i?(t.lng=Math.min(n.lng,t.lng),t.lat=Math.min(n.lat,t.lat),i.lng=Math.max(r.lng,i.lng),i.lat=Math.max(r.lat,i.lat)):(this._sw=new Fc(n.lng,n.lat),this._ne=new Fc(r.lng,r.lat)),this}getCenter(){return new Fc((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new Fc(this.getWest(),this.getNorth())}getSouthEast(){return new Fc(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){const{lng:t,lat:i}=Fc.convert(e);let n=this._sw.lng<=t&&t<=this._ne.lng;return this._sw.lng>this._ne.lng&&(n=this._sw.lng>=t&&t>=this._ne.lng),this._sw.lat<=i&&i<=this._ne.lat&&n}static convert(e){if(e)return e instanceof Nc?e:new Nc(e)}}function Yc(e){return zc*Math.cos(e*Math.PI/180)}function Bc(e){return(180+e)/360}function Hc(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function jc(e,t){return e/Yc(t)}function Vc(e){return 360*e-180}function Wc(e){return 360/Math.PI*Math.atan(Math.exp((180-360*e)*Math.PI/180))-90}function Uc(e,t){return e*Yc(Wc(t))}const $c=85.051129;function Gc(e){return Math.cos(Te(Le(e,-$c,$c)))}function Xc(e,t){const i=Le(t,0,25.5),n=Math.pow(2,i);return Gc(e)*zc/(512*n)}function qc(e){return 1/Math.cos(e*Math.PI/180)}function Zc(e,t=0){const i=Math.exp(Math.PI*(1-(e.y+t/Rn)/(1<=l?(Kc(e,t,i,c,h,s,d,a,l),Kc(e,c,h,n,r,d,o,a,l)):e.push(o)}function Qc(e,t,i){let n=e[0],r=n.x,s=n.y;t(n);const o=[n];for(let a=1;ae.x+1||ne.y+1)&&We("Geometry exceeds allowed extent, reduce your vector tile buffer size"),e}function sh(e,t,i){const n=e.loadGeometry(),r=e.extent,s=Rn/r;if(t&&i&&i.projection.isReprojectedInTileSpace){const s=1<{const i=Vc((t.x+e.x/r)/s),n=Wc((t.y+e.y/r)/s),h=c.project(i,n);e.x=(h.x*o-a)*r,e.y=(h.y*o-l)*r};for(let t=0;t=r||i.y<0||i.y>=r||(h(i),e.push(i));n[t]=e}}for(const e of n)for(const t of e)rh(t,s);return n}function oh(e,t){return{type:e.type,id:e.id,properties:e.properties,geometry:t?sh(e):[]}}class ah{constructor(e,t,i,n,r){this.properties={},this.extent=i,this.type=0,this.id=void 0,this._pbf=e,this._geometry=-1,this._keys=n,this._values=r,e.readFields(lh,this,t)}loadGeometry(){const e=this._pbf;e.pos=this._geometry;const t=e.readVarint()+e.pos,i=[];let n,r=1,s=0,o=0,a=0;for(;e.pos>3}if(s--,1===r||2===r)o+=e.readSVarint(),a+=e.readSVarint(),1===r&&(n&&i.push(n),n=[]),n&&n.push(new xe(o,a));else{if(7!==r)throw new Error(`unknown command ${r}`);n&&n.push(n[0].clone())}}return n&&i.push(n),i}bbox(){const e=this._pbf;e.pos=this._geometry;const t=e.readVarint()+e.pos;let i=1,n=0,r=0,s=0,o=1/0,a=-1/0,l=1/0,c=-1/0;for(;e.pos>3}if(n--,1===i||2===i)r+=e.readSVarint(),s+=e.readSVarint(),ra&&(a=r),sc&&(c=s);else if(7!==i)throw new Error(`unknown command ${i}`)}return[o,l,a,c]}toGeoJSON(e,t,i){const n=this.extent*Math.pow(2,i),r=this.extent*e,s=this.extent*t,o=this.loadGeometry();function a(e){return[360*(e.x+r)/n-180,360/Math.PI*Math.atan(Math.exp((1-2*(e.y+s)/n)*Math.PI))-90]}function l(e){return e.map(a)}let c;if(1===this.type){const e=[];for(const t of o)e.push(t[0]);const t=l(e);c=1===e.length?{type:"Point",coordinates:t[0]}:{type:"MultiPoint",coordinates:t}}else if(2===this.type){const e=o.map(l);c=1===e.length?{type:"LineString",coordinates:e[0]}:{type:"MultiLineString",coordinates:e}}else{if(3!==this.type)throw new Error("unknown feature type");{const e=function(e){const t=e.length;if(t<=1)return[e];const i=[];let n,r;for(let s=0;s=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];const t=this._pbf.readVarint()+this._pbf.pos;return new ah(this._pbf,t,this.extent,this._keys,this._values)}}function dh(e,t,i){15===e?t.version=i.readVarint():1===e?t.name=i.readString():5===e?t.extent=i.readVarint():2===e?t._features.push(i.pos):3===e?t._keys.push(i.readString()):4===e&&t._values.push(function(e){let t=null;const i=e.readVarint()+e.pos;for(;e.pos>3;t=1===i?e.readString():2===i?e.readFloat():3===i?e.readDouble():4===i?e.readVarint64():5===i?e.readVarint():6===i?e.readSVarint():7===i?e.readBoolean():null}if(null==t)throw new Error("unknown feature value");return t}(i))}class uh{constructor(e,t){this.layers=e.readFields(fh,{},t)}}function fh(e,t,i){if(3===e){const e=new hh(i,i.readVarint()+i.pos);e.length&&(t[e.name]=e)}}const ph="3d_elevation_id",mh="level";class gh{constructor(){this._valid=!1}reset(e){return this.feature=e,this._valid=!0,this._geometry=e.loadGeometry(),0!==this._geometry.length&&0!==this._geometry[0].length||(this._valid=!1),this}geometry(e,t){return this._valid&&e(t(this._geometry)),this}require(e,t,i){return this.get(e,!0,t,i)}optional(e,t,i){return this.get(e,!1,t,i)}success(){return this._valid}get(e,t,i,n){const r=this.feature.properties.hasOwnProperty(e)?+this.feature.properties[e]:void 0;return this._valid&&void 0!==r&&!Number.isNaN(r)?i(n?n(r):r):t&&(this._valid=!1),this}}class _h{constructor(e,t){this.featureFunc=e,this.vertexFunc=t}parseFeature(e,t,i){return this.featureFunc(e,t,i)}parseVertex(e,t,i){return this.vertexFunc(e,t,i)}}const yh=new _h((e,t,i)=>e.reset(t).require(ph,e=>{i.id=e}).optional("fixed_height_relative",e=>{i.constantHeight=e},xh.decodeRelativeHeight).geometry(e=>{i.bounds=e},un).success(),(e,t,i)=>e.reset(t).require(ph,e=>{i.id=e}).require("elevation_idx",e=>{i.idx=e}).require("extent",e=>{i.extent=e}).require("height_relative",e=>{i.height=e},xh.decodeRelativeHeight).geometry(e=>{i.position=e},xh.getPoint).success()),vh=new _h((e,t,i)=>e.reset(t).require(ph,e=>{i.id=e}).optional("fixed_height",e=>{i.constantHeight=e},xh.decodeMetricHeight).geometry(e=>{i.bounds=e},un).success(),(e,t,i)=>e.reset(t).require(ph,e=>{i.id=e}).require("elevation_idx",e=>{i.idx=e}).require("extent",e=>{i.extent=e}).require("height",e=>{i.height=e},xh.decodeMetricHeight).geometry(e=>{i.position=e},xh.getPoint).success());class xh{static getPoint(e){return ae(e[0][0].x,e[0][0].y)}static decodeRelativeHeight(e){return 1e-4*e*5}static decodeMetricHeight(e){return 1e-4*e}static parse(e){const t=[],i=[],n=e.length,r=new gh;for(let o=0;o=0;if(0===s)return 0;s!==t.length&&(i=!1)}return i?2:1}function Mh(e,t){for(const i of e.projections){const n=Th(t,e.points[0],i.axis);if(i.projection[1]n[1])return 0}return 1}function Ah(e,t){let i=0;const n=[0,0,0,0];for(let o=0;o=0&&i++;var r,s;return i}class Ch{constructor(e,t){this.points=e||new Array(8).fill([0,0,0]),this.planes=t||new Array(6).fill([0,0,0,0]),this.bounds=Dh.fromPoints(this.points),this.projections=[],this.frustumEdges=[W([],this.points[2],this.points[3]),W([],this.points[0],this.points[3]),W([],this.points[4],this.points[0]),W([],this.points[5],this.points[1]),W([],this.points[6],this.points[2]),W([],this.points[7],this.points[3])];for(const e of this.frustumEdges){const t=[0,-e[2],e[1]],i=[e[2],0,-e[0]];this.projections.push({axis:t,projection:Th(this.points,this.points[0],t)}),this.projections.push({axis:i,projection:Th(this.points,this.points[0],i)})}}static fromInvProjectionMatrix(e,t,i,n){const r=Math.pow(2,i),s=[[-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 s=Z([],i,e),o=1/s[3]/t*r;return(a=s)[0]=(l=s)[0]*(c=[o,o,n?1/s[3]:o,o])[0],a[1]=l[1]*c[1],a[2]=l[2]*c[2],a[3]=l[3]*c[3],a;var a,l,c}),o=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(e=>{const t=O([],F([],W([],s[e[0]],s[e[1]]),W([],s[e[2]],s[e[1]]))),i=-z(t,s[e[1]]);return t.concat(i)}),a=[];for(let e=0;eo[1]||o[0]>s[1])return 0}return 1}containsPoint(e){for(const t of this.planes){const i=t[3];if(z([t[0],t[1],t[2]],e)+i<0)return!1}return!0}}class Dh{static fromPoints(e){const t=[1/0,1/0,1/0],i=[-1/0,-1/0,-1/0];for(const n of e)C(t,t,n),D(i,i,n);return new Dh(t,i)}static fromTileIdAndHeight(e,t,i){const n=1<e.max[t]||e.min[t]>this.max[t])return!1;return!0}intersectsAabbXY(e){return!(this.min[0]>e.max[0]||e.min[0]>this.max[0]||this.min[1]>e.max[1]||e.min[1]>this.max[1])}encapsulate(e){for(let t=0;t<3;t++)this.min[t]=Math.min(this.min[t],e.min[t]),this.max[t]=Math.max(this.max[t],e.max[t])}encapsulatePoint(e){for(let t=0;t<3;t++)this.min[t]=Math.min(this.min[t],e[t]),this.max[t]=Math.max(this.max[t],e[t])}closestPoint(e){return[Math.max(Math.min(this.max[0],e[0]),this.min[0]),Math.max(Math.min(this.max[1],e[1]),this.min[1]),Math.max(Math.min(this.max[2],e[2]),this.min[2])]}}Ws(Dh,"Aabb");class Lh{constructor(e,t){this.feature=e,this.metersToTile=t,this.index=0}get(){const e=this.feature.vertices[this.index],t=this.feature.vertexProps[this.index].dir,i=t[1],n=-t[0],r=(e.extent+1)*this.metersToTile;return[new xe(Math.trunc(e.position[0]+i*r),Math.trunc(e.position[1]+n*r)),new xe(Math.trunc(e.position[0]-i*r),Math.trunc(e.position[1]-n*r))]}next(){this.index++}valid(){return this.index{return e.a0?L(a,a,1/l):S(0,0,1)}getSafeArea(){return this.safeArea}isTunnel(){return this.heightRange.max<=-5}getClosestEdge(e){if(0===this.edges.length)return;let t=0,i=Number.POSITIVE_INFINITY,n=0;const r=ae(e.x,e.y);for(let e=0;e0?fe(m,p)/g:0,y=Le(_,0,1),v=Math.abs((_-y)*this.edgeProps[e].len),x=ce(oe(),r,l),b=v+Math.abs(fe(x,ae(o[1],-o[0])));b=0;--t){const i=this.edges[t].a,n=this.edges[t].b,{position:r,height:s,extent:o}=this.vertices[i],{position:a,height:l,extent:c}=this.vertices[n],h=this.vertexProps[i].dir,d=this.vertexProps[n].dir,u=S(r[0]/e,r[1]/e,s),f=S(a[0]/e,a[1]/e,l),p=S(h[1],-h[0],0);L(p,p,o);const m=S(d[1],-d[0],0);if(L(m,m,c),this.distSqLines(S(u[0]+.5*p[0],u[1]+.5*p[1],u[2]+.5*p[2]),S(f[0]-.5*m[0],f[1]-.5*m[1],f[2]-.5*m[2]),S(u[0]-.5*p[0],u[1]-.5*p[1],u[2]-.5*p[2]),S(f[0]+.5*m[0],f[1]+.5*m[1],f[2]+.5*m[2]))<=.0025000000000000005)continue;const g=this.vertices.length,_=le(oe(),r,a);this.vertices.push({position:he(_,_,.5),height:.5*(s+l),extent:.5*(o+c)});const y=le(oe(),h,d);this.vertexProps.push({dir:ue(y,y)}),this.edges.splice(t,1),this.edgeProps.splice(t,1),this.edges.push({a:i,b:g}),this.edges.push({a:g,b:n});const v=ce(oe(),this.vertices[g].position,r),x=de(v),b={vec:v,dir:he(oe(),v,1/x),len:x};this.edgeProps.push(b),this.edgeProps.push(b)}}distSqLines(e,t,i,n){const r=M(x(),t,e),s=M(x(),n,i),o=M(x(),e,i),a=z(r,r),l=z(r,s),c=z(r,o),h=z(s,s),d=z(s,o),u=a*h-l*l;if(0===u){const t=z(o,s)/z(s,s);return I(N(x(),i,n,t),e)}const f=(l*d-c*h)/u,p=(a*d-l*c)/u;return I(N(x(),e,t,f),N(x(),i,n,p))}}class Ih{static parseFrom(e,t){const i=xh.parse(e);if(!i)return[];let{vertices:n,features:r}=i;const s=1/Zc(t);r.sort((e,t)=>e.id-t.id),n.sort((e,t)=>e.id-t.id||e.idx-t.idx),n=n.filter((e,t,i)=>t===i.findIndex(t=>t.id===e.id&&t.idx===e.idx));const o=new Array;let a=0;const l=n.length;for(const e of r){if(e.constantHeight){o.push(new Eh(e.id,e.bounds,e.constantHeight));continue}for(;a!==l&&n[a].ide.id===i)}}class Ph{constructor(e,t){this.zScale=1,this.xOffset=0,this.yOffset=0,e.equals(t)||(this.zScale=Math.pow(2,t.z-e.z),this.xOffset=(e.x*this.zScale-t.x)*Rn,this.yOffset=(e.y*this.zScale-t.y)*Rn)}constantElevation(e,t){if(null!=e.constantHeight)return this.computeBiasedHeight(e.constantHeight,t)}pointElevation(e,t,i){const n=this.constantElevation(t,i);return null!=n?n:(e.x=e.x*this.zScale+this.xOffset,e.y=e.y*this.zScale+this.yOffset,this.computeBiasedHeight(t.pointElevation(e),i))}computeBiasedHeight(e,t){return t<=0?e:e+t*Ee(0,t,e>=0?e:Math.abs(.5*e))}}Ws(Eh,"ElevationFeature");class Rh{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.fqid),this.index=e.index,this.hasPattern=!1,this.projection=e.projection,this.layoutVertexArray=new Za,this.indexArray=new _l,this.segments=new Xl,this.programConfigurations=new wc(e.layers,{zoom:e.zoom,lut:e.lut}),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.elevationMode=this.layers[0].layout.get("circle-elevation-reference"),this.hasElevation=!1,"none"!==this.elevationMode&&(this.elevatedLayoutVertexArray=new Qa),this.worldview=e.worldview}updateFootprints(e,t){}populate(e,t,i,n){const r=this.layers[0],s=[];let o=null;"circle"===r.type&&(o=r.layout.get("circle-sort-key"));for(const{feature:t,id:r,index:a,sourceLayerIndex:l}of e){const e=this.layers[0]._featureFilter.needGeometry,c=oh(t,e);if(!this.layers[0]._featureFilter.filter(new da(this.zoom,{worldview:this.worldview}),c,i))continue;const h=o?o.evaluate(c,{},i):void 0,d={id:r,properties:t.properties,type:t.type,sourceLayerIndex:l,index:a,geometry:e?c.geometry:sh(t,i,n),patterns:{},sortKey:h};s.push(d)}o&&s.sort((e,t)=>e.sortKey-t.sortKey);let a=null;"globe"===n.projection.name&&(this.globeExtVertexArray=new al,a=n.projection);for(const n of s){const{geometry:r,index:s,sourceLayerIndex:o}=n,l=e[s].feature;this.addFeature(n,r,s,t.availableImages,i,a,t.brightness,t.elevationFeatures),t.featureIndex.insert(l,r,s,o,this.index)}this.hasElevation||(this.elevatedLayoutVertexArray=void 0)}update(e,t,i,n,r,s,o){this.programConfigurations.updatePaintArrays(e,t,r,i,n,s,o,this.worldview)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Ul.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,Gl.members)),this.elevatedLayoutVertexArray&&(this.elevatedLayoutVertexBuffer=e.createVertexBuffer(this.elevatedLayoutVertexArray,$l.members))),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy(),this.elevatedLayoutVertexBuffer&&this.elevatedLayoutVertexBuffer.destroy())}addFeature(e,t,i,n,r,s,o,a){let l;"none"!==this.elevationMode&&(l=Ih.getElevationFeature(e,a));for(const i of t)for(const t of i){const i=t.x,n=t.y;if(i<0||i>=Rn||n<0||n>=Rn)continue;if(s){const e=s.projectTilePoint(i,n,r),t=s.upVector(r,i,n);this.addGlobeExtVertex(e,t),this.addGlobeExtVertex(e,t),this.addGlobeExtVertex(e,t),this.addGlobeExtVertex(e,t)}const o=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),a=o.vertexLength;if(this.addCircleVertex(i,n,-1,-1),this.addCircleVertex(i,n,1,-1),this.addCircleVertex(i,n,1,1),this.addCircleVertex(i,n,-1,1),"none"!==this.elevationMode){const e=l?l.pointElevation(new xe(i,n)):0;this.hasElevation=this.hasElevation||0!==e;for(let t=0;t<4;t++)this.elevatedLayoutVertexArray.emplaceBack(e)}this.indexArray.emplaceBack(a,a+1,a+2),this.indexArray.emplaceBack(a,a+2,a+3),o.vertexLength+=4,o.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,{},n,r,o,void 0,this.worldview)}addCircleVertex(e,t,i,n){this.layoutVertexArray.emplaceBack(2*e+(i+1)/2,2*t+(n+1)/2)}addGlobeExtVertex(e,t){const i=16384;this.globeExtVertexArray.emplaceBack(e.x,e.y,e.z,t[0]*i,t[1]*i,t[2]*i)}}function Oh(e,t){for(let i=0;i1){if(Yh(e,t))return!0;for(let n=0;n1?i:i.sub(t)._mult(r)._add(t))}function Uh(e,t){let i,n,r,s=!1;for(let o=0;ot.y!=r.y>t.y&&t.x<(r.x-n.x)*(t.y-n.y)/(r.y-n.y)+n.x&&(s=!s)}return s}function $h(e,t){let i=!1;for(let n=0,r=e.length-1;nt.y!=o.y>t.y&&t.x<(o.x-s.x)*(t.y-s.y)/(o.y-s.y)+s.x&&(i=!i)}return i}function Gh(e,t,i,n,r){for(const s of e)if(t<=s.x&&i<=s.y&&n>=s.x&&r>=s.y)return!0;const s=[new xe(t,i),new xe(t,r),new xe(n,r),new xe(n,i)];if(e.length>2)for(const t of s)if($h(e,t))return!0;for(let t=0;tr.x&&t.x>r.x||e.yr.y&&t.y>r.y)return!1;const s=Ue(e,t,i[0]);return s!==Ue(e,t,i[1])||s!==Ue(e,t,i[2])||s!==Ue(e,t,i[3])}function qh(e,t,i,n,r,s){let o=t.y-e.y,a=e.x-t.x;if(s=s||0){const e=o*o+a*a;if(0===e)return!0;const t=Math.sqrt(e);o/=t,a/=t}return!((i.x-e.x)*o+(i.y-e.y)*a-s<0||(n.x-e.x)*o+(n.y-e.y)*a-s<0||(r.x-e.x)*o+(r.y-e.y)*a-s<0)}function Zh(e,t,i,n,r,s,o){return!(qh(e,t,n,r,s,o)||qh(t,i,n,r,s,o)||qh(i,e,n,r,s,o)||qh(n,r,e,t,i,o)||qh(r,s,e,t,i,o)||qh(s,n,e,t,i,o))}function Jh(e,t,i){const n=t.paint.get(e).value;return"constant"===n.kind?n.value:i.programConfigurations.get(t.id).getMaxValue(e)}function Kh(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function Qh(e,t,i,n,r){if(!t[0]&&!t[1])return e;const s=xe.convert(t)._mult(r);"viewport"===i&&s._rotate(-n);const o=[];for(let t=0;t>t&&e.y===this.y>>t}url(e,t){const i=function(e,t,i){var n=nd(256*e,256*(t=Math.pow(2,i)-t-1),i),r=nd(256*(e+1),256*(t+1),i);return n[0]+","+n[1]+","+r[0]+","+r[1]}(this.x,this.y,this.z),n=function(e,t,i){let n,r="";for(let s=e;s>0;s--)n=1<this.canonical.z?new od(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new od(e,this.wrap,e,this.canonical.x>>t,this.canonical.y>>t)}calculateScaledKey(e,t=!0){if(this.overscaledZ===e&&t)return this.key;if(e>this.canonical.z)return ad(this.wrap*+t,e,this.canonical.z,this.canonical.x,this.canonical.y);{const i=this.canonical.z-e;return ad(this.wrap*+t,e,e,this.canonical.x>>i,this.canonical.y>>i)}}isChildOf(e){if(e.wrap!==this.wrap)return!1;const t=this.canonical.z-e.canonical.z;return 0===e.overscaledZ||e.overscaledZ>t&&e.canonical.y===this.canonical.y>>t}children(e){if(this.overscaledZ>=e)return[new od(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const t=this.canonical.z+1,i=2*this.canonical.x,n=2*this.canonical.y;return[new od(t,this.wrap,t,i,n),new od(t,this.wrap,t,i+1,n),new od(t,this.wrap,t,i,n+1),new od(t,this.wrap,t,i+1,n+1)]}isLessThan(e){return this.wrape.wrap)&&(this.overscaledZe.overscaledZ)&&(this.canonical.xe.canonical.x)&&this.canonical.y{let t=e.canonical.x-1,i=e.wrap;return t<0&&(t=(1<{let t=e.canonical.x+1,i=e.wrap;return t===1<new od(e.overscaledZ,e.wrap,e.canonical.z,e.canonical.x,(0===e.canonical.y?1<new od(e.overscaledZ,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y===(1<1?null:function(e,t,i,n){const r=Math.sin(i);return e*(Math.sin((1-n)*i)/r)+t*(Math.sin(n*i)/r)}(e.a[t],e.b[t],e.angle,Le(i,0,1))+e.center[t]}function yd(e){if(e.z<=1)return pd[e.z+2*e.y+e.x];const t=Sd(wd(e));return Dh.fromPoints(t)}function vd(e,t,i){return L(e,e,1-i),E(e,e,t,i)}function xd(e,t,i){for(const n of e)Y(n,n,t),L(n,n,i)}function bd(e,t,i,n){const r=t/e.worldSize,s=e.globeMatrix;if(i.z<=1){const e=yd(i).getCorners();return xd(e,s,r),Dh.fromPoints(e)}const o=wd(i,n),a=Sd(o,Cc+fd(e._tileCoverLift));xd(a,s,r);const l=Number.MAX_VALUE,c=[-l,-l,-l],h=[l,l,l];if(o.contains(e.center)){for(const e of a)C(h,h,e),D(c,c,e);c[2]=0;const t=e.point,i=[t.x*r,t.y*r,0];return C(h,h,i),D(c,c,i),new Dh(h,c)}if(e._tileCoverLift>0){for(const e of a)C(h,h,e),D(c,c,e);return new Dh(h,c)}const d=[s[12]*r,s[13]*r,s[14]*r],u=o.getCenter(),f=Le(e.center.lat,-$c,$c),p=Le(u.lat,-$c,$c),m=Bc(e.center.lng),g=Hc(f);let _=m-Bc(u.lng);const y=g-Hc(p);_>.5?_-=1:_<-.5&&(_+=1);let v=0;Math.abs(_)>Math.abs(y)?v=_>=0?1:3:(v=y>=0?0:2,E(d,d,[s[4]*r,s[5]*r,s[6]*r],-Math.sin(Te(y>=0?o.getSouth():o.getNorth()))*Cc));const x=a[v],b=a[(v+1)%4],w=new gd(x,b,d),S=[_d(w,0)||x[0],_d(w,1)||x[1],_d(w,2)||x[2]],T=Id(e.zoom);if(T>0){const n=function({x:e,y:t,z:i},n,r,s,o){const a=1/(1<.5?u=-1:f<-.5&&(u=1),l=((l+u)*n-(s*=n))*r+s,c=((c+u)*n-s)*r+s,h=(h*n-(o*=n))*r+o,d=(d*n-o)*r+o,[[l,d,0],[c,d,0],[c,h,0],[l,h,0]]}(i,t,e._pixelsPerMercatorPixel,m,g);for(let e=0;eMath.PI/2*1.01}const Od=Te(85),zd=Math.cos(Od),Fd=Math.sin(Od),Nd=a(),Yd=e=>{const t=[];return"map"===e.paint.get("circle-pitch-alignment")&&t.push("PITCH_WITH_MAP"),"map"===e.paint.get("circle-pitch-scale")&&t.push("SCALE_WITH_MAP"),t};function Bd(e,t,i,n,r,s,o,a,l){if(s&&e.queryGeometry.isAboveHorizon)return!1;s&&(l*=e.pixelToTileUnitsFactor);const c=e.tileID.canonical,h=i.projection.upVectorScale(c,i.center.lat,i.worldSize).metersToTile;for(const d of t)for(const t of d){const d=t.add(a),u=r&&i.elevation?i.elevation.exaggeration()*r.getElevationAt(d.x,d.y,!0):0,f=i.projection.projectTilePoint(d.x,d.y,c);if(u>0){const e=i.projection.upVector(c,d.x,d.y);f.x+=e[0]*h*u,f.y+=e[1]*h*u,f.z+=e[2]*h*u}const p=s?d:Hd(f.x,f.y,f.z,n),m=s?e.tilespaceRays.map(e=>Wd(e,u)):e.queryGeometry.screenGeometry,g=Z([],[f.x,f.y,f.z,1],n);if(!o&&s?l*=g[3]/i.cameraToCenterDistance:o&&!s&&(l*=i.cameraToCenterDistance/g[3]),s){const e=Wc((t.y/Rn+c.y)/(1<e.width||r.height>e.height||i.x>e.width-r.width||i.y>e.height-r.height)throw new RangeError("out of range source coordinates for image copy");if(r.width>t.width||r.height>t.height||n.x>t.width-r.width||n.y>t.height-r.height)throw new RangeError("out of range destination coordinates for image copy");const l=e.data,c=t.data,h=4===s&&a;for(let a=0;a{t[e.evaluationKey]=s;const o=e.expression.evaluate(t),a=o?o.toNonPremultipliedRenderColor(null):null;a&&(r.data[i+n+0]=Math.floor(255*a.r),r.data[i+n+1]=Math.floor(255*a.g),r.data[i+n+2]=Math.floor(255*a.b),r.data[i+n+3]=Math.floor(255*a.a))};if(e.clips)for(let t=0,r=0;t80*i){a=e[0],l=e[1];let t=a,n=l;for(let s=i;st&&(t=i),r>n&&(n=r)}c=Math.max(t-a,n-l),c=0!==c?32767/c:0}return hu(s,o,i,a,l,c,0),o}function lu(e,t,i,n,r){let s;if(r===function(e,t,i,n){let r=0;for(let s=t,o=i-n;s0)for(let r=t;r=t;r-=n)s=Lu(r/n|0,e[r],e[r+1],s);return s&&Tu(s,s.next)&&(Eu(s),s=s.next),s}function cu(e,t){if(!e)return e;t||(t=e);let i,n=e;do{if(i=!1,n.steiner||!Tu(n,n.next)&&0!==Su(n.prev,n,n.next))n=n.next;else{if(Eu(n),n=t=n.prev,n===n.next)break;i=!0}}while(i||n!==t);return t}function hu(e,t,i,n,r,s,o){if(!e)return;!o&&s&&function(e,t,i,n){let r=e;do{0===r.z&&(r.z=yu(r.x,r.y,t,i,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==e);r.prevZ.nextZ=null,r.prevZ=null,function(e){let t,i=1;do{let n,r=e;e=null;let s=null;for(t=0;r;){t++;let o=r,a=0;for(let e=0;e0||l>0&&o;)0!==a&&(0===l||!o||r.z<=o.z)?(n=r,r=r.nextZ,a--):(n=o,o=o.nextZ,l--),s?s.nextZ=n:e=n,n.prevZ=s,s=n;r=o}s.nextZ=null,i*=2}while(t>1)}(r)}(e,n,r,s);let a=e;for(;e.prev!==e.next;){const l=e.prev,c=e.next;if(s?uu(e,n,r,s):du(e))t.push(l.i,e.i,c.i),Eu(e),e=c.next,a=c.next;else if((e=c)===a){o?1===o?hu(e=fu(cu(e),t),t,i,n,r,s,2):2===o&&pu(e,t,i,n,r,s):hu(cu(e),t,i,n,r,s,1);break}}}function du(e){const t=e.prev,i=e,n=e.next;if(Su(t,i,n)>=0)return!1;const r=t.x,s=i.x,o=n.x,a=t.y,l=i.y,c=n.y,h=Math.min(r,s,o),d=Math.min(a,l,c),u=Math.max(r,s,o),f=Math.max(a,l,c);let p=n.next;for(;p!==t;){if(p.x>=h&&p.x<=u&&p.y>=d&&p.y<=f&&bu(r,a,s,l,o,c,p.x,p.y)&&Su(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function uu(e,t,i,n){const r=e.prev,s=e,o=e.next;if(Su(r,s,o)>=0)return!1;const a=r.x,l=s.x,c=o.x,h=r.y,d=s.y,u=o.y,f=Math.min(a,l,c),p=Math.min(h,d,u),m=Math.max(a,l,c),g=Math.max(h,d,u),_=yu(f,p,t,i,n),y=yu(m,g,t,i,n);let v=e.prevZ,x=e.nextZ;for(;v&&v.z>=_&&x&&x.z<=y;){if(v.x>=f&&v.x<=m&&v.y>=p&&v.y<=g&&v!==r&&v!==o&&bu(a,h,l,d,c,u,v.x,v.y)&&Su(v.prev,v,v.next)>=0)return!1;if(v=v.prevZ,x.x>=f&&x.x<=m&&x.y>=p&&x.y<=g&&x!==r&&x!==o&&bu(a,h,l,d,c,u,x.x,x.y)&&Su(x.prev,x,x.next)>=0)return!1;x=x.nextZ}for(;v&&v.z>=_;){if(v.x>=f&&v.x<=m&&v.y>=p&&v.y<=g&&v!==r&&v!==o&&bu(a,h,l,d,c,u,v.x,v.y)&&Su(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;x&&x.z<=y;){if(x.x>=f&&x.x<=m&&x.y>=p&&x.y<=g&&x!==r&&x!==o&&bu(a,h,l,d,c,u,x.x,x.y)&&Su(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function fu(e,t){let i=e;do{const n=i.prev,r=i.next.next;!Tu(n,r)&&ku(n,i,i.next,r)&&Cu(n,r)&&Cu(r,n)&&(t.push(n.i,i.i,r.i),Eu(i),Eu(i.next),i=e=r),i=i.next}while(i!==e);return cu(i)}function pu(e,t,i,n,r,s){let o=e;do{let e=o.next.next;for(;e!==o.prev;){if(o.i!==e.i&&wu(o,e)){let a=Du(o,e);return o=cu(o,o.next),a=cu(a,a.next),hu(o,t,i,n,r,s,0),void hu(a,t,i,n,r,s,0)}e=e.next}o=o.next}while(o!==e)}function mu(e,t){let i=e.x-t.x;return 0===i&&(i=e.y-t.y,0===i)&&(i=(e.next.y-e.y)/(e.next.x-e.x)-(t.next.y-t.y)/(t.next.x-t.x)),i}function gu(e,t){const i=function(e,t){let i=t;const n=e.x,r=e.y;let s,o=-1/0;if(Tu(e,i))return i;do{if(Tu(e,i.next))return i.next;if(r<=i.y&&r>=i.next.y&&i.next.y!==i.y){const e=i.x+(r-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(e<=n&&e>o&&(o=e,s=i.x=i.x&&i.x>=l&&n!==i.x&&xu(rs.x||i.x===s.x&&_u(s,i)))&&(s=i,h=t)}i=i.next}while(i!==a);return s}(e,t);if(!i)return t;const n=Du(i,e);return cu(n,n.next),cu(i,i.next)}function _u(e,t){return Su(e.prev,e,t.prev)<0&&Su(t.next,e,e.next)<0}function yu(e,t,i,n,r){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-i)*r|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-n)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function vu(e){let t=e,i=e;do{(t.x=(e-o)*(s-a)&&(e-o)*(n-a)>=(i-o)*(t-a)&&(i-o)*(s-a)>=(r-o)*(n-a)}function bu(e,t,i,n,r,s,o,a){return!(e===o&&t===a)&&xu(e,t,i,n,r,s,o,a)}function wu(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){let i=e;do{if(i.i!==e.i&&i.next.i!==e.i&&i.i!==t.i&&i.next.i!==t.i&&ku(i,i.next,e,t))return!0;i=i.next}while(i!==e);return!1}(e,t)&&(Cu(e,t)&&Cu(t,e)&&function(e,t){let i=e,n=!1;const r=(e.x+t.x)/2,s=(e.y+t.y)/2;do{i.y>s!=i.next.y>s&&i.next.y!==i.y&&r<(i.next.x-i.x)*(s-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next}while(i!==e);return n}(e,t)&&(Su(e.prev,e,t.prev)||Su(e,t.prev,t))||Tu(e,t)&&Su(e.prev,e,e.next)>0&&Su(t.prev,t,t.next)>0)}function Su(e,t,i){return(t.y-e.y)*(i.x-t.x)-(t.x-e.x)*(i.y-t.y)}function Tu(e,t){return e.x===t.x&&e.y===t.y}function ku(e,t,i,n){const r=Au(Su(e,t,i)),s=Au(Su(e,t,n)),o=Au(Su(i,n,e)),a=Au(Su(i,n,t));return r!==s&&o!==a||!(0!==r||!Mu(e,i,t))||!(0!==s||!Mu(e,n,t))||!(0!==o||!Mu(i,e,n))||!(0!==a||!Mu(i,t,n))}function Mu(e,t,i){return t.x<=Math.max(e.x,i.x)&&t.x>=Math.min(e.x,i.x)&&t.y<=Math.max(e.y,i.y)&&t.y>=Math.min(e.y,i.y)}function Au(e){return e>0?1:e<0?-1:0}function Cu(e,t){return Su(e.prev,e,e.next)<0?Su(e,t,e.next)>=0&&Su(e,e.prev,t)>=0:Su(e,t,e.prev)<0||Su(e,e.next,t)<0}function Du(e,t){const i=Iu(e.i,e.x,e.y),n=Iu(t.i,t.x,t.y),r=e.next,s=t.prev;return e.next=t,t.prev=e,i.next=r,r.prev=i,n.next=i,i.prev=n,s.next=n,n.prev=s,n}function Lu(e,t,i,n){const r=Iu(e,t,i);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function Eu(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function Iu(e,t,i){return{i:e,x:t,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Pu(e,t){const i=e.length;if(i<=1)return[e];const n=[];let r,s;for(let t=0;t1)for(let e=0;ee<=0&&t<=0||e>=Rn&&t>=Rn;for(const e of t){const t=e.va,n=e.vb;(i(t.x,n.x)||i(t.y,n.y))&&(e.type="border")}const n=t.filter(e=>"unevaluated"!==e.type),r=t.filter(e=>"unevaluated"===e.type);if(0===r.length)return new Yu;r.sort((e,t)=>e.hash===t.hash?e.isTunnel===t.isTunnel?0:e.isTunnel?-1:1:e.hashe.hash"fill-tunnel-structure-color"!==e),this.tunnelProgramConfigurations=new wc(t,{zoom:i,lut:n},e=>"fill-bridge-guard-rail-color"!==e)}addVertices(e,t){const i=this.unevalVertices.length;for(let i=0;i=r.min.x&&c.x<=r.max.x&&c.y>=r.min.y&&c.y<=r.max.y||h.x>=r.min.x&&h.x<=r.max.x&&h.y>=r.min.y&&h.y<=r.max.y||Xh(c,h,o)))continue;if(this.isOnBorder(c.x,h.x)||this.isOnBorder(c.y,h.y))continue;const d=Hu.computeEdgeHash(this.unevalVertices[i],this.unevalVertices[l]);let u,f=this.vertexHashLookup.get(Hu.computePosHash(c));null!=f?u=f.next:(f=this.vertexHashLookup.get(Hu.computePosHash(h)),u=null!=f?f.prev:d),this.unevalEdges.push({polygonIdx:e,a:i,b:l,hash:d,portalHash:u,isTunnel:n,type:"unevaluated",featureInfo:s})}}addPortalCandidates(e,t,i,n,r){if(0===t.length)return;this.portalPolygons.add(e,{geometry:t,zLevel:r});const s=t[0];this.vertexHashLookup.clear();let o=Hu.computeEdgeHash(s[s.length-2],s[s.length-1]);for(let t=0;t({vertexOffset:0,primitiveOffset:this.indexArray.length}),i=e=>{e.primitiveLength=this.indexArray.length-e.primitiveOffset},n=new Bu(this.vertexPositions,this.vertexNormals,this.indexArray);this.prepareEdges(e.portals,this.unevalEdges);const r=t(),s=t(),o=t(),a=(e,t)=>{e.sort((e,i)=>e.type===t&&i.type!==t?-1:e.type!==t&&i.type===t?1:0);const i=e.findIndex(e=>e.type!==t);return i>=0?i:e.length};let l=0;this.unevalEdges.length>0&&(l=a(this.unevalEdges,"none"),this.constructBridgeStructures(n,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:l},this.tileToMeters)),i(o);const c=t(),h=t();if(this.unevalEdges.length>0){const e=this.unevalEdges.splice(l),t=a(e,"tunnel")+l;this.unevalEdges.push(...e),this.constructTunnelStructures(n,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:l},{min:l,max:t})}i(c),n.addTriangles(this.unevalTriangles,this.unevalVertices,this.unevalHeights),i(h),n.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,this.unevalHeights),i(s),n.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,[-.1]),i(r),this.maskSegments=Xl.simpleSegment(0,h.primitiveOffset,0,h.primitiveLength),this.depthSegments=Xl.simpleSegment(0,s.primitiveOffset,0,s.primitiveLength),this.renderableBridgeSegments=Xl.simpleSegment(0,o.primitiveOffset,0,o.primitiveLength),this.renderableTunnelSegments=Xl.simpleSegment(0,c.primitiveOffset,0,c.primitiveLength),this.shadowCasterSegments=Xl.simpleSegment(0,r.primitiveOffset,0,r.primitiveLength)}update(e,t,i,n,r,s,o,a){this.bridgeProgramConfigurations.updatePaintArrays(e,t,r,i,n,s,o,a),this.tunnelProgramConfigurations.updatePaintArrays(e,t,r,i,n,s,o,a)}upload(e){this.vertexBuffer||0===this.vertexPositions.length||0===this.vertexNormals.length||0===this.indexArray.length||(this.vertexBuffer=e.createVertexBuffer(this.vertexPositions,su.members),this.vertexBufferNormal=e.createVertexBuffer(this.vertexNormals,ou.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.bridgeProgramConfigurations.upload(e),this.tunnelProgramConfigurations.upload(e))}destroy(){this.vertexBuffer&&(this.vertexBuffer.destroy(),this.vertexBufferNormal.destroy(),this.indexBuffer.destroy()),this.maskSegments&&(this.maskSegments.destroy(),this.depthSegments.destroy(),this.renderableBridgeSegments.destroy(),this.renderableTunnelSegments.destroy(),this.shadowCasterSegments.destroy()),this.bridgeProgramConfigurations.destroy(),this.tunnelProgramConfigurations.destroy()}populatePaintArrays(e,t,i,n,r){const s=(s,o)=>{for(let a=0;aT(e,t[n].x,t[n].y,i[n]*a),h=x(),d=x(),u=x(),f=x(),p=x(),m=(e,i)=>{const n=o.get(Hu.computePosHash(t[i])),r=n.from,s=n.to;if(!r||!s)return;c(h,r),c(d,i),c(u,s),j(f),V(h,d)||(W(p,d,h),O(f,p)),V(u,d)||(W(p,u,d),k(f,f,O(p,p)));const a=$(f);return a>0?L(e,f,1/a):void 0};let g=Number.POSITIVE_INFINITY;this.sortSubarray(n,r.min,r.max,(e,t)=>e.featureInfo.featureIndex-t.featureInfo.featureIndex);const _=x(),y=x(),v=x(),b=x(),w=x(),S=x(),M=x(),A=x(),C=x(),D=[x(),x(),x(),x()],E=[x(),x(),x(),x()],I=[{coord:new xe(0,0),height:0},{coord:new xe(0,0),height:0}],P=(e,t)=>e>t;for(let c=r.min;ce.featureInfo.featureIndex-t.featureInfo.featureIndex;this.sortSubarray(n,r.min,r.max,a),this.sortSubarray(n,s.min,s.max,a);const l=e=>O(e,e),c=[{coord:new xe(0,0),height:0},{coord:new xe(0,0),height:0}],h=(e,t)=>ee.hash===t.hash?t.polygonIdx-e.polygonIdx:t.hash>e.hash?1:-1);let i=0,n=0,r=0,s=t[i].polygonIdx;do{n++,(n===t.length||t[i].hash!==t[n].hash)&&((1==n-i||t[n-1].polygonIdx!==s)&&(re.portalHashs.hash?i++:s.hash>r.portalHash?n++:(r.type=s.type,i++)}}}isOnBorder(e,t){return e<=0&&t<=0||e>=Rn&&t>=Rn}addFeatureSection(e,t,i,n){return e!==t&&(t=e,i.push({featureIndex:e,vertexStart:n.getVertexCount()}),n.clearVertexLookup()),t}sortSubarray(e,t,i,n){const r=e.slice(t,i);r.sort(n),e.splice(t,r.length,...r)}static computeEdgeHash(e,t){return(e.y===t.y&&e.x>t.x||e.y>t.y)&&([e,t]=[t,e]),BigInt(Hu.computePosHash(e))<<32n|BigInt(Hu.computePosHash(t))}static computePosHash(e){return((65535&e.x)<<16|65535&e.y)>>>0}}var ju,Vu={exports:{}},Wu=(ju||(ju=1,function(e,t){!function(e){function t(e,t){return e>t?1:e0){var a=n+Math.floor(o/2),l={key:t[a],data:i[a],parent:e};return l.left=r(l,t,i,n,a),l.right=r(l,t,i,a+1,s),l}return null}function s(e,t,i,n,r){if(!(i>=n)){for(var o=e[i+n>>1],a=i-1,l=n+1;;){do{a++}while(r(e[a],o)<0);do{l--}while(r(e[l],o)>0);if(a>=l)break;var c=e[a];e[a]=e[l],e[l]=c,c=t[a],t[a]=t[l],t[l]=c}s(e,t,i,l,r),s(e,t,l+1,n,r)}}i.prototype.rotateLeft=function(e){var t=e.right;t&&(e.right=t.left,t.left&&(t.left.parent=e),t.parent=e.parent),e.parent?e===e.parent.left?e.parent.left=t:e.parent.right=t:this._root=t,t&&(t.left=e),e.parent=t},i.prototype.rotateRight=function(e){var t=e.left;t&&(e.left=t.right,t.right&&(t.right.parent=e),t.parent=e.parent),e.parent?e===e.parent.left?e.parent.left=t:e.parent.right=t:this._root=t,t&&(t.right=e),e.parent=t},i.prototype._splay=function(e){for(;e.parent;){var t=e.parent;t.parent?t.left===e&&t.parent.left===t?(this.rotateRight(t.parent),this.rotateRight(t)):t.right===e&&t.parent.right===t?(this.rotateLeft(t.parent),this.rotateLeft(t)):t.left===e&&t.parent.right===t?(this.rotateRight(t),this.rotateLeft(t)):(this.rotateLeft(t),this.rotateRight(t)):t.left===e?this.rotateRight(t):this.rotateLeft(t)}},i.prototype.splay=function(e){for(var t,i,n,r,s;e.parent;)(i=(t=e.parent).parent)&&i.parent?((n=i.parent).left===i?n.left=e:n.right=e,e.parent=n):(e.parent=null,this._root=e),r=e.left,s=e.right,e===t.left?(i&&(i.left===t?(t.right?(i.left=t.right,i.left.parent=i):i.left=null,t.right=i,i.parent=t):(r?(i.right=r,r.parent=i):i.right=null,e.left=i,i.parent=e)),s?(t.left=s,s.parent=t):t.left=null,e.right=t,t.parent=e):(i&&(i.right===t?(t.left?(i.right=t.left,i.right.parent=i):i.right=null,t.left=i,i.parent=t):(s?(i.left=s,s.parent=i):i.left=null,e.right=i,i.parent=e)),r?(t.right=r,r.parent=t):t.right=null,e.left=t,t.parent=e)},i.prototype.replace=function(e,t){e.parent?e===e.parent.left?e.parent.left=t:e.parent.right=t:this._root=t,t&&(t.parent=e.parent)},i.prototype.minNode=function(e){if(void 0===e&&(e=this._root),e)for(;e.left;)e=e.left;return e},i.prototype.maxNode=function(e){if(void 0===e&&(e=this._root),e)for(;e.right;)e=e.right;return e},i.prototype.insert=function(e,t){var i=this._root,n=null,r=this._compare;if(this._noDuplicates)for(;i;){if(n=i,0===r(i.key,e))return;i=r(i.key,e)<0?i.right:i.left}else for(;i;)n=i,i=r(i.key,e)<0?i.right:i.left;return i={key:e,data:t,left:null,right:null,parent:n},n?r(n.key,i.key)<0?n.right=i:n.left=i:this._root=i,this.splay(i),this._size++,i},i.prototype.find=function(e){for(var t=this._root,i=this._compare;t;){var n=i(t.key,e);if(n<0)t=t.right;else{if(!(n>0))return t;t=t.left}}return null},i.prototype.contains=function(e){for(var t=this._root,i=this._compare;t;){var n=i(e,t.key);if(0===n)return!0;t=n<0?t.left:t.right}return!1},i.prototype.remove=function(e){var t=this.find(e);if(!t)return!1;if(this.splay(t),t.left)if(t.right){var i=this.minNode(t.right);i.parent!==t&&(this.replace(i,i.right),i.right=t.right,i.right.parent=i),this.replace(t,i),i.left=t.left,i.left.parent=i}else this.replace(t,t.left);else this.replace(t,t.right);return this._size--,!0},i.prototype.removeNode=function(e){if(!e)return!1;if(this.splay(e),e.left)if(e.right){var t=this.minNode(e.right);t.parent!==e&&(this.replace(t,t.right),t.right=e.right,t.right.parent=t),this.replace(e,t),t.left=e.left,t.left.parent=t}else this.replace(e,e.left);else this.replace(e,e.right);return this._size--,!0},i.prototype.erase=function(e){var t=this.find(e);if(t){this.splay(t);var i=t.left,n=t.right,r=null;i&&(i.parent=null,r=this.maxNode(i),this.splay(r),this._root=r),n&&(i?r.right=n:this._root=n,n.parent=r),this._size--}},i.prototype.pop=function(){var e=this._root,t=null;if(e){for(;e.left;)e=e.left;t={key:e.key,data:e.data},this.remove(e.key)}return t},i.prototype.next=function(e){var t=e;if(t)if(t.right)for(t=t.right;t&&t.left;)t=t.left;else for(t=e.parent;t&&t.right===e;)e=t,t=t.parent;return t},i.prototype.prev=function(e){var t=e;if(t)if(t.left)for(t=t.left;t&&t.right;)t=t.right;else for(t=e.parent;t&&t.left===e;)e=t,t=t.parent;return t},i.prototype.forEach=function(e){for(var t=this._root,i=[],n=!1,r=0;!n;)t?(i.push(t),t=t.left):i.length>0?(e(t=i.pop(),r++),t=t.right):n=!0;return this},i.prototype.range=function(e,t,i,n){for(var r=[],s=this._compare,o=this._root;0!==r.length||o;)if(o)r.push(o),o=o.left;else{if(s((o=r.pop()).key,t)>0)break;if(s(o.key,e)>=0&&i.call(n,o))return this;o=o.right}return this},i.prototype.keys=function(){for(var e=this._root,t=[],i=[],n=!1;!n;)e?(t.push(e),e=e.left):t.length>0?(e=t.pop(),i.push(e.key),e=e.right):n=!0;return i},i.prototype.values=function(){for(var e=this._root,t=[],i=[],n=!1;!n;)e?(t.push(e),e=e.left):t.length>0?(e=t.pop(),i.push(e.data),e=e.right):n=!0;return i},i.prototype.at=function(e){for(var t=this._root,i=[],n=!1,r=0;!n;)if(t)i.push(t),t=t.left;else if(i.length>0){if(t=i.pop(),r===e)return t;r++,t=t.right}else n=!0;return null},i.prototype.load=function(e,t,i){if(void 0===e&&(e=[]),void 0===t&&(t=[]),void 0===i&&(i=!1),0!==this._size)throw new Error("bulk-load: tree is not empty");var n=e.length;return i&&s(e,t,0,n-1,this._compare),this._root=r(null,e,t,0,n),this._size=n,this},i.prototype.min=function(){var e=this.minNode(this._root);return e?e.key:null},i.prototype.max=function(){var e=this.maxNode(this._root);return e?e.key:null},i.prototype.isEmpty=function(){return null===this._root},n.size.get=function(){return this._size},i.createTree=function(e,t,n,r,s){return new i(n,s).load(e,t,r)},Object.defineProperties(i.prototype,n);function o(e,t,i){null===t?(e.inOut=!1,e.otherInOut=!0):(e.isSubject===t.isSubject?(e.inOut=!t.inOut,e.otherInOut=t.otherInOut):(e.inOut=!t.otherInOut,e.otherInOut=t.isVertical()?!t.inOut:t.inOut),t&&(e.prevInResult=!a(t,i)||t.isVertical()?t.prevInResult:t));var n=a(e,i);e.resultTransition=n?function(e,t){var i,n=!e.inOut,r=!e.otherInOut;switch(t){case 0:i=n&&r;break;case 1:i=n||r;break;case 3:i=n^r;break;case 2:i=e.isSubject?n&&!r:r&&!n}return i?1:-1}(e,i):0}function a(e,t){switch(e.type){case 0:switch(t){case 0:return!e.otherInOut;case 1:return e.otherInOut;case 2:return e.isSubject&&e.otherInOut||!e.isSubject&&!e.otherInOut;case 3:return!0}break;case 2:return 0===t||1===t;case 3:return 2===t;case 1:return!1}return!1}var l=function(e,t,i,n,r){this.left=t,this.point=e,this.otherEvent=i,this.isSubject=n,this.type=r||0,this.inOut=!1,this.otherInOut=!1,this.prevInResult=null,this.resultTransition=0,this.otherPos=-1,this.outputContourId=-1,this.isExteriorRing=!0},c={inResult:{configurable:!0}};function h(e,t){return e[0]===t[0]&&e[1]===t[1]}l.prototype.isBelow=function(e){var t=this.point,i=this.otherEvent.point;return this.left?(t[0]-e[0])*(i[1]-e[1])-(i[0]-e[0])*(t[1]-e[1])>0:(i[0]-e[0])*(t[1]-e[1])-(t[0]-e[0])*(i[1]-e[1])>0},l.prototype.isAbove=function(e){return!this.isBelow(e)},l.prototype.isVertical=function(){return this.point[0]===this.otherEvent.point[0]},c.inResult.get=function(){return 0!==this.resultTransition},l.prototype.clone=function(){var e=new l(this.point,this.left,this.otherEvent,this.isSubject,this.type);return e.contourId=this.contourId,e.resultTransition=this.resultTransition,e.prevInResult=this.prevInResult,e.isExteriorRing=this.isExteriorRing,e.inOut=this.inOut,e.otherInOut=this.otherInOut,e},Object.defineProperties(l.prototype,c);var d=11102230246251565e-32,u=134217729,f=(3+8*d)*d;function p(e,t,i,n,r){var s,o,a,l,c=t[0],h=n[0],d=0,u=0;h>c==h>-c?(s=c,c=t[++d]):(s=h,h=n[++u]);var f=0;if(dc==h>-c?(a=s-((o=c+s)-c),c=t[++d]):(a=s-((o=h+s)-h),h=n[++u]),s=o,0!==a&&(r[f++]=a);dc==h>-c?(a=s-((o=s+c)-(l=o-s))+(c-l),c=t[++d]):(a=s-((o=s+h)-(l=o-s))+(h-l),h=n[++u]),s=o,0!==a&&(r[f++]=a);for(;d0!=a>0)return l;var c=Math.abs(o+a);return Math.abs(l)>=33306690738754716e-32*c?l:-function(e,t,i,n,r,s,o){var a,l,c,h,d,m,b,w,S,T,k,M,A,C,D,L,E,I,P=e-r,R=i-r,O=t-s,z=n-s;g[0]=(D=(w=P-(b=(m=u*P)-(m-P)))*(T=z-(S=(m=u*z)-(m-z)))-((C=P*z)-b*S-w*S-b*T))-((k=D-(E=(w=O-(b=(m=u*O)-(m-O)))*(T=R-(S=(m=u*R)-(m-R)))-((L=O*R)-b*S-w*S-b*T)))+(d=D-k))+(d-E),g[1]=(A=C-((M=C+k)-(d=M-C))+(k-d))-((k=A-L)+(d=A-k))+(d-L),g[2]=M-((I=M+k)-(d=I-M))+(k-d),g[3]=I;var F=function(e,t){for(var i=t[0],n=1;n<4;n++)i+=t[n];return i}(0,g),N=22204460492503146e-32*o;if(F>=N||-F>=N)return F;if(a=e-(P+(d=e-P))+(d-r),c=i-(R+(d=i-R))+(d-r),l=t-(O+(d=t-O))+(d-s),h=n-(z+(d=n-z))+(d-s),0===a&&0===l&&0===c&&0===h)return F;if(N=11093356479670487e-47*o+f*Math.abs(F),(F+=P*h+z*a-(O*c+R*l))>=N||-F>=N)return F;x[0]=(D=(w=a-(b=(m=u*a)-(m-a)))*(T=z-(S=(m=u*z)-(m-z)))-((C=a*z)-b*S-w*S-b*T))-((k=D-(E=(w=l-(b=(m=u*l)-(m-l)))*(T=R-(S=(m=u*R)-(m-R)))-((L=l*R)-b*S-w*S-b*T)))+(d=D-k))+(d-E),x[1]=(A=C-((M=C+k)-(d=M-C))+(k-d))-((k=A-L)+(d=A-k))+(d-L),x[2]=M-((I=M+k)-(d=I-M))+(k-d),x[3]=I;var Y=p(4,g,4,x,_);x[0]=(D=(w=P-(b=(m=u*P)-(m-P)))*(T=h-(S=(m=u*h)-(m-h)))-((C=P*h)-b*S-w*S-b*T))-((k=D-(E=(w=O-(b=(m=u*O)-(m-O)))*(T=c-(S=(m=u*c)-(m-c)))-((L=O*c)-b*S-w*S-b*T)))+(d=D-k))+(d-E),x[1]=(A=C-((M=C+k)-(d=M-C))+(k-d))-((k=A-L)+(d=A-k))+(d-L),x[2]=M-((I=M+k)-(d=I-M))+(k-d),x[3]=I;var B=p(Y,_,4,x,y);x[0]=(D=(w=a-(b=(m=u*a)-(m-a)))*(T=h-(S=(m=u*h)-(m-h)))-((C=a*h)-b*S-w*S-b*T))-((k=D-(E=(w=l-(b=(m=u*l)-(m-l)))*(T=c-(S=(m=u*c)-(m-c)))-((L=l*c)-b*S-w*S-b*T)))+(d=D-k))+(d-E),x[1]=(A=C-((M=C+k)-(d=M-C))+(k-d))-((k=A-L)+(d=A-k))+(d-L),x[2]=M-((I=M+k)-(d=I-M))+(k-d),x[3]=I;var H=p(B,y,4,x,v);return v[H-1]}(e,t,i,n,r,s,c)}(e[0],e[1],t[0],t[1],i[0],i[1]);return n>0?-1:n<0?1:0}function w(e,t){var i=e.point,n=t.point;return i[0]>n[0]?1:i[0]n[1]?1:-1:function(e,t,i){return e.left!==t.left?e.left?1:-1:0!==b(i,e.otherEvent.point,t.otherEvent.point)?e.isBelow(t.otherEvent.point)?-1:1:!e.isSubject&&t.isSubject?1:-1}(e,t,i)}function S(e,t,i){var n=new l(t,!1,e,e.isSubject),r=new l(t,!0,e.otherEvent,e.isSubject);return h(e.point,e.otherEvent.point)&&console.warn("what is that, a collapsed segment?",e),n.contourId=r.contourId=e.contourId,w(r,e.otherEvent)>0&&(e.otherEvent.left=!0,r.left=!1),e.otherEvent.otherEvent=r,e.otherEvent=n,i.push(r),i.push(n),i}function T(e,t){return e[0]*t[1]-e[1]*t[0]}function k(e,t){return e[0]*t[0]+e[1]*t[1]}function M(e,t,i){var n=function(e,t,i,n){var r=[t[0]-e[0],t[1]-e[1]],s=[n[0]-i[0],n[1]-i[1]];function o(e,t,i){return[e[0]+t*i[0],e[1]+t*i[1]]}var a=[i[0]-e[0],i[1]-e[1]],l=T(r,s),c=l*l,h=k(r,r);if(c>0){var d=T(a,s)/l;if(d<0||d>1)return null;var u=T(a,r)/l;return u<0||u>1?null:0===d||1===d?[o(e,d,r)]:0===u||1===u?[o(i,u,s)]:[o(e,d,r)]}if((c=(l=T(a,r))*l)>0)return null;var f=k(r,a)/h,p=f+k(r,s)/h,m=Math.min(f,p),g=Math.max(f,p);return m<=1&&g>=0?1===m?[o(e,m>0?m:0,r)]:0===g?[o(e,g<1?g:1,r)]:[o(e,m>0?m:0,r),o(e,g<1?g:1,r)]:null}(e.point,e.otherEvent.point,t.point,t.otherEvent.point),r=n?n.length:0;if(0===r)return 0;if(1===r&&(h(e.point,t.point)||h(e.otherEvent.point,t.otherEvent.point)))return 0;if(2===r&&e.isSubject===t.isSubject)return 0;if(1===r)return h(e.point,n[0])||h(e.otherEvent.point,n[0])||S(e,n[0],i),h(t.point,n[0])||h(t.otherEvent.point,n[0])||S(t,n[0],i),1;var s=[],o=!1,a=!1;return h(e.point,t.point)?o=!0:1===w(e,t)?s.push(t,e):s.push(e,t),h(e.otherEvent.point,t.otherEvent.point)?a=!0:1===w(e.otherEvent,t.otherEvent)?s.push(t.otherEvent,e.otherEvent):s.push(e.otherEvent,t.otherEvent),o&&a||o?(t.type=1,e.type=t.inOut===e.inOut?2:3,o&&!a&&S(s[1].otherEvent,s[0].point,i),2):a?(S(s[0],s[1].point,i),3):s[0]!==s[3].otherEvent?(S(s[0],s[1].point,i),S(s[1],s[2].point,i),3):(S(s[0],s[1].point,i),S(s[3].otherEvent,s[2].point,i),3)}function A(e,t){if(e===t)return 0;if(0!==b(e.point,e.otherEvent.point,t.point)||0!==b(e.point,e.otherEvent.point,t.otherEvent.point))return h(e.point,t.point)?e.isBelow(t.otherEvent.point)?-1:1:e.point[0]===t.point[0]?e.point[1]t.contourId?1:-1:1===w(e,t)?1:-1}var C=function(){this.points=[],this.holeIds=[],this.holeOf=null,this.depth=null};function D(e,t,i,n){var r,s=e+1,o=t[e].point,a=t.length;for(sn;)s--;return s}C.prototype.isExterior=function(){return null==this.holeOf};var L=I,E=I;function I(e,t){if(!(this instanceof I))return new I(e,t);if(this.data=e||[],this.length=this.data.length,this.compare=t||P,this.length>0)for(var i=(this.length>>1)-1;i>=0;i--)this._down(i)}function P(e,t){return et?1:0}I.prototype={push:function(e){this.data.push(e),this.length++,this._up(this.length-1)},pop:function(){if(0!==this.length){var e=this.data[0];return this.length--,this.length>0&&(this.data[0]=this.data[this.length],this._down(0)),this.data.pop(),e}},peek:function(){return this.data[0]},_up:function(e){for(var t=this.data,i=this.compare,n=t[e];e>0;){var r=e-1>>1,s=t[r];if(i(n,s)>=0)break;t[e]=s,e=r}t[e]=n},_down:function(e){for(var t=this.data,i=this.compare,n=this.length>>1,r=t[e];e=0)break;t[e]=a,e=s}t[e]=r}},L.default=E;var R=Math.max,O=Math.min,z=0;function F(e,t,i,n,r,s){var o,a,c,h,d,u;for(o=0,a=e.length-1;o0?u.left=!0:d.left=!0;var f=c[0],p=c[1];r[0]=O(r[0],f),r[1]=O(r[1],p),r[2]=R(r[2],f),r[3]=R(r[3],p),n.push(d),n.push(u)}}var N=[];function Y(e,t,n){"number"==typeof e[0][0][0]&&(e=[e]),"number"==typeof t[0][0][0]&&(t=[t]);var r=function(e,t,i){var n=null;return e.length*t.length==0&&(0===i?n=N:2===i?n=e:1!==i&&3!==i||(n=0===e.length?t:e)),n}(e,t,n);if(r)return r===N?null:r;var s=[1/0,1/0,-1/0,-1/0],a=[1/0,1/0,-1/0,-1/0],l=function(e,t,i,n,r){var s,o,a,l,c,h,d=new L(null,w);for(a=0,l=e.length;an[2]||n[0]>i[2]||i[1]>n[3]||n[1]>i[3])&&(0===r?s=N:2===r?s=e:1!==r&&3!==r||(s=e.concat(t))),s}(e,t,s,a,n))return r===N?null:r;for(var c=function(e){var t,i,n=function(e){var t,i,n,r,s=[];for(i=0,n=e.length;i0){var o=t[s];if(null!=o.holeOf){var a=o.holeOf;t[a].holeIds.push(i),n.holeOf=a,n.depth=t[s].depth}else t[s].holeIds.push(i),n.holeOf=s,n.depth=t[s].depth+1}else n.holeOf=null,n.depth=t[s].depth}else n.holeOf=null,n.depth=0;return n}(n[t],s,e),o=function(t){r[t]=!0,t=n.length)&&n[a];);s.push(i)}};for(t=0,i=n.length;tf||2===a&&p.point[0]>r[2])break;if(p.left){c=l=d.insert(p),l=l!==(h=d.minNode())?d.prev(l):null,c=d.next(c);var m=l?l.key:null;if(o(p,m,a),c&&2===M(p,c.key,e)&&(o(p,m,a),o(c.key,p,a)),l&&2===M(l.key,p,e)){var g=l;o(m,(g=g!==h?d.prev(g):null)?g.key:null,a),o(p,m,a)}}else c=l=d.find(p=p.otherEvent),l&&c&&(l=l!==h?d.prev(l):null,c=d.next(c),d.remove(p),c&&l&&M(l.key,c.key,e))}return u}(l,0,0,s,a,n)),h=[],d=0;d{e.push(new xe(s,i+(s-t)/(n-t)*(r-i)))}:(e,t,i,n,r,s)=>{e.push(new xe(t+(s-i)/(r-i)*(n-t),s))};for(const o of e){const e=[];for(const r of o){if(r.length<=2)continue;const o=[];for(let e=0;et&&s(o,a,l,c,h,t):d>i?u=t&&s(o,a,l,c,h,t),u>i&&d<=i&&s(o,a,l,c,h,i)}let a=r[r.length-1];const l=0===n?a.x:a.y;l>=t&&l<=i&&o.push(a),o.length&&(a=o[o.length-1],o[0].x===a.x&&o[0].y===a.y||o.push(o[0]),e.push(o))}e.length&&r.push(e)}return r}function $u(e,t){const i=Xu(e),n=Xu([t]),r=Wu.intersection(i,n);return null==r?[]:qu(r)}function Gu(e,t){const i=65536;let n=Xu(e,i);for(;t.valid();t.next()){const[e,r]=t.get(),s=e.x*i,o=e.y*i,a=r.x*i,l=r.y*i,c=a-s,h=l-o,d=Math.hypot(c,h),u=Math.trunc(h/d*3),f=-Math.trunc(c/d*3);n=Wu.diff(n,[[[s,o],[a,l],[a+u,l+f],[s+u,o+f],[s,o]]])}return qu(n,1/i)}function Xu(e,t=1){return[e.map(e=>e.map(e=>[e.x*t,e.y*t]))]}function qu(e,t=1){return e.map(e=>e.map((e,i)=>{const n=e.map(e=>new xe(e[0]*t,e[1]*t).round());return i>0&&n.reverse(),n}))}class Zu{constructor(e,t){this.layoutVertexArray=new Za,this.indexArray=new _l,this.lineIndexArray=new ul,this.triangleSegments=new Xl,this.lineSegments=new Xl,this.programConfigurations=new wc(e.layers,{zoom:e.zoom,lut:e.lut}),this.uploaded=!1,t&&(this.elevatedLayoutVertexArray=new Qa)}update(e,t,i,n,r,s,o,a){this.programConfigurations.updatePaintArrays(e,t,r,i,n,s,o,a)}isEmpty(){return 0===this.layoutVertexArray.length}needsUpload(){return this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,nu.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.lineIndexBuffer=e.createIndexBuffer(this.lineIndexArray),this.elevatedLayoutVertexArray&&this.elevatedLayoutVertexArray.length>0&&(this.elevatedLayoutVertexBuffer=e.createVertexBuffer(this.elevatedLayoutVertexArray,ru.members))),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.elevatedLayoutVertexBuffer&&this.elevatedLayoutVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.lineIndexBuffer.destroy(),this.programConfigurations.destroy(),this.triangleSegments.destroy(),this.lineSegments.destroy())}populatePaintArrays(e,t,i,n,r,s,o){this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,t,i,n,r,s,void 0,o)}}class Ju{constructor(e){this.zoom=e.zoom,this.pixelRatio=e.pixelRatio,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.fqid),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.lut=e.lut,this.bufferData=new Zu(e,!1),this.elevationBufferData=new Zu(e,!0),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.projection=e.projection,this.elevationMode=this.layers[0].layout.get("fill-elevation-reference"),this.sourceLayerIndex=e.sourceLayerIndex,this.worldview=e.worldview}updateFootprints(e,t){}populate(e,t,i,n){this.hasPattern=zu("fill",this.layers,this.pixelRatio,t);const r=this.layers[0].layout.get("fill-sort-key"),s=[];for(const{feature:o,id:a,index:l,sourceLayerIndex:c}of e){const e=this.layers[0]._featureFilter.needGeometry,h=oh(o,e);if(!this.layers[0]._featureFilter.filter(new da(this.zoom,{worldview:this.worldview}),h,i))continue;const d=r?r.evaluate(h,{},i,t.availableImages):void 0,u={id:a,properties:o.properties,type:o.type,sourceLayerIndex:c,index:l,geometry:e?h.geometry:sh(o,i,n),patterns:{},sortKey:d};s.push(u)}r&&s.sort((e,t)=>e.sortKey-t.sortKey);for(const n of s){const{geometry:r,index:s,sourceLayerIndex:o}=n;if(this.hasPattern){const e=Fu("fill",this.layers,n,this.zoom,this.pixelRatio,t);this.patternFeatures.push(e)}else this.addFeature(n,r,s,i,{},t.availableImages,t.brightness,t.elevationFeatures);t.featureIndex.insert(e[s].feature,r,s,o,this.index)}}update(e,t,i,n,r,s,o){this.bufferData.update(e,t,i,n,r,s,o,this.worldview),this.elevationBufferData.update(e,t,i,n,r,s,o,this.worldview),this.elevatedStructures&&this.elevatedStructures.update(e,t,i,n,r,s,o,this.worldview)}addFeatures(e,t,i,n,r,s){for(const r of this.patternFeatures)this.addFeature(r,r.geometry,r.index,t,i,n,s,e.elevationFeatures)}isEmpty(){return this.bufferData.isEmpty()&&this.elevationBufferData.isEmpty()}uploadPending(){return!this.uploaded||this.bufferData.needsUpload()||this.elevationBufferData.needsUpload()}upload(e){this.bufferData.upload(e),this.elevationBufferData.upload(e),this.elevatedStructures&&this.elevatedStructures.upload(e)}destroy(){this.bufferData.destroy(),this.elevationBufferData.destroy(),this.elevatedStructures&&this.elevatedStructures.destroy()}addFeature(e,t,i,n,r,s=[],o,a){const l=Pu(t,500);"none"!==this.elevationMode?this.addElevatedRoadFeature(e,l,n,i,a):this.addGeometry(l,this.bufferData),this.bufferData.populatePaintArrays(e,i,r,s,n,o,this.worldview),this.elevationBufferData.populatePaintArrays(e,i,r,s,n,o,this.worldview)}getUnevaluatedPortalGraph(){return this.elevatedStructures?this.elevatedStructures.unevaluatedPortals:void 0}getElevationPolygons(){return this.elevatedStructures?this.elevatedStructures.portalPolygons:void 0}setEvaluatedPortalGraph(e,t,i,n,r){this.elevatedStructures&&(this.elevatedStructures.construct(e),this.elevatedStructures.populatePaintArrays(t,i,n,r,this.worldview))}addElevatedRoadFeature(e,t,i,n,r){const s=new Array,o=Ih.getElevationFeature(e,r);if(!o)return void this.addGeometry(t,this.bufferData);{const e=this.clipPolygonsToTile(t,1);e.length>0&&s.push({polygons:e,elevationFeature:o,elevationTileID:i})}const a={guardRailEnabled:this.layers[0].layout.get("fill-construct-bridge-guard-rail").evaluate(e,{},i),featureIndex:n};for(const t of s)if(t.elevationFeature){if("hd-road-base"===this.elevationMode){this.elevatedStructures||(this.elevatedStructures=new Hu(t.elevationTileID,this.layers,this.zoom,this.lut));const i=t.elevationFeature.isTunnel();let n=0;e.properties.hasOwnProperty(mh)&&(n=+e.properties[mh]);for(const e of t.polygons)this.elevatedStructures.addPortalCandidates(t.elevationFeature.id,e,i,t.elevationFeature,n)}null==t.elevationFeature.constantHeight&&(t.polygons=this.prepareElevatedPolygons(t.polygons,t.elevationFeature,t.elevationTileID));const r=new Ph(i,t.elevationTileID);this.addElevatedGeometry(t.polygons,r,t.elevationFeature,"hd-road-base"===this.elevationMode?0:.05,n,a)}}addElevatedGeometry(e,t,i,n,r,s){const o={elevation:i,elevationSampler:t,bias:n,index:r,featureInfo:s},[a,l]=this.addGeometry(e,this.elevationBufferData,o);null==this.elevationBufferData.heightRange?this.elevationBufferData.heightRange={min:a,max:l}:(this.elevationBufferData.heightRange.min=Math.min(this.elevationBufferData.heightRange.min,a),this.elevationBufferData.heightRange.max=Math.max(this.elevationBufferData.heightRange.max,l))}addGeometry(e,t,i){let n=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY,s=null;i&&(s=i.elevationSampler.constantElevation(i.elevation,i.bias),null!=s&&(n=s,r=s));const o=(e,o,a)=>{if(null!=i)if(o.push(e),null!=s)t.elevatedLayoutVertexArray.emplaceBack(s),a.push(s);else{const s=i.elevationSampler.pointElevation(e,i.elevation,i.bias);t.elevatedLayoutVertexArray.emplaceBack(s),a.push(s),n=Math.min(n,s),r=Math.max(r,s)}};for(const n of e){let e=0;for(const t of n)e+=t.length;const r=t.triangleSegments.prepareSegment(e,t.layoutVertexArray,t.indexArray),s=r.vertexLength,a=[],l=[],c=[],h=[],d=[],u=t.layoutVertexArray.length;for(const e of n){if(0===e.length)continue;e!==n[0]&&l.push(a.length/2);const r=t.lineSegments.prepareSegment(e.length,t.layoutVertexArray,t.lineIndexArray),s=r.vertexLength;i&&d.push(t.layoutVertexArray.length-u),o(e[0],c,h),t.layoutVertexArray.emplaceBack(e[0].x,e[0].y),t.lineIndexArray.emplaceBack(s+e.length-1,s),a.push(e[0].x),a.push(e[0].y);for(let i=1;i0&&i&&"hd-road-base"===this.elevationMode){const e=i.elevation.isTunnel(),t=i.elevation.safeArea,n=this.elevatedStructures.addVertices(c,h);this.elevatedStructures.addTriangles(f,n,e);const r=d.length;if(r>0){for(let s=0;s=i&&c.max.x<=r&&c.min.y>=n&&c.max.y<=s?a:l).push(t)}if(a.length===e.length)return e;const c=[new xe(i,n),new xe(r,n),new xe(r,s),new xe(i,s),new xe(i,n)],h=a;for(const e of l)h.push(...$u(e,c));return h}}let Ku,Qu,ef,tf;Ws(Ju,"FillBucket",{omit:["layers","patternFeatures"]}),Ws(Zu,"FillBufferData"),Ws(Hu,"ElevatedStructures");class nf{constructor(e,t,i,n){if(this.triangleCount=t.length/3,this.min=new xe(0,0),this.max=new xe(0,0),this.xScale=0,this.yScale=0,this.cellsX=0,this.cellsY=0,this.cells=[],this.payload=[],0===this.triangleCount||0===e.length)return;const[r,s]=[e[0].clone(),e[0].clone()];for(let t=1;te.cellIdx-t.cellIdx||e.triIdx-t.triIdx);let c=0;for(;cthis.max.x||this.min.x>e.x||e.y>this.max.y||this.min.y>e.y)return;const i=rf(e.x-this.min.x,this.xScale,this.cellsX),n=rf(e.y-this.min.y,this.yScale,this.cellsY),r=this.cells[n*this.cellsX+i];if(r){this._lazyInitLookup();for(let e=0;ethis.max.x||this.min.x>t.x)return;if(e.y>this.max.y||this.min.y>t.y)return;this._lazyInitLookup();const n=rf(e.x-this.min.x,this.xScale,this.cellsX),r=rf(t.x-this.min.x,this.xScale,this.cellsX),s=rf(e.y-this.min.y,this.yScale,this.cellsY),o=rf(t.y-this.min.y,this.yScale,this.cellsY);for(let e=s;e<=o;e++)for(let t=n;t<=r;t++){const n=this.cells[e*this.cellsX+t];if(n)for(let e=0;ee.fqid),this.index=e.index,this.hasPattern=!1,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.footprints=[],this.worldview=e.worldview}updateFootprints(e,t){for(const i of this.footprints)t.push({footprint:i,id:e})}populate(e,t,i,n){const r=[];for(const{feature:t,id:s,index:o,sourceLayerIndex:a}of e){const e=this.layers[0]._featureFilter.needGeometry,l=oh(t,e);if(!this.layers[0]._featureFilter.filter(new da(this.zoom,{worldview:this.worldview}),l,i))continue;const c={id:s,properties:t.properties,type:t.type,sourceLayerIndex:a,index:o,geometry:e?l.geometry:sh(t,i,n),patterns:{}};r.push(c)}for(const n of r){const{geometry:r,index:s,sourceLayerIndex:o}=n;this.addFeature(n,r,s,i,{},t.availableImages,t.brightness),t.featureIndex.insert(e[s].feature,r,s,o,this.index)}}isEmpty(){return 0===this.footprints.length}uploadPending(){return!1}upload(e){}update(e,t,i,n,r,s,o){}destroy(){}addFeature(e,t,i,n,r,s=[],o){for(const e of Pu(t,2)){const t=[],i=[],n=[],r=new xe(1/0,1/0),s=new xe(-1/0,-1/0);for(const o of e)if(0!==o.length){o!==e[0]&&n.push(i.length/2);for(let e=0;et===e)}(n,e.clipScope)}function gf(e,t){return e.x-t.x||e.y-t.y}function _f(e,t){return 0===gf(e.min,t.min)&&0===gf(e.max,t.max)}function yf(e,t){return!(e.min.x>t.max.x||e.max.xt.max.y||e.max.ynew xe((e.x+s.x*Rn)*a-o.x*Rn,(e.y+s.y*Rn)*a-o.y*Rn))}return wf(i,r,e.indices,0,e.indices.length,0,0)}function Tf(e,t,i,n){const r=Math.pow(2,n.z-i.z);return new xe((e+i.x*Rn)*r-n.x*Rn,(t+i.y*Rn)*r-n.y*Rn)}function kf(e,t){const i=[];t.grid.queryPoint(e,i);const n=t.indices,r=t.vertices;for(let t=0;t0&&(n.length>1&&i.push(n),n=[])}return n.length>1&&i.push(n),i}const Cf=ah.types,Df=["fill-extrusion-base","fill-extrusion-height","fill-extrusion-color","fill-extrusion-pattern","fill-extrusion-flood-light-wall-radius","fill-extrusion-line-width","fill-extrusion-emissive-strength"],Lf=["fill-extrusion-flood-light-ground-radius"],Ef=Math.pow(2,13),If=Math.pow(2,15)-1,Pf=new xe(0,1),Rf=2147483648;function Of(e,t,i,n,r,s,o,a){e.emplaceBack((t<<1)+o,(i<<1)+s,(Math.floor(n*Ef)<<1)+r,Math.round(a))}function zf(e,t,i){e.emplaceBack(t.x*Rn,t.y*Rn,i?1:0)}function Ff(e,t,i,n,r,s){e.emplaceBack(t.x,t.y,(i.x<<1)+n,(i.y<<1)+r,s)}function Nf(e,t,i){const n=16384;e.emplaceBack(t.x,t.y,t.z,i[0]*n,i[1]*n,i[2]*n)}class Yf{constructor(){this.vertexOffset=0,this.vertexCount=0,this.indexOffset=0,this.indexCount=0}}class Bf{constructor(){this.centroidXY=new xe(0,0),this.vertexArrayOffset=0,this.vertexCount=0,this.groundVertexArrayOffset=0,this.groundVertexCount=0,this.flags=0,this.footprintSegIdx=-1,this.footprintSegLen=0,this.polygonSegIdx=-1,this.polygonSegLen=0,this.min=new xe(Number.MAX_VALUE,Number.MAX_VALUE),this.max=new xe(-Number.MAX_VALUE,-Number.MAX_VALUE),this.height=0,this.buildingId=0}span(){return new xe(this.max.x-this.min.x,this.max.y-this.min.y)}}class Hf{constructor(){this.acc=new xe(0,0),this.accCount=0,this.centroidDataIndex=0}startRing(e,t){e.min.x===Number.MAX_VALUE&&(e.min.x=e.max.x=t.x,e.min.y=e.max.y=t.y)}appendEdge(e,t,i){this.accCount++,this.acc._add(t);let n=!!this.borders;t.xe.max.x&&(e.max.x=t.x,n=!0),t.ye.max.y&&(e.max.y=t.y,n=!0),((0===t.x||t.x===Rn)&&t.x===i.x)!=((0===t.y||t.y===Rn)&&t.y===i.y)&&this.processBorderOverlap(t,i),n&&this.checkBorderIntersection(t,i)}checkBorderIntersection(e,t){t.x<0!=e.x<0&&this.addBorderIntersection(0,ci(t.y,e.y,(0-t.x)/(e.x-t.x))),t.x>Rn!=e.x>Rn&&this.addBorderIntersection(1,ci(t.y,e.y,(Rn-t.x)/(e.x-t.x))),t.y<0!=e.y<0&&this.addBorderIntersection(2,ci(t.x,e.x,(0-t.y)/(e.y-t.y))),t.y>Rn!=e.y>Rn&&this.addBorderIntersection(3,ci(t.x,e.x,(Rn-t.y)/(e.y-t.y)))}addBorderIntersection(e,t){this.borders||(this.borders=[[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE]]);const i=this.borders[e];ti[1]&&(i[1]=t)}processBorderOverlap(e,t){if(e.x===t.x){if(e.y===t.y)return;const i=0===e.x?0:1;this.addBorderIntersection(i,t.y),this.addBorderIntersection(i,e.y)}else{const i=0===e.y?2:3;this.addBorderIntersection(i,t.x),this.addBorderIntersection(i,e.x)}}centroid(){return 0===this.accCount?new xe(0,0):new xe(Math.floor(Math.max(0,this.acc.x)/this.accCount),Math.floor(Math.max(0,this.acc.y)/this.accCount))}intersectsCount(){return this.borders?this.borders.reduce((e,t)=>e+ +(t[0]!==Number.MAX_VALUE),0):0}}function jf(e,t){const i=e.add(t)._unit(),n=Le(e.x*i.x+e.y*i.y,-1,1);var r,s,o;return r=Math.acos(n),Math.min(4,Math.max(-4,Math.tan(r)))/4*If*((s=e).x*(o=t).y-s.y*o.x<0?-1:1)}const Vf=[e=>e.x<0,e=>e.x>Rn,e=>e.y<0,e=>e.y>Rn];function Wf(e,t,i,n){const r=[4];if(0===n)return r;i._mult(n);const s=e.sub(i),o=t.sub(i),a=[e,t,s,o];for(let e=0;e<4;e++)for(const t of a)if(Vf[e](t)){r.push(e);break}return r}class Uf{constructor(e){this.vertexArray=new il,this.indexArray=new _l,this.programConfigurations=new wc(e.layers,{zoom:e.zoom,lut:e.lut},e=>Lf.includes(e)),this._segments=new Xl,this.hiddenByLandmarkVertexArray=new El,this._segmentToGroundQuads={},this._segmentToGroundQuads[0]=[],this._segmentToRegionTriCounts={},this._segmentToRegionTriCounts[0]=[0,0,0,0,0],this.regionSegments={},this.regionSegments[4]=new Xl}getDefaultSegment(){return this.regionSegments[4]}hasData(){return 0!==this.vertexArray.length}addData(e,t,i,n=!1){const r=e.length;if(r>2){let s=Math.max(0,this._segments.get().length-1);const o=this._segments._prepareSegment(4*r,this.vertexArray.length,2*this._segmentToGroundQuads[s].length);let a;s!==this._segments.get().length-1&&(s++,this._segmentToGroundQuads[s]=[],this._segmentToRegionTriCounts[s]=[0,0,0,0,0]);{const t=e[0],i=e[1];a=jf(t.sub(e[r-1])._perp()._unit(),i.sub(t)._perp()._unit())}for(let l=0;le.region-t.region);for(let i=0;ie+t,0);let s=0;for(let e=0;e<=4;e++){const t=r[e];if(0!==t){let i=this.regionSegments[e];i||(i=this.regionSegments[e]=new Xl);const r={vertexOffset:n.vertexOffset,primitiveOffset:n.primitiveOffset+s,vertexLength:n.vertexLength,primitiveLength:t};i.get().push(r)}s+=t}for(let e=0;e0?this.hiddenByLandmarkVertexBuffer=e.createVertexBuffer(this.hiddenByLandmarkVertexArray,hf.members,!0):this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexBuffer.updateData(this.hiddenByLandmarkVertexArray),this._needsHiddenByLandmarkUpdate=!1)}destroy(){if(this.vertexBuffer){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexBuffer.destroy(),this._segments&&this._segments.destroy(),this.programConfigurations.destroy();for(let e=0;e<=4;e++){const t=this.regionSegments[e];t&&t.destroy()}}}}class $f{constructor(e){this.zoom=e.zoom,this.canonical=e.canonical,this.overscaling=e.overscaling,this.layers=e.layers,this.pixelRatio=e.pixelRatio,this.layerIds=this.layers.map(e=>e.fqid),this.index=e.index,this.hasPattern=!1,this.edgeRadius=0,this.projection=e.projection,this.activeReplacements=[],this.replacementUpdateTime=0,this.centroidData=[],this.footprintIndices=new _l,this.footprintVertices=new Za,this.footprintSegments=[],this.layoutVertexArray=new Ka,this.centroidVertexArray=new jl,this.wallVertexArray=new Wl,this.indexArray=new _l,this.programConfigurations=new wc(e.layers,{zoom:e.zoom,lut:e.lut},e=>Df.includes(e)),this.segments=new Xl,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.groundEffect=new Uf(e),this.maxHeight=0,this.partLookup={},this.triangleSubSegments=[],this.polygonSegments=[],this.worldview=e.worldview}updateFootprints(e,t){}populate(e,t,i,n){this.features=[],this.hasPattern=zu("fill-extrusion",this.layers,this.pixelRatio,t),this.featuresOnBorder=[],this.borderFeatureIndices=[[],[],[],[]],this.borderDoneWithNeighborZ=[-1,-1,-1,-1],this.selfDEMTileTimestamp=Number.MAX_VALUE,this.borderDEMTileTimestamp=[Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE],this.tileToMeter=Zc(i),this.edgeRadius=this.layers[0].layout.get("fill-extrusion-edge-radius")/this.tileToMeter,this.wallMode=0!==this.layers[0].paint.get("fill-extrusion-line-width").constantOr(1);for(const{feature:r,id:s,index:o,sourceLayerIndex:a}of e){const e=this.layers[0]._featureFilter.needGeometry,l=oh(r,e);if(!this.layers[0]._featureFilter.filter(new da(this.zoom,{worldview:this.worldview}),l,i))continue;const c={id:s,sourceLayerIndex:a,index:o,geometry:e?l.geometry:sh(r,i,n),properties:r.properties,type:r.type,patterns:{}},h=this.layoutVertexArray.length,d="Polygon"===Cf[c.type];if(this.hasPattern)this.features.push({featureId:r.id,feature:Fu("fill-extrusion",this.layers,c,this.zoom,this.pixelRatio,t)});else if(this.wallMode)for(const e of c.geometry)for(const s of Af(e,d))this.addFeature(r.id,c,[s],o,i,{},t.availableImages,n,t.brightness);else this.addFeature(r.id,c,c.geometry,o,i,{},t.availableImages,n,t.brightness);t.featureIndex.insert(r,c.geometry,o,a,this.index,h)}this.sortBorders(),"mercator"===this.projection.name&&this.splitToSubtiles(),this.groundEffect.prepareBorderSegments(),this.polygonSegments.length=0}addFeatures(e,t,i,n,r,s){for(const{featureId:e,feature:o}of this.features){const a="Polygon"===Cf[o.type],{geometry:l}=o;if(this.wallMode)for(const c of l)for(const l of Af(c,a))this.addFeature(e,o,[l],o.index,t,i,n,r,s);else this.addFeature(e,o,l,o.index,t,i,n,r,s)}this.sortBorders(),"mercator"===this.projection.name&&this.splitToSubtiles()}update(e,t,i,n,r,s,o){this.programConfigurations.updatePaintArrays(e,t,r,i,n,s,o,this.worldview),this.groundEffect.update(e,t,r,i,n,s,o,this.worldview)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,uf),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.wallVertexBuffer=e.createVertexBuffer(this.wallVertexArray,cf.members),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=e.createVertexBuffer(this.layoutVertexExtArray,df.members,!0)),this.groundEffect.upload(e)),this.groundEffect.uploadPaintProperties(e),this.programConfigurations.upload(e),this.uploaded=!0}uploadCentroid(e){this.groundEffect.uploadHiddenByLandmark(e),this.needsCentroidUpdate&&(!this.centroidVertexBuffer&&this.centroidVertexArray.length>0?this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,lf.members,!0):this.centroidVertexBuffer&&this.centroidVertexBuffer.updateData(this.centroidVertexArray),this.needsCentroidUpdate=!1)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.centroidVertexBuffer&&this.centroidVertexBuffer.destroy(),this.layoutVertexExtBuffer&&this.layoutVertexExtBuffer.destroy(),this.groundEffect.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,t,i,n,r,s,o,a,l){const c=this.layers[0].paint.get("fill-extrusion-flood-light-ground-radius").evaluate(t,{})/this.tileToMeter,h=[new xe(0,0),new xe(Rn,Rn)],d=a.projection,u="globe"===d.name,f=this.wallMode||"Polygon"===Cf[t.type],p=new Hf;p.centroidDataIndex=this.centroidData.length;const m=new Bf;m.buildingId=e,t.properties&&t.properties.hasOwnProperty("building_id")&&(m.buildingId=t.properties.building_id);const g=this.layers[0].paint.get("fill-extrusion-base").evaluate(t,{},r)<=0,_=this.layers[0].paint.get("fill-extrusion-height").evaluate(t,{},r);let y;if(m.height=_,m.vertexArrayOffset=this.layoutVertexArray.length,m.groundVertexArrayOffset=this.groundEffect.vertexArray.length,u&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new al),this.wallMode){if(u)return void We("Non zero fill-extrusion-line-width is not yet supported on globe.");if(1!==i.length)return;y=function(e){const t=e[0].x===e[e.length-1].x&&e[0].y===e[e.length-1].y,i=function(e){let t=0;const i=e.length;for(let n=0;n=0}(e);i||(e=e.reverse());const n={geometry:[],joinNormals:[],indices:[]},r=[],s=[],o=[];let a=e.length;for(;a>=2&&e[a-1].equals(e[a-2]);)a--;if(a<(t?3:2))return n;let l,c,h,d,u,f=0;for(;f0;let _="miter";const y=2;"miter"===_&&m>y&&(_="bevel"),"bevel"===_&&(m>100&&(_="flipbevel"),m{const a=new xe(e.x,e.y),l=new xe(e.x,e.y);a.x+=t.x*n,a.y+=t.y*n,l.x-=t.x*Math.max(i,1),l.y-=t.y*Math.max(i,1),o.push(t),r.push(a),s.push(l)};if("miter"===_)n._mult(m),v(l,n,0,0);else if("flipbevel"===_)n=u.mult(-1),v(l,n,0,0),v(l,n.mult(-1),0,0);else{const e=-Math.sqrt(m*m-1),t=g?e:0,i=g?0:e;c&&v(l,d,t,i),h&&v(l,u,t,i)}}n.geometry=[...r,...s.reverse(),r[0]],n.joinNormals=[...o,...o.reverse(),o[o.length-1]];const p=n.geometry.length-1;for(let e=0;e

e<(t.length-1)/2||e===t.length-1,x=this.wallMode?[i]:Pu(i,500);for(let e=x.length-1;e>=0;e--){const t=x[e];(0===t.length||(b=t[0]).every(e=>e.x<=0)||b.every(e=>e.x>=Rn)||b.every(e=>e.y<=0)||b.every(e=>e.y>=Rn))&&x.splice(e,1)}var b;let w;if(u)w=tp(x,h,r);else{w=[];for(const e of x)w.push({polygon:e,bounds:h})}const S=f?this.edgeRadius:0,T=S>0&&this.zoom<17,k=(e,t)=>{if(0===e.length)return!1;const i=e[e.length-1];return t.x===i.x&&t.y===i.y};for(const{polygon:e,bounds:t}of w){let i=0,n=0;for(const t of e)f&&!t[0].equals(t[t.length-1])&&t.push(t[0]),n+=f?t.length-1:t.length;const s=this.segments.prepareSegment((f?5:4)*n,this.layoutVertexArray,this.indexArray);m.footprintSegIdx<0&&(m.footprintSegIdx=this.footprintSegments.length),m.polygonSegIdx<0&&(m.polygonSegIdx=this.polygonSegments.length);const o={triangleArrayOffset:this.indexArray.length,triangleCount:0,triangleSegIdx:this.segments.segments.length-1},a=new Yf;if(a.vertexOffset=this.footprintVertices.length,a.indexOffset=3*this.footprintIndices.length,a.ringIndices=[],f){const n=[],o=[];i=s.vertexLength;for(let i=0;i4&&Kf(o[o.length-2],o[0],o[1]),l=S?Xf(o[o.length-2],o[0],o[1],S):0;const h=[];let _,x,b;x=o[1].sub(o[0])._perp()._unit();let w=!0;for(let e=1,n=0;e0?1:0,D=c.dist(f);if(n+D>32768&&(n=0),S){b=T.sub(f)._perp()._unit();let e=qf(c,f,T,Gf(x,b),S);isNaN(e)&&(e=0);const t=f.sub(c)._unit();c=c.add(t.mult(l))._round(),f=f.add(t.mult(-e))._round(),l=e,x=b,g&&this.zoom>=17&&(k(h,c)||h.push(c),k(h,f)||h.push(f))}const L=s.vertexLength,E=o.length>4&&Kf(c,f,T);let I=Qf(n,a,w);if(Of(this.layoutVertexArray,c.x,c.y,A,C,0,0,I),Of(this.layoutVertexArray,c.x,c.y,A,C,0,1,I),this.wallMode){const t=v(e-1,o),i=y.joinNormals[e-1];zf(this.wallVertexArray,i,t),zf(this.wallVertexArray,i,t)}if(n+=D,I=Qf(n,E,!w),a=E,Of(this.layoutVertexArray,f.x,f.y,A,C,0,0,I),Of(this.layoutVertexArray,f.x,f.y,A,C,0,1,I),this.wallMode){const t=v(e,o),i=y.joinNormals[e];zf(this.wallVertexArray,i,t),zf(this.wallVertexArray,i,t)}if(s.vertexLength+=4,this.indexArray.emplaceBack(L+0,L+1,L+2),this.indexArray.emplaceBack(L+1,L+3,L+2),s.primitiveLength+=2,S){const n=i+(1===e?o.length-2:e-2),r=1===e?i:n+1;if(this.indexArray.emplaceBack(L+1,n,L+3),this.indexArray.emplaceBack(n,r,L+3),s.primitiveLength+=2,void 0===_&&(_=L),!Zf(T,o[e],t)){const t=e===o.length-1?_:s.vertexLength;this.indexArray.emplaceBack(L+2,L+3,t),this.indexArray.emplaceBack(L+3,t+1,t),this.indexArray.emplaceBack(L+3,r,t+1),s.primitiveLength+=3}w=!w}if(u){const e=this.layoutVertexExtArray,t=d.projectTilePoint(c.x,c.y,r),i=d.projectTilePoint(f.x,f.y,r),n=d.upVector(r,c.x,c.y),s=d.upVector(r,f.x,f.y);Nf(e,t,n),Nf(e,t,n),Nf(e,i,s),Nf(e,i,s)}}f&&(i+=o.length-1),g&&S&&this.zoom>=17&&(0!==h.length&&k(h,h[0])&&h.pop(),this.groundEffect.addData(h,t,c,S>0))}this.footprintSegments.push(a),o.triangleCount=this.indexArray.length-o.triangleArrayOffset,this.polygonSegments.push(o),++m.footprintSegLen,++m.polygonSegLen}if(m.vertexCount=this.layoutVertexArray.length-m.vertexArrayOffset,m.groundVertexCount=this.groundEffect.vertexArray.length-m.groundVertexArrayOffset,0!==m.vertexCount){if(m.centroidXY=p.borders?Pf:this.encodeCentroid(p,m),this.centroidData.push(m),p.borders){this.featuresOnBorder.push(p);const e=this.featuresOnBorder.length-1;for(let t=0;tthis.featuresOnBorder[t].borders[e][0]-this.featuresOnBorder[i].borders[e][0])}splitToSubtiles(){const e=[];for(let t=0;tRn),r=2*n+(+(i.min.x+i.max.x>Rn)^n);for(let n=0;ne.triangleSegmentIdx===t.triangleSegmentIdx?e.subtile-t.subtile:e.triangleSegmentIdx-t.triangleSegmentIdx);let i=0,n=0,r=0;for(const t of e){if(t.triangleSegmentIdx!==i)break;r++}const s=e.length;for(;n!==e.length;){i=e[n].triangleSegmentIdx;let o=0,a=n,l=n;for(let t=a;t0&&this.triangleSubSegments.push({segment:h,min:s,max:c}),a=l;for(let t=a;t[e[0]*(1-i[0])+t[0]*i[0],e[1]*(1-i[1])+t[1]*i[1]],u=[],f=[];for(const e of this.triangleSubSegments){u[0]=e.min.x/Rn,u[1]=e.min.y/Rn,f[0]=e.max.x/Rn,f[1]=e.max.y/Rn;const t=d(c,h,u),o=d(c,h,f);if(0===new Dh([t[0],t[1],r],[o[0],o[1],s]).intersectsPrecise(i)){l&&(n.segments.push(l),l=void 0);continue}const a=e.segment;l&&l.vertexOffset!==a.vertexOffset&&(n.segments.push(l),l=void 0),l?(l.vertexLength+=a.vertexLength,l.primitiveLength+=a.primitiveLength):l={vertexOffset:a.vertexOffset,primitiveLength:a.primitiveLength,vertexLength:a.vertexLength,primitiveOffset:a.primitiveOffset,sortKey:void 0,vaos:{}}}return l&&n.segments.push(l),n}encodeCentroid(e,t){const i=e.centroid(),n=t.span(),r=Math.min(7,Math.round(n.x*this.tileToMeter/10)),s=Math.min(7,Math.round(n.y*this.tileToMeter/10));return new xe(Le(i.x,1,8191)<<3|r,Le(i.y,1,8191)<<3|s)}encodeBorderCentroid(e){if(!e.borders)return new xe(0,0);const t=e.borders,i=Number.MAX_VALUE;if(t[0][0]!==i||t[1][0]!==i){const e=t[0][0]!==i?0:1;return new xe(6|(t[0][0]!==i?0:65528),(t[e][0]+t[e][1])/2<<3|6)}{const e=t[2][0]!==i?2:3;return new xe((t[e][0]+t[e][1])/2<<3|6,6|(t[2][0]!==i?0:65528))}}showCentroid(e){const t=this.centroidData[e.centroidDataIndex];t.flags&=2147483647,t.centroidXY.x=0,t.centroidXY.y=0,this.writeCentroidToBuffer(t)}writeCentroidToBuffer(e){this.groundEffect.updateHiddenByLandmark(e);const t=e.vertexArrayOffset,i=e.vertexCount+e.vertexArrayOffset,n=e.flags&Rf?Pf:e.centroidXY,r=this.centroidVertexArray.geta_centroid_pos0(t);if(this.centroidVertexArray.geta_centroid_pos1(t)!==n.y||r!==n.x){for(let e=t;ei.max.x||i.min.x>t.max.x||t.min.y>i.max.y||i.min.y>t.max.y))for(let s=0;st!=l>t&&e<(this.footprintVertices.int16[2*(a+s.vertexOffset)+0]-i)*(t-o)/(l-o)+i&&(n=!n)}o=i}}return n}getHeightAtTileCoord(e,t){let i=Number.NEGATIVE_INFINITY,n=!0;const r=4*(e+Rn)*Rn+(t+Rn);if(this.partLookup.hasOwnProperty(r)){const e=this.partLookup[r];return e?{height:e.height,hidden:!!(e.flags&Rf)}:void 0}for(const s of this.centroidData)e>s.max.x||s.min.x>e||t>s.max.y||s.min.y>t||s.height<=i||this.footprintContainsPoint(e,t,s)&&(i=s.height,this.partLookup[r]=s,n=!!(s.flags&Rf));if(i!==Number.NEGATIVE_INFINITY)return{height:i,hidden:n};this.partLookup[r]=void 0}}function Gf(e,t){const i=e.add(t)._unit();return e.x*i.x+e.y*i.y}function Xf(e,t,i,n){const r=t.sub(e)._perp()._unit(),s=i.sub(t)._perp()._unit();return qf(e,t,i,Gf(r,s),n)}function qf(e,t,i,n,r){const s=Math.sqrt(1-n*n);return Math.min(e.dist(t)/3,t.dist(i)/3,r*s/n)}function Zf(e,t,i){return e.xi[1].x&&t.x>i[1].x||e.yi[1].y&&t.y>i[1].y}function Jf(e,t){return e.xt[1].x||e.yt[1].y}function Kf(e,t,i){if(e.x<0||e.x>=Rn||t.x<0||t.x>=Rn||i.x<0||i.x>=Rn)return!1;const n=i.sub(t),r=n.perp(),s=e.sub(t);return(n.x*s.x+n.y*s.y)/Math.sqrt((n.x*n.x+n.y*n.y)*(s.x*s.x+s.y*s.y))>-.866&&r.x*s.x+r.y*s.y<0}function Qf(e,t,i){const n=t?2|e:-3&e;return i?1|n:-2&n}function ep(){const e=Math.PI/32,t=Math.tan(e),i=Oc;return i*Math.sqrt(1+2*t*t)-i}function tp(e,t,i){const n=1<{for(const i of e)o.push({polygon:i,bounds:t})},l=Math.ceil(Math.log2(i)),c=Math.ceil(Math.log2(n)),h=l-c,d=[];for(let e=0;e0?0:1);for(let e=0;et+1?f.push({polygons:u,bounds:e,depth:t+1}):a(u,e)}if(p.length){const e=[new xe(0===i?h:n.x,1===i?h:n.y),o];d.length>t+1?f.push({polygons:p,bounds:e,depth:t+1}):a(p,e)}}return o}(e,t,Math.ceil((s-r)/11.25),Math.ceil((o-a)/11.25),1,(e,t,r)=>{if(0===e)return.5*(t+r);{const e=Wc((i.y+t/Rn)/n);return(Hc(.5*(Wc((i.y+r/Rn)/n)+e))*n-i.y)*Rn}})}function ip(e,t,i,n,r,s){const o=Math.pow(2,n.z-r.z);for(let a=0;a=o[i]&&(n=t,o=e),n[i]r&&ap(n,o,i,r),n[i]s&&ap(o,n,i,s)}}function cp(e,t,i,n,r,s){const o=[];for(let a=0;a=n&&u.x>=n||(h.x>=n?h=new xe(n,h.y+(n-h.x)/(u.x-h.x)*(u.y-h.y))._round():u.x>=n&&(u=new xe(n,h.y+(n-h.x)/(u.x-h.x)*(u.y-h.y))._round()),h.y>=r&&u.y>=r||(h.y>=r?h=new xe(h.x+(r-h.y)/(u.y-h.y)*(u.x-h.x),r)._round():u.y>=r&&(u=new xe(h.x+(r-h.y)/(u.y-h.y)*(u.x-h.x),r)._round()),c&&h.equals(c[c.length-1])||(c=[h],o.push(c),s&&s.push({progress:{min:p+dp(m,g,h)*f,max:1},parentIndex:a,prevPoint:m,nextPoint:g})),c.push(u),s&&(s[s.length-1].progress.max=p+dp(m,g,u)*f,s[s.length-1].nextPoint=g)))))}if(s&&d>0)for(let e=h;ee.t-t.t);let o=0,a=0,l=[];for(n.push(l);o!==e.length;){if(a===s.length){for(;o!==e.length;)0!==l.length&&l[l.length-1].equals(e[o])||l.push(e[o]),o++;break}s[a].t<=o?(0!==l.length&&l[l.length-1].equals(s[a].point)||l.push(s[a].point),Math.trunc(s[a].t),a++):(0!==l.length&&l[l.length-1].equals(e[o])||l.push(e[o]),o++)}}function dp(e,t,i){return e.x!==t.x?(i.x-e.x)/(t.x-e.x):e.y!==t.y?(i.y-e.y)/(t.y-e.y):0}function up(e,t){return e.x*t.x+e.y*t.y}function fp(e,t){if(1===e.length){let i=0;const n=t[i++];let r;for(;!r||n.equals(r);)if(r=t[i++],!r)return 1/0;for(;i{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){this._channel=void 0,this._callback=()=>{}}}class gp{constructor(){this.tasks={},this.taskQueue=[],Ne(["process"],this),this.invoker=new mp(this.process),this.nextId=0}add(e,t){const i=this.nextId++,n=function({type:e,isSymbolTile:t,zoom:i}){return i=i||0,"message"===e?0:"maybePrepare"!==e||t?"parseTile"!==e||t?"parseTile"===e&&t?300-i:"maybePrepare"===e&&t?400-i:500:200-i:100-i}(t);if(0===n){try{e()}finally{}return null}return this.tasks[i]={fn:e,metadata:t,priority:n,id:i},this.taskQueue.push(i),this.invoker.trigger(),{cancel:()=>{delete this.tasks[i]}}}process(){try{if(this.taskQueue=this.taskQueue.filter(e=>!!this.tasks[e]),!this.taskQueue.length)return;const e=this.pick();if(null===e)return;const t=this.tasks[e];if(delete this.tasks[e],this.taskQueue.length&&this.invoker.trigger(),!t)return;t.fn()}finally{}}pick(){let e=null,t=1/0;for(let i=0;i{i&&delete this.callbacks[o],this.target.postMessage({id:o,type:"",targetMapId:n,sourceMapId:this.mapId})}}}receive(e){const t=e.data;if(!t)return;const i=t.id;if(i&&(!t.targetMapId||this.mapId===t.targetMapId))if(""===t.type){const e=this.cancelCallbacks[i];delete this.cancelCallbacks[i],e&&e.cancel()}else if(t.mustQueue||Xe(self)){const e=this.callbacks[i],n=this.scheduler.add(()=>this.processTask(i,t),e&&e.metadata||{type:"message"});n&&(this.cancelCallbacks[i]=n)}else this.processTask(i,t)}processTask(e,t){if(delete this.cancelCallbacks[e],""===t.type){const i=this.callbacks[e];delete this.callbacks[e],i&&(t.error?i(Xs(t.error)):i(null,Xs(t.data)))}else{const i=new Set,n=t.hasCallback?(t,n)=>{this.target.postMessage({id:e,type:"",sourceMapId:this.mapId,error:t?Gs(t):null,data:Gs(n,i)},i)}:()=>{},r=Xs(t.data);if(this.parent[t.type])this.parent[t.type](t.sourceMapId,r,n);else if(this.parent.getWorkerSource){const e=t.type.split("."),{source:i,scope:s}=r;this.parent.getWorkerSource(t.sourceMapId,e[0],i,s)[e[1]](r,n)}else n(new Error(`Could not find function ${t.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}}var yp={workerUrl:"",workerClass:null,workerParams:void 0};const vp="mapboxgl_preloaded_worker_pool";class xp{constructor(){this.active={}}acquire(e,t=xp.workerCount){if(!this.workers)for(this.workers=[];this.workers.length{e.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[vp]}numActive(){return Object.keys(this.active).length}}xp.workerCount=2;class bp{constructor(e,t,i="Worker",n=xp.workerCount){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=ze();const r=this.workerPool.acquire(this.id,n);for(let e=0;e{this.ready=!0})}broadcast(e,t,i){Pe(this.actors,(i,n)=>{i.send(e,t,n)},i=i||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(e=>{e.remove()}),this.actors=[],this.workerPool.release(this.id)}}let wp,Sp;function Tp(){return wp||(wp=new xp),wp}bp.Actor=_p;class kp{constructor(e){this.module=e}createIntArray(e){const t=new Int32Array(e),i=this.module.malloc(t.length*t.BYTES_PER_ELEMENT);return this.module.heap32.set(t,i/t.BYTES_PER_ELEMENT),i}createFloatArray(e){const t=new Float32Array(e),i=this.module.malloc(t.length*t.BYTES_PER_ELEMENT);return this.module.heapF32.set(t,i/t.BYTES_PER_ELEMENT),i}createStringBuffer(e){const t=this.module.malloc(e.length+1);for(let i=0;ie.arrayBuffer()).then(e=>{t.buffers[i]=e})}function qp(e,t){const i=e.json.bufferViews[t];return new Uint8Array(e.buffers[i.buffer],i.byteOffset||0,i.byteLength)}function Zp(e,t,i,n){if(e.uri){const r=Gp(e.uri,n);return fetch(r).then(e=>e.blob()).then(e=>createImageBitmap(e)).then(e=>{t.images[i]=e})}if(void 0!==e.bufferView){const n=qp(t,e.bufferView),r=new Blob([n],{type:e.mimeType});return createImageBitmap(r).then(e=>{t.images[i]=e})}}function Jp(e,t=0,i){const n={json:null,images:[],buffers:[]};if(new Uint32Array(e,t,1)[0]===Up){const i=new Uint32Array(e,t);let r=2;const s=(i[r++]>>2)-3,o=i[r++]>>2;if(r++,n.json=JSON.parse($p.decode(i.subarray(r,r+o))),r+=o,r{const e=[],t=a&&a.includes(Hp),r=a&&a.includes(Vp);if(t&&e.push(function(){if(!Cp)return null!=Mp?Mp:(Mp=function(e){let t,i=null;function n(){t=new Uint8Array(i.buffer)}function r(){throw new Error("Unexpected Draco error.")}const s={a:{a:r,d:function(e,i,n){return t.copyWithin(e,i,i+n)},c:function(e){const r=t.length,s=Math.max(e>>>0,Math.ceil(1.2*r)),o=Math.ceil((s-r)/65536);try{return i.grow(o),n(),!0}catch(e){return!1}},b:r}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(e,s):e.then(e=>e.arrayBuffer()).then(e=>WebAssembly.instantiate(e,s))).then(e=>{const{Rb:r,Qb:s,P:o,T:a,X:l,Ja:c,La:h,Qa:d,Va:u,Wa:f,eb:p,jb:m,f:g,e:_,yb:y,zb:v,Ab:x,Bb:b,Db:w,Gb:S}=e.instance.exports;i=_;const T=(()=>{let e=0,i=0,n=0,o=0;return a=>{n&&(r(o),r(e),i+=n,n=e=0),e||(i+=128,e=s(i));const l=a.length+7&-8;let c=e;l>=i&&(n=l,c=o=s(l));for(let e=0;e{Cp=e,Mp=void 0}))}()),r&&e.push(function(){if(Lp)return;const e=function(e){let t;const i=WebAssembly.instantiateStreaming(e,{}).then(e=>{t=e.instance,t.exports.__wasm_call_ctors()}),n={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},r={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return{ready:i,supported:!0,decodeGltfBuffer(e,i,s,o,a,l){!function(e,t,i,n,r,s,o){const a=e.exports.sbrk,l=n+3&-4,c=a(l*r),h=a(s.length),d=new Uint8Array(e.exports.memory.buffer);d.set(s,h);const u=t(c,n,r,h,s.length);if(0===u&&o&&o(c,l,r),i.set(d.subarray(c,c+n*r)),a(c-a(0)),0!==u)throw new Error(`Malformed buffer data: ${u}`)}(t,t.exports[r[a]],e,i,s,o,t.exports[n[l]])}}}(fetch(zp()));return e.ready.then(()=>{Lp=e})}()),s)for(let t=0;t{if(t&&o)for(const{primitives:e}of o)for(const t of e)jp(t,n);if(r&&o&&l)for(const e of l)Wp(e,n);return n})})}function Kp(e){switch(e){case WebGL2RenderingContext.RGBA8:return WebGL2RenderingContext.RGBA;case WebGL2RenderingContext.DEPTH_COMPONENT16:return WebGL2RenderingContext.DEPTH_COMPONENT;case WebGL2RenderingContext.DEPTH24_STENCIL8:return WebGL2RenderingContext.DEPTH_STENCIL;case WebGL2RenderingContext.R8:case WebGL2RenderingContext.R32F:return WebGL2RenderingContext.RED}}function Qp(e){switch(e){case WebGL2RenderingContext.RGBA8:return WebGL2RenderingContext.UNSIGNED_BYTE;case WebGL2RenderingContext.DEPTH_COMPONENT16:return WebGL2RenderingContext.UNSIGNED_SHORT;case WebGL2RenderingContext.DEPTH24_STENCIL8:return WebGL2RenderingContext.UNSIGNED_INT_24_8;case WebGL2RenderingContext.R8:return WebGL2RenderingContext.UNSIGNED_BYTE;case WebGL2RenderingContext.R32F:return WebGL2RenderingContext.FLOAT}}class em{constructor(e,t,i,n){this.context=e,this.format=i,this.useMipmap=n&&n.useMipmap,this.texture=e.gl.createTexture(),this.update(t,{premultiply:n&&n.premultiply})}update(e,t){const i=e&&e instanceof HTMLVideoElement&&0===e.width?e.videoWidth:e.width,n=e&&e instanceof HTMLVideoElement&&0===e.height?e.videoHeight:e.height,{context:r}=this,{gl:s}=r,{x:o,y:a}=t&&t.position?t.position:{x:0,y:0},l=o+i,c=a+n;!this.size||this.size[0]===l&&this.size[1]===c||(s.bindTexture(s.TEXTURE_2D,null),s.deleteTexture(this.texture),this.texture=s.createTexture(),this.size=null),s.bindTexture(s.TEXTURE_2D,this.texture),r.pixelStoreUnpackFlipY.set(!1),r.pixelStoreUnpack.set(1),r.pixelStoreUnpackPremultiplyAlpha.set(this.format===s.RGBA8&&(!t||!1!==t.premultiply));const h=e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||ImageBitmap&&e instanceof ImageBitmap;if(!this.size&&l>0&&c>0){const e=this.useMipmap?Math.floor(Math.log2(Math.max(l,c)))+1:1;s.texStorage2D(s.TEXTURE_2D,e,this.format,l,c),this.size=[l,c]}if(this.size)if(h)s.texSubImage2D(s.TEXTURE_2D,0,o,a,Kp(this.format),Qp(this.format),e);else{const t=e.data;t&&s.texSubImage2D(s.TEXTURE_2D,0,o,a,i,n,Kp(this.format),Qp(this.format),t)}this.useMipmap&&s.generateMipmap(s.TEXTURE_2D)}bind(e,t,i=!1){const{context:n}=this,{gl:r}=n;r.bindTexture(r.TEXTURE_2D,this.texture),e!==this.minFilter&&(r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,e),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,this.useMipmap&&!i?e===r.NEAREST?r.NEAREST_MIPMAP_NEAREST:r.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),t!==this.wrapS&&(r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,t),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,t),this.wrapS=t)}bindExtraParam(e,t,i,n,r){const{context:s}=this,{gl:o}=s;o.bindTexture(o.TEXTURE_2D,this.texture),t!==this.magFilter&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,t),this.magFilter=t),e!==this.minFilter&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,this.useMipmap?e===o.NEAREST?o.NEAREST_MIPMAP_NEAREST:o.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),i!==this.wrapS&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,i),this.wrapS=i),n!==this.wrapT&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,n),this.wrapT=n),r!==this.compareMode&&(r?(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_COMPARE_MODE,o.COMPARE_REF_TO_TEXTURE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_COMPARE_FUNC,r)):o.texParameteri(o.TEXTURE_2D,o.TEXTURE_COMPARE_MODE,o.NONE),this.compareMode=r)}destroy(){const{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}class tm{constructor(e,t){this.context=e,this.texture=t}bind(e,t){const{context:i}=this,{gl:n}=i;n.bindTexture(n.TEXTURE_2D,this.texture),e!==this.minFilter&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,e),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,e),this.minFilter=e),t!==this.wrapS&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,t),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,t),this.wrapS=t)}}const im=Xa([{name:"a_pos_3f",components:3,type:"Float32"}]),nm=Xa([{name:"a_color_3f",components:3,type:"Float32"}]),rm=Xa([{name:"a_color_4f",components:4,type:"Float32"}]),sm=Xa([{name:"a_uv_2f",components:2,type:"Float32"}]),om=Xa([{name:"a_normal_3f",components:3,type:"Float32"}]),am=Xa([{name:"a_normal_matrix0",components:4,type:"Float32"},{name:"a_normal_matrix1",components:4,type:"Float32"},{name:"a_normal_matrix2",components:4,type:"Float32"},{name:"a_normal_matrix3",components:4,type:"Float32"}]),lm=Xa([{name:"a_pbr",components:4,type:"Uint16"},{name:"a_heightBasedEmissiveStrength",components:3,type:"Float32"}]);function cm(e,t){const i=dm(e.projection,e.zoom,e.width,e.height),n=function(e,t,i,n,r){const s=new Fc(i.lng-180*um,i.lat),o=new Fc(i.lng+180*um,i.lat),a=e.project(s.lng,s.lat),c=e.project(o.lng,o.lat),d=-Math.atan2(c.y-a.y,c.x-a.x),f=Jc.fromLngLat(i);f.y=Le(f.y,-1+um,1-um);const p=f.toLngLat(),g=e.project(p.lng,p.lat),_=Jc.fromLngLat(p);_.x+=um;const y=_.toLngLat(),v=e.project(y.lng,y.lat),x=pm(v.x-g.x,v.y-g.y,d),b=Jc.fromLngLat(p);b.y+=um;const w=b.toLngLat(),S=e.project(w.lng,w.lat),T=pm(S.x-g.x,S.y-g.y,d),k=Math.abs(x.x)/Math.abs(T.y),M=l([]);m(M,M,-d*(1-(r?0:n)));const A=l([]);return u(A,A,[1,1-(1-k)*n,1]),A[4]=-T.x/T.y*n,m(A,A,d),h(A,M,A),A}(e.projection,0,e.center,i,t),r=hm(e);return u(n,n,[r,r,1]),n}function hm(e){const t=e.projection,i=dm(e.projection,e.zoom,e.width,e.height),n=fm(t,e.center),r=fm(t,Fc.convert(t.center));return Math.pow(2,n*i+(1-i)*r)}function dm(e,t,i,n,r=1/0){const s=e.range;if(!s)return 0;const o=Math.min(r,Math.max(i,n)),a=Math.log(o/1024)/Math.LN2;return Ee(s[0]+a,s[1]+a,t)}const um=1/4e4;function fm(e,t){const i=Le(t.lat,-$c,$c),n=new Fc(t.lng-180*um,i),r=new Fc(t.lng+180*um,i),s=e.project(n.lng,i),o=e.project(r.lng,i),a=Jc.fromLngLat(n),l=Jc.fromLngLat(r),c=o.x-s.x,h=o.y-s.y,d=l.x-a.x,u=l.y-a.y,f=Math.sqrt((d*d+u*u)/(c*c+h*h));return Math.log(f)/Math.LN2}function pm(e,t,i){const n=Math.cos(i),r=Math.sin(i);return{x:e*n-t*r,y:e*r+t*n}}function mm(e,t,i){l(e),m(e,e,Te(t[2])),f(e,e,Te(t[0])),p(e,e,Te(t[1])),u(e,e,i),h(e,e,[1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1])}function gm(e,t,i,n,r,s,o,a){const l=[i[0]-t[0],i[1]-t[1],0],c=[n[0]-t[0],n[1]-t[1],0];if(w(l)<1e-12||w(c)<1e-12)return K(e);const h=F([],l,c);O(h,h),M(c,n,t),l[2]=(s-r)*a,c[2]=(o-r)*a;const d=l;return F(d,l,c),O(d,d),se(e,h,d)}function _m(e,t,i=!1){const n=Id(t.zoom),r=function(e,t,i){const n=t.worldSize,r=[e[12],e[13],e[14]],s=Wc(r[1]/n),o=Vc(r[0]/n),a=l([]),c=jc(1,s)*n,f=jc(1,0)*n*Xc(s,t.zoom),p=1/Dd(n);let m=f*p;if(i){const e=dm(t.projection,t.zoom,t.width,t.height,1024);m=p*t.projection.pixelSpaceConversion(t.center.lat,n,e)}const g=Rc(s,o);k(g,g,L([],O([],g),c*m*r[2]));const _=function(e){const t=[e[0],e[1],e[2]];let i=[0,1,0];const n=F([],i,t);return F(i,t,n),0===P(i)&&(i=[0,1,0],F(n,t,i)),O(n,n),O(i,i),O(t,t),[n[0],n[1],n[2],0,i[0],i[1],i[2],0,t[0],t[1],t[2],0,e[0],e[1],e[2],1]}(g);u(a,a,[m,m,m*c]),d(a,a,[-r[0],-r[1],-r[2]]);const y=h([],t.globeMatrix,_);return h(y,y,a),h(y,y,e),y}(e,t,i);if(n>0){const i=function(e,t){const i=t.worldSize,n=jc(1,0)*i*Xc(t.center.lat,t.zoom)/Dd(i),r=jc(1,t.center.lat)*i,s=l([]);return p(s,s,Te(t.center.lng)),f(s,s,Te(t.center.lat)),d(s,s,[0,0,Cc]),u(s,s,[n,n,n*r]),d(s,s,[t.point.x-.5*i,t.point.y-.5*i,0]),h(s,s,e),h(s,t.globeMatrix,s)}(e,t);return function(e,t,i){const n=(e,t,i)=>{const n=w(e),r=w(t),s=vd(e,t,i);return L(s,s,1/w(s)*ci(n,r,i))},r=n([e[0],e[1],e[2]],[t[0],t[1],t[2]],i),s=n([e[4],e[5],e[6]],[t[4],t[5],t[6]],i),o=n([e[8],e[9],e[10]],[t[8],t[9],t[10]],i),a=vd([e[12],e[13],e[14]],[t[12],t[13],t[14]],i);return[r[0],r[1],r[2],0,s[0],s[1],s[2],0,o[0],o[1],o[2],0,a[0],a[1],a[2],1]}(r,i,n)}return r}function ym(e,t,i,n){const r=Dh.projectAabbCorners(n,i);let s=Number.MAX_VALUE,o=-1;for(let e=0;enew xe(r[e][0],r[e][1]);let l;switch(o){case 0:case 6:l=[a(1),a(5),a(4),a(7),a(3),a(2),a(1)];break;case 1:case 7:l=[a(0),a(4),a(5),a(6),a(2),a(3),a(0)];break;case 3:case 5:l=[a(1),a(0),a(4),a(7),a(6),a(2),a(1)];break;default:l=[a(1),a(5),a(6),a(7),a(3),a(0),a(1)]}if(Oh(e,l))return s}const vm=64,xm={CoordinateSpaceTile:1,HasMapboxMeshFeatures:4,HasMeshoptCompression:8};function bm(e,t,i,n,r,s,o,a,c,f=!1){const p=i.zoom,m=i.project(n),g=Xc(n.lat,p),_=1/g;l(e),d(e,e,[m.x+o[0]*_,m.y+o[1]*_,o[2]]);let v=1,x=1;const b=i.worldSize;if(f){if("mercator"===i.projection.name){let e=0;i.elevation&&(e=i.elevation.getAtPointOrZero(new Jc(m.x/b,m.y/b),0));const t=Z([],[m.x,m.y,e,1],i.projMatrix)[3]/i.cameraToCenterDistance;v=t,x=t*Xc(i.center.lat,p)}else if("globe"===i.projection.name){const t=_m(e,i),r=[0,0,0,1];Z(r,r,h([],i.projMatrix,t));const s=r[3]/i.cameraToCenterDistance,o=Id(p),a=i.projection.pixelsPerMeter(n.lat,b)*Xc(n.lat,p),l=i.projection.pixelsPerMeter(i.center.lat,b)*Xc(i.center.lat,p);v=s/ci(a,Gc(i.center.lat),o),x=s*g/a,v*=l,x*=l}}else v=_;u(e,e,[v,v,x]);const w=[...e],S=t.orientation,T=[];if(mm(T,[S[0]+r[0],S[1]+r[1],S[2]+r[2]],s),h(e,w,T),a&&i.elevation){let r=0;const s=[];if(c&&i.elevation){r=function(e,t,i,n,r){const s=t.elevation;if(!s)return 0;const o=Dh.projectAabbCorners(i,n),a=jc(1,r.lat)*t.worldSize,l=function(e,t){const i=[0,0,1],n=[{corners:[0,1,3,2],dotProductWithUp:0},{corners:[1,5,2,6],dotProductWithUp:0},{corners:[0,4,1,5],dotProductWithUp:0},{corners:[2,6,3,7],dotProductWithUp:0},{corners:[4,7,5,6],dotProductWithUp:0},{corners:[0,3,4,7],dotProductWithUp:0}];for(const r of n){const n=e[r.corners[0]],s=e[r.corners[1]],o=e[r.corners[2]],a=[s[0]-n[0],s[1]-n[1],t*(s[2]-n[2])],l=F(a,a,[o[0]-n[0],o[1]-n[1],t*(o[2]-n[2])]);O(l,l),r.dotProductWithUp=z(l,i)}return n.sort((e,t)=>e.dotProductWithUp-t.dotProductWithUp),n[0].corners}(o,a),c=o[l[0]],h=o[l[1]],d=o[l[2]],u=o[l[3]],f=s.getAtPointOrZero(new Jc(c[0]/t.worldSize,c[1]/t.worldSize),0),p=s.getAtPointOrZero(new Jc(h[0]/t.worldSize,h[1]/t.worldSize),0),m=s.getAtPointOrZero(new Jc(d[0]/t.worldSize,d[1]/t.worldSize),0),g=s.getAtPointOrZero(new Jc(u[0]/t.worldSize,u[1]/t.worldSize),0),_=(f+g)/2,y=(p+m)/2;return _>y?p=t.gl.NEAREST_MIPMAP_NEAREST}),e.uploaded=!0,e.image=null)}function Sm(e,t,i){e.indexBuffer=t.createIndexBuffer(e.indexArray,!1,!0),e.vertexBuffer=t.createVertexBuffer(e.vertexArray,im.members,!1,!0),e.normalArray&&(e.normalBuffer=t.createVertexBuffer(e.normalArray,om.members,!1,!0)),e.texcoordArray&&(e.texcoordBuffer=t.createVertexBuffer(e.texcoordArray,sm.members,!1,!0)),e.colorArray&&(e.colorBuffer=t.createVertexBuffer(e.colorArray,(12===e.colorArray.bytesPerElement?nm:rm).members,!1,!0)),e.featureArray&&(e.pbrBuffer=t.createVertexBuffer(e.featureArray,lm.members,!0)),e.segments=Xl.simpleSegment(0,0,e.vertexArray.length,e.indexArray.length);const n=e.material;n.pbrMetallicRoughness.baseColorTexture&&wm(n.pbrMetallicRoughness.baseColorTexture,t),n.pbrMetallicRoughness.metallicRoughnessTexture&&wm(n.pbrMetallicRoughness.metallicRoughnessTexture,t),n.normalTexture&&wm(n.normalTexture,t),n.occlusionTexture&&wm(n.occlusionTexture,t,i),n.emissionTexture&&wm(n.emissionTexture,t)}function Tm(e,t,i){if(e.meshes)for(const n of e.meshes)Sm(n,t,i);if(e.children)for(const n of e.children)Tm(n,t,i)}function km(e){if(e.meshes)for(const t of e.meshes)t.indexArray.destroy(),t.vertexArray.destroy(),t.colorArray&&t.colorArray.destroy(),t.normalArray&&t.normalArray.destroy(),t.texcoordArray&&t.texcoordArray.destroy(),t.featureArray&&t.featureArray.destroy();if(e.children)for(const t of e.children)km(t)}function Mm(e){if(e.meshes)for(const i of e.meshes)i.vertexBuffer&&(i.vertexBuffer.destroy(),i.indexBuffer.destroy(),i.normalBuffer&&i.normalBuffer.destroy(),i.texcoordBuffer&&i.texcoordBuffer.destroy(),i.colorBuffer&&i.colorBuffer.destroy(),i.pbrBuffer&&i.pbrBuffer.destroy(),i.segments.destroy(),i.material&&((t=i.material).pbrMetallicRoughness.baseColorTexture&&t.pbrMetallicRoughness.baseColorTexture.gfxTexture&&t.pbrMetallicRoughness.baseColorTexture.gfxTexture.destroy(),t.pbrMetallicRoughness.metallicRoughnessTexture&&t.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture&&t.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture.destroy(),t.normalTexture&&t.normalTexture.gfxTexture&&t.normalTexture.gfxTexture.destroy(),t.emissionTexture&&t.emissionTexture.gfxTexture&&t.emissionTexture.gfxTexture.destroy(),t.occlusionTexture&&t.occlusionTexture.gfxTexture&&t.occlusionTexture.gfxTexture.destroy()));var t;if(e.children)for(const t of e.children)Mm(t)}function Am(e,t){const i=e.json.bufferViews[t.bufferView],n=Fp[t.componentType];return new n(e.buffers[i.buffer],(t.byteOffset||0)+(i.byteOffset||0),t.count*(i.byteStride&&i.byteStride!==Yp[t.type]*n.BYTES_PER_ELEMENT?i.byteStride/n.BYTES_PER_ELEMENT:Yp[t.type]))}function Cm(e,t,i,n){const r=Fp[t.componentType],s=function(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:return 1}}(r),o=e.json.bufferViews[t.bufferView],a=o.byteStride?o.byteStride/r.BYTES_PER_ELEMENT:Yp[t.type],l=i.float32,c=l.length/i.capacity;for(let e=0,i=0;e0){for(let r=0;r0){s.texcoordArray=new kl;const e=t.json.accessors[r.TEXCOORD_0];s.texcoordArray.resize(e.count);const i=Am(t,e);Cm(t,e,s.texcoordArray,i)}if(void 0!==r._FEATURE_ID_RGBA4444){const e=t.json.accessors[r._FEATURE_ID_RGBA4444];t.json.extensionsUsed&&t.json.extensionsUsed.includes("EXT_meshopt_compression")&&(s.featureData=Am(t,e))}void 0!==r._FEATURE_RGBA4444&&(s.featureData=new Uint32Array(Am(t,t.json.accessors[r._FEATURE_RGBA4444]).buffer));const d=e.material;return s.material=function(e,t){const{emissiveFactor:i=[0,0,0],alphaMode:n="OPAQUE",alphaCutoff:r=.5,normalTexture:s,occlusionTexture:o,emissiveTexture:a,doubleSided:l}=e,{baseColorFactor:c=[1,1,1,1],metallicFactor:h=1,roughnessFactor:d=1,baseColorTexture:u,metallicRoughnessTexture:f}=e.pbrMetallicRoughness||{},p=o?t[o.index]:void 0;if(o&&o.extensions&&o.extensions.KHR_texture_transform&&p){const e=o.extensions.KHR_texture_transform;p.offsetScale=[e.offset[0],e.offset[1],e.scale[0],e.scale[1]]}return{pbrMetallicRoughness:{baseColorFactor:new si(...c),metallicFactor:h,roughnessFactor:d,baseColorTexture:u?t[u.index]:void 0,metallicRoughnessTexture:f?t[f.index]:void 0},doubleSided:l,emissiveFactor:new si(...i),alphaMode:n,alphaCutoff:r,normalTexture:s?t[s.index]:void 0,occlusionTexture:p,emissionTexture:a?t[a.index]:void 0,defined:void 0===e.defined}}(void 0!==d?t.json.materials[d]:{defined:!1},i),s}function Lm(e,t,i){const{matrix:n,rotation:r,translation:s,scale:o,mesh:a,extras:l,children:c}=e,h={};if(h.matrix=n||function(e,t,i,n){var r=t[0],s=t[1],o=t[2],a=t[3],l=r+r,c=s+s,h=o+o,d=r*l,u=r*c,f=r*h,p=s*c,m=s*h,g=o*h,_=a*l,y=a*c,v=a*h,x=n[0],b=n[1],w=n[2];return e[0]=(1-(p+g))*x,e[1]=(u+v)*x,e[2]=(f-y)*x,e[3]=0,e[4]=(u-v)*b,e[5]=(1-(d+g))*b,e[6]=(m+_)*b,e[7]=0,e[8]=(f+y)*w,e[9]=(m-_)*w,e[10]=(1-(d+p))*w,e[11]=0,e[12]=i[0],e[13]=i[1],e[14]=i[2],e[15]=1,e}([],r||[0,0,0,1],s||[0,0,0],o||[1,1,1]),void 0!==a){h.meshes=i[a];const e=h.anchor=[0,0];for(const t of h.meshes){const{min:i,max:n}=t.aabb;e[0]+=i[0]+n[0],e[1]+=i[1]+n[1]}e[0]=Math.floor(e[0]/h.meshes.length/2),e[1]=Math.floor(e[1]/h.meshes.length/2)}if(l&&(l.id&&(h.id=l.id),l.lights&&(h.lights=function(e){if(!e.length)return[];const t=function(e){const t=atob(e),i=new Uint8Array(t.length);for(let e=0;e1&&n[n.length-1].equals(n[0])&&n.pop();let r=0;for(let e=0;e0&&n.reverse();const s=au(n.flatMap(e=>[e.x,e.y]),[]);return 0===s.length?null:{vertices:n,indices:s}}function Pm(e,t){const i=[],n=[];let r=0;const s=[];for(const o of e){r=i.length;const e=o.vertexArray.float32,a=o.indexArray.uint16;for(let n=0;n0&&([n[e+1],n[e+2]]=[n[e+2],n[e+1]])}return{vertices:i,indices:n}}function Rm(e){const t=function(e,t){const i=[],n=WebGL2RenderingContext;if(e.json.textures)for(const r of e.json.textures){const s={magFilter:n.LINEAR,minFilter:n.NEAREST,wrapS:n.REPEAT,wrapT:n.REPEAT};void 0!==r.sampler&&Object.assign(s,e.json.samplers[r.sampler]),i.push({image:t[r.source],sampler:s,uploaded:!1})}return i}(e,e.images),i=function(e,t){const i=[];for(const n of e.json.meshes){const r=[];for(const i of n.primitives)r.push(Dm(i,e,t));i.push(r)}return i}(e,t),{scenes:n,scene:r,nodes:s}=e.json,o=n?n[r||0].nodes:s,a=[];for(const t of o)a.push(Lm(s[t],e,i));return function(e,t,i){const n={},r=new Set;for(let s=0;s0){const t=Array.from(r.values()).sort((e,t)=>e-t);for(let i=t.length-1;i>=0;i--)e.splice(t[i],1)}}(a,o,e.json.nodes),a}function Om(e){e.heightmap=new Float32Array(4096),e.heightmap.fill(-1);const t=e.vertexArray.float32,i=e.aabb.min[0]-1,n=e.aabb.min[1]-1,r=vm/(e.aabb.max[0]-i+2),s=vm/(e.aabb.max[1]-n+2);for(let o=0;oe.heightmap[c*vm+l]&&(e.heightmap[c*vm+l]=a)}}function zm(e,t,i,n,r){i.reserve(i.length+4*e.length),n.reserve(n.length+10*e.length),r.reserve(r.length+10*e.length);let s=n.length;for(const o of e){const e=Math.min(10,Math.max(4,1.3*o.height))*t,a=[-o.normal[1],o.normal[0],0],l=Math.min(.29,.1*o.width/o.depth),c=o.width-2*o.depth*t*(l+.01),h=E([],o.pos,a,c/2),d=E([],o.pos,a,-c/2),u=[h[0],h[1],h[2]+o.height],f=[d[0],d[1],d[2]+o.height],p=E([],o.normal,a,l);L(p,p,e);const m=E([],o.normal,a,-l);L(m,m,e),k(p,h,p),k(m,d,m),h[2]+=.1,d[2]+=.1,n.emplaceBack(p[0],p[1],p[2]),n.emplaceBack(m[0],m[1],m[2]),n.emplaceBack(h[0],h[1],h[2]),n.emplaceBack(d[0],d[1],d[2]),n.emplaceBack(u[0],u[1],u[2]),n.emplaceBack(f[0],f[1],f[2]),n.emplaceBack(h[0],h[1],h[2]),n.emplaceBack(d[0],d[1],d[2]),n.emplaceBack(p[0],p[1],p[2]),n.emplaceBack(m[0],m[1],m[2]);const g=c/e/2;r.emplaceBack(-g-l,-1,g,.8),r.emplaceBack(g+l,-1,g,.8),r.emplaceBack(-g,0,g,1.3),r.emplaceBack(g,0,g,1.3),r.emplaceBack(g+l,-.8,g,.7),r.emplaceBack(g+l,-.8,g,.7),r.emplaceBack(0,0,g,1.3),r.emplaceBack(0,0,g,1.3),r.emplaceBack(g+l,-1.2,g,.8),r.emplaceBack(g+l,-1.2,g,.8),i.emplaceBack(6+s,4+s,8+s),i.emplaceBack(7+s,9+s,5+s),i.emplaceBack(0+s,1+s,2+s),i.emplaceBack(1+s,3+s,2+s),s+=10}}function Fm(e,t){const i={};i.indexArray=new _l,i.vertexArray=new rl,i.colorArray=new hl,zm(e,t,i.indexArray,i.vertexArray,i.colorArray);const n={defined:!0};n.emissiveFactor=si.black;const r={};return r.baseColorFactor=si.white,n.pbrMetallicRoughness=r,i.material=n,i.aabb=new Dh([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),i}const Nm=Xa([{name:"a_pos_3f",components:3,type:"Float32"}]),Ym=Xa([{name:"a_normal_3",components:3,type:"Int16"}]),Bm=Xa([{name:"a_part_color_emissive",components:2,type:"Uint16"}]),Hm=Xa([{name:"a_bloom_attenuation",components:4,type:"Float32"}]),jm=ah.types,Vm=32767;function Wm(e,t){const i=Rn+t;for(const n of e)for(const e of n)if(e.x<-t||e.x>i||e.y<-t||e.y>i)return!1;return!0}class Um{constructor(e){this.layoutAOArray=[],this.indexArrayForConflationUploaded=!1,this.maxHeight=0,this.replacementUpdateTime=0,this.activeReplacements=[],this.footprints=[],this.featuresOnBorder=[],this.buildingFeatures=[],this.footprintLookup={},this.zoom=e.zoom,this.canonical=e.canonical,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.fqid),this.index=e.index,this.hasPattern=!1,this.worldview=e.worldview,this.layoutVertexArray=new rl,this.layoutNormalArray=new Ja,this.layoutColorArray=new ul,this.indexArray=new _l,this.indexArrayForConflation=new _l,this.entranceBloom={layoutVertexArray:new rl,layoutVertexBuffer:null,layoutAttenuationArray:new hl,layoutAttenuationBuffer:null,layoutColorArray:new ul,layoutColorBuffer:null,indexArray:new _l,indexArrayForConflation:new _l,indexBuffer:null,segmentsBucket:new Xl},this.programConfigurations=new wc(e.layers,{zoom:e.zoom,lut:e.lut}),this.segmentsBucket=new Xl,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.projection=e.projection,this.groundEffect=new Uf(e)}get segments(){return this.segmentsBucket}get bloomGeometry(){return this.entranceBloom}updateFootprints(e,t){for(const i of this.footprints)t.push({footprint:i,id:e})}prepare(){return function(){if(null!=Rp||null!=Pp)return null;if(null!=Ip)return Ip;const e=fetch(nt.BUILDING_GEN_URL);return Ip=function(e){let t,i,n,r;function s(){t=new Uint8Array(r.buffer),i=new Int32Array(r.buffer),n=new Float32Array(r.buffer)}function o(){throw new Error("Unexpected BuildingGen error.")}const a=()=>{},l={a:{a:o,f:function(e){const i=t.length,n=Math.max(e>>>0,Math.ceil(1.2*i)),o=Math.ceil((n-i)/65536);try{return r.grow(o),s(),!0}catch(e){return!1}},g:o,b:a,c:a,d:a,e:a}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(e,l):e.then(e=>e.arrayBuffer()).then(e=>WebAssembly.instantiate(e,l))).then(e=>{const o=e.instance.exports;return(0,o.g)(),r=o.f,s(),new kp({setStyle:o.h,setAOOptions:o.i,setMetricOptions:o.j,setStructuralOptions:o.k,setFacadeOptions:o.l,setFauxFacadeOptions:o.m,setFacadeClassifierOptions:o.n,addFeature:o.o,addFacade:o.p,generateMesh:o.q,getLastError:o.r,getMeshCount:o.s,getPositionsPtr:o.t,getPositionsLength:o.u,getNormalsPtr:o.v,getNormalsLength:o.w,getColorsPtr:o.x,getColorsLength:o.y,getAOPtr:o.z,getAOLength:o.A,getUVPtr:o.B,getUVLength:o.C,getFauxFacadePtr:o.D,getFauxFacadeLength:o.E,getIndicesPtr:o.F,getIndicesLength:o.G,getBuildingPart:o.H,getRingCount:o.I,getRingPtr:o.J,getRingLength:o.K,free:o.L,malloc:o.M,heapU8:t,heap32:i,heapF32:n})})}(e).then(e=>(Ip=null,Rp=e,Rp)).catch(e=>{We("Could not load building-gen"),Ip=null,Pp=e}),Ip}()}populate(e,t,i,n){const r=Rp;if(!r)return;const s=Zc(i);this.tileToMeter=s,this.brightness=t.brightness,r.setStyle({convertToMeters:!1,entranceColorRgb:[1,1,1],facadeGlazingColorRgb:[.5607843137254902,.6745098039215687,.7215686274509804],normalScale:[1,-1,s],ridgeHeight:3,roofColorRgb:[.886274516,.784313738,.713725507],tileToMeters:s,tileZoom:16,wallColorRgb:[.988235294,.933333337,.811764717]}),r.setAOOptions(!1,.3),r.setMetricOptions(!1,16),r.setStructuralOptions(!0),r.setFacadeOptions(4,!0),r.setFauxFacadeOptions(!1,!1,1),r.setFacadeClassifierOptions(3);const o=new Map;for(const{feature:t}of e){if("LineString"!==jm[t.type])continue;const e=this.layers[0]._featureFilter.needGeometry,r=oh(t,e);if(!this.layers[0]._featureFilter.filter(new da(this.zoom),r,i))continue;const s=e?r.geometry:sh(t,i,n),a=[];for(const e of s)for(const t of e)a.push({x:t.x,y:t.y});const l={coordinates:a,crossPerc:t.properties.cross_perc,distanceToRoad:t.properties.distance_to_road,entrances:t.properties.entrances,sourceId:0},c=t.properties.source_id;let h=o.get(c);h||(h=[],o.set(c,h)),h.push(l)}this.maxHeight=0;for(const{feature:s,index:a}of e){if("LineString"===jm[s.type])continue;const e=this.layers[0]._featureFilter.needGeometry,l=oh(s,e);if(!this.layers[0]._featureFilter.filter(new da(this.zoom),l,i))continue;const c=e?l.geometry:sh(s,i,n),h=Pu(c,500);if(!Wm(c,163))continue;const d=this.layers[0],u=d.layout.get("building-base").evaluate(s,{},i),f=d.layout.get("building-height").evaluate(s,{},i),p=d.layout.get("building-roof-shape").evaluate(s,{},i),m=d.paint.get("building-ambient-occlusion-intensity"),g=d.paint.get("building-ambient-occlusion-ground-radius")/this.tileToMeter;if("flat"===p)continue;const _=s.properties.source_id;let y;y=o.has(_)?o.get(_):[];const v=[],x=new xe(1/0,1/0),b=new xe(-1/0,-1/0);for(const e of h)if(e.length>0){const t=[];for(const i of e){const e=[];for(let t=i.length-1;t>=0;t--){const n=i[t];e.push({x:n.x,y:n.y}),x.x=Math.min(x.x,n.x),x.y=Math.min(x.y,n.y),b.x=Math.max(b.x,n.x),b.y=Math.max(b.y,n.y)}t.push(e)}v.push({id:s.id,height:f,minHeight:u,sourceId:0,roofType:p,coordinates:t})}const w=r.generateMesh(v,y);if("string"==typeof w)continue;if(0===w.meshes.length||0===w.modifiedPolygonRings.length)continue;let S=0;for(const e of w.meshes)S+=e.positions.length/3;const T=this.segmentsBucket.prepareSegment(S,this.layoutVertexArray,this.indexArray),k=[];let M=null,A=0,C=-1;const D=this.indexArray.length;let L=0;for(const e of w.meshes){const t=this.layoutVertexArray.length;if("entrance"===e.buildingPart){const t=new Array;for(let i=0;iRn||x.y<0||b.y>Rn)&&this.featuresOnBorder.push({featureId:s.id,footprintIndex:this.footprints.length});{const e=au(I,null,2),t=new nf(P,e,8,256);let i=s.id;s.properties&&s.properties.hasOwnProperty("building_id")&&(i=s.properties.building_id),this.footprints.push({vertices:P,indices:e,grid:t,min:R,max:O,buildingId:i,hiddenFlags:0,indicesOffset:D,indicesLength:E,bloomIndicesOffset:A,bloomIndicesLength:C,groundEffectVertexOffset:z,groundEffectVertexLength:F,segment:T,height:L})}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,s,a,{},t.availableImages,i,t.brightness),this.groundEffect.addPaintPropertiesData(s,a,{},t.availableImages,i,t.brightness)}this.groundEffect.prepareBorderSegments(),this.evaluate(this.layers[0])}update(e,t,i,n,r,s,o){this.programConfigurations.updatePaintArrays(e,t,r,i,n,s,o),this.groundEffect.update(e,t,r,i,n,s,o)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Nm.members),this.layoutNormalBuffer=e.createVertexBuffer(this.layoutNormalArray,Ym.members),this.entranceBloom.layoutVertexBuffer=e.createVertexBuffer(this.entranceBloom.layoutVertexArray,Nm.members),this.entranceBloom.layoutAttenuationBuffer=e.createVertexBuffer(this.entranceBloom.layoutAttenuationArray,Hm.members),this.uploadUpdatedColorBuffer(e),this.uploadUpdatedIndexBuffer(e),this.groundEffect.upload(e)),this.groundEffect.uploadPaintProperties(e),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.layoutNormalBuffer.destroy(),this.layoutColorBuffer.destroy(),this.groundEffect.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segmentsBucket.destroy(),this.entranceBloom.layoutVertexBuffer.destroy(),this.entranceBloom.layoutColorBuffer.destroy(),this.entranceBloom.layoutAttenuationBuffer.destroy(),this.entranceBloom.indexBuffer.destroy(),this.entranceBloom.segmentsBucket.destroy())}updateFootprintHiddenFlags(e,t,i=!0){let n=!1;const r=i?t:0,s=0|(i?-1:~t);0===this.groundEffect.hiddenByLandmarkVertexArray.length&&this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const t of e){const e=this.footprints[t],i=e.hiddenFlags&s|r;e.hiddenFlags!==i&&(e.hiddenFlags=i,n=!0,this.groundEffect.updateHiddenByLandmarkRange(e.groundEffectVertexOffset,e.groundEffectVertexLength,0!==e.hiddenFlags))}return n&&(this.indexArrayForConflationUploaded=!1),n}uploadUpdatedIndexBuffer(e){if(this.groundEffect.uploadHiddenByLandmark(e),!this.indexArrayForConflationUploaded&&0!==this.indexArray.length){this.indexArrayForConflation.resize(this.indexArray.length),this.indexArrayForConflation.uint16.set(this.indexArray.uint16),this.entranceBloom.indexArrayForConflation.resize(this.entranceBloom.indexArray.length),this.entranceBloom.indexArrayForConflation.uint16.set(this.entranceBloom.indexArray.uint16);for(const e of this.footprints){const t=e.indicesOffset+e.indicesLength;if(0!==e.hiddenFlags){for(let i=e.indicesOffset;it.max.x||n.max.xt.max.y||n.max.yo.max.x||o.min.x>e||t>o.max.y||o.min.y>t||o.height<=i||kf(s,o)&&(i=o.height,this.footprintLookup[r]=o,n=0!==o.hiddenFlags);if(i!==Number.NEGATIVE_INFINITY)return{height:i,hidden:n};this.footprintLookup[r]=void 0}}function $m(e,t,i,n,r,s){const o=Math.pow(2,n.z-r.z);for(let a=0;a1&&(o=e[++s]);const l=Math.abs(a-o.left),c=Math.abs(a-o.right),h=Math.min(l,c);let d;const u=t/i*(n+1);if(o.isDash){const e=n-Math.abs(u);d=Math.sqrt(h*h+e*e)}else d=n-Math.sqrt(h*h+u*u);this.image.data[r+a]=Math.max(0,Math.min(255,d+128))}}}addRegularDash(e,t){for(let t=e.length-1;t>=0;--t){const i=e[t],n=e[t+1];i.zeroLength?e.splice(t,1):n&&n.isDash===i.isDash&&(n.left=i.left,e.splice(t,1))}const i=e[0],n=e[e.length-1];i.isDash===n.isDash&&(i.left=n.left-this.width,n.right=i.right+this.width);const r=this.width*this.nextRow;let s=0,o=e[s];for(let i=0;i1&&(o=e[++s]);const n=Math.abs(i-o.left),a=Math.abs(i-o.right),l=Math.min(n,a);this.image.data[r+i]=Math.max(0,Math.min(255,(o.isDash?l:-l)+t+128))}}addDash(e,t){const i=this.getKey(e,t);if(this.positions[i])return this.positions[i];const n="round"===t,r=n?7:0,s=2*r+1;if(this.nextRow+s>this.height)return We("LineAtlas out of space"),null;0===e.length&&e.push(1);let o=0;for(let t=0;te.fqid),this.index=e.index,this.projection=e.projection,this.hasPattern=!1,this.hasCrossSlope=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(e=>{this.gradients[e.id]={}}),this.layoutVertexArray=new nl,this.layoutVertexArray2=new rl,this.patternVertexArray=new rl,this.indexArray=new _l,this.programConfigurations=new wc(e.layers,{zoom:e.zoom,lut:e.lut}),this.segments=new Xl,this.maxLineLength=0,this.zOffsetVertexArray=new rl,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.tessellationStep=e.tessellationStep?e.tessellationStep:128,this.worldview=e.worldview}updateFootprints(e,t){}populate(e,t,i,n){this.hasPattern=zu("line",this.layers,this.pixelRatio,t);const r=this.layers[0].layout.get("line-sort-key");this.tileToMeter=Zc(i);const s=this.layers[0].layout.get("line-elevation-reference");if("hd-road-markup"===s)this.elevationType="road";else{const e=this.layers[0].layout.get("line-z-offset"),t=e.isConstant()&&!e.constantOr(0);this.elevationType="sea"!==s&&"ground"!==s&&t?"none":"offset","offset"===this.elevationType&&"none"===s&&We(`line-elevation-reference: ground is used for the layer ${this.layerIds[0]} because non-zero line-z-offset value was found.`)}const o=this.layers[0].layout.get("line-cross-slope");this.hasCrossSlope="offset"===this.elevationType&&void 0!==o;const a=[];for(const{feature:t,id:s,index:o,sourceLayerIndex:l}of e){const e=this.layers[0]._featureFilter.needGeometry,c=oh(t,e);if(!this.layers[0]._featureFilter.filter(new da(this.zoom,{worldview:this.worldview}),c,i))continue;const h=r?r.evaluate(c,{},i):void 0,d={id:s,properties:t.properties,type:t.type,sourceLayerIndex:l,index:o,geometry:e?c.geometry:sh(t,i,n),patterns:{},sortKey:h};a.push(d)}r&&a.sort((e,t)=>e.sortKey-t.sortKey);const{lineAtlas:l,featureIndex:c}=t,h=this.addConstantDashes(l);for(const n of a){const{geometry:r,index:s,sourceLayerIndex:o}=n;if(h&&this.addFeatureDashes(n,l),this.hasPattern){const e=Fu("line",this.layers,n,this.zoom,this.pixelRatio,t);this.patternFeatures.push(e)}else this.addFeature(n,r,s,i,l.positions,t.availableImages,t.brightness,t.elevationFeatures);c.insert(e[s].feature,r,s,o,this.index)}}addConstantDashes(e){let t=!1;for(const i of this.layers){const n=i.paint.get("line-dasharray").value,r=i.layout.get("line-cap").value;if("constant"!==n.kind||"constant"!==r.kind)t=!0;else{const t=r.value,i=n.value;if(!i)continue;e.addDash(i,t)}}return t}addFeatureDashes(e,t){const i=this.zoom;for(const n of this.layers){const r=n.paint.get("line-dasharray").value,s=n.layout.get("line-cap").value;if("constant"===r.kind&&"constant"===s.kind)continue;let o,a;if("constant"===r.kind){if(o=r.value,!o)continue}else o=r.evaluate({zoom:i},e);a="constant"===s.kind?s.value:s.evaluate({zoom:i},e),t.addDash(o,a),e.patterns[n.id]=[t.getKey(o,a)]}}update(e,t,i,n,r,s,o,a){this.programConfigurations.updatePaintArrays(e,t,r,i,n,s,o,a)}addFeatures(e,t,i,n,r,s){for(const e of this.patternFeatures)this.addFeature(e,e.geometry,e.index,t,i,n,s)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,Qm)),0!==this.patternVertexArray.length&&(this.patternVertexBuffer=e.createVertexBuffer(this.patternVertexArray,tg)),!this.zOffsetVertexBuffer&&this.zOffsetVertexArray.length>0&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,Zm.members,!0)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Jm),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&e.properties.hasOwnProperty("mapbox_clip_start")&&e.properties.hasOwnProperty("mapbox_clip_end"))return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}addFeature(e,t,i,n,r,s,o,a){const l=this.layers[0].layout,c=l.get("line-join").evaluate(e,{}),h=l.get("line-cap").evaluate(e,{}),d=l.get("line-miter-limit"),u=l.get("line-round-limit");this.lineClips=this.lineFeatureClips(e),this.lineFeature=e,this.zOffsetValue=l.get("line-z-offset").value;const f=this.layers[0].paint.get("line-width").value;if("constant"!==f.kind&&!1===f.isLineProgressConstant&&(this.variableWidthValue=f),"road"===this.elevationType){const i=this.layoutVertexArray.length;if(!this.addElevatedRoadFeature(e,t,n,a,c,h,d,u)){const[r,s]=this.clipRuntimeLinesToTile(t,1);for(let t=0;t>1,this.layoutVertexArray.int16[6*e+1]>>1),n=l.pointElevation(i,t.elevation,.05);this.updateHeightRange(n),this.zOffsetVertexArray.emplaceBack(n,0,0)}else this.fillNonElevatedRoadSegment(n)}return!0}prepareElevatedLines(e,t,i){if(null!=t.constantHeight)return e;const n=[],r=1/Zc(i);for(const i of e)hp(i,new Lh(t,r),0,n);return n}fillNonElevatedRoadSegment(e){for(let t=e;t0,h=a&&a.progress.max<1;if(this.lineClips){let i={min:this.lineClips.start,max:this.lineClips.end},n=1;if(a){const e=this.lineClips.end-this.lineClips.start;i=function(e,t,i){return{min:it(e.min,t,i),max:it(e.max,t,i)}}(a.progress,{min:0,max:1},i),e>0&&(n=(i.max-i.min)/e)}const r=+t.properties.mapbox_clip_feature_len,s=+t.properties.mapbox_clip_seg_len;if(Number.isNaN(r)||Number.isNaN(s)){for(let t=0;t=2&&e[u-1].equals(e[u-2]);)u--;let f=0;for(;f0,L=this.overscaling<=16?15*Rn/(512*this.overscaling):0;if(i&&"round"===a)if(Ms&&(a="bevel"),"bevel"===a&&(M>2&&(a="flipbevel"),M2*L){const t=m.sub(m.sub(g)._mult(L/e)._round());this.updateDistance(g,t),this.addCurrentVertex(t,y,0,0,p,w),g=t}this.updateDistance(g,m),T._mult(M),this.addCurrentVertex(m,T,0,0,p,w);const t=m.dist(_);if(t>2*L){const e=m.add(_.sub(m)._mult(L/t)._round());this.updateDistance(m,e),this.addCurrentVertex(e,v,0,0,p,w),m=e}}else T._mult(M),this.addCurrentVertex(m,T,0,0,p,w);else if("flipbevel"===a){if(M>100)T=v.mult(-1);else{const e=M*y.add(v).mag()/y.sub(v).mag();T._perp()._mult(e*(D?-1:1))}this.addCurrentVertex(m,T,0,0,p,w),this.addCurrentVertex(m,T.mult(-1),0,0,p,w)}else if("bevel"===a||"fakeround"===a){null!=w&&g&&this.addCurrentVertex(m,b||y,-1,-1,p,w);const e=m.dist(g)<=2*L&&"bevel"!==a,t=T.mult(D?1:-1);t._mult(M);const i=v.mult(D?-1:1),n=y.mult(D?-1:1),r=this.evaluateLineProgressFeatures(this.distance);if(null==w&&(this.addHalfVertex(m,t.x,t.y,!1,!D,0,p,r),e||this.addHalfVertex(m,t.x+2*n.x,t.y+2*n.y,!1,D,0,p,r)),"fakeround"===a){const e=Math.round(180*A/Math.PI/20);this.addHalfVertex(m,n.x,n.y,!1,D,0,p,r);for(let t=0;t1){this.lineSoFar=e.w;const u=(t.x-e.x)/h,f=(t.y-e.y)/h,p=(t.z-e.z)/h,m=(t.w-e.w)/h;for(let t=1;t=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,c),a.primitiveLength++),s?this.e2=c:this.e1=c,null!=l&&this.zOffsetVertexArray.emplaceBack(l.zOffset,l.variableWidth,l.variableWidth)}updateScaledDistance(){this.lineClips?(this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=this.totalFeatureLength*this.lineClips.start+this.distance):this.lineSoFar=this.distance}updateDistance(e,t){this.prevDistance=this.distance,this.distance+=e.dist(t),this.updateScaledDistance()}}function ag(e,t,i){return e.xi||e.yi}let lg,cg;function hg(e,t,i){return t*(Rn/(e.tileSize*Math.pow(2,i-e.tileID.overscaledZ)))}Ws(og,"LineBucket",{omit:["layers","patternFeatures","currentVertex","currentVertexIsOutside"]});const dg=(e,t,i)=>(1-i)*e+i*t;function ug(e,t){return 1/hg(e,1,t.tileZoom)}function fg(e,t,i,n){return e.translatePosMatrix(n||t.tileID.projMatrix,t,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}const pg=e=>{const t=[];mg(e)&&t.push("RENDER_LINE_DASH"),e.paint.get("line-gradient")&&t.push("RENDER_LINE_GRADIENT");const i=e.paint.get("line-trim-offset");0===i[0]&&0===i[1]||t.push("RENDER_LINE_TRIM_OFFSET"),0!==e.paint.get("line-border-width").constantOr(1)&&t.push("RENDER_LINE_BORDER");const n="none"===e.layout.get("line-join").constantOr("miter"),r=!!e.paint.get("line-pattern").constantOr(1);return n&&r&&t.push("LINE_JOIN_NONE"),t};function mg(e){const t=e.paint.get("line-dasharray").value;return t.value||"constant"!==t.kind}let gg;const _g=()=>gg||(gg={layout:lg||(lg=new Sa({"line-cap":new ba(Ta.layout_line["line-cap"]),"line-join":new ba(Ta.layout_line["line-join"]),"line-miter-limit":new xa(Ta.layout_line["line-miter-limit"]),"line-round-limit":new xa(Ta.layout_line["line-round-limit"]),"line-sort-key":new ba(Ta.layout_line["line-sort-key"]),"line-z-offset":new ba(Ta.layout_line["line-z-offset"]),"line-elevation-reference":new xa(Ta.layout_line["line-elevation-reference"]),"line-cross-slope":new xa(Ta.layout_line["line-cross-slope"]),visibility:new xa(Ta.layout_line.visibility),"line-width-unit":new xa(Ta.layout_line["line-width-unit"])})),paint:cg||(cg=new Sa({"line-opacity":new ba(Ta.paint_line["line-opacity"]),"line-color":new ba(Ta.paint_line["line-color"]),"line-translate":new xa(Ta.paint_line["line-translate"]),"line-translate-anchor":new xa(Ta.paint_line["line-translate-anchor"]),"line-width":new ba(Ta.paint_line["line-width"]),"line-gap-width":new ba(Ta.paint_line["line-gap-width"]),"line-offset":new ba(Ta.paint_line["line-offset"]),"line-blur":new ba(Ta.paint_line["line-blur"]),"line-dasharray":new ba(Ta.paint_line["line-dasharray"]),"line-pattern":new ba(Ta.paint_line["line-pattern"]),"line-pattern-cross-fade":new xa(Ta.paint_line["line-pattern-cross-fade"]),"line-gradient":new wa(Ta.paint_line["line-gradient"]),"line-trim-offset":new xa(Ta.paint_line["line-trim-offset"]),"line-trim-fade-range":new xa(Ta.paint_line["line-trim-fade-range"]),"line-trim-color":new xa(Ta.paint_line["line-trim-color"]),"line-emissive-strength":new xa(Ta.paint_line["line-emissive-strength"]),"line-border-width":new ba(Ta.paint_line["line-border-width"]),"line-border-color":new ba(Ta.paint_line["line-border-color"]),"line-occlusion-opacity":new xa(Ta.paint_line["line-occlusion-opacity"]),"line-color-use-theme":new ba({type:"string",default:"default","property-type":"data-driven"}),"line-gradient-use-theme":new ba({type:"string",default:"default","property-type":"data-driven"}),"line-trim-color-use-theme":new ba({type:"string",default:"default","property-type":"data-driven"}),"line-border-color-use-theme":new ba({type:"string",default:"default","property-type":"data-driven"})}))},gg);class yg extends ba{possiblyEvaluate(e,t){return t=new da(Math.floor(t.zoom),{now:t.now,fadeDuration:t.fadeDuration,transition:t.transition,worldview:t.worldview}),super.possiblyEvaluate(e,t)}evaluate(e,t,i,n){return t=Re({},t,{zoom:Math.floor(t.zoom)}),super.evaluate(e,t,i,n)}}let vg;function xg(e,t){return t>0?t+2*e:e}const bg=Xa([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),wg=Xa([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),Sg=Xa([{name:"a_projected_pos",components:4,type:"Float32"}],4);Xa([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Tg=Xa([{name:"a_auto_z_offset",components:1,type:"Float32"}],4),kg=Xa([{name:"a_x_axis",components:3,type:"Float32"},{name:"a_y_axis",components:3,type:"Float32"}]),Mg=Xa([{name:"a_texb",components:2,type:"Uint16"}]),Ag=Xa([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_elevation_from_sea",components:2,type:"Float32"}]),Cg=Xa([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"},{name:"a_auto_z_offset",components:1,type:"Float32"}]);Xa([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Int16",name:"tileAnchorX"},{type:"Int16",name:"tileAnchorY"},{type:"Float32",name:"x1"},{type:"Float32",name:"y1"},{type:"Float32",name:"x2"},{type:"Float32",name:"y2"},{type:"Int16",name:"padding"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const Dg=Xa([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Lg=Xa([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);Xa([{name:"triangle",components:3,type:"Uint16"}]),Xa([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"},{type:"Uint8",name:"flipState"}]),Xa([{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{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"},{type:"Float32",name:"zOffset"},{type:"Uint8",name:"hasIconTextFit"},{type:"Uint16",name:"elevationFeatureIndex"}]),Xa([{type:"Float32",name:"offsetX"}]),Xa([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);var Eg=24;function Ig(e,t,i){return e.sections.forEach(e=>{e.text=function(e,t,i){const n=t.layout.get("text-transform").evaluate(i,{});return"uppercase"===n?e=e.toLocaleUpperCase():"lowercase"===n&&(e=e.toLocaleLowerCase()),ha.applyArabicShaping&&(e=ha.applyArabicShaping(e)),e}(e.text,t,i)}),e}const Pg={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂","←":"↑","→":"↓"};function Rg(e){return"︶"===e||"﹈"===e||"︸"===e||"﹄"===e||"﹂"===e||"︾"===e||"︼"===e||"︺"===e||"︘"===e||"﹀"===e||"︐"===e||"︓"===e||"︔"===e||"`"===e||" ̄"===e||"︑"===e||"︒"===e}function Og(e){return"︵"===e||"﹇"===e||"︷"===e||"﹃"===e||"﹁"===e||"︽"===e||"︻"===e||"︹"===e||"︗"===e||"︿"===e}const zg=4294967296,Fg=1/zg,Ng="undefined"==typeof TextDecoder?null:new TextDecoder("utf-8");let Yg=class{constructor(e=new Uint8Array(16)){this.buf=ArrayBuffer.isView(e)?e:new Uint8Array(e),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(e,t,i=this.length){for(;this.pos>3,r=this.pos;this.type=7&i,e(n,t,this),this.pos===r&&this.skip(i)}return t}readMessage(e,t){return this.readFields(e,t,this.readVarint()+this.pos)}readFixed32(){const e=this.dataView.getUint32(this.pos,!0);return this.pos+=4,e}readSFixed32(){const e=this.dataView.getInt32(this.pos,!0);return this.pos+=4,e}readFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*zg;return this.pos+=8,e}readSFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*zg;return this.pos+=8,e}readFloat(){const e=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,e}readDouble(){const e=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,e}readVarint(e){const t=this.buf;let i,n;return n=t[this.pos++],i=127&n,n<128?i:(n=t[this.pos++],i|=(127&n)<<7,n<128?i:(n=t[this.pos++],i|=(127&n)<<14,n<128?i:(n=t[this.pos++],i|=(127&n)<<21,n<128?i:(n=t[this.pos],i|=(15&n)<<28,function(e,t,i){const n=i.buf;let r,s;if(s=n[i.pos++],r=(112&s)>>4,s<128)return Bg(e,r,t);if(s=n[i.pos++],r|=(127&s)<<3,s<128)return Bg(e,r,t);if(s=n[i.pos++],r|=(127&s)<<10,s<128)return Bg(e,r,t);if(s=n[i.pos++],r|=(127&s)<<17,s<128)return Bg(e,r,t);if(s=n[i.pos++],r|=(127&s)<<24,s<128)return Bg(e,r,t);if(s=n[i.pos++],r|=(1&s)<<31,s<128)return Bg(e,r,t);throw new Error("Expected varint not more than 10 bytes")}(i,e,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){const e=this.readVarint();return e%2==1?(e+1)/-2:e/2}readBoolean(){return Boolean(this.readVarint())}readString(){const e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=12&&Ng?Ng.decode(this.buf.subarray(t,e)):function(e,t,i){let n="",r=t;for(;r239?4:t>223?3:t>191?2:1;if(r+c>i)break;1===c?t<128&&(l=t):2===c?(s=e[r+1],128==(192&s)&&(l=(31&t)<<6|63&s,l<=127&&(l=null))):3===c?(s=e[r+1],o=e[r+2],128==(192&s)&&128==(192&o)&&(l=(15&t)<<12|(63&s)<<6|63&o,(l<=2047||l>=55296&&l<=57343)&&(l=null))):4===c&&(s=e[r+1],o=e[r+2],a=e[r+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&(l=(15&t)<<18|(63&s)<<12|(63&o)<<6|63&a,(l<=65535||l>=1114112)&&(l=null))),null===l?(l=65533,c=1):l>65535&&(l-=65536,n+=String.fromCharCode(l>>>10&1023|55296),l=56320|1023&l),n+=String.fromCharCode(l),r+=c}return n}(this.buf,t,e)}readBytes(){const e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t}readPackedVarint(e=[],t){const i=this.readPackedEnd();for(;this.pos127;);else if(2===t)this.pos=this.readVarint()+this.pos;else if(5===t)this.pos+=4;else{if(1!==t)throw new Error(`Unimplemented type: ${t}`);this.pos+=8}}writeTag(e,t){this.writeVarint(e<<3|t)}realloc(e){let t=this.length||16;for(;t268435455||e<0?function(e,t){let i,n;if(e>=0?(i=e%4294967296|0,n=e/4294967296|0):(i=~(-e%4294967296),n=~(-e/4294967296),4294967295^i?i=i+1|0:(i=0,n=n+1|0)),e>=0x10000000000000000||e<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),function(e,t,i){i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,i.buf[i.pos]=127&(e>>>=7)}(i,0,t),function(e,t){const i=(7&e)<<4;t.buf[t.pos++]|=i|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e)))))}(n,t)}(e,this):(this.realloc(4),this.buf[this.pos++]=127&e|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=e>>>7&127))))}writeSVarint(e){this.writeVarint(e<0?2*-e-1:2*e)}writeBoolean(e){this.writeVarint(+e)}writeString(e){e=String(e),this.realloc(4*e.length),this.pos++;const t=this.pos;this.pos=function(e,t,i){for(let n,r,s=0;s55295&&n<57344){if(!r){n>56319||s+1===t.length?(e[i++]=239,e[i++]=191,e[i++]=189):r=n;continue}if(n<56320){e[i++]=239,e[i++]=191,e[i++]=189,r=n;continue}n=r-55296<<10|n-56320|65536,r=null}else r&&(e[i++]=239,e[i++]=191,e[i++]=189,r=null);n<128?e[i++]=n:(n<2048?e[i++]=n>>6|192:(n<65536?e[i++]=n>>12|224:(e[i++]=n>>18|240,e[i++]=n>>12&63|128),e[i++]=n>>6&63|128),e[i++]=63&n|128)}return i}(this.buf,e,this.pos);const i=this.pos-t;i>=128&&Hg(t,i,this),this.pos=t-1,this.writeVarint(i),this.pos+=i}writeFloat(e){this.realloc(4),this.dataView.setFloat32(this.pos,e,!0),this.pos+=4}writeDouble(e){this.realloc(8),this.dataView.setFloat64(this.pos,e,!0),this.pos+=8}writeBytes(e){const t=e.length;this.writeVarint(t),this.realloc(t);for(let i=0;i=128&&Hg(i,n,this),this.pos=i-1,this.writeVarint(n),this.pos+=n}writeMessage(e,t,i){this.writeTag(e,2),this.writeRawMessage(t,i)}writePackedVarint(e,t){t.length&&this.writeMessage(e,jg,t)}writePackedSVarint(e,t){t.length&&this.writeMessage(e,Vg,t)}writePackedBoolean(e,t){t.length&&this.writeMessage(e,$g,t)}writePackedFloat(e,t){t.length&&this.writeMessage(e,Wg,t)}writePackedDouble(e,t){t.length&&this.writeMessage(e,Ug,t)}writePackedFixed32(e,t){t.length&&this.writeMessage(e,Gg,t)}writePackedSFixed32(e,t){t.length&&this.writeMessage(e,Xg,t)}writePackedFixed64(e,t){t.length&&this.writeMessage(e,qg,t)}writePackedSFixed64(e,t){t.length&&this.writeMessage(e,Zg,t)}writeBytesField(e,t){this.writeTag(e,2),this.writeBytes(t)}writeFixed32Field(e,t){this.writeTag(e,5),this.writeFixed32(t)}writeSFixed32Field(e,t){this.writeTag(e,5),this.writeSFixed32(t)}writeFixed64Field(e,t){this.writeTag(e,1),this.writeFixed64(t)}writeSFixed64Field(e,t){this.writeTag(e,1),this.writeSFixed64(t)}writeVarintField(e,t){this.writeTag(e,0),this.writeVarint(t)}writeSVarintField(e,t){this.writeTag(e,0),this.writeSVarint(t)}writeStringField(e,t){this.writeTag(e,2),this.writeString(t)}writeFloatField(e,t){this.writeTag(e,5),this.writeFloat(t)}writeDoubleField(e,t){this.writeTag(e,1),this.writeDouble(t)}writeBooleanField(e,t){this.writeVarintField(e,+t)}};function Bg(e,t,i){return i?4294967296*t+(e>>>0):4294967296*(t>>>0)+(e>>>0)}function Hg(e,t,i){const n=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(7*Math.LN2));i.realloc(n);for(let t=i.pos-1;t>=e;t--)i.buf[t+n]=i.buf[t]}function jg(e,t){for(let i=0;i=0&&i>=e&&r_[this.text.charCodeAt(i)];i--)t--;this.text=this.text.substring(e,t),this.sectionIndex=this.sectionIndex.slice(e,t)}substring(e,t){const i=new i_;return i.text=this.text.substring(e,t),i.sectionIndex=this.sectionIndex.slice(e,t),i.sections=this.sections,i}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,t)=>Math.max(e,this.sections[t].scale),0)}addTextSection(e,t){this.text+=e.text,this.sections.push(t_.forText(e.scale,e.fontStack||t));const i=this.sections.length-1;for(let t=0;t=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function n_(e,t,i,n,r,s,o,a,l,c,h,d,u,f,p,m=1){const g=i_.fromFeature(e,r,m);d===e_.vertical&&g.verticalizePunctuation(u);let _=[];const y=function(e,t,i,n,r,s){if(!e)return[];const o=[],a=function(e,t,i,n,r,s){let o=0;for(let i=0;i=0;let c=0;for(let i=0;i0&&s>b&&(b=s)}else{const e=i[a.fontStack];if(!e)continue;e[m]&&(T=e[m]);const n=t[a.fontStack];if(!n)continue;const s=n.glyphs[m];if(!s)continue;if(v=s.metrics,M=8203!==m?Eg:0,g){const e=void 0!==n.ascender?Math.abs(n.ascender):0,t=void 0!==n.descender?Math.abs(n.descender):0,i=(e+t)*_;w-i/2;){if(o--,o<0)return!1;a-=e[o].dist(s),s=e[o]}a+=e[o].dist(e[o+1]),o++;const l=[];let c=0;for(;an;)c-=l.shift().angleDelta;if(c>r)return!1;o++,a+=t.dist(i)}return!0}function k_(e){let t=0;for(let i=0;ic){const h=(c-l)/s,d=ci(n.x,r.x,h),u=ci(n.y,r.y,h),f=new S_(d,u,0,r.angleTo(n),i);return!o||T_(e,f,a,o,t)?f:void 0}l+=s}}function D_(e,t,i,n,r,s,o,a,l){const c=M_(n,s,o),h=A_(n,r),d=h*o,u=0===e[0].x||e[0].x===l||0===e[0].y||e[0].y===l;return t-d=0&&_=0&&y=0&&u+c<=h){const i=new S_(_,y,0,m,t);n&&!T_(e,i,s,n,r)||f.push(i)}}d+=p}return a||f.length||o||(f=L_(e,d/2,i,n,r,s,o,!0,l)),f}function E_(e){let t=0,i=0;for(const n of e)t+=n.w*n.h,i=Math.max(i,n.w);e.sort((e,t)=>t.h-e.h);const n=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),i),h:1/0}];let r=0,s=0;for(const t of e)for(let e=n.length-1;e>=0;e--){const i=n[e];if(!(t.w>i.w||t.h>i.h)){if(t.x=i.x,t.y=i.y,s=Math.max(s,t.y+t.h),r=Math.max(r,t.x+t.w),t.w===i.w&&t.h===i.h){const t=n.pop();t&&e1?o-1:o,eu.copy(n.data,l,{x:0,y:0},{x:a,y:c},n.data,i),eu.copy(n.data,l,{x:0,y:d-o},{x:a,y:c-o},{width:h,height:o},i),eu.copy(n.data,l,{x:0,y:0},{x:a,y:c+d},{width:h,height:o},i),eu.copy(n.data,l,{x:h-o,y:0},{x:a-o,y:c},{width:o,height:d},i),eu.copy(n.data,l,{x:0,y:0},{x:a+h,y:c},{width:o,height:d},i),eu.copy(n.data,l,{x:h-o,y:d-o},{x:a-o,y:c-o},{width:o,height:o},i),eu.copy(n.data,l,{x:0,y:d-o},{x:a+h,y:c-o},{width:o,height:o},i),eu.copy(n.data,l,{x:0,y:0},{x:a+h,y:c+d},{width:o,height:o},i),eu.copy(n.data,l,{x:h-o,y:0},{x:a-o,y:c+d},{width:o,height:o},i)}this.lut=i,this.image=l,this.iconPositions=n,this.patternPositions=r}addImages(e,t,i,n){for(const[r,s]of e.entries()){const{bin:e,imagePosition:o,imageVariant:a}=P_(r,s,i);t.set(r,o),n.push(e),s.hasRenderCallback&&this.haveRenderCallbacks.push(a.id)}}patchUpdatedImages(e,t,i){this.haveRenderCallbacks=this.haveRenderCallbacks.filter(t=>e.hasImage(t,i)),e.dispatchRenderCallbacks(this.haveRenderCallbacks,i);for(const n of e.getUpdatedImages(i)){for(const r of this.iconPositions.keys()){const s=Oi.parse(r);if(ti.isEqual(s.id,n)){const s=e.getImage(n,i);this.patchUpdatedImage(this.iconPositions.get(r),s,t)}}for(const r of this.patternPositions.keys()){const s=Oi.parse(r);if(ti.isEqual(s.id,n)){const s=e.getImage(n,i);this.patchUpdatedImage(this.patternPositions.get(r),s,t)}}}}patchUpdatedImage(e,t,i){if(!e||!t)return;if(e.version===t.version)return;e.version=t.version;const[n,r]=e.tl,s=e.sdf;if(this.lut||s){const e={width:t.data.width,height:t.data.height},o=new eu(e);eu.copy(t.data,o,{x:0,y:0},{x:0,y:0},e,this.lut,s),i.update(o,{position:{x:n,y:r}})}else i.update(t.data,{position:{x:n,y:r}})}}Ws(I_,"ImagePosition"),Ws(R_,"ImageAtlas");const O_=1e20;function z_(e,t,i,n,r,s,o,a,l){for(let c=t;c-1);l++,s[l]=a,o[l]=c,o[l+1]=O_}for(let a=0,l=0;a{let r=this.entries[e];r||(r=this.entries[e]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let s=r.glyphs[t];if(void 0!==s)return void i(null,{stack:e,id:t,glyph:s});if(s=this._tinySDF(r,e,t),s)return r.glyphs[t]=s,void i(null,{stack:e,id:t,glyph:s});const o=Math.floor(t/256);if(256*o>65535)return We("glyphs > 65535 not supported"),void i(null,{stack:e,id:t,glyph:s});if(r.ranges[o])return void i(null,{stack:e,id:t,glyph:s});let a=r.requests[o];a||(a=r.requests[o]=[],Y_.loadGlyphRange(e,o,n,this.requestManager,(e,t)=>{if(t){r.ascender=t.ascender,r.descender=t.descender;for(const e in t.glyphs)this._doesCharSupportLocalGlyph(+e)||(r.glyphs[+e]=t.glyphs[+e]);r.ranges[o]=!0}for(const i of a)i(e,t);delete r.requests[o]})),a.push((n,r)=>{n?i(n):r&&i(null,{stack:e,id:t,glyph:r.glyphs[t]||null})})},(e,i)=>{if(e)t(e);else if(i){const e={};for(const{stack:t,id:n,glyph:r}of i)void 0===e[t]&&(e[t]={}),void 0===e[t].glyphs&&(e[t].glyphs={}),e[t].glyphs[n]=r&&{id:r.id,bitmap:r.bitmap.clone(),metrics:r.metrics},e[t].ascender=this.entries[t].ascender,e[t].descender=this.entries[t].descender;t(null,e)}})}_doesCharSupportLocalGlyph(e){return this.localGlyphMode!==N_.none&&(this.localGlyphMode===N_.all?!!this.localFontFamily:!!this.localFontFamily&&(Lo(e)||Ro(e)||yo(e)||vo(e)||_o(e)||Co(e)||Uo(e)||Wo(e)))}_tinySDF(e,t,i){const n=this.localFontFamily;if(!n||!this._doesCharSupportLocalGlyph(i))return;let r=e.tinySDF;if(!r){let i="400";/bold/i.test(t)?i="900":/medium/i.test(t)?i="500":/light/i.test(t)&&(i="200"),r=e.tinySDF=new Y_.TinySDF({fontFamily:n,fontWeight:i,fontSize:48,buffer:6,radius:16}),r.fontWeight=i}if(this.localGlyphs[r.fontWeight][i])return this.localGlyphs[r.fontWeight][i];const s=String.fromCodePoint(i),{data:o,width:a,height:l,glyphWidth:c,glyphHeight:h,glyphLeft:d,glyphTop:u,glyphAdvance:f}=r.draw(s);return this.localGlyphs[r.fontWeight][i]={id:i,bitmap:new Qd({width:a,height:l},o),metrics:{width:c/2,height:h/2,left:d/2,top:u/2-27,advance:f/2,localGlyph:!0}}}}Y_.loadGlyphRange=function(e,t,i,n,r){const s=256*t,o=s+255,a=n.transformRequest(n.normalizeGlyphsURL(i).replace("{fontstack}",e).replace("{range}",`${s}-${o}`),It.Glyphs);zt(a,(e,t)=>{if(e)r(e);else if(t){const e={},i=function(e){return new Yg(e).readFields(Jg,{})}(t);for(const t of i.glyphs)e[t.id]=t;r(null,{glyphs:e,ascender:i.ascender,descender:i.descender})}})},Y_.TinySDF=class{constructor({fontSize:e=24,buffer:t=3,radius:i=8,cutoff:n=.25,fontFamily:r="sans-serif",fontWeight:s="normal",fontStyle:o="normal"}={}){this.buffer=t,this.cutoff=n,this.radius=i;const a=this.size=e+4*t,l=this._createCanvas(a),c=this.ctx=l.getContext("2d",{willReadFrequently:!0});c.font=`${o} ${s} ${e}px ${r}`,c.textBaseline="alphabetic",c.textAlign="left",c.fillStyle="black",this.gridOuter=new Float64Array(a*a),this.gridInner=new Float64Array(a*a),this.f=new Float64Array(a),this.z=new Float64Array(a+1),this.v=new Uint16Array(a)}_createCanvas(e){const t=document.createElement("canvas");return t.width=t.height=e,t}draw(e){const{width:t,actualBoundingBoxAscent:i,actualBoundingBoxDescent:n,actualBoundingBoxLeft:r,actualBoundingBoxRight:s}=this.ctx.measureText(e),o=Math.ceil(i),a=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(s-r))),l=Math.min(this.size-this.buffer,o+Math.ceil(n)),c=a+2*this.buffer,h=l+2*this.buffer,d=Math.max(c*h,0),u=new Uint8ClampedArray(d),f={data:u,width:c,height:h,glyphWidth:a,glyphHeight:l,glyphTop:o,glyphLeft:0,glyphAdvance:t};if(0===a||0===l)return f;const{ctx:p,buffer:m,gridInner:g,gridOuter:_}=this;p.clearRect(m,m,a,l),p.fillText(e,m,m+o);const y=p.getImageData(m,m,a,l);_.fill(O_,0,d),g.fill(0,0,d);for(let e=0;e0?e*e:0,g[n]=e<0?e*e:0}}z_(_,0,0,c,h,c,this.f,this.v,this.z),z_(g,m,m,a,l,c,this.f,this.v,this.z);for(let e=0;e{const u=W_(n.stretch-y,v,h,e.left*r),f=U_(n.fixed-w,S,n.stretch,p),g=W_(s.stretch-x,b,d,e.top*r),_=U_(s.fixed-T,k,s.stretch,m),M=W_(l.stretch-y,v,h,e.left*r),A=U_(l.fixed-w,S,l.stretch,p),C=W_(c.stretch-x,b,d,e.top*r),D=U_(c.fixed-T,k,c.stretch,m),L=new xe(u,g),E=new xe(M,g),I=new xe(M,C),P=new xe(u,C),R=new xe(f/a,_/a),O=new xe(A/a,D/a),z=t*Math.PI/180;if(z){const e=Math.sin(z),t=Math.cos(z),i=[t,-e,e,t];L._matMult(i),E._matMult(i),P._matMult(i),I._matMult(i)}const F=n.stretch+n.fixed,N=l.stretch+l.fixed,Y=s.stretch+s.fixed,B=c.stretch+c.fixed,H=e.imageSecondary;return{tl:L,tr:E,bl:P,br:I,texPrimary:{x:o.paddedRect.x+1+F,y:o.paddedRect.y+1+Y,w:N-F,h:B-Y},texSecondary:H?{x:H.paddedRect.x+1+F,y:H.paddedRect.y+1+Y,w:N-F,h:B-Y}:void 0,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:R,pixelOffsetBR:O,minFontScaleX:S/a/h,minFontScaleY:k/a/d,isSDF:i}};if(n&&(o.stretchX||o.stretchY)){const e=V_(u,g,p),t=V_(f,_,m);for(let i=0;is)&&(s=t.x),(!e||t.y>o)&&(o=t.y)}const l=Math.min(s-n,o-r);let c=l/2;const h=new Pn([],X_);if(0===l)return new xe(n,r);for(let t=n;td.d||!d.d)&&(d=n,i&&console.log("found best %d after %d probes",Math.round(1e4*n.d)/1e4,u)),n.max-d.d<=t||(c=n.h/2,h.push(new q_(n.p.x-c,n.p.y-c,c,e)),h.push(new q_(n.p.x+c,n.p.y-c,c,e)),h.push(new q_(n.p.x-c,n.p.y+c,c,e)),h.push(new q_(n.p.x+c,n.p.y+c,c,e)),u+=4)}return i&&(console.log(`num probes: ${u}`),console.log(`best distance: ${d.d}`)),d.p}function X_(e,t){return t.max-e.max}class q_{constructor(e,t,i,n){this.p=new xe(e,t),this.h=i,this.d=function(e,t){let i=!1,n=1/0;for(let r=0;re.y!=a.y>e.y&&e.x<(a.x-r.x)*(e.y-r.y)/(a.y-r.y)+r.x&&(i=!i),n=Math.min(n,Wh(e,r,a))}}return(i?1:-1)*Math.sqrt(n)}(this.p,n),this.max=this.d+this.h*Math.SQRT2}}const Z_=Object.keys,J_=Number.POSITIVE_INFINITY,K_=Math.sqrt(2);function Q_(e,[t,i]){let n=0,r=0;if(i===J_){t<0&&(t=0);const i=t/K_;switch(e){case"top-right":case"top-left":r=i-7;break;case"bottom-right":case"bottom-left":r=7-i;break;case"bottom":r=7-t;break;case"top":r=t-7}switch(e){case"top-right":case"bottom-right":n=-i;break;case"top-left":case"bottom-left":n=i;break;case"left":n=t;break;case"right":n=-t}}else{switch(t=Math.abs(t),i=Math.abs(i),e){case"top-right":case"top-left":case"top":r=i-7;break;case"bottom-right":case"bottom-left":case"bottom":r=7-i}switch(e){case"top-right":case"bottom-right":case"right":n=-t;break;case"top-left":case"bottom-left":case"left":n=t}}return[n,r]}function ey(e,t,i,n,r,s,o,a,l){if(!t||!t.usvg)return;const c=y_(n),h=y_(r),d="both"!==s&&"width"!==s||!g_(n)?1:h.width/c.width,u="both"!==s&&"height"!==s||!__(n)?1:h.height/c.height;i.scaleSelf(d,u);const f=i.toString();o.set(f,i),a.set(f,t);const{imagePosition:p}=P_(f,t,1);l.set(f,p)}function ty(e,t,i,n,r,s,o,a,l){if(!e)return;const c=function(e,t,i,n,r,s){if("camera"===e.kind)return e.maxSize;if("composite"===e.kind){const n=t.possiblyEvaluate(new da(e.maxZoom,{worldview:s}),i).evaluate(r,{},i),o=t.possiblyEvaluate(new da(e.minZoom,{worldview:s}),i).evaluate(r,{},i);return Math.max(n,o)}return t.possiblyEvaluate(new da(n,{worldview:s})).evaluate(r,{},i)}(t,i,n,r,s,l);return e.scaleSelf(c*a*o)}function iy(e,t,i,n,r,s,o,a,l){return{iconPrimary:ty(e.getPrimary(),t,i,n,r,s,o,a,l),iconSecondary:ty(e.getSecondary(),t,i,n,r,s,o,a,l)}}function ny(e,t,i){if(!t)return;const n=i.get(e.toString()),r=i.get(t.toString());r&&(n.paddedRect.w===r.paddedRect.w&&n.paddedRect.h===r.paddedRect.h||We(`Mismatch in icon variant sizes: ${e.toString()} and ${t.toString()}`),n.usvg!==r.usvg&&We(`Mismatch in icon variant image types: ${e.id} and ${t.id}`))}function ry(e,t,i,n){if(!e)return;const r=t.get(i.toString());if(e.imagePrimary=r,n){const i=t.get(n.toString());e.imageSecondary=i}}function sy(e,t){for(const i in e.horizontal)oy(e.horizontal[i],t);oy(e.vertical,t)}function oy(e,t){if(e)for(const i of e.positionedLines)for(const e of i.positionedGlyphs)if(null!==e.image){const i=e.image.toString();e.rect=t.get(i).paddedRect}}function ay(e){switch(e){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function ly(e,t,i,n,r,s,o,a,l){const c=fy(s.horizontal)||s.vertical,h=i.get("icon-text-fit-padding").evaluate(n,{},r);let d,u=t;return t&&"none"!==l&&(e.allowVerticalPlacement&&s.vertical&&(d=m_(t,s.vertical,l,h,a,o)),c&&(u=m_(t,c,l,h,a,o))),{defaultShapedIcon:u,verticallyShapedIcon:d}}function cy(e,t,i,n,r,s,o,a,l,c,h,d,u,f,p,m,g,_,y,v){let x=o.textMaxSize.evaluate(t,{},u);void 0===x?x=a*o.textScaleFactor:x*=o.textScaleFactor;const b=e.layers[0].layout,w=fy(i.horizontal)||i.vertical,S="globe"===f.name,T=e.tilePixelRatio*x/24,k=(E=e.overscaling,e.zoom>18&&E>2&&(E>>=1),Math.max(Rn/(512*E),1)*b.get("symbol-spacing")),M=b.get("text-padding")*e.tilePixelRatio,A=b.get("icon-padding")*e.tilePixelRatio,C=Te(b.get("text-max-angle")),D="map"===b.get("icon-rotation-alignment")&&"point"!==v,L=k/2;var E;!1===e.hasAnyIconTextFit&&"none"!==g&&(e.hasAnyIconTextFit=!0);const I=t.properties?+t.properties[ph]:null,P=I&&e.elevationFeatureIdToIndex?e.elevationFeatureIdToIndex.get(I):65535,R=(a,l,v)=>{if(l.x<0||l.x>=Rn||l.y<0||l.y>=Rn)return;let x=null;if(S){const{x:e,y:t,z:i}=f.projectTilePoint(l.x,l.y,v);x={anchor:new S_(e,t,i,0,void 0),up:f.upVector(v,l.x,l.y)}}!function(e,t,i,n,r,s,o,a,l,c,h,d,u,f,p,m,g,_,y,v,x,b,w,S,T,k,M,A,C){const D=e.addToLineVertexArray(t,n);let L,E,I,P,R,O,z,F=0,N=0,Y=0,B=0,H=-1,j=-1;const V={};let W=qt("");const U=i?i.anchor:t,$="none"!==A;let G=0,X=0;if(void 0===l._unevaluatedLayout.getValue("text-radial-offset")){const e=l.layout.get("text-offset").evaluate(x,{},T);G=e[0]*Eg,X=e[1]*Eg}else G=l.layout.get("text-radial-offset").evaluate(x,{},T)*Eg,X=J_;if(e.allowVerticalPlacement&&r.vertical){const e=r.vertical;if(p)O=my(e),a&&(z=my(a));else{const i=l.layout.get("text-rotate").evaluate(x,{},T)+90;I=py(c,U,t,h,d,u,e,f,i,m),a&&(P=py(c,U,t,h,d,u,a,_,i))}}if(s){const n=e.iconSizeData,r=l.layout.get("icon-rotate").evaluate(x,{},T),o=H_(s,r,w,$,b.iconScaleFactor),f=a?H_(a,r,w,$,b.iconScaleFactor):void 0;E=py(c,U,t,h,d,u,s,_,r,null),F=4*o.length;let p=null;"source"===n.kind?(p=[v_*l.layout.get("icon-size").evaluate(x,{},T)*b.iconScaleFactor],p[0]>dy&&We(`${e.layerIds[0]}: Value for "icon-size" is >= ${hy}. Reduce your "icon-size".`)):"composite"===n.kind&&(p=[v_*b.compositeIconSizes[0].evaluate(x,{},T)*b.iconScaleFactor,v_*b.compositeIconSizes[1].evaluate(x,{},T)*b.iconScaleFactor],(p[0]>dy||p[1]>dy)&&We(`${e.layerIds[0]}: Value for "icon-size" is >= ${hy}. Reduce your "icon-size".`)),e.addSymbols(e.icon,o,p,v,y,x,void 0,i,t,D.lineStartIndex,D.lineLength,-1,S,T,k,M),H=e.icon.placedSymbolArray.length-1,f&&(N=4*f.length,e.addSymbols(e.icon,f,p,v,y,x,e_.vertical,i,t,D.lineStartIndex,D.lineLength,-1,S,T,k,M),j=e.icon.placedSymbolArray.length-1)}for(const n in r.horizontal){const s=n,a=r.horizontal[s];L||(W=qt(a.text),p?R=my(a):L=py(c,U,t,h,d,u,a,f,l.layout.get("text-rotate").evaluate(x,{},T),m));const g=1===a.positionedLines.length;if(Y+=uy(e,i,t,a,o,l,p,x,m,D,r.vertical?e_.horizontal:e_.horizontalOnly,g?Z_(r.horizontal):[s],V,H,b,S,T,k),g)break}r.vertical&&(B+=uy(e,i,t,r.vertical,o,l,p,x,m,D,e_.vertical,["vertical"],V,j,b,S,T,k));let q=-1;const Z=(e,t)=>e?Math.max(e,t):t;q=Z(R,q),q=Z(O,q),q=Z(z,q);const J=q>-1?1:0;e.glyphOffsetArray.length>=65535&&We("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==x.sortKey&&e.addToSortKeyRanges(e.symbolInstances.length,x.sortKey),e.symbolInstances.emplaceBack(t.x,t.y,U.x,U.y,U.z,V.right>=0?V.right:-1,V.center>=0?V.center:-1,V.left>=0?V.left:-1,V.vertical>=0?V.vertical:-1,H,j,W,void 0!==L?L:e.collisionBoxArray.length,void 0!==L?L+1:e.collisionBoxArray.length,void 0!==I?I:e.collisionBoxArray.length,void 0!==I?I+1:e.collisionBoxArray.length,void 0!==E?E:e.collisionBoxArray.length,void 0!==E?E+1:e.collisionBoxArray.length,P||e.collisionBoxArray.length,P?P+1:e.collisionBoxArray.length,h,Y,B,F,N,J,0,G,X,q,0,$?1:0,C)}(e,l,x,a,i,n,s,r,e.layers[0],e.collisionBoxArray,t.index,t.sourceLayerIndex,e.index,M,y,c,0,A,D,_,t,o,h,d,u,p,m,g,P)};if("line"===v)for(const r of cp(t.geometry,0,0,Rn,Rn)){const t=D_(r,k,C,i.vertical||w,n,24,T,e.overscaling,Rn);for(const i of t)w&&gy(e,w.text,L,i)||R(r,i,u)}else if("line-center"===v){for(const e of t.geometry)if(e.length>1){const t=C_(e,C,i.vertical||w,n,24,T);t&&R(e,t,u)}}else if("Polygon"===t.type)for(const e of Pu(t.geometry,0)){const t=G_(e,16);R(e[0],new S_(t.x,t.y,0,0,void 0),u)}else if("LineString"===t.type)for(const e of t.geometry)R(e,new S_(e[0].x,e[0].y,0,0,void 0),u);else if("Point"===t.type)for(const e of t.geometry)for(const t of e)R([t],new S_(t.x,t.y,0,0,void 0),u)}const hy=255,dy=hy*v_;function uy(e,t,i,n,r,s,o,a,l,c,h,d,u,f,p,m,g,_){const y=function(e,t,i,n,r,s,o,a){const l=[];if(0===t.positionedLines.length)return l;const c=n.layout.get("text-rotate").evaluate(s,{})*Math.PI/180,h=function(e){const t=e[0],i=e[1],n=t*i;return n>0?[t,-i]:n<0?[-t,i]:0===t?[i,t]:[i,-t]}(i);let d=Math.abs(t.top-t.bottom);for(const e of t.positionedLines)d-=e.lineOffset;const u=t.positionedLines.length,f=d/u;let p=t.top-i[1];for(let e=0;edy&&We(`${e.layerIds[0]}: Value for "text-size" is >= ${hy}. Reduce your "text-size".`)):"composite"===v.kind&&(x=[v_*p.compositeTextSizes[0].evaluate(a,{},g)*p.textScaleFactor,v_*p.compositeTextSizes[1].evaluate(a,{},g)*p.textScaleFactor],(x[0]>dy||x[1]>dy)&&We(`${e.layerIds[0]}: Value for "text-size" is >= ${hy}. Reduce your "text-size".`)),e.addSymbols(e.text,y,x,l,o,a,h,t,i,c.lineStartIndex,c.lineLength,f,m,g,_,!1);for(const t of d)u[t]=e.text.placedSymbolArray.length-1;return 4*y.length}function fy(e){for(const t in e)return e[t];return null}function py(e,t,i,n,r,s,o,a,l,c){let h=o.top,d=o.bottom,u=o.left,f=o.right;if(f_(o)&&o.collisionPadding){const e=o.collisionPadding;u-=e[0],h-=e[1],f+=e[2],d+=e[3]}if(l){const e=new xe(u,h),t=new xe(f,h),i=new xe(u,d),n=new xe(f,d),r=Te(l);let s=new xe(0,0);c&&(s=new xe(c[0],c[1])),e._rotateAround(r,s),t._rotateAround(r,s),i._rotateAround(r,s),n._rotateAround(r,s),u=Math.min(e.x,t.x,i.x,n.x),f=Math.max(e.x,t.x,i.x,n.x),h=Math.min(e.y,t.y,i.y,n.y),d=Math.max(e.y,t.y,i.y,n.y)}return e.emplaceBack(t.x,t.y,t.z,i.x,i.y,u,h,f,d,a,n,r,s),e.length-1}function my(e){f_(e)&&e.collisionPadding&&(e.top-=e.collisionPadding[1],e.bottom+=e.collisionPadding[3]);const t=e.bottom-e.top;return t>0?Math.max(10,t):null}function gy(e,t,i,n){const r=e.compareText;if(t in r){const e=r[t];for(let t=e.length-1;t>=0;t--)if(n.dist(e[t])v&&(x(e,c,n,r,a,l),x(c,i,a,l,s,o))}x(d,u,n,s,r,s),x(u,f,r,s,r,o),x(f,p,r,o,n,o),x(p,d,n,o,n,s),m-=v,g-=v,_+=v,y+=v;const b=1/Math.max(_-m,y-g);return{scale:b,x:m*b,y:g*b,x2:_*b,y2:y*b,projection:t}}function vy(e,{x:t,y:i},n=0){return new xe(((t-n)*e.scale-e.x)*Rn,(i*e.scale-e.y)*Rn)}const xy=l(new Float32Array(16));class by{constructor(e){this.spec=e,this.name=e.name,this.wrap=!1,this.requiresDraping=!1,this.supportsWorldCopies=!1,this.supportsTerrain=!1,this.supportsFog=!1,this.supportsFreeCamera=!1,this.zAxisUnit="meters",this.isReprojectedInTileSpace=!0,this.unsupportedLayers=["custom"],this.center=[0,0],this.range=[3.5,7]}project(e,t){return{x:0,y:0,z:0}}unproject(e,t){return new Fc(0,0)}projectTilePoint(e,t,i){return{x:e,y:t,z:0}}locationPoint(e,t,i,n=!0){return e._coordinatePoint(e.locationCoordinate(t,i),n)}pixelsPerMeter(e,t){return jc(1,e)*t}pixelSpaceConversion(e,t,i){return 1}farthestPixelDistance(e){return _y(e,e.pixelsPerMeter)}pointCoordinate(e,t,i,n){const r=e.horizonLineFromTop(!1),s=new xe(t,Math.max(r,i));return e.rayIntersectionCoordinate(e.pointRayIntersection(s,n))}pointCoordinate3D(e,t,i){const n=new xe(t,i);if(e.elevation)return e.elevation.pointCoordinate(n);{const t=this.pointCoordinate(e,n.x,n.y,0);return[t.x,t.y,t.z]}}isPointAboveHorizon(e,t){if(e.elevation&&e.elevation.visibleDemTiles.length)return!this.pointCoordinate3D(e,t.x,t.y);const i=e.horizonLineFromTop();return t.y0?t<-Ly+i&&(t=-Ly+i):t>Ly-i&&(t=Ly-i);const s=r/Math.pow(Ey(t),n);let o=s*Math.sin(n*e),a=r-s*Math.cos(n*e);return o=.5*(o/Math.PI+.5),a=.5*(a/Math.PI+.5),{x:o,y:this.southernCenter?a:1-a,z:0}}unproject(e,t){e=(2*e-.5)*Math.PI,this.southernCenter&&(t=1-t),t=(2*(1-t)-.5)*Math.PI;const{n:i,f:n}=this,r=n-t,s=Math.sign(r),o=Math.sign(i)*Math.sqrt(e*e+r*r);let a=Math.atan2(e,Math.abs(r))*s;r*i<0&&(a-=Math.PI*Math.sign(e)*s);const l=Le(ke(a/i)+this.center[0],-180,180),c=Le(ke(2*Math.atan(Math.pow(n/o,1/i))-Ly),-$c,$c);return new Fc(l,this.southernCenter?-c:c)}}class Py extends by{constructor(e){super(e),this.wrap=!0,this.supportsWorldCopies=!0,this.supportsTerrain=!0,this.supportsFog=!0,this.supportsFreeCamera=!0,this.isReprojectedInTileSpace=!1,this.unsupportedLayers=[],this.range=null}project(e,t){return{x:Bc(e),y:Hc(t),z:0}}unproject(e,t){const i=Vc(e),n=Wc(t);return new Fc(i,n)}}const Ry=Te($c);class Oy extends by{project(e,t){const i=(t=Te(t))*t,n=i*i;return{x:.5*((e=Te(e))*(.8707-.131979*i+n*(n*(.003971*i-.001529*n)-.013791))/Math.PI+.5),y:1-.5*(t*(1.007226+i*(.015085+n*(.028874*i-.044475-.005916*n)))/Math.PI+1),z:0}}unproject(e,t){e=(2*e-.5)*Math.PI;let i=t=(2*(1-t)-1)*Math.PI,n=25,r=0,s=i*i;do{s=i*i;const e=s*s;r=(i*(1.007226+s*(.015085+e*(.028874*s-.044475-.005916*e)))-t)/(1.007226+s*(.045255+e*(.259866*s-.311325-.005916*11*e))),i=Le(i-r,-Ry,Ry)}while(Math.abs(r)>1e-6&&--n>0);s=i*i;const o=Le(ke(e/(.8707+s*(s*(s*s*s*(.003971-.001529*s)-.013791)-.131979))),-180,180),a=ke(i);return new Fc(o,a)}}const zy=Te($c);class Fy extends by{project(e,t){t=Te(t),e=Te(e);const i=Math.cos(t),n=2/Math.PI,r=Math.acos(i*Math.cos(e/2)),s=Math.sin(r)/r,o=.5*(e*n+2*i*Math.sin(e/2)/s)||0,a=.5*(t+Math.sin(t)/s)||0;return{x:.5*(o/Math.PI+.5),y:1-.5*(a/Math.PI+1),z:0}}unproject(e,t){let i=e=(2*e-.5)*Math.PI,n=t=(2*(1-t)-1)*Math.PI,r=25;const s=1e-6;let o=0,a=0;do{const r=Math.cos(n),s=Math.sin(n),l=2*s*r,c=s*s,h=r*r,d=Math.cos(i/2),u=Math.sin(i/2),f=2*d*u,p=u*u,m=1-h*d*d,g=m?1/m:0,_=m?Math.acos(r*d)*Math.sqrt(1/m):0,y=.5*(2*_*r*u+2*i/Math.PI)-e,v=.5*(_*s+n)-t,x=.5*g*(h*p+_*r*d*c)+1/Math.PI,b=g*(f*l/4-_*s*u),w=.125*g*(l*u-_*s*h*f),S=.5*g*(c*d+_*p*r)+.5,T=b*w-S*x;o=(v*b-y*S)/T,a=(y*w-v*x)/T,i=Le(i-o,-Math.PI,Math.PI),n=Le(n-a,-zy,zy)}while((Math.abs(o)>s||Math.abs(a)>s)&&--r>0);return new Fc(ke(i),ke(n))}}class Ny extends by{constructor(e){super(e),this.center=e.center||[0,0],this.parallels=e.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(Te(this.parallels[0]))),this.scale=1/(2*Math.max(Math.PI*this.cosPhi,1/this.cosPhi)),this.wrap=!0,this.supportsWorldCopies=!0}project(e,t){const{scale:i,cosPhi:n}=this;return{x:Te(e)*n*i+.5,y:-Math.sin(Te(t))/n*i+.5,z:0}}unproject(e,t){const{scale:i,cosPhi:n}=this,r=-(t-.5)/i,s=Le(ke((e-.5)/i)/n,-180,180),o=Math.asin(Le(r*n,-1,1)),a=Le(ke(o),-$c,$c);return new Fc(s,a)}}class Yy extends Py{constructor(e){super(e),this.requiresDraping=!0,this.supportsWorldCopies=!1,this.supportsFog=!0,this.zAxisUnit="pixels",this.unsupportedLayers=["debug"],this.range=[3,5]}projectTilePoint(e,t,i){const n=Td(e,t,i);return Y(n,n,Ad(yd(i))),{x:n[0],y:n[1],z:n[2]}}locationPoint(e,t,i){const n=Rc(t.lat,t.lng),r=O([],n),s=i?e._centerAltitude+i:e.elevation?e.elevation.getAtPointOrZero(e.locationCoordinate(t),e._centerAltitude):e._centerAltitude;E(n,n,r,jc(1,0)*Rn*s);const o=l(new Float64Array(16));return h(o,e.pixelMatrix,e.globeMatrix),Y(n,n,o),new xe(n[0],n[1])}pixelsPerMeter(e,t){return jc(1,0)*t}pixelSpaceConversion(e,t,i){const n=jc(1,e)*t,r=ci(jc(1,45)*t,n,i);return this.pixelsPerMeter(e,t)/r}createTileMatrix(e,t,i){const n=Cd(yd(i.canonical));return h(new Float64Array(16),e.globeMatrix,n)}createInversionMatrix(e,t){const{center:i}=e,n=Ad(yd(t));return p(n,n,Te(i.lng)),f(n,n,Te(i.lat)),u(n,n,[e._pixelsPerMercatorPixel,e._pixelsPerMercatorPixel,1]),Float32Array.from(n)}pointCoordinate(e,t,i,n){return md(e,t,i,!0)||new Jc(0,0)}pointCoordinate3D(e,t,i){const n=this.pointCoordinate(e,t,i,0);return[n.x,n.y,n.z]}isPointAboveHorizon(e,t){return!md(e,t.x,t.y,!1)}farthestPixelDistance(e){const t=function(e,t){const i=e.cameraToCenterDistance,n=e._centerAltitude*t,r=e._camera,s=e._camera.forward(),o=k([],L([],s,-i),[0,0,n]),a=e.worldSize/(2*Math.PI),l=[0,0,-a],c=e.width/e.height,h=Math.tan(e.fovAboveCenter),d=L([],r.up(),h),u=L([],r.right(),h*c),f=O([],k([],k([],s,d),u)),p=[];let m;if(new wh(o,f).closestPointOnSphere(l,a,p)){const t=k([],p,l),i=W([],t,o);m=Math.cos(e.fovAboveCenter)*w(i)}else{const e=W([],o,l),t=W([],l,o);O(t,t);const i=w(e)-a;m=Math.sqrt(i*(i+2*a));const n=Math.acos(m/(a+i))-Math.acos(z(s,t));m*=Math.cos(n)}return 1.01*m}(e,this.pixelsPerMeter(e.center.lat,e.worldSize)),i=Id(e.zoom);if(i>0){const n=_y(e,jc(1,e.center.lat)*e.worldSize),r=e.worldSize/(2*Math.PI),s=Math.max(e.width,e.height)/e.worldSize*Math.PI;return ci(t,n+r*(1-Math.cos(s)),Math.pow(i,10))}return t}upVector(e,t,i){return Td(t,i,e,1)}upVectorScale(e){return{metersToTile:fd(kd(yd(e)))}}}function By(e){const t=e.parallels,i=!!t&&Math.abs(t[0]+t[1])<.01;switch(e.name){case"mercator":return new Py(e);case"equirectangular":return new Dy(e);case"naturalEarth":return new Oy(e);case"equalEarth":return new Cy(e);case"winkelTripel":return new Fy(e);case"albers":return i?new Ny(e):new wy(e);case"lambertConformalConic":return i?new Ny(e):new Iy(e);case"globe":return new Yy(e)}throw new Error(`Invalid projection name: ${e.name}`)}const Hy=ah.types,jy=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Vy(e,t,i,n,r,s,o,a,l,c,h,d,u){const f=a?Math.min(dy,Math.round(a[0])):0,p=a?Math.min(dy,Math.round(a[1])):0;e.emplaceBack(t,i,Math.round(32*n),Math.round(32*r),s,o,(f<<1)+(l?1:0),p,16*c,16*h,256*d,256*u)}function Wy(e,t,i){e.emplaceBack(t,i)}function Uy(e,t,i,n,r,s,o){e.emplaceBack(t,i,n,r,s,o)}const $y=(e,t,i,n)=>{for(let r=0;r0&&(this.iconTransitioningVertexBuffer=e.createVertexBuffer(this.iconTransitioningVertexArray,Mg.members,!0)),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,wg.members,!0)),!this.zOffsetVertexBuffer&&(this.zOffsetVertexArray.length>0||r)&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,Tg.members,!0)),!this.orientationVertexBuffer&&this.orientationVertexArray&&this.orientationVertexArray.length>0&&(this.orientationVertexBuffer=e.createVertexBuffer(this.orientationVertexArray,kg.members,!0)),this.opacityVertexBuffer.itemSize=1),(i||n)&&this.programConfigurations.upload(e))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy(),this.iconTransitioningVertexBuffer&&this.iconTransitioningVertexBuffer.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy(),this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy(),this.orientationVertexBuffer&&this.orientationVertexBuffer.destroy())}}Ws(qy,"SymbolBuffers");class Zy{constructor(e,t,i){this.layoutVertexArray=new e,this.layoutAttributes=t,this.indexArray=new i,this.segments=new Xl,this.collisionVertexArray=new gl,this.collisionVertexArrayExt=new hl}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,Ag.members,!0),this.collisionVertexBufferExt=e.createVertexBuffer(this.collisionVertexArrayExt,Cg.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.destroy())}}Ws(Zy,"CollisionBuffers");class Jy{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.lut=e.lut,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.fqid),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.hasAnyIconTextFit=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=l([]),this.placementViewportMatrix=l([]);const t=this.layers[0]._unevaluatedLayout._values;this.worldview=e.worldview,this.textSizeData=x_(this.zoom,t["text-size"],this.worldview),this.iconSizeData=x_(this.zoom,t["icon-size"],this.worldview);const i=this.layers[0].layout,n=i.get("symbol-sort-key"),r=i.get("symbol-z-order");this.canOverlap=i.get("text-allow-overlap")||i.get("icon-allow-overlap")||i.get("text-ignore-placement")||i.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==r&&void 0!==n.constantOr(1),this.sortFeaturesByY=("viewport-y"===r||"auto"===r&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=i.get("text-writing-mode").map(e=>e_[e]),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.sourceID=e.sourceID,this.projection=e.projection,this.hasAnyZOffset=!1,this.zOffsetSortDirty=!1,this.zOffsetBuffersNeedUpload=!1,this.elevationType="none",this.elevationStateComplete=!1,this.activeReplacements=[],this.replacementUpdateTime=0,this.hasAnySecondaryIcon=!1}createArrays(){this.text=new qy(new wc(this.layers,{zoom:this.zoom,lut:this.lut},e=>e.startsWith("text")||e.startsWith("symbol"))),this.icon=new qy(new wc(this.layers,{zoom:this.zoom,lut:this.lut},e=>e.startsWith("icon")||e.startsWith("symbol"))),this.glyphOffsetArray=new Nl,this.lineVertexArray=new Yl,this.symbolInstances=new Fl}calculateGlyphDependencies(e,t,i,n,r){for(const i of e){const e=i.codePointAt(0);if(void 0===e)break;if(t[e]=!0,n&&r&&e<=65535){const e=Pg[i];e&&(t[e.charCodeAt(0)]=!0)}}}updateFootprints(e,t){}updateReplacement(e,t){if(t.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=t.updateTime;const i=t.getReplacementRegionsForTile(e.toUnwrapped(),!0);return!vf(this.activeReplacements,i)&&(this.activeReplacements=i,!0)}populate(e,t,i,n){const r=this.layers[0],s=r.layout,o="globe"===this.projection.name,a=s.get("text-font"),l=s.get("text-field"),c=s.get("icon-image"),[h,d]=s.get("icon-size-scale-range"),u=Le(t.scaleFactor||1,h,d),f=("constant"!==l.value.kind||l.value.value instanceof Ri&&!l.value.value.isEmpty()||l.value.value.toString().length>0)&&("constant"!==a.value.kind||a.value.value.length>0),p="constant"!==c.value.kind||!!c.value.value||Object.keys(c.parameters).length>0,m=s.get("symbol-sort-key");if(this.features=[],!f&&!p)return;const g=t.iconDependencies,_=t.glyphDependencies,y=t.availableImages,v=new da(this.zoom,{worldview:this.worldview});for(const{feature:t,id:l,index:c,sourceLayerIndex:h}of e){const e=r._featureFilter.needGeometry,d=oh(t,e);if(!r._featureFilter.filter(v,d,i))continue;if(e||(d.geometry=sh(t,i,n)),o&&1!==t.type&&i.z<=5){const e=d.geometry,t=.98078528056,n=(e,n)=>z(Td(e.x,e.y,i,1),Td(n.x,n.y,i,1))=0;for(const i of x.sections)if(i.image){const e=i.image.getPrimary().scaleSelf(this.pixelRatio),t=e.id.toString(),n=g.get(t)||[];n.push(e),g.set(t,n)}else{const n=$o(x.toString()),r=i.fontStack||e,s=_[r]=_[r]||{};this.calculateGlyphDependencies(i.text,s,t,this.allowVerticalPlacement,n)}}}if("line"===s.get("symbol-placement")&&(this.features=function(e){const t={},i={},n=[];let r=0;function s(t){n.push(e[t]),r++}function o(e,t,r){const s=i[e];return delete i[e],i[t]=s,n[s].geometry[0].pop(),n[s].geometry[0]=n[s].geometry[0].concat(r[0]),s}function a(e,i,r){const s=t[i];return delete t[i],t[e]=s,n[s].geometry[0].shift(),n[s].geometry[0]=r[0].concat(n[s].geometry[0]),s}function l(e,t,i){const n=i?t[0][t[0].length-1]:t[0][0];return`${e}:${n.x}:${n.y}`}for(let c=0;ce.geometry)}(this.features)),"hd-road-markup"===s.get("symbol-elevation-reference")){if(this.elevationType="road",t.elevationFeatures){!this.elevationFeatures&&t.elevationFeatures.length>0&&(this.elevationFeatures=[],this.elevationFeatureIdToIndex=new Map);for(const e of t.elevationFeatures)this.elevationFeatureIdToIndex.set(e.id,this.elevationFeatures.length),this.elevationFeatures.push(e)}}else s.get("symbol-z-elevate")&&(this.elevationType="offset");"none"!==this.elevationType&&(this.zOffsetBuffersNeedUpload=!0),this.sortFeaturesByKey&&this.features.sort((e,t)=>e.sortKey-t.sortKey)}update(e,t,i,n,r,s,o){this.text.programConfigurations.updatePaintArrays(e,t,r,i,n,s,o,this.worldview),this.icon.programConfigurations.updatePaintArrays(e,t,r,i,n,s,o,this.worldview)}updateRoadElevation(e){if("road"!==this.elevationType||!this.elevationFeatures)return;if(this.elevationStateComplete)return;this.elevationStateComplete=!0,this.hasAnyZOffset=!1;let t=!1;const i=Zc(e),n=1/i;let r=!1,s=!1;for(let e=0;e0||h>0,p=d>0,m=this.elevationFeatures[o.elevationFeatureIndex];if(m){const e=new xe(o.tileAnchorX,o.tileAnchorY),c=.075+m.pointElevation(e);o.zOffset!==c&&(t=!0,o.zOffset=c);const h=m.computeSlopeNormal(e,n),d=se(J(),S(0,0,1),h);H(a,a,d),H(l,l,d),a[2]*=i,l[2]*=i,1===a[0]&&0===a[1]&&0===a[2]&&0===l[0]&&1===l[1]&&0===l[2]||(r=r||f,s=s||p)}if(f&&($y(this.text.orientationVertexArray,c,a,l),$y(this.text.orientationVertexArray,h,a,l)),p){const{placedIconSymbolIndex:e,verticalPlacedIconSymbolIndex:t}=o;e>=0&&$y(this.icon.orientationVertexArray,d,a,l),t>=0&&$y(this.icon.orientationVertexArray,u,a,l)}}r||(this.text.orientationVertexArray=void 0),s||(this.icon.orientationVertexArray=void 0),t&&(this.zOffsetBuffersNeedUpload=!0,this.zOffsetSortDirty=!0)}updateZOffset(){const e=(e,t,n)=>{i+=t,i>e.length&&e.resize(i);for(let r=-t;r<0;r++)e.emplace(r+i,n)},t=(e,t,i)=>{n+=t,n>e.length&&e.resize(n);for(let r=-t;r<0;r++)e.emplace(r+n,i)};if(!this.zOffsetBuffersNeedUpload)return;this.zOffsetBuffersNeedUpload=!1;let i=0,n=0;for(let i=0;i0;if((r>0||s>0)&&(e(this.text.zOffsetVertexArray,r,a),e(this.text.zOffsetVertexArray,s,a)),l){const{placedIconSymbolIndex:e,verticalPlacedIconSymbolIndex:i}=n;e>=0&&t(this.icon.zOffsetVertexArray,o,a),i>=0&&t(this.icon.zOffsetVertexArray,n.numVerticalIconVertices,a)}}this.text.zOffsetVertexBuffer&&this.text.zOffsetVertexBuffer.updateData(this.text.zOffsetVertexArray),this.icon.zOffsetVertexBuffer&&this.icon.zOffsetVertexBuffer.updateData(this.icon.zOffsetVertexArray)}isEmpty(){return 0===this.symbolInstances.length&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}getProjection(){return this.projectionInstance||(this.projectionInstance=By(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,t){const i=this.lineVertexArray.length;if(void 0!==e.segment)for(const{x:e,y:i}of t)this.lineVertexArray.emplaceBack(e,i);return{lineStartIndex:i,lineLength:this.lineVertexArray.length-i}}addSymbols(e,t,i,n,r,s,o,a,l,c,h,d,u,f,p,m){const g=e.indexArray,_=e.layoutVertexArray,y=e.globeExtVertexArray,v=e.segments.prepareSegment(4*t.length,_,g,this.canOverlap?s.sortKey:void 0),x=this.glyphOffsetArray.length,b=v.vertexLength,w=this.allowVerticalPlacement&&o===e_.vertical?Math.PI/2:0,S=s.text&&s.text.sections;for(let n=0;n=0?t.rightJustifiedTextSymbolIndex:t.centerJustifiedTextSymbolIndex>=0?t.centerJustifiedTextSymbolIndex:t.leftJustifiedTextSymbolIndex>=0?t.leftJustifiedTextSymbolIndex:t.verticalPlacedTextSymbolIndex>=0?t.verticalPlacedTextSymbolIndex:n),s=b_(this.textSizeData,e,r)/Eg;return this.tilePixelRatio*s}getSymbolInstanceIconSize(e,t,i){const n=this.icon.placedSymbolArray.get(i),r=b_(this.iconSizeData,e,n);return this.tilePixelRatio*r}_commitDebugCollisionVertexUpdate(e,t,i,n){e.emplaceBack(t,-i,-i,n),e.emplaceBack(t,i,-i,n),e.emplaceBack(t,i,i,n),e.emplaceBack(t,-i,i,n)}_updateTextDebugCollisionBoxes(e,t,i,n,r,s,o){for(let o=n;o0}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}hasIconTextFit(){return this.hasAnyIconTextFit}addIndicesForPlacedSymbol(e,t){const i=e.placedSymbolArray.get(t),n=i.vertexStartIndex+4*i.numGlyphs;for(let t=i.vertexStartIndex;tn[e]-n[t]||r[t]-r[e]),s}getSortedIndexesByZOffset(){if(!this.zOffsetSortDirty)return this.symbolInstanceIndexesSortedZOffset;if(!this.symbolInstanceIndexesSortedZOffset){this.symbolInstanceIndexesSortedZOffset=[];for(let e=0;ethis.symbolInstances.get(t).zOffset-this.symbolInstances.get(e).zOffset)}addToSortKeyRanges(e,t){const i=this.sortKeyRanges[this.sortKeyRanges.length-1];i&&i.sortKey===t?i.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:t,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const e of this.symbolInstanceIndexes){const t=this.symbolInstances.get(e);this.featureSortOrder.push(t.featureIndex);const{rightJustifiedTextSymbolIndex:i,centerJustifiedTextSymbolIndex:n,leftJustifiedTextSymbolIndex:r,verticalPlacedTextSymbolIndex:s,placedIconSymbolIndex:o,verticalPlacedIconSymbolIndex:a}=t;i>=0&&this.addIndicesForPlacedSymbol(this.text,i),n>=0&&n!==i&&this.addIndicesForPlacedSymbol(this.text,n),r>=0&&r!==n&&r!==i&&this.addIndicesForPlacedSymbol(this.text,r),s>=0&&this.addIndicesForPlacedSymbol(this.text,s),o>=0&&this.addIndicesForPlacedSymbol(this.icon,o),a>=0&&this.addIndicesForPlacedSymbol(this.icon,a)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let Ky,Qy,ev;Ws(Jy,"SymbolBucket",{omit:["layers","collisionBoxArray","features","compareText"]}),Jy.addDynamicAttributes=Gy;class tv{constructor(e){this.type=e.property.overrides?e.property.overrides.runtimeType:mi,this.defaultValue=e}evaluate(e){if(e.formattedSection){const t=this.defaultValue.property.overrides;if(t&&t.hasOverride(e.formattedSection))return t.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Ws(tv,"FormatSectionOverride",{omit:["defaultValue"]});const iv=()=>ev||(ev={layout:Ky||(Ky=new Sa({"symbol-placement":new xa(Ta.layout_symbol["symbol-placement"]),"symbol-spacing":new xa(Ta.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new xa(Ta.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new ba(Ta.layout_symbol["symbol-sort-key"]),"symbol-z-order":new xa(Ta.layout_symbol["symbol-z-order"]),"symbol-z-elevate":new xa(Ta.layout_symbol["symbol-z-elevate"]),"symbol-elevation-reference":new xa(Ta.layout_symbol["symbol-elevation-reference"]),"icon-allow-overlap":new xa(Ta.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new xa(Ta.layout_symbol["icon-ignore-placement"]),"icon-optional":new xa(Ta.layout_symbol["icon-optional"]),"icon-rotation-alignment":new xa(Ta.layout_symbol["icon-rotation-alignment"]),"icon-size":new ba(Ta.layout_symbol["icon-size"]),"icon-size-scale-range":new xa(Ta.layout_symbol["icon-size-scale-range"]),"icon-text-fit":new ba(Ta.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new ba(Ta.layout_symbol["icon-text-fit-padding"]),"icon-image":new ba(Ta.layout_symbol["icon-image"]),"icon-rotate":new ba(Ta.layout_symbol["icon-rotate"]),"icon-padding":new xa(Ta.layout_symbol["icon-padding"]),"icon-keep-upright":new xa(Ta.layout_symbol["icon-keep-upright"]),"icon-offset":new ba(Ta.layout_symbol["icon-offset"]),"icon-anchor":new ba(Ta.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new xa(Ta.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new xa(Ta.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new xa(Ta.layout_symbol["text-rotation-alignment"]),"text-field":new ba(Ta.layout_symbol["text-field"]),"text-font":new ba(Ta.layout_symbol["text-font"]),"text-size":new ba(Ta.layout_symbol["text-size"]),"text-size-scale-range":new xa(Ta.layout_symbol["text-size-scale-range"]),"text-max-width":new ba(Ta.layout_symbol["text-max-width"]),"text-line-height":new ba(Ta.layout_symbol["text-line-height"]),"text-letter-spacing":new ba(Ta.layout_symbol["text-letter-spacing"]),"text-justify":new ba(Ta.layout_symbol["text-justify"]),"text-radial-offset":new ba(Ta.layout_symbol["text-radial-offset"]),"text-variable-anchor":new xa(Ta.layout_symbol["text-variable-anchor"]),"text-anchor":new ba(Ta.layout_symbol["text-anchor"]),"text-max-angle":new xa(Ta.layout_symbol["text-max-angle"]),"text-writing-mode":new xa(Ta.layout_symbol["text-writing-mode"]),"text-rotate":new ba(Ta.layout_symbol["text-rotate"]),"text-padding":new xa(Ta.layout_symbol["text-padding"]),"text-keep-upright":new xa(Ta.layout_symbol["text-keep-upright"]),"text-transform":new ba(Ta.layout_symbol["text-transform"]),"text-offset":new ba(Ta.layout_symbol["text-offset"]),"text-allow-overlap":new xa(Ta.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new xa(Ta.layout_symbol["text-ignore-placement"]),"text-optional":new xa(Ta.layout_symbol["text-optional"]),visibility:new xa(Ta.layout_symbol.visibility)})),paint:Qy||(Qy=new Sa({"icon-opacity":new ba(Ta.paint_symbol["icon-opacity"]),"icon-occlusion-opacity":new ba(Ta.paint_symbol["icon-occlusion-opacity"]),"icon-emissive-strength":new ba(Ta.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new ba(Ta.paint_symbol["text-emissive-strength"]),"icon-color":new ba(Ta.paint_symbol["icon-color"]),"icon-halo-color":new ba(Ta.paint_symbol["icon-halo-color"]),"icon-halo-width":new ba(Ta.paint_symbol["icon-halo-width"]),"icon-halo-blur":new ba(Ta.paint_symbol["icon-halo-blur"]),"icon-translate":new xa(Ta.paint_symbol["icon-translate"]),"icon-translate-anchor":new xa(Ta.paint_symbol["icon-translate-anchor"]),"icon-image-cross-fade":new xa(Ta.paint_symbol["icon-image-cross-fade"]),"text-opacity":new ba(Ta.paint_symbol["text-opacity"]),"text-occlusion-opacity":new ba(Ta.paint_symbol["text-occlusion-opacity"]),"text-color":new ba(Ta.paint_symbol["text-color"],{runtimeType:vi,getOverride:e=>e.textColor,hasOverride:e=>!!e.textColor}),"text-halo-color":new ba(Ta.paint_symbol["text-halo-color"]),"text-halo-width":new ba(Ta.paint_symbol["text-halo-width"]),"text-halo-blur":new ba(Ta.paint_symbol["text-halo-blur"]),"text-translate":new xa(Ta.paint_symbol["text-translate"]),"text-translate-anchor":new xa(Ta.paint_symbol["text-translate-anchor"]),"icon-color-saturation":new xa(Ta.paint_symbol["icon-color-saturation"]),"icon-color-contrast":new xa(Ta.paint_symbol["icon-color-contrast"]),"icon-color-brightness-min":new xa(Ta.paint_symbol["icon-color-brightness-min"]),"icon-color-brightness-max":new xa(Ta.paint_symbol["icon-color-brightness-max"]),"symbol-z-offset":new ba(Ta.paint_symbol["symbol-z-offset"]),"icon-color-use-theme":new ba({type:"string",default:"default","property-type":"data-driven"}),"icon-halo-color-use-theme":new ba({type:"string",default:"default","property-type":"data-driven"}),"text-color-use-theme":new ba({type:"string",default:"default","property-type":"data-driven"}),"text-halo-color-use-theme":new ba({type:"string",default:"default","property-type":"data-driven"})}))},ev);class nv extends Wa{constructor(e,t,i,n){super(e,iv(),t,i,n),this._colorAdjustmentMatrix=l([]),this.hasInitialOcclusionOpacityProperties=void 0!==e.paint&&("icon-occlusion-opacity"in e.paint||"text-occlusion-opacity"in e.paint)}recalculate(e,t){super.recalculate(e,t),"auto"===this.layout.get("icon-rotation-alignment")&&(this.layout._values["icon-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-rotation-alignment")&&(this.layout._values["text-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment"));const i=this.layout.get("text-writing-mode");if(i){const e=[];for(const t of i)e.indexOf(t)<0&&e.push(t);this.layout._values["text-writing-mode"]=e}else this.layout._values["text-writing-mode"]="point"===this.layout.get("symbol-placement")?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getColorAdjustmentMatrix(e,t,i,n){return this._saturation===e&&this._contrast===t&&this._brightnessMin===i&&this._brightnessMax===n||(this._colorAdjustmentMatrix=function(e,t,i,n){e=tt(e),t=et(t);const r=a(),s=e/3,o=1-2*s,l=[o,s,s,0,s,o,s,0,s,s,o,0,0,0,0,1],c=.5-.5*t,d=n-i;return h(r,[d,0,0,0,0,d,0,0,0,0,d,0,i,i,i,1],[t,0,0,0,0,t,0,0,0,0,t,0,c,c,c,1]),h(r,r,l),r}(e,t,i,n),this._saturation=e,this._contrast=t,this._brightnessMin=i,this._brightnessMax=n),this._colorAdjustmentMatrix}getValueAndResolveTokens(e,t,i,n){const r=this.layout.get(e).evaluate(t,{},i,n),s=this._unevaluatedLayout._values[e];return s.isDataDriven()||Is(s.value)||!r?r:function(e,t){return t.replace(/{([^{}]+)}/g,(t,i)=>i in e?String(e[i]):"")}(t.properties,r)}createBucket(e){return new Jy(e)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const e of iv().paint.overridableProperties){if(!nv.hasPaintOverride(this.layout,e))continue;const t=this.paint.get(e),i=new tv(t),n=new Es(i,t.property.specification,this.scope,this.options);let r=null;r="constant"===t.value.kind||"source"===t.value.kind?new Rs("source",n):new Os("composite",n,t.value.zoomStops,t.value.interpolationType),this.paint._values[e]=new ya(t.property,r,t.parameters)}}_handleOverridablePaintPropertyUpdate(e,t,i){return!(!this.layout||t.isDataDriven()||i.isDataDriven())&&nv.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,t){const i=e.get("text-field"),n=iv().paint.properties[t];let r=!1;const s=e=>{for(const t of e)if(n.overrides&&n.overrides.hasOverride(t))return void(r=!0)};if("constant"===i.value.kind&&i.value.value instanceof Ri)s(i.value.value.sections);else if("source"===i.value.kind){const e=t=>{r||(t instanceof Hi&&Yi(t.value)===Si?s(t.value.sections):t instanceof Ui?s(t.sections):t.eachChild(e))},t=i.value;t._styleExpression&&e(t._styleExpression.expression)}return r}getProgramIds(){return["symbol"]}getDefaultProgramParams(e,t,i){return{config:new bc(this,{zoom:t,lut:i}),overrideFog:!1}}hasElevation(){return this.layout&&"hd-road-markup"===this.layout.get("symbol-elevation-reference")}}let rv,sv,ov,av;var lv=Xa([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);function cv(e,t,i,n,r,a,l,c){const h=[e,t,1,i,n,1,r,a,1],d=[l,c,1],u=s([],h),[f,p,m]=B(d,d,u);return o(h,h,[f,0,0,0,p,0,0,0,m])}function hv(e,t,i,n,r,a,l,c){const h=function(e,t,i,n,r,a,l,c){const h=cv(0,0,1,0,1,1,0,1),d=cv(e,t,i,n,r,a,l,c);return o(d,d,s([],h))}(e,t,i,n,r,a,l,c);return[h[2]/h[8]/Rn,h[5]/h[8]/Rn]}function dv(e){return[e[0],Math.min(Math.max(e[1],-$c),$c)]}class uv extends ei{constructor(e,t,i,n){super(),this.id=e,this.dispatcher=i,this.coordinates=t.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.onNorthPole=!1,this.onSouthPole=!1,this.setEventedParent(n),this.options=t,this._dirty=!1}load(e,t){if(this._loaded=t||!1,this.fire(new Zt("dataloading",{dataType:"source"})),this.url=this.options.url,!this.url)return e&&(this.coordinates=e),this._loaded=!0,void this._finishLoading();this._imageRequest=Ht(this.map._requestManager.transformRequest(this.url,It.Image),(t,i)=>{this._imageRequest=null,this._loaded=!0,t?this.fire(new Jt(t)):i&&(this.image=i instanceof HTMLImageElement?ft.getImageData(i):i,this._dirty=!0,this.width=this.image.width,this.height=this.image.height,e&&(this.coordinates=e),this._finishLoading())})}loaded(){return this._loaded}updateImage(e){return e.url?(this._imageRequest&&e.url!==this.options.url&&(this._imageRequest.cancel(),this._imageRequest=null),this.options.url=e.url,this.load(e.coordinates,this._loaded),this):this}setTexture(e){if(!(e.handle instanceof WebGLTexture))throw new Error("The provided handle is not a WebGLTexture instance");return this.texture=new tm(this.map.painter.context,e.handle),this.width=e.dimensions[0],this.height=e.dimensions[1],this._dirty=!1,this._loaded=!0,this._finishLoading(),this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new Zt("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(e){this._imageRequest&&(this._imageRequest.cancel(),this._imageRequest=null),!this.texture||this.texture instanceof tm||this.texture.destroy(),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy())}setCoordinates(e){if(this.coordinates=e,this._boundsArray=void 0,this._unsupportedCoords=!1,!e.length)return this;this.onNorthPole=!1,this.onSouthPole=!1;let t=e[0][1],i=e[0][1];for(const n of e)n[1]>i&&(i=n[1]),n[1]$c?this.onNorthPole=!0:n<-$c&&(this.onSouthPole=!0),!this.onNorthPole&&!this.onSouthPole){const t=e.map(Jc.fromLngLat);this.tileID=function(e){let t=1/0,i=1/0,n=-1/0,r=-1/0;for(const s of e)t=Math.min(t,s.x),i=Math.min(i,s.y),n=Math.max(n,s.x),r=Math.max(r,s.y);const s=Math.max(n-t,r-i),o=Math.max(0,Math.floor(-Math.log(s)/Math.LN2)),a=Math.pow(2,o);let l=Math.floor((t+n)/2*a);return l>1&&(l-=1),new rd(o,l,Math.floor((i+r)/2*a))}(t),this.minzoom=this.maxzoom=this.tileID.z}return this.fire(new Zt("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){!this.texture||this.texture instanceof tm||(this.texture.destroy(),this._dirty=!0),this.texture=null,this._boundsArray=void 0,this._unsupportedCoords=!1}_prepareData(e){for(const e in this.tiles){const t=this.tiles[e];"loaded"!==t.state&&(t.state="loaded",t.texture=this.texture)}if(this._boundsArray||this.onNorthPole||this.onSouthPole||this._unsupportedCoords)return;const t=yy(new rd(0,0,0),this.map.transform.projection),i=[t.projection.project(this.coordinates[0][0],this.coordinates[0][1]),t.projection.project(this.coordinates[1][0],this.coordinates[1][1]),t.projection.project(this.coordinates[2][0],this.coordinates[2][1]),t.projection.project(this.coordinates[3][0],this.coordinates[3][1])];if(!function(e){const t=e[1].x-e[0].x,i=e[1].y-e[0].y,n=e[2].x-e[1].x,r=e[2].y-e[1].y,s=e[3].x-e[2].x,o=e[3].y-e[2].y,a=e[0].x-e[3].x,l=e[0].y-e[3].y,c=t*r-n*i,h=n*o-s*r,d=s*l-a*o,u=a*i-t*l;return c>0&&h>0&&d>0&&u>0||c<0&&h<0&&d<0&&u<0}(i))return console.warn("Image source coordinates are defining non-convex area in the Mercator projection"),void(this._unsupportedCoords=!0);const n=yy(this.tileID,this.map.transform.projection),[r,a,l,c]=this.coordinates.map(e=>{const t=n.projection.project(e[0],e[1]);return vy(n,t)._round()});this.perspectiveTransform=hv(r.x,r.y,a.x,a.y,l.x,l.y,c.x,c.y);const h=this._boundsArray=new Ka;h.emplaceBack(r.x,r.y,0,0),h.emplaceBack(a.x,a.y,Rn,0),h.emplaceBack(c.x,c.y,0,Rn),h.emplaceBack(l.x,l.y,Rn,Rn),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy()),this.boundsBuffer=e.createVertexBuffer(h,lv.members),this.boundsSegments=Xl.simpleSegment(0,0,4,2);const d=[],u=[dv((f=this.coordinates)[0]),dv(f[1]),dv(f[2]),dv(f[3])];var f;const[p,m,g,_]=function(e){let t=e[0][0],i=t,n=e[0][1],r=n;for(let s=1;si&&(i=e[s][0]),e[s][1]r&&(r=e[s][1]);return[t,n,i-t,r-n]}(u);{const n=new Ka,[r,a,l,c]=function(e){let t=e[0].x,i=t,n=e[0].y,r=n;for(let s=1;si&&(i=e[s].x),e[s].yr&&(r=e[s].y);return[t,n,i-t,r-n]}(i),h=e=>[(e.x-r)/l,(e.y-a)/c],[u,f,y,v]=i.map(h),x=function(e,t,i,n,r,a,l,c){const h=cv(0,0,1,0,1,1,0,1);return o(h,h,s([],cv(e,t,i,n,r,a,l,c)))}(u[0],u[1],f[0],f[1],y[0],y[1],v[0],v[1]);this.elevatedGlobePerspectiveTransform=hv(u[0],u[1],f[0],f[1],y[0],y[1],v[0],v[1]);const b=(e,t)=>{d.push(e.lng);const i=Math.round((e.lng-p)/g*Rn),r=Math.round((e.lat-m)/_*Rn),s=h(t),o=B([],[s[0],s[1],1],x),a=Math.round(o[0]/o[2]*Rn),l=Math.round(o[1]/o[2]*Rn);n.emplaceBack(i,r,a,l)},w=i[3].x-i[0].x,S=i[3].y-i[0].y,T=i[2].x-i[1].x,k=i[2].y-i[1].y;for(let e=0;e<65;e++){const n=e/64,r=[i[0].x+n*w,i[0].y+n*S],s=[i[1].x+n*T,i[1].y+n*k],o=s[0]-r[0],a=s[1]-r[1];for(let e=0;e<65;e++){const i=e/64,n={x:r[0]+o*i,y:r[1]+a*i};b(t.projection.unproject(n.x,n.y),n)}}this.elevatedGlobeVertexBuffer=e.createVertexBuffer(n,lv.members)}{this.maxLongitudeTriangleSize=0;let t=[],i=new _l;const n=(e,n,r)=>{i.emplaceBack(e,n,r);const s=d[e],o=d[n],a=d[r],l=Math.min(Math.min(s,o),a),c=Math.max(Math.max(s,o),a)-l;c>this.maxLongitudeTriangleSize&&(this.maxLongitudeTriangleSize=c),t.push(l+c/2)};for(let e=0;e<64;e++)for(let t=0;t<64;t++){const i=65*e+t,r=i+1,s=i+65,o=s+1;n(i,s,r),n(r,s,o)}[t,i]=function(e,t){const i=Array.from({length:e.length},(e,t)=>t);i.sort((t,i)=>e[t]-e[i]);const n=[],r=new _l;for(let s=0;s{s.segments.push({vertexOffset:0,primitiveOffset:e,vertexLength:t.segments[0].vertexLength,primitiveLength:i,sortKey:void 0,vaos:{}})},a=.51*this.maxLongitudeTriangleSize;if(Math.abs(i[0]-n)<=a){const e=Qe(i,0,i.length,n+a);return e===i.length||o(e,Ke(i,e+1,i.length,n+360-a)-e),s}ne.fqid),this.projection=e.projection,this.index=e.index,this.worldview=e.worldview,this.hasZoomDependentProperties=this.layers[0].isZoomDependent(),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.hasPattern=!1,this.instancesPerModel={},this.validForExaggeration=0,this.maxVerticalOffset=0,this.maxScale=0,this.maxHeight=0,this.lookupDim=this.zoom>this.canonical.z?256:this.zoom>15?75:100,this.instanceCount=0,this.terrainElevationMin=0,this.terrainElevationMax=0,this.validForDEMTile={id:null,timestamp:0},this.modelUris=[],this.modelsRequested=!1,this.activeReplacements=[],this.replacementUpdateTime=0,this.styleDefinedModelURLs=e.styleDefinedModelURLs}updateFootprints(e,t){}populate(e,t,i,n){this.tileToMeter=Zc(i);const r=this.layers[0]._featureFilter.needGeometry;this.lookup=new Uint8Array(this.lookupDim*this.lookupDim);for(const{feature:s,id:o,index:a,sourceLayerIndex:l}of e){const e=null!=o?o:s.properties&&s.properties.hasOwnProperty("id")?s.properties.id:void 0,c=oh(s,r);if(!this.layers[0]._featureFilter.filter(new da(this.zoom,{worldview:this.worldview}),c,i))continue;const h={id:e,sourceLayerIndex:l,index:a,geometry:r?c.geometry:sh(s,i,n),properties:s.properties,type:s.type,patterns:{}},d=this.addFeature(h,h.geometry,c);d&&t.featureIndex.insert(s,h.geometry,a,l,this.index,this.instancesPerModel[d].instancedDataArray.length,256)}this.lookup=null}update(e,t,i,n){for(const t in this.instancesPerModel){const i=this.instancesPerModel[t];for(const t in e)i.idToFeaturesIndex.hasOwnProperty(t)&&(this.evaluate(i.features[i.idToFeaturesIndex[t]],e[t],i,!0),this.uploaded=!1)}this.maxHeight=0}updateZoomBasedPaintProperties(){if(!this.hasZoomDependentProperties)return!1;let e=!1;for(const t in this.instancesPerModel){const i=this.instancesPerModel[t];for(const t of i.features){const n=this.layers[0],r=t.feature,s=this.canonical,o=n.paint.get("model-rotation").evaluate(r,{},s),a=n.paint.get("model-scale").evaluate(r,{},s),l=n.paint.get("model-translation").evaluate(r,{},s);V(t.rotation,o)&&V(t.scale,a)&&V(t.translation,l)||(this.evaluate(t,t.featureStates,i,!0),e=!0)}}return e}updateReplacement(e,t,i,n){if(t.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=t.updateTime;const r=t.getReplacementRegionsForTile(e.toUnwrapped(),!0);if(vf(this.activeReplacements,r))return!1;this.activeReplacements=r;let s=!1;for(const t in this.instancesPerModel){const r=this.instancesPerModel[t],o=r.instancedDataArray;for(const t of r.features){const r=t.instancedDataOffset,a=t.instancedDataCount;for(let t=0;tRn;l=c?l-Rn:l;const h=Math.floor(l),d=o.float32[a+1];let u=!1;for(const t of this.activeReplacements)if(!mf(t,i,Sv.Model,n)&&!(t.min.x>h||h>t.max.x||t.min.y>d||d>t.max.y)&&(u=kf(Tf(h,d,e.canonical,t.footprintTileId.canonical),t.footprint),u))break;o.float32[a]=u?l+Rn:l,s=s||u!==c}}}return s}isEmpty(){for(const e in this.instancesPerModel)if(0!==this.instancesPerModel[e].instancedDataArray.length)return!1;return!0}uploadPending(){return!this.uploaded}upload(e){if(!this.uploaded)for(const t in this.instancesPerModel){const i=this.instancesPerModel[t];i.instancedDataArray.length<0||0===i.instancedDataArray.length||(i.instancedDataBuffer?i.instancedDataBuffer.updateData(i.instancedDataArray):i.instancedDataBuffer=e.createVertexBuffer(i.instancedDataArray,am.members,!0,void 0,this.instanceCount))}this.uploaded=!0}destroy(){for(const e in this.instancesPerModel){const t=this.instancesPerModel[e];0!==t.instancedDataArray.length&&t.instancedDataBuffer&&t.instancedDataBuffer.destroy()}const e=this.layers[0].modelManager;if(e&&this.modelUris&&this.modelsRequested)for(const t of this.modelUris)e.removeModel(t,"",!0)}addFeature(e,t,i){const n=this.layers[0],r=n.layout.get("model-id").evaluate(i,{},this.canonical);if(!r)return We(`modelId is not evaluated for layer ${n.id} and it is not going to get rendered.`),r;(kv(r,!1)||void 0!==this.styleDefinedModelURLs[r])&&(this.modelUris.includes(r)||this.modelUris.push(r)),this.instancesPerModel[r]||(this.instancesPerModel[r]=new Av);const s=this.instancesPerModel[r],o=s.instancedDataArray,a=new Mv(i,o.length);for(const e of t)for(const t of e){if(t.x<0||t.x>=Rn||t.y<0||t.y>=Rn)continue;const e=(this.lookupDim-1)/Rn,i=this.lookupDim*(t.y*e|0)+t.x*e|0;if(this.lookup){if(0!==this.lookup[i])continue;this.lookup[i]=1}this.instanceCount++;const n=o.length;o.resize(n+1),s.instancesEvaluatedElevation.push(0),o.float32[16*n]=t.x,o.float32[16*n+1]=t.y}return a.instancedDataCount=s.instancedDataArray.length-a.instancedDataOffset,a.instancedDataCount>0&&(e.id&&(s.idToFeaturesIndex[e.id]=s.features.length),s.features.push(a),this.evaluate(a,{},s,!1)),r}getModelUris(){return this.modelUris}evaluate(e,t,i,n){const r=this.layers[0],s=e.feature,o=this.canonical,a=e.rotation=r.paint.get("model-rotation").evaluate(s,t,o),l=e.scale=r.paint.get("model-scale").evaluate(s,t,o),c=e.translation=r.paint.get("model-translation").evaluate(s,t,o),h=r.paint.get("model-color").evaluate(s,t,o);h.a=r.paint.get("model-color-mix-intensity").evaluate(s,t,o);const d=[];this.maxVerticalOffset10?this.tileToMeter:Zc(o,f)),a[s+4]=c[0],a[s+5]=c[1],a[s+6]=c[2]+l,a[s+7]=d[0],a[s+8]=d[1],a[s+9]=d[2],a[s+10]=d[4],a[s+11]=d[5],a[s+12]=d[6],a[s+13]=d[8],a[s+14]=d[9],a[s+15]=d[10],i.instancesEvaluatedElevation[r]=c[2]}}}let Dv,Lv;Ws(Cv,"ModelBucket",{omit:["layers"]}),Ws(Av,"PerModelAttributes"),Ws(Mv,"ModelFeature");class Ev{constructor(e,t,i){this._demTile=e,this._dem=this._demTile.dem,this._scale=t,this._offset=i}static create(e,t,i){const n=i||e.findDEMTileFor(t);if(!n||!n.dem)return;const r=n.dem,s=n.tileID,o=1<e.fqid),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.modelTraits|=xm.CoordinateSpaceTile,this.uploaded=!1,this.hasPattern=!1,n&&(this.modelTraits|=xm.HasMapboxMeshFeatures),r&&(this.modelTraits|=xm.HasMeshoptCompression),this.zoom=-1,this.terrainExaggeration=1,this.projection={name:"mercator"},this.replacementUpdateTime=0,this.elevationReadFromZ=255,this.brightness=s,this.worldview=a,this.dirty=!0,this.needsUpload=!1,this.filter=null,this.nodesInfo=[];for(const e of t)this.nodesInfo.push(new Fv(e)),Ov(e,o.featureIndexArray.length,o.grid),o.featureIndexArray.emplaceBack(this.nodesInfo.length-1,0,o.bucketLayerIDs.length-1,0);this.states={}}updateFootprints(e,t){for(const i of this.getNodesInfo()){const n=i.node;n.footprint&&t.push({footprint:n.footprint,id:e})}}update(e){const t=0!==Object.keys(e).length;if(t&&!this.stateDependentLayers.length)return;const i=t?this.stateDependentLayers:this.layers;if(!be(e,this.states))for(const t of i)this.evaluate(t,e);this.states=structuredClone(e)}populate(){console.log("populate 3D model bucket")}uploadPending(){return!this.uploaded||this.needsUpload}upload(e){if(!this.needsUpload)return;const t=this.getNodesInfo();for(const i of t){const t=i.node;this.uploaded?this.updatePbrBuffer(t):Tm(t,e,!0)}for(const e of t)km(e.node);this.uploaded=!0,this.needsUpload=!1}updatePbrBuffer(e){let t=!1;if(!e.meshes)return t;for(const i of e.meshes)i.pbrBuffer&&(i.pbrBuffer.updateData(i.featureArray),t=!0);return t}needsReEvaluation(e,t,i){const n=e.transform.projectionOptions,r=e.style.getBrightness(),s=this.brightness!==r;if(!this.uploaded||this.dirty||n.name!==this.projection.name||Yv(i.paint.get("model-color").value,s)||Yv(i.paint.get("model-color-mix-intensity").value,s)||Yv(i.paint.get("model-roughness").value,s)||Yv(i.paint.get("model-emissive-strength").value,s)||Yv(i.paint.get("model-height-based-emissive-strength-multiplier").value,s)){this.projection=n,this.brightness=r;const e=this.getNodesInfo();for(const t of e)t.state=null;return!0}return!1}evaluateTransform(e,t){if(e.transform.zoom===this.zoom)return;this.zoom=e.transform.zoom;const i=this.getNodesInfo(),n=this.id.canonical;for(const e of i){const i=e.feature;e.evaluatedTranslation=t.paint.get("model-translation").evaluate(i,{},n),e.evaluatedScale=t.paint.get("model-scale").evaluate(i,{},n)}}evaluate(e,t){const i=this.getNodesInfo();for(const n of i){if(!n.node.meshes)continue;const i=n.feature,r=t&&t[i.id];if(be(r,n.state))continue;n.state=structuredClone(r);const s=n.node.meshes&&n.node.meshes[0].featureData,o=n.evaluatedColor[2],a=n.evaluatedRMEA[2],l=this.id.canonical;if(n.hasTranslucentParts=!1,s){for(let t=0;t=e)continue;const d=Iv[c],u=Math.abs(d);u>a&&(o=d,a=u,l=r,h=t)}if(a>.1){const s=1-(e+.5*Math.abs(l*h))/c;let a=t._dem.get(n,i)+o*s;const d=t._dem.get(n+l,i+h),u=t._dem.get(n-l,i-h,!0);(a-d)*(a-u)>0&&(a=(d+u)/2),Iv[r]=t._dem.set(n,i,a),Pv[r]=e}}}}}o&&(t._demTile.needsDEMTextureUpload=!0,t._dem._timestamp=ft.now())}setFilter(e){this.filter=e?Ca(e):null}getNodesInfo(){return this.filter?this.nodesInfo.filter(e=>this.filter.filter(new da(this.id.overscaledZ,{worldview:this.worldview}),e.feature,this.id.canonical)):this.nodesInfo}destroy(){const e=this.getNodesInfo();for(const t of e)km(t.node),Mm(t.node)}isEmpty(){return!this.nodesInfo.length}updateReplacement(e,t){if(t.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=t.updateTime;const i=t.getReplacementRegionsForTile(e.toUnwrapped());for(const e of this.getNodesInfo()){const t=e.node.footprint;e.hiddenByReplacement=!!t&&!i.find(e=>e.footprint===t)}}getHeightAtTileCoord(e,t){const i=[],n=[0,0,0],r=l([]);for(const s of this.getNodesInfo()){const o=s.node.meshes[0],a=o.transformedAabb;if(ea.max[0]||t>a.max[1])continue;if(!0===s.node.hidden)return{height:1/0,maxHeight:s.feature.properties.height,hidden:!1,verticalScale:s.evaluatedScale[2]};c(r,s.node.matrix),n[0]=e,n[1]=t,Y(n,n,r);const l=(n[0]-o.aabb.min[0])/(o.aabb.max[0]-o.aabb.min[0])*vm|0,h=Math.min(63,(n[1]-o.aabb.min[1])/(o.aabb.max[1]-o.aabb.min[1])*vm|0)*vm+Math.min(63,l),d=o.heightmap[h];if(!(d<0&&s.node.footprint)){if(s.hiddenByReplacement)return;return{height:d,maxHeight:s.feature.properties.height,hidden:!1,verticalScale:s.evaluatedScale[2]}}if(s.node.footprint.grid.query(new xe(e,t),new xe(e,t),i),i.length>0)return{height:void 0,maxHeight:s.feature.properties.height,hidden:s.hiddenByReplacement,verticalScale:s.evaluatedScale[2]}}}}function Yv(e,t){return e instanceof Rs&&!e.isLightConstant&&t}function Bv(e,t,i,n,r,s,o,a){let l=(61440&t|(61440&t)>>4)>>8,c=(3840&t|(3840&t)>>4)>>4,h=240&t|(240&t)>>4;i[3]>0&&(l=ci(l,255*i[0],i[3]),c=ci(c,255*i[1],i[3]),h=ci(h,255*i[2],i[3]));const d=l<<8|c,u=h<<8|Math.floor(255*n[3]),f=function(e){const t=Le(e,0,2);return Math.min(Math.round(.5*t*255),255)}(n[2])<<8|15*n[0]<<4|15*n[1],p=Le(r[0],0,1),m=Le(r[1],0,1),g=Le(r[2],0,1),_=Le(r[3],0,1);let y,v,x,b;if(p!==m&&o!==s&&m!==p){const e=o-s;v=1/(e*(m-p)),x=-(s+e*p)/(e*(m-p));const t=Le(r[4],-1,1);b=Math.pow(10,t),y=255*g<<8|255*_}else y=65535,v=0,x=1,b=1;if(e.emplaceBack(d,u,f,y,v,x,b),a){const e=a.length;a.clear();for(let t=0;t>16&65535,a=s?t>>16&65535:65535&t,l=(15&a)<8?15&a:0,c=e.evaluatedRMEA[l],h=e.evaluatedColor[l],d=e.emissionHeightBasedParams[l];let u;if(o&&2===l&&n.lights&&(u=new Dl,u.resize(10*n.lights.length)),Bv(i.featureArray,r,h,c,d,i.aabb.min[2],i.aabb.max[2],u),u&&o){o=!1;const e=n.meshes[n.lightMeshIndex];e.featureArray=u,e.featureArray._trim()}}i.featureArray._trim(),r++}}function jv(e,t,i,n){const r=1<e.polygon).flat());const g=f?a:null,[_,y]=function(e,t,i,n,r,s,o,a,l,c,h){return"globe"===e.projection.name?function(e,t,i,n,r,s,o,a,l,c,h){const d=[],u=[],f=e.projection.upVectorScale(h,e.center.lat,e.worldSize).metersToTile,p=[0,0,0,1],m=[0,0,0,1],g=(e,t,i,n)=>{e[0]=t,e[1]=i,e[2]=n,e[3]=1},_=ep();i>0&&(i+=_),n+=_;for(const _ of t){const t=[],y=[];for(const d of _){const u=d.x+r.x,_=d.y+r.y,v=e.projection.projectTilePoint(u,_,h),x=e.projection.upVector(h,d.x,d.y);let b=i,w=n;if(o){const e=pp(u,_,i,n,o,a,l,c);b+=e.base,w+=e.top}0!==i?g(p,v.x+x[0]*f*b,v.y+x[1]*f*b,v.z+x[2]*f*b):g(p,v.x,v.y,v.z),g(m,v.x+x[0]*f*w,v.y+x[1]*f*w,v.z+x[2]*f*w),Y(p,p,s),Y(m,m,s),t.push(new sp(p[0],p[1],p[2])),y.push(new sp(m[0],m[1],m[2]))}d.push(t),u.push(y)}return[d,u]}(e,t,i,n,r,s,o,a,l,c,h):o?function(e,t,i,n,r,s,o,a,l){const c=[],h=[],d=[0,0,0,1];for(const u of e){const e=[],f=[];for(const c of u){const h=c.x+n.x,u=c.y+n.y,p=pp(h,u,t,i,s,o,a,l);d[0]=h,d[1]=u,d[2]=p.base,d[3]=1,Z(d,d,r),d[3]=Math.max(d[3],1e-5);const m=new sp(d[0]/d[3],d[1]/d[3],d[2]/d[3]);d[0]=h,d[1]=u,d[2]=p.top,d[3]=1,Z(d,d,r),d[3]=Math.max(d[3],1e-5);const g=new sp(d[0]/d[3],d[1]/d[3],d[2]/d[3]);e.push(m),f.push(g)}c.push(e),h.push(f)}return[c,h]}(t,i,n,r,s,o,a,l,c):function(e,t,i,n,r){const s=[],o=[],a=r[8]*t,l=r[9]*t,c=r[10]*t,h=r[11]*t,d=r[8]*i,u=r[9]*i,f=r[10]*i,p=r[11]*i;for(const t of e){const e=[],i=[];for(const s of t){const t=s.x+n.x,o=s.y+n.y,m=r[0]*t+r[4]*o+r[12],g=r[1]*t+r[5]*o+r[13],_=r[2]*t+r[6]*o+r[14],y=r[3]*t+r[7]*o+r[15],v=m+a,x=g+l,b=_+c,w=Math.max(y+h,1e-5),S=m+d,T=g+u,k=_+f,M=Math.max(y+p,1e-5);e.push(new sp(v/w,x/w,b/w)),i.push(new sp(S/M,T/M,k/M))}s.push(e),o.push(i)}return[s,o]}(t,i,n,r,s)}(s,n,d,h,c,o,g,u,p,s.center.lat,e.tileID.canonical),v=e.queryGeometry;return function(e,t,i){let n=1/0;Fh(i,t)&&(n=fp(i,t[0]));for(let r=0;r{if(vg)return vg;const e=_g();return vg=new yg(e.paint.properties["line-width"].specification),vg.useIntegerZoom=!0,vg})().possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new og(e)}getProgramIds(){return[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"]}getDefaultProgramParams(e,t,i){const n=pg(this);return{config:new bc(this,{zoom:t,lut:i}),defines:n,overrideFog:!1}}queryRadius(e){const t=e,i=xg(Jh("line-width",this,t),Jh("line-gap-width",this,t)),n=Jh("line-offset",this,t);return i/2+Math.abs(n)+Kh(this.paint.get("line-translate"))}queryIntersectsFeature(e,t,i,n,r,s){if(e.queryGeometry.isAboveHorizon)return!1;const o=Qh(e.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),s.angle,e.pixelToTileUnitsFactor),a=e.pixelToTileUnitsFactor/2*xg(this.paint.get("line-width").evaluate(t,i),this.paint.get("line-gap-width").evaluate(t,i)),l=this.paint.get("line-offset").evaluate(t,i);return l&&(n=function(e,t){const i=[],n=new xe(0,0);for(let r=0;r=3)for(let t=0;t>16&255)/255,(e>>8&255)/255,(255&e)/255,1)}function Sx(e,t,i){1===e?(t.rgb_color=wx(i.readVarint()),t.paint="rgb_color"):2===e?(t.linear_gradient_idx=i.readVarint(),t.paint="linear_gradient_idx"):3===e?(t.radial_gradient_idx=i.readVarint(),t.paint="radial_gradient_idx"):5===e?i.readPackedFloat(t.dasharray):6===e?t.dashoffset=i.readFloat():7===e?t.miterlimit=i.readFloat():8===e?t.opacity=i.readVarint():9===e?t.width=i.readFloat():10===e?t.linecap=i.readVarint():11===e&&(t.linejoin=i.readVarint())}function Tx(e,t,i){1===e?t.transform=yx(i,i.readVarint()+i.pos):2===e?t.spread_method=i.readVarint():3===e?t.stops.push(kx(i,i.readVarint()+i.pos)):4===e?t.x1=i.readFloat():5===e?t.y1=i.readFloat():6===e?t.x2=i.readFloat():7===e&&(t.y2=i.readFloat())}function kx(e,t){return e.readFields(Mx,{offset:0,opacity:255,rgb_color:Uv},t)}function Mx(e,t,i){1===e?t.offset=i.readFloat():2===e?t.opacity=i.readVarint():3===e&&(t.rgb_color=wx(i.readVarint()))}function Ax(e,t,i){1===e?t.transform=yx(i,i.readVarint()+i.pos):2===e?t.spread_method=i.readVarint():3===e?t.stops.push(kx(i,i.readVarint()+i.pos)):4===e?t.cx=i.readFloat():5===e?t.cy=i.readFloat():6===e?t.r=i.readFloat():7===e?t.fx=i.readFloat():8===e?t.fy=i.readFloat():9===e&&(t.fr=i.readFloat())}function Cx(e,t,i){1===e?t.transform=yx(i,i.readVarint()+i.pos):2===e?t.clip_path_idx=i.readVarint():3===e&&t.children.push(mx(i,i.readVarint()+i.pos))}function Dx(e,t,i){1===e?t.left=t.top=i.readFloat():2===e?t.width=t.height=i.readFloat():3===e?t.top=i.readFloat():4===e?t.height=i.readFloat():5===e?t.mask_type=i.readVarint():6===e?t.mask_idx=i.readVarint():7===e&&t.children.push(mx(i,i.readVarint()+i.pos))}class Lx{static calculate(e={},t=[]){const i=new Map,n=new Map;if(0===Object.keys(e).length)return i;t.forEach(e=>{n.set(e.name,e.rgb_color||new si(0,0,0))});for(const[t,r]of Object.entries(e))n.has(t)?i.set(n.get(t).toString(),r):console.warn(`Ignoring unknown image variable "${t}"`);return i}}function Ex(e,t=255,i){const n=t/255,r=e.toString(),s=i.has(r)?i.get(r).clone():e.clone();return s.a*=n,s.toString()}function Ix(e,t){if(!ut()){const i=document.createElement("canvas");return i.width=e,i.height=t,i}return new OffscreenCanvas(e,t)}function Px(e,t){const i=Lx.calculate(t.params,e.metadata?e.metadata.variables:[]),n=e.usvg_tree,r=n.width,s=n.height,o=t.transform?t.transform:new DOMMatrix,a=Math.max(1,Math.round(r*o.a)),l=Math.max(1,Math.round(s*o.d)),c=new DOMMatrix([a/r,0,0,l/s,0,0]),h=Ix(a,l).getContext("2d");return Rx(h,c,n,n,i),h.getImageData(0,0,a,l)}function Rx(e,t,i,n,r){for(const s of n.children)Ox(e,t,i,s,r)}function Ox(e,t,i,n,r){n.group?(e.save(),function(e,t,i,n,r){const s=null!=n.mask_idx?i.masks[n.mask_idx]:null,o=null!=n.clip_path_idx?i.clip_paths[n.clip_path_idx]:null;if(n.transform&&(t=Wx(n.transform).preMultiplySelf(t)),!function(e,t,i){return 255!==e.opacity||t||i}(n,null!=o,null!=s))return void Rx(e,t,i,n,r);const a=Ix(e.canvas.width,e.canvas.height),l=a.getContext("2d");Rx(l,t,i,n,r),o&&jx(l,t,i,o),s&&Vx(l,t,i,s,r),e.globalAlpha=n.opacity/255,e.drawImage(a,0,0)}(e,t,i,n.group,r),e.restore()):n.path&&(e.save(),function(e,t,i,n,r){e.setTransform(t),n.paint_order===tx?(zx(e,i,n,r),Nx(e,i,n,r)):(Nx(e,i,n,r),zx(e,i,n,r))}(e,t,i,n.path,r),e.restore())}function zx(e,t,i,n){const r=i.fill;if(!r)return;const s=r.opacity/255;switch(e.save(),e.beginPath(),Ux(i,e),r.paint){case"rgb_color":e.fillStyle=Ex(r.rgb_color,r.opacity,n);break;case"linear_gradient_idx":{const i=t.linear_gradients[r.linear_gradient_idx];i.transform&&e.setTransform(Wx(i.transform).preMultiplySelf(e.getTransform())),e.fillStyle=Yx(e,i,s,n);break}case"radial_gradient_idx":{const i=t.radial_gradients[r.radial_gradient_idx];i.transform&&e.setTransform(Wx(i.transform).preMultiplySelf(e.getTransform())),e.fillStyle=Bx(e,i,s,n)}}e.fill(Fx(i)),e.restore()}function Fx(e){return e.rule===$v?"nonzero":e.rule===Gv?"evenodd":void 0}function Nx(e,t,i,n){const r=i.stroke;if(!r)return;const s=$x(i);e.lineWidth=r.width,e.miterLimit=r.miterlimit,e.setLineDash(r.dasharray),e.lineDashOffset=r.dashoffset;const o=r.opacity/255;switch(r.paint){case"rgb_color":e.strokeStyle=Ex(r.rgb_color,r.opacity,n);break;case"linear_gradient_idx":e.strokeStyle=Yx(e,t.linear_gradients[r.linear_gradient_idx],o,n,!0);break;case"radial_gradient_idx":e.strokeStyle=Bx(e,t.radial_gradients[r.radial_gradient_idx],o,n,!0)}switch(r.linejoin){case Kv:case Jv:e.lineJoin="miter";break;case Qv:e.lineJoin="round";break;case ex:e.lineJoin="bevel"}switch(r.linecap){case Xv:e.lineCap="butt";break;case qv:e.lineCap="round";break;case Zv:e.lineCap="square"}e.stroke(s)}function Yx(e,t,i,n,r=!1){if(1===t.stops.length){const e=t.stops[0];return Ex(e.rgb_color,e.opacity*i,n)}const{x1:s,y1:o,x2:a,y2:l}=t;let c=new DOMPoint(s,o),h=new DOMPoint(a,l);if(r){const e=Wx(t.transform);c=e.transformPoint(c),h=e.transformPoint(h)}const d=e.createLinearGradient(c.x,c.y,h.x,h.y);for(const e of t.stops)d.addColorStop(e.offset,Ex(e.rgb_color,e.opacity*i,n));return d}function Bx(e,t,i,n,r=!1){if(1===t.stops.length){const e=t.stops[0];return Ex(e.rgb_color,e.opacity*i,n)}const s=Wx(t.transform),{fx:o,fy:a,fr:l,cx:c,cy:h,r:d}=t;let u=new DOMPoint(o,a),f=new DOMPoint(c,h),p=l,m=d;if(r){u=s.transformPoint(u),f=s.transformPoint(f);const e=(s.a+s.d)/2;p=l*e,m=t.r*e}const g=e.createRadialGradient(u.x,u.y,p,f.x,f.y,m);for(const e of t.stops)g.addColorStop(e.offset,Ex(e.rgb_color,e.opacity*i,n));return g}function Hx(e,t,i,n){const r=n.transform?Wx(n.transform).preMultiplySelf(t):t,s=Ix(e.canvas.width,e.canvas.height),o=s.getContext("2d");for(const e of n.children)if(e.group)Hx(o,r,i,e.group);else if(e.path){const t=e.path,i=new Path2D;i.addPath($x(t),r),o.fill(i,Fx(t))}const a=null!=n.clip_path_idx?i.clip_paths[n.clip_path_idx]:null;a&&jx(o,r,i,a),e.globalCompositeOperation="source-over",e.drawImage(s,0,0)}function jx(e,t,i,n){const r=Ix(e.canvas.width,e.canvas.height);Hx(r.getContext("2d"),t,i,n),e.globalCompositeOperation="destination-in",e.drawImage(r,0,0)}function Vx(e,t,i,n,r){if(0===n.children.length)return;const s=null!=n.mask_idx?i.masks[n.mask_idx]:null;s&&Vx(e,t,i,s,r);const o=e.canvas.width,a=e.canvas.height,l=Ix(o,a),c=l.getContext("2d"),h=n.width,d=n.height,u=n.left,f=n.top,p=new Path2D,m=new Path2D;m.rect(u,f,h,d),p.addPath(m,t),c.clip(p);for(const e of n.children)Ox(c,t,i,e,r);const g=c.getImageData(0,0,o,a),_=g.data;if(n.mask_type===ax)for(let e=0;e<_.length;e+=4)_[e+3]=_[e+3]/255*(.2126*_[e]+.7152*_[e+1]+.0722*_[e+2]);c.putImageData(g,0,0),e.globalCompositeOperation="destination-in",e.drawImage(l,0,0)}function Wx(e){return e?new DOMMatrix([e.sx,e.ky,e.kx,e.sy,e.tx,e.ty]):new DOMMatrix}function Ux(e,t){const i=e.step;let n=e.diffs[0]*i,r=e.diffs[1]*i;t.moveTo(n,r);for(let s=0,o=2;st[o])return null}else{const a=1/n[o];let l=(e[o]-i[o])*a,c=(t[o]-i[o])*a;if(l>c){const e=l;l=c,c=e}if(l>r&&(r=l),cs)return null}return r}function Jx(e,t,i,n,r,s,o,a,l,c,h){const d=n-e,u=r-t,f=s-i,p=o-e,m=a-t,g=l-i,_=h[1]*g-h[2]*m,y=h[2]*p-h[0]*g,v=h[0]*m-h[1]*p,x=d*_+u*y+f*v;if(Math.abs(x)<1e-15)return null;const b=1/x,w=c[0]-e,S=c[1]-t,T=c[2]-i,k=(w*_+S*y+T*v)*b;if(k<0||k>1)return null;const M=S*f-T*u,A=T*d-w*f,C=w*u-S*d,D=(h[0]*M+h[1]*A+h[2]*C)*b;return D<0||k+D>1?null:(p*M+m*A+g*C)*b}function Kx(e,t,i){return(e-t)/(i-t)}function Qx(e,t,i,n,r,s,o,a,l){const c=1<{const s=n?1:0,o=(e+1)*i-s,a=t*i,l=(t+1)*i-s;r[0]=e*i,r[1]=a,r[2]=o,r[3]=l};let o=new qx(n);const a=[];for(let t=0;t=1;n/=2){const e=i[i.length-1];o=new qx(n);for(let t=0;t0;){const{idx:a,t:f,nodex:p,nodey:m,depth:g}=u.pop();if(this.leaves[a]){Qx(p,m,g,e,t,i,n,h,d);const a=1<=e[2])return f}continue}let _=0;for(let u=0;u=l[c[i]]&&(c.splice(i,0,u),t=!0);t||(c[_]=u),_++}}for(let e=0;e<_;e++){const t=c[e];u.push({idx:this.childOffsets[a]+t,t:l[t],nodex:(p<<1)+this._siblingOffset[t][0],nodey:(m<<1)+this._siblingOffset[t][1],depth:g+1})}}return null}_addNode(e,t,i){return this.minimums.push(e),this.maximums.push(t),this.leaves.push(i),this.childOffsets.push(0),this.nodeCount++}_construct(e,t,i,n,r){if(1===e[n].isLeaf(t,i))return;this.childOffsets[r]||(this.childOffsets[r]=this.nodeCount);const s=n-1,o=e[s];let a=0,l=0;for(let e=0;e=this.dim+1||t<-1||t>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(t+1)*this.stride+(e+1)}static pack(e,t){const i=[0,0,0,0],n=ob.getUnpackVector(t);let r=Math.floor((e+n[3])/n[2]);return i[2]=r%256,r=Math.floor(r/256),i[1]=r%256,r=Math.floor(r/256),i[0]=r,i}getPixels(){return new tu({width:this.stride,height:this.stride},this.pixels)}backfillBorder(e,t,i){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let n=t*this.dim,r=t*this.dim+this.dim,s=i*this.dim,o=i*this.dim+this.dim;switch(t){case-1:n=r-1;break;case 1:r=n+1}switch(i){case-1:s=o-1;break;case 1:o=s+1}const a=-t*this.dim,l=-i*this.dim;for(let t=s;t=1;n--){const r=1===n?1:0,s=2===n?1:0;for(let n=0;n>>1^-(1&e[t]);return e}function _b(e,t){switch(t){case"uint32":return e;case"uint16":for(let t=0;t>4|(61440&i)>>8|(240&n)<<4|61440&n,e[t+1]=15&i|(3840&i)>>4|(15&n)<<8|(3840&n)<<4}return e;case"uint8":for(let t=0;t>6|(192&n)>>4|(192&r)>>2|192&s,e[t+1]=(48&i)>>4|(48&n)>>2|48&r|(48&s)<<2,e[t+2]=(12&i)>>2|12&n|(12&r)<<2|(12&s)<<4,e[t+3]=3&i|(3&n)<<2|(3&r)<<4|(3&s)<<6}return e;default:throw new Error(`Invalid pixel format, "${t}"`)}}Ws(ob,"DEMData"),Ws(eb,"DemMinMaxQuadTree",{omit:["dem"]});var yb=Uint8Array,vb=Uint16Array,xb=Int32Array,bb=new yb([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),wb=new yb([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Sb=new yb([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Tb=function(e,t){for(var i=new vb(31),n=0;n<31;++n)i[n]=t+=1<>1|(21845&Lb)<<1;Db[Lb]=((65280&(Eb=(61680&(Eb=(52428&Eb)>>2|(13107&Eb)<<2))>>4|(3855&Eb)<<4))>>8|(255&Eb)<<8)>>1}var Ib=function(e,t,i){for(var n=e.length,r=0,s=new vb(t);r>l]=c;return o},Pb=new yb(288);for(Lb=0;Lb<144;++Lb)Pb[Lb]=8;for(Lb=144;Lb<256;++Lb)Pb[Lb]=9;for(Lb=256;Lb<280;++Lb)Pb[Lb]=7;for(Lb=280;Lb<288;++Lb)Pb[Lb]=8;var Rb=new yb(32);for(Lb=0;Lb<32;++Lb)Rb[Lb]=5;var Ob=Ib(Pb,9),zb=Ib(Rb,5),Fb=function(e){for(var t=e[0],i=1;it&&(t=e[i]);return t},Nb=function(e,t,i){var n=t/8|0;return(e[n]|e[n+1]<<8)>>(7&t)&i},Yb=function(e,t){var i=t/8|0;return(e[i]|e[i+1]<<8|e[i+2]<<16)>>(7&t)},Bb=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Hb=function(e,t,i){var n=new Error(t||Bb[e]);if(n.code=e,Error.captureStackTrace&&Error.captureStackTrace(n,Hb),!i)throw n;return n},jb=new yb(0),Vb="undefined"!=typeof TextDecoder&&new TextDecoder;try{Vb.decode(jb,{stream:!0})}catch(e){}const Wb={gzip_data:"gzip"};class Ub extends Error{constructor(e){super(e),this.name="MRTError"}}const $b={0:"uint32",1:"uint32",2:"uint16",3:"uint8"},Gb={uint32:1,uint16:2,uint8:4},Xb={uint32:Uint32Array,uint16:Uint16Array,uint8:Uint8Array};let qb;class Zb{constructor(e=5){this.x=NaN,this.y=NaN,this.z=NaN,this.layers={},this._cacheSize=e}getLayer(e){const t=this.layers[e];if(!t)throw new Ub(`Layer '${e}' not found`);return t}getHeaderLength(e){const t=new Uint8Array(e),i=new DataView(e);if(13!==t[0])throw new Ub("File is not a valid MRT.");return i.getUint32(1,!0)}parseHeader(e){const t=new Uint8Array(e),i=this.getHeaderLength(e);if(t.length= ${i} but got buffer of length ${t.length}`);const n=new qb(t.subarray(0,i)).readFields(ab,{headerLength:0,x:0,y:0,z:0,layers:[]},void 0);if(!isNaN(this.x)&&(this.x!==n.x||this.y!==n.y||this.z!==n.z))throw new Ub(`Invalid attempt to parse header ${n.z}/${n.x}/${n.y} for tile ${this.z}/${this.x}/${this.y}`);this.x=n.x,this.y=n.y,this.z=n.z;for(const e of n.layers)this.layers[e.name]=new Jb(e,{cacheSize:this._cacheSize});return this}createDecodingTask(e){const t=[],i=this.getLayer(e.layerName);for(let n of e.blockIndices){const r=i.dataIndex[n],s=r.firstByte-e.firstByte,o=r.lastByte-e.firstByte;if(i._blocksInProgress.has(n))continue;const a={layerName:i.name,firstByte:s,lastByte:o,pixelFormat:i.pixelFormat,blockIndex:n,blockShape:[r.bands.length].concat(i.bandShape),buffer:i.buffer,codec:r.codec.codec,filters:r.filters.map(e=>e.filter)};i._blocksInProgress.add(n),t.push(a)}return new Kb(t,()=>{t.forEach(e=>i._blocksInProgress.delete(e.blockIndex))},(e,n)=>{if(t.forEach(e=>i._blocksInProgress.delete(e.blockIndex)),e)throw e;n.forEach(e=>{this.getLayer(e.layerName).processDecodedData(e)})})}}class Jb{constructor({version:e,name:t,units:i,tileSize:n,pixelFormat:r,buffer:s,dataIndex:o},a){if(this.version=e,1!==this.version)throw new Ub(`Cannot parse raster layer encoded with MRT version ${e}`);this.name=t,this.units=i,this.tileSize=n,this.buffer=s,this.pixelFormat=$b[r],this.dataIndex=o,this.bandShape=[n+2*s,n+2*s,Gb[this.pixelFormat]],this._decodedBlocks=new Gx(a?a.cacheSize:5),this._blocksInProgress=new Set}get dimension(){return Gb[this.pixelFormat]}get cacheSize(){return this._decodedBlocks.capacity}getBandList(){return this.dataIndex.map(({bands:e})=>e).flat()}processDecodedData(e){const t=e.blockIndex.toString();this._decodedBlocks.get(t)||this._decodedBlocks.put(t,e.data)}getBlockForBand(e){let t=0;switch(typeof e){case"string":for(const[i,n]of this.dataIndex.entries()){for(const[r,s]of n.bands.entries())if(s===e)return{bandIndex:t+r,blockIndex:i,blockBandIndex:r};t+=n.bands.length}break;case"number":for(const[i,n]of this.dataIndex.entries()){if(e>=t&&ethis.cacheSize)throw new Ub(`Number of blocks to decode (${r.size}) exceeds cache size (${this.cacheSize}).`);return{layerName:this.name,firstByte:t,lastByte:i,blockIndices:n}}hasBand(e){const{blockIndex:t}=this.getBlockForBand(e);return t>=0}hasDataForBand(e){const{blockIndex:t}=this.getBlockForBand(e);return t>=0&&!!this._decodedBlocks.get(t.toString())}getBandView(e){const{blockIndex:t,blockBandIndex:i}=this.getBlockForBand(e);if(t<0)throw new Ub(`Band not found: ${JSON.stringify(e)}`);const n=this._decodedBlocks.get(t.toString());if(!n)throw new Ub(`Data for band ${JSON.stringify(e)} of layer "${this.name}" not decoded.`);const r=this.dataIndex[t],s=this.bandShape.reduce((e,t)=>e*t,1),o=i*s,a=n.subarray(o,o+s);return{data:a,bytes:new Uint8Array(a.buffer).subarray(a.byteOffset,a.byteOffset+a.byteLength),tileSize:this.tileSize,buffer:this.buffer,pixelFormat:this.pixelFormat,dimension:this.dimension,offset:r.offset,scale:r.scale}}}Zb.setPbf=function(e){qb=e};class Kb{constructor(e,t,i){this.tasks=e,this._onCancel=t,this._onComplete=i,this._finalized=!1}cancel(){this._finalized||(this._onCancel(),this._finalized=!0)}complete(e,t){this._finalized||(this._onComplete(e,t),this._finalized=!0)}}Zb.performDecoding=function(e,t){const i=new Uint8Array(e);return Promise.all(t.tasks.map(e=>{const{layerName:t,firstByte:n,lastByte:r,pixelFormat:s,blockShape:o,blockIndex:a,filters:l,codec:c}=e,h=i.subarray(n,r+1),d=new Uint32Array(o[0]*o[1]*o[2]);let u;if("gzip_data"!==c)throw new Ub(`Unhandled codec: ${c}`);return u=function(e,t){if(!globalThis.DecompressionStream&&"gzip_data"===t)return Promise.resolve(((s=function(e){31==e[0]&&139==e[1]&&8==e[2]||Hb(6,"invalid gzip data");var t=e[3],i=10;4&t&&(i+=2+(e[10]|e[11]<<8));for(var n=(t>>3&1)+(t>>4&1);n>0;n-=!e[i++]);return i+(2&t)}(r=e))+8>r.length&&Hb(6,"invalid gzip data"),function(e,t,i){var n=e.length;if(!n||t.f&&!t.l)return i||new yb(0);var r=!i,s=r||2!=t.i,o=t.i;r&&(i=new yb(3*n));var a,l,c=function(e){var t=i.length;if(e>t){var n=new yb(Math.max(2*t,e));n.set(i),i=n}},h=t.f||0,d=t.p||0,u=t.b||0,f=t.l,p=t.d,m=t.m,g=t.n,_=8*n;do{if(!f){h=Nb(e,d,1);var y=Nb(e,d+1,3);if(d+=3,!y){var v=e[(L=4+((d+7)/8|0))-4]|e[L-3]<<8,x=L+v;if(x>n){o&&Hb(0);break}s&&c(u+v),i.set(e.subarray(L,x),u),t.b=u+=v,t.p=d=8*x,t.f=h;continue}if(1==y)f=Ob,p=zb,m=9,g=5;else if(2==y){var b=Nb(e,d,31)+257,w=Nb(e,d+10,15)+4,S=b+Nb(e,d+5,31)+1;d+=14;for(var T=new yb(S),k=new yb(19),M=0;M>4)<16)T[M++]=L;else{var I=0,P=0;for(16==L?(P=3+Nb(e,d,3),d+=2,I=T[M-1]):17==L?(P=3+Nb(e,d,7),d+=3):18==L&&(P=11+Nb(e,d,127),d+=7);P--;)T[M++]=I}}var R=T.subarray(0,b),O=T.subarray(b);m=Fb(R),g=Fb(O),f=Ib(R,m),p=Ib(O,g)}else Hb(1);if(d>_){o&&Hb(0);break}}s&&c(u+131072);for(var z=(1<>4;if((d+=15&I)>_){o&&Hb(0);break}if(I||Hb(2),Y<256)i[u++]=Y;else{if(256==Y){N=d,f=null;break}var B=Y-254;Y>264&&(B=Nb(e,d,(1<<(V=bb[M=Y-257]))-1)+Mb[M],d+=V);var H=p[Yb(e,d)&F],j=H>>4;if(H||Hb(3),d+=15&H,O=Cb[j],j>3){var V=wb[j];O+=Yb(e,d)&(1<_){o&&Hb(0);break}s&&c(u+131072);var W=u+B;if(ua.length)&&(l=a.length),new yb(a.subarray(0,l))):i.subarray(0,u)}(r.subarray(s,-8),{i:2},new yb(((i=r)[(n=i.length)-4]|i[n-3]<<8|i[n-2]<<16|i[n-1]<<24)>>>0))));var i,n,r,s;const o=Wb[t];if(!o)throw new Error(`Unhandled codec: ${t}`);const a=new globalThis.DecompressionStream(o);return new Response(new Blob([e]).stream().pipeThrough(a)).arrayBuffer().then(e=>new Uint8Array(e))}(h,c).then(e=>(function(e,t){e.readFields(fb,t)}(new qb(e),d),new(0,Xb[s])(d.buffer))),u.then(e=>{for(let t=l.length-1;t>=0;t--)switch(l[t]){case"delta_filter":mb(e,o);break;case"zigzag_filter":gb(e);break;case"bitshuffle_filter":_b(e,s);break;default:throw new Ub(`Unhandled filter "${l[t]}"`)}return{layerName:t,blockIndex:a,data:e}}).catch(e=>{throw e})}))},Ws(Kb,"MRTDecodingBatch",{omit:["_onCancel","_onComplete"]}),Ws(Zb,"MapboxRasterTile"),Ws(Jb,"MapboxRasterLayer",{omit:["_blocksInProgress"]});class Qb{constructor(e){this._stringToNumber={},this._numberToString=[];for(let t=0;t=0&&n[3]>=0&&l.insert(a,n[0],n[1],n[2],n[3])}}loadVTLayers(){if(!this.vtLayers){this.vtLayers=new uh(new Yg(this.rawTileData)).layers,this.sourceLayerCoder=new Qb(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={};for(const e in this.vtLayers)this.vtFeatures[e]=[]}return this.vtLayers}query(e,t){const{tilespaceGeometry:i,transform:n,tileTransform:r,pixelPosMatrix:s,availableImages:o,worldview:a}=t;this.loadVTLayers(),this.serializedLayersCache.clear();const l=i.bufferedTilespaceBounds,c=this.grid.query(l.min.x,l.min.y,l.max.x,l.max.y,(e,t,n,r)=>Gh(i.bufferedTilespaceGeometry,e,t,n,r));c.sort(rw);let h=null;n.elevation&&c.length>0&&(h=Ev.create(n.elevation,this.tileID));const d={};let u;for(let t=0;t(p||(p=sh(e,this.tileID.canonical,r)),t.queryIntersectsFeature(i,e,o,p,this.z,n,s,h,a)))}return d}loadMatchingFeature(e,t,i,n,r,s){const{featureIndex:o,bucketIndex:a,sourceLayerIndex:l,layoutVertexArrayOffset:c}=t,h=this.bucketLayerIDs[a],d=i.layers,u=Object.keys(d);if(u.length&&!je(u,h))return;const f=i.sourceCache,p=this.sourceLayerCoder.decode(l),m=this.vtLayers[p].feature(o),g=this.getId(m,p);for(let t=0;t`${e.key}: ${e.message}`).join(", ")}`);this.promoteIdExpression=e.value}this.promoteIdExpression._evaluator||(this.promoteIdExpression._evaluator=new Ji),i=this.promoteIdExpression.evaluate({zoom:0},e)}else i=e.properties[n];"boolean"==typeof i&&(i=Number(i))}return i}}function nw(e,t,i,n,r){return Ye(e,(e,s)=>{const o=t instanceof va?t.get(s):null;return o&&o.evaluate?o.evaluate(i,n,void 0,r):o})}function rw(e,t){return t-e}Ws(iw,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});const sw=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class ow{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[t,i]=new Uint8Array(e,0,2);if(219!==t)throw new Error("Data does not appear to be in a KDBush format.");const n=i>>4;if(1!==n)throw new Error(`Got v${n} data when expected v1.`);const r=sw[15&i];if(!r)throw new Error("Unrecognized array type.");const[s]=new Uint16Array(e,2,1),[o]=new Uint32Array(e,4,1);return new ow(o,s,r,e)}constructor(e,t=64,i=Float64Array,n){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+t,2),65535),this.ArrayType=i,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const r=sw.indexOf(this.ArrayType),s=2*e*this.ArrayType.BYTES_PER_ELEMENT,o=e*this.IndexArrayType.BYTES_PER_ELEMENT,a=(8-o%8)%8;if(r<0)throw new Error(`Unexpected typed array class: ${i}.`);n&&n instanceof ArrayBuffer?(this.data=n,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+o+a,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+s+o+a),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+o+a,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+r]),new Uint16Array(this.data,2,1)[0]=t,new Uint32Array(this.data,4,1)[0]=e)}add(e,t){const i=this._pos>>1;return this.ids[i]=i,this.coords[this._pos++]=e,this.coords[this._pos++]=t,i}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return aw(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,t,i,n){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:r,coords:s,nodeSize:o}=this,a=[0,r.length-1,0],l=[];for(;a.length;){const c=a.pop()||0,h=a.pop()||0,d=a.pop()||0;if(h-d<=o){for(let o=d;o<=h;o++){const a=s[2*o],c=s[2*o+1];a>=e&&a<=i&&c>=t&&c<=n&&l.push(r[o])}continue}const u=d+h>>1,f=s[2*u],p=s[2*u+1];f>=e&&f<=i&&p>=t&&p<=n&&l.push(r[u]),(0===c?e<=f:t<=p)&&(a.push(d),a.push(u-1),a.push(1-c)),(0===c?i>=f:n>=p)&&(a.push(u+1),a.push(h),a.push(1-c))}return l}within(e,t,i){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:n,coords:r,nodeSize:s}=this,o=[0,n.length-1,0],a=[],l=i*i;for(;o.length;){const c=o.pop()||0,h=o.pop()||0,d=o.pop()||0;if(h-d<=s){for(let i=d;i<=h;i++)dw(r[2*i],r[2*i+1],e,t)<=l&&a.push(n[i]);continue}const u=d+h>>1,f=r[2*u],p=r[2*u+1];dw(f,p,e,t)<=l&&a.push(n[u]),(0===c?e-i<=f:t-i<=p)&&(o.push(d),o.push(u-1),o.push(1-c)),(0===c?e+i>=f:t+i>=p)&&(o.push(u+1),o.push(h),o.push(1-c))}return a}}function aw(e,t,i,n,r,s){if(r-n<=i)return;const o=n+r>>1;lw(e,t,o,n,r,s),aw(e,t,i,n,o-1,1-s),aw(e,t,i,o+1,r,1-s)}function lw(e,t,i,n,r,s){for(;r>n;){if(r-n>600){const o=r-n+1,a=i-n+1,l=Math.log(o),c=.5*Math.exp(2*l/3),h=.5*Math.sqrt(l*c*(o-c)/o)*(a-o/2<0?-1:1);lw(e,t,i,Math.max(n,Math.floor(i-a*c/o+h)),Math.min(r,Math.floor(i+(o-a)*c/o+h)),s)}const o=t[2*i+s];let a=n,l=r;for(cw(e,t,n,i),t[2*r+s]>o&&cw(e,t,n,r);ao;)l--}t[2*n+s]===o?cw(e,t,n,l):(l++,cw(e,t,l,r)),l<=i&&(n=l+1),i<=l&&(r=l-1)}}function cw(e,t,i,n){hw(e,i,n),hw(t,2*i,2*n),hw(t,2*i+1,2*n+1)}function hw(e,t,i){const n=e[t];e[t]=e[i],e[i]=n}function dw(e,t,i,n){const r=e-i,s=t-n;return r*r+s*s}e.$=Ki,e.A=Zt,e.B=Oi,e.C=Ha,e.D=bp,e.E=ei,e.F=2,e.G=I_,e.H=E_,e.I=ti,e.J=Gi,e.K=class extends Tv{},e.L=ui,e.M=ka,e.N=ws,e.O=vs,e.P=xe,e.Q=bs,e.R=It,e.S=Is,e.T=em,e.U=Ma,e.V=Tv,e.W=zs,e.X=Ps,e.Y=hr,e.Z=ur,e._=cr,e.a=function(e){return nt.API_CDN_URL_REGEX.test(e)},e.a$=ze,e.a0=ri,e.a1=Aa,e.a2=Ss,e.a3=xs,e.a4=function(e){const t=e.value;let i=[];if(!t)return i;const n=Gi(t);return"string"!==n?(i=i.concat([new Tv(e.key,t,`string expected, "${n}" found`)]),i):(kv(t,!0)||(i=i.concat([new Tv(e.key,t,`invalid url "${t}"`)])),i)},e.a5=Ta,e.a6=pa,e.a7=Sa,e.a8=xa,e.a9=class{constructor(e){this.specification=e}possiblyEvaluate(e,t){return Ge(e.expression.evaluate(t))}interpolate(e,t,i){return{x:ci(e.x,t.x,i),y:ci(e.y,t.y,i),z:ci(e.z,t.z,i),azimuthal:ci(e.azimuthal,t.azimuthal,i),polar:ci(e.polar,t.polar,i)}}},e.aA=Z,e.aB=Cc,e.aC=$h,e.aD=Bc,e.aE=Qc,e.aF=function(e,t){const i={};for(let n=0;n{n(e,i)},t):n(e,i),()=>{}}return r.callbacks.push(n),r.cancel||(r.cancel=i((i,n)=>{r.result=[i,n];for(const e of r.callbacks)this.scheduler?this.scheduler.add(()=>{e(i,n)},t):e(i,n);setTimeout(()=>delete this.entries[e],3e3)})),()=>{r.result||(r.callbacks=r.callbacks.filter(e=>e!==n),r.callbacks.length||(r.cancel(),delete this.entries[e]))}}},e.aJ=function(e,t,i){const n=JSON.stringify(e.request);return e.data&&(this.deduped.entries[n]={result:[null,e.data]}),this.deduped.request(n,{type:"parseTile",isSymbolTile:e.isSymbolTile,zoom:e.tileZoom},t=>{const n=zt(e.request,(e,n,r,s)=>{e?t(e):n&&t(null,{vectorTile:i?void 0:new uh(new Yg(n)),rawData:n,cacheControl:r,expires:s})});return()=>{n.cancel(),t()}},t)},e.aK=function(e){Tt++,Tt>yt&&(e.getActor().send("enforceCacheSizeLimit",_t),Tt=0)},e.aL=function(e){return e<=1?1:Math.pow(2,Math.floor(Math.log(e)/Math.LN2))},e.aM=od,e.aN=pv,e.aO=xv,e.aP=uv,e.aQ=function(e,t){const i=document.createElement("video");i.muted=!0,i.onloadstart=function(){t(null,i)};for(let t=0;t{}}},e.aR=tm,e.aS=function(e){return fetch(e).then(e=>e.arrayBuffer()).then(t=>Jp(t,0,e))},e.aT=Rm,e.aU=class{constructor(e,t,i,n){this.id=e,this.position=null!=t?new Fc(t[0],t[1]):new Fc(0,0),this.orientation=null!=i?i:[0,0,0],this.nodes=n,this.uploaded=!1,this.aabb=new Dh([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),this.matrix=[]}_applyTransformations(e,t){if(h(e.matrix,t,e.matrix),e.meshes)for(const t of e.meshes){const i=Dh.applyTransformFast(t.aabb,e.matrix);this.aabb.encapsulate(i)}if(e.children)for(const t of e.children)this._applyTransformations(t,e.matrix)}computeBoundsAndApplyParent(){const e=l([]);for(const t of this.nodes)this._applyTransformations(t,e)}computeModelMatrix(e,t,i,n,r,s,o=!1){bm(this.matrix,this,e.transform,this.position,t,i,n,r,s,o)}upload(e){if(!this.uploaded){for(const t of this.nodes)Tm(t,e);for(const e of this.nodes)km(e);this.uploaded=!0}}destroy(){for(const e of this.nodes)Mm(e)}},e.aV=Ne,e.aW=yy,e.aX=Vc,e.aY=Wc,e.aZ=Ka,e.a_=_l,e.aa=da,e.ab=Os,e.ac=Jc,e.ad=Y,e.ae=w,e.af=Ee,e.ag=va,e.ah=Id,e.ai=ci,e.aj=Rn,e.ak=hi,e.al=Te,e.am=si,e.an=class{constructor(e){this.specification=e}possiblyEvaluate(e,t){return function([e,t]){const i=Ge([1,e,t]);return{x:i.x,y:i.y,z:i.z}}(e.expression.evaluate(t))}interpolate(e,t,i){return{x:ci(e.x,t.x,i),y:ci(e.y,t.y,i),z:ci(e.z,t.z,i)}}},e.ao=function(e,t,i=0,n=!0){const r=new xe(i,i),s=e.sub(r),o=t.add(r),a=[s,new xe(o.x,s.y),o,new xe(s.x,o.y)];return n&&a.push(s.clone()),a},e.ap=function(e,t){const i=[];for(let n=0;n0&&i[0]<=e.width&&i[1]>0&&i[1]<=e.height&&!Rd(e,new Fc(e.center.lat,90)),n[0]>0&&n[0]<=e.width&&n[1]>0&&n[1]<=e.height&&!Rd(e,new Fc(e.center.lat,-90))]},e.cK=function(e,t){const{scale:i}=e.tileTransform,n=i*Rn/(e.tileSize*Math.pow(2,t.zoom-e.tileID.overscaledZ+e.tileID.canonical.z));return function(e,t,i){var n=t[1],r=t[2],s=t[3],o=i[0],a=i[1];return e[0]=t[0]*o,e[1]=n*o,e[2]=r*a,e[3]=s*a,e}(new Float32Array(4),t.inverseAdjustmentMatrix,[n,n])},e.cL=dm,e.cM=v,e.cN=cm,e.cO=function(e){const t=cm(e,!0);return n([],[t[0],t[1],t[4],t[5]])},e.cP=u,e.cQ=Sh,e.cR=f,e.cS=function(e){const{x:t,y:i}=e.point,{lng:n,lat:r}=e._center;return Ed(t,i,e.worldSize,n,r)},e.cT=A,e.cU=ke,e.cV=ad,e.cW=Xh,e.cX=5,e.cY=function(e,t,i){let n=0;for(let i=0;i<2;++i){const r=0;e[i]>r&&(n+=(e[i]-r)*(e[i]-r)),t[i]{const h=e.transform,d=h.calculatePixelsToTileUnitsMatrix(t),u="none"===i.paint.get("line-trim-color-use-theme").constantOr("default"),f=h.pitch<15?dg(.07,.7,Le((14-h.zoom)/5,0,1)):.07;return{u_matrix:fg(e,t,i,n),u_pixels_to_tile_units:d,u_device_pixel_ratio:s,u_width_scale:o,u_floor_width_scale:a,u_units_to_pixels:[1/h.pixelsToGLUnits[0],1/h.pixelsToGLUnits[1]],u_dash_image:0,u_gradient_image:1,u_image_height:r,u_texsize:mg(i)&&t.lineAtlasTexture?t.lineAtlasTexture.size:[0,0],u_tile_units_to_pixels:ug(t,e.transform),u_alpha_discard_threshold:0,u_trim_offset:l,u_trim_fade_range:i.paint.get("line-trim-fade-range"),u_trim_color:i.paint.get("line-trim-color").toPremultipliedRenderColor(u?null:i.lut).toArray01(),u_emissive_strength:i.paint.get("line-emissive-strength"),u_zbias_factor:f,u_tile_to_meter:Zc(t.tileID.canonical,0),u_ground_shadow_factor:c}},e.d0=lc,e.d1=function(e,t,i){const n=Math.sqrt(e*e+t*t+i*i),r=n>0?Math.acos(i/n)*Se:0;let s=0!==e||0!==t?Math.atan2(-t,-e)*Se+90:0;return s<0&&(s+=360),[n,s,r]},e.d2=S,e.d3=Ge,e.d4=Zc,e.d5=k,e.d6=Dh,e.d7=M,e.d8=function(e){return[Math.pow(e[0],1/2.2),Math.pow(e[1],1/2.2),Math.pow(e[2],1/2.2)]},e.d9=kv,e.dA=wd,e.dB=function(e){const t=$c-5;e=Le(e,-t,t)/t*90;const i=Math.pow(Math.abs(Math.sin(Te(e))),3);return Math.round(i*(Lc.length-1))},e.dC=function(e,t,i,n){const r=t.getNorth(),s=t.getSouth(),a=t.getWest(),l=t.getEast(),c=1<0){const e=180/n;o(p,p,[e/h+1,0,0,0,e/d+1,0,-.5*e/u,.5*e/f,1])}return p[2]=c,p[5]=e.x,p[8]=e.y,p},e.dD=yd,e.dE=function(e,t,i){const n=l(new Float64Array(16)),r=(t/(1<1)return!1;const i=t.getSource().maxzoom,n=1<1)return t;const r=n.getSource().maxzoom,s=1<{const s=this.getAtTileOffset(e,r.x,r.y),o=n.upVector(e.canonical,r.x,r.y);return L(o,o,s*n.upVectorScale(e.canonical,t,i).metersToTile),o}}getForTilePoints(e,t,i,n){if(this.isUsingMockSource())return!1;const r=Ev.create(this,e,n);return!!r&&(t.forEach(e=>{e[2]=this.exaggeration()*r.getElevationAt(e[0],e[1],i)}),!0)}getMinMaxForTile(e){if(this.isUsingMockSource())return null;const t=this.findDEMTileFor(e);if(!t||!t.dem)return null;const i=t.dem.tree,n=t.tileID,r=1<({u_matrix:new dc(e),u_texsize:new oc(e),u_pixels_to_tile_units:new pc(e),u_device_pixel_ratio:new sc(e),u_width_scale:new sc(e),u_floor_width_scale:new sc(e),u_image:new rc(e),u_units_to_pixels:new oc(e),u_tile_units_to_pixels:new sc(e),u_alpha_discard_threshold:new sc(e),u_trim_offset:new oc(e),u_trim_fade_range:new oc(e),u_trim_color:new lc(e),u_emissive_strength:new sc(e),u_zbias_factor:new sc(e),u_tile_to_meter:new sc(e),u_ground_shadow_factor:new ac(e),u_pattern_transition:new sc(e)}),e.dS=e=>({u_matrix:new dc(e),u_pixels_to_tile_units:new pc(e),u_device_pixel_ratio:new sc(e),u_width_scale:new sc(e),u_floor_width_scale:new sc(e),u_units_to_pixels:new oc(e),u_dash_image:new rc(e),u_gradient_image:new rc(e),u_image_height:new sc(e),u_texsize:new oc(e),u_tile_units_to_pixels:new sc(e),u_alpha_discard_threshold:new sc(e),u_trim_offset:new oc(e),u_trim_fade_range:new oc(e),u_trim_color:new lc(e),u_emissive_strength:new sc(e),u_zbias_factor:new sc(e),u_tile_to_meter:new sc(e),u_ground_shadow_factor:new ac(e)}),e.dT=e=>({u_camera_to_center_distance:new sc(e),u_extrude_scale:new pc(e),u_device_pixel_ratio:new sc(e),u_matrix:new dc(e),u_inv_rot_matrix:new dc(e),u_merc_center:new oc(e),u_tile_id:new ac(e),u_zoom_transition:new sc(e),u_up_dir:new ac(e),u_emissive_strength:new sc(e)}),e.dU=ml,e.dV=Lg,e.dW=Yd,e.dX=(e,t,i,n,r,s)=>{const o=e.transform,a="globe"===o.projection.name;let l;if("map"===s.paint.get("circle-pitch-alignment"))if(a){const e=Ld(o.zoom,t.canonical)*o._pixelsPerMercatorPixel;l=Float32Array.from([e,0,0,e])}else l=o.calculatePixelsToTileUnitsMatrix(i);else l=new Float32Array([o.pixelsToGLUnits[0],0,0,o.pixelsToGLUnits[1]]);const c={u_camera_to_center_distance:e.transform.getCameraToCenterDistance(o.projection),u_matrix:e.translatePosMatrix(t.projMatrix,i,s.paint.get("circle-translate"),s.paint.get("circle-translate-anchor")),u_device_pixel_ratio:ft.devicePixelRatio,u_extrude_scale:l,u_inv_rot_matrix:Nd,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0],u_emissive_strength:s.paint.get("circle-emissive-strength")};if(a){c.u_inv_rot_matrix=n,c.u_merc_center=r,c.u_tile_id=[t.canonical.x,t.canonical.y,1<{const h=e.transform,d=h.pitch<15?dg(.07,.7,Le((14-h.zoom)/5,0,1)):.07,u="none"===i.paint.get("line-trim-color-use-theme").constantOr("default");return{u_matrix:fg(e,t,i,n),u_texsize:t.imageAtlasTexture?t.imageAtlasTexture.size:[0,0],u_pixels_to_tile_units:h.calculatePixelsToTileUnitsMatrix(t),u_device_pixel_ratio:r,u_width_scale:s,u_floor_width_scale:o,u_image:0,u_tile_units_to_pixels:ug(t,h),u_units_to_pixels:[1/h.pixelsToGLUnits[0],1/h.pixelsToGLUnits[1]],u_alpha_discard_threshold:0,u_trim_offset:a,u_trim_fade_range:i.paint.get("line-trim-fade-range"),u_trim_color:i.paint.get("line-trim-color").toPremultipliedRenderColor(u?null:i.lut).toArray01(),u_emissive_strength:i.paint.get("line-emissive-strength"),u_zbias_factor:d,u_tile_to_meter:Zc(t.tileID.canonical,0),u_ground_shadow_factor:l,u_pattern_transition:c}},e.da=function(e,t){return e.readFields(lx,{icons:[]},t)},e.db=Tp,e.dc=Y_,e.dd=N_,e.de=Rt,e.df=sa,e.dg=mt,e.dh=qt,e.di=He,e.dj=function(e){const t=e.indexOf(Ba);return t>=0?e.slice(0,t):e},e.dk=function(e){return e.indexOf(Ba)>=0},e.dl=function(e){const t=e.lastIndexOf(Ba);return t>=0?e.slice(t+1):""},e.dm=function(e){const t=[],i=e.id;return void 0===i&&t.push({message:`layers.${i}: missing required property "id"`}),void 0===e.render&&t.push({message:`layers.${i}: missing required method "render"`}),e.renderingMode&&"2d"!==e.renderingMode&&"3d"!==e.renderingMode&&t.push({message:`layers.${i}: property "renderingMode" must be either "2d" or "3d"`}),t},e.dn=function(e,t,i,n){return"custom"===e.type?new bv(e,t):new Wv[e.type](e,t,i,n)},e.dp=Be,e.dq=function(e){const t=e.indexOf(Ba);return t>=0?e.slice(t+1):""},e.dr=class extends tw{constructor(e,t){super(e._vectorTileFeature,e._z,e._x,e._y,e.id),e.state&&(this.state=Object.assign({},e.state)),this.target=t.target,this.namespace=t.namespace,t.properties&&(this.properties=t.properties),this.target&&("featuresetId"in this.target&&!this.target.importId||"layerId"in this.target)&&(this.source=e.source,this.sourceLayer=e.sourceLayer,this.layer=e.layer)}toJSON(){const e=super.toJSON();return e.target=this.target,e.namespace=this.namespace,e}},e.ds=aa,e.dt=Ot,e.du=function(e){return e({pluginStatus:na,pluginURL:ra}),aa.on("pluginStateChange",e),e},e.dv=cc,e.dw=class extends nc{constructor(e){super(e),this.current=uc}set(e,t,i){if(this.fetchUniformLocation(e,t))for(let e=0;e<9;e++)if(i[e]!==this.current[e]){this.current=i,this.gl.uniformMatrix3fv(this.location,!1,i);break}}},e.dx=Ae,e.dy=function(e,t,i){const n=Id(i.zoom),r=e.style.map._antialias,s=e.terrain&&e.terrain.exaggeration()>0;return 0===n&&!r&&!s},e.dz=function(e){const t=e.pixelsPerMeter,i=t/jc(1,e.center.lat),n=l(new Float64Array(16));return d(n,n,[e.point.x,e.point.y,0]),u(n,n,[i,i,t]),Float32Array.from(n)},e.e=nt,e.e$=la,e.e0=Fe,e.e1=iu,e.e2=Uc,e.e3=ld,e.e4=$f,e.e5=ep,e.e6=Rf,e.e7=450,e.e8=7,e.e9=Xc,e.eA=function(e,t,n,r,s,o,a,l,c,h,d,u,f,p,m,g){var _=new i(16);return _[0]=e,_[1]=t,_[2]=n,_[3]=r,_[4]=s,_[5]=o,_[6]=a,_[7]=l,_[8]=c,_[9]=h,_[10]=d,_[11]=u,_[12]=f,_[13]=p,_[14]=m,_[15]=g,_},e.eB=Oc,e.eC=Tl,e.eD=Sl,e.eE=class{constructor(){this._updateTime=0,this._sourceIds=[],this._activeRegions=[],this._prevRegions=[],this._globalClipBounds={min:new xe(1/0,1/0),max:new xe(-1/0,-1/0)}}clear(){this._activeRegions.length>0&&++this._updateTime,this._activeRegions=[],this._prevRegions=[]}get updateTime(){return this._updateTime}getReplacementRegionsForTile(e,t=!1){const i=xf(new xe(0,0),new xe(Rn,Rn),e),n=[];if(t&&!yf(i,this._globalClipBounds))return n;for(const t of this._activeRegions){if(t.hiddenByOverlap)continue;if(!yf(i,t))continue;const r=bf(t.min,t.max,e);n.push({min:r.min,max:r.max,sourceId:this._sourceIds[t.priority],footprint:t.footprint,footprintTileId:t.tileId,order:t.order,clipMask:t.clipMask,clipScope:t.clipScope})}return n}setSources(e){this._setSources(e.map(e=>({getSourceId:()=>e.cache.id,getFootprints:()=>{const t=[];for(const i of e.cache.getVisibleCoordinates()){const n=e.cache.getTile(i).buckets[e.layer];n&&n.updateFootprints(i.toUnwrapped(),t)}return t},getOrder:()=>e.order,getClipMask:()=>e.clipMask,getClipScope:()=>e.clipScope})))}_addSource(e){const t=e.getFootprints();if(0===t.length)return;const i=e.getOrder(),n=e.getClipMask(),r=e.getClipScope();for(const e of t){if(!e.footprint)continue;const t=xf(e.footprint.min,e.footprint.max,e.id);this._activeRegions.push({min:t.min,max:t.max,hiddenByOverlap:!1,priority:this._sourceIds.length,tileId:e.id,footprint:e.footprint,order:i,clipMask:n,clipScope:r})}this._sourceIds.push(e.getSourceId())}_computeReplacement(){this._activeRegions.sort((e,t)=>e.priority-t.priority||gf(e.min,t.min)||gf(e.max,t.max)||e.order-t.order||e.clipMask-t.clipMask||function(e,t){const i=(e,t)=>e+t;return e.length-t.length||e.reduce(i,"").localeCompare(t.reduce(i,""))}(e.clipScope,t.clipScope));let e=this._activeRegions.length!==this._prevRegions.length;if(!e){let t=0;for(;!e&&t!==this._activeRegions.length;){const i=this._activeRegions[t],n=this._prevRegions[t];e=i.priority!==n.priority||!_f(i,n)||i.order!==n.order||i.clipMask!==n.clipMask||!be(i.clipScope,n.clipScope),++t}}if(e){++this._updateTime;for(const e of this._activeRegions)e.order!==ff&&(this._globalClipBounds.min.x=Math.min(this._globalClipBounds.min.x,e.min.x),this._globalClipBounds.min.y=Math.min(this._globalClipBounds.min.y,e.min.y),this._globalClipBounds.max.x=Math.max(this._globalClipBounds.max.x,e.max.x),this._globalClipBounds.max.y=Math.max(this._globalClipBounds.max.y,e.max.y));const e=e=>{const t=this._activeRegions;if(e>=t.length)return e;const i=t[e].priority;for(;e1){let t=0,i=e(t);for(;t!==i;){let n=t;const r=t;for(;n!==i;){const e=this._activeRegions[n];e.hiddenByOverlap=!1;for(let t=0;t=0;t--)this._addSource(e[t]);this._computeReplacement()}},e.eF=ff,e.eG=class{constructor(e){this._createGrid(e),this._createPoles(e)}destroy(){this._poleIndexBuffer.destroy(),this._gridBuffer.destroy(),this._gridIndexBuffer.destroy(),this._poleNorthVertexBuffer.destroy(),this._poleSouthVertexBuffer.destroy();for(const e of this._poleSegments)e.destroy();for(const e of this._gridSegments)e.withSkirts.destroy(),e.withoutSkirts.destroy()}_fillGridMeshWithLods(e,t){const i=new Za,n=new _l,r=[],s=e+1+2,o=t[0]+1,a=t[0]+1+(1+t.length),l=(e,t,i)=>{let n=e===s-1?e-2:0===e?e:e-1;return n+=i?24575:0,[n,t]};for(let e=0;eString.fromCharCode(Number("0x"+t))))},e.f0=function(e,t,i=!1){if(na===ta.deferred||na===ta.loading||na===ta.loaded)throw new Error("setRTLTextPlugin cannot be called multiple times.");ra=ft.resolveURL(e),na=ta.deferred,ia=t,oa(),i||ca()},e.f1=function(e){Dp=ft.resolveURL(e),Ep||(Ep=new bp(Tp(),new ei)),Ep.broadcast("setMeshoptUrl",Dp)},e.f2=zp,e.f3=function(e){Ap=ft.resolveURL(e),Ep||(Ep=new bp(Tp(),new ei)),Ep.broadcast("setDracoUrl",Ap)},e.f4=Op,e.f5=yp,e.f6=function(e){const t=wt();if(!t)return;const i=t.delete(gt);e&&i.then(()=>e()).catch(e)},e.f7=xp,e.f8=Ws,e.f9=Qd,e.fa=2,e.fb=Qb,e.fc=iw,e.fd=ig,e.fe=ph,e.ff="hd_road_elevation",e.fg=Ih,e.fh=Ye,e.fi=Yu,e.fj=P_,e.fk=1,e.fl=function(e,t,i,n,r,s,o,a=1,l,c,h){e.createArrays(),e.tilePixelRatio=Rn/(512*e.overscaling),e.compareText={},e.iconsNeedLinear=!1;const d=e.layers[0].layout,u=e.layers[0]._unevaluatedLayout._values,f={};f.scaleFactor=a,f.textSizeScaleRange=d.get("text-size-scale-range"),f.iconSizeScaleRange=d.get("icon-size-scale-range");const[p,m]=f.textSizeScaleRange,[g,_]=f.iconSizeScaleRange;f.textScaleFactor=Le(f.scaleFactor,p,m),f.iconScaleFactor=Le(f.scaleFactor,g,_);const y=u["text-size"],v=u["icon-size"];if("composite"===e.textSizeData.kind){const{minZoom:t,maxZoom:i}=e.textSizeData;f.compositeTextSizes=[y.possiblyEvaluate(new da(t,{worldview:h}),s),y.possiblyEvaluate(new da(i,{worldview:h}),s)]}if("composite"===e.iconSizeData.kind){const{minZoom:t,maxZoom:i}=e.iconSizeData;f.compositeIconSizes=[v.possiblyEvaluate(new da(t,{worldview:h}),s),v.possiblyEvaluate(new da(i,{worldview:h}),s)]}f.layoutTextSize=y.possiblyEvaluate(new da(o+1,{worldview:h}),s),f.layoutIconSize=v.possiblyEvaluate(new da(o+1,{worldview:h}),s),f.textMaxSize=y.possiblyEvaluate(new da(18,{worldview:h}),s);const x=d.get("symbol-placement"),b="map"===d.get("text-rotation-alignment")&&"point"!==x,w=d.get("text-size");let S=!1;const T=[];for(const o of e.features){const a=d.get("text-font").evaluate(o,{},s).join(","),p=w.evaluate(o,{},s)*f.textScaleFactor,m=f.layoutTextSize.evaluate(o,{},s)*f.textScaleFactor,g=f.layoutIconSize.evaluate(o,{},s)*f.iconScaleFactor,_={horizontal:{},vertical:void 0},y=o.text;let v,k=[0,0];if(y){const n=y.toString(),c=d.get("text-letter-spacing").evaluate(o,{},s)*Eg,h=d.get("text-line-height").evaluate(o,{},s)*Eg,u=Go(n)?c:0,f=d.get("text-anchor").evaluate(o,{},s),g=d.get("text-variable-anchor");if(!g){const e=d.get("text-radial-offset").evaluate(o,{},s);if(e)k=Q_(f,[e*Eg,J_]);else{const e=d.get("text-offset").evaluate(o,{},s);k=[e[0]*Eg,e[1]*Eg]}}let v=b?"center":d.get("text-justify").evaluate(o,{},s);const w="point"===x,S=w?d.get("text-max-width").evaluate(o,{},s)*Eg:1/0,T=s=>{e.allowVerticalPlacement&&$o(n)&&(_.vertical=n_(y,t,i,r,a,S,h,f,s,u,k,e_.vertical,!0,m,p,l))};if(!b&&g){const e="auto"===v?g.map(e=>ay(e)):[v];let n=!1;for(let s=0;s=0||!$o(n)){const e=n_(y,t,i,r,a,S,h,f,v,u,k,e_.horizontal,!1,m,p,l);e&&(_.horizontal[v]=e)}T(w?"left":v)}}let M,A,C,D,L,E,I=!1;const P=d.get("icon-text-fit").evaluate(o,{},s);if(o.icon&&o.icon.hasPrimary()){const t=iy(o.icon,e.iconSizeData,u["icon-size"],s,e.zoom,o,l,f.iconScaleFactor,h);M=t.iconPrimary,C=t.iconSecondary;const i=M.toString();if(A=n.get(i),A&&(L=d.get("icon-offset").evaluate(o,{},s),E=d.get("icon-anchor").evaluate(o,{},s),v=p_(r.get(i),C?r.get(C.toString()):void 0,L,E),I=A.sdf,void 0===e.sdfIcons?e.sdfIcons=A.sdf:e.sdfIcons!==A.sdf&&We("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(A.pixelRatio!==e.pixelRatio||0!==d.get("icon-rotate").constantOr(1))&&(e.iconsNeedLinear=!0)),C){const e=C.toString();D=n.get(e)}}S=S||!(!o.icon||!o.icon.hasSecondary());const R=fy(_.horizontal)||_.vertical;e.iconsInText||(e.iconsInText=!!R&&R.iconsInText);const O=m*f.textScaleFactor/Eg,{defaultShapedIcon:z,verticallyShapedIcon:F}=ly(e,v,d,o,s,_,O,L,P);"none"!==P&&v&&(g_(v)||__(v))&&(ey(0,A,M,v,z,P,c,n,r),ey(0,D,C,v,z,P,c,n,r),F&&(ey(0,A,M,v,F,P,c,n,r),ey(0,D,C,v,F,P,c,n,r))),v=z,T.push({feature:o,shapedTextOrientations:_,shapedText:R,shapedIcon:v,iconPrimary:M,iconSecondary:C,iconOffset:L,iconAnchor:E,verticallyShapedIcon:F,layoutTextSize:m,layoutIconSize:g,textOffset:k,isSDFIcon:I,iconTextFit:P})}return{featureData:T,sizes:f,hasAnySecondaryIcon:S,textAlongLine:b,symbolPlacement:x}},e.fm=R_,e.fn=function(e,t,i,n,r,s,o,a,l,c){const{featureData:h,hasAnySecondaryIcon:d,sizes:u,textAlongLine:f,symbolPlacement:p}=t;for(const t of h){const{shapedIcon:i,verticallyShapedIcon:s,feature:h,shapedTextOrientations:m,shapedText:g,layoutTextSize:_,textOffset:y,isSDFIcon:v,iconPrimary:x,iconSecondary:b,iconTextFit:w,iconOffset:S}=t;ry(i,c.iconPositions,x,b),ry(s,c.iconPositions,x,b),sy(m,c.iconPositions),ny(x,b,c.iconPositions),(g||i)&&cy(e,h,m,i,s,l,u,_,0,y,v,n,r,o,a,d,w,S,f,p)}i&&e.generateCollisionDebugBuffers(s,e.collisionBoxArray,u.textScaleFactor)},e.fo=uh,e.fp=ob,e.fq=ah,e.fr=function(e){let t=0;if(new Uint32Array(e,0,1)[0]!==Up){const i=new Uint32Array(e,0,7),[,,n,r,s,o]=i;t=i.byteLength+r+s+o+s,(n!==e.byteLength||t>=e.byteLength)&&We("Invalid b3dm header information.")}return Jp(e,t)},e.fs=function(e,t){const i=Rm(e);for(const e of i){for(const t of e.meshes)Om(t);e.lights&&(e.lightMeshIndex=e.meshes.length,e.meshes.push(Fm(e.lights,t)))}return i},e.ft=Nv,e.fu=Xe,e.fv=_p,e.fw=ha,e.fx=ta,e.fy=function(e){St(),null!=xt&&xt.then(t=>{t.keys().then(i=>{for(let n=0;nWe(e.message))}).catch(e=>We(e.message))}).catch(e=>We(e.message))},e.g=function(e,t){return Ot(Re(e,{method:"GET"}),t)},e.h=Re,e.i=function(e){return nt.API_STYLE_REGEX.test(e)&&!st(e)},e.j=function(e){return 0===e.indexOf("mapbox:")},e.k=rt,e.l=kt,e.m=function(e){return decodeURIComponent(atob(e).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join(""))},e.n=function(e,t){return Ot(Re(e,{type:"json"}),t)},e.o=Ht,e.p=function(e,t){return Ot(Re(e,{method:"POST"}),t)},e.q=ft,e.r=eu,e.s=function(e){try{const t=self[e];return t.setItem("_mapbox_test_",1),t.removeItem("_mapbox_test_"),!0}catch(e){return!1}},e.t=ut,e.u=function(){return function e(t){return t?(t^Math.random()*(16>>t/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,e)}()},e.v=function(e){return!!e&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e)},e.w=We,e.x=function(){return Sp||(Sp=new xp),Sp},e.y=Xx,e.z=Jt}),n(0,function(e){function t(e){const t=e?e.url.toString():void 0;return t?performance.getEntriesByName(t):[]}function i(e){if("number"==typeof e||"boolean"==typeof e||"string"==typeof e||null==e)return JSON.stringify(e);if(Array.isArray(e)){let t="[";for(const n of e)t+=`${i(n)},`;return`${t}]`}let t="{";for(const n of Object.keys(e).sort())t+=`${n}:${i(e[n])},`;return`${t}}`}function n(t){let n="";for(const r of e.bu)n+=`/${i(t[r])}`;return n}class r{constructor(e){this.keyCache={},this._layers={},this._layerConfigs={},e&&this.replace(e)}replace(e,t){this._layerConfigs={},this._layers={},this.update(e,[],t)}update(t,r,s){this._options=s;for(const i of t)this._layerConfigs[i.id]=i,(this._layers[i.id]=e.dn(i,this.scope,null,this._options)).compileFilter(s),this.keyCache[i.id]&&delete this.keyCache[i.id];for(const e of r)delete this.keyCache[e],delete this._layerConfigs[e],delete this._layers[e];this.familiesBySource={};const o=function(e,t){const r={};for(let s=0;sthis._layers[e.id]),i=t[0];if("none"===i.visibility)continue;const n=i.source||"";let r=this.familiesBySource[n];r||(r=this.familiesBySource[n]={});const s=i.sourceLayer||"_geojsonTileLayer";let o=r[s];o||(o=r[s]=[]),o.push(t)}}}const s=1*e.fa;class o{constructor(t){const i={},n=[];for(const e in t){const r=t[e],o=i[e]={};for(const e in r.glyphs){const t=r.glyphs[+e];if(!t||0===t.bitmap.width||0===t.bitmap.height)continue;const i=t.metrics.localGlyph?s:1,a={x:0,y:0,w:t.bitmap.width+2*i,h:t.bitmap.height+2*i};n.push(a),o[e]=a}}const{w:r,h:o}=e.H(n),a=new e.f9({width:r||1,height:o||1});for(const n in t){const r=t[n];for(const t in r.glyphs){const o=r.glyphs[+t];if(!o||0===o.bitmap.width||0===o.bitmap.height)continue;const l=i[n][t],c=o.metrics.localGlyph?s:1;e.f9.copy(o.bitmap,a,{x:0,y:0},{x:l.x+c,y:l.y+c},o.bitmap)}}this.image=a,this.positions=i}}e.f8(o,"GlyphAtlas");class a{constructor(t){this.tileID=new e.aM(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.lut=t.lut,this.canonical=t.tileID.canonical,this.pixelRatio=t.pixelRatio,this.tileSize=t.tileSize,this.source=t.source,this.scope=t.scope,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=t.showCollisionBoxes,this.collectResourceTiming=!!t.request&&t.request.collectResourceTiming,this.promoteId=t.promoteId,this.isSymbolTile=t.isSymbolTile,this.tileTransform=e.aW(t.tileID.canonical,t.projection),this.projection=t.projection,this.worldview=t.worldview,this.localizableLayerIds=t.localizableLayerIds,this.brightness=t.brightness,this.extraShadowCaster=!!t.extraShadowCaster,this.tessellationStep=t.tessellationStep,this.scaleFactor=t.scaleFactor,this.worldview=t.worldview}parse(t,i,n,r,s,a){this.status="parsing",this.data=t,this.collisionBoxArray=new e.b0;const c=new e.fb(Object.keys(t.layers).sort()),h=new e.fc(this.tileID,this.promoteId);h.bucketLayerIDs=[];const d={},u=new e.fd(256,256),f={featureIndex:h,iconDependencies:new Map,patternDependencies:new Map,glyphDependencies:{},lineAtlas:u,availableImages:n,brightness:this.brightness,scaleFactor:this.scaleFactor,elevationFeatures:void 0},p=[],m=i.familiesBySource[this.source];for(const i in m){const s=t.layers[i];if(!s)continue;let o=!1,a=!1,u=!1;for(const e of m[i])"symbol"===e[0].type?o=!0:a=!0,e[0].is3D()&&"model"!==e[0].type&&(u=!0);if(this.extraShadowCaster&&!u)continue;if(!0===this.isSymbolTile&&!o)continue;if(!1===this.isSymbolTile&&!a)continue;1===s.version&&e.w(`Vector tile source "${this.source}" layer "${i}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const g=c.encode(i),_=[];let y=!1;for(let t=0,n=0;t=i.maxzoom)continue;if("none"===i.visibility)continue;l(t,this.zoom,f.brightness,n,this.worldview);const s=d[i.id]=i.createBucket({index:h.bucketLayerIDs.length,layers:t,zoom:this.zoom,lut:this.lut,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:g,sourceID:this.source,projection:this.projection.spec,tessellationStep:this.tessellationStep,styleDefinedModelURLs:r,worldview:this.worldview});h.bucketLayerIDs.push(t.map(t=>e.C(t.id,t.scope)));let o=s.prepare?s.prepare():null;null!=o?(o=o.then(()=>s.populate(_,f,this.tileID.canonical,this.tileTransform)),p.push(o)):s.populate(_,f,this.tileID.canonical,this.tileTransform)}}const g=()=>{let i,r,p,m,g,_;u.trim();const y={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},v=()=>{if(i)return this.status="done",a(i);if(this.extraShadowCaster)this.status="done",a(null,{buckets:Object.values(d).filter(e=>!e.isEmpty()),featureIndex:h,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:f.brightness,glyphMap:null,iconMap:null,glyphPositions:null});else if(r&&p&&m){const t=new o(r),i=new Map;for(const[t,n]of p.entries()){const{imagePosition:r}=e.fj(t,n,e.fk);i.set(t,r)}const a={};for(const s in d){const o=d[s];o instanceof e.b1&&(l(o.layers,this.zoom,f.brightness,n,this.worldview),a[s]=e.fl(o,r,t.positions,p,i,this.tileID.canonical,this.tileZoom,this.scaleFactor,this.pixelRatio,g,this.worldview))}const c={iconsPending:!0,patternsPending:!0};this.rasterizeIfNeeded(s,p,g,()=>{c.iconsPending=!1,x(a,t,c)}),this.rasterizeIfNeeded(s,m,_,()=>{c.patternsPending=!1,x(a,t,c)})}},x=(t,i,r,s)=>{if(r.iconsPending||r.patternsPending)return;const o=new e.fm(p,m,this.lut);for(const i in d){const r=d[i];if(i in t)e.fn(r,t[i],this.showCollisionBoxes,n,this.tileID.canonical,this.tileZoom,this.projection,this.brightness,p,o);else if(r.hasPattern&&(r instanceof e.b7||r instanceof e.b8||r instanceof e.e4)){l(r.layers,this.zoom,f.brightness,n,this.worldview);const e=Object.fromEntries(o.patternPositions);r.addFeatures(f,this.tileID.canonical,e,n,this.tileTransform,this.brightness)}}this.status="done",a(null,{buckets:Object.values(d).filter(e=>!e.isEmpty()),featureIndex:h,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:i.image,lineAtlas:u,imageAtlas:o,brightness:f.brightness})};if(!this.extraShadowCaster){const t=e.fh(f.glyphDependencies,e=>Object.keys(e).map(Number));Object.keys(t).length?s.send("getGlyphs",{uid:this.uid,stacks:t},(e,t)=>{i||(i=e,r=t,v())},void 0,!1,y):r={};const n=Array.from(f.iconDependencies.keys()).map(t=>e.I.parse(t));n.length?s.send("getImages",{images:n,source:this.source,scope:this.scope,tileID:this.tileID,type:"icons"},(e,t)=>{i||(i=e,p=new Map,g=this.updateImageMapAndGetImageTaskQueue(p,t,f.iconDependencies),v())},void 0,!1,y):(p=new Map,g=new Map);const o=Array.from(f.patternDependencies.keys()).map(t=>e.I.parse(t));o.length?s.send("getImages",{images:o,source:this.source,scope:this.scope,tileID:this.tileID,type:"patterns"},(e,t)=>{i||(i=e,m=new Map,_=this.updateImageMapAndGetImageTaskQueue(m,t,f.patternDependencies),v())},void 0,!1,y):(m=new Map,_=new Map)}if(f.elevationFeatures&&f.elevationFeatures.length>0){const i=[];for(const t of Object.values(d))if(t instanceof e.b8){const e=t.getUnevaluatedPortalGraph();e&&i.push(e)}const n=e.fi.evaluate(i);for(const i of Object.values(d))if(i instanceof e.b8){const e=t.layers[c.decode(i.sourceLayerIndex)];i.setEvaluatedPortalGraph(n,e,this.tileID.canonical,f.availableImages,f.brightness)}}v()};p.length>0?Promise.allSettled(p).then(g).catch(a):g()}rasterizeIfNeeded(e,t,i,n){Array.from(t.values()).some(e=>e.usvg)?this.rasterize(e,t,i,n):n()}updateImageMapAndGetImageTaskQueue(e,t,i){const n=new Map;for(const r of t.keys()){const s=i.get(r)||[];for(const i of s){const r=i.toString(),s=t.get(i.id.toString());s.usvg?n.has(r)||(n.set(r,i),e.set(r,Object.assign({},s))):e.set(r,s)}}return n}rasterize(e,t,i,n){this.rasterizeTask=e.send("rasterizeImages",{scope:this.scope,tasks:i},(e,i)=>{if(!e)for(const[e,n]of i.entries()){const i=Object.assign(t.get(e),{data:n});t.set(e,i)}n()})}cancelRasterize(){this.rasterizeTask&&this.rasterizeTask.cancel()}}function l(t,i,n,r,s){const o=new e.aa(i,{brightness:n,worldview:s});for(const e of t)e.recalculate(o,r)}class c extends e.E{constructor(t,i,n,r,s,o,a){super(),this.actor=t,this.layerIndex=i,this.availableImages=n,this.availableModels=r,this.loadVectorData=o||e.aJ,this.loading={},this.loaded={},this.deduped=new e.aI(t.scheduler),this.isSpriteLoaded=s,this.scheduler=t.scheduler,this.brightness=a}loadTile(i,n){const r=i.uid,s=i&&i.request,o=s&&s.collectResourceTiming,l=this.loading[r]=new a(i);l.abort=this.loadVectorData(i,(a,c)=>{const h=!this.loading[r];if(delete this.loading[r],l.cancelRasterize(),h||a||!c)return l.status="done",h||(this.loaded[r]=l),n(a);const d=c.rawData,u={};c.expires&&(u.expires=c.expires),c.cacheControl&&(u.cacheControl=c.cacheControl),l.vectorTile=c.vectorTile||new e.fo(new e.bq(d));const f=()=>{l.parse(l.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,(i,r)=>{if(i||!r)return n(i);const a={};if(o){const e=t(s);e.length>0&&(a.resourceTiming=JSON.parse(JSON.stringify(e)))}n(null,e.h({rawTileData:d.slice(0)},r,u,a))})};this.isSpriteLoaded?f():this.once("isSpriteLoaded",()=>{this.scheduler?this.scheduler.add(f,{type:"parseTile",isSymbolTile:i.isSymbolTile,zoom:i.tileZoom}):f()}),this.loaded=this.loaded||{},this.loaded[r]=l})}reloadTile(t,i){const n=this.loaded,r=t.uid;if(n&&n[r]){const s=n[r];s.scaleFactor=t.scaleFactor,s.showCollisionBoxes=t.showCollisionBoxes,s.projection=t.projection,s.brightness=t.brightness,s.tileTransform=e.aW(t.tileID.canonical,t.projection),s.extraShadowCaster=t.extraShadowCaster,s.lut=t.lut,s.worldview=t.worldview;const o=(e,t)=>{const n=s.reloadCallback;n&&(delete s.reloadCallback,s.parse(s.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,n)),i(e,t)};"parsing"===s.status?s.reloadCallback=o:"done"===s.status&&(s.vectorTile?s.parse(s.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,o):o())}else i(null,void 0)}abortTile(e,t){const i=e.uid,n=this.loading[i];n&&(n.abort&&n.abort(),delete this.loading[i]),t()}removeTile(e,t){const i=this.loaded,n=e.uid;i&&i[n]&&delete i[n],t()}}class h{loadTile(t,i){const{uid:n,encoding:r,rawImageData:s,padding:o}=t,a=ImageBitmap&&s instanceof ImageBitmap?this.getImageData(s,o):s;i(null,new e.fp(n,a,r,o<1))}reloadTile(e,t){t(null,null)}abortTile(e,t){t()}removeTile(e,t){t()}getImageData(e,t){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(e.width,e.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=e.width,this.offscreenCanvas.height=e.height,this.offscreenCanvasContext.drawImage(e,0,0,e.width,e.height);const i=this.offscreenCanvasContext.getImageData(-t,-t,e.width+2*t,e.height+2*t);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),i}}e.bp.setPbf(e.bq);class d{constructor(t){this._mrt=new e.bp(t.partial?30:1/0),this._isHeaderLoaded=!1,this.uid=t.uid,this.tileID=t.tileID,this.source=t.source}parse(t,i){const n=this._mrt;this.status="parsing",this._entireBuffer=t;try{n.parseHeader(t),this._isHeaderLoaded=!0;const r=[];for(const i in n.layers){const s=n.getLayer(i),o=s.getDataRange(s.getBandList()),a=n.createDecodingTask(o),l=t.slice(o.firstByte,o.lastByte+1),c=e.bp.performDecoding(l,a).then(e=>a.complete(null,e)).catch(e=>a.complete(e,null));r.push(c)}Promise.allSettled(r).then(()=>i(null,n)).catch(e=>i(e))}catch(e){i(e)}}}class u{constructor(e){this.actor=e,this.loading={},this.loaded={}}loadTile(t,i){const n=t.uid,r=t.request,s=this.loading[n]=new d(t),{cancel:o}=e.br(r,(e,t,r,o)=>{const a=!this.loading[n];if(delete this.loading[n],a||e||!t)return s.status="done",a||(this.loaded[n]=s),i(e);s.parse(t,(e,t)=>{if(e||!t)return i(e);i(null,t,r,o)}),this.loaded[n]=s});s.abort=o}reloadTile(e,t){t(null,void 0)}abortTile(e,t){const i=e.uid,n=this.loading[i];n&&(n.abort&&n.abort(),delete this.loading[i]),t()}removeTile(e,t){const i=e.uid;this.loaded[i]&&delete this.loaded[i],t()}decodeRasterArray(t,i){e.bp.performDecoding(t.buffer,t.task).then(e=>i(null,e)).catch(e=>i(e))}}const f=e.fq.prototype.toGeoJSON;class p{constructor(t){this._feature=t,this.extent=e.aj,this.type=t.type,this.properties=t.tags,"id"in t&&!isNaN(t.id)&&(this.id=parseInt(t.id,10))}loadGeometry(){if(1===this._feature.type){const t=[];for(const i of this._feature.geometry)t.push([new e.P(i[0],i[1])]);return t}{const t=[];for(const i of this._feature.geometry){const n=[];for(const t of i)n.push(new e.P(t[0],t[1]));t.push(n)}return t}}toGeoJSON(e,t,i){return f.call(this,e,t,i)}}class m{constructor(t,i){this.name=t,this.extent=e.aj,this.length=i.length,this._jsonFeatures=i}feature(e){return new p(this._jsonFeatures[e])}}class g{constructor(t){this.layers={},this.extent=e.aj;for(const e of Object.keys(t))this.layers[e]=new m(e,t[e])}}const _=64/4096;class y{constructor(){this.features=new Map}clear(){this.features.clear()}load(e=[],t){for(const i of e){const e=i.id;if(null==e)continue;let n=this.features.get(e);n&&this.updateCache(n,t),i.geometry?(n=x(i),this.updateCache(n,t),this.features.set(e,n)):this.features.delete(e),this.updateCache(n,t)}}updateCache(e,t){for(const{canonical:i,uid:n}of Object.values(t)){const{z:r,x:s,y:o}=i;v(e,Math.pow(2,r),s,o)&&delete t[n]}}getTile(e,t,i){const n=Math.pow(2,e),r=[];for(const e of this.features.values())v(e,n,t,i)&&r.push(T(e,n,t,i));return{features:r}}getFeatures(){return[...this.features.values()]}}function v({minX:e,minY:t,maxX:i,maxY:n},r,s,o){return e<(s+1+_)/r&&t<(o+1+_)/r&&i>(s-_)/r&&n>(o-_)/r}function x(e){const{id:t,geometry:i,properties:n}=e;if(!i)return;if("GeometryCollection"===i.type)throw new Error("GeometryCollection not supported in dynamic mode.");const{type:r,coordinates:s}=i,o={id:t,type:1,geometry:[],tags:n,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0},a=o.geometry;if("Point"===r)b(s,a,o);else if("MultiPoint"===r)for(const e of s)b(e,a,o);else if("LineString"===r)o.type=2,w(s,a,o);else if("MultiLineString"===r)o.type=2,S(s,a,o);else if("Polygon"===r)o.type=3,S(s,a,o,!0);else{if("MultiPolygon"!==r)throw new Error("Input data is not a valid GeoJSON object.");o.type=3;for(const e of s)S(e,a,o,!0)}return o}function b([t,i],n,r){const s=e.aD(t);let o=e.aH(i);o=o<0?0:o>1?1:o,n.push(s,o),r.minX=Math.min(r.minX,s),r.minY=Math.min(r.minY,o),r.maxX=Math.max(r.maxX,s),r.maxY=Math.max(r.maxY,o)}function w(e,t,i,n=!1,r=!1){const s=[];for(const t of e)b(t,s,i);t.push(s),n&&function(e,t){let i=0;for(let t=0,n=e.length,r=n-2;t0===t)for(let t=0,i=e.length;t=a&&u>=a||(h>=a?(d+=Math.round(m*((a-h)/p)),h=a):u>=a&&(f=d+Math.round(m*((a-h)/p)),u=a),d>=a&&f>=a||(d>=a?(h+=Math.round(p*((a-d)/m)),d=a):f>=a&&(u=h+Math.round(p*((a-d)/m)),f=a),l&&h===l[l.length-1][0]&&d===l[l.length-1][1]||(l=[[h,d]],s.push(l)),l.push([u,f])))))}}function M({name:t,features:i},n){n.writeStringField(1,t),n.writeVarintField(5,e.aj);const r=new Map,s=new Map,o={keys:r,values:s,feature:null};for(const e of i)o.feature=e,n.writeMessage(2,A,o);for(const e of r.keys())n.writeStringField(3,e);for(const e of s.keys())n.writeMessage(4,I,e)}function A(e,t){const i=e.feature;void 0===i.id||isNaN(+i.id)||t.writeVarintField(1,+i.id),i.tags&&t.writeMessage(2,C,e),t.writeVarintField(3,i.type),t.writeMessage(4,E,i)}function C({keys:e,values:t,feature:i},n){for(const r of Object.keys(i.tags)){let s=i.tags[r];if(null===s)continue;let o=e.get(r);void 0===o&&(o=e.size,e.set(r,o)),n.writeVarint(o);const a=typeof s;"string"!==a&&"boolean"!==a&&"number"!==a&&(s=JSON.stringify(s));let l=t.get(s);void 0===l&&(l=t.size,t.set(s,l)),n.writeVarint(l)}}function D(e,t){return(t<<3)+(7&e)}function L(e){return e<<1^e>>31}function E(e,t){const{geometry:i,type:n}=e;let r=0,s=0;if(1===n){t.writeVarint(D(1,i.length));for(const e of i){const i=e[0]-r,n=e[1]-s;t.writeVarint(L(i)),t.writeVarint(L(n)),r+=i,s+=n}}else for(const e of i){t.writeVarint(D(1,1));const i=e.length-(3===n?1:0);for(let n=0;ne},R=Math.fround||(O=new Float32Array(1),e=>(O[0]=+e,O[0]));var O;class z{constructor(e){this.options=Object.assign(Object.create(P),e),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(e){const{log:t,minZoom:i,maxZoom:n}=this.options;t&&console.time("total time");const r=`prepare ${e.length} points`;t&&console.time(r),this.points=e;const s=[];for(let t=0;t=i;e--){const i=+Date.now();o=this.trees[e]=this._createTree(this._cluster(o,e)),t&&console.log("z%d: %d clusters in %dms",e,o.numItems,+Date.now()-i)}return t&&console.timeEnd("total time"),this}getClusters(e,t){let i=((e[0]+180)%360+360)%360-180;const n=Math.max(-90,Math.min(90,e[1]));let r=180===e[2]?180:((e[2]+180)%360+360)%360-180;const s=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)i=-180,r=180;else if(i>r){const e=this.getClusters([i,n,180,s],t),o=this.getClusters([-180,n,r,s],t);return e.concat(o)}const o=this.trees[this._limitZoom(t)],a=o.range(Y(i),B(s),Y(r),B(n)),l=o.data,c=[];for(const e of a){const t=this.stride*e;c.push(l[t+5]>1?F(l,t,this.clusterProps):this.points[l[t+3]])}return c}getChildren(e){const t=this._getOriginId(e),i=this._getOriginZoom(e),n="No cluster with the specified id.",r=this.trees[i];if(!r)throw new Error(n);const s=r.data;if(t*this.stride>=s.length)throw new Error(n);const o=this.options.radius/(this.options.extent*Math.pow(2,i-1)),a=r.within(s[t*this.stride],s[t*this.stride+1],o),l=[];for(const t of a){const i=t*this.stride;s[i+4]===e&&l.push(s[i+5]>1?F(s,i,this.clusterProps):this.points[s[i+3]])}if(0===l.length)throw new Error(n);return l}getLeaves(e,t,i){const n=[];return this._appendLeaves(n,e,t=t||10,i=i||0,0),n}getTile(e,t,i){const n=this.trees[this._limitZoom(e)],r=Math.pow(2,e),{extent:s,radius:o}=this.options,a=o/s,l=(i-a)/r,c=(i+1+a)/r,h={features:[]};return this._addTileFeatures(n.range((t-a)/r,l,(t+1+a)/r,c),n.data,t,i,r,h),0===t&&this._addTileFeatures(n.range(1-a/r,l,1,c),n.data,r,i,r,h),t===r-1&&this._addTileFeatures(n.range(0,l,a/r,c),n.data,-1,i,r,h),h.features.length?h:null}getClusterExpansionZoom(e){let t=this._getOriginZoom(e)-1;for(;t<=this.options.maxZoom;){const i=this.getChildren(e);if(t++,1!==i.length)break;e=i[0].properties.cluster_id}return t}_appendLeaves(e,t,i,n,r){const s=this.getChildren(t);for(const t of s){const s=t.properties;if(s&&s.cluster?r+s.point_count<=n?r+=s.point_count:r=this._appendLeaves(e,s.cluster_id,i,n,r):r1;let l,c,h;if(a)l=N(t,e,this.clusterProps),c=t[e],h=t[e+1];else{const i=this.points[t[e+3]];l=i.properties;const[n,r]=i.geometry.coordinates;c=Y(n),h=B(r)}const d={type:1,geometry:[[Math.round(this.options.extent*(c*r-i)),Math.round(this.options.extent*(h*r-n))]],tags:l};let u;u=a||this.options.generateId?t[e+3]:this.points[t[e+3]].id,void 0!==u&&(d.id=u),s.features.push(d)}}_limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}_cluster(e,t){const{radius:i,extent:n,reduce:r,minPoints:s}=this.options,o=i/(n*Math.pow(2,t)),a=e.data,l=[],c=this.stride;for(let i=0;it&&(f+=a[i+5])}if(f>u&&f>=s){let e,s=n*u,o=h*u,p=-1;const m=(i/c<<5)+(t+1)+this.points.length;for(const n of d){const l=n*c;if(a[l+2]<=t)continue;a[l+2]=t;const h=a[l+5];s+=a[l]*h,o+=a[l+1]*h,a[l+4]=m,r&&(e||(e=this._map(a,i,!0),p=this.clusterProps.length,this.clusterProps.push(e)),r(e,this._map(a,l)))}a[i+4]=m,l.push(s/f,o/f,1/0,m,-1,f),r&&l.push(p)}else{for(let e=0;e1)for(const e of d){const i=e*c;if(!(a[i+2]<=t)){a[i+2]=t;for(let e=0;e>5}_getOriginZoom(e){return(e-this.points.length)%32}_map(e,t,i){if(e[t+5]>1){const n=this.clusterProps[e[t+6]];return i?Object.assign({},n):n}const n=this.points[e[t+3]].properties,r=this.options.map(n);return i&&r===n?Object.assign({},r):r}}function F(e,t,i){return{type:"Feature",id:e[t+3],properties:N(e,t,i),geometry:{type:"Point",coordinates:[(n=e[t],360*(n-.5)),H(e[t+1])]}};var n}function N(e,t,i){const n=e[t+5],r=n>=1e4?`${Math.round(n/1e3)}k`:n>=1e3?Math.round(n/100)/10+"k":n,s=e[t+6],o=-1===s?{}:Object.assign({},i[s]);return Object.assign(o,{cluster:!0,cluster_id:e[t+3],point_count:n,point_count_abbreviated:r})}function Y(e){return e/360+.5}function B(e){const t=Math.sin(e*Math.PI/180),i=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return i<0?0:i>1?1:i}function H(e){const t=(180-360*e)*Math.PI/180;return 360*Math.atan(Math.exp(t))/Math.PI-90}function j(e,t,i,n){let r=n;const s=t+(i-t>>1);let o,a=i-t;const l=e[t],c=e[t+1],h=e[i],d=e[i+1];for(let n=t+3;nr)o=n,r=t;else if(t===r){const e=Math.abs(n-s);en&&(o-t>3&&j(e,t,o,n),e[o+2]=r,i-o>3&&j(e,o,i,n))}function V(e,t,i,n,r,s){let o=r-i,a=s-n;if(0!==o||0!==a){const l=((e-i)*o+(t-n)*a)/(o*o+a*a);l>1?(i=r,n=s):l>0&&(i+=o*l,n+=a*l)}return o=e-i,a=t-n,o*o+a*a}function W(e,t,i,n){const r={id:e??null,type:t,geometry:i,tags:n,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if("Point"===t||"MultiPoint"===t||"LineString"===t)U(r,i);else if("Polygon"===t)U(r,i[0]);else if("MultiLineString"===t)for(const e of i)U(r,e);else if("MultiPolygon"===t)for(const e of i)U(r,e[0]);return r}function U(e,t){for(let i=0;i0&&(o+=n?(r*l-a*s)/2:Math.sqrt(Math.pow(a-r,2)+Math.pow(l-s,2))),r=a,s=l}const a=t.length-3;t[2]=1,j(t,0,a,i),t[a+2]=1,t.size=Math.abs(o),t.start=0,t.end=t.size}function q(e,t,i,n){for(let r=0;r1?1:i}function K(e,t,i,n,r,s,o,a){if(n/=t,s>=(i/=t)&&o=n)return null;const l=[];for(const t of e){const e=t.geometry;let s=t.type;const o=0===r?t.minX:t.minY,c=0===r?t.maxX:t.maxY;if(o>=i&&c=n)continue;let h=[];if("Point"===s||"MultiPoint"===s)Q(e,h,i,n,r);else if("LineString"===s)ee(e,h,i,n,r,!1,a.lineMetrics);else if("MultiLineString"===s)ie(e,h,i,n,r,!1);else if("Polygon"===s)ie(e,h,i,n,r,!0);else if("MultiPolygon"===s)for(const t of e){const e=[];ie(t,e,i,n,r,!0),e.length&&h.push(e)}if(h.length){if(a.lineMetrics&&"LineString"===s){for(const e of h)l.push(W(t.id,s,e,t.tags));continue}"LineString"!==s&&"MultiLineString"!==s||(1===h.length?(s="LineString",h=h[0]):s="MultiLineString"),"Point"!==s&&"MultiPoint"!==s||(s=3===h.length?"Point":"MultiPoint"),l.push(W(t.id,s,h,t.tags))}}return l.length?l:null}function Q(e,t,i,n,r){for(let s=0;s=i&&o<=n&&ne(t,e[s],e[s+1],e[s+2])}}function ee(e,t,i,n,r,s,o){let a=te(e);const l=0===r?re:se;let c,h,d=e.start;for(let u=0;ui&&(h=l(a,f,p,g,_,i),o&&(a.start=d+c*h)):y>n?v=i&&(h=l(a,f,p,g,_,i),x=!0),v>n&&y<=n&&(h=l(a,f,p,g,_,n),x=!0),!s&&x&&(o&&(a.end=d+c*h),t.push(a),a=te(e)),o&&(d+=c)}let u=e.length-3;const f=e[u],p=e[u+1],m=0===r?f:p;m>=i&&m<=n&&ne(a,f,p,e[u+2]),u=a.length-3,s&&u>=3&&(a[u]!==a[0]||a[u+1]!==a[1])&&ne(a,a[0],a[1],a[2]),a.length&&t.push(a)}function te(e){const t=[];return t.size=e.size,t.start=e.start,t.end=e.end,t}function ie(e,t,i,n,r,s){for(const o of e)ee(o,t,i,n,r,s,!1)}function ne(e,t,i,n){e.push(t,i,n)}function re(e,t,i,n,r,s){const o=(s-t)/(n-t);return ne(e,s,i+(r-i)*o,1),o}function se(e,t,i,n,r,s){const o=(s-i)/(r-i);return ne(e,t+(n-t)*o,s,1),o}function oe(e,t){const i=[];for(let n=0;n0&&t.size<(r?o:n))return void(i.numPoints+=t.length/3);const a=[];for(let e=0;eo)&&(i.numSimplified++,a.push(t[e],t[e+1])),i.numPoints++;r&&function(e,t){let i=0;for(let t=0,n=e.length,r=n-2;t0===t)for(let t=0,i=e.length;t24)throw new Error("maxZoom should be in the 0-24 range");if(t.promoteId&&t.generateId)throw new Error("promoteId and generateId cannot be used together.");let n=function(e,t){const i=[];if("FeatureCollection"===e.type)for(let n=0;n1&&console.time("creation"),u=this.tiles[d]=he(e,t,i,n,l),this.tileCoords.push({z:t,x:i,y:n}),c)){c>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",t,i,n,u.numFeatures,u.numPoints,u.numSimplified),console.timeEnd("creation"));const e=`z${t}`;this.stats[e]=(this.stats[e]||0)+1,this.total++}if(u.source=e,null==r){if(t===l.indexMaxZoom||u.numPoints<=l.indexMaxPoints)continue}else{if(t===l.maxZoom||t===r)continue;if(null!=r){const e=r-t;if(i!==s>>e||n!==o>>e)continue}}if(u.source=null,0===e.length)continue;c>1&&console.time("clipping");const f=.5*l.buffer/l.extent,p=.5-f,m=.5+f,g=1+f;let _=null,y=null,v=null,x=null,b=K(e,h,i-f,i+m,0,u.minX,u.maxX,l),w=K(e,h,i+p,i+g,0,u.minX,u.maxX,l);e=null,b&&(_=K(b,h,n-f,n+m,1,u.minY,u.maxY,l),y=K(b,h,n+p,n+g,1,u.minY,u.maxY,l),b=null),w&&(v=K(w,h,n-f,n+m,1,u.minY,u.maxY,l),x=K(w,h,n+p,n+g,1,u.minY,u.maxY,l),w=null),c>1&&console.timeEnd("clipping"),a.push(_||[],t+1,2*i,2*n),a.push(y||[],t+1,2*i,2*n+1),a.push(v||[],t+1,2*i+1,2*n),a.push(x||[],t+1,2*i+1,2*n+1)}}getTile(e,t,i){e=+e,t=+t,i=+i;const n=this.options,{extent:r,debug:s}=n;if(e<0||e>24)return null;const o=1<1&&console.log("drilling down to z%d-%d-%d",e,t,i);let l,c=e,h=t,d=i;for(;!l&&c>0;)c--,h>>=1,d>>=1,l=this.tiles[me(c,h,d)];return l&&l.source?(s>1&&(console.log("found parent tile z%d-%d-%d",c,h,d),console.time("drilling down")),this.splitTile(l.source,c,h,d,e,t,i),s>1&&console.timeEnd("drilling down"),this.tiles[a]?le(this.tiles[a],r):null):null}}function me(e,t,i){return 32*((1<e.tags&&"3d_elevation_id"in e.tags&&"source"in e.tags&&"elevation"===e.tags.source,o=r.features.filter(e=>s(e));let a={_geojsonTileLayer:r.features};o.length>0&&(a={_geojsonTileLayer:r.features.filter(e=>!s(e)),hd_road_elevation:o});const l=new g(a),c=function(t){const i=new e.bq;for(const e of Object.keys(t))i.writeMessage(3,M,{name:e,features:t[e]});return i.finish()}(a).buffer;i(null,{vectorTile:l,rawData:c})}class _e extends c{constructor(e,t,i,n,r,s,o){super(e,t,i,n,r,ge,o),s&&(this.loadGeoJSON=s),this._dynamicIndex=new y}loadData(i,n){const r=i&&i.request,s=r&&r.collectResourceTiming;this._geoJSONIndex=null,this.loadGeoJSON(i,(o,a)=>{if(o||!a)return n(o);if("object"!=typeof a)return n(new Error(`Input data given to '${i.source}' is not a valid GeoJSON object.`));{try{if(i.filter){const t=e.X(i.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===t.result)throw new Error(t.value.map(e=>`${e.key}: ${e.message}`).join(", "));a.features=a.features.filter(e=>t.value.evaluate({zoom:0},e))}i.dynamic?("Feature"===a.type&&(a={type:"FeatureCollection",features:[a]}),i.append||(this._dynamicIndex.clear(),this.loaded={}),this._dynamicIndex.load(a.features,this.loaded),i.cluster&&(a.features=this._dynamicIndex.getFeatures())):this.loaded={},this._geoJSONIndex=i.cluster?new z(function({superclusterOptions:t,clusterProperties:i}){if(!i||!t)return t;const n={},r={},s={accumulated:null,zoom:0},o={properties:null},a=Object.keys(i);for(const t of a){const[s,o]=i[t],a=e.X(o),l=e.X("string"==typeof s?[s,["accumulated"],["get",t]]:s);n[t]=a.value,r[t]=l.value}return t.map=e=>{o.properties=e;const t={};for(const e of a)t[e]=n[e].evaluate(s,o);return t},t.reduce=(e,t)=>{o.properties=t;for(const t of a)s.accumulated=e[t],e[t]=r[t].evaluate(s,o)},t}(i)).load(a.features):i.dynamic?this._dynamicIndex:function(e,t){return new pe(e,t)}(a,i.geojsonVtOptions)}catch(e){return n(e)}const o={};if(s){const e=t(r);e&&(o.resourceTiming={},o.resourceTiming[i.source]=JSON.parse(JSON.stringify(e)))}n(null,o)}})}reloadTile(e,t){const i=this.loaded;return i&&i[e.uid]?e.partial?t(null,void 0):super.reloadTile(e,t):this.loadTile(e,t)}loadGeoJSON(t,i){if(t.request)e.n(t.request,i);else{if("string"!=typeof t.data)return i(new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`));setTimeout(()=>{try{return i(null,JSON.parse(t.data))}catch(e){return i(new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`))}},0)}}getClusterExpansionZoom(e,t){try{t(null,this._geoJSONIndex.getClusterExpansionZoom(e.clusterId))}catch(e){t(e)}}getClusterChildren(e,t){try{t(null,this._geoJSONIndex.getChildren(e.clusterId))}catch(e){t(e)}}getClusterLeaves(e,t){try{t(null,this._geoJSONIndex.getLeaves(e.clusterId,e.limit,e.offset))}catch(e){t(e)}}}class ye{constructor(t,i,n){this.tileID=new e.aM(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.canonical=t.tileID.canonical,this.pixelRatio=t.pixelRatio,this.tileSize=t.tileSize,this.source=t.source,this.overscaling=this.tileID.overscaleFactor(),this.projection=t.projection,this.brightness=i,this.worldview=n}parse(t,i,n,r){this.status="parsing";const s=new e.aM(n.tileID.overscaledZ,n.tileID.wrap,n.tileID.canonical.z,n.tileID.canonical.x,n.tileID.canonical.y),o=[],a=i.familiesBySource[n.source],l=new e.fc(s,n.promoteId);l.bucketLayerIDs=[],l.is3DTile=!0,e.fr(t).then(t=>{if(!t)return r(new Error("Could not parse tile"));const i=t.json.extensionsUsed&&t.json.extensionsUsed.includes("MAPBOX_mesh_features")||t.json.asset.extras&&t.json.asset.extras.MAPBOX_mesh_features,c=t.json.extensionsUsed&&t.json.extensionsUsed.includes("EXT_meshopt_compression"),h=new e.aa(this.zoom,{brightness:this.brightness,worldview:this.worldview});for(const r in a)for(const d of a[r]){const r=d[0];l.bucketLayerIDs.push(d.map(t=>e.C(t.id,t.scope))),r.recalculate(h,[]);const a=e.fs(t,1/e.d4(n.tileID.canonical)),u=new e.ft(d,a,s,i,c,this.brightness,l,this.worldview);i||(u.needsUpload=!0),o.push(u),u.evaluate(r)}this.status="done",r(null,{buckets:o,featureIndex:l,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:null})}).catch(e=>r(new Error(e.message)))}}class ve{constructor(e,t,i,n,r,s,o,a){this.actor=e,this.layerIndex=t,this.availableImages=i,this.availableModels=n,this.brightness=o,this.loading={},this.loaded={},this.worldview=a}loadTile(t,i){const n=t.uid,r=this.loading[n]=new ye(t,this.brightness,this.worldview);e.br(t.request,(e,s)=>{const o=!this.loading[n];return delete this.loading[n],o||e?(r.status="done",o||(this.loaded[n]=r),i(e)):s&&0!==s.byteLength?void r.parse(s,this.layerIndex,t,(e,t)=>{r.status="done",this.loaded=this.loaded||{},this.loaded[n]=r,e||!t?i(e):i(null,t)}):(r.status="done",this.loaded[n]=r,i())})}reloadTile(e,t){const i=this.loaded,n=e.uid;if(i&&i[n]){const r=i[n];r.projection=e.projection,r.brightness=e.brightness;const s=(i,n)=>{r.reloadCallback&&(delete r.reloadCallback,this.loadTile(e,t)),t(i,n)};"parsing"===r.status?r.reloadCallback=s:"done"===r.status&&this.loadTile(e,t)}}abortTile(e,t){const i=e.uid;this.loading[i]&&delete this.loading[i],t()}removeTile(e,t){const i=this.loaded,n=e.uid;i&&i[n]&&delete i[n],t()}}class xe{constructor(t){this.self=t,this.actor=new e.fv(t,this),this.layerIndexes={},this.availableImages={},this.availableModels={},this.isSpriteLoaded={},this.imageRasterizer=new e.y,this.rtlPluginParsingListeners=[],this.projections={},this.defaultProjection=e.cj({name:"mercator"}),this.workerSourceTypes={vector:c,geojson:_e,"raster-dem":h,"raster-array":u,"batched-model":ve},this.workerSources={},this.self.registerWorkerSource=(e,t)=>{if(this.workerSourceTypes[e])throw new Error(`Worker source with name "${e}" already registered.`);this.workerSourceTypes[e]=t},this.self.registerRTLTextPlugin=t=>{if(e.fw.isParsed())throw new Error("RTL text plugin already registered.");e.fw.setState({pluginStatus:e.fx.parsed,pluginURL:e.fw.getPluginURL()}),e.fw.applyArabicShaping=t.applyArabicShaping,e.fw.processBidirectionalText=t.processBidirectionalText,e.fw.processStyledBidirectionalText=t.processStyledBidirectionalText;for(const e of this.rtlPluginParsingListeners)e(null,!0);this.rtlPluginParsingListeners=[]}}clearCaches(e,t,i){delete this.layerIndexes[e],delete this.availableImages[e],delete this.availableModels[e],delete this.workerSources[e],i()}checkIfReady(e,t,i){i()}setReferrer(e,t){this.referrer=t}spriteLoaded(t,i){this.isSpriteLoaded[t]||(this.isSpriteLoaded[t]={});const{scope:n,isLoaded:r}=i;if(this.isSpriteLoaded[t][n]=r,this.workerSources[t]&&this.workerSources[t][n])for(const i in this.workerSources[t][n]){const s=this.workerSources[t][n][i];for(const t in s){const i=s[t];i instanceof c&&(i.isSpriteLoaded=r,i.fire(new e.A("isSpriteLoaded")))}}}setImages(e,t,i){this.availableImages[e]||(this.availableImages[e]={});const{scope:n,images:r}=t;if(this.availableImages[e][n]=r,this.workerSources[e]&&this.workerSources[e][n]){for(const t in this.workerSources[e][n]){const i=this.workerSources[e][n][t];for(const e in i)i[e].availableImages=r}i()}else i()}setModels(e,{scope:t,models:i},n){if(this.availableModels[e]||(this.availableModels[e]={}),this.availableModels[e][t]=i,this.workerSources[e]&&this.workerSources[e][t]){for(const n in this.workerSources[e][t]){const r=this.workerSources[e][t][n];for(const e in r)r[e].availableModels=i}n()}else n()}setProjection(t,i){this.projections[t]=e.cj(i)}setBrightness(e,t,i){this.brightness=t,i()}setWorldview(e,t,i){this.worldview=t,i()}setLayers(e,t,i){this.getLayerIndex(e,t.scope).replace(t.layers,t.options),i()}updateLayers(e,t,i){this.getLayerIndex(e,t.scope).update(t.layers,t.removedIds,t.options),i()}loadTile(e,t,i){t.projection=this.projections[e]||this.defaultProjection,this.getWorkerSource(e,t.type,t.source,t.scope).loadTile(t,i)}decodeRasterArray(e,t,i){this.getWorkerSource(e,t.type,t.source,t.scope).decodeRasterArray(t,i)}reloadTile(e,t,i){t.projection=this.projections[e]||this.defaultProjection,this.getWorkerSource(e,t.type,t.source,t.scope).reloadTile(t,i)}abortTile(e,t,i){this.getWorkerSource(e,t.type,t.source,t.scope).abortTile(t,i)}removeTile(e,t,i){this.getWorkerSource(e,t.type,t.source,t.scope).removeTile(t,i)}removeSource(e,t,i){if(!(this.workerSources[e]&&this.workerSources[e][t.scope]&&this.workerSources[e][t.scope][t.type]&&this.workerSources[e][t.scope][t.type][t.source]))return;const n=this.workerSources[e][t.scope][t.type][t.source];delete this.workerSources[e][t.scope][t.type][t.source],void 0!==n.removeSource?n.removeSource(t,i):i()}loadWorkerSource(e,t,i){try{this.self.importScripts(t.url),i()}catch(e){i(e.toString())}}syncRTLPluginState(t,i,n){if(e.fw.isParsed())n(null,!0);else if(e.fw.isParsing())this.rtlPluginParsingListeners.push(n);else try{e.fw.setState(i);const t=e.fw.getPluginURL();!e.fw.isLoaded()||e.fw.isParsed()||e.fw.isParsing()||null==t||(e.fw.setState({pluginStatus:e.fx.parsing,pluginURL:e.fw.getPluginURL()}),this.self.importScripts(t),e.fw.isParsed()?n(null,!0):this.rtlPluginParsingListeners.push(n))}catch(e){n(e.toString())}}setDracoUrl(e,t){this.dracoUrl=t}getAvailableImages(e,t){this.availableImages[e]||(this.availableImages[e]={});let i=this.availableImages[e][t];return i||(i=[]),i}getAvailableModels(e,t){this.availableModels[e]||(this.availableModels[e]={});let i=this.availableModels[e][t];return i||(i={}),i}getLayerIndex(e,t){this.layerIndexes[e]||(this.layerIndexes[e]={});let i=this.layerIndexes[e][t];return i||(i=this.layerIndexes[e][t]=new r,i.scope=t),i}getWorkerSource(e,t,i,n){const r=this.workerSources;return r[e]||(r[e]={}),r[e][n]||(r[e][n]={}),r[e][n][t]||(r[e][n][t]={}),this.isSpriteLoaded[e]||(this.isSpriteLoaded[e]={}),r[e][n][t][i]||(r[e][n][t][i]=new this.workerSourceTypes[t]({send:(t,i,n,r,s,o)=>this.actor.send(t,i,n,e,s,o),scheduler:this.actor.scheduler},this.getLayerIndex(e,n),this.getAvailableImages(e,n),this.getAvailableModels(e,n),this.isSpriteLoaded[e][n],void 0,this.brightness,this.worldview)),r[e][n][t][i]}rasterizeImagesWorker(e,t,i){const n=new Map;for(const[i,{image:r,imageVariant:s}]of t.tasks.entries()){const o=this.imageRasterizer.rasterize(s,r,t.scope,e);n.set(i,o)}i(void 0,n)}removeRasterizedImages(e,t,i){this.imageRasterizer.removeImagesFromCacheByIds(t.imageIds,t.scope,e),i()}enforceCacheSizeLimit(t,i){e.fy(i)}getWorkerPerformanceMetrics(e,t,i){i(void 0,void 0)}}return e.fu(self)&&(self.worker=new xe(self)),xe}),n(0,function(e){var t="3.14.0";const i={create:"create",load:"load",fullLoad:"fullLoad"},n={mark(e){performance.mark(e)},measure(e,t,i){performance.measure(e,t,i)}};function r(t){const i=t.name.split("?")[0];return e.a(i)&&i.includes("mapbox-gl.js")?"javascript":e.a(i)&&i.includes("mapbox-gl.css")?"css":e.b(i)?"fontRange":e.c(i)?"sprite":e.i(i)?"style":e.d(i)?"tilejson":"other"}var s,o={},a=function(){if(s)return o;function e(e){return!t(e)}function t(t){return"undefined"==typeof window||"undefined"==typeof document?"not a browser":function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var e,t,i=new Blob([""],{type:"text/javascript"}),n=URL.createObjectURL(i);try{t=new Worker(n),e=!0}catch(t){e=!1}return t&&t.terminate(),URL.revokeObjectURL(n),e}()?function(){var e=document.createElement("canvas");e.width=e.height=1;var t=e.getContext("2d");if(!t)return!1;var i=t.getImageData(0,0,1,1);return i&&i.width===e.width}()?(void 0===i[n=t&&t.failIfMajorPerformanceCaveat]&&(i[n]=function(t){var i,n=function(t){var i=document.createElement("canvas"),n=Object.create(e.webGLContextAttributes);return n.failIfMajorPerformanceCaveat=t,i.getContext("webgl2",n)}(t);if(!n)return!1;try{i=n.createShader(n.VERTEX_SHADER)}catch(e){return!1}return!(!i||n.isContextLost())&&(n.shaderSource(i,"void main() {}"),n.compileShader(i),!0===n.getShaderParameter(i,n.COMPILE_STATUS))}(n)),i[n]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL2 support"):"insufficient Canvas/getImageData support":"insufficient worker support";var n}s=1,o.supported=e,o.notSupportedReason=t;var i={};return e.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0},o}();function l(e,t,i){const n=document.createElement(e);return null!=t&&(n.className=t),i&&i.appendChild(n),n}function c(e,t,i){const n=document.createElementNS("http://www.w3.org/2000/svg",e);for(const e of Object.keys(t))n.setAttributeNS(null,e,String(t[e]));return i&&i.appendChild(n),n}const h="undefined"!=typeof document?document.documentElement&&document.documentElement.style:null,d=h&&void 0!==h.userSelect?"userSelect":"WebkitUserSelect";let u;function f(){h&&d&&(u=h[d],h[d]="none")}function p(){h&&d&&(h[d]=u)}function m(e){e.preventDefault(),e.stopPropagation(),window.removeEventListener("click",m,!0)}function g(){window.addEventListener("click",m,!0),window.setTimeout(()=>{window.removeEventListener("click",m,!0)},0)}function _(e,t){const i=e.getBoundingClientRect();return x(e,i,t)}function y(e,t){const i=e.getBoundingClientRect(),n=[];for(let r=0;rthis._skuTokenExpiresAt}transformRequest(e,t){return this._transformRequestFn&&this._transformRequestFn(e,t)||{url:e}}normalizeStyleURL(i,n){if(!e.j(i))return i;const r=k(i);return r.params.push(`sdk=js-${t}`),r.path=`/styles/v1${r.path}`,this._makeAPIURL(r,this._customAccessToken||n)}normalizeGlyphsURL(t,i){if(!e.j(t))return t;const n=k(t);return n.path=`/fonts/v1${n.path}`,this._makeAPIURL(n,this._customAccessToken||i)}normalizeModelURL(t,i){if(!e.j(t))return t;const n=k(t);return n.path=`/models/v1${n.path}`,this._makeAPIURL(n,this._customAccessToken||i)}normalizeSourceURL(t,i,n,r){if(!e.j(t))return t;const s=k(t);return s.path=`/v4/${s.authority}.json`,s.params.push("secure"),n&&s.params.push(`language=${n}`),r&&s.params.push(`worldview=${r}`),this._makeAPIURL(s,this._customAccessToken||i)}normalizeIconsetURL(t,i){const n=k(t);return e.j(t)?(n.path=`/styles/v1${n.path}/iconset.pbf`,this._makeAPIURL(n,this._customAccessToken||i)):M(n)}normalizeSpriteURL(t,i,n,r){const s=k(t);return e.j(t)?(s.path=`/styles/v1${s.path}/sprite${i}${n}`,this._makeAPIURL(s,this._customAccessToken||r)):(s.path+=`${i}${n}`,M(s))}normalizeTileURL(t,i,n){if(this._isSkuTokenExpired()&&this._createSkuToken(),t&&!e.j(t))return t;const r=k(t);r.path=r.path.replace(/(\.(png|jpg)\d*)(?=$)/,`${i||n&&"raster"!==r.authority&&512===n?"@2x":""}${e.l.supported?".webp":"$1"}`),"raster"===r.authority?r.path=`/${e.e.RASTER_URL_PREFIX}${r.path}`:"rasterarrays"===r.authority?r.path=`/${e.e.RASTERARRAYS_URL_PREFIX}${r.path}`:"3dtiles"===r.authority?r.path=`/${e.e.TILES3D_URL_PREFIX}${r.path}`:(r.path=r.path.replace(/^.+\/v4\//,"/"),r.path=`/${e.e.TILE_URL_VERSION}${r.path}`);const s=this._customAccessToken||function(e){for(const t of e){const e=t.match(/^access_token=(.*)$/);if(e)return e[1]}return null}(r.params)||e.e.ACCESS_TOKEN;return e.e.REQUIRE_ACCESS_TOKEN&&s&&this._skuToken&&r.params.push(`sku=${this._skuToken}`),this._makeAPIURL(r,s)}canonicalizeTileURL(t,i){const n=k(t);if(!n.path.match(/^(\/v4\/|\/(raster|rasterarrays)\/v1\/)/)||!n.path.match(/\.[\w]+$/))return t;let r="mapbox://";n.path.match(/^\/raster\/v1\//)?r+=`raster/${n.path.replace(`/${e.e.RASTER_URL_PREFIX}/`,"")}`:n.path.match(/^\/rasterarrays\/v1\//)?r+=`rasterarrays/${n.path.replace(`/${e.e.RASTERARRAYS_URL_PREFIX}/`,"")}`:r+=`tiles/${n.path.replace(`/${e.e.TILE_URL_VERSION}/`,"")}`;let s=n.params;return i&&(s=s.filter(e=>!e.match(/^access_token=/))),s.length&&(r+=`?${s.join("&")}`),r}canonicalizeTileset(t,i){const n=!!i&&e.j(i),r=[];for(const i of t.tiles||[])e.k(i)?r.push(this.canonicalizeTileURL(i,n)):r.push(i);return r}_makeAPIURL(t,i){const n="See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes",r=k(e.e.API_URL);if(t.protocol=r.protocol,t.authority=r.authority,"http"===t.protocol){const e=t.params.indexOf("secure");e>=0&&t.params.splice(e,1)}if("/"!==r.path&&(t.path=`${r.path}${t.path}`),!e.e.REQUIRE_ACCESS_TOKEN)return M(t);if(i=i||e.e.ACCESS_TOKEN,!this._silenceAuthErrors){if(!i)throw new Error(`An API access token is required to use Mapbox GL. ${n}`);if("s"===i[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(e=>-1===e.indexOf("access_token")),t.params.push(`access_token=${i||""}`),M(t)}}const T=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function k(e){const t=e.match(T);if(!t)throw new Error("Unable to parse URL object");return{protocol:t[1],authority:t[2],path:t[3]||"/",params:t[4]?t[4].split("&"):[]}}function M(e){const t=e.params.length?`?${e.params.join("&")}`:"";return`${e.protocol}://${e.authority}${e.path}${t}`}const A="mapbox.eventData";function C(t){if(!t)return null;const i=t.split(".");if(!i||3!==i.length)return null;try{return JSON.parse(e.m(i[1]))}catch(e){return null}}class D{constructor(e){this.type=e,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(t){const i=C(e.e.ACCESS_TOKEN);let n="";return n=i&&i.u?e.f(i.u):e.e.ACCESS_TOKEN||"",t?`${A}.${t}:${n}`:`${A}:${n}`}fetchEventData(){const t=e.s("localStorage"),i=this.getStorageKey(),n=this.getStorageKey("uuid");if(t)try{const e=localStorage.getItem(i);e&&(this.eventData=JSON.parse(e));const t=localStorage.getItem(n);t&&(this.anonId=t)}catch(t){e.w("Unable to read from LocalStorage")}}saveEventData(){const t=e.s("localStorage"),i=this.getStorageKey(),n=this.getStorageKey("uuid"),r=this.anonId;if(t&&r)try{localStorage.setItem(n,r),Object.keys(this.eventData).length>=1&&localStorage.setItem(i,JSON.stringify(this.eventData))}catch(t){e.w("Unable to write to LocalStorage")}}processRequests(e){}postEvent(t,i,n,r){if(!e.e.EVENTS_URL)return;const s=k(e.e.EVENTS_URL);s.params.push(`access_token=${r||e.e.ACCESS_TOKEN||""}`);const o={event:this.type,created:new Date(t).toISOString()},a=i?e.h(o,i):o,l={url:M(s),headers:{"Content-Type":"text/plain"},body:JSON.stringify([a])};this.pendingRequest=e.p(l,e=>{this.pendingRequest=null,n(e),this.saveEventData(),this.processRequests(r)})}queueRequest(e,t){this.queue.push(e),this.processRequests(t)}}const L=new class extends D{constructor(e){super("appUserTurnstile"),this._customAccessToken=e}postTurnstileEvent(t,i){e.e.EVENTS_URL&&e.e.ACCESS_TOKEN&&Array.isArray(t)&&t.some(t=>e.j(t)||e.k(t))&&this.queueRequest(Date.now(),i)}processRequests(i){if(this.pendingRequest||0===this.queue.length)return;this.anonId&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();const n=C(e.e.ACCESS_TOKEN),r=n?n.u:e.e.ACCESS_TOKEN;let s=r!==this.eventData.tokenU;e.v(this.anonId)||(this.anonId=e.u(),s=!0);const o=this.queue.shift();if(this.eventData.lastSuccess){const e=new Date(this.eventData.lastSuccess),t=new Date(o),i=(o-this.eventData.lastSuccess)/864e5;s=s||i>=1||i<-1||e.getDate()!==t.getDate()}else s=!0;s?this.postEvent(o,{sdkIdentifier:"mapbox-gl-js",sdkVersion:t,skuId:b,"enabled.telemetry":!1,userId:this.anonId},e=>{e||(this.eventData.lastSuccess=o,this.eventData.tokenU=r)},i):this.processRequests()}},E=L.postTurnstileEvent.bind(L),I=new class extends D{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(t,i,n,r){this.skuToken=i,this.errorCb=r,e.e.EVENTS_URL&&(n||e.e.ACCESS_TOKEN?this.queueRequest({id:t,timestamp:Date.now()},n):this.errorCb(new Error(w)))}processRequests(i){if(this.pendingRequest||0===this.queue.length)return;const{id:n,timestamp:r}=this.queue.shift();n&&this.success[n]||(this.anonId||this.fetchEventData(),e.v(this.anonId)||(this.anonId=e.u()),this.postEvent(r,{sdkIdentifier:"mapbox-gl-js",sdkVersion:t,skuId:b,skuToken:this.skuToken,userId:this.anonId},e=>{e?this.errorCb(e):n&&(this.success[n]=!0)},i))}remove(){this.errorCb=null}},P=I.postMapLoadEvent.bind(I),R=new class extends D{constructor(){super("style.load"),this.eventIdPerMapInstanceMap=new Map,this.mapInstanceIdMap=new WeakMap}getMapInstanceId(t){let i=this.mapInstanceIdMap.get(t);return i||(i=e.u(),this.mapInstanceIdMap.set(t,i)),i}getEventId(e){const t=this.eventIdPerMapInstanceMap.get(e)||0;return this.eventIdPerMapInstanceMap.set(e,t+1),t}postStyleLoadEvent(t,i){const{map:n,style:r,importedStyles:s}=i;if(!e.e.EVENTS_URL||!t&&!e.e.ACCESS_TOKEN)return;const o=this.getMapInstanceId(n),a={mapInstanceId:o,eventId:this.getEventId(o),style:r};s.length&&(a.importedStyles=s),this.queueRequest({timestamp:Date.now(),payload:a},t)}processRequests(e){if(this.pendingRequest||0===this.queue.length)return;const{timestamp:t,payload:i}=this.queue.shift();this.postEvent(t,i,()=>{},e)}},O=R.postStyleLoadEvent.bind(R),z=new class extends D{constructor(){super("gljs.performance")}postPerformanceEvent(t,i){e.e.EVENTS_URL&&(t||e.e.ACCESS_TOKEN)&&this.queueRequest({timestamp:Date.now(),performanceData:i},t)}processRequests(n){if(this.pendingRequest||0===this.queue.length)return;const{timestamp:s,performanceData:o}=this.queue.shift(),a=function(n){const s=performance.getEntriesByType("resource"),o=performance.getEntriesByType("mark"),a=function(e){const t={};if(e)for(const i in e)if("other"!==i)for(const n of e[i]){const e=`${i}ResolveRangeMin`,r=`${i}ResolveRangeMax`,s=`${i}RequestCount`,o=`${i}RequestCachedCount`;t[e]=Math.min(t[e]||1/0,n.startTime),t[r]=Math.max(t[r]||-1/0,n.responseEnd);const a=e=>{void 0===t[e]&&(t[e]=0),++t[e]};void 0!==n.transferSize&&0===n.transferSize&&a(o),a(s)}return t}(function(e,t){const i={};if(e)for(const n of e){const e=t(n);void 0===i[e]&&(i[e]=[]),i[e].push(n)}return i}(s,r)),l=window.devicePixelRatio,c=navigator.connection||navigator.mozConnection||navigator.webkitConnection,h=c?c.effectiveType:void 0,d={counters:[],metadata:[],attributes:[]},u=(e,t,i)=>{null!=i&&e.push({name:t,value:i.toString()})};for(const e in a)u(d.counters,e,a[e]);if(n.interactionRange[0]!==1/0&&n.interactionRange[1]!==-1/0&&(u(d.counters,"interactionRangeMin",n.interactionRange[0]),u(d.counters,"interactionRangeMax",n.interactionRange[1])),o)for(const e of Object.keys(i)){const t=i[e],n=o.find(e=>e.name===t);n&&u(d.counters,t,n.startTime)}return u(d.counters,"visibilityHidden",n.visibilityHidden),u(d.attributes,"style",function(t){if(t)for(const i of t){const t=i.name.split("?")[0];if(e.i(t)){const e=t.split("/").slice(-2);if(2===e.length)return`mapbox://styles/${e[0]}/${e[1]}`}}}(s)),u(d.attributes,"terrainEnabled",n.terrainEnabled?"true":"false"),u(d.attributes,"fogEnabled",n.fogEnabled?"true":"false"),u(d.attributes,"projection",n.projection),u(d.attributes,"zoom",n.zoom),u(d.metadata,"devicePixelRatio",l),u(d.metadata,"connectionEffectiveType",h),u(d.metadata,"navigatorUserAgent",navigator.userAgent),u(d.metadata,"screenWidth",window.screen.width),u(d.metadata,"screenHeight",window.screen.height),u(d.metadata,"windowWidth",window.innerWidth),u(d.metadata,"windowHeight",window.innerHeight),u(d.metadata,"mapWidth",n.width/l),u(d.metadata,"mapHeight",n.height/l),u(d.metadata,"webglRenderer",n.renderer),u(d.metadata,"webglVendor",n.vendor),u(d.metadata,"sdkVersion",t),u(d.metadata,"sdkIdentifier","mapbox-gl-js"),d}(o);for(const e of a.metadata);for(const e of a.counters);for(const e of a.attributes);this.postEvent(s,a,()=>{},n)}},F=z.postPerformanceEvent.bind(z),N=new class extends D{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(t,i,n,r){if(!e.e.API_URL||!e.e.SESSION_PATH)return;const s=k(e.e.API_URL+e.e.SESSION_PATH);s.params.push(`sku=${i||""}`),s.params.push(`access_token=${r||e.e.ACCESS_TOKEN||""}`);const o={url:M(s),headers:{"Content-Type":"text/plain"}};this.pendingRequest=e.g(o,e=>{this.pendingRequest=null,n(e),this.saveEventData(),this.processRequests(r)})}getSessionAPI(t,i,n,r){this.skuToken=i,this.errorCb=r,e.e.SESSION_PATH&&e.e.API_URL&&(n||e.e.ACCESS_TOKEN?this.queueRequest({id:t,timestamp:Date.now()},n):this.errorCb(new Error(w)))}processRequests(e){if(this.pendingRequest||0===this.queue.length)return;const{id:t,timestamp:i}=this.queue.shift();t&&this.success[t]||this.getSession(i,this.skuToken,e=>{e?this.errorCb(e):t&&(this.success[t]=!0)},e)}remove(){this.errorCb=null}},Y=N.getSessionAPI.bind(N),B=new Set;function H(e,t){t?B.add(e):B.delete(e)}class j{constructor(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps=new Set,this._updatedImages={}}isDirty(){return this._changed}setDirty(){this._changed=!0}getUpdatedSourceCaches(){return this._updatedSourceCaches}updateSourceCache(e,t){this._updatedSourceCaches[e]=t,this.setDirty()}discardSourceCacheUpdate(e){delete this._updatedSourceCaches[e]}updateLayer(e){const t=e.scope;this._updatedLayers[t]=this._updatedLayers[t]||new Set,this._updatedLayers[t].add(e.id),this.setDirty()}removeLayer(e){const t=e.scope;this._removedLayers[t]=this._removedLayers[t]||{},this._updatedLayers[t]=this._updatedLayers[t]||new Set,this._removedLayers[t][e.id]=e,this._updatedLayers[t].delete(e.id),this._updatedPaintProps.delete(e.fqid),this.setDirty()}getRemovedLayer(e){return this._removedLayers[e.scope]?this._removedLayers[e.scope][e.id]:null}discardLayerRemoval(e){this._removedLayers[e.scope]&&delete this._removedLayers[e.scope][e.id]}getLayerUpdatesByScope(){const e={};for(const t in this._updatedLayers)e[t]=e[t]||{},e[t].updatedIds=Array.from(this._updatedLayers[t].values());for(const t in this._removedLayers)e[t]=e[t]||{},e[t].removedIds=Object.keys(this._removedLayers[t]);return e}getUpdatedPaintProperties(){return this._updatedPaintProps}updatePaintProperties(e){this._updatedPaintProps.add(e.fqid),this.setDirty()}getUpdatedImages(e){return this._updatedImages[e]?Array.from(this._updatedImages[e].values()):[]}updateImage(t,i){this._updatedImages[i]=this._updatedImages[i]||new Set,this._updatedImages[i].add(e.I.toString(t)),this.setDirty()}resetUpdatedImages(e){this._updatedImages[e]&&this._updatedImages[e].clear()}reset(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps.clear(),this._updatedImages={}}}function V(e){const{userImage:t}=e;return!!(t&&t.render&&t.render())&&(e.data.replace(new Uint8Array(t.data.buffer)),!0)}class W extends e.E{constructor(t){super(),this.imageProviders=new Map,this.images=new Map,this.updatedImages=new Map,this.callbackDispatchedThisFrame=new Map,this.loaded=new Map,this.requestors=[],this.patterns=new Map,this.patternsInFlight=new Set,this.atlasImage=new Map,this.atlasTexture=new Map,this.dirty=!0,this.spriteFormat=t,"raster"!==t&&e.t()&&(this.imageRasterizerDispatcher=new e.D(e.x(),this,"Image Rasterizer Worker",1))}addScope(t){this.loaded.set(t,!1),this.imageProviders.set(t,new Map),this.images.set(t,new Map),this.updatedImages.set(t,new Set),this.callbackDispatchedThisFrame.set(t,new Set),this.patterns.set(t,new Map),this.atlasImage.set(t,new e.r({width:1,height:1}))}removeScope(e){this.loaded.delete(e),this.imageProviders.delete(e),this.images.delete(e),this.updatedImages.delete(e),this.callbackDispatchedThisFrame.delete(e),this.patterns.delete(e),this.atlasImage.delete(e);const t=this.atlasTexture.get(e);t&&(t.destroy(),this.atlasTexture.delete(e))}addImageProvider(e,t){this.imageProviders.has(t)||this.imageProviders.set(t,new Map),this.imageProviders.get(t).set(e.id,e)}removeImageProvider(e,t){this.imageProviders.has(t)&&this.imageProviders.get(t).delete(e)}getPendingImageProviders(){const e=[];for(const t of this.imageProviders.values())for(const i of t.values())i.hasPendingRequests()&&e.push(i);return e}get imageRasterizer(){return this._imageRasterizer||(this._imageRasterizer=new e.y),this._imageRasterizer}isLoaded(){for(const e of this.loaded.keys())if(!this.loaded.get(e))return!1;return!0}setLoaded(e,t){if(this.loaded.get(t)!==e&&(this.loaded.set(t,e),e)){for(const{ids:e,callback:i}of this.requestors)this._notify(e,t,i);this.requestors=[]}}hasImage(e,t){return!!this.getImage(e,t)}getImage(e,t){return this.images.get(t).get(e.toString())}addImage(e,t,i){this._validate(e,i)&&this.images.get(t).set(e.toString(),i)}_validate(t,i){let n=!0;return this._validateStretch(i.stretchX,i.data&&i.data.width)||(this.fire(new e.z(new Error(`Image "${t.name}" has invalid "stretchX" value`))),n=!1),this._validateStretch(i.stretchY,i.data&&i.data.height)||(this.fire(new e.z(new Error(`Image "${t.name}" has invalid "stretchY" value`))),n=!1),this._validateContent(i.content,i)||(this.fire(new e.z(new Error(`Image "${t.name}" has invalid "content" value`))),n=!1),n}_validateStretch(e,t){if(!e)return!0;let i=0;for(const n of e){if(n[0]e.I.from(t))}getImages(e,t,i){const n=[],r=[],s=this.imageProviders.get(t);for(const i of e){if(!i.iconsetId){n.push(i);continue}const e=s.get(i.iconsetId);e&&(this.getImage(i,t)?r.push(i):e.addPendingRequest(i))}if(0===n.length)return void this._notify(r,t,i);let o=!0;const a=!!this.loaded.get(t),l=this.images.get(t);if(!a)for(const e of n)l.has(e.toString())||(o=!1);a||o?this._notify(n,t,i):this.requestors.push({ids:n,scope:t,callback:i})}rasterizeImages(e,t){const i=new Map,{tasks:n,scope:r}=e;for(const[e,t]of n.entries()){const n=this.getImage(t.id,r);n&&i.set(e,{image:n,imageVariant:t})}this._rasterizeImages(r,i,t)}_rasterizeImages(t,i,n){if(e.t())this.imageRasterizerDispatcher.getActor().send("rasterizeImagesWorker",{tasks:i,scope:t},n);else{const e=new Map;for(const[n,{image:r,imageVariant:s}]of i.entries())e.set(n,this.imageRasterizer.rasterize(s,r,t,0));n(void 0,e)}}getUpdatedImages(e){return this.updatedImages.get(e)||new Set}_notify(t,i,n){const r=this.images.get(i),s=new Map;for(const i of t){if(!r.get(i.toString())){if(i.iconsetId)continue;this.fire(new e.A("styleimagemissing",{id:i.name}))}const t=r.get(i.toString());if(!t){e.w(`Image "${i.name}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`);continue}const n={data:t.usvg?null:t.data.clone(),pixelRatio:t.pixelRatio,sdf:t.sdf,usvg:t.usvg,version:t.version,stretchX:t.stretchX,stretchY:t.stretchY,content:t.content,hasRenderCallback:Boolean(t.userImage&&t.userImage.render)};t.usvg&&Object.assign(n,{width:t.icon.usvg_tree.width,height:t.icon.usvg_tree.height}),s.set(e.I.toString(i),n)}n(null,s)}getPixelSize(e){const{width:t,height:i}=this.atlasImage.get(e);return{width:t,height:i}}getPattern(t,i,n){const r=t.toString(),s=this.patterns.get(i),o=s.get(r),a=this.getImage(t,i);if(!a)return null;if(o){if(o.position.version===a.version)return o.position;o.position.version=a.version}else{if(a.usvg&&!a.data){const s=this.getPatternInFlightId(r,i);if(this.patternsInFlight.has(s))return null;this.patternsInFlight.add(s);const o=new e.B(t).scaleSelf(e.q.devicePixelRatio),l=new Map([[o.toString(),{image:a,imageVariant:o}]]);return this._rasterizeImages(i,l,(e,t)=>this.storePatternImage(o,i,a,n,t)),null}this.storePattern(t,i,a)}return this._updatePatternAtlas(i,n),s.get(r).position}getPatternInFlightId(t,i){return e.C(t,i)}hasPatternsInFlight(){return 0!==this.patternsInFlight.size}storePatternImage(e,t,i,n,r){const s=e.toString(),o=r?r.get(s):void 0;o&&(i.data=o,this.storePattern(e.id,t,i),this._updatePatternAtlas(t,n),this.patternsInFlight.delete(this.getPatternInFlightId(e.id.toString(),t)))}storePattern(t,i,n){const r={w:n.data.width+2*e.F,h:n.data.height+2*e.F,x:0,y:0},s=new e.G(r,n,e.F);this.patterns.get(i).set(t.toString(),{bin:r,position:s})}destroyAtlasTextures(){for(const e of this.atlasTexture.values())e&&e.destroy();this.atlasTexture.clear()}bind(t,i){const n=t.gl;let r=this.atlasTexture.get(i);r?this.dirty&&(r.update(this.atlasImage.get(i)),this.dirty=!1):(r=new e.T(t,this.atlasImage.get(i),n.RGBA8),this.atlasTexture.set(i,r)),r.bind(n.LINEAR,n.CLAMP_TO_EDGE)}_updatePatternAtlas(t,i){const n=this.patterns.get(t),r=Array.from(n.values()).map(({bin:e})=>e),{w:s,h:o}=e.H(r),a=this.atlasImage.get(t);a.resize({width:s||1,height:o||1});const l=this.images.get(t);for(const[t,{bin:r,position:s}]of n.entries()){let n=s.padding;const o=r.x+n,c=r.y+n,h=l.get(t).data,d=h.width,u=h.height;n=n>1?n-1:n,e.r.copy(h,a,{x:0,y:0},{x:o,y:c},{width:d,height:u},i),e.r.copy(h,a,{x:0,y:u-n},{x:o,y:c-n},{width:d,height:n},i),e.r.copy(h,a,{x:0,y:0},{x:o,y:c+u},{width:d,height:n},i),e.r.copy(h,a,{x:d-n,y:0},{x:o-n,y:c},{width:n,height:u},i),e.r.copy(h,a,{x:0,y:0},{x:o+d,y:c},{width:n,height:u},i),e.r.copy(h,a,{x:d-n,y:u-n},{x:o-n,y:c-n},{width:n,height:n},i),e.r.copy(h,a,{x:0,y:u-n},{x:o+d,y:c-n},{width:n,height:n},i),e.r.copy(h,a,{x:0,y:0},{x:o+d,y:c+u},{width:n,height:n},i),e.r.copy(h,a,{x:d-n,y:0},{x:o-n,y:c+u},{width:n,height:n},i)}this.dirty=!0}beginFrame(){for(const e of this.images.keys())this.callbackDispatchedThisFrame.set(e,new Set)}dispatchRenderCallbacks(e,t){const i=this.images.get(t);for(const n of e){if(this.callbackDispatchedThisFrame.get(t).has(n.toString()))continue;this.callbackDispatchedThisFrame.get(t).add(n.toString());const e=i.get(n.toString());V(e)&&this.updateImage(n,t,e)}}destroy(){this.imageRasterizerDispatcher&&this.imageRasterizerDispatcher.remove()}}function U(t){const i=t.key,n=t.value,r=t.valueSpec||{},s=t.objectElementValidators||{},o=t.style,a=t.styleSpec;let l=[];const c=e.J(n);if("object"!==c)return[new e.V(i,n,`object expected, ${c} found`)];for(const t in n){const c=t.split(".")[0];let h;s[c]?h=s[c]:r[c]?h=fe:s["*"]?h=s["*"]:r["*"]&&(h=fe),h?l=l.concat(h({key:(i?`${i}.`:i)+t,value:n[t],valueSpec:r[c]||r["*"],style:o,styleSpec:a,object:n,objectKey:t},n)):l.push(new e.K(i,n[t],`unknown property "${t}"`))}for(const t in r)s[t]||r[t].required&&void 0===r[t].default&&void 0===n[t]&&l.push(new e.V(i,n,`missing required property "${t}"`));return l}function $(t){const i=t.value,n=t.valueSpec,r=t.style,s=t.styleSpec,o=t.key,a=t.arrayElementValidator||fe;if("array"!==e.J(i))return[new e.V(o,i,`array expected, ${e.J(i)} found`)];if(n.length&&i.length!==n.length)return[new e.V(o,i,`array length ${n.length} expected, length ${i.length} found`)];if(n["min-length"]&&i.lengths)return[new e.V(i,n,`${n} is greater than the maximum value ${s}`)]}return[]}function X(t){const i=t.valueSpec,n=e.M(t.value.type);let r,s,o,a={};const l="categorical"!==n&&void 0===t.value.property,c=!l,h="array"===e.J(t.value.stops)&&"array"===e.J(t.value.stops[0])&&"object"===e.J(t.value.stops[0][0]),d=U({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 e.V(t.key,t.value,'identity function may not have a "stops" property')];let i=[];const r=t.value;return i=i.concat($({key:t.key,value:r,valueSpec:t.valueSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:u})),"array"===e.J(r)&&0===r.length&&i.push(new e.V(t.key,r,"array must have at least one stop")),i},default:function(e){return fe({key:e.key,value:e.value,valueSpec:i,style:e.style,styleSpec:e.styleSpec})}}});return"identity"===n&&l&&d.push(new e.V(t.key,t.value,'missing required property "property"')),"identity"===n||t.value.stops||d.push(new e.V(t.key,t.value,'missing required property "stops"')),"exponential"===n&&t.valueSpec.expression&&!e.N(t.valueSpec)&&d.push(new e.V(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(c&&!e.O(t.valueSpec)?d.push(new e.V(t.key,t.value,"property functions not supported")):l&&!e.Q(t.valueSpec)&&d.push(new e.V(t.key,t.value,"zoom functions not supported"))),"categorical"!==n&&!h||void 0!==t.value.property||d.push(new e.V(t.key,t.value,'"property" property is required')),d;function u(t){let n=[];const r=t.value,l=t.key;if("array"!==e.J(r))return[new e.V(l,r,`array expected, ${e.J(r)} found`)];if(2!==r.length)return[new e.V(l,r,`array length 2 expected, length ${r.length} found`)];if(h){if("object"!==e.J(r[0]))return[new e.V(l,r,`object expected, ${e.J(r[0])} found`)];if(void 0===r[0].zoom)return[new e.V(l,r,"object stop key must have zoom")];if(void 0===r[0].value)return[new e.V(l,r,"object stop key must have value")];const i=e.M(r[0].zoom);if("number"!=typeof i)return[new e.V(l,r[0].zoom,"stop zoom values must be numbers")];if(o&&o>i)return[new e.V(l,r[0].zoom,"stop zoom values must appear in ascending order")];i!==o&&(o=i,s=void 0,a={}),n=n.concat(U({key:`${l}[0]`,value:r[0],valueSpec:{zoom:{}},style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:G,value:f}}))}else n=n.concat(f({key:`${l}[0]`,value:r[0],style:t.style,styleSpec:t.styleSpec},r));return e.S(e.U(r[1]))?n.concat([new e.V(`${l}[1]`,r[1],"expressions are not allowed in function stops.")]):n.concat(fe({key:`${l}[1]`,value:r[1],valueSpec:i,style:t.style,styleSpec:t.styleSpec}))}function f(t,o){const l=e.J(t.value),c=e.M(t.value),h=null!==t.value?t.value:o;if(r){if(l!==r)return[new e.V(t.key,h,`${l} stop domain type must match previous stop domain type ${r}`)]}else r=l;if("number"!==l&&"string"!==l&&"boolean"!==l&&"number"!=typeof c&&"string"!=typeof c&&"boolean"!=typeof c)return[new e.V(t.key,h,"stop domain value must be a number, string, or boolean")];if("number"!==l&&"categorical"!==n){let r=`number expected, ${l} found`;return e.O(i)&&void 0===n&&(r+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new e.V(t.key,h,r)]}return"categorical"!==n||"number"!==l||"number"==typeof c&&isFinite(c)&&Math.floor(c)===c?"categorical"!==n&&"number"===l&&"number"==typeof c&&"number"==typeof s&&void 0!==s&&cnew e.V(`${t.key}${i.key}`,t.value,i.message));const n=i.value.expression||i.value._styleExpression.expression;if("property"===t.expressionContext&&"text-font"===t.propertyKey&&!n.outputDefined())return[new e.V(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&&!e.Y(n))return[new e.V(t.key,t.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===t.expressionContext)return Z(n,t);if(t.expressionContext&&0===t.expressionContext.indexOf("cluster")){if(!e.Z(n,["zoom","feature-state"]))return[new e.V(t.key,t.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===t.expressionContext&&!e._(n))return[new e.V(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Z(t,i){const n=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(i.valueSpec&&i.valueSpec.expression)for(const e of i.valueSpec.expression.parameters)n.delete(e);if(0===n.size)return[];const r=[];return t instanceof e.$&&n.has(t.name)?[new e.V(i.key,i.value,`["${t.name}"] expression is not supported in a filter for a ${i.object.type} layer with id: ${i.object.id}`)]:(t.eachChild(e=>{r.push(...Z(e,i))}),r)}function J(t){const i=t.key,n=t.value,r=t.valueSpec,s=[];return Array.isArray(r.values)?-1===r.values.indexOf(e.M(n))&&s.push(new e.V(i,n,`expected one of [${r.values.join(", ")}], ${JSON.stringify(n)} found`)):-1===Object.keys(r.values).indexOf(e.M(n))&&s.push(new e.V(i,n,`expected one of [${Object.keys(r.values).join(", ")}], ${JSON.stringify(n)} found`)),s}function K(t){return e.a1(e.U(t.value))?q(e.L({},t,{expressionContext:"filter",valueSpec:t.styleSpec[`filter_${t.layerType||"fill"}`]})):Q(t)}function Q(t){const i=t.value,n=t.key;if("array"!==e.J(i))return[new e.V(n,i,`array expected, ${e.J(i)} found`)];const r=t.styleSpec;let s,o=[];if(i.length<1)return[new e.V(n,i,"filter array must have at least 1 element")];switch(o=o.concat(J({key:`${n}[0]`,value:i[0],valueSpec:r.filter_operator,style:t.style,styleSpec:t.styleSpec})),e.M(i[0])){case"<":case"<=":case">":case">=":i.length>=2&&"$type"===e.M(i[1])&&o.push(new e.V(n,i,`"$type" cannot be use with operator "${i[0]}"`));case"==":case"!=":3!==i.length&&o.push(new e.V(n,i,`filter array for operator "${i[0]}" must have 3 elements`));case"in":case"!in":i.length>=2&&(s=e.J(i[1]),"string"!==s&&o.push(new e.V(`${n}[1]`,i[1],`string expected, ${s} found`)));for(let a=2;a{t in n&&i.push(new e.V(r,n[t],`"${t}" is prohibited for ref layers`))}),s.layers.forEach(i=>{e.M(i.id)===l&&(t=i)}),t?t.ref?i.push(new e.V(r,n.ref,"ref cannot reference another ref layer")):a=e.M(t.type):"string"==typeof l&&i.push(new e.V(r,n.ref,`ref layer "${l}" not found`))}else if("background"!==a&&"sky"!==a&&"slot"!==a)if(n.source){const t=s.sources&&s.sources[n.source],o=t&&e.M(t.type);t?"vector"===o&&"raster"===a?i.push(new e.V(r,n.source,`layer "${n.id}" requires a raster source`)):"raster"===o&&"raster"!==a?i.push(new e.V(r,n.source,`layer "${n.id}" requires a vector source`)):"vector"!==o||n["source-layer"]?"raster-dem"===o&&"hillshade"!==a?i.push(new e.V(r,n.source,"raster-dem source can only be used with layer type 'hillshade'.")):"raster-array"!==o||["raster","raster-particle"].includes(a)?"line"===a&&n.paint&&(n.paint["line-gradient"]||n.paint["line-trim-offset"])&&"geojson"===o&&!t.lineMetrics?i.push(new e.V(r,n,`layer "${n.id}" specifies a line-gradient, which requires the GeoJSON source to have \`lineMetrics\` enabled.`)):"raster-particle"===a&&"raster-array"!==o&&i.push(new e.V(r,n.source,`layer "${n.id}" requires a 'raster-array' source.`)):i.push(new e.V(r,n.source,"raster-array source can only be used with layer type 'raster'.")):i.push(new e.V(r,n,`layer "${n.id}" must specify a "source-layer"`)):i.push(new e.V(r,n.source,`source "${n.source}" not found`))}else i.push(new e.V(r,n,'missing required property "source"'));return i=i.concat(U({key:r,value:n,valueSpec:o.layer,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":()=>[],type:()=>fe({key:`${r}.type`,value:n.type,valueSpec:o.layer.type,style:t.style,styleSpec:t.styleSpec,object:n,objectKey:"type"}),filter:t=>K(e.L({layerType:a},t)),layout:t=>U({layer:n,key:t.key,value:t.value,valueSpec:{},style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":t=>ie(e.L({layerType:a},t))}}),paint:t=>U({layer:n,key:t.key,value:t.value,valueSpec:{},style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":t=>te(e.L({layerType:a,layer:n},t))}})}})),i}function re(t){const i=t.value,n=t.key,r=e.J(i);return"string"!==r?[new e.V(n,i,`string expected, ${r} found`)]:[]}const se={promoteId:function t({key:i,value:n}){if("string"===e.J(n))return re({key:i,value:n});if(Array.isArray(n)){const t=[],r=e.U(n),s=e.X(r);return"error"===s.result&&s.value.forEach(n=>{t.push(new e.V(`${i}${n.key}`,null,`${n.message}`))}),e.Z(s.value.expression,["zoom","heatmap-density","line-progress","raster-value","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center","measure-light","raster-particle-speed"])||t.push(new e.V(`${i}`,null,"promoteId expression should be only feature dependent")),t}{const e=[];for(const r in n)e.push(...t({key:`${i}.${r}`,value:n[r]}));return e}}};function oe(t){const i=t.value,n=t.key,r=t.styleSpec,s=t.style;if(!i.type)return[new e.V(n,i,'"type" is required')];const o=e.M(i.type);let a=[];switch(["vector","raster","raster-dem","raster-array"].includes(o)&&(i.url||i.tiles||a.push(new e.K(n,i,'Either "url" or "tiles" is required.'))),o){case"vector":case"raster":case"raster-dem":case"raster-array":return a=a.concat(U({key:n,value:i,valueSpec:r[`source_${o.replace("-","_")}`],style:t.style,styleSpec:r,objectElementValidators:se})),a;case"geojson":if(a=U({key:n,value:i,valueSpec:r.source_geojson,style:s,styleSpec:r,objectElementValidators:se}),i.cluster)for(const e in i.clusterProperties){const[t,r]=i.clusterProperties[e],s="string"==typeof t?[t,["accumulated"],["get",e]]:t;a.push(...q({key:`${n}.${e}.map`,value:r,expressionContext:"cluster-map"})),a.push(...q({key:`${n}.${e}.reduce`,value:s,expressionContext:"cluster-reduce"}))}return a;case"video":return U({key:n,value:i,valueSpec:r.source_video,style:s,styleSpec:r});case"image":return U({key:n,value:i,valueSpec:r.source_image,style:s,styleSpec:r});case"canvas":return[new e.V(n,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return J({key:`${n}.type`,value:i.type,valueSpec:{values:ae(r)}})}}function ae(e){return e.source.reduce((t,i)=>{const n=e[i];return"enum"===n.type.type&&(t=t.concat(Object.keys(n.type.values))),t},[])}function le(t){const i=t.value,n=t.styleSpec,r=n.light,s=t.style;let o=[];const a=e.J(i);if(void 0===i)return o;if("object"!==a)return o=o.concat([new e.V("light",i,`object expected, ${a} found`)]),o;for(const t in i){const a=t.match(/^(.*)-transition$/),l=t.match(/^(.*)-use-theme$/);o=o.concat(l&&r[l[1]]?fe({key:t,value:i[t],valueSpec:{type:"string"},style:s,styleSpec:n}):a&&r[a[1]]&&r[a[1]].transition?fe({key:t,value:i[t],valueSpec:n.transition,style:s,styleSpec:n}):r[t]?fe({key:t,value:i[t],valueSpec:r[t],style:s,styleSpec:n}):[new e.V(t,i[t],`unknown property "${t}"`)])}return o}function ce(t){const i=t.value;let n=[];if(!i)return n;const r=e.J(i);if("object"!==r)return n=n.concat([new e.V("light-3d",i,`object expected, ${r} found`)]),n;const s=t.styleSpec,o=s["light-3d"],a=t.key,l=t.style,c=t.style.lights;for(const t of["type","id"])if(!(t in i))return n=n.concat([new e.V("light-3d",i,`missing property ${t} on light`)]),n;if(i.type&&c)for(let r=0;r[],array:$,boolean:function(t){const i=t.value,n=t.key,r=e.J(i);return"boolean"!==r?[new e.V(n,i,`boolean expected, ${r} found`)]:[]},number:G,color:function(t){const i=t.key,n=t.value,r=e.J(n);return"string"!==r?[new e.V(i,n,`color expected, ${r} found`)]:null===e.a0.parseCSSColor(n)?[new e.V(i,n,`color expected, "${n}" found`)]:[]},enum:J,filter:K,function:X,layer:ne,object:U,source:oe,model:e.a4,light:le,"light-3d":ce,terrain:he,fog:de,string:re,formatted:function(e){return 0===re(e).length?[]:q(e)},resolvedImage:function(e){return 0===re(e).length?[]:q(e)},projection:function(t){const i=t.value,n=t.styleSpec,r=n.projection,s=t.style;let o=[];const a=e.J(i);if("object"===a)for(const e in i)o=o.concat(fe({key:e,value:i[e],valueSpec:r[e],style:s,styleSpec:n}));else"string"!==a&&(o=o.concat([new e.V("projection",i,`object or string expected, ${a} found`)]));return o},import:function(t){const{value:i,styleSpec:n}=t,{data:r,...s}=i;Object.defineProperty(s,"__line__",{value:i.__line__,enumerable:!1});let o=U(e.L({},t,{value:s,valueSpec:n.import}));return""===e.M(s.id)&&o.push(new e.V(`${t.key}.id`,s,"import id can't be an empty string")),r&&(o=o.concat(me(r,n,{key:`${t.key}.data`}))),o},iconset:function(t){const i=t.value,n=t.key,r=t.styleSpec,s=t.style;if(!i.type)return[new e.V(n,i,'"type" is required')];const o=e.M(i.type);let a=[];if(a=a.concat(U({key:n,value:i,valueSpec:r[`iconset_${o}`],style:s,styleSpec:r})),"source"===o&&i.source){const t=s.sources&&s.sources[i.source],r=t&&e.M(t.type);t?"raster-array"!==r&&a.push(new e.V(n,i.source,`iconset cannot be used with a source of type ${String(r)}, it only be used with a "raster-array" source type`)):a.push(new e.V(n,i.source,`source "${i.source}" not found`))}return a}};function fe(t,i=!1){const n=t.value,r=t.valueSpec,s=t.styleSpec;if(r.expression&&e.a2(e.M(n)))return X(t);if(r.expression&&e.S(e.U(n)))return q(t);if(r.type&&ue[r.type]){const n=ue[r.type](t);return!0===i&&n.length>0&&"array"===e.J(t.value)?q(t):n}return U(e.L({},t,{valueSpec:r.type?s[r.type]:r}))}function pe(t){const i=t.value,n=t.key,r=re(t);return r.length||(-1===i.indexOf("{fontstack}")&&r.push(new e.V(n,i,'"glyphs" url must include a "{fontstack}" token')),-1===i.indexOf("{range}")&&r.push(new e.V(n,i,'"glyphs" url must include a "{range}" token'))),r}function me(t,i=e.a5,n={}){return fe({key:n.key||"",value:t,valueSpec:i.$root,styleSpec:i,style:t,objectElementValidators:{glyphs:pe,"*":()=>[]}})}function ge(t,i=e.a5){return De(me(t,i))}const _e=e=>De(oe(e)),ye=e=>De(le(e)),ve=e=>De(ce(e)),xe=e=>De(he(e)),be=e=>De(de(e)),we=t=>De(function(t){const i=t.value,n=t.style,r=t.styleSpec,s=r.snow;let o=[];const a=e.J(i);if(void 0===i)return o;if("object"!==a)return o=o.concat([new e.V("snow",i,`object expected, ${a} found`)]),o;for(const t in i){const a=t.match(/^(.*)-transition$/);o=o.concat(a&&s[a[1]]&&s[a[1]].transition?fe({key:t,value:i[t],valueSpec:r.transition,style:n,styleSpec:r}):s[t]?fe({key:t,value:i[t],valueSpec:s[t],style:n,styleSpec:r}):[new e.K(t,i[t],`unknown property "${t}"`)])}return o}(t)),Se=t=>De(function(t){const i=t.value,n=t.style,r=t.styleSpec,s=r.rain;let o=[];const a=e.J(i);if(void 0===i)return o;if("object"!==a)return o=o.concat([new e.V("rain",i,`object expected, ${a} found`)]),o;for(const t in i){const a=t.match(/^(.*)-transition$/);o=o.concat(a&&s[a[1]]&&s[a[1]].transition?fe({key:t,value:i[t],valueSpec:r.transition,style:n,styleSpec:r}):s[t]?fe({key:t,value:i[t],valueSpec:s[t],style:n,styleSpec:r}):[new e.K(t,i[t],`unknown property "${t}"`)])}return o}(t)),Te=e=>De(ne(e)),ke=e=>De(K(e)),Me=e=>De(te(e)),Ae=e=>De(ie(e)),Ce=t=>De(e.a4(t));function De(e){return e.slice().sort((e,t)=>e.line&&t.line?e.line-t.line:0)}function Le(t,i){let n=!1;if(i&&i.length)for(const r of i)r instanceof e.K?e.w(r.message):(t.fire(new e.z(new Error(r.message))),n=!0);return n}let Ee;class Ie extends e.E{constructor(t,i="flat"){super(),this._transitionable=new e.a6(Ee||(Ee=new e.a7({anchor:new e.a8(e.a5.light.anchor),position:new e.a9(e.a5.light.position),color:new e.a8(e.a5.light.color),intensity:new e.a8(e.a5.light.intensity)}))),this.setLight(t,i),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,t,i={}){this._validate(ye,e,i)||(this._transitionable.setTransitionOrValue(e),this.id=t)}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(t,i,n){return(!n||!1!==n.validate)&&Le(this,t.call(ge,e.h({value:i,style:{glyphs:!0,sprite:!0},styleSpec:e.a5})))}}let Pe=class extends e.E{constructor(t,i,n,r,s){super(),this.scope=n,this._transitionable=new e.a6(new e.a7({source:new e.a8(e.a5.terrain.source),exaggeration:new e.a8(e.a5.terrain.exaggeration)}),n,r),this._transitionable.setTransitionOrValue(t,r),this._transitioning=this._transitionable.untransitioned(),this.drapeRenderMode=i,this.worldview=s}get(){return this._transitionable.serialize()}set(e,t){this._transitionable.setTransitionOrValue(e,t)}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}getExaggeration(t){return this._transitioning.possiblyEvaluate(new e.aa(t,{worldview:this.worldview})).get("exaggeration")}getAttenuationRange(){if(!this.isZoomDependent())return null;const t=this._transitionable._values.exaggeration;if(!t)return null;const i=t.value.expression;if(!i)return null;let n=-1,r=-1,s=1;for(const t of i.zoomStops)s=i.evaluate(new e.aa(t,{worldview:this.worldview})),s>.01?(n=t,r=-1):r=t;return s<.01&&n>0&&r>n?[n,r]:null}isZoomDependent(){const t=this._transitionable._values.exaggeration;return null!=t&&null!=t.value&&null!=t.value.expression&&t.value.expression instanceof e.ab}};const Re=.05;function Oe(t,i,n,r){const s=e.af(45,65,n),[o,a]=ze(t,r);let l=1-Math.min(1,Math.exp((i-o)/(a-o)*-6));return l*=l*l,l=Math.min(1,1.00747*l),l*s*t.alpha}function ze(e,t){const i=.5/Math.tan(.5*t);return[e.range[0]+i,e.range[1]+i]}function Fe(t,i,n,r,s){const o=e.ad([],[i,n,r],s.mercatorFogMatrix);return Oe(t,e.ae(o),s.pitch,s._fov)}function Ne(t,i,n,r,s,o,a){const l=[[n,r,0],[s,r,0],[s,o,0],[n,o,0]];let c=Number.MAX_VALUE,h=-Number.MAX_VALUE;for(const t of l){const n=e.ad([],t,i),r=e.ae(n);c=Math.min(c,r),h=Math.max(h,r)}return[Oe(t,c,a.pitch,a._fov),Oe(t,h,a.pitch,a._fov)]}class Ye extends e.E{constructor(t,i,n,r){super();const s=new e.a7({range:new e.a8(e.a5.fog.range),color:new e.a8(e.a5.fog.color),"color-use-theme":new e.a8({type:"string","property-type":"data-constant",default:"default"}),"high-color":new e.a8(e.a5.fog["high-color"]),"high-color-use-theme":new e.a8({type:"string","property-type":"data-constant",default:"default"}),"space-color":new e.a8(e.a5.fog["space-color"]),"space-color-use-theme":new e.a8({type:"string","property-type":"data-constant",default:"default"}),"horizon-blend":new e.a8(e.a5.fog["horizon-blend"]),"star-intensity":new e.a8(e.a5.fog["star-intensity"]),"vertical-range":new e.a8(e.a5.fog["vertical-range"])});this._transitionable=new e.a6(s,n,new Map(r)),this.set(t,r),this._transitioning=this._transitionable.untransitioned(),this._transform=i,this.properties=new e.ag(s),this.scope=n}get state(){const t=this._transform,i="globe"===t.projection.name,n=e.ah(t.zoom),r=this.properties.get("range"),s=[.5,3];return{range:i?[e.ai(s[0],r[0],n),e.ai(s[1],r[1],n)]:r,horizonBlend:this.properties.get("horizon-blend"),alpha:this.properties.get("color").a}}get(){return this._transitionable.serialize()}set(t,i,n={}){if(this._validate(be,t,n))return;const r=e.h({},t);for(const t of Object.keys(e.a5.fog))void 0===r[t]&&(r[t]=e.a5.fog[t].default);this._options=r,this._transitionable.setTransitionOrValue(this._options,i)}getOpacity(t){if(!this._transform.projection.supportsFog)return 0;const i=this.properties&&this.properties.get("color")||1;return("globe"===this._transform.projection.name?1:e.af(45,65,t))*i.a}getOpacityAtLatLng(t,i){return this._transform.projection.supportsFog?function(t,i,n){const r=e.ac.fromLngLat(i),s=n.elevation?n.elevation.getAtPointOrZero(r):0;return Fe(t,r.x,r.y,s,n)}(this.state,t,i):0}getOpacityForTile(t){if(!this._transform.projection.supportsFog)return[1,1];const i=this._transform.calculateFogTileMatrix(t.toUnwrapped());return Ne(this.state,i,0,0,e.aj,e.aj,this._transform)}getOpacityForBounds(e,t,i,n,r){return this._transform.projection.supportsFog?Ne(this.state,e,t,i,n,r,this._transform):[1,1]}getFovAdjustedRange(e){return this._transform.projection.supportsFog?ze(this.state,e):[0,1]}isVisibleOnFrustum(t){if(!this._transform.projection.supportsFog)return!1;const i=[4,5,6,7];for(const n of i){const i=t.points[n];let r;if(i[2]>=0)r=i;else{const s=t.points[n-4];r=e.ak(s,i,s[2]/(s[2]-i[2]))}if(Fe(this.state,r[0],r[1],0,this._transform)>=Re)return!0}return!1}updateConfig(e){this._transitionable.setTransitionOrValue(this._options,new Map(e))}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(t,i,n){return(!n||!1!==n.validate)&&Le(this,t.call(ge,e.h({value:i,style:{glyphs:!0,sprite:!0},styleSpec:e.a5})))}}let Be,He,je,Ve,We=class extends e.E{constructor(t,i,n,r){super();const s=Be||(Be=new e.a7({density:new e.a8(e.a5.snow.density),intensity:new e.a8(e.a5.snow.intensity),color:new e.a8(e.a5.snow.color),opacity:new e.a8(e.a5.snow.opacity),vignette:new e.a8(e.a5.snow.vignette),"vignette-color":new e.a8(e.a5.snow["vignette-color"]),"center-thinning":new e.a8(e.a5.snow["center-thinning"]),direction:new e.a8(e.a5.snow.direction),"flake-size":new e.a8(e.a5.snow["flake-size"])}));this._transitionable=new e.a6(s,n,new Map(r)),this.set(t,r),this._transitioning=this._transitionable.untransitioned(),this.properties=new e.ag(s),this.scope=n}get state(){const t=this.properties.get("opacity"),i=this.properties.get("color"),n=this.properties.get("direction"),r=e.al(n[0]),s=-Math.max(e.al(n[1]),.01),o=[Math.cos(r)*Math.cos(s),Math.sin(r)*Math.cos(s),Math.sin(s)],a=this.properties.get("vignette"),l=this.properties.get("vignette-color");return l.a=a,{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new e.am(i.r,i.g,i.b,i.a*t),direction:o,centerThinning:this.properties.get("center-thinning"),flakeSize:this.properties.get("flake-size"),vignetteColor:l}}get(){return this._transitionable.serialize()}set(t,i,n={}){if(this._validate(we,t,n))return;const r=e.h({},t);for(const t of Object.keys(e.a5.snow))void 0===r[t]&&(r[t]=e.a5.snow[t].default);this._options=r,this._transitionable.setTransitionOrValue(this._options,i)}updateConfig(e){this._transitionable.setTransitionOrValue(this._options,new Map(e))}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(t,i,n){return(!n||!1!==n.validate)&&Le(this,t.call(ge,e.h({value:i,style:{glyphs:!0,sprite:!0},styleSpec:e.a5})))}},Ue=class extends e.E{constructor(t,i,n,r){super();const s=He||(He=new e.a7({density:new e.a8(e.a5.rain.density),intensity:new e.a8(e.a5.rain.intensity),color:new e.a8(e.a5.rain.color),opacity:new e.a8(e.a5.rain.opacity),vignette:new e.a8(e.a5.rain.vignette),"vignette-color":new e.a8(e.a5.rain["vignette-color"]),"center-thinning":new e.a8(e.a5.rain["center-thinning"]),direction:new e.a8(e.a5.rain.direction),"droplet-size":new e.a8(e.a5.rain["droplet-size"]),"distortion-strength":new e.a8(e.a5.rain["distortion-strength"])}));this._transitionable=new e.a6(s,n,new Map(r)),this.set(t,r),this._transitioning=this._transitionable.untransitioned(),this.properties=new e.ag(s),this.scope=n}get state(){const t=this.properties.get("opacity"),i=this.properties.get("color"),n=this.properties.get("direction"),r=e.al(n[0]),s=-Math.max(e.al(n[1]),.01),o=[Math.cos(r)*Math.cos(s),Math.sin(r)*Math.cos(s),Math.sin(s)],a=this.properties.get("vignette-color");return a.a=this.properties.get("vignette"),{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new e.am(i.r,i.g,i.b,i.a*t),direction:o,centerThinning:this.properties.get("center-thinning"),dropletSize:this.properties.get("droplet-size"),distortionStrength:this.properties.get("distortion-strength"),vignetteColor:a}}get(){return this._transitionable.serialize()}set(t,i,n={}){if(this._validate(Se,t,n))return;const r=e.h({},t);for(const t of Object.keys(e.a5.rain))void 0===r[t]&&(r[t]=e.a5.rain[t].default);this._options=r,this._transitionable.setTransitionOrValue(this._options,i)}updateConfig(e){this._transitionable.setTransitionOrValue(this._options,new Map(e))}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(t,i,n){return(!n||!1!==n.validate)&&Le(this,t.call(ge,e.h({value:i,style:{glyphs:!0,sprite:!0},styleSpec:e.a5})))}};class $e extends e.E{constructor(t,i,n,r){super(),this.scope=n,this._options=t,this.properties=new e.ag(i),this._transitionable=new e.a6(i,n,new Map(r)),this._transitionable.setTransitionOrValue(t.properties),this._transitioning=this._transitionable.untransitioned()}updateConfig(e){this._transitionable.setTransitionOrValue(this._options.properties,new Map(e))}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}get(){return this._options.properties=this._transitionable.serialize(),this._options}set(e,t){this._options=e,this._transitionable.setTransitionOrValue(e.properties,t)}shadowsEnabled(){return!!this.properties&&!0===this.properties.get("cast-shadows")}}class Ge{constructor(e,t,i){this.screenBounds=e,this.cameraPoint=i.getCameraPoint(),this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=t,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this._bufferedScreenMercator(0,i)}static createFromScreenPoints(t,i){let n,r;if(t instanceof e.P||"number"==typeof t[0]){const s=e.P.convert(t);n=[s],r=i.isPointAboveHorizon(s)}else{const s=e.P.convert(t[0]),o=e.P.convert(t[1]),a=s.add(o)._div(2);n=[s,o],r=e.ao(s,o).every(e=>i.isPointAboveHorizon(e))&&i.isPointAboveHorizon(a)}return new Ge(n,r,i)}isPointQuery(){return 1===this.screenBounds.length}bufferedScreenGeometry(t){return e.ao(this.screenBounds[0],1===this.screenBounds.length?this.screenBounds[0]:this.screenBounds[1],t)}bufferedCameraGeometry(t){const i=this.screenBounds[0],n=1===this.screenBounds.length?this.screenBounds[0].add(new e.P(1,1)):this.screenBounds[1],r=e.ao(i,n,0,!1);return this.cameraPoint.y>n.y&&(this.cameraPoint.x>i.x&&this.cameraPoint.x=n.x?r[2]=this.cameraPoint:this.cameraPoint.x<=i.x&&(r[3]=this.cameraPoint)),e.ap(r,t)}bufferedCameraGeometryGlobe(t){const i=this.screenBounds[0],n=1===this.screenBounds.length?this.screenBounds[0].add(new e.P(1,1)):this.screenBounds[1],r=e.ao(i,n,t),s=this.cameraPoint.clone();switch(3*((s.y>i.y)+(s.y>n.y))+((s.x>i.x)+(s.x>n.x))){case 0:r[0]=s,r[4]=s.clone();break;case 1:r.splice(1,0,s);break;case 2:r[1]=s;break;case 3:r.splice(4,0,s);break;case 5:r.splice(2,0,s);break;case 6:r[3]=s;break;case 7:r.splice(3,0,s);break;case 8:r[2]=s}return r}containsTile(t,i,n,r=0){const s=t.queryPadding/i._pixelsPerMercatorPixel+1,o=n?this._bufferedCameraMercator(s,i):this._bufferedScreenMercator(s,i);let a=t.tileID.wrap+(o.unwrapped?r:0);const l=o.polygon.map(i=>e.aq(t.tileTransform,i,a));if(!e.ar(l,0,0,e.aj,e.aj))return;a=t.tileID.wrap+(this.screenGeometryMercator.unwrapped?r:0);const c=this.screenGeometryMercator.polygon.map(i=>e.as(t.tileTransform,i,a)),h=c.map(t=>new e.P(t[0],t[1])),d=i.getFreeCameraOptions().position||new e.ac(0,0,0),u=e.as(t.tileTransform,d,a),f=c.map(t=>{const i=e.at(t,t,u);return e.au(i,i),new e.av(u,i)}),p=e.aw(t,1,i.zoom)*i._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:h,tilespaceRays:f,bufferedTilespaceGeometry:l,bufferedTilespaceBounds:(m=e.ax(l),m.min.x=e.ay(m.min.x,0,e.aj),m.min.y=e.ay(m.min.y,0,e.aj),m.max.x=e.ay(m.max.x,0,e.aj),m.max.y=e.ay(m.max.y,0,e.aj),m),tile:t,tileID:t.tileID,pixelToTileUnitsFactor:p};var m}_bufferedScreenMercator(e,t){const i=Ze(e);if(this._screenRaycastCache[i])return this._screenRaycastCache[i];{let n;return n="globe"===t.projection.name?this._projectAndResample(this.bufferedScreenGeometry(e),t):{polygon:this.bufferedScreenGeometry(e).map(e=>t.pointCoordinate3D(e)),unwrapped:!0},this._screenRaycastCache[i]=n,n}}_bufferedCameraMercator(e,t){const i=Ze(e);if(this._cameraRaycastCache[i])return this._cameraRaycastCache[i];{let n;return n="globe"===t.projection.name?this._projectAndResample(this.bufferedCameraGeometryGlobe(e),t):{polygon:this.bufferedCameraGeometry(e).map(e=>t.pointCoordinate3D(e)),unwrapped:!0},this._cameraRaycastCache[i]=n,n}}_projectAndResample(t,i){const n=function(t,i){const n=e.az([],i.pixelMatrix,i.globeMatrix),r=[0,-e.aB,0,1],s=[0,e.aB,0,1],o=[0,0,0,1];e.aA(r,r,n),e.aA(s,s,n),e.aA(o,o,n);const a=new e.P(r[0]/r[3],r[1]/r[3]),l=new e.P(s[0]/s[3],s[1]/s[3]),c=e.aC(t,a)&&r[3]1?Xe(t.slice(0,u),i):[],m=unew e.P(qe(t.x),t.y)),m=m.map(t=>new e.P(qe(t.x),t.y));const g=[...p];0===g.length&&g.push(m[m.length-1]);const _=e.ai(g[g.length-1].y,(0===m.length?p[0]:m[0]).y,f);let y;return y=c?[new e.P(0,_),new e.P(0,0),new e.P(1,0),new e.P(1,_)]:[new e.P(1,_),new e.P(1,1),new e.P(0,1),new e.P(0,_)],g.push(...y),0===m.length?g.push(p[0]):g.push(...m),{polygon:g.map(t=>new e.ac(t.x,t.y)),unwrapped:!1}}(t,i);if(n)return n;const r=function(t,i){let n=!1,r=-1/0,s=0;for(let e=0;er&&(r=t[e].x,s=e);for(let e=0;e.5&&(r.x{e.x-=1}),{polygon:t,unwrapped:n}}(Xe(t,i).map(t=>new e.P(qe(t.x),t.y)),i);return{polygon:r.polygon.map(t=>new e.ac(t.x,t.y)),unwrapped:r.unwrapped}}}function Xe(t,i){return e.aE(t,e=>{const t=i.pointCoordinate3D(e);e.x=t.x,e.y=t.y},1/256)}function qe(e){return e<0?1+e%1:e%1}function Ze(e){return 100*e|0}function Je(t,i,n,r,s){const o=function(n,r){if(n)return s(n);if(r){if(t.url&&r.tiles&&t.tiles&&delete t.tiles,r.variants){if(!Array.isArray(r.variants))return s(new Error("variants must be an array"));for(const t of r.variants){if(null==t||"object"!=typeof t||t.constructor!==Object)return s(new Error("variant must be an object"));if(!Array.isArray(t.capabilities))return s(new Error("capabilities must be an array"));if(1===t.capabilities.length&&"meshopt"===t.capabilities[0]){r=e.h(r,t);break}}}const n=e.aF(e.h({},r,t),["tilejson","tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","extra_bounds","scheme","tileSize","encoding","vector_layers","raster_layers","worldview_options","worldview_default","worldview"]);n.tiles=i.canonicalizeTileset(n,t.url),s(null,n)}},a=function(e,t,i){if(!e)return null;if(!t&&!i)return e;i=i||e.worldview_default;const n=Object.values(e.language||{});if(0===n.length)return null;const r=Object.values(e.worldview||{});if(0===r.length)return null;const s=n.every(e=>e===t),o=r.every(e=>e===i);return s&&o?e:t in(e.language_options||{})||i in(e.worldview_options||{})?null:e.language_options&&e.worldview_options?e:null}(t.data,n,r);return a?e.q.frame(()=>o(null,a)):t.url?e.n(i.transformRequest(i.normalizeSourceURL(t.url,null,n,r),e.R.Source),o):e.q.frame(()=>{const{data:e,...i}=t;o(null,i)})}function Ke(t,i){const n=Math.pow(2,i.z),r=Math.floor(e.aD(t.getWest())*n),s=Math.floor(e.aH(t.getNorth())*n),o=Math.ceil(e.aD(t.getEast())*n),a=Math.ceil(e.aH(t.getSouth())*n);return i.x>=r&&i.x=s&&i.ythis.maxzoom||e.z{if(this._tileJSONRequest=null,this._loaded=!0,r)i&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${i}`),n&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${n}`),this.fire(new e.z(r));else if(s){if(e.h(this,s),this.hasWorldviews=!!s.worldview_options,s.worldview_default&&(this.worldviewDefault=s.worldview_default),s.vector_layers){this.vectorLayers=s.vector_layers,this.vectorLayerIds=[],this.localizableLayerIds=new Set;for(const e of s.vector_layers)this.vectorLayerIds.push(e.id),s.worldview&&s.worldview[e.source]&&this.localizableLayerIds.add(e.id)}this.tileBounds=Qe.fromTileJSON(s),E(s.tiles,this.map._requestManager._customAccessToken),this.fire(new e.A("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.A("data",{dataType:"source",sourceDataType:"content"}))}t&&t(r)})}loaded(){return this._loaded}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}onAdd(e){this.map=e,this.load()}reload(){this.cancelTileJSONRequest();const t=e.C(this.id,this.scope);this.load(()=>this.map.style.clearSource(t))}setTiles(e){return this._options.tiles=e,this.reload(),this}setUrl(e){return this.url=e,this._options.url=e,this.reload(),this}onRemove(e){this.cancelTileJSONRequest()}serialize(){return e.h({},this._options)}loadTile(t,i){const n=t.tileID.canonical.url(this.tiles,this.scheme),r=this.map._requestManager.normalizeTileURL(n),s=this.map._requestManager.transformRequest(r,e.R.Tile),o=this.map.style?this.map.style.getLut(this.scope):null,a=o?{image:o.image.clone()}:null,l={request:s,data:void 0,uid:t.uid,tileID:t.tileID,tileZoom:t.tileZoom,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,lut:a,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.type,source:this.id,scope:this.scope,pixelRatio:e.q.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,isSymbolTile:t.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:t.isExtraShadowCaster,tessellationStep:this.map._tessellationStep,scaleFactor:this.map.getScaleFactor(),worldview:this.map.getWorldview()||this.worldviewDefault};if(this.hasWorldviews&&e.j(n)&&(l.localizableLayerIds=this.localizableLayerIds),l.request.collectResourceTiming=this._collectResourceTiming,t.actor&&"expired"!==t.state)"loading"===t.state?t.reloadCallback=i:t.request=t.actor.send("reloadTile",l,c.bind(this));else if(t.actor=this._tileWorkers[r]=this._tileWorkers[r]||this.dispatcher.getActor(),this.dispatcher.ready)t.request=t.actor.send("loadTile",l,c.bind(this),void 0,!0);else{const i=e.aJ.call({deduped:this._deduped},l,(e,i)=>{e||!i?c.call(this,e):(l.data={cacheControl:i.cacheControl,expires:i.expires,rawData:i.rawData.slice(0)},t.actor&&t.actor.send("loadTile",l,c.bind(this),void 0,!0))},!0);t.request={cancel:i}}function c(n,r){return delete t.request,t.aborted?i(null):n&&404!==n.status?i(n):(r&&r.resourceTiming&&(t.resourceTiming=r.resourceTiming),this.map._refreshExpiredTiles&&r&&t.setExpiryData(r),t.loadVectorData(r,this.map.painter),e.aK(this.dispatcher),i(null),void(t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)))}}abortTile(e){e.request&&(e.request.cancel(),delete e.request),e.actor&&e.actor.send("abortTile",{uid:e.uid,type:this.type,source:this.id,scope:this.scope})}unloadTile(e,t){e.actor&&e.actor.send("removeTile",{uid:e.uid,type:this.type,source:this.id,scope:this.scope}),e.destroy()}hasTransition(){return!1}afterUpdate(){this._tileWorkers={}}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}class tt extends e.E{constructor(t,i,n,r){super(),this.id=t,this.dispatcher=n,this.setEventedParent(r),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=e.h({type:"raster"},i),e.h(this,e.aF(i,["url","scheme","tileSize"]))}load(t){this._loaded=!1,this.fire(new e.A("dataloading",{dataType:"source"}));const i=this.map.getWorldview();this._tileJSONRequest=Je(this._options,this.map._requestManager,null,i,(i,n)=>{this._tileJSONRequest=null,this._loaded=!0,i?this.fire(new e.z(i)):n&&(e.h(this,n),n.raster_layers&&(this.rasterLayers=n.raster_layers,this.rasterLayerIds=this.rasterLayers.map(e=>e.id)),this.tileBounds=Qe.fromTileJSON(n),E(n.tiles),this.fire(new e.A("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.A("data",{dataType:"source",sourceDataType:"content"}))),t&&t(i)})}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}reload(){this.cancelTileJSONRequest();const t=e.C(this.id,this.scope);this.load(()=>this.map.style.clearSource(t))}setTiles(e){return this._options.tiles=e,this.reload(),this}setUrl(e){return this.url=e,this._options.url=e,this.reload(),this}onRemove(e){this.cancelTileJSONRequest()}serialize(){return e.h({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(t,i){const n=e.q.devicePixelRatio>=2,r=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),n,this.tileSize);t.request=e.o(this.map._requestManager.transformRequest(r,e.R.Tile),(n,r,s,o)=>(delete t.request,t.aborted?(t.state="unloaded",i(null)):n?(t.state="errored",i(n)):r?(this.map._refreshExpiredTiles&&t.setExpiryData({cacheControl:s,expires:o}),t.setTexture(r,this.map.painter),t.state="loaded",e.aK(this.dispatcher),void i(null)):i(null)))}abortTile(e,t){e.request&&(e.request.cancel(),delete e.request),t&&t()}unloadTile(t,i){t.texture&&t.texture instanceof e.T?(t.destroy(!0),t.texture&&t.texture instanceof e.T&&this.map.painter.saveTileTexture(t.texture)):t.destroy(),i&&i()}hasTransition(){return!1}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}class it extends tt{constructor(t,i,n,r){super(t,i,n,r),this.type="raster-array",this.maxzoom=22,this.partial=!0,this._options=e.h({type:"raster-array"},i)}triggerRepaint(e){const t=this.map.painter._terrain,i=this.map.style.getSourceCache(this.id);t&&t.enabled&&i&&t._clearRenderCacheForTile(i.id,e.tileID),this.map.triggerRepaint()}loadTile(t,i){const n=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize),r=this.map._requestManager.transformRequest(n,e.R.Tile),s={request:r,uid:t.uid,tileID:t.tileID,type:this.type,source:this.id,scope:this.scope,partial:this.partial};t.source=this.id,t.scope=this.scope,t.requestParams=r,t.actor||(t.actor=this.dispatcher.getActor());const o=(e,n,r,s)=>{if(delete t.request,t.aborted)return t.state="unloaded",i(null);if(e){if("AbortError"===e.name)return;return t.state="errored",i(e)}if(this.map._refreshExpiredTiles&&n&&t.setExpiryData({cacheControl:r,expires:s}),this.partial)t.state="empty";else{if(!n)return i(null);t.state="loaded",t._isHeaderLoaded=!0,t._mrt=n}i(null)};t.request=this.partial?t.fetchHeader(void 0,o.bind(this)):t.actor.send("loadTile",s,o.bind(this),void 0,!0)}abortTile(e){e.request&&(e.request.cancel(),delete e.request),e.actor&&e.actor.send("abortTile",{uid:e.uid,type:this.type,source:this.id,scope:this.scope})}unloadTile(e,t){const i=e.texturePerLayer;if(e.flushAllQueues(),i.size){e.destroy(!0);for(const e of i.values())this.map.painter.saveTileTexture(e)}else e.destroy()}prepareTile(t,i,n,r){t._isHeaderLoaded&&("empty"!==t.state&&(t.state="reloading"),t.fetchBand(i,n,r,(i,r)=>{if(i)return t.state="errored",this.fire(new e.z(i)),void this.triggerRepaint(t);r&&(t._isHeaderLoaded=!0,t.setTexturePerLayer(n,r,this.map.painter),t.state="loaded",this.triggerRepaint(t))}))}getInitialBand(e){if(!this.rasterLayers)return 0;const t=this.rasterLayers.find(({id:t})=>t===e),i=t&&t.fields,n=i&&i.bands&&i.bands;return n?n[0]:0}getTextureDescriptor(t,i,n){if(!t)return;const r=i.sourceLayer||this.rasterLayerIds&&this.rasterLayerIds[0];if(!r)return;let s=null;i instanceof e.aN?s=i.paint.get("raster-array-band"):i instanceof e.aO&&(s=i.paint.get("raster-particle-array-band"));const o=s||this.getInitialBand(r);if(null==o)return;if(!t.textureDescriptorPerLayer.get(i.id))return void this.prepareTile(t,r,i.id,o);if(t.updateNeeded(i.id,o)&&!n)return;const a=t.textureDescriptorPerLayer.get(i.id);return Object.assign({},a,{texture:t.texturePerLayer.get(i.id)})}getImages(t,i){const n=new Map;for(const r of t)for(const t of i){const[i,s]=t.split("/"),o=r.getLayer(i);if(!o)continue;if(!o.hasBand(s)||!o.hasDataForBand(s))continue;const{bytes:a,tileSize:l,buffer:c}=o.getBandView(s),h=l+2*c,d={data:new e.r({width:h,height:h},a),pixelRatio:2,sdf:!1,usvg:!1,version:0};n.set(t,d)}return n}}const nt={vector:et,raster:tt,"raster-dem":class extends tt{constructor(t,i,n,r){super(t,i,n,r),this.type="raster-dem",this.maxzoom=22,this._options=e.h({type:"raster-dem"},i),this.encoding=i.encoding||"mapbox"}loadTile(t,i){const n=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);function r(e,n){e&&(t.state="errored",i(e)),n&&(t.dem=n,t.dem.onDeserialize(),t.needsHillshadePrepare=!0,t.needsDEMTextureUpload=!0,t.state="loaded",i(null))}t.request=e.o(this.map._requestManager.transformRequest(n,e.R.Tile),function(n,s,o,a){if(delete t.request,t.aborted)t.state="unloaded",i(null);else if(n)t.state="errored",i(n);else if(s){this.map._refreshExpiredTiles&&t.setExpiryData({cacheControl:o,expires:a});const i=ImageBitmap&&s instanceof ImageBitmap&&e.t(),n=1-(s.width-e.aL(s.width))/2;n<1||t.neighboringTiles||(t.neighboringTiles=this._getNeighboringTiles(t.tileID));const l=i?s:e.q.getImageData(s,n),c={uid:t.uid,tileID:t.tileID,source:this.id,type:this.type,scope:this.scope,rawImageData:l,encoding:this.encoding,padding:n};t.actor&&"expired"!==t.state||(t.actor=this.dispatcher.getActor(),t.actor.send("loadTile",c,r.bind(this),void 0,!0))}}.bind(this))}_getNeighboringTiles(t){const i=t.canonical,n=Math.pow(2,i.z),r=(i.x-1+n)%n,s=0===i.x?t.wrap-1:t.wrap,o=(i.x+1+n)%n,a=i.x+1===n?t.wrap+1:t.wrap,l={};return l[new e.aM(t.overscaledZ,s,i.z,r,i.y).key]={backfilled:!1},l[new e.aM(t.overscaledZ,a,i.z,o,i.y).key]={backfilled:!1},i.y>0&&(l[new e.aM(t.overscaledZ,s,i.z,r,i.y-1).key]={backfilled:!1},l[new e.aM(t.overscaledZ,t.wrap,i.z,i.x,i.y-1).key]={backfilled:!1},l[new e.aM(t.overscaledZ,a,i.z,o,i.y-1).key]={backfilled:!1}),i.y+1{if(this._loaded=!0,this._pendingLoad=null,i)this.fire(new e.z(i));else{const i={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&n&&n.resourceTiming&&n.resourceTiming[this.id]&&(i.resourceTiming=n.resourceTiming[this.id]),t&&(this._partialReload=!0),this.fire(new e.A("data",i)),this._partialReload=!1,this._metadataFired=!0}this._coalesce&&(this._updateWorkerData(t),this._coalesce=!1)})}loaded(){return this._loaded}reload(){const t=e.C(this.id,this.scope);this.map.style.clearSource(t),this._updateWorkerData()}loadTile(t,i){const n=t.actor?"reloadTile":"loadTile";t.actor=this.actor;const r=this.map.style?this.map.style.getLut(this.scope):null,s=r?{image:r.image.clone()}:null,o=this._partialReload,a={type:this.type,uid:t.uid,tileID:t.tileID,tileZoom:t.tileZoom,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,lut:s,scope:this.scope,pixelRatio:e.q.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:t.isExtraShadowCaster,scaleFactor:this.map.getScaleFactor(),partial:o,worldview:this.map.getWorldview()};t.request=this.actor.send(n,a,(e,r)=>o&&!r?(t.state="loaded",i(null)):(delete t.request,t.destroy(),t.aborted?i(null):e?i(e):(t.loadVectorData(r,this.map.painter,"reloadTile"===n),i(null))),void 0,"loadTile"===n)}abortTile(e){e.request&&(e.request.cancel(),delete e.request),e.aborted=!0}unloadTile(e,t){this.actor.send("removeTile",{uid:e.uid,type:this.type,source:this.id,scope:this.scope}),e.destroy()}onRemove(e){this._pendingLoad&&this._pendingLoad.cancel()}serialize(){return e.h({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},video:class extends e.aP{constructor(e,t,i,n){super(e,t,i,n),this.roundZoom=!0,this.type="video",this.options=t}load(){this._loaded=!1;const t=this.options;this.urls=[];for(const i of t.urls)this.urls.push(this.map._requestManager.transformRequest(i,e.R.Source).url);e.aQ(this.urls,(t,i)=>{this._loaded=!0,t?this.fire(new e.z(t)):i&&(this.video=i,this.video.loop=!0,this.video.setAttribute("playsinline",""),this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(t){if(this.video){const i=this.video.seekable;ti.end(0)?this.fire(new e.z(new e.V(`sources.${this.id}`,null,`Playback for this video can be set only between the ${i.start(0)} and ${i.end(0)}-second mark.`))):this.video.currentTime=t}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(0===Object.keys(this.tiles).length||this.video.readyState<2)return;const t=this.map.painter.context,i=t.gl;this.texture?this.video.paused||(this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE),i.texSubImage2D(i.TEXTURE_2D,0,0,0,i.RGBA,i.UNSIGNED_BYTE,this.video)):(this.texture=new e.T(t,this.video,i.RGBA8),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE),this.width=this.video.videoWidth,this.height=this.video.videoHeight),this._prepareData(t)}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:e.aP,model:class extends e.E{constructor(e,t,i,n){super(),this.id=e,this.type="model",this.models=[],this._loaded=!1,this._options=t}load(){const t=[];for(const i in this._options.models){const n=this._options.models[i],r=e.aS(this.map._requestManager.transformRequest(n.uri,e.R.Model).url).then(t=>{if(!t)return;const r=e.aT(t),s=new e.aU(i,n.position,n.orientation,r);s.computeBoundsAndApplyParent(),this.models.push(s)}).catch(t=>{this.fire(new e.z(new Error(`Could not load model ${i} from ${n.uri}: ${t.message}`)))});t.push(r)}Promise.allSettled(t).then(()=>{this._loaded=!0,this.fire(new e.A("data",{dataType:"source",sourceDataType:"metadata"}))}).catch(t=>{this._loaded=!0,this.fire(new e.z(new Error(`Could not load models: ${t.message}`)))})}onAdd(e){this.map=e,this.load()}hasTransition(){return!1}loaded(){return this._loaded}getModels(){return this.models}loadTile(e,t){}serialize(){return this._options}},"batched-model":class extends e.E{constructor(e,t,i,n){super(),this.type="batched-model",this.id=e,this.tileSize=512,this._options=t,this.tiles=this._options.tiles,this.maxzoom=t.maxzoom||19,this.minzoom=t.minzoom||0,this.roundZoom=!0,this.usedInConflation=!0,this.dispatcher=i,this.reparseOverscaled=!1,this.scheme="xyz",this._loaded=!1,this.setEventedParent(n)}onAdd(e){this.map=e,this.load()}reload(){this.cancelTileJSONRequest();const t=e.C(this.id,this.scope);this.load(()=>this.map.style.clearSource(t))}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}load(t){this._loaded=!1,this.fire(new e.A("dataloading",{dataType:"source"}));const i=Array.isArray(this.map._language)?this.map._language.join():this.map._language,n=this.map.getWorldview();this._tileJSONRequest=Je(this._options,this.map._requestManager,i,n,(r,s)=>{this._tileJSONRequest=null,this._loaded=!0,r?(i&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${i}`),n&&2!==n.length&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${n}`),this.fire(new e.z(r))):s&&(e.h(this,s),s.bounds&&(this.tileBounds=new Qe(s.bounds,this.minzoom,this.maxzoom)),E(s.tiles,this.map._requestManager._customAccessToken),this.fire(new e.A("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.A("data",{dataType:"source",sourceDataType:"content"}))),t&&t(r)})}hasTransition(){return!1}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loaded(){return this._loaded}loadTile(t,i){const n=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme)),r={request:this.map._requestManager.transformRequest(n,e.R.Tile),data:void 0,uid:t.uid,tileID:t.tileID,tileZoom:t.tileZoom,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.type,source:this.id,scope:this.scope,showCollisionBoxes:this.map.showCollisionBoxes,isSymbolTile:t.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0,pixelRatio:e.q.devicePixelRatio,promoteId:this.promoteId};if(t.actor&&"expired"!==t.state)if("loading"===t.state)t.reloadCallback=i;else{if(t.buckets){const e=Object.values(t.buckets);for(const t of e)t.dirty=!0;return void(t.state="loaded")}t.request=t.actor.send("reloadTile",r,s.bind(this))}else t.actor=this.dispatcher.getActor(),t.request=t.actor.send("loadTile",r,s.bind(this),void 0,!0);function s(e,n){return t.aborted?i(null):e&&404!==e.status?i(e):(this.map._refreshExpiredTiles&&n&&t.setExpiryData(n),t.loadModelData(n,this.map.painter),t.state="loaded",void i(null))}}serialize(){return e.h({},this._options)}},canvas:class extends e.aP{constructor(t,i,n,r){super(t,i,n,r),i.coordinates?Array.isArray(i.coordinates)&&4===i.coordinates.length&&!i.coordinates.some(e=>!Array.isArray(e)||2!==e.length||e.some(e=>"number"!=typeof e))||this.fire(new e.z(new e.V(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new e.z(new e.V(`sources.${t}`,null,'missing required property "coordinates"'))),i.animate&&"boolean"!=typeof i.animate&&this.fire(new e.z(new e.V(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),i.canvas?"string"==typeof i.canvas||i.canvas instanceof HTMLCanvasElement||this.fire(new e.z(new e.V(`sources.${t}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new e.z(new e.V(`sources.${t}`,null,'missing required property "canvas"'))),this.options=i,this.animate=void 0===i.animate||i.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new e.z(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(e){this.pause()}prepare(){let t=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,t=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,t=!0),this._hasInvalidDimensions())return;if(0===Object.keys(this.tiles).length)return;const i=this.map.painter.context;this.texture?!t&&!this._playing||this.texture instanceof e.aR||this.texture.update(this.canvas,{premultiply:!0}):this.texture=new e.T(i,this.canvas,i.gl.RGBA8,{premultiply:!0}),this._prepareData(i)}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}},custom:class extends e.E{constructor(t,i,n,r){super(),this.id=t,this.type="custom",this._dataType="raster",this._dispatcher=n,this._implementation=i,this.setEventedParent(r),this.scheme="xyz",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this._loaded=!1,this.roundZoom=!0,this._implementation||this.fire(new e.z(new Error(`Missing implementation for ${this.id} custom source`))),this._implementation.loadTile||this.fire(new e.z(new Error(`Missing loadTile implementation for ${this.id} custom source`))),this._implementation.bounds&&(this.tileBounds=new Qe(this._implementation.bounds,this.minzoom,this.maxzoom)),i.update=this._update.bind(this),i.clearTiles=this._clearTiles.bind(this),i.coveringTiles=this._coveringTiles.bind(this),e.h(this,e.aF(i,["dataType","scheme","minzoom","maxzoom","tileSize","attribution","minTileCacheSize","maxTileCacheSize"]))}serialize(){return e.aF(this,["type","scheme","minzoom","maxzoom","tileSize","attribution"])}load(){this._loaded=!0,this.fire(new e.A("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.A("data",{dataType:"source",sourceDataType:"content"}))}loaded(){return this._loaded}onAdd(t){this.map=t,this._loaded=!1,this.fire(new e.A("dataloading",{dataType:"source"})),this._implementation.onAdd&&this._implementation.onAdd(t),this.load()}onRemove(e){this._implementation.onRemove&&this._implementation.onRemove(e)}hasTile(e){if(this._implementation.hasTile){const{x:t,y:i,z:n}=e.canonical;return this._implementation.hasTile({x:t,y:i,z:n})}return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(e,t){const{x:i,y:n,z:r}=e.tileID.canonical,s=new AbortController;e.request=Promise.resolve(this._implementation.loadTile({x:i,y:n,z:r},{signal:s.signal})).then(function(i){return delete e.request,e.aborted?(e.state="unloaded",t(null)):void 0===i?(e.state="errored",t(null)):null===i?(this.loadTileData(e,{width:this.tileSize,height:this.tileSize,data:null}),e.state="loaded",t(null)):function(e){return e instanceof ImageData||e instanceof HTMLCanvasElement||e instanceof ImageBitmap||e instanceof HTMLImageElement}(i)?(this.loadTileData(e,i),e.state="loaded",void t(null)):(e.state="errored",t(new Error(`Can't infer data type for ${this.id}, only raster data supported at the moment`)))}.bind(this)).catch(i=>{"AbortError"!==i.name&&(e.state="errored",t(i))}),e.request.cancel=()=>s.abort()}loadTileData(e,t){e.setTexture(t,this.map.painter)}unloadTile(t,i){if(t.texture&&t.texture instanceof e.T?(t.destroy(!0),t.texture&&t.texture instanceof e.T&&this.map.painter.saveTileTexture(t.texture)):t.destroy(),this._implementation.unloadTile){const{x:e,y:i,z:n}=t.tileID.canonical;this._implementation.unloadTile({x:e,y:i,z:n})}i&&i()}abortTile(e,t){e.request&&e.request.cancel&&(e.request.cancel(),delete e.request),t&&t()}hasTransition(){return!1}_coveringTiles(){return this.map.transform.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,roundZoom:this.roundZoom}).map(e=>({x:e.canonical.x,y:e.canonical.y,z:e.canonical.z}))}_clearTiles(){const t=e.C(this.id,this.scope);this.map.style.clearSource(t)}_update(){this.fire(new e.A("data",{dataType:"source",sourceDataType:"content"}))}}},rt=function(t,i,n,r){const s=new nt[i.type](t,i,n,r);if(s.id!==t)throw new Error(`Expected Source id to be ${t} instead of ${s.id}`);return e.aV(["load","abort","unload","serialize","prepare"],s),s};function st(e,t,i=""){return`${i}:${t.id||""}:${t.layer.id}:${function(e){if("layerId"in e)return`layer:${e.layerId}`;{const{featuresetId:t,importId:i}=e;return`featureset:${t}${i?`:import:${i}`:""}`}}(e.target)}`}function ot(e,t,i,n=""){if(e.uniqueFeatureID){const r=st(e,t,n);if(i.has(r))return!0;i.add(r)}return!1}function at(e,t,i,n,r=!1){const s=t.sourceCache.transform,o=t.sourceCache.tilesIn(e,t.has3DLayers,r);o.sort(ht);const a=[];for(const e of o){const o=e.tile.queryRenderedFeatures(t,e,i,n,s,r);Object.keys(o).length&&a.push({wrappedTileID:e.tile.tileID.wrapped().key,queryResults:o})}return 0===a.length?{}:function(e){const t={},i={};for(const n of e){const e=n.queryResults,r=n.wrappedTileID,s=i[r]=i[r]||{};for(const i in e){const n=e[i],r=s[i]=s[i]||{},o=t[i]=t[i]||[];for(const e of n)r[e.featureIndex]||(r[e.featureIndex]=!0,o.push(e))}}return t}(a)}function lt(e,t,i,n,r,s){const o={},a=n.queryRenderedSymbols(e),l=[];for(const e of Object.keys(a).map(Number))l.push(r[e]);l.sort(ht);for(const e of l){const n=e.featureIndex.lookupSymbolFeatures(a[e.bucketInstanceId],e.bucketIndex,e.sourceLayerIndex,t,i,s);for(const t in n){const i=o[t]=o[t]||[],r=n[t];r.sort((t,i)=>{const n=e.featureSortOrder;if(n){const e=n.indexOf(t.featureIndex);return n.indexOf(i.featureIndex)-e}return i.featureIndex-t.featureIndex});for(const e of r)i.push(e)}}return o}function ct(e,t){const i=e.getRenderableIds().map(t=>e.getTileByID(t)),n=[],r={};for(let e=0;et.getLayer(e)).filter(Boolean);if(0!==e.length){n.layers=e,n.stateDependentLayerIds&&(n.stateDependentLayers=n.stateDependentLayerIds.map(t=>e.filter(e=>e.id===t)[0]));for(const t of e)i[t.fqid]=n}}return i}const ut=32,ft=33,pt=new Uint16Array(8184);for(let e=0;e<2046;e++){let t=e+2,i=0,n=0,r=0,s=0,o=0,a=0;for(1&t?r=s=o=ut:i=n=a=ut;(t>>=1)>1;){const e=i+r>>1,l=n+s>>1;1&t?(r=i,s=n,i=o,n=a):(i=r,n=s,r=o,s=a),o=e,a=l}const l=4*e;pt[l+0]=i,pt[l+1]=n,pt[l+2]=r,pt[l+3]=s}const mt=new Uint16Array(2178),gt=new Uint8Array(1089),_t=new Uint16Array(1089);function yt(e){return 0===e?-.03125:32===e?.03125:0}const vt={type:2,extent:e.aj,loadGeometry:()=>[[new e.P(0,0),new e.P(e.aj+1,0),new e.P(e.aj+1,e.aj+1),new e.P(0,e.aj+1),new e.P(0,0)]]};class xt{constructor(t,i,n,r,s,o){this.tileID=t,this.uid=e.a$(),this.uses=0,this.tileSize=i,this.tileZoom=n,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=s,r&&r.style&&(this._lastUpdatedBrightness=r.style.getBrightness()),this.expiredRequestCount=0,this.state="loading",r&&r.transform&&(this.projection=r.transform.projection),this.worldview=o}registerFadeDuration(t){const i=t+this.timeAdded;ie)t=!1;else if(i)if(this.expirationTime0&&!i;p&&!a.stateDependentLayers.length&&!i||a.update(u,h,r,f,p?a.stateDependentLayers:a.layers,i,s),(a instanceof e.b7||a instanceof e.b8)&&t._terrain&&t._terrain.enabled&&d&&a.uploadPending()&&t._terrain._clearRenderCacheForTile(d.id,this.tileID);const m=t&&t.style&&t.style.getOwnLayer(o);m&&(this.queryPadding=Math.max(this.queryPadding,m.queryRadius(a)))}}holdingForFade(){return void 0!==this.symbolFadeHoldUntil}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil=0;e--){const t=4*e,i=pt[t+0],n=pt[t+1],r=pt[t+2],s=pt[t+3],o=i+r>>1,a=n+s>>1,l=o+a-n,c=a+i-o,h=n*ft+i,d=s*ft+r,u=a*ft+o,f=Math.hypot((mt[2*h+0]+mt[2*d+0])/2-mt[2*u+0],(mt[2*h+1]+mt[2*d+1])/2-mt[2*u+1])>=16;gt[u]=gt[u]||(f?1:0),e<1022&&(gt[u]=gt[u]||gt[(n+c>>1)*ft+(i+l>>1)]||gt[(s+c>>1)*ft+(r+l>>1)])}const s=new e.aZ,o=new e.a_;let a=0;function l(t,i){const n=i*ft+t;return 0===_t[n]&&(s.emplaceBack(mt[2*n+0],mt[2*n+1],t*e.aj/ut,i*e.aj/ut),_t[n]=++a),_t[n]-1}function c(e,t,i,n,r,s){const a=e+i>>1,h=t+n>>1;if(Math.abs(e-r)+Math.abs(t-s)>1&>[h*ft+a])c(r,s,e,t,a,h),c(i,n,r,s,a,h);else{const a=l(e,t),c=l(i,n),h=l(r,s);o.emplaceBack(a,c,h)}}return c(0,0,ut,ut,ut,0),c(ut,ut,0,0,0,ut),{vertices:s,indices:o}}(this.tileID.canonical,i);r=t.vertices,s=t.indices}else{r=new e.aZ,s=new e.a_;for(const{x:e,y:t}of n)r.emplaceBack(e,t,0,0);const t=e.be(r.int16.subarray(0,4*r.length),void 0,4);for(let e=0;e0&&(l=e.bi(new Float64Array(16),i.globeMatrix)),this._makeGlobeTileDebugBorderBuffer(t,r,i,o,l,a),this._makeGlobeTileDebugTextBuffer(t,r,i,o,l,a)}_globePoint(t,i,n,r,s,o,a){let l=e.bj(t,i,n);if(o){const s=1<.5?u=-1:d<-.5&&(u=1);let f=(t/e.aj+n.x)/s+u,p=(i/e.aj+n.y)/s;f=(f-c)*r._pixelsPerMercatorPixel+c,p=(p-h)*r._pixelsPerMercatorPixel+h;const m=[f*r.worldSize,p*r.worldSize,0];e.ad(m,m,o),l=e.bk(l,m,a)}return e.ad(l,l,s)}_makeGlobeTileDebugBorderBuffer(t,i,n,r,s,o){const a=new e.ba,l=new e.bb,c=new e.bl,h=(e,t,h,d,u)=>{const f=(h-e)/(u-1),p=(d-t)/(u-1),m=a.length;for(let h=0;hd*e+t;for(let e=0;e{if(e)i(e);else try{const e=n.getHeaderLength(r);if(e>t)return void(this.request=this.fetchHeader(e,i));n.parseHeader(r),this._isHeaderLoaded=!0;let a=0;for(const e of Object.values(n.layers))a=Math.max(a,e.dataIndex[e.dataIndex.length-1].lastByte);r.byteLength>=a&&(this.entireBuffer=r),i(null,this.entireBuffer||r,s,o)}catch(e){i(e)}}),this.request}fetchBand(t,i,n,r){const s=this._mrt;if(!this._isHeaderLoaded||!s)return void r(new Error("Tile header is not ready"));const o=this.actor;if(!o)return void r(new Error("Can't fetch tile band without an actor"));let a;const l=(e,s)=>{if(a.complete(e,s),e)return void r(e);this.updateTextureDescriptor(t,i,n);const o=this.textureDescriptorPerLayer.get(i);r(null,o&&o.img)},c=(e,t)=>{if(e)return r(e);const n=o.send("decodeRasterArray",{type:"raster-array",source:this.source,scope:this.scope,tileID:this.tileID,uid:this.uid,buffer:t,task:a},l,void 0,!0),s=this._workQueuePerLayer.get(i)||[];s.push(()=>{n&&n.cancel(),a.cancel()}),this._workQueuePerLayer.has(i)||this._workQueuePerLayer.set(i,s)},h=s.getLayer(t);if(!h)return void r(new Error(`Unknown sourceLayer "${t}"`));if(h.hasDataForBand(n)){this.updateTextureDescriptor(t,i,n);const e=this.textureDescriptorPerLayer.get(i);return void r(null,e?e.img:null)}const d=h.getDataRange([n]);if(a=s.createDecodingTask(d),!a||a.tasks.length)if(this.flushQueues(i),this.entireBuffer)c(null,this.entireBuffer.slice(d.firstByte,d.lastByte+1));else{const t=Object.assign({},this.requestParams,{headers:{Range:`bytes=${d.firstByte}-${d.lastByte}`}}),n=e.br(t,c),r=this._fetchQueuePerLayer.get(i)||[];r.push(()=>{n.cancel(),a.cancel()}),this._fetchQueuePerLayer.has(i)||this._fetchQueuePerLayer.set(i,r)}else r(null)}updateNeeded(e,t){return(!this.textureDescriptorPerLayer.get(e)||this.textureDescriptorPerLayer.get(e).band!==t)&&"errored"!==this.state}updateTextureDescriptor(t,i,n){if(!this._mrt)return;const r=this._mrt.getLayer(t);if(!r||!r.hasBand(n)||!r.hasDataForBand(n))return;const{bytes:s,tileSize:o,buffer:a,offset:l,scale:c}=r.getBandView(n),h=o+2*a,d=new e.r({width:h,height:h},s),u=this.texturePerLayer.get(i);u&&u instanceof e.T&&u.update(d,{premultiply:!1}),this.textureDescriptorPerLayer.set(i,{layer:t,band:n,img:d,buffer:a,offset:l,tileSize:o,format:r.pixelFormat,mix:[c,256*c,65536*c,16777216*c]})}destroy(t=!1){if(super.destroy(t),delete this._mrt,!t)for(const t of this.texturePerLayer.values())t&&t instanceof e.T&&t.destroy();this.texturePerLayer.clear(),this.textureDescriptorPerLayer.clear(),this.fbo&&(this.fbo.destroy(),delete this.fbo),delete this.request,delete this.requestParams,this._isHeaderLoaded=!1}}class wt{constructor(e,t){this.max=e,this.onRemove=t,this.reset()}reset(){for(const e in this.data)for(const t of this.data[e])t.timeout&&clearTimeout(t.timeout),this.onRemove(t.value);return this.data={},this.order=[],this}add(e,t,i){const n=e.wrapped().key;void 0===this.data[n]&&(this.data[n]=[]);const r={value:t,timeout:void 0};if(void 0!==i&&(r.timeout=setTimeout(()=>{this.remove(e,r)},i)),this.data[n].push(r),this.order.push(n),this.order.length>this.max){const e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){const t=this.data[e].shift();return t.timeout&&clearTimeout(t.timeout),0===this.data[e].length&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),t.value}getByKey(e){const t=this.data[e];return t?t[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,t){if(!this.has(e))return this;const i=e.wrapped().key,n=void 0===t?0:this.data[i].indexOf(t),r=this.data[i][n];return this.data[i].splice(n,1),r.timeout&&clearTimeout(r.timeout),0===this.data[i].length&&delete this.data[i],this.onRemove(r.value),this.order.splice(this.order.indexOf(i),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){const e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}filter(e){const t=[];for(const i in this.data)for(const n of this.data[i])e(n.value)||t.push(n);for(const e of t)this.remove(e.value.tileID,e)}}class St{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,i,n){const r=String(i);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][r]=this.stateChanges[t][r]||{},e.h(this.stateChanges[t][r],n),null===this.deletedStates[t]){this.deletedStates[t]={};for(const e in this.state[t])e!==r&&(this.deletedStates[t][e]=null)}else if(this.deletedStates[t]&&null===this.deletedStates[t][r]){this.deletedStates[t][r]={};for(const e in this.state[t][r])n[e]||(this.deletedStates[t][r][e]=null)}else for(const e in n)this.deletedStates[t]&&this.deletedStates[t][r]&&null===this.deletedStates[t][r][e]&&delete this.deletedStates[t][r][e]}removeFeatureState(e,t,i){if(null===this.deletedStates[e])return;const n=String(t);if(this.deletedStates[e]=this.deletedStates[e]||{},i&&void 0!==t)null!==this.deletedStates[e][n]&&(this.deletedStates[e][n]=this.deletedStates[e][n]||{},this.deletedStates[e][n][i]=null);else if(void 0!==t)if(this.stateChanges[e]&&this.stateChanges[e][n])for(i in this.deletedStates[e][n]={},this.stateChanges[e][n])this.deletedStates[e][n][i]=null;else this.deletedStates[e][n]=null;else this.deletedStates[e]=null}getState(t,i){const n=this.state[t]||{},r=this.stateChanges[t]||{},s=this.deletedStates[t];if(null===s)return{};if(void 0!==i){const t=String(i),o=e.h({},n[t],r[t]);if(s){const e=s[i];if(null===e)return{};for(const t in e)delete o[t]}return o}const o=e.h({},n,r);if(s)for(const e in s)delete o[e];return o}initializeTileState(e,t){e.refreshFeatureState(t)}coalesceChanges(t,i){const n={};for(const t in this.stateChanges){this.state[t]=this.state[t]||{};const i={};for(const n in this.stateChanges[t])this.state[t][n]||(this.state[t][n]={}),e.h(this.state[t][n],this.stateChanges[t][n]),i[n]=this.state[t][n];n[t]=i}for(const t in this.deletedStates){this.state[t]=this.state[t]||{};const i={};if(null===this.deletedStates[t])for(const e in this.state[t])i[e]={},this.state[t][e]={};else for(const e in this.deletedStates[t]){if(null===this.deletedStates[t][e])this.state[t][e]={};else if(this.state[t][e])for(const i of Object.keys(this.deletedStates[t][e]))delete this.state[t][e][i];i[e]=this.state[t][e]}n[t]=n[t]||{},e.h(n[t],i)}if(this.stateChanges={},this.deletedStates={},0!==Object.keys(n).length)for(const e in t)t[e].refreshFeatureState(i)}}class Tt extends e.E{constructor(e,t,i){super(),this.id=e,this._onlySymbols=i,t.on("data",e=>{"source"===e.dataType&&"metadata"===e.sourceDataType&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&"source"===e.dataType&&"content"===e.sourceDataType&&(this.reload(),this.transform&&this.update(this.transform))}),t.on("error",()=>{this._sourceErrored=!0}),this._source=t,this._tiles={},this._cache=new wt(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._minTileCacheSize=t.minTileCacheSize,this._maxTileCacheSize=t.maxTileCacheSize,this._loadedParentTiles={},this.castsShadows=!1,this.tileCoverLift=0,this._coveredTiles={},this._shadowCasterTiles={},this._state=new St,this._isRaster="raster"===this._source.type||"raster-dem"===this._source.type||"raster-array"===this._source.type||"custom"===this._source.type&&"raster"===this._source._dataType}onAdd(e){this.map=e,this._minTileCacheSize=void 0===this._minTileCacheSize&&e?e._minTileCacheSize:this._minTileCacheSize,this._maxTileCacheSize=void 0===this._maxTileCacheSize&&e?e._maxTileCacheSize:this._maxTileCacheSize}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded)return!1;if(!this._source.loaded())return!1;for(const e in this._tiles)if(!this._tiles[e].loaded())return!1;return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform)}_loadTile(e,t){return e.isSymbolTile=this._onlySymbols,e.isExtraShadowCaster=this._shadowCasterTiles[e.tileID.key],this._source.loadTile(e,t)}_unloadTile(e){if(this._source.unloadTile)return this._source.unloadTile(e)}_abortTile(e){if(this._source.abortTile)return this._source.abortTile(e)}serialize(){return this._source.serialize()}prepare(e){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const t in this._tiles){const i=this._tiles[t];i.upload(e),i.prepare(this.map.style.imageManager,this.map?this.map.painter:null,this._source.scope)}}getIds(){return Object.values(this._tiles).map(e=>e.tileID).sort(kt).map(e=>e.key)}getRenderableIds(t,i){const n=[];for(const e in this._tiles)this._isIdRenderable(+e,t,i)&&n.push(this._tiles[e]);return t?n.sort((t,i)=>{const n=t.tileID,r=i.tileID,s=new e.P(n.canonical.x,n.canonical.y)._rotate(this.transform.angle),o=new e.P(r.canonical.x,r.canonical.y)._rotate(this.transform.angle);return n.overscaledZ-r.overscaledZ||o.y-s.y||o.x-s.x}).map(e=>e.tileID.key):n.map(e=>e.tileID).sort(kt).map(e=>e.key)}hasRenderableParent(e){const t=this.findLoadedParent(e,0);return!!t&&this._isIdRenderable(t.tileID.key)}_isIdRenderable(e,t,i){return this._tiles[e]&&this._tiles[e].hasData()&&!this._coveredTiles[e]&&(t||!this._tiles[e].holdingForFade())&&(i||!this._shadowCasterTiles[e])}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const e in this._tiles)"errored"!==this._tiles[e].state&&this._reloadTile(+e,"reloading")}}_reloadTile(e,t){const i=this._tiles[e];i&&("loading"!==i.state&&(i.state=t),this._loadTile(i,this._tileLoaded.bind(this,i,e,t)))}_tileLoaded(t,i,n,r){if(r)if(t.state="errored",404!==r.status)this._source.fire(new e.z(r,{tile:t}));else{if(this._source.fire(new e.A("data",{dataType:"source",sourceDataType:"error",sourceId:this._source.id,tile:t})),!(t.tileID.key in this._loadedParentTiles))return;if("raster-dem"===this._source.type&&this.usedForTerrain&&this.map.painter.terrain){const e=this.map.painter.terrain;this.update(this.transform,e.getScaledDemTileSize(),!0),e.resetTileLookupCache(this.id)}else this.update(this.transform)}else t.timeAdded=e.q.now(),"expired"===n&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(i,t),"raster-dem"===this._source.type&&t.dem&&this._backfillDEM(t),this._state.initializeTileState(t,this.map?this.map.painter:null),this._source.fire(new e.A("data",{dataType:"source",tile:t,coord:t.tileID,sourceCacheId:this.id}))}_backfillDEM(e){const t=this.getRenderableIds();for(let n=0;n1||(Math.abs(i)>1&&(1===Math.abs(i+r)?i+=r:1===Math.abs(i-r)&&(i-=r)),t.dem&&e.dem&&(e.dem.backfillBorder(t.dem,i,n),e.neighboringTiles&&e.neighboringTiles[s]&&(e.neighboringTiles[s].backfilled=!0)))}}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._tiles[e]}_retainLoadedChildren(e,t,i,n){for(const r in this._tiles){let s=this._tiles[r];if(n[r]||!s.hasData()||s.tileID.overscaledZ<=t||s.tileID.overscaledZ>i)continue;let o=s.tileID;for(;s&&s.tileID.overscaledZ>t+1;){const e=s.tileID.scaledTo(s.tileID.overscaledZ-1);s=this._tiles[e.key],s&&s.hasData()&&(o=e)}let a=o;for(;a.overscaledZ>t;)if(a=a.scaledTo(a.overscaledZ-1),e[a.key]){n[o.key]=o;break}}}findLoadedParent(e,t){if(e.key in this._loadedParentTiles){const i=this._loadedParentTiles[e.key];return i&&i.tileID.overscaledZ>=t?i:null}for(let i=e.overscaledZ-1;i>=t;i--){const t=e.scaledTo(i),n=this._getLoadedTile(t);if(n)return n}}_getLoadedTile(e){const t=this._tiles[e.key];return t&&t.hasData()?t:this._cache.getByKey(this._source.reparseOverscaled?e.wrapped().key:e.canonical.key)}updateCacheSize(e,t){t=t||this._source.tileSize;const i=Math.ceil(e.width/t)+1,n=Math.ceil(e.height/t)+1,r=Math.floor(i*n*5),s="number"==typeof this._minTileCacheSize?Math.max(this._minTileCacheSize,r):r,o="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,s):s;this._cache.setMaxSize(o)}handleWrapJump(e){const t=Math.round((e-(void 0===this._prevLng?e:this._prevLng))/360);if(this._prevLng=e,t){const e={};for(const i in this._tiles){const n=this._tiles[i];n.tileID=n.tileID.unwrapTo(n.tileID.wrap+t),e[n.tileID.key]=n}this._tiles=e;for(const e in this._timers)clearTimeout(this._timers[e]),delete this._timers[e];for(const e in this._tiles)this._setTileReloadTimer(+e,this._tiles[e])}}update(t,i,n,r,s){if(this.transform=t,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage)return;if(this.usedForTerrain&&!n)return;this.updateCacheSize(t,i),"globe"!==this.transform.projection.name&&this.handleWrapJump(this.transform.center.lng),this._shadowCasterTiles={},this._coveredTiles={};const o="batched-model"===this._source.type;let a,l=this._source.maxzoom;const c=this.map&&this.map.painter?this.map.painter._terrain:null;if(c&&c.sourceCache===this&&c.attenuationRange()){const e=c.attenuationRange()[0],t=Math.floor(e)-Math.log2(c.getDemUpscale());l>t&&(l=t)}if(this.used||this.usedForTerrain){if(this._source.tileID)a=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(t=>new e.aM(t.canonical.z,t.wrap,t.canonical.z,t.canonical.x,t.canonical.y));else if(0!==this.tileCoverLift){const r=t.clone();r.tileCoverLift=this.tileCoverLift,a=r.coveringTiles({tileSize:i||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:l,roundZoom:this._source.roundZoom&&!n,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:o}),this._source.minzoom<=1&&"globe"===t.projection.name&&(a.push(new e.aM(1,0,1,0,0)),a.push(new e.aM(1,0,1,1,0)),a.push(new e.aM(1,0,1,0,1)),a.push(new e.aM(1,0,1,1,1)))}else if(a=t.coveringTiles({tileSize:i||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:l,roundZoom:this._source.roundZoom&&!n,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:o}),this._source.hasTile){const e=this._source.hasTile.bind(this._source);a=a.filter(t=>e(t))}}else a=[];if(a.length>0&&"globe"!==this.transform.projection.name&&!this.usedForTerrain&&!Mt(this._source.type)){const e=t.coveringZoomLevel({tileSize:i||this._source.tileSize,roundZoom:this._source.roundZoom&&!n}),l=Math.min(e,this._source.maxzoom);if(o){const e=t.extendTileCover(a,l);for(const t of e)a.push(t)}else if(s){const e=t.extendTileCoverToNearPlane(a,this.transform.getFrustum(l),l);for(const t of e)a.push(t)}else if(this.castsShadows&&r){const e=t.extendTileCover(a,l,r);for(const t of e)this._shadowCasterTiles[t.key]=!0,a.push(t)}}const h=this._updateRetainedTiles(a);if(Mt(this._source.type)&&0!==a.length){const t={},i={},n=Object.keys(h);for(const r of n){const n=h[r],s=this._tiles[r];if(!s||s.fadeEndTime&&s.fadeEndTime<=e.q.now())continue;const o=this.findLoadedParent(n,Math.max(n.overscaledZ-Tt.maxOverzooming,this._source.minzoom));o&&(this._addTile(o.tileID),t[o.tileID.key]=o.tileID),i[r]=n}const r=a[a.length-1].overscaledZ;for(const e in this._tiles){const t=this._tiles[e];if(h[e]||!t.hasData())continue;let n=t.tileID;for(;n.overscaledZ>r;){n=n.scaledTo(n.overscaledZ-1);const r=this._tiles[n.key];if(r&&r.hasData()&&i[n.key]){h[e]=t.tileID;break}}}for(const e in t)h[e]||(this._coveredTiles[e]=!0,h[e]=t[e])}for(const e in h)this._tiles[e].clearFadeHold();const d=e.bs(this._tiles,h);for(const e of d){const t=this._tiles[e];t.hasSymbolBuckets&&!t.holdingForFade()?t.setHoldDuration(this.map._fadeDuration):t.hasSymbolBuckets&&!t.symbolFadeFinished()||this._removeTile(+e)}this._updateLoadedParentTileCache(),this._onlySymbols&&this._source.afterUpdate&&this._source.afterUpdate()}releaseSymbolFadeTiles(){for(const e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(+e)}_updateRetainedTiles(e){const t={};if(0===e.length)return t;const i={},n=e.reduce((e,t)=>Math.min(e,t.overscaledZ),1/0),r=e[0].overscaledZ,s=Math.max(r-Tt.maxOverzooming,this._source.minzoom),o=Math.max(r+Tt.maxUnderzooming,this._source.minzoom),a={};for(const i of e){const e=this._addTile(i);t[i.key]=i,e.hasData()||n=this._source.maxzoom){const e=n.children(this._source.maxzoom)[0],i=this.getTile(e);if(i&&i.hasData()){t[e.key]=e;continue}}else{const e=n.children(this._source.maxzoom);if(t[e[0].key]&&t[e[1].key]&&t[e[2].key]&&t[e[3].key])continue}let r=e.wasRequested();for(let o=n.overscaledZ-1;o>=s;--o){const s=n.scaledTo(o);if(i[s.key])break;if(i[s.key]=!0,e=this.getTile(s),!e&&r&&(e=this._addTile(s)),e&&(t[s.key]=s,r=e.wasRequested(),e.hasData()))break}}return t}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const e in this._tiles){const t=[];let i,n=this._tiles[e].tileID;for(;n.overscaledZ>0;){if(n.key in this._loadedParentTiles){i=this._loadedParentTiles[n.key];break}t.push(n.key);const e=n.scaledTo(n.overscaledZ-1);if(i=this._getLoadedTile(e),i)break;n=e}for(const e of t)this._loadedParentTiles[e]=i}}_addTile(t){let i=this._tiles[t.key];if(i)return!0!==i.isExtraShadowCaster||!!this._shadowCasterTiles[t.key]||this._reloadTile(t.key,"reloading"),i;i=this._cache.getAndRemove(t),i&&(this._setTileReloadTimer(t.key,i),i.tileID=t,this._state.initializeTileState(i,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,i)));const n=Boolean(i);if(!n){const e=this.map?this.map.painter:null,n=this._source.tileSize*t.overscaleFactor();i="raster-array"===this._source.type?new bt(t,n,this.transform.tileZoom,e,this._isRaster):new xt(t,n,this.transform.tileZoom,e,this._isRaster,this._source.worldview),this._loadTile(i,this._tileLoaded.bind(this,i,t.key,i.state))}return i.uses++,this._tiles[t.key]=i,n||this._source.fire(new e.A("dataloading",{tile:i,coord:i.tileID,dataType:"source"})),i}_setTileReloadTimer(e,t){e in this._timers&&(clearTimeout(this._timers[e]),delete this._timers[e]);const i=t.getExpiryTimeout();i&&(this._timers[e]=setTimeout(()=>{this._reloadTile(e,"expired"),delete this._timers[e]},i))}_removeTile(e){const t=this._tiles[e];t&&(t.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),t.uses>0||(t.hasData()&&"reloading"!==t.state||"empty"===t.state?this._cache.add(t.tileID,t,t.getExpiryTimeout()):(t.aborted=!0,this._abortTile(t),this._unloadTile(t))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const e in this._tiles)this._removeTile(+e);this._source._clear&&this._source._clear(),this._cache.reset(),this.map&&this.usedForTerrain&&this.map.painter.terrain&&this.map.painter.terrain.resetTileLookupCache(this.id)}tilesIn(t,i,n){const r=[],s=this.transform;if(!s)return r;const o="globe"===s.projection.name,a=e.aD(s.center.lng);for(const l in this._tiles){const c=this._tiles[l];if(n&&c.clearQueryDebugViz(),c.holdingForFade())continue;let h;if(o){const t=c.tileID.canonical;if(0===t.z){const i=[Math.abs(e.ay(a,...At(t,-1))-a),Math.abs(e.ay(a,...At(t,1))-a)];h=[0,2*i.indexOf(Math.min(...i))-1]}else{const i=[Math.abs(e.ay(a,...At(t,-1))-a),Math.abs(e.ay(a,...At(t,0))-a),Math.abs(e.ay(a,...At(t,1))-a)];h=[i.indexOf(Math.min(...i))-1]}}else h=[0];for(const e of h){const n=t.containsTile(c,s,i,e);n&&r.push(n)}}return r}getShadowCasterCoordinates(){return this._getRenderableCoordinates(!1,!0)}getVisibleCoordinates(e){return this._getRenderableCoordinates(e)}_getRenderableCoordinates(e,t){const i=this.getRenderableIds(e,t).map(e=>this._tiles[e].tileID),n="globe"===this.transform.projection.name;for(const e of i)e.projMatrix=this.transform.calculateProjMatrix(e.toUnwrapped()),e.expandedProjMatrix=n?this.transform.calculateProjMatrix(e.toUnwrapped(),!1,!0):e.projMatrix;return i}sortCoordinatesByDistance(e){const t=e.slice(),i=this.transform._camera.position,n=this.transform._camera.forward(),r={};for(const e of t){const t=1/(1<r[e.key]-r[t.key]),t}hasTransition(){if(this._source.hasTransition())return!0;if(Mt(this._source.type))for(const t in this._tiles){const i=this._tiles[t];if(void 0!==i.fadeEndTime&&i.fadeEndTime>=e.q.now())return!0}return!1}setFeatureState(e,t,i){this._state.updateState(e=e||"_geojsonTileLayer",t,i)}removeFeatureState(e,t,i){this._state.removeFeatureState(e=e||"_geojsonTileLayer",t,i)}getFeatureState(e,t){return this._state.getState(e=e||"_geojsonTileLayer",t)}setDependencies(e,t,i){const n=this._tiles[e];n&&n.setDependencies(t,i)}reloadTilesForDependencies(e,t){for(const i in this._tiles)this._tiles[i].hasDependency(e,t)&&this._reloadTile(+i,"reloading");this._cache.filter(i=>!i.hasDependency(e,t))}_preloadTiles(t,i){if(!this._sourceLoaded){const e=()=>{this._sourceLoaded&&(this._source.off("data",e),this._preloadTiles(t,i))};return void this._source.on("data",e)}const n=new Map,r=Array.isArray(t)?t:[t],s=this.map.painter.terrain,o=this.usedForTerrain&&s?s.getScaledDemTileSize():this._source.tileSize;for(const e of r){const t=e.coveringTiles({tileSize:o,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain});for(const e of t)n.set(e.key,e);this.usedForTerrain&&e.updateElevation(!1)}const a=Array.from(n.values());e.bt(a,(e,t)=>{const i=new xt(e,this._source.tileSize*e.overscaleFactor(),this.transform.tileZoom,this.map.painter,this._isRaster,this._source.worldview);this._loadTile(i,e=>{"raster-dem"===this._source.type&&i.dem&&this._backfillDEM(i),t(e,i)})},i)}}function kt(e,t){const i=Math.abs(2*e.wrap)-+(e.wrap<0),n=Math.abs(2*t.wrap)-+(t.wrap<0);return e.overscaledZ-t.overscaledZ||n-i||t.canonical.y-e.canonical.y||t.canonical.x-e.canonical.x}function Mt(e){return"raster"===e||"image"===e||"video"===e||"custom"===e}function At(e,t){const i=1<0:"building"===i.type?n=!i.isHidden(e)&&i.paint.get("building-opacity")>0:"model"===i.type&&(n=!i.isHidden(e)&&i.paint.get("model-opacity").constantOr(1)>0),this.layersGotHidden=this.layersGotHidden||!n&&t.visible,t.visible=n}}updateZOffset(e,t){this.currentBuildingBuckets=[];for(const e of this.layers){const i=e.layer,n=this.style.getLayerSourceCache(i);let r=1;"fill-extrusion"===i.type?r=e.visible?i.paint.get("fill-extrusion-vertical-scale"):0:"building"===i.type&&(r=e.visible?i.paint.get("building-vertical-scale"):0);let s=n?n.getTile(t):null;if(!s&&n)for(const e in n._tiles){const i=n._tiles[e];if(t.canonical.isChildOf(i.tileID.canonical)){s=i;break}}this.currentBuildingBuckets.push({bucket:s?s.getBucket(i):null,tileID:s?s.tileID:t,verticalScale:r})}e.hasAnyZOffset=!1;let i=!1;for(let n=0;n{e in i&&(n[e]=i[e])}),n}function Lt(e){e=e.slice();const t=Object.create(null);for(let i=0;i0?(r-o)/a:0;return this.points[s].mult(1-l).add(this.points[i].mult(l))}}class Vt{constructor(e,t,i){const n=this.boxCells=[],r=this.circleCells=[];this.xCellCount=Math.ceil(e/i),this.yCellCount=Math.ceil(t/i);for(let e=0;ethis.width||n<0||t>this.height)return!r&&[];const o=[];if(e<=0&&t<=0&&this.width<=i&&this.height<=n){if(r)return!0;for(let e=0;e0:o}_queryCircle(e,t,i,n,r){const s=e-i,o=e+i,a=t-i,l=t+i;if(o<0||s>this.width||l<0||a>this.height)return!n&&[];const c=[];return this._forEachCell(s,a,o,l,this._queryCellCircle,c,{hitTest:n,circle:{x:e,y:t,radius:i},seenUids:{box:{},circle:{}}},r),n?c.length>0:c}query(e,t,i,n,r){return this._query(e,t,i,n,!1,r)}hitTest(e,t,i,n,r){return this._query(e,t,i,n,!0,r)}hitTestCircle(e,t,i,n){return this._queryCircle(e,t,i,!0,n)}_queryCell(e,t,i,n,r,s,o,a){const l=o.seenUids,c=this.boxCells[r];if(null!==c){const r=this.bboxes;for(const h of c)if(!l.box[h]){l.box[h]=!0;const c=4*h;if(e<=r[c+2]&&t<=r[c+3]&&i>=r[c+0]&&n>=r[c+1]&&(!a||a(this.boxKeys[h]))){if(o.hitTest)return s.push(!0),!0;s.push({key:this.boxKeys[h],x1:r[c],y1:r[c+1],x2:r[c+2],y2:r[c+3]})}}}const h=this.circleCells[r];if(null!==h){const r=this.circles;for(const c of h)if(!l.circle[c]){l.circle[c]=!0;const h=3*c;if(this._circleAndRectCollide(r[h],r[h+1],r[h+2],e,t,i,n)&&(!a||a(this.circleKeys[c]))){if(o.hitTest)return s.push(!0),!0;{const e=r[h],t=r[h+1],i=r[h+2];s.push({key:this.circleKeys[c],x1:e-i,y1:t-i,x2:e+i,y2:t+i})}}}}}_queryCellCircle(e,t,i,n,r,s,o,a){const l=o.circle,c=o.seenUids,h=this.boxCells[r];if(null!==h){const e=this.bboxes;for(const t of h)if(!c.box[t]){c.box[t]=!0;const i=4*t;if(this._circleAndRectCollide(l.x,l.y,l.radius,e[i+0],e[i+1],e[i+2],e[i+3])&&(!a||a(this.boxKeys[t])))return s.push(!0),!0}}const d=this.circleCells[r];if(null!==d){const e=this.circles;for(const t of d)if(!c.circle[t]){c.circle[t]=!0;const i=3*t;if(this._circlesCollide(e[i],e[i+1],e[i+2],l.x,l.y,l.radius)&&(!a||a(this.circleKeys[t])))return s.push(!0),!0}}}_forEachCell(e,t,i,n,r,s,o,a){const l=this._convertToXCellCoord(e),c=this._convertToYCellCoord(t),h=this._convertToXCellCoord(i),d=this._convertToYCellCoord(n);for(let u=l;u<=h;u++)for(let l=c;l<=d;l++)if(r.call(this,e,t,i,n,this.xCellCount*l+u,s,o,a))return}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,t,i,n,r,s){const o=n-e,a=r-t,l=i+s;return l*l>o*o+a*a}_circleAndRectCollide(e,t,i,n,r,s,o){const a=(s-n)/2,l=Math.abs(e-(n+a));if(l>a+i)return!1;const c=(o-r)/2,h=Math.abs(t-(r+c));if(h>c+i)return!1;if(l<=a||h<=c)return!0;const d=l-a,u=h-c;return d*d+u*u<=i*i}}const Wt=0,Ut=1,$t=2,Gt=Math.tan(85*Math.PI/180);function Xt(t,i,n,r,s,o,a){const l=e.bz();if(n)if("globe"===o.name){const t=e.bA(s,i);e.az(l,l,t)}else{const t=e.bB([],a);l[0]=t[0],l[1]=t[1],l[4]=t[2],l[5]=t[3],r||e.by(l,l,s.angle)}else e.az(l,s.labelPlaneMatrix,t);return l}function qt(e,t,i,n,r,s,o){const a=Xt(e,t,i,n,r,s,o);return"globe"===s.name&&i||(a[2]=a[6]=a[10]=a[14]=0),a}function Zt(t,i,n,r,s,o,a){if(n){if("globe"===o.name){const l=Xt(t,i,n,r,s,o,a);return e.bi(l,l),e.az(l,t,l),l}{const i=e.bw(t),n=e.bx([]);return n[0]=a[0],n[1]=a[1],n[4]=a[2],n[5]=a[3],e.az(i,i,n),r||e.by(i,i,-s.angle),i}}return s.glCoordMatrix}function Jt(t,i,n,r){const s=[t,i,n,1];n?e.aA(s,s,r):li(s,s,r);const o=s[3];return s[0]/=o,s[1]/=o,s[2]/=o,s}function Kt(e,t){return Math.min(.5+e/t*.5,1.5)}function Qt(e,t){const i=e[0]/e[3],n=e[1]/e[3];return i>=-t[0]&&i<=t[0]&&n>=-t[1]&&n<=t[1]}function ei(t,i,n,r,s,o,a,l,c,h){const d=n.transform,u=r?t.textSizeData:t.iconSizeData,f=e.bH(u,n.transform.zoom),p="globe"===d.projection.name,m=[256/n.width*2+1,256/n.height*2+1],g=r?t.text.dynamicLayoutVertexArray:t.icon.dynamicLayoutVertexArray;g.clear();let _=null;p&&(_=r?t.text.globeExtVertexArray:t.icon.globeExtVertexArray);const y=t.lineVertexArray,v=r?t.text.placedSymbolArray:t.icon.placedSymbolArray,x=n.transform.width/n.transform.height;let b,w=!1;for(let r=0;rMath.abs(n)?{useVertical:!0}:t===e.bI.vertical?r>0?{needsFlipping:!0}:null:i!==Wt&&function(e,t){return 0===e||Math.abs(t/e)>Gt}(n,r)?i===Ut?{needsFlipping:!0}:null:n<0?{needsFlipping:!0}:null}function ni(t,i,n,r,s,o,a,l,c,h,d,u,f,p,m,g,_,y,v,x){const b=i/24,w=t.lineOffsetX*b,S=t.lineOffsetY*b,{lineStartIndex:T,glyphStartIndex:k,numGlyphs:M,segment:A,writingMode:C,flipState:D}=t,L=T+t.lineLength,E=t=>{if(d){const[i,n,r]=t.up,s=h.length;e.bK(d,s+0,i,n,r),e.bK(d,s+1,i,n,r),e.bK(d,s+2,i,n,r),e.bK(d,s+3,i,n,r)}const[i,n,r]=t.point;e.bL(h,i,n,r,t.angle)};if(M>1){const e=ti(b,l,w,S,n,u,f,t,c,o,p,g,!1,_,y,v,x);if(!e)return{notEnoughRoom:!0};if(r&&!n){let[i,n,r]=e.first.point,[s,o,l]=e.last.point;[i,n]=Jt(i,n,r,a),[s,o]=Jt(s,o,l,a);const c=ii(C,D,(s-i)*m,o-n);if(t.flipState=c&&c.needsFlipping?Ut:$t,c)return c}E(e.first);for(let e=k+1;e0?o:si(f,r,i,1,s,void 0,_,y.canonical),l=ii(C,D,(a[0]-i[0])*m,a[1]-i[1]);if(t.flipState=l&&l.needsFlipping?Ut:$t,l)return l}const i=oi(b*l.getoffsetX(k),w,S,n,u,f,A,T,L,c,o,p,g,!1,!1,_,y,v,x);if(!i)return{notEnoughRoom:!0};E(i)}return{}}function ri(e,t,i,n,r){const{x:s,y:o,z:a}=n.projectTilePoint(e.x,e.y,t);if(!r)return Jt(s,o,a,i);const[l,c,h]=r(e);return Jt(s+l,o+c,a+h,i)}function si(t,i,n,r,s,o,a,l){const c=ri(t.sub(i)._unit()._add(t),l,s,a,o);return e.at(c,n,c),e.au(c,c),e.bE(c,n,c,r)}function oi(t,i,n,r,s,o,a,l,c,h,d,u,f,p,m,g,_,y,v){const x=r?t-i:t+i;let b=x>0?1:-1,w=0;r&&(b*=-1,w=Math.PI),b<0&&(w+=Math.PI);let S=l+a+(b>0?0:1)|0,T=s,k=s,M=0,A=0;const C=Math.abs(x),D=[],L=[];let E=o,I=E,P=e.bC([]);const R=()=>si(I,E,k,C-M+1,d,f,g,_.canonical);for(;M+A<=C;){if(S+=b,S=c)return null;if(k=T,I=E,D.push(k),p&&L.push(I),E=new e.P(h.getx(S),h.gety(S)),T=u[S],!T){const e=ri(E,_.canonical,d,g,f);T=e[3]>0?u[S]=e:R()}M+=A;const t=e.at([],T,k),i=e.bD(k,T);if(n&&i>0&&A>0&&e.bG(P,t)/(A*i)0,v),S=c*w.perspectiveRatio,T=(n.x1*i+a.x-n.padding)*S+w.point.x,k=(n.y1*i+a.y-n.padding)*S+w.point.y,M=(n.x2*i+a.x+n.padding)*S+w.point.x,A=(n.y2*i+a.y+n.padding)*S+w.point.y,C=w.perspectiveRatio<=.55||w.occluded;return!this.isInsideGrid(T,k,M,A)||!l&&this.grid.hitTest(T,k,M,A,d)||C?{box:[],offscreen:!1,occluded:w.occluded}:{box:[T,k,M,A],offscreen:this.isOffscreen(T,k,M,A),occluded:!1}}placeCollisionCircles(t,i,n,r,s,o,a,l,c,h,d,u,f,p,m){const g=[],_=this.transform.elevation,y=t.getProjection(),v=_?_.getAtTileOffsetFunc(m,this.transform.center.lat,this.transform.worldSize,y):null,x=new e.P(n.tileAnchorX,n.tileAnchorY);let{x:b,y:w,z:S}=y.projectTilePoint(x.x,x.y,m.canonical);if(v){const[e,t,i]=v(x);b+=e,w+=t,S+=i}const T="globe"===y.name,k=this.projectAndGetPerspectiveRatio(a,b,w,S,m,T||!!_||this.transform.pitch>0,y),{perspectiveRatio:M}=k,A=(d?o/M:o*M)/e.bU,C=Jt(b,w,S,l),D=n.lineOffsetX*A,L=n.lineOffsetY*A,E=e.al(t.layers[0].layout.get("text-max-angle")),I=Math.cos(E),P=k.signedDistanceFromCamera>0?ti(A,s,D,L,!1,C,x,n,r,l,{},_&&!d?v:null,d&&!!_,y,m,d,I):null;let R=!1,O=!1,z=!0;if(P&&!k.occluded){const t=.5*f*M+p,n=new e.P(-100,-100),r=new e.P(this.screenRightBoundary,this.screenBottomBoundary),s=new jt,{first:o,last:a}=P,l=o.path.length;let d=[];for(let e=l-1;e>=1;e--)d.push(o.path[e]);for(let e=1;e(v&&!T&&(i=v(ne[3]<=0)&&(d=[]));let _=[];if(d.length>0){let t=1/0,i=-1/0,s=1/0,o=-1/0;for(const e of d)t=Math.min(t,e[0]),s=Math.min(s,e[1]),i=Math.max(i,e[0]),o=Math.max(o,e[1]);i>=n.x&&t<=r.x&&o>=n.y&&s<=r.y&&(_=[d.map(t=>new e.P(t[0],t[1]))],(tr.x||sr.y)&&(_=e.bS(_,n.x,n.y,r.x,r.y)))}for(const e of _){s.reset(e,.25*t);let n=0;n=s.length<=.5*t?1:Math.ceil(s.paddedLength/m)+1;for(let e=0;e0){if(e.aA(l,l,t),this.fogState&&s&&"globe"!==a.name){const t=function(t,i,n,r,s,o){const a=o.calculateFogTileMatrix(s),l=[i,n,r];return e.ad(l,l,a),Oe(t,e.ae(l),o.pitch,o._fov)}(this.fogState,i,n,r,s.toUnwrapped(),this.transform);c=t>.9}}else li(l,l,t);const h=l[3];return{point:new e.P((l[0]/h+1)/2*this.transform.width+ci,(-l[1]/h+1)/2*this.transform.height+ci),perspectiveRatio:Math.min(.5+this.transform.getCameraToCenterDistance(a)/h*.5,1.5),signedDistanceFromCamera:h,occluded:o&&l[2]>h||c}}isOffscreen(e,t,i,n){return i=this.screenRightBoundary||nthis.screenBottomBoundary}isInsideGrid(e,t,i,n){return i>=0&&e=0&&te.collisionGroupID===t}}return this.collisionGroups[e]}}function _i(t,i,n,r,s){const{horizontalAlign:o,verticalAlign:a}=e.bZ(t),l=-(o-.5)*i,c=-(a-.5)*n,h=e.b_(t,r);return new e.P(l+h[0]*s,c+h[1]*s)}function yi(t,i,n,r,s){const o=new e.P(t,i);return n&&o._rotate(r?s:-s),o}class vi{constructor(e,t,i,n,r,s){this.transform=e.clone(),this.projection=e.projection.name,this.collisionIndex=new hi(this.transform,r),this.buildingIndex=s,this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=t,this.retainedQueryData={},this.collisionGroups=new gi(i),this.collisionCircleArrays={},this.prevPlacement=n,n&&(n.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(t,i,n,r,s=1){const o=n.getBucket(i),a=n.latestFeatureIndex;if(!o||!a||i.fqid!==o.layerIds[0])return;const l=o.layers[0].layout,c=o.layers[0].paint,h=n.collisionBoxArray,d=Math.pow(2,this.transform.zoom-n.tileID.overscaledZ),u=n.tileSize/e.aj,f=n.tileID.toUnwrapped();this.transform.setProjection(o.projection);const p=(m=n.tileID,g=o.getProjection(),_=this.transform,g.name===this.projection?_.calculateProjMatrix(m.toUnwrapped()):Yt(_,g,m));var m,g,_;const y="map"===l.get("text-pitch-alignment"),v="map"===l.get("text-rotation-alignment");i.compileFilter(i.options);const x=i.dynamicFilter(),b=i.dynamicFilterNeedsFeature(),w=this.transform.calculatePixelsToTileUnitsMatrix(n),S=qt(p,n.tileID.canonical,y,v,this.transform,o.getProjection(),w);let T=null;const k=o.getProjection().createInversionMatrix(this.transform,n.tileID.canonical);if(y){const t=Zt(p,n.tileID.canonical,y,v,this.transform,o.getProjection(),w);T=e.az([],this.transform.labelPlaneMatrix,t)}let M=null;x&&n.latestFeatureIndex&&(M={unwrappedTileID:f,dynamicFilter:x,dynamicFilterNeedsFeature:b}),this.retainedQueryData[o.bucketInstanceId]=new mi(o.bucketInstanceId,a,o.sourceLayerIndex,o.index,n.tileID);const[A,C]=o.layers[0].layout.get("text-size-scale-range"),D=e.ay(s,A,C),[L,E]=l.get("icon-size-scale-range"),I=e.ay(s,L,E),P={bucket:o,layout:l,paint:c,posMatrix:p,invMatrix:k,mercatorCenter:[e.aD(this.transform.center.lng),e.aH(this.transform.center.lat)],textLabelPlaneMatrix:S,labelToScreenMatrix:T,clippingData:M,scale:d,textPixelRatio:u,holdingForFade:n.holdingForFade(),collisionBoxArray:h,partiallyEvaluatedTextSize:e.bH(o.textSizeData,this.transform.zoom,D),partiallyEvaluatedIconSize:e.bH(o.iconSizeData,this.transform.zoom,I),collisionGroup:this.collisionGroups.get(o.sourceID),latestFeatureIndex:n.latestFeatureIndex};if(r)for(const e of o.sortKeyRanges){const{sortKey:i,symbolInstanceStart:n,symbolInstanceEnd:r}=e;t.push({sortKey:i,symbolInstanceStart:n,symbolInstanceEnd:r,parameters:P})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:o.symbolInstances.length,parameters:P})}attemptAnchorPlacement(e,t,i,n,r,s,o,a,l,c,h,d,u,f,p,m,g,_,y,v,x){const{textOffset0:b,textOffset1:w,crossTileID:S}=p,T=[b,w],k=_i(e,s,o,T,a),M=this.collisionIndex.placeCollisionBox(g,a,t,i,n,r,yi(k.x,k.y,l,c,this.transform.angle),f,h,d,u.predicate);if(y){const e=g.getSymbolInstanceIconSize(x,this.transform.zoom,p.placedIconSymbolIndex);if(0===this.collisionIndex.placeCollisionBox(g,e,y,i,n,r,yi(k.x,k.y,l,c,this.transform.angle),f,h,d,u.predicate).box.length)return}if(M.box.length>0){let t;return this.prevPlacement&&this.prevPlacement.variableOffsets[S]&&this.prevPlacement.placements[S]&&this.prevPlacement.placements[S].text&&(t=this.prevPlacement.variableOffsets[S].anchor),this.variableOffsets[S]={textOffset:T,width:s,height:o,anchor:e,textScale:a,prevAnchor:t},this.markUsedJustification(g,e,p,_),g.allowVerticalPlacement&&(this.markUsedOrientation(g,_,p),this.placedOrientations[S]=_),{shift:k,placedGlyphBoxes:M}}}placeLayerBucketPart(t,i,n,r,s=1){const{bucket:o,layout:a,paint:l,posMatrix:c,textLabelPlaneMatrix:h,labelToScreenMatrix:d,clippingData:u,textPixelRatio:f,mercatorCenter:p,invMatrix:m,holdingForFade:g,collisionBoxArray:_,partiallyEvaluatedTextSize:y,partiallyEvaluatedIconSize:v,collisionGroup:x,latestFeatureIndex:b}=t.parameters,w=a.get("text-optional"),S=a.get("icon-optional"),T=a.get("text-allow-overlap"),k=a.get("icon-allow-overlap"),M="map"===a.get("text-rotation-alignment"),A="map"===a.get("icon-rotation-alignment"),C="map"===a.get("text-pitch-alignment"),D=l.get("symbol-z-offset"),L="sea"===a.get("symbol-elevation-reference"),E=a.get("symbol-placement"),[I,P]=a.get("text-size-scale-range"),[R,O]=a.get("icon-size-scale-range"),z=e.ay(s,I,P),F=e.ay(s,R,O),N=a.get("text-variable-anchor"),Y=M&&"point"!==E,B=A&&"point"!==E,H=N&&o.hasTextData(),j=o.hasIconTextFit()&&H&&o.hasIconData();this.transform.setProjection(o.projection);const V=H||Y,W=B||j;let U=T&&(k||!o.hasIconData()||S),$=k&&(T||!o.hasTextData()||w);const G=!D.isConstant();!o.collisionArrays&&_&&o.deserializeCollisionBoxes(_),n&&r&&o.updateCollisionDebugBuffers(this.transform.zoom,_,z,F);const X=(t,r,l)=>{const{crossTileID:_,numVerticalGlyphVertices:A}=t;let E=null;if(u&&u.dynamicFilterNeedsFeature||G){const e=this.retainedQueryData[o.bucketInstanceId];E=b.loadFeature({featureIndex:t.featureIndex,bucketIndex:e.bucketIndex,sourceLayerIndex:e.sourceLayerIndex,layoutVertexArrayOffset:0})}if(u&&!(0,u.dynamicFilter)({zoom:this.transform.zoom,pitch:this.transform.pitch},E,this.retainedQueryData[o.bucketInstanceId].tileID.canonical,new e.P(t.tileAnchorX,t.tileAnchorY),this.transform.calculateDistanceTileData(u.unwrappedTileID)))return this.placements[_]=new fi(!1,!1,!1,!0),void i.add(_);const I=D.evaluate(E,{});if(i.has(_))return;if(g)return void(this.placements[_]=new fi(!1,!1,!1));let P=!1,R=!1,O=!0,z=!1,F=!1,Y=null,B={box:null,offscreen:null,occluded:null},H={box:null},j=null,X=null,q=null,Z=0,J=0,K=0;l.textFeatureIndex?Z=l.textFeatureIndex:t.useRuntimeCollisionCircles&&(Z=t.featureIndex),l.verticalTextFeatureIndex&&(J=l.verticalTextFeatureIndex);const Q=e=>{e.tileID=this.retainedQueryData[o.bucketInstanceId].tileID;const i=this.transform.elevation;e.elevation=L?I:I+(i?i.getAtTileOffset(e.tileID,e.tileAnchorX,e.tileAnchorY):0),e.elevation+=t.zOffset},ee=l.textBox;if(ee){Q(ee);const i=i=>{let n=e.bI.horizontal;if(o.allowVerticalPlacement&&!i&&this.prevPlacement){const e=this.prevPlacement.placedOrientations[_];e&&(this.placedOrientations[_]=e,n=e,this.markUsedOrientation(o,n,t))}return n},n=(t,i)=>{if(o.allowVerticalPlacement&&A>0&&l.verticalTextBox){for(const n of o.writingModes)if(n===e.bI.vertical?(B=i(),H=B):B=t(),B&&B.box&&B.box.length)break}else B=t()};if(N){let s=N;if(this.prevPlacement&&this.prevPlacement.variableOffsets[_]){const e=this.prevPlacement.variableOffsets[_];s.indexOf(e.anchor)>0&&(s=s.filter(t=>t!==e.anchor),s.unshift(e.anchor))}const a=(e,i,n)=>{const a=o.getSymbolInstanceTextSize(y,t,this.transform.zoom,r),l=(e.x2-e.x1)*a+2*e.padding,h=(e.y2-e.y1)*a+2*e.padding,d=t.hasIconTextFit&&!k?i:null;d&&Q(d);let u={box:[],offscreen:!1,occluded:!1};const g=T?2*s.length:s.length;for(let i=0;i=s.length,t,r,o,n,d,y,v);if(g&&(u=g.placedGlyphBoxes,u&&u.box&&u.box.length)){P=!0,Y=g.shift;break}}return u};n(()=>a(ee,l.iconBox,e.bI.horizontal),()=>{const t=l.verticalTextBox;return t&&Q(t),o.allowVerticalPlacement&&!(B&&B.box&&B.box.length)&&A>0&&t?a(t,l.verticalIconBox,e.bI.vertical):{box:null,offscreen:null,occluded:null}}),B&&(P=B.box,O=B.offscreen,z=B.occluded);const h=i(!(!B||!B.box));if(!P&&this.prevPlacement){const e=this.prevPlacement.variableOffsets[_];e&&(this.variableOffsets[_]=e,this.markUsedJustification(o,e.anchor,t,h))}}else{const a=(i,n)=>{const a=o.getSymbolInstanceTextSize(y,t,this.transform.zoom,r,s),l=this.collisionIndex.placeCollisionBox(o,a,i,p,m,V,new e.P(0,0),T,f,c,x.predicate);return l&&l.box&&l.box.length&&(this.markUsedOrientation(o,n,t),this.placedOrientations[_]=n),l};n(()=>a(ee,e.bI.horizontal),()=>{const t=l.verticalTextBox;return o.allowVerticalPlacement&&A>0&&t?(Q(t),a(t,e.bI.vertical)):{box:null,offscreen:null,occluded:null}}),i(!!(B&&B.box&&B.box.length))}}if(j=B,P=j&&j.box&&j.box.length>0,O=j&&j.offscreen,z=j&&j.occluded,t.useRuntimeCollisionCircles){const i=o.text.placedSymbolArray.get(t.centerJustifiedTextSymbolIndex>=0?t.centerJustifiedTextSymbolIndex:t.verticalPlacedTextSymbolIndex),r=e.bJ(o.textSizeData,y,i),s=a.get("text-padding");X=this.collisionIndex.placeCollisionCircles(o,T,i,o.lineVertexArray,o.glyphOffsetArray,r,c,h,d,n,C,x.predicate,t.collisionCircleDiameter*r/e.bU,s,this.retainedQueryData[o.bucketInstanceId].tileID),P=T||X.circles.length>0&&!X.collisionDetected,O=O&&X.offscreen,z=X.occluded}if(l.iconFeatureIndex&&(K=l.iconFeatureIndex),l.iconBox){const i=i=>{Q(i);const n=t.hasIconTextFit&&Y?yi(Y.x,Y.y,M,C,this.transform.angle):new e.P(0,0),r=o.getSymbolInstanceIconSize(v,this.transform.zoom,t.placedIconSymbolIndex);return this.collisionIndex.placeCollisionBox(o,r,i,p,m,W,n,k,f,c,x.predicate)};H&&H.box&&H.box.length&&l.verticalIconBox?(q=i(l.verticalIconBox),R=q.box.length>0):(q=i(l.iconBox),R=q.box.length>0),O=O&&q.offscreen,F=q.occluded}const te=w||0===t.numHorizontalGlyphVertices&&0===A,ie=S||0===t.numIconVertices;if(te||ie?ie?te||(R=R&&P):P=R&&P:R=P=R&&P,P&&j&&j.box&&this.collisionIndex.insertCollisionBox(j.box,a.get("text-ignore-placement"),o.bucketInstanceId,H&&H.box&&J?J:Z,x.ID),R&&q&&this.collisionIndex.insertCollisionBox(q.box,a.get("icon-ignore-placement"),o.bucketInstanceId,K,x.ID),X&&(P&&this.collisionIndex.insertCollisionCircles(X.circles,a.get("text-ignore-placement"),o.bucketInstanceId,Z,x.ID),n)){const e=o.bucketInstanceId;let t=this.collisionCircleArrays[e];void 0===t&&(t=this.collisionCircleArrays[e]=new pi);for(let e=0;e=0;--e){const i=t[e];X(o.symbolInstances.get(i),i,o.collisionArrays[i])}o.hasAnyZOffset&&e.w(`${o.layerIds[0]} layer symbol-z-elevate: symbols are not sorted by elevation if symbol-z-order is evaluated to viewport-y`)}else if(o.hasAnyZOffset){const e=o.getSortedIndexesByZOffset();for(let t=0;t=0&&(t.text.placedSymbolArray.get(s).crossTileID=d>=0&&s!==d?0:c),o>=0&&(t.text.placedSymbolArray.get(o).crossTileID=d>=0&&o!==d?0:c),a>=0&&(t.text.placedSymbolArray.get(a).crossTileID=d>=0&&a!==d?0:c),l>=0&&(t.text.placedSymbolArray.get(l).crossTileID=d>=0&&l!==d?0:c)}markUsedOrientation(t,i,n){const r=i===e.bI.horizontal||i===e.bI.horizontalOnly?i:0,s=i===e.bI.vertical?i:0,{leftJustifiedTextSymbolIndex:o,centerJustifiedTextSymbolIndex:a,rightJustifiedTextSymbolIndex:l,verticalPlacedTextSymbolIndex:c}=n,h=t.text.placedSymbolArray;o>=0&&(h.get(o).placedOrientation=r),a>=0&&(h.get(a).placedOrientation=r),l>=0&&(h.get(l).placedOrientation=r),c>=0&&(h.get(c).placedOrientation=s)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;const t=this.prevPlacement;let i=!1;this.prevZoomAdjustment=t?t.zoomAdjustment(this.transform.zoom):0;const n=t?t.symbolFadeChange(e):1,r=t?t.opacities:{},s=t?t.variableOffsets:{},o=t?t.placedOrientations:{};for(const e in this.placements){const t=this.placements[e],s=r[e];s?(this.opacities[e]=new ui(s,n,t.text,t.icon,null,t.clipped),i=i||t.text!==s.text.placed||t.icon!==s.icon.placed):(this.opacities[e]=new ui(null,n,t.text,t.icon,t.skipFade,t.clipped),i=i||t.text||t.icon)}for(const e in r){const t=r[e];if(!this.opacities[e]){const r=new ui(t,n,!1,!1);r.isHidden()||(this.opacities[e]=r,i=i||t.text.placed||t.icon.placed)}}for(const e in s)this.variableOffsets[e]||!this.opacities[e]||this.opacities[e].isHidden()||(this.variableOffsets[e]=s[e]);for(const e in o)this.placedOrientations[e]||!this.opacities[e]||this.opacities[e].isHidden()||(this.placedOrientations[e]=o[e]);i?this.lastPlacementChangeTime=e:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=t?t.lastPlacementChangeTime:e)}updateLayerOpacities(e,t,i,n){const r=new Set;for(const s of t){const t=s.getBucket(e);t&&s.latestFeatureIndex&&e.fqid===t.layerIds[0]&&(this.updateBucketOpacities(t,r,s,s.collisionBoxArray,i,n,s.tileID,e.scope),"offset"===t.elevationType&&this.buildingIndex&&this.buildingIndex.updateZOffset(t,s.tileID),"road"===t.elevationType&&t.updateRoadElevation(s.tileID.canonical),t.updateZOffset())}}updateBucketOpacities(t,i,n,r,s,o,a,l){t.hasTextData()&&t.text.opacityVertexArray.clear(),t.hasIconData()&&t.icon.opacityVertexArray.clear(),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();const c=t.layers[0].layout,h=t.layers[0].paint,d=!!t.layers[0].dynamicFilter(),u=new ui(null,0,!1,!1,!0),f=c.get("text-allow-overlap"),p=c.get("icon-allow-overlap"),m=c.get("text-variable-anchor"),g="map"===c.get("text-rotation-alignment"),_="map"===c.get("text-pitch-alignment"),y=h.get("symbol-z-offset"),v="sea"===c.get("symbol-elevation-reference"),x=!y.isConstant(),b=new ui(null,0,f&&(p||!t.hasIconData()||c.get("icon-optional")),p&&(f||!t.hasTextData()||c.get("text-optional")),!0);!t.collisionArrays&&r&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(r);const w=(e,t,i)=>{for(let n=0;n0||f>0,P=T>0,R=this.placedOrientations[p],O=R===e.bI.vertical,z=R===e.bI.horizontal||R===e.bI.horizontalOnly;!I&&!P||E.isHidden()||S++;let F=!1;if((I||P)&&o)for(const i of t.activeReplacements){if(e.bV(i,s,e.bW.Symbol,l))continue;if(i.min.x>k||k>i.max.x||i.min.y>M||M>i.max.y)continue;const t=e.bX(k,M,a.canonical,i.footprintTileId.canonical);if(F=e.bY(t,i.footprint),F)break}if(I){const e=F?Di:Ci(E.text);w(t.text,h,O?Di:e),w(t.text,f,z?Di:e);const i=E.text.isHidden(),{leftJustifiedTextSymbolIndex:n,centerJustifiedTextSymbolIndex:r,rightJustifiedTextSymbolIndex:s,verticalPlacedTextSymbolIndex:o}=c,a=t.text.placedSymbolArray,l=i||O?1:0;n>=0&&(a.get(n).hidden=l),r>=0&&(a.get(r).hidden=l),s>=0&&(a.get(s).hidden=l),o>=0&&(a.get(o).hidden=i||z?1:0);const d=this.variableOffsets[p];d&&this.markUsedJustification(t,d.anchor,c,R);const u=this.placedOrientations[p];u&&(this.markUsedJustification(t,"left",c,u),this.markUsedOrientation(t,u,c))}if(P){const e=F?Di:Ci(E.icon),{placedIconSymbolIndex:i,verticalPlacedIconSymbolIndex:n}=c,r=t.icon.placedSymbolArray,s=E.icon.isHidden()?1:0;i>=0&&(w(t.icon,T,O?Di:e),r.get(i).hidden=s),n>=0&&(w(t.icon,c.numVerticalIconVertices,z?Di:e),r.get(n).hidden=s)}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const i=t.collisionArrays[r];if(i){let n=new e.P(0,0),r=!0;if(i.textBox||i.verticalTextBox){if(m){const e=this.variableOffsets[p];e?(n=_i(e.anchor,e.width,e.height,e.textOffset,e.textScale),g&&n._rotate(_?this.transform.angle:-this.transform.angle)):r=!1}d&&(r=!E.clipped),i.textBox&&xi(t.textCollisionBox.collisionVertexArray,E.text.placed,!r||O,D,v,n.x,n.y),i.verticalTextBox&&xi(t.textCollisionBox.collisionVertexArray,E.text.placed,!r||z,D,v,n.x,n.y)}const s=r&&Boolean(!z&&i.verticalIconBox);i.iconBox&&xi(t.iconCollisionBox.collisionVertexArray,E.icon.placed,s,D,v,c.hasIconTextFit?n.x:0,c.hasIconTextFit?n.y:0),i.verticalIconBox&&xi(t.iconCollisionBox.collisionVertexArray,E.icon.placed,!s,D,v,c.hasIconTextFit?n.x:0,c.hasIconTextFit?n.y:0)}}}if(t.fullyClipped=0===S,t.sortFeatures(this.transform.angle),this.retainedQueryData[t.bucketInstanceId]&&(this.retainedQueryData[t.bucketInstanceId].featureSortOrder=t.featureSortOrder),t.hasTextData()&&t.text.opacityVertexBuffer&&t.text.opacityVertexBuffer.updateData(t.text.opacityVertexArray),t.hasIconData()&&t.icon.opacityVertexBuffer&&t.icon.opacityVertexBuffer.updateData(t.icon.opacityVertexArray),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexBuffer&&t.iconCollisionBox.collisionVertexBuffer.updateData(t.iconCollisionBox.collisionVertexArray),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexBuffer&&t.textCollisionBox.collisionVertexBuffer.updateData(t.textCollisionBox.collisionVertexArray),t.bucketInstanceId in this.collisionCircleArrays){const e=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=e.invProjMatrix,t.placementViewportMatrix=e.viewportMatrix,t.collisionCircleArray=e.circles,delete this.collisionCircleArrays[t.bucketInstanceId]}}symbolFadeChange(e){return 0===this.fadeDuration?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(e){return Math.max(0,(this.transform.zoom-e)/1.5)}hasTransitions(e){return this.stale||e-this.lastPlacementChangeTimee}setStale(){this.stale=!0}}function xi(e,t,i,n,r,s,o){e.emplaceBack(t?1:0,i?1:0,s||0,o||0,n,r?1:0),e.emplaceBack(t?1:0,i?1:0,s||0,o||0,n,r?1:0),e.emplaceBack(t?1:0,i?1:0,s||0,o||0,n,r?1:0),e.emplaceBack(t?1:0,i?1:0,s||0,o||0,n,r?1:0)}const bi=Math.pow(2,25),wi=Math.pow(2,24),Si=Math.pow(2,17),Ti=Math.pow(2,16),ki=Math.pow(2,9),Mi=Math.pow(2,8),Ai=Math.pow(2,1);function Ci(e){if(0===e.opacity&&!e.placed)return 0;if(1===e.opacity&&e.placed)return 4294967295;const t=e.placed?1:0,i=Math.floor(127*e.opacity);return i*bi+t*wi+i*Si+t*Ti+i*ki+t*Mi+i*Ai+t}const Di=0;class Li{constructor(e){this._sortAcrossTiles="viewport-y"!==e.layout.get("symbol-z-order")&&void 0!==e.layout.get("symbol-sort-key").constantOr(1),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs=new Set,this._bucketParts=[]}continuePlacement(e,t,i,n,r,s){const o=this._bucketParts;for(;this._currentTileIndexe.sortKey-t.sortKey));this._currentPartIndex{const t=e.q.now()-o;return!this._forceFullPlacement&&t>2};for(;this._currentPlacementIndex>=0;){const o=i[t[this._currentPlacementIndex]],l=this.placement.collisionIndex.transform.zoom;if("symbol"===o.type&&(!o.minzoom||o.minzoom<=l)&&(!o.maxzoom||o.maxzoom>l)){const t=o,i=t.layout.get("symbol-z-elevate"),l=void 0!==t.layout.get("symbol-sort-key").constantOr(1),c=t.layout.get("symbol-z-order"),h="viewport-y"===c||"auto"===c&&!("viewport-y"!==c&&l),d=t.layout.get("text-allow-overlap")||t.layout.get("icon-allow-overlap")||t.layout.get("text-ignore-placement")||t.layout.get("icon-ignore-placement"),u=h&&d,f=this._inProgressLayer=this._inProgressLayer||new Li(t),p=e.C(o.source,o.scope);if(f.continuePlacement(i||u?r[p]:n[p],this.placement,this._showCollisionBoxes,o,a,s))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}}const Ii=512/e.aj/2;class Pi{constructor(t,i,n){this.tileID=t,this.bucketInstanceId=n,this.index=new e.c0(i.length,16,Int32Array),this.keys=[],this.crossTileIDs=[];const r=t.canonical.x*e.aj,s=t.canonical.y*e.aj;for(let e=0;ee-t);for(const e of f){const t=this.crossTileIDs[e];if(this.keys[e]===l&&!n.has(t)){n.add(t),i.crossTileID=t;break}}}}}class Ri{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Oi{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){const t=Math.round((e-this.lng)/360);if(0!==t)for(const e in this.indexes){const i=this.indexes[e],n={};for(const e in i){const r=i[e];r.tileID=r.tileID.unwrapTo(r.tileID.wrap+t),n[r.tileID.key]=r}this.indexes[e]=n}this.lng=e}addBucket(e,t,i){if(this.indexes[e.overscaledZ]&&this.indexes[e.overscaledZ][e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===t.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(let e=0;ee.overscaledZ)for(const i in r){const s=r[i];s.tileID.isChildOf(e)&&s.findMatches(t.symbolInstances,e,n)}else{const s=r[e.scaledTo(Number(i)).key];s&&s.findMatches(t.symbolInstances,e,n)}}for(let e=0;e{t[e]=!0});for(const e in this.layerIndexes)t[e]||delete this.layerIndexes[e]}}const Fi=771;class Ni{constructor(e,t,i,n){this.blendFunction=e,this.blendColor=t.toNonPremultipliedRenderColor(null),this.mask=i,this.blendEquation=n}}Ni.Replace=[1,0,1,0],Ni.disabled=new Ni(Ni.Replace,e.am.transparent,[!1,!1,!1,!1]),Ni.unblended=new Ni(Ni.Replace,e.am.transparent,[!0,!0,!0,!0]),Ni.alphaBlended=new Ni([1,Fi,1,Fi],e.am.transparent,[!0,!0,!0,!0]),Ni.alphaBlendedNonPremultiplied=new Ni([770,Fi,770,Fi],e.am.transparent,[!0,!0,!0,!0]),Ni.multiply=new Ni([774,0,774,0],e.am.transparent,[!0,!0,!0,!0]);class Yi{constructor(e,t,i){this.func=e,this.mask=t,this.range=i}}Yi.ReadOnly=!1,Yi.ReadWrite=!0,Yi.disabled=new Yi(519,Yi.ReadOnly,[0,1]);const Bi=7680;class Hi{constructor(e,t,i,n,r,s){this.test=e,this.ref=t,this.mask=i,this.fail=n,this.depthFail=r,this.pass=s}}Hi.disabled=new Hi({func:519,mask:0},0,0,Bi,Bi,Bi);const ji=1029,Vi=2305;class Wi{constructor(e,t,i){this.enable=e,this.mode=t,this.frontFace=i}}function Ui(t,i){const n=e.c6(t,3);e.c8(t,i),e.cc(t,3,n)}function $i(t,i){const n=e.c3([]);return e.c4(n,n,-i),e.c5(n,n,-t),n}function Gi(t,i){const n=[t[0],t[1],0],r=[i[0],i[1],0];if(e.ae(n)>=1e-15){const t=e.au([],n);e.c1(r,t,e.bG(r,t)),i[0]=r[0],i[1]=r[1]}const s=e.bF([],i,t);if(e.c2(s)<1e-15)return null;const o=Math.atan2(-s[1],s[0]);return $i(Math.atan2(Math.sqrt(t[0]*t[0]+t[1]*t[1]),-t[2]),o)}Wi.disabled=new Wi(!1,ji,Vi),Wi.backCCW=new Wi(!0,ji,Vi),Wi.backCW=new Wi(!0,ji,2304),Wi.frontCW=new Wi(!0,1028,2304),Wi.frontCCW=new Wi(!0,1028,Vi);class Xi{constructor(e,t){this.position=e,this.orientation=t}get position(){return this._position}set position(t){if(t){const i=t instanceof e.ac?t:new e.ac(t[0],t[1],t[2]);this._renderWorldCopies&&(i.x=e.bQ(i.x,0,1)),this._position=i}else this._position=null}lookAtPoint(t,i){if(this.orientation=null,!this.position)return;const n=this.position,r=this._elevation?this._elevation.getAtPointOrZero(e.ac.fromLngLat(t)):0,s=e.ac.fromLngLat(t,r),o=[s.x-n.x,s.y-n.y,s.z-n.z];i||(i=[0,0,1]),i[2]=Math.abs(i[2]),this.orientation=Gi(o,i)}setPitchBearing(t,i){this.orientation=$i(e.al(t),e.al(-i))}}class qi{constructor(t,i){this._transform=e.bx([]),this.orientation=i,this.position=t}get mercatorPosition(){const t=this.position;return new e.ac(t[0],t[1],t[2])}get position(){const t=e.c6(this._transform,3);return[t[0],t[1],t[2]]}set position(t){var i;t&&e.cc(this._transform,3,[(i=t)[0],i[1],i[2],1])}get orientation(){return this._orientation}set orientation(t){this._orientation=t||e.c3([]),t&&Ui(this._transform,this._orientation)}getPitchBearing(){const e=this.forward(),t=this.right();return{bearing:Math.atan2(-t[1],t[0]),pitch:Math.atan2(Math.sqrt(e[0]*e[0]+e[1]*e[1]),-e[2])}}setPitchBearing(e,t){this._orientation=$i(e,t),Ui(this._transform,this._orientation)}forward(){const t=e.c6(this._transform,2);return[-t[0],-t[1],-t[2]]}up(){const t=e.c6(this._transform,1);return[-t[0],-t[1],-t[2]]}right(){const t=e.c6(this._transform,0);return[t[0],t[1],t[2]]}getCameraToWorld(t,i){const n=new Float64Array(16);return e.bi(n,this.getWorldToCamera(t,i)),n}getCameraToWorldMercator(){return this._transform}getWorldToCameraPosition(t,i,n){const r=this.position;e.c1(r,r,-t);const s=new Float64Array(16);return e.bn(s,[n,n,n]),e.bo(s,s,r),s[10]*=i,s}getWorldToCamera(t,i){const n=new Float64Array(16),r=new Float64Array(4),s=this.position;return e.c7(r,this._orientation),e.c1(s,s,-t),e.c8(n,r),e.bo(n,n,s),n[1]*=-1,n[5]*=-1,n[9]*=-1,n[13]*=-1,n[8]*=i,n[9]*=i,n[10]*=i,n[11]*=i,n}getCameraToClipPerspective(t,i,n,r){const s=new Float64Array(16);return e.c9(s,t,i,n,r),s}getCameraToClipOrthographic(t,i,n,r,s,o){const a=new Float64Array(16);return e.ca(a,t,i,n,r,s,o),a}getDistanceToElevation(t,i=!1){const n=0===t?0:e.cb(t,i?e.aY(this.position[1]):this.position[1]),r=this.forward();return(n-this.position[2])/r[2]}clone(){return new qi([...this.position],[...this.orientation])}}const Zi=5,Ji=6,Ki=7,Qi=8,en=9,tn=10,nn=11;class rn{constructor(e=0,t=0,i=0,n=0){if(isNaN(e)||e<0||isNaN(t)||t<0||isNaN(i)||i<0||isNaN(n)||n<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=e,this.bottom=t,this.left=i,this.right=n}interpolate(t,i,n){return null!=i.top&&null!=t.top&&(this.top=e.ai(t.top,i.top,n)),null!=i.bottom&&null!=t.bottom&&(this.bottom=e.ai(t.bottom,i.bottom,n)),null!=i.left&&null!=t.left&&(this.left=e.ai(t.left,i.left,n)),null!=i.right&&null!=t.right&&(this.right=e.ai(t.right,i.right,n)),this}getCenter(t,i){const n=e.ay((this.left+t-this.right)/2,0,t),r=e.ay((this.top+i-this.bottom)/2,0,i);return new e.P(n,r)}equals(e){return this.top===e.top&&this.bottom===e.bottom&&this.left===e.left&&this.right===e.right}clone(){return new rn(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const sn=15;class on{constructor(t,i,n,r,s,o,a){this.tileSize=512,this._renderWorldCopies=void 0===s||s,this._minZoom=t||0,this._maxZoom=i||22,this._minPitch=n??0,this._maxPitch=r??60,this.setProjection(o),this.setMaxBounds(a),this.width=0,this.height=0,this._center=new e.ci(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._nearZ=0,this._farZ=0,this._unmodified=!0,this._edgeInsets=new rn,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._expandedProjMatrixCache={},this._distanceTileDataCache={},this._camera=new qi,this._centerAltitude=0,this._averageElevation=0,this.cameraElevationReference="ground",this._pixelsPerMercatorPixel=1,this.globeRadius=0,this.globeCenterInViewSpace=[0,0,0],this._tileCoverLift=0,this.freezeTileCoverage=!1,this._horizonShift=.1,this._orthographicProjectionAtLowPitch=!1,this._allowWorldUnderZoom=!1}clone(){const e=new on(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies,this.getProjection(),this.maxBounds);return e._elevation=this._elevation,e._centerAltitude=this._centerAltitude,e._centerAltitudeValidForExaggeration=this._centerAltitudeValidForExaggeration,e.tileSize=this.tileSize,e.mercatorFromTransition=this.mercatorFromTransition,e.width=this.width,e.height=this.height,e.cameraElevationReference=this.cameraElevationReference,e._center=this._center,e._setZoom(this.zoom),e._seaLevelZoom=this._seaLevelZoom,e.angle=this.angle,e._fov=this._fov,e._pitch=this._pitch,e._nearZ=this._nearZ,e._farZ=this._farZ,e._averageElevation=this._averageElevation,e._orthographicProjectionAtLowPitch=this._orthographicProjectionAtLowPitch,e._unmodified=this._unmodified,e._edgeInsets=this._edgeInsets.clone(),e._camera=this._camera.clone(),e._calcMatrices(),e.freezeTileCoverage=this.freezeTileCoverage,e.frustumCorners=this.frustumCorners,e._allowWorldUnderZoom=this._allowWorldUnderZoom,e}get isOrthographic(){return"globe"!==this.projection.name&&this._orthographicProjectionAtLowPitch&&this.pitch0&&this.elevation.exaggeration()>0&&this._centerAltitudeValidForExaggeration;if(!this._elevation||e===Number.NEGATIVE_INFINITY&&(!t||!this._centerAltitude))return this._centerAltitude=0,this._seaLevelZoom=null,void(this._centerAltitudeValidForExaggeration=void 0);const i=this._elevation;t||this._centerAltitude&&this._centerAltitudeValidForExaggeration&&i.exaggeration()&&this._centerAltitudeValidForExaggeration!==i.exaggeration()?(this._centerAltitude=this._centerAltitude/this._centerAltitudeValidForExaggeration*i.exaggeration(),this._centerAltitudeValidForExaggeration=i.exaggeration()):(this._centerAltitude=e||0,this._centerAltitudeValidForExaggeration=i.exaggeration()),this._updateSeaLevelZoom()}_updateSeaLevelZoom(){if(void 0===this._centerAltitudeValidForExaggeration)return;const e=Math.max(0,(this.pixelsPerMeter*this._centerAltitude+this.cameraToCenterDistance)/this.worldSize);this._seaLevelZoom=this._zoomFromMercatorZ(e)}sampleAverageElevation(){if(!this._elevation)return 0;const t=this._elevation,i=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8]],n=this.horizonLineFromTop();let r=0,s=0;for(let o=0;o{const l=e.cV(i,t,n,s,o);a.has(l)||(r.push(new e.aM(t,i,n,s,o)),a.add(l))};for(let e=0;e0,p=a.y+10,g=r.wrap-(f?0:1),_=r.wrap+(u?0:1),y=f?a.x-1:d-1,v=u?a.x+1:0;if(s)n[0]<0?(l(c,_,a.z,v,a.y),n[1]<0&&p&&(l(c,h,a.z,a.x,a.y+1),l(c,_,a.z,v,a.y+1)),n[1]>0&&m&&(l(c,h,a.z,a.x,a.y-1),l(c,_,a.z,v,a.y-1))):n[0]>0?(l(c,g,a.z,y,a.y),n[1]<0&&p&&(l(c,h,a.z,a.x,a.y+1),l(c,g,a.z,y,a.y+1)),n[1]>0&&m&&(l(c,h,a.z,a.x,a.y-1),l(c,g,a.z,y,a.y-1))):n[1]<0&&p?l(c,h,a.z,a.x,a.y+1):m&&l(c,h,a.z,a.x,a.y-1);else{const e=r.visibleQuadrants;1&e&&(l(c,g,a.z,y,a.y),m&&(l(c,h,a.z,a.x,a.y-1),l(c,g,a.z,y,a.y-1))),2&e&&(l(c,_,a.z,v,a.y),m&&(l(c,h,a.z,a.x,a.y-1),l(c,_,a.z,v,a.y-1))),4&e&&(l(c,g,a.z,y,a.y),p&&(l(c,h,a.z,a.x,a.y+1),l(c,g,a.z,y,a.y+1))),8&e&&(l(c,_,a.z,v,a.y),p&&(l(c,h,a.z,a.x,a.y+1),l(c,_,a.z,v,a.y+1)))}}const c=[];for(const e of r)r.some(t=>e.isChildOf(t))||c.push(e);if(r=c.filter(e=>!t.some(t=>!!(e.overscaledZ{const t=e.canonical.x+.5-n[0],i=e.canonical.y+.5-n[1];return t*t+i*i{const l=e.cV(i,t,n,o,a);s.has(l)||(r.push(new e.aM(t,i,n,o,a)),s.add(l))},a=t.reduce((e,t)=>Math.max(e,t.overscaledZ),n),l=1<{const r=Math.floor(t[0]),s=Math.floor(t[1]),u=(t[0]-r)*e.aj,f=(t[1]-s)*e.aj,p=Math.floor(i[0]),m=Math.floor(i[1]),g=(i[0]-p)*e.aj,_=(i[1]-m)*e.aj;for(let t=-1;t<=1;t++){const i=r+t;if(!(i<0||i>=l)){h.x=u-t*e.aj,d.x=g-(i-p)*e.aj;for(let t=-1;t<=1;t++){const r=s+t;h.y=f-t*e.aj,d.y=_-(r-m)*e.aj,e.cW(h,d,c)&&o(a,0,n,i,r)}}}},f=i.points,p=f[e.cs],m=f[e.ct],g=this._projectToGround(p,f[e.cu]),_=this._projectToGround(m,f[e.cv]);return u(p,g),u(m,_),r}_projectToGround(t,i){return e.cw(e.cx(),t,i,t[2]/(t[2]-i[2]))}coveringTiles(t){let i=this.coveringZoomLevel(t);const n=i,r=this.elevation&&this.elevation.exaggeration(),s=r&&!t.isTerrainDEM,o="mercator"===this.projection.name;if(void 0!==t.minzoom&&it.maxzoom&&(i=t.maxzoom);const a=this.locationCoordinate(this.center),l=this.center.lat,c=1<{const i=1/4e4,n=new e.ac(t.x+i,t.y,t.z),r=new e.ac(t.x,t.y+i,t.z),s=t.toLngLat(),o=n.toLngLat(),a=r.toLngLat(),l=this.locationCoordinate(s),c=this.locationCoordinate(o),h=this.locationCoordinate(a),d=Math.hypot(c.x-l.x,c.y-l.y),u=Math.hypot(h.x-l.x,h.y-l.y);return Math.sqrt(d*u)*S/i},k=t=>{const i=b,n=w;return{aabb:e.cC(this,c,0,0,0,t,n,i,this.projection),zoom:0,x:0,y:0,minZ:n,maxZ:i,wrap:t,fullyVisible:!1}},M=[];let A=[];const C=i,D=t.reparseOverscaled?n:i,L=(g-this._centerAltitude)*m,E=e=>{if(!this._elevation||!e.tileID||!o)return;const t=this._elevation.getMinMaxForTile(e.tileID),i=e.aabb;t?(i.min[2]=t.min,i.max[2]=t.max,i.center[2]=(i.min[2]+i.max[2])/2):(e.shouldSplit=P(e),e.shouldSplit||(i.min[2]=i.max[2]=i.center[2]=this._centerAltitude))},I=(e,t)=>{if(.707*t{if(t.zoom=.9)return!0}else if(s&&(a=t.aabb.distanceZ(_)*m),this.projection.isReprojectedInTileSpace&&n<=5){const i=Math.pow(2,t.zoom),n=T(new e.ac((t.x+.5)/i,(t.y+.5)/i));c=n>.85?1:n}if(!o){const e=Math.sqrt(i*i+r*r+a*a);let n=(1<0;){const n=M.pop(),r=n.x,a=n.y;let l=n.fullyVisible;const u=()=>"globe"===this.projection.name&&(0===n.y||n.y===(1<>1),u={aabb:o?n.aabb.quadrant(t):e.cC(this,c,n.zoom+1,i,h,n.wrap,n.minZ,n.maxZ,this.projection),zoom:n.zoom+1,x:i,y:h,wrap:n.wrap,fullyVisible:l,tileID:void 0,shouldSplit:void 0,minZ:n.minZ,maxZ:n.maxZ};s&&!d&&(u.tileID=new e.aM(n.zoom+1===C?D:n.zoom+1,n.wrap,n.zoom+1,i,h),E(u)),M.push(u)}else{const s=n.zoom===C?D:n.zoom;if(t.minzoom&&t.minzoom>s)continue;let o=0;if(!l){let i=y?n.aabb.intersectsPrecise(f):n.aabb.intersectsPreciseFlat(f);if(0===i&&u()){const t=new e.cA(n.zoom,r,a);i=e.cB(this,c,t,!0).intersectsPrecise(f)}if(0===i)continue;if(t.calculateQuadrantVisibility)if(f.containsPoint(n.aabb.center))o=15;else for(let e=0;e<4;e++)0!==n.aabb.quadrant(e).intersects(f)&&(o|=1<{const s=[0,0,0,1],o=[e.aj,e.aj,0,1],a=this.calculateFogTileMatrix(r.tileID.toUnwrapped());e.aA(s,s,a),e.aA(o,o,a);const l=e.cD([],s,o),c=e.cE([],s,o),h=e.cY(l,c);if(0===h)return!0;let d=!1;const u=this._elevation;if(u&&h>i&&0!==n){const i=this.calculateProjMatrix(r.tileID.toUnwrapped());let s;t.isTerrainDEM||(s=u.getMinMaxForTile(r.tileID)),s||(s={min:w,max:b});const o=e.cF(this.rotation),a=[o[0]*e.aj,o[1]*e.aj,s.max];e.ad(a,a,i),d=(1-a[1])*this.height*.5e.distanceSq-t.distanceSq).map(e=>e.tileID)}resize(e,t){this.width=e,this.height=t,this.pixelsToGLUnits=[2/e,-2/t],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(e){return Math.pow(2,e)}scaleZoom(e){return Math.log(e)/Math.LN2}project(t){const i=e.ay(t.lat,-e.cG,e.cG),n=this.projection.project(t.lng,i);return new e.P(n.x*this.worldSize,n.y*this.worldSize)}unproject(e){return this.projection.unproject(e.x/this.worldSize,e.y/this.worldSize)}get point(){return this.project(this.center)}get pointMerc(){return this.point._div(this.worldSize)}get pixelsPerMeterRatio(){return this.pixelsPerMeter/e.cb(1,this.center.lat)/this.worldSize}setLocationAtPoint(t,i){let n,r;const s=this.centerPoint;if("globe"===this.projection.name){const e=this.worldSize;n=(i.x-s.x)/e,r=(i.y-s.y)/e}else{const e=this.pointCoordinate(i),t=this.pointCoordinate(s);n=e.x-t.x,r=e.y-t.y}const o=this.locationCoordinate(t);this.setLocation(new e.ac(o.x-n,o.y-r))}setLocation(e){this.center=this.coordinateLocation(e),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(e,t){return this.projection.locationPoint(this,e,t)}locationPoint3D(e,t){return this.projection.locationPoint(this,e,t,!0)}pointLocation(e){return this.coordinateLocation(this.pointCoordinate(e))}pointLocation3D(e,t){return this.coordinateLocation(this.pointCoordinate3D(e,t))}locationCoordinate(t,i){const n=i?e.cb(i,t.lat):void 0,r=this.projection.project(t.lng,t.lat);return new e.ac(r.x,r.y,n)}coordinateLocation(e){return this.projection.unproject(e.x,e.y)}pointRayIntersection(t,i){const n=null!=i?i:this._centerAltitude,r=[t.x,t.y,0,1],s=[t.x,t.y,1,1];e.aA(r,r,this.pixelMatrixInverse),e.aA(s,s,this.pixelMatrixInverse);const o=s[3];e.cH(r,r,1/r[3]),e.cH(s,s,1/o);const a=r[2],l=s[2];return{p0:r,p1:s,t:a===l?0:(n-a)/(l-a)}}screenPointToMercatorRay(t){const i=[t.x,t.y,0,1],n=[t.x,t.y,1,1];return e.aA(i,i,this.pixelMatrixInverse),e.aA(n,n,this.pixelMatrixInverse),e.cH(i,i,1/i[3]),e.cH(n,n,1/n[3]),i[2]=e.cb(i[2],this._center.lat)*this.worldSize,n[2]=e.cb(n[2],this._center.lat)*this.worldSize,e.cH(i,i,1/this.worldSize),e.cH(n,n,1/this.worldSize),new e.av([i[0],i[1],i[2]],e.au([],e.at([],n,i)))}rayIntersectionCoordinate(t){const{p0:i,p1:n,t:r}=t,s=e.cb(i[2],this._center.lat),o=e.cb(n[2],this._center.lat);return new e.ac(e.ai(i[0],n[0],r)/this.worldSize,e.ai(i[1],n[1],r)/this.worldSize,e.ai(s,o,r))}pointCoordinate(e,t=this._centerAltitude){return this.projection.pointCoordinate(this,e.x,e.y,t)}pointCoordinate3D(t,i){if(!this.elevation)return this.pointCoordinate(t,i);let n=this.projection.pointCoordinate3D(this,t.x,t.y);if(n)return new e.ac(n[0],n[1],n[2]);let r=0,s=this.horizonLineFromTop();if(t.y>s)return this.pointCoordinate(t,i);const o=.02*s,a=t.clone();for(let t=0;t<10&&s-r>o;t++){a.y=e.ai(r,s,.66);const t=this.projection.pointCoordinate3D(this,a.x,a.y);t?(s=a.y,n=t):r=a.y}return n?new e.ac(n[0],n[1],n[2]):this.pointCoordinate(t)}isPointAboveHorizon(e){return this.projection.isPointAboveHorizon(this,e)}isPointOnSurface(t){if(t.y<0||t.y>this.height||t.x<0||t.x>this.width)return!1;if(this.elevation||this.zoom>=e.cI)return!this.isPointAboveHorizon(t);const i=this.pointCoordinate(t);return i.y>=0&&i.y<=1}_coordinatePoint(t,i){const n=i&&this.elevation?this.elevation.getAtPointOrZero(t,this._centerAltitude):this._centerAltitude,r=[t.x*this.worldSize,t.y*this.worldSize,n+t.toAltitude(),1];return e.aA(r,r,this.pixelMatrix),r[3]>0?new e.P(r[0]/r[3],r[1]/r[3]):new e.P(Number.MAX_VALUE,Number.MAX_VALUE)}_getBoundsNonRectangular(){const{top:t,left:i}=this._edgeInsets,n=this.height-this._edgeInsets.bottom,r=this.width-this._edgeInsets.right,s=this.pointLocation3D(new e.P(i,t)),o=this.pointLocation3D(new e.P(r,t)),a=this.pointLocation3D(new e.P(r,n)),l=this.pointLocation3D(new e.P(i,n));let c=Math.min(s.lng,o.lng,a.lng,l.lng),h=Math.max(s.lng,o.lng,a.lng,l.lng),d=Math.min(s.lat,o.lat,a.lat,l.lat),u=Math.max(s.lat,o.lat,a.lat,l.lat);const f=Math.pow(2,-this.zoom)/16*270,p="globe"===this.projection.name?1:4,m=(t,i,n,r,s)=>{const o=(t+n)/2,a=(i+r)/2,l=new e.P(o,a),{lng:g,lat:_}=this.pointLocation3D(l),y=Math.max(0,c-g,d-_,g-h,_-u);c=Math.min(c,g),h=Math.max(h,g),d=Math.min(d,_),u=Math.max(u,_),(sf)&&(m(t,i,o,a,s+1),m(o,a,n,r,s+1))};if(m(i,t,r,t,1),m(r,t,r,n,1),m(r,n,i,n,1),m(i,n,i,t,1),"globe"===this.projection.name){const[t,i]=e.cJ(this);t?(u=90,h=180,c=-180):i&&(d=-90,h=180,c=-180)}return new e.aG(new e.ci(c,d),new e.ci(h,u))}_getBoundsRectangular(t,i){const{top:n,left:r}=this._edgeInsets,s=this.height-this._edgeInsets.bottom,o=this.width-this._edgeInsets.right,a=new e.P(r,n),l=new e.P(o,n),c=new e.P(o,s),h=new e.P(r,s);let d=this.pointCoordinate(a,t),u=this.pointCoordinate(l,t);const f=this.pointCoordinate(c,i),p=this.pointCoordinate(h,i),m=(e,t)=>(t.y-e.y)/(t.x-e.x);return d.y>1&&u.y>=0?d=new e.ac((1-p.y)/m(p,d)+p.x,1):d.y<0&&u.y<=1&&(d=new e.ac(-p.y/m(p,d)+p.x,0)),u.y>1&&d.y>=0?u=new e.ac((1-f.y)/m(f,u)+f.x,1):u.y<0&&d.y<=1&&(u=new e.ac(-f.y/m(f,u)+f.x,0)),(new e.aG).extend(this.coordinateLocation(d)).extend(this.coordinateLocation(u)).extend(this.coordinateLocation(p)).extend(this.coordinateLocation(f))}_getBoundsRectangularTerrain(){const e=this.elevation;if(!e.visibleDemTiles.length||e.isUsingMockSource())return this._getBoundsRectangular(0,0);const t=e.visibleDemTiles.reduce((e,t)=>{if(t.dem){const i=t.dem.tree;e.min=Math.min(e.min,i.minimums[0]),e.max=Math.max(e.max,i.maximums[0])}return e},{min:Number.MAX_VALUE,max:0});return this._getBoundsRectangular(t.min*e.exaggeration(),t.max*e.exaggeration())}getBounds(){return"mercator"===this.projection.name||"equirectangular"===this.projection.name?this._terrainEnabled()?this._getBoundsRectangularTerrain():this._getBoundsRectangular(0,0):this._getBoundsNonRectangular()}horizonLineFromTop(e=!0){const t=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))-this.centerOffset.y,i=this.height/2-t*(1-this._horizonShift);return e?Math.max(0,i):i}getMaxBounds(){return this.maxBounds}setMaxBounds(t){this.maxBounds=t,this.minLat=-e.cG,this.maxLat=e.cG,this.minLng=-180,this.maxLng=180,t&&(this.minLat=t.getSouth(),this.maxLat=t.getNorth(),this.minLng=t.getWest(),this.maxLng=t.getEast(),this.maxLngd&&(a=d-c),d-ht&&(o=t-l),t-e{for(let s=0;s<16;s++)t[s]=e.ai(i[s],n[s],r)})(a,a,l,e.cZ(this.pitch>=sn?1:this.pitch/sn))}else a=l;const c=e.cM([],l,o);let h=e.cM([],a,o);if(this.projection.isReprojectedInTileSpace){const t=this.locationCoordinate(this.center),i=e.bx([]);e.bo(i,i,[t.x*this.worldSize,t.y*this.worldSize,0]),e.az(i,i,e.cN(this)),e.bo(i,i,[-t.x*this.worldSize,-t.y*this.worldSize,0]),e.az(h,h,i),e.az(c,c,i),this.inverseAdjustmentMatrix=e.cO(this)}else this.inverseAdjustmentMatrix=[1,0,0,1];if(this.mercatorMatrix=e.cP([],h,[this.worldSize,this.worldSize,this.worldSize/s,1]),this.projMatrix=h,this.invProjMatrix=e.bi(new Float64Array(16),this.projMatrix),i){const i=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,1/0);i[8]=2*-t.x/this.width,i[9]=2*t.y/this.height,this.expandedFarZProjMatrix=e.cM([],i,o)}else this.expandedFarZProjMatrix=this.projMatrix;const d=e.bi([],a);this.frustumCorners=e.cQ.fromInvProjectionMatrix(d,this.horizonLineFromTop(),this.height),this.cameraFrustum=e.cy.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,0,!i);const u=new Float32Array(16);e.bx(u),e.cP(u,u,[1,-1,1]),e.cR(u,u,this._pitch),e.by(u,u,this.angle);const f=e.c9(new Float32Array(16),this._fov,this.width/this.height,this._nearZ,this._farZ);this.starsProjMatrix=e.bw(f);const p=(Math.PI/2-this._pitch)*(this.height/this._fov)*this._horizonShift;f[8]=2*-t.x/this.width,f[9]=2*(t.y+p)/this.height,this.skyboxMatrix=e.az(u,f,u);const m=this.point,g=m.x,_=m.y,y=this.width%2/2,v=this.height%2/2,x=Math.cos(this.angle),b=Math.sin(this.angle),w=g-Math.round(g)+x*y+b*v,S=_-Math.round(_)+x*v+b*y,T=new Float64Array(h);if(e.bo(T,T,[w>.5?w-1:w,S>.5?S-1:S,0]),this.alignedProjMatrix=T,h=e.bz(),e.cP(h,h,[this.width/2,-this.height/2,1]),e.bo(h,h,[1,-1,0]),this.labelPlaneMatrix=h,h=e.bz(),e.cP(h,h,[1,-1,1]),e.bo(h,h,[-1,-1,0]),e.cP(h,h,[2/this.width,2/this.height,1]),this.glCoordMatrix=h,this.pixelMatrix=e.az(new Float64Array(16),this.labelPlaneMatrix,c),this._calcFogMatrices(),this._distanceTileDataCache={},h=e.bi(new Float64Array(16),this.pixelMatrix),!h)throw new Error("failed to invert matrix");if(this.pixelMatrixInverse=h,"globe"===this.projection.name||this.mercatorFromTransition){this.globeMatrix=e.cS(this);const t=[this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]];this.globeCenterInViewSpace=e.ad(t,t,o),this.globeRadius=this.worldSize/2/Math.PI-1}else this.globeMatrix=h;this._projMatrixCache={},this._alignedProjMatrixCache={},this._pixelsToTileUnitsCache={},this._expandedProjMatrixCache={}}_calcFogMatrices(){this._fogTileMatrixCache={};const t=this.cameraWorldSizeForFog,i=this.cameraPixelsPerMeter,n=this._camera.position,r=1/this.height/this._pixelsPerMercatorPixel,s=[t,t,i];e.c1(s,s,r),e.c1(n,n,-1),e.cT(n,n,s);const o=e.bz();e.bo(o,o,n),e.cP(o,o,s),this.mercatorFogMatrix=o,this.worldToFogMatrix=this._camera.getWorldToCameraPosition(t,i,r)}_computeCameraPosition(e){const t=(e=e||this.pixelsPerMeter)/this.pixelsPerMeter,i=this._camera.forward(),n=this.point,r=this._mercatorZfromZoom(this._seaLevelZoom?this._seaLevelZoom:this._zoom)*t-e/this.worldSize*this._centerAltitude;return[n.x/this.worldSize-i[0]*r,n.y/this.worldSize-i[1]*r,e/this.worldSize*this._centerAltitude-i[2]*r]}_updateCameraState(){this.height&&(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition())}_translateCameraConstrained(t){const i=this._maxCameraBoundsDistance()*Math.cos(this._pitch),n=this._camera.position[2],r=t[2];let s=1;this.projection.wrap&&(this.center=this.center.wrap()),r>0&&(s=Math.min((i-n)/r,1)),this._camera.position=e.bE([],this._camera.position,t,s),this._updateStateFromCamera()}_updateStateFromCamera(){const t=this._camera.position,i=this._camera.forward(),{pitch:n,bearing:r}=this._camera.getPitchBearing(),s=e.cb(this._centerAltitude,this.center.lat)*this._pixelsPerMercatorPixel,o=this._mercatorZfromZoom(this._maxZoom)*Math.cos(e.al(this._maxPitch)),a=Math.max((t[2]-s)/Math.cos(n),o),l=this._zoomFromMercatorZ(a);e.bE(t,t,i,a),this._pitch=e.ay(n,e.al(this.minPitch),e.al(this.maxPitch)),this.angle=e.bQ(r,-Math.PI,Math.PI),this._setZoom(e.ay(l,this._minZoom,this._maxZoom)),this._updateSeaLevelZoom(),this._center=this.coordinateLocation(new e.ac(t[0],t[1],t[2])),this._unmodified=!1,this._constrain(),this._calcMatrices()}_worldSizeFromZoom(e){return Math.pow(2,e)*this.tileSize}_mercatorZfromZoom(e){return this.cameraToCenterDistance/this._worldSizeFromZoom(e)}_minimumHeightOverTerrain(){const e=Math.min(null!=this._seaLevelZoom?this._seaLevelZoom:this._zoom,this._maxZoom)+4;return this._mercatorZfromZoom(e)}_zoomFromMercatorZ(e){return this.scaleZoom(this.cameraToCenterDistance/(Math.max(0,e)*this.tileSize))}zoomFromMercatorZAdjusted(t){let i=0,n=e.cI,r=0,s=1/0;for(;n-i>1e-6&&n>i;){const e=i+.5*(n-i),o=this.tileSize*Math.pow(2,e),a=this.getCameraToCenterDistance(this.projection,e,o),l=this.scaleZoom(a/(Math.max(0,t)*this.tileSize)),c=Math.abs(e-l);cc||i.y>1)return!0}return!1}isHorizonVisible(){return this.pitch+e.cU(this.fovAboveCenter)>88||this.anyCornerOffEdge(new e.P(0,0),new e.P(this.width,this.height))}zoomDeltaToMovement(t,i){const n=e.ae(e.at([],this._camera.position,t)),r=this._zoomFromMercatorZ(n)+i;return n-this._mercatorZfromZoom(r)}getCameraPoint(){if("globe"===this.projection.name){const t=function([t,i,n],r){const s=[t,i,n,1];e.aA(s,s,r);const o=s[3]=Math.max(s[3],1e-6);return s[0]/=o,s[1]/=o,s[2]/=o,s}([this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]],this.pixelMatrix);return new e.P(t[0],t[1])}{const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new e.P(0,t))}}getCameraToCenterDistance(t,i=this.zoom,n=this.worldSize){const r=e.cL(t,i,this.width,this.height,1024),s=t.pixelSpaceConversion(this.center.lat,n,r);let o=.5/Math.tan(.5*this._fov)*this.height*s;return this.isOrthographic&&(o=e.ai(1,o,e.cZ(this.pitch>=sn?1:this.pitch/sn))),o}getWorldToCameraMatrix(){const t=this._camera.getWorldToCamera(this.worldSize,"meters"===this.projection.zAxisUnit?this.pixelsPerMeter:1);return"globe"===this.projection.name&&e.az(t,t,this.globeMatrix),t}getFrustum(t){return e.cy.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,t,"meters"===this.projection.zAxisUnit)}}const an=(t,i)=>{if(i>0&&t.terrain&&e.w("Cutoff is currently disabled on terrain"),i<=0||t.terrain)return{shouldRenderCutoff:!1,uniformValues:{u_cutoff_params:[0,0,0,1]}};const n=t.transform,r=Math.max(Math.abs(n._zoom-(t.minCutoffZoom-1)),1),s=n.isLODDisabled(!1)?e.af(60,45,n.pitch):e.af(30,15,n.pitch),o=n._farZ-n._nearZ,a=i*n.height,l=((1-(c=s))*n.cameraToCenterDistance+c*(n._farZ+a))*r;var c;return{shouldRenderCutoff:s<1,uniformValues:{u_cutoff_params:[n._nearZ,n._farZ,(l-n._nearZ)/o,(l-a-n._nearZ)/o]}}},ln={cascadeCount:2,normalOffset:3,shadowMapResolution:2048};class cn{constructor(e,t){this.aabb=e,this.lastCascade=t}}class hn{add(e,t){const i=this.receivers[e.key];void 0!==i?(i.aabb.min[0]=Math.min(i.aabb.min[0],t.min[0]),i.aabb.min[1]=Math.min(i.aabb.min[1],t.min[1]),i.aabb.min[2]=Math.min(i.aabb.min[2],t.min[2]),i.aabb.max[0]=Math.max(i.aabb.max[0],t.max[0]),i.aabb.max[1]=Math.max(i.aabb.max[1],t.max[1]),i.aabb.max[2]=Math.max(i.aabb.max[2],t.max[2])):this.receivers[e.key]=new cn(t,null)}clear(){this.receivers={}}get(e){return this.receivers[e.key]}computeRequiredCascades(t,i,n){const r=e.d6.fromPoints(t.points);let s=0;for(const t in this.receivers){const o=this.receivers[t];if(!o)continue;if(!r.intersectsAabb(o.aabb))continue;o.aabb.min=r.closestPoint(o.aabb.min),o.aabb.max=r.closestPoint(o.aabb.max);const a=o.aabb.getCorners();for(let t=0;t1||o[1]<-1||o[1]>1){r=!1;break}}if(o.lastCascade=t,s=Math.max(s,t),r)break}}return s+1}}class dn{constructor(e){this.painter=e,this._enabled=!1,this._shadowLayerCount=0,this._numCascadesToRender=0,this._cascades=[],this._groundShadowTiles=[],this._receivers=new hn,this._depthMode=new Yi(e.context.gl.LEQUAL,Yi.ReadWrite,[0,1]),this._uniformValues={u_light_matrix_0:new Float32Array(16),u_light_matrix_1:new Float32Array(16),u_shadow_intensity:0,u_fade_range:[0,0],u_shadow_normal_offset:[1,1,1],u_shadow_texel_size:1,u_shadow_map_resolution:1,u_shadow_direction:[0,0,1],u_shadow_bias:[36e-5,.0012,.012],u_shadowmap_0:0,u_shadowmap_1:0},this._forceDisable=!1,this.useNormalOffset=!1,e.tp.registerParameter(this,["Shadows"],"_forceDisable",{label:"forceDisable"},()=>{this.painter.style.map.triggerRepaint()}),e.tp.registerParameter(ln,["Shadows"],"cascadeCount",{min:1,max:2,step:1}),e.tp.registerParameter(ln,["Shadows"],"normalOffset",{min:0,max:10,step:.05}),e.tp.registerParameter(ln,["Shadows"],"shadowMapResolution",{min:32,max:2048,step:32}),e.tp.registerBinding(this,["Shadows"],"_numCascadesToRender",{readonly:!0,label:"numCascadesToRender"})}destroy(){for(const e of this._cascades)e.texture.destroy(),e.framebuffer.destroy();this._cascades=[]}updateShadowParameters(t,i){const n=this.painter;if(this._enabled=!1,this._shadowLayerCount=0,this._receivers.clear(),!i||!i.properties)return;const r=i.properties.get("shadow-intensity");if(!i.shadowsEnabled()||r<=0)return;if(this._shadowLayerCount=n.style.order.reduce((e,i)=>{const r=n.style._mergedLayers[i];return e+(r.hasShadowPass()&&!r.isHidden(t.zoom)?1:0)},0),this._enabled=this._shadowLayerCount>0,!this.enabled)return;const s=n.context,o=ln.shadowMapResolution,a=ln.shadowMapResolution;if(0===this._cascades.length||ln.shadowMapResolution!==this._cascades[0].texture.size[0]){this._cascades=[];for(let t=0;te.dem).forEach(e=>{const t=e.dem.tree;i[0]=Math.min(i[0],t.minimums[0]),i[1]=Math.max(i[1],t.maximums[0])}),1e4!==i[0]&&(l=(i[1]-i[0])*e.exaggeration())}const c=1.5*t.cameraToCenterDistance,h=3*c,d=new Float64Array(16);for(let i=0;i=0)return{};const s=function(t,i,n){const r=n/(1<0&&(e.d5(s[1],s[1],[r[0]*o,0,0]),e.d5(s[2],s[2],[r[0]*o,0,0])),r[1]<0?(e.d5(s[0],s[0],[0,r[1]*o,0]),e.d5(s[1],s[1],[0,r[1]*o,0])):r[1]>0&&(e.d5(s[2],s[2],[0,r[1]*o,0]),e.d5(s[3],s[3],[0,r[1]*o,0]));const a={};return a.vertices=s,a.planes=[un(s[1],s[0],s[4]),un(s[2],s[1],s[5]),un(s[3],s[2],s[6]),un(s[0],s[3],s[7])],a}addShadowReceiver(t,i,n){this._receivers.add(t,e.d6.fromTileIdAndHeight(t,i,n))}getMaxCascadeForTile(e){const t=this._receivers.get(e);return t&&t.lastCascade?t.lastCascade:0}}function un(t,i,n){const r=e.at([],n,i),s=e.at([],t,i),o=e.bF([],r,s),a=e.ae(o);return 0===a?[0,0,1,0]:(e.c1(o,o,1/a),[o[0],o[1],o[2],-e.bG(o,i)])}function fn(t){const i=t.properties.get("direction"),n=e.d1(i.x,i.y,i.z);n[2]=e.ay(n[2],0,75);const r=e.d3([n[0],n[1],n[2]]);return e.d2(r.x,r.y,r.z)}function pn(t,i,n){const r="none"===i.properties.get("color-use-theme"),s=i.properties.get("color"),o=i.properties.get("intensity"),a=i.properties.get("direction"),l=[a.x,a.y,a.z],c="none"===n.properties.get("color-use-theme"),h=n.properties.get("color"),d=n.properties.get("intensity"),u=Math.max(e.bG([0,0,1],l),0),f=[0,0,0];e.c1(f,h.toPremultipliedRenderColor(c?null:t.getLut(i.scope)).toArray01Linear().slice(0,3),d);const p=[0,0,0];return e.c1(p,s.toPremultipliedRenderColor(r?null:t.getLut(n.scope)).toArray01Linear().slice(0,3),u*o),e.d8([f[0]>0?f[0]/(f[0]+p[0]):0,f[1]>0?f[1]/(f[1]+p[1]):0,f[2]>0?f[2]/(f[2]+p[2]):0])}function mn(t,i,n,r,s,o){const a=t.zoom,l=t.scale,c=t.worldSize,h=1/c,d=t.aspect,u=Math.sqrt(1+d*d)*Math.tan(.5*t.fovX),f=u*u,p=r-n,m=r+n;let g,_;f>p/m?(g=r,_=r*u):(g=.5*m*(1+f),_=.5*Math.sqrt(p*p+2*(r*r+n*n)*f+m*m*f*f));const y=t.projection.pixelsPerMeter(t.center.lat,c),v=t._camera.getCameraToWorldMercator(),x=[0,0,-g*h];e.ad(x,x,v);let b=_*h;const w=t._edgeInsets;if(!(0===w.left&&0===w.top&&0===w.right&&0===w.bottom||w.left===w.right&&w.top===w.bottom)){const i=t._camera.getWorldToCamera(t.worldSize,"meters"===t.projection.zAxisUnit?y:1),s=t._camera.getCameraToClipPerspective(t._fov,t.width/t.height,n,r);s[8]=2*-t.centerOffset.x/t.width,s[9]=2*t.centerOffset.y/t.height;const o=new Float64Array(16);e.cM(o,s,i);const h=new Float64Array(16);e.bi(h,o);const d=e.cy.fromInvProjectionMatrix(h,c,a,!0);for(const i of d.points){const n=((S=i)[0]/=l,S[1]/=l,S[2]=e.cb(S[2],t._center.lat),S);b=Math.max(b,e.c2(e.d7([],x,n)))}}var S;b*=s/(s-1);const T=Math.acos(i[2]),k=Math.atan2(-i[0],-i[1]),M=new qi;M.position=x,M.setPitchBearing(T,k);const A=M.getWorldToCamera(c,y),C=b*c,D=Math.min(t._mercatorZfromZoom(17)*c*-2,-2*C),L=M.getCameraToClipOrthographic(-C,C,-C,C,D,(C+o*y)/i[2]),E=new Float64Array(16);e.az(E,L,A);const I=e.d2(Math.floor(1e6*x[0])/1e6*c,Math.floor(1e6*x[1])/1e6*c,0),P=.5*s,R=[0,0,0];e.ad(R,I,E),e.c1(R,R,P);const O=[Math.floor(R[0]),Math.floor(R[1]),Math.floor(R[2])],z=[0,0,0];e.at(z,R,O),e.c1(z,z,-1/P);const F=new Float64Array(16);return e.bx(F),e.bo(F,F,z),e.az(E,F,E),[E,C]}class gn extends e.E{constructor(e){super(),this.requestManager=e,this.models={"":{}},this.modelUris={"":{}},this.modelByURL={},this.numModelsLoading={}}loadModel(t,i){return e.aS(this.requestManager.transformRequest(i,e.R.Model).url).then(i=>{if(!i)return;const n=e.aT(i),r=new e.aU(t,void 0,void 0,n);return r.computeBoundsAndApplyParent(),r}).catch(n=>{if(n&&404===n.status)return null;this.fire(new e.z(new Error(`Could not load model ${t} from ${i}: ${n.message}`)))})}load(t,i,n={forceReload:!1}){this.models[i]||(this.models[i]={});const r=Object.keys(t),s=[],o=[];for(const e of r){const r=t[e];this.hasURLBeenRequested(r)&&!n.forceReload||(this.modelByURL[r]={modelId:e,scope:i},s.push(this.loadModel(e,r)),o.push(e)),this.models[i][e]||(this.models[i][e]={model:null,numReferences:1})}this.numModelsLoading[i]=(this.numModelsLoading[i]||0)+o.length,Promise.allSettled(s).then(t=>{for(let e=0;e{this.fire(new e.z(new Error(`Could not load models: ${t.message}`)))})}isLoaded(){for(const e in this.numModelsLoading)if(this.numModelsLoading[e]>0)return!1;return!0}hasModel(e,t,i={exactIdMatch:!1}){return!!(i.exactIdMatch?this.getModel(e,t):this.getModelByURL(this.modelUris[t][e]))}getModel(e,t){return this.models[t]||(this.models[t]={}),this.models[t][e]?this.models[t][e].model:void 0}getModelByURL(e){if(!e)return null;const t=this.modelByURL[e];return t?this.models[t.scope][t.modelId].model:null}hasModelBeenAdded(e,t){return this.models[t]&&void 0!==this.models[t][e]}getModelURIs(e){return this.modelUris[e]||{}}addModel(e,t,i){this.models[i]||(this.models[i]={}),this.modelUris[i]||(this.modelUris[i]={});const n=this.requestManager.normalizeModelURL(t);if((this.hasModel(e,i,{exactIdMatch:!0})||this.hasModelBeenAdded(e,i))&&this.modelUris[i][e]===n)this.models[i][e].numReferences++;else if(this.hasURLBeenRequested(n)){const{scope:e,modelId:t}=this.modelByURL[n];this.models[e][t].numReferences++}else this.modelUris[i][e]=n,this.load({[e]:this.modelUris[i][e]},i)}addModelURLs(e,t){this.models[t]||(this.models[t]={}),this.modelUris[t]||(this.modelUris[t]={});const i=this.modelUris[t];for(const t in e)i[t]=this.requestManager.normalizeModelURL(e[t])}reloadModels(e){this.load(this.modelUris[e],e,{forceReload:!0})}addModelsFromBucket(t,i){this.models[i]||(this.models[i]={}),this.modelUris[i]||(this.modelUris[i]={});const n={};for(const r of t)this.hasModel(r,i,{exactIdMatch:!0})||this.hasURLBeenRequested(r)?this.models[i][r].numReferences++:this.modelUris[i][r]&&!this.hasURLBeenRequested(r)?n[r]=this.modelUris[i][r]:!this.hasURLBeenRequested(r)&&e.d9(r,!1)&&(this.modelUris[i][r]=this.requestManager.normalizeModelURL(r),n[r]=this.modelUris[i][r]);this.load(n,i)}hasURLBeenRequested(e){return void 0!==this.modelByURL[e]}removeModel(e,t,i=!1,n=!1){if(this.models[t]&&this.models[t][e]&&(this.models[t][e].numReferences--,0===this.models[t][e].numReferences||n)){const n=this.modelUris[t][e];i||delete this.modelUris[t][e],delete this.modelByURL[n];const r=this.models[t][e].model;if(!r)return;delete this.models[t][e],r.destroy()}}destroy(){for(const e of Object.keys(this.models))for(const t of Object.keys(this.models[e])){const i=this.models[e][t].model;delete this.models[e][t],i&&i.destroy()}this.models={"":{}},this.modelUris={"":{}},this.modelByURL={},this.numModelsLoading={}}listModels(e){return this.models[e]||(this.models[e]={}),Object.keys(this.models[e])}upload(e,t){this.models[t]||(this.models[t]={});for(const i in this.models[t])this.models[t][i].model&&this.models[t][i].model.upload(e.context)}}const _n=new e.a7({data:new e.a8(e.a5.colorTheme.data)});class yn{constructor(e){this._scope=e,this._buildingQueryParams={target:{featuresetId:"building-outline",importId:this._scope}},this._floorQueryParams={target:{featuresetId:"floor-outline",importId:this._scope}}}execute(e){const t=this._makeBuildingsQueryArea(e),i=this._makeFloorsQueryArea(e),n=e.queryRenderedFeatures(t,this._buildingQueryParams).filter(e=>"building"===e.properties.shape_type).reduce((e,t)=>{const i=t.properties.id;return"building"!==t.properties.shape_type||e.some(e=>e.properties.id===i)||e.push(t),e},[]),r=e.queryRenderedFeatures(i,this._floorQueryParams).filter(e=>"floor"===e.properties.shape_type).reduce((e,t)=>{const i=t.properties.id;return"floor"!==t.properties.shape_type||e.some(e=>e.properties.id===i)||e.push(t),e},[]),s=[e.getCenter().lng,e.getCenter().lat];return{floors:r,building:this._findBuildingAtCenter(s,n)||(n.length>0?n[0]:null)}}_makeBuildingsQueryArea(t){const i=t.transform.width,n=t.transform.height,r=Math.min(i,n),s=r*(1/8),o=r*(1/8),a=.5*(i-s),l=.5*(n-o);return[new e.P(a,l),new e.P(a+s,l+o)]}_makeFloorsQueryArea(t){const i=t.transform.width,n=t.transform.height,r=i*(2/3),s=n*(2/3),o=.5*(i-r),a=.5*(n-s);return[new e.P(o,a),new e.P(o+r,a+s)]}_findBuildingAtCenter(e,t){for(const i of t)if("Polygon"===i.geometry.type&&this._pointInPolygon(e,i.geometry.coordinates[0]))return i;return null}_pointInPolygon(e,t){let i=!1;for(let n=0,r=t.length-1;ne[1]!=a>e[1]&&e[0]<(t[r][0]-s)*(e[1]-o)/(a-o)+s&&(i=!i)}return i}}class vn{constructor(){this._selectedFloorId=null,this._selectedBuildingId=null,this._floors=[]}setBuildingId(e){this._selectedBuildingId=e}setFloors(e){if(this._floors=e.filter(e=>e.properties.building_id===this._selectedBuildingId),!this._selectedFloorId||!this._floors.map(e=>e.properties.id).includes(this._selectedFloorId)){const e=this._floors.map(e=>({id:e.properties.id,level:e.properties.floor_level})).reduce((e,t)=>{const i=Math.abs(e.level-1),n=Math.abs(t.level-1);return ne.level?t:e});this._selectedFloorId=e.id}}setFloorId(e){this._selectedFloorId=e}getSelectedFloorId(){return this._selectedFloorId}getCurrentBuildingFloors(){return this._floors}reset(){this._selectedFloorId=null,this._selectedBuildingId=null,this._floors=[]}}const xn={"mbx-indoor-level-selected":{default:["literal",[]]}};function bn(e){return e=e||{},Object.assign(e,xn)}class wn extends e.E{constructor(t){super(),e.aV(["_onLoad","_onMove"],this),this._map=t,this._floorSelectionState=new vn,this._queryIndoor(),this._map.on("load",this._onLoad),this._map.on("move",this._onMove)}destroy(){this._map.indoor.off("load",this._onLoad),this._map.indoor.off("move",this._onMove),this._map=null,this._floorSelectionState=null}_onLoad(){this._map.style.forEachFragmentStyle(t=>{t.stylesheet.indoor&&(this._indoorDataQuery?this.fire(new e.z(new Error("Multiple indoor map styles detected, simultaneous usage is not allowed currently."))):(this._scope=t.scope,this._indoorDataQuery=new yn(this._scope)))}),this._map._addIndoorControl(),this._queryIndoor()}_onMove(){this._queryIndoor()}_queryIndoor(){if(!this._indoorDataQuery||!this._map.isStyleLoaded())return;if(this._map.transform.zoom<16)return void this._clearIndoorData();const e=this._indoorDataQuery.execute(this._map);e&&0!==e.floors.length?(this._floorSelectionState.getSelectedFloorId()||this._map._addIndoorControl(),this._selectFloors(e)):this._clearIndoorData()}_selectFloors(e){if(e.building)this._floorSelectionState.setBuildingId(e.building.properties.id),this._floorSelectionState.setFloors(e.floors),this._updateUI();else{const t=this._floorSelectionState.getSelectedFloorId();if(t&&e.floors.some(e=>e.properties.id===t))return;this._clearIndoorData()}}_clearIndoorData(){this._floorSelectionState.reset(),this._map._removeIndoorControl(),this._map.setConfigProperty(this._scope,"mbx-indoor-level-selected",["literal",[]])}_updateUI(){const t=this._floorSelectionState.getCurrentBuildingFloors().map(e=>({id:e.properties.id,name:e.properties.name,shortName:e.properties.floor_level,levelOrder:e.properties.floor_level})),i=this._floorSelectionState.getSelectedFloorId();i?(this._updateIndoorConfig(),this.fire(new e.A("indoorupdate",{selectedFloorId:i,floors:t}))):console.warn("IndoorManager: Selected floor is not set")}_updateIndoorConfig(){const e=this._floorSelectionState.getSelectedFloorId();e?this._map.setConfigProperty(this._scope,"mbx-indoor-level-selected",["literal",[e]]):console.warn("IndoorManager: Selected floor is not set")}selectFloor(e){this._floorSelectionState.setFloorId(e),this._updateIndoorConfig()}}function Sn(t){if(!t.metadata||!t.metadata.content_area)return;const i=e.q.devicePixelRatio,{left:n,top:r,width:s,height:o}=t.metadata.content_area,a=n*i,l=r*i;return[a,l,a+s*i,l+o*i]}function Tn(t){if(t)return t.map(([t,i])=>[t*e.q.devicePixelRatio,i*e.q.devicePixelRatio])}class kn{constructor(e,t,i){this.id=e,this.scope=t,this.sourceCache=i,this.pendingRequests=new Set,this.missingRequests=new Set}addPendingRequest(e){this.missingRequests.has(e.name)||this.pendingRequests.has(e.name)||this.pendingRequests.add(e.name)}hasPendingRequests(){return this.pendingRequests.size>0}resolvePendingRequests(){const t=new Map;if(!this.sourceCache.loaded())return t;const i=this.sourceCache.getVisibleCoordinates();if(0===i.length)return t;const n=this.sourceCache.getSource();if(!(n instanceof it))return t;const r=i.map(e=>this.sourceCache.getTile(e)),s=n.getImages(r,Array.from(this.pendingRequests));for(const[i,n]of s)t.set(e.I.from({name:i,iconsetId:this.id}),n),this.pendingRequests.delete(i);for(const e of this.pendingRequests)this.missingRequests.add(e);return this.pendingRequests.clear(),t}}const Mn=(e,t)=>Le(e,t&&t.filter(e=>"source.canvas"!==e.identifier)),An=e.aF(Et,["addLayer","removeLayer","setLights","setPaintProperty","setLayoutProperty","setSlot","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setTerrain","setFog","setSnow","setRain","setProjection","setCamera","addImport","removeImport","updateImport","addIconset","removeIconset"]),Cn=e.aF(Et,["setCenter","setZoom","setBearing","setPitch"]),Dn=new Set(["background","sky","slot","custom"]),Ln={version:8,layers:[],sources:{}},En={duration:300,delay:0};class In extends e.E{constructor(t,i={}){super(),this.map=t,this.scope=i.scope||"",this.globalId=null,this.fragments=[],this.importDepth=i.importDepth||0,this.importsCache=i.importsCache||new Map,this.resolvedImports=i.resolvedImports||new Set,this.transition=e.h({},En),this._buildingIndex=new Ct(this),this.crossTileSymbolIndex=new zi,this._mergedOrder=[],this._drapedFirstOrder=[],this._mergedLayers={},this._mergedSourceCaches={},this._mergedOtherSourceCaches={},this._mergedSymbolSourceCaches={},this._clipLayerPresent=!1,this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this._changes=i.styleChanges||new j,this.dispatcher=i.dispatcher?i.dispatcher:new e.D(e.db(),this),i.imageManager?this.imageManager=i.imageManager:(this.imageManager=new W(this.map._spriteFormat),this.imageManager.setEventedParent(this)),this.imageManager.addScope(this.scope),this.glyphManager=i.glyphManager?i.glyphManager:new e.dc(t._requestManager,i.localFontFamily?e.dd.all:i.localIdeographFontFamily?e.dd.ideographs:e.dd.none,i.localFontFamily||i.localIdeographFontFamily),i.modelManager?this.modelManager=i.modelManager:(this.modelManager=new gn(t._requestManager),this.modelManager.setEventedParent(this)),this._layers={},this._sourceCaches={},this._otherSourceCaches={},this._symbolSourceCaches={},this._loaded=!1,this._precompileDone=!1,this._shouldPrecompile=!1,this._availableImages=[],this._availableModels={},this._order=[],this._markersNeedUpdate=!1,this.options=i.configOptions?i.configOptions:new Map,this._configDependentLayers=i.configDependentLayers?i.configDependentLayers:new Set,this._config=i.config,this._styleColorTheme={lut:null,lutLoading:!1,lutLoadingCorrelationID:0,colorTheme:null,colorThemeOverride:i.colorThemeOverride},this._styleColorThemeForScope={},this._initialConfig=i.initialConfig,this.dispatcher.broadcast("setReferrer",e.de());const n=this;this._rtlTextPluginCallback=In.registerForPluginStateChange(t=>{n.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:t.pluginStatus,pluginURL:t.pluginURL},(t,i)=>{if(e.df(t),i&&i.every(e=>e))for(const e in n._sourceCaches){const t=n._sourceCaches[e],i=t.getSource().type;"vector"!==i&&"geojson"!==i||t.reload()}})}),this.on("data",e=>{if("source"!==e.dataType||"metadata"!==e.sourceDataType)return;const t=this.getOwnSource(e.sourceId);if(t&&t.vectorLayerIds)for(const e in this._layers){const i=this._layers[e];i.source===t.id&&this._validateLayer(i)}})}load(e){return e?("string"==typeof e?this.loadURL(e):this.loadJSON(e),this):this}_getGlobalId(t){if(!t)return null;if("string"==typeof t){if(e.j(t))return t;const i=e.dg(t);if(!i.startsWith("http"))try{return new URL(i,location.href).toString()}catch(e){return i}return i}return`json://${e.dh(JSON.stringify(t))}`}_diffStyle(t,i,n){this.globalId=this._getGlobalId(t);const r=(e,t)=>{try{t(null,this.setState(e,n))}catch(e){t(e,!1)}};if("string"==typeof t){const n=this.map._requestManager.normalizeStyleURL(t),s=this.map._requestManager.transformRequest(n,e.R.Style);e.n(s,(t,n)=>{t?this.fire(new e.z(t)):n&&r(n,i)})}else"object"==typeof t&&r(t,i)}loadURL(t,i={}){this.fire(new e.A("dataloading",{dataType:"style"}));const n="boolean"==typeof i.validate?i.validate:!e.j(t);this.globalId=this._getGlobalId(t),t=this.map._requestManager.normalizeStyleURL(t,i.accessToken),this.resolvedImports.add(t);const r=this.importsCache.get(t);if(r)return this._load(r,n);const s=this.map._requestManager.transformRequest(t,e.R.Style);this._request=e.n(s,(i,r)=>{if(this._request=null,i)this.fire(new e.z(i));else if(r)return this.importsCache.set(t,r),this._load(r,n)})}loadJSON(t,i={}){this.fire(new e.A("dataloading",{dataType:"style"})),this.globalId=this._getGlobalId(t),this._request=e.q.frame(()=>{this._request=null,this._load(t,!1!==i.validate)})}loadEmpty(){this.fire(new e.A("dataloading",{dataType:"style"})),this._load(Ln,!1)}_loadImports(t,i,n){if(this.importDepth>=4)return e.w("Style doesn't support nesting deeper than 5"),Promise.resolve();const r=[];for(const e of t){const t=this._createFragmentStyle(e),s=new Promise(e=>{t.once("style.import.load",e),t.once("error",e)}).then(()=>this.mergeAll());if(r.push(s),this.resolvedImports.has(e.url)){t.loadEmpty();continue}const o=e.data||this.importsCache.get(e.url);o?(t.loadJSON(o,{validate:i}),this._isInternalStyle(o)&&(t.globalId=null)):e.url?t.loadURL(e.url,{validate:i}):t.loadEmpty();const a={style:t,id:e.id,config:e.config};if(n){const e=this.fragments.findIndex(({id:e})=>e===n);this.fragments=this.fragments.slice(0,e).concat(a).concat(this.fragments.slice(e))}else this.fragments.push(a)}return Promise.allSettled(r)}getImportGlobalIds(e=this,t=new Set){for(const i of e.fragments)i.style.globalId&&t.add(i.style.globalId),this.getImportGlobalIds(i.style,t);return[...t.values()]}_createFragmentStyle(t){const i=this.scope?e.C(t.id,this.scope):t.id;let n;const r=this._initialConfig&&this._initialConfig[i];(t.config||r)&&(n=e.h({},t.config,r));const s=new In(this.map,{scope:i,styleChanges:this._changes,importDepth:this.importDepth+1,importsCache:this.importsCache,resolvedImports:new Set(this.resolvedImports),dispatcher:this.dispatcher,imageManager:this.imageManager,glyphManager:this.glyphManager,modelManager:this.modelManager,config:n,configOptions:this.options,colorThemeOverride:t["color-theme"],configDependentLayers:this._configDependentLayers});return s.setEventedParent(this.map,{style:s}),s}_reloadImports(){this.mergeAll(),this._updateMapProjection(),this.updateConfigDependencies(),this.map._triggerCameraUpdate(this.camera),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),this._shouldPrecompile=this.map._precompilePrograms&&this.isRootStyle()}_isInternalStyle(e){return this.isRootStyle()&&(e.fragment||!!e.schema&&!1!==e.fragment)}_load(t,i){const n=t.indoor?bn(t.schema):t.schema;if(this._isInternalStyle(t)){const n=e.h({},Ln,{imports:[{id:"basemap",data:t,url:""}]});return void this._load(n,i)}if(this.updateConfig(this._config,n),i&&Mn(this,ge(t)))return;this._loaded=!0,this.stylesheet=e.di(t);const r=()=>{for(const e in t.sources)this.addSource(e,t.sources[e],{validate:!1,isInitialLoad:!0});if(t.iconsets)for(const e in t.iconsets)this.addIconset(e,t.iconsets[e]);t.sprite?this._loadIconset(t.sprite):(this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0})),!this.glyphManager.url&&t.glyphs&&this.glyphManager.setURL(t.glyphs);const n=Lt(this.stylesheet.layers);if(this._order=n.map(e=>e.id),this.stylesheet.light&&e.w("The `light` root property is deprecated, prefer using `lights` with `flat` light type instead."),this.stylesheet.lights)if(1===this.stylesheet.lights.length&&"flat"===this.stylesheet.lights[0].type){const e=this.stylesheet.lights[0];this.light=new Ie(e.properties,e.id)}else this.setLights(this.stylesheet.lights);this.light||(this.light=new Ie(this.stylesheet.light)),this._layers={};for(const t of n){const i=e.dn(t,this.scope,this._styleColorTheme.lut,this.options);0!==i.configDependencies.size&&this._configDependentLayers.add(i.fqid),i.setEventedParent(this,{layer:{id:i.id}}),this._layers[i.id]=i;const n=this.getOwnLayerSourceCache(i),r=!!this.directionalLight&&this.directionalLight.shadowsEnabled();n&&i.canCastShadows()&&r&&(n.castsShadows=!0)}this.stylesheet.featuresets&&this.setFeaturesetSelectors(this.stylesheet.featuresets),this.stylesheet.models&&this.addModelURLs(this.stylesheet.models);const r=this.stylesheet.terrain;r&&(this.checkCanvasFingerprintNoise(),this.disableElevatedTerrain||this.terrainSetForDrapingOnly()||this._createTerrain(r,1)),this.stylesheet.fog&&this._createFog(this.stylesheet.fog),this.stylesheet.snow&&this._createSnow(this.stylesheet.snow),this.stylesheet.rain&&this._createRain(this.stylesheet.rain),this.stylesheet.transition&&this.setTransition(this.stylesheet.transition),this.fire(new e.A("data",{dataType:"style"}));const s=this.isRootStyle();t.imports?this._loadImports(t.imports,i).then(()=>{this._reloadImports(),this.fire(new e.A(s?"style.load":"style.import.load"))}).catch(t=>{this.fire(new e.z(new Error("Failed to load imports",t))),this.fire(new e.A(s?"style.load":"style.import.load"))}):(this._reloadImports(),this.fire(new e.A(s?"style.load":"style.import.load")))};this._styleColorTheme.colorTheme=this.stylesheet["color-theme"];const s=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(s){const t=this._evaluateColorThemeData(s);this._loadColorTheme(t).then(()=>{r()}).catch(t=>{e.w(`Couldn't load color theme from the stylesheet: ${t}`),r()})}else this._styleColorTheme.lut=null,r()}isRootStyle(){return 0===this.importDepth}mergeAll(){let t,i,n,r,s,o,a,l,c,h;const d={};this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(e=>{if(e.stylesheet){if(null!=e.light&&(t=e.light),e.stylesheet.lights)for(const t of e.stylesheet.lights)"ambient"===t.type&&null!=e.ambientLight&&(i=e.ambientLight),"directional"===t.type&&null!=e.directionalLight&&(n=e.directionalLight);r=this._prioritizeTerrain(r,e.terrain,e.stylesheet.terrain),e.stylesheet.fog&&null!=e.fog&&(s=e.fog),e.stylesheet.snow&&null!=e.snow&&(o=e.snow),e.stylesheet.rain&&null!=e.rain&&(a=e.rain),null!=e.stylesheet.camera&&(h=e.stylesheet.camera),null!=e.stylesheet.projection&&(l=e.stylesheet.projection),null!=e.stylesheet.transition&&(c=e.stylesheet.transition),d[e.scope]=e._styleColorTheme}}),this.light=t,this.ambientLight=i,this.directionalLight=n,this.fog=s,this.snow=o,this.rain=a,this._styleColorThemeForScope=d,null===r?delete this.terrain:this.terrain=r,this.camera=h||{"camera-projection":"perspective"},this.projection=l||{name:"mercator"},this.transition=e.h({},En,c),this.mergeSources(),this.mergeLayers()}forEachFragmentStyle(e){const t=i=>{for(const e of i.fragments)t(e.style);e(i)};t(this)}_prioritizeTerrain(e,t,i){const n=e&&0===e.drapeRenderMode;return null===i?t&&0===t.drapeRenderMode?t:n?e:null:null!=t&&(!e||n||t&&1===t.drapeRenderMode)?t:e}mergeTerrain(){let e;this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(t=>{e=this._prioritizeTerrain(e,t.terrain,t.stylesheet.terrain)}),null===e?delete this.terrain:this.terrain=e}mergeProjection(){let e;this.forEachFragmentStyle(t=>{null!=t.stylesheet.projection&&(e=t.stylesheet.projection)}),this.projection=e||{name:"mercator"}}mergeSources(){const t={},i={},n={};this.forEachFragmentStyle(r=>{for(const i in r._sourceCaches){const n=e.C(i,r.scope);t[n]=r._sourceCaches[i]}for(const t in r._otherSourceCaches){const n=e.C(t,r.scope);i[n]=r._otherSourceCaches[t]}for(const t in r._symbolSourceCaches){const i=e.C(t,r.scope);n[i]=r._symbolSourceCaches[t]}}),this._mergedSourceCaches=t,this._mergedOtherSourceCaches=i,this._mergedSymbolSourceCaches=n}mergeLayers(){const t={},i=[],n={};this._mergedSlots=[],this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this.forEachFragmentStyle(n=>{for(const r of n._order){const s=n._layers[r];if("slot"===s.type){const i=e.dj(r);if(t[i])continue;t[i]=[]}s.slot&&t[s.slot]?t[s.slot].push(s):i.push(s)}}),this._mergedOrder=[];const r=(i=[])=>{for(const s of i)if("slot"===s.type){const i=e.dj(s.id);t[i]&&r(t[i]),this._mergedSlots.push(i)}else{const t=e.C(s.id,s.scope);this._mergedOrder.push(t),n[t]=s,s.is3D(!!this.terrain)&&(this._has3DLayers=!0),"circle"===s.type&&(this._hasCircleLayers=!0),"symbol"===s.type&&(this._hasSymbolLayers=!0),"clip"===s.type&&(this._clipLayerPresent=!0)}};r(i),this._mergedOrder.sort((e,t)=>{const i=n[e],r=n[t];return i.hasInitialOcclusionOpacityProperties?r.is3D(!!this.terrain)?1:0:i.is3D(!!this.terrain)&&r.hasInitialOcclusionOpacityProperties?-1:0}),this._mergedLayers=n,this.updateDrapeFirstLayers(),this._buildingIndex.processLayersChanged()}terrainSetForDrapingOnly(){return!!this.terrain&&0===this.terrain.drapeRenderMode}getCamera(){return this.stylesheet.camera}setCamera(t){return this.stylesheet.camera=e.h({},this.stylesheet.camera,t),this.camera=this.stylesheet.camera,this}_evaluateColorThemeData(t){return t.data?function(t,i,n){const r=e.h({},i);for(const t of Object.keys(e.a5.colorTheme))void 0===r[t]&&(r[t]=e.a5.colorTheme[t].default);const s=new e.a6(_n,t,new Map(n));return s.setTransitionOrValue(r,n),s.untransitioned().possiblyEvaluate(new e.aa(0,{worldview:void 0}))}(this.scope,t,this.options).get("data"):null}_loadColorTheme(t){this._styleColorTheme.lutLoading=!0,this._styleColorTheme.lutLoadingCorrelationID+=1;const i=this._styleColorTheme.lutLoadingCorrelationID;return new Promise((n,r)=>{const s="data:image/png;base64,";if(!t||0===t.length)return this._styleColorTheme.lut=null,this._styleColorTheme.lutLoading=!1,void n();let o=t;o.startsWith(s)||(o=s+o);const a=e.I.from("mapbox-reserved-lut"),l=new Image;l.src=o,l.onerror=()=>{this._styleColorTheme.lutLoading=!1,r(new Error("Failed to load image data"))},l.onload=()=>{if(this._styleColorTheme.lutLoadingCorrelationID!==i)return void n();this._styleColorTheme.lutLoading=!1;const{width:s,height:o,data:c}=e.q.getImageData(l);if(o>32)return void r(new Error("The height of the image must be less than or equal to 32 pixels."));if(s!==o*o)return void r(new Error("The width of the image must be equal to the height squared."));this.getImage(a)&&this.removeImage(a),this.addImage(a,{data:new e.r({width:s,height:o},c),pixelRatio:1,sdf:!1,usvg:!1,version:0});const h=this.imageManager.getImage(a,this.scope);h?(this._styleColorTheme.lut={image:h.data,data:t},n()):r(new Error("Missing LUT image."))}})}getLut(e){const t=this._styleColorThemeForScope[e];return t?t.lut:null}setProjection(e){e?this.stylesheet.projection=e:delete this.stylesheet.projection,this.mergeProjection(),this._updateMapProjection()}applyProjectionUpdate(){this._loaded&&(this.dispatcher.broadcast("setProjection",this.map.transform.projectionOptions),this.map.transform.projection.requiresDraping?(this.getTerrain()||this.stylesheet.terrain)&&!this.disableElevatedTerrain||this.setTerrainForDraping():this.terrainSetForDrapingOnly()&&this.setTerrain(null,0))}_updateMapProjection(){this.isRootStyle()&&(this.map._useExplicitProjection?this.applyProjectionUpdate():this.map._prioritizeAndUpdateProjection(null,this.projection))}_loadSprite(t){this._spriteRequest=function(t,i,n){let r,s,o;const a=e.q.devicePixelRatio>1?"@2x":"";let l=e.n(i.transformRequest(i.normalizeSpriteURL(t,a,".json"),e.R.SpriteJSON),(e,t)=>{l=null,o||(o=e,r=t,h())}),c=e.o(i.transformRequest(i.normalizeSpriteURL(t,a,".png"),e.R.SpriteImage),(e,t)=>{c=null,o||(o=e,s=t,h())});function h(){if(o)n(o);else if(r&&s){const t=e.q.getImageData(s),i={};for(const n in r){const{width:s,height:o,x:a,y:l,sdf:c,pixelRatio:h,stretchX:d,stretchY:u,content:f}=r[n],p=new e.r({width:s,height:o});e.r.copy(t,p,{x:a,y:l},{x:0,y:0},{width:s,height:o},null),i[n]={data:p,pixelRatio:h,sdf:c,stretchX:d,stretchY:u,content:f,usvg:!1}}n(null,i)}}return{cancel(){l&&(l.cancel(),l=null),c&&(c.cancel(),c=null)}}}(t,this.map._requestManager,(t,i)=>{if(this._spriteRequest=null,t)this.fire(new e.z(t));else if(i){const t=new Map;for(const n in i)t.set(e.I.from(n),i[n]);this.addImages(t)}this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new e.A("data",{dataType:"style"}))})}addIconset(t,i){if("sprite"===i.type)return void this._loadSprite(i.url);const n=this.getOwnSourceCache(i.source);if(!n)return void this.fire(new e.z(new Error(`Source "${i.source}" as specified by iconset "${t}" does not exist and cannot be used as an iconset source`)));const r=n.getSource();if("raster-array"!==r.type)return void this.fire(new e.z(new Error(`Source "${i.source}" as specified by iconset "${t}" is not a "raster-array" source and cannot be used as an iconset source`)));r.partial=!1;const s=new kn(t,this.scope,n);this.imageManager.addImageProvider(s,this.scope)}removeIconset(e){this.imageManager.removeImageProvider(e,this.scope)}_loadIconset(t){if(!e.j(t)&&"icon_set"!==this.map._spriteFormat||"raster"===this.map._spriteFormat)return void this._loadSprite(t);const i="auto"===this.map._spriteFormat;var n,r;this._spriteRequest=(r=(n,r)=>{if(this._spriteRequest=null,n)i?this._loadSprite(t):this.fire(new e.z(n));else if(r){const t=new Map;for(const i in r)t.set(e.I.from(i),r[i]);this.addImages(t)}this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new e.A("data",{dataType:"style"}))},e.br((n=this.map._requestManager).transformRequest(n.normalizeIconsetURL(t),e.R.Iconset),(t,i)=>{if(t)return void r(t);const n={},s=e.da(new e.bq(i));for(const t of s.icons){const i={version:1,pixelRatio:e.q.devicePixelRatio,content:Sn(t),stretchX:t.metadata?Tn(t.metadata.stretch_x_areas):void 0,stretchY:t.metadata?Tn(t.metadata.stretch_y_areas):void 0,sdf:!1,usvg:!0,icon:t};n[t.name]=i}r(null,n)}))}_validateLayer(t){const i=this.getOwnSource(t.source);if(!i)return;const n=t.sourceLayer;n&&("geojson"===i.type||i.vectorLayerIds&&-1===i.vectorLayerIds.indexOf(n))&&this.fire(new e.z(new Error(`Source layer "${n}" does not exist on source "${i.id}" as specified by style layer "${t.id}"`)))}loaded(){if(!this._loaded)return!1;if(Object.keys(this._changes.getUpdatedSourceCaches()).length)return!1;for(const e in this._sourceCaches)if(!this._sourceCaches[e].loaded())return!1;if(!this.imageManager.isLoaded())return!1;if(this.imageManager.hasPatternsInFlight())return!1;if(!this.modelManager.isLoaded())return!1;if(this._styleColorTheme.lutLoading)return!1;for(const{style:e}of this.fragments)if(!e.loaded())return!1;return!0}_serializeImports(){if(this.stylesheet.imports)return this.stylesheet.imports.map((e,t)=>{const i=this.fragments[t];return i&&i.style&&(e.data=i.style.serialize()),e})}_serializeSources(){const e={};for(const t in this._sourceCaches){const i=this._sourceCaches[t].getSource();e[i.id]||(e[i.id]=i.serialize())}return e}_serializeLayers(e){const t=[];for(const i of e){const e=this._layers[i];e&&"custom"!==e.type&&t.push(e.serialize())}return t}hasLightTransitions(){return!(!this.light||!this.light.hasTransition())||!(!this.ambientLight||!this.ambientLight.hasTransition())||!(!this.directionalLight||!this.directionalLight.hasTransition())}hasFogTransition(){return!!this.fog&&this.fog.hasTransition()}hasSnowTransition(){return!!this.snow&&this.snow.hasTransition()}hasRainTransition(){return!!this.rain&&this.rain.hasTransition()}hasTransitions(){if(this.hasLightTransitions())return!0;if(this.hasFogTransition())return!0;if(this.hasSnowTransition())return!0;if(this.hasRainTransition())return!0;for(const e in this._sourceCaches)if(this._sourceCaches[e].hasTransition())return!0;for(const e in this._layers)if(this._layers[e].hasTransition())return!0;return!1}get order(){return this.terrain?this._drapedFirstOrder:this._mergedOrder}_getOrder(e){return e?this.order:this._mergedOrder}isLayerDraped(e){return!!this.terrain&&e.isDraped(this.getLayerSourceCache(e))}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading")}_checkLayer(t){const i=this.getOwnLayer(t);if(i)return i;this.fire(new e.z(new Error(`The layer '${t}' does not exist in the map's style.`)))}_checkSource(t){const i=this.getOwnSource(t);if(i)return i;this.fire(new e.z(new Error(`The source '${t}' does not exist in the map's style.`)))}precompilePrograms(e,t){const i=this.map.painter;if(i)for(let n=e.minzoom||0;n<(e.maxzoom||25.5);n++){const n=e.getProgramIds();if(n)for(const r of n){const n=e.getDefaultProgramParams(r,t.zoom,this._styleColorTheme.lut);n&&(i.style=this,this.fog&&(i._fogVisible=!0,n.overrideFog=!0,i.getOrCreateProgram(r,n)),i._fogVisible=!1,n.overrideFog=!1,i.getOrCreateProgram(r,n),(this.stylesheet.terrain||this.stylesheet.projection&&"globe"===this.stylesheet.projection.name)&&(n.overrideRtt=!0,i.getOrCreateProgram(r,n)))}}}update(t){if(!this._loaded)return;this.ambientLight&&this.ambientLight.recalculate(t),this.directionalLight&&this.directionalLight.recalculate(t);const i=this.calculateLightsBrightness();t.brightness=i||0,i!==this._brightness&&(this._brightness=i,this.dispatcher.broadcast("setBrightness",i)),t.worldview!==this._worldview&&(this._worldview=t.worldview,this.dispatcher.broadcast("setWorldview",this._worldview));const n=this._changes.isDirty();let r=!1;if(this._changes.isDirty()){const e=this._changes.getLayerUpdatesByScope();for(const t in e){const{updatedIds:i,removedIds:n}=e[t];(i||n)&&(this._updateWorkerLayers(t,i,n),r=!0)}this.updateSourceCaches(),this._updateTilesForChangedImages(),this.updateLayers(t),this.light&&this.light.updateTransitions(t),this.ambientLight&&this.ambientLight.updateTransitions(t),this.directionalLight&&this.directionalLight.updateTransitions(t),this.fog&&this.fog.updateTransitions(t),this.snow&&this.snow.updateTransitions(t),this.rain&&this.rain.updateTransitions(t),this._changes.reset()}const s={};for(const e in this._mergedSourceCaches){const t=this._mergedSourceCaches[e];s[e]=t.used,t.used=!1,t.tileCoverLift=0}for(const e of this._mergedOrder){const i=this._mergedLayers[e];if(i.recalculate(t,this._availableImages),!i.isHidden(t.zoom)){const e=this.getLayerSourceCache(i);e&&(e.used=!0,e.tileCoverLift=Math.max(e.tileCoverLift,i.tileCoverLift()))}!this._precompileDone&&this._shouldPrecompile&&("requestIdleCallback"in window?requestIdleCallback(()=>{this.precompilePrograms(i,t)}):this.precompilePrograms(i,t))}this._shouldPrecompile&&(this._precompileDone=!0),this.terrain&&r&&this.mergeLayers();const o=this.imageManager.getPendingImageProviders();for(const e of o)e.sourceCache.used=!0;for(const t in s){const i=this._mergedSourceCaches[t];s[t]!==i.used&&i.getSource().fire(new e.A("data",{sourceDataType:"visibility",dataType:"source",sourceId:i.getSource().id}))}this.light&&this.light.recalculate(t),this.terrain&&this.terrain.recalculate(t),this.fog&&this.fog.recalculate(t),this.snow&&this.snow.recalculate(t),this.rain&&this.rain.recalculate(t),this.z=t.zoom,this._markersNeedUpdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),this.imageManager.clearUpdatedImages(this.scope),n&&this.fire(new e.A("data",{dataType:"style"}))}updateImageProviders(){const e=this.imageManager.getPendingImageProviders();for(const t of e){const e=t.resolvePendingRequests(),i=this.getFragmentStyle(t.scope);i&&i.addImages(e)}}_updateTilesForChangedImages(){const e={};for(const t in this._mergedSourceCaches){const i=this._mergedSourceCaches[t].getSource().scope;e[i]=e[i]||this._changes.getUpdatedImages(i),0!==e[i].length&&this._mergedSourceCaches[t].reloadTilesForDependencies(["icons","patterns"],e[i])}for(const t in e)this._changes.resetUpdatedImages(t)}_updateWorkerLayers(e,t,i){const n=this.getFragmentStyle(e);n&&this.dispatcher.broadcast("updateLayers",{layers:t?n._serializeLayers(t):[],scope:e,removedIds:i||[],options:n.options})}setState(t,i){if(this._checkLoaded(),Mn(this,ge(t)))return!1;(t=e.di(t)).layers=Lt(t.layers);const n=function(t,i){if(!t)return[{command:Et.setStyle,args:[i]}];let n=[];try{if(!e.bv(t.version,i.version))return[{command:Et.setStyle,args:[i]}];if(e.bv(t.center,i.center)||n.push({command:Et.setCenter,args:[i.center]}),e.bv(t.zoom,i.zoom)||n.push({command:Et.setZoom,args:[i.zoom]}),e.bv(t.bearing,i.bearing)||n.push({command:Et.setBearing,args:[i.bearing]}),e.bv(t.pitch,i.pitch)||n.push({command:Et.setPitch,args:[i.pitch]}),e.bv(t.sprite,i.sprite)||n.push({command:Et.setSprite,args:[i.sprite]}),e.bv(t.glyphs,i.glyphs)||n.push({command:Et.setGlyphs,args:[i.glyphs]}),e.bv(t.imports,i.imports)||function(t=[],i=[],n){i=i||[];const r=(t=t||[]).map(Ft),s=i.map(Ft),o=t.reduce(Nt,{}),a=i.reduce(Nt,{}),l=r.slice();let c,h,d,u;for(c=0,h=0;c{e.source&&r[e.source]?n.push({command:Et.removeLayer,args:[e.id]}):o.push(e)});let a=t.terrain;a&&r[a.source]&&(n.push({command:Et.setTerrain,args:[void 0]}),a=void 0),n=n.concat(s),e.bv(a,i.terrain)||n.push({command:Et.setTerrain,args:[i.terrain]}),function(t,i,n){i=i||[];const r=(t=t||[]).map(Ft),s=i.map(Ft),o=t.reduce(Nt,{}),a=i.reduce(Nt,{}),l=r.slice(),c=Object.create(null);let h,d,u,f,p,m,g;for(h=0,d=0;h!(e.command in Cn));if(0===n.length)return!1;const r=n.filter(e=>!(e.command in An));if(r.length>0)throw new Error(`Unimplemented: ${r.map(e=>e.command).join(", ")}.`);const s=[];return n.forEach(e=>{s.push(this[e.command](...e.args))}),i&&Promise.all(s).then(i).catch(i),this.stylesheet=t,this.mergeAll(),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),!0}_updateWorkerImages(){this._availableImages=this.imageManager.listImages(this.scope),this.dispatcher.broadcast("setImages",{scope:this.scope,images:this._availableImages})}_updateWorkerModels(){this._availableModels=this.modelManager.getModelURIs(this.scope),this.dispatcher.broadcast("setModels",{scope:this.scope,models:this._availableModels})}addImages(t){if(0===t.size)return this;for(const[i,n]of t.entries()){if(this.getImage(i))return this.fire(new e.z(new Error(`An image with the name "${i.name}" already exists.`)));this.imageManager.addImage(i,this.scope,n),this._changes.updateImage(i,this.scope)}return this._updateWorkerImages(),this.fire(new e.A("data",{dataType:"style"})),this}addImage(t,i){return this.getImage(t)?this.fire(new e.z(new Error(`An image with the name "${t.name}" already exists.`))):(this.imageManager.addImage(t,this.scope,i),this._changes.updateImage(t,this.scope),this._updateWorkerImages(),this.fire(new e.A("data",{dataType:"style"})),this)}updateImage(t,i,n=!1){this.imageManager.updateImage(t,this.scope,i),n&&(this._changes.updateImage(t,this.scope),this._updateWorkerImages(),this.fire(new e.A("data",{dataType:"style"})))}getImage(e){return this.imageManager.getImage(e,this.scope)}removeImage(t){return this.getImage(t)?(this.imageManager.removeImage(t,this.scope),this._changes.updateImage(t,this.scope),this._updateWorkerImages(),this.fire(new e.A("data",{dataType:"style"})),this):this.fire(new e.z(new Error("No image with this name exists.")))}listImages(){return this._checkLoaded(),this._availableImages.slice()}addModelURLs(t){return this.modelManager.addModelURLs(t,this.scope),this._updateWorkerModels(),this.fire(new e.A("data",{dataType:"style"})),this}addModel(t,i,n={}){return this._checkLoaded(),this._validate(Ce,`models.${t}`,i,null,n)||(this.modelManager.addModel(t,i,this.scope),this.fire(new e.A("data",{dataType:"style"}))),this}hasModel(e){return this.modelManager.hasModel(e,this.scope)}removeModel(t){return this.hasModel(t)?(this.modelManager.removeModel(t,this.scope,!1,!0),this.fire(new e.A("data",{dataType:"style"})),this):this.fire(new e.z(new Error("No model with this ID exists.")))}listModels(){return this._checkLoaded(),this.modelManager.listModels(this.scope)}addSource(t,i,n={}){if(this._checkLoaded(),void 0!==this.getOwnSource(t))throw new Error(`There is already a source with ID "${t}".`);if(!i.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(i).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(i.type)>=0&&this._validate(_e,`sources.${t}`,i,null,n))return;this.map&&this.map._collectResourceTiming&&(i.collectResourceTiming=!0);const r=rt(t,i,this.dispatcher,this);r.scope=this.scope,r.setEventedParent(this,()=>({isSourceLoaded:this._isSourceCacheLoaded(r.id),source:r.serialize(),sourceId:r.id}));const s=t=>{const i=(t?"symbol:":"other:")+r.id,n=e.C(i,this.scope),s=this._sourceCaches[i]=new Tt(n,r,t);(t?this._symbolSourceCaches:this._otherSourceCaches)[r.id]=s,s.onAdd(this.map)};s(!1),"vector"!==i.type&&"geojson"!==i.type||s(!0),r.onAdd&&r.onAdd(this.map),n.isInitialLoad||(this.mergeSources(),this._changes.setDirty())}removeSource(t){this._checkLoaded();const i=this.getOwnSource(t);if(!i)throw new Error("There is no source with this ID");for(const i in this._layers)if(this._layers[i].source===t)return this.fire(new e.z(new Error(`Source "${t}" cannot be removed while layer "${i}" is using it.`)));if(this.terrain&&this.terrain.scope===this.scope&&this.terrain.get().source===t)return this.fire(new e.z(new Error(`Source "${t}" cannot be removed while terrain is using it.`)));if(this.stylesheet.iconsets){const i=Object.entries(this.stylesheet.iconsets).find(([e,i])=>"source"===i.type&&i.source===t);if(i)return this.fire(new e.z(new Error(`Source "${t}" cannot be removed while iconset "${i[0]}" is using it.`)))}const n=this.getOwnSourceCaches(t);for(const t of n){const i=e.dj(t.id);delete this._sourceCaches[i],this._changes.discardSourceCacheUpdate(t.id),t.fire(new e.A("data",{sourceDataType:"metadata",dataType:"source",sourceId:t.getSource().id})),t.setEventedParent(null),t.clearTiles()}return delete this._otherSourceCaches[t],delete this._symbolSourceCaches[t],this.mergeSources(),i.setEventedParent(null),i.onRemove&&i.onRemove(this.map),this._changes.setDirty(),this}setGeoJSONSourceData(e,t){this._checkLoaded(),this.getOwnSource(e).setData(t),this._changes.setDirty()}getOwnSource(e){const t=this.getOwnSourceCache(e);return t&&t.getSource()}getOwnSources(){const e=[];for(const t in this._otherSourceCaches){const i=this.getOwnSourceCache(t);i&&e.push(i.getSource())}return e}areTilesLoaded(){const e=this._mergedSourceCaches;for(const t in e){const i=e[t]._tiles;for(const e in i){const t=i[e];if("loaded"!==t.state&&"errored"!==t.state)return!1}}return!0}setLights(t){if(this._checkLoaded(),!t)return delete this.ambientLight,void delete this.directionalLight;const i=this._getTransitionParameters();for(const n of t){if(this._validate(ve,"lights",n))return;switch(n.type){case"ambient":if(this.ambientLight){const e=this.ambientLight;e.set(n),e.updateTransitions(i)}else this.ambientLight=new $e(n,je||(je=new e.a7({color:new e.a8(e.a5.properties_light_ambient.color),"color-use-theme":new e.a8({type:"string",default:"default","property-type":"data-constant"}),intensity:new e.a8(e.a5.properties_light_ambient.intensity)})),this.scope,this.options);break;case"directional":if(this.directionalLight){const e=this.directionalLight;e.set(n),e.updateTransitions(i)}else this.directionalLight=new $e(n,Ve||(Ve=new e.a7({direction:new e.an(e.a5.properties_light_directional.direction),color:new e.a8(e.a5.properties_light_directional.color),"color-use-theme":new e.a8({type:"string",default:"default","property-type":"data-constant"}),intensity:new e.a8(e.a5.properties_light_directional.intensity),"cast-shadows":new e.a8(e.a5.properties_light_directional["cast-shadows"]),"shadow-quality":new e.a8(e.a5.properties_light_directional["shadow-quality"]),"shadow-intensity":new e.a8(e.a5.properties_light_directional["shadow-intensity"])})),this.scope,this.options)}}const n=Object.assign(i,{worldview:this.map.getWorldview()}),r=new e.aa(this.z||0,n);this.ambientLight&&this.ambientLight.recalculate(r),this.directionalLight&&this.directionalLight.recalculate(r),this._brightness=this.calculateLightsBrightness(),this.dispatcher.broadcast("setBrightness",this._brightness)}calculateLightsBrightness(){const t=this.directionalLight,i=this.ambientLight;if(!t||!i)return;const n=e=>.2126*(e[0]<=.03928?e[0]/12.92:Math.pow((e[0]+.055)/1.055,2.4))+.7152*(e[1]<=.03928?e[1]/12.92:Math.pow((e[1]+.055)/1.055,2.4))+.0722*(e[2]<=.03928?e[2]/12.92:Math.pow((e[2]+.055)/1.055,2.4)),r=t.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(),s=t.properties.get("intensity"),o=t.properties.get("direction"),a=1-e.d1(o.x,o.y,o.z)[2]/90,l=n(r)*s*a,c=i.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(),h=i.properties.get("intensity"),d=n(c)*h;return Number(((l+d)/2).toFixed(6))}getBrightness(){return this._brightness}getLights(){if(!this.enable3dLights())return null;const e=[];return this.directionalLight&&e.push(this.directionalLight.get()),this.ambientLight&&e.push(this.ambientLight.get()),e}enable3dLights(){return!!this.ambientLight&&!!this.directionalLight}getFragmentStyle(t){if(null==t||""===t&&this.isRootStyle())return this;if(e.dk(t)){const i=e.dl(t),n=this.fragments.find(({id:e})=>e===i);if(!n)return;const r=e.dj(t);return n.style.getFragmentStyle(r)}{const e=this.fragments.find(({id:e})=>e===t);return e?e.style:void 0}}setFeaturesetSelectors(t){if(!t)return;const i={},n=(e,t="")=>`${e}::${t}`;this._featuresetSelectors={};for(const r in t){const s=this._featuresetSelectors[r]=[];for(const o of t[r].selectors){if(o.featureNamespace){const t=this.getOwnLayer(o.layer);if(!t){e.w(`Layer is undefined for selector: ${o.layer}`);continue}const s=n(t.source,t.sourceLayer);if(s in i&&i[s]!==o.featureNamespace){e.w(`"featureNamespace ${o.featureNamespace} of featureset ${r}'s selector is not associated to the same source, skip this selector`);continue}i[s]=o.featureNamespace}let t;if(o.properties)for(const i in o.properties){const n=e.X(o.properties[i]);"success"===n.result&&(t=t||{},t[i]=n.value)}s.push({layerId:o.layer,namespace:o.featureNamespace,properties:t,uniqueFeatureID:o._uniqueFeatureID})}}}getFeaturesetDescriptors(e){const t=this.getFragmentStyle(e);if(!t||!t.stylesheet.featuresets)return[];const i=[];for(const e in t.stylesheet.featuresets)i.push({featuresetId:e,importId:t.scope?t.scope:void 0});return i}getFeaturesetLayers(t,i){const n=this.getFragmentStyle(i),r=n.stylesheet.featuresets;if(!r||!r[t])return this.fire(new e.z(new Error(`The featureset '${t}' does not exist in the map's style and cannot be queried.`))),[];const s=[];for(const e of r[t].selectors){const t=n.getOwnLayer(e.layer);t&&s.push(t)}return s}getConfigProperty(t,i){const n=this.getFragmentStyle(t);if(!n)return null;const r=e.C(i,n.scope),s=n.options.get(r),o=s?s.value||s.default:null;return o?o.serialize():null}setConfigProperty(t,i,n){const r=this.getFragmentStyle(t);if(!r)return;const s=r.stylesheet.indoor?bn(r.stylesheet.schema):r.stylesheet.schema;if(!s||!s[i])return;const o=e.X(n);if("success"!==o.result)return void Mn(this,o.value);const a=o.value.expression,l=e.C(i,r.scope),c=r.options.get(l);if(!c)return;let h;const{minValue:d,maxValue:u,stepValue:f,type:p,values:m}=s[i],g=e.X(s[i].default);"success"===g.result&&(h=g.value.expression),h?(this.options.set(l,Object.assign({},c,{value:a,default:h,minValue:d,maxValue:u,stepValue:f,type:p,values:m})),this.updateConfigDependencies(i)):this.fire(new e.z(new Error(`No schema defined for the config option "${i}" in the "${t}" fragment.`)))}getConfig(t){const i=this.getFragmentStyle(t);if(!i)return null;const n=i.stylesheet.schema;if(!n)return null;const r={};for(const t in n){const n=e.C(t,i.scope),s=i.options.get(n),o=s?s.value||s.default:null;r[t]=o?o.serialize():null}return r}setConfig(e,t){const i=this.getFragmentStyle(e);i&&(i.updateConfig(t,i.stylesheet.schema),this.updateConfigDependencies())}getSchema(e){const t=this.getFragmentStyle(e);return t?t.stylesheet.schema:null}setSchema(e,t){const i=this.getFragmentStyle(e);i&&(i.stylesheet.schema=t,i.updateConfig(i._config,t),this.updateConfigDependencies())}updateConfig(t,i){if(this._config=t,t||i)if(i)for(const n in i){let r,s;const o=e.X(i[n].default);if("success"===o.result&&(r=o.value.expression),t&&void 0!==t[n]){const i=e.X(t[n]);"success"===i.result&&(s=i.value.expression)}const{minValue:a,maxValue:l,stepValue:c,type:h,values:d}=i[n];if(r){const t=e.C(n,this.scope);this.options.set(t,{default:r,value:s,minValue:a,maxValue:l,stepValue:c,type:h,values:d})}else this.fire(new e.z(new Error(`No schema defined for config option "${n}".`)))}else this.fire(new e.z(new Error("Attempting to set config for a style without schema.")))}updateConfigDependencies(e){for(const t of this._configDependentLayers){const i=this.getLayer(t);if(i){if(e&&!i.configDependencies.has(e))continue;i.possiblyEvaluateVisibility(),this._updateLayer(i)}}this.ambientLight&&this.ambientLight.updateConfig(this.options),this.directionalLight&&this.directionalLight.updateConfig(this.options),this.fog&&this.fog.updateConfig(this.options),this.snow&&this.snow.updateConfig(this.options),this.rain&&this.rain.updateConfig(this.options),this.forEachFragmentStyle(e=>{const t=e._styleColorTheme.colorThemeOverride?e._styleColorTheme.colorThemeOverride:e._styleColorTheme.colorTheme;if(t){const i=e._evaluateColorThemeData(t);(!e._styleColorTheme.lut&&""!==i||e._styleColorTheme.lut&&i!==e._styleColorTheme.lut.data)&&e.setColorTheme(t)}}),this._changes.setDirty()}addLayer(t,i,n={}){this._checkLoaded();const r=t.id;if(this._layers[r])return void this.fire(new e.z(new Error(`Layer with id "${r}" already exists on this map`)));let s;if("custom"===t.type){if(Mn(this,e.dm(t)))return;s=e.dn(t,this.scope,this._styleColorTheme.lut,this.options)}else{if("object"==typeof t.source&&(this.addSource(r,t.source),t=e.di(t),t=e.h(t,{source:r})),this._validate(Te,`layers.${r}`,t,{arrayIndex:-1},n))return;s=e.dn(t,this.scope,this._styleColorTheme.lut,this.options),this._validateLayer(s),s.setEventedParent(this,{layer:{id:r}})}0!==s.configDependencies.size&&this._configDependentLayers.add(s.fqid);let o=this._order.length;if(i){const t=this._order.indexOf(i);if(-1===t)return void this.fire(new e.z(new Error(`Layer with id "${i}" does not exist on this map.`)));s.slot===this._layers[i].slot?o=t:e.w(`Layer with id "${i}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(o,0,r),this._layerOrderChanged=!0,this._layers[r]=s;const a=this.getOwnLayerSourceCache(s),l=!!this.directionalLight&&this.directionalLight.shadowsEnabled();a&&s.canCastShadows()&&l&&(a.castsShadows=!0);const c=this._changes.getRemovedLayer(s);if(c&&s.source&&a&&"custom"!==s.type){this._changes.discardLayerRemoval(s);const t=e.C(s.source,s.scope);c.type!==s.type?this._changes.updateSourceCache(t,"clear"):(this._changes.updateSourceCache(t,"reload"),a.pause())}this._updateLayer(s),s.onAdd&&s.onAdd(this.map),s.scope=this.scope,this.mergeLayers()}moveLayer(t,i){this._checkLoaded();const n=this._checkLayer(t);if(!n)return;if(t===i)return;const r=this._order.indexOf(t);this._order.splice(r,1);let s=this._order.length;if(i){const t=this._order.indexOf(i);if(-1===t)return void this.fire(new e.z(new Error(`Layer with id "${i}" does not exist on this map.`)));n.slot===this._layers[i].slot?s=t:e.w(`Layer with id "${i}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(s,0,t),this._changes.setDirty(),this._layerOrderChanged=!0,this.mergeLayers()}removeLayer(e){this._checkLoaded();const t=this._checkLayer(e);if(!t)return;t.setEventedParent(null);const i=this._order.indexOf(e);this._order.splice(i,1),delete this._layers[e],this._changes.setDirty(),this._layerOrderChanged=!0,this._configDependentLayers.delete(t.fqid),this._changes.removeLayer(t);const n=this.getOwnLayerSourceCache(t);if(n&&n.castsShadows){let e=!1;for(const i in this._layers)if(this._layers[i].source===t.source&&this._layers[i].canCastShadows()){e=!0;break}n.castsShadows=e}t.onRemove&&t.onRemove(this.map),this.mergeLayers()}getOwnLayer(e){return this._layers[e]}hasLayer(e){return e in this._mergedLayers}hasLayerType(e){for(const t in this._layers)if(this._layers[t].type===e)return!0;return!1}setLayerZoomRange(e,t,i){this._checkLoaded();const n=this._checkLayer(e);n&&(n.minzoom===t&&n.maxzoom===i||(null!=t&&(n.minzoom=t),null!=i&&(n.maxzoom=i),this._updateLayer(n)))}getSlots(){return this._checkLoaded(),this._mergedSlots}setSlot(e,t){this._checkLoaded();const i=this._checkLayer(e);i&&i.slot!==t&&(i.slot=t,this._updateLayer(i))}setFilter(t,i,n={}){this._checkLoaded();const r=this._checkLayer(t);if(r&&!e.bv(r.filter,i))return null==i?(r.filter=void 0,void this._updateLayer(r)):void(this._validate(ke,`layers.${r.id}.filter`,i,{layerType:r.type},n)||(r.filter=e.di(i),this._updateLayer(r)))}getFilter(t){const i=this._checkLayer(t);if(i)return e.di(i.filter)}setLayoutProperty(t,i,n,r={}){this._checkLoaded();const s=this._checkLayer(t);if(s&&!e.bv(s.getLayoutProperty(i),n)){if(null!=n&&(!r||!1!==r.validate)&&Mn(s,Ae.call(ge,{key:`layers.${t}.layout.${i}`,layerType:s.type,objectKey:i,value:n,styleSpec:e.a5,style:{glyphs:!0,sprite:!0}})))return;s.setLayoutProperty(i,n),0!==s.configDependencies.size&&this._configDependentLayers.add(s.fqid),this._updateLayer(s)}}getLayoutProperty(e,t){const i=this._checkLayer(e);if(i)return i.getLayoutProperty(t)}setPaintProperty(t,i,n,r={}){this._checkLoaded();const s=this._checkLayer(t);if(!s)return;if(e.bv(s.getPaintProperty(i),n))return;if(null!=n&&(!r||!1!==r.validate)&&Mn(s,Me.call(ge,{key:`layers.${t}.paint.${i}`,layerType:s.type,objectKey:i,value:n,styleSpec:e.a5})))return;const o=s.setPaintProperty(i,n);0!==s.configDependencies.size&&this._configDependentLayers.add(s.fqid),o&&this._updateLayer(s),this._changes.updatePaintProperties(s)}getPaintProperty(e,t){const i=this._checkLayer(e);if(i)return i.getPaintProperty(t)}setFeatureState(t,i){if(this._checkLoaded(),"target"in t){if("featuresetId"in t.target){const{featuresetId:e,importId:n}=t.target,r=this.getFragmentStyle(n),s=r.getFeaturesetLayers(e);for(const{source:e,sourceLayer:n}of s)r.setFeatureState({id:t.id,source:e,sourceLayer:n},i)}else if("layerId"in t.target){const{layerId:e}=t.target,n=this.getLayer(e);this.setFeatureState({id:t.id,source:n.source,sourceLayer:n.sourceLayer},i)}return}const n=t.source,r=t.sourceLayer,s=this._checkSource(n);if(!s)return;const o=s.type;if("geojson"===o&&r)return void this.fire(new e.z(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));if("vector"===o&&!r)return void this.fire(new e.z(new Error("The sourceLayer parameter must be provided for vector source types.")));void 0===t.id&&this.fire(new e.z(new Error("The feature id parameter must be provided.")));const a=this.getOwnSourceCaches(n);for(const e of a)e.setFeatureState(r,t.id,i)}removeFeatureState(t,i){if(this._checkLoaded(),"target"in t){if("featuresetId"in t.target){const{featuresetId:e,importId:n}=t.target,r=this.getFragmentStyle(n),s=r.getFeaturesetLayers(e);for(const{source:e,sourceLayer:n}of s)r.removeFeatureState({id:t.id,source:e,sourceLayer:n},i)}else if("layerId"in t.target){const{layerId:e}=t.target,n=this.getLayer(e);this.removeFeatureState({id:t.id,source:n.source,sourceLayer:n.sourceLayer},i)}return}const n=t.source,r=this._checkSource(n);if(!r)return;const s=r.type,o="vector"===s?t.sourceLayer:void 0;if("vector"===s&&!o)return void this.fire(new e.z(new Error("The sourceLayer parameter must be provided for vector source types.")));if(i&&"string"!=typeof t.id&&"number"!=typeof t.id)return void this.fire(new e.z(new Error("A feature id is required to remove its specific state property.")));const a=this.getOwnSourceCaches(n);for(const e of a)e.removeFeatureState(o,t.id,i)}getFeatureState(t){if(this._checkLoaded(),"target"in t){let i;if("featuresetId"in t.target){const{featuresetId:n,importId:r}=t.target,s=this.getFragmentStyle(r),o=s.getFeaturesetLayers(n);for(const{source:n,sourceLayer:r}of o){const o=s.getFeatureState({id:t.id,source:n,sourceLayer:r});if(o&&!i)i=o;else if(!e.bv(i,o))return void this.fire(new e.z(new Error("The same feature id exists in multiple sources in the featureset, but their feature states are not consistent through the sources.")))}}else if("layerId"in t.target){const{layerId:e}=t.target,n=this.getLayer(e);i=this.getFeatureState({id:t.id,source:n.source,sourceLayer:n.sourceLayer})}return i}const i=t.source,n=t.sourceLayer,r=this._checkSource(i);if(r){if("vector"!==r.type||n)return void 0===t.id&&this.fire(new e.z(new Error("The feature id parameter must be provided."))),this.getOwnSourceCaches(i)[0].getFeatureState(n,t.id);this.fire(new e.z(new Error("The sourceLayer parameter must be provided for vector source types.")))}}setTransition(t){return this.stylesheet.transition=e.h({},this.stylesheet.transition,t),this.transition=this.stylesheet.transition,this}getTransition(){return e.h({},this.stylesheet.transition)}serialize(){this._checkLoaded();const t=this.getTerrain(),i=t&&this.terrain&&this.terrain.scope===this.scope?t:this.stylesheet.terrain;return e.dp({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,fragment:this.stylesheet.fragment,iconsets:this.stylesheet.iconsets,imports:this._serializeImports(),schema:this.stylesheet.schema,camera:this.stylesheet.camera,light:this.stylesheet.light,lights:this.stylesheet.lights,terrain:i,fog:this.stylesheet.fog,snow:this.stylesheet.snow,rain:this.stylesheet.rain,center:this.stylesheet.center,"color-theme":this.stylesheet["color-theme"],zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,projection:this.stylesheet.projection,sources:this._serializeSources(),layers:this._serializeLayers(this._order)},e=>void 0!==e)}_updateFilteredLayers(e){for(const t of Object.values(this._mergedLayers))e(t)&&this._updateLayer(t)}_updateLayer(t){this._changes.updateLayer(t);const i=this.getLayerSourceCache(t),n=e.C(t.source,t.scope),r=this._changes.getUpdatedSourceCaches();t.source&&!r[n]&&i&&"raster"!==i.getSource().type&&(this._changes.updateSourceCache(n,"reload"),i.pause()),t.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(e){const t=e=>this._mergedLayers[e].is3D(!!this.terrain),i=this.order,n={},r=[];for(let s=i.length-1;s>=0;s--){const o=i[s];if(t(o)){n[o]=s;for(const t of e){const e=t[o];if(e)for(const t of e)r.push(t)}}}r.sort((e,t)=>t.intersectionZ-e.intersectionZ);const s=[];for(let o=i.length-1;o>=0;o--){const a=i[o];if(t(a))for(let e=r.length-1;e>=0;e--){const t=r[e].feature;if(t.layer&&n[t.layer.id]{if(Dn.has(e.type))return;const t=this.getOwnLayerSourceCache(e),i=s[t.id]=s[t.id]||{sourceCache:t,layers:{},has3DLayers:!1};e.is3D(!!this.terrain)&&(i.has3DLayers=!0),i.layers[e.fqid]=i.layers[e.fqid]||{styleLayer:e,targets:[]},i.layers[e.fqid].targets.push({filter:r})};if(i&&i.layers){if(!Array.isArray(i.layers))return this.fire(new e.z(new Error("parameters.layers must be an Array."))),[];for(const t of i.layers){const i=this._layers[t];if(!i)return this.fire(new e.z(new Error(`The layer '${t}' does not exist in the map's style and cannot be queried for features.`))),[];o(i)}}else for(const e in this._layers)o(this._layers[e]);const a=this._queryRenderedFeatures(t,s,n),l=this._flattenAndSortRenderedFeatures(a),c=[];for(const t of l)e.dq(t.layer.id)===this.scope&&c.push(t);return c}queryRenderedFeatureset(t,i,n){let r;i&&!Array.isArray(i)&&i.filter&&(this._validate(ke,"queryRenderedFeatures.filter",i.filter,null,i),r=e.b3(i.filter));const s="mock",o=[];if(i&&i.target)o.push(Object.assign({},i,{targetId:s,filter:r}));else{const e=this.getFeaturesetDescriptors();for(const t of e)o.push({targetId:s,filter:r,target:t});for(const{style:e}of this.fragments){const t=e.getFeaturesetDescriptors();for(const e of t)o.push({targetId:s,filter:r,target:e})}}const a=this.queryRenderedTargets(t,o,n),l=[],c=new Set;for(const t of a)for(const i of t.variants[s])ot(i,t,c)||l.push(new e.dr(t,i));return l}queryRenderedTargets(t,i,n){const r={},s=(e,t,i,n)=>{const s=r[t.id]=r[t.id]||{sourceCache:t,layers:{},has3DLayers:!1};if(s.layers[e.fqid]=s.layers[e.fqid]||{styleLayer:e,targets:[]},e.is3D(!!this.terrain)&&(s.has3DLayers=!0),!n)return i.uniqueFeatureID=!1,void s.layers[e.fqid].targets.push(i);s.layers[e.fqid].targets.push(Object.assign({},i,{namespace:n.namespace,properties:n.properties,uniqueFeatureID:n.uniqueFeatureID}))};for(const t of i)if("featuresetId"in t.target){const{featuresetId:i,importId:n}=t.target,r=this.getFragmentStyle(n);if(!r||!r._featuresetSelectors)continue;const o=r._featuresetSelectors[i];if(!o){this.fire(new e.z(new Error(`The featureset '${i}' does not exist in the map's style and cannot be queried for features.`)));continue}for(const e of o){const i=r.getOwnLayer(e.layerId);i&&!Dn.has(i.type)&&s(i,r.getOwnLayerSourceCache(i),t,e)}}else if("layerId"in t.target){const{layerId:e}=t.target,i=this.getLayer(e);if(!i||Dn.has(i.type))continue;s(i,this.getLayerSourceCache(i),t)}const o=this._queryRenderedFeatures(t,r,n);return this._flattenAndSortRenderedFeatures(o)}_queryRenderedFeatures(e,t,i){const n=[],r=!!this.map._showQueryGeometry,s=Ge.createFromScreenPoints(e,i);for(const e in t){const o=at(s,t[e],this._availableImages,i,r);Object.keys(o).length&&n.push(o)}if(this.placement)for(const e in t){if(!t[e].sourceCache._onlySymbols)continue;const i=lt(s.screenGeometry,t[e],this._availableImages,this.placement.collisionIndex,this.placement.retainedQueryData,this.map.getWorldview());Object.keys(i).length&&n.push(i)}return n}querySourceFeatures(e,t){const i=t&&t.filter;i&&this._validate(ke,"querySourceFeatures.filter",i,null,t);let n=[];const r=this.getOwnSourceCaches(e);for(const e of r)n=n.concat(ct(e,t));return n}addSourceType(e,t,i){return In.getSourceType(e)?i(new Error(`A source type called "${e}" already exists.`)):(In.setSourceType(e,t),t.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:e,url:t.workerSourceURL},i):i(null,null))}getFlatLight(){return this.light.getLight()}setFlatLight(t,i,n={}){this._checkLoaded();const r=this.light.getLight();let s=!1;for(const i in t)if(!e.bv(t[i],r[i])){s=!0;break}if(!s)return;const o=this._getTransitionParameters();this.light.setLight(t,i,n),this.light.updateTransitions(o)}getTerrain(){return this.terrain&&1===this.terrain.drapeRenderMode?this.terrain.get():null}setTerrainForDraping(){this.setTerrain({source:"",exaggeration:0},0)}checkCanvasFingerprintNoise(){void 0===this.disableElevatedTerrain&&(this.disableElevatedTerrain=e.q.hasCanvasFingerprintNoise(),this.disableElevatedTerrain&&e.w("Terrain and hillshade are disabled because of Canvas2D limitations when fingerprinting protection is enabled (e.g. in private browsing mode)."))}setTerrain(t,i=1){if(this._checkLoaded(),!t)return this.terrainSetForDrapingOnly()||(delete this.terrain,this.map.transform.projection.requiresDraping&&this.setTerrainForDraping()),0===i&&delete this.terrain,null===t?this.stylesheet.terrain=null:delete this.stylesheet.terrain,this._force3DLayerUpdate(),void(this._markersNeedUpdate=!0);this.checkCanvasFingerprintNoise();let n=t;const r=null==t.source;if(1===i){if(this.disableElevatedTerrain)return;if("object"==typeof n.source){const t="terrain-dem-src";this.addSource(t,n.source),n=e.di(n),n=e.h(n,{source:t})}const t=e.h({},n),i={};if(this.terrain&&r){t.source=this.terrain.get().source;const e=this.terrain?this.getFragmentStyle(this.terrain.scope):null;e&&(i.style=e.serialize())}if(this._validate(xe,"terrain",t,i))return}if(!this.terrain||this.terrain.scope!==this.scope&&!r||this.terrain&&i!==this.terrain.drapeRenderMode){if(!n)return;this._createTerrain(n,i),this.fire(new e.A("data",{dataType:"style"}))}else{const i=this.terrain,r=i.get();for(const t of Object.keys(e.a5.terrain))!n.hasOwnProperty(t)&&e.a5.terrain[t].default&&(n[t]=e.a5.terrain[t].default);for(const n in t)if(!e.bv(t[n],r[n])){i.set(t,this.options),this.stylesheet.terrain=t;const n=this._getTransitionParameters({duration:0});i.updateTransitions(n),this.fire(new e.A("data",{dataType:"style"}));break}}this.mergeTerrain(),this.updateDrapeFirstLayers(),this._markersNeedUpdate=!0}_createFog(e){const t=this.fog=new Ye(e,this.map.transform,this.scope,this.options);this.stylesheet.fog=t.get();const i=this._getTransitionParameters({duration:0});t.updateTransitions(i)}_createSnow(e){const t=this.snow=new We(e,this.map.transform,this.scope,this.options);this.stylesheet.snow=t.get();const i=this._getTransitionParameters({duration:0});t.updateTransitions(i)}_createRain(e){const t=this.rain=new Ue(e,this.map.transform,this.scope,this.options);this.stylesheet.rain=t.get();const i=this._getTransitionParameters({duration:0});t.updateTransitions(i)}_updateMarkersOpacity(){0!==this.map._markers.length&&this.map._requestDomTask(()=>{for(const e of this.map._markers)e._evaluateOpacity()})}getFog(){return this.fog?this.fog.get():null}setFog(t){if(this._checkLoaded(),!t)return delete this.fog,delete this.stylesheet.fog,void(this._markersNeedUpdate=!0);if(this.fog){const i=this.fog;if(!e.bv(i.get(),t)){i.set(t,this.options),this.stylesheet.fog=i.get();const e=this._getTransitionParameters({duration:0});i.updateTransitions(e)}}else this._createFog(t);this._markersNeedUpdate=!0}getSnow(){return this.snow?this.snow.get():null}setSnow(t){if(this._checkLoaded(),!t)return delete this.snow,void delete this.stylesheet.snow;if(this.snow){const i=this.snow;if(!e.bv(i.get(),t)){i.set(t,this.options),this.stylesheet.snow=i.get();const e=this._getTransitionParameters({duration:0});i.updateTransitions(e)}}else this._createSnow(t);this._markersNeedUpdate=!0}getRain(){return this.rain?this.rain.get():null}setRain(t){if(this._checkLoaded(),!t)return delete this.rain,void delete this.stylesheet.rain;if(this.rain){const i=this.rain;if(!e.bv(i.get(),t)){i.set(t,this.options),this.stylesheet.rain=i.get();const e=this._getTransitionParameters({duration:0});i.updateTransitions(e)}}else this._createRain(t);this._markersNeedUpdate=!0}_reloadColorTheme(){const t=()=>{for(const e in this._layers)this._layers[e].lut=this._styleColorTheme.lut;for(const e in this._sourceCaches)this._sourceCaches[e].clearTiles()},i=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(!i)return this._styleColorTheme.lut=null,void t();const n=this._evaluateColorThemeData(i);this._loadColorTheme(n).then(()=>{this.fire(new e.A("colorthemeset")),t()}).catch(t=>{e.w(`Couldn't set color theme: ${t}`)})}setColorTheme(t){this._checkLoaded(),this._styleColorTheme.colorThemeOverride&&e.w("Note: setColorTheme is called on a style with a color-theme override, the passed color-theme won't be visible."),this._styleColorTheme.colorTheme=t,this._reloadColorTheme()}setImportColorTheme(e,t){const i=this.getFragmentStyle(e);i&&(i._styleColorTheme.colorThemeOverride=t,i._reloadColorTheme())}_getTransitionParameters(t){return{now:e.q.now(),transition:e.h(this.transition,t)}}updateDrapeFirstLayers(){if(!this.terrain)return;const e=[],t=[];for(const i of this._mergedOrder)this.isLayerDraped(this._mergedLayers[i])?e.push(i):t.push(i);this._drapedFirstOrder=[],this._drapedFirstOrder.push(...e),this._drapedFirstOrder.push(...t)}_createTerrain(e,t){const i=this.terrain=new Pe(e,t,this.scope,this.options,this.map.getWorldview());1===t&&(this.stylesheet.terrain=e),this.mergeTerrain(),this.updateDrapeFirstLayers(),this._force3DLayerUpdate();const n=this._getTransitionParameters({duration:0});i.updateTransitions(n)}_force3DLayerUpdate(){for(const e in this._layers){const t=this._layers[e];"fill-extrusion"===t.type&&this._updateLayer(t)}}_forceSymbolLayerUpdate(){for(const e in this._layers){const t=this._layers[e];"symbol"===t.type&&this._updateLayer(t)}}_validate(t,i,n,r,s={}){if(s&&!1===s.validate)return!1;const o=e.h({},this.serialize());return Mn(this,t.call(ge,e.h({key:i,style:o,value:n,styleSpec:e.a5},r)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),e.ds.off("pluginStateChange",this._rtlTextPluginCallback);for(const e in this._mergedLayers)this._mergedLayers[e].setEventedParent(null);for(const e in this._mergedSourceCaches)this._mergedSourceCaches[e].clearTiles(),this._mergedSourceCaches[e].setEventedParent(null);this.imageManager.removeScope(this.scope),this.setEventedParent(null),delete this.fog,delete this.snow,delete this.rain,delete this.terrain,delete this.ambientLight,delete this.directionalLight,this.isRootStyle()&&(this.imageManager.setEventedParent(null),this.imageManager.destroy(),this.modelManager.setEventedParent(null),this.modelManager.destroy(),this.dispatcher.remove())}clearSource(e){const t=this.getSourceCaches(e);for(const e of t)e.clearTiles()}clearSources(){for(const e in this._mergedSourceCaches)this._mergedSourceCaches[e].clearTiles()}clearLayers(){for(const e in this._mergedLayers){const t=this._mergedLayers[e];t._clear&&t._clear()}}reloadSource(e){const t=this.getSourceCaches(e);for(const e of t)e.resume(),e.reload()}reloadSources(){for(const e of this.getSources())e.reload&&e.reload()}reloadModels(){this.modelManager.reloadModels(""),this.forEachFragmentStyle(e=>{e.modelManager.reloadModels(e.scope)})}updateSources(e){let t;this.directionalLight&&(t=fn(this.directionalLight));const i=new Set;for(const e in this._mergedLayers){const t=this._mergedLayers[e];t.hasElevation()&&!i.has(t.source)&&i.add(t.source)}for(const n in this._mergedSourceCaches){const r=this._mergedSourceCaches[n],s=i.has(r._source.id);r.update(e,void 0,void 0,t,s)}}_generateCollisionBoxes(){for(const e in this._sourceCaches){const t=this._sourceCaches[e];t.resume(),t.reload()}}_updatePlacement(t,i,n,r,s,o,a=!1){let l=!1,c=!1;const h={},d={};for(const t of this._mergedOrder){const n=this._mergedLayers[t];if("symbol"!==n.type)continue;const r=e.C(n.source,n.scope);let s=h[r];if(!s){const e=this.getLayerSourceCache(n);if(!e)continue;const t=e.getRenderableIds(!0).map(t=>e.getTileByID(t));d[r]=t.slice(),s=h[r]=t.sort((e,t)=>t.tileID.overscaledZ-e.tileID.overscaledZ||(e.tileID.isLessThan(t.tileID)?-1:1))}const o=this.crossTileSymbolIndex.addLayer(n,s,i.center.lng,i.projection);l=l||o}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._mergedOrder),a=a||this._layerOrderChanged||0===r,this._layerOrderChanged&&this.fire(new e.A("neworder")),(a||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(e.q.now(),i.zoom))&&(this.pauseablePlacement=new Ei(i,this._mergedOrder,a,n,r,s,this.placement,this.fog&&i.projection.supportsFog?this.fog.state:null,this._buildingIndex),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._mergedOrder,this._mergedLayers,h,d,this.map.painter.scaleFactor),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(e.q.now()),c=!0),l&&this.pauseablePlacement.placement.setStale()),c||l){this._buildingIndex.onNewFrame(i.zoom);for(let t=0;te===t.id))return void this.fire(new e.z(new Error(`Import with id '${t.id}' already exists in the map's style.`)));if(!i)return n.push(t),this._loadImports([t],!0);const r=n.findIndex(({id:e})=>e===i);return-1===r&&this.fire(new e.z(new Error(`Import with id "${i}" does not exist on this map.`))),this.stylesheet.imports=n.slice(0,r).concat(t).concat(n.slice(r)),this._loadImports([t],!0,i)}updateImport(t,i){this._checkLoaded();const n=this.stylesheet.imports||[],r=this.getImportIndex(t);return-1===r?this:"string"==typeof i?(this.setImportUrl(t,i),this):(i.url&&i.url!==n[r].url&&this.setImportUrl(t,i.url),e.bv(i.config,n[r].config)||this.setImportConfig(t,i.config,i.data.schema),e.bv(i.data,n[r].data)||this.setImportData(t,i.data),this)}moveImport(e,t){this._checkLoaded();let i=this.stylesheet.imports||[];const n=this.getImportIndex(e);if(-1===n)return this;const r=this.getImportIndex(t);if(-1===r)return this;const s=i[n],o=this.fragments[n];return i=i.filter(({id:t})=>t!==e),this.fragments=this.fragments.filter(({id:t})=>t!==e),this.stylesheet.imports=i.slice(0,r).concat(s).concat(i.slice(r)),this.fragments=this.fragments.slice(0,r).concat(o).concat(this.fragments.slice(r)),this.mergeLayers(),this}setImportUrl(e,t){this._checkLoaded();const i=this.stylesheet.imports||[],n=this.getImportIndex(e);if(-1===n)return this;i[n].url=t;const r=this.fragments[n];return r.style=this._createFragmentStyle(i[n]),r.style.on("style.import.load",()=>this.mergeAll()),r.style.loadURL(t),this}setImportData(e,t){this._checkLoaded();const i=this.getImportIndex(e),n=this.stylesheet.imports||[];return-1===i?this:t?(this.fragments[i].style.setState(t),this._reloadImports(),this):(delete n[i].data,this.setImportUrl(e,n[i].url))}setImportConfig(e,t,i){this._checkLoaded();const n=this.getImportIndex(e),r=this.stylesheet.imports||[];if(-1===n)return this;t?r[n].config=t:delete r[n].config;const s=this.fragments[n];i&&s.style.stylesheet&&(s.style.stylesheet.schema=i);const o=s.style.stylesheet&&s.style.stylesheet.schema;return s.config=t,s.style.updateConfig(t,o),this.updateConfigDependencies(),this}removeImport(e){this._checkLoaded();const t=this.stylesheet.imports||[],i=this.getImportIndex(e);-1!==i&&(t.splice(i,1),this.fragments[i].style._remove(),this.fragments.splice(i,1),this._reloadImports())}getImportIndex(t){const i=(this.stylesheet.imports||[]).findIndex(e=>e.id===t);return-1===i&&this.fire(new e.z(new Error(`Import '${t}' does not exist in the map's style and cannot be updated.`))),i}getLayer(e){return this._mergedLayers[e]}getSources(){const e=[];for(const t in this._mergedOtherSourceCaches){const i=this._mergedOtherSourceCaches[t];i&&e.push(i.getSource())}return e}getSource(e,t){const i=this.getSourceCache(e,t);return i&&i.getSource()}getLayerSource(e){const t=this.getLayerSourceCache(e);return t&&t.getSource()}getSourceCache(t,i){const n=e.C(t,i);return this._mergedOtherSourceCaches[n]}getLayerSourceCache(t){const i=e.C(t.source,t.scope);return"symbol"===t.type?this._mergedSymbolSourceCaches[i]:this._mergedOtherSourceCaches[i]}getSourceCaches(e){if(null==e)return Object.values(this._mergedSourceCaches);const t=[];return this._mergedOtherSourceCaches[e]&&t.push(this._mergedOtherSourceCaches[e]),this._mergedSymbolSourceCaches[e]&&t.push(this._mergedSymbolSourceCaches[e]),t}updateSourceCaches(){const e=this._changes.getUpdatedSourceCaches();for(const t in e){const i=e[t];"reload"===i?this.reloadSource(t):"clear"===i&&this.clearSource(t)}}updateLayers(e){const t=this._changes.getUpdatedPaintProperties();for(const i of t){const t=this.getLayer(i);t&&t.updateTransitions(e)}}getGlyphsUrl(){return this.stylesheet.glyphs}setGlyphsUrl(e){this.stylesheet.glyphs=e,this.glyphManager.setURL(e)}getImages(t,i,n){this.imageManager.getImages(i.images,i.scope,n),this._updateTilesForChangedImages();const r=t=>{if(t){const n=i.images.map(t=>e.I.toString(t));t.setDependencies(i.tileID.key,i.type,n)}},s=e.C(i.source,i.scope);r(this._mergedOtherSourceCaches[s]),r(this._mergedSymbolSourceCaches[s]),i.images.some(e=>e.iconsetId)&&this.fire(new e.A("data",{dataType:"style"}))}rasterizeImages(e,t,i){this.imageManager.rasterizeImages(t,i)}getGlyphs(e,t,i){this.glyphManager.getGlyphs(t.stacks,i)}getResource(t,i,n){return e.dt(i,n)}getOwnSourceCache(e){return this._otherSourceCaches[e]}getOwnLayerSourceCache(e){return"symbol"===e.type?this._symbolSourceCaches[e.source]:this._otherSourceCaches[e.source]}getOwnSourceCaches(e){const t=[];return this._otherSourceCaches[e]&&t.push(this._otherSourceCaches[e]),this._symbolSourceCaches[e]&&t.push(this._symbolSourceCaches[e]),t}_isSourceCacheLoaded(t){const i=this.getOwnSourceCaches(t);return 0===i.length?(this.fire(new e.z(new Error(`There is no source with ID '${t}'`))),!1):i.every(e=>e.loaded())}has3DLayers(){return this._has3DLayers}hasSymbolLayers(){return this._hasSymbolLayers}hasCircleLayers(){return this._hasCircleLayers}isLayerClipped(e,t){if(!this._clipLayerPresent&&"fill-extrusion"!==e.type&&"building"!==e.type)return!1;const i="fill-extrusion"===e.type&&("building"===e.sourceLayer||"procedural_buildings"===e.sourceLayer),n="building"===e.type;if(e.is3D(!!this.terrain)){if(i||n||t&&"batched-model"===t.type)return!0;if("model"===e.type)return!0}else if("symbol"===e.type)return!0;return!1}_clearWorkerCaches(){this.dispatcher.broadcast("clearCaches")}destroy(){this._clearWorkerCaches(),this.fragments.forEach(e=>{e.style._remove()}),this.terrainSetForDrapingOnly()&&(delete this.terrain,delete this.stylesheet.terrain)}}In.getSourceType=function(e){return nt[e]},In.setSourceType=function(e,t){nt[e]=t},In.registerForPluginStateChange=e.du;var Pn="\n#define EPSILON 0.0000001\n#define PI 3.141592653589793\n#ifdef RENDER_CUTOFF\nfloat cutoff_opacity(vec4 cutoff_params,float depth) {float near=cutoff_params.x;float far=cutoff_params.y;float cutoffStart=cutoff_params.z;float cutoffEnd=cutoff_params.w;float linearDepth=(depth-near)/(far-near);return clamp((linearDepth-cutoffStart)/(cutoffEnd-cutoffStart),0.0,1.0);}\n#endif",Rn="\nout vec4 glFragColor;highp float unpack_depth(highp vec4 rgba_depth)\n{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}highp vec4 pack_depth(highp float ndc_z) {highp float depth=ndc_z*0.5+0.5;const highp vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);const highp vec4 bit_mask =vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);highp vec4 res=fract(depth*bit_shift);res-=res.xxyz*bit_mask;return res;}\n#ifdef INDICATOR_CUTOUT\nuniform vec3 u_indicator_cutout_centers;uniform vec4 u_indicator_cutout_params;\n#endif\nvec4 applyCutout(vec4 color,float height) {\n#ifdef INDICATOR_CUTOUT\nfloat verticalFadeRange=u_indicator_cutout_centers.z*0.25;float holeMinOpacity=mix(1.0,u_indicator_cutout_params.x,smoothstep(u_indicator_cutout_centers.z,u_indicator_cutout_centers.z+verticalFadeRange,height));float holeRadius=max(u_indicator_cutout_params.y,0.0);float holeAspectRatio=u_indicator_cutout_params.z;float fadeStart=u_indicator_cutout_params.w;float distA=distance(vec2(gl_FragCoord.x,gl_FragCoord.y*holeAspectRatio),vec2(u_indicator_cutout_centers[0],u_indicator_cutout_centers[1]*holeAspectRatio));return color*min(smoothstep(fadeStart,holeRadius,distA)+holeMinOpacity,1.0);\n#else\nreturn color;\n#endif\n}\n#ifdef DEBUG_WIREFRAME\n#define HANDLE_WIREFRAME_DEBUG \\\nglFragColor=vec4(0.7,0.0,0.0,0.7); \\\ngl_FragDepth=gl_FragCoord.z-0.0001;\n#else\n#define HANDLE_WIREFRAME_DEBUG\n#endif\n#ifdef RENDER_CUTOFF\nuniform highp vec4 u_cutoff_params;in float v_cutoff_opacity;\n#endif\nvec4 textureLodCustom(sampler2D image,highp vec2 pos,highp vec2 lod_coord) {highp vec2 size=vec2(textureSize(image,0));highp vec2 dx=dFdx(lod_coord.xy*size);highp vec2 dy=dFdy(lod_coord.xy*size);highp float delta_max_sqr=max(dot(dx,dx),dot(dy,dy));highp float lod=0.5*log2(delta_max_sqr);return textureLod(image,pos,lod);}vec4 applyLUT(highp sampler3D lut,vec4 col) {vec3 size=vec3(textureSize(lut,0));vec3 uvw=(col.rbg*float(size-1.0)+0.5)/size;return vec4(texture(lut,uvw).rgb,col.a);}vec3 applyLUT(highp sampler3D lut,vec3 col) {return applyLUT(lut,vec4(col,1.0)).rgb;}",On="\n#define EXTENT 8192.0\n#define RAD_TO_DEG 180.0/PI\n#define DEG_TO_RAD PI/180.0\n#define GLOBE_RADIUS EXTENT/PI/2.0\nfloat wrap(float n,float min,float max) {float d=max-min;float w=mod(mod(n-min,d)+d,d)+min;return (w==min) ? max : w;}\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 mercator_tile_position(mat4 matrix,vec2 tile_anchor,vec3 tile_id,vec2 mercator_center) {\n#ifndef PROJECTED_POS_ON_VIEWPORT\nfloat tiles=tile_id.z;vec2 mercator=(tile_anchor/EXTENT+tile_id.xy)/tiles;mercator-=mercator_center;mercator.x=wrap(mercator.x,-0.5,0.5);vec4 mercator_tile=vec4(mercator.xy*EXTENT,EXTENT/(2.0*PI),1.0);mercator_tile=matrix*mercator_tile;return mercator_tile.xyz;\n#else\nreturn vec3(0.0);\n#endif\n}vec3 mix_globe_mercator(vec3 globe,vec3 mercator,float t) {return mix(globe,mercator,t);}mat3 globe_mercator_surface_vectors(vec3 pos_normal,vec3 up_dir,float zoom_transition) {vec3 normal=zoom_transition==0.0 ? pos_normal : normalize(mix(pos_normal,up_dir,zoom_transition));vec3 xAxis=normalize(vec3(normal.z,0.0,-normal.x));vec3 yAxis=normalize(cross(normal,xAxis));return mat3(xAxis,yAxis,normal);}\n#endif\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(\nunpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const vec2 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 (units_to_pixels*pos+offset)/pattern_size;}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) {return get_pattern_pos(pixel_coord_upper,pixel_coord_lower,pattern_size,vec2(tile_units_to_pixels),pos);}float mercatorXfromLng(float lng) {return (180.0+lng)/360.0;}float mercatorYfromLat(float lat) {return (180.0-(RAD_TO_DEG*log(tan(PI/4.0+lat/2.0*DEG_TO_RAD))))/360.0;}vec3 latLngToECEF(vec2 latLng) {latLng=DEG_TO_RAD*latLng;float cosLat=cos(latLng[0]);float sinLat=sin(latLng[0]);float cosLng=cos(latLng[1]);float sinLng=sin(latLng[1]);float sx=cosLat*sinLng*GLOBE_RADIUS;float sy=-sinLat*GLOBE_RADIUS;float sz=cosLat*cosLng*GLOBE_RADIUS;return vec3(sx,sy,sz);}\n#ifdef RENDER_CUTOFF\nuniform vec4 u_cutoff_params;out float v_cutoff_opacity;\n#endif\nconst vec4 AWAY=vec4(-1000.0,-1000.0,-1000.0,1);const float skirtOffset=24575.0;vec3 decomposeToPosAndSkirt(vec2 posWithComposedSkirt)\n{float skirt=float(posWithComposedSkirt.x >=skirtOffset);vec2 pos=posWithComposedSkirt-vec2(skirt*skirtOffset,0.0);return vec3(pos,skirt);}",zn="in highp vec3 a_pos_3f;uniform lowp mat4 u_matrix;out 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;}",Fn="\n#define ELEVATION_SCALE 7.0\n#define ELEVATION_OFFSET 450.0\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_tl_up;uniform vec3 u_tile_tr_up;uniform vec3 u_tile_br_up;uniform vec3 u_tile_bl_up;uniform float u_tile_up_scale;vec3 elevationVector(vec2 pos) {vec2 uv=pos/EXTENT;vec3 up=normalize(mix(\nmix(u_tile_tl_up,u_tile_tr_up,uv.xxx),mix(u_tile_bl_up,u_tile_br_up,uv.xxx),uv.yyy));return up*u_tile_up_scale;}\n#else\nvec3 elevationVector(vec2 pos) { return vec3(0,0,1); }\n#endif\n#ifdef TERRAIN\nuniform highp sampler2D u_dem;uniform highp sampler2D u_dem_prev;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;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 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*texture(u_dem,pos).r;\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=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(dd,0)).r;float bl=texture(u_dem,pos+vec2(0,dd)).r;float br=texture(u_dem,pos+vec2(dd,dd)).r;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*texture(u_dem_prev,pos).r;\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=texture(u_dem_prev,pos).r;float tr=texture(u_dem_prev,pos+vec2(dd,0)).r;float bl=texture(u_dem_prev,pos+vec2(0,dd)).r;float br=texture(u_dem_prev,pos+vec2(dd,dd)).r;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) {\n#ifdef ZERO_EXAGGERATION\nreturn 0.0;\n#endif\nfloat nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);}\n#else\nfloat elevation(vec2 apos) {\n#ifdef ZERO_EXAGGERATION\nreturn 0.0;\n#endif\nreturn currentElevation(apos);}\n#endif\nvec4 fourSample(vec2 pos,vec2 off) {float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(off.x,0.0)).r;float bl=texture(u_dem,pos+vec2(0.0,off.y)).r;float br=texture(u_dem,pos+off).r;return 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;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; }\n#endif\n#ifdef DEPTH_OCCLUSION\nuniform highp sampler2D u_depth;uniform highp vec2 u_depth_size_inv;uniform highp vec2 u_depth_range_unpack;uniform highp float u_occluder_half_size;uniform highp float u_occlusion_depth_offset;\n#ifdef DEPTH_D24\nfloat unpack_depth(float depth) {return depth*u_depth_range_unpack.x+u_depth_range_unpack.y;}vec4 unpack_depth4(vec4 depth) {return depth*u_depth_range_unpack.x+vec4(u_depth_range_unpack.y);}\n#else\nhighp float unpack_depth_rgba(vec4 rgba_depth)\n{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}\n#endif\nbool isOccluded(vec4 frag) {vec3 coord=frag.xyz/frag.w;\n#ifdef DEPTH_D24\nfloat depth=unpack_depth(texture(u_depth,(coord.xy+1.0)*0.5).r);\n#else\nfloat depth=unpack_depth_rgba(texture(u_depth,(coord.xy+1.0)*0.5));\n#endif\nreturn coord.z+u_occlusion_depth_offset > depth;}highp vec4 getCornerDepths(vec2 coord) {highp vec3 df=vec3(u_occluder_half_size*u_depth_size_inv,0.0);highp vec2 uv=0.5*coord.xy+0.5;\n#ifdef DEPTH_D24\nhighp vec4 depth=vec4(\ntexture(u_depth,uv-df.xz).r,texture(u_depth,uv+df.xz).r,texture(u_depth,uv-df.zy).r,texture(u_depth,uv+df.zy).r\n);depth=unpack_depth4(depth);\n#else\nhighp vec4 depth=vec4(\nunpack_depth_rgba(texture(u_depth,uv-df.xz)),unpack_depth_rgba(texture(u_depth,uv+df.xz)),unpack_depth_rgba(texture(u_depth,uv-df.zy)),unpack_depth_rgba(texture(u_depth,uv+df.zy))\n);\n#endif\nreturn depth;}highp float occlusionFadeMultiSample(vec4 frag) {highp vec3 coord=frag.xyz/frag.w;highp vec2 uv=0.5*coord.xy+0.5;int NX=3;int NY=4;highp vec2 df=u_occluder_half_size*u_depth_size_inv;highp vec2 oneStep=2.0*u_occluder_half_size*u_depth_size_inv/vec2(NX-1,NY-1);highp float res=0.0;for (int y=0; y < NY;++y) {for (int x=0; x < NX;++x) {\n#ifdef DEPTH_D24\nhighp float depth=unpack_depth(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y)).r);\n#else\nhighp float depth=unpack_depth_rgba(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y)));\n#endif\nres+=1.0-clamp(300.0*(coord.z+u_occlusion_depth_offset-depth),0.0,1.0);}}res=clamp(2.0*res/float(NX*NY)-0.5,0.0,1.0);return res;}highp float occlusionFade(vec4 frag) {highp vec3 coord=frag.xyz/frag.w;highp vec4 depth=getCornerDepths(coord.xy);return dot(vec4(0.25),vec4(1.0)-clamp(300.0*(vec4(coord.z+u_occlusion_depth_offset)-depth),0.0,1.0));}\n#else\nbool isOccluded(vec4 frag) { return false; }highp float occlusionFade(vec4 frag) { return 1.0; }highp float occlusionFadeMultiSample(vec4 frag) { return 1.0; }\n#endif//DEPTH_OCCLUSION",Nn="#ifdef FOG\nuniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump mat4 u_fog_matrix;out vec3 v_fog_pos;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}vec3 fog_position(vec3 pos) {return (u_fog_matrix*vec4(pos,1.0)).xyz;}vec3 fog_position(vec2 pos) {return fog_position(vec3(pos,0.0));}float fog(vec3 pos) {float depth=length(pos);float opacity=fog_opacity(fog_range(depth));return opacity*fog_horizon_blending(pos/depth);}\n#endif",Yn="#ifdef FOG\nuniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump vec2 u_fog_vertical_limit;uniform mediump float u_fog_temporal_offset;in vec3 v_fog_pos;uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform highp vec2 u_viewport;uniform float u_globe_transition;uniform int u_is_globe;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}float globe_glow_progress() {highp vec2 uv=gl_FragCoord.xy/u_viewport;\n#ifdef FLIP_Y\nuv.y=1.0-uv.y;\n#endif\nhighp vec3 ray_dir=mix(\nmix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float sdf=length(closest_point-u_globe_pos)/u_globe_radius;return sdf+PI*0.5;}float fog_opacity(vec3 pos) {float depth=length(pos);return fog_opacity(fog_range(depth));}vec3 fog_apply(vec3 color,vec3 pos,float opacity_limit) {float depth=length(pos);float opacity;if (u_is_globe==1) {float glow_progress=globe_glow_progress();float t=mix(glow_progress,depth,u_globe_transition);opacity=fog_opacity(fog_range(t));} else {opacity=fog_opacity(fog_range(depth));opacity*=fog_horizon_blending(pos/depth);}return mix(color,u_fog_color.rgb,min(opacity,opacity_limit));}vec3 fog_apply(vec3 color,vec3 pos) {return fog_apply(color,pos,1.0);}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;}vec4 fog_apply_premultiplied(vec4 color,vec3 pos,float heightMeters) {float verticalProgress=(u_fog_vertical_limit.x > 0.0 || u_fog_vertical_limit.y > 0.0) ? smoothstep(u_fog_vertical_limit.x,u_fog_vertical_limit.y,heightMeters) : 0.0;float opacityLimit=1.0-smoothstep(0.9,1.0,fog_opacity(pos));return mix(fog_apply_premultiplied(color,pos),color,min(verticalProgress,opacityLimit));}vec3 fog_dither(vec3 color) {return color;}vec4 fog_dither(vec4 color) {return vec4(fog_dither(color.rgb),color.a);}\n#endif",Bn="#ifdef RASTER_ARRAY\nuniform highp sampler2D u_image0;uniform sampler2D u_image1;const vec4 NODATA=vec4(1);ivec4 _raTexLinearCoord(highp vec2 texCoord,highp vec2 texResolution,out highp vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return ivec4(texCoord.xxyy+vec2(1.5,0.5).xyxy);}vec2 _raTexLinearMix(highp vec2 fxy,highp vec4 colorMix,highp float colorOffset,highp vec4 t00,highp vec4 t10,highp vec4 t01,highp vec4 t11) {vec2 c00=t00==NODATA ? vec2(0) : vec2(colorOffset+dot(t00,colorMix),1);vec2 c10=t10==NODATA ? vec2(0) : vec2(colorOffset+dot(t10,colorMix),1);vec2 c01=t01==NODATA ? vec2(0) : vec2(colorOffset+dot(t01,colorMix),1);vec2 c11=t11==NODATA ? vec2(0) : vec2(colorOffset+dot(t11,colorMix),1);return mix(mix(c01,c11,fxy.x),mix(c00,c10,fxy.x),fxy.y);}vec2 raTexture2D_image0_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image0,c.yz,0),texelFetch(u_image0,c.xz,0),texelFetch(u_image0,c.yw,0),texelFetch(u_image0,c.xw,0)\n);}vec2 raTexture2D_image1_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image1,c.yz,0),texelFetch(u_image1,c.xz,0),texelFetch(u_image1,c.yw,0),texelFetch(u_image1,c.xw,0)\n);}vec2 raTexture2D_image0_nearest(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec4 t=texelFetch(u_image0,ivec2(texCoord*texResolution),0);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);}vec2 raTexture2D_image1_nearest(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec4 t=texelFetch(u_image1,ivec2(texCoord*texResolution),0);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);}\n#endif",Hn="#ifdef RASTER_ARRAY\nuniform sampler2D u_velocity;uniform mediump vec2 u_velocity_res;uniform mediump float u_max_speed;const vec4 NO_DATA=vec4(1);const vec2 INVALID_VELOCITY=vec2(-1);uniform highp vec2 u_uv_offset;uniform highp float u_data_offset;uniform highp vec2 u_data_scale;ivec4 rasterArrayLinearCoord(highp vec2 texCoord,highp vec2 texResolution,out highp vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return ivec4(texCoord.xxyy+vec2(1.5,0.5).xyxy);}highp vec2 lookup_velocity(highp vec2 uv) {uv=u_uv_offset.x+u_uv_offset.y*uv;highp vec2 fxy;ivec4 c=rasterArrayLinearCoord(uv,u_velocity_res,fxy);highp vec4 tl=texelFetch(u_velocity,c.yz,0);highp vec4 tr=texelFetch(u_velocity,c.xz,0);highp vec4 bl=texelFetch(u_velocity,c.yw,0);highp vec4 br=texelFetch(u_velocity,c.xw,0);if (tl==NO_DATA) {return INVALID_VELOCITY;}if (tr==NO_DATA) {return INVALID_VELOCITY;}if (bl==NO_DATA) {return INVALID_VELOCITY;}if (br==NO_DATA) {return INVALID_VELOCITY;}highp vec4 t=mix(mix(bl,br,fxy.x),mix(tl,tr,fxy.x),fxy.y);highp vec2 velocity=u_data_offset+vec2(dot(t.rg,u_data_scale),dot(t.ba,u_data_scale));velocity.y=-velocity.y;velocity/=max(u_max_speed,length(velocity));return velocity;}\n#endif\nuniform highp float u_particle_pos_scale;uniform highp vec2 u_particle_pos_offset;highp vec4 pack_pos_to_rgba(highp vec2 p) {highp vec2 v=(p+u_particle_pos_offset)/u_particle_pos_scale;highp vec4 r=vec4(v.x,fract(v.x*255.0),v.y,fract(v.y*255.0));return vec4(r.x-r.y/255.0,r.y,r.z-r.w/255.0,r.w);}highp vec2 unpack_pos_from_rgba(highp vec4 v) {v=floor(v*255.0+0.5)/255.0;highp vec2 p=vec2(v.x+(v.y/255.0),v.z+(v.w/255.0));return u_particle_pos_scale*p-u_particle_pos_offset;}",jn="#ifdef RENDER_SHADOWS\nuniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_normal_offset;vec3 shadow_normal_offset(vec3 normal) {float tileInMeters=u_shadow_normal_offset[0];vec3 n=vec3(-normal.xy,tileInMeters*normal.z);float dotScale=min(1.0-dot(normal,u_shadow_direction),1.0)*0.5+0.5;return n*dotScale;}vec3 shadow_normal_offset_model(vec3 normal) {vec3 transformed_normal=vec3(-normal.xy,normal.z);float NDotL=dot(normalize(transformed_normal),u_shadow_direction);float dotScale=min(1.0-NDotL,1.0)*0.5+0.5;return normal*dotScale;}float shadow_normal_offset_multiplier0() {return u_shadow_normal_offset[1];}float shadow_normal_offset_multiplier1() {return u_shadow_normal_offset[2];}\n#endif//RENDER_SHADOWS",Vn="#ifdef RENDER_SHADOWS\nprecision highp sampler2DShadow;uniform sampler2DShadow u_shadowmap_0;uniform sampler2DShadow u_shadowmap_1;uniform float u_shadow_intensity;uniform float u_shadow_map_resolution;uniform float u_shadow_texel_size;uniform highp vec3 u_shadow_normal_offset;uniform vec2 u_fade_range;uniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_bias;float shadow_sample(sampler2DShadow shadowmap,highp vec3 pos,highp float bias) {\n#ifdef CLIP_ZERO_TO_ONE\nhighp vec3 coord=vec3(pos.xy*0.5+0.5,pos.z-bias);\n#else\nhighp vec3 coord=vec3(pos.xy*0.5+0.5,pos.z*0.5+0.5-bias);\n#endif\nreturn texture(shadowmap,coord);}float shadow_occlusion(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth,highp float bias) {light_view_pos0.xyz/=light_view_pos0.w;\n#ifdef SHADOWS_SINGLE_CASCADE\nvec2 abs_bounds=abs(light_view_pos0.xy);if (abs_bounds.x >=1.0 || abs_bounds.y >=1.0) {return 0.0;}return shadow_sample(u_shadowmap_0,light_view_pos0.xyz,bias);\n#else\nlight_view_pos1.xyz/=light_view_pos1.w;vec4 abs_bounds=abs(vec4(light_view_pos0.xy,light_view_pos1.xy));if (abs_bounds.x < 1.0 && abs_bounds.y < 1.0) {return shadow_sample(u_shadowmap_0,light_view_pos0.xyz,bias);}if (abs_bounds.z >=1.0 || abs_bounds.w >=1.0) {return 0.0;}float occlusion1=shadow_sample(u_shadowmap_1,light_view_pos1.xyz,bias);return clamp(mix(occlusion1,0.0,smoothstep(u_fade_range.x,u_fade_range.y,view_depth)),0.0,1.0);\n#endif\n}highp float calculate_shadow_bias(float NDotL) {\n#ifdef NORMAL_OFFSET\nreturn 0.5*u_shadow_bias.x;\n#else\nreturn 0.5*(u_shadow_bias.x+clamp(u_shadow_bias.y*tan(acos(NDotL)),0.0,u_shadow_bias.z));\n#endif\n}float shadowed_light_factor_normal(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=calculate_shadow_bias(NDotL);float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor_normal_opacity(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth,float shadow_opacity) {float NDotL=dot(N,u_shadow_direction);float bias=calculate_shadow_bias(NDotL);float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias)*shadow_opacity;return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor_normal_unbiased(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}highp vec2 compute_receiver_plane_depth_bias(highp vec3 pos_dx,highp vec3 pos_dy)\n{highp vec2 biasUV=vec2(\npos_dy.y*pos_dx.z-pos_dx.y*pos_dy.z,pos_dx.x*pos_dy.z-pos_dy.x*pos_dx.z);biasUV*=1.0/((pos_dx.x*pos_dy.y)-(pos_dx.y*pos_dy.x));return biasUV;}float shadowed_light_factor_plane_bias(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {highp vec3 light_view_pos0_xyz=light_view_pos0.xyz/light_view_pos0.w*0.5+0.5;highp vec3 light_view_pos0_ddx=dFdx(light_view_pos0_xyz);highp vec3 light_view_pos0_ddy=dFdy(light_view_pos0_xyz);highp vec2 plane_depth_bias=compute_receiver_plane_depth_bias(light_view_pos0_ddx,light_view_pos0_ddy);highp float bias=dot(vec2(u_shadow_texel_size,u_shadow_texel_size),plane_depth_bias)+0.0001;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return 1.0-(u_shadow_intensity*occlusion);}float shadowed_light_factor(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return 1.0-(u_shadow_intensity*occlusion);}float shadow_occlusion(float ndotl,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=calculate_shadow_bias(ndotl);return shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);}\n#endif";const Wn=[];Zn(Pn,Wn),Zn(On,Wn),Zn(Rn,Wn);const Un={"_prelude_fog.vertex.glsl":Nn,"_prelude_terrain.vertex.glsl":Fn,"_prelude_shadow.vertex.glsl":jn,"_prelude_fog.fragment.glsl":Yn,"_prelude_shadow.fragment.glsl":Vn,"_prelude_lighting.glsl":"\n#ifdef LIGHTING_3D_MODE\nuniform mediump vec3 u_lighting_ambient_color;uniform mediump vec3 u_lighting_directional_dir;uniform mediump vec3 u_lighting_directional_color;uniform mediump vec3 u_ground_radiance;float calculate_ambient_directional_factor(vec3 normal) {float NdotL=dot(normal,u_lighting_directional_dir);const float factor_reduction_max=0.3;float dir_luminance=dot(u_lighting_directional_color,vec3(0.2126,0.7152,0.0722));float directional_factor_min=1.0-factor_reduction_max*min(dir_luminance,1.0);float ambient_directional_factor=mix(directional_factor_min,1.0,min((NdotL+1.0),1.0));const float vertical_factor_min=0.92;float vertical_factor=mix(vertical_factor_min,1.0,normal.z*0.5+0.5);return vertical_factor*ambient_directional_factor;}vec3 linearProduct(vec3 srgbIn,vec3 k) {return srgbIn*pow(k,vec3(1./2.2));}vec3 apply_lighting(vec3 color,vec3 normal,float dir_factor) {float ambient_directional_factor=calculate_ambient_directional_factor(normal);vec3 ambient_contrib=ambient_directional_factor*u_lighting_ambient_color;vec3 directional_contrib=u_lighting_directional_color*dir_factor;return linearProduct(color,ambient_contrib+directional_contrib);}vec4 apply_lighting(vec4 color,vec3 normal,float dir_factor) {return vec4(apply_lighting(color.rgb,normal,dir_factor),color.a);}vec3 apply_lighting(vec3 color,vec3 normal) {float dir_factor=max(dot(normal,u_lighting_directional_dir),0.0);return apply_lighting(color.rgb,normal,dir_factor);}vec4 apply_lighting(vec4 color,vec3 normal) {float dir_factor=max(dot(normal,u_lighting_directional_dir),0.0);return vec4(apply_lighting(color.rgb,normal,dir_factor),color.a);}vec3 apply_lighting_ground(vec3 color) {return color*u_ground_radiance;}vec4 apply_lighting_ground(vec4 color) {return vec4(apply_lighting_ground(color.rgb),color.a);}float calculate_NdotL(vec3 normal) {const float ext=0.70710678118;return (clamp(dot(normal,u_lighting_directional_dir),-ext,1.0)+ext)/(1.0+ext);}vec4 apply_lighting_with_emission_ground(vec4 color,float emissive_strength) {return mix(apply_lighting_ground(color),color,emissive_strength);}vec3 compute_flood_lighting(vec3 flood_light_color,float fully_occluded_factor,float occlusion,vec3 ground_shadow_factor) {vec3 fully_occluded_color=flood_light_color*mix(ground_shadow_factor,vec3(1.0),fully_occluded_factor);float occlusion_ramp=smoothstep(0.0,0.2,1.0-occlusion);return mix(fully_occluded_color,flood_light_color,occlusion_ramp);}vec3 compute_emissive_draped(vec3 unlit_color,float fully_occluded_factor,float occlusion,vec3 ground_shadow_factor) {vec3 fully_occluded_color=unlit_color*mix(ground_shadow_factor,vec3(1.0),fully_occluded_factor);return mix(fully_occluded_color,unlit_color,1.0-occlusion);}\n#endif//LIGHTING_3D_MODE","_prelude_raster_array.glsl":Bn,"_prelude_raster_particle.glsl":Hn},$n={};Jn("",Fn),Jn(Yn,Nn),Jn(Vn,jn),Jn(Bn,""),Jn(Hn,"");const Gn=Jn(Rn,On),Xn=Pn;var qn={background:Jn('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform vec4 u_color;uniform float u_opacity;\n#ifdef LIGHTING_3D_MODE\nin vec4 v_color;\n#endif\nvoid main() {vec4 out_color;\n#ifdef LIGHTING_3D_MODE\nout_color=v_color;\n#else\nout_color=u_color;\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_lighting.glsl"\nin vec2 a_pos;uniform mat4 u_matrix;\n#ifdef LIGHTING_3D_MODE\nuniform mediump vec4 u_color;out vec4 v_color;uniform float u_emissive_strength;\n#endif\nvoid main() {gl_Position=u_matrix*vec4(a_pos,0,1);\n#ifdef LIGHTING_3D_MODE\nv_color=apply_lighting_with_emission_ground(u_color,u_emissive_strength);\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),backgroundPattern:Jn('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform vec2 u_pattern_tl;uniform vec2 u_pattern_br;uniform vec2 u_texsize;uniform float u_opacity;uniform float u_emissive_strength;uniform sampler2D u_image;in highp vec2 v_pos;void main() {highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(u_pattern_tl/u_texsize,u_pattern_br/u_texsize,imagecoord);vec4 out_color=textureLodCustom(u_image,pos,v_pos);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform vec2 u_pattern_size;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec2 u_pattern_units_to_pixels;in vec2 a_pos;out highp vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_pattern_size,u_pattern_units_to_pixels,a_pos);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),building:Jn('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_lighting.glsl"\nconst float window_depth=0.5;const float ao_radius=0.2;in vec4 v_color;in highp vec3 v_normal;in highp vec3 v_pos;\n#ifdef BUILDING_FAUX_FACADE\nin lowp float v_faux_facade;in highp float v_faux_facade_ed;in highp vec2 v_faux_facade_window;in highp vec2 v_faux_facade_floor;in highp vec2 v_faux_facade_range;in highp float v_aspect;in highp vec3 v_tbn_0;in highp vec3 v_tbn_1;in highp vec3 v_tbn_2;in highp vec4 v_faux_color_emissive;uniform float u_faux_facade_ao_intensity;\n#endif\n#ifdef RENDER_SHADOWS\nin highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth_shadows;\n#endif\nuniform lowp float u_opacity;uniform vec3 u_camera_pos;uniform highp float u_tile_to_meter;uniform float u_facade_emissive_chance;vec3 linearTosRGB(in vec3 color) {return pow(color,vec3(1./2.2));}\n#ifdef BUILDING_FAUX_FACADE\nfloat hash12(in vec2 p) {vec3 p3 =fract(vec3(p.xyx)*0.1031);p3+=dot(p3,p3.yzx+33.33);return fract((p3.x+p3.y)*p3.z);}float min3(in vec3 v) {return min(min(v.x,v.y),v.z);}vec2 get_uv_mask_id(in vec2 q,out float mask,out vec2 id) {vec2 p=q;mask=step(v_faux_facade_range.x,p.y)*step(p.y,v_faux_facade_range.y);p.y=p.y-v_faux_facade_range.x;vec2 uv=modf(p/v_faux_facade_floor,id);vec4 d=(v_faux_facade_floor.xyxy+vec4(-v_faux_facade_window,v_faux_facade_window))*0.5;vec4 edge=d/v_faux_facade_floor.xyxy;vec2 m=step(edge.xy,uv)*step(uv,edge.zw);mask*=m.x*m.y;uv-=vec2(0.5);uv*=vec2(0.5)/(vec2(0.5)-edge.xy);uv+=vec2(0.5);return uv;}float ray_unit_box(in vec3 ray_o,in vec3 ray_d,in vec3 bmin,in vec3 bmax) {vec3 planes=mix(bmin,bmax,step(0.0,ray_d));vec3 t=(planes-ray_o)/ray_d;return min3(t);}float get_emissive(in vec2 id) {if (u_facade_emissive_chance > 0.0) {return (step(hash12(id),u_facade_emissive_chance)+0.05)*v_faux_color_emissive.a;}return 0.0;}vec3 get_shade_info(in vec3 v,in vec3 v_normalized,in vec3 color,in vec2 id,in mat3 tbn,inout vec3 out_normal,inout float out_emissive) {vec3 out_color=color;vec3 abs_v=abs(v_normalized);bool x_major=abs_v.x >=abs_v.y && abs_v.x >=abs_v.z;bool y_major=abs_v.y >=abs_v.x && abs_v.y >=abs_v.z;bool z_major=abs_v.z >=abs_v.x && abs_v.z >=abs_v.y;\n#if 0\nif (x_major) {out_color=v.x > 0.0 ? vec3(1.0,0.0,0.0) : vec3(0.0,1.0,1.0);} else if (y_major) {out_color=v.y > 0.0 ? vec3(0.0,1.0,0.0) : vec3(1.0,0.0,1.0);} else if (z_major) {out_color=v.z > 0.0 ? vec3(0.0,0.0,1.0) : vec3(1.0,1.0,0.0);}out_emissive=1.0;\n#else\nif (x_major) {out_normal=sign(v.x)*tbn[0];} else if (y_major) {out_normal=vec3(0.0,0.0,-sign(v.y));} else if (z_major) {out_color=v_faux_color_emissive.rgb;out_emissive=v.z <=0.0 ? get_emissive(id) : out_emissive;}float ao=1.0;if (u_faux_facade_ao_intensity > 0.0) {vec4 ao_range=v_faux_facade_window.xxyy*0.5-vec4(0,ao_radius,0,ao_radius);vec2 ao_range_z=vec2(window_depth*0.5)-vec2(0.0,ao_radius);if (x_major || y_major) {ao*=smoothstep(-ao_range_z.x,-ao_range_z.y,v.z);} else if (z_major) {ao*=smoothstep(-ao_range.x,-ao_range.y,v.x)*(1.0-smoothstep(ao_range.y,ao_range.x,v.x));ao*=smoothstep(-ao_range.z,-ao_range.w,v.y)*(1.0-smoothstep(ao_range.w,ao_range.z,v.y));}ao=mix(1.0,min(1.0,ao+0.25),u_faux_facade_ao_intensity);}out_color*=ao;\n#endif\nreturn out_color;}\n#endif\nvec3 apply_lighting_linear(in vec3 color,in vec3 normal,in float dir_factor) {float ambient_directional_factor=calculate_ambient_directional_factor(normal);vec3 ambient_contrib=ambient_directional_factor*u_lighting_ambient_color;vec3 directional_contrib=u_lighting_directional_color*dir_factor;return color*(ambient_contrib+directional_contrib);}void main() {vec3 normal=normalize(v_normal);vec3 base_color=v_color.rgb;float emissive=v_color.a;\n#ifdef BUILDING_FAUX_FACADE\nif (v_faux_facade > 0.0) {mat3 tbn=mat3(v_tbn_0,v_tbn_1,v_tbn_2);vec3 v=vec3(v_pos.xy,v_pos.z/u_tile_to_meter)-u_camera_pos;vec3 view_tangent=transpose(tbn)*v;vec2 q=vec2(v_faux_facade_ed,v_pos.z);float mask=0.0;vec2 id=vec2(0.0);vec2 uv=get_uv_mask_id(q,mask,id);uv*=v_faux_facade_window;vec3 bmin=vec3(0.0,0.0,-window_depth);vec3 bmax=bmin+vec3(v_faux_facade_window,window_depth);vec3 ray_o=vec3(uv,0.0);vec3 ray_d=normalize(view_tangent);float t_min=ray_unit_box(ray_o,ray_d,bmin,bmax);vec3 hit=ray_o+t_min*ray_d;vec3 r=vec3(v_faux_facade_window,-window_depth);hit-=r*0.5;vec3 normalized=hit/r;vec3 out_normal=normal;float out_emissive=emissive;vec3 room_color=get_shade_info(hit,normalized,base_color,id,tbn,out_normal,out_emissive);base_color=mix(base_color,room_color,mask);normal=mix(normal,out_normal,mask);emissive=mix(emissive,out_emissive,mask);}\n#endif\nvec4 color=vec4(base_color,1.0);vec3 xy_flipped_normal=vec3(-normal.xy,normal.z);float shadowed_lighting_factor=0.0;\n#ifdef RENDER_SHADOWS\nshadowed_lighting_factor=shadowed_light_factor_normal(xy_flipped_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);\n#else\nshadowed_lighting_factor=dot(normal,u_lighting_directional_dir);\n#endif\ncolor.rgb=apply_lighting_linear(color.rgb,xy_flipped_normal,shadowed_lighting_factor);color.rgb=mix(color.rgb,base_color.rgb,emissive);\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos,v_pos.z));\n#endif\ncolor.rgb=linearTosRGB(color.rgb);color*=u_opacity;\n#ifdef INDICATOR_CUTOUT\ncolor=applyCutout(color,v_pos.z);\n#endif\nglFragColor=color; \n#ifdef DEBUG_SHOW_NORMALS\ncolor.rgb=xy_flipped_normal*0.5+vec3(0.5,0.5,0.5);color.a=1.0;glFragColor=color;\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nin vec3 a_pos_3f;in vec3 a_normal_3;in vec3 a_centroid_3;in vec4 a_faux_facade_data;in vec2 a_faux_facade_vertical_range;uniform mat4 u_matrix;uniform mat4 u_normal_matrix;uniform highp float u_tile_to_meter;out vec4 v_color;out vec3 v_normal;out highp vec3 v_pos;\n#ifdef BUILDING_FAUX_FACADE\nout lowp float v_faux_facade;out highp float v_faux_facade_ed;out highp vec2 v_faux_facade_window;out highp vec2 v_faux_facade_floor;out highp vec2 v_faux_facade_range;out highp float v_aspect;out highp vec3 v_tbn_0;out highp vec3 v_tbn_1;out highp vec3 v_tbn_2;out highp vec4 v_faux_color_emissive;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out float v_depth_shadows;\n#endif\nconst float MAX_UINT_16=65535.0;const float MAX_INT_16=32767.0;const float MAX_UINT_8=255.0;const float TWO_POW_8=256.0;vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}\n#ifdef BUILDING_FAUX_FACADE\nmat3 get_tbn(in vec3 normal) {const vec3 bitangent=vec3(0.0,0.0,1.0);vec3 tangent=normalize(vec3(normal.y,-normal.x,0.0));return mat3(tangent,bitangent,normal);}\n#endif\n#pragma mapbox: define-attribute-vertex-shader-only highp vec2 part_color_emissive\n#pragma mapbox: define-attribute-vertex-shader-only highp vec2 faux_facade_color_emissive\nvoid main() {\n#pragma mapbox: initialize-attribute-custom highp vec2 part_color_emissive\n#pragma mapbox: initialize-attribute-custom highp vec2 faux_facade_color_emissive\nvec4 color_emissive=decode_color(part_color_emissive);v_color=vec4(sRGBToLinear(color_emissive.rgb),color_emissive.a);vec3 a_normal_3f=a_normal_3/MAX_INT_16;v_normal=vec3(u_normal_matrix*vec4(a_normal_3f,0.0));float hidden=0.0;\n#ifdef BUILDING_FAUX_FACADE\nv_faux_facade=a_faux_facade_data.x;if (v_faux_facade > 0.0) {v_faux_facade_ed=a_faux_facade_data.x *u_tile_to_meter;float window_x_perc=floor(a_faux_facade_data.y/TWO_POW_8);float window_y_perc=a_faux_facade_data.y-TWO_POW_8*window_x_perc;vec2 window_perc=vec2(window_x_perc,window_y_perc)/MAX_UINT_8;v_faux_facade_floor=(a_faux_facade_data.zw/MAX_UINT_16*EXTENT)*u_tile_to_meter;v_faux_facade_window=window_perc*v_faux_facade_floor;v_faux_facade_range=(a_faux_facade_vertical_range/MAX_UINT_16*EXTENT)*u_tile_to_meter;v_aspect=v_faux_facade_window.x/v_faux_facade_window.y;mat3 tbn=get_tbn(normalize(v_normal));v_tbn_0=tbn[0];v_tbn_1=tbn[1];v_tbn_2=tbn[2];v_faux_color_emissive=decode_color(faux_facade_color_emissive);v_faux_color_emissive.rgb=sRGBToLinear(v_faux_color_emissive.rgb);}\n#endif\nv_pos=a_pos_3f;\n#ifdef RENDER_CUTOFF\nvec4 ground=u_matrix*vec4(a_centroid_3,1.0);v_cutoff_opacity=cutoff_opacity(u_cutoff_params,ground.z);hidden=float(v_cutoff_opacity==0.0);v_pos.z*=v_cutoff_opacity;\n#endif\n#ifdef RENDER_SHADOWS\nvec3 shadow_pos=v_pos;\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset_model(v_normal);shadow_pos+=offset*shadow_normal_offset_multiplier0();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shadow_pos,1.0);v_pos_light_view_1=u_light_matrix_1*vec4(shadow_pos,1.0);v_depth_shadows=gl_Position.w;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(v_pos);\n#endif\ngl_Position=mix(u_matrix*vec4(v_pos,1),AWAY,hidden);}'),buildingBloom:Jn("in vec4 v_color_emissive;\n#pragma mapbox: define-attribute highp vec4 bloom_attenuation\n#pragma mapbox: initialize-attribute highp vec4 bloom_attenuation\nfloat saturate(float val) {return clamp(val,0.0,1.0);}void main() {float emission=v_color_emissive.a;float opacity=1.0;\n#ifdef HAS_ATTRIBUTE_a_bloom_attenuation\nfloat distance=length(vec2(1.3*max(0.0,abs(bloom_attenuation.x)-bloom_attenuation.z),bloom_attenuation.y));distance+= mix(0.5,0.0,clamp(emission-1.0,0.0,1.0));opacity*=saturate(1.0-distance*distance);\n#endif\nglFragColor=vec4(v_color_emissive.rgb,1.0)*opacity;}","in vec3 a_pos_3f;\n#pragma mapbox: define-attribute-vertex-shader-only highp vec2 part_color_emissive\n#pragma mapbox: define-attribute highp vec4 bloom_attenuation\nout vec4 v_color_emissive;uniform mat4 u_matrix;vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() {\n#pragma mapbox: initialize-attribute-custom highp vec2 part_color_emissive\n#pragma mapbox: initialize-attribute highp vec4 bloom_attenuation\n#ifdef HAS_ATTRIBUTE_a_part_color_emissive\nvec4 color_emissive=decode_color(part_color_emissive);float part_emissive=color_emissive.a*5.0;v_color_emissive=vec4(sRGBToLinear(color_emissive.rgb),part_emissive);\n#else\nv_color_emissive=vec4(1.0);\n#endif\ngl_Position=u_matrix*vec4(a_pos_3f,1.0);}"),buildingDepth:Jn("in highp float v_depth;void main() {\n#ifndef DEPTH_TEXTURE\nglFragColor=pack_depth(v_depth);\n#endif\n}","in vec3 a_pos_3f;uniform mat4 u_matrix;out highp float v_depth;void main() {gl_Position=u_matrix*vec4(a_pos_3f,1.0);v_depth=gl_Position.z/gl_Position.w;}"),circle:Jn('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nin vec3 v_data;in 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\nuniform float u_emissive_strength;void 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 blur_positive=blur < 0.0 ? 0.0 : 1.0;lowp float antialiasblur=v_data.z;float extrude_length=length(extrude)+antialiasblur*(1.0-blur_positive);float antialiased_blur=-max(abs(blur),antialiasblur);float antialiase_blur_opacity=smoothstep(0.0,antialiasblur,extrude_length-1.0);float opacity_t=blur_positive==1.0 ? \nsmoothstep(0.0,-antialiased_blur,1.0-extrude_length) : \nsmoothstep(antialiased_blur,0.0,extrude_length-1.0)-antialiase_blur_opacity;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 LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#endif\n#ifdef FOG\nout_color=fog_apply_premultiplied(out_color,v_fog_pos);\n#endif\nglFragColor=out_color*(v_visibility*opacity_t);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\n}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#define NUM_VISIBILITY_RINGS 2\n#define INV_SQRT2 0.70710678\n#define ELEVATION_BIAS 0.0001\n#define NUM_SAMPLES_PER_RING 16\nuniform mat4 u_matrix;uniform mat2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;in vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;\n#endif\n#ifdef ELEVATED_ROADS\nin float a_circle_z_offset;\n#endif\nout vec3 v_data;out float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvec2 calc_offset(vec2 extrusion,float radius,float stroke_width, float view_scale) {return extrusion*(radius+stroke_width)*u_extrude_scale*view_scale;}float cantilevered_elevation(vec2 pos,float radius,float stroke_width,float view_scale) {vec2 c1=pos+calc_offset(vec2(-1,-1),radius,stroke_width,view_scale);vec2 c2=pos+calc_offset(vec2(1,-1),radius,stroke_width,view_scale);vec2 c3=pos+calc_offset(vec2(1,1),radius,stroke_width,view_scale);vec2 c4=pos+calc_offset(vec2(-1,1),radius,stroke_width,view_scale);float h1=elevation(c1)+ELEVATION_BIAS;float h2=elevation(c2)+ELEVATION_BIAS;float h3=elevation(c3)+ELEVATION_BIAS;float h4=elevation(c4)+ELEVATION_BIAS;return max(h4,max(h3,max(h1,h2)));}float circle_elevation(vec2 pos) {\n#if defined(TERRAIN)\nreturn elevation(pos)+ELEVATION_BIAS;\n#else\nreturn 0.0;\n#endif\n}vec4 project_vertex(vec2 extrusion,vec4 world_center,vec4 projected_center,float radius,float stroke_width, float view_scale,mat3 surface_vectors) {vec2 sample_offset=calc_offset(extrusion,radius,stroke_width,view_scale);\n#ifdef PITCH_WITH_MAP\n#ifdef PROJECTION_GLOBE_VIEW\nreturn u_matrix*( world_center+vec4(sample_offset.x*surface_vectors[0]+sample_offset.y*surface_vectors[1],0) );\n#else\nreturn u_matrix*( world_center+vec4(sample_offset,0,0) );\n#endif\n#else\nreturn projected_center+vec4(sample_offset,0,0);\n#endif\n}float get_sample_step() {\n#ifdef PITCH_WITH_MAP\nreturn 2.0*PI/float(NUM_SAMPLES_PER_RING);\n#else\nreturn PI/float(NUM_SAMPLES_PER_RING);\n#endif\n}void main(void) {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);vec4 world_center;mat3 surface_vectors;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 pos_normal_3=a_pos_normal_3/16384.0;surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(circle_center)*circle_elevation(circle_center);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*circle_elevation(circle_center);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,circle_center,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;vec3 pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);world_center=vec4(pos,1);\n#else \nsurface_vectors=mat3(1.0);float height=circle_elevation(circle_center);world_center=vec4(circle_center,height,1);\n#endif\n#ifdef ELEVATED_ROADS\nworld_center.z+=a_circle_z_offset+ELEVATION_BIAS;\n#endif\nvec4 projected_center=u_matrix*world_center;float view_scale=0.0;\n#ifdef PITCH_WITH_MAP\n#ifdef SCALE_WITH_MAP\nview_scale=1.0;\n#else\nview_scale=projected_center.w/u_camera_to_center_distance;\n#endif\n#else\n#ifdef SCALE_WITH_MAP\nview_scale=u_camera_to_center_distance;\n#else\nview_scale=projected_center.w;\n#endif\n#endif\ngl_Position=project_vertex(extrude,world_center,projected_center,radius,stroke_width,view_scale,surface_vectors);float visibility=0.0;\n#ifdef TERRAIN\nfloat step=get_sample_step();vec4 occlusion_world_center;vec4 occlusion_projected_center;\n#ifdef PITCH_WITH_MAP\nfloat cantilevered_height=cantilevered_elevation(circle_center,radius,stroke_width,view_scale);occlusion_world_center=vec4(circle_center,cantilevered_height,1);occlusion_projected_center=u_matrix*occlusion_world_center;\n#else\nocclusion_world_center=world_center;occlusion_projected_center=projected_center;\n#endif\nfor(int ring=0; ring < NUM_VISIBILITY_RINGS; ring++) {float scale=(float(ring)+1.0)/float(NUM_VISIBILITY_RINGS);for(int i=0; i < NUM_SAMPLES_PER_RING; i++) {vec2 extrusion=vec2(cos(step*float(i)),-sin(step*float(i)))*scale;vec4 frag_pos=project_vertex(extrusion,occlusion_world_center,occlusion_projected_center,radius,stroke_width,view_scale,surface_vectors);visibility+=float(!isOccluded(frag_pos));}}visibility/=float(NUM_VISIBILITY_RINGS)*float(NUM_SAMPLES_PER_RING);\n#else\nvisibility=1.0;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nvisibility=1.0;\n#endif\nv_visibility=visibility;lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);\n#ifdef FOG\nv_fog_pos=fog_position(world_center.xyz);\n#endif\n}'),clippingMask:Jn("void main() {glFragColor=vec4(1.0);}","in vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:Jn('#include "_prelude_fog.fragment.glsl"\nuniform highp float u_intensity;in 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);glFragColor=vec4(val,1.0,1.0,1.0);\n#ifdef FOG\nif (u_is_globe==0) {glFragColor.r*=pow(1.0-fog_opacity(v_fog_pos),2.0);}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_terrain.vertex.glsl"\n#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;in vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;\n#endif\nout vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 tilePos=floor(a_pos*0.5);vec3 pos;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 pos_normal_3=a_pos_normal_3/16384.0;mat3 surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(tilePos)*elevation(tilePos);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*elevation(tilePos);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,tilePos,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#else\npos=vec3(tilePos+extrude,elevation(tilePos));\n#endif\ngl_Position=u_matrix*vec4(pos,1);\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}'),heatmapTexture:Jn("uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));glFragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(0.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}","in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=a_pos*0.5+0.5;}"),collisionBox:Jn("in float v_placed;in 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);glFragColor =mix(red,blue,step(0.5,v_placed))*0.5;glFragColor*=mix(1.0,0.1,step(0.5,v_notUsed));}",'#include "_prelude_terrain.vertex.glsl"\nin vec3 a_pos;in vec2 a_anchor_pos;in vec2 a_extrude;in vec2 a_placed;in vec2 a_shift;in vec2 a_elevation_from_sea;in float a_size_scale;in vec2 a_padding;in float a_auto_z_offset;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform float u_zoom_transition;\n#endif\nout float v_placed;out float v_notUsed;void main() {float feature_elevation=a_elevation_from_sea.x+a_auto_z_offset;float terrain_elevation=(a_elevation_from_sea.y==1.0 ? 0.0 : elevation(a_anchor_pos));vec3 proj_pos=a_pos+elevationVector(a_anchor_pos)*(feature_elevation+terrain_elevation);\n#ifdef PROJECTION_GLOBE_VIEW\n#ifndef PROJECTED_POS_ON_VIEWPORT\nvec3 globe_pos=proj_pos;vec3 mercator_pos=mercator_tile_position(u_inv_rot_matrix,a_anchor_pos,u_tile_id,u_merc_center);proj_pos=mix_globe_mercator(globe_pos,mercator_pos,u_zoom_transition);\n#endif\n#endif\nvec4 projectedPoint=u_matrix*vec4(proj_pos,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(\n0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,1.5);gl_Position=projectedPoint;gl_Position.xy+=(a_extrude*a_size_scale+a_shift+a_padding)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}'),collisionCircle:Jn("in float v_radius;in vec2 v_extrude;in float v_perspective_ratio;in 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);glFragColor=color*alpha*opacity_t;}","in vec2 a_pos_2f;in float a_radius;in vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;out float v_radius;out vec2 v_extrude;out float v_perspective_ratio;out 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:Jn("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);glFragColor=mix(u_color,overlay_color,overlay_color.a);}",'#include "_prelude_terrain.vertex.glsl"\nin vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_pos_3;\n#endif\nout vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {float h=elevation(a_pos);v_uv=a_pos/8192.0;\n#ifdef PROJECTION_GLOBE_VIEW\ngl_Position=u_matrix*vec4(a_pos_3+elevationVector(a_pos)*h,1);\n#else\ngl_Position=u_matrix*vec4(a_pos*u_overlay_scale,h,1);\n#endif\n}'),elevatedStructuresDepth:Jn("void main() {\n#ifndef DEPTH_TEXTURE\nglFragColor=vec4(0.);\n#endif\n}","in vec2 a_pos;in float a_height;uniform mat4 u_matrix;uniform float u_depth_bias;void main() {gl_Position=u_matrix*vec4(a_pos,a_height,1);gl_Position.z=gl_Position.z+u_depth_bias;}"),elevatedStructuresDepthReconstruct:Jn("#ifdef DEPTH_RECONSTRUCTION\nin float v_height;\n#endif\nvoid main() {\n#ifdef DEPTH_RECONSTRUCTION\nif (v_height >=0.0)\ndiscard;\n#endif\nglFragColor=vec4(1.0,0.0,0.0,1.0);}","in vec2 a_pos;in float a_height;uniform mat4 u_matrix;uniform vec3 u_camera_pos;uniform highp float u_depth_bias;uniform lowp float u_height_scale;uniform lowp float u_reset_depth;\n#ifdef DEPTH_RECONSTRUCTION\nout float v_height;\n#endif\nvoid main() {vec3 vpos=vec3(a_pos,a_height*u_height_scale);\n#ifdef DEPTH_RECONSTRUCTION\nif (u_camera_pos.z > vpos.z) {vpos-=(u_camera_pos-vpos)*(vpos.z/(u_camera_pos.z-vpos.z));}v_height=a_height;\n#endif\ngl_Position=u_matrix*vec4(vpos,1);gl_Position.z=u_reset_depth==1.0 ? gl_Position.w : gl_Position.z+u_depth_bias;}"),elevatedStructures:Jn('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\nin vec3 v_normal;in float v_height;\n#ifdef RENDER_SHADOWS\nin highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth;\n#endif\nvec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}vec3 compute_view_dependent_emissive_color(float ndotl,float emissive_strength,vec3 color)\n{color=sRGBToLinear(color);color=color*(ndotl+(1.0-min(ndotl*57.29,1.0))*emissive_strength);color=linearTosRGB(color.rgb);return color;}uniform float u_emissive_strength;\n#pragma mapbox: define highp vec4 structure_color\nvoid main() {\n#pragma mapbox: initialize highp vec4 structure_color\nvec3 color=structure_color.xyz;\n#ifdef LIGHTING_3D_MODE\nvec3 normal=normalize(v_normal);vec3 transformed_normal=vec3(-normal.xy,normal.z);float ndotl=calculate_NdotL(transformed_normal);float emissive_strength=u_emissive_strength;emissive_strength=0.0;vec3 emissive_color=compute_view_dependent_emissive_color(ndotl,emissive_strength,color.xyz);\n#ifdef RENDER_SHADOWS\nfloat shadowed_lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth);color.rgb=apply_lighting(color.rgb,transformed_normal,shadowed_lighting_factor);\n#else\ncolor=apply_lighting(color,transformed_normal);\n#endif\ncolor=mix(color,emissive_color,emissive_strength);if (v_height < 0.0) {float penetration=max(v_height+7.5,0.0);float occlusion=1.0-1.0/PI*acos(1.0-penetration/4.0);color=color*(1.0-pow(occlusion,2.0)*0.3);}\n#endif\n#ifdef FOG\ncolor=fog_apply(color,v_fog_pos);\n#endif\nvec4 out_color=vec4(color,1.0);\n#ifdef INDICATOR_CUTOUT\nout_color=applyCutout(out_color,v_height);\n#endif\n#ifdef FEATURE_CUTOUT\nout_color=apply_feature_cutout(out_color,gl_FragCoord);\n#endif\nglFragColor=out_color;HANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nin vec2 a_pos;in float a_height;in vec3 a_pos_normal_3;uniform mat4 u_matrix;out vec3 v_normal;out float v_height;\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out float v_depth;\n#endif\n#pragma mapbox: define highp vec4 structure_color\nvoid main() {\n#pragma mapbox: initialize highp vec4 structure_color\nv_normal=a_pos_normal_3/16384.0;v_height=a_height;vec3 pos=vec3(a_pos,a_height);gl_Position=u_matrix*vec4(pos,1);\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=pos;vec3 shd_pos1=pos;\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(vec3(-v_normal.xy,v_normal.z));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),fill:Jn('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nuniform float u_emissive_strength;\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\n#ifdef ELEVATED_ROADS\nin highp float v_road_z_offset;\n#endif\n#ifdef INDICATOR_CUTOUT\nin highp float v_z_offset;\n#endif\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\nvec4 out_color=color;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nout_color*=opacity;\n#ifdef INDICATOR_CUTOUT\nif (v_z_offset >=0.0) {out_color=applyCutout(out_color,v_z_offset);}\n#endif\n#ifdef FEATURE_CUTOUT\nout_color=apply_feature_cutout(out_color,gl_FragCoord);\n#endif\nglFragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nin vec2 a_pos;\n#ifdef ELEVATED_ROADS\nin float a_road_z_offset;out highp float v_road_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\n#ifdef INDICATOR_CUTOUT\nout highp float v_z_offset;\n#endif\nuniform mat4 u_matrix;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp float z_offset\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp float z_offset\n#ifdef ELEVATED_ROADS\nz_offset+=a_road_z_offset;v_road_z_offset=z_offset;\n#endif\nfloat hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n#ifdef INDICATOR_CUTOUT\nv_z_offset=z_offset;\n#endif\n}'),fillOutline:Jn('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\nin highp vec2 v_pos;uniform float u_emissive_strength;\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\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 LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\n#ifdef FEATURE_CUTOUT\nout_color=apply_feature_cutout(out_color,gl_FragCoord);\n#endif\nglFragColor=out_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nin vec2 a_pos;\n#ifdef ELEVATED_ROADS\nin float a_road_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\nuniform mat4 u_matrix;uniform vec2 u_world;out highp vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp float z_offset\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp float z_offset\n#ifdef ELEVATED_ROADS\nz_offset+=a_road_z_offset;\n#endif\nfloat hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);\n#ifdef FLIP_Y\nv_pos=(vec2(gl_Position.x,-gl_Position.y)/gl_Position.w+1.0)/2.0*u_world;\n#else\nv_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#endif\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),fillOutlinePattern:Jn('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\nuniform vec2 u_texsize;uniform sampler2D u_image;\n#ifdef FILL_PATTERN_TRANSITION\nuniform float u_pattern_transition;\n#endif\nuniform float u_emissive_strength;\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\nin highp vec2 v_pos;in highp vec2 v_pos_world;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\n#ifdef FILL_PATTERN_TRANSITION\n#pragma mapbox: define mediump vec4 pattern_b\n#endif\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\n#ifdef FILL_PATTERN_TRANSITION\n#pragma mapbox: initialize mediump vec4 pattern_b\n#endif\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);float dist=length(v_pos_world-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);\n#ifdef FILL_PATTERN_TRANSITION\nvec2 pattern_b_tl=pattern_b.xy;vec2 pattern_b_br=pattern_b.zw;highp vec2 pos_b=mix(pattern_b_tl/u_texsize,pattern_b_br/u_texsize,imagecoord);vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);out_color=out_color*(1.0-u_pattern_transition)+color_b*u_pattern_transition;\n#endif\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#ifdef FEATURE_CUTOUT\nout_color=apply_feature_cutout(out_color,gl_FragCoord);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nuniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos;\n#ifdef ELEVATED_ROADS\nin float a_road_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\nout highp vec2 v_pos;out highp vec2 v_pos_world;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\n#ifdef FILL_PATTERN_TRANSITION\n#pragma mapbox: define mediump vec4 pattern_b\n#endif\n#pragma mapbox: define lowp float pixel_ratio\n#pragma mapbox: define highp float z_offset\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\n#ifdef FILL_PATTERN_TRANSITION\n#pragma mapbox: initialize mediump vec4 pattern_b\n#endif\n#pragma mapbox: initialize lowp float pixel_ratio\n#pragma mapbox: initialize highp float z_offset\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;\n#ifdef ELEVATED_ROADS\nz_offset+=a_road_z_offset;\n#endif\nfloat hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos);\n#ifdef FLIP_Y\nv_pos_world=(vec2(gl_Position.x,-gl_Position.y)/gl_Position.w+1.0)/2.0*u_world;\n#else\nv_pos_world=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#endif\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),fillPattern:Jn('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\nuniform vec2 u_texsize;uniform sampler2D u_image;\n#ifdef FILL_PATTERN_TRANSITION\nuniform float u_pattern_transition;\n#endif\nin highp vec2 v_pos;uniform float u_emissive_strength;\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\n#ifdef ELEVATED_ROADS\nin highp float v_road_z_offset;\n#endif\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\n#ifdef FILL_PATTERN_TRANSITION\n#pragma mapbox: define mediump vec4 pattern_b\n#endif\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\n#ifdef FILL_PATTERN_TRANSITION\n#pragma mapbox: initialize mediump vec4 pattern_b\n#endif\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);\n#ifdef FILL_PATTERN_TRANSITION\nvec2 pattern_b_tl=pattern_b.xy;vec2 pattern_b_br=pattern_b.zw;highp vec2 pos_b=mix(pattern_b_tl/u_texsize,pattern_b_br/u_texsize,imagecoord);vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);out_color=out_color*(1.0-u_pattern_transition)+color_b*u_pattern_transition;\n#endif\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);\n#ifdef ELEVATED_ROADS\nout_color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);\n#else\nout_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#endif\n#ifdef FEATURE_CUTOUT\nout_color=apply_feature_cutout(out_color,gl_FragCoord);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*opacity;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nuniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos;\n#ifdef ELEVATED_ROADS\nin float a_road_z_offset;out highp float v_road_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\nout highp vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\n#ifdef FILL_PATTERN_TRANSITION\n#pragma mapbox: define mediump vec4 pattern_b\n#endif\n#pragma mapbox: define lowp float pixel_ratio\n#pragma mapbox: define highp float z_offset\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize lowp float pixel_ratio\n#pragma mapbox: initialize highp float z_offset\n#ifdef FILL_PATTERN_TRANSITION\n#pragma mapbox: initialize mediump vec4 pattern_b\n#endif\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;\n#ifdef ELEVATED_ROADS\nz_offset+=a_road_z_offset;v_road_z_offset=z_offset;\n#endif\nfloat hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos);\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),fillExtrusion:Jn('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_lighting.glsl"\nin vec4 v_color;in vec4 v_flat;\n#ifdef RENDER_SHADOWS\nin highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;\n#endif\nuniform lowp float u_opacity;\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;in vec2 v_ao;\n#endif\n#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)\nin vec4 v_roof_color;\n#endif\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nin highp vec3 v_normal;\n#endif\nuniform vec3 u_flood_light_color;uniform highp float u_vertical_scale;uniform float u_flood_light_intensity;uniform vec3 u_ground_shadow_factor;\n#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT)\nin float v_flood_radius;in float v_has_floodlight;\n#endif\nin float v_height;\n#pragma mapbox: define highp float emissive_strength\nvoid main() {\n#pragma mapbox: initialize highp float emissive_strength\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nvec3 normal=normalize(v_normal);\n#endif\nfloat z;vec4 color=v_color;\n#ifdef ZERO_ROOF_RADIUS\nz=float(normal.z > 0.00001);\n#ifdef LIGHTING_3D_MODE\nnormal=mix(normal,vec3(0.0,0.0,1.0),z);\n#else\ncolor=mix(v_color,v_roof_color,z);\n#endif\n#endif\nfloat h=max(0.0,v_height);float ao_shade=1.0;\n#ifdef FAUX_AO\nfloat intensity=u_ao[0];float h_floors=h/(u_ao[1]*u_vertical_scale);float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);ao_shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;\n#ifdef ZERO_ROOF_RADIUS\nconcave*=(1.0-z);\n#endif\nfloat x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);ao_shade*=mix(1.0,x_shade*x_shade*x_shade,concave);\n#ifdef LIGHTING_3D_MODE\n#ifdef FLOOD_LIGHT\ncolor.rgb*=mix(ao_shade,1.0,v_has_floodlight);\n#else\ncolor.rgb*=ao_shade;\n#endif\n#else\ncolor.rgb*=ao_shade;\n#endif\n#endif\n#ifdef LIGHTING_3D_MODE\nfloat flood_radiance=0.0;\n#ifdef FLOOD_LIGHT\nflood_radiance=(1.0-min(h/v_flood_radius,1.0))*u_flood_light_intensity*v_has_floodlight;\n#endif\n#ifdef RENDER_SHADOWS\n#ifdef FLOOD_LIGHT\nfloat ndotl_unclamped=dot(normal,u_shadow_direction);float ndotl=max(0.0,ndotl_unclamped);float occlusion=ndotl_unclamped < 0.0 ? 1.0 : shadow_occlusion(ndotl,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 litColor=apply_lighting(color.rgb,normal,(1.0-u_shadow_intensity*occlusion)*ndotl);vec3 floodLitColor=compute_flood_lighting(u_flood_light_color*u_opacity,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=mix(litColor,floodLitColor,flood_radiance);\n#else\nfloat shadowed_lighting_factor;\n#ifdef RENDER_CUTOFF\nshadowed_lighting_factor=shadowed_light_factor_normal_opacity(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,v_cutoff_opacity);if (v_cutoff_opacity==0.0) {discard;}\n#else\nshadowed_lighting_factor=shadowed_light_factor_normal(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);\n#endif\ncolor.rgb=apply_lighting(color.rgb,normal,shadowed_lighting_factor);\n#endif\n#else\ncolor.rgb=apply_lighting(color.rgb,normal);\n#ifdef FLOOD_LIGHT\ncolor.rgb=mix(color.rgb,u_flood_light_color*u_opacity,flood_radiance);\n#endif\n#endif\ncolor.rgb=mix(color.rgb,v_flat.rgb,emissive_strength);color*=u_opacity;\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos,h));\n#endif\n#ifdef INDICATOR_CUTOUT\ncolor=applyCutout(color,h);\n#endif\n#ifdef FEATURE_CUTOUT\ncolor=apply_feature_cutout(color,gl_FragCoord);\n#endif\nglFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\n#include "_prelude_lighting.glsl"\nuniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_edge_radius;uniform float u_width_scale;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos;\n#ifdef RENDER_WALL_MODE\nin vec3 a_join_normal_inside;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;\n#endif\n#ifdef TERRAIN\nuniform int u_height_type;uniform int u_base_type;\n#endif\nuniform highp float u_vertical_scale;out vec4 v_color;out vec4 v_flat;\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;\n#endif\n#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)\nout vec4 v_roof_color;\n#endif\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nout highp vec3 v_normal;\n#endif\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;out vec2 v_ao;\n#endif\n#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT)\nout float v_flood_radius;out float v_has_floodlight;\n#endif\nout float v_height;vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define highp float flood_light_wall_radius\n#pragma mapbox: define highp float line_width\n#pragma mapbox: define highp float emissive_strength\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize highp float flood_light_wall_radius\n#pragma mapbox: initialize highp float line_width\n#pragma mapbox: initialize highp float emissive_strength\nbase*=u_vertical_scale;height*=u_vertical_scale;vec4 pos_nx=floor(a_pos_normal_ed*0.5);vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nv_normal=normal;\n#endif\nbase=max(0.0,base);float attr_height=height;height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=a_centroid_pos;\n#endif\nfloat ele=0.0;float h=0.0;float c_ele=0.0;vec3 pos;\n#ifdef TERRAIN\nbool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;ele=elevation(pos_nx.xy);c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);h=t > 0.0 ? max(h_base,h_height) : h_base;pos=vec3(pos_nx.xy,h);\n#else\nh=t > 0.0 ? height : base;pos=vec3(pos_nx.xy,h);\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nfloat lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*h);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,pos.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*pos.z;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#endif\nfloat cutoff=1.0;vec3 scaled_pos=pos;\n#ifdef RENDER_CUTOFF\nvec3 centroid_random=vec3(centroid_pos.xy,centroid_pos.x+centroid_pos.y+1.0);vec3 ground_pos=centroid_pos.x==0.0 ? pos.xyz : (centroid_random/8.0);vec4 ground=u_matrix*vec4(ground_pos.xy,ele,1.0);\n#ifdef CLIP_ZERO_TO_ONE\ncutoff=cutoff_opacity(u_cutoff_params,ground.z*2.0-ground.w);\n#else\ncutoff=cutoff_opacity(u_cutoff_params,ground.z);\n#endif\nif (centroid_pos.y !=0.0 && centroid_pos.x !=0.0) {vec3 g=floor(ground_pos);vec3 mod_=centroid_random-g*8.0;float seed=min(1.0,0.1*(min(3.5,max(mod_.x+mod_.y,0.2*attr_height))*0.35+mod_.z));if (cutoff < 0.8-seed) {cutoff=0.0;}}float cutoff_scale=cutoff;v_cutoff_opacity=cutoff;scaled_pos.z=mix(c_ele,h,cutoff_scale);\n#endif\nfloat hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (cutoff==0.0 && centroid_pos.x !=0.0) || (color.a==0.0));\n#ifdef RENDER_WALL_MODE\nvec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);scaled_pos.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;scaled_pos.xy-=a_join_normal_inside.z*wall_offset*0.5;\n#endif\ngl_Position=mix(u_matrix*vec4(scaled_pos,1),AWAY,hidden);h=h-ele;v_height=h;\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=pos;vec3 shd_pos1=pos;\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(normal);shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);\n#endif\nfloat NdotL=0.0;float colorvalue=0.0;\n#ifndef LIGHTING_3D_MODE\ncolorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),NdotL);if (normal.y !=0.0) {float r=0.84;r=mix(0.7,0.98,1.0-u_lightintensity);NdotL*=(\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}\n#endif\n#ifdef FAUX_AO\nfloat concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;\n#ifdef TERRAIN\ntop_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);\n#endif\nv_ao=vec2(mix(concave,-concave,start),y_ground);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]);\n#ifdef PROJECTION_GLOBE_VIEW\ntop_height+=u_height_lift;\n#endif\ngl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;\n#endif\n#ifdef LIGHTING_3D_MODE\n#ifdef FLOOD_LIGHT\nfloat is_wall=1.0-float(t > 0.0 && top_up_ny.y > 0.0);v_has_floodlight=float(flood_light_wall_radius > 0.0 && is_wall > 0.0);v_flood_radius=flood_light_wall_radius*u_vertical_scale;\n#endif\nv_color=vec4(color.rgb,1.0);float ndotl=calculate_NdotL(normal);v_flat.rgb=sRGBToLinear(color.rgb);v_flat.rgb=v_flat.rgb*(ndotl+(1.0-min(ndotl*57.29,1.0))*emissive_strength);v_flat=vec4(linearTosRGB(v_flat.rgb),1.0);\n#else\nv_color=vec4(0.0,0.0,0.0,1.0);v_color.rgb+=clamp(color.rgb*NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_color*=u_opacity;\n#endif\n#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)\nfloat roofNdotL=clamp(u_lightpos.z,0.0,1.0);roofNdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),roofNdotL);v_roof_color=vec4(0.0,0.0,0.0,1.0);v_roof_color.rgb+=clamp(color.rgb*roofNdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_roof_color*=u_opacity;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}'),fillExtrusionDepth:Jn("in highp float v_depth;void main() {\n#ifndef DEPTH_TEXTURE\nglFragColor=pack_depth(v_depth);\n#endif\n}",'#include "_prelude_terrain.vertex.glsl"\nuniform mat4 u_matrix;uniform float u_edge_radius;uniform float u_width_scale;uniform float u_vertical_scale;\n#ifdef TERRAIN\nuniform int u_height_type;uniform int u_base_type;\n#endif\nin vec4 a_pos_normal_ed;in vec2 a_centroid_pos;\n#ifdef RENDER_WALL_MODE\nin vec3 a_join_normal_inside;\n#endif\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp float line_width\n#pragma mapbox: define highp vec4 color\nout highp float v_depth;void main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp float line_width\n#pragma mapbox: initialize highp vec4 color\nbase*=u_vertical_scale;height*=u_vertical_scale;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;base=max(0.0,base);height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=a_centroid_pos;\n#endif\nvec3 pos;\n#ifdef TERRAIN\nbool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;float ele=elevation(pos_nx.xy);float c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);float h=t > 0.0 ? max(h_base,h_height) : h_base;pos=vec3(pos_nx.xy,h);\n#else\npos=vec3(pos_nx.xy,t > 0.0 ? height : base);\n#endif\n#ifdef RENDER_WALL_MODE\nvec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);pos.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;pos.xy-=a_join_normal_inside.z*wall_offset*0.5;\n#endif\nfloat hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (color.a==0.0));gl_Position=mix(u_matrix*vec4(pos,1),AWAY,hidden);v_depth=gl_Position.z/gl_Position.w;}'),fillExtrusionPattern:Jn('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform vec2 u_texsize;uniform sampler2D u_image;\n#ifdef FILL_EXTRUSION_PATTERN_TRANSITION\nuniform float u_pattern_transition;\n#endif\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;in vec3 v_ao;\n#endif\n#ifdef LIGHTING_3D_MODE\nin vec3 v_normal;\n#endif\nin highp vec2 v_pos;in vec4 v_lighting;uniform lowp float u_opacity;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define mediump vec4 pattern\n#ifdef FILL_EXTRUSION_PATTERN_TRANSITION\n#pragma mapbox: define mediump vec4 pattern_b\n#endif\n#pragma mapbox: define highp float pixel_ratio\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize mediump vec4 pattern\n#ifdef FILL_EXTRUSION_PATTERN_TRANSITION\n#pragma mapbox: initialize mediump vec4 pattern_b\n#endif\n#pragma mapbox: initialize highp float pixel_ratio\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);\n#ifdef FILL_EXTRUSION_PATTERN_TRANSITION\nvec2 pattern_b_tl=pattern_b.xy;vec2 pattern_b_br=pattern_b.zw;highp vec2 pos_b=mix(pattern_b_tl/u_texsize,pattern_b_br/u_texsize,imagecoord);vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);out_color=out_color*(1.0-u_pattern_transition)+color_b*u_pattern_transition;\n#endif\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color,normalize(v_normal))*u_opacity;\n#else\nout_color=out_color*v_lighting;\n#endif\n#ifdef FAUX_AO\nfloat intensity=u_ao[0];float h=max(0.0,v_ao.z);float h_floors=h/u_ao[1];float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);float shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);shade*=mix(1.0,x_shade*x_shade*x_shade,concave);out_color.rgb=out_color.rgb*shade;\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\n#ifdef INDICATOR_CUTOUT\nout_color=applyCutout(out_color,height);\n#endif\nglFragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#include "_prelude_lighting.glsl"\nuniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform float u_tile_units_to_pixels;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_width_scale;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos;\n#ifdef RENDER_WALL_MODE\nin vec3 a_join_normal_inside;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;\n#endif\n#ifdef TERRAIN\nuniform int u_height_type;uniform int u_base_type;\n#endif\nout highp vec2 v_pos;out vec4 v_lighting;\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;out vec3 v_ao;\n#endif\n#ifdef LIGHTING_3D_MODE\nout vec3 v_normal;\n#endif\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump vec4 pattern\n#ifdef FILL_EXTRUSION_PATTERN_TRANSITION\n#pragma mapbox: define mediump vec4 pattern_b\n#endif\n#pragma mapbox: define highp float pixel_ratio\n#pragma mapbox: define highp float line_width\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump vec4 pattern\n#ifdef FILL_EXTRUSION_PATTERN_TRANSITION\n#pragma mapbox: initialize mediump vec4 pattern_b\n#endif\n#pragma mapbox: initialize highp float pixel_ratio\n#pragma mapbox: initialize highp float line_width\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec4 pos_nx=floor(a_pos_normal_ed*0.5);mediump vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;mediump vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));float edgedistance=a_pos_normal_ed.w;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;base=max(0.0,base);height=max(0.0,height);float t=top_up_ny.x;float z=t > 0.0 ? height : base;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=a_centroid_pos;\n#endif\nfloat ele=0.0;float h=z;vec3 p;float c_ele;\n#ifdef TERRAIN\nbool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;ele=elevation(pos_nx.xy);c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);h=t > 0.0 ? max(h_base,h_height) : h_base;p=vec3(pos_nx.xy,h);\n#else\np=vec3(pos_nx.xy,z);\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nfloat lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*(p.z+lift));vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,p.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*p.z;p=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#endif\n#ifdef RENDER_WALL_MODE\nvec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);p.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;p.xy-=a_join_normal_inside.z*wall_offset*0.5;\n#endif\nfloat hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (color.a==0.0));gl_Position=mix(u_matrix*vec4(p,1),AWAY,hidden);vec2 pos=normal.z==1.0\n? pos_nx.xy\n: vec2(edgedistance,z*u_height_factor);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float NdotL=0.0;\n#ifdef LIGHTING_3D_MODE\nNdotL=calculate_NdotL(normal);\n#else\nNdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),NdotL);\n#endif\nif (normal.y !=0.0) {float r=0.84;\n#ifndef LIGHTING_3D_MODE\nr=mix(0.7,0.98,1.0-u_lightintensity);\n#endif\nNdotL*=(\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}\n#ifdef FAUX_AO\nfloat concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;\n#ifdef TERRAIN\ntop_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);\n#endif\nv_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]);\n#ifdef PROJECTION_GLOBE_VIEW\ntop_height+=u_height_lift;\n#endif\ngl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;\n#endif\n#ifdef LIGHTING_3D_MODE\nv_normal=normal;\n#else\nv_lighting.rgb+=clamp(NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(p);\n#endif\n}'),groundShadow:Jn('#include "_prelude_shadow.fragment.glsl"\nprecision highp float;uniform vec3 u_ground_shadow_factor;in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;\n#ifdef FOG\nin float v_fog_opacity;\n#endif\nvoid main() {float light=shadowed_light_factor_plane_bias(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 shadow=mix(u_ground_shadow_factor,vec3(1.0),light);\n#ifdef RENDER_CUTOFF\nshadow=mix(vec3(1.0),shadow,cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w));\n#endif\n#ifdef FOG\nshadow=mix(shadow,vec3(1.0),v_fog_opacity);\n#endif\n#ifdef INDICATOR_CUTOUT\nshadow=mix(shadow,vec3(1.0),1.0-applyCutout(vec4(1.0),0.0).r);\n#endif\nglFragColor=vec4(shadow,1.0);}','#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;in vec2 a_pos;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1;\n#ifdef FOG\nout float v_fog_opacity;\n#endif\nvoid main() {gl_Position=u_matrix*vec4(a_pos,0.0,1.0);v_pos_light_view_0=u_light_matrix_0*vec4(a_pos,0.0,1.0);v_pos_light_view_1=u_light_matrix_1*vec4(a_pos,0.0,1.0);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);v_fog_opacity=fog(v_fog_pos);\n#endif\n}'),fillExtrusionGroundEffect:Jn("uniform highp float u_ao_pass;uniform highp float u_opacity;uniform highp float u_flood_light_intensity;uniform highp vec3 u_flood_light_color;uniform highp float u_attenuation;uniform sampler2D u_fb;uniform float u_fb_size;\n#ifdef SDF_SUBPASS\nin highp vec2 v_pos;in highp vec4 v_line_segment;in highp float v_flood_light_radius_tile;in highp vec2 v_ao;float line_df(highp vec2 a,highp vec2 b,highp vec2 p) {highp vec2 ba=b-a;highp vec2 pa=p-a;highp float r=clamp(dot(pa,ba)/dot(ba,ba),0.0,1.0);return length(pa-r*ba);}\n#ifdef FOG\nin highp float v_fog;\n#endif\n#endif\nvoid main() {\n#ifdef CLEAR_SUBPASS\nvec4 color=vec4(1.0);\n#ifdef CLEAR_FROM_TEXTURE\ncolor=texture(u_fb,gl_FragCoord.xy/vec2(u_fb_size));\n#endif\nglFragColor=color;\n#else\n#ifdef SDF_SUBPASS\nhighp float d=line_df(v_line_segment.xy,v_line_segment.zw,v_pos);highp float effect_radius=mix(v_flood_light_radius_tile,v_ao.y,u_ao_pass);d/=effect_radius;d=min(d,1.0);d=1.0-pow(1.0-d,u_attenuation);highp float effect_intensity=mix(u_flood_light_intensity,v_ao.x,u_ao_pass);highp float fog=1.0;\n#ifdef FOG\nfog=v_fog;\n#endif\n#ifdef RENDER_CUTOFF\nfog*=v_cutoff_opacity;\n#endif\nglFragColor=vec4(vec3(0.0),mix(1.0,d,effect_intensity*u_opacity*fog));\n#else\nvec4 color=mix(vec4(u_flood_light_color,1.0),vec4(vec3(0.0),1.0),u_ao_pass);\n#ifdef OVERDRAW_INSPECTOR\ncolor=vec4(1.0);\n#endif\nglFragColor=color;\n#endif\nHANDLE_WIREFRAME_DEBUG;\n#endif\n}",'#include "_prelude_fog.vertex.glsl"\nin highp vec4 a_pos_end;in highp float a_angular_offset_factor;in highp float a_hidden_by_landmark;\n#ifdef SDF_SUBPASS\nout highp vec2 v_pos;out highp vec4 v_line_segment;out highp float v_flood_light_radius_tile;out highp vec2 v_ao;\n#ifdef FOG\nout highp float v_fog;\n#endif\n#endif\nuniform highp float u_flood_light_intensity;uniform highp mat4 u_matrix;uniform highp float u_ao_pass;uniform highp float u_meter_to_tile;uniform highp float u_edge_radius;uniform highp float u_dynamic_offset;uniform highp vec2 u_ao;\n#pragma mapbox: define highp float flood_light_ground_radius\nconst float TANGENT_CUTOFF=4.0;const float NORM=32767.0;void main() {\n#pragma mapbox: initialize highp float flood_light_ground_radius\nvec2 p=a_pos_end.xy;vec2 q=floor(a_pos_end.zw*0.5);vec2 start_bottom=a_pos_end.zw-q*2.0;float fl_ground_radius=flood_light_ground_radius;fl_ground_radius=abs(flood_light_ground_radius);float direction=flood_light_ground_radius < 0.0 ?-1.0 : 1.0;float flood_radius_tile=fl_ground_radius*u_meter_to_tile;vec2 v=normalize(q-p);float ao_radius=u_ao.y/3.5;float effect_radius=mix(flood_radius_tile,ao_radius,u_ao_pass)+u_edge_radius;float angular_offset_factor=a_angular_offset_factor/NORM*TANGENT_CUTOFF;float angular_offset=direction*angular_offset_factor*effect_radius;float top=1.0-start_bottom.y;float side=(0.5-start_bottom.x)*2.0;vec2 extrusion_parallel=v*side*mix(u_dynamic_offset,angular_offset,top);vec2 perp=vec2(v.y,-v.x);vec2 extrusion_perp=direction*perp*effect_radius*top;vec3 pos=vec3(mix(q,p,start_bottom.x),0.0);pos.xy+=extrusion_parallel+extrusion_perp;\n#ifdef SDF_SUBPASS\nv_pos=pos.xy;v_line_segment=vec4(p,q)+perp.xyxy*u_edge_radius;v_flood_light_radius_tile=flood_radius_tile;v_ao=vec2(u_ao.x,ao_radius);\n#ifdef FOG\nv_fog_pos=fog_position(pos);v_fog=1.0-fog(v_fog_pos);\n#endif\n#endif\nfloat hidden_by_landmark=0.0;\n#ifdef HAS_CENTROID\nhidden_by_landmark=a_hidden_by_landmark;\n#endif\nfloat isFloodlit=float(fl_ground_radius > 0.0 && u_flood_light_intensity > 0.0);float hidden=mix(1.0-isFloodlit,isFloodlit,u_ao_pass);hidden+=hidden_by_landmark;gl_Position=mix(u_matrix*vec4(pos,1.0),AWAY,float(hidden > 0.0));\n#ifdef RENDER_CUTOFF\nv_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);\n#endif\n}'),hillshadePrepare:Jn("precision highp float;uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;float getElevation(vec2 coord) {return texture(u_image,coord).r/4.0;}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+vec2(epsilon.x,0));float f=getElevation(v_pos+vec2(-epsilon.x,epsilon.y));float g=getElevation(v_pos+vec2(0,epsilon.y));float h=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+e+e+h)-(a+d+d+f),(f+g+g+h)-(a+b+b+c)\n)/pow(2.0,exaggeration+(19.2562-u_zoom));glFragColor=clamp(vec4(\nderiv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);}","uniform mat4 u_matrix;uniform vec2 u_dimension;in vec2 a_pos;in vec2 a_texture_pos;out 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:Jn('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;uniform float u_emissive_strength;void main() {vec4 pixel=texture(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);glFragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef LIGHTING_3D_MODE\nglFragColor=apply_lighting_with_emission_ground(glFragColor,u_emissive_strength);\n#endif\n#ifdef FOG\nglFragColor=fog_dither(fog_apply_premultiplied(glFragColor,v_fog_pos));\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;in vec2 a_pos;in vec2 a_texture_pos;out 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:Jn('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\nuniform lowp float u_device_pixel_ratio;uniform highp float u_width_scale;uniform highp float u_floor_width_scale;uniform float u_alpha_discard_threshold;uniform highp vec2 u_trim_offset;uniform highp vec2 u_trim_fade_range;uniform lowp vec4 u_trim_color;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec3 v_uv;\n#ifdef ELEVATED_ROADS\nin highp float v_road_z_offset;\n#endif\n#ifdef RENDER_LINE_DASH\nuniform sampler2D u_dash_image;in vec2 v_tex;\n#endif\n#ifdef RENDER_LINE_GRADIENT\nuniform sampler2D u_gradient_image;\n#endif\n#ifdef INDICATOR_CUTOUT\nin highp float v_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\nfloat luminance(vec3 c) {return (c.r+c.r+c.b+c.g+c.g+c.g)*0.1667;}uniform float u_emissive_strength;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 dash\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float border_width\n#pragma mapbox: define lowp vec4 border_color\nfloat linearstep(float edge0,float edge1,float x) {return clamp((x-edge0)/(edge1-edge0),0.0,1.0);}void main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize lowp vec4 dash\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float border_width\n#pragma mapbox: initialize lowp vec4 border_color\nfloat dist=length(v_normal)*v_width2.s;float blur2=(u_width_scale*blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);\n#ifdef RENDER_LINE_DASH\nfloat sdfdist=texture(u_dash_image,v_tex).r;float sdfgamma=1.0/(2.0*u_device_pixel_ratio)/dash.z;float scaled_floorwidth=(floorwidth*u_floor_width_scale);alpha*=linearstep(0.5-sdfgamma/scaled_floorwidth,0.5+sdfgamma/scaled_floorwidth,sdfdist);\n#endif\nhighp vec4 out_color;\n#ifdef RENDER_LINE_GRADIENT\nout_color=texture(u_gradient_image,v_uv.xy);\n#else\nout_color=color;\n#endif\nfloat trim_alpha=1.0;\n#ifdef RENDER_LINE_TRIM_OFFSET\nhighp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=v_uv[2];if (trim_end > trim_start) {highp float start_transition=max(0.0,min(1.0,(line_progress-trim_start)/max(u_trim_fade_range[0],1.0e-9)));highp float end_transition=max(0.0,min(1.0,(trim_end-line_progress)/max(u_trim_fade_range[1],1.0e-9)));highp float transition_factor=min(start_transition,end_transition);out_color=mix(out_color,u_trim_color,transition_factor);trim_alpha=1.0-transition_factor;}\n#endif\nif (u_alpha_discard_threshold !=0.0) {if (alpha < u_alpha_discard_threshold) {discard;}}\n#ifdef RENDER_LINE_BORDER\nfloat edgeBlur=((border_width*u_width_scale)+1.0/u_device_pixel_ratio);float alpha2=clamp(min(dist-(v_width2.t-edgeBlur),v_width2.s-dist)/edgeBlur,0.0,1.0);if (alpha2 < 1.) {float smoothAlpha=smoothstep(0.6,1.0,alpha2);if (border_color.a==0.0) {float Y=(out_color.a > 0.01) ? luminance(out_color.rgb/out_color.a) : 1.;float adjustment=(Y > 0.) ? 0.5/Y : 0.45;if (out_color.a > 0.25 && Y < 0.25) {vec3 borderColor=(Y > 0.) ? out_color.rgb : vec3(1,1,1)*out_color.a;out_color.rgb=out_color.rgb+borderColor*(adjustment*(1.0-smoothAlpha));} else {out_color.rgb*=(0.6 +0.4*smoothAlpha);}} else {out_color=mix(border_color*trim_alpha,out_color,smoothAlpha);}}\n#endif\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);\n#ifdef ELEVATED_ROADS\nout_color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);\n#else\nout_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nout_color*=(alpha*opacity);\n#ifdef INDICATOR_CUTOUT\nout_color=applyCutout(out_color,v_z_offset);\n#endif\n#ifdef FEATURE_CUTOUT\nout_color=apply_feature_cutout(out_color,gl_FragCoord);\n#endif\nglFragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#define EXTRUDE_SCALE 0.015873016\nin vec2 a_pos_normal;in vec4 a_data;\n#if defined(ELEVATED) || defined(ELEVATED_ROADS) || defined(VARIABLE_LINE_WIDTH)\nin vec3 a_z_offset_width;\n#endif\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)\nin highp vec3 a_packed;\n#endif\n#ifdef RENDER_LINE_DASH\nin float a_linesofar;\n#endif\nuniform mat4 u_matrix;uniform mat2 u_pixels_to_tile_units;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;uniform float u_width_scale;uniform highp float u_floor_width_scale;\n#ifdef ELEVATED\nuniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) {\n#ifdef ELEVATION_REFERENCE_SEA\nreturn 0.0;\n#else\nreturn elevation(apos);\n#endif\n}\n#endif\nout vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec3 v_uv;\n#ifdef ELEVATED_ROADS\nout highp float v_road_z_offset;\n#endif\n#ifdef RENDER_LINE_DASH\nuniform vec2 u_texsize;uniform float u_tile_units_to_pixels;out vec2 v_tex;\n#endif\n#ifdef RENDER_LINE_GRADIENT\nuniform float u_image_height;\n#endif\n#ifdef INDICATOR_CUTOUT\nout highp float v_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 dash\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 border_width\n#pragma mapbox: define lowp vec4 border_color\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize lowp vec4 dash\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 border_width\n#pragma mapbox: initialize lowp vec4 border_color\nfloat a_z_offset;\n#if defined(ELEVATED) || defined(ELEVATED_ROADS)\na_z_offset=a_z_offset_width.x;\n#endif\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;\n#ifdef VARIABLE_LINE_WIDTH\nfloat left=a_pos_normal.y-2.0*floor(a_pos_normal.y*0.5);halfwidth=(u_width_scale*(left==1.0 ? a_z_offset_width.y : a_z_offset_width.z))/2.0;\n#else\nhalfwidth=(u_width_scale*width)/2.0;\n#endif\noffset=-1.0*offset*u_width_scale;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);float hidden=float(opacity==0.0);vec2 extrude=dist*u_pixels_to_tile_units;vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy;\n#ifdef ELEVATED_ROADS\nv_road_z_offset=a_z_offset;gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,a_z_offset,1.0)+projected_extrude;\n#else\n#ifdef ELEVATED\nvec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0;\n#ifdef CROSS_SLOPE_VERTICAL\nfloat top=a_pos_normal.y-2.0*floor(a_pos_normal.y*0.5);float line_height=2.0*u_tile_to_meter*outset*top*u_pixels_to_tile_units[1][1]+a_z_offset;ele=sample_elevation(offset_pos)+line_height;projected_extrude=vec4(0);\n#else\n#ifdef CROSS_SLOPE_HORIZONTAL\nfloat ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,max(ele1,ele2));ele=ele_max+a_z_offset;\n#else\nfloat ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,0.5*(ele1+ele2));ele=ele_max-ele0+ele1+a_z_offset;\n#endif\n#endif\ngl_Position=u_matrix*vec4(offset_pos,ele,1.0)+projected_extrude;float z=clamp(gl_Position.z/gl_Position.w,0.5,1.0);float zbias=max(0.00005,(pow(z,0.8)-z)*u_zbias_factor*u_exaggeration);gl_Position.z-=(gl_Position.w*zbias);gl_Position=mix(gl_Position,AWAY,hidden);\n#else\ngl_Position=mix(u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude,AWAY,hidden);\n#endif\n#endif\n#ifdef ELEVATED_ROADS\n#ifdef RENDER_SHADOWS\nvec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos;\n#ifdef NORMAL_OFFSET\nvec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#endif\n#ifndef RENDER_TO_TEXTURE\nfloat epsilon=0.0001;float extrude_length_without_perspective=max(length(dist),epsilon);float extrude_length_with_perspective=max(length(projected_extrude_xy/gl_Position.w*u_units_to_pixels),epsilon);v_gamma_scale=mix(extrude_length_without_perspective/extrude_length_with_perspective,1.0,step(0.01,blur));\n#else\nv_gamma_scale=1.0;\n#endif\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)\nhighp float a_uv_x=a_packed[0];float a_split_index=a_packed[1];highp float line_progress=a_packed[2];\n#ifdef RENDER_LINE_GRADIENT\nhighp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec3(a_uv_x,a_split_index*texel_height-half_texel_height,line_progress);\n#else\nv_uv=vec3(a_uv_x,0.0,line_progress);\n#endif\n#endif\n#ifdef RENDER_LINE_DASH\nfloat scale=dash.z==0.0 ? 0.0 : u_tile_units_to_pixels/dash.z;float height=dash.y;v_tex=vec2(a_linesofar*scale/(floorwidth*u_floor_width_scale),(-normal.y*height+dash.x+0.5)/u_texsize.y);\n#endif\nv_width2=vec2(outset,inset);\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n#ifdef INDICATOR_CUTOUT\nv_z_offset=a_z_offset;\n#endif\n}'),linePattern:Jn('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\nuniform highp float u_device_pixel_ratio;uniform highp float u_width_scale;uniform highp float u_alpha_discard_threshold;uniform highp vec2 u_texsize;uniform highp float u_tile_units_to_pixels;uniform highp vec2 u_trim_offset;uniform highp vec2 u_trim_fade_range;uniform lowp vec4 u_trim_color;uniform sampler2D u_image;\n#ifdef LINE_PATTERN_TRANSITION\nuniform float u_pattern_transition;\n#endif\nin vec2 v_normal;in vec2 v_width2;in highp float v_linesofar;in float v_gamma_scale;in float v_width;\n#ifdef RENDER_LINE_TRIM_OFFSET\nin highp vec3 v_uv;\n#endif\n#ifdef ELEVATED_ROADS\nin highp float v_road_z_offset;\n#endif\n#ifdef LINE_JOIN_NONE\nin vec2 v_pattern_data;\n#endif\n#ifdef INDICATOR_CUTOUT\nin highp float v_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\nuniform float u_emissive_strength;\n#pragma mapbox: define mediump vec4 pattern\n#ifdef LINE_PATTERN_TRANSITION\n#pragma mapbox: define mediump vec4 pattern_b\n#endif\n#pragma mapbox: define mediump float pixel_ratio\n#pragma mapbox: define mediump float blur\n#pragma mapbox: define mediump float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern\n#ifdef LINE_PATTERN_TRANSITION\n#pragma mapbox: initialize mediump vec4 pattern_b\n#endif\n#pragma mapbox: initialize mediump float pixel_ratio\n#pragma mapbox: initialize mediump float blur\n#pragma mapbox: initialize mediump float opacity\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;highp float pattern_size=display_size.x/u_tile_units_to_pixels;float aspect=display_size.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(u_width_scale*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);highp float pattern_x=v_linesofar/pattern_size*aspect;highp float x=mod(pattern_x,1.0);highp float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;highp vec2 pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(x,y));highp vec2 lod_pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(pattern_x,y));vec4 color=textureLodCustom(u_image,pos,lod_pos);\n#ifdef LINE_PATTERN_TRANSITION\nvec2 pattern_b_tl=pattern_b.xy;vec2 pattern_b_br=pattern_b.zw;highp vec2 pos_b=mix(pattern_b_tl*texel_size-texel_size,pattern_b_br*texel_size+texel_size,vec2(x,y));vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);color=color*(1.0-u_pattern_transition)+color_b*u_pattern_transition;\n#endif\n#ifdef RENDER_LINE_TRIM_OFFSET\nhighp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=v_uv[2];if (trim_end > trim_start) {highp float start_transition=max(0.0,min(1.0,(line_progress-trim_start)/max(u_trim_fade_range[0],1.0e-9)));highp float end_transition=max(0.0,min(1.0,(trim_end-line_progress)/max(u_trim_fade_range[1],1.0e-9)));highp float transition_factor=min(start_transition,end_transition);color=mix(color,color.a*u_trim_color,transition_factor);}\n#endif\n#ifdef LINE_JOIN_NONE\nhighp float pattern_len=pattern_size/aspect;highp float segment_phase=pattern_len-mod(v_linesofar-v_pattern_data.x+pattern_len,pattern_len);highp float visible_start=segment_phase-step(pattern_len*0.5,segment_phase)*pattern_len;highp float visible_end=floor((v_pattern_data.y-segment_phase)/pattern_len)*pattern_len+segment_phase;visible_end+=step(pattern_len*0.5,v_pattern_data.y-visible_end)*pattern_len;if (v_pattern_data.x < visible_start || v_pattern_data.x >=visible_end) {color=vec4(0.0);}\n#endif\n#ifdef LIGHTING_3D_MODE\ncolor=apply_lighting_with_emission_ground(color,u_emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);\n#ifdef ELEVATED_ROADS\ncolor.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);\n#else\ncolor.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ncolor*=(alpha*opacity);if (u_alpha_discard_threshold !=0.0) {if (color.a < u_alpha_discard_threshold) {discard;}}\n#ifdef INDICATOR_CUTOUT\ncolor=applyCutout(color,v_z_offset);\n#endif\nglFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#define scale 0.015873016\nin vec2 a_pos_normal;in vec4 a_data;\n#if defined(ELEVATED) || defined(ELEVATED_ROADS)\nin vec3 a_z_offset_width;\n#endif\n#ifdef RENDER_LINE_TRIM_OFFSET\nin highp vec3 a_packed;\n#endif\nin highp float a_linesofar;\n#ifdef LINE_JOIN_NONE\nin highp vec3 a_pattern_data;out vec2 v_pattern_data;\n#endif\n#ifdef INDICATOR_CUTOUT\nout highp float v_z_offset;\n#endif\nuniform mat4 u_matrix;uniform float u_tile_units_to_pixels;uniform vec2 u_units_to_pixels;uniform mat2 u_pixels_to_tile_units;uniform float u_device_pixel_ratio;uniform float u_width_scale;uniform float u_floor_width_scale;\n#ifdef ELEVATED\nuniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) {\n#ifdef ELEVATION_REFERENCE_SEA\nreturn 0.0;\n#else\nreturn elevation(apos);\n#endif\n}\n#endif\nout vec2 v_normal;out vec2 v_width2;out highp float v_linesofar;out float v_gamma_scale;out float v_width;\n#ifdef RENDER_LINE_TRIM_OFFSET\nout highp vec3 v_uv;\n#endif\n#ifdef ELEVATED_ROADS\nout highp float v_road_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\n#pragma mapbox: define mediump float blur\n#pragma mapbox: define mediump float opacity\n#pragma mapbox: define mediump float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define mediump float floorwidth\n#pragma mapbox: define mediump vec4 pattern\n#ifdef LINE_PATTERN_TRANSITION\n#pragma mapbox: define mediump vec4 pattern_b\n#endif\n#pragma mapbox: define mediump float pixel_ratio\nvoid main() {\n#pragma mapbox: initialize mediump float blur\n#pragma mapbox: initialize mediump float opacity\n#pragma mapbox: initialize mediump float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize mediump float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern\n#ifdef LINE_PATTERN_TRANSITION\n#pragma mapbox: initialize mediump vec4 pattern_b\n#endif\n#pragma mapbox: initialize mediump float pixel_ratio\nfloat a_z_offset;\n#if defined(ELEVATED) || defined(ELEVATED_ROADS)\na_z_offset=a_z_offset_width.x;\n#endif\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);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=(u_width_scale*width)/2.0;offset=-1.0*offset*u_width_scale;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);vec2 dist=outset*a_extrude*scale;float u=0.5*a_direction;float t=1.0-abs(u);vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float hidden=float(opacity==0.0);vec2 extrude=dist*u_pixels_to_tile_units;vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy;\n#ifdef ELEVATED_ROADS\nv_road_z_offset=a_z_offset;gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,a_z_offset,1.0)+projected_extrude;\n#else\n#ifdef ELEVATED\nvec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0;\n#ifdef CROSS_SLOPE_VERTICAL\nfloat top=a_pos_normal.y-2.0*floor(a_pos_normal.y*0.5);float line_height=2.0*u_tile_to_meter*outset*top*u_pixels_to_tile_units[1][1]+a_z_offset;ele=sample_elevation(offset_pos)+line_height;projected_extrude=vec4(0);\n#else\n#ifdef CROSS_SLOPE_HORIZONTAL\nfloat ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,max(ele1,ele2));ele=ele_max+a_z_offset;\n#else\nfloat ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,0.5*(ele1+ele2));ele=ele_max-ele0+ele1+a_z_offset;\n#endif\n#endif\ngl_Position=u_matrix*vec4(offset_pos,ele,1.0)+projected_extrude;float z=clamp(gl_Position.z/gl_Position.w,0.5,1.0);float zbias=max(0.00005,(pow(z,0.8)-z)*u_zbias_factor*u_exaggeration);gl_Position.z-=(gl_Position.w*zbias);gl_Position=mix(gl_Position,AWAY,hidden);\n#else\ngl_Position=mix(u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude,AWAY,hidden);\n#endif\n#endif\n#ifdef ELEVATED_ROADS\n#ifdef RENDER_SHADOWS\nvec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos;\n#ifdef NORMAL_OFFSET\nvec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#endif\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=mix(extrude_length_without_perspective/extrude_length_with_perspective,1.0,step(0.01,blur));\n#else\nv_gamma_scale=1.0;\n#endif\n#ifdef RENDER_LINE_TRIM_OFFSET\nhighp float a_uv_x=a_packed[0];highp float line_progress=a_packed[2];v_uv=vec3(a_uv_x,0.0,line_progress);\n#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=(floorwidth*u_floor_width_scale);\n#ifdef LINE_JOIN_NONE\nv_width=(floorwidth*u_floor_width_scale)+ANTIALIASING;mediump float pixels_to_tile_units=1.0/u_tile_units_to_pixels;mediump float pixel_ratio_inverse=1.0/pixel_ratio;mediump float aspect=v_width/((pattern.w-pattern.y)*pixel_ratio_inverse);highp float subt_multiple=(pattern.z-pattern.x)*pixel_ratio_inverse*pixels_to_tile_units*aspect*32.0;highp float subt=floor(a_pattern_data.z/subt_multiple)*subt_multiple;float offset_sign=(fract(a_pattern_data.x)-0.5)*4.0;float line_progress_offset=offset_sign*v_width*0.5*pixels_to_tile_units;v_linesofar=(a_pattern_data.z-subt)+a_linesofar+line_progress_offset;v_pattern_data=vec2(a_pattern_data.x+line_progress_offset,a_pattern_data.y);\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n#ifdef INDICATOR_CUTOUT\nv_z_offset=a_z_offset;\n#endif\n}'),raster:Jn('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_raster_array.glsl"\nuniform float u_fade_t;uniform float u_opacity;uniform highp float u_raster_elevation;uniform highp float u_zoom_transition;in vec2 v_pos0;in vec2 v_pos1;in float v_depth;\n#ifdef PROJECTION_GLOBE_VIEW\nin float v_split_fade;\n#endif\nuniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;uniform float u_emissive_strength;\n#ifndef RASTER_ARRAY\nuniform highp sampler2D u_image0;uniform sampler2D u_image1;\n#endif\n#ifdef RASTER_COLOR\nuniform sampler2D u_color_ramp;uniform highp vec4 u_colorization_mix;uniform highp float u_colorization_offset;uniform vec2 u_texture_res;\n#endif\nvoid main() {vec4 color0,color1,color;vec2 value;\n#ifdef RASTER_COLOR\n#ifdef RASTER_ARRAY\n#ifdef RASTER_ARRAY_LINEAR\nvalue=mix(\nraTexture2D_image0_linear(v_pos0,u_texture_res,u_colorization_mix,u_colorization_offset),raTexture2D_image1_linear(v_pos1,u_texture_res,u_colorization_mix,u_colorization_offset),u_fade_t\n);\n#else\nvalue=mix(\nraTexture2D_image0_nearest(v_pos0,u_texture_res,u_colorization_mix,u_colorization_offset),raTexture2D_image1_nearest(v_pos1,u_texture_res,u_colorization_mix,u_colorization_offset),u_fade_t\n);\n#endif\nif (value.y > 0.0) value.x/=value.y;\n#else\ncolor=mix(texture(u_image0,v_pos0),texture(u_image1,v_pos1),u_fade_t);value=vec2(u_colorization_offset+dot(color.rgb,u_colorization_mix.rgb),color.a);\n#endif\ncolor=texture(u_color_ramp,vec2(value.x,0.5));if (color.a > 0.0) color.rgb/=color.a;color.a*=value.y;\n#else\ncolor0=texture(u_image0,v_pos0);color1=texture(u_image1,v_pos1);if (color0.a > 0.0) color0.rgb/=color0.a;if (color1.a > 0.0) color1.rgb/=color1.a;color=mix(color0,color1,u_fade_t);\n#endif\ncolor.a*=u_opacity;\n#ifdef GLOBE_POLES\ncolor.a*=1.0-smoothstep(0.0,0.05,u_zoom_transition);\n#endif\nvec3 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 LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),u_emissive_strength).rgb;\n#endif\n#ifdef FOG\nhighp float fog_limit_high_meters=1000000.0;highp float fog_limit_low_meters=600000.0;float fog_limit=1.0-smoothstep(fog_limit_low_meters,fog_limit_high_meters,u_raster_elevation);out_color=fog_dither(fog_apply(out_color,v_fog_pos,fog_limit));\n#endif\nglFragColor=vec4(out_color*color.a,color.a);\n#ifdef PROJECTION_GLOBE_VIEW\nglFragColor*=mix(1.0,1.0-smoothstep(0.0,0.05,u_zoom_transition),smoothstep(0.8,0.9,v_split_fade));\n#endif\n#ifdef RENDER_CUTOFF\nglFragColor=glFragColor*cutoff_opacity(u_cutoff_params,v_depth);\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform mat3 u_grid_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform vec2 u_perspective_transform;uniform vec2 u_texture_offset;uniform float u_raster_elevation;uniform float u_zoom_transition;uniform vec2 u_merc_center;\n#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8\n#ifdef GLOBE_POLES\nin vec3 a_globe_pos;in vec2 a_uv;\n#else\nin vec2 a_pos;in vec2 a_texture_pos;\n#endif\nout vec2 v_pos0;out vec2 v_pos1;out float v_depth;\n#ifdef PROJECTION_GLOBE_VIEW\nout float v_split_fade;\n#endif\nvoid main() {vec2 uv;\n#ifdef GLOBE_POLES\nvec3 globe_pos=a_globe_pos;globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;gl_Position=u_matrix*u_globe_matrix*vec4(globe_pos ,1.0);uv=a_uv;\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(a_globe_pos,1.0)).xyz);\n#endif\n#else\nfloat w=1.0+dot(a_texture_pos,u_perspective_transform);uv=a_texture_pos/8192.0;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);vec3 globe_pos=latLngToECEF(latLng.xy);globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);float mercatorY=mercatorYfromLat(latLng[0]);float mercatorX=mercatorXfromLng(latLng[1]); \nv_split_fade=0.0;if (u_zoom_transition > 0.0) {vec2 merc_pos=vec2(mercatorX,mercatorY);merc_world_pos=vec4(merc_pos,u_raster_elevation,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;float opposite_merc_center=mod(u_merc_center.x+0.5,1.0);float dist_from_poles=(abs(mercatorY-0.5)*2.0);float range=0.1;v_split_fade=abs(opposite_merc_center-mercatorX);v_split_fade=clamp(1.0-v_split_fade,0.0,1.0);v_split_fade=max(smoothstep(1.0-range,1.0,dist_from_poles),max(smoothstep(1.0-range,1.0,v_split_fade),smoothstep(1.0-range,1.0,1.0-v_split_fade)));}float tiles=u_grid_matrix[0][2];if (tiles > 0.0) {float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];float uvY=mercatorY*tiles-idy;float uvX=mercatorX*tiles-idx;uv=vec2(uvX,uvY);}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition)*w,w);gl_Position=u_matrix*interpolated_pos;\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);\n#endif\n#else\ngl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n#endif\n#endif\nv_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;v_pos0=u_texture_offset.x+u_texture_offset.y*v_pos0;v_pos1=u_texture_offset.x+u_texture_offset.y*v_pos1;\n#ifdef RENDER_CUTOFF\nv_depth=gl_Position.z;\n#endif\n}'),rasterParticle:Jn('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform float u_fade_t;uniform float u_opacity;uniform highp float u_raster_elevation;in vec2 v_pos0;in vec2 v_pos1;uniform sampler2D u_image0;uniform sampler2D u_image1;void main() {vec4 color0,color1,color;color0=texture(u_image0,v_pos0);color1=texture(u_image1,v_pos1);if (color0.a > 0.0) color0.rgb/=color0.a;if (color1.a > 0.0) color1.rgb/=color1.a;color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 out_color=color.rgb;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),0.0).rgb;\n#endif\n#ifdef FOG\nhighp float fog_limit_high_meters=1000000.0;highp float fog_limit_low_meters=600000.0;float fog_limit=1.0-smoothstep(fog_limit_low_meters,fog_limit_high_meters,u_raster_elevation);out_color=fog_dither(fog_apply(out_color,v_fog_pos,fog_limit));\n#endif\nglFragColor=vec4(out_color*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform mat3 u_grid_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_raster_elevation;uniform float u_zoom_transition;uniform vec2 u_merc_center;\n#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8\nin vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {float w=1.0;vec2 uv;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float mercatorX=mercatorXfromLng(latLng[1]);float tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];float uvX=mercatorX*tiles-idx;float uvY=mercatorY*tiles-idy;uv=vec2(uvX,uvY);vec3 globe_pos=latLngToECEF(latLng.xy);globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {vec2 merc_pos=vec2(mercatorX,mercatorY);merc_world_pos=vec4(merc_pos,u_raster_elevation,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition)*w,w);gl_Position=u_matrix*interpolated_pos;\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);\n#endif\n#else\nuv=a_texture_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n#endif\nv_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}'),rasterParticleDraw:Jn("uniform sampler2D u_color_ramp;in float v_particle_speed;void main() {glFragColor=texture(u_color_ramp,vec2(v_particle_speed,0.5));}",'#include "_prelude_raster_particle.glsl"\nin float a_index;uniform sampler2D u_particle_texture;uniform float u_particle_texture_side_len;uniform vec2 u_tile_offset;out float v_particle_speed;void main() {ivec2 pixel_coord=ivec2(\nmod(a_index,u_particle_texture_side_len),a_index/u_particle_texture_side_len);vec4 pixel=texelFetch(u_particle_texture,pixel_coord,0);vec2 pos=unpack_pos_from_rgba(pixel)+u_tile_offset;vec2 tex_coord=fract(pos);vec2 velocity=lookup_velocity(tex_coord);if (velocity==INVALID_VELOCITY) {gl_Position=AWAY;v_particle_speed=0.0;} else {gl_Position=vec4(2.0*pos-1.0,0,1);v_particle_speed=length(velocity);}gl_PointSize=1.0;}'),rasterParticleTexture:Jn("uniform sampler2D u_texture;uniform float u_opacity;in vec2 v_tex_pos;void main() {vec4 color=texture(u_texture,v_tex_pos);glFragColor=vec4(floor(255.0*color*u_opacity)/255.0);}","in vec2 a_pos;out vec2 v_tex_pos;void main() {vec2 uv=0.5*a_pos+vec2(0.5);v_tex_pos=uv;gl_Position=vec4(a_pos,0.0,1.0);}"),rasterParticleUpdate:Jn('#include "_prelude_raster_particle.glsl"\nuniform sampler2D u_particle_texture;uniform mediump float u_particle_texture_side_len;uniform mediump float u_speed_factor;uniform highp float u_reset_rate;uniform highp float u_rand_seed;in highp vec2 v_tex_coord;vec2 linearstep(vec2 edge0,vec2 edge1,vec2 x) {return clamp((x-edge0)/(edge1-edge0),vec2(0),vec2(1));}const highp vec3 rand_constants=vec3(12.9898,78.233,4375.85453);highp float rand(const highp vec2 co) {highp float t=dot(rand_constants.xy,co);return fract(sin(t)*(rand_constants.z+t));}void main() {ivec2 pixel_coord=ivec2(v_tex_coord*u_particle_texture_side_len);highp vec4 pixel=texelFetch(u_particle_texture,pixel_coord,0);highp vec2 pos=unpack_pos_from_rgba(pixel);highp vec2 velocity=lookup_velocity(clamp(pos,0.0,1.0));highp vec2 dp=velocity==INVALID_VELOCITY ? vec2(0) : velocity*u_speed_factor;pos=pos+dp;highp vec2 seed=(pos+v_tex_coord)*u_rand_seed;highp vec2 random_pos=vec2(rand(seed+1.3),rand(seed+2.1));highp vec2 persist_rate=pow(\nlinearstep(vec2(-u_particle_pos_offset),vec2(0),pos)*linearstep(vec2(1.0+u_particle_pos_offset),vec2(1),pos),vec2(4)\n);highp vec2 per_frame_persist=pow(persist_rate,abs(dp)/u_particle_pos_offset);highp float drop_rate=1.0-per_frame_persist.x*per_frame_persist.y;drop_rate=any(greaterThanEqual(abs(pos-0.5),vec2(0.5+u_particle_pos_offset))) ? 1.0 : drop_rate;highp float drop=step(1.0-drop_rate-u_reset_rate,rand(seed));highp vec2 next_pos=mix(pos,random_pos,drop);glFragColor=pack_pos_to_rgba(next_pos);}',"in vec2 a_pos;out vec2 v_tex_coord;void main() {v_tex_coord=0.5*(a_pos+vec2(1.0));gl_Position=vec4(a_pos,0.0,1.0);}"),symbol:Jn('#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;uniform bool u_is_halo;uniform lowp float u_scale_factor;\n#ifdef ICON_TRANSITION\nuniform float u_icon_transition;\n#endif\n#ifdef COLOR_ADJUSTMENT\nuniform mat4 u_color_adj_mat;\n#endif\n#ifdef INDICATOR_CUTOUT\nin highp float v_z_offset;\n#else\n#ifdef RENDER_SHADOWS\nin highp float v_z_offset;\n#endif\n#endif\nin vec2 v_tex_a;\n#ifdef ICON_TRANSITION\nin vec2 v_tex_b;\n#endif\nin float v_draw_halo;in vec3 v_gamma_scale_size_fade_opacity;\n#ifdef RENDER_TEXT_AND_SYMBOL\nin float is_sdf;in vec2 v_tex_a_icon;\n#endif\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\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\n#pragma mapbox: define lowp float emissive_strength\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\n#pragma mapbox: initialize lowp float emissive_strength\nvec4 out_color;float fade_opacity=v_gamma_scale_size_fade_opacity[2];\n#ifdef RENDER_TEXT_AND_SYMBOL\nif (is_sdf==ICON) {vec2 tex_icon=v_tex_a_icon;lowp float alpha=opacity*fade_opacity;glFragColor=texture(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nreturn;}\n#endif\n#ifdef RENDER_SDF\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_gamma_scale_size_fade_opacity.x;float size=v_gamma_scale_size_fade_opacity.y;float fontScale=u_is_text ? size/24.0 : size;out_color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;bool draw_halo=v_draw_halo > 0.0;if (draw_halo) {out_color=halo_color;gamma=(halo_blur*u_scale_factor*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width*u_scale_factor/fontScale)/SDF_PX;}lowp float dist=texture(u_texture,v_tex_a).r;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);out_color*=alpha;\n#else\n#ifdef ICON_TRANSITION\nvec4 a=texture(u_texture,v_tex_a)*(1.0-u_icon_transition);vec4 b=texture(u_texture,v_tex_b)*u_icon_transition;out_color=(a+b);\n#else\nout_color=texture(u_texture,v_tex_a);\n#endif\n#ifdef COLOR_ADJUSTMENT\nout_color=u_color_adj_mat*out_color;\n#endif\n#endif\nout_color*=opacity*fade_opacity;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);\n#ifdef TERRAIN\nout_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#else\nout_color.rgb*=mix(v_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);\n#endif\n#endif\n#endif\n#ifdef INDICATOR_CUTOUT\nout_color=applyCutout(out_color,v_z_offset);\n#endif\n#ifdef FEATURE_CUTOUT\nout_color=apply_feature_cutout(out_color,gl_FragCoord);\n#endif\nglFragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_terrain.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nin vec4 a_pos_offset;in vec4 a_tex_size;in vec4 a_pixeloffset;in vec4 a_projected_pos;in float a_fade_opacity;\n#ifdef Z_OFFSET\nin float a_auto_z_offset;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_globe_anchor;in vec3 a_globe_normal;\n#endif\n#ifdef ICON_TRANSITION\nin vec2 a_texb;\n#endif\n#ifdef OCCLUSION_QUERIES\nin float a_occlusion_query_opacity;\n#endif\n#ifdef ELEVATED_ROADS\nin vec3 a_x_axis;in vec3 a_y_axis;uniform float u_normal_scale;\n#endif\n#ifdef INDICATOR_CUTOUT\nout highp float v_z_offset;\n#else\n#ifdef RENDER_SHADOWS\nout highp float v_z_offset;\n#endif\n#endif\nuniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_elevation_from_sea;uniform bool u_pitch_with_map;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec3 u_up_vector;uniform vec2 u_texsize_icon;uniform bool u_is_halo;\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix;\n#endif\nout vec2 v_tex_a;\n#ifdef ICON_TRANSITION\nout vec2 v_tex_b;\n#endif\nout float v_draw_halo;out vec3 v_gamma_scale_size_fade_opacity;\n#ifdef RENDER_TEXT_AND_SYMBOL\nout float is_sdf;out vec2 v_tex_a_icon;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\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\n#pragma mapbox: define lowp float emissive_strength\n#pragma mapbox: define lowp float occlusion_opacity\n#pragma mapbox: define lowp float z_offset\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\n#pragma mapbox: initialize lowp float emissive_strength\n#pragma mapbox: initialize lowp float occlusion_opacity\n#pragma mapbox: initialize lowp float z_offset\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_min_font_scale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[3];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;float e=u_elevation_from_sea ? z_offset : z_offset+elevation(tile_anchor);\n#ifdef Z_OFFSET\ne+=a_auto_z_offset;\n#endif\nvec3 h=elevationVector(tile_anchor)*e;float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;vec3 world_pos_globe;\n#ifdef PROJECTION_GLOBE_VIEW\nmercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos_globe=a_globe_anchor+h;world_pos=mix_globe_mercator(world_pos_globe,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0;\n#else\nworld_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;\n#endif\nvec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float font_scale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetprojected_point;vec2 a;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);offsetprojected_point=u_matrix*vec4(a_globe_anchor+displacement,1);vec4 projected_point_globe=u_matrix*vec4(world_pos_globe,1);a=projected_point_globe.xy/projected_point_globe.w;\n#else\noffsetprojected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);a=projected_point.xy/projected_point.w;\n#endif\nvec2 b=offsetprojected_point.xy/offsetprojected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos;\n#ifdef PROJECTION_GLOBE_VIEW\n#ifdef PROJECTED_POS_ON_VIEWPORT\nprojected_pos=u_label_plane_matrix*vec4(a_projected_pos.xyz+h,1.0);\n#else\nvec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz,mercator_pos,u_zoom_transition)+h;projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0); \n#endif\n#else\nprojected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);\n#endif\nhighp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*max(a_min_font_scale,font_scale)+a_pxoffset/16.0);\n#ifdef TERRAIN\n#ifdef PITCH_WITH_MAP_TERRAIN\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\n#endif\n#endif\n#ifdef Z_OFFSET\nz+=u_pitch_with_map ? a_auto_z_offset+z_offset : 0.0;\n#else\nz+=u_pitch_with_map ? z_offset : 0.0;\n#endif\nfloat occlusion_fade=globe_occlusion_fade;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float out_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));\n#ifdef DEPTH_OCCLUSION\nfloat depth_occlusion=occlusionFadeMultiSample(projected_point);float depth_occlusion_multplier=mix(occlusion_opacity,1.0,depth_occlusion);out_fade_opacity*=depth_occlusion_multplier;\n#endif\n#ifdef OCCLUSION_QUERIES\nfloat occludedFadeMultiplier=mix(occlusion_opacity,1.0,a_occlusion_query_opacity);out_fade_opacity*=occludedFadeMultiplier;\n#endif\nfloat alpha=opacity*out_fade_opacity;float hidden=float(alpha==0.0 || projected_point.w <=0.0 || occlusion_fade==0.0);vec3 pos;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);pos=projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y;\n#else\n#ifdef ELEVATED_ROADS\nvec3 xAxis=vec3(a_x_axis.xy,a_x_axis.z*u_normal_scale);vec3 yAxis=vec3(a_y_axis.xy,a_y_axis.z*u_normal_scale);pos=projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y;\n#else\npos=vec3(projected_pos.xy/projected_pos.w+offset,z);\n#endif\n#endif\ngl_Position=mix(u_coord_matrix*vec4(pos,1.0),AWAY,hidden);float gamma_scale=gl_Position.w;v_draw_halo=(u_is_halo && float(gl_InstanceID)==0.0) ? 1.0 : 0.0;v_gamma_scale_size_fade_opacity=vec3(gamma_scale,size,out_fade_opacity);v_tex_a=a_tex/u_texsize;\n#ifdef RENDER_TEXT_AND_SYMBOL\nis_sdf=a_size[0]-2.0*a_size_min;v_tex_a_icon=a_tex/u_texsize_icon;\n#endif\n#ifdef ICON_TRANSITION\nv_tex_b=a_texb/u_texsize;\n#endif\n#ifdef RENDER_SHADOWS\nvec4 shd_pos=u_inv_matrix*vec4(pos,1.0);vec3 shd_pos0=shd_pos.xyz;vec3 shd_pos1=shd_pos.xyz;\n#ifdef NORMAL_OFFSET\nvec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#ifdef INDICATOR_CUTOUT\nv_z_offset=e;\n#else\n#ifdef RENDER_SHADOWS\nv_z_offset=e;\n#endif\n#endif\n}'),terrainRaster:Jn('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform sampler2D u_image0;in vec2 v_pos0;\n#ifdef FOG\nin float v_fog_opacity;\n#endif\n#ifdef RENDER_SHADOWS\nin vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;\n#endif\nuniform vec3 u_ground_shadow_factor;void main() {vec4 image_color=texture(u_image0,v_pos0);vec4 color;\n#ifdef LIGHTING_3D_MODE\nconst vec3 normal=vec3(0.0,0.0,1.0);\n#ifdef RENDER_SHADOWS\nfloat cutoffOpacity=1.0;\n#ifdef RENDER_CUTOFF\ncutoffOpacity=cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w);\n#endif\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\nvec3 unlit_base=image_color.rgb*(1.0-image_color.a);vec3 emissive_base=image_color.rgb*image_color.a;float ndotl=u_shadow_direction.z;float occlusion=ndotl < 0.0 ? 1.0 : shadow_occlusion(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,0.0);ndotl=max(0.0,ndotl);vec3 lit=apply_lighting(unlit_base,normal,mix(1.0,(1.0-(u_shadow_intensity*occlusion))*ndotl,cutoffOpacity));vec3 emissive=compute_emissive_draped(emissive_base,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=lit+emissive;color.a=1.0;\n#else\nfloat lighting_factor=shadowed_light_factor_normal_unbiased(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);color=apply_lighting(image_color,normal,mix(1.0,lighting_factor,cutoffOpacity));\n#endif\n#else\nfloat lighting_factor=u_lighting_directional_dir.z;color=apply_lighting(image_color,normal,lighting_factor);\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\ncolor.rgb=mix(color.rgb,image_color.rgb,image_color.a);color.a=1.0;\n#endif\n#endif\n#else\ncolor=image_color;\n#endif\n#ifdef FOG\n#ifdef ZERO_EXAGGERATION\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#else\ncolor=fog_dither(fog_apply_from_vert(color,v_fog_opacity));\n#endif\n#endif\nglFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\nuniform mat4 u_matrix;uniform float u_skirt_height;in vec2 a_pos;out vec2 v_pos0;\n#ifdef FOG\nout float v_fog_opacity;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1;\n#endif\nvoid main() {vec3 decomposedPosAndSkirt=decomposeToPosAndSkirt(a_pos);float skirt=decomposedPosAndSkirt.z;vec2 decodedPos=decomposedPosAndSkirt.xy;float elevation=elevation(decodedPos)-skirt*u_skirt_height;v_pos0=decodedPos/8192.0;gl_Position=u_matrix*vec4(decodedPos,elevation,1.0);\n#ifdef FOG\n#ifdef ZERO_EXAGGERATION\nv_fog_pos=fog_position(decodedPos);\n#else\nv_fog_opacity=fog(fog_position(vec3(decodedPos,elevation)));\n#endif\n#endif\n#ifdef RENDER_SHADOWS\nvec3 pos=vec3(decodedPos,elevation);v_pos_light_view_0=u_light_matrix_0*vec4(pos,1.);v_pos_light_view_1=u_light_matrix_1*vec4(pos,1.);\n#endif\n}'),terrainDepth:Jn("precision highp float;in float v_depth;void main() {glFragColor=pack_depth(v_depth);}",'#include "_prelude_terrain.vertex.glsl"\nuniform mat4 u_matrix;in vec2 a_pos;out float v_depth;void main() {float elevation=elevation(a_pos);gl_Position=u_matrix*vec4(a_pos,elevation,1.0);v_depth=gl_Position.z/gl_Position.w;}'),skybox:Jn('#include "_prelude_fog.fragment.glsl"\nin 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=texture(u_cubemap,uv).rgb;\n#ifdef FOG\nsky_color=fog_apply_sky_gradient(v_uv.xzy,sky_color);\n#endif\nsky_color+=0.1*sun_disk(v_uv,u_sun_direction);glFragColor=vec4(sky_color*u_opacity,u_opacity);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\n}',zn),skyboxGradient:Jn('#include "_prelude_fog.fragment.glsl"\nin 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=texture(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;glFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\n}',zn),skyboxCapture:Jn("\nin 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;precision highp float;\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;glFragColor=vec4(color,1.0);}","in highp vec3 a_pos_3f;uniform mat3 u_matrix_3f;out highp vec3 v_position;float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec4 pos=vec4(u_matrix_3f*a_pos_3f,1.0);v_position=pos.xyz;v_position.y*=-1.0;v_position.y=map(v_position.y,-1.0,1.0,0.0,1.0);gl_Position=vec4(a_pos_3f.xy,0.0,1.0);}"),globeRaster:Jn('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform sampler2D u_image0;uniform float u_far_z_cutoff;in vec2 v_pos0;\n#ifndef FOG\nuniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform vec2 u_viewport;\n#endif\nvoid main() {vec4 color;\n#ifdef CUSTOM_ANTIALIASING\nhighp vec2 uv=gl_FragCoord.xy/u_viewport;\n#ifdef FLIP_Y\nuv.y=1.0-uv.y;\n#endif\nhighp vec3 ray_dir=mix(\nmix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float norm_dist_from_center=1.0-length(closest_point-u_globe_pos)/u_globe_radius;const float antialias_pixel=2.0;highp float antialias_factor=antialias_pixel*fwidth(norm_dist_from_center);highp float antialias=smoothstep(0.0,antialias_factor,norm_dist_from_center);vec4 raster=texture(u_image0,v_pos0);\n#ifdef LIGHTING_3D_MODE\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\nraster=apply_lighting_with_emission_ground(raster,raster.a);color=vec4(clamp(raster.rgb,vec3(0),vec3(1))*antialias,antialias);\n#else\nraster=apply_lighting_ground(raster);color=vec4(raster.rgb*antialias,raster.a*antialias);\n#endif\n#else\ncolor=vec4(raster.rgb*antialias,raster.a*antialias);\n#endif\n#else\ncolor=texture(u_image0,v_pos0);\n#ifdef LIGHTING_3D_MODE\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\ncolor=apply_lighting_with_emission_ground(color,color.a);color.a=1.0;\n#else\ncolor=apply_lighting_ground(color);\n#endif\n#endif\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ncolor*=1.0-step(u_far_z_cutoff,1.0/gl_FragCoord.w);glFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\nuniform mat4 u_proj_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform float u_zoom_transition;uniform vec2 u_merc_center;uniform mat3 u_grid_matrix;uniform float u_skirt_height;\n#ifdef GLOBE_POLES\nin vec3 a_globe_pos;in vec2 a_uv;\n#else\nin vec2 a_pos;\n#endif\nout vec2 v_pos0;void main() {\n#ifdef GLOBE_POLES\nvec3 globe_pos=a_globe_pos;vec2 uv=a_uv;\n#else\nfloat tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float uvY=mercatorY*tiles-idy;float mercatorX=mercatorXfromLng(latLng[1]);float uvX=mercatorX*tiles-idx;vec3 globe_pos=latLngToECEF(latLng.xy);vec2 merc_pos=vec2(mercatorX,mercatorY);vec2 uv=vec2(uvX,uvY);\n#endif\nv_pos0=uv;vec2 tile_pos=uv*EXTENT;vec3 globe_derived_up_vector=normalize(globe_pos)*u_tile_up_scale;\n#ifdef GLOBE_POLES\nvec3 up_vector=globe_derived_up_vector;\n#else\nvec3 up_vector=elevationVector(tile_pos);\n#endif\nfloat height=elevation(tile_pos);globe_pos+=up_vector*height;\n#ifndef GLOBE_POLES\nglobe_pos-=globe_derived_up_vector*u_skirt_height*decomposed_pos_and_skirt.z;\n#endif\n#ifdef GLOBE_POLES\nvec4 interpolated_pos=u_globe_matrix*vec4(globe_pos,1.0);\n#else\nvec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {merc_world_pos=vec4(merc_pos,height-u_skirt_height*decomposed_pos_and_skirt.z,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition),1.0);\n#endif\ngl_Position=u_proj_matrix*interpolated_pos;\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);\n#endif\n}'),globeAtmosphere:Jn('#include "_prelude_fog.fragment.glsl"\nuniform float u_transition;uniform highp float u_fadeout_range;uniform highp float u_temporal_offset;uniform vec4 u_color;uniform vec4 u_high_color;uniform vec4 u_space_color;uniform float u_horizon_angle;in highp vec3 v_ray_dir;in highp vec3 v_horizon_dir;void main() {highp vec3 dir=normalize(v_ray_dir);float globe_pos_dot_dir;\n#ifdef PROJECTION_GLOBE_VIEW\nglobe_pos_dot_dir=dot(u_globe_pos,dir);highp vec3 closest_point_forward=abs(globe_pos_dot_dir)*dir;float norm_dist_from_center=length(closest_point_forward-u_globe_pos)/u_globe_radius;if (norm_dist_from_center < 0.98) {\n#ifdef ALPHA_PASS\nglFragColor=vec4(0,0,0,0);return;\n#else\n#ifdef NATIVE\nglFragColor=vec4(1,1,1,1);\n#else\nglFragColor=vec4(0,0,0,1);\n#endif\nreturn;\n#endif\n}\n#endif\nhighp vec3 horizon_dir=normalize(v_horizon_dir);float horizon_angle_mercator=dir.y < horizon_dir.y ?\n0.0 : max(acos(clamp(dot(dir,horizon_dir),-1.0,1.0)),0.0);float horizon_angle;\n#ifdef PROJECTION_GLOBE_VIEW\nhighp vec3 closest_point=globe_pos_dot_dir*dir;highp float closest_point_to_center=length(closest_point-u_globe_pos);highp float theta=asin(clamp(closest_point_to_center/length(u_globe_pos),-1.0,1.0));horizon_angle=globe_pos_dot_dir < 0.0 ?\nPI-theta-u_horizon_angle : theta-u_horizon_angle;float angle_t=pow(u_transition,10.0);horizon_angle=mix(horizon_angle,horizon_angle_mercator,angle_t);\n#else\nhorizon_angle=horizon_angle_mercator;\n#endif\nhorizon_angle/=PI;float t=exp(-horizon_angle/u_fadeout_range);float alpha_0=u_color.a;float alpha_1=u_high_color.a;float alpha_2=u_space_color.a;vec3 color_stop_0=u_color.rgb;vec3 color_stop_1=u_high_color.rgb;vec3 color_stop_2=u_space_color.rgb;\n#ifdef ALPHA_PASS\nfloat a0=mix(alpha_2,1.0,alpha_1);float a1=mix(a0,1.0,alpha_0);float a2=mix(a0,a1,t);float a =mix(alpha_2,a2,t);glFragColor=vec4(1.0,1.0,1.0,a);\n#else\nvec3 c0=mix(color_stop_2,color_stop_1,alpha_1);vec3 c1=mix(c0,color_stop_0,alpha_0);vec3 c2=mix(c0,c1,t);vec3 c=c2;glFragColor=vec4(c*t,t);\n#endif\n}',"in vec3 a_pos;in vec2 a_uv;uniform vec3 u_frustum_tl;uniform vec3 u_frustum_tr;uniform vec3 u_frustum_br;uniform vec3 u_frustum_bl;uniform float u_horizon;out highp vec3 v_ray_dir;out highp vec3 v_horizon_dir;void main() {v_ray_dir=mix(\nmix(u_frustum_tl,u_frustum_tr,a_uv.x),mix(u_frustum_bl,u_frustum_br,a_uv.x),a_uv.y);v_horizon_dir=mix(\nmix(u_frustum_tl,u_frustum_bl,u_horizon),mix(u_frustum_tr,u_frustum_br,u_horizon),a_uv.x);gl_Position=vec4(a_pos,1.0);}"),model:Jn('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform float u_opacity;uniform vec3 u_lightcolor;uniform vec3 u_lightpos;uniform float u_lightintensity;uniform vec4 u_baseColorFactor;uniform vec4 u_emissiveFactor;uniform float u_metallicFactor;uniform float u_roughnessFactor;uniform float u_emissive_strength;in highp vec4 v_position_height;in lowp vec4 v_color_mix;\n#ifdef RENDER_SHADOWS\nin highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth_shadows;\n#endif\n#ifdef OCCLUSION_TEXTURE_TRANSFORM\nuniform vec4 u_occlusionTextureTransform;\n#endif\n#pragma mapbox: define-attribute highp vec3 normal_3f\n#pragma mapbox: define-attribute highp vec3 color_3f\n#pragma mapbox: define-attribute highp vec4 color_4f\n#pragma mapbox: define-attribute highp vec2 uv_2f\n#pragma mapbox: initialize-attribute highp vec3 normal_3f\n#pragma mapbox: initialize-attribute highp vec3 color_3f\n#pragma mapbox: initialize-attribute highp vec4 color_4f\n#pragma mapbox: initialize-attribute highp vec2 uv_2f\n#ifdef HAS_ATTRIBUTE_a_pbr\nin lowp vec4 v_roughness_metallic_emissive_alpha;in mediump vec4 v_height_based_emission_params;\n#endif\n#ifdef HAS_TEXTURE_u_baseColorTexture\nuniform sampler2D u_baseColorTexture;uniform bool u_baseTextureIsAlpha;uniform bool u_alphaMask;uniform float u_alphaCutoff;\n#endif\n#ifdef HAS_TEXTURE_u_metallicRoughnessTexture\nuniform sampler2D u_metallicRoughnessTexture;\n#endif\n#ifdef HAS_TEXTURE_u_occlusionTexture\nuniform sampler2D u_occlusionTexture;uniform float u_aoIntensity;\n#endif\n#ifdef HAS_TEXTURE_u_normalTexture\nuniform sampler2D u_normalTexture;\n#endif\n#ifdef HAS_TEXTURE_u_emissionTexture\nuniform sampler2D u_emissionTexture;\n#endif\n#ifdef APPLY_LUT_ON_GPU\nuniform highp sampler3D u_lutTexture;\n#endif\n#ifdef TERRAIN_FRAGMENT_OCCLUSION\nin highp float v_depth;uniform highp sampler2D u_depthTexture;uniform highp vec2 u_inv_depth_size;uniform highp vec2 u_depth_range_unpack;\n#ifdef DEPTH_D24\nhighp float unpack_depth(highp float depth) {return depth*u_depth_range_unpack.x+u_depth_range_unpack.y;}\n#else\nhighp float unpack_depth_rgba(highp vec4 rgba_depth)\n{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}\n#endif\nbool isOccluded() {highp vec2 coord=gl_FragCoord.xy*u_inv_depth_size;\n#ifdef DEPTH_D24\nhighp float depth=unpack_depth(texture(u_depthTexture,coord).r);\n#else\nhighp float depth=unpack_depth_rgba(texture(u_depthTexture,coord));\n#endif\nreturn v_depth > depth+0.0005;}\n#endif\n#define saturate(_x) clamp(_x,0.,1.)\nvec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}float calculate_NdotL(vec3 normal,vec3 lightDir) {const float ext=0.70710678118;return (clamp(dot(normal,lightDir),-ext,1.0)+ext)/(1.0+ext);}vec3 getDiffuseShadedColor(vec3 albedo,vec3 normal,vec3 lightDir,vec3 lightColor)\n{\n#ifdef LIGHTING_3D_MODE\nvec3 transformed_normal=vec3(-normal.xy,normal.z);float lighting_factor;\n#ifdef RENDER_SHADOWS\nlighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);\n#else\nlighting_factor=saturate(dot(transformed_normal,u_lighting_directional_dir));\n#endif\nreturn apply_lighting(albedo,transformed_normal,lighting_factor);\n#else\nvec3 n=normal;float colorvalue=((albedo.x*0.2126)+(albedo.y*0.7152))+(albedo.z*0.0722);vec3 c=vec3(0.03,0.03,0.03);float directional=clamp(dot(n,vec3(lightDir)),0.0,1.0);directional=mix(1.0-u_lightintensity,max((1.0-colorvalue)+u_lightintensity,1.0),directional);vec3 c3=c+clamp((albedo*directional)*lightColor,mix(vec3(0.0),vec3(0.3),vec3(1.0)-lightColor),vec3(1.0));return c3;\n#endif\n}vec4 getBaseColor() {vec4 albedo=u_baseColorFactor;\n#ifdef HAS_ATTRIBUTE_a_color_3f\nalbedo*=vec4(color_3f,1.0);\n#endif\n#ifdef HAS_ATTRIBUTE_a_pbr\n#else\n#ifdef HAS_ATTRIBUTE_a_color_4f\nalbedo*=color_4f;\n#endif\n#endif\n#if defined (HAS_TEXTURE_u_baseColorTexture) && defined (HAS_ATTRIBUTE_a_uv_2f)\nvec4 texColor=texture(u_baseColorTexture,uv_2f);if(u_alphaMask) {if (texColor.w < u_alphaCutoff) {discard;}}\n#ifdef UNPREMULT_TEXTURE_IN_SHADER\nif(texColor.w > 0.0) {texColor.rgb/=texColor.w;}texColor.w=1.0;\n#endif\nif(u_baseTextureIsAlpha) {if (texColor.r < 0.5) {discard;}} else {texColor.rgb=sRGBToLinear(texColor.rgb);albedo*=texColor;}\n#endif\nvec4 color=vec4(mix(albedo.rgb,v_color_mix.rgb,v_color_mix.a),albedo.a);\n#ifdef APPLY_LUT_ON_GPU\ncolor=applyLUT(u_lutTexture,color);\n#endif\nreturn color;}highp mat3 cotangentFrame(highp vec3 N,highp vec3 p,highp vec2 uv ) {\n#ifdef HAS_TEXTURE_u_normalTexture\nhighp vec3 dp1=vec3(dFdx(p.x),dFdx(p.y),dFdx(p.z));highp vec3 dp2=vec3(dFdy(p.x),dFdy(p.y),dFdy(p.z));highp vec2 duv1=vec2(dFdx(uv.x),dFdx(uv.y));highp vec2 duv2=vec2(dFdy(uv.x),dFdy(uv.y));highp vec3 dp2perp=cross( dp2,N );highp vec3 dp1perp=cross( N,dp1 );highp vec3 T=dp2perp*duv1.x+dp1perp*duv2.x;highp vec3 B=dp2perp*duv1.y+dp1perp*duv2.y;\n#ifdef FLIP_Y\nT=-T;B=-B;\n#endif\nhighp float lengthT=dot(T,T);highp float lengthB=dot(B,B);highp float maxLength=max(lengthT,lengthB);highp float invmax=inversesqrt( maxLength );highp mat3 res=mat3( T*invmax,B*invmax,N );return res;\n#else\nreturn mat3(1.0);\n#endif\n}highp vec3 getNormal(){highp vec3 n;\n#ifdef HAS_ATTRIBUTE_a_normal_3f\nn=normalize(normal_3f);\n#else\nhighp vec3 fdx=vec3(dFdx(v_position_height.x),dFdx(v_position_height.y),dFdx(v_position_height.z));highp vec3 fdy=vec3(dFdy(v_position_height.x),dFdy(v_position_height.y),dFdy(v_position_height.z));\n#ifdef FLIP_Y\nn=normalize(cross(fdx,fdy));\n#else\nn=normalize(cross(fdx,fdy))*-1.0;\n#endif\n#endif\n#if defined(HAS_TEXTURE_u_normalTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)\nvec3 nMap=texture( u_normalTexture,uv_2f).xyz;nMap=normalize(2.0*nMap-vec3(1.0));highp vec3 v=normalize(-v_position_height.xyz);highp mat3 TBN=cotangentFrame(n,v,uv_2f);n=normalize(TBN*nMap);\n#endif\nreturn n;}struct Material {float perceptualRoughness;float alphaRoughness;float metallic;vec3 f90;vec4 baseColor;vec3 diffuseColor;vec3 specularColor;highp vec3 normal;};Material getPBRMaterial() {Material mat;mat.baseColor=getBaseColor();mat.perceptualRoughness=u_roughnessFactor;mat.metallic=u_metallicFactor;\n#ifdef HAS_ATTRIBUTE_a_pbr\nmat.perceptualRoughness=v_roughness_metallic_emissive_alpha.x;mat.metallic=v_roughness_metallic_emissive_alpha.y;mat.baseColor.w*=v_roughness_metallic_emissive_alpha.w;\n#endif\n#if defined(HAS_TEXTURE_u_metallicRoughnessTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) \nvec4 mrSample=texture(u_metallicRoughnessTexture,uv_2f);mat.perceptualRoughness*=mrSample.g;mat.metallic*=mrSample.b;\n#endif\nconst float c_minRoughness=0.04;mat.perceptualRoughness=clamp(mat.perceptualRoughness,c_minRoughness,1.0);mat.metallic=saturate(mat.metallic);mat.alphaRoughness=mat.perceptualRoughness*mat.perceptualRoughness;const vec3 f0=vec3(0.04);mat.diffuseColor=mat.baseColor.rgb*(vec3(1.0)-f0);mat.diffuseColor*=1.0-mat.metallic;mat.specularColor=mix(f0,mat.baseColor.rgb,mat.metallic);highp float reflectance=max(max(mat.specularColor.r,mat.specularColor.g),mat.specularColor.b);highp float reflectance90=saturate(reflectance*25.0);mat.f90=vec3(reflectance90);mat.normal=getNormal();return mat;}float V_GGX(float NdotL,float NdotV,float roughness)\n{float a2=roughness*roughness;float GGXV=NdotL*sqrt(NdotV*NdotV*(1.0-a2)+a2);float GGXL=NdotV*sqrt(NdotL*NdotL*(1.0-a2)+a2);return 0.5/(GGXV+GGXL);}float V_GGXFast(float NdotL,float NdotV,float roughness) {float a=roughness;float GGXV=NdotL*(NdotV*(1.0-a)+a);float GGXL=NdotV*(NdotL*(1.0-a)+a);return 0.5/(GGXV+GGXL);}vec3 F_Schlick(vec3 specularColor,vec3 f90,float VdotH)\n{return specularColor+(f90-specularColor)*pow(clamp(1.0-VdotH,0.0,1.0),5.0);}vec3 F_SchlickFast(vec3 specularColor,float VdotH)\n{float x=1.0-VdotH;float x4=x*x*x*x;return specularColor+(1.0-specularColor)*x4*x;}float D_GGX(highp float NdotH,float alphaRoughness)\n{highp float a4=alphaRoughness*alphaRoughness;highp float f=(NdotH*a4-NdotH)*NdotH+1.0;return a4/(PI*f*f);}vec3 diffuseBurley(Material mat,float LdotH,float NdotL,float NdotV)\n{float f90=2.0*LdotH*LdotH*mat.alphaRoughness-0.5;return (mat.diffuseColor/PI)*(1.0+f90*pow((1.0-NdotL),5.0))*(1.0+f90*pow((1.0-NdotV),5.0));}vec3 diffuseLambertian(Material mat)\n{\n#ifdef LIGHTING_3D_MODE\nreturn mat.diffuseColor;\n#else\nreturn mat.diffuseColor/PI;\n#endif\n}vec3 EnvBRDFApprox(vec3 specularColor,float roughness,highp float NdotV)\n{vec4 c0=vec4(-1,-0.0275,-0.572,0.022);vec4 c1=vec4(1,0.0425,1.04,-0.04);highp vec4 r=roughness*c0+c1;highp float a004=min(r.x*r.x,exp2(-9.28*NdotV))*r.x+r.y;vec2 AB=vec2(-1.04,1.04)*a004+r.zw;return specularColor*AB.x+AB.y;}vec3 computeIndirectLightContribution(Material mat,float NdotV,vec3 normal)\n{vec3 env_light=vec3(0.65,0.65,0.65);\n#ifdef LIGHTING_3D_MODE\nfloat ambient_factor=calculate_ambient_directional_factor(normal);env_light=u_lighting_ambient_color*ambient_factor;\n#endif\nvec3 envBRDF=EnvBRDFApprox(mat.specularColor,mat.perceptualRoughness,NdotV);vec3 indirectSpecular= envBRDF*env_light;vec3 indirectDiffuse=mat.diffuseColor*env_light;return indirectSpecular+indirectDiffuse;}vec3 computeLightContribution(Material mat,vec3 lightPosition,vec3 lightColor)\n{highp vec3 n=mat.normal;highp vec3 v=normalize(-v_position_height.xyz);highp vec3 l=normalize(lightPosition);highp vec3 h=normalize(v+l);float NdotV=clamp(abs(dot(n,v)),0.001,1.0);float NdotL=saturate(dot(n,l));highp float NdotH=saturate(dot(n,h));float VdotH=saturate(dot(v,h));vec3 f=F_SchlickFast(mat.specularColor,VdotH);float g=V_GGXFast(NdotL,NdotV,mat.alphaRoughness);float d=D_GGX(NdotH,mat.alphaRoughness);vec3 diffuseTerm=(1.0-f)*diffuseLambertian(mat);vec3 specularTerm=f*g*d;vec3 transformed_normal=vec3(-n.xy,n.z);float lighting_factor;\n#ifdef RENDER_SHADOWS\nlighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);\n#else\nlighting_factor=NdotL;\n#endif\nvec3 directLightColor=(specularTerm+diffuseTerm)*lighting_factor*lightColor;vec3 indirectLightColor=computeIndirectLightContribution(mat,NdotV,transformed_normal);vec3 color=(saturate(directLightColor)+indirectLightColor);float intensityFactor=1.0;\n#if !defined(LIGHTING_3D_MODE)\nconst vec3 luminosityFactor=vec3(0.2126,0.7152,0.0722);float luminance=dot(diffuseTerm,luminosityFactor);intensityFactor=mix((1.0-u_lightintensity),max((1.0-luminance+u_lightintensity),1.0),NdotL);\n#endif\ncolor*=intensityFactor;return color;}void main() {\n#ifdef TERRAIN_FRAGMENT_OCCLUSION\nif (isOccluded()) {discard;}\n#endif\nvec3 lightDir=u_lightpos;vec3 lightColor=u_lightcolor;\n#ifdef LIGHTING_3D_MODE\nlightDir=u_lighting_directional_dir;lightDir.xy=-lightDir.xy;lightColor=u_lighting_directional_color;\n#endif\nvec4 finalColor;\n#ifdef DIFFUSE_SHADED\nvec3 N=getNormal();vec3 baseColor=getBaseColor().rgb;vec3 diffuse=getDiffuseShadedColor(baseColor,N,lightDir,lightColor);\n#ifdef HAS_TEXTURE_u_occlusionTexture\nfloat ao=(texture(u_occlusionTexture,uv_2f).r-1.0)*u_aoIntensity+1.0;diffuse*=ao;\n#endif\nfinalColor=vec4(mix(diffuse,baseColor,u_emissive_strength),1.0)*u_opacity;\n#else\nMaterial mat=getPBRMaterial();vec3 color=computeLightContribution(mat,lightDir,lightColor);float ao=1.0;\n#if defined (HAS_TEXTURE_u_occlusionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)\n#ifdef OCCLUSION_TEXTURE_TRANSFORM\nvec2 uv=uv_2f.xy*u_occlusionTextureTransform.zw+u_occlusionTextureTransform.xy;\n#else\nvec2 uv=uv_2f;\n#endif\nao=(texture(u_occlusionTexture,uv).x-1.0)*u_aoIntensity+1.0;color*=ao;\n#endif\nvec4 emissive=u_emissiveFactor;\n#if defined(HAS_TEXTURE_u_emissionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)\nemissive.rgb*=sRGBToLinear(texture(u_emissionTexture,uv_2f).rgb);\n#endif\n#ifdef APPLY_LUT_ON_GPU\nfloat emissiveFactorLength=max(length(u_emissiveFactor.rgb),0.001);emissive.rgb=sRGBToLinear(applyLUT(u_lutTexture,linearTosRGB(emissive.rgb/emissiveFactorLength).rbg))*emissiveFactorLength;\n#endif\ncolor+=emissive.rgb;float opacity=mat.baseColor.w*u_opacity;\n#ifdef HAS_ATTRIBUTE_a_pbr\nfloat resEmission=v_roughness_metallic_emissive_alpha.z;resEmission*=v_height_based_emission_params.z+v_height_based_emission_params.w*pow(clamp(v_height_based_emission_params.x,0.0,1.0),v_height_based_emission_params.y);vec3 color_mix=v_color_mix.rgb;\n#ifdef APPLY_LUT_ON_GPU\ncolor_mix=applyLUT(u_lutTexture,color_mix);\n#endif\ncolor=mix(color,color_mix,min(1.0,resEmission));\n#ifdef HAS_ATTRIBUTE_a_color_4f\nfloat distance=length(vec2(1.3*max(0.0,abs(color_4f.x)-color_4f.z),color_4f.y));distance+= mix(0.5,0.0,clamp(resEmission-1.0,0.0,1.0));opacity*=v_roughness_metallic_emissive_alpha.w*saturate(1.0-distance*distance);\n#endif\n#endif\nvec3 unlitColor=mat.baseColor.rgb*ao+emissive.rgb;color=mix(color,unlitColor,u_emissive_strength);color=linearTosRGB(color);color*=opacity;finalColor=vec4(color,opacity);\n#endif\n#ifdef FOG\nfinalColor=fog_dither(fog_apply_premultiplied(finalColor,v_fog_pos,v_position_height.w));\n#endif\n#ifdef RENDER_CUTOFF\nfinalColor*=v_cutoff_opacity;\n#endif\n#ifdef INDICATOR_CUTOUT\nfinalColor=applyCutout(finalColor,v_position_height.w);\n#endif\n#ifdef FEATURE_CUTOUT\nfinalColor=apply_feature_cutout(finalColor,gl_FragCoord);\n#endif\nglFragColor=finalColor;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nin vec3 a_pos_3f;\n#pragma mapbox: define-attribute highp vec3 normal_3f\n#pragma mapbox: define-attribute highp vec2 uv_2f\n#pragma mapbox: define-attribute highp vec3 color_3f\n#pragma mapbox: define-attribute highp vec4 color_4f\n#pragma mapbox: define-attribute-vertex-shader-only highp vec4 pbr\n#pragma mapbox: define-attribute-vertex-shader-only highp vec3 heightBasedEmissiveStrength\nuniform mat4 u_matrix;uniform mat4 u_node_matrix;uniform mat4 u_lighting_matrix;uniform vec3 u_camera_pos;uniform vec4 u_color_mix;\n#ifdef INSTANCED_ARRAYS\nin vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3;\n#else\nuniform highp mat4 u_normal_matrix;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out float v_depth_shadows;\n#endif\nout vec4 v_position_height;out lowp vec4 v_color_mix;\n#ifdef TERRAIN_FRAGMENT_OCCLUSION\nout highp float v_depth;\n#endif\n#ifdef HAS_ATTRIBUTE_a_pbr\nout lowp vec4 v_roughness_metallic_emissive_alpha;out mediump vec4 v_height_based_emission_params;\n#endif\nvec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() {\n#pragma mapbox: initialize-attribute highp vec3 normal_3f\n#pragma mapbox: initialize-attribute highp vec2 uv_2f\n#pragma mapbox: initialize-attribute highp vec3 color_3f\n#pragma mapbox: initialize-attribute highp vec4 color_4f\n#pragma mapbox: initialize-attribute-custom highp vec4 pbr\n#pragma mapbox: initialize-attribute-custom highp vec3 heightBasedEmissiveStrength\nhighp mat4 normal_matrix;\n#ifdef INSTANCED_ARRAYS\nnormal_matrix=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3);\n#else\nnormal_matrix=u_normal_matrix;\n#endif\nvec3 local_pos;mat3 rs;\n#ifdef MODEL_POSITION_ON_GPU\nvec3 pos_color=normal_matrix[0].xyz;vec4 translate=normal_matrix[1];vec3 pos_a=floor(pos_color);vec3 rgb=1.05*(pos_color-pos_a);float hidden=float(pos_a.x > EXTENT);float color_mix=pos_a.z/100.0;v_color_mix=vec4(sRGBToLinear(rgb),color_mix);float meter_to_tile=normal_matrix[0].w;vec4 pos=vec4(pos_a.xy,translate.z,1.0);rs[0].x=normal_matrix[1].w;rs[0].yz=normal_matrix[2].xy;rs[1].xy=normal_matrix[2].zw;rs[1].z=normal_matrix[3].x;rs[2].xyz=normal_matrix[3].yzw;vec4 pos_node=u_lighting_matrix*vec4(a_pos_3f,1.0);vec3 rotated_pos_node=rs*pos_node.xyz;vec3 pos_model_tile=(rotated_pos_node+vec3(translate.xy,0.0))*vec3(meter_to_tile,meter_to_tile,1.0);pos.xyz+=pos_model_tile;local_pos=pos.xyz;gl_Position=mix(u_matrix*pos,AWAY,hidden);pos.z*=meter_to_tile;v_position_height.xyz=pos.xyz-u_camera_pos;\n#else\nlocal_pos=a_pos_3f;gl_Position=u_matrix*vec4(a_pos_3f,1);v_position_height.xyz=vec3(u_lighting_matrix*vec4(a_pos_3f,1));v_color_mix=vec4(sRGBToLinear(u_color_mix.rgb),u_color_mix.a);\n#endif\nv_position_height.w=a_pos_3f.z;\n#ifdef HAS_ATTRIBUTE_a_pbr\nvec4 albedo_c=decode_color(pbr.xy);vec2 e_r_m=unpack_float(pbr.z);vec2 r_m= unpack_float(e_r_m.y*16.0);r_m.r=r_m.r*16.0;v_color_mix=vec4(albedo_c.rgb,1.0);v_roughness_metallic_emissive_alpha=vec4(vec3(r_m,e_r_m.x)/255.0,albedo_c.a);v_roughness_metallic_emissive_alpha.z*=2.0;float heightBasedRelativeIntepolation=a_pos_3f.z*heightBasedEmissiveStrength.x+heightBasedEmissiveStrength.y;v_height_based_emission_params.x=heightBasedRelativeIntepolation;v_height_based_emission_params.y=heightBasedEmissiveStrength.z;vec2 emissionMultiplierValues=unpack_float(pbr.w)/256.0;v_height_based_emission_params.z=emissionMultiplierValues.x;v_height_based_emission_params.w=emissionMultiplierValues.y-emissionMultiplierValues.x;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(local_pos);\n#endif\n#ifdef RENDER_CUTOFF\nv_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);\n#endif\n#ifdef TERRAIN_FRAGMENT_OCCLUSION\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef HAS_ATTRIBUTE_a_normal_3f\n#ifdef MODEL_POSITION_ON_GPU\nfloat x_squared_scale=dot(rs[0],rs[0]);float y_squared_scale=dot(rs[1],rs[1]);float z_squared_scale=dot(rs[2],rs[2]);vec3 squared_scale=vec3(x_squared_scale,y_squared_scale,z_squared_scale);normal_3f=rs*((u_lighting_matrix*vec4(normal_3f,0.0)).xyz/squared_scale);normal_3f=normalize(normal_3f);\n#else\nnormal_3f=vec3(normal_matrix*vec4(normal_3f,0));\n#endif\n#endif\n#ifdef HAS_ATTRIBUTE_a_pbr\n#ifdef HAS_ATTRIBUTE_a_color_4f\nv_roughness_metallic_emissive_alpha.w=clamp(color_4f.a*v_roughness_metallic_emissive_alpha.w*(v_roughness_metallic_emissive_alpha.z-1.0),0.0,1.0);\n#endif\n#endif\n#ifdef RENDER_SHADOWS\nvec4 shadow_pos=u_node_matrix*vec4(local_pos,1.0);\n#ifdef NORMAL_OFFSET\n#ifdef HAS_ATTRIBUTE_a_normal_3f\n#ifdef MODEL_POSITION_ON_GPU\nvec3 offset=shadow_normal_offset(vec3(-normal_3f.xy,normal_3f.z));shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0();\n#else\nvec3 offset=shadow_normal_offset_model(normal_3f);shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0();\n#endif\n#endif\n#endif\nv_pos_light_view_0=u_light_matrix_0*shadow_pos;v_pos_light_view_1=u_light_matrix_1*shadow_pos;v_depth_shadows=gl_Position.w;\n#endif\n}'),modelDepth:Jn("in highp float v_depth;void main() {\n#ifndef DEPTH_TEXTURE\nglFragColor=pack_depth(v_depth);\n#endif\n}","in vec3 a_pos_3f;uniform mat4 u_matrix;out highp float v_depth;\n#ifdef MODEL_POSITION_ON_GPU\n#ifdef INSTANCED_ARRAYS\nin vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3;\n#else\nuniform highp mat4 u_instance;\n#endif\nuniform highp mat4 u_node_matrix;\n#endif\nvoid main() {\n#ifdef MODEL_POSITION_ON_GPU\nhighp mat4 instance;\n#ifdef INSTANCED_ARRAYS\ninstance=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3);\n#else\ninstance=u_instance;\n#endif\nvec3 pos_color=instance[0].xyz;vec4 translate=instance[1];vec3 pos_a=floor(pos_color);float hidden=float(pos_a.x > EXTENT);float meter_to_tile=instance[0].w;vec4 pos=vec4(pos_a.xy,translate.z,1.0);mat3 rs;rs[0].x=instance[1].w;rs[0].yz=instance[2].xy;rs[1].xy=instance[2].zw;rs[1].z=instance[3].x;rs[2].xyz=instance[3].yzw;vec4 pos_node=u_node_matrix*vec4(a_pos_3f,1.0);vec3 rotated_pos_node=rs*pos_node.xyz;vec3 pos_model_tile=(rotated_pos_node+vec3(translate.xy,0.0))*vec3(meter_to_tile,meter_to_tile,1.0);pos.xyz+=pos_model_tile;gl_Position=mix(u_matrix*pos,AWAY,hidden);\n#else\ngl_Position=u_matrix*vec4(a_pos_3f,1);\n#endif\nv_depth=gl_Position.z/gl_Position.w;}"),stars:Jn("in highp vec2 v_uv;in mediump float v_intensity;float shapeCircle(in vec2 uv)\n{float beginFade=0.6;float lengthFromCenter=length(v_uv);return 1.0-clamp((lengthFromCenter-beginFade)/(1.0-beginFade),0.0,1.0);}void main() {float alpha=shapeCircle(v_uv);vec3 color=vec3(1.0,1.0,1.0);alpha*=v_intensity;glFragColor=vec4(color*alpha,alpha);HANDLE_WIREFRAME_DEBUG;}","\nin vec3 a_pos_3f;in vec2 a_uv;in float a_size_scale;in float a_fade_opacity;uniform mat4 u_matrix;uniform vec3 u_up;uniform vec3 u_right;uniform float u_intensity_multiplier;out highp vec2 v_uv;out mediump float v_intensity;void main() {v_uv=a_uv;v_intensity=a_fade_opacity*u_intensity_multiplier;vec3 pos=a_pos_3f;pos+=a_uv.x*u_right*a_size_scale;pos+=a_uv.y*u_up*a_size_scale;gl_Position=u_matrix*vec4(pos,1.0);}"),snowParticle:Jn("in highp vec2 uv;in highp float alphaMultiplier;uniform vec4 u_particleColor;uniform vec2 u_simpleShapeParameters;void main() {float t=clamp((length(uv)-u_simpleShapeParameters.x)/(1.0-u_simpleShapeParameters.x),0.0,1.0);float alpha=1.0-pow(t,pow(10.0,u_simpleShapeParameters.y));alpha*=alphaMultiplier;alpha*=u_particleColor.a;vec3 color=u_particleColor.rgb*alpha;glFragColor=vec4(color,alpha) ;HANDLE_WIREFRAME_DEBUG;}","\nin highp vec3 a_pos_3f;in highp vec2 a_uv;in highp vec4 a_snowParticleData;in highp vec4 a_snowParticleDataHorizontalOscillation;uniform mat4 u_modelview;uniform mat4 u_projection;uniform vec3 u_cam_pos;uniform vec2 u_screenSize;uniform float u_time;uniform float u_boxSize;uniform float u_velocityConeAperture; \nuniform float u_velocity;uniform vec3 u_direction;uniform float u_horizontalOscillationRadius; \nuniform float u_horizontalOscillationRate; \nuniform float u_billboardSize;uniform vec2 u_thinningCenterPos;uniform vec3 u_thinningShape;uniform float u_thinningAffectedRatio;uniform float u_thinningParticleOffset;out highp vec2 uv;out highp float alphaMultiplier;void main() {vec3 pos=a_pos_3f;float halfBoxSize=0.5*u_boxSize;pos.xyz*=halfBoxSize;pos+=u_cam_pos;float velocityConeApertureRad=radians(u_velocityConeAperture*0.5);float coneAnglePichRad=velocityConeApertureRad*a_snowParticleData.z;float coneAngleHeadingRad=a_snowParticleData.w*radians(360.0);vec3 localZ=normalize(u_direction);vec3 localX=normalize(cross(localZ,vec3(1,0,0)));vec3 localY=normalize(cross(localZ,localX));vec3 direction;direction.x=cos(coneAngleHeadingRad)*sin(coneAnglePichRad);direction.y=sin(coneAngleHeadingRad)*sin(coneAnglePichRad);direction.z=cos(coneAnglePichRad);direction=normalize(direction);vec3 simPosLocal=vec3(0,0,0);float velocityScale=(1.0+3.0*a_snowParticleData.y)*u_velocity;simPosLocal+=direction*velocityScale*u_time;float horizontalOscillationRadius=u_horizontalOscillationRadius*a_snowParticleDataHorizontalOscillation.x;float horizontalOscillationAngle=u_horizontalOscillationRate*u_time*(-1.0+2.0*a_snowParticleDataHorizontalOscillation.y);simPosLocal.xy+=horizontalOscillationRadius*vec2(cos(horizontalOscillationAngle),sin(horizontalOscillationAngle));vec3 simPos=localX*simPosLocal.x+\nlocalY*simPosLocal.y+localZ*simPosLocal.z;pos+=simPos;pos=fract((pos+vec3(halfBoxSize))/vec3(u_boxSize))*u_boxSize-vec3(halfBoxSize);float clipZ=-u_cam_pos.z+pos.z;vec4 posView=u_modelview*vec4(pos,1.0);float size=u_billboardSize;alphaMultiplier=1.0;vec4 posScreen=u_projection*posView;posScreen/=posScreen.w;posScreen.xy=vec2(0.5)+posScreen.xy*0.5;posScreen.xy*=u_screenSize;vec2 thinningCenterPos=u_thinningCenterPos.xy;thinningCenterPos.y=u_screenSize.y-thinningCenterPos.y;float screenDist=length((thinningCenterPos-posScreen.xy)/(0.5*u_screenSize));screenDist+=a_snowParticleData.x*u_thinningParticleOffset;float scaleFactorMode=0.0;float thinningShapeDist=u_thinningShape.x+u_thinningShape.y;if (screenDist < thinningShapeDist) {float thinningFadeRatio=clamp((screenDist-u_thinningShape.x)/u_thinningShape.y,0.0,1.0);thinningFadeRatio=pow(thinningFadeRatio,u_thinningShape.z);if (a_snowParticleData.x < u_thinningAffectedRatio) {scaleFactorMode=1.0-thinningFadeRatio;alphaMultiplier=thinningFadeRatio;}}vec4 posScreen1=u_projection*vec4(posView.x-size,posView.yzw);posScreen1/=posScreen1.w;vec4 posScreen2=u_projection*vec4(posView.x+size,posView.yzw);posScreen2/=posScreen2.w;posScreen1.xy=vec2(0.5)+posScreen1.xy*0.5;posScreen1.xy*=u_screenSize;posScreen2.xy=vec2(0.5)+posScreen2.xy*0.5;posScreen2.xy*=u_screenSize;float screenLength=length(posScreen1.xy-posScreen2.xy);float screenEpsilon=3.0;float scaleFactor=1.0;if (screenLength < screenEpsilon) {scaleFactor=screenEpsilon/max(screenLength,0.01);scaleFactor=mix(scaleFactor,1.0,scaleFactorMode);}float screenEpsilon2=15.0;if (screenLength > screenEpsilon2) {scaleFactor=screenEpsilon2/max(screenLength,0.01);}size*=scaleFactor;vec2 right=size*vec2(1,0);vec2 up=size*vec2(0,1);posView.xy+=right*a_uv.x;posView.xy+=up*a_uv.y;uv=a_uv;gl_Position=u_projection*posView;}"),rainParticle:Jn("in highp vec2 uv;in highp float particleRandomValue;uniform sampler2D u_texScreen;uniform float u_distortionStrength;uniform vec4 u_color;uniform vec2 u_thinningCenterPos;uniform vec3 u_thinningShape;uniform float u_thinningAffectedRatio;uniform float u_thinningParticleOffset;uniform float u_shapeDirectionalPower;uniform float u_mode;void main() {vec2 st=uv*0.5+vec2(0.5);vec2 uvm=uv;uvm.y=-1.0+2.0*pow(st.y,u_shapeDirectionalPower);float shape=clamp(1.0-length(uvm),0.0,1.0);float alpha=abs(shape)*u_color.a;vec2 screenSize=vec2(textureSize(u_texScreen,0));vec2 thinningCenterPos=u_thinningCenterPos.xy;thinningCenterPos.y=screenSize.y-thinningCenterPos.y;float screenDist=length((thinningCenterPos-gl_FragCoord.xy)/(0.5*screenSize));screenDist+=(0.5+0.5*particleRandomValue)*u_thinningParticleOffset;float thinningShapeDist=u_thinningShape.x+u_thinningShape.y;float thinningAlpha=1.0;if (screenDist < thinningShapeDist) {float thinningFadeRatio=clamp((screenDist-u_thinningShape.x)/u_thinningShape.y,0.0,1.0);thinningFadeRatio=pow(thinningFadeRatio,u_thinningShape.z);thinningAlpha*=thinningFadeRatio;}vec2 offsetXY=normalize(uvm)*abs(shape);vec2 stScreen=(gl_FragCoord.xy+offsetXY*u_distortionStrength*thinningAlpha)/screenSize;vec3 colorScreen=texture(u_texScreen,stScreen).rgb;alpha*=thinningAlpha;glFragColor=mix(vec4(colorScreen,1.0),vec4(u_color.rgb*alpha,alpha),u_mode);HANDLE_WIREFRAME_DEBUG;}","\nin highp vec3 a_pos_3f;in highp vec2 a_uv;in highp vec4 a_rainParticleData;uniform mat4 u_modelview;uniform mat4 u_projection;uniform vec3 u_cam_pos;uniform float u_time;uniform float u_boxSize;uniform float u_velocityConeAperture; \nuniform float u_velocity; \nuniform vec2 u_rainDropletSize;uniform vec3 u_rainDirection;out highp vec2 uv;out highp float particleRandomValue;void main() {vec3 pos=a_pos_3f;float halfBoxSize=0.5*u_boxSize;pos*=halfBoxSize; \npos+=u_cam_pos;float velocityConeApertureRad=radians(u_velocityConeAperture*0.5);float coneAnglePichRad=velocityConeApertureRad*a_rainParticleData.z;float coneAngleHeadingRad=a_rainParticleData.w*radians(360.0);vec3 localZ=normalize(u_rainDirection);vec3 localX=normalize(cross(localZ,vec3(1,0,0)));vec3 localY=normalize(cross(localZ,localX));vec3 directionLocal;directionLocal.x=cos(coneAngleHeadingRad)*sin(coneAnglePichRad);directionLocal.y=sin(coneAngleHeadingRad)*sin(coneAnglePichRad);directionLocal.z=cos(coneAnglePichRad);directionLocal=normalize(directionLocal);vec3 directionWorld=localX*directionLocal.x+localY*directionLocal.y+localZ*directionLocal.z;float velocityScale=(1.0+3.0*a_rainParticleData.y)*u_velocity;vec3 simPosLocal=vec3(0,0,0);simPosLocal+=directionLocal*velocityScale*u_time;vec3 simPos=localX*simPosLocal.x+\nlocalY*simPosLocal.y+localZ*simPosLocal.z;pos+=simPos;pos=fract((pos+vec3(halfBoxSize))/vec3(u_boxSize))*u_boxSize-vec3(halfBoxSize);vec4 posView=u_modelview*vec4(pos,1.0);vec3 directionView=normalize((u_modelview*vec4(directionWorld,0.0)).xyz);vec3 side=cross(directionView,normalize(posView.xyz));posView.xyz+=side*a_uv.x*u_rainDropletSize.x;posView.xyz+=directionView*a_uv.y*u_rainDropletSize.y;uv=a_uv;particleRandomValue=a_rainParticleData.x;gl_Position=u_projection*posView;}"),vignette:Jn("uniform vec3 u_vignetteShape;uniform vec4 u_vignetteColor;in vec2 st;void main() {float screenDist=length(st);float alpha=clamp((screenDist-u_vignetteShape.x)/u_vignetteShape.y,0.0,1.0);alpha=pow(alpha,u_vignetteShape.z)*u_vignetteColor.a;vec3 color=u_vignetteColor.rgb;glFragColor=vec4(color*alpha,alpha) ;}","in vec2 a_pos_2f;out vec2 st;void main() {st=a_pos_2f;gl_Position=vec4(a_pos_2f,0,1);}"),occlusion:Jn("uniform vec4 u_color;void main() {glFragColor=u_color;}",'#include "_prelude_terrain.vertex.glsl"\nin highp vec2 a_offset_xy;uniform highp vec3 u_anchorPos;uniform mat4 u_matrix;uniform vec2 u_screenSizePx;uniform vec2 u_occluderSizePx;void main() {vec3 world_pos=u_anchorPos;\n#ifdef TERRAIN\nfloat e=elevation(world_pos.xy);world_pos.z+=e;\n#endif\nvec4 projected_point=u_matrix*vec4(world_pos,1.0);projected_point.xy+=projected_point.w*a_offset_xy*0.5*u_occluderSizePx/u_screenSizePx;gl_Position=projected_point;}')};function Zn(e,t){const i=e.replace(/\s*\/\/[^\n]*\n/g,"\n").split("\n");for(let e of i)if(e=e.trim(),"#"===e[0]&&e.includes("if")&&!e.includes("endif")){e=e.replace("#","").replace(/ifdef|ifndef|elif|if/g,"").replace(/!|defined|\(|\)|\|\||&&/g,"").replace(/\s+/g," ").trim();const i=e.split(" ");for(const e of i)t.includes(e)||t.push(e)}}function Jn(e,t){const i=/#include\s+"([^"]+)"/g,n=/#pragma mapbox: ([\w\-]+) ([\w]+) ([\w]+) ([\w]+)/g;let r=t.match(/(attribute(\S*)|(^\s*|;)in) (highp |mediump |lowp )?([\w]+) ([\w]+)/gm);r&&(r=r.map(e=>{const t=e.split(" ");return t[t.length-1]}),r=[...new Set(r)]);const s={},o=[],a=[];if(e=e.replace(i,(e,t)=>(a.push(t),"")),(t=t.replace(i,(e,t)=>(o.push(t),""))).includes("flat out"))return void console.error('The usage of "flat" qualifier is disallowed, see: https://bugs.webkit.org/show_bug.cgi?id=268071');let l=[...Wn];Zn(e,l),Zn(t,l);for(const e of[...o,...a])Un[e]||console.error(`Undefined include: ${e}`),$n[e]||($n[e]=[],Zn(Un[e],$n[e])),l=[...l,...$n[e]];return{fragmentSource:e=e.replace(n,(e,t,i,n,r)=>(s[r]=!0,"define"===t?`\n#ifndef HAS_UNIFORM_u_${r}\nin ${i} ${n} ${r};\n#else\nuniform ${i} ${n} u_${r};\n#endif\n`:"initialize"===t?`\n#ifdef HAS_UNIFORM_u_${r}\n ${i} ${n} ${r} = u_${r};\n#endif\n`:"define-attribute"===t?`\n#ifdef HAS_ATTRIBUTE_a_${r}\n in ${i} ${n} ${r};\n#endif\n`:"initialize-attribute"===t?"":void 0)),vertexSource:t=t.replace(n,(e,t,i,n,r)=>{const o="float"===n?"vec2":n,a=r.match(/color/)?"color":o;return"define-attribute-vertex-shader-only"===t?`\n#ifdef HAS_ATTRIBUTE_a_${r}\nin ${i} ${n} a_${r};\n#endif\n`:s[r]?"define"===t?`\n#ifndef HAS_UNIFORM_u_${r}\nuniform lowp float u_${r}_t;\nin ${i} ${o} a_${r};\nout ${i} ${n} ${r};\n#else\nuniform ${i} ${n} u_${r};\n#endif\n`:"initialize"===t?"vec4"===a?`\n#ifndef HAS_UNIFORM_u_${r}\n ${r} = a_${r};\n#else\n ${i} ${n} ${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 ${i} ${n} ${r} = u_${r};\n#endif\n`:"define-attribute"===t?`\n#ifdef HAS_ATTRIBUTE_a_${r}\n in ${i} ${n} a_${r};\n out ${i} ${n} ${r};\n#endif\n`:"initialize-attribute"===t?`\n#ifdef HAS_ATTRIBUTE_a_${r}\n ${r} = a_${r};\n#endif\n`:void 0:"define"===t?`\n#ifndef HAS_UNIFORM_u_${r}\nuniform lowp float u_${r}_t;\nin ${i} ${o} a_${r};\n#else\nuniform ${i} ${n} u_${r};\n#endif\n`:"define-instanced"===t?"mat4"===a?`\n#ifdef INSTANCED_ARRAYS\nin vec4 a_${r}0;\nin vec4 a_${r}1;\nin vec4 a_${r}2;\nin vec4 a_${r}3;\n#else\nuniform ${i} ${n} u_${r};\n#endif\n`:`\n#ifdef INSTANCED_ARRAYS\nin ${i} ${o} a_${r};\n#else\nuniform ${i} ${n} u_${r};\n#endif\n`:"initialize-attribute-custom"===t?`\n#ifdef HAS_ATTRIBUTE_a_${r}\n ${i} ${n} ${r} = a_${r};\n#endif\n`:"vec4"===a?`\n#ifndef HAS_UNIFORM_u_${r}\n ${i} ${n} ${r} = a_${r};\n#else\n ${i} ${n} ${r} = u_${r};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${r}\n ${i} ${n} ${r} = unpack_mix_${a}(a_${r}, u_${r}_t);\n#else\n ${i} ${n} ${r} = u_${r};\n#endif\n`}),staticAttributes:r,usedDefines:l,vertexIncludes:o,fragmentIncludes:a}}class Kn{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffers=[],this.vao=null}bind(e,t,i,n,r,s,o,a){this.context=e;let l=this.boundPaintVertexBuffers.length!==n.length;for(let e=0;!l&&e{const s=n.paint.get("hillshade-shadow-color"),o="none"===n.paint.get("hillshade-shadow-color-use-theme").constantOr("default"),a=n.paint.get("hillshade-highlight-color"),l="none"===n.paint.get("hillshade-highlight-color-use-theme").constantOr("default"),c=n.paint.get("hillshade-accent-color"),h="none"===n.paint.get("hillshade-accent-color-use-theme").constantOr("default"),d=n.paint.get("hillshade-emissive-strength");let u=e.al(n.paint.get("hillshade-illumination-direction"));if("viewport"===n.paint.get("hillshade-illumination-anchor"))u-=t.transform.angle;else if(t.style&&t.style.enable3dLights()&&t.style.directionalLight){const i=t.style.directionalLight.properties.get("direction"),n=e.d1(i.x,i.y,i.z);u=e.al(n[1])}const f=!t.options.moving;return{u_matrix:r||t.transform.calculateProjMatrix(i.tileID.toUnwrapped(),f),u_image:0,u_latrange:Qn(0,i.tileID),u_light:[n.paint.get("hillshade-exaggeration"),u],u_shadow:s.toPremultipliedRenderColor(o?null:n.lut),u_highlight:a.toPremultipliedRenderColor(l?null:n.lut),u_emissive_strength:d,u_accent:c.toPremultipliedRenderColor(h?null:n.lut)}})(t,n,r,t.terrain?i.projMatrix:null);t.uploadCommonUniforms(l,u,i.toUnwrapped());const{tileBoundsBuffer:p,tileBoundsIndexBuffer:m,tileBoundsSegments:g}=t.getTileBoundsBuffers(n);u.draw(t,c.TRIANGLES,s,o,a,Wi.disabled,f,r.id,p,m,g)}function tr(t,i,n){if(!i.needsDEMTextureUpload)return;const r=t.context,s=r.gl;r.pixelStoreUnpackPremultiplyAlpha.set(!1),i.demTexture=i.demTexture||t.getTileTexture(n.stride);const o=n.getPixels();i.demTexture?i.demTexture.update(o,{premultiply:!1}):i.demTexture=new e.T(r,o,s.R32F,{premultiply:!1}),i.needsDEMTextureUpload=!1}function ir(t,i,n){const r=t.context,s=r.gl;if(!i.dem)return;const o=i.dem;if(r.activeTexture.set(s.TEXTURE1),tr(t,i,o),!i.demTexture)return;i.demTexture.bind(s.NEAREST,s.CLAMP_TO_EDGE);const a=o.dim;r.activeTexture.set(s.TEXTURE0);let l=i.hillshadeFBO;if(!l){const t=new e.T(r,{width:a,height:a,data:null},s.RGBA8);t.bind(s.LINEAR,s.CLAMP_TO_EDGE),l=i.hillshadeFBO=r.createFramebuffer(a,a,!0,"renderbuffer"),l.colorAttachment.set(t.texture)}r.bindFramebuffer.set(l.framebuffer),r.viewport.set([0,0,a,a]);const{tileBoundsBuffer:c,tileBoundsIndexBuffer:h,tileBoundsSegments:d}=t.getMercatorTileBoundsBuffers(),u=[];t.linearFloatFilteringSupported()&&u.push("TERRAIN_DEM_FLOAT_FORMAT"),t.getOrCreateProgram("hillshadePrepare",{defines:u}).draw(t,s.TRIANGLES,Yi.disabled,Hi.disabled,Ni.unblended,Wi.disabled,((t,i)=>{const n=i.stride,r=e.bz();return e.ca(r,0,e.aj,-e.aj,0,0,1),e.bo(r,r,[0,-e.aj,0]),{u_matrix:r,u_image:1,u_dimension:[n,n],u_zoom:t.overscaledZ}})(i.tileID,o),n.id,c,h,d),i.needsHillshadePrepare=!1}class nr{constructor(e){this.gl=e.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(e){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class rr extends nr{getDefault(){return e.am.transparent.toNonPremultipliedRenderColor(null)}set(e){const t=this.current;(e.r!==t.r||e.g!==t.g||e.b!==t.b||e.a!==t.a||this.dirty)&&(this.gl.clearColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class sr extends nr{getDefault(){return 1}set(e){(e!==this.current||this.dirty)&&(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}}class or extends nr{getDefault(){return 0}set(e){(e!==this.current||this.dirty)&&(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}}class ar extends nr{getDefault(){return[!0,!0,!0,!0]}set(e){const t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||e[3]!==t[3]||this.dirty)&&(this.gl.colorMask(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class lr extends nr{getDefault(){return!0}set(e){(e!==this.current||this.dirty)&&(this.gl.depthMask(e),this.current=e,this.dirty=!1)}}class cr extends nr{getDefault(){return 255}set(e){(e!==this.current||this.dirty)&&(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}}class hr extends nr{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(e){const t=this.current;(e.func!==t.func||e.ref!==t.ref||e.mask!==t.mask||this.dirty)&&(this.gl.stencilFunc(e.func,e.ref,e.mask),this.current=e,this.dirty=!1)}}class dr extends nr{getDefault(){const e=this.gl;return[e.KEEP,e.KEEP,e.KEEP]}set(e){const t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||this.dirty)&&(this.gl.stencilOp(e[0],e[1],e[2]),this.current=e,this.dirty=!1)}}class ur extends nr{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;e?t.enable(t.STENCIL_TEST):t.disable(t.STENCIL_TEST),this.current=e,this.dirty=!1}}class fr extends nr{getDefault(){return[0,1]}set(e){const t=this.current;(e[0]!==t[0]||e[1]!==t[1]||this.dirty)&&(this.gl.depthRange(e[0],e[1]),this.current=e,this.dirty=!1)}}class pr extends nr{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;e?t.enable(t.DEPTH_TEST):t.disable(t.DEPTH_TEST),this.current=e,this.dirty=!1}}class mr extends nr{getDefault(){return this.gl.LESS}set(e){(e!==this.current||this.dirty)&&(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}}class gr extends nr{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;e?t.enable(t.BLEND):t.disable(t.BLEND),this.current=e,this.dirty=!1}}class _r extends nr{getDefault(){const e=this.gl;return[e.ONE,e.ZERO,e.ONE,e.ZERO]}set(e){const t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||e[3]!==t[3]||this.dirty)&&(this.gl.blendFuncSeparate(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class yr extends nr{getDefault(){return e.am.transparent.toNonPremultipliedRenderColor(null)}set(e){const t=this.current;(e.r!==t.r||e.g!==t.g||e.b!==t.b||e.a!==t.a||this.dirty)&&(this.gl.blendColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class vr extends nr{getDefault(){return this.gl.FUNC_ADD}set(e){(e!==this.current||this.dirty)&&(this.gl.blendEquationSeparate(e,e),this.current=e,this.dirty=!1)}}class xr extends nr{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;e?t.enable(t.CULL_FACE):t.disable(t.CULL_FACE),this.current=e,this.dirty=!1}}class br extends nr{getDefault(){return this.gl.BACK}set(e){(e!==this.current||this.dirty)&&(this.gl.cullFace(e),this.current=e,this.dirty=!1)}}class wr extends nr{getDefault(){return this.gl.CCW}set(e){(e!==this.current||this.dirty)&&(this.gl.frontFace(e),this.current=e,this.dirty=!1)}}let Sr=class extends nr{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.useProgram(e),this.current=e,this.dirty=!1)}};class Tr extends nr{getDefault(){return this.gl.TEXTURE0}set(e){(e!==this.current||this.dirty)&&(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}}class kr extends nr{getDefault(){const e=this.gl;return[0,0,e.drawingBufferWidth,e.drawingBufferHeight]}set(e){const t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||e[3]!==t[3]||this.dirty)&&(this.gl.viewport(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class Mr extends nr{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.bindFramebuffer(t.FRAMEBUFFER,e),this.current=e,this.dirty=!1}}class Ar extends nr{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.bindRenderbuffer(t.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class Cr extends nr{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.bindTexture(t.TEXTURE_2D,e),this.current=e,this.dirty=!1}}class Dr extends nr{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.bindBuffer(t.ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class Lr extends nr{getDefault(){return null}set(e){const t=this.gl;t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class Er extends nr{getDefault(){return null}set(e){this.gl&&(e!==this.current||this.dirty)&&(this.gl.bindVertexArray(e),this.current=e,this.dirty=!1)}}class Ir extends nr{getDefault(){return 4}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.pixelStorei(t.UNPACK_ALIGNMENT,e),this.current=e,this.dirty=!1}}class Pr extends nr{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e),this.current=e,this.dirty=!1}}class Rr extends nr{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,e),this.current=e,this.dirty=!1}}class Or extends nr{constructor(e,t){super(e),this.context=e,this.parent=t}getDefault(){return null}}class zr extends Or{setDirty(){this.dirty=!0}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const t=this.gl;t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,e,0),this.current=e,this.dirty=!1}}class Fr extends Or{attachment(){return this.gl.DEPTH_ATTACHMENT}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const t=this.gl;t.framebufferRenderbuffer(t.FRAMEBUFFER,this.attachment(),t.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class Nr extends Or{attachment(){return this.gl.DEPTH_ATTACHMENT}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const t=this.gl;t.framebufferTexture2D(t.FRAMEBUFFER,this.attachment(),t.TEXTURE_2D,e,0),this.current=e,this.dirty=!1}}class Yr extends Fr{attachment(){return this.gl.DEPTH_STENCIL_ATTACHMENT}}const Br=(e,t,i)=>({u_matrix:e,u_image0:0,u_skirt_height:t,u_ground_shadow_factor:i}),Hr=(e,t,i,n,r,s,o,a,l,c,h,d,u,f,p,m)=>({u_proj_matrix:Float32Array.from(e),u_globe_matrix:t,u_normalize_matrix:Float32Array.from(n),u_merc_matrix:i,u_zoom_transition:r,u_merc_center:s,u_image0:0,u_frustum_tl:o,u_frustum_tr:a,u_frustum_br:l,u_frustum_bl:c,u_globe_pos:h,u_globe_radius:d,u_viewport:u,u_grid_matrix:m?Float32Array.from(m):new Float32Array(9),u_skirt_height:f,u_far_z_cutoff:p});function jr(e,t){return null!=e&&null!=t&&!(!e.hasData()||!t.hasData())&&null!=e.demTexture&&null!=t.demTexture&&e.tileID.key!==t.tileID.key}const Vr=new class{constructor(){this.operations={}}newMorphing(e,t,i,n,r){if(e in this.operations){const t=this.operations[e];t.to.tileID.key!==i.tileID.key&&(t.queued=i)}else this.operations[e]={startTime:n,phase:0,duration:r,from:t,to:i,queued:null}}getMorphValuesForProxy(e){if(!(e in this.operations))return null;const t=this.operations[e];return{from:t.from,to:t.to,phase:t.phase}}update(e){for(const t in this.operations){const i=this.operations[t];for(i.phase=(e-i.startTime)/i.duration;i.phase>=1||!this._validOp(i);)if(!this._nextOp(i,e)){delete this.operations[t];break}}}_nextOp(e,t){return!!e.queued&&(e.from=e.to,e.to=e.queued,e.queued=null,e.phase=0,e.startTime=t,!0)}_validOp(e){return e.from.hasData()&&e.to.hasData()}},Wr={0:null,1:"TERRAIN_VERTEX_MORPHING"};function Ur(e,t,i){if(0===t)return 0;const n=t<1&&514===i?.25/t:1;return 6*Math.pow(1.5,22-e)*Math.max(t,1)*n}function $r(e,t){const i=1<({u_matrix:e});function Xr(t,i,n,r,s){if(s>0){const o=e.q.now(),a=(o-t.timeAdded)/s,l=i?(o-i.timeAdded)/s:-1,c=n.getSource(),h=r.coveringZoomLevel({tileSize:c.tileSize,roundZoom:c.roundZoom}),d=!i||Math.abs(i.tileID.overscaledZ-h)>Math.abs(t.tileID.overscaledZ-h),u=d&&t.refreshedUponExpiration?1:e.ay(d?a:1-l,0,1);return t.refreshedUponExpiration&&a>=1&&(t.refreshedUponExpiration=!1),i?{opacity:1,mix:1-u}:{opacity:u,mix:0}}return{opacity:1,mix:0}}class qr extends Tt{constructor(e){const t=rt("mock-dem",{type:"raster-dem",maxzoom:e.transform.maxZoom},e.style.dispatcher,e.style);super("mock-dem",t,!1),t.setEventedParent(this),this._sourceLoaded=!0}_loadTile(e,t){e.state="loaded",t(null)}}class Zr extends Tt{constructor(e){const t=rt("proxy",{type:"geojson",maxzoom:e.transform.maxZoom},e.style.dispatcher,e.style);super("proxy",t,!1),t.setEventedParent(this),this.map=this.getSource().map=e,this.used=this._sourceLoaded=!0,this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}update(e,t,i){if(e.freezeTileCoverage)return;this.transform=e;const n=e.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}).reduce((t,i)=>{if(t[i.key]="",!this._tiles[i.key]){const t=new xt(i,this._source.tileSize*i.overscaleFactor(),e.tileZoom,void 0,void 0,this._source.worldview);t.state="loaded",this._tiles[i.key]=t}return t},{});for(const e in this._tiles)e in n||(this.freeFBO(e),this._tiles[e].unloadVectorData(),delete this._tiles[e])}freeFBO(e){const t=this.proxyCachedFBO[e];if(void 0!==t){const i=Object.values(t);this.renderCachePool.push(...i),delete this.proxyCachedFBO[e]}}deallocRenderCache(){this.renderCache.forEach(e=>e.fb.destroy()),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}class Jr extends e.aM{constructor(e,t,i){super(e.overscaledZ,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y),this.proxyTileKey=t,this.projMatrix=i}}class Kr extends e.dF{constructor(t,i){super(),this._debugParams={sortTilesHiZFirst:!0,disableRenderCache:!1},t.tp.registerParameter(this._debugParams,["Terrain"],"sortTilesHiZFirst",{},()=>{this._style.map.triggerRepaint()}),t.tp.registerParameter(this._debugParams,["Terrain"],"disableRenderCache",{},()=>{this._style.map.triggerRepaint()}),t.tp.registerButton(["Terrain"],"Invalidate Render Cache",()=>{this.invalidateRenderCache=!0,this._style.map.triggerRepaint()}),this.painter=t,this.terrainTileForTile={},this.prevTerrainTileForTile={};const[n,r,s]=function(){const t=new e.ba,i=new e.a_,n=131;t.reserve(17161),i.reserve(33800);const r=e.aj/128,s=e.aj+r/2,o=s+r;for(let i=-r;is||i<0||i>s?24575:0,o=e.ay(Math.round(n),0,e.aj),a=e.ay(Math.round(i),0,e.aj);t.emplaceBack(o+r,a)}const a=(e,t)=>{const r=t*n+e;i.emplaceBack(r+1,r,r+n),i.emplaceBack(r+n,r+n+1,r+1)};for(let e=1;e<129;e++)for(let t=1;t<129;t++)a(t,e);return[0,129].forEach(e=>{for(let t=0;t<130;t++)a(t,e),a(e,t)}),[t,i,32768]}(),o=t.context;this.gridBuffer=o.createVertexBuffer(n,e.bc.members),this.gridIndexBuffer=o.createIndexBuffer(r),this.gridSegments=e.bd.simpleSegment(0,0,n.length,r.length),this.gridNoSkirtSegments=e.bd.simpleSegment(0,0,n.length,s),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new Zr(i.map),this.orthoMatrix=e.bz(),e.ca(this.orthoMatrix,"globe"===this.painter.transform.projection.name?.015:0,e.aj,0,e.aj,0,1);const a=o.gl;this._overlapStencilMode=new Hi({func:a.GEQUAL,mask:255},0,255,a.KEEP,a.KEEP,a.REPLACE),this._previousZoom=t.transform.zoom,this.pool=[],this._findCoveringTileCache={},this._tilesDirty={},this.style=i,this._useVertexMorphing=!0,this._exaggeration=1,this._mockSourceCache=new qr(i.map),this._pendingGroundEffectLayers=[]}set style(e){e.on("data",this._onStyleDataEvent.bind(this)),this._style=e,this._style.map.on("moveend",()=>{this._clearLineLayersFromRenderCache()})}update(t,i,n){if(t&&t.terrain){this._style!==t&&(this.style=t,this._evaluationZoom=void 0);const r=t.terrain.properties,s=0===t.terrain.drapeRenderMode,o=t.terrain.isZoomDependent();this._previousUpdateTimestamp=this.enabled?this._updateTimestamp:void 0,this._updateTimestamp=e.q.now();const a=t.terrain&&t.terrain.scope,l=r.get("source"),c=s?this._mockSourceCache:t.getSourceCache(l,a);if(!c)return void e.w(`Couldn't find terrain source "${l}".`);if(this.sourceCache=c,this._attenuationRange=t.terrain.getAttenuationRange(),this._exaggeration=o?this.calculateExaggeration(i):r.get("exaggeration"),!i.projection.requiresDraping&&o&&0===this._exaggeration)return void this._disable();this.enabled=!0;const h=()=>{this.sourceCache.used&&e.w(`Raster DEM source '${this.sourceCache.id}' is used both for terrain and as layer source.\nThis leads to lower resolution of hillshade. For full hillshade resolution but higher memory consumption, define another raster DEM source.`);const t=this.getScaledDemTileSize();this.sourceCache.update(i,t,!0),this.resetTileLookupCache(this.sourceCache.id)};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,h(),this._initializing=!0),h(),i.updateElevation(!0,n),this.resetTileLookupCache(this.proxySourceCache.id),this.proxySourceCache.update(i),this._emptyDEMTextureDirty=!0,this._previousZoom=i.zoom}else this._disable()}calculateExaggeration(t){if(this._attenuationRange&&t.zoom>=Math.ceil(this._attenuationRange[1]))return this._style.terrain.getExaggeration(t.zoom);const i=this._previousCameraAltitude,n=t.getFreeCameraOptions().position.z/t.pixelsPerMeter*t.worldSize;this._previousCameraAltitude=n;const r=null!=i?n-i:Number.MAX_VALUE;if(Math.abs(r)<2)return this._exaggeration;const s=t.zoom,o=this._style.terrain;if(!this._previousUpdateTimestamp)return o.getExaggeration(s);let a=s-this._previousZoom;const l=this._previousUpdateTimestamp;let c=s;null!=this._evaluationZoom&&(c=this._evaluationZoom,Math.abs(s-c)>.5&&(a=.5*(s-c+a)),a*r<0&&(c+=a)),this._evaluationZoom=c;const h=o.getExaggeration(c),d=h===o.getExaggeration(Math.max(0,c-.1));if(d&&Math.abs(h-this._exaggeration)<.01)return h;let u=Math.min(.1,.00375*(this._updateTimestamp-l));return(d||h<.1||Math.abs(a)<1e-4)&&(u=Math.min(.2,4*u)),e.ai(this._exaggeration,h,u)}resetTileLookupCache(e){this._findCoveringTileCache[e]={}}attenuationRange(){return this._attenuationRange}getDemUpscale(){return this.proxySourceCache.getSource().tileSize/128}getScaledDemTileSize(){return this.sourceCache.getSource().tileSize/128*this.proxySourceCache.getSource().tileSize}_onStyleDataEvent(e){e.coord&&"source"===e.dataType?this._clearRenderCacheForTile(e.sourceCacheId,e.coord):"style"===e.dataType&&(this.invalidateRenderCache=!0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this._previousCameraAltitude=void 0)}_disable(){if(this.enabled&&(this.enabled=!1,this._emptyDEMTextureDirty=!0,this._sharedDepthStencil=void 0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this.proxySourceCache.deallocRenderCache(),this._style))for(const e in this._style._mergedSourceCaches)this._style._mergedSourceCaches[e].usedForTerrain=!1}destroy(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this.pool.forEach(e=>e.fb.destroy()),this.pool=[],this.framebufferCopyTexture&&this.framebufferCopyTexture.destroy()}_source(){return this.enabled?this.sourceCache:null}isUsingMockSource(){return this.sourceCache===this._mockSourceCache}exaggeration(){return this.enabled?this._exaggeration:0}get visibleDemTiles(){return this._visibleDemTiles}get drapeBufferSize(){const e=2*this.proxySourceCache.getSource().tileSize;return[e,e]}set useVertexMorphing(e){this._useVertexMorphing=e}updateTileBinding(t){if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;const i=this.proxySourceCache,n=this.painter.transform;this._initializing&&(this._initializing=0===n._centerAltitude&&-1===this.getAtPointOrZero(e.ac.fromLngLat(n.center),-1),this._emptyDEMTextureDirty=!this._initializing);const r=this.proxyCoords=i.getIds().map(e=>{const t=i.getTileByID(e).tileID;return t.projMatrix=n.calculateProjMatrix(t.toUnwrapped()),t});!function(t,i){const n=i.transform.pointCoordinate(i.transform.getCameraPoint()),r=new e.P(n.x,n.y);t.sort((t,i)=>{if(i.overscaledZ-t.overscaledZ)return i.overscaledZ-t.overscaledZ;const n=new e.P(t.canonical.x+(1<{this.proxyToSource[e.key]={}}),this.terrainTileForTile={};const o=this._style._mergedSourceCaches;for(const e in o){const i=o[e];if(!i.used)continue;if(i!==this.sourceCache&&this.resetTileLookupCache(i.id),this._setupProxiedCoordsForOrtho(i,t[e],s),i.usedForTerrain)continue;const n=t[e];i.getSource().reparseOverscaled&&this._assignTerrainTiles(n)}this.proxiedCoords[i.id]=r.map(e=>new Jr(e,e.key,this.orthoMatrix)),this._assignTerrainTiles(r),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(s),this.renderingToTexture=!1;const a={};this._visibleDemTiles=[];for(const e of this.proxyCoords){const t=this.terrainTileForTile[e.key];if(!t)continue;const i=t.tileID.key;i in a||(this._visibleDemTiles.push(t),a[i]=i)}}_assignTerrainTiles(e){this._initializing||e.forEach(e=>{if(this.terrainTileForTile[e.key])return;const t=this._findTileCoveringTileID(e,this.sourceCache);t&&(this.terrainTileForTile[e.key]=t)})}_prepareDEMTextures(){const e=this.painter.context,t=e.gl;for(const i in this.terrainTileForTile){const n=this.terrainTileForTile[i],r=n.dem;!r||n.demTexture&&!n.needsDEMTextureUpload||(e.activeTexture.set(t.TEXTURE1),tr(this.painter,n,r))}}_prepareDemTileUniforms(e,t,i,n){if(!t||null==t.demTexture)return!1;const r=e.tileID.canonical,s=Math.pow(2,t.tileID.canonical.z-r.z),o=n||"";return i[`u_dem_tl${o}`]=[r.x*s%1,r.y*s%1],i[`u_dem_scale${o}`]=s,!0}get emptyDEMTexture(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}_getLoadedAreaMinimum(){if(!this.enabled)return 0;let e=0;const t=this._visibleDemTiles.reduce((t,i)=>{if(!i.dem)return t;const n=i.dem.tree.minimums[0];return n>0&&e++,t+n},0);return e?t/e:0}_updateEmptyDEMTexture(){const t=this.painter.context,i=t.gl;t.activeTexture.set(i.TEXTURE2);const n=this._getLoadedAreaMinimum(),r=new e.dG({width:1,height:1},new Float32Array([n]));this._emptyDEMTextureDirty=!1;let s=this._emptyDEMTexture;return s?s.update(r,{premultiply:!1}):s=this._emptyDEMTexture=new e.T(t,r,i.R32F,{premultiply:!1}),s}setupElevationDraw(t,i,n){const r=this.painter.context,s=r.gl,o={u_dem:2,u_dem_prev:4,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_depth_range_unpack:[0,1],u_occluder_half_size:16,u_occlusion_depth_offset:-1e-4,u_exaggeration:0};o.u_exaggeration=this.exaggeration();let a=null,l=null,c=1;if(n&&n.morphing&&this._useVertexMorphing){const e=n.morphing.srcDemTile,i=n.morphing.dstDemTile;c=n.morphing.phase,e&&i&&(this._prepareDemTileUniforms(t,e,o,"_prev")&&(l=e),this._prepareDemTileUniforms(t,i,o)&&(a=i))}const h=e=>e&&e.demTexture&&this.painter.linearFloatFilteringSupported()?s.LINEAR:s.NEAREST;let d=null;var u;if(this.enabled?l&&a?(d=a.demTexture,r.activeTexture.set(s.TEXTURE4),l.demTexture.bind(h(l),s.CLAMP_TO_EDGE),o.u_dem_lerp=c):(a=this.terrainTileForTile[t.tileID.key],d=this._prepareDemTileUniforms(t,a,o)?a.demTexture:this.emptyDEMTexture):d=this.emptyDEMTexture,r.activeTexture.set(s.TEXTURE2),d&&(o.u_dem_size=1===(u=d).size[0]?1:u.size[0]-2,d.bind(h(a),s.CLAMP_TO_EDGE)),this.painter.setupDepthForOcclusion(n&&n.useDepthForOcclusion,i,o),n&&n.useMeterToDem&&a){const t=(1<{if(c===i)return;const n=[Wr[i],"PROJECTION_GLOBE_VIEW"];d&&n.push("CUSTOM_ANTIALIASING");const r=t.isTileAffectedByFog(e);l=t.getOrCreateProgram("globeRaster",{defines:n,overrideFog:r}),c=i},f=t.colorModeForRenderPass(),p=new Yi(a.LEQUAL,Yi.ReadWrite,t.depthRangeFor3D);Vr.update(s);const m=e.dz(h),g=[e.aD(h.center.lng),e.aH(h.center.lat)],_=t.globeSharedBuffers,y=[h.width*e.q.devicePixelRatio,h.height*e.q.devicePixelRatio],v=Float32Array.from(h.globeMatrix),x={useDenormalizedUpVectorScale:!0};{const h=t.transform,d=Ur(h.zoom,i.exaggeration(),i.sourceCache._source.tileSize);c=-1;const b=a.TRIANGLES;for(const c of r){const r=n.getTile(c),w=Hi.disabled,S=i.prevTerrainTileForTile[c.key],T=i.terrainTileForTile[c.key];jr(S,T)&&Vr.newMorphing(c.key,S,T,s,250),o.activeTexture.set(a.TEXTURE0),r.texture&&r.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE);const k=Vr.getMorphValuesForProxy(c.key),M=k?1:0;k&&e.L(x,{morphing:{srcDemTile:k.from,dstDemTile:k.to,phase:e.dx(k.phase)}});const A=e.dA(c.canonical),C=e.dB(A.getCenter().lat),D=e.dC(c.canonical,A,C,h.worldSize/h._pixelsPerMercatorPixel),L=e.bh(e.dD(c.canonical)),E=Hr(h.expandedFarZProjMatrix,v,m,L,e.ah(h.zoom),g,h.frustumCorners.TL,h.frustumCorners.TR,h.frustumCorners.BR,h.frustumCorners.BL,h.globeCenterInViewSpace,h.globeRadius,y,d,h._farZ,D);if(u(c,M),l&&(i.setupElevationDraw(r,l,x),t.uploadCommonUniforms(o,l,c.toUnwrapped()),_)){const[e,i,n]=_.getGridBuffers(C,0!==d);l.draw(t,b,p,w,f,Wi.backCCW,E,"globe_raster",e,i,n)}}}if(_&&(t.renderDefaultNorthPole||t.renderDefaultSouthPole)){const s=["GLOBE_POLES","PROJECTION_GLOBE_VIEW"];d&&s.push("CUSTOM_ANTIALIASING"),l=t.getOrCreateProgram("globeRaster",{defines:s});for(const s of r){const{x:r,y:c,z:d}=s.canonical,u=0===c,m=c===(1<e.draw(t,a.TRIANGLES,p,Hi.disabled,f,Wi.disabled,Hr(h.expandedFarZProjMatrix,_,_,T,0,g,h.frustumCorners.TL,h.frustumCorners.TR,h.frustumCorners.BR,h.frustumCorners.BL,h.globeCenterInViewSpace,h.globeRadius,y,0,h._farZ),"globe_pole_raster",i,w,S);i.setupElevationDraw(c,l,x),t.uploadCommonUniforms(o,l,s.toUnwrapped()),u&&t.renderDefaultNorthPole&&k(l,v),m&&t.renderDefaultSouthPole&&(_=e.cP(e.bz(),_,[1,-1,1]),k(l,b))}}}}(t,i,n,r,s);else{const o=t.context,a=o.gl;let l,c;const h=t.shadowRenderer,d=an(t,t.longestCutoffRange),u=e=>{if(c===e)return;const i=[];i.push(Wr[e]),d.shouldRenderCutoff&&i.push("RENDER_CUTOFF"),h&&(i.push("RENDER_SHADOWS","DEPTH_TEXTURE"),h.useNormalOffset&&i.push("NORMAL_OFFSET")),l=t.getOrCreateProgram("terrainRaster",{defines:i}),c=e},f=t.colorModeForRenderPass(),p=new Yi(a.LEQUAL,Yi.ReadWrite,t.depthRangeFor3D);Vr.update(s);const m=t.transform,g=Ur(m.zoom,i.exaggeration(),i.sourceCache._source.tileSize);let _=[0,0,0];if(h){const e=t.style.directionalLight,i=t.style.ambientLight;e&&i&&(_=pn(t.style,e,i))}{c=-1;const y=a.TRIANGLES,[v,x]=[i.gridIndexBuffer,i.gridSegments];for(const c of r){const r=n.getTile(c),b=Hi.disabled,w=i.prevTerrainTileForTile[c.key],S=i.terrainTileForTile[c.key];jr(w,S)&&Vr.newMorphing(c.key,w,S,s,250),o.activeTexture.set(a.TEXTURE0),r.texture&&r.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE);const T=Vr.getMorphValuesForProxy(c.key),k=T?1:0;let M;T&&(M={morphing:{srcDemTile:T.from,dstDemTile:T.to,phase:e.dx(T.phase)}});const A=Br(c.projMatrix,$r(c.canonical,m.renderWorldCopies)?g/10:g,_);if(u(k),!l)continue;i.setupElevationDraw(r,l,M);const C=c.toUnwrapped();h&&h.setupShadows(C,l),t.uploadCommonUniforms(o,l,C,null,d),l.draw(t,y,p,b,f,Wi.backCCW,A,"terrain_raster",i.gridBuffer,v,x)}}}}(i,this,this.proxySourceCache,t,this._updateTimestamp),this.renderingToTexture=!0,i.gpuTimingDeferredRenderEnd(),t.splice(0,t.length))}renderBatch(t){if(0===this._drapedRenderBatches.length)return t+1;this.renderingToTexture=!0;const i=this.painter,n=this.painter.context,r=this.proxySourceCache,s=this.proxiedCoords[r.id],o=this._drapedRenderBatches.shift(),a=i.style.order,l=[];let c=0;for(const h of s){const s=r.getTileByID(h.proxyTileKey),d=r.proxyCachedFBO[h.key]?r.proxyCachedFBO[h.key][t]:void 0,u=void 0!==d?r.renderCache[d]:this.pool[c++],f=void 0!==d;if(s.texture=u.tex,f&&!u.dirty){l.push(s.tileID);continue}let p;n.bindFramebuffer.set(u.fb.framebuffer),this.renderedToTile=!1,u.dirty&&(n.clear({color:e.am.transparent,stencil:0}),u.dirty=!1);for(let e=o.start;e<=o.end;++e){const t=i.style._mergedLayers[a[e]];if(t.isHidden(i.transform.zoom))continue;const r=i.style.getLayerSourceCache(t),s=r?this.proxyToSource[h.key][r.id]:[h];if(!s)continue;const o=s;n.viewport.set([0,0,u.fb.width,u.fb.height]),p!==(r?r.id:null)&&(this._setupStencil(u,s,t,r),p=r?r.id:null),i.renderLayer(i,r,t,o)}if(0===this._drapedRenderBatches.length)for(const e of this._pendingGroundEffectLayers){const t=i.style._mergedLayers[a[e]];if(t.isHidden(i.transform.zoom))continue;const r=i.style.getLayerSourceCache(t),s=r?this.proxyToSource[h.key][r.id]:[h];if(!s)continue;const o=s;n.viewport.set([0,0,u.fb.width,u.fb.height]),p!==(r?r.id:null)&&(this._setupStencil(u,s,t,r),p=r?r.id:null),i.renderLayer(i,r,t,o)}this.renderedToTile?(u.dirty=!0,l.push(s.tileID)):f||--c,5===c&&(c=0,this.renderToBackBuffer(l))}return this.renderToBackBuffer(l),this.renderingToTexture=!1,n.bindFramebuffer.set(null),n.viewport.set([0,0,i.width,i.height]),o.end+1}postRender(){}isLayerOrderingCorrect(e){const t=e.order.length;let i=-1,n=t;for(let r=0;ri}getMinElevationBelowMSL(){let e=0;return this._visibleDemTiles.filter(e=>e.dem).forEach(t=>{e=Math.min(e,t.dem.tree.minimums[0])}),0===e?e:(e-30)*this._exaggeration}raycast(e,t,i){if(!this._visibleDemTiles)return null;const n=this._visibleDemTiles.filter(e=>e.dem).map(n=>{const r=n.tileID,s=1<(null!==e.t?e.t:Number.MAX_VALUE)-(null!==t.t?t.t:Number.MAX_VALUE));for(const r of n){if(null==r.t)return null;const n=r.tile.dem.tree.raycast(r.minx,r.miny,r.maxx,r.maxy,e,t,i);if(null!=n)return n}return null}_createFBO(){const t=this.painter.context,i=t.gl,n=this.drapeBufferSize;t.activeTexture.set(i.TEXTURE0);const r=new e.T(t,{width:n[0],height:n[1],data:null},i.RGBA8);r.bind(i.LINEAR,i.CLAMP_TO_EDGE);const s=t.createFramebuffer(n[0],n[1],!0,null);return s.colorAttachment.set(r.texture),s.depthAttachment=new Yr(t,s.framebuffer),void 0===this._sharedDepthStencil?(this._sharedDepthStencil=t.createRenderbuffer(t.gl.DEPTH_STENCIL,n[0],n[1]),this._stencilRef=0,s.depthAttachment.set(this._sharedDepthStencil),t.clear({stencil:0})):s.depthAttachment.set(this._sharedDepthStencil),t.extTextureFilterAnisotropic&&i.texParameterf(i.TEXTURE_2D,t.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,t.extTextureFilterAnisotropicMax),{fb:s,tex:r,dirty:!1}}_initFBOPool(){for(;this.pool.length{const t=this._style._mergedLayers[e],i=t.isHidden(this.painter.transform.zoom);return"hillshade"===t.type||"custom"===t.type?!i&&t.shouldRedrape():!i&&t.hasTransition()})}_clearLineLayersFromRenderCache(){let t=!1;for(const e of this._style.getSources())if(e instanceof et){t=!0;break}if(!t)return;const i={};for(let t=0;te>t.end)||e.w("fill-extrusion with flood lighting and/or ground ambient occlusion should be moved to be on top of all draped layers.")}this._drapedRenderBatches=n}_setupRenderCache(e){const t=this.proxySourceCache;if(this._shouldDisableRenderCache()||this.invalidateRenderCache){if(this.invalidateRenderCache=!1,t.renderCache.length>t.renderCachePool.length){const e=Object.values(t.proxyCachedFBO);t.proxyCachedFBO={};for(let i=0;i=0;r--){const s=i[r];if(t.getTileByID(s.key),void 0!==t.proxyCachedFBO[s.key]){const i=e[s.key],r=this.proxyToSource[s.key];let o=0;for(const e in r){const t=r[e],s=i[e];if(!s||s.length!==t.length||t.some((t,i)=>t!==s[i]||n[e]&&n[e].hasOwnProperty(t.key))){o=-1;break}++o}for(const e in t.proxyCachedFBO[s.key])t.renderCache[t.proxyCachedFBO[s.key][e]].dirty=o<0||o!==Object.values(i).length}}const r=[...this._drapedRenderBatches];r.sort((e,t)=>t.end-t.start-(e.end-e.start));for(const e of r)for(const n of i){if(t.proxyCachedFBO[n.key])continue;let i=t.renderCachePool.pop();void 0===i&&t.renderCache.length<50&&(i=t.renderCache.length,t.renderCache.push(this._createFBO())),void 0!==i&&(t.proxyCachedFBO[n.key]={},t.proxyCachedFBO[n.key][e.start]=i,t.renderCache[i].dirty=!0)}this._tilesDirty={}}_setupStencil(e,t,i,n){if(!n||!this._sourceTilesOverlap[n.id])return void(this._overlapStencilType&&(this._overlapStencilType=!1));const r=this.painter.context,s=r.gl;if(t.length<=1)return void(this._overlapStencilType=!1);let o;if(i.isTileClipped())o=t.length,this._overlapStencilMode.test={func:s.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(t[0].overscaledZ>t[t.length-1].overscaledZ))return void(this._overlapStencilType=!1);o=1,this._overlapStencilMode.test={func:s.GREATER,mask:255},this._overlapStencilType="Mask"}this._stencilRef+o>255&&(r.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=o,this._overlapStencilMode.ref=this._stencilRef,i.isTileClipped()&&this._renderTileClippingMasks(t,this._overlapStencilMode.ref)}clipOrMaskOverlapStencilType(){return"Clip"===this._overlapStencilType||"Mask"===this._overlapStencilType}stencilModeForRTTOverlap(e){return this.renderingToTexture&&this._overlapStencilType?("Clip"===this._overlapStencilType&&(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[e.key]),this._overlapStencilMode):Hi.disabled}_renderTileClippingMasks(e,t){const i=this.painter,n=this.painter.context,r=n.gl;i._tileClippingMaskIDs={},n.setColorMode(Ni.disabled),n.setDepthMode(Yi.disabled);const s=i.getOrCreateProgram("clippingMask");for(const n of e){const e=i._tileClippingMaskIDs[n.key]=--t;s.draw(i,r.TRIANGLES,Yi.disabled,new Hi({func:r.ALWAYS,mask:0},e,255,r.KEEP,r.KEEP,r.REPLACE),Ni.disabled,Wi.disabled,Gr(n.projMatrix),"$clipping",i.tileExtentBuffer,i.quadTriangleIndexBuffer,i.tileExtentSegments)}}pointCoordinate(t){const i=this.painter.transform;if(t.x<0||t.x>i.width||t.y<0||t.y>i.height)return null;const n=[t.x,t.y,1,1];e.aA(n,n,i.pixelMatrixInverse),e.cH(n,n,1/n[3]),n[0]/=i.worldSize,n[1]/=i.worldSize;const r=i._camera.position,s=e.cb(1,i.center.lat),o=[r[0],r[1],r[2]/s,0],a=e.d7([],n.slice(0,3),o);e.au(a,a);const l=this.raycast(o,a,this._exaggeration);return null!==l&&l?(e.bE(o,o,a,l),o[3]=o[2],o[2]*=s,o):null}_setupProxiedCoordsForOrtho(t,i,n){if(t.getSource()instanceof e.aP)return this._setupProxiedCoordsForImageSource(t,i,n);this._findCoveringTileCache[t.id]=this._findCoveringTileCache[t.id]||{};const r=this.proxiedCoords[t.id]=[],s=this.proxyCoords;for(let e=0;et.overscaledZ-e.overscaledZ)}_setupProxiedCoordsForImageSource(t,i,n){if(!t.getSource().loaded())return;const r=this.proxiedCoords[t.id]=[],s=this.proxyCoords,o=t.getSource(),a=o.tileID;if(!a)return;const l=new e.P(a.x,a.y)._div(1<(e.min.x=Math.min(e.min.x,t.x-l.x),e.min.y=Math.min(e.min.y,t.y-l.y),e.max.x=Math.max(e.max.x,t.x-l.x),e.max.y=Math.max(e.max.y,t.y-l.y),e),{min:new e.P(Number.MAX_VALUE,Number.MAX_VALUE),max:new e.P(-Number.MAX_VALUE,-Number.MAX_VALUE)}),h=(t,i)=>{const n=t.wrap+t.canonical.x/(1<o+c.max.x||r+sa+c.max.y};for(let e=0;ee.key===i.tileID.key);if(e)return e}if(i.tileID.key!==t.key){const n=t.canonical.z-i.tileID.canonical.z;let s,o,a;r=e.bz();const l=i.tileID.wrap-t.wrap<0?(s=e.aj>>n,o=s*((i.tileID.canonical.x<=r){const n=t.canonical.z-r;i.getSource().reparseOverscaled?(a=Math.max(t.canonical.z+2,i.transform.tileZoom),o=new e.aM(a,t.wrap,r,t.canonical.x>>n,t.canonical.y>>n)):0!==n&&(a=r,o=new e.aM(a,t.wrap,r,t.canonical.x>>n,t.canonical.y>>n))}o.key!==t.key&&(c.push(o.key),n=i.getTile(o))}const h=e=>{c.forEach(t=>{r[t]=e}),c.length=0};for(a-=1;a>=l&&(!n||!n.hasData());a--){n&&h(n.tileID.key);const e=o.calculateScaledKey(a);if(n=i.getTileByID(e),n&&n.hasData())break;const t=r[e];if(null===t)break;void 0===t?c.push(e):n=i.getTileByID(t)}return h(n?n.tileID.key:null),n&&n.hasData()?n:null}findDEMTileFor(e){return this.enabled?this._findTileCoveringTileID(e,this.sourceCache):null}prepareDrawTile(){this.renderedToTile=!0}_clearRenderCacheForTile(e,t){let i=this._tilesDirty[e];i||(i=this._tilesDirty[e]={}),i[t.key]=!0}}function Qr(t,i,n){const r=function(t,i,n){const r=e.bG(i,t),s=e.bG(n,[.2126,.7152,.0722]),o=(e,t,i)=>(1-i)*e+i*t,a=o(1-.3*Math.min(s,1),1,Math.min(r+1,1));return o(.92,1,Math.asin(e.ay(i[2],-1,1))/Math.PI+.5)*a}(t,[0,0,1],i),s=[0,0,0];e.c1(s,n.slice(0,3),r);const o=[0,0,0];e.c1(o,i.slice(0,3),t[2]);const a=[0,0,0];return e.d5(a,s,o),e.d8(a)}const es=["fill","fillOutline","fillPattern","line","linePattern","background","backgroundPattern","hillshade","raster"],ts=["stars","rainParticle","snowParticle","fillExtrusion","fillExtrusionGroundEffect","elevatedStructures","model","symbol"];class is{static cacheKey(e,t,i,n){let r=`${t}${n?n.cacheKey:""}`;for(const t of i)e.usedDefines.includes(t)&&(r+=`/${t}`);return r}constructor(t,i,n,r,s,o){const a=t.gl;this.program=a.createProgram(),this.configuration=r,this.name=i,this.fixedDefines=[...o];const l=r?r.getBinderAttributes():[],c=(n.staticAttributes||[]).concat(l);let h=r?r.defines():[];h=h.concat(o.map(e=>`#define ${e}`));const d="#version 300 es\n";let u=d+h.concat("precision mediump float;",Xn,Gn.fragmentSource).join("\n");for(const e of n.fragmentIncludes)u+=`\n${Un[e]}`;u+=`\n${n.fragmentSource}`;let f=d+h.concat("precision highp float;",Xn,Gn.vertexSource).join("\n");for(const e of n.vertexIncludes)f+=`\n${Un[e]}`;this.forceManualRenderingForInstanceIDShaders=t.forceManualRenderingForInstanceIDShaders&&-1!==n.vertexSource.indexOf("gl_InstanceID"),this.forceManualRenderingForInstanceIDShaders&&(f+="\nuniform int u_instanceID;\n"),f+=`\n${n.vertexSource}`,this.forceManualRenderingForInstanceIDShaders&&(f=f.replaceAll("gl_InstanceID","u_instanceID"));const p=a.createShader(a.FRAGMENT_SHADER);if(a.isContextLost())return void(this.failedToCreate=!0);a.shaderSource(p,u),a.compileShader(p),a.attachShader(this.program,p);const m=a.createShader(a.VERTEX_SHADER);if(a.isContextLost())this.failedToCreate=!0;else{a.shaderSource(m,f),a.compileShader(m),a.attachShader(this.program,m),this.attributes={},this.numAttributes=c.length;for(let e=0;e({u_instanceID:new e.cd(t)}))(t)),(o.includes("TERRAIN")||-1!==i.indexOf("symbol")||-1!==i.indexOf("circle"))&&(this.terrainUniforms=(t=>({u_dem:new e.cd(t),u_dem_prev:new e.cd(t),u_dem_tl:new e.cg(t),u_dem_scale:new e.cf(t),u_dem_tl_prev:new e.cg(t),u_dem_scale_prev:new e.cf(t),u_dem_size:new e.cf(t),u_dem_lerp:new e.cf(t),u_exaggeration:new e.cf(t),u_depth:new e.cd(t),u_depth_size_inv:new e.cg(t),u_depth_range_unpack:new e.cg(t),u_occluder_half_size:new e.cf(t),u_occlusion_depth_offset:new e.cf(t),u_meter_to_dem:new e.cf(t),u_label_plane_matrix_inv:new e.ch(t)}))(t)),o.includes("GLOBE")&&(this.globeUniforms=(t=>({u_tile_tl_up:new e.ce(t),u_tile_tr_up:new e.ce(t),u_tile_br_up:new e.ce(t),u_tile_bl_up:new e.ce(t),u_tile_up_scale:new e.cf(t)}))(t)),o.includes("FOG")&&(this.fogUniforms=(t=>({u_fog_matrix:new e.ch(t),u_fog_range:new e.cg(t),u_fog_color:new e.d0(t),u_fog_horizon_blend:new e.cf(t),u_fog_vertical_limit:new e.cg(t),u_fog_temporal_offset:new e.cf(t),u_frustum_tl:new e.ce(t),u_frustum_tr:new e.ce(t),u_frustum_br:new e.ce(t),u_frustum_bl:new e.ce(t),u_globe_pos:new e.ce(t),u_globe_radius:new e.cf(t),u_globe_transition:new e.cf(t),u_is_globe:new e.cd(t),u_viewport:new e.cg(t)}))(t)),o.includes("RENDER_CUTOFF")&&(this.cutoffUniforms=(t=>({u_cutoff_params:new e.d0(t)}))(t)),o.includes("LIGHTING_3D_MODE")&&(this.lightsUniforms=(t=>({u_lighting_ambient_color:new e.ce(t),u_lighting_directional_dir:new e.ce(t),u_lighting_directional_color:new e.ce(t),u_ground_radiance:new e.ce(t)}))(t)),o.includes("RENDER_SHADOWS")&&(this.shadowUniforms=(t=>({u_light_matrix_0:new e.ch(t),u_light_matrix_1:new e.ch(t),u_fade_range:new e.cg(t),u_shadow_normal_offset:new e.ce(t),u_shadow_intensity:new e.cf(t),u_shadow_texel_size:new e.cf(t),u_shadow_map_resolution:new e.cf(t),u_shadow_direction:new e.ce(t),u_shadow_bias:new e.ce(t),u_shadowmap_0:new e.cd(t),u_shadowmap_1:new e.cd(t)}))(t))}}setTerrainUniformValues(e,t){if(!this.terrainUniforms)return;const i=this.terrainUniforms;if(!this.failedToCreate){e.program.set(this.program);for(const e in t)i[e]&&i[e].set(this.program,e,t[e])}}setGlobeUniformValues(e,t){if(!this.globeUniforms)return;const i=this.globeUniforms;if(!this.failedToCreate){e.program.set(this.program);for(const e in t)i[e]&&i[e].set(this.program,e,t[e])}}setFogUniformValues(e,t){if(!this.fogUniforms)return;const i=this.fogUniforms;if(!this.failedToCreate){e.program.set(this.program);for(const e in t)i[e].set(this.program,e,t[e])}}setCutoffUniformValues(e,t){if(!this.cutoffUniforms)return;const i=this.cutoffUniforms;if(!this.failedToCreate){e.program.set(this.program);for(const e in t)i[e].set(this.program,e,t[e])}}setLightsUniformValues(e,t){if(!this.lightsUniforms)return;const i=this.lightsUniforms;if(!this.failedToCreate){e.program.set(this.program);for(const e in t)i[e].set(this.program,e,t[e])}}setShadowUniformValues(e,t){if(this.failedToCreate||!this.shadowUniforms)return;const i=this.shadowUniforms;e.program.set(this.program);for(const e in t)i[e].set(this.program,e,t[e])}_drawDebugWireframe(t,i,n,r,s,o,a,l,c,h){const d=t.options.wireframe;if(!1===d.terrain&&!1===d.layers2D&&!1===d.layers3D)return;const u=t.context;if(!(()=>!(!d.terrain||"terrainRaster"!==this.name&&"globeRaster"!==this.name)||!(!d.layers2D||t._terrain&&t._terrain.renderingToTexture||!es.includes(this.name))||!(!d.layers3D||!ts.includes(this.name)))())return;const f=u.gl,p=t.wireframeDebugCache.getLinesFromTrianglesBuffer(t.frameCounter,s,u);if(!p)return;const m=[...this.fixedDefines];m.push("DEBUG_WIREFRAME");const g=t.getOrCreateProgram(this.name,{config:this.configuration,defines:m});u.program.set(g.program);const _=(e,t,i)=>{if(t[e]&&i[e])for(const n in t[e])i[e][n]&&i[e][n].set(i.program,n,t[e][n].current)};c&&c.setUniforms(g.program,u,g.binderUniforms,a,{zoom:l}),_("fixedUniforms",this,g),_("terrainUniforms",this,g),_("globeUniforms",this,g),_("fogUniforms",this,g),_("lightsUniforms",this,g),_("shadowUniforms",this,g),p.bind(),u.setColorMode(new Ni([f.ONE,f.ONE_MINUS_SRC_ALPHA,f.ZERO,f.ONE],e.am.transparent,[!0,!0,!0,!1])),u.setDepthMode(new Yi(i.func===f.LESS?f.LEQUAL:i.func,Yi.ReadOnly,i.range)),u.setStencilMode(Hi.disabled);const y=3*o.primitiveLength*2,v=3*o.primitiveOffset*2*2;if(this.forceManualRenderingForInstanceIDShaders){const e=h||1;for(let t=0;t1?f.drawElementsInstanced(f.LINES,y,f.UNSIGNED_SHORT,v,h):f.drawElements(f.LINES,y,f.UNSIGNED_SHORT,v);s.bind(),u.program.set(this.program),u.setDepthMode(i),u.setStencilMode(n),u.setColorMode(r)}checkUniforms(e,t,i){if(this.fixedDefines.includes(t))for(const n of Object.keys(i))if(!i[n].initialized)throw new Error(`Program '${this.name}', from draw '${e}': uniform ${n} not set but required by ${t} being defined`)}draw(e,t,i,n,r,s,o,a,l,c,h,d,u,f,p,m){const g=e.context,_=g.gl;if(this.failedToCreate)return;g.program.set(this.program),g.setDepthMode(i),g.setStencilMode(n),g.setColorMode(r),g.setCullFace(s);for(const e of Object.keys(this.fixedUniforms))this.fixedUniforms[e].set(this.program,e,o[e]);f&&f.setUniforms(this.program,g,this.binderUniforms,d,{zoom:u});const y={[_.POINTS]:1,[_.LINES]:2,[_.TRIANGLES]:3,[_.LINE_STRIP]:1}[t];this.checkUniforms(a,"RENDER_SHADOWS",this.shadowUniforms);const v=m&&m>0?1:void 0;for(const s of h.get()){const o=s.vaos||(s.vaos={});if((o[a]||(o[a]=new Kn)).bind(g,this,l,f?f.getPaintVertexBuffers():[],c,s.vertexOffset,p||[],v),this.forceManualRenderingForInstanceIDShaders){const e=m||1;for(let i=0;i1?_.drawElementsInstanced(t,s.primitiveLength*y,_.UNSIGNED_SHORT,s.primitiveOffset*y*2,m):c?_.drawElements(t,s.primitiveLength*y,_.UNSIGNED_SHORT,s.primitiveOffset*y*2):_.drawArrays(t,s.vertexOffset,s.vertexLength);t===_.TRIANGLES&&c&&this._drawDebugWireframe(e,i,n,r,c,s,d,u,f,m)}}}function ns(t,i,n=0){const r=Math.pow(2,i.tileID.overscaledZ),s=i.tileSize*Math.pow(2,t.transform.tileZoom)/r,o=s*(i.tileID.canonical.x+i.tileID.wrap*r),a=s*i.tileID.canonical.y;return{u_image:0,u_texsize:i.imageAtlasTexture?i.imageAtlasTexture.size:[0,0],u_tile_units_to_pixels:1/e.aw(i,1,t.transform.tileZoom),u_pixel_coord_upper:[o>>16,a>>16],u_pixel_coord_lower:[65535&o,65535&a],u_pattern_transition:n}}const rs={terrain:0,flat:1},ss=e.bz(),os=(t,i,n,r,s,o,a,l,c,h,d,u,f,p,m,g,_,y)=>{const v=i.style.light,x=v.properties.get("position"),b=[x.x,x.y,x.z],w=e.dJ();"viewport"===v.properties.get("anchor")&&(e.dK(w,-i.transform.angle),e.dL(b,b,w));const S=v.properties.get("color").toPremultipliedRenderColor(null),T=i.transform,k={u_matrix:t,u_lightpos:b,u_lightintensity:v.properties.get("intensity"),u_lightcolor:[S.r,S.g,S.b],u_vertical_gradient:+n,u_opacity:r,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:ss,u_merc_center:[0,0],u_up_dir:[0,0,0],u_height_lift:0,u_height_type:rs[h],u_base_type:rs[d],u_ao:s,u_edge_radius:o,u_width_scale:a,u_flood_light_color:m,u_vertical_scale:g,u_flood_light_intensity:_,u_ground_shadow_factor:y};return"globe"===T.projection.name&&(k.u_tile_id=[l.canonical.x,l.canonical.y,1<({u_matrix:e,u_edge_radius:t,u_width_scale:i,u_vertical_scale:n,u_height_type:rs[r],u_base_type:rs[s]}),ls=(t,i,n,r,s,o,a,l,c,h,d,u,f,p,m,g,_,y)=>{const v=os(t,i,n,r,s,o,a,l,h,d,u,f,p,m,g,_,1,[0,0,0]),x={u_height_factor:-Math.pow(2,l.overscaledZ)/c.tileSize/8};return e.h(v,ns(i,c,y),x)},cs=(e,t,i)=>({u_matrix:e,u_emissive_strength:t,u_ground_shadow_factor:i}),hs=(t,i,n,r,s,o=0)=>e.h(cs(t,i,s),ns(n,r,o)),ds=(e,t,i,n)=>({u_matrix:e,u_world:i,u_emissive_strength:t,u_ground_shadow_factor:n}),us=(t,i,n,r,s,o,a=0)=>e.h(hs(t,i,n,r,o,a),{u_world:s}),fs=(e,t)=>({u_matrix:e,u_ground_shadow_factor:t}),ps=(e,t,i,n,r)=>({u_matrix:e,u_camera_pos:[t[0],t[1],t[2]],u_depth_bias:i,u_height_scale:n,u_reset_depth:r}),ms=(e,t)=>({u_matrix:e,u_normal_matrix:t,u_opacity:1}),gs=e=>({u_matrix:e}),_s=e=>({u_matrix:e}),ys=(t,i,n,r,s,o,a,l)=>{const c=e.aj/o.tileSize;return{u_matrix:t,u_inv_rot_matrix:i,u_camera_to_center_distance:n.getCameraToCenterDistance(l),u_extrude_scale:[n.pixelsToGLUnits[0]/c,n.pixelsToGLUnits[1]/c],u_zoom_transition:r,u_tile_id:a,u_merc_center:s}},vs=(e,t,i=1)=>({u_matrix:e,u_color:t,u_overlay:0,u_overlay_scale:i}),xs=e.bz(),bs=(t,i,n,r,s,o,a)=>{const l=t.transform,c="globe"===l.projection.name,h=c?e.dM(l.zoom,i.canonical)*l._pixelsPerMercatorPixel:e.aw(n,1,o),d={u_matrix:i.projMatrix,u_extrude_scale:h,u_intensity:a,u_inv_rot_matrix:xs,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(c){d.u_inv_rot_matrix=r,d.u_merc_center=s,d.u_tile_id=[i.canonical.x,i.canonical.y,1<({u_matrix:t,u_normalize_matrix:i,u_globe_matrix:n,u_merc_matrix:r,u_grid_matrix:s,u_tl_parent:o,u_scale_parent:h,u_fade_t:d.mix,u_opacity:d.opacity*u.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:u.paint.get("raster-brightness-min"),u_brightness_high:u.paint.get("raster-brightness-max"),u_saturation_factor:e.dO(u.paint.get("raster-saturation")),u_contrast_factor:e.dN(u.paint.get("raster-contrast")),u_spin_weights:ks(u.paint.get("raster-hue-rotate")),u_perspective_transform:f,u_raster_elevation:p,u_zoom_transition:a,u_merc_center:l,u_cutoff_params:c,u_colorization_mix:ws(e.dP,g,y),u_colorization_offset:Ss(e.dP,_,y),u_color_ramp:m,u_texture_offset:[x/(v+2*x),v/(v+2*x)],u_texture_res:[v+2*x,v+2*x],u_emissive_strength:b});function ks(e){e*=Math.PI/180;const t=Math.sin(e),i=Math.cos(e);return[(2*i+1)/3,(-Math.sqrt(3)*t-i+1)/3,(Math.sqrt(3)*t-i+1)/3]}const Ms=.05,As=(e,t,i,n,r,s,o,a,l,c,h,d)=>({u_matrix:e,u_normalize_matrix:t,u_globe_matrix:i,u_merc_matrix:n,u_grid_matrix:r,u_tl_parent:s,u_scale_parent:c,u_fade_t:h.mix,u_opacity:h.opacity,u_image0:0,u_image1:1,u_raster_elevation:d,u_zoom_transition:o,u_merc_center:a,u_cutoff_params:l}),Cs=(e,t,i,n,r,s,o,a,l,c)=>({u_particle_texture:e,u_particle_texture_side_len:t,u_tile_offset:i,u_velocity:n,u_color_ramp:s,u_velocity_res:r,u_max_speed:o,u_uv_offset:a,u_data_scale:[255*l[0],255*l[1]],u_data_offset:c,u_particle_pos_scale:1.1,u_particle_pos_offset:[Ms,Ms]}),Ds=(e,t,i,n,r,s,o,a,l,c)=>({u_particle_texture:e,u_particle_texture_side_len:t,u_velocity:i,u_velocity_res:n,u_max_speed:r,u_speed_factor:s,u_reset_rate:o,u_rand_seed:Math.random(),u_uv_offset:a,u_data_scale:[255*l[0],255*l[1]],u_data_offset:c,u_particle_pos_scale:1.1,u_particle_pos_offset:[Ms,Ms]}),Ls=e.bz(),Es=(t,i,n,r,s,o,a,l,c,h,d,u,f,p,m,g,_,y,v,x,b,w,S,T)=>{const k=s.transform,M={u_is_size_zoom_constant:+("constant"===t||"source"===t),u_is_size_feature_constant:+("constant"===t||"camera"===t),u_size_t:i?i.uSizeT:0,u_size:i?i.uSize:0,u_camera_to_center_distance:k.getCameraToCenterDistance(v),u_rotate_symbol:+n,u_aspect_ratio:k.width/k.height,u_fade_change:s.options.fadeDuration?s.symbolFadeChange:1,u_matrix:o,u_label_plane_matrix:a,u_coord_matrix:l,u_is_text:+h,u_elevation_from_sea:c?1:0,u_pitch_with_map:+r,u_texsize:d,u_texsize_icon:u,u_texture:0,u_texture_icon:1,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:Ls,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:Ls,u_up_vector:[0,-1,0],u_color_adj_mat:w,u_icon_transition:S||0,u_gamma_scale:r?s.transform.getCameraToCenterDistance(v)*Math.cos(s.terrain?0:s.transform._pitch):1,u_device_pixel_ratio:e.q.devicePixelRatio,u_is_halo:1,u_scale_factor:T||1,u_ground_shadow_factor:x,u_inv_matrix:e.bi(e.bz(),a),u_normal_scale:b};return"globe"===v.name&&(M.u_tile_id=[p.canonical.x,p.canonical.y,1<({u_matrix:e,u_emissive_strength:t,u_opacity:i,u_color:n}),Ps=(t,i,n,r,s,o,a,l,c)=>e.h(function(t,i,n,r,s,o){const{width:a,height:l}=r.imageManager.getPixelSize(i),c=Math.pow(2,o.tileID.overscaledZ),h=o.tileSize*Math.pow(2,r.transform.tileZoom)/c,d=h*(o.tileID.canonical.x+o.tileID.wrap*c),u=h*o.tileID.canonical.y;return{u_image:0,u_pattern_tl:n.tl,u_pattern_br:n.br,u_texsize:[a,l],u_pattern_size:n.displaySize,u_pattern_units_to_pixels:s?[r.transform.width,-1*r.transform.height]:[1/e.aw(o,1,r.transform.tileZoom),1/e.aw(o,1,r.transform.tileZoom)],u_pixel_coord_upper:[d>>16,u>>16],u_pixel_coord_lower:[65535&d,65535&u]}}(0,o,a,r,l,c),{u_matrix:t,u_emissive_strength:i,u_opacity:n}),Rs=new Float32Array(e.bx([])),Os=(t,i,n,r,s,o,a,l,c,h,d,u,f,p=[0,0,0],m)=>{const g=s.style.light,_=g.properties.get("position"),y=[-_.x,-_.y,_.z],v=e.dJ();"viewport"===g.properties.get("anchor")&&(e.dK(v,-s.transform.angle),e.dL(y,y,v));const x="MASK"===d.alphaMode,b=g.properties.get("color").toNonPremultipliedRenderColor(null),w=f.paint.get("model-ambient-occlusion-intensity"),S=f.paint.get("model-color").constantOr(e.am.white).toNonPremultipliedRenderColor(null);return S.a=f.paint.get("model-color-mix-intensity").constantOr(0),{u_matrix:t,u_lighting_matrix:i,u_normal_matrix:n,u_node_matrix:r||Rs,u_lightpos:y,u_lightintensity:g.properties.get("intensity"),u_lightcolor:[b.r,b.g,b.b],u_camera_pos:p,u_opacity:o,u_baseTextureIsAlpha:0,u_alphaMask:+x,u_alphaCutoff:d.alphaCutoff,u_baseColorFactor:a.toNonPremultipliedRenderColor(null).toArray01(),u_emissiveFactor:l.toNonPremultipliedRenderColor(null).toArray01(),u_metallicFactor:c,u_roughnessFactor:h,u_baseColorTexture:Zi,u_metallicRoughnessTexture:Ji,u_normalTexture:Ki,u_occlusionTexture:Qi,u_emissionTexture:en,u_lutTexture:tn,u_color_mix:S.toArray01(),u_aoIntensity:w,u_emissive_strength:u,u_occlusionTextureTransform:m||[0,0,0,0]}},zs=(e,t=Rs,i=Rs)=>({u_matrix:e,u_instance:t,u_node_matrix:i}),Fs={fillExtrusion:t=>({u_matrix:new e.ch(t),u_lightpos:new e.ce(t),u_lightintensity:new e.cf(t),u_lightcolor:new e.ce(t),u_vertical_gradient:new e.cf(t),u_opacity:new e.cf(t),u_edge_radius:new e.cf(t),u_width_scale:new e.cf(t),u_ao:new e.cg(t),u_height_type:new e.cd(t),u_base_type:new e.cd(t),u_tile_id:new e.ce(t),u_zoom_transition:new e.cf(t),u_inv_rot_matrix:new e.ch(t),u_merc_center:new e.cg(t),u_up_dir:new e.ce(t),u_height_lift:new e.cf(t),u_flood_light_color:new e.ce(t),u_vertical_scale:new e.cf(t),u_flood_light_intensity:new e.cf(t),u_ground_shadow_factor:new e.ce(t)}),fillExtrusionDepth:t=>({u_matrix:new e.ch(t),u_edge_radius:new e.cf(t),u_width_scale:new e.cf(t),u_vertical_scale:new e.cf(t),u_height_type:new e.cd(t),u_base_type:new e.cd(t)}),fillExtrusionPattern:t=>({u_matrix:new e.ch(t),u_lightpos:new e.ce(t),u_lightintensity:new e.cf(t),u_lightcolor:new e.ce(t),u_vertical_gradient:new e.cf(t),u_height_factor:new e.cf(t),u_edge_radius:new e.cf(t),u_width_scale:new e.cf(t),u_ao:new e.cg(t),u_height_type:new e.cd(t),u_base_type:new e.cd(t),u_tile_id:new e.ce(t),u_zoom_transition:new e.cf(t),u_inv_rot_matrix:new e.ch(t),u_merc_center:new e.cg(t),u_up_dir:new e.ce(t),u_height_lift:new e.cf(t),u_image:new e.cd(t),u_texsize:new e.cg(t),u_pixel_coord_upper:new e.cg(t),u_pixel_coord_lower:new e.cg(t),u_tile_units_to_pixels:new e.cf(t),u_opacity:new e.cf(t),u_pattern_transition:new e.cf(t)}),fillExtrusionGroundEffect:t=>({u_matrix:new e.ch(t),u_opacity:new e.cf(t),u_ao_pass:new e.cf(t),u_meter_to_tile:new e.cf(t),u_ao:new e.cg(t),u_flood_light_intensity:new e.cf(t),u_flood_light_color:new e.ce(t),u_attenuation:new e.cf(t),u_edge_radius:new e.cf(t),u_fb:new e.cd(t),u_fb_size:new e.cf(t),u_dynamic_offset:new e.cf(t)}),fill:t=>({u_matrix:new e.ch(t),u_emissive_strength:new e.cf(t),u_ground_shadow_factor:new e.ce(t)}),fillPattern:t=>({u_matrix:new e.ch(t),u_emissive_strength:new e.cf(t),u_image:new e.cd(t),u_texsize:new e.cg(t),u_pixel_coord_upper:new e.cg(t),u_pixel_coord_lower:new e.cg(t),u_tile_units_to_pixels:new e.cf(t),u_ground_shadow_factor:new e.ce(t),u_pattern_transition:new e.cf(t)}),fillOutline:t=>({u_matrix:new e.ch(t),u_emissive_strength:new e.cf(t),u_world:new e.cg(t),u_ground_shadow_factor:new e.ce(t)}),fillOutlinePattern:t=>({u_matrix:new e.ch(t),u_emissive_strength:new e.cf(t),u_world:new e.cg(t),u_image:new e.cd(t),u_texsize:new e.cg(t),u_pixel_coord_upper:new e.cg(t),u_pixel_coord_lower:new e.cg(t),u_tile_units_to_pixels:new e.cf(t),u_ground_shadow_factor:new e.ce(t),u_pattern_transition:new e.cf(t)}),building:t=>({u_matrix:new e.ch(t),u_normal_matrix:new e.ch(t),u_opacity:new e.cf(t)}),buildingBloom:t=>({u_matrix:new e.ch(t)}),buildingDepth:t=>({u_matrix:new e.ch(t)}),elevatedStructuresDepth:t=>({u_matrix:new e.ch(t),u_depth_bias:new e.cf(t)}),elevatedStructures:t=>({u_matrix:new e.ch(t),u_ground_shadow_factor:new e.ce(t)}),elevatedStructuresDepthReconstruct:t=>({u_matrix:new e.ch(t),u_camera_pos:new e.ce(t),u_depth_bias:new e.cf(t),u_height_scale:new e.cf(t),u_reset_depth:new e.cf(t)}),circle:e.dT,collisionBox:t=>({u_matrix:new e.ch(t),u_inv_rot_matrix:new e.ch(t),u_camera_to_center_distance:new e.cf(t),u_extrude_scale:new e.cg(t),u_zoom_transition:new e.cf(t),u_merc_center:new e.cg(t),u_tile_id:new e.ce(t)}),collisionCircle:t=>({u_matrix:new e.ch(t),u_inv_matrix:new e.ch(t),u_camera_to_center_distance:new e.cf(t),u_viewport_size:new e.cg(t)}),debug:t=>({u_color:new e.dv(t),u_matrix:new e.ch(t),u_overlay:new e.cd(t),u_overlay_scale:new e.cf(t)}),clippingMask:t=>({u_matrix:new e.ch(t)}),heatmap:t=>({u_extrude_scale:new e.cf(t),u_intensity:new e.cf(t),u_matrix:new e.ch(t),u_inv_rot_matrix:new e.ch(t),u_merc_center:new e.cg(t),u_tile_id:new e.ce(t),u_zoom_transition:new e.cf(t),u_up_dir:new e.ce(t)}),heatmapTexture:t=>({u_image:new e.cd(t),u_color_ramp:new e.cd(t),u_opacity:new e.cf(t)}),hillshade:t=>({u_matrix:new e.ch(t),u_image:new e.cd(t),u_latrange:new e.cg(t),u_light:new e.cg(t),u_shadow:new e.dv(t),u_highlight:new e.dv(t),u_emissive_strength:new e.cf(t),u_accent:new e.dv(t)}),hillshadePrepare:t=>({u_matrix:new e.ch(t),u_image:new e.cd(t),u_dimension:new e.cg(t),u_zoom:new e.cf(t)}),line:e.dS,linePattern:e.dR,raster:t=>({u_matrix:new e.ch(t),u_normalize_matrix:new e.ch(t),u_globe_matrix:new e.ch(t),u_merc_matrix:new e.ch(t),u_grid_matrix:new e.dw(t),u_tl_parent:new e.cg(t),u_scale_parent:new e.cf(t),u_fade_t:new e.cf(t),u_opacity:new e.cf(t),u_image0:new e.cd(t),u_image1:new e.cd(t),u_brightness_low:new e.cf(t),u_brightness_high:new e.cf(t),u_saturation_factor:new e.cf(t),u_contrast_factor:new e.cf(t),u_spin_weights:new e.ce(t),u_perspective_transform:new e.cg(t),u_raster_elevation:new e.cf(t),u_zoom_transition:new e.cf(t),u_merc_center:new e.cg(t),u_cutoff_params:new e.d0(t),u_colorization_mix:new e.d0(t),u_colorization_offset:new e.cf(t),u_color_ramp:new e.cd(t),u_texture_offset:new e.cg(t),u_texture_res:new e.cg(t),u_emissive_strength:new e.cf(t)}),rasterParticle:t=>({u_matrix:new e.ch(t),u_normalize_matrix:new e.ch(t),u_globe_matrix:new e.ch(t),u_merc_matrix:new e.ch(t),u_grid_matrix:new e.dw(t),u_tl_parent:new e.cg(t),u_scale_parent:new e.cf(t),u_fade_t:new e.cf(t),u_opacity:new e.cf(t),u_image0:new e.cd(t),u_image1:new e.cd(t),u_raster_elevation:new e.cf(t),u_zoom_transition:new e.cf(t),u_merc_center:new e.cg(t),u_cutoff_params:new e.d0(t)}),rasterParticleTexture:t=>({u_texture:new e.cd(t),u_opacity:new e.cf(t)}),rasterParticleDraw:t=>({u_particle_texture:new e.cd(t),u_particle_texture_side_len:new e.cf(t),u_tile_offset:new e.cg(t),u_velocity:new e.cd(t),u_color_ramp:new e.cd(t),u_velocity_res:new e.cg(t),u_max_speed:new e.cf(t),u_uv_offset:new e.cg(t),u_data_scale:new e.cg(t),u_data_offset:new e.cf(t),u_particle_pos_scale:new e.cf(t),u_particle_pos_offset:new e.cg(t)}),rasterParticleUpdate:t=>({u_particle_texture:new e.cd(t),u_particle_texture_side_len:new e.cf(t),u_velocity:new e.cd(t),u_velocity_res:new e.cg(t),u_max_speed:new e.cf(t),u_speed_factor:new e.cf(t),u_reset_rate:new e.cf(t),u_rand_seed:new e.cf(t),u_uv_offset:new e.cg(t),u_data_scale:new e.cg(t),u_data_offset:new e.cf(t),u_particle_pos_scale:new e.cf(t),u_particle_pos_offset:new e.cg(t)}),symbol:t=>({u_is_size_zoom_constant:new e.cd(t),u_is_size_feature_constant:new e.cd(t),u_size_t:new e.cf(t),u_size:new e.cf(t),u_camera_to_center_distance:new e.cf(t),u_rotate_symbol:new e.cd(t),u_aspect_ratio:new e.cf(t),u_fade_change:new e.cf(t),u_matrix:new e.ch(t),u_label_plane_matrix:new e.ch(t),u_coord_matrix:new e.ch(t),u_is_text:new e.cd(t),u_elevation_from_sea:new e.cd(t),u_pitch_with_map:new e.cd(t),u_texsize:new e.cg(t),u_texsize_icon:new e.cg(t),u_texture:new e.cd(t),u_texture_icon:new e.cd(t),u_gamma_scale:new e.cf(t),u_device_pixel_ratio:new e.cf(t),u_tile_id:new e.ce(t),u_zoom_transition:new e.cf(t),u_inv_rot_matrix:new e.ch(t),u_merc_center:new e.cg(t),u_camera_forward:new e.ce(t),u_tile_matrix:new e.ch(t),u_up_vector:new e.ce(t),u_ecef_origin:new e.ce(t),u_is_halo:new e.cd(t),u_icon_transition:new e.cf(t),u_color_adj_mat:new e.ch(t),u_scale_factor:new e.cf(t),u_ground_shadow_factor:new e.ce(t),u_inv_matrix:new e.ch(t),u_normal_scale:new e.cf(t)}),background:t=>({u_matrix:new e.ch(t),u_emissive_strength:new e.cf(t),u_opacity:new e.cf(t),u_color:new e.dv(t)}),backgroundPattern:t=>({u_matrix:new e.ch(t),u_emissive_strength:new e.cf(t),u_opacity:new e.cf(t),u_image:new e.cd(t),u_pattern_tl:new e.cg(t),u_pattern_br:new e.cg(t),u_texsize:new e.cg(t),u_pattern_size:new e.cg(t),u_pixel_coord_upper:new e.cg(t),u_pixel_coord_lower:new e.cg(t),u_pattern_units_to_pixels:new e.cg(t)}),terrainRaster:t=>({u_matrix:new e.ch(t),u_image0:new e.cd(t),u_skirt_height:new e.cf(t),u_ground_shadow_factor:new e.ce(t)}),skybox:t=>({u_matrix:new e.ch(t),u_sun_direction:new e.ce(t),u_cubemap:new e.cd(t),u_opacity:new e.cf(t),u_temporal_offset:new e.cf(t)}),skyboxGradient:t=>({u_matrix:new e.ch(t),u_color_ramp:new e.cd(t),u_center_direction:new e.ce(t),u_radius:new e.cf(t),u_opacity:new e.cf(t),u_temporal_offset:new e.cf(t)}),skyboxCapture:t=>({u_matrix_3f:new e.dw(t),u_sun_direction:new e.ce(t),u_sun_intensity:new e.cf(t),u_color_tint_r:new e.d0(t),u_color_tint_m:new e.d0(t),u_luminance:new e.cf(t)}),globeRaster:t=>({u_proj_matrix:new e.ch(t),u_globe_matrix:new e.ch(t),u_normalize_matrix:new e.ch(t),u_merc_matrix:new e.ch(t),u_zoom_transition:new e.cf(t),u_merc_center:new e.cg(t),u_image0:new e.cd(t),u_grid_matrix:new e.dw(t),u_skirt_height:new e.cf(t),u_far_z_cutoff:new e.cf(t),u_frustum_tl:new e.ce(t),u_frustum_tr:new e.ce(t),u_frustum_br:new e.ce(t),u_frustum_bl:new e.ce(t),u_globe_pos:new e.ce(t),u_globe_radius:new e.cf(t),u_viewport:new e.cg(t)}),globeAtmosphere:t=>({u_frustum_tl:new e.ce(t),u_frustum_tr:new e.ce(t),u_frustum_br:new e.ce(t),u_frustum_bl:new e.ce(t),u_horizon:new e.cf(t),u_transition:new e.cf(t),u_fadeout_range:new e.cf(t),u_color:new e.d0(t),u_high_color:new e.d0(t),u_space_color:new e.d0(t),u_temporal_offset:new e.cf(t),u_horizon_angle:new e.cf(t)}),model:t=>({u_matrix:new e.ch(t),u_lighting_matrix:new e.ch(t),u_normal_matrix:new e.ch(t),u_node_matrix:new e.ch(t),u_lightpos:new e.ce(t),u_lightintensity:new e.cf(t),u_lightcolor:new e.ce(t),u_camera_pos:new e.ce(t),u_opacity:new e.cf(t),u_baseColorFactor:new e.d0(t),u_emissiveFactor:new e.d0(t),u_metallicFactor:new e.cf(t),u_roughnessFactor:new e.cf(t),u_baseTextureIsAlpha:new e.cd(t),u_alphaMask:new e.cd(t),u_alphaCutoff:new e.cf(t),u_baseColorTexture:new e.cd(t),u_metallicRoughnessTexture:new e.cd(t),u_normalTexture:new e.cd(t),u_occlusionTexture:new e.cd(t),u_emissionTexture:new e.cd(t),u_lutTexture:new e.cd(t),u_color_mix:new e.d0(t),u_aoIntensity:new e.cf(t),u_emissive_strength:new e.cf(t),u_occlusionTextureTransform:new e.d0(t)}),modelDepth:t=>({u_matrix:new e.ch(t),u_instance:new e.ch(t),u_node_matrix:new e.ch(t)}),groundShadow:t=>({u_matrix:new e.ch(t),u_ground_shadow_factor:new e.ce(t)}),stars:t=>({u_matrix:new e.ch(t),u_up:new e.ce(t),u_right:new e.ce(t),u_intensity_multiplier:new e.cf(t)}),snowParticle:t=>({u_modelview:new e.ch(t),u_projection:new e.ch(t),u_time:new e.cf(t),u_cam_pos:new e.ce(t),u_velocityConeAperture:new e.cf(t),u_velocity:new e.cf(t),u_horizontalOscillationRadius:new e.cf(t),u_horizontalOscillationRate:new e.cf(t),u_boxSize:new e.cf(t),u_billboardSize:new e.cf(t),u_simpleShapeParameters:new e.cg(t),u_screenSize:new e.cg(t),u_thinningCenterPos:new e.cg(t),u_thinningShape:new e.ce(t),u_thinningAffectedRatio:new e.cf(t),u_thinningParticleOffset:new e.cf(t),u_particleColor:new e.d0(t),u_direction:new e.ce(t)}),rainParticle:t=>({u_modelview:new e.ch(t),u_projection:new e.ch(t),u_time:new e.cf(t),u_cam_pos:new e.ce(t),u_texScreen:new e.cd(t),u_velocityConeAperture:new e.cf(t),u_velocity:new e.cf(t),u_boxSize:new e.cf(t),u_rainDropletSize:new e.cg(t),u_distortionStrength:new e.cf(t),u_rainDirection:new e.ce(t),u_color:new e.d0(t),u_screenSize:new e.cg(t),u_thinningCenterPos:new e.cg(t),u_thinningShape:new e.ce(t),u_thinningAffectedRatio:new e.cf(t),u_thinningParticleOffset:new e.cf(t),u_shapeDirectionalPower:new e.cf(t),u_shapeNormalPower:new e.cf(t),u_mode:new e.cf(t)}),vignette:t=>({u_vignetteShape:new e.ce(t),u_vignetteColor:new e.d0(t)}),occlusion:t=>({u_matrix:new e.ch(t),u_anchorPos:new e.ce(t),u_screenSizePx:new e.cg(t),u_occluderSizePx:new e.cg(t),u_color:new e.d0(t)})};class Ns{constructor(e,t,i,n){this.id=Ns.uniqueIdxCounter,Ns.uniqueIdxCounter++,this.context=e;const r=e.gl;this.buffer=r.createBuffer(),this.dynamicDraw=Boolean(i),this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),r.bufferData(r.ELEMENT_ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?r.DYNAMIC_DRAW:r.STATIC_DRAW),this.dynamicDraw||n||t.destroy()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){this.id=Ns.uniqueIdxCounter,Ns.uniqueIdxCounter++;const t=this.context.gl;this.context.unbindVAO(),this.bind(),t.bufferSubData(t.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}Ns.uniqueIdxCounter=0;const Ys={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Bs{constructor(e,t,i,n,r,s){this.length=t.length,this.attributes=i,this.itemSize=t.bytesPerElement,this.dynamicDraw=n,this.instanceCount=s,this.context=e;const o=e.gl;this.buffer=o.createBuffer(),e.bindVertexBuffer.set(this.buffer),o.bufferData(o.ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?o.DYNAMIC_DRAW:o.STATIC_DRAW),this.dynamicDraw||r||t.destroy()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(e){const t=this.context.gl;this.bind(),t.bufferSubData(t.ARRAY_BUFFER,0,e.arrayBuffer)}enableAttributes(e,t){for(let i=0;i0&&e.vertexAttribDivisor(r,i)}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class Hs{constructor(e,t,i,n,r){this.context=e,this.width=t,this.height=i;const s=this.framebuffer=e.gl.createFramebuffer();n&&(this.colorAttachment=new zr(e,s)),r&&(this.depthAttachmentType=r,this.depthAttachment="renderbuffer"===r?new Fr(e,s):new Nr(e,s))}destroy(){const e=this.context.gl;if(this.colorAttachment){const t=this.colorAttachment.get();t&&e.deleteTexture(t)}if(this.depthAttachment&&this.depthAttachmentType)if("renderbuffer"===this.depthAttachmentType){const t=this.depthAttachment.get();t&&e.deleteRenderbuffer(t)}else{const t=this.depthAttachment.get();t&&e.deleteTexture(t)}e.deleteFramebuffer(this.framebuffer)}}class js{constructor(e,t){this.gl=e,this.clearColor=new rr(this),this.clearDepth=new sr(this),this.clearStencil=new or(this),this.colorMask=new ar(this),this.depthMask=new lr(this),this.stencilMask=new cr(this),this.stencilFunc=new hr(this),this.stencilOp=new dr(this),this.stencilTest=new ur(this),this.depthRange=new fr(this),this.depthTest=new pr(this),this.depthFunc=new mr(this),this.blend=new gr(this),this.blendFunc=new _r(this),this.blendColor=new yr(this),this.blendEquation=new vr(this),this.cullFace=new xr(this),this.cullFaceSide=new br(this),this.frontFace=new wr(this),this.program=new Sr(this),this.activeTexture=new Tr(this),this.viewport=new kr(this),this.bindFramebuffer=new Mr(this),this.bindRenderbuffer=new Ar(this),this.bindTexture=new Cr(this),this.bindVertexBuffer=new Dr(this),this.bindElementBuffer=new Lr(this),this.bindVertexArrayOES=new Er(this),this.pixelStoreUnpack=new Ir(this),this.pixelStoreUnpackPremultiplyAlpha=new Pr(this),this.pixelStoreUnpackFlipY=new Rr(this),this.options=t?Object.assign({},t):{},this.options.extTextureFilterAnisotropicForceOff||(this.extTextureFilterAnisotropic=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=e.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT))),this.extDebugRendererInfo=e.getExtension("WEBGL_debug_renderer_info"),this.extDebugRendererInfo&&(this.renderer=e.getParameter(this.extDebugRendererInfo.UNMASKED_RENDERER_WEBGL),this.vendor=e.getParameter(this.extDebugRendererInfo.UNMASKED_VENDOR_WEBGL)),this.forceManualRenderingForInstanceIDShaders=t&&!!t.forceManualRenderingForInstanceIDShaders||this.renderer&&-1!==this.renderer.indexOf("PowerVR"),this.options.extTextureFloatLinearForceOff||(this.extTextureFloatLinear=e.getExtension("OES_texture_float_linear")),this.extRenderToTextureHalfFloat=e.getExtension("EXT_color_buffer_half_float"),this.extTimerQuery=e.getExtension("EXT_disjoint_timer_query_webgl2"),this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE),this.maxPointSize=e.getParameter(e.ALIASED_POINT_SIZE_RANGE)[1]}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArrayOES.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(e,t,i){return new Ns(this,e,t,i)}createVertexBuffer(e,t,i,n,r){return new Bs(this,e,t,i,n,r)}createRenderbuffer(e,t,i){const n=this.gl,r=n.createRenderbuffer();return this.bindRenderbuffer.set(r),n.renderbufferStorage(n.RENDERBUFFER,e,t,i),this.bindRenderbuffer.set(null),r}createFramebuffer(e,t,i,n){return new Hs(this,e,t,i,n)}clear({color:e,depth:t,stencil:i,colorMask:n}){const r=this.gl;let s=0;e&&(s|=r.COLOR_BUFFER_BIT,this.clearColor.set(e.toNonPremultipliedRenderColor(null)),this.colorMask.set(n||[!0,!0,!0,!0])),void 0!==t&&(s|=r.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(t),this.depthMask.set(!0)),void 0!==i&&(s|=r.STENCIL_BUFFER_BIT,this.clearStencil.set(i),this.stencilMask.set(255)),r.clear(s)}setCullFace(e){!1===e.enable?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(e.mode),this.frontFace.set(e.frontFace))}setDepthMode(e){e.func!==this.gl.ALWAYS||e.mask?(this.depthTest.set(!0),this.depthFunc.set(e.func),this.depthMask.set(e.mask),this.depthRange.set(e.range)):this.depthTest.set(!1)}setStencilMode(e){e.test.func!==this.gl.ALWAYS||e.mask?(this.stencilTest.set(!0),this.stencilMask.set(e.mask),this.stencilOp.set([e.fail,e.depthFail,e.pass]),this.stencilFunc.set({func:e.test.func,ref:e.ref,mask:e.test.mask})):this.stencilTest.set(!1)}setColorMode(t){e.bv(t.blendFunction,Ni.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(t.blendFunction),this.blendColor.set(t.blendColor),t.blendEquation?this.blendEquation.set(t.blendEquation):this.blendEquation.setDefault()),this.colorMask.set(t.mask)}unbindVAO(){this.bindVertexArrayOES.set(null)}}let Vs;function Ws(t,i,n,r,s,o,a){const l=t.context,c=l.gl,h=t.transform,d=[e.aD(h.center.lng),e.aH(h.center.lat)],u=n.layout.get("symbol-placement"),f=n.layout.get("text-variable-anchor"),p="map"===n.layout.get("icon-rotation-alignment"),m="map"===n.layout.get("text-rotation-alignment"),g="point"!==u,_=[];let y=0,v=0;for(let l=0;l0){const t=e.bz(),i=P;e.cM(t,b.placementInvProjMatrix,h.glCoordMatrix),e.cM(t,t,b.placementViewportMatrix),_.push({circleArray:O,circleOffset:v,transform:i,invTransform:t,projection:b.getProjection()}),y+=O.length/4,v=y}if(!R)continue;t.terrain&&t.terrain.setupElevationDraw(x,I);const z=L?[u.canonical.x,u.canonical.y,1<=0&&(p[v.associatedIconIndex]={x:T,y:k,z:M,angle:E})}else ai(w,u)}if(h){f.clear();const i=t.icon.placedSymbolArray;for(let t=0;t{let i=[0,0,0];if(e){const e=t.style.directionalLight,n=t.style.ambientLight;e&&n&&(i=pn(t.style,e,n))}return i},V=e=>{k.depthOcclusionForSymbolsAndCircles&&(n.hasInitialOcclusionOpacityProperties||t.terrain)&&(e.push("DEPTH_D24"),e.push("DEPTH_OCCLUSION"))},W=()=>{const i=M&&"point"!==n.layout.get("symbol-placement"),a=[];V(a);const c=i||Y,d="road"===o.elevationType,_=t.shadowRenderer,S=d&&C&&!!_&&_.enabled,A=j(S),D=d&&C&&!t.terrain?P:I,L=n.paint.get("icon-image-cross-fade");t.terrainRenderModeElevated()&&C&&a.push("PITCH_WITH_MAP_TERRAIN"),u&&(a.push("PROJECTION_GLOBE_VIEW"),c&&a.push("PROJECTED_POS_ON_VIEWPORT")),L>0&&o.hasAnySecondaryIcon&&a.push("ICON_TRANSITION"),!o.icon.zOffsetVertexBuffer||d&&t.terrain||a.push("Z_OFFSET"),0===y&&0===v&&0===x&&1===b||a.push("COLOR_ADJUSTMENT"),o.sdfIcons&&a.push("RENDER_SDF"),S&&a.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),d&&C&&!t.terrain&&o.icon.orientationVertexBuffer&&a.push("ELEVATED_ROADS");const E=o.icon.programConfigurations.get(n.id),O=t.getOrCreateProgram("symbol",{config:E,defines:a}),F=r.imageAtlasTexture?r.imageAtlasTexture.size:[0,0],W=o.iconSizeData,U=e.bH(W,k.zoom),$=C||!k.isOrthographic,G=Xt(p,r.tileID.canonical,C,M,k,o.getProjection(),m),X=Zt(p,r.tileID.canonical,C,M,k,o.getProjection(),m),q=t.translatePosMatrix(X,r,l,h,!0),Z=t.translatePosMatrix(p,r,l,h),J=c?Us:G,K=M&&!C&&!i;let Q=N;!z&&!k.mercatorFromTransition||M||(Q=$s(k));const ee=u?Q:N,te=n.getColorAdjustmentMatrix(y,v,x,b),ie=Es(W.kind,U,K,C,t,Z,J,q,w,!1,F,[0,0],0,s,f,R,B,ee,o.getProjection(),A,H,te,L,null),ne=r.imageAtlasTexture?r.imageAtlasTexture:null,re=1!==n.layout.get("icon-size").constantOr(0)||o.iconsNeedLinear,se=o.sdfIcons||t.options.rotating||t.options.zooming||re||$?T.LINEAR:T.NEAREST,oe=o.sdfIcons&&0!==n.paint.get("icon-halo-width").constantOr(1),ae=t.terrain&&C&&i?e.bi(e.bz(),G):Us;if(i&&o.icon){const e=k.elevation,i=e?e.getAtTileOffsetFunc(s,k.center.lat,k.worldSize,o.getProjection()):null,n=qt(p,r.tileID.canonical,C,M,k,o.getProjection(),m);ei(o,p,t,!1,n,X,C,g,i,s)}return{program:O,buffers:o.icon,uniformValues:ie,atlasTexture:ne,atlasTextureIcon:null,atlasInterpolation:se,atlasInterpolationIcon:null,isSDF:o.sdfIcons,hasHalo:oe,depthMode:D,tile:r,renderWithShadows:S,labelPlaneMatrixInv:ae}},U=()=>{const i=A&&"point"!==n.layout.get("symbol-placement"),a=[],l=i||O||Y,h="road"===o.elevationType,g=t.shadowRenderer,y=h&&D&&!!g&&g.enabled,v=j(y),x=h&&D&&!t.terrain?P:I;t.terrainRenderModeElevated()&&D&&a.push("PITCH_WITH_MAP_TERRAIN"),u&&(a.push("PROJECTION_GLOBE_VIEW"),l&&a.push("PROJECTED_POS_ON_VIEWPORT")),!o.text.zOffsetVertexBuffer||h&&t.terrain||a.push("Z_OFFSET"),o.iconsInText&&a.push("RENDER_TEXT_AND_SYMBOL"),a.push("RENDER_SDF"),y&&a.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),h&&D&&!t.terrain&&o.text.orientationVertexBuffer&&a.push("ELEVATED_ROADS"),V(a);const b=o.text.programConfigurations.get(n.id),S=t.getOrCreateProgram("symbol",{config:b,defines:a});let M,C=[0,0],L=null;const E=o.textSizeData;o.iconsInText&&(C=r.imageAtlasTexture?r.imageAtlasTexture.size:[0,0],L=r.imageAtlasTexture?r.imageAtlasTexture:null,M=D||!k.isOrthographic||t.options.rotating||t.options.zooming||"composite"===E.kind||"camera"===E.kind?T.LINEAR:T.NEAREST);const F=r.glyphAtlasTexture?r.glyphAtlasTexture.size:[0,0],W=n.layout.get("text-size-scale-range"),U=e.ay(t.scaleFactor,W[0],W[1]),$=e.bH(E,k.zoom,U),G=Xt(p,r.tileID.canonical,D,A,k,o.getProjection(),m),X=Zt(p,r.tileID.canonical,D,A,k,o.getProjection(),m),q=t.translatePosMatrix(X,r,c,d,!0),Z=t.translatePosMatrix(p,r,c,d),J=l?Us:G,K=A&&!D&&!i;let Q=N;!z&&!k.mercatorFromTransition||A||(Q=$s(k));const ee=Es(E.kind,$,K,D,t,Z,J,q,w,!0,F,C,0,s,f,R,B,u?Q:N,o.getProjection(),v,H,null,null,U),te=r.glyphAtlasTexture?r.glyphAtlasTexture:null,ie=T.LINEAR,ne=0!==n.paint.get("text-halo-width").constantOr(1),re=t.terrain&&D&&i?e.bi(e.bz(),G):Us;if(i&&o.text){const e=k.elevation,i=e?e.getAtTileOffsetFunc(s,k.center.lat,k.worldSize,o.getProjection()):null,n=qt(p,r.tileID.canonical,D,A,k,o.getProjection(),m);ei(o,p,t,!0,n,X,D,_,i,s)}return{program:S,buffers:o.text,uniformValues:ee,atlasTexture:te,atlasTextureIcon:L,atlasInterpolation:ie,atlasInterpolationIcon:M,isSDF:!0,hasHalo:ne,depthMode:x,tile:r,renderWithShadows:y,labelPlaneMatrixInv:re}},$=o.icon.segments.get().length,G=o.text.segments.get().length,X=$&&!a.onlyText?W():null,q=G&&!a.onlyIcons?U():null,Z=n.paint.get("icon-opacity").constantOr(1),J=n.paint.get("text-opacity").constantOr(1);if(L&&o.canOverlap){E=!0;const t=Z&&!a.onlyText?o.icon.segments.get():[],i=J&&!a.onlyIcons?o.text.segments.get():[];for(const i of t)F.push({segments:new e.bd([i]),sortKey:i.sortKey,state:X});for(const t of i)F.push({segments:new e.bd([t]),sortKey:t.sortKey,state:q})}else a.onlyText||F.push({segments:Z?o.icon.segments:new e.bd([]),sortKey:0,state:X}),a.onlyIcons||F.push({segments:J?o.text.segments:new e.bd([]),sortKey:0,state:q})}E&&F.sort((e,t)=>e.sortKey-t.sortKey);for(const e of F){const i=e.state;if(i)if(t.terrain?t.terrain.setupElevationDraw(i.tile,i.program,{useDepthForOcclusion:k.depthOcclusionForSymbolsAndCircles,labelPlaneMatrixInv:i.labelPlaneMatrixInv}):t.setupDepthForOcclusion(k.depthOcclusionForSymbolsAndCircles,i.program),S.activeTexture.set(T.TEXTURE0),i.atlasTexture&&i.atlasTexture.bind(i.atlasInterpolation,T.CLAMP_TO_EDGE,!0),i.atlasTextureIcon&&(S.activeTexture.set(T.TEXTURE1),i.atlasTextureIcon&&i.atlasTextureIcon.bind(i.atlasInterpolationIcon,T.CLAMP_TO_EDGE,!0)),i.renderWithShadows&&t.shadowRenderer.setupShadows(i.tile.tileID.toUnwrapped(),i.program,"vector-tile"),t.uploadCommonLightUniforms(t.context,i.program),i.hasHalo){const r=i.uniformValues;r.u_is_halo=1,Zs(i.buffers,e.segments,n,t,i.program,i.depthMode,s,o,r,2),r.u_is_halo=0}else{if(i.isSDF){const r=i.uniformValues;i.hasHalo&&(r.u_is_halo=1,Zs(i.buffers,e.segments,n,t,i.program,i.depthMode,s,o,r,1)),r.u_is_halo=0}Zs(i.buffers,e.segments,n,t,i.program,i.depthMode,s,o,i.uniformValues,1)}}}function Zs(e,t,i,n,r,s,o,a,l,c){const h=[e.dynamicLayoutVertexBuffer,e.opacityVertexBuffer,e.iconTransitioningVertexBuffer,e.globeExtVertexBuffer,e.zOffsetVertexBuffer,e.orientationVertexBuffer];r.draw(n,n.context.gl.TRIANGLES,s,o,a,Wi.disabled,l,i.id,e.layoutVertexBuffer,e.indexBuffer,t,i.paint,n.transform.zoom,e.programConfigurations.get(i.id),h,c)}function Js(t,i){const n=1<=sn?1:i/sn))),2*n}(t.transform),h=t.transform.getFreeCameraOptions().position,d="elevatedStructuresDepthReconstruct",u=t.getOrCreateProgram(d,{defines:["DEPTH_RECONSTRUCTION"]}),f=t.getOrCreateProgram(d);for(const e of r){const r=i.getTile(e),d=r.getBucket(n);if(!d)continue;const p=d.elevatedStructures;if(!p)continue;const m=d.elevationBufferData.heightRange,g=Js(e.toUnwrapped(),h),_=t.translatePosMatrix(e.projMatrix,r,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor"));let y,v,x,b;if("initialize"===s){if(!m||m.min>=1||0===p.depthSegments.segments[0].primitiveLength)continue;y=ps(_,g,c,1,0),v=a,x=p.depthSegments,b=u}else if("reset"===s){if(!m||m.min>=0||0===p.maskSegments.segments[0].primitiveLength)continue;y=ps(_,g,0,0,1),v=l,x=p.maskSegments,b=u}else if("geometry"===s){if(0===p.depthSegments.segments[0].primitiveLength)continue;y=ps(_,g,c,1,0),v=a,x=p.depthSegments,b=f}b.draw(t,o.TRIANGLES,v,Hi.disabled,Ni.disabled,Wi.disabled,y,n.id,p.vertexBuffer,p.indexBuffer,x,n.paint,t.transform.zoom)}}function Qs(t,i,n){const{painter:r,sourceCache:s,layer:o,coords:a,colorMode:l,elevationType:c,terrainEnabled:h,pass:d}=t,u=r.context.gl,f=o.paint.get("fill-pattern"),p=o.paint.get("fill-pattern-cross-fade"),m=f.constantOr(null);let g=c;"road"!==c||i&&!h||(g="none");const _="road"===g,y=t.painter.shadowRenderer,v=_&&!!y&&y.enabled,x=new Yi(r.context.gl.LEQUAL,Yi.ReadOnly,r.depthRangeFor3D);let b=[0,0,0];if(v){const e=r.style.directionalLight,t=r.style.ambientLight;e&&t&&(b=pn(r.style,e,t))}const w=f&&f.constantOr(1),S=(t,d)=>{let f,g,S,T,k;d?(f=w&&!o.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",S=u.LINES):(f=w?"fillPattern":"fill",S=u.TRIANGLES);for(const M of a){const a=s.getTile(M);if(w&&!a.patternsLoaded())continue;const A=a.getBucket(o);if(!A)continue;const C=i?A.elevationBufferData:A.bufferData;if(C.isEmpty())continue;r.prepareDrawTile();const D=C.programConfigurations.get(o.id),L=r.isTileAffectedByFog(M),E=[],I=[];_&&(E.push("ELEVATED_ROADS"),I.push(C.elevatedLayoutVertexBuffer)),v&&E.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),w&&(r.context.activeTexture.set(u.TEXTURE0),a.imageAtlasTexture&&a.imageAtlasTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE),D.updatePaintBuffers());let P=!1;if(m&&a.imageAtlas){const t=a.imageAtlas,i=e.dZ.from(m),n=i.getPrimary().scaleSelf(e.q.devicePixelRatio).toString(),r=i.getSecondary(),s=t.patternPositions.get(n),o=r?t.patternPositions.get(r.scaleSelf(e.q.devicePixelRatio).toString()):null;P=!!s&&!!o,s&&D.setConstantPatternPositions(s,o)}p>0&&(P||D.getPatternTransitionVertexBuffer("fill-pattern"))&&E.push("FILL_PATTERN_TRANSITION");const R=r.getOrCreateProgram(f,{config:D,overrideFog:L,defines:E}),O=r.translatePosMatrix(M.projMatrix,a,o.paint.get("fill-translate"),o.paint.get("fill-translate-anchor"));v&&y.setupShadows(a.tileID.toUnwrapped(),R,"vector-tile");const z=o.paint.get("fill-emissive-strength");if(d){T=C.lineIndexBuffer,k=C.lineSegments;const e=r.terrain&&r.terrain.renderingToTexture?r.terrain.drapeBufferSize:[u.drawingBufferWidth,u.drawingBufferHeight];g="fillOutlinePattern"===f&&w?us(O,z,r,a,e,b,p):ds(O,z,e,b)}else T=C.indexBuffer,k=C.triangleSegments,g=w?hs(O,z,r,a,b,p):cs(O,z,b);r.uploadCommonUniforms(r.context,R,M.toUnwrapped());let F=t;("road"===c&&!h||"offset"===c)&&(F=x),R.draw(r,S,F,n||r.stencilModeForClipping(M),l,Wi.disabled,g,o.id,C.layoutVertexBuffer,T,k,o.paint,r.transform.zoom,D,I)}};r.renderPass===d&&S(r.depthModeForSublayer(1,"opaque"===r.renderPass?Yi.ReadWrite:Yi.ReadOnly),!1),"none"===g&&"translucent"===r.renderPass&&o.paint.get("fill-antialias")&&S(r.depthModeForSublayer(o.getPaintProperty("fill-outline-color")?2:0,Yi.ReadOnly),!0)}function eo(t,i,n,r,s,o,a,l){n.resetLayerRenderingStats(t);const c=t.context,h=c.gl,d=t.transform,u=n.paint.get("fill-extrusion-pattern"),f=n.paint.get("fill-extrusion-pattern-cross-fade"),p=u.constantOr(null),m=u.constantOr(1),g=n.paint.get("fill-extrusion-opacity"),_=t.style.enable3dLights(),y=n.paint.get(_&&!m?"fill-extrusion-ambient-occlusion-wall-radius":"fill-extrusion-ambient-occlusion-radius"),v=[n.paint.get("fill-extrusion-ambient-occlusion-intensity"),y],x=n.layout.get("fill-extrusion-edge-radius"),b=x>0&&!n.paint.get("fill-extrusion-rounded-roof"),w=b?0:x,S="globe"===d.projection.name?e.e5():0,T="globe"===d.projection.name,k=T?e.ah(d.zoom):0,M=[e.aD(d.center.lng),e.aH(d.center.lat)],A="none"===n.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default"),C=n.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(A?null:n.lut).toArray01().slice(0,3),D=n.paint.get("fill-extrusion-flood-light-intensity"),L=n.paint.get("fill-extrusion-vertical-scale"),E=0!==n.paint.get("fill-extrusion-line-width").constantOr(1),I=n.paint.get("fill-extrusion-height-alignment"),P=n.paint.get("fill-extrusion-base-alignment"),R=an(t,n.paint.get("fill-extrusion-cutoff-fade-range")),O=[];let z;T&&O.push("PROJECTION_GLOBE_VIEW"),v[0]>0&&O.push("FAUX_AO"),b&&O.push("ZERO_ROOF_RADIUS"),l&&O.push("HAS_CENTROID"),D>0&&O.push("FLOOD_LIGHT"),R.shouldRenderCutoff&&O.push("RENDER_CUTOFF"),E&&O.push("RENDER_WALL_MODE");const F="shadow"===t.renderPass,N=t.shadowRenderer,Y=F&&!!N,B=F?Wi.disabled:Wi.backCCW;t.shadowRenderer&&(t.shadowRenderer.useNormalOffset=!0);let H=[0,0,0];if(N){const e=t.style.directionalLight,i=t.style.ambientLight;e&&i&&(H=pn(t.style,e,i)),F||(O.push("RENDER_SHADOWS","DEPTH_TEXTURE"),N.useNormalOffset&&O.push("NORMAL_OFFSET")),z=O.concat(["SHADOWS_SINGLE_CASCADE"])}const j=Y?"fillExtrusionDepth":m?"fillExtrusionPattern":"fillExtrusion",V=n.getLayerRenderingStats();for(const u of r){const r=i.getTile(u),_=r.getBucket(n);if(!_||_.projection.name!==d.projection.name)continue;let y=!1;N&&(y=0===N.getMaxCascadeForTile(u.toUnwrapped()));const x=t.isTileAffectedByFog(u),b=_.programConfigurations.get(n.id);let A=!1;if(p&&r.imageAtlas){const t=r.imageAtlas,i=e.dZ.from(p),n=i.getPrimary().scaleSelf(e.q.devicePixelRatio).toString(),s=i.getSecondary(),o=t.patternPositions.get(n),a=s?t.patternPositions.get(s.scaleSelf(e.q.devicePixelRatio).toString()):null;A=!!o&&!!a,o&&b.setConstantPatternPositions(o,a)}f>0&&(A||b.getPatternTransitionVertexBuffer("fill-extrusion-pattern"))&&O.push("FILL_EXTRUSION_PATTERN_TRANSITION");const Y=t.getOrCreateProgram(j,{config:b,defines:y?z:O,overrideFog:x});if(t.terrain&&t.terrain.setupElevationDraw(r,Y,{useMeterToDem:!0}),!_.centroidVertexBuffer){const e=Y.attributes.a_centroid_pos;void 0!==e&&h.vertexAttrib2f(e,0,0)}!F&&N&&N.setupShadows(r.tileID.toUnwrapped(),Y,"vector-tile"),m&&(t.context.activeTexture.set(h.TEXTURE0),r.imageAtlasTexture&&r.imageAtlasTexture.bind(h.LINEAR,h.CLAMP_TO_EDGE),b.updatePaintBuffers());const W=n.paint.get("fill-extrusion-vertical-gradient"),U=1/_.tileToMeter;let $;if(F&&N){if(ao(r.tileID,_.maxHeight,t))continue;const e=N.calculateShadowPassMatrixFromTile(r.tileID.toUnwrapped());$=as(e,w,U,L,I,P)}else{const e=t.translatePosMatrix(u.expandedProjMatrix,r,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),i=d.projection.createInversionMatrix(d,u.canonical);$=m?ls(e,t,W,g,v,w,U,u,r,S,I,P,k,M,i,C,L,f):os(e,t,W,g,v,w,U,u,S,I,P,k,M,i,C,L,D,H)}t.uploadCommonUniforms(c,Y,u.toUnwrapped(),null,R);let G=_.segments;if("mercator"===d.projection.name&&!F&&(G=_.getVisibleSegments(r.tileID,t.terrain,t.transform.getFrustum(0)),!G.get().length))continue;if(V)if(F)for(const e of G.get())V.numRenderedVerticesInShadowPass+=e.primitiveLength;else for(const e of G.get())V.numRenderedVerticesInTransparentPass+=e.primitiveLength;const X=[];(t.terrain||l)&&X.push(_.centroidVertexBuffer),T&&X.push(_.layoutVertexExtBuffer),E&&X.push(_.wallVertexBuffer),Y.draw(t,c.gl.TRIANGLES,s,o,a,B,$,n.id,_.layoutVertexBuffer,_.indexBuffer,G,n.paint,t.transform.zoom,b,X)}t.shadowRenderer&&(t.shadowRenderer.useNormalOffset=!1)}class to{constructor(){this.translate=[0,0],this.translateAnchor="map",this.edgeRadius=0,this.cutoffFadeRange=0}}function io(t,i,n,r,s,o,a,l,c,h,d,u,f,p,m,g,_,y,v,x){const b=i.context,w=b.gl,S=i.transform,T=i.transform.zoom,k=[],M=t.translate,A=t.translateAnchor,C=t.edgeRadius,D=an(i,t.cutoffFadeRange);"clear"===d?(k.push("CLEAR_SUBPASS"),x&&(k.push("CLEAR_FROM_TEXTURE"),b.activeTexture.set(w.TEXTURE0),x.bind(w.LINEAR,w.CLAMP_TO_EDGE))):"sdf"===d&&k.push("SDF_SUBPASS"),y&&k.push("HAS_CENTROID"),D.shouldRenderCutoff&&k.push("RENDER_CUTOFF");const L=(e,t,n,s,d)=>{const v=t.programConfigurations.get(r.id),w=i.isTileAffectedByFog(e),S=i.getOrCreateProgram("fillExtrusionGroundEffect",{config:v,defines:k,overrideFog:w}),M=((e,t,i,n,r,s,o,a,l,c,h)=>({u_matrix:t,u_opacity:i,u_ao_pass:n?1:0,u_meter_to_tile:r,u_ao:s,u_flood_light_intensity:o,u_flood_light_color:a,u_attenuation:l,u_edge_radius:c,u_fb:0,u_fb_size:h,u_dynamic_offset:1}))(0,s,u,h,d,[f,p*d],m,g,_,T>=17?0:C*d,x?x.size[0]:0),A=[];y&&A.push(t.hiddenByLandmarkVertexBuffer),i.uploadCommonUniforms(b,S,e.toUnwrapped(),null,D),S.draw(i,b.gl.TRIANGLES,o,a,l,c,M,r.id,t.vertexBuffer,t.indexBuffer,n,r.paint,T,v,A)};for(const t of s){const s=n.getTile(t),o=s.getBucket(r);if(!o||o.projection.name!==S.projection.name||!o.groundEffect||o.groundEffect&&!o.groundEffect.hasData())continue;const a=o.groundEffect,l=1/o.tileToMeter;{const e=i.translatePosMatrix(t.projMatrix,s,M,A),n=a.getDefaultSegment();L(t,a,n,e,l)}if(v)for(let o=0;o<4;o++){const a=e.e3[o](t),c=n.getTile(a);if(!c)continue;const h=c.getBucket(r);if(!h||h.projection.name!==S.projection.name||!h.groundEffect||h.groundEffect&&!h.groundEffect.hasData())continue;const d=h.groundEffect;let u,f;0===o?(u=[-e.aj,0,0],f=1):1===o?(u=[e.aj,0,0],f=0):2===o?(u=[0,-e.aj,0],f=3):(u=[0,e.aj,0],f=2);const p=d.regionSegments[f];if(!p)continue;const m=new Float32Array(16);e.bo(m,t.projMatrix,u),L(t,d,p,i.translatePosMatrix(m,s,M,A),l)}}}function no(t,i,n,r,s,o,a){0===r.centroidVertexArray.length&&r.createCentroidsBuffer();const l=o?o.findDEMTileFor(n):null;if(!(l&&l.dem||a))return;o&&l&&l.dem&&r.selfDEMTileTimestamp!==l.dem._timestamp&&(r.borderDoneWithNeighborZ=[-1,-1,-1,-1],r.selfDEMTileTimestamp=l.dem._timestamp);const c=t=>new e.P(Math.ceil((t+e.e7)*e.e8),0),h=e=>{const t=i.getSource().minzoom,n=e=>{const t=i.getTileByID(e);if(t&&t.hasData())return t.getBucket(s)},r=[0,-1,1];for(const i of r){if(e.overscaledZ+i(d[0]=Math.min(t.min.y,i.min.y),d[1]=Math.max(t.max.y,i.max.y),d[2]=e.aj-i.min.x>t.max.x?i.min.x-e.aj:t.max.x,d),f=(t,i)=>(d[0]=Math.min(t.min.x,i.min.x),d[1]=Math.max(t.max.x,i.max.x),d[2]=e.aj-i.min.y>t.max.y?i.min.y-e.aj:t.max.y,d),p=[(e,t)=>u(e,t),(e,t)=>u(t,e),(e,t)=>f(e,t),(e,t)=>f(t,e)],m=(t,i,r,s,a,c,h)=>{if(!o)return 0;const d=[[c?r:t,c?t:r,0],[c?r:i,c?i:r,0]],u=h<0?e.aj+h:h,f=[c?u:(t+i)/2,c?(t+i)/2:u,0];return 0===r&&h<0||0!==r&&h>0?o.getForTilePoints(a,[f],!0,s):d.push(f),o.getForTilePoints(n,d,!0,l),Math.max(d[0][2],d[1][2],f[2])/o.exaggeration()};for(let t=0;t<4;t++){const i=r.borderFeatureIndices[t];if(0===i.length)continue;const s=e.e3[t](n),l=h(s);if(!(l&&l instanceof e.e4))continue;const d=o?o.findDEMTileFor(s):null;if(!(d&&d.dem||a))continue;if(o&&d&&d.dem&&r.borderDEMTileTimestamp[t]!==d.dem._timestamp&&(r.borderDoneWithNeighborZ[t]=-1,r.borderDEMTileTimestamp[t]=d.dem._timestamp),r.borderDoneWithNeighborZ[t]===l.canonical.z)continue;0===l.centroidVertexArray.length&&l.createCentroidsBuffer();const u=(t<2?1:5)-t,f=l.borderDoneWithNeighborZ[u]!==r.canonical.z,y=l.borderFeatureIndices[u];let v=0;if(r.canonical.z!==l.canonical.z){for(const e of i)r.showCentroid(r.featuresOnBorder[e]);if(f)for(const e of y)l.showCentroid(l.featuresOnBorder[e]);r.borderDoneWithNeighborZ[t]=l.canonical.z,l.borderDoneWithNeighborZ[u]=r.canonical.z}for(const n of i){const i=r.featuresOnBorder[n],o=r.centroidData[i.centroidDataIndex],h=i.borders[t];let f;for(;vh[0]+3||e[0]>h[0]-3)break;l.showCentroid(f),v++}if(f&&vh[1]-3)&&(x++,++v!==y.length);)f=l.featuresOnBorder[y[v]];f=l.featuresOnBorder[y[n]];let b=!1;if(x>=1){const e=f.borders[u];Math.abs(h[0]-e[0])<3&&Math.abs(h[1]-e[1])<3&&(x=1,b=!0,v=n+1)}else if(0===x){r.showCentroid(i);continue}const w=l.centroidData[f.centroidDataIndex];a&&b&&(((g=o).flags|(_=w).flags)&e.e6?(g.flags|=e.e6,_.flags|=e.e6):(g.flags&=~e.e6,_.flags&=~e.e6));const S=i.intersectsCount()>1||f.intersectsCount()>1;if(x>1)v=n,o.centroidXY=w.centroidXY=new e.P(0,0);else if(d&&d.dem&&!S){const i=p[t](o,w),n=t%2?e.aj-1:0,r=m(i[0],Math.min(e.aj-1,i[1]),n,d,s,t<2,i[2]);o.centroidXY=w.centroidXY=c(r)}else S?o.centroidXY=w.centroidXY=new e.P(0,0):(o.centroidXY=r.encodeBorderCentroid(i),w.centroidXY=l.encodeBorderCentroid(f));r.writeCentroidToBuffer(o),l.writeCentroidToBuffer(w)}else r.showCentroid(i)}r.borderDoneWithNeighborZ[t]=l.canonical.z,l.borderDoneWithNeighborZ[u]=r.canonical.z}var g,_;(r.needsCentroidUpdate||!r.centroidVertexBuffer&&0!==r.centroidVertexArray.length)&&r.uploadCentroid(t)}const ro=[1,0,0],so=[0,1,0],oo=[0,0,1];function ao(t,i,n){const r=n.transform,s=n.shadowRenderer;if(!s)return!0;const o=t.toUnwrapped(),a=r.tileSize*s._cascades[n.currentShadowCascade].scale;let l=i;if(r.elevation){const e=r.elevation.getMinMaxForTile(t);e&&(l+=e.max)}const c=[...s.shadowDirection];c[2]=-c[2];const h=s.computeSimplifiedTileShadowVolume(o,l,a,c);if(!h)return!1;const d=[ro,so,oo,c,[c[0],0,c[2]],[0,c[1],c[2]]],u="globe"===r.projection.name,f=r.scaleZoom(a),p=e.cy.fromInvProjectionMatrix(r.invProjMatrix,r.worldSize,f,!u),m=s.getCurrentCascadeFrustum();return 0===p.intersectsPrecise(h.vertices,h.planes,d)||0===m.intersectsPrecise(h.vertices,h.planes,d)}function lo(t){const{painter:i,source:n,layer:r,coords:s}=t,o=t.defines,a=i.context,l="shadow"===i.renderPass,c="light-beam"===i.renderPass,h=i.shadowRenderer;let d;h&&(d=o.concat(["SHADOWS_SINGLE_CASCADE"]));const u=e.e9(i.transform.center.lat,i.transform.zoom);for(const f of s){const s=n.getTile(f),p=s.getBucket(r);if(!p)continue;let m=!1;h&&(m=0===h.getMaxCascadeForTile(f.toUnwrapped()));const g=p.programConfigurations.get(r.id);let _,y,v=i.translatePosMatrix(f.expandedProjMatrix,s,[0,0],"map");if(v=e.cP(e.bz(),v,[1,1,t.verticalScale]),l&&h){if(ao(s.tileID,p.maxHeight*u,i))continue;let n=h.calculateShadowPassMatrixFromTile(s.tileID.toUnwrapped());n=e.cP(e.bz(),n,[1,1,t.verticalScale]),y=_s(n),_=i.getOrCreateProgram("buildingDepth",{config:g,defines:m?d:o,overrideFog:!1})}else if(c)_=i.getOrCreateProgram("buildingBloom",{config:g,defines:m?d:o,overrideFog:!1}),y=gs(v);else{const n=i.transform.calculatePosMatrix(f.toUnwrapped(),i.transform.worldSize);e.cP(n,n,[1,1,t.verticalScale]);const r=e.bz();e.cP(r,n,[1,-1,1/u]),e.bi(r,r),e.ea(r,r),y=ms(v,r),_=i.getOrCreateProgram("building",{config:g,defines:m?d:o,overrideFog:!1}),h&&h.setupShadowsFromMatrix(n,_,!0)}if(i.uploadCommonUniforms(a,_,f.toUnwrapped(),null,null),c){const e=p.bloomGeometry;_.draw(i,a.gl.TRIANGLES,t.depthMode,Hi.disabled,t.blendMode,Wi.disabled,y,r.id,e.layoutVertexBuffer,e.indexBuffer,e.segmentsBucket,r.paint,i.transform.zoom,g,[e.layoutAttenuationBuffer,e.layoutColorBuffer])}else _.draw(i,a.gl.TRIANGLES,t.depthMode,Hi.disabled,t.blendMode,l?Wi.disabled:Wi.backCW,y,r.id,p.layoutVertexBuffer,p.indexBuffer,p.segments,r.paint,i.transform.zoom,g,[p.layoutNormalBuffer,p.layoutColorBuffer])}}function co(t){return[t[0]*e.eb,t[1]*e.eb,t[2]*e.eb,0]}function ho(t,i,n,r,s,o,a,l,c){const h=r.getSource(),d=n.globeSharedBuffers;if(!d)return;let u,f,p;if(i&&(u=r.getTile(i)),h instanceof e.aP?(f=h.texture,p=e.dE(0,0,n.transform)):u&&i&&(f=u.texture,p=e.dE(i.canonical.z,i.canonical.x,n.transform)),!f||!p)return;t||(p=e.cP(e.bz(),p,[1,-1,1]));const m=n.context,g=m.gl,_="nearest"===s.paint.get("raster-resampling")?g.NEAREST:g.LINEAR,y=n.colorModeForDrapableLayerRenderPass(o),v=a.defines;v.push("GLOBE_POLES");const x=new Yi(g.LEQUAL,Yi.ReadWrite,n.depthRangeFor3D),b=Float32Array.from(n.transform.expandedFarZProjMatrix),w=Float32Array.from(e.bh(e.dD(new e.cA(0,0,0))));n.terrain&&n.terrain.prepareDrawTile(),m.activeTexture.set(g.TEXTURE0),f.bind(_,g.CLAMP_TO_EDGE),m.activeTexture.set(g.TEXTURE1),f.bind(_,g.CLAMP_TO_EDGE),"useMipmap"in f&&m.extTextureFilterAnisotropic&&n.transform.pitch>20&&g.texParameterf(g.TEXTURE_2D,m.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,m.extTextureFilterAnisotropicMax);const[S,T,k,M]=i?d.getPoleBuffers(i.canonical.z,!1):d.getPoleBuffers(0,!0),A=s.paint.get("raster-elevation");let C;t?(C=S,n.renderDefaultNorthPole=0!==A):(C=T,n.renderDefaultSouthPole=0!==A);const D=co(a.mix),L=((e,t,i,n,r,s,o,a,l,c,h,d,u)=>Ts(e,t,i,new Float32Array(16),new Float32Array(9),[0,0],n,[0,0],[0,0,0,0],1,{opacity:1,mix:0},s,[0,0]||0,a,2,c,h,d,1,0,u))(b,w,p,e.ah(n.transform.zoom),0,s,0,A,0,D,a.offset,a.range,o),E=n.getOrCreateProgram("raster",{defines:v});n.uploadCommonUniforms(m,E,null),E.draw(n,g.TRIANGLES,x,c,y,l,L,s.id,C,k,M)}function uo(e){const t=e._nearZ,i=e.projection.farthestPixelDistance(e),n=i-t,r=.2*e.height,s=t+r;return[t,i,(s-r-t)/n,(s-t)/n]}function fo(e,t,i,n){if(e)return t instanceof it&&e instanceof bt?t.getTextureDescriptor(e,i,!0):{texture:e.texture,mix:co(n.mix),offset:n.offset,buffer:0,tileSize:1}}var po=e.ec([{name:"a_index",type:"Int16",components:1}]);class mo{constructor(t,i,n,r){const s={width:n[0],height:n[1],data:null},o=t.gl;this.targetColorTexture=new e.T(t,s,o.RGBA8,{useMipmap:!1}),this.backgroundColorTexture=new e.T(t,s,o.RGBA8,{useMipmap:!1}),this.context=t,this.updateParticleTexture(i,r),this.lastInvalidatedAt=0}updateParticleTexture(t,i){if(this.particleTextureDimension===i.width)return;(this.particleTexture0||this.particleTexture1||this.particleIndexBuffer||this.particleSegment)&&(this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleIndexBuffer.destroy(),this.particleSegment.destroy());const n=this.context.gl,r=i.width*i.height;this.particleTexture0=new e.T(this.context,i,n.RGBA8,{premultiply:!1,useMipmap:!1}),this.particleTexture1=new e.T(this.context,i,n.RGBA8,{premultiply:!1,useMipmap:!1});const s=new e.ed;s.reserve(r);for(let e=0;e0){const t=e.bg(n.canonical,c),i=e.ef(t);f=e.az(new Float32Array(16),c.globeMatrix,i),e.az(f,c.projMatrix,f)}const p=e.bz();p[12]+=2*s/(e.q.devicePixelRatio*c.width),p[13]+=2*o/(e.q.devicePixelRatio*c.height),e.az(f,p,f);const m=t.getOrCreateProgram("debug",{defines:u}),g=i.getTileByID(n.key);t.terrain&&t.terrain.setupElevationDraw(g,m);const _=Yi.disabled,y=Hi.disabled,v=t.colorModeForRenderPass(),x="$debug";l.activeTexture.set(h.TEXTURE0),t.emptyTexture.bind(h.LINEAR,h.CLAMP_TO_EDGE),d?g._makeGlobeTileDebugBuffers(t.context,c):g._makeDebugTileBoundsBuffers(t.context,c.projection);const b=g._tileDebugBuffer||t.debugBuffer,w=g._tileDebugIndexBuffer||t.debugIndexBuffer,S=g._tileDebugSegments||t.debugSegments;if(m.draw(t,h.LINE_STRIP,_,y,v,Wi.disabled,vs(f,r.toPremultipliedRenderColor(null)),x,b,w,S,null,null,null,[g._globeTileDebugBorderBuffer]),a){const e=g.latestRawTileData,i=Math.floor((e&&e.byteLength||0)/1024);let r=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(r+=` => ${n.overscaledZ}`),r+=` ${g.state}`,r+=` ${i}kb`,function(e,t){e.initDebugOverlayCanvas();const i=e.debugOverlayCanvas,n=e.context.gl,r=e.debugOverlayCanvas.getContext("2d");r.clearRect(0,0,i.width,i.height),r.shadowColor="white",r.shadowBlur=2,r.lineWidth=1.5,r.strokeStyle="white",r.textBaseline="top",r.font="bold 36px Open Sans, sans-serif",r.fillText(t,5,5),r.strokeText(t,5,5),e.debugOverlayTexture.update(i),e.debugOverlayTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}(t,r)}const T=i.getTile(n).tileSize,k=512/Math.min(T,512)*(n.overscaledZ/c.zoom)*.5,M=g._tileDebugTextBuffer||t.debugBuffer,A=g._tileDebugTextIndexBuffer||t.quadTriangleIndexBuffer,C=g._tileDebugTextSegments||t.debugSegments;m.draw(t,h.TRIANGLES,_,y,Ni.alphaBlended,Wi.disabled,vs(f,e.am.transparent.toPremultipliedRenderColor(null),k),x,M,A,C,null,null,null,[g._globeTileDebugTextBuffer])}function ko(e,t,i,n){Ao(e,0,t+i/2,e.transform.width,i,n)}function Mo(e,t,i,n){Ao(e,t-i/2,0,i,e.transform.height,n)}function Ao(t,i,n,r,s,o){const a=t.context,l=a.gl;l.enable(l.SCISSOR_TEST),l.scissor(i*e.q.devicePixelRatio,n*e.q.devicePixelRatio,r*e.q.devicePixelRatio,s*e.q.devicePixelRatio),a.clear({color:o}),l.disable(l.SCISSOR_TEST)}const Co=e.ec([{name:"a_pos_3f",components:3,type:"Float32"}]),{members:Do}=Co;function Lo(e,t,i,n){e.emplaceBack(t,i,n)}class Eo{constructor(t){this.vertexArray=new e.eg,this.indices=new e.a_,Lo(this.vertexArray,-1,-1,1),Lo(this.vertexArray,1,-1,1),Lo(this.vertexArray,-1,1,1),Lo(this.vertexArray,1,1,1),Lo(this.vertexArray,-1,-1,-1),Lo(this.vertexArray,1,-1,-1),Lo(this.vertexArray,-1,1,-1),Lo(this.vertexArray,1,1,-1),this.indices.emplaceBack(5,1,3),this.indices.emplaceBack(3,7,5),this.indices.emplaceBack(6,2,0),this.indices.emplaceBack(0,4,6),this.indices.emplaceBack(2,6,7),this.indices.emplaceBack(7,3,2),this.indices.emplaceBack(5,4,0),this.indices.emplaceBack(0,1,5),this.indices.emplaceBack(0,2,3),this.indices.emplaceBack(3,1,0),this.indices.emplaceBack(7,6,4),this.indices.emplaceBack(4,5,7),this.vertexBuffer=t.createVertexBuffer(this.vertexArray,Do),this.indexBuffer=t.createIndexBuffer(this.indices),this.segment=e.bd.simpleSegment(0,0,36,12)}}function Io(t,i,n,r,s,o){const a=t.context.gl,l=i.paint.get("sky-atmosphere-color"),c=i.paint.get("sky-atmosphere-halo-color"),h=i.paint.get("sky-atmosphere-sun-intensity"),d=((e,t,i,n,r)=>({u_matrix_3f:e,u_sun_direction:t,u_sun_intensity:i,u_color_tint_r:[n.r,n.g,n.b,n.a],u_color_tint_m:[r.r,r.g,r.b,r.a],u_luminance:5e-5}))(e.ei(e.dJ(),r),s,h,l.toPremultipliedRenderColor(null),c.toPremultipliedRenderColor(null));a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_CUBE_MAP_POSITIVE_X+o,i.skyboxTexture,0),n.draw(t,a.TRIANGLES,Yi.disabled,Hi.disabled,Ni.unblended,Wi.frontCW,d,"skyboxCapture",i.skyboxGeometry.vertexBuffer,i.skyboxGeometry.indexBuffer,i.skyboxGeometry.segment)}const Po=e.ec([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]);class Ro{constructor(t){const i=new e.ej;i.emplaceBack(-1,1,1,0,0),i.emplaceBack(1,1,1,1,0),i.emplaceBack(1,-1,1,1,1),i.emplaceBack(-1,-1,1,0,1);const n=new e.a_;n.emplaceBack(0,1,2),n.emplaceBack(2,3,0),this.vertexBuffer=t.createVertexBuffer(i,Po.members),this.indexBuffer=t.createIndexBuffer(n),this.segments=e.bd.simpleSegment(0,0,4,2)}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy()}}const Oo=e.ec([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_size_scale",components:1},{type:"Float32",name:"a_fade_opacity",components:1}]);class zo{constructor(){this.starsCount=16e3,this.sizeMultiplier=.15,this.sizeRange=100,this.intensityRange=200}}class Fo{constructor(t){this.colorModeAlphaBlendedWriteRGB=new Ni([1,Fi,1,Fi],e.am.transparent,[!0,!0,!0,!1]),this.colorModeWriteAlpha=new Ni([1,0,1,0],e.am.transparent,[!1,!1,!1,!0]),this.params=new zo,this.updateNeeded=!0,t.tp.registerParameter(this.params,["Stars"],"starsCount",{min:100,max:16e3,step:1},()=>{this.updateNeeded=!0}),t.tp.registerParameter(this.params,["Stars"],"sizeMultiplier",{min:.01,max:2,step:.01}),t.tp.registerParameter(this.params,["Stars"],"sizeRange",{min:0,max:200,step:1},()=>{this.updateNeeded=!0}),t.tp.registerParameter(this.params,["Stars"],"intensityRange",{min:0,max:200,step:1},()=>{this.updateNeeded=!0})}update(t){const i=t.context;if(!this.atmosphereBuffer||this.updateNeeded){this.updateNeeded=!1,this.atmosphereBuffer=new Ro(i);const t=this.params.sizeRange,n=this.params.intensityRange,r=function(t){const i=e.el(30),n=[];for(let r=0;r{const i="globe"===s.projection.name?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"];e&&i.push("ALPHA_PASS");const l=t.getOrCreateProgram("globeAtmosphere",{defines:i}),c=((e,t,i,n,r,s,o,a,l,c,h,d)=>({u_frustum_tl:e,u_frustum_tr:t,u_frustum_br:i,u_frustum_bl:n,u_horizon:r,u_transition:s,u_fadeout_range:o,u_color:a,u_high_color:l,u_space_color:c,u_temporal_offset:h,u_horizon_angle:d}))(s.frustumCorners.TL,s.frustumCorners.TR,s.frustumCorners.BR,s.frustumCorners.BL,s.frustumCorners.horizon,a,g,h,u,p,y,b);t.uploadCommonUniforms(n,l);const d=this.atmosphereBuffer;d&&l.draw(t,r.TRIANGLES,o,Hi.disabled,e?this.colorModeWriteAlpha:this.colorModeAlphaBlendedWriteRGB,Wi.backCW,c,e?"atmosphere_glow_alpha":"atmosphere_glow",d.vertexBuffer,d.indexBuffer,d.segments)};w(!1),w(!0)}drawStars(t,i){const n=e.ay(i.properties.get("star-intensity"),0,1);if(0===n)return;const r=t.context,s=r.gl,o=t.transform,a=t.getOrCreateProgram("stars"),l=e.c3([]);e.c5(l,l,-o._pitch),e.c4(l,l,-o.angle),e.c5(l,l,e.al(o._center.lat)),e.en(l,l,-e.al(o._center.lng));const c=e.c8(new Float32Array(16),l),h=e.az([],o.starsProjMatrix,c),d=e.ei([],c),u=e.eo([],d),f=[0,1,0];e.dL(f,f,u),e.c1(f,f,this.params.sizeMultiplier);const p=[1,0,0];e.dL(p,p,u),e.c1(p,p,this.params.sizeMultiplier);const m=(g=f,_=p,y=n,{u_matrix:Float32Array.from(h),u_up:g,u_right:_,u_intensity_multiplier:y});var g,_,y;t.uploadCommonUniforms(r,a),this.starsVx&&this.starsIdx&&a.draw(t,s.TRIANGLES,Yi.disabled,Hi.disabled,this.colorModeAlphaBlendedWriteRGB,Wi.disabled,m,"atmosphere_stars",this.starsVx,this.starsIdx,this.starsSegments)}}class No{constructor(){this.visibleTiles=[]}updateBorders(t,i){const n=[],r=[],s=t._getRenderableCoordinates(!1,!0);for(const e of s){const s=t.getTile(e);if(!s.hasData())continue;const o=s.getBucket(i);o&&(o.isEmpty()||(n.push(e.key),r.push({bucket:o,tileID:e.canonical})))}let o=n.length!==this.visibleTiles.length;if(!o){n.sort();for(let e=0;ee.tileID.z-t.tileID.z||e.tileID.x-t.tileID.x||e.tileID.y-t.tileID.y);for(const t of r){const i=new Array,n=new Array,r=t.bucket;for(const e of r.featuresOnBorder)a.has(e.featureId)?n.push(e.footprintIndex):(a.add(e.featureId),i.push(e.footprintIndex));r.updateFootprintHiddenFlags(i,e.ep,!1),r.updateFootprintHiddenFlags(n,e.ep,!0)}}}function Yo(t,i){const n=[...t],r=i.cameraWorldSizeForFog/i.worldSize,s=e.bx([]);return e.cP(s,s,[r,r,1]),e.az(n,s,n),e.az(n,i.worldToFogMatrix,n),n}function Bo(t,i,n,r,s){const o=n.material,a=r.context,{baseColorTexture:l,metallicRoughnessTexture:c}=o.pbrMetallicRoughness,{normalTexture:h,occlusionTexture:d,emissionTexture:u}=o;function f(e,i,n){if(e&&(t.push(i),a.activeTexture.set(a.gl.TEXTURE0+n),e.gfxTexture)){const{minFilter:t,magFilter:i,wrapS:n,wrapT:r}=e.sampler;e.gfxTexture.bindExtraParam(t,i,n,r)}}f(l,"HAS_TEXTURE_u_baseColorTexture",Zi),f(c,"HAS_TEXTURE_u_metallicRoughnessTexture",Ji),f(h,"HAS_TEXTURE_u_normalTexture",Ki),f(d,"HAS_TEXTURE_u_occlusionTexture",Qi),f(u,"HAS_TEXTURE_u_emissionTexture",en),s&&(s.texture||(s.texture=new e.et(r.context,s.image,[s.image.height,s.image.height,s.image.height],a.gl.RGBA8)),a.activeTexture.set(a.gl.TEXTURE0+tn),s.texture&&s.texture.bind(a.gl.LINEAR,a.gl.CLAMP_TO_EDGE),t.push("APPLY_LUT_ON_GPU")),n.texcoordBuffer&&(t.push("HAS_ATTRIBUTE_a_uv_2f"),i.push(n.texcoordBuffer)),n.colorBuffer&&(t.push(12===n.colorBuffer.itemSize?"HAS_ATTRIBUTE_a_color_3f":"HAS_ATTRIBUTE_a_color_4f"),i.push(n.colorBuffer)),n.normalBuffer&&(t.push("HAS_ATTRIBUTE_a_normal_3f"),i.push(n.normalBuffer)),n.pbrBuffer&&(t.push("HAS_ATTRIBUTE_a_pbr"),t.push("HAS_ATTRIBUTE_a_heightBasedEmissiveStrength"),i.push(n.pbrBuffer)),"OPAQUE"!==o.alphaMode&&"MASK"!==o.alphaMode||t.push("UNPREMULT_TEXTURE_IN_SHADER"),o.defined||t.push("DIFFUSE_SHADED");const p=r.shadowRenderer;p&&(t.push("RENDER_SHADOWS","DEPTH_TEXTURE"),p.useNormalOffset&&t.push("NORMAL_OFFSET"))}function Ho(t,i,n,r,s,o){const a=n.paint.get("model-opacity").constantOr(1),l=i.context,c=new Yi(i.context.gl.LEQUAL,Yi.ReadWrite,i.depthRangeFor3D),h=i.transform,d=t.mesh,u=d.material,f=u.pbrMetallicRoughness,p=i.style.fog;let m;m="pixels"===i.transform.projection.zAxisUnit?[...t.nodeModelMatrix]:e.az([],r.zScaleMatrix,t.nodeModelMatrix),e.az(m,r.negCameraPosMatrix,m);const g=e.bi([],m);e.ea(g,g);const _="none"===n.paint.get("model-color-use-theme").constantOr("default"),y=n.paint.get("model-emissive-strength").constantOr(0),v=Os(new Float32Array(t.worldViewProjection),new Float32Array(m),new Float32Array(g),null,i,a,f.baseColorFactor,u.emissiveFactor,f.metallicFactor,f.roughnessFactor,u,y,n),x={defines:[]},b=[],w=i.shadowRenderer;w&&(w.useNormalOffset=!1),Bo(x.defines,b,d,i,_?null:n.lut);let S=null;if(p){const e=Yo(t.nodeModelMatrix,i.transform);if(S=new Float32Array(e),"globe"!==h.projection.name){const t=d.aabb.min,i=d.aabb.max,[n,r]=p.getOpacityForBounds(e,t[0],t[1],i[0],i[1]);x.overrideFog=n>=Re||r>=Re}}const T=an(i,n.paint.get("model-cutoff-fade-range"));T.shouldRenderCutoff&&x.defines.push("RENDER_CUTOFF");const k=i.getOrCreateProgram("model",x);i.uploadCommonUniforms(l,k,null,S,T),"shadow"!==i.renderPass&&w&&w.setupShadowsFromMatrix(t.nodeModelMatrix,k),k.draw(i,l.gl.TRIANGLES,c,s,o,d.material.doubleSided?Wi.disabled:Wi.backCCW,v,n.id,d.vertexBuffer,d.indexBuffer,d.segments,n.paint,i.transform.zoom,void 0,b)}function jo(t,i,n,r,s,o,a){let l;l="globe"===t.projection.name?e.er(n,t):[...n],e.az(l,l,i.matrix);const c=e.az([],r,l);if(i.meshes)for(const n of i.meshes){if("BLEND"!==n.material.alphaMode){a.push({mesh:n,depth:0,modelIndex:s,worldViewProjection:c,nodeModelMatrix:l});continue}const i=e.ad([],n.centroid,c);!t.isOrthographic&&i[2]<=0||o.push({mesh:n,depth:i[2],modelIndex:s,worldViewProjection:c,nodeModelMatrix:l})}if(i.children)for(const e of i.children)jo(t,e,n,r,s,o,a)}function Vo(e,t,i,n){const r=i.shadowRenderer;if(!r)return;const s=r.getShadowPassDepthMode(),o=r.getShadowPassColorMode(),a=r.calculateShadowPassMatrixFromMatrix(t),l=zs(a);i.getOrCreateProgram("modelDepth",{defines:i._shadowMapDebug?[]:["DEPTH_TEXTURE"]}).draw(i,i.context.gl.TRIANGLES,s,Hi.disabled,o,Wi.backCCW,l,n.id,e.vertexBuffer,e.indexBuffer,e.segments,n.paint,i.transform.zoom,void 0,void 0)}function Wo(t,i,n){const r=i.updateZoomBasedPaintProperties(),s=function(t,i,n){let r,s,o,a=t.terrain?t.terrain.exaggeration():0;if(t.terrain&&a>0){const i=t.terrain,s=i.findDEMTileFor(n);s&&s.dem?r=e.eu.create(i,n,s):a=0}if(0===a&&(i.terrainElevationMin=0,i.terrainElevationMax=0),a===i.validForExaggeration&&(0===a||r&&r._demTile&&r._demTile.tileID===i.validForDEMTile.id&&r._dem._timestamp===i.validForDEMTile.timestamp))return!1;for(const e in i.instancesPerModel){const t=i.instancesPerModel[e];for(let e=0;eh&&(h=e.max)}const d=e.ay(r.x,o,a)-r.x,u=e.ay(r.y,l,c)-r.y,f=e.cb(h,i.center.lat)-r.z;return i._zoomFromMercatorZ(Math.sqrt(d*d+u*u+f*f))}function Go(e,t,i,n,r,s,o){const a=e.context,l="shadow"===e.renderPass,c=e.shadowRenderer,h=l&&c?c.getShadowPassDepthMode():new Yi(a.gl.LEQUAL,Yi.ReadWrite,e.depthRangeFor3D),d=e.isTileAffectedByFog(s);if(i.meshes)for(const u of i.meshes){const f=["MODEL_POSITION_ON_GPU"],p=[];let m,g,_;n.instancedDataArray.length>20&&f.push("INSTANCED_ARRAYS");const y=an(e,t.paint.get("model-cutoff-fade-range"));if(y.shouldRenderCutoff&&f.push("RENDER_CUTOFF"),l&&c)m=e.getOrCreateProgram("modelDepth",{defines:f}),g=zs(o.shadowTileMatrix,o.shadowTileMatrix,Float32Array.from(i.matrix)),_=c.getShadowPassColorMode();else{Bo(f,p,u,e,"none"===t.paint.get("model-color-use-theme").constantOr("default")?null:t.lut),m=e.getOrCreateProgram("model",{defines:f,overrideFog:d});const n=u.material,l=n.pbrMetallicRoughness,h=t.paint.get("model-opacity").constantOr(1),v=t.paint.get("model-emissive-strength").constantOr(0);g=Os(s.expandedProjMatrix,Float32Array.from(i.matrix),new Float32Array(16),null,e,h,l.baseColorFactor,n.emissiveFactor,l.metallicFactor,l.roughnessFactor,n,v,t,r),c&&(o.shadowUniformsInitialized?m.setShadowUniformValues(a,c.getShadowUniformValues()):(c.setupShadows(s.toUnwrapped(),m,"model-tile"),o.shadowUniformsInitialized=!0)),_=y.shouldRenderCutoff||h<1||"OPAQUE"!==n.alphaMode?Ni.alphaBlended:Ni.unblended}e.uploadCommonUniforms(a,m,s.toUnwrapped(),null,y);const v=u.material.doubleSided?Wi.disabled:Wi.backCCW;if(n.instancedDataArray.length>20)p.push(n.instancedDataBuffer),m.draw(e,a.gl.TRIANGLES,h,Hi.disabled,_,v,g,t.id,u.vertexBuffer,u.indexBuffer,u.segments,t.paint,e.transform.zoom,void 0,p,n.instancedDataArray.length);else{const i=l?"u_instance":"u_normal_matrix";for(let r=0;rc[1]?a:c,o[0]=n.max[0],a=e.aA(e.ev(),o,s),l=a[1]c[1]?a:c,o[1]=n.min[1],a=e.aA(e.ev(),o,s),l=a[1]c[1]?a:c;const h=e.ay(r[0],0,1),d=100*i.pixelsPerMeter*e.ay(r[1],0,1),u=e.ay(r[2],0,1),f=e.ew(e.ev(),l,c,h),p=Math.tan(.5*i.fovX),m=-f[2]*p;if(0===d)return f[1]<-Math.abs(m)?u:1;const g=(-Math.abs(m)-f[1])/d,_=(e,t,i)=>(1-i)*e+i*t,y=e.ay(_(1,u,g),u,1);return _(1,y,e.ay((i.pitch-20)/20,0,1))}class Ko{}class Qo{constructor(){this._storage=new Map}getLinesFromTrianglesBuffer(t,i,n){{const e=this._storage.get(i.id);if(e)return e.lastUsedFrameIdx=t,e.buf}const r=n.gl,s=r.getBufferParameter(r.ELEMENT_ARRAY_BUFFER,r.BUFFER_SIZE),o=new ArrayBuffer(s),a=new Int16Array(o);r.getBufferSubData(r.ELEMENT_ARRAY_BUFFER,0,new Int16Array(o));const l=new e.ey;for(let e=0;e30&&(i.buf.destroy(),this._storage.delete(t))}destroy(){for(const[e,t]of this._storage)t.buf.destroy(),this._storage.delete(e)}}class ea{constructor(e){this.occluderSize=30,this.depthOffset=-1e-4,e.registerParameter(this,["Occlusion"],"occluderSize",{min:1,max:100,step:1}),e.registerParameter(this,["Occlusion"],"depthOffset",{min:-.05,max:0,step:1e-5})}}const ta=e.ec([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_rainParticleData",components:4}]);class ia{registerParameter(){}registerButton(){}registerBinding(){}refreshUI(){}}class na{constructor(e,t){this.revealStart=11,this.revealRange=2,e.registerParameter(this,[...t,"Reveal"],"revealStart",{min:0,max:17,step:.05}),e.registerParameter(this,[...t,"Reveal"],"revealRange",{min:.1,max:5.1,step:.05})}}const ra=e.ec([{type:"Float32",name:"a_pos_2f",components:2}]);class sa{destroy(){this.vignetteVx&&this.vignetteVx.destroy(),this.vignetteIdx&&this.vignetteIdx.destroy()}draw(t,i){const n=t.getOrCreateProgram("vignette");if(!this.vignetteVx||!this.vignetteIdx){const i=new e.ez,n=new e.a_;i.emplaceBack(-1,-1),i.emplaceBack(1,-1),i.emplaceBack(1,1),i.emplaceBack(-1,1),n.emplaceBack(0,1,2),n.emplaceBack(0,2,3),this.vignetteVx=t.context.createVertexBuffer(i,ra.members),this.vignetteIdx=t.context.createIndexBuffer(n)}const r=e.bd.simpleSegment(0,0,4,6);if(this.vignetteVx&&this.vignetteIdx){t.uploadCommonUniforms(t.context,n);const e={u_vignetteShape:(s={vignetteShape:[i.start,i.range,Math.pow(10,i.fadePower)],vignetteColor:[i.color.r,i.color.g,i.color.b,i.color.a*i.strength]}).vignetteShape,u_vignetteColor:s.vignetteColor};n.draw(t,t.context.gl.TRIANGLES,Yi.disabled,Hi.disabled,Ni.alphaBlended,Wi.disabled,e,"vignette",this.vignetteVx,this.vignetteIdx,r)}var s}}class oa{constructor(){this._accumulatedOffsetX=0,this._accumulatedOffsetY=0,this._accumulatedElevation=0}update(t,i){const n=t.getFreeCameraOptions().position,r=n.toAltitude(),s=n.toLngLat(),o=e.al(s.lng),a=e.al(s.lat),l=t.pixelsPerMeter/i,c=o*e.eB,h=e.eB*Math.log(Math.tan(Math.PI/4+a/2));if(void 0===this._offsetXPrev)this._offsetXPrev=0,this._offsetYPrev=0,this._elevationPrev=0,this._accumulatedOffsetX=0,this._accumulatedOffsetY=0,this._accumulatedElevation=0;else{const e=-this._offsetYPrev+h,t=-this._elevationPrev+r;this._accumulatedOffsetX+=(-this._offsetXPrev+c)*l,this._accumulatedOffsetY+=e*l,this._accumulatedElevation+=t*l,this._offsetXPrev=c,this._offsetYPrev=h,this._elevationPrev=r}}getPosition(){return[this._accumulatedOffsetX,this._accumulatedOffsetY,this._accumulatedElevation]}}function aa(e,t){return[-(e[0]-Math.floor(e[0]/t)*t),-(e[1]-Math.floor(e[1]/t)*t),-(e[2]-Math.floor(e[2]/t)*t)]}function la(t){const i=e.el(1323123451230),n=[];for(let r=0;rn)return;const r=ca(0,1,i.revealStart,i.revealStart+i.revealRange,n);if(!this.particlesVx||!this.particlesIdx)return;const s=structuredClone(this._params);let o=[-s.direction.x,s.direction.y,-100];e.au(o,o);const a=structuredClone(this._vignetteParams);a.strength*=r,s.overrideStyleParameters||(s.intensity=t.style.rain.state.density,s.timeFactor=t.style.rain.state.intensity,s.color=structuredClone(t.style.rain.state.color),o=structuredClone(t.style.rain.state.direction),s.screenThinning.intensity=t.style.rain.state.centerThinning,s.dropletSizeX=t.style.rain.state.dropletSize[0],s.dropletSizeYScale=t.style.rain.state.dropletSize[1]/t.style.rain.state.dropletSize[0],s.distortionStrength=100*t.style.rain.state.distortionStrength,a.strength=1,a.color=structuredClone(t.style.rain.state.vignetteColor));const l=this.updateOnRender(t,s.timeFactor),c=t.context,h=c.gl,d=t.transform;this.screenTexture&&this.screenTexture.size[0]===t.width&&this.screenTexture.size[1]===t.height||(this.screenTexture=new e.T(c,{width:t.width,height:t.height,data:null},h.RGBA8)),s.distortionStrength>0&&(c.activeTexture.set(h.TEXTURE0),this.screenTexture.bind(h.LINEAR,h.CLAMP_TO_EDGE),h.copyTexSubImage2D(h.TEXTURE_2D,0,0,0,0,0,t.width,t.height));const u=t.getOrCreateProgram("rainParticle");t.uploadCommonUniforms(c,u),c.activeTexture.set(h.TEXTURE0),this.screenTexture.bind(h.LINEAR,h.CLAMP_TO_EDGE);const f=[s.color.r,s.color.g,s.color.b,s.color.a],p=(i,n)=>{const r=aa(this._movement.getPosition(),i),a=s.dropletSizeX,c=s.dropletSizeX*s.dropletSizeYScale,p=t.width/2,m=t.height/2,g=ca(0,s.screenThinning.start,0,1,s.screenThinning.intensity),_=ca(.001,s.screenThinning.range,0,1,s.screenThinning.intensity),y=ca(0,s.screenThinning.particleOffset,0,1,s.screenThinning.intensity),v=(x={modelview:l.modelviewMatrix,projection:l.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:r,velocityConeAperture:s.velocityConeAperture,velocity:s.velocity,boxSize:i,rainDropletSize:[a,c],distortionStrength:s.distortionStrength,rainDirection:o,color:f,screenSize:[d.width,d.height],thinningCenterPos:[p,m],thinningShape:[g,_,Math.pow(10,s.screenThinning.fadePower)],thinningAffectedRatio:s.screenThinning.affectedRatio,thinningParticleOffset:y,shapeDirectionalPower:s.shapeDirPower,shapeNormalPower:s.shapeNormalPower,mode:n?0:1},{u_modelview:Float32Array.from(x.modelview),u_projection:Float32Array.from(x.projection),u_time:x.time,u_cam_pos:x.camPos,u_texScreen:0,u_velocityConeAperture:x.velocityConeAperture,u_velocity:x.velocity,u_boxSize:x.boxSize,u_rainDropletSize:x.rainDropletSize,u_distortionStrength:x.distortionStrength,u_rainDirection:x.rainDirection,u_color:x.color,u_screenSize:x.screenSize,u_thinningCenterPos:x.thinningCenterPos,u_thinningShape:x.thinningShape,u_thinningAffectedRatio:x.thinningAffectedRatio,u_thinningParticleOffset:x.thinningParticleOffset,u_shapeDirectionalPower:x.shapeDirectionalPower,u_shapeNormalPower:x.shapeNormalPower,u_mode:x.mode});var x;const b=Math.round(s.intensity*this.particlesCount),w=e.bd.simpleSegment(0,0,4*b,2*b);u.draw(t,h.TRIANGLES,Yi.disabled,Hi.disabled,Ni.alphaBlended,Wi.disabled,v,"rain_particles",this.particlesVx,this.particlesIdx,w)};s.distortionStrength>0&&p(s.boxSize,!0),p(s.boxSize,!1),this._vignette.draw(t,a)}}const ua=e.ec([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_snowParticleData",components:4},{type:"Float32",name:"a_snowParticleDataHorizontalOscillation",components:2}]);class fa extends ha{constructor(e){super(2.25),this._params={overrideStyleParameters:!1,intensity:.85,timeFactor:.75,velocityConeAperture:70,velocity:40,horizontalOscillationRadius:4,horizontalOscillationRate:1.5,boxSize:2e3,billboardSize:2,shapeFadeStart:.27,shapeFadePower:.21,screenThinning:{intensity:.4,start:.15,range:1.4,fadePower:.24,affectedRatio:1,particleOffset:-.2},color:{r:1,g:1,b:1,a:1},direction:{x:-50,y:-35}},this._revealParams=new na(e.tp,["Precipitation","Snow"]),this._vignetteParams={strength:.3,start:.78,range:.46,fadePower:.2,color:{r:1,g:1,b:1,a:1}},this.particlesCount=16e3}update(t){const i=t.context;if(!this.particlesVx){const t=la(this.particlesCount),n=new e.eD,r=new e.a_;let s=0;const o=e.el(1323123451230);for(let e=0;eo)return;const a=ca(0,1,s.revealStart,s.revealStart+s.revealRange,o);r.strength*=a,i.overrideStyleParameters||(i.intensity=t.style.snow.state.density,i.timeFactor=t.style.snow.state.intensity,i.color=structuredClone(t.style.snow.state.color),n=structuredClone(t.style.snow.state.direction),i.screenThinning.intensity=t.style.snow.state.centerThinning,i.billboardSize=2.79*t.style.snow.state.flakeSize,r.strength=1,r.color=structuredClone(t.style.snow.state.vignetteColor));const l=this.updateOnRender(t,i.timeFactor);if(!this.particlesVx||!this.particlesIdx)return;const c=t.context,h=c.gl,d=t.transform,u=t.getOrCreateProgram("snowParticle");t.uploadCommonUniforms(c,u),((i,r,s)=>{const o=aa(this._movement.getPosition(),i),a=d.width/2,c=d.height/2,f=ca(0,s.screenThinning.start,0,1,s.screenThinning.intensity),p=ca(.001,s.screenThinning.range,0,1,s.screenThinning.intensity),m=ca(0,s.screenThinning.particleOffset,0,1,s.screenThinning.intensity),g=(_={modelview:l.modelviewMatrix,projection:l.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:o,velocityConeAperture:s.velocityConeAperture,velocity:s.velocity,horizontalOscillationRadius:s.horizontalOscillationRadius,horizontalOscillationRate:s.horizontalOscillationRate,boxSize:i,billboardSize:1*s.billboardSize,simpleShapeParameters:[s.shapeFadeStart,s.shapeFadePower],screenSize:[d.width,d.height],thinningCenterPos:[a,c],thinningShape:[f,p,Math.pow(10,s.screenThinning.fadePower)],thinningAffectedRatio:s.screenThinning.affectedRatio,thinningParticleOffset:m,color:[s.color.r,s.color.g,s.color.b,s.color.a],direction:n},{u_modelview:Float32Array.from(_.modelview),u_projection:Float32Array.from(_.projection),u_time:_.time,u_cam_pos:_.camPos,u_velocityConeAperture:_.velocityConeAperture,u_velocity:_.velocity,u_horizontalOscillationRadius:_.horizontalOscillationRadius,u_horizontalOscillationRate:_.horizontalOscillationRate,u_boxSize:_.boxSize,u_billboardSize:_.billboardSize,u_simpleShapeParameters:_.simpleShapeParameters,u_screenSize:_.screenSize,u_thinningCenterPos:_.thinningCenterPos,u_thinningShape:_.thinningShape,u_thinningAffectedRatio:_.thinningAffectedRatio,u_thinningParticleOffset:_.thinningParticleOffset,u_particleColor:_.color,u_direction:_.direction});var _;const y=Math.round(s.intensity*this.particlesCount),v=e.bd.simpleSegment(0,0,4*y,2*y);this.particlesVx&&this.particlesIdx&&u.draw(t,h.TRIANGLES,Yi.disabled,Hi.disabled,Ni.alphaBlended,Wi.disabled,g,"snow_particles",this.particlesVx,this.particlesIdx,v)})(i.boxSize,0,i),this._vignette.draw(t,r)}}const pa={symbol:function(t,i,n,r,s){if("translucent"!==t.renderPass)return;const o=Hi.disabled,a=t.colorModeForRenderPass(),l=n.layout.get("text-variable-anchor"),c=n.layout.get("text-size-scale-range"),h=e.ay(t.scaleFactor,c[0],c[1]);l&&function(t,i,n,r,s,o,a,l){const c=i.transform,h="map"===s,d="map"===o;for(const i of t){const t=r.getTile(i),s=t.getBucket(n);if(!s||!s.text||!s.text.segments.get().length)continue;const o=e.bH(s.textSizeData,c.zoom,l),u=Ht(i,s.getProjection(),c),f=c.calculatePixelsToTileUnitsMatrix(t),p=Xt(u,t.tileID.canonical,d,h,c,s.getProjection(),f),m=s.hasIconTextFit()&&s.hasIconData();o&&Xs(s,h,d,a,c,p,i,Math.pow(2,c.zoom-t.tileID.overscaledZ),o,m)}}(r,t,n,i,n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),s,h);const d=0!==n.paint.get("icon-opacity").constantOr(1),u=0!==n.paint.get("text-opacity").constantOr(1);void 0!==n.layout.get("symbol-sort-key").constantOr(1)&&(d||u)?qs(t,i,n,r,o,a):(d&&qs(t,i,n,r,o,a,{onlyIcons:!0}),u&&qs(t,i,n,r,o,a,{onlyText:!0})),i.map.showCollisionBoxes&&(Ws(t,i,n,r,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),!0),Ws(t,i,n,r,n.paint.get("icon-translate"),n.paint.get("icon-translate-anchor"),!1))},circle:function(t,i,n,r){if("translucent"!==t.renderPass)return;const s=n.paint.get("circle-opacity"),o=n.paint.get("circle-stroke-width"),a=n.paint.get("circle-stroke-opacity"),l=void 0!==n.layout.get("circle-sort-key").constantOr(1),c=n.paint.get("circle-emissive-strength");if(0===s.constantOr(1)&&(0===o.constantOr(1)||0===a.constantOr(1)))return;const h=t.context,d=h.gl,u=t.transform,f=!(!t.terrain||!t.terrain.enabled),p=n.layout.get("circle-elevation-reference"),m=t.depthModeForSublayer(0,Yi.ReadOnly),g=new Yi(t.context.gl.LEQUAL,Yi.ReadOnly,t.depthRangeFor3D),_="none"===p||f?m:g,y=Hi.disabled,v=t.colorModeForDrapableLayerRenderPass(c),x="globe"===u.projection.name,b=[e.aD(u.center.lng),e.aH(u.center.lat)],w=[];for(let s=0;se.sortKey-t.sortKey);const S={useDepthForOcclusion:u.depthOcclusionForSymbolsAndCircles};for(const e of w){const{programConfiguration:i,program:r,layoutVertexBuffer:s,dynamicBuffers:o,indexBuffer:a,uniformValues:l,tile:c}=e.state,f=e.segments;t.terrain&&t.terrain.setupElevationDraw(c,r,S),t.uploadCommonUniforms(h,r,c.tileID.toUnwrapped()),r.draw(t,d.TRIANGLES,_,y,v,Wi.disabled,l,n.id,s,a,f,n.paint,u.zoom,i,o)}},heatmap:function(t,i,n,r){if(0!==n.paint.get("heatmap-opacity"))if("offscreen"===t.renderPass){const s=t.context,o=s.gl,a=Hi.disabled,l=new Ni([o.ONE,o.ONE,o.ONE,o.ONE],e.am.transparent,[!0,!0,!0,!0]);!function(e,t,i,n){const r=e.gl,s=t.width*n,o=t.height*n;e.activeTexture.set(r.TEXTURE1),e.viewport.set([0,0,s,o]);let a=i.heatmapFbo;if(!a||a&&(a.width!==s||a.height!==o)){a&&a.destroy();const t=r.createTexture();r.bindTexture(r.TEXTURE_2D,t),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR),a=i.heatmapFbo=e.createFramebuffer(s,o,!0,null),function(e,t,i,n,r,s){const o=e.gl;o.texImage2D(o.TEXTURE_2D,0,e.extRenderToTextureHalfFloat?o.RGBA16F:o.RGBA,r,s,0,o.RGBA,e.extRenderToTextureHalfFloat?o.HALF_FLOAT:o.UNSIGNED_BYTE,null),n.colorAttachment.set(i)}(e,0,t,a,s,o)}else r.bindTexture(r.TEXTURE_2D,a.colorAttachment.get()),e.bindFramebuffer.set(a.framebuffer)}(s,t,n,"globe"===t.transform.projection.name?.5:.25),s.clear({color:e.am.transparent});const c=t.transform,h="globe"===c.projection.name,d=h?["PROJECTION_GLOBE_VIEW"]:[],u=h?Wi.frontCCW:Wi.disabled,f=[e.aD(c.center.lng),e.aH(c.center.lat)];for(let e=0;e({u_image:0,u_color_ramp:1,u_opacity:t.paint.get("heatmap-opacity")}))(0,i),i.id,t.viewportBuffer,t.quadTriangleIndexBuffer,t.viewportSegments,i.paint,t.transform.zoom)}(t,n))},line:function(t,i,n,r){if("translucent"!==t.renderPass)return;const s=n.paint.get("line-opacity"),o=n.paint.get("line-width");if(0===s.constantOr(1)||0===o.constantOr(1))return;const a=n.paint.get("line-emissive-strength"),l=n.paint.get("line-occlusion-opacity"),c=n.layout.get("line-elevation-reference"),h="meters"===n.layout.get("line-width-unit"),d="sea"===c,u=!(!t.terrain||!t.terrain.enabled),f=t.context,p=f.gl;if(n.hasElevatedBuckets&&"globe"===t.transform.projection.name)return;const m=n.layout.get("line-cross-slope"),g=void 0!==m,_=m<1,y=t.colorModeForDrapableLayerRenderPass(a),v=t.terrain&&t.terrain.renderingToTexture,x=v?1:e.q.devicePixelRatio,b=n.paint.get("line-dasharray"),w=b.constantOr(1),S=n.layout.get("line-cap"),T=b.constantOr(null),k=S.constantOr(null),M=n.paint.get("line-pattern"),A=M.constantOr(1),C=n.paint.get("line-pattern-cross-fade"),D=M.constantOr(null),L=n.paint.get("line-opacity").constantOr(1);let E=!A&&1!==L||t.depthOcclusion&&l>0&&l<1;const I=n.paint.get("line-gradient"),P=A?"linePattern":"line",R=e.dY(n);let O;if(v&&t.terrain&&t.terrain.clipOrMaskOverlapStencilType()&&(E=!1),0!==l&&t.depthOcclusion){const t=n.paint._values["line-opacity"];t&&t.value&&"constant"===t.value.kind?O=t.value:e.w(`Occlusion opacity for layer ${n.id} is supported only when line-opacity isn't data-driven.`)}"constant"!==o.value.kind&&!1===o.value.isLineProgressConstant&&R.push("VARIABLE_LINE_WIDTH");const z=(r,s,o,a,c,u)=>{for(const m of r){const r=i.getTile(m);if(A&&!r.patternsLoaded())continue;const g=r.getBucket(n);if(!g)continue;if("none"!==g.elevationType&&!c||"none"===g.elevationType&&c)continue;t.prepareDrawTile();const _=[...s],b=t.shadowRenderer,S="road"===g.elevationType&&!!b&&b.enabled;let M=[0,0,0];if(S){const e=t.style.directionalLight,i=t.style.ambientLight;e&&i&&(M=pn(t.style,e,i)),_.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET")}const R=g.programConfigurations.get(n.id);let z=!1;if(D&&r.imageAtlas){const t=e.dZ.from(D),i=t.getPrimary().scaleSelf(x).toString(),n=r.imageAtlas.patternPositions.get(i),s=t.getSecondary(),o=s?r.imageAtlas.patternPositions.get(s.scaleSelf(x).toString()):null;z=!!n&&!!o,n&&R.setConstantPatternPositions(n,o)}C>0&&(z||R.getPatternTransitionVertexBuffer("line-pattern"))&&_.push("LINE_PATTERN_TRANSITION");const F=t.isTileAffectedByFog(m),N=t.getOrCreateProgram(P,{config:R,defines:_,overrideFog:F});if(!A&&T&&k&&r.lineAtlas){const e=r.lineAtlas.getDash(T,k);e&&R.setConstantPatternPositions(e)}S&&b.setupShadows(r.tileID.toUnwrapped(),N,"vector-tile");let[Y,B]=n.paint.get("line-trim-offset");if("round"===k||"square"===k){const e=1;Y!==B&&(0===Y&&(Y-=e),1===B&&(B+=e))}const H=v?m.projMatrix:null,j=h?1/g.tileToMeter/e.aw(r,1,t.transform.zoom):1,V=h?1/g.tileToMeter/e.aw(r,1,Math.floor(t.transform.zoom)):1,W=A?e.d_(t,r,n,H,x,j,V,[Y,B],M,C):e.d$(t,r,n,H,g.lineClipsArray.length,x,j,V,[Y,B],M);if(I){const r=g.gradients[n.id];let s=r.texture;if(n.gradientVersion!==r.version){let o=256;if(n.stepInterpolant){const n=i.getSource().maxzoom,r=m.canonical.z===n?Math.ceil(1<{null!=O&&(O.value=L*l),N.draw(t,p.TRIANGLES,o,e,y,Wi.disabled,W,n.id,g.layoutVertexBuffer,g.indexBuffer,g.segments,n.paint,t.transform.zoom,R,[g.layoutVertexBuffer2,g.patternVertexBuffer,g.zOffsetVertexBuffer]),null!=O&&(O.value=L)};if(E&&!c){const e=t.stencilModeForClipping(m).ref;0===e&&v&&f.clear({stencil:0});const i={func:p.EQUAL,mask:255};W.u_alpha_discard_threshold=.8,U(new Hi(i,e,255,p.KEEP,p.KEEP,p.INVERT)),W.u_alpha_discard_threshold=0,U(new Hi(i,e,255,p.KEEP,p.KEEP,p.KEEP))}else W.u_alpha_discard_threshold=E&&c&&u?.8:0,U(c?a:t.stencilModeForClipping(m))}};let F=t.depthModeForSublayer(0,Yi.ReadOnly);const N=new Yi(t.depthOcclusion?p.GREATER:p.LEQUAL,Yi.ReadOnly,t.depthRangeFor3D);if(n.hasNonElevatedBuckets){const i=!v&&t.terrain;0!==l&&i?e.w(`Occlusion opacity for layer ${n.id} is supported on terrain only if the layer has line-z-offset enabled.`):i?e.w(`Cannot render non-elevated lines in immediate mode when terrain is enabled. Layer: ${n.id}.`):z(r,R,F,Hi.disabled,!1,!0)}if(n.hasElevatedBuckets){"hd-road-markup"===c?u||(F=N,R.push("ELEVATED_ROADS")):(R.push("ELEVATED"),F=N,g&&R.push(_?"CROSS_SLOPE_HORIZONTAL":"CROSS_SLOPE_VERTICAL"),d&&R.push("ELEVATION_REFERENCE_SEA"));const e=E?t.stencilModeFor3D():Hi.disabled;t.forceTerrainMode=!0,z(r,R,F,e,!0,!0),E&&z(r,R,F,e,!0,!1),t.forceTerrainMode=!1}E&&(t.resetStencilClippingMasks(),v&&f.clear({stencil:0})),0===l||t.depthOcclusion||v||t.layersWithOcclusionOpacity.push(t.currentLayer)},fill:function(t,i,n,r){const s=n.paint.get("fill-color"),o=n.paint.get("fill-opacity");if(0===o.constantOr(1))return;const a=n.paint.get("fill-emissive-strength"),l=t.colorModeForDrapableLayerRenderPass(a),c=n.paint.get("fill-pattern"),h=t.opaquePassEnabledForLayer()&&!c.constantOr(1)&&1===s.constantOr(e.am.transparent).a&&1===o.constantOr(0)?"opaque":"translucent";let d="none";"none"!==n.layout.get("fill-elevation-reference")?d="road":0!==n.paint.get("fill-z-offset").constantOr(1)&&(d="offset");const u=!(!t.terrain||!t.terrain.enabled),f={painter:t,sourceCache:i,layer:n,coords:r,colorMode:l,elevationType:d,terrainEnabled:u,pass:h};if("shadow"!==t.renderPass)if("offset"!==d){if(Qs(f,!1),"road"===d){const e=!u&&"translucent"===t.renderPass;e&&Ks(t,i,n,r,"geometry"),Qs(f,!0,Hi.disabled),e&&function(e){const{painter:t,sourceCache:i,layer:n,coords:r,colorMode:s}=e,o=t.context.gl,a=e.painter.shadowRenderer,l=!!a&&a.enabled,c=new Yi(t.context.gl.LEQUAL,Yi.ReadOnly,t.depthRangeFor3D);let h=[0,0,0];if(l){const e=t.style.directionalLight,i=t.style.ambientLight;e&&i&&(h=pn(t.style,e,i))}const d=e=>{for(const d of r){const r=i.getTile(d),u=r.getBucket(n);if(!u)continue;const f=u.elevatedStructures;if(!f)continue;let p,m;if(e?(p=f.renderableBridgeSegments,m=f.bridgeProgramConfigurations.get(n.id)):(p=f.renderableTunnelSegments,m=f.tunnelProgramConfigurations.get(n.id)),!p||0===p.segments[0].primitiveLength)continue;m.updatePaintBuffers(),t.prepareDrawTile();const g=t.isTileAffectedByFog(d),_=[];l&&_.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET");const y=t.getOrCreateProgram("elevatedStructures",{config:m,overrideFog:g,defines:_}),v=t.translatePosMatrix(d.projMatrix,r,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor"));l&&a.setupShadows(r.tileID.toUnwrapped(),y,"vector-tile");const x=fs(v,h);t.uploadCommonUniforms(t.context,y,d.toUnwrapped()),y.draw(t,o.TRIANGLES,c,Hi.disabled,s,Wi.backCCW,x,n.id,f.vertexBuffer,f.indexBuffer,p,n.paint,t.transform.zoom,m,[f.vertexBufferNormal])}};d(!0),d(!1)}(f)}}else Qs(f,!1,t.stencilModeFor3D());else t.shadowRenderer&&"road"===d&&!u&&function(e){const{painter:t,sourceCache:i,layer:n,coords:r}=e,s=t.context.gl,o=e.painter.shadowRenderer;for(const e of r){const r=i.getTile(e),a=r.getBucket(n);if(!a)continue;const l=a.elevatedStructures;if(!l)continue;if(!l.shadowCasterSegments||0===l.shadowCasterSegments.segments[0].primitiveLength)continue;t.prepareDrawTile();const c=a.bufferData.programConfigurations.get(n.id),h=t.isTileAffectedByFog(e),d=t.getOrCreateProgram("elevatedStructuresDepth",{config:c,overrideFog:h}),u=o.calculateShadowPassMatrixFromTile(r.tileID.toUnwrapped());t.uploadCommonUniforms(t.context,d,e.toUnwrapped());const f={u_matrix:u,u_depth_bias:0};d.draw(t,s.TRIANGLES,o.getShadowPassDepthMode(),Hi.disabled,o.getShadowPassColorMode(),Wi.disabled,f,n.id,l.vertexBuffer,l.indexBuffer,l.shadowCasterSegments,n.paint,t.transform.zoom,c)}}(f)},"fill-extrusion":function(t,i,n,r){const s=n.paint.get("fill-extrusion-opacity"),o=t.context,a=o.gl,l=t.terrain,c=l&&l.renderingToTexture;if(0===s)return;const h=t.conflationActive&&t.style.isLayerClipped(n,i.getSource()),d=t.style.order.indexOf(n.fqid);if(h&&function(e,t,i,n,r){for(const s of n){const n=t.getTile(s).getBucket(i);n&&(n.updateReplacement(s,e.replacementSource,r),n.uploadCentroid(e.context))}}(t,i,n,r,d),l||h)for(const e of r){const r=i.getTile(e).getBucket(n);r&&no(t.context,i,e,r,n,l,h)}if("shadow"===t.renderPass&&t.shadowRenderer){const o=t.shadowRenderer;if(l&&s<.65&&n._transitionablePaint._values["fill-extrusion-opacity"].value.expression instanceof e.ab)return;const a=o.getShadowPassDepthMode(),c=o.getShadowPassColorMode();eo(t,i,n,r,a,Hi.disabled,c,h)}else if("translucent"===t.renderPass){const d=!n.paint.get("fill-extrusion-pattern").constantOr(1),u=n.paint.get("fill-extrusion-color").constantOr(e.am.white);if(!c&&0!==u.a){const e=new Yi(t.context.gl.LEQUAL,Yi.ReadWrite,t.depthRangeFor3D);1===s&&d?eo(t,i,n,r,e,Hi.disabled,Ni.unblended,h):(eo(t,i,n,r,e,Hi.disabled,Ni.disabled,h),eo(t,i,n,r,e,t.stencilModeFor3D(),t.colorModeForRenderPass(),h),t.resetStencilClippingMasks())}if(t.style.enable3dLights()&&d&&(!l&&"globe"!==t.transform.projection.name||c)){const s=n.paint.get("fill-extrusion-opacity"),d=n.paint.get("fill-extrusion-ambient-occlusion-intensity"),u=n.paint.get("fill-extrusion-ambient-occlusion-ground-radius"),f=n.paint.get("fill-extrusion-flood-light-intensity"),p="none"===n.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default"),m=n.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(p?null:n.lut).toArray01().slice(0,3),g=d>0&&u>0,_=f>0,y=(e,t,i)=>(1-i)*e+i*t,v=new to;v.translate=n.paint.get("fill-extrusion-translate"),v.translateAnchor=n.paint.get("fill-extrusion-translate-anchor"),v.edgeRadius=n.layout.get("fill-extrusion-edge-radius"),v.cutoffFadeRange=n.paint.get("fill-extrusion-cutoff-fade-range");const x=o=>{const l=t.depthModeForSublayer(1,Yi.ReadOnly,a.LEQUAL,!0),c=n.paint.get(o?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),p=y(.1,3,c),g=t._showOverdrawInspector;if(!g){const c=new Hi({func:a.ALWAYS,mask:255},255,255,a.KEEP,a.KEEP,a.REPLACE),g=new Ni([a.ONE,a.ONE,a.ONE,a.ONE],e.am.transparent,[!1,!1,!1,!0],a.MIN);io(v,t,i,n,r,l,c,g,Wi.disabled,o,"sdf",s,d,u,f,m,p,h,!1)}{const c=g?Hi.disabled:new Hi({func:a.EQUAL,mask:255},255,255,a.KEEP,a.DECR,a.DECR),_=g?t.colorModeForRenderPass():new Ni([a.ONE_MINUS_DST_ALPHA,a.DST_ALPHA,a.ONE,a.ONE],e.am.transparent,[!0,!0,!0,!0]);io(v,t,i,n,r,l,c,_,Wi.disabled,o,"color",s,d,u,f,m,p,h,!1)}};if(c){const c=(o,l,c)=>{const p=t.depthModeForSublayer(1,Yi.ReadOnly,a.LEQUAL,!1),g=n.paint.get(o?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),_=y(.1,3,g);{const c=new Ni([a.ONE,a.ONE,a.ONE,a.ONE],e.am.transparent,[!1,!1,!1,!0]);io(v,t,i,n,r,p,Hi.disabled,c,Wi.disabled,o,"clear",s,d,u,f,m,_,h,l)}{const c=new Hi({func:a.ALWAYS,mask:255},255,255,a.KEEP,a.KEEP,a.REPLACE),g=new Ni([a.ONE,a.ONE,a.ONE,a.ONE],e.am.transparent,[!1,!1,!1,!0],a.MIN);io(v,t,i,n,r,p,c,g,Wi.disabled,o,"sdf",s,d,u,f,m,_,h,l)}{const c=o?a.ZERO:a.ONE_MINUS_DST_ALPHA,g=new Hi({func:a.EQUAL,mask:255},255,255,a.KEEP,a.DECR,a.DECR),y=new Ni([c,a.DST_ALPHA,a.ONE_MINUS_DST_ALPHA,a.ZERO],e.am.transparent,[!0,!0,!0,!0]);io(v,t,i,n,r,p,g,y,Wi.disabled,o,"color",s,d,u,f,m,_,h,l)}{const g=new Ni([a.ONE,a.ONE,a.ONE,o?a.ZERO:a.ONE],e.am.transparent,[!1,!1,!1,!0],o?a.FUNC_ADD:a.MAX);io(v,t,i,n,r,p,Hi.disabled,g,Wi.disabled,o,"clear",s,d,u,f,m,_,h,l,c)}};if(g||_){let i;if(t.prepareDrawTile(),l){const t=l.drapeBufferSize[0],n=l.drapeBufferSize[1];i=l.framebufferCopyTexture,i&&(!i||i.size[0]===t&&i.size[1]===n)||(i&&i.destroy(),i=l.framebufferCopyTexture=new e.T(o,new e.r({width:t,height:n}),a.RGBA8)),i.bind(a.LINEAR,a.CLAMP_TO_EDGE),a.copyTexSubImage2D(a.TEXTURE_2D,0,0,0,0,0,t,n)}g&&c(!0,!1,i),_&&c(!1,!0,i)}}else g&&x(!0),_&&x(!1),(g||_)&&t.resetStencilClippingMasks()}}},building:function(t,i,n,r){t.currentLayer0&&o>0,c=!0;const h=n.paint.get("building-vertical-scale");h<1&&(c=!1);const d=t.conflationActive&&t.style.isLayerClipped(n,i.getSource()),u=t.style.order.indexOf(n.fqid);if(function(e,t,i,n,r,s){for(const o of s){const s=t.getTile(o).getBucket(i);s&&(r&&s.updateReplacement(o,e.replacementSource,n),s.uploadUpdatedIndexBuffer(e.context))}}(t,i,n,u,d,r),function(e,t,i,n){for(const r of n){const n=t.getTile(r).getBucket(i);n&&n.needsEvaluation(e,i)&&(n.evaluate(i),n.uploadUpdatedColorBuffer(e.context))}}(t,i,n,r),n.resetLayerRenderingStats(t),t.shadowRenderer&&(t.shadowRenderer.useNormalOffset=!0),"shadow"===t.renderPass&&t.shadowRenderer){const e=t.shadowRenderer,s=[],o=e.getShadowPassDepthMode();lo({painter:t,source:i,layer:n,coords:r,defines:s,blendMode:e.getShadowPassColorMode(),depthMode:o,verticalScale:h})}else if("translucent"===t.renderPass){l&&function(t,i,n,r,s,o,a,l,c,h,d,u){const f=t.context.gl,p=t.depthModeForSublayer(1,Yi.ReadOnly,f.LEQUAL,!0),m=.1*(1-(g=d))+3*g;var g;const _=t._showOverdrawInspector,y=u,v=new to;_||io(v,t,i,n,r,p,new Hi({func:f.ALWAYS,mask:255},255,255,f.KEEP,f.KEEP,f.REPLACE),new Ni([f.ONE,f.ONE,f.ONE,f.ONE],e.am.transparent,[!1,!1,!1,!0],f.MIN),Wi.disabled,s,"sdf",1,a,l,0,h,m,y,!1);{const o=_?Hi.disabled:new Hi({func:f.EQUAL,mask:255},255,255,f.KEEP,f.DECR,f.DECR),c=_?t.colorModeForRenderPass():new Ni([f.ONE_MINUS_DST_ALPHA,f.DST_ALPHA,f.ONE,f.ONE],e.am.transparent,[!0,!0,!0,!0]);io(v,t,i,n,r,p,o,c,Wi.disabled,s,"color",1,a,l,0,h,m,y,!1)}}(t,i,n,r,!0,0,s,o,0,[0,0,0],a,d);let u=["HAS_ATTRIBUTE_a_part_color_emissive","LIGHTING_3D_MODE"];c&&(u=u.concat("RENDER_SHADOWS","DEPTH_TEXTURE")),t.shadowRenderer.useNormalOffset&&(u=u.concat("NORMAL_OFFSET"));const f=new Yi(t.context.gl.LEQUAL,Yi.ReadWrite,t.depthRangeFor3D),p=t.colorModeForRenderPass();lo({painter:t,source:i,layer:n,coords:r,defines:u,blendMode:p,depthMode:f,verticalScale:h})}else if("light-beam"===t.renderPass){const e=["HAS_ATTRIBUTE_a_part_color_emissive","HAS_ATTRIBUTE_a_bloom_attenuation"],s=new Yi(t.context.gl.LEQUAL,Yi.ReadOnly,t.depthRangeFor3D);lo({painter:t,source:i,layer:n,coords:r,defines:e,blendMode:Ni.alphaBlended,depthMode:s,verticalScale:h})}t.shadowRenderer&&(t.shadowRenderer.useNormalOffset=!1),t.resetStencilClippingMasks()},hillshade:function(e,t,i,n){if("offscreen"!==e.renderPass&&"translucent"!==e.renderPass)return;if(e.style.disableElevatedTerrain)return;const r=e.context,s=e.terrain&&e.terrain.renderingToTexture,[o,a]="translucent"!==e.renderPass||s?[{},n]:e.stencilConfigForOverlap(n);for(const n of a){const r=t.getTile(n);if(r.needsHillshadePrepare&&"offscreen"===e.renderPass)ir(e,r,i);else if("translucent"===e.renderPass){const t=e.depthModeForSublayer(0,Yi.ReadOnly),a=i.paint.get("hillshade-emissive-strength"),l=e.colorModeForDrapableLayerRenderPass(a),c=s&&e.terrain?e.terrain.stencilModeForRTTOverlap(n):o[n.overscaledZ];er(e,n,r,i,t,c,l)}}r.viewport.set([0,0,e.width,e.height]),e.resetStencilClippingMasks()},raster:function(t,i,n,r,s,o){if("translucent"!==t.renderPass)return;if(0===n.paint.get("raster-opacity"))return;const a="globe"===t.transform.projection.name,l=0!==n.paint.get("raster-elevation"),c=l&&a;if(t.renderElevatedRasterBackface&&!c)return;const h=t.context,d=h.gl,u=i.getSource(),f=function(t,i,n,r){const s=i.paint.get("raster-color"),o="raster-array"===t.type,a=[],l=i.paint.get("raster-resampling"),c=i.paint.get("raster-color-mix");let h=i.paint.get("raster-color-range");const d=[c[0],c[1],c[2],0],u=c[3];let f="nearest"===l?r.NEAREST:r.LINEAR;if(o&&(a.push("RASTER_ARRAY"),s||a.push("RASTER_COLOR"),"linear"===l&&a.push("RASTER_ARRAY_LINEAR"),f=r.NEAREST,!h&&t.rasterLayers)){const e=t.rasterLayers.find(({id:e})=>e===i.sourceLayer);e&&e.fields&&e.fields.range&&(h=e.fields.range)}if(h=h||[0,1],s){a.push("RASTER_COLOR"),n.activeTexture.set(r.TEXTURE2),i.updateColorRamp(h);let t=i.colorRampTexture;t||(t=i.colorRampTexture=new e.T(n,i.colorRamp,r.RGBA8)),t.bind(r.LINEAR,r.CLAMP_TO_EDGE)}return{mix:d,range:h,offset:u,defines:a,resampling:f}}(u,n,h,d);if(u instanceof e.aP&&!r.length&&!a)return;const p=n.paint.get("raster-emissive-strength"),m=t.colorModeForDrapableLayerRenderPass(p),g=t.terrain&&t.terrain.renderingToTexture,_=!t.options.moving,y="nearest"===n.paint.get("raster-resampling")?d.NEAREST:d.LINEAR;if(u instanceof e.aP&&!r.length&&(u.onNorthPole||u.onSouthPole)){const e=l?t.stencilModeFor3D():Hi.disabled;return void ho(!!u.onNorthPole,null,t,i,n,p,f,Wi.disabled,e)}if(!r.length)return;const[v,x]=u instanceof e.aP||g?[{},r]:t.stencilConfigForOverlap(r),b=x[x.length-1].overscaledZ;c&&f.defines.push("PROJECTION_GLOBE_VIEW"),l&&f.defines.push("RENDER_CUTOFF");const w=(r,s,x)=>{for(const w of r){const r=w.toUnwrapped(),S=i.getTile(w);if(g&&(!S||!S.hasData()))continue;h.activeTexture.set(d.TEXTURE0);const T=fo(S,u,n,f);if(!T||!T.texture)continue;const{texture:k,mix:M,offset:A,tileSize:C,buffer:D}=T;let L,E;g?(L=Yi.disabled,E=w.projMatrix):l?(L=new Yi(d.LEQUAL,Yi.ReadWrite,t.depthRangeFor3D),E=a?Float32Array.from(t.transform.expandedFarZProjMatrix):t.transform.calculateProjMatrix(r,_)):(L=t.depthModeForSublayer(w.overscaledZ-b,1===n.paint.get("raster-opacity")?Yi.ReadWrite:Yi.ReadOnly,d.LESS),E=t.transform.calculateProjMatrix(r,_));const I=t.terrain&&g?t.terrain.stencilModeForRTTOverlap(w):v[w.overscaledZ],P=o?0:n.paint.get("raster-fade-duration");S.registerFadeDuration(P);const R=i.findLoadedParent(w,0),O=Xr(S,R,i,t.transform,P);let z,F;t.terrain&&t.terrain.prepareDrawTile(),h.activeTexture.set(d.TEXTURE0),k.bind(y,d.CLAMP_TO_EDGE),h.activeTexture.set(d.TEXTURE1),R?(R.texture&&R.texture.bind(y,d.CLAMP_TO_EDGE),z=Math.pow(2,R.tileID.overscaledZ-S.tileID.overscaledZ),F=[S.tileID.canonical.x*z%1,S.tileID.canonical.y*z%1]):k.bind(y,d.CLAMP_TO_EDGE),"useMipmap"in k&&h.extTextureFilterAnisotropic&&t.transform.pitch>20&&d.texParameterf(d.TEXTURE_2D,h.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,h.extTextureFilterAnisotropicMax);const N=t.transform;let Y;const B=l?uo(N):[0,0,0,0];let H,j,V,W,U,$=0;if(c&&u instanceof e.aP&&u.coordinates.length>3)H=Float32Array.from(e.bh(e.dD(new e.cA(0,0,0)))),j=Float32Array.from(N.globeMatrix),V=Float32Array.from(e.dz(N)),W=[e.aD(N.center.lng),e.aH(N.center.lat)],Y=u.elevatedGlobePerspectiveTransform,U=u.elevatedGlobeGridMatrix||new Float32Array(9);else if(c){const t=e.dA(w.canonical);$=e.dB(t.getCenter().lat),H=Float32Array.from(e.bh(e.dD(w.canonical))),j=Float32Array.from(N.globeMatrix),V=Float32Array.from(e.dz(N)),W=[e.aD(N.center.lng),e.aH(N.center.lat)],Y=[0,0],U=Float32Array.from(e.dC(w.canonical,t,$,N.worldSize/N._pixelsPerMercatorPixel))}else Y=u instanceof e.aP?u.perspectiveTransform:[0,0],H=new Float32Array(16),j=new Float32Array(9),V=new Float32Array(16),W=[0,0],U=new Float32Array(9);const G=Ts(E,H,j,V,U,F||[0,0],e.ah(t.transform.zoom),W,B,z||1,O,n,Y,l?n.paint.get("raster-elevation"):0,2,M,A,f.range,C,D,p),X=t.isTileAffectedByFog(w),q=t.getOrCreateProgram("raster",{defines:f.defines,overrideFog:X});if(t.uploadCommonUniforms(h,q,r),u instanceof e.aP){const i=u.elevatedGlobeVertexBuffer,r=u.elevatedGlobeIndexBuffer;if(g||!a)u.boundsBuffer&&u.boundsSegments&&q.draw(t,d.TRIANGLES,L,Hi.disabled,m,Wi.disabled,G,n.id,u.boundsBuffer,t.quadTriangleIndexBuffer,u.boundsSegments);else if(i&&r){const o=N.zoom<=e.cX?u.elevatedGlobeSegments:u.getSegmentsForLongitude(N.center.lng);o&&q.draw(t,d.TRIANGLES,L,Hi.disabled,m,s,G,n.id,i,r,o)}}else if(c){L=new Yi(d.LEQUAL,Yi.ReadOnly,t.depthRangeFor3D);const e=t.globeSharedBuffers;if(e){const[i,r,o]=e.getGridBuffers($,!1);q.draw(t,d.TRIANGLES,L,x||I,t.colorModeForRenderPass(),s,G,n.id,i,r,o)}}else{const{tileBoundsBuffer:e,tileBoundsIndexBuffer:i,tileBoundsSegments:r}=t.getTileBoundsBuffers(S);q.draw(t,d.TRIANGLES,L,I,m,Wi.disabled,G,n.id,e,i,r)}}if(!(u instanceof e.aP)&&c)for(const e of r){const r=e.canonical.y===(1<>>16,2654435769),((e=Math.imul(e^e>>>16,2654435769))>>>0)/4294967296},r=1/1.1;for(let e=0;ee.e3[t](r));p.push(r);const m=r.canonical.x,g=r.canonical.y;for(const e of p){const s=i.getTile(l?e.wrapped():e);if(!s)continue;const a=s.rasterParticleState;if(!a)continue;const h=e.canonical.x+(1<e.tileID)),p&&(h.activeTexture.set(d.TEXTURE0),t.imageManager.bind(t.context,n.scope)),c){const i=t.getOrCreateProgram(x,{overrideFog:!1,overrideRtt:!0}),r=new Float32Array(e.bx([])),h=new e.aM(0,0,0,0,0),u=p?Ps(r,l,a,t,0,n.scope,m,c,{tileID:h,tileSize:f}):Is(r,l,a,s.toPremultipliedRenderColor(o?null:n.lut));i.draw(t,d.TRIANGLES,y,_,v,Wi.disabled,u,n.id,t.viewportBuffer,t.quadTriangleIndexBuffer,t.viewportSegments)}else for(const e of w){const g=t.isTileAffectedByFog(e),w=t.getOrCreateProgram(x,{overrideFog:g}),S=e.toUnwrapped(),T=r?e.projMatrix:t.transform.calculateProjMatrix(S);t.prepareDrawTile();const k=i?i.getTile(e):b?b[e.key]:new xt(e,f,u.zoom,t),M=p?Ps(T,l,a,t,0,n.scope,m,c,{tileID:e,tileSize:f}):Is(T,l,a,s.toPremultipliedRenderColor(o?null:n.lut));t.uploadCommonUniforms(h,w,S);const{tileBoundsBuffer:A,tileBoundsIndexBuffer:C,tileBoundsSegments:D}=t.getTileBoundsBuffers(k);w.draw(t,d.TRIANGLES,y,_,v,Wi.disabled,M,n.id,A,C,D)}},sky:function(t,i,n){const r=t._atmosphere?e.ah(t.transform.zoom):1,s=n.paint.get("sky-opacity")*r;if(0===s)return;const o=t.context,a=n.paint.get("sky-type"),l=new Yi(o.gl.LEQUAL,Yi.ReadOnly,[0,1]),c=t.frameCounter/1e3%1;"atmosphere"===a?"offscreen"===t.renderPass?n.needsSkyboxCapture(t)&&(function(t,i){const n=t.context,r=n.gl;let s=i.skyboxFbo;if(!s){s=i.skyboxFbo=n.createFramebuffer(32,32,!0,null),i.skyboxGeometry=new Eo(n),i.skyboxTexture=n.gl.createTexture(),r.bindTexture(r.TEXTURE_CUBE_MAP,i.skyboxTexture),r.texParameteri(r.TEXTURE_CUBE_MAP,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_CUBE_MAP,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_CUBE_MAP,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_CUBE_MAP,r.TEXTURE_MAG_FILTER,r.LINEAR);for(let e=0;e<6;++e)r.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,r.RGBA,32,32,0,r.RGBA,r.UNSIGNED_BYTE,null)}n.bindFramebuffer.set(s.framebuffer),n.viewport.set([0,0,32,32]);const o=i.getCenter(t,!0),a=t.getOrCreateProgram("skyboxCapture"),l=new Float64Array(16);e.bx(l),e.eh(l,l,.5*-Math.PI),Io(t,i,a,l,o,0),e.bx(l),e.eh(l,l,.5*Math.PI),Io(t,i,a,l,o,1),e.bx(l),e.cR(l,l,.5*-Math.PI),Io(t,i,a,l,o,2),e.bx(l),e.cR(l,l,.5*Math.PI),Io(t,i,a,l,o,3),e.bx(l),Io(t,i,a,l,o,4),e.bx(l),e.eh(l,l,Math.PI),Io(t,i,a,l,o,5),n.viewport.set([0,0,t.width,t.height])}(t,n),n.markSkyboxValid(t)):"sky"===t.renderPass&&function(e,t,i,n,r){const s=e.context,o=s.gl,a=e.transform,l=e.getOrCreateProgram("skybox");s.activeTexture.set(o.TEXTURE0),o.bindTexture(o.TEXTURE_CUBE_MAP,t.skyboxTexture);const c=((e,t,i,n,r)=>({u_matrix:e,u_sun_direction:t,u_cubemap:0,u_opacity:n,u_temporal_offset:r}))(a.skyboxMatrix,t.getCenter(e,!1),0,n,r);e.uploadCommonUniforms(s,l),l.draw(e,o.TRIANGLES,i,Hi.disabled,e.colorModeForRenderPass(),Wi.backCW,c,"skybox",t.skyboxGeometry.vertexBuffer,t.skyboxGeometry.indexBuffer,t.skyboxGeometry.segment)}(t,n,l,s,c):"gradient"===a&&"sky"===t.renderPass&&function(t,i,n,r,s){const o=t.context,a=o.gl,l=t.transform,c=t.getOrCreateProgram("skyboxGradient");i.skyboxGeometry||(i.skyboxGeometry=new Eo(o)),o.activeTexture.set(a.TEXTURE0);let h=i.colorRampTexture;h||(h=i.colorRampTexture=new e.T(o,i.colorRamp,a.RGBA8)),h.bind(a.LINEAR,a.CLAMP_TO_EDGE);const d=((t,i,n,r,s)=>({u_matrix:t,u_color_ramp:0,u_center_direction:i,u_radius:e.al(n),u_opacity:r,u_temporal_offset:s}))(l.skyboxMatrix,i.getCenter(t,!1),i.paint.get("sky-gradient-radius"),r,s);t.uploadCommonUniforms(o,c),c.draw(t,a.TRIANGLES,n,Hi.disabled,t.colorModeForRenderPass(),Wi.backCW,d,"skyboxGradient",i.skyboxGeometry.vertexBuffer,i.skyboxGeometry.indexBuffer,i.skyboxGeometry.segment)}(t,n,l,s,c)},custom:function(t,i,n,r){const s=t.context,o=n.implementation;if(!t.transform.projection.unsupportedLayers||!t.transform.projection.unsupportedLayers.includes("custom")||t.terrain&&(t.terrain.renderingToTexture||"offscreen"===t.renderPass)&&n.isDraped(i)){if("offscreen"===t.renderPass){const i=o.prerender;if(i){if(t.setCustomLayerDefaults(),s.setColorMode(t.colorModeForRenderPass()),"globe"===t.transform.projection.name){const n=t.transform.pointMerc;i.call(o,s.gl,t.transform.customLayerMatrix(),t.transform.getProjection(),t.transform.globeToMercatorMatrix(),e.ah(t.transform.zoom),[n.x,n.y],t.transform.pixelsPerMeterRatio)}else i.call(o,s.gl,t.transform.customLayerMatrix());s.setDirty(),t.setBaseState()}}else if("translucent"===t.renderPass){if(t.terrain&&t.terrain.renderingToTexture){const e=o.renderToTile;if(e){const i=r[0].canonical,n={x:i.x+r[0].wrap*(o.wrapTileId?0:1<{a&&(a.useNormalOffset=!0,l||(a.enabled=!0))},h=i.getSource();if("light-beam"===t.renderPass&&"batched-model"!==h.type)return;if("vector"===h.type||"geojson"===h.type)return function(t,i,n,r,s){const o=t.transform;if("mercator"!==o.projection.name)return void e.w(`Drawing 3D models for ${o.projection.name} projection is not yet implemented`);const a=o.getFreeCameraOptions().position;if(!t.modelManager)return;const l=t.modelManager;n.modelManager=l;const c=t.shadowRenderer;if(!n._unevaluatedLayout._values.hasOwnProperty("model-id"))return;const h=n._unevaluatedLayout._values["model-id"],d=Object.assign({},n.layout.get("model-id").parameters),u=t.style.order.indexOf(n.fqid);for(const f of r){const r=i.getTile(f).getBucket(n);if(!r||r.projection.name!==o.projection.name)continue;const p=r.getModelUris();p&&!r.modelsRequested&&(l.addModelsFromBucket(p,s),r.modelsRequested=!0);const m=$o(f,o);d.zoom=m;const g=h.possiblyEvaluate(d);if(Wo(t,r,f),Uo.shadowUniformsInitialized=!1,Uo.useSingleShadowCascade=!!c&&0===c.getMaxCascadeForTile(f.toUnwrapped()),"shadow"===t.renderPass&&c){if(1===t.currentShadowCascade&&r.isInsideFirstShadowMapFrustum)continue;const i=o.calculatePosMatrix(f.toUnwrapped(),o.worldSize);if(Uo.tileMatrix.set(i),Uo.shadowTileMatrix=Float32Array.from(c.calculateShadowPassMatrixFromMatrix(i)),Uo.aabb.min.fill(0),Uo.aabb.max[0]=Uo.aabb.max[1]=e.aj,Uo.aabb.max[2]=0,qo(r,Uo,t,n.scope))continue}const _=1<0&&t.style.isLayerClipped(n,i.getSource())&&r.updateReplacement(f,t.replacementSource,u,s)&&(r.uploaded=!1,r.upload(t.context));for(let e in r.instancesPerModel){const i=r.instancesPerModel[e];i.features.length>0&&(e=g.evaluate(i.features[0].feature,{}));const o=l.getModel(e,s);if(o||l.hasURLBeenRequested(e)||r.modelUris.includes(e)||(r.modelUris.push(e),r.modelsRequested=!1),o&&o.uploaded)for(const e of o.nodes)Go(t,n,e,i,y,f,Uo)}}}(t,i,n,r,"vector"===h.type?n.scope:""),void c();if(!h.loaded())return;if("batched-model"===h.type)return function(t,i,n,r){n.resetLayerRenderingStats(t);const s=t.context,o=t.transform,a=t.style.fog,l=t.shadowRenderer;if("mercator"!==o.projection.name)return void e.w(`Drawing 3D landmark models for ${o.projection.name} projection is not yet implemented`);const c=t.transform.getFreeCameraOptions().position,h=e.c1([],[c.x,c.y,c.z],t.transform.worldSize),d=e.eq([],h),u=e.bx([]),f=e.e9(o.center.lat,o.zoom),p=e.bn([],[1,1,1/f]);e.bo(u,u,d);const m=n.paint.get("model-opacity").constantOr(1),g=new Yi(s.gl.LEQUAL,Yi.ReadWrite,t.depthRangeFor3D),_=new Yi(s.gl.LEQUAL,Yi.ReadOnly,t.depthRangeFor3D),y=new e.d6([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),v="shadow"===t.renderPass,x=v&&l?l.getCurrentCascadeFrustum():o.getFrustum(o.scaleZoom(o.worldSize)),b=n.paint.get("model-front-cutoff"),w=b[2]<1,S=an(t,n.paint.get("model-cutoff-fade-range")),T=n.getLayerRenderingStats();(function(e,t,i,n){const r=e.terrain?e.terrain.exaggeration():0,s=e.transform.zoom;for(const o of n){const n=t.getTile(o).getBucket(i);n&&(n.setFilter(i.filter),e.conflationActive&&n.updateReplacement(o,e.replacementSource),n.evaluateTransform(e,i),e.terrain&&r>0&&n.elevationUpdate(e.terrain,r,o,i.source),n.needsReEvaluation(e,s,i)&&n.evaluate(i))}})(t,i,n,r),function(){let c,d,k;w?(c=r.length-1,d=-1,k=-1):(c=0,d=r.length,k=1);const M=new Float64Array(16),A=e.cx(),C=new e.P(0,0);for(let D=c;D!==d;D+=k){const c=r[D],d=i.getTile(c).getBucket(n);if(!d||!d.uploaded)continue;let k=!1;l&&(k=0===l.getMaxCascadeForTile(c.toUnwrapped()));const L=o.calculatePosMatrix(c.toUnwrapped(),o.worldSize),E=d.modelTraits;!v&&w&&(e.bi(M,L),e.ad(A,h,M),C.x=A[0],C.y=A[1]);const I=[];d.setFilter(n.filter);for(const i of d.getNodesInfo()){if(i.hiddenByReplacement)continue;if(!i.node.meshes)continue;const n=i.node;let r=0;t.terrain&&n.elevation&&(r=n.elevation*t.terrain.exaggeration());const s=(()=>{const t=i.aabb;return y.min=[...t.min],y.max=[...t.max],y.min[2]+=r,y.max[2]+=r,e.ad(y.min,y.min,L),e.ad(y.max,y.max,L),y})(),a=i.evaluatedScale;if(a[0]<=1&&a[1]<=1&&a[2]<=1&&0===s.intersects(x))continue;if(!v&&w){const t=1/6;i.cameraCollisionOpacity=h[0]>s.min[0]&&h[0]s.min[1]&&h[1]!w||1===e.opacity&&1===t.opacity?e.deptht.depth?-1:1);for(const i of I){const r=i.nodeInfo,c=r.node;let h=e.az([],p,i.tileModelMatrix);e.az(h,u,h);const d=e.bi([],h);e.ea(d,d),e.cP(d,d,Xo),h=e.az(h,h,c.matrix);const f="light-beam"===t.renderPass,m="none"===n.paint.get("model-color-use-theme").constantOr("default"),y=E&e.ex.HasMapboxMeshFeatures,x=y?0:r.evaluatedRMEA[0][2];for(let e=0;e=Re||r>=Re}}const A=u.material;let C;A.occlusionTexture&&A.occlusionTexture.offsetScale&&(C=A.occlusionTexture.offsetScale,w.defines.push("OCCLUSION_TEXTURE_TRANSFORM"));const D=t.getOrCreateProgram("model",w);!v&&l&&l.setupShadowsFromMatrix(i.tileModelMatrix,D,l.useNormalOffset),t.uploadCommonUniforms(s,D,null,M);const L=A.pbrMetallicRoughness;L.metallicFactor=.9,L.roughnessFactor=.5;const E=Os(new Float32Array(b),new Float32Array(h),new Float32Array(d),new Float32Array(c.matrix),t,i.opacity,L.baseColorFactor,A.emissiveFactor,L.metallicFactor,L.roughnessFactor,A,x,n,[0,0,0],C);!p&&(r.hasTranslucentParts||i.opacity<1)&&D.draw(t,s.gl.TRIANGLES,g,Hi.disabled,Ni.disabled,Wi.backCCW,E,n.id,u.vertexBuffer,u.indexBuffer,u.segments,n.paint,t.transform.zoom,void 0,S),D.draw(t,s.gl.TRIANGLES,p?_:g,Hi.disabled,p||i.opacity<1||r.hasTranslucentParts?Ni.alphaBlended:Ni.unblended,Wi.backCCW,E,n.id,u.vertexBuffer,u.indexBuffer,u.segments,n.paint,t.transform.zoom,void 0,S)}}}}()}(t,i,n,r),void c();if("model"!==h.type)return;const d=h.getModels(),u=[],f=t.transform.getFreeCameraOptions().position,p=e.c1([],[f.x,f.y,f.z],t.transform.worldSize);e.eq(p,p);const m=[],g=[];let _=0;for(const i of d){const r=n.paint.get("model-rotation").constantOr(null),s=n.paint.get("model-scale").constantOr(null),o=n.paint.get("model-translation").constantOr(null);i.computeModelMatrix(t,r,s,o,!0,!0,!1);const a=e.bx([]),l=e.e9(i.position.lat,t.transform.zoom),c=e.bn([],[1,1,1/l]);e.bo(a,a,p),u.push({zScaleMatrix:c,negCameraPosMatrix:a});for(const e of i.nodes)jo(t.transform,e,i.matrix,t.transform.expandedFarZProjMatrix,_,m,g);_++}if(m.sort((e,t)=>t.depth-e.depth),"shadow"!==t.renderPass){if(1===s)for(const e of g)Ho(e,t,n,u[e.modelIndex],Hi.disabled,t.colorModeForRenderPass());else{for(const e of g)Ho(e,t,n,u[e.modelIndex],Hi.disabled,Ni.disabled);for(const e of g)Ho(e,t,n,u[e.modelIndex],t.stencilModeFor3D(),t.colorModeForRenderPass());t.resetStencilClippingMasks()}for(const e of m)Ho(e,t,n,u[e.modelIndex],Hi.disabled,t.colorModeForRenderPass());c()}else{for(const e of g)Vo(e.mesh,e.nodeModelMatrix,t,n);for(const e of m)Vo(e.mesh,e.nodeModelMatrix,t,n);c()}}},ma={line:function(e,t,i){if(e.hasElevatedBuckets=!1,e.hasNonElevatedBuckets=!1,void 0!==e._unevaluatedLayout.getValue("line-elevation-reference")||void 0!==e._unevaluatedLayout.getValue("line-z-offset")){if(t){const i=t.getVisibleCoordinates();for(const n of i){const i=t.getTile(n).getBucket(e);if(i&&("none"!==i.elevationType?e.hasElevatedBuckets=!0:e.hasNonElevatedBuckets=!0,e.hasElevatedBuckets&&e.hasNonElevatedBuckets))break}}}else e.hasNonElevatedBuckets=!0},model:function(e,t,i){const n=t.getSource();if(!n.loaded())return;if("vector"===n.type||"geojson"===n.type)return void(i.modelManager&&i.modelManager.upload(i,"vector"===n.type?e.scope:""));if("batched-model"===n.type)return;if("model"!==n.type)return;const r=n.getModels();for(const e of r)e.upload(i.context)},raster:function(e,t,i){const n=t.getSource();if(!(n instanceof it&&n.loaded()))return;const r=e.sourceLayer||n.rasterLayerIds&&n.rasterLayerIds[0];if(!r)return;const s=e.paint.get("raster-array-band")||n.getInitialBand(r);if(null==s)return;const o=t.getIds().map(e=>t.getTileByID(e));for(const t of o)t.updateNeeded(e.id,s)&&n.prepareTile(t,r,e.id,s)},"raster-particle":function(e,t,i){const n=t.getSource();if(!(n instanceof it&&n.loaded()))return;const r=e.sourceLayer||n.rasterLayerIds&&n.rasterLayerIds[0];if(!r)return;const s=e.paint.get("raster-particle-array-band")||n.getInitialBand(r);if(null==s)return;const o=t.getIds().map(e=>t.getTileByID(e));for(const t of o)t.updateNeeded(e.id,s)&&n.prepareTile(t,r,e.id,s)}},ga={fill:Ks},_a={fill:function(e,t,i,n){if(!i.layout||"none"===i.layout.get("fill-elevation-reference"))return;const r=e.context.gl,s=new Yi(r.LEQUAL,Yi.ReadOnly,e.depthRangeFor3D),o=new Hi({func:r.ALWAYS,mask:255},255,255,r.KEEP,r.KEEP,r.REPLACE),a=e.transform.getFreeCameraOptions().position,l=e.getOrCreateProgram("elevatedStructuresDepthReconstruct");for(const c of n){const n=t.getTile(c),h=n.getBucket(i);if(!h)continue;const d=h.elevatedStructures;if(!d||0===d.depthSegments.segments[0].primitiveLength)continue;const u=Js(c.toUnwrapped(),a),f=e.translatePosMatrix(c.projMatrix,n,i.paint.get("fill-translate"),i.paint.get("fill-translate-anchor")),p=ps(f,u,0,1,0);l.draw(e,r.TRIANGLES,s,o,Ni.disabled,Wi.disabled,p,i.id,d.vertexBuffer,d.indexBuffer,d.depthSegments,i.paint,e.transform.zoom)}}};class ya{constructor(t,i,n,r,s,o){this.context=new js(t,i),this.transform=n,this._tileTextures={},this.frameCopies=[],this.loadTimeStamps=[],this.tp=s,this._timeStamp=e.q.now(),this._averageFPS=0,this._fpsHistory=[],this._dt=0,this._debugParams={forceEnablePrecipitation:!1,showTerrainProxyTiles:!1,fpsWindow:30,continousRedraw:!1,enabledLayers:{}};const a=["fill","line","symbol","circle","heatmap","fill-extrusion","building","raster","raster-particle","hillshade","model","background","sky"];for(const e of a)this._debugParams.enabledLayers[e]=!0;s.registerParameter(this._debugParams,["Terrain"],"showTerrainProxyTiles",{},()=>{this.style.map.triggerRepaint()}),s.registerParameter(this._debugParams,["Precipitation"],"forceEnablePrecipitation"),s.registerParameter(this._debugParams,["FPS"],"fpsWindow",{min:1,max:100,step:1}),s.registerBinding(this._debugParams,["FPS"],"continousRedraw",{readonly:!0,label:"continuous redraw"}),s.registerBinding(this,["FPS"],"_averageFPS",{readonly:!0,label:"value"}),s.registerBinding(this,["FPS"],"_averageFPS",{readonly:!0,label:"graph",view:"graph",min:0,max:200});for(const e of a)s.registerParameter(this._debugParams.enabledLayers,["Debug","Layers"],e);this.occlusionParams=new ea(s),this.setup(),this.numSublayers=Tt.maxUnderzooming+Tt.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.deferredRenderGpuTimeQueries=[],this.gpuTimers={},this.frameCounter=0,this._backgroundTiles={},this.conflationActive=!1,this.replacementSource=new e.eE,this.longestCutoffRange=0,this.minCutoffZoom=0,this._fogVisible=!1,this._cachedTileFogOpacities={},this._shadowRenderer=new dn(this),this._wireframeDebugCache=new Qo,this.renderDefaultNorthPole=!0,this.renderDefaultSouthPole=!0,this.layersWithOcclusionOpacity=[];const l=new e.r({width:1,height:1},Uint8Array.of(0,0,0,0));this.emptyDepthTexture=new e.T(this.context,l,t.RGBA8),this._clippingActiveLastFrame=!1,this.scaleFactor=r,this.worldview=o}updateTerrain(e,t){const i=!!e&&!!e.terrain&&this.transform.projection.supportsTerrain;if(!(i||this._terrain&&this._terrain.enabled))return;this._terrain||(this._terrain=new Kr(this,e));const n=this._terrain;this.transform.elevation=i?n:null,n.update(e,this.transform,t),this.transform.elevation&&!n.enabled&&(this.transform.elevation=null)}_updateFog(e){const t=e.fog;if(!t||"globe"===this.transform.projection.name||t.getOpacity(this.transform.pitch)<1||t.properties.get("horizon-blend")<.03)return void(this.transform.fogCullDistSq=null);const[i,n]=t.getFovAdjustedRange(this.transform._fov);if(i>n)return void(this.transform.fogCullDistSq=null);const r=i+.78*(n-i);this.transform.fogCullDistSq=r*r}get terrain(){return this.transform._terrainEnabled()&&this._terrain&&this._terrain.enabled||this._forceTerrainMode?this._terrain:null}get forceTerrainMode(){return this._forceTerrainMode}set forceTerrainMode(e){e&&!this._terrain&&(this._terrain=new Kr(this,this.style)),this._forceTerrainMode=e}get shadowRenderer(){return this._shadowRenderer&&this._shadowRenderer.enabled?this._shadowRenderer:null}get wireframeDebugCache(){return this._wireframeDebugCache}resize(t,i){if(this.width=t*e.q.devicePixelRatio,this.height=i*e.q.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const e of this.style.order)this.style._mergedLayers[e].resize()}setup(){const t=this.context,i=new e.ba;i.emplaceBack(0,0),i.emplaceBack(e.aj,0),i.emplaceBack(0,e.aj),i.emplaceBack(e.aj,e.aj),this.tileExtentBuffer=t.createVertexBuffer(i,e.bc.members),this.tileExtentSegments=e.bd.simpleSegment(0,0,4,2);const n=new e.ba;n.emplaceBack(0,0),n.emplaceBack(e.aj,0),n.emplaceBack(0,e.aj),n.emplaceBack(e.aj,e.aj),this.debugBuffer=t.createVertexBuffer(n,e.bc.members),this.debugSegments=e.bd.simpleSegment(0,0,4,5);const r=new e.ba;r.emplaceBack(-1,-1),r.emplaceBack(1,-1),r.emplaceBack(-1,1),r.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(r,e.bc.members),this.viewportSegments=e.bd.simpleSegment(0,0,4,2);const s=new e.aZ;s.emplaceBack(0,0,0,0),s.emplaceBack(e.aj,0,e.aj,0),s.emplaceBack(0,e.aj,0,e.aj),s.emplaceBack(e.aj,e.aj,e.aj,e.aj),this.mercatorBoundsBuffer=t.createVertexBuffer(s,e.bf.members),this.mercatorBoundsSegments=e.bd.simpleSegment(0,0,4,2);const o=new e.a_;o.emplaceBack(0,1,2),o.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(o);const a=new e.bb;for(const e of[0,1,3,2,0])a.emplaceBack(e);this.debugIndexBuffer=t.createIndexBuffer(a),this.emptyTexture=new e.T(t,new e.r({width:1,height:1},Uint8Array.of(0,0,0,0)),t.gl.RGBA8),this.identityMat=e.bz();const l=this.context.gl;this.stencilClearMode=new Hi({func:l.ALWAYS,mask:0},0,255,l.ZERO,l.ZERO,l.ZERO),this.loadTimeStamps.push(performance.now())}getMercatorTileBoundsBuffers(){return{tileBoundsBuffer:this.mercatorBoundsBuffer,tileBoundsIndexBuffer:this.quadTriangleIndexBuffer,tileBoundsSegments:this.mercatorBoundsSegments}}getTileBoundsBuffers(e){return e._makeTileBoundsBuffers(this.context,this.transform.projection),e._tileBoundsBuffer?{tileBoundsBuffer:e._tileBoundsBuffer,tileBoundsIndexBuffer:e._tileBoundsIndexBuffer,tileBoundsSegments:e._tileBoundsSegments}:this.getMercatorTileBoundsBuffers()}clearStencil(){const e=this.context.gl;this.nextStencilID=1,this.currentStencilSource=void 0,this._tileClippingMaskIDs={},this.getOrCreateProgram("clippingMask").draw(this,e.TRIANGLES,Yi.disabled,this.stencilClearMode,Ni.disabled,Wi.disabled,Gr(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}_renderTileClippingMasks(e,t,i){if(!t||this.currentStencilSource===t.id||!e.isTileClipped()||!i||0===i.length)return;if(this._tileClippingMaskIDs&&!this.terrain){let e=!1;for(const t of i)if(void 0===this._tileClippingMaskIDs[t.key]){e=!0;break}if(!e)return}this.currentStencilSource=t.id;const n=this.context,r=n.gl;this.nextStencilID+i.length>256&&this.clearStencil(),n.setColorMode(Ni.disabled),n.setDepthMode(Yi.disabled);const s=this.getOrCreateProgram("clippingMask");this._tileClippingMaskIDs={};for(const e of i){const i=t.getTile(e),n=this._tileClippingMaskIDs[e.key]=this.nextStencilID++,{tileBoundsBuffer:o,tileBoundsIndexBuffer:a,tileBoundsSegments:l}=this.getTileBoundsBuffers(i);s.draw(this,r.TRIANGLES,Yi.disabled,new Hi({func:r.ALWAYS,mask:0},n,255,r.KEEP,r.KEEP,r.REPLACE),Ni.disabled,Wi.disabled,Gr(e.projMatrix),"$clipping",o,a,l)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const e=this.nextStencilID++,t=this.context.gl;return new Hi({func:t.NOTEQUAL,mask:255},e,255,t.KEEP,t.KEEP,t.REPLACE)}stencilModeForClipping(e){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(e);const t=this.context.gl;return new Hi({func:t.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,t.KEEP,t.KEEP,t.REPLACE)}stencilConfigForOverlap(e){const t=this.context.gl,i=e.sort((e,t)=>t.overscaledZ-e.overscaledZ),n=i[i.length-1].overscaledZ,r=i[0].overscaledZ-n+1;if(r>1){this.currentStencilSource=void 0,this.nextStencilID+r>256&&this.clearStencil();const e={};for(let i=0;ithis.style&&this.style.enable3dLights()&&this.terrain&&this.terrain.renderingToTexture)()&&"translucent"===this.renderPass?new Ni([i.ONE,i.ONE_MINUS_SRC_ALPHA,i.CONSTANT_ALPHA,i.ONE_MINUS_SRC_ALPHA],new e.am(0,0,0,void 0===t?0:t),[!0,!0,!0,!0]):this.colorModeForRenderPass()}depthModeForSublayer(e,t,i,n=!1){if(this.depthOcclusion)return new Yi(this.context.gl.GREATER,Yi.ReadOnly,this.depthRangeFor3D);if(!this.opaquePassEnabledForLayer()&&!n)return Yi.disabled;const r=1-((1+this.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new Yi(i||this.context.gl.LEQUAL,t,[r,r])}opaquePassEnabledForLayer(){return this.currentLayerthis._debugParams.fpsWindow&&this._fpsHistory.splice(0,this._fpsHistory.length-this._debugParams.fpsWindow),this._averageFPS=Math.round(this._fpsHistory.reduce((e,t)=>e+t/this._fpsHistory.length,0))}render(t,i){const n=e.q.now();this._dt=n-this._timeStamp,this._timeStamp=n,this._wireframeDebugCache.update(this.frameCounter),this._debugParams.continousRedraw=t.map.repaint,this.style=t,this.options=i;const r=this.style._mergedLayers,s=!(!this.terrain||!this.terrain.enabled),o=()=>this.style._getOrder(s).filter(e=>{const t=r[e];return!(t.type in this._debugParams.enabledLayers)||this._debugParams.enabledLayers[t.type]});let a=o(),l=!1,c=!1,h=null;for(const e of a){const t=r[e];"circle"===t.type?l=!0:"building"===t.type?h=t:"symbol"===t.type&&(t.hasInitialOcclusionOpacityProperties?c=!0:l=!0)}let d=a.map(e=>r[e]);const u=this.style._mergedSourceCaches;this.imageManager=t.imageManager,this.modelManager=t.modelManager,this.symbolFadeChange=t.placement.symbolFadeChange(e.q.now()),this.imageManager.beginFrame();let f=0,p=!1;for(const e in u){const t=u[e];t.used&&(t.prepare(this.context),t.getSource().usedInConflation&&++f)}let m=!1;for(const e of d)e.isHidden(this.transform.zoom)||("clip"===e.type&&(m=!0),this.prepareLayer(e));const g={},_={},y={},v={},x={};for(const e in u){const t=u[e];g[e]=t.getVisibleCoordinates(),_[e]=g[e].slice().reverse(),y[e]=t.getVisibleCoordinates(!0).reverse(),v[e]=t.getShadowCasterCoordinates(),x[e]=t.sortCoordinatesByDistance(g[e])}const b=e=>{const t=this.style.getLayerSourceCache(e);return t&&t.used?t.getSource():null};if(f||m||this._clippingActiveLastFrame){const t=[],i=[];let n=0;for(const e of d)this.isSourceForClippingOrConflation(e,b(e))&&(t.push(e),i.push(n)),n++;if(t&&(m||t.length>1)||this._clippingActiveLastFrame){m=!1;const n=[];for(let r=0;r0){const e=b(t);e&&(this.minCutoffZoom=Math.max(e.minzoom,this.minCutoffZoom)),t.minzoom&&(this.minCutoffZoom=Math.max(t.minzoom,this.minCutoffZoom))}t.is3D(s)&&(this.opaquePassCutoff===1/0&&(this.opaquePassCutoff=e),this._lastOcclusionLayer=e)}const w=this.style&&this.style.fog;w?(this._fogVisible=0!==w.getOpacity(this.transform.pitch),this._fogVisible&&"globe"!==this.transform.projection.name&&(this._fogVisible=w.isVisibleOnFrustum(this.transform.cameraFrustum))):this._fogVisible=!1,this._cachedTileFogOpacities={},this.terrain&&(this.terrain.updateTileBinding(y),this.opaquePassCutoff=0,a=o(),d=a.map(e=>r[e]));const S=this._shadowRenderer;if(S){S.updateShadowParameters(this.transform,this.style.directionalLight);for(const e in u)for(const t of g[e]){let e={min:0,max:0};this.terrain&&(e=this.terrain.getMinMaxForTile(t)||e),S.addShadowReceiver(t.toUnwrapped(),e.min,e.max)}}"globe"!==this.transform.projection.name||this.globeSharedBuffers||(this.globeSharedBuffers=new e.eG(this.context)),this.style.fog&&this.transform.projection.supportsFog?(this._atmosphere||(this._atmosphere=new Fo(this)),this._atmosphere.update(this)):this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0);const T=this._debugParams.forceEnablePrecipitation||!(!this.style||!this.style.snow),k=this._debugParams.forceEnablePrecipitation||!(!this.style||!this.style.rain);if(T&&!this._snow&&(this._snow=new fa(this)),!T&&this._snow&&(this._snow.destroy(),delete this._snow),k&&!this._rain&&(this._rain=new da(this)),!k&&this._rain&&(this._rain.destroy(),delete this._rain),this._snow&&this._snow.update(this),this._rain&&this._rain.update(this),h){this.buildingTileBorderManager||(this.buildingTileBorderManager=new No);const e=this.style.getLayerSourceCache(h);this.buildingTileBorderManager.updateBorders(e,h)}if(!B.has(this.context.gl))return;this.renderPass="offscreen";for(const e of d){const i=t.getLayerSourceCache(e);if(!e.hasOffscreenPass()||e.isHidden(this.transform.zoom))continue;const n=i?_[i.id]:void 0;("custom"===e.type||"raster"===e.type||"raster-particle"===e.type||e.isSky()||n&&n.length)&&this.renderLayer(this,i,e,n)}this.depthRangeFor3D=[0,1-(d.length+2)*this.numSublayers*this.depthEpsilon],this._shadowRenderer&&(this.renderPass="shadow",this._shadowRenderer.drawShadowPass(this.style,v)),this.context.bindFramebuffer.set(null),this.context.viewport.set([0,0,this.width,this.height]);const M="globe"===this.transform.projection.name||this.transform.isHorizonVisible(),A=(()=>{if(i.showOverdrawInspector)return e.am.black;const t=this.style.fog;if(t&&this.transform.projection.supportsFog){const i=this.style.getLut(t.scope);if(!M){const n="none"===t.properties.get("color-use-theme"),r=t.properties.get("color").toNonPremultipliedRenderColor(n?null:i).toArray01();return new e.am(...r)}if(M){const n="none"===t.properties.get("space-color-use-theme"),r=t.properties.get("space-color").toNonPremultipliedRenderColor(n?null:i).toArray01();return new e.am(...r)}}return e.am.transparent})();if(this.context.clear({color:A,depth:1}),this.clearStencil(),this._showOverdrawInspector=i.showOverdrawInspector,this.renderPass="opaque",this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&M&&this._atmosphere.drawStars(this,this.style.fog),!this.terrain)for(this.currentLayer=a.length-1;this.currentLayer>=0;this.currentLayer--){const e=d[this.currentLayer],i=t.getLayerSourceCache(e);if(e.isSky())continue;const n=i?(e.is3D(s)?x:_)[i.id]:void 0;this._renderTileClippingMasks(e,i,n),this.renderLayer(this,i,e,n)}if(this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&M&&this._atmosphere.drawAtmosphereGlow(this,this.style.fog),this.renderPass="sky",(!this._atmosphere||e.ah(this.transform.zoom)>0)&&("globe"===this.transform.projection.name||this.transform.isHorizonVisible()))for(this.currentLayer=0;this.currentLayer{for(this.currentLayer=0;this.currentLayer0&&e.hasShadowPass()&&0==--D){{this.clearStencil(),this.resetStencilClippingMasks();const e=this.currentLayer;for(this.currentLayer=0;this.currentLayer=this._lastOcclusionLayer&&this.layersWithOcclusionOpacity.length>0){const e=this.currentLayer;this.depthOcclusion=!0;for(const e of this.layersWithOcclusionOpacity){this.currentLayer=e;const i=d[this.currentLayer],n=t.getLayerSourceCache(i),r=n?_[n.id]:void 0;this.terrain||this._renderTileClippingMasks(i,n,n?g[n.id]:void 0),this.renderLayer(this,n,i,r)}this.depthOcclusion=!1,this.currentLayer=e,this.renderPass="translucent",this.layersWithOcclusionOpacity=[]}++this.currentLayer}}if(this.terrain&&this.terrain.postRender(),this._snow&&this._snow.draw(this),this._rain&&this._rain.draw(this),this.options.showTileBoundaries||this.options.showQueryGeometry||this.options.showTileAABBs){let i=null;d.forEach(e=>{const n=t.getLayerSourceCache(e);n&&!e.isHidden(this.transform.zoom)&&n.getVisibleCoordinates().length&&(!i||i.getSource().maxzoom0?t.pop():null}terrainRenderModeElevated(){return this.style&&!!this.style.getTerrain()&&!!this.terrain&&!this.terrain.renderingToTexture||this.forceTerrainMode}linearFloatFilteringSupported(){return null!=this.context.extTextureFloatLinear}currentGlobalDefines(e,t,i){const n=void 0===i?this.terrain&&this.terrain.renderingToTexture:i,r=[];return this.style&&this.style.enable3dLights()&&("globeRaster"===e||"terrainRaster"===e?(r.push("LIGHTING_3D_MODE"),r.push("LIGHTING_3D_ALPHA_EMISSIVENESS")):n||r.push("LIGHTING_3D_MODE")),"shadow"===this.renderPass&&(this._shadowMapDebug||r.push("DEPTH_TEXTURE")),this.terrainRenderModeElevated()&&(r.push("TERRAIN"),this.linearFloatFilteringSupported()&&r.push("TERRAIN_DEM_FLOAT_FORMAT")),"globe"===this.transform.projection.name&&r.push("GLOBE"),!this._fogVisible||n||void 0!==t&&!t||r.push("FOG","FOG_DITHERING"),n&&r.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&r.push("OVERDRAW_INSPECTOR"),r}getOrCreateProgram(e,t){this.cache=this.cache||{};const i=t&&t.defines||[],n=t&&t.config,r=this.currentGlobalDefines(e,t&&t.overrideFog,t&&t.overrideRtt).concat(i),s=is.cacheKey(qn[e],e,r,n);return this.cache[s]||(this.cache[s]=new is(this.context,e,qn[e],n,Fs[e],r)),this.cache[s]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.frontFace.setDefault(),this.context.cullFaceSide.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}initDebugOverlayCanvas(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new e.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA8))}destroy(){this._terrain&&this._terrain.destroy(),this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0),this.globeSharedBuffers&&this.globeSharedBuffers.destroy(),this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this._wireframeDebugCache.destroy(),this.depthFBO&&(this.depthFBO.destroy(),this.depthFBO=void 0,this.depthTexture=void 0),this.emptyDepthTexture&&this.emptyDepthTexture.destroy()}prepareDrawTile(){this.terrain&&this.terrain.prepareDrawTile()}uploadCommonLightUniforms(t,i){if(this.style.enable3dLights()){const n=this.style.directionalLight,r=this.style.ambientLight;if(n&&r){const s=((t,i,n)=>{const r=t.properties.get("direction"),s="none"===t.properties.get("color-use-theme"),o=t.properties.get("color").toNonPremultipliedRenderColor(s?null:n.getLut(t.scope)).toArray01(),a=t.properties.get("intensity"),l="none"===i.properties.get("color-use-theme"),c=i.properties.get("color").toNonPremultipliedRenderColor(l?null:n.getLut(i.scope)).toArray01(),h=i.properties.get("intensity"),d=[r.x,r.y,r.z],u=e.dI(c,h),f=e.dI(o,a);return{u_lighting_ambient_color:u,u_lighting_directional_dir:d,u_lighting_directional_color:f,u_ground_radiance:Qr(d,f,u)}})(n,r,this.style);i.setLightsUniformValues(t,s)}}}uploadCommonUniforms(t,i,n,r,s){if(this.uploadCommonLightUniforms(t,i),this.terrain&&this.terrain.renderingToTexture)return;const o=this.style.fog;if(o){const s=o.getOpacity(this.transform.pitch),a=((t,i,n,r,s,o,a,l,c,h,d,u)=>{const f=t.transform,p="none"===i.properties.get("color-use-theme"),m=i.properties.get("color").toNonPremultipliedRenderColor(p?null:t.style.getLut(i.scope)).toArray01();m[3]=r;const g=t.frameCounter/1e3%1,[_,y]=i.properties.get("vertical-range");return{u_fog_matrix:n?f.calculateFogTileMatrix(n):u||t.identityMat,u_fog_range:i.getFovAdjustedRange(f._fov),u_fog_color:m,u_fog_horizon_blend:i.properties.get("horizon-blend"),u_fog_vertical_limit:[Math.min(_,y),y],u_fog_temporal_offset:g,u_frustum_tl:s,u_frustum_tr:o,u_frustum_br:a,u_frustum_bl:l,u_globe_pos:c,u_globe_radius:h,u_viewport:d,u_globe_transition:e.ah(f.zoom),u_is_globe:+("globe"===f.projection.name)}})(this,o,n,s,this.transform.frustumCorners.TL,this.transform.frustumCorners.TR,this.transform.frustumCorners.BR,this.transform.frustumCorners.BL,this.transform.globeCenterInViewSpace,this.transform.globeRadius,[this.transform.width*e.q.devicePixelRatio,this.transform.height*e.q.devicePixelRatio],r);i.setFogUniformValues(t,a)}s&&i.setCutoffUniformValues(t,s.uniformValues)}setTileLoadedFlag(e){this.tileLoaded=e}saveCanvasCopy(){const e=this.canvasCopy();e&&(this.frameCopies.push(e),this.tileLoaded=!1)}canvasCopy(){const e=this.context.gl,t=e.createTexture();return e.bindTexture(e.TEXTURE_2D,t),e.copyTexImage2D(e.TEXTURE_2D,0,e.RGBA,0,0,e.drawingBufferWidth,e.drawingBufferHeight,0),t}getCanvasCopiesAndTimestamps(){return{canvasCopies:this.frameCopies,timeStamps:this.loadTimeStamps}}averageElevationNeedsEasing(){if(!this.transform._elevation)return!1;const e=this.style&&this.style.fog;return!!e&&0!==e.getOpacity(this.transform.pitch)}getBackgroundTiles(){const e=this._backgroundTiles,t=this._backgroundTiles={},i=this.transform.coveringTiles({tileSize:512});for(const n of i)t[n.key]=e[n.key]||new xt(n,512,this.transform.tileZoom,this,void 0,this.worldview);return t}clearBackgroundTiles(){this._backgroundTiles={}}isSourceForClippingOrConflation(e,t){return!(!e.is3D(!(!this.terrain||!this.terrain.enabled))||"clip"!==e.type&&"building"!==e.type&&(e.minzoom&&e.minzoom>this.transform.zoom||(this.style._clipLayerPresent||"building"!==e.sourceLayer&&"procedural_buildings"!==e.sourceLayer)&&(!t||"batched-model"!==t.type)))}isTileAffectedByFog(e){if(!this.style||!this.style.fog)return!1;if("globe"===this.transform.projection.name)return!0;let t=this._cachedTileFogOpacities[e.key];return t||(this._cachedTileFogOpacities[e.key]=t=this.style.fog.getOpacityForTile(e)),t[0]>=Re||t[1]>=Re}setupDepthForOcclusion(e,t,i){const n=this.context,r=n.gl,s=!!i;var o;i||(i={u_dem:2,u_dem_prev:4,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_depth_range_unpack:[0,1],u_occluder_half_size:16,u_occlusion_depth_offset:-1e-4,u_exaggeration:0}),n.activeTexture.set(r.TEXTURE3),e&&this.depthFBO&&this.depthTexture?(this.depthTexture.bind(r.NEAREST,r.CLAMP_TO_EDGE),i.u_depth_size_inv=[1/this.depthFBO.width,1/this.depthFBO.height],i.u_depth_range_unpack=[2/((o=this.depthRangeFor3D)[1]-o[0]),-1-2*o[0]/(o[1]-o[0])],i.u_occluder_half_size=.5*this.occlusionParams.occluderSize,i.u_occlusion_depth_offset=this.occlusionParams.depthOffset):this.emptyDepthTexture.bind(r.NEAREST,r.CLAMP_TO_EDGE),n.activeTexture.set(r.TEXTURE0),s||t.setTerrainUniformValues(n,i)}}function va(e,t){let i=!1,n=null;const r=()=>{n=null,i&&(e(),n=setTimeout(r,t),i=!1)};return()=>(i=!0,n||r(),n)}class xa{constructor(t){this._hashName=t&&encodeURIComponent(t),e.aV(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=va(this._updateHashUnthrottled.bind(this),300)}addTo(e){return this._map=e,window.addEventListener("hashchange",this._onHashChange,!1),e.on("moveend",this._updateHash),this}remove(){return this._map?(this._map.off("moveend",this._updateHash),window.removeEventListener("hashchange",this._onHashChange,!1),clearTimeout(this._updateHash()),this._map=void 0,this):this}getHashString(){const e=this._map;if(!e)return"";const t=ba(e);if(this._hashName){const e=this._hashName;let i=!1;const n=location.hash.slice(1).split("&").map(n=>{const r=n.split("=")[0];return r===e?(i=!0,`${r}=${t}`):n}).filter(e=>e);return i||n.push(`${e}=${t}`),`#${n.join("&")}`}return`#${t}`}_getCurrentHash(){const e=location.hash.replace("#","");if(this._hashName){let t;return e.split("&").map(e=>e.split("=")).forEach(e=>{e[0]===this._hashName&&(t=e)}),(t&&t[1]||"").split("/")}return e.split("/")}_onHashChange(){const e=this._map;if(!e)return!1;const t=this._getCurrentHash();if(t.length>=3&&!t.some(e=>isNaN(Number(e)))){const i=e.dragRotate.isEnabled()&&e.touchZoomRotate.isEnabled()?+(t[3]||0):e.getBearing();return e.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:i,pitch:+(t[4]||0)}),!0}return!1}_updateHashUnthrottled(){history.replaceState(history.state,"",location.href.replace(/(#.+)?$/,this.getHashString()))}}function ba(e,t){const i=e.getCenter(),n=Math.round(100*e.getZoom())/100,r=Math.ceil((n*Math.LN2+Math.log(512/360/.5))/Math.LN10),s=Math.pow(10,r),o=Math.round(i.lng*s)/s,a=Math.round(i.lat*s)/s,l=e.getBearing(),c=e.getPitch();let h=t?`/${o}/${a}/${n}`:`${n}/${a}/${o}`;return(l||c)&&(h+="/"+Math.round(10*l)/10),c&&(h+=`/${Math.round(c)}`),h}const wa={linearity:.3,easing:e.eI(0,0,.3,1)},Sa=e.h({deceleration:2500,maxSpeed:1400},wa),Ta=e.h({deceleration:20,maxSpeed:1400},wa),ka=e.h({deceleration:1e3,maxSpeed:360},wa),Ma=e.h({deceleration:1e3,maxSpeed:90},wa);class Aa{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:e.q.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,i=e.q.now();for(;t.length>0&&i-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._map._prefersReducedMotion())return;if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const i={zoom:0,bearing:0,pitch:0,pan:new e.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:e}of this._inertiaBuffer)i.zoom+=e.zoomDelta||0,i.bearing+=e.bearingDelta||0,i.pitch+=e.pitchDelta||0,e.panDelta&&i.pan._add(e.panDelta),e.around&&(i.around=e.around),e.pinchAround&&(i.pinchAround=e.pinchAround);const n=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,r={};if(i.pan.mag()){const s=Da(i.pan.mag(),n,e.h({},Sa,t||{}));r.offset=i.pan.mult(s.amount/i.pan.mag()),r.center=this._map.transform.center,Ca(r,s)}if(i.zoom){const e=Da(i.zoom,n,Ta);r.zoom=this._map.transform.zoom+e.amount,Ca(r,e)}if(i.bearing){const t=Da(i.bearing,n,ka);r.bearing=this._map.transform.bearing+e.ay(t.amount,-179,179),Ca(r,t)}if(i.pitch){const e=Da(i.pitch,n,Ma);r.pitch=this._map.transform.pitch+e.amount,Ca(r,e)}if(r.zoom||r.bearing){const e=void 0===i.pinchAround?i.around:i.pinchAround;r.around=e?this._map.unproject(e):this._map.getCenter()}return this.clear(),r.noMoveStart=!0,r}}function Ca(e,t){(!e.duration||e.durationi.unproject(e)),a=s.reduce((e,t,i,n)=>e.add(t.div(n.length)),new e.P(0,0));super(t,{points:s,point:a,lngLats:o,lngLat:i.unproject(a),originalEvent:n}),this._defaultPrevented=!1}}class Ia extends e.A{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t){super("wheel",{originalEvent:t}),this._defaultPrevented=!1}}class Pa{constructor(e,t){this._map=e,this._clickTolerance=t.clickTolerance}reset(){this._mousedownPos=void 0}wheel(e){return this._firePreventable(new Ia(this._map,e))}mousedown(e,t){return this._mousedownPos=t,this._firePreventable(new La(e.type,this._map,e))}mouseup(e){this._map.fire(new La(e.type,this._map,e))}preclick(t){const i=e.h({},t);i.type="preclick",this._map.fire(new La(i.type,this._map,i))}click(e,t){this._mousedownPos&&this._mousedownPos.dist(t)>=this._clickTolerance||(this.preclick(e),this._map.fire(new La(e.type,this._map,e)))}dblclick(e){return this._firePreventable(new La(e.type,this._map,e))}mouseover(e){this._map.fire(new La(e.type,this._map,e))}mouseout(e){this._map.fire(new La(e.type,this._map,e))}touchstart(e){return this._firePreventable(new Ea(e.type,this._map,e))}touchmove(e){this._map.fire(new Ea(e.type,this._map,e))}touchend(e){this._map.fire(new Ea(e.type,this._map,e))}touchcancel(e){this._map.fire(new Ea(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Ra{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._contextMenuEvent=void 0}mousemove(e){this._map.fire(new La(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new La("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._map.fire(new La(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Oa{constructor(e,t){this._map=e,this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=t.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,t){this.isEnabled()&&e.shiftKey&&0===e.button&&(f(),this._startPos=this._lastPos=t,this._active=!0)}mousemoveWindow(e,t){if(!this._active)return;const i=t,n=this._startPos,r=this._lastPos;if(!n||!r||r.equals(i)||!this._box&&i.dist(n){this._box&&(this._box.style.transform=`translate(${s}px,${a}px)`,this._box.style.width=o-s+"px",this._box.style.height=c-a+"px")})}mouseupWindow(t,i){if(!this._active)return;const n=this._startPos,r=i;if(n&&0===t.button){if(this.reset(),g(),n.x!==r.x||n.y!==r.y)return this._map.fire(new e.A("boxzoomend",{originalEvent:t})),{cameraAnimation:e=>e.fitScreenCoordinates(n,r,this._map.getBearing(),{linear:!1})};this._fireEvent("boxzoomcancel",t)}}keydown(e){this._active&&27===e.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",e))}blur(){this.reset()}reset(){this._active=!1,this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.remove(),this._box=null),p(),delete this._startPos,delete this._lastPos}_fireEvent(t,i){return this._map.fire(new e.A(t,{originalEvent:i}))}}function za(e,t){const i={};for(let n=0;nthis.numTouches)&&(this.aborted=!0),this.aborted||(0===this.startTime&&(this.startTime=t.timeStamp),n.length===this.numTouches&&(this.centroid=function(t){const i=new e.P(0,0);for(const e of t)i._add(e);return i.div(t.length)}(i),this.touches=za(n,i)))}touchmove(e,t,i){if(this.aborted||!this.centroid)return;const n=za(i,t);for(const e in this.touches){const t=n[e];(!t||t.dist(this.touches[e])>30)&&(this.aborted=!0)}}touchend(e,t,i){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),0===i.length){const e=!this.aborted&&this.centroid;if(this.reset(),e)return e}}}class Na{constructor(e){this.singleTap=new Fa(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,this.lastTap=void 0,this.count=0,this.singleTap.reset()}touchstart(e,t,i){this.singleTap.touchstart(e,t,i)}touchmove(e,t,i){this.singleTap.touchmove(e,t,i)}touchend(e,t,i){const n=this.singleTap.touchend(e,t,i);if(n){const t=e.timeStamp-this.lastTime<500,i=!this.lastTap||this.lastTap.dist(n)<30;if(t&&i||this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=n,this.count===this.numTaps)return this.reset(),n}}}class Ya{constructor(){this._zoomIn=new Na({numTouches:1,numTaps:2}),this._zoomOut=new Na({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,t,i){this._zoomIn.touchstart(e,t,i),this._zoomOut.touchstart(e,t,i)}touchmove(e,t,i){this._zoomIn.touchmove(e,t,i),this._zoomOut.touchmove(e,t,i)}touchend(e,t,i){const n=this._zoomIn.touchend(e,t,i),r=this._zoomOut.touchend(e,t,i);return n?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:t=>t.easeTo({duration:300,zoom:t.getZoom()+1,around:t.unproject(n)},{originalEvent:e})}):r?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:t=>t.easeTo({duration:300,zoom:t.getZoom()-1,around:t.unproject(r)},{originalEvent:e})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}const Ba={0:1,2:2},Ha={Control:"ctrlKey",Alt:"altKey",Shift:"shiftKey",Meta:"metaKey"};class ja{constructor(e){this.reset(),this._clickTolerance=e.clickTolerance||1}blur(){this.reset()}reset(){this._active=!1,this._moved=!1,this._lastPoint=void 0,this._eventButton=void 0}_correctButton(e,t){return!1}_move(e,t){return{}}mousedown(e,t){if(this._lastPoint)return;const i=v(e);this._correctButton(e,i)&&(this._lastPoint=t,this._eventButton=i)}mousemoveWindow(e,t){const i=this._lastPoint;if(i)if(e.preventDefault(),null!=this._eventButton&&function(e,t){const i=Ba[t];return void 0===e.buttons||(e.buttons&i)!==i}(e,this._eventButton))this.reset();else if(this._moved||!(t.dist(i)0&&(this._active=!0);const r=za(n,i),s=new e.P(0,0),o=new e.P(0,0);let a=0;for(const e in r){const t=r[e],i=this._touches[e];i&&(s._add(t),o._add(t.sub(i)),a++,r[e]=t)}if(this._touches=r,a{this._alertContainer.classList.remove("mapboxgl-touch-pan-blocker-show"),this._alertContainer.removeAttribute("role")},500)}}class Ga{constructor(){this.reset()}reset(){this._active=!1,this._firstTwoTouches=void 0}_start(e){}_move(e,t,i){return{}}touchstart(e,t,i){this._firstTwoTouches||i.length<2||(this._firstTwoTouches=[i[0].identifier,i[1].identifier],this._start([t[0],t[1]]))}touchmove(e,t,i){const n=this._firstTwoTouches;if(!n)return;e.preventDefault();const[r,s]=n,o=Xa(i,t,r),a=Xa(i,t,s);if(!o||!a)return;const l=this._aroundCenter?null:o.add(a).div(2);return this._move([o,a],l,e)}touchend(e,t,i){if(!this._firstTwoTouches)return;const[n,r]=this._firstTwoTouches,s=Xa(i,t,n),o=Xa(i,t,r);s&&o||(this._active&&g(),this.reset())}touchcancel(){this.reset()}enable(e){this._enabled=!0,this._aroundCenter=!!e&&"center"===e.around}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function Xa(e,t,i){for(let n=0;nMath.abs(e.x)}class el extends Ga{constructor(e){super(),this._map=e}reset(){super.reset(),this._valid=void 0,this._firstMove=void 0,this._lastPoints=void 0}_start(e){this._lastPoints=e,Qa(e[0].sub(e[1]))&&(this._valid=!1)}_move(t,i,n){const r=this._lastPoints;if(!r)return;const s=t[0].sub(r[0]),o=t[1].sub(r[1]);return this._map._cooperativeGestures&&!e.eJ()&&n.touches.length<3||(this._valid=this.gestureBeginsVertically(s,o,n.timeStamp),!this._valid)?void 0:(this._lastPoints=t,this._active=!0,{pitchDelta:(s.y+o.y)/2*-.5})}gestureBeginsVertically(e,t,i){if(void 0!==this._valid)return this._valid;const n=e.mag()>=2,r=t.mag()>=2;if(!n&&!r)return;if(!n||!r)return null==this._firstMove&&(this._firstMove=i),i-this._firstMove<100&&void 0;const s=e.y>0==t.y>0;return Qa(e)&&Qa(t)&&s}}const tl={panStep:100,bearingStep:15,pitchStep:10};class il{constructor(){const e=tl;this._panStep=e.panStep,this._bearingStep=e.bearingStep,this._pitchStep=e.pitchStep,this._rotationDisabled=!1}blur(){this.reset()}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let t=0,i=0,n=0,r=0,s=0;switch(e.keyCode){case 61:case 107:case 171:case 187:t=1;break;case 189:case 109:case 173:t=-1;break;case 37:e.shiftKey?i=-1:(e.preventDefault(),r=-1);break;case 39:e.shiftKey?i=1:(e.preventDefault(),r=1);break;case 38:e.shiftKey?n=1:(e.preventDefault(),s=-1);break;case 40:e.shiftKey?n=-1:(e.preventDefault(),s=1);break;default:return}return this._rotationDisabled&&(i=0,n=0),{cameraAnimation:o=>{const a=o.getZoom();o.easeTo({duration:300,easeId:"keyboardHandler",easing:nl,zoom:t?Math.round(a)+t*(e.shiftKey?2:1):a,bearing:o.getBearing()+i*this._bearingStep,pitch:o.getPitch()+n*this._pitchStep,offset:[-r*this._panStep,-s*this._panStep],center:o.getCenter()},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function nl(e){return e*(2-e)}const rl=4.000244140625,sl=1/450;class ol{constructor(t,i){this._map=t,this._el=t.getCanvasContainer(),this._handler=i,this._delta=0,this._lastDelta=0,this._defaultZoomRate=.01,this._wheelZoomRate=sl,e.aV(["_onTimeout","_addScrollZoomBlocker","_showBlockerAlert"],this)}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return this._active||void 0!==this._finishTimeout}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!e&&"center"===e.around,this._map._cooperativeGestures&&this._addScrollZoomBlocker())}disable(){this.isEnabled()&&(this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove()))}wheel(t){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!(t.ctrlKey||t.metaKey||this.isZooming()||e.eJ()))return void this._showBlockerAlert();"hidden"!==this._alertContainer.style.visibility&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}let i=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const n=e.q.now(),r=n-(this._lastWheelEventTime||0);this._lastWheelEventTime=n,0!==i&&i%rl==0?this._type="wheel":0!==i&&Math.abs(i)<4?this._type="trackpad":r>400?(this._type=null,this._lastValue=i,this._timeout=window.setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(r*i)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,i+=this._lastValue)),t.shiftKey&&i&&(i/=4),this._type&&(this._lastWheelEvent=t,this._delta-=i,this._active||this._start(t)),t.preventDefault()}_onTimeout(e){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(e)}_start(e){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const t=_(this._el,e);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:t,this._aroundCoord=this._map.transform.pointCoordinate3D(this._aroundPoint),this._targetZoom=void 0,this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId)return;if(this._frameId=null,!this.isActive())return;const t=this._map.transform;"wheel"===this._type&&t.projection.wrap&&(t._center.lng>=180||t._center.lng<=-180)&&(this._prevEase=null,this._easing=null,this._lastWheelEvent=null,this._lastWheelEventTime=0);const i=()=>t._terrainEnabled()&&this._aroundCoord?t.computeZoomRelativeTo(this._aroundCoord):t.zoom;if(0!==this._delta){const e="wheel"===this._type&&Math.abs(this._delta)>rl?this._wheelZoomRate:this._defaultZoomRate;let n=2/(1+Math.exp(-Math.abs(this._delta*e)));this._delta<0&&0!==n&&(n=1/n);const r=i(),s=Math.pow(2,r),o="number"==typeof this._targetZoom?t.zoomScale(this._targetZoom):s;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(o*n))),"wheel"===this._type&&(this._startZoom=r,this._easing=this._smoothOutEasing(200)),this._lastDelta=this._delta,this._delta=0}const n="number"==typeof this._targetZoom?this._targetZoom:i(),r=this._startZoom,s=this._easing;let o,a=!1;if("wheel"===this._type&&r&&s){const t=Math.min((e.q.now()-this._lastWheelEventTime)/200,1),i=s(t);o=e.ai(r,n,i),t<1?this._frameId||(this._frameId=!0):a=!0}else o=n,a=!0;this._active=!0,a&&(this._active=!1,this._finishTimeout=window.setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200));let l=o-i();return l*this._lastDelta<0&&(l=0),{noInertia:!0,needsRenderFrame:!a,zoomDelta:l,around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let i=e.eK;if(this._prevEase){const t=this._prevEase,n=(e.q.now()-t.start)/t.duration,r=t.easing(n+.01)-t.easing(n),s=.27/Math.sqrt(r*r+1e-4)*.01,o=Math.sqrt(.0729-s*s);i=e.eI(s,o,.25,1)}return this._prevEase={start:e.q.now(),duration:t,easing:i},i}blur(){this.reset()}reset(){this._active=!1}_addScrollZoomBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=l("div","mapboxgl-scroll-zoom-blocker",this._map._container),this._alertContainer.textContent=/(Mac|iPad)/i.test(navigator.userAgent)?this._map._getUIString("ScrollZoomBlocker.CmdMessage"):this._map._getUIString("ScrollZoomBlocker.CtrlMessage"),this._alertContainer.style.fontSize=`${Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth)))}px`)}_showBlockerAlert(){this._alertContainer.style.visibility="visible",this._alertContainer.classList.add("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.setAttribute("role","alert"),clearTimeout(this._alertTimer),this._alertTimer=window.setTimeout(()=>{this._alertContainer.classList.remove("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.removeAttribute("role")},200)}}class al{constructor(e,t){this._clickZoom=e,this._tapZoom=t}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class ll{constructor(){this.reset()}reset(){this._active=!1}blur(){this.reset()}dblclick(e,t){return e.preventDefault(),{cameraAnimation:i=>{i.easeTo({duration:300,zoom:i.getZoom()+(e.shiftKey?-1:1),around:i.unproject(t)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class cl{constructor(){this._tap=new Na({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,this._swipePoint=void 0,this._swipeTouch=0,this._tapTime=0,this._tap.reset()}touchstart(e,t,i){this._swipePoint||(this._tapTime&&e.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?i.length>0&&(this._swipePoint=t[0],this._swipeTouch=i[0].identifier):this._tap.touchstart(e,t,i))}touchmove(e,t,i){if(this._tapTime){if(this._swipePoint){if(i[0].identifier!==this._swipeTouch)return;const n=t[0],r=n.y-this._swipePoint.y;return this._swipePoint=n,e.preventDefault(),this._active=!0,{zoomDelta:r/128}}}else this._tap.touchmove(e,t,i)}touchend(e,t,i){this._tapTime?this._swipePoint&&0===i.length&&this.reset():this._tap.touchend(e,t,i)&&(this._tapTime=e.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class hl{constructor(e,t,i){this._el=e,this._mousePan=t,this._touchPan=i}enable(e){this._inertiaOptions=e||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("mapboxgl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("mapboxgl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class dl{constructor(e,t,i){this._pitchWithRotate=e.pitchWithRotate,this._mouseRotate=t,this._mousePitch=i}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class ul{constructor(e,t,i,n){this._el=e,this._touchZoom=t,this._touchRotate=i,this._tapDragZoom=n,this._rotationDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),this._tapDragZoom.enable(),this._el.classList.add("mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("mapboxgl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}const fl=e=>e.zoom||e.drag||e.pitch||e.rotate;class pl extends e.A{}class ml{constructor(){this.constants=[1,1,.01],this.radius=0}setup(t,i){const n=e.at([],i,t);this.radius=e.ae(n[2]<0?e.eM([],n,this.constants):[n[0],n[1],0])}projectRay(t){e.eM(t,t,this.constants),e.au(t,t),e.eN(t,t,this.constants);const i=e.c1([],t,this.radius);if(i[2]>0){const t=e.c1([],[0,0,1],e.bG(i,[0,0,1])),n=e.c1([],e.au([],[i[0],i[1],0]),this.radius),r=e.d5([],i,e.c1([],e.at([],e.d5([],n,t),i),2));i[0]=r[0],i[1]=r[1]}return i}}function gl(e){return e.panDelta&&e.panDelta.mag()||e.zoomDelta||e.bearingDelta||e.pitchDelta}class _l{constructor(t,i){this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Aa(t),this._bearingSnap=i.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new ml,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(i),e.aV(["handleEvent","handleWindowEvent"],this);const n=this._el;this._listeners=[[n,"touchstart",{passive:!0}],[n,"touchmove",{passive:!1}],[n,"touchend",void 0],[n,"touchcancel",void 0],[n,"mousedown",void 0],[n,"mousemove",void 0],[n,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[n,"mouseover",void 0],[n,"mouseout",void 0],[n,"dblclick",void 0],[n,"click",void 0],[n,"keydown",{capture:!1}],[n,"keyup",void 0],[n,"wheel",{passive:!1}],[n,"contextmenu",void 0],[window,"blur",void 0]];for(const[e,t,i]of this._listeners){const n=e===document?this.handleWindowEvent:this.handleEvent;e.addEventListener(t,n,i)}}destroy(){for(const[e,t,i]of this._listeners){const n=e===document?this.handleWindowEvent:this.handleEvent;e.removeEventListener(t,n,i)}}_addDefaultHandlers(e){const t=this._map,i=t.getCanvasContainer();this._add("mapEvent",new Pa(t,e));const n=t.boxZoom=new Oa(t,e);this._add("boxZoom",n);const r=new Ya,s=new ll;t.doubleClickZoom=new al(s,r),this._add("tapZoom",r),this._add("clickZoom",s);const o=new cl;this._add("tapDragZoom",o);const a=t.touchPitch=new el(t);this._add("touchPitch",a);const l=new Wa(e),c=new Ua(e);t.dragRotate=new dl(e,l,c),this._add("mouseRotate",l,["mousePitch"]),this._add("mousePitch",c,["mouseRotate"]);const h=new Va(e),d=new $a(t,e);t.dragPan=new hl(i,h,d),this._add("mousePan",h),this._add("touchPan",d,["touchZoom","touchRotate"]);const u=new Ka,f=new Za;t.touchZoomRotate=new ul(i,f,u,o),this._add("touchRotate",u,["touchPan","touchZoom"]),this._add("touchZoom",f,["touchPan","touchRotate"]),this._add("blockableMapEvent",new Ra(t));const p=t.scrollZoom=new ol(t,this);this._add("scrollZoom",p,["mousePan"]);const m=t.keyboard=new il;this._add("keyboard",m);for(const i of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])e.interactive&&e[i]&&t[i].enable(e[i])}_add(e,t,i){this._handlers.push({handlerName:e,handler:t,allowed:i}),this._handlersById[e]=t}stop(e){if(!this._updatingCamera){for(const{handler:e}of this._handlers)e.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[],this._originalZoom=void 0}}isActive(){for(const{handler:e}of this._handlers)if(e.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!fl(this._eventsInProgress)||this.isZooming()}_isDragging(){return!!this._eventsInProgress.drag}_blockedByActive(e,t,i){for(const n in e)if(n!==i&&(!t||t.indexOf(n)<0))return!0;return!1}handleWindowEvent(e){this.handleEvent(e,`${e.type}Window`)}_getMapTouches(e){const t=[];for(const i of e)this._el.contains(i.target)&&t.push(i);return t}handleEvent(e,t){this._updatingCamera=!0;const i="renderFrame"===e.type,n=i?void 0:e,r={needsRenderFrame:!1},s={},o={},a=e.touches?this._getMapTouches(e.touches):void 0,l=a?y(this._el,a):i?void 0:_(this._el,e);for(const{handlerName:i,handler:c,allowed:h}of this._handlers){if(!c.isEnabled())continue;let d;this._blockedByActive(o,h,i)?c.reset():c[t||e.type]&&(d=c[t||e.type](e,l,a),this.mergeHandlerResult(r,s,d,i,n),d&&d.needsRenderFrame&&this._triggerRenderFrame()),(d||c.isActive())&&(o[i]=c)}const c={};for(const e in this._previousActiveHandlers)o[e]||(c[e]=n);this._previousActiveHandlers=o,(Object.keys(c).length||gl(r))&&(this._changes.push([r,s,c]),this._triggerRenderFrame()),(Object.keys(o).length||gl(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(t,i,n,r,s){if(!n)return;e.h(t,n);const o={handlerName:r,originalEvent:n.originalEvent||s};void 0!==n.zoomDelta&&(i.zoom=o),void 0!==n.panDelta&&(i.drag=o),void 0!==n.pitchDelta&&(i.pitch=o),void 0!==n.bearingDelta&&(i.rotate=o)}_applyChanges(){const t={},i={},n={};for(const[r,s,o]of this._changes)r.panDelta&&(t.panDelta=(t.panDelta||new e.P(0,0))._add(r.panDelta)),r.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+r.zoomDelta),r.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+r.bearingDelta),r.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+r.pitchDelta),void 0!==r.around&&(t.around=r.around),void 0!==r.aroundCoord&&(t.aroundCoord=r.aroundCoord),void 0!==r.pinchAround&&(t.pinchAround=r.pinchAround),r.noInertia&&(t.noInertia=r.noInertia),e.h(i,s),e.h(n,o);this._updateMapTransform(t,i,n),this._changes=[]}_updateMapTransform(t,i,n){const r=this._map,s=r.transform,o=e=>[e.x,e.y,e.z];if((()=>{const e=this._eventsInProgress.drag;return e&&!this._handlersById[e.handlerName].isActive()})()&&!gl(t)){const e=s.zoom;s.cameraElevationReference="sea",null!=this._originalZoom&&s._orthographicProjectionAtLowPitch&&"globe"!==s.projection.name&&0===s.pitch?(s.cameraElevationReference="ground",s.zoom=this._originalZoom):(s.recenterOnTerrain(),s.cameraElevationReference="ground"),e!==s.zoom&&this._map._update(!0)}if(s._isCameraConstrained&&r._stop(!0),!gl(t))return void this._fireEvents(i,n,!0);let{panDelta:a,zoomDelta:l,bearingDelta:c,pitchDelta:h,around:d,aroundCoord:u,pinchAround:f}=t;s._isCameraConstrained&&(l>0&&(l=0),s._isCameraConstrained=!1),void 0!==f&&(d=f),(l||(e=>i[e]&&!this._eventsInProgress[e])("drag"))&&d&&(this._dragOrigin=o(s.pointCoordinate3D(d)),this._originalZoom=s.zoom,this._trackingEllipsoid.setup(s._camera.position,this._dragOrigin)),s.cameraElevationReference="sea",r._stop(!0),d=d||r.transform.centerPoint,c&&(s.bearing+=c),h&&(s.pitch+=h),s._updateCameraState();const p=[0,0,0];if(a)if("mercator"===s.projection.name){const e=this._trackingEllipsoid.projectRay(s.screenPointToMercatorRay(d).dir),t=this._trackingEllipsoid.projectRay(s.screenPointToMercatorRay(d.sub(a)).dir);p[0]=t[0]-e[0],p[1]=t[1]-e[1]}else{const t=s.pointCoordinate(d);if("globe"===s.projection.name){a=a.rotate(-s.angle);const i=s._pixelsPerMercatorPixel/s.worldSize;p[0]=-a.x*e.eL(e.aY(t.y))*i,p[1]=-a.y*e.eL(s.center.lat)*i}else{const e=s.pointCoordinate(d.sub(a));t&&e&&(p[0]=e.x-t.x,p[1]=e.y-t.y)}}const m=s.zoom,g=[0,0,0];if(l){const t=o(u||s.pointCoordinate3D(d)),i={dir:e.au([],e.at([],t,s._camera.position))};if(i.dir[2]<0){const n=s.zoomDeltaToMovement(t,l);e.c1(g,i.dir,n)}}const _=e.d5(p,p,g);s._translateCameraConstrained(_),l&&Math.abs(s.zoom-m)>1e-4&&s.recenterOnTerrain(),s.cameraElevationReference="ground",this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(i,n,!0)}_fireEvents(t,i,n){const r=fl(this._eventsInProgress),s=fl(t),o={};for(const e in t){const{originalEvent:i}=t[e];this._eventsInProgress[e]||(o[`${e}start`]=i),this._eventsInProgress[e]=t[e]}!r&&s&&this._fireEvent("movestart",s.originalEvent);for(const e in o)this._fireEvent(e,o[e]);s&&this._fireEvent("move",s.originalEvent);for(const e in t){const{originalEvent:i}=t[e];this._fireEvent(e,i)}const a={};let l;for(const e in this._eventsInProgress){const{handlerName:t,originalEvent:n}=this._eventsInProgress[e];this._handlersById[t].isActive()||(delete this._eventsInProgress[e],l=i[t]||n,a[`${e}end`]=l)}for(const e in a)this._fireEvent(e,a[e]);const c=fl(this._eventsInProgress);if(n&&(r||s)&&!c){this._updatingCamera=!0;const t=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),i=e=>0!==e&&-this._bearingSnap{this._frameId=void 0,this.handleEvent(new pl("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}}const yl="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class vl extends e.E{constructor(t,i){super(),this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=i.bearingSnap,this._respectPrefersReducedMotion=!1!==i.respectPrefersReducedMotion,e.aV(["_renderFrameCallback"],this)}getCenter(){return new e.ci(this.transform.center.lng,this.transform.center.lat)}setCenter(e,t){return this.jumpTo({center:e},t)}panBy(t,i,n){return t=e.P.convert(t).mult(-1),this.panTo(this.transform.center,e.h({offset:t},i),n)}panTo(t,i,n){return this.easeTo(e.h({center:t},i),n)}getZoom(){return this.transform.zoom}setZoom(e,t){return this.jumpTo({zoom:e},t),this}zoomTo(t,i,n){return this.easeTo(e.h({zoom:t},i),n)}zoomIn(e,t){return this.zoomTo(this.getZoom()+1,e,t),this}zoomOut(e,t){return this.zoomTo(this.getZoom()-1,e,t),this}getBearing(){return this.transform.bearing}setBearing(e,t){return this.jumpTo({bearing:e},t),this}getPadding(){return this.transform.padding}setPadding(e,t){return this.jumpTo({padding:e},t),this}rotateTo(t,i,n){return this.easeTo(e.h({bearing:t},i),n)}resetNorth(t,i){return this.rotateTo(0,e.h({duration:1e3},t),i),this}resetNorthPitch(t,i){return this.easeTo(e.h({bearing:0,pitch:0,duration:1e3},t),i),this}snapToNorth(e,t){return Math.abs(this.getBearing())e.aspect?i/(2*Math.tan(.5*e.fovX)*e.aspect):n/(2*Math.tan(.5*e.fovY)*e.aspect)}_cameraForBoundsOnGlobe(t,i,n,r,s,o){const a=t.clone(),l=this._extendCameraOptions(o);a.bearing=r,a.pitch=s;const c=e.ci.convert(i),h=e.ci.convert(n),d=.5*(c.lat+h.lat),u=.5*(c.lng+h.lng),f=e.eO(d,u),p=e.au([],f),m=e.au([],e.bF([],p,[0,1,0])),g=e.bF([],m,p),_=[m[0],m[1],m[2],0,g[0],g[1],g[2],0,p[0],p[1],p[2],0,0,0,0,1],y=[f,e.eO(c.lat,c.lng),e.eO(h.lat,c.lng),e.eO(h.lat,h.lng),e.eO(c.lat,h.lng),e.eO(d,c.lng),e.eO(d,h.lng),e.eO(c.lat,u),e.eO(h.lat,u)];let v=e.d6.fromPoints(y.map(t=>[e.bG(m,t),e.bG(g,t),e.bG(p,t)]));const x=e.ad([],v.center,_);0===e.eP(x)&&e.eQ(x,0,0,1),e.au(x,x),e.c1(x,x,e.aB),a.center=e.eR(x);const b=a.getWorldToCameraMatrix(),w=e.bi(new Float64Array(16),b);v=e.d6.applyTransform(v,e.az([],b,_));const S=this._extendAABB(v,a,l,r);if(!S)return void e.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");v=S,e.ad(x,x,b);const T=.5*(v.max[2]-v.min[2]),k=this._minimumAABBFrustumDistance(a,v),M=e.c1([],[0,0,1],T),A=e.d5(M,x,M),C=k+(0===a.pitch?0:e.bD(x,A)),D=a.globeCenterInViewSpace,L=e.at([],x,[D[0],D[1],D[2]]);e.au(L,L),e.c1(L,L,C);const E=e.d5([],x,L);e.ad(E,E,w);const I=e.eB/e.aB,P=e.ae(E),R=e.cb(Math.max(P*I-e.eB,Number.EPSILON),0),O=Math.min(a.zoomFromMercatorZAdjusted(R),l.maxZoom);return O>.5*(e.cX+e.cI)?(a.setProjection({name:"mercator"}),a.zoom=O,this._cameraForBounds(a,i,n,r,s,o)):{center:a.center,zoom:O,bearing:r,pitch:s}}_extendAABB(t,i,n,r){const s=.5*((n.padding.left||0)+(n.padding.right||0)),o=.5*((n.padding.top||0)+(n.padding.bottom||0)),a=o,l=s,c=s,h=o,d=i.width-(l+c),u=i.height-(a+h),f=e.at([],t.max,t.min),p=Math.min(d/f[0],u/f[1]),m=Math.min(i.scaleZoom(i.scale*p),n.maxZoom);if(isNaN(m))return null;const g=i.scale/i.zoomScale(m),_=new e.d6([t.min[0]-l*g,t.min[1]-h*g,t.min[2]],[t.max[0]+c*g,t.max[1]+a*g,t.max[2]]),y=("number"==typeof n.offset.x&&"number"==typeof n.offset.y?new e.P(n.offset.x,n.offset.y):e.P.convert(n.offset)).rotate(-e.al(r));return _.center[0]-=y.x*g,_.center[1]+=y.y*g,_}queryTerrainElevation(t,i){const n=this.transform.elevation;return n?(i=e.h({},{exaggerated:!0},i),n.getAtPoint(e.ac.fromLngLat(t),null,i.exaggerated)):null}_cameraForBounds(t,i,n,r,s,o){if("globe"===t.projection.name)return this._cameraForBoundsOnGlobe(t,i,n,r,s,o);const a=t.clone(),l=this._extendCameraOptions(o);a.bearing=r,a.pitch=s;const c=e.ci.convert(i),h=e.ci.convert(n),d=new e.ci(c.lng,h.lat),u=new e.ci(h.lng,c.lat),f=a.project(c),p=a.project(h),m=this.queryTerrainElevation(c),g=this.queryTerrainElevation(h),_=this.queryTerrainElevation(d),y=this.queryTerrainElevation(u),v=[[f.x,f.y,Math.min(m||0,g||0,_||0,y||0)],[p.x,p.y,Math.max(m||0,g||0,_||0,y||0)]];let x=e.d6.fromPoints(v);const b=a.getWorldToCameraMatrix(),w=e.bi(new Float64Array(16),b);x=e.d6.applyTransform(x,b);const S=this._extendAABB(x,a,l,r);if(!S)return void e.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");x=S;const T=.5*e.at([],x.max,x.min)[2],k=this._minimumAABBFrustumDistance(a,x),M=[0,0,1,0];e.aA(M,M,b),e.eS(M,M);const A=e.c1([],M,k+T),C=e.d5([],x.center,A);e.ad(x.center,x.center,w),e.ad(C,C,w);const D=a.unproject(new e.P(x.center[0],x.center[1])),L=e.eT(a.projection,D),E=Math.pow(2,L),I=Math.min(a._zoomFromMercatorZ(C[2]*a.pixelsPerMeter*E/a.worldSize),l.maxZoom);return a.mercatorFromTransition&&I<.5*(e.cX+e.cI)?(a.setProjection({name:"globe"}),a.zoom=I,this._cameraForBounds(a,i,n,r,s,o)):{center:D,zoom:I,bearing:r,pitch:s}}fitBounds(e,t,i){const n=this.cameraForBounds(e,t);return this._fitInternal(n,t,i)}fitScreenCoordinates(t,i,n,r,s){const o=e.P.convert(t),a=e.P.convert(i),l=new e.P(Math.min(o.x,a.x),Math.min(o.y,a.y)),c=new e.P(Math.max(o.x,a.x),Math.max(o.y,a.y));if("mercator"===this.transform.projection.name&&this.transform.anyCornerOffEdge(o,a))return this;const h=this.transform.pointLocation3D(l),d=this.transform.pointLocation3D(c),u=this.transform.pointLocation3D(new e.P(l.x,c.y)),f=this.transform.pointLocation3D(new e.P(c.x,l.y)),p=[Math.min(h.lng,d.lng,u.lng,f.lng),Math.min(h.lat,d.lat,u.lat,f.lat)],m=[Math.max(h.lng,d.lng,u.lng,f.lng),Math.max(h.lat,d.lat,u.lat,f.lat)],g=r&&r.pitch?r.pitch:this.getPitch(),_=this._cameraForBounds(this.transform,p,m,n,g,r);return this._fitInternal(_,r,s)}_fitInternal(t,i,n){return t?(i=e.h(t,i)).linear?this.easeTo(i,n):this.flyTo(i,n):this}jumpTo(t,i){this.stop();const n=t.preloadOnly?this.transform.clone():this.transform;let r=!1,s=!1,o=!1;"zoom"in t&&n.zoom!==+t.zoom&&(r=!0,n.zoom=+t.zoom),void 0!==t.center&&(n.center=e.ci.convert(t.center)),"bearing"in t&&n.bearing!==+t.bearing&&(s=!0,n.bearing=+t.bearing),"pitch"in t&&n.pitch!==+t.pitch&&(o=!0,n.pitch=+t.pitch);const a="number"==typeof t.padding?this._extendPadding(t.padding):t.padding;if(null!=t.padding&&!n.isPaddingEqual(a))if(!1===t.retainPadding){const e=n.clone();e.padding=a,n.setLocationAtPoint(n.center,e.centerPoint)}else n.padding=a;return t.preloadOnly?(this._preloadTiles(n),this):(this.fire(new e.A("movestart",i)).fire(new e.A("move",i)),r&&this.fire(new e.A("zoomstart",i)).fire(new e.A("zoom",i)).fire(new e.A("zoomend",i)),s&&this.fire(new e.A("rotatestart",i)).fire(new e.A("rotate",i)).fire(new e.A("rotateend",i)),o&&this.fire(new e.A("pitchstart",i)).fire(new e.A("pitch",i)).fire(new e.A("pitchend",i)),this.fire(new e.A("moveend",i)))}getFreeCameraOptions(){return this.transform.projection.supportsFreeCamera||e.w(yl),this.transform.getFreeCameraOptions()}setFreeCameraOptions(t,i){const n=this.transform;if(!n.projection.supportsFreeCamera)return e.w(yl),this;this.stop();const r=n.zoom,s=n.pitch,o=n.bearing;n.setFreeCameraOptions(t);const a=r!==n.zoom,l=s!==n.pitch,c=o!==n.bearing;return this.fire(new e.A("movestart",i)).fire(new e.A("move",i)),a&&this.fire(new e.A("zoomstart",i)).fire(new e.A("zoom",i)).fire(new e.A("zoomend",i)),c&&this.fire(new e.A("rotatestart",i)).fire(new e.A("rotate",i)).fire(new e.A("rotateend",i)),l&&this.fire(new e.A("pitchstart",i)).fire(new e.A("pitch",i)).fire(new e.A("pitchend",i)),this.fire(new e.A("moveend",i)),this}easeTo(t,i){this._stop(!1,t.easeId),(!1===(t=e.h({offset:[0,0],duration:500,easing:e.eK},t)).animate||this._prefersReducedMotion(t))&&(t.duration=0);const n=this.transform,r=this.getZoom(),s=this.getBearing(),o=this.getPitch(),a=this.getPadding(),l="zoom"in t?+t.zoom:r,c="bearing"in t?this._normalizeBearing(t.bearing,s):s,h="pitch"in t?+t.pitch:o,d=this._extendPadding(t.padding),u=e.P.convert(t.offset);let f,p,m;if("globe"===n.projection.name){const i=e.ac.fromLngLat(n.center),r=u.rotate(-n.angle);i.x+=r.x/n.worldSize,i.y+=r.y/n.worldSize;const s=i.toLngLat(),o=e.ci.convert(t.center||s);this._normalizeCenter(o),f=n.centerPoint.add(r),p=new e.P(i.x,i.y).mult(n.worldSize),m=new e.P(e.aD(o.lng),e.aH(o.lat)).mult(n.worldSize).sub(p)}else{f=n.centerPoint.add(u);const i=n.pointLocation(f),r=e.ci.convert(t.center||i);this._normalizeCenter(r),p=n.project(i),m=n.project(r).sub(p)}const g=n.zoomScale(l-r);let _,y;t.around&&(_=e.ci.convert(t.around),y=n.locationPoint(_));const v=this._zooming||l!==r,x=this._rotating||s!==c,b=this._pitching||h!==o,w=!n.isPaddingEqual(d),S=!1===t.retainPadding?n.clone():n,T=n=>T=>{if(v&&(n.zoom=e.ai(r,l,T)),x&&(n.bearing=e.ai(s,c,T)),b&&(n.pitch=e.ai(o,h,T)),w&&(S.interpolatePadding(a,d,T),f=S.centerPoint.add(u)),_)n.setLocationAtPoint(_,y);else{const e=n.zoomScale(n.zoom-r),t=l>r?Math.min(2,g):Math.max(.5,g),i=Math.pow(t,1-T),s=n.unproject(p.add(m.mult(T*i)).mult(e));n.setLocationAtPoint(n.renderWorldCopies?s.wrap():s,f)}return t.preloadOnly||this._fireMoveEvents(i),n};if(t.preloadOnly){const e=this._emulate(T,t.duration,n);return this._preloadTiles(e),this}const k={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=v,this._rotating=x,this._pitching=b,this._padding=w,this._easeId=t.easeId,this._prepareEase(i,t.noMoveStart,k),this._ease(T(n),e=>{"sea"===n.cameraElevationReference&&n.recenterOnTerrain(),this._afterEase(i,e)},t),this}_prepareEase(t,i,n={}){this._moving=!0,this.transform.cameraElevationReference="sea",this.transform._orthographicProjectionAtLowPitch&&0===this.transform.pitch&&"globe"!==this.transform.projection.name&&(this.transform.cameraElevationReference="ground"),i||n.moving||this.fire(new e.A("movestart",t)),this._zooming&&!n.zooming&&this.fire(new e.A("zoomstart",t)),this._rotating&&!n.rotating&&this.fire(new e.A("rotatestart",t)),this._pitching&&!n.pitching&&this.fire(new e.A("pitchstart",t))}_fireMoveEvents(t){this.fire(new e.A("move",t)),this._zooming&&this.fire(new e.A("zoom",t)),this._rotating&&this.fire(new e.A("rotate",t)),this._pitching&&this.fire(new e.A("pitch",t))}_afterEase(t,i){if(this._easeId&&i&&this._easeId===i)return;this._easeId=void 0,this.transform.cameraElevationReference="ground";const n=this._zooming,r=this._rotating,s=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,n&&this.fire(new e.A("zoomend",t)),r&&this.fire(new e.A("rotateend",t)),s&&this.fire(new e.A("pitchend",t)),this.fire(new e.A("moveend",t))}flyTo(t,i){if(this._prefersReducedMotion(t)){const n=e.aF(t,["center","zoom","bearing","pitch","around","padding","retainPadding"]);return this.jumpTo(n,i)}this.stop(),t=e.h({offset:[0,0],speed:1.2,curve:1.42,easing:e.eK},t);const n=this.transform,r=this.getZoom(),s=this.getBearing(),o=this.getPitch(),a=this.getPadding(),l="zoom"in t?e.ay(+t.zoom,n.minZoom,n.maxZoom):r,c="bearing"in t?this._normalizeBearing(t.bearing,s):s,h="pitch"in t?+t.pitch:o,d=this._extendPadding(t.padding),u=n.zoomScale(l-r),f=e.P.convert(t.offset);let p=n.centerPoint.add(f);const m=n.pointLocation(p),g=e.ci.convert(t.center||m);this._normalizeCenter(g);const _=n.project(m),y=n.project(g).sub(_);let v=t.curve;const x=Math.max(n.width,n.height),b=x/u,w=y.mag();if("minZoom"in t){const i=e.ay(Math.min(t.minZoom,r,l),n.minZoom,n.maxZoom),s=x/n.zoomScale(i-r);v=Math.sqrt(s/w*2)}const S=v*v;function T(e){const t=(b*b-x*x+(e?-1:1)*S*S*w*w)/(2*(e?b:x)*S*w);return Math.log(Math.sqrt(t*t+1)-t)}function k(e){return(Math.exp(e)-Math.exp(-e))/2}function M(e){return(Math.exp(e)+Math.exp(-e))/2}const A=T(0);let C=function(e){return M(A)/M(A+v*e)},D=function(e){return x*((M(A)*(k(t=A+v*e)/M(t))-k(A))/S)/w;var t},L=(T(1)-A)/v;if(Math.abs(w)<1e-6||!isFinite(L)){if(Math.abs(x-b)<1e-6)return this.easeTo(t,i);const e=bt.maxDuration&&(t.duration=0);const E=s!==c,I=h!==o,P=!n.isPaddingEqual(d),R=!1===t.retainPadding?n.clone():n,O=n=>u=>{const m=u*L,v=1/C(m);n.zoom=1===u?l:r+n.scaleZoom(v),E&&(n.bearing=e.ai(s,c,u)),I&&(n.pitch=e.ai(o,h,u)),P&&(R.interpolatePadding(a,d,u),p=R.centerPoint.add(f));const x=1===u?g:n.unproject(_.add(y.mult(D(m))).mult(v));return n.setLocationAtPoint(n.renderWorldCopies?x.wrap():x,p),n._updateCameraOnTerrain(),t.preloadOnly||this._fireMoveEvents(i),n};if(t.preloadOnly){const e=this._emulate(O,t.duration,n);return this._preloadTiles(e),this}return this._zooming=!0,this._rotating=E,this._pitching=I,this._padding=P,this._prepareEase(i,!1),this._ease(O(n),()=>this._afterEase(i),t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_requestRenderFrame(e){}_cancelRenderFrame(e){}_stop(e,t){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),this._easeFrameId=void 0,this._onEaseFrame=void 0),this._onEaseEnd){const e=this._onEaseEnd;this._onEaseEnd=void 0,e.call(this,t)}if(!e){const e=this.handlers;e&&e.stop(!1)}return this}_ease(t,i,n){!1===n.animate||0===n.duration?(t(1),i()):(this._easeStart=e.q.now(),this._easeOptions=n,this._onEaseFrame=t,this._onEaseEnd=i,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const t=Math.min((e.q.now()-this._easeStart)/this._easeOptions.duration,1),i=this._onEaseFrame;i&&i(this._easeOptions.easing(t)),t<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(t,i){t=e.bQ(t,-180,180);const n=Math.abs(t-i);return Math.abs(t-360-i)180?-360:i<-180?360:0}_prefersReducedMotion(t){return this._respectPrefersReducedMotion&&e.q.prefersReducedMotion&&!(t&&t.essential)}_emulate(e,t,i){const n=Math.ceil(15*t/1e3),r=[],s=e(i.clone());for(let e=0;e<=n;e++){const t=s(e/n);r.push(t.clone())}return r}_preloadTiles(e,t){}}class xl{constructor(t={}){this.options=t,e.aV(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)}getDefaultPosition(){return"bottom-right"}onAdd(e){const t=this.options&&this.options.compact,i=e._getUIString("AttributionControl.ToggleAttribution");this._map=e,this._container=l("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=l("button","mapboxgl-ctrl-attrib-button",this._container),this._compactButton.type="button",this._compactButton.addEventListener("click",this._toggleAttribution),this._compactButton.setAttribute("aria-label",i);const n=l("span","mapboxgl-ctrl-icon",this._compactButton);return n.setAttribute("aria-hidden","true"),n.setAttribute("title",i),this._innerContainer=l("div","mapboxgl-ctrl-attrib-inner",this._container),t&&this._container.classList.add("mapboxgl-compact"),this._updateAttributions(),this._updateEditLink(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("moveend",this._updateEditLink),void 0===t&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0,this._attribHTML=void 0}_toggleAttribution(){this._container.classList.contains("mapboxgl-compact-show")?(this._container.classList.remove("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","false")):(this._container.classList.add("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","true"))}_updateEditLink(){let t=this._editLink;t||(t=this._editLink=this._container.querySelector(".mapbox-improve-map"));const i=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||e.e.ACCESS_TOKEN}];if(t){const n=i.reduce((e,t,n)=>(t.value&&(e+=`${t.key}=${t.value}${ne.length-t.length),e=e.filter((t,i)=>{for(let n=i+1;n=0)return!1;return!0}),this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=[...this.options.customAttribution,...e]:e.unshift(this.options.customAttribution));const i=e.join(" | ");i!==this._attribHTML&&(this._attribHTML=i,e.length?(this._innerContainer.innerHTML=i,this._container.classList.remove("mapboxgl-attrib-empty")):this._container.classList.add("mapboxgl-attrib-empty"),this._editLink=null)}_updateCompact(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("mapboxgl-compact"):this._container.classList.remove("mapboxgl-compact","mapboxgl-compact-show")}}class bl{constructor(){e.aV(["_updateLogo","_updateCompact"],this)}onAdd(e){this._map=e,this._container=l("div","mapboxgl-ctrl");const t=l("a","mapboxgl-ctrl-logo");return t.target="_blank",t.rel="noopener nofollow",t.href="https://www.mapbox.com/",t.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),t.setAttribute("rel","noopener nofollow"),this._container.appendChild(t),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact)}getDefaultPosition(){return"bottom-left"}_updateLogo(e){e&&"metadata"!==e.sourceDataType||(this._container.style.display=this._logoRequired()?"block":"none")}_logoRequired(){if(!this._map.style)return!0;const e=this._map.style._sourceCaches;if(0===Object.entries(e).length)return!0;for(const t in e){const i=e[t].getSource();if(i.hasOwnProperty("mapbox_logo")&&!i.mapbox_logo)return!1}return!0}_updateCompact(){const e=this._container.children;if(e.length){const t=e[0];this._map.getCanvasContainer().offsetWidth<250?t.classList.add("mapboxgl-compact"):t.classList.remove("mapboxgl-compact")}}}class wl{constructor(){e.aV(["_onIndoorUpdate"],this)}onAdd(e){return this._map=e,this._container=l("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._map.indoor.on("indoorupdate",e=>this._onIndoorUpdate({selectedFloorId:e.selectedFloorId,floors:e.floors})),this._container}_createButton(e,t){const i=l("button",e,this._container);return i.type="button",i.addEventListener("click",t),i}_setButtonTitle(e,t){this._map&&(e.setAttribute("aria-label",t),e.innerHTML=`${t}`,e.firstElementChild&&e.firstElementChild.setAttribute("title",t))}onRemove(){this._container&&this._container.remove(),this._map&&this._map.indoor&&(this._map.indoor.off("indoorupdate",this._onIndoorUpdate),this._map=null)}getDefaultPosition(){return"right"}_onIndoorUpdate(e){if(!e||!e.floors)return void(this._container.style.display="none");const t=this._model;this._model=e,this._container.style.display="inline-block";const i=e.floors.sort((e,t)=>e.levelOrder-t.levelOrder);t?(Array.from(this._container.children).forEach(e=>e.remove()),this.addCurrentFloors(i)):this.addCurrentFloors(i)}addCurrentFloors(e){for(const t of e){const e=this._createButton("mapboxgl-ctrl-level-button",()=>{this._map._selectIndoorFloor(t.id),Array.from(this._container.children).forEach(e=>{e.classList.remove("mapboxgl-ctrl-level-button-selected")}),e.classList.add("mapboxgl-ctrl-level-button-selected")});this._setButtonTitle(e,t.shortName),this._model&&t.id===this._model.selectedFloorId&&(this._map._selectIndoorFloor(t.id),e.classList.add("mapboxgl-ctrl-level-button-selected")),this._container.append(e)}}}class Sl{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){const t=++this._id;return this._queue.push({callback:e,id:t,cancelled:!1}),t}remove(e){const t=this._currentlyRunning,i=t?this._queue.concat(t):this._queue;for(const t of i)if(t.id===e)return void(t.cancelled=!0)}run(e=0){const t=this._currentlyRunning=this._queue;this._queue=[];for(const i of t)if(!i.cancelled&&(i.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}class Tl{constructor(e){this.jumpTo(e)}getValue(t){if(t<=this._startTime)return this._start;if(t>=this._endTime)return this._end;const i=e.dx((t-this._startTime)/(this._endTime-this._startTime));return this._start*(1-i)+this._end*i}isEasing(e){return e>=this._startTime&&e<=this._endTime}jumpTo(e){this._startTime=-1/0,this._endTime=-1/0,this._start=e,this._end=e}easeTo(e,t,i){this._start=this.getValue(t),this._end=e,this._startTime=t,this._endTime=t+i}}const kl={"AttributionControl.ToggleAttribution":"Toggle attribution","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox homepage","Map.Title":"Map","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScrollZoomBlocker.CtrlMessage":"Use ctrl + scroll to zoom the map","ScrollZoomBlocker.CmdMessage":"Use ⌘ + scroll to zoom the map","TouchPanBlocker.Message":"Use two fingers to move the map"};class Ml extends e.A{constructor(e,t,i,n){const{point:r,lngLat:s,originalEvent:o,target:a}=e;super(e.type,{point:r,lngLat:s,originalEvent:o,target:a}),this.preventDefault=()=>{e.preventDefault()},this.id=t,this.interaction=i,this.feature=n}}class Al{constructor(e){this.map=e,this.interactionsByType=new Map,this.delegatedInteractions=new Map,this.typeById=new Map,this.filters=new Map,this.handleType=this.handleType.bind(this),this.handleMove=this.handleMove.bind(this),this.handleOut=this.handleOut.bind(this),this.hoveredFeatures=new Map,this.prevHoveredFeatures=new Map}add(t,i){if(this.typeById.has(t))throw new Error(`Interaction id "${t}" already exists.`);const n=i.filter;let r=i.type;n&&this.filters.set(t,e.b3(n)),"mouseover"===r&&(r="mouseenter"),"mouseout"===r&&(r="mouseleave");const s=this.interactionsByType.get(r)||new Map;"mouseenter"===r||"mouseleave"===r?(0===this.delegatedInteractions.size&&(this.map.on("mousemove",this.handleMove),this.map.on("mouseout",this.handleOut)),this.delegatedInteractions.set(t,i)):0===s.size&&this.map.on(r,this.handleType),0===s.size&&this.interactionsByType.set(r,s),s.set(t,i),this.typeById.set(t,r)}get(e){const t=this.typeById.get(e);if(!t)return;const i=this.interactionsByType.get(t);return i?i.get(e):void 0}remove(e){const t=this.typeById.get(e);if(!t)return;this.typeById.delete(e),this.filters.delete(e);const i=this.interactionsByType.get(t);i&&(i.delete(e),"mouseenter"===t||"mouseleave"===t?(this.delegatedInteractions.delete(e),0===this.delegatedInteractions.size&&(this.map.off("mousemove",this.handleMove),this.map.off("mouseout",this.handleOut))):0===i.size&&this.map.off(t,this.handleType))}queryTargets(e,t){const i=[];for(const[e,n]of t)n.target&&i.push({targetId:e,target:n.target,filter:this.filters.get(e)});return this.map.style.queryRenderedTargets(e,i,this.map.transform)}handleMove(e){this.prevHoveredFeatures=this.hoveredFeatures,this.hoveredFeatures=new Map;const t=this.queryTargets(e.point,Array.from(this.delegatedInteractions).reverse());t.length&&(e.type="mouseenter",this.handleType(e,t));const i=new Map;for(const[e,{feature:t}]of this.prevHoveredFeatures)this.hoveredFeatures.has(e)||i.set(t.id,t);i.size&&(e.type="mouseleave",this.handleType(e,Array.from(i.values())))}handleOut(e){const t=Array.from(this.hoveredFeatures.values()).map(({feature:e})=>e);t.length&&(e.type="mouseleave",this.handleType(e,t)),this.hoveredFeatures.clear()}handleType(t,i){const n="mouseenter"===t.type;if(n&&!this.interactionsByType.has(t.type))return void e.w("mouseenter interaction required for mouseleave to work.");const r=Array.from(this.interactionsByType.get(t.type)).reverse(),s=!!i;i=i||this.queryTargets(t.point,r);let o=!1;const a=new Set;for(const l of i){for(const[i,c]of r){if(!c.target)continue;const r=l.variants?l.variants[i]:null;if(r){for(const h of r){if(ot(h,l,a,i))continue;const r=new e.dr(l,h),d=st(h,l,i);s&&(r.state=this.map.getFeatureState(r));const u=n?this.prevHoveredFeatures.get(d):null,f=new Ml(t,i,c,r),p=u?u.stop:c.handler(f);if(n&&this.hoveredFeatures.set(d,{feature:l,stop:p}),!1!==p){o=!0;break}}if(o)break}}if(o)break}if(!o)for(const[e,i]of r){const{handler:n,target:r}=i;if(!r&&!1!==n(new Ml(t,e,i,null)))break}}}function Cl(t,i){if(Array.isArray(t)&&Array.isArray(i)){const e=new Set(t),n=new Set(i);return e.size===n.size&&t.every(e=>n.has(e))}return e.bv(t,i)}const Dl={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:85,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,performanceMetricsCollection:!0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,antialias:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,minTileCacheSize:null,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",localFontFamily:null,transformRequest:null,accessToken:null,fadeDuration:300,respectPrefersReducedMotion:!0,crossSourceCollisions:!0,collectResourceTiming:!1,testMode:!1,precompilePrograms:!0,scaleFactor:1,spriteFormat:"auto"},Ll={showCompass:!0,showZoom:!0,visualizePitch:!1};class El{constructor(t,i,n=!1){this._clickTolerance=10,this.element=i,this.mouseRotate=new Wa({clickTolerance:t.dragRotate._mouseRotate._clickTolerance}),this.map=t,n&&(this.mousePitch=new Ua({clickTolerance:t.dragRotate._mousePitch._clickTolerance})),e.aV(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),i.addEventListener("mousedown",this.mousedown),i.addEventListener("touchstart",this.touchstart,{passive:!1}),i.addEventListener("touchmove",this.touchmove),i.addEventListener("touchend",this.touchend),i.addEventListener("touchcancel",this.reset)}down(e,t){this.mouseRotate.mousedown(e,t),this.mousePitch&&this.mousePitch.mousedown(e,t),f()}move(e,t){const i=this.map,n=this.mouseRotate.mousemoveWindow(e,t),r=n&&n.bearingDelta;if(r&&i.setBearing(i.getBearing()+r),this.mousePitch){const n=this.mousePitch.mousemoveWindow(e,t),r=n&&n.pitchDelta;r&&i.setPitch(i.getPitch()+r)}}off(){const e=this.element;e.removeEventListener("mousedown",this.mousedown),e.removeEventListener("touchstart",this.touchstart),e.removeEventListener("touchmove",this.touchmove),e.removeEventListener("touchend",this.touchend),e.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){p(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup)}mousedown(t){this.down(e.h({},t,{ctrlKey:!0,preventDefault:()=>t.preventDefault()}),_(this.element,t)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)}mousemove(e){this.move(e,_(this.element,e))}mouseup(e){this.mouseRotate.mouseupWindow(e),this.mousePitch&&this.mousePitch.mouseupWindow(e),this.offTemp()}touchstart(e){1!==e.targetTouches.length?this.reset():(this._startPos=this._lastPos=y(this.element,e.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>e.preventDefault()},this._startPos))}touchmove(e){1!==e.targetTouches.length?this.reset():(this._lastPos=y(this.element,e.targetTouches)[0],this.move({preventDefault:()=>e.preventDefault()},this._lastPos))}touchend(e){0===e.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)n.width||i.y>n.height;n.locationPoint3D(r).distSqr(i)180;){const e=n.locationPoint3D(t);if(e.x>=0&&e.y>=0&&e.x<=n.width&&e.y<=n.height)break;t.lng>n.center.lng?t.lng-=360:t.lng+=360}return t}const Pl={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%)"},Rl={rotation:0,rotationAlignment:"auto",pitchAlignment:"auto",occludedOpacity:.2,altitude:0};class Ol extends e.E{constructor(t,i){super(),(t instanceof HTMLElement||i)&&(t=e.h({element:t},i)),e.aV(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer"],this);const{anchor:n="center",color:r="#3FB1CE",scale:s=1,draggable:o=!1,clickTolerance:a=0,rotation:l=Rl.rotation,rotationAlignment:c=Rl.rotationAlignment,pitchAlignment:h=Rl.pitchAlignment,occludedOpacity:d=Rl.occludedOpacity,altitude:u=Rl.altitude}=t||{};this._anchor=n,this._color=r,this._scale=s,this._draggable=o,this._clickTolerance=a,this._rotation=l,this._rotationAlignment=c,this._pitchAlignment=h,this._occludedOpacity=d,this._altitude=u,this._state="inactive",this._isDragging=!1,this._updateMoving=()=>this._update(!0),t&&t.element?(this._element=t.element,this._offset=e.P.convert(t&&t.offset||[0,0])):(this._defaultMarker=!0,this._element=this._createDefaultMarker(),this._offset=e.P.convert(t&&t.offset||[0,-14])),this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label","Map marker"),this._element.hasAttribute("role")||this._element.setAttribute("role","img"),this._element.classList.add("mapboxgl-marker"),this._element.addEventListener("dragstart",e=>{e.preventDefault()}),this._element.addEventListener("mousedown",e=>{e.preventDefault()});const f=this._element.classList;for(const e in Pl)f.remove(`mapboxgl-marker-anchor-${e}`);f.add(`mapboxgl-marker-anchor-${this._anchor}`);const p=t&&t.className?t.className.trim().split(/\s+/):[];f.add(...p),this._popup=null}_createDefaultMarker(){const e=l("div"),t=c("svg",{display:"block",height:41*this._scale+"px",width:27*this._scale+"px",viewBox:"0 0 27 41"},e);if(0===this._altitude){const e=c("radialGradient",{id:"shadowGradient"},c("defs",{},t));c("stop",{offset:"10%","stop-opacity":.4},e),c("stop",{offset:"100%","stop-opacity":.05},e),c("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"},t)}return c("path",{fill:this._color,d:"M27,13.5C27,19.07 20.25,27 14.75,34.5C14.02,35.5 12.98,35.5 12.25,34.5C6.75,27 0,19.22 0,13.5C0,6.04 6.04,0 13.5,0C20.96,0 27,6.04 27,13.5Z"},t),c("path",{opacity:.25,d:"M13.5,0C6.04,0 0,6.04 0,13.5C0,19.22 6.75,27 12.25,34.5C13,35.52 14.02,35.5 14.75,34.5C20.25,27 27,19.07 27,13.5C27,6.04 20.96,0 13.5,0ZM13.5,1C20.42,1 26,6.58 26,13.5C26,15.9 24.5,19.18 22.22,22.74C19.95,26.3 16.71,30.14 13.94,33.91C13.74,34.18 13.61,34.32 13.5,34.44C13.39,34.32 13.26,34.18 13.06,33.91C10.28,30.13 7.41,26.31 5.02,22.77C2.62,19.23 1,15.95 1,13.5C1,6.58 6.58,1 13.5,1Z"},t),c("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},t),e}addTo(e){return e===this._map||(this.remove(),this._map=e,e.getCanvasContainer().appendChild(this._element),e.on("move",this._updateMoving),e.on("moveend",this._update),e.on("remove",this._clearFadeTimer),e._addMarker(this),this.setDraggable(this._draggable),this._update(),e.on("click",this._onMapClick)),this}remove(){const e=this._map;return e&&(e.off("click",this._onMapClick),e.off("move",this._updateMoving),e.off("moveend",this._update),e.off("mousedown",this._addDragHandler),e.off("touchstart",this._addDragHandler),e.off("mouseup",this._onUp),e.off("touchend",this._onUp),e.off("mousemove",this._onMove),e.off("touchmove",this._onMove),e.off("remove",this._clearFadeTimer),e._removeMarker(this),this._map=void 0),this._clearFadeTimer(),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=e.ci.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(!0),this}setAltitude(e){return e===this._altitude||(this._defaultMarker&&(0===this._altitude&&0!==e||0!==this._altitude&&0===e)&&(this._element=this._createDefaultMarker()),this._altitude=e||Rl.altitude,this._update()),this}getAltitude(){return this._altitude}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeAttribute("role"),this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),e){if(!("offset"in e.options)){const t=38.1,i=13.5,n=Math.sqrt(Math.pow(i,2)/2);e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-t],"bottom-left":[n,-1*(t-i+n)],"bottom-right":[-n,-1*(t-i+n)],left:[i,-1*(t-i)],right:[-i,-1*(t-i)]}:this._offset}this._popup=e,e._marker=this,e._altitude=this._altitude,this._lngLat&&this._popup.setLngLat(this._lngLat),this._element.setAttribute("role","button"),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress),this._element.setAttribute("aria-expanded","false")}return this}_onKeyPress(e){const t=e.code,i=e.charCode||e.keyCode;"Space"!==t&&"Enter"!==t&&32!==i&&13!==i||this.togglePopup()}_onMapClick(e){const t=e.originalEvent.target,i=this._element;this._popup&&(t===i||i.contains(t))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const e=this._popup;return e?(e.isOpen()?(e.remove(),this._element.setAttribute("aria-expanded","false")):this._map&&(e.addTo(this._map),this._element.setAttribute("aria-expanded","true")),this):this}_behindTerrain(){const e=this._map,t=this._pos;if(!e||!t)return!1;const i=e.unproject(t,this._altitude),n=e.getFreeCameraOptions();if(!n.position)return!1;const r=n.position.toLngLat();return r.distanceTo(i)<.9*r.distanceTo(this._lngLat)}_evaluateOpacity(){const t=this._map;if(!t)return;const i=this._pos;if(!i||i.x<0||i.x>t.transform.width||i.y<0||i.y>t.transform.height)return void this._clearFadeTimer();const n=t.unproject(i,this._altitude);let r;t._showingGlobe()&&e.eW(t.transform,this._lngLat)?r=0:(r=1-t._queryFogOpacity(n),t.transform._terrainEnabled()&&t.getTerrain()&&this._behindTerrain()&&(r*=this._occludedOpacity)),this._element.style.opacity=`${r}`,this._element.style.pointerEvents=r>0?"auto":"none",this._popup&&this._popup._setOpacity(r),this._fadeTimer=null}_clearFadeTimer(){this._fadeTimer&&(clearTimeout(this._fadeTimer),this._fadeTimer=null)}_updateDOM(){const e=this._pos;if(!e||!this._map)return;const t=this._offset.mult(this._scale);this._element.style.transform=`\n translate(${e.x}px,${e.y}px)\n ${Pl[this._anchor]}\n ${this._calculateXYTransform()} ${this._calculateZTransform()}\n translate(${t.x}px,${t.y}px)\n `}_calculateXYTransform(){const t=this._pos,i=this._map,n=this.getPitchAlignment();if(!i||!t||"map"!==n)return"";if(!i._showingGlobe()){const e=i.getPitch();return e?`rotateX(${e}deg)`:""}const r=e.cU(e.eX(i.transform,this._lngLat)),s=t.sub(e.eY(i.transform)),o=Math.abs(s.x)+Math.abs(s.y);if(0===o)return"";const a=r/o;return`rotateX(${-s.y*a}deg) rotateY(${s.x*a}deg)`}_calculateZTransform(){const t=this._pos,i=this._map;if(!i||!t)return"";let n=0;const r=this.getRotationAlignment();if("map"===r)if(i._showingGlobe()){const t=i.project(new e.ci(this._lngLat.lng,this._lngLat.lat+.001),this._altitude),r=i.project(new e.ci(this._lngLat.lng,this._lngLat.lat-.001),this._altitude).sub(t);n=e.cU(Math.atan2(r.y,r.x))-90}else n=-i.getBearing();else if("horizon"===r){const r=e.af(4,6,i.getZoom()),s=e.eY(i.transform);s.y+=r*i.transform.height;const o=t.sub(s),a=e.cU(Math.atan2(o.y,o.x));n=(a>90?a-270:a+90)*(1-r)}return n+=this._rotation,n?`rotateZ(${n}deg)`:""}_update(e){cancelAnimationFrame(this._updateFrameId);const t=this._map;t&&(t.transform.renderWorldCopies&&(this._lngLat=Il(this._lngLat,this._pos,t.transform)),this._pos=t.project(this._lngLat,this._altitude),!0===e?this._updateFrameId=requestAnimationFrame(()=>{this._element&&this._pos&&this._anchor&&(this._pos=this._pos.round(),this._updateDOM())}):this._pos=this._pos.round(),t._requestDomTask(()=>{this._map&&(this._element&&this._pos&&this._anchor&&this._updateDOM(),(t._showingGlobe()||t.getTerrain()||t.getFog())&&!this._fadeTimer&&(this._fadeTimer=window.setTimeout(this._evaluateOpacity.bind(this),60)))}))}getOffset(){return this._offset}setOffset(t){return this._offset=e.P.convert(t),this._update(),this}addClassName(e){return this._element.classList.add(e),this}removeClassName(e){return this._element.classList.remove(e),this}toggleClassName(e){return this._element.classList.toggle(e)}_onMove(t){const i=this._map;if(!i)return;const n=this._pointerdownPos,r=this._positionDelta;if(n&&r){if(!this._isDragging){const e=this._clickTolerance||i._clickTolerance;if(t.point.dist(n)t.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(null!=t.minPitch&&null!=t.maxPitch&&t.minPitch>t.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(null!=t.minPitch&&t.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(null!=t.maxPitch&&t.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(t.antialias&&e.eU(window)&&(t.antialias=!1,e.w("Antialiasing is disabled for this WebGL context to avoid browser bug: https://github.com/mapbox/mapbox-gl-js/issues/11609")),super(new on(t.minZoom,t.maxZoom,t.minPitch,t.maxPitch,t.renderWorldCopies,null,null),t),this._repaint=!!t.repaint,this._interactive=t.interactive,this._minTileCacheSize=t.minTileCacheSize,this._maxTileCacheSize=t.maxTileCacheSize,this._failIfMajorPerformanceCaveat=t.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=t.preserveDrawingBuffer,this._antialias=t.antialias,this._trackResize=t.trackResize,this._bearingSnap=t.bearingSnap,this._refreshExpiredTiles=t.refreshExpiredTiles,this._fadeDuration=t.fadeDuration,this._isInitialLoad=!0,this._crossSourceCollisions=t.crossSourceCollisions,this._collectResourceTiming=t.collectResourceTiming,this._language=this._parseLanguage(t.language),this._worldview=t.worldview,this._renderTaskQueue=new Sl,this._domRenderTaskQueue=new Sl,this._controls=[],this._markers=[],this._popups=[],this._mapId=e.a$(),this._locale=e.h({},kl,t.locale),this._clickTolerance=t.clickTolerance,this._cooperativeGestures=t.cooperativeGestures,this._performanceMetricsCollection=t.performanceMetricsCollection,this._tessellationStep=t.tessellationStep,this._containerWidth=0,this._containerHeight=0,this._showParseStatus=!0,this._precompilePrograms=t.precompilePrograms,this._scaleFactorChanged=!1,this._averageElevationLastSampledAt=-1/0,this._averageElevationExaggeration=0,this._averageElevation=new Tl(0),this._interactionRange=[1/0,-1/0],this._visibilityHidden=0,this._useExplicitProjection=!1,this._frameId=0,this._scaleFactor=t.scaleFactor,this._requestManager=new S(t.transformRequest,t.accessToken,t.testMode),this._silenceAuthErrors=!!t.testMode,this._contextCreateOptions=t.contextCreateOptions?Object.assign({},t.contextCreateOptions):{},"string"==typeof t.container){const e=document.getElementById(t.container);if(!e)throw new Error(`Container '${t.container.toString()}' not found.`);this._container=e}else{if(!(t.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=t.container}if(this._container.childNodes.length>0&&e.w("The map container element should be empty, otherwise the map's interactivity will be negatively impacted. If you want to display a message when WebGL is not supported, use the Mapbox GL Supported plugin instead."),t.maxBounds&&this.setMaxBounds(t.maxBounds),this._spriteFormat=t.spriteFormat,e.aV(["_onWindowOnline","_onWindowResize","_onVisibilityChange","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._tp||(this._tp=new ia),this._tp.registerParameter(this,["Debug"],"showOverdrawInspector"),this._tp.registerParameter(this,["Debug"],"showTileBoundaries"),this._tp.registerParameter(this,["Debug"],"showParseStatus"),this._tp.registerParameter(this,["Debug"],"repaint"),this._tp.registerParameter(this,["Debug"],"showTileAABBs"),this._tp.registerParameter(this,["Debug"],"showPadding"),this._tp.registerParameter(this,["Debug"],"showCollisionBoxes",{noSave:!0}),this._tp.registerParameter(this.transform,["Debug"],"freezeTileCoverage",{noSave:!0},()=>{this._update()}),this._tp.registerParameter(this,["Debug","Wireframe"],"showTerrainWireframe"),this._tp.registerParameter(this,["Debug","Wireframe"],"showLayers2DWireframe"),this._tp.registerParameter(this,["Debug","Wireframe"],"showLayers3DWireframe"),this._tp.registerParameter(this,["Scaling"],"_scaleFactor",{min:.1,max:10,step:.1},()=>{this.setScaleFactor(this._scaleFactor)}),this._setupPainter(),void 0===this.painter)throw new Error("Failed to initialize WebGL.");if(this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this._fullscreenchangeEvent="onfullscreenchange"in document?"fullscreenchange":"webkitfullscreenchange",window.addEventListener("online",this._onWindowOnline,!1),window.addEventListener("resize",this._onWindowResize,!1),window.addEventListener("orientationchange",this._onWindowResize,!1),window.addEventListener(this._fullscreenchangeEvent,this._onWindowResize,!1),window.addEventListener("visibilitychange",this._onVisibilityChange,!1),this.handlers=new _l(this,t),this._localFontFamily=t.localFontFamily,this._localIdeographFontFamily=t.localIdeographFontFamily,(t.style||!t.testMode)&&this.setStyle(t.style||e.e.DEFAULT_STYLE,{config:t.config,localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily}),t.projection&&this.setProjection(t.projection),this.indoor=new wn(this),t.hash&&(this._hash=new xa("string"==typeof t.hash&&t.hash||void 0).addTo(this)),!this._hash||!this._hash._onHashChange()){null==r.center&&null==r.zoom||(this.transform._unmodified=!1),this.jumpTo({center:t.center,zoom:t.zoom,bearing:t.bearing,pitch:t.pitch});const i=t.bounds;i&&(this.resize(),this.fitBounds(i,e.h({},t.fitBoundsOptions,{duration:0})))}this.resize(),t.attributionControl&&this.addControl(new xl({customAttribution:t.customAttribution})),this._logoControl=new bl,this.addControl(this._logoControl,t.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet),this._postStyleLoadEvent()}),this.on("data",t=>{this._update("style"===t.dataType),this.fire(new e.A(`${t.dataType}data`,t))}),this.on("dataloading",t=>{this.fire(new e.A(`${t.dataType}dataloading`,t))}),this._interactions=new Al(this)}_getMapId(){return this._mapId}addControl(t,i){if(void 0===i&&(i=t.getDefaultPosition?t.getDefaultPosition():"top-right"),!t||!t.onAdd)return this.fire(new e.z(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const n=t.onAdd(this);this._controls.push(t);const r=this._controlPositions[i];return-1!==i.indexOf("bottom")?r.insertBefore(n,r.firstChild):r.appendChild(n),this}removeControl(t){if(!t||!t.onRemove)return this.fire(new e.z(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const i=this._controls.indexOf(t);return i>-1&&this._controls.splice(i,1),t.onRemove(this),this}hasControl(e){return this._controls.indexOf(e)>-1}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}resize(t){if(this._updateContainerDimensions(),this._containerWidth===this.transform.width&&this._containerHeight===this.transform.height)return this;this._resizeCanvas(this._containerWidth,this._containerHeight),this.transform.resize(this._containerWidth,this._containerHeight),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight));const i=!this._moving;return i&&this.fire(new e.A("movestart",t)).fire(new e.A("move",t)),this.fire(new e.A("resize",t)),i&&this.fire(new e.A("moveend",t)),this}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(t){return this.transform.setMaxBounds(e.aG.convert(t)),this._update()}setMinZoom(t){if((t=t??-2)>=-2&&t<=this.transform.maxZoom)return this.transform.minZoom=t,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=t,this._update(),this.getZoom()>t?this.setZoom(t):this.fire(new e.A("zoomstart")).fire(new e.A("zoom")).fire(new e.A("zoomend")),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(t){if((t=t??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(t>=0&&t<=this.transform.maxPitch)return this.transform.minPitch=t,this._update(),this.getPitch()85)throw new Error("maxPitch must be less than or equal to 85");if(t>=this.transform.minPitch)return this.transform.maxPitch=t,this._update(),this.getPitch()>t?this.setPitch(t):this.fire(new e.A("pitchstart")).fire(new e.A("pitch")).fire(new e.A("pitchend")),this;throw new Error("maxPitch must be greater than or equal to minPitch")}getMaxPitch(){return this.transform.maxPitch}getScaleFactor(){return this._scaleFactor}setScaleFactor(e){return this._scaleFactor=e,this.painter.scaleFactor=e,this._tp.refreshUI(),this._scaleFactorChanged=!0,this.style._updateFilteredLayers(e=>"symbol"===e.type),this._update(!0),this}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(e){return this.transform.renderWorldCopies=e,this.transform.renderWorldCopies||this._forceMarkerAndPopupUpdate(!0),this._update()}getLanguage(){return this._language}_parseLanguage(e){return"auto"===e?navigator.language:Array.isArray(e)?0===e.length?void 0:e.map(e=>"auto"===e?navigator.language:e):e}setLanguage(e){const t=this._parseLanguage(e);if(!this.style||t===this._language)return this;this._language=t,this.style.reloadSources();for(const e of this._controls)e._setLanguage&&e._setLanguage(this._language);return this}getWorldview(){return this._worldview}setWorldview(e){return this.style&&e!==this._worldview?(this._worldview=e,this._styleDirty=!0,this.style.reloadSources(),this):this}getProjection(){return this.transform.mercatorFromTransition?{name:"globe",center:[0,0]}:this.transform.getProjection()}_showingGlobe(){return"globe"===this.transform.projection.name}setProjection(e){return this._lazyInitEmptyStyle(),e?"string"==typeof e&&(e={name:e}):e=null,this._useExplicitProjection=!!e,this._prioritizeAndUpdateProjection(e,this.style.projection)}_updateProjectionTransition(){if("globe"!==this.getProjection().name)return;const t=this.transform,i=t.projection.name;let n;"globe"===i&&t.zoom>=e.cI?(t.setMercatorFromTransition(),n=!0):"mercator"===i&&t.zoom=e.cI?this.transform.setMercatorFromTransition():this.transform.setProjection(t),this.style.applyProjectionUpdate(),i&&(this.painter.clearBackgroundTiles(),this.style.clearSources(),this._update(!0),this._forceMarkerAndPopupUpdate(!0)),this}project(t,i){return this.transform.locationPoint3D(e.ci.convert(t),i)}unproject(t,i){return this.transform.pointLocation3D(e.P.convert(t),i)}isMoving(){return this._moving||this.handlers&&this.handlers.isMoving()||!1}isZooming(){return this._zooming||this.handlers&&this.handlers.isZooming()||!1}isRotating(){return this._rotating||this.handlers&&this.handlers.isRotating()||!1}_isDragging(){return this.handlers&&this.handlers._isDragging()||!1}_createDelegatedListener(e,t,i){const n=e=>{let i=[];if(Array.isArray(t)){const n=t.filter(e=>this.getLayer(e));i=n.length?this.queryRenderedFeatures(e,{layers:n}):[]}else i=this.queryRenderedFeatures(e,{target:t});return i};if("mouseenter"===e||"mouseover"===e){let r=!1;const s=t=>{const s=n(t.point);s.length?r||(r=!0,i.call(this,new La(e,this,t.originalEvent,{features:s}))):r=!1};return{listener:i,targets:t,delegates:{mousemove:s,mouseout:()=>{r=!1}}}}if("mouseleave"===e||"mouseout"===e){let r=!1;const s=t=>{n(t.point).length?r=!0:r&&(r=!1,i.call(this,new La(e,this,t.originalEvent)))},o=t=>{r&&(r=!1,i.call(this,new La(e,this,t.originalEvent)))};return{listener:i,targets:t,delegates:{mousemove:s,mouseout:o}}}{const r=e=>{const t=n(e.point);t.length&&(e.features=t,i.call(this,e),delete e.features)};return{listener:i,targets:t,delegates:{[e]:r}}}}on(e,t,i){if("function"==typeof t||void 0===i)return super.on(e,t);if("string"==typeof t&&(t=[t]),!this._areTargetsValid(t))return this;const n=this._createDelegatedListener(e,t,i);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[e]=this._delegatedListeners[e]||[],this._delegatedListeners[e].push(n);for(const e in n.delegates)this.on(e,n.delegates[e]);return this}once(e,t,i){if("function"==typeof t||void 0===i)return super.once(e,t);if("string"==typeof t&&(t=[t]),!this._areTargetsValid(t))return this;const n=this._createDelegatedListener(e,t,i);for(const e in n.delegates)this.once(e,n.delegates[e]);return this}off(e,t,i){if("function"==typeof t||void 0===i)return super.off(e,t);if("string"==typeof t&&(t=[t]),!this._areTargetsValid(t))return this;const n=this._delegatedListeners?this._delegatedListeners[e]:void 0;return n&&(e=>{for(let n=0;n{if(n){const r="string"==typeof n?n:n instanceof Error?n.message:n.error;e.w(`Unable to perform style diff: ${r}. Rebuilding the style from scratch.`),this._updateStyle(t,i)}else r&&this._update(!0)},()=>this._postStyleLoadEvent()),this):(this._localIdeographFontFamily=i.localIdeographFontFamily,this._localFontFamily=i.localFontFamily,this._updateStyle(t,i))}_getUIString(e){const t=this._locale[e];if(null==t)throw new Error(`Missing UI string '${e}'`);return t}_updateStyle(t,i){if(this.style&&(this.style.setEventedParent(null),this.style._remove(),this.style=void 0),t){const n=e.h({},i);i&&i.config&&(n.initialConfig=i.config,delete n.config),this.style=new In(this,n).load(t),this.style.setEventedParent(this,{style:this.style})}return this._updateTerrain(),this}_lazyInitEmptyStyle(){this.style||(this.style=new In(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():(e.w("There is no style added to the map."),!1)}_isValidId(t){return null==t?(this.fire(new e.z(new Error("IDs can't be empty."))),!1):!e.dk(t)||(this.fire(new e.z(new Error(`IDs can't contain special symbols: "${t}".`))),!1)}_isTargetValid(e){return"featuresetId"in e?this._isValidId("importId"in e?e.importId:e.featuresetId):"layerId"in e&&this._isValidId(e.layerId)}_areTargetsValid(e){if(Array.isArray(e)){for(const t of e)if(!this._isValidId(t))return!1;return!0}return this._isTargetValid(e)}addSource(e,t){return this._isValidId(e)?(this._lazyInitEmptyStyle(),this.style.addSource(e,t),this._update(!0)):this}isSourceLoaded(e){return!!this._isValidId(e)&&!!this.style&&this.style._isSourceCacheLoaded(e)}areTilesLoaded(){return this.style.areTilesLoaded()}addSourceType(e,t,i){this._lazyInitEmptyStyle(),this.style.addSourceType(e,t,i)}removeSource(e){return this._isValidId(e)?(this.style.removeSource(e),this._updateTerrain(),this._update(!0)):this}getSource(e){return this._isValidId(e)?this.style.getOwnSource(e):null}addImage(t,i,{pixelRatio:n=1,sdf:r=!1,stretchX:s,stretchY:o,content:a}={}){this._lazyInitEmptyStyle();const l=e.I.from(t);if(i instanceof HTMLImageElement||ImageBitmap&&i instanceof ImageBitmap){const{width:t,height:c,data:h}=e.q.getImageData(i);this.style.addImage(l,{data:new e.r({width:t,height:c},h),pixelRatio:n,stretchX:s,stretchY:o,content:a,sdf:r,version:0,usvg:!1})}else if(void 0===i.width||void 0===i.height)this.fire(new e.z(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));else{const{width:c,height:h}=i,d=i;this.style.addImage(l,{data:new e.r({width:c,height:h},new Uint8Array(d.data)),pixelRatio:n,stretchX:s,stretchY:o,content:a,sdf:r,usvg:!1,version:0,userImage:d}),d.onAdd&&d.onAdd(this,t)}}updateImage(t,i){this._lazyInitEmptyStyle();const n=e.I.from(t),r=this.style.getImage(n);if(!r)return void this.fire(new e.z(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const s=i instanceof HTMLImageElement||ImageBitmap&&i instanceof ImageBitmap?e.q.getImageData(i):i,{width:o,height:a,data:l}=s;if(void 0===o||void 0===a)return void this.fire(new e.z(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`")));if(o!==(r.usvg?r.icon.usvg_tree.width:r.data.width)||a!==(r.usvg?r.icon.usvg_tree.height:r.data.height))return void this.fire(new e.z(new Error(`The width and height of the updated image (${o}, ${a})\n must be that same as the previous version of the image\n (${r.data.width}, ${r.data.height})`)));const c=!(i instanceof HTMLImageElement||ImageBitmap&&i instanceof ImageBitmap);let h=!1;r.usvg?(r.data=new e.r({width:o,height:a},new Uint8Array(l)),r.usvg=!1,r.icon=void 0,h=!0):r.data.replace(l,c),this.style.updateImage(n,r,h)}hasImage(t){return t?!!this.style&&!!this.style.getImage(e.I.from(t)):(this.fire(new e.z(new Error("Missing required image id"))),!1)}removeImage(t){this.style.removeImage(e.I.from(t))}loadImage(t,i){e.o(this._requestManager.transformRequest(t,e.R.Image),(t,n)=>{i(t,n instanceof HTMLImageElement?e.q.getImageData(n):n)})}listImages(){return this.style.listImages().map(e=>e.name)}addModel(e,t){this._lazyInitEmptyStyle(),this.style.addModel(e,t)}hasModel(t){return t?this.style.hasModel(t):(this.fire(new e.z(new Error("Missing required model id"))),!1)}removeModel(e){this.style.removeModel(e)}listModels(){return this.style.listModels()}addLayer(e,t){return this._isValidId(e.id)?(this._lazyInitEmptyStyle(),this.style.addLayer(e,t),this._update(!0)):this}getSlot(e){const t=this.getLayer(e);return t&&t.slot||null}setSlot(e,t){return this.style.setSlot(e,t),this.style.mergeLayers(),this._update(!0)}addImport(t,i){return this.style.addImport(t,i).catch(t=>this.fire(new e.z(new Error("Failed to add import",t)))),this}updateImport(e,t){return"string"!=typeof t&&t.id!==e?(this.removeImport(e),this.addImport(t)):(this.style.updateImport(e,t),this._update(!0))}removeImport(e){return this.style.removeImport(e),this}moveImport(e,t){return this.style.moveImport(e,t),this._update(!0)}moveLayer(e,t){return this._isValidId(e)?(this.style.moveLayer(e,t),this._update(!0)):this}removeLayer(e){return this._isValidId(e)?(this.style.removeLayer(e),this._update(!0)):this}getLayer(e){if(!this._isValidId(e))return null;const t=this.style.getOwnLayer(e);return t?"custom"===t.type?t.implementation:t.serialize():void 0}getSlots(){return this.style.getSlots()}setLayerZoomRange(e,t,i){return this._isValidId(e)?(this.style.setLayerZoomRange(e,t,i),this._update(!0)):this}setFilter(e,t,i={}){return this._isValidId(e)?(this.style.setFilter(e,t,i),this._update(!0)):this}getFilter(e){return this._isValidId(e)?this.style.getFilter(e):null}setPaintProperty(e,t,i,n={}){return this._isValidId(e)?(this.style.setPaintProperty(e,t,i,n),this._update(!0)):this}getPaintProperty(e,t){return this._isValidId(e)?this.style.getPaintProperty(e,t):null}setLayoutProperty(e,t,i,n={}){return this._isValidId(e)?(this.style.setLayoutProperty(e,t,i,n),this._update(!0)):this}getLayoutProperty(e,t){return this._isValidId(e)?this.style.getLayoutProperty(e,t):null}getGlyphsUrl(){return this.style.getGlyphsUrl()}setGlyphsUrl(e){return this.style.setGlyphsUrl(e),this._update(!0)}getSchema(e){return this.style.getSchema(e)}setSchema(e,t){return this.style.setSchema(e,t),this._update(!0)}getConfig(e){return this.style.getConfig(e)}setConfig(e,t){return this.style.setConfig(e,t),this._update(!0)}getConfigProperty(e,t){return this.style.getConfigProperty(e,t)}setConfigProperty(e,t,i){return this.style.setConfigProperty(e,t,i),this._update(!0)}getFeaturesetDescriptors(e){return this.style.getFeaturesetDescriptors(e)}setLights(e){if(this._lazyInitEmptyStyle(),e&&1===e.length&&"flat"===e[0].type){const t=e[0];t.properties?this.style.setFlatLight(t.properties,t.id,{}):this.style.setFlatLight({},"flat")}else this.style.setLights(e),this.painter.terrain&&(this.painter.terrain.invalidateRenderCache=!0);return this._update(!0)}getLights(){const e=this.style.getLights()||[];return 0===e.length&&e.push({id:this.style.light.id,type:"flat",properties:this.style.getFlatLight()}),e}setLight(e,t={}){return console.log("The `map.setLight` function is deprecated, prefer using `map.setLights` with `flat` light type instead."),this.setLights([{id:"flat",type:"flat",properties:e}])}getLight(){return console.log("The `map.getLight` function is deprecated, prefer using `map.getLights` instead."),this.style.getFlatLight()}setTerrain(e){return this._lazyInitEmptyStyle(),!e&&this.transform.projection.requiresDraping?this.style.setTerrainForDraping():this.style.setTerrain(e),this._averageElevationLastSampledAt=-1/0,this._update(!0)}getTerrain(){return this.style?this.style.getTerrain():null}setFog(e){return this._lazyInitEmptyStyle(),this.style.setFog(e),this._update(!0)}getFog(){return this.style?this.style.getFog():null}setSnow(e){return this._lazyInitEmptyStyle(),this.style.setSnow(e),this._update(!0)}getSnow(){return this.style?this.style.getSnow():null}setRain(e){return this._lazyInitEmptyStyle(),this.style.setRain(e),this._update(!0)}getRain(){return this.style?this.style.getRain():null}setColorTheme(e){return this._lazyInitEmptyStyle(),this.style.setColorTheme(e),this._update(!0)}setImportColorTheme(e,t){return this._lazyInitEmptyStyle(),this.style.setImportColorTheme(e,t),this._update(!0)}setCamera(e){return this.style.setCamera(e),this._triggerCameraUpdate(e)}_triggerCameraUpdate(e){return this._update(this.transform.setOrthographicProjectionAtLowPitch("orthographic"===e["camera-projection"]))}getCamera(){return this.style.camera}_queryFogOpacity(t){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(e.ci.convert(t),this.transform):0}setFeatureState(e,t){return e.source&&!this._isValidId(e.source)?this:(this.style.setFeatureState(e,t),this._update())}removeFeatureState(e,t){return e.source&&!this._isValidId(e.source)?this:(this.style.removeFeatureState(e,t),this._update())}getFeatureState(e){return e.source&&!this._isValidId(e.source)?null:this.style.getFeatureState(e)}_selectIndoorFloor(e){this.indoor.selectFloor(e)}_addIndoorControl(){this._indoorControl||(this._indoorControl=new wl),this.addControl(this._indoorControl,"right")}_removeIndoorControl(){this._indoorControl&&this.removeControl(this._indoorControl)}_updateContainerDimensions(){if(!this._container)return;const e=this._container.getBoundingClientRect().width||400,t=this._container.getBoundingClientRect().height||300;let i,n,r,s=this._container;for(;s&&(!n||!r);){const e=window.getComputedStyle(s).transform;e&&"none"!==e&&(i=e.match(/matrix.*\((.+)\)/)[1].split(", "),i[0]&&"0"!==i[0]&&"1"!==i[0]&&(n=i[0]),i[3]&&"0"!==i[3]&&"1"!==i[3]&&(r=i[3])),s=s.parentElement}this._containerWidth=n?Math.abs(e/n):e,this._containerHeight=r?Math.abs(t/r):t}_detectMissingCSS(){"rgb(250, 128, 114)"!==window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")&&e.w("This page appears to be missing CSS declarations for Mapbox GL JS, which may cause the map to display incorrectly. Please ensure your page includes mapbox-gl.css, as described in https://www.mapbox.com/mapbox-gl-js/api/.")}_setupContainer(){const e=this._container;e.classList.add("mapboxgl-map"),(this._missingCSSCanary=l("div","mapboxgl-canary",e)).style.visibility="hidden",this._detectMissingCSS();const t=this._canvasContainer=l("div","mapboxgl-canvas-container",e);this._canvas=l("canvas","mapboxgl-canvas",t),this._interactive&&(t.classList.add("mapboxgl-interactive"),this._canvas.setAttribute("tabindex","0")),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region"),this._updateContainerDimensions(),this._resizeCanvas(this._containerWidth,this._containerHeight);const i=this._controlContainer=l("div","mapboxgl-control-container",e),n=this._controlPositions={};["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"].forEach(e=>{n[e]=l("div",`mapboxgl-ctrl-${e}`,i)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(t,i){const n=e.q.devicePixelRatio||1;this._canvas.width=n*Math.ceil(t),this._canvas.height=n*Math.ceil(i),this._canvas.style.width=`${t}px`,this._canvas.style.height=`${i}px`}_addMarker(e){this._markers.push(e)}_removeMarker(e){const t=this._markers.indexOf(e);-1!==t&&this._markers.splice(t,1)}_addPopup(e){this._popups.push(e)}_removePopup(e){const t=this._popups.indexOf(e);-1!==t&&this._popups.splice(t,1)}_setupPainter(){const t=e.h({},a.supported.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),i=this._canvas.getContext("webgl2",t);i?(H(i,!0),this.painter=new ya(i,this._contextCreateOptions,this.transform,this._scaleFactor,this._tp,this._worldview),this.on("data",e=>{"source"===e.dataType&&this.painter.setTileLoadedFlag(!0)}),e.l.testSupport(i)):this.fire(new e.z(new Error("Failed to initialize WebGL")))}_contextLost(t){t.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new e.A("webglcontextlost",{originalEvent:t}))}_contextRestored(t){this._setupPainter(),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight)),this._updateTerrain(),this.style&&(this.style.clearLayers(),this.style.imageManager.destroyAtlasTextures(),this.style.reloadModels(),this.style.clearSources()),this._update(),this.fire(new e.A("webglcontextrestored",{originalEvent:t}))}_onMapScroll(e){if(e.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}idle(){return!this.isMoving()&&this.loaded()}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}frameReady(){return this.loaded()&&!this._placementDirty}_update(e){return this.style?(this._styleDirty=this._styleDirty||e,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(e){return this._update(),this._renderTaskQueue.add(e)}_cancelRenderFrame(e){this._renderTaskQueue.remove(e)}_requestDomTask(e){!this.loaded()||this.loaded()&&!this.isMoving()?e():this._domRenderTaskQueue.add(e)}_render(t){let r;this.fire(new e.A("renderstart")),++this._frameId;const s=this.painter.context.extTimerQuery,o=e.q.now(),a=this.painter.context.gl;if(this.listens("gpu-timing-frame")&&(r=a.createQuery(),a.beginQuery(s.TIME_ELAPSED_EXT,r)),this.painter.context.setDirty(),this.painter.setBaseState(),(this.isMoving()||this.isRotating()||this.isZooming())&&(this._interactionRange[0]=Math.min(this._interactionRange[0],performance.now()),this._interactionRange[1]=Math.max(this._interactionRange[1],performance.now())),this._renderTaskQueue.run(t),this._domRenderTaskQueue.run(t),this._removed)return;this._updateProjectionTransition();const l=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;const t=this.transform.zoom,i=this.transform.pitch,n=e.q.now(),r=new e.aa(t,{now:n,fadeDuration:l,pitch:i,transition:this.style.transition,worldview:this._worldview});this.style.update(r)}this.style&&this.style.hasFogTransition()&&(this.style._markersNeedUpdate=!0,this._sourcesDirty=!0);let c=!1;this.style&&this._sourcesDirty?(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),c=this._updateAverageElevation(o),this.style.updateSources(this.transform),this.style.updateImageProviders(),this.isMoving()||this._forceMarkerAndPopupUpdate()):c=this._updateAverageElevation(o);const h=this.style&&this.style._updatePlacement(this.painter,this.painter.transform,this.showCollisionBoxes,l,this._crossSourceCollisions,this.painter.replacementSource,this._scaleFactorChanged);if(this._scaleFactorChanged&&(this._scaleFactorChanged=!1),h&&(this._placementDirty=h.needsRerender),this.style&&this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showParseStatus:this.showParseStatus,wireframe:{terrain:this.showTerrainWireframe,layers2D:this.showLayers2DWireframe,layers3D:this.showLayers3DWireframe},showOverdrawInspector:this._showOverdrawInspector,showQueryGeometry:!!this._showQueryGeometry,showTileAABBs:this.showTileAABBs,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:l,isInitialLoad:this._isInitialLoad,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer"),gpuTimingDeferredRender:!!this.listens("gpu-timing-deferred-render"),speedIndexTiming:this.speedIndexTiming}),this.fire(new e.A("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,n.mark(i.load),this.fire(new e.A("load"))),this.style&&this.style.hasTransitions()&&(this._styleDirty=!0),this.style&&(this.style.snow||this.style.rain)&&(this._styleDirty=!0),this.style&&this.style.imageManager.hasPatternsInFlight()&&(this._styleDirty=!0),this.style&&!this.style.modelManager.isLoaded()&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),r){const t=e.q.now()-o;a.endQuery(s.TIME_ELAPSED_EXT),setTimeout(()=>{const i=a.getQueryParameter(r,a.QUERY_RESULT)/1e6;a.deleteQuery(r),this.fire(new e.A("gpu-timing-frame",{cpuTime:t,gpuTime:i}))},50)}if(this.listens("gpu-timing-layer")){const t=this.painter.collectGpuTimers();setTimeout(()=>{const i=this.painter.queryGpuTimers(t);this.fire(new e.A("gpu-timing-layer",{layerTimes:i}))},50)}if(this.listens("gpu-timing-deferred-render")){const t=this.painter.collectDeferredRenderGpuQueries();setTimeout(()=>{const i=this.painter.queryGpuTimeDeferredRender(t);this.fire(new e.A("gpu-timing-deferred-render",{gpuTime:i}))},50)}const d=this._sourcesDirty||this._styleDirty||this._placementDirty||c;if(d||this._repaint)this.triggerRepaint();else{const t=this.idle();if(t&&(c=this._updateAverageElevation(o,!0)),c)this.triggerRepaint();else if(this._triggerFrame(!1),t&&(this.fire(new e.A("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){const t=this._calculateSpeedIndex();this.fire(new e.A("speedindexcompleted",{speedIndex:t})),this.speedIndexTiming=!1}}!this._loaded||this._fullyLoaded||d||(this._fullyLoaded=!0,n.mark(i.fullLoad),this._performanceMetricsCollection&&F(this._requestManager._customAccessToken,{width:this.painter.width,height:this.painter.height,interactionRange:this._interactionRange,visibilityHidden:this._visibilityHidden,terrainEnabled:!!this.painter.style.getTerrain(),fogEnabled:!!this.painter.style.getFog(),projection:this.getProjection().name,zoom:this.transform.zoom,renderer:this.painter.context.renderer,vendor:this.painter.context.vendor}),this._authenticate())}_forceMarkerAndPopupUpdate(e){for(const t of this._markers)e&&!this.getRenderWorldCopies()&&(t._lngLat=t._lngLat.wrap()),t._update();for(const t of this._popups)!e||this.getRenderWorldCopies()||t._trackPointer||(t._lngLat=t._lngLat.wrap()),t._update()}_updateAverageElevation(e,t=!1){const i=e=>(this.transform.averageElevation=e,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return 0!==this.transform.averageElevation&&i(0);const n=this.transform.elevation&&this.transform.elevation.exaggeration()!==this._averageElevationExaggeration;if(n||(t||e-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(e)){const t=this.transform.averageElevation;let r=this.transform.sampleAverageElevation();null!=this.transform.elevation&&(this._averageElevationExaggeration=this.transform.elevation.exaggeration()),isNaN(r)?r=0:this._averageElevationLastSampledAt=e;const s=Math.abs(t-r);if(s>1){if(this._isInitialLoad||n)return this._averageElevation.jumpTo(r),i(r);this._averageElevation.easeTo(r,e,300)}else if(s>1e-4)return this._averageElevation.jumpTo(r),i(r)}return!!this._averageElevation.isEasing(e)&&i(this._averageElevation.getValue(e))}_authenticate(){Y(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,t=>{if(t&&(t.message===w||401===t.status)){const t=this.painter.context.gl;H(t,!1),this._logoControl instanceof bl&&this._logoControl._updateLogo(),t&&t.clear(t.DEPTH_BUFFER_BIT|t.COLOR_BUFFER_BIT|t.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new e.z(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/")))}}),P(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,()=>{})}_postStyleLoadEvent(){this.style.globalId&&O(this._requestManager._customAccessToken,{map:this,style:this.style.globalId,importedStyles:this.style.getImportGlobalIds()})}_updateTerrain(){const e=this._isDragging();this.painter.updateTerrain(this.style,e)}_calculateSpeedIndex(){const e=this.painter.canvasCopy(),t=this.painter.getCanvasCopiesAndTimestamps();t.timeStamps.push(performance.now());const i=this.painter.context.gl,n=i.createFramebuffer();function r(e){i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,e,0);const t=new Uint8Array(i.drawingBufferWidth*i.drawingBufferHeight*4);return i.readPixels(0,0,i.drawingBufferWidth,i.drawingBufferHeight,i.RGBA,i.UNSIGNED_BYTE,t),t}return i.bindFramebuffer(i.FRAMEBUFFER,n),this._canvasPixelComparison(r(e),t.canvasCopies.map(r),t.timeStamps)}_canvasPixelComparison(e,t,i){let n=i[1]-i[0];const r=e.length/4;for(let s=0;s{const t=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,t&&this._render(e)}))}_preloadTiles(t){const i=this.style?this.style.getSourceCaches():[];return e.bt(i,(e,i)=>e._preloadTiles(t,i),()=>{this.triggerRepaint()}),this}_onWindowOnline(){this._update()}_onWindowResize(e){this._trackResize&&this.resize({originalEvent:e})._update()}_onVisibilityChange(){"hidden"===document.visibilityState&&this._visibilityHidden++}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(e){this._showTileBoundaries!==e&&(this._showTileBoundaries=e,this._tp.refreshUI(),this._update())}get showParseStatus(){return!!this._showParseStatus}set showParseStatus(e){this._showParseStatus!==e&&(this._showParseStatus=e,this._tp.refreshUI(),this._update())}get showTerrainWireframe(){return!!this._showTerrainWireframe}set showTerrainWireframe(e){this._showTerrainWireframe!==e&&(this._showTerrainWireframe=e,this._tp.refreshUI(),this._update())}get showLayers2DWireframe(){return!!this._showLayers2DWireframe}set showLayers2DWireframe(e){this._showLayers2DWireframe!==e&&(this._showLayers2DWireframe=e,this._tp.refreshUI(),this._update())}get showLayers3DWireframe(){return!!this._showLayers3DWireframe}set showLayers3DWireframe(e){this._showLayers3DWireframe!==e&&(this._showLayers3DWireframe=e,this._tp.refreshUI(),this._update())}get speedIndexTiming(){return!!this._speedIndexTiming}set speedIndexTiming(e){this._speedIndexTiming!==e&&(this._speedIndexTiming=e,this._update())}get showPadding(){return!!this._showPadding}set showPadding(e){this._showPadding!==e&&(this._showPadding=e,this._tp.refreshUI(),this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(e){this._showCollisionBoxes!==e&&(this._showCollisionBoxes=e,this._tp.refreshUI(),e?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(e){this._showOverdrawInspector!==e&&(this._showOverdrawInspector=e,this._tp.refreshUI(),this._update())}get repaint(){return!!this._repaint}set repaint(e){this._repaint!==e&&(this._repaint=e,this._tp.refreshUI(),this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(e){this._vertices=e,this._update()}get showTileAABBs(){return!!this._showTileAABBs}set showTileAABBs(e){this._showTileAABBs!==e&&(this._showTileAABBs=e,this._tp.refreshUI(),e&&this._update())}_setCacheLimits(t,i){e.eV(t,i)}get version(){return t}},NavigationControl:class{constructor(t={}){this.options=e.h({},Ll,t),this._container=l("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",e=>e.preventDefault()),this.options.showZoom&&(e.aV(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",e=>{this._map&&this._map.zoomIn({},{originalEvent:e})}),l("span","mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("mapboxgl-ctrl-zoom-out",e=>{this._map&&this._map.zoomOut({},{originalEvent:e})}),l("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(e.aV(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",e=>{const t=this._map;t&&(this.options.visualizePitch?t.resetNorthPitch({},{originalEvent:e}):t.resetNorth({},{originalEvent:e}))}),this._compassIcon=l("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const e=this._map;if(!e)return;const t=e.getZoom(),i=t===e.getMaxZoom(),n=t===e.getMinZoom();this._zoomInButton.disabled=i,this._zoomOutButton.disabled=n,this._zoomInButton.setAttribute("aria-disabled",i.toString()),this._zoomOutButton.setAttribute("aria-disabled",n.toString())}_rotateCompassArrow(){const e=this._map;if(!e)return;const t=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(e.transform.pitch*(Math.PI/180)),.5)}) rotateX(${e.transform.pitch}deg) rotateZ(${e.transform.angle*(180/Math.PI)}deg)`:`rotate(${e.transform.angle*(180/Math.PI)}deg)`;e._requestDomTask(()=>{this._compassIcon&&(this._compassIcon.style.transform=t)})}onAdd(e){return this._map=e,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),e.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&e.on("pitch",this._rotateCompassArrow),e.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new El(e,this._compass,this.options.visualizePitch)),this._container}onRemove(){const e=this._map;e&&(this._container.remove(),this.options.showZoom&&e.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&e.off("pitch",this._rotateCompassArrow),e.off("rotate",this._rotateCompassArrow),this._handler&&this._handler.off(),this._handler=void 0),this._map=void 0)}_createButton(e,t){const i=l("button",e,this._container);return i.type="button",i.addEventListener("click",t),i}_setButtonTitle(e,t){if(!this._map)return;const i=this._map._getUIString(`NavigationControl.${t}`);e.setAttribute("aria-label",i),e.firstElementChild&&e.firstElementChild.setAttribute("title",i)}},GeolocateControl:class extends e.E{constructor(t={}){super();const i=navigator.geolocation;this.options=e.h({geolocation:i},zl,t),e.aV(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation","_onDeviceOrientation"],this),this._updateMarkerRotationThrottled=va(this._updateMarkerRotation,20),this._numberOfWatches=0}onAdd(e){return this._map=e,this._container=l("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkGeolocationSupport(this._setupUI),this._container}onRemove(){void 0!==this._geolocationWatchID&&(this.options.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),this._container.remove(),this._map.off("zoom",this._onZoom),this._map=void 0,this._numberOfWatches=0,this._noTimeout=!1}_checkGeolocationSupport(e){const t=(t=!!this.options.geolocation)=>{this._supportsGeolocation=t,e(t)};void 0!==this._supportsGeolocation?e(this._supportsGeolocation):void 0!==navigator.permissions?navigator.permissions.query({name:"geolocation"}).then(e=>t("denied"!==e.state)).catch(()=>t()):t()}_isOutOfMapMaxBounds(e){const t=this._map.getMaxBounds(),i=e.coords;return!!t&&(i.longitudet.getEast()||i.latitudet.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting")}}_onSuccess(t){if(this._map){if(this._isOutOfMapMaxBounds(t))return this._setErrorState(),this.fire(new e.A("outofmaxbounds",t)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=t,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background")}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(t),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(t),this.options.showUserLocation&&this._userLocationDotMarker.removeClassName("mapboxgl-user-location-dot-stale"),this.fire(new e.A("geolocate",t)),this._finish()}}_updateCamera(t){const i=new e.ci(t.coords.longitude,t.coords.latitude),n=t.coords.accuracy,r=this._map.getBearing(),s=e.h({bearing:r},this.options.fitBoundsOptions);this._map.fitBounds(i.toBounds(n),s,{geolocateSource:!0})}_updateMarker(t){if(t){const i=new e.ci(t.coords.longitude,t.coords.latitude);this._accuracyCircleMarker.setLngLat(i).addTo(this._map),this._userLocationDotMarker.setLngLat(i).addTo(this._map),this._accuracy=t.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const t=this._map.transform,i=e.cb(1,t._center.lat)*t.worldSize,n=Math.ceil(2*this._accuracy*i);this._circleElement.style.width=`${n}px`,this._circleElement.style.height=`${n}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_updateMarkerRotation(){this._userLocationDotMarker&&"number"==typeof this._heading?(this._userLocationDotMarker.setRotation(this._heading),this._userLocationDotMarker.addClassName("mapboxgl-user-location-show-heading")):(this._userLocationDotMarker.removeClassName("mapboxgl-user-location-show-heading"),this._userLocationDotMarker.setRotation(0))}_onError(t){if(this._map){if(this.options.trackUserLocation)if(1===t.code){this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const e=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.setAttribute("aria-label",e),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",e),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===t.code&&this._noTimeout)return;this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._userLocationDotMarker.addClassName("mapboxgl-user-location-dot-stale"),this.fire(new e.A("error",t)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(t){if(void 0!==this._map){if(this._container.addEventListener("contextmenu",e=>e.preventDefault()),this._geolocateButton=l("button","mapboxgl-ctrl-geolocate",this._container),l("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",!1===t){e.w("Geolocation support is not available so the GeolocateControl will be disabled.");const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.setAttribute("aria-label",t),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",t)}else{const e=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.setAttribute("aria-label",e),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",e)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=l("div","mapboxgl-user-location"),this._dotElement.appendChild(l("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(l("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new Ol({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=l("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Ol({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",t=>{t.geolocateSource||"ACTIVE_LOCK"!==this._watchState||t.originalEvent&&"resize"===t.originalEvent.type||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this.fire(new e.A("trackuserlocationend")))})}}_onDeviceOrientation(e){this._userLocationDotMarker&&(e.webkitCompassHeading?this._heading=e.webkitCompassHeading:!0===e.absolute&&(this._heading=-1*e.alpha),this._updateMarkerRotationThrottled())}trigger(){if(!this._setup)return e.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new e.A("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":this._numberOfWatches--,this._noTimeout=!1,this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this.fire(new e.A("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new e.A("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error")}if("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){let e;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),this._numberOfWatches++,this._numberOfWatches>1?(e={maximumAge:6e5,timeout:0},this._noTimeout=!0):(e=this.options.positionOptions,this._noTimeout=!1),this._geolocationWatchID=this.options.geolocation.watchPosition(this._onSuccess,this._onError,e),this.options.showUserHeading&&this._addDeviceOrientationListener()}}else this.options.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=window.setTimeout(this._finish,1e4);return!0}_addDeviceOrientationListener(){const e=()=>{"ondeviceorientationabsolute"in window?window.addEventListener("deviceorientationabsolute",this._onDeviceOrientation):window.addEventListener("deviceorientation",this._onDeviceOrientation)};"undefined"!=typeof DeviceMotionEvent&&"function"==typeof DeviceMotionEvent.requestPermission?DeviceOrientationEvent.requestPermission().then(t=>{"granted"===t&&e()}).catch(console.error):e()}_clearWatch(){this.options.geolocation.clearWatch(this._geolocationWatchID),window.removeEventListener("deviceorientation",this._onDeviceOrientation),window.removeEventListener("deviceorientationabsolute",this._onDeviceOrientation),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:xl,ScaleControl:class{constructor(t={}){this.options=e.h({},Fl,t),this._isNumberFormatSupported=function(){try{return new Intl.NumberFormat("en",{style:"unit",unitDisplay:"short",unit:"meter"}),!0}catch(e){return!1}}(),e.aV(["_update","_setScale","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_update(){const e=this.options.maxWidth||100,t=this._map,i=t._containerHeight/2,n=t._containerWidth/2-e/2,r=t.unproject([n,i]),s=t.unproject([n+e,i]),o=r.distanceTo(s);if("imperial"===this.options.unit){const t=3.2808*o;t>5280?this._setScale(e,t/5280,"mile"):this._setScale(e,t,"foot")}else"nautical"===this.options.unit?this._setScale(e,o/1852,"nautical-mile"):o>=1e3?this._setScale(e,o/1e3,"kilometer"):this._setScale(e,o,"meter")}_setScale(e,t,i){this._map._requestDomTask(()=>{const n=function(e){const t=Math.pow(10,`${Math.floor(e)}`.length-1);let i=e/t;return i=i>=10?10:i>=5?5:i>=3?3:i>=2?2:i>=1?1:function(e){const t=Math.pow(10,Math.ceil(-Math.log(e)/Math.LN10));return Math.round(e*t)/t}(i),t*i}(t),r=n/t;this._container.innerHTML=this._isNumberFormatSupported&&"nautical-mile"!==i?new Intl.NumberFormat(this._language,{style:"unit",unitDisplay:"short",unit:i}).format(n):`${n} ${Nl[i]}`,this._container.style.width=e*r+"px"})}onAdd(e){return this._map=e,this._language=e.getLanguage(),this._container=l("div","mapboxgl-ctrl mapboxgl-ctrl-scale",e.getContainer()),this._container.dir="auto",this._map.on("move",this._update),this._update(),this._container}onRemove(){this._container.remove(),this._map.off("move",this._update),this._map=void 0}_setLanguage(e){this._language=e,this._update()}setUnit(e){this.options.unit=e,this._update()}},FullscreenControl:class{constructor(t={}){this._fullscreen=!1,t&&t.container&&(t.container instanceof HTMLElement?this._container=t.container:e.w("Full screen control 'container' must be a DOM element.")),e.aV(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in document&&(this._fullscreenchange="webkitfullscreenchange")}onAdd(t){return this._map=t,this._container||(this._container=this._map.getContainer()),this._controlContainer=l("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",e.w("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!(!document.fullscreenEnabled&&!document.webkitFullscreenEnabled)}_setupUI(){const e=this._fullscreenButton=l("button","mapboxgl-ctrl-fullscreen",this._controlContainer);l("span","mapboxgl-ctrl-icon",e).setAttribute("aria-hidden","true"),e.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const e=this._getTitle();this._fullscreenButton.setAttribute("aria-label",e),this._fullscreenButton.firstElementChild&&this._fullscreenButton.firstElementChild.setAttribute("title",e)}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(document.fullscreenElement||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()?document.exitFullscreen?document.exitFullscreen():document.webkitCancelFullScreen&&document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},IndoorControl:wl,Popup:class extends e.E{constructor(t){super(),this.options=e.h(Object.create(Yl),t),this._altitude=this.options.altitude,e.aV(["_update","_onClose","remove","_onMouseEvent"],this),this._classList=new Set(t&&t.className?t.className.trim().split(/\s+/):[])}addTo(t){return this._map&&this.remove(),this._map=t,this.options.closeOnClick&&t.on("preclick",this._onClose),this.options.closeOnMove&&t.on("move",this._onClose),t.on("remove",this.remove),this._update(),t._addPopup(this),this._focusFirstElement(),this._trackPointer?(t.on("mousemove",this._onMouseEvent),t.on("mouseup",this._onMouseEvent),t._canvasContainer.classList.add("mapboxgl-track-pointer")):t.on("move",this._update),this.fire(new e.A("open")),this}isOpen(){return!!this._map}remove(){this._content&&this._content.remove(),this._container&&(this._container.remove(),this._container=void 0);const t=this._map;return t&&(t.off("move",this._update),t.off("move",this._onClose),t.off("preclick",this._onClose),t.off("click",this._onClose),t.off("remove",this.remove),t.off("mousemove",this._onMouseEvent),t.off("mouseup",this._onMouseEvent),t.off("drag",this._onMouseEvent),t._canvasContainer&&t._canvasContainer.classList.remove("mapboxgl-track-pointer"),t._removePopup(this),this._map=void 0),this.fire(new e.A("close")),this}getLngLat(){return this._lngLat}setLngLat(t){this._lngLat=e.ci.convert(t),this._pos=null,this._trackPointer=!1,this._update();const i=this._map;return i&&(i.on("move",this._update),i.off("mousemove",this._onMouseEvent),i._canvasContainer.classList.remove("mapboxgl-track-pointer")),this}getAltitude(){return this._altitude}setAltitude(e){return this._altitude=e,this._update(),this}trackPointer(){this._trackPointer=!0,this._pos=null,this._update();const e=this._map;return e&&(e.off("move",this._update),e.on("mousemove",this._onMouseEvent),e.on("drag",this._onMouseEvent),e._canvasContainer.classList.add("mapboxgl-track-pointer")),this}getElement(){return this._container}setText(e){return this.setDOMContent(document.createTextNode(e))}setHTML(e){const t=document.createDocumentFragment(),i=document.createElement("body");let n;for(i.innerHTML=e;n=i.firstChild,n;)t.appendChild(n);return this.setDOMContent(t)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(e){return this.options.maxWidth=e,this._update(),this}setDOMContent(e){let t=this._content;if(t)for(;t.hasChildNodes();)t.firstChild&&t.removeChild(t.firstChild);else t=this._content=l("div","mapboxgl-popup-content",this._container||void 0);if(t.appendChild(e),this.options.closeButton){const e=this._closeButton=l("button","mapboxgl-popup-close-button",t);e.type="button",e.setAttribute("aria-label","Close popup"),e.innerHTML='',e.addEventListener("click",this._onClose)}return this._update(),this._focusFirstElement(),this}addClassName(e){return this._classList.add(e),this._updateClassList(),this}removeClassName(e){return this._classList.delete(e),this._updateClassList(),this}setOffset(e){return this.options.offset=e,this._update(),this}toggleClassName(e){let t;return this._classList.delete(e)?t=!1:(this._classList.add(e),t=!0),this._updateClassList(),t}_onMouseEvent(e){this._update(e.point)}_getAnchor(e){if(this.options.anchor)return this.options.anchor;const t=this._map,i=this._container,n=this._pos;if(!t||!i||!n)return"bottom";const r=i.offsetWidth,s=i.offsetHeight,o=n.xt.transform.width-r/2;if(n.y+et.transform.height-s){if(o)return"bottom-left";if(a)return"bottom-right"}return o?"left":a?"right":"bottom"}_updateClassList(){const e=this._container;if(!e)return;const t=[...this._classList];t.push("mapboxgl-popup"),this._anchor&&t.push(`mapboxgl-popup-anchor-${this._anchor}`),this._trackPointer&&t.push("mapboxgl-popup-track-pointer"),e.className=t.join(" ")}_update(t){const i=this._map,n=this._content;if(!i||!this._lngLat&&!this._trackPointer||!n)return;let r=this._container;if(r||(r=this._container=l("div","mapboxgl-popup",i.getContainer()),this._tip=l("div","mapboxgl-popup-tip",r),r.appendChild(n)),this.options.maxWidth&&r.style.maxWidth!==this.options.maxWidth&&(r.style.maxWidth=this.options.maxWidth),i.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=Il(this._lngLat,this._pos,i.transform)),!this._trackPointer||t){const n=this._pos=this._trackPointer&&t instanceof e.P?t:i.project(this._lngLat,this._altitude),r=Hl(this.options.offset),s=this._anchor=this._getAnchor(r.y),o=Hl(this.options.offset,s),a=n.add(o).round();i._requestDomTask(()=>{this._container&&s&&(this._container.style.transform=`${Pl[s]} translate(${a.x}px,${a.y}px)`)})}if(!this._marker&&i._showingGlobe()){const t=e.eW(i.transform,this._lngLat)?0:1;this._setOpacity(t)}this._updateClassList()}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const e=this._container.querySelector(Bl);e&&e.focus()}_onClose(){this.remove()}_setOpacity(e){this._container&&(this._container.style.opacity=`${e}`),this._content&&(this._content.style.pointerEvents=e?"auto":"none")}},Marker:Ol,Style:In,LngLat:e.ci,LngLatBounds:e.aG,Point:e.P,MercatorCoordinate:e.ac,FreeCameraOptions:Xi,Evented:e.E,config:e.e,prewarm:e.e_,clearPrewarmedResources:e.eZ,get accessToken(){return e.e.ACCESS_TOKEN},set accessToken(t){e.e.ACCESS_TOKEN=t},get baseApiUrl(){return e.e.API_URL},set baseApiUrl(t){e.e.API_URL=t},get workerCount(){return e.f7.workerCount},set workerCount(t){e.f7.workerCount=t},get maxParallelImageRequests(){return e.e.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(t){e.e.MAX_PARALLEL_IMAGE_REQUESTS=t},clearStorage(t){e.f6(t)},get workerUrl(){return e.f5.workerUrl},set workerUrl(t){e.f5.workerUrl=t},get workerClass(){return e.f5.workerClass},set workerClass(t){e.f5.workerClass=t},get workerParams(){return e.f5.workerParams},set workerParams(t){e.f5.workerParams=t},get dracoUrl(){return e.f4()},set dracoUrl(t){e.f3(t)},get meshoptUrl(){return e.f2()},set meshoptUrl(t){e.f1(t)},setNow:e.q.setNow,restoreNow:e.q.restoreNow};return jl}),i}()},844:(e,t,i)=>{"use strict";function n(e){var t=e.reduce(function(e,t){var i=e[t.name];return e[t.name]=i?Object.assign({},i,t,{options:Object.assign({},i.options,t.options),data:Object.assign({},i.data,t.data)}):t,e},{});return Object.keys(t).map(function(e){return t[e]})}i.d(t,{A:()=>n})},1007:(e,t,i)=>{"use strict";function n(e,t){return t.reduce(function(t,i){return t[i]=e,t},{})}i.d(t,{A:()=>n})},1011:function(e,t,i){!function(e){"use strict";e.defineLocale("sv",{months:"januari_februari_mars_april_maj_juni_juli_augusti_september_oktober_november_december".split("_"),monthsShort:"jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec".split("_"),weekdays:"söndag_måndag_tisdag_onsdag_torsdag_fredag_lördag".split("_"),weekdaysShort:"sön_mån_tis_ons_tor_fre_lör".split("_"),weekdaysMin:"sö_må_ti_on_to_fr_lö".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY-MM-DD",LL:"D MMMM YYYY",LLL:"D MMMM YYYY [kl.] HH:mm",LLLL:"dddd D MMMM YYYY [kl.] HH:mm",lll:"D MMM YYYY HH:mm",llll:"ddd D MMM YYYY HH:mm"},calendar:{sameDay:"[Idag] LT",nextDay:"[Imorgon] LT",lastDay:"[Igår] LT",nextWeek:"[På] dddd LT",lastWeek:"[I] dddd[s] LT",sameElse:"L"},relativeTime:{future:"om %s",past:"för %s sedan",s:"några sekunder",ss:"%d sekunder",m:"en minut",mm:"%d minuter",h:"en timme",hh:"%d timmar",d:"en dag",dd:"%d dagar",M:"en månad",MM:"%d månader",y:"ett år",yy:"%d år"},dayOfMonthOrdinalParse:/\d{1,2}(\:e|\:a)/,ordinal:function(e){var t=e%10;return e+(1==~~(e%100/10)?":e":1===t||2===t?":a":":e")},week:{dow:1,doy:4}})}(i(5093))},1025:function(e,t,i){!function(e){"use strict";var t={1:"௧",2:"௨",3:"௩",4:"௪",5:"௫",6:"௬",7:"௭",8:"௮",9:"௯",0:"௦"},i={"௧":"1","௨":"2","௩":"3","௪":"4","௫":"5","௬":"6","௭":"7","௮":"8","௯":"9","௦":"0"};e.defineLocale("ta",{months:"ஜனவரி_பிப்ரவரி_மார்ச்_ஏப்ரல்_மே_ஜூன்_ஜூலை_ஆகஸ்ட்_செப்டெம்பர்_அக்டோபர்_நவம்பர்_டிசம்பர்".split("_"),monthsShort:"ஜனவரி_பிப்ரவரி_மார்ச்_ஏப்ரல்_மே_ஜூன்_ஜூலை_ஆகஸ்ட்_செப்டெம்பர்_அக்டோபர்_நவம்பர்_டிசம்பர்".split("_"),weekdays:"ஞாயிற்றுக்கிழமை_திங்கட்கிழமை_செவ்வாய்கிழமை_புதன்கிழமை_வியாழக்கிழமை_வெள்ளிக்கிழமை_சனிக்கிழமை".split("_"),weekdaysShort:"ஞாயிறு_திங்கள்_செவ்வாய்_புதன்_வியாழன்_வெள்ளி_சனி".split("_"),weekdaysMin:"ஞா_தி_செ_பு_வி_வெ_ச".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, HH:mm",LLLL:"dddd, D MMMM YYYY, HH:mm"},calendar:{sameDay:"[இன்று] LT",nextDay:"[நாளை] LT",nextWeek:"dddd, LT",lastDay:"[நேற்று] LT",lastWeek:"[கடந்த வாரம்] dddd, LT",sameElse:"L"},relativeTime:{future:"%s இல்",past:"%s முன்",s:"ஒரு சில விநாடிகள்",ss:"%d விநாடிகள்",m:"ஒரு நிமிடம்",mm:"%d நிமிடங்கள்",h:"ஒரு மணி நேரம்",hh:"%d மணி நேரம்",d:"ஒரு நாள்",dd:"%d நாட்கள்",M:"ஒரு மாதம்",MM:"%d மாதங்கள்",y:"ஒரு வருடம்",yy:"%d ஆண்டுகள்"},dayOfMonthOrdinalParse:/\d{1,2}வது/,ordinal:function(e){return e+"வது"},preparse:function(e){return e.replace(/[௧௨௩௪௫௬௭௮௯௦]/g,function(e){return i[e]})},postformat:function(e){return e.replace(/\d/g,function(e){return t[e]})},meridiemParse:/யாமம்|வைகறை|காலை|நண்பகல்|எற்பாடு|மாலை/,meridiem:function(e,t,i){return e<2?" யாமம்":e<6?" வைகறை":e<10?" காலை":e<14?" நண்பகல்":e<18?" எற்பாடு":e<22?" மாலை":" யாமம்"},meridiemHour:function(e,t){return 12===e&&(e=0),"யாமம்"===t?e<2?e:e+12:"வைகறை"===t||"காலை"===t||"நண்பகல்"===t&&e>=10?e:e+12},week:{dow:0,doy:6}})}(i(5093))},1052:function(e,t,i){!function(e){"use strict";var t="pagh_wa’_cha’_wej_loS_vagh_jav_Soch_chorgh_Hut".split("_");function i(e,i,n,r){var s=function(e){var i=Math.floor(e%1e3/100),n=Math.floor(e%100/10),r=e%10,s="";return i>0&&(s+=t[i]+"vatlh"),n>0&&(s+=(""!==s?" ":"")+t[n]+"maH"),r>0&&(s+=(""!==s?" ":"")+t[r]),""===s?"pagh":s}(e);switch(n){case"ss":return s+" lup";case"mm":return s+" tup";case"hh":return s+" rep";case"dd":return s+" jaj";case"MM":return s+" jar";case"yy":return s+" DIS"}}e.defineLocale("tlh",{months:"tera’ jar wa’_tera’ jar cha’_tera’ jar wej_tera’ jar loS_tera’ jar vagh_tera’ jar jav_tera’ jar Soch_tera’ jar chorgh_tera’ jar Hut_tera’ jar wa’maH_tera’ jar wa’maH wa’_tera’ jar wa’maH cha’".split("_"),monthsShort:"jar wa’_jar cha’_jar wej_jar loS_jar vagh_jar jav_jar Soch_jar chorgh_jar Hut_jar wa’maH_jar wa’maH wa’_jar wa’maH cha’".split("_"),monthsParseExact:!0,weekdays:"lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj".split("_"),weekdaysShort:"lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj".split("_"),weekdaysMin:"lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[DaHjaj] LT",nextDay:"[wa’leS] LT",nextWeek:"LLL",lastDay:"[wa’Hu’] LT",lastWeek:"LLL",sameElse:"L"},relativeTime:{future:function(e){var t=e;return-1!==e.indexOf("jaj")?t.slice(0,-3)+"leS":-1!==e.indexOf("jar")?t.slice(0,-3)+"waQ":-1!==e.indexOf("DIS")?t.slice(0,-3)+"nem":t+" pIq"},past:function(e){var t=e;return-1!==e.indexOf("jaj")?t.slice(0,-3)+"Hu’":-1!==e.indexOf("jar")?t.slice(0,-3)+"wen":-1!==e.indexOf("DIS")?t.slice(0,-3)+"ben":t+" ret"},s:"puS lup",ss:i,m:"wa’ tup",mm:i,h:"wa’ rep",hh:i,d:"wa’ jaj",dd:i,M:"wa’ jar",MM:i,y:"wa’ DIS",yy:i},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(i(5093))},1135:function(e,t,i){!function(e){"use strict";e.defineLocale("vi",{months:"tháng 1_tháng 2_tháng 3_tháng 4_tháng 5_tháng 6_tháng 7_tháng 8_tháng 9_tháng 10_tháng 11_tháng 12".split("_"),monthsShort:"Thg 01_Thg 02_Thg 03_Thg 04_Thg 05_Thg 06_Thg 07_Thg 08_Thg 09_Thg 10_Thg 11_Thg 12".split("_"),monthsParseExact:!0,weekdays:"chủ nhật_thứ hai_thứ ba_thứ tư_thứ năm_thứ sáu_thứ bảy".split("_"),weekdaysShort:"CN_T2_T3_T4_T5_T6_T7".split("_"),weekdaysMin:"CN_T2_T3_T4_T5_T6_T7".split("_"),weekdaysParseExact:!0,meridiemParse:/sa|ch/i,isPM:function(e){return/^ch$/i.test(e)},meridiem:function(e,t,i){return e<12?i?"sa":"SA":i?"ch":"CH"},longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM [năm] YYYY",LLL:"D MMMM [năm] YYYY HH:mm",LLLL:"dddd, D MMMM [năm] YYYY HH:mm",l:"DD/M/YYYY",ll:"D MMM YYYY",lll:"D MMM YYYY HH:mm",llll:"ddd, D MMM YYYY HH:mm"},calendar:{sameDay:"[Hôm nay lúc] LT",nextDay:"[Ngày mai lúc] LT",nextWeek:"dddd [tuần tới lúc] LT",lastDay:"[Hôm qua lúc] LT",lastWeek:"dddd [tuần trước lúc] LT",sameElse:"L"},relativeTime:{future:"%s tới",past:"%s trước",s:"vài giây",ss:"%d giây",m:"một phút",mm:"%d phút",h:"một giờ",hh:"%d giờ",d:"một ngày",dd:"%d ngày",w:"một tuần",ww:"%d tuần",M:"một tháng",MM:"%d tháng",y:"một năm",yy:"%d năm"},dayOfMonthOrdinalParse:/\d{1,2}/,ordinal:function(e){return e},week:{dow:1,doy:4}})}(i(5093))},1149:(e,t,i)=>{"use strict";i.d(t,{oI:()=>h});var n=function(){return n=Object.assign||function(e){for(var t,i=1,n=arguments.length;i32&&(n*=.8),e.hasAttribute("data-spinner-size")&&(n=parseInt(e.getAttribute("data-spinner-size"),10)),e.hasAttribute("data-spinner-color")&&(t=e.getAttribute("data-spinner-color")),e.hasAttribute("data-spinner-lines")&&(i=parseInt(e.getAttribute("data-spinner-lines"),10));var r=.2*n;return new s({color:t||"#fff",lines:i||12,radius:r,length:.6*r,width:r<7?2:3,animation:"ladda-spinner-line-fade",zIndex:"auto",top:"auto",left:"auto",className:""})}(e)),e.disabled=!0,e.setAttribute("data-loading",""),clearTimeout(o),a.spin(l),this.setProgress(0),this},startAfter:function(e){return clearTimeout(o),o=setTimeout(function(){h.start()},e),this},stop:function(){return h.isLoading()&&(e.disabled=!1,e.removeAttribute("data-loading")),clearTimeout(o),a&&(o=setTimeout(function(){a.stop()},1e3)),this},toggle:function(){return this.isLoading()?this.stop():this.start()},setProgress:function(t){t=Math.max(Math.min(t,1),0);var i=e.querySelector(".ladda-progress");0===t&&i&&i.parentNode?i.parentNode.removeChild(i):(i||((i=document.createElement("div")).className="ladda-progress",e.appendChild(i)),i.style.width=(t||0)*e.offsetWidth+"px")},isLoading:function(){return e.hasAttribute("data-loading")},remove:function(){clearTimeout(o),e.disabled=!1,e.removeAttribute("data-loading"),a&&(a.stop(),a=null),c.splice(c.indexOf(h),1)}};return c.push(h),h}console.warn("Ladda button target must be defined.")}(e),n=-1;e.addEventListener("click",function(){var r=!0,s=function(e,t){for(;e.parentNode&&e.tagName!==t;)e=e.parentNode;return t===e.tagName?e:void 0}(e,"FORM");void 0===s||s.hasAttribute("novalidate")||"function"==typeof s.checkValidity&&(r=s.checkValidity()),r&&(i.startAfter(1),"number"==typeof t.timeout&&(clearTimeout(n),n=setTimeout(i.stop,t.timeout)),"function"==typeof t.callback&&t.callback.apply(null,[i]))},!1)}}},1206:(e,t,i)=>{"use strict";if(i.d(t,{A:()=>s}),/^(7(06|92|96)|140)$/.test(i.j))var n=i(4278);function r(e){var t=new Map,i=new Set,n=[];function r(e){i.add(e.name),[].concat(e.requires||[],e.requiresIfExists||[]).forEach(function(e){if(!i.has(e)){var n=t.get(e);n&&r(n)}}),n.push(e)}return e.forEach(function(e){t.set(e.name,e)}),e.forEach(function(e){i.has(e.name)||r(e)}),n}function s(e){var t=r(e);return n.GM.reduce(function(e,i){return e.concat(t.filter(function(e){return e.phase===i}))},[])}},1221:function(e,t,i){!function(e){"use strict";var t=["جنوري","فيبروري","مارچ","اپريل","مئي","جون","جولاءِ","آگسٽ","سيپٽمبر","آڪٽوبر","نومبر","ڊسمبر"],i=["آچر","سومر","اڱارو","اربع","خميس","جمع","ڇنڇر"];e.defineLocale("sd",{months:t,monthsShort:t,weekdays:i,weekdaysShort:i,weekdaysMin:i,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd، D MMMM YYYY HH:mm"},meridiemParse:/صبح|شام/,isPM:function(e){return"شام"===e},meridiem:function(e,t,i){return e<12?"صبح":"شام"},calendar:{sameDay:"[اڄ] LT",nextDay:"[سڀاڻي] LT",nextWeek:"dddd [اڳين هفتي تي] LT",lastDay:"[ڪالهه] LT",lastWeek:"[گزريل هفتي] dddd [تي] LT",sameElse:"L"},relativeTime:{future:"%s پوء",past:"%s اڳ",s:"چند سيڪنڊ",ss:"%d سيڪنڊ",m:"هڪ منٽ",mm:"%d منٽ",h:"هڪ ڪلاڪ",hh:"%d ڪلاڪ",d:"هڪ ڏينهن",dd:"%d ڏينهن",M:"هڪ مهينو",MM:"%d مهينا",y:"هڪ سال",yy:"%d سال"},preparse:function(e){return e.replace(/،/g,",")},postformat:function(e){return e.replace(/,/g,"،")},week:{dow:1,doy:4}})}(i(5093))},1262:(e,t,i)=>{"use strict";i.d(t,{A:()=>f});var n=i(4278),r=i(5128),s=i(8979),o=i(9760),a=i(271),l=i(2632),c=i(8101),h=i(6906),d={top:"auto",right:"auto",bottom:"auto",left:"auto"};function u(e){var t,i=e.popper,l=e.popperRect,c=e.placement,u=e.variation,f=e.offsets,p=e.position,m=e.gpuAcceleration,g=e.adaptive,_=e.roundOffsets,y=e.isFixed,v=f.x,x=void 0===v?0:v,b=f.y,w=void 0===b?0:b,S="function"==typeof _?_({x,y:w}):{x,y:w};x=S.x,w=S.y;var T=f.hasOwnProperty("x"),k=f.hasOwnProperty("y"),M=n.kb,A=n.Mn,C=window;if(g){var D=(0,r.A)(i),L="clientHeight",E="clientWidth";D===(0,s.A)(i)&&(D=(0,o.A)(i),"static"!==(0,a.A)(D).position&&"absolute"===p&&(L="scrollHeight",E="scrollWidth")),(c===n.Mn||(c===n.kb||c===n.pG)&&u===n._N)&&(A=n.sQ,w-=(y&&D===C&&C.visualViewport?C.visualViewport.height:D[L])-l.height,w*=m?1:-1),c!==n.kb&&(c!==n.Mn&&c!==n.sQ||u!==n._N)||(M=n.pG,x-=(y&&D===C&&C.visualViewport?C.visualViewport.width:D[E])-l.width,x*=m?1:-1)}var I,P=Object.assign({position:p},g&&d),R=!0===_?function(e,t){var i=e.x,n=e.y,r=t.devicePixelRatio||1;return{x:(0,h.LI)(i*r)/r||0,y:(0,h.LI)(n*r)/r||0}}({x,y:w},(0,s.A)(i)):{x,y:w};return x=R.x,w=R.y,m?Object.assign({},P,((I={})[A]=k?"0":"",I[M]=T?"0":"",I.transform=(C.devicePixelRatio||1)<=1?"translate("+x+"px, "+w+"px)":"translate3d("+x+"px, "+w+"px, 0)",I)):Object.assign({},P,((t={})[A]=k?w+"px":"",t[M]=T?x+"px":"",t.transform="",t))}const f={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(e){var t=e.state,i=e.options,n=i.gpuAcceleration,r=void 0===n||n,s=i.adaptive,o=void 0===s||s,a=i.roundOffsets,h=void 0===a||a,d={placement:(0,l.A)(t.placement),variation:(0,c.A)(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:r,isFixed:"fixed"===t.options.strategy};null!=t.modifiersData.popperOffsets&&(t.styles.popper=Object.assign({},t.styles.popper,u(Object.assign({},d,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:o,roundOffsets:h})))),null!=t.modifiersData.arrow&&(t.styles.arrow=Object.assign({},t.styles.arrow,u(Object.assign({},d,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:h})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})},data:{}}},1290:function(e,t,i){!function(e){"use strict";var t={1:"১",2:"২",3:"৩",4:"৪",5:"৫",6:"৬",7:"৭",8:"৮",9:"৯",0:"০"},i={"১":"1","২":"2","৩":"3","৪":"4","৫":"5","৬":"6","৭":"7","৮":"8","৯":"9","০":"0"};e.defineLocale("bn",{months:"জানুয়ারি_ফেব্রুয়ারি_মার্চ_এপ্রিল_মে_জুন_জুলাই_আগস্ট_সেপ্টেম্বর_অক্টোবর_নভেম্বর_ডিসেম্বর".split("_"),monthsShort:"জানু_ফেব্রু_মার্চ_এপ্রিল_মে_জুন_জুলাই_আগস্ট_সেপ্ট_অক্টো_নভে_ডিসে".split("_"),weekdays:"রবিবার_সোমবার_মঙ্গলবার_বুধবার_বৃহস্পতিবার_শুক্রবার_শনিবার".split("_"),weekdaysShort:"রবি_সোম_মঙ্গল_বুধ_বৃহস্পতি_শুক্র_শনি".split("_"),weekdaysMin:"রবি_সোম_মঙ্গল_বুধ_বৃহ_শুক্র_শনি".split("_"),longDateFormat:{LT:"A h:mm সময়",LTS:"A h:mm:ss সময়",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm সময়",LLLL:"dddd, D MMMM YYYY, A h:mm সময়"},calendar:{sameDay:"[আজ] LT",nextDay:"[আগামীকাল] LT",nextWeek:"dddd, LT",lastDay:"[গতকাল] LT",lastWeek:"[গত] dddd, LT",sameElse:"L"},relativeTime:{future:"%s পরে",past:"%s আগে",s:"কয়েক সেকেন্ড",ss:"%d সেকেন্ড",m:"এক মিনিট",mm:"%d মিনিট",h:"এক ঘন্টা",hh:"%d ঘন্টা",d:"এক দিন",dd:"%d দিন",M:"এক মাস",MM:"%d মাস",y:"এক বছর",yy:"%d বছর"},preparse:function(e){return e.replace(/[১২৩৪৫৬৭৮৯০]/g,function(e){return i[e]})},postformat:function(e){return e.replace(/\d/g,function(e){return t[e]})},meridiemParse:/রাত|সকাল|দুপুর|বিকাল|রাত/,meridiemHour:function(e,t){return 12===e&&(e=0),"রাত"===t&&e>=4||"দুপুর"===t&&e<5||"বিকাল"===t?e+12:e},meridiem:function(e,t,i){return e<4?"রাত":e<10?"সকাল":e<17?"দুপুর":e<20?"বিকাল":"রাত"},week:{dow:0,doy:6}})}(i(5093))},1470:function(e,t,i){!function(e){"use strict";function t(e,t,i){return e+" "+function(e,t){return 2===t?function(e){var t={m:"v",b:"v",d:"z"};return void 0===t[e.charAt(0)]?e:t[e.charAt(0)]+e.substring(1)}(e):e}({mm:"munutenn",MM:"miz",dd:"devezh"}[i],e)}function i(e){return e>9?i(e%10):e}var n=[/^gen/i,/^c[ʼ\']hwe/i,/^meu/i,/^ebr/i,/^mae/i,/^(mez|eve)/i,/^gou/i,/^eos/i,/^gwe/i,/^her/i,/^du/i,/^ker/i],r=/^(genver|c[ʼ\']hwevrer|meurzh|ebrel|mae|mezheven|gouere|eost|gwengolo|here|du|kerzu|gen|c[ʼ\']hwe|meu|ebr|mae|eve|gou|eos|gwe|her|du|ker)/i,s=[/^Su/i,/^Lu/i,/^Me([^r]|$)/i,/^Mer/i,/^Ya/i,/^Gw/i,/^Sa/i];e.defineLocale("br",{months:"Genver_Cʼhwevrer_Meurzh_Ebrel_Mae_Mezheven_Gouere_Eost_Gwengolo_Here_Du_Kerzu".split("_"),monthsShort:"Gen_Cʼhwe_Meu_Ebr_Mae_Eve_Gou_Eos_Gwe_Her_Du_Ker".split("_"),weekdays:"Sul_Lun_Meurzh_Mercʼher_Yaou_Gwener_Sadorn".split("_"),weekdaysShort:"Sul_Lun_Meu_Mer_Yao_Gwe_Sad".split("_"),weekdaysMin:"Su_Lu_Me_Mer_Ya_Gw_Sa".split("_"),weekdaysParse:s,fullWeekdaysParse:[/^sul/i,/^lun/i,/^meurzh/i,/^merc[ʼ\']her/i,/^yaou/i,/^gwener/i,/^sadorn/i],shortWeekdaysParse:[/^Sul/i,/^Lun/i,/^Meu/i,/^Mer/i,/^Yao/i,/^Gwe/i,/^Sad/i],minWeekdaysParse:s,monthsRegex:r,monthsShortRegex:r,monthsStrictRegex:/^(genver|c[ʼ\']hwevrer|meurzh|ebrel|mae|mezheven|gouere|eost|gwengolo|here|du|kerzu)/i,monthsShortStrictRegex:/^(gen|c[ʼ\']hwe|meu|ebr|mae|eve|gou|eos|gwe|her|du|ker)/i,monthsParse:n,longMonthsParse:n,shortMonthsParse:n,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D [a viz] MMMM YYYY",LLL:"D [a viz] MMMM YYYY HH:mm",LLLL:"dddd, D [a viz] MMMM YYYY HH:mm"},calendar:{sameDay:"[Hiziv da] LT",nextDay:"[Warcʼhoazh da] LT",nextWeek:"dddd [da] LT",lastDay:"[Decʼh da] LT",lastWeek:"dddd [paset da] LT",sameElse:"L"},relativeTime:{future:"a-benn %s",past:"%s ʼzo",s:"un nebeud segondennoù",ss:"%d eilenn",m:"ur vunutenn",mm:t,h:"un eur",hh:"%d eur",d:"un devezh",dd:t,M:"ur miz",MM:t,y:"ur bloaz",yy:function(e){switch(i(e)){case 1:case 3:case 4:case 5:case 9:return e+" bloaz";default:return e+" vloaz"}}},dayOfMonthOrdinalParse:/\d{1,2}(añ|vet)/,ordinal:function(e){return e+(1===e?"añ":"vet")},week:{dow:1,doy:4},meridiemParse:/a.m.|g.m./,isPM:function(e){return"g.m."===e},meridiem:function(e,t,i){return e<12?"a.m.":"g.m."}})}(i(5093))},1488:function(e,t,i){!function(e){"use strict";var t=function(e){return 0===e?0:1===e?1:2===e?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5},i={s:["أقل من ثانية","ثانية واحدة",["ثانيتان","ثانيتين"],"%d ثوان","%d ثانية","%d ثانية"],m:["أقل من دقيقة","دقيقة واحدة",["دقيقتان","دقيقتين"],"%d دقائق","%d دقيقة","%d دقيقة"],h:["أقل من ساعة","ساعة واحدة",["ساعتان","ساعتين"],"%d ساعات","%d ساعة","%d ساعة"],d:["أقل من يوم","يوم واحد",["يومان","يومين"],"%d أيام","%d يومًا","%d يوم"],M:["أقل من شهر","شهر واحد",["شهران","شهرين"],"%d أشهر","%d شهرا","%d شهر"],y:["أقل من عام","عام واحد",["عامان","عامين"],"%d أعوام","%d عامًا","%d عام"]},n=function(e){return function(n,r,s,o){var a=t(n),l=i[e][t(n)];return 2===a&&(l=l[r?0:1]),l.replace(/%d/i,n)}},r=["جانفي","فيفري","مارس","أفريل","ماي","جوان","جويلية","أوت","سبتمبر","أكتوبر","نوفمبر","ديسمبر"];e.defineLocale("ar-dz",{months:r,monthsShort:r,weekdays:"الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),weekdaysShort:"أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت".split("_"),weekdaysMin:"ح_ن_ث_ر_خ_ج_س".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"D/‏M/‏YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},meridiemParse:/ص|م/,isPM:function(e){return"م"===e},meridiem:function(e,t,i){return e<12?"ص":"م"},calendar:{sameDay:"[اليوم عند الساعة] LT",nextDay:"[غدًا عند الساعة] LT",nextWeek:"dddd [عند الساعة] LT",lastDay:"[أمس عند الساعة] LT",lastWeek:"dddd [عند الساعة] LT",sameElse:"L"},relativeTime:{future:"بعد %s",past:"منذ %s",s:n("s"),ss:n("s"),m:n("m"),mm:n("m"),h:n("h"),hh:n("h"),d:n("d"),dd:n("d"),M:n("M"),MM:n("M"),y:n("y"),yy:n("y")},postformat:function(e){return e.replace(/,/g,"،")},week:{dow:0,doy:4}})}(i(5093))},1503:(e,t,i)=>{var n,r,s;!function(){"use strict";r=[i(4692)],n=function(e){e.ui=e.ui||{},e.ui.version="1.14.1";var t,i,n=0,r=Array.prototype.hasOwnProperty,s=Array.prototype.slice;e.cleanData=e.cleanData||(t=e.cleanData,function(i){var n,r,s;for(s=0;null!=(r=i[s]);s++)(n=e._data(r,"events"))&&n.remove&&e(r).triggerHandler("remove");t(i)}),e.widget=e.widget||function(t,i,n){var r,s,o,a={},l=t.split(".")[0];if("__proto__"===(t=t.split(".")[1])||"constructor"===t)return e.error("Invalid widget name: "+t);var c=l+"-"+t;return n||(n=i,i=e.Widget),Array.isArray(n)&&(n=e.extend.apply(null,[{}].concat(n))),e.expr.pseudos[c.toLowerCase()]=function(t){return!!e.data(t,c)},e[l]=e[l]||{},r=e[l][t],s=e[l][t]=function(e,t){if(!this||!this._createWidget)return new s(e,t);arguments.length&&this._createWidget(e,t)},e.extend(s,r,{version:n.version,_proto:e.extend({},n),_childConstructors:[]}),(o=new i).options=e.widget.extend({},o.options),e.each(n,function(e,t){a[e]="function"==typeof t?function(){function n(){return i.prototype[e].apply(this,arguments)}function r(t){return i.prototype[e].apply(this,t)}return function(){var e,i=this._super,s=this._superApply;return this._super=n,this._superApply=r,e=t.apply(this,arguments),this._super=i,this._superApply=s,e}}():t}),s.prototype=e.widget.extend(o,{widgetEventPrefix:r&&o.widgetEventPrefix||t},a,{constructor:s,namespace:l,widgetName:t,widgetFullName:c}),r?(e.each(r._childConstructors,function(t,i){var n=i.prototype;e.widget(n.namespace+"."+n.widgetName,s,i._proto)}),delete r._childConstructors):i._childConstructors.push(s),e.widget.bridge(t,s),s},e.widget.extend=function(t){for(var i,n,o=s.call(arguments,1),a=0,l=o.length;a",options:{classes:{},disabled:!1,create:null},_createWidget:function(t,i){i=e(i||this.defaultElement||this)[0],this.element=e(i),this.uuid=n++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=e(),this.hoverable=e(),this.focusable=e(),this.classesElementLookup={},i!==this&&(e.data(i,this.widgetFullName,this),this._on(!0,this.element,{remove:function(e){e.target===i&&this.destroy()}}),this.document=e(i.style?i.ownerDocument:i.document||i),this.window=e(this.document[0].defaultView||this.document[0].parentWindow)),this.options=e.widget.extend({},this.options,this._getCreateOptions(),t),this._create(),this.options.disabled&&this._setOptionDisabled(this.options.disabled),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:function(){return{}},_getCreateEventData:e.noop,_create:e.noop,_init:e.noop,destroy:function(){var t=this;this._destroy(),e.each(this.classesElementLookup,function(e,i){t._removeClass(i,e)}),this.element.off(this.eventNamespace).removeData(this.widgetFullName),this.widget().off(this.eventNamespace).removeAttr("aria-disabled"),this.bindings.off(this.eventNamespace)},_destroy:e.noop,widget:function(){return this.element},option:function(t,i){var n,r,s,o=t;if(0===arguments.length)return e.widget.extend({},this.options);if("string"==typeof t)if(o={},n=t.split("."),t=n.shift(),n.length){for(r=o[t]=e.widget.extend({},this.options[t]),s=0;s

"),s=r.children()[0];return e("body").append(r),i=s.offsetWidth,r.css("overflow","scroll"),i===(n=s.offsetWidth)&&(n=r[0].clientWidth),r.remove(),t=i-n},getScrollInfo:function(t){var i=t.isWindow||t.isDocument?"":t.element.css("overflow-x"),n=t.isWindow||t.isDocument?"":t.element.css("overflow-y"),r="scroll"===i||"auto"===i&&t.width0?"right":"center",vertical:h<0?"top":l>0?"bottom":"middle"};fi(n(l),n(h))?d.important="horizontal":d.important="vertical",t.using.call(this,e,d)}),o.offset(e.extend(k,{using:s}))})},e.ui.position={fit:{left:function(e,t){var n,r=t.within,s=r.isWindow?r.scrollLeft:r.offset.left,o=r.width,a=e.left-t.collisionPosition.marginLeft,l=s-a,c=a+t.collisionWidth-o-s;t.collisionWidth>o?l>0&&c<=0?(n=e.left+l+t.collisionWidth-o-s,e.left+=l-n):e.left=c>0&&l<=0?s:l>c?s+o-t.collisionWidth:s:l>0?e.left+=l:c>0?e.left-=c:e.left=i(e.left-a,e.left)},top:function(e,t){var n,r=t.within,s=r.isWindow?r.scrollTop:r.offset.top,o=t.within.height,a=e.top-t.collisionPosition.marginTop,l=s-a,c=a+t.collisionHeight-o-s;t.collisionHeight>o?l>0&&c<=0?(n=e.top+l+t.collisionHeight-o-s,e.top+=l-n):e.top=c>0&&l<=0?s:l>c?s+o-t.collisionHeight:s:l>0?e.top+=l:c>0?e.top-=c:e.top=i(e.top-a,e.top)}},flip:{left:function(e,t){var i,r,s=t.within,o=s.offset.left+s.scrollLeft,a=s.width,l=s.isWindow?s.scrollLeft:s.offset.left,c=e.left-t.collisionPosition.marginLeft,h=c-l,d=c+t.collisionWidth-a-l,u="left"===t.my[0]?-t.elemWidth:"right"===t.my[0]?t.elemWidth:0,f="left"===t.at[0]?t.targetWidth:"right"===t.at[0]?-t.targetWidth:0,p=-2*t.offset[0];h<0?((i=e.left+u+f+p+t.collisionWidth-a-o)<0||i0&&((r=e.left-t.collisionPosition.marginLeft+u+f+p-l)>0||n(r)0&&((i=e.top-t.collisionPosition.marginTop+u+f+p-l)>0||n(i)=3&&e%100<=10?3:e%100>=11?4:5},r={s:["أقل من ثانية","ثانية واحدة",["ثانيتان","ثانيتين"],"%d ثوان","%d ثانية","%d ثانية"],m:["أقل من دقيقة","دقيقة واحدة",["دقيقتان","دقيقتين"],"%d دقائق","%d دقيقة","%d دقيقة"],h:["أقل من ساعة","ساعة واحدة",["ساعتان","ساعتين"],"%d ساعات","%d ساعة","%d ساعة"],d:["أقل من يوم","يوم واحد",["يومان","يومين"],"%d أيام","%d يومًا","%d يوم"],M:["أقل من شهر","شهر واحد",["شهران","شهرين"],"%d أشهر","%d شهرا","%d شهر"],y:["أقل من عام","عام واحد",["عامان","عامين"],"%d أعوام","%d عامًا","%d عام"]},s=function(e){return function(t,i,s,o){var a=n(t),l=r[e][n(t)];return 2===a&&(l=l[i?0:1]),l.replace(/%d/i,t)}},o=["يناير","فبراير","مارس","أبريل","مايو","يونيو","يوليو","أغسطس","سبتمبر","أكتوبر","نوفمبر","ديسمبر"];e.defineLocale("ar",{months:o,monthsShort:o,weekdays:"الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),weekdaysShort:"أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت".split("_"),weekdaysMin:"ح_ن_ث_ر_خ_ج_س".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"D/‏M/‏YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},meridiemParse:/ص|م/,isPM:function(e){return"م"===e},meridiem:function(e,t,i){return e<12?"ص":"م"},calendar:{sameDay:"[اليوم عند الساعة] LT",nextDay:"[غدًا عند الساعة] LT",nextWeek:"dddd [عند الساعة] LT",lastDay:"[أمس عند الساعة] LT",lastWeek:"dddd [عند الساعة] LT",sameElse:"L"},relativeTime:{future:"بعد %s",past:"منذ %s",s:s("s"),ss:s("s"),m:s("m"),mm:s("m"),h:s("h"),hh:s("h"),d:s("d"),dd:s("d"),M:s("M"),MM:s("M"),y:s("y"),yy:s("y")},preparse:function(e){return e.replace(/[١٢٣٤٥٦٧٨٩٠]/g,function(e){return i[e]}).replace(/،/g,",")},postformat:function(e){return e.replace(/\d/g,function(e){return t[e]}).replace(/,/g,"،")},week:{dow:6,doy:12}})}(i(5093))},1541:function(e,t,i){!function(e){"use strict";e.defineLocale("zh-mo",{months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"週日_週一_週二_週三_週四_週五_週六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"YYYY年M月D日",LLL:"YYYY年M月D日 HH:mm",LLLL:"YYYY年M月D日dddd HH:mm",l:"D/M/YYYY",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},meridiemParse:/凌晨|早上|上午|中午|下午|晚上/,meridiemHour:function(e,t){return 12===e&&(e=0),"凌晨"===t||"早上"===t||"上午"===t?e:"中午"===t?e>=11?e:e+12:"下午"===t||"晚上"===t?e+12:void 0},meridiem:function(e,t,i){var n=100*e+t;return n<600?"凌晨":n<900?"早上":n<1130?"上午":n<1230?"中午":n<1800?"下午":"晚上"},calendar:{sameDay:"[今天] LT",nextDay:"[明天] LT",nextWeek:"[下]dddd LT",lastDay:"[昨天] LT",lastWeek:"[上]dddd LT",sameElse:"L"},dayOfMonthOrdinalParse:/\d{1,2}(日|月|週)/,ordinal:function(e,t){switch(t){case"d":case"D":case"DDD":return e+"日";case"M":return e+"月";case"w":case"W":return e+"週";default:return e}},relativeTime:{future:"%s內",past:"%s前",s:"幾秒",ss:"%d 秒",m:"1 分鐘",mm:"%d 分鐘",h:"1 小時",hh:"%d 小時",d:"1 天",dd:"%d 天",M:"1 個月",MM:"%d 個月",y:"1 年",yy:"%d 年"}})}(i(5093))},1545:function(e,t,i){!function(e){"use strict";var t={1:"༡",2:"༢",3:"༣",4:"༤",5:"༥",6:"༦",7:"༧",8:"༨",9:"༩",0:"༠"},i={"༡":"1","༢":"2","༣":"3","༤":"4","༥":"5","༦":"6","༧":"7","༨":"8","༩":"9","༠":"0"};e.defineLocale("bo",{months:"ཟླ་བ་དང་པོ_ཟླ་བ་གཉིས་པ_ཟླ་བ་གསུམ་པ_ཟླ་བ་བཞི་པ_ཟླ་བ་ལྔ་པ_ཟླ་བ་དྲུག་པ_ཟླ་བ་བདུན་པ_ཟླ་བ་བརྒྱད་པ_ཟླ་བ་དགུ་པ_ཟླ་བ་བཅུ་པ_ཟླ་བ་བཅུ་གཅིག་པ_ཟླ་བ་བཅུ་གཉིས་པ".split("_"),monthsShort:"ཟླ་1_ཟླ་2_ཟླ་3_ཟླ་4_ཟླ་5_ཟླ་6_ཟླ་7_ཟླ་8_ཟླ་9_ཟླ་10_ཟླ་11_ཟླ་12".split("_"),monthsShortRegex:/^(ཟླ་\d{1,2})/,monthsParseExact:!0,weekdays:"གཟའ་ཉི་མ་_གཟའ་ཟླ་བ་_གཟའ་མིག་དམར་_གཟའ་ལྷག་པ་_གཟའ་ཕུར་བུ_གཟའ་པ་སངས་_གཟའ་སྤེན་པ་".split("_"),weekdaysShort:"ཉི་མ་_ཟླ་བ་_མིག་དམར་_ལྷག་པ་_ཕུར་བུ_པ་སངས་_སྤེན་པ་".split("_"),weekdaysMin:"ཉི_ཟླ_མིག_ལྷག_ཕུར_སངས_སྤེན".split("_"),longDateFormat:{LT:"A h:mm",LTS:"A h:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm",LLLL:"dddd, D MMMM YYYY, A h:mm"},calendar:{sameDay:"[དི་རིང] LT",nextDay:"[སང་ཉིན] LT",nextWeek:"[བདུན་ཕྲག་རྗེས་མ], LT",lastDay:"[ཁ་སང] LT",lastWeek:"[བདུན་ཕྲག་མཐའ་མ] dddd, LT",sameElse:"L"},relativeTime:{future:"%s ལ་",past:"%s སྔན་ལ",s:"ལམ་སང",ss:"%d སྐར་ཆ།",m:"སྐར་མ་གཅིག",mm:"%d སྐར་མ",h:"ཆུ་ཚོད་གཅིག",hh:"%d ཆུ་ཚོད",d:"ཉིན་གཅིག",dd:"%d ཉིན་",M:"ཟླ་བ་གཅིག",MM:"%d ཟླ་བ",y:"ལོ་གཅིག",yy:"%d ལོ"},preparse:function(e){return e.replace(/[༡༢༣༤༥༦༧༨༩༠]/g,function(e){return i[e]})},postformat:function(e){return e.replace(/\d/g,function(e){return t[e]})},meridiemParse:/མཚན་མོ|ཞོགས་ཀས|ཉིན་གུང|དགོང་དག|མཚན་མོ/,meridiemHour:function(e,t){return 12===e&&(e=0),"མཚན་མོ"===t&&e>=4||"ཉིན་གུང"===t&&e<5||"དགོང་དག"===t?e+12:e},meridiem:function(e,t,i){return e<4?"མཚན་མོ":e<10?"ཞོགས་ཀས":e<17?"ཉིན་གུང":e<20?"དགོང་དག":"མཚན་མོ"},week:{dow:0,doy:6}})}(i(5093))},1576:(e,t,i)=>{"use strict";i.d(t,{n4:()=>p});var n=i(3424),r=i(9068),s=i(5059),o=i(1262),a=i(6607),l=i(8490),c=i(644),h=i(192),d=i(8256),u=i(9081),f=[r.A,s.A,o.A,a.A,l.A,c.A,h.A,d.A,u.A],p=(0,n.UD)({defaultModifiers:f})},1632:function(e,t,i){!function(e){"use strict";e.defineLocale("zh-hk",{months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"週日_週一_週二_週三_週四_週五_週六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日 HH:mm",LLLL:"YYYY年M月D日dddd HH:mm",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},meridiemParse:/凌晨|早上|上午|中午|下午|晚上/,meridiemHour:function(e,t){return 12===e&&(e=0),"凌晨"===t||"早上"===t||"上午"===t?e:"中午"===t?e>=11?e:e+12:"下午"===t||"晚上"===t?e+12:void 0},meridiem:function(e,t,i){var n=100*e+t;return n<600?"凌晨":n<900?"早上":n<1200?"上午":1200===n?"中午":n<1800?"下午":"晚上"},calendar:{sameDay:"[今天]LT",nextDay:"[明天]LT",nextWeek:"[下]ddddLT",lastDay:"[昨天]LT",lastWeek:"[上]ddddLT",sameElse:"L"},dayOfMonthOrdinalParse:/\d{1,2}(日|月|週)/,ordinal:function(e,t){switch(t){case"d":case"D":case"DDD":return e+"日";case"M":return e+"月";case"w":case"W":return e+"週";default:return e}},relativeTime:{future:"%s後",past:"%s前",s:"幾秒",ss:"%d 秒",m:"1 分鐘",mm:"%d 分鐘",h:"1 小時",hh:"%d 小時",d:"1 天",dd:"%d 天",M:"1 個月",MM:"%d 個月",y:"1 年",yy:"%d 年"}})}(i(5093))},1713:function(e,t,i){!function(e){"use strict";e.defineLocale("he",{months:"ינואר_פברואר_מרץ_אפריל_מאי_יוני_יולי_אוגוסט_ספטמבר_אוקטובר_נובמבר_דצמבר".split("_"),monthsShort:"ינו׳_פבר׳_מרץ_אפר׳_מאי_יוני_יולי_אוג׳_ספט׳_אוק׳_נוב׳_דצמ׳".split("_"),weekdays:"ראשון_שני_שלישי_רביעי_חמישי_שישי_שבת".split("_"),weekdaysShort:"א׳_ב׳_ג׳_ד׳_ה׳_ו׳_ש׳".split("_"),weekdaysMin:"א_ב_ג_ד_ה_ו_ש".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D [ב]MMMM YYYY",LLL:"D [ב]MMMM YYYY HH:mm",LLLL:"dddd, D [ב]MMMM YYYY HH:mm",l:"D/M/YYYY",ll:"D MMM YYYY",lll:"D MMM YYYY HH:mm",llll:"ddd, D MMM YYYY HH:mm"},calendar:{sameDay:"[היום ב־]LT",nextDay:"[מחר ב־]LT",nextWeek:"dddd [בשעה] LT",lastDay:"[אתמול ב־]LT",lastWeek:"[ביום] dddd [האחרון בשעה] LT",sameElse:"L"},relativeTime:{future:"בעוד %s",past:"לפני %s",s:"מספר שניות",ss:"%d שניות",m:"דקה",mm:"%d דקות",h:"שעה",hh:function(e){return 2===e?"שעתיים":e+" שעות"},d:"יום",dd:function(e){return 2===e?"יומיים":e+" ימים"},M:"חודש",MM:function(e){return 2===e?"חודשיים":e+" חודשים"},y:"שנה",yy:function(e){return 2===e?"שנתיים":e%10==0&&10!==e?e+" שנה":e+" שנים"}},meridiemParse:/אחה"צ|לפנה"צ|אחרי הצהריים|לפני הצהריים|לפנות בוקר|בבוקר|בערב/i,isPM:function(e){return/^(אחה"צ|אחרי הצהריים|בערב)$/.test(e)},meridiem:function(e,t,i){return e<5?"לפנות בוקר":e<10?"בבוקר":e<12?i?'לפנה"צ':"לפני הצהריים":e<18?i?'אחה"צ':"אחרי הצהריים":"בערב"}})}(i(5093))},1734:function(e,t,i){!function(e){"use strict";e.defineLocale("ga",{months:["Eanáir","Feabhra","Márta","Aibreán","Bealtaine","Meitheamh","Iúil","Lúnasa","Meán Fómhair","Deireadh Fómhair","Samhain","Nollaig"],monthsShort:["Ean","Feabh","Márt","Aib","Beal","Meith","Iúil","Lún","M.F.","D.F.","Samh","Noll"],monthsParseExact:!0,weekdays:["Dé Domhnaigh","Dé Luain","Dé Máirt","Dé Céadaoin","Déardaoin","Dé hAoine","Dé Sathairn"],weekdaysShort:["Domh","Luan","Máirt","Céad","Déar","Aoine","Sath"],weekdaysMin:["Do","Lu","Má","Cé","Dé","A","Sa"],longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Inniu ag] LT",nextDay:"[Amárach ag] LT",nextWeek:"dddd [ag] LT",lastDay:"[Inné ag] LT",lastWeek:"dddd [seo caite] [ag] LT",sameElse:"L"},relativeTime:{future:"i %s",past:"%s ó shin",s:"cúpla soicind",ss:"%d soicind",m:"nóiméad",mm:"%d nóiméad",h:"uair an chloig",hh:"%d uair an chloig",d:"lá",dd:"%d lá",M:"mí",MM:"%d míonna",y:"bliain",yy:"%d bliain"},dayOfMonthOrdinalParse:/\d{1,2}(d|na|mh)/,ordinal:function(e){return e+(1===e?"d":e%10==2?"na":"mh")},week:{dow:1,doy:4}})}(i(5093))},1765:function(e,t,i){!function(e){"use strict";e.defineLocale("tzm",{months:"ⵉⵏⵏⴰⵢⵔ_ⴱⵕⴰⵢⵕ_ⵎⴰⵕⵚ_ⵉⴱⵔⵉⵔ_ⵎⴰⵢⵢⵓ_ⵢⵓⵏⵢⵓ_ⵢⵓⵍⵢⵓⵣ_ⵖⵓⵛⵜ_ⵛⵓⵜⴰⵏⴱⵉⵔ_ⴽⵟⵓⴱⵕ_ⵏⵓⵡⴰⵏⴱⵉⵔ_ⴷⵓⵊⵏⴱⵉⵔ".split("_"),monthsShort:"ⵉⵏⵏⴰⵢⵔ_ⴱⵕⴰⵢⵕ_ⵎⴰⵕⵚ_ⵉⴱⵔⵉⵔ_ⵎⴰⵢⵢⵓ_ⵢⵓⵏⵢⵓ_ⵢⵓⵍⵢⵓⵣ_ⵖⵓⵛⵜ_ⵛⵓⵜⴰⵏⴱⵉⵔ_ⴽⵟⵓⴱⵕ_ⵏⵓⵡⴰⵏⴱⵉⵔ_ⴷⵓⵊⵏⴱⵉⵔ".split("_"),weekdays:"ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ".split("_"),weekdaysShort:"ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ".split("_"),weekdaysMin:"ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[ⴰⵙⴷⵅ ⴴ] LT",nextDay:"[ⴰⵙⴽⴰ ⴴ] LT",nextWeek:"dddd [ⴴ] LT",lastDay:"[ⴰⵚⴰⵏⵜ ⴴ] LT",lastWeek:"dddd [ⴴ] LT",sameElse:"L"},relativeTime:{future:"ⴷⴰⴷⵅ ⵙ ⵢⴰⵏ %s",past:"ⵢⴰⵏ %s",s:"ⵉⵎⵉⴽ",ss:"%d ⵉⵎⵉⴽ",m:"ⵎⵉⵏⵓⴺ",mm:"%d ⵎⵉⵏⵓⴺ",h:"ⵙⴰⵄⴰ",hh:"%d ⵜⴰⵙⵙⴰⵄⵉⵏ",d:"ⴰⵙⵙ",dd:"%d oⵙⵙⴰⵏ",M:"ⴰⵢoⵓⵔ",MM:"%d ⵉⵢⵢⵉⵔⵏ",y:"ⴰⵙⴳⴰⵙ",yy:"%d ⵉⵙⴳⴰⵙⵏ"},week:{dow:6,doy:12}})}(i(5093))},1788:function(e,t,i){e.exports=function(e){"use strict";var t=function(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}(e);const i=(e=>{const t="transitionend",i={TRANSITION_END:"mmTransitionEnd",triggerTransitionEnd(i){e(i).trigger(t)},supportsTransitionEnd:()=>Boolean(t)};return e.fn.mmEmulateTransitionEnd=function(t){let n=!1;return e(this).one(i.TRANSITION_END,()=>{n=!0}),setTimeout(()=>{n||i.triggerTransitionEnd(this)},t),this},e.event.special[i.TRANSITION_END]={bindType:t,delegateType:t,handle(t){if(e(t.target).is(this))return t.handleObj.handler.apply(this,arguments)}},i})(t.default),n="metisMenu",r="metisMenu",s=t.default.fn[n],o={toggle:!0,preventDefault:!0,triggerElement:"a",parentTrigger:"li",subMenu:"ul"},a="show.metisMenu",l="shown.metisMenu",c="hide.metisMenu",h="hidden.metisMenu",d="click.metisMenu.data-api",u="mm-active",f="mm-show",p="mm-collapse",m="mm-collapsing";class g{constructor(e,t){this.element=e,this.config={...o,...t},this.transitioning=null,this.init()}init(){const e=this,i=this.config,n=t.default(this.element);n.addClass("metismenu"),n.find(`${i.parentTrigger}.${u}`).children(i.triggerElement).attr("aria-expanded","true"),n.find(`${i.parentTrigger}.${u}`).parents(i.parentTrigger).addClass(u),n.find(`${i.parentTrigger}.${u}`).parents(i.parentTrigger).children(i.triggerElement).attr("aria-expanded","true"),n.find(`${i.parentTrigger}.${u}`).has(i.subMenu).children(i.subMenu).addClass(`${p} ${f}`),n.find(i.parentTrigger).not(`.${u}`).has(i.subMenu).children(i.subMenu).addClass(p),n.find(i.parentTrigger).children(i.triggerElement).on(d,function(n){const r=t.default(this);if("true"===r.attr("aria-disabled"))return;i.preventDefault&&"#"===r.attr("href")&&n.preventDefault();const s=r.parent(i.parentTrigger),o=s.siblings(i.parentTrigger),a=o.children(i.triggerElement);s.hasClass(u)?(r.attr("aria-expanded","false"),e.removeActive(s)):(r.attr("aria-expanded","true"),e.setActive(s),i.toggle&&(e.removeActive(o),a.attr("aria-expanded","false"))),i.onTransitionStart&&i.onTransitionStart(n)})}setActive(e){t.default(e).addClass(u);const i=t.default(e).children(this.config.subMenu);i.length>0&&!i.hasClass(f)&&this.show(i)}removeActive(e){t.default(e).removeClass(u);const i=t.default(e).children(`${this.config.subMenu}.${f}`);i.length>0&&this.hide(i)}show(e){if(this.transitioning||t.default(e).hasClass(m))return;const n=t.default(e),r=t.default.Event(a);if(n.trigger(r),!r.isDefaultPrevented()){if(n.parent(this.config.parentTrigger).addClass(u),this.config.toggle){const e=n.parent(this.config.parentTrigger).siblings().children(`${this.config.subMenu}.${f}`);this.hide(e)}n.removeClass(p).addClass(m).height(0),this.setTransitioning(!0),n.height(e[0].scrollHeight).one(i.TRANSITION_END,()=>{this.config&&this.element&&(n.removeClass(m).addClass(`${p} ${f}`).height(""),this.setTransitioning(!1),n.trigger(l))}).mmEmulateTransitionEnd(350)}}hide(e){if(this.transitioning||!t.default(e).hasClass(f))return;const n=t.default(e),r=t.default.Event(c);if(n.trigger(r),r.isDefaultPrevented())return;n.parent(this.config.parentTrigger).removeClass(u),n.height(n.height())[0].offsetHeight,n.addClass(m).removeClass(p).removeClass(f),this.setTransitioning(!0);const s=()=>{this.config&&this.element&&(this.transitioning&&this.config.onTransitionEnd&&this.config.onTransitionEnd(),this.setTransitioning(!1),n.trigger(h),n.removeClass(m).addClass(p))};0===n.height()||"none"===n.css("display")?s():n.height(0).one(i.TRANSITION_END,s).mmEmulateTransitionEnd(350)}setTransitioning(e){this.transitioning=e}dispose(){t.default.removeData(this.element,r),t.default(this.element).find(this.config.parentTrigger).children(this.config.triggerElement).off(d),this.transitioning=null,this.config=null,this.element=null}static jQueryInterface(e){return this.each(function(){const i=t.default(this);let n=i.data(r);const s={...o,...i.data(),..."object"==typeof e&&e?e:{}};if(n||(n=new g(this,s),i.data(r,n)),"string"==typeof e){if(void 0===n[e])throw new Error(`No method named "${e}"`);n[e]()}})}}return t.default.fn[n]=g.jQueryInterface,t.default.fn[n].Constructor=g,t.default.fn[n].noConflict=()=>(t.default.fn[n]=s,g.jQueryInterface),g}(i(4692))},1794:function(e,t,i){!function(e){"use strict";e.defineLocale("ka",{months:"იანვარი_თებერვალი_მარტი_აპრილი_მაისი_ივნისი_ივლისი_აგვისტო_სექტემბერი_ოქტომბერი_ნოემბერი_დეკემბერი".split("_"),monthsShort:"იან_თებ_მარ_აპრ_მაი_ივნ_ივლ_აგვ_სექ_ოქტ_ნოე_დეკ".split("_"),weekdays:{standalone:"კვირა_ორშაბათი_სამშაბათი_ოთხშაბათი_ხუთშაბათი_პარასკევი_შაბათი".split("_"),format:"კვირას_ორშაბათს_სამშაბათს_ოთხშაბათს_ხუთშაბათს_პარასკევს_შაბათს".split("_"),isFormat:/(წინა|შემდეგ)/},weekdaysShort:"კვი_ორშ_სამ_ოთხ_ხუთ_პარ_შაბ".split("_"),weekdaysMin:"კვ_ორ_სა_ოთ_ხუ_პა_შა".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[დღეს] LT[-ზე]",nextDay:"[ხვალ] LT[-ზე]",lastDay:"[გუშინ] LT[-ზე]",nextWeek:"[შემდეგ] dddd LT[-ზე]",lastWeek:"[წინა] dddd LT-ზე",sameElse:"L"},relativeTime:{future:function(e){return e.replace(/(წამ|წუთ|საათ|წელ|დღ|თვ)(ი|ე)/,function(e,t,i){return"ი"===i?t+"ში":t+i+"ში"})},past:function(e){return/(წამი|წუთი|საათი|დღე|თვე)/.test(e)?e.replace(/(ი|ე)$/,"ის წინ"):/წელი/.test(e)?e.replace(/წელი$/,"წლის წინ"):e},s:"რამდენიმე წამი",ss:"%d წამი",m:"წუთი",mm:"%d წუთი",h:"საათი",hh:"%d საათი",d:"დღე",dd:"%d დღე",M:"თვე",MM:"%d თვე",y:"წელი",yy:"%d წელი"},dayOfMonthOrdinalParse:/0|1-ლი|მე-\d{1,2}|\d{1,2}-ე/,ordinal:function(e){return 0===e?e:1===e?e+"-ლი":e<20||e<=100&&e%20==0||e%100==0?"მე-"+e:e+"-ე"},week:{dow:1,doy:7}})}(i(5093))},1815:(e,t,i)=>{"use strict";if(i.d(t,{A:()=>a}),/^(7(06|92|96)|140)$/.test(i.j))var n=i(2632);if(/^(7(06|92|96)|140)$/.test(i.j))var r=i(8101);if(/^(7(06|92|96)|140)$/.test(i.j))var s=i(9703);if(/^(7(06|92|96)|140)$/.test(i.j))var o=i(4278);function a(e){var t,i=e.reference,a=e.element,l=e.placement,c=l?(0,n.A)(l):null,h=l?(0,r.A)(l):null,d=i.x+i.width/2-a.width/2,u=i.y+i.height/2-a.height/2;switch(c){case o.Mn:t={x:d,y:i.y-a.height};break;case o.sQ:t={x:d,y:i.y+i.height};break;case o.pG:t={x:i.x+i.width,y:u};break;case o.kb:t={x:i.x-a.width,y:u};break;default:t={x:i.x,y:i.y}}var f=c?(0,s.A)(c):null;if(null!=f){var p="y"===f?"height":"width";switch(h){case o.ni:t[f]=t[f]-(i[p]/2-a[p]/2);break;case o._N:t[f]=t[f]+(i[p]/2-a[p]/2)}}return t}},1827:function(e,t,i){!function(e){"use strict";e.defineLocale("it-ch",{months:"gennaio_febbraio_marzo_aprile_maggio_giugno_luglio_agosto_settembre_ottobre_novembre_dicembre".split("_"),monthsShort:"gen_feb_mar_apr_mag_giu_lug_ago_set_ott_nov_dic".split("_"),weekdays:"domenica_lunedì_martedì_mercoledì_giovedì_venerdì_sabato".split("_"),weekdaysShort:"dom_lun_mar_mer_gio_ven_sab".split("_"),weekdaysMin:"do_lu_ma_me_gi_ve_sa".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[Oggi alle] LT",nextDay:"[Domani alle] LT",nextWeek:"dddd [alle] LT",lastDay:"[Ieri alle] LT",lastWeek:function(){return 0===this.day()?"[la scorsa] dddd [alle] LT":"[lo scorso] dddd [alle] LT"},sameElse:"L"},relativeTime:{future:function(e){return(/^[0-9].+$/.test(e)?"tra":"in")+" "+e},past:"%s fa",s:"alcuni secondi",ss:"%d secondi",m:"un minuto",mm:"%d minuti",h:"un'ora",hh:"%d ore",d:"un giorno",dd:"%d giorni",M:"un mese",MM:"%d mesi",y:"un anno",yy:"%d anni"},dayOfMonthOrdinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:1,doy:4}})}(i(5093))},1848:function(e,t,i){!function(e){"use strict";e.defineLocale("mi",{months:"Kohi-tāte_Hui-tanguru_Poutū-te-rangi_Paenga-whāwhā_Haratua_Pipiri_Hōngoingoi_Here-turi-kōkā_Mahuru_Whiringa-ā-nuku_Whiringa-ā-rangi_Hakihea".split("_"),monthsShort:"Kohi_Hui_Pou_Pae_Hara_Pipi_Hōngoi_Here_Mahu_Whi-nu_Whi-ra_Haki".split("_"),monthsRegex:/(?:['a-z\u0101\u014D\u016B]+\-?){1,3}/i,monthsStrictRegex:/(?:['a-z\u0101\u014D\u016B]+\-?){1,3}/i,monthsShortRegex:/(?:['a-z\u0101\u014D\u016B]+\-?){1,3}/i,monthsShortStrictRegex:/(?:['a-z\u0101\u014D\u016B]+\-?){1,2}/i,weekdays:"Rātapu_Mane_Tūrei_Wenerei_Tāite_Paraire_Hātarei".split("_"),weekdaysShort:"Ta_Ma_Tū_We_Tāi_Pa_Hā".split("_"),weekdaysMin:"Ta_Ma_Tū_We_Tāi_Pa_Hā".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY [i] HH:mm",LLLL:"dddd, D MMMM YYYY [i] HH:mm"},calendar:{sameDay:"[i teie mahana, i] LT",nextDay:"[apopo i] LT",nextWeek:"dddd [i] LT",lastDay:"[inanahi i] LT",lastWeek:"dddd [whakamutunga i] LT",sameElse:"L"},relativeTime:{future:"i roto i %s",past:"%s i mua",s:"te hēkona ruarua",ss:"%d hēkona",m:"he meneti",mm:"%d meneti",h:"te haora",hh:"%d haora",d:"he ra",dd:"%d ra",M:"he marama",MM:"%d marama",y:"he tau",yy:"%d tau"},dayOfMonthOrdinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:1,doy:4}})}(i(5093))},1885:function(e,t,i){!function(e){"use strict";e.defineLocale("te",{months:"జనవరి_ఫిబ్రవరి_మార్చి_ఏప్రిల్_మే_జూన్_జులై_ఆగస్టు_సెప్టెంబర్_అక్టోబర్_నవంబర్_డిసెంబర్".split("_"),monthsShort:"జన._ఫిబ్ర._మార్చి_ఏప్రి._మే_జూన్_జులై_ఆగ._సెప్._అక్టో._నవ._డిసె.".split("_"),monthsParseExact:!0,weekdays:"ఆదివారం_సోమవారం_మంగళవారం_బుధవారం_గురువారం_శుక్రవారం_శనివారం".split("_"),weekdaysShort:"ఆది_సోమ_మంగళ_బుధ_గురు_శుక్ర_శని".split("_"),weekdaysMin:"ఆ_సో_మం_బు_గు_శు_శ".split("_"),longDateFormat:{LT:"A h:mm",LTS:"A h:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm",LLLL:"dddd, D MMMM YYYY, A h:mm"},calendar:{sameDay:"[నేడు] LT",nextDay:"[రేపు] LT",nextWeek:"dddd, LT",lastDay:"[నిన్న] LT",lastWeek:"[గత] dddd, LT",sameElse:"L"},relativeTime:{future:"%s లో",past:"%s క్రితం",s:"కొన్ని క్షణాలు",ss:"%d సెకన్లు",m:"ఒక నిమిషం",mm:"%d నిమిషాలు",h:"ఒక గంట",hh:"%d గంటలు",d:"ఒక రోజు",dd:"%d రోజులు",M:"ఒక నెల",MM:"%d నెలలు",y:"ఒక సంవత్సరం",yy:"%d సంవత్సరాలు"},dayOfMonthOrdinalParse:/\d{1,2}వ/,ordinal:"%dవ",meridiemParse:/రాత్రి|ఉదయం|మధ్యాహ్నం|సాయంత్రం/,meridiemHour:function(e,t){return 12===e&&(e=0),"రాత్రి"===t?e<4?e:e+12:"ఉదయం"===t?e:"మధ్యాహ్నం"===t?e>=10?e:e+12:"సాయంత్రం"===t?e+12:void 0},meridiem:function(e,t,i){return e<4?"రాత్రి":e<10?"ఉదయం":e<17?"మధ్యాహ్నం":e<20?"సాయంత్రం":"రాత్రి"},week:{dow:0,doy:6}})}(i(5093))},2063:(e,t,i)=>{"use strict";if(i.d(t,{A:()=>r}),/^(7(06|92|96)|140)$/.test(i.j))var n=i(7604);function r(e){return["table","td","th"].indexOf((0,n.A)(e))>=0}},2083:(e,t,i)=>{"use strict";if(i.d(t,{A:()=>o}),/^(7(06|92|96)|140)$/.test(i.j))var n=i(7604);if(/^(7(06|92|96)|140)$/.test(i.j))var r=i(9760);if(/^(7(06|92|96)|140)$/.test(i.j))var s=i(5581);function o(e){return"html"===(0,n.A)(e)?e:e.assignedSlot||e.parentNode||((0,s.Ng)(e)?e.host:null)||(0,r.A)(e)}},2124:function(e,t,i){!function(e){"use strict";function t(e,t,i,n){var r={s:["थोडया सॅकंडांनी","थोडे सॅकंड"],ss:[e+" सॅकंडांनी",e+" सॅकंड"],m:["एका मिणटान","एक मिनूट"],mm:[e+" मिणटांनी",e+" मिणटां"],h:["एका वरान","एक वर"],hh:[e+" वरांनी",e+" वरां"],d:["एका दिसान","एक दीस"],dd:[e+" दिसांनी",e+" दीस"],M:["एका म्हयन्यान","एक म्हयनो"],MM:[e+" म्हयन्यानी",e+" म्हयने"],y:["एका वर्सान","एक वर्स"],yy:[e+" वर्सांनी",e+" वर्सां"]};return n?r[i][0]:r[i][1]}e.defineLocale("gom-deva",{months:{standalone:"जानेवारी_फेब्रुवारी_मार्च_एप्रील_मे_जून_जुलय_ऑगस्ट_सप्टेंबर_ऑक्टोबर_नोव्हेंबर_डिसेंबर".split("_"),format:"जानेवारीच्या_फेब्रुवारीच्या_मार्चाच्या_एप्रीलाच्या_मेयाच्या_जूनाच्या_जुलयाच्या_ऑगस्टाच्या_सप्टेंबराच्या_ऑक्टोबराच्या_नोव्हेंबराच्या_डिसेंबराच्या".split("_"),isFormat:/MMMM(\s)+D[oD]?/},monthsShort:"जाने._फेब्रु._मार्च_एप्री._मे_जून_जुल._ऑग._सप्टें._ऑक्टो._नोव्हें._डिसें.".split("_"),monthsParseExact:!0,weekdays:"आयतार_सोमार_मंगळार_बुधवार_बिरेस्तार_सुक्रार_शेनवार".split("_"),weekdaysShort:"आयत._सोम._मंगळ._बुध._ब्रेस्त._सुक्र._शेन.".split("_"),weekdaysMin:"आ_सो_मं_बु_ब्रे_सु_शे".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"A h:mm [वाजतां]",LTS:"A h:mm:ss [वाजतां]",L:"DD-MM-YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY A h:mm [वाजतां]",LLLL:"dddd, MMMM Do, YYYY, A h:mm [वाजतां]",llll:"ddd, D MMM YYYY, A h:mm [वाजतां]"},calendar:{sameDay:"[आयज] LT",nextDay:"[फाल्यां] LT",nextWeek:"[फुडलो] dddd[,] LT",lastDay:"[काल] LT",lastWeek:"[फाटलो] dddd[,] LT",sameElse:"L"},relativeTime:{future:"%s",past:"%s आदीं",s:t,ss:t,m:t,mm:t,h:t,hh:t,d:t,dd:t,M:t,MM:t,y:t,yy:t},dayOfMonthOrdinalParse:/\d{1,2}(वेर)/,ordinal:function(e,t){return"D"===t?e+"वेर":e},week:{dow:0,doy:3},meridiemParse:/राती|सकाळीं|दनपारां|सांजे/,meridiemHour:function(e,t){return 12===e&&(e=0),"राती"===t?e<4?e:e+12:"सकाळीं"===t?e:"दनपारां"===t?e>12?e:e+12:"सांजे"===t?e+12:void 0},meridiem:function(e,t,i){return e<4?"राती":e<12?"सकाळीं":e<16?"दनपारां":e<20?"सांजे":"राती"}})}(i(5093))},2218:function(e,t,i){!function(e){"use strict";e.defineLocale("yo",{months:"Sẹ́rẹ́_Èrèlè_Ẹrẹ̀nà_Ìgbé_Èbibi_Òkùdu_Agẹmo_Ògún_Owewe_Ọ̀wàrà_Bélú_Ọ̀pẹ̀̀".split("_"),monthsShort:"Sẹ́r_Èrl_Ẹrn_Ìgb_Èbi_Òkù_Agẹ_Ògú_Owe_Ọ̀wà_Bél_Ọ̀pẹ̀̀".split("_"),weekdays:"Àìkú_Ajé_Ìsẹ́gun_Ọjọ́rú_Ọjọ́bọ_Ẹtì_Àbámẹ́ta".split("_"),weekdaysShort:"Àìk_Ajé_Ìsẹ́_Ọjr_Ọjb_Ẹtì_Àbá".split("_"),weekdaysMin:"Àì_Aj_Ìs_Ọr_Ọb_Ẹt_Àb".split("_"),longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY h:mm A",LLLL:"dddd, D MMMM YYYY h:mm A"},calendar:{sameDay:"[Ònì ni] LT",nextDay:"[Ọ̀la ni] LT",nextWeek:"dddd [Ọsẹ̀ tón'bọ] [ni] LT",lastDay:"[Àna ni] LT",lastWeek:"dddd [Ọsẹ̀ tólọ́] [ni] LT",sameElse:"L"},relativeTime:{future:"ní %s",past:"%s kọjá",s:"ìsẹjú aayá die",ss:"aayá %d",m:"ìsẹjú kan",mm:"ìsẹjú %d",h:"wákati kan",hh:"wákati %d",d:"ọjọ́ kan",dd:"ọjọ́ %d",M:"osù kan",MM:"osù %d",y:"ọdún kan",yy:"ọdún %d"},dayOfMonthOrdinalParse:/ọjọ́\s\d{1,2}/,ordinal:"ọjọ́ %d",week:{dow:1,doy:4}})}(i(5093))},2264:function(e,t,i){!function(e){"use strict";var t={1:"၁",2:"၂",3:"၃",4:"၄",5:"၅",6:"၆",7:"၇",8:"၈",9:"၉",0:"၀"},i={"၁":"1","၂":"2","၃":"3","၄":"4","၅":"5","၆":"6","၇":"7","၈":"8","၉":"9","၀":"0"};e.defineLocale("my",{months:"ဇန်နဝါရီ_ဖေဖော်ဝါရီ_မတ်_ဧပြီ_မေ_ဇွန်_ဇူလိုင်_သြဂုတ်_စက်တင်ဘာ_အောက်တိုဘာ_နိုဝင်ဘာ_ဒီဇင်ဘာ".split("_"),monthsShort:"ဇန်_ဖေ_မတ်_ပြီ_မေ_ဇွန်_လိုင်_သြ_စက်_အောက်_နို_ဒီ".split("_"),weekdays:"တနင်္ဂနွေ_တနင်္လာ_အင်္ဂါ_ဗုဒ္ဓဟူး_ကြာသပတေး_သောကြာ_စနေ".split("_"),weekdaysShort:"နွေ_လာ_ဂါ_ဟူး_ကြာ_သော_နေ".split("_"),weekdaysMin:"နွေ_လာ_ဂါ_ဟူး_ကြာ_သော_နေ".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[ယနေ.] LT [မှာ]",nextDay:"[မနက်ဖြန်] LT [မှာ]",nextWeek:"dddd LT [မှာ]",lastDay:"[မနေ.က] LT [မှာ]",lastWeek:"[ပြီးခဲ့သော] dddd LT [မှာ]",sameElse:"L"},relativeTime:{future:"လာမည့် %s မှာ",past:"လွန်ခဲ့သော %s က",s:"စက္ကန်.အနည်းငယ်",ss:"%d စက္ကန့်",m:"တစ်မိနစ်",mm:"%d မိနစ်",h:"တစ်နာရီ",hh:"%d နာရီ",d:"တစ်ရက်",dd:"%d ရက်",M:"တစ်လ",MM:"%d လ",y:"တစ်နှစ်",yy:"%d နှစ်"},preparse:function(e){return e.replace(/[၁၂၃၄၅၆၇၈၉၀]/g,function(e){return i[e]})},postformat:function(e){return e.replace(/\d/g,function(e){return t[e]})},week:{dow:1,doy:4}})}(i(5093))},2271:function(e,t,i){!function(e){"use strict";function t(e,t,i){return"m"===i?t?"минута":"минуту":e+" "+(n=+e,r={ss:t?"секунда_секунды_секунд":"секунду_секунды_секунд",mm:t?"минута_минуты_минут":"минуту_минуты_минут",hh:"час_часа_часов",dd:"день_дня_дней",ww:"неделя_недели_недель",MM:"месяц_месяца_месяцев",yy:"год_года_лет"}[i].split("_"),n%10==1&&n%100!=11?r[0]:n%10>=2&&n%10<=4&&(n%100<10||n%100>=20)?r[1]:r[2]);var n,r}var i=[/^янв/i,/^фев/i,/^мар/i,/^апр/i,/^ма[йя]/i,/^июн/i,/^июл/i,/^авг/i,/^сен/i,/^окт/i,/^ноя/i,/^дек/i];e.defineLocale("ru",{months:{format:"января_февраля_марта_апреля_мая_июня_июля_августа_сентября_октября_ноября_декабря".split("_"),standalone:"январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь".split("_")},monthsShort:{format:"янв._февр._мар._апр._мая_июня_июля_авг._сент._окт._нояб._дек.".split("_"),standalone:"янв._февр._март_апр._май_июнь_июль_авг._сент._окт._нояб._дек.".split("_")},weekdays:{standalone:"воскресенье_понедельник_вторник_среда_четверг_пятница_суббота".split("_"),format:"воскресенье_понедельник_вторник_среду_четверг_пятницу_субботу".split("_"),isFormat:/\[ ?[Вв] ?(?:прошлую|следующую|эту)? ?] ?dddd/},weekdaysShort:"вс_пн_вт_ср_чт_пт_сб".split("_"),weekdaysMin:"вс_пн_вт_ср_чт_пт_сб".split("_"),monthsParse:i,longMonthsParse:i,shortMonthsParse:i,monthsRegex:/^(январ[ья]|янв\.?|феврал[ья]|февр?\.?|марта?|мар\.?|апрел[ья]|апр\.?|ма[йя]|июн[ья]|июн\.?|июл[ья]|июл\.?|августа?|авг\.?|сентябр[ья]|сент?\.?|октябр[ья]|окт\.?|ноябр[ья]|нояб?\.?|декабр[ья]|дек\.?)/i,monthsShortRegex:/^(январ[ья]|янв\.?|феврал[ья]|февр?\.?|марта?|мар\.?|апрел[ья]|апр\.?|ма[йя]|июн[ья]|июн\.?|июл[ья]|июл\.?|августа?|авг\.?|сентябр[ья]|сент?\.?|октябр[ья]|окт\.?|ноябр[ья]|нояб?\.?|декабр[ья]|дек\.?)/i,monthsStrictRegex:/^(январ[яь]|феврал[яь]|марта?|апрел[яь]|ма[яй]|июн[яь]|июл[яь]|августа?|сентябр[яь]|октябр[яь]|ноябр[яь]|декабр[яь])/i,monthsShortStrictRegex:/^(янв\.|февр?\.|мар[т.]|апр\.|ма[яй]|июн[ья.]|июл[ья.]|авг\.|сент?\.|окт\.|нояб?\.|дек\.)/i,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY г.",LLL:"D MMMM YYYY г., H:mm",LLLL:"dddd, D MMMM YYYY г., H:mm"},calendar:{sameDay:"[Сегодня, в] LT",nextDay:"[Завтра, в] LT",lastDay:"[Вчера, в] LT",nextWeek:function(e){if(e.week()===this.week())return 2===this.day()?"[Во] dddd, [в] LT":"[В] dddd, [в] LT";switch(this.day()){case 0:return"[В следующее] dddd, [в] LT";case 1:case 2:case 4:return"[В следующий] dddd, [в] LT";case 3:case 5:case 6:return"[В следующую] dddd, [в] LT"}},lastWeek:function(e){if(e.week()===this.week())return 2===this.day()?"[Во] dddd, [в] LT":"[В] dddd, [в] LT";switch(this.day()){case 0:return"[В прошлое] dddd, [в] LT";case 1:case 2:case 4:return"[В прошлый] dddd, [в] LT";case 3:case 5:case 6:return"[В прошлую] dddd, [в] LT"}},sameElse:"L"},relativeTime:{future:"через %s",past:"%s назад",s:"несколько секунд",ss:t,m:t,mm:t,h:"час",hh:t,d:"день",dd:t,w:"неделя",ww:t,M:"месяц",MM:t,y:"год",yy:t},meridiemParse:/ночи|утра|дня|вечера/i,isPM:function(e){return/^(дня|вечера)$/.test(e)},meridiem:function(e,t,i){return e<4?"ночи":e<12?"утра":e<17?"дня":"вечера"},dayOfMonthOrdinalParse:/\d{1,2}-(й|го|я)/,ordinal:function(e,t){switch(t){case"M":case"d":case"DDD":return e+"-й";case"D":return e+"-го";case"w":case"W":return e+"-я";default:return e}},week:{dow:1,doy:4}})}(i(5093))},2274:function(e,t,i){!function(e){"use strict";e.defineLocale("nb",{months:"januar_februar_mars_april_mai_juni_juli_august_september_oktober_november_desember".split("_"),monthsShort:"jan._feb._mars_apr._mai_juni_juli_aug._sep._okt._nov._des.".split("_"),monthsParseExact:!0,weekdays:"søndag_mandag_tirsdag_onsdag_torsdag_fredag_lørdag".split("_"),weekdaysShort:"sø._ma._ti._on._to._fr._lø.".split("_"),weekdaysMin:"sø_ma_ti_on_to_fr_lø".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY [kl.] HH:mm",LLLL:"dddd D. MMMM YYYY [kl.] HH:mm"},calendar:{sameDay:"[i dag kl.] LT",nextDay:"[i morgen kl.] LT",nextWeek:"dddd [kl.] LT",lastDay:"[i går kl.] LT",lastWeek:"[forrige] dddd [kl.] LT",sameElse:"L"},relativeTime:{future:"om %s",past:"%s siden",s:"noen sekunder",ss:"%d sekunder",m:"ett minutt",mm:"%d minutter",h:"én time",hh:"%d timer",d:"én dag",dd:"%d dager",w:"én uke",ww:"%d uker",M:"én måned",MM:"%d måneder",y:"ett år",yy:"%d år"},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(i(5093))},2283:(e,t,i)=>{"use strict";if(i.d(t,{A:()=>r}),/^(7(06|92|96)|140)$/.test(i.j))var n=i(2398);function r(){return!/^((?!chrome|android).)*safari/i.test((0,n.A)())}},2297:function(e,t,i){!function(e){"use strict";e.defineLocale("ms-my",{months:"Januari_Februari_Mac_April_Mei_Jun_Julai_Ogos_September_Oktober_November_Disember".split("_"),monthsShort:"Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ogs_Sep_Okt_Nov_Dis".split("_"),weekdays:"Ahad_Isnin_Selasa_Rabu_Khamis_Jumaat_Sabtu".split("_"),weekdaysShort:"Ahd_Isn_Sel_Rab_Kha_Jum_Sab".split("_"),weekdaysMin:"Ah_Is_Sl_Rb_Km_Jm_Sb".split("_"),longDateFormat:{LT:"HH.mm",LTS:"HH.mm.ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY [pukul] HH.mm",LLLL:"dddd, D MMMM YYYY [pukul] HH.mm"},meridiemParse:/pagi|tengahari|petang|malam/,meridiemHour:function(e,t){return 12===e&&(e=0),"pagi"===t?e:"tengahari"===t?e>=11?e:e+12:"petang"===t||"malam"===t?e+12:void 0},meridiem:function(e,t,i){return e<11?"pagi":e<15?"tengahari":e<19?"petang":"malam"},calendar:{sameDay:"[Hari ini pukul] LT",nextDay:"[Esok pukul] LT",nextWeek:"dddd [pukul] LT",lastDay:"[Kelmarin pukul] LT",lastWeek:"dddd [lepas pukul] LT",sameElse:"L"},relativeTime:{future:"dalam %s",past:"%s yang lepas",s:"beberapa saat",ss:"%d saat",m:"seminit",mm:"%d minit",h:"sejam",hh:"%d jam",d:"sehari",dd:"%d hari",M:"sebulan",MM:"%d bulan",y:"setahun",yy:"%d tahun"},week:{dow:1,doy:7}})}(i(5093))},2323:(e,t,i)=>{"use strict";i.d(t,{v:()=>n});class n{constructor(e){this.element=e,this.verticalBorderSize=this._styleProp("borderTopWidth")+this._styleProp("borderBottomWidth")||0,this._inputHandler=this._inputHandler.bind(this),e.addEventListener("input",this._inputHandler),this.update()}_inputHandler(e){this.update()}destroy(){this.removeEventListener("input",this._inputHandler),this.element=null}update(){const e=this._styleProp("fontSize");this.element.style.height=`${e}px`;const t=this.element.scrollHeight+this.verticalBorderSize;this.element.style.height=`${t}px`}_styleProp(e){const t=getComputedStyle(this.element,null);return parseInt(t[e])}}},2353:function(e,t,i){!function(e){"use strict";var t={1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9",0:"0"},i=function(e){return 0===e?0:1===e?1:2===e?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5},n={s:["أقل من ثانية","ثانية واحدة",["ثانيتان","ثانيتين"],"%d ثوان","%d ثانية","%d ثانية"],m:["أقل من دقيقة","دقيقة واحدة",["دقيقتان","دقيقتين"],"%d دقائق","%d دقيقة","%d دقيقة"],h:["أقل من ساعة","ساعة واحدة",["ساعتان","ساعتين"],"%d ساعات","%d ساعة","%d ساعة"],d:["أقل من يوم","يوم واحد",["يومان","يومين"],"%d أيام","%d يومًا","%d يوم"],M:["أقل من شهر","شهر واحد",["شهران","شهرين"],"%d أشهر","%d شهرا","%d شهر"],y:["أقل من عام","عام واحد",["عامان","عامين"],"%d أعوام","%d عامًا","%d عام"]},r=function(e){return function(t,r,s,o){var a=i(t),l=n[e][i(t)];return 2===a&&(l=l[r?0:1]),l.replace(/%d/i,t)}},s=["يناير","فبراير","مارس","أبريل","مايو","يونيو","يوليو","أغسطس","سبتمبر","أكتوبر","نوفمبر","ديسمبر"];e.defineLocale("ar-ly",{months:s,monthsShort:s,weekdays:"الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),weekdaysShort:"أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت".split("_"),weekdaysMin:"ح_ن_ث_ر_خ_ج_س".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"D/‏M/‏YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},meridiemParse:/ص|م/,isPM:function(e){return"م"===e},meridiem:function(e,t,i){return e<12?"ص":"م"},calendar:{sameDay:"[اليوم عند الساعة] LT",nextDay:"[غدًا عند الساعة] LT",nextWeek:"dddd [عند الساعة] LT",lastDay:"[أمس عند الساعة] LT",lastWeek:"dddd [عند الساعة] LT",sameElse:"L"},relativeTime:{future:"بعد %s",past:"منذ %s",s:r("s"),ss:r("s"),m:r("m"),mm:r("m"),h:r("h"),hh:r("h"),d:r("d"),dd:r("d"),M:r("M"),MM:r("M"),y:r("y"),yy:r("y")},preparse:function(e){return e.replace(/،/g,",")},postformat:function(e){return e.replace(/\d/g,function(e){return t[e]}).replace(/,/g,"،")},week:{dow:6,doy:12}})}(i(5093))},2398:(e,t,i)=>{"use strict";function n(){var e=navigator.userAgentData;return null!=e&&e.brands&&Array.isArray(e.brands)?e.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}i.d(t,{A:()=>n})},2475:function(e,t,i){!function(e){"use strict";e.defineLocale("uz-latn",{months:"Yanvar_Fevral_Mart_Aprel_May_Iyun_Iyul_Avgust_Sentabr_Oktabr_Noyabr_Dekabr".split("_"),monthsShort:"Yan_Fev_Mar_Apr_May_Iyun_Iyul_Avg_Sen_Okt_Noy_Dek".split("_"),weekdays:"Yakshanba_Dushanba_Seshanba_Chorshanba_Payshanba_Juma_Shanba".split("_"),weekdaysShort:"Yak_Dush_Sesh_Chor_Pay_Jum_Shan".split("_"),weekdaysMin:"Ya_Du_Se_Cho_Pa_Ju_Sha".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"D MMMM YYYY, dddd HH:mm"},calendar:{sameDay:"[Bugun soat] LT [da]",nextDay:"[Ertaga] LT [da]",nextWeek:"dddd [kuni soat] LT [da]",lastDay:"[Kecha soat] LT [da]",lastWeek:"[O'tgan] dddd [kuni soat] LT [da]",sameElse:"L"},relativeTime:{future:"Yaqin %s ichida",past:"Bir necha %s oldin",s:"soniya",ss:"%d soniya",m:"bir daqiqa",mm:"%d daqiqa",h:"bir soat",hh:"%d soat",d:"bir kun",dd:"%d kun",M:"bir oy",MM:"%d oy",y:"bir yil",yy:"%d yil"},week:{dow:1,doy:7}})}(i(5093))},2477:function(e,t,i){!function(e){"use strict";e.defineLocale("fo",{months:"januar_februar_mars_apríl_mai_juni_juli_august_september_oktober_november_desember".split("_"),monthsShort:"jan_feb_mar_apr_mai_jun_jul_aug_sep_okt_nov_des".split("_"),weekdays:"sunnudagur_mánadagur_týsdagur_mikudagur_hósdagur_fríggjadagur_leygardagur".split("_"),weekdaysShort:"sun_mán_týs_mik_hós_frí_ley".split("_"),weekdaysMin:"su_má_tý_mi_hó_fr_le".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D. MMMM, YYYY HH:mm"},calendar:{sameDay:"[Í dag kl.] LT",nextDay:"[Í morgin kl.] LT",nextWeek:"dddd [kl.] LT",lastDay:"[Í gjár kl.] LT",lastWeek:"[síðstu] dddd [kl] LT",sameElse:"L"},relativeTime:{future:"um %s",past:"%s síðani",s:"fá sekund",ss:"%d sekundir",m:"ein minuttur",mm:"%d minuttir",h:"ein tími",hh:"%d tímar",d:"ein dagur",dd:"%d dagar",M:"ein mánaður",MM:"%d mánaðir",y:"eitt ár",yy:"%d ár"},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(i(5093))},2572:function(e,t,i){!function(e){"use strict";var t="jan._feb._mrt._apr._mei_jun._jul._aug._sep._okt._nov._dec.".split("_"),i="jan_feb_mrt_apr_mei_jun_jul_aug_sep_okt_nov_dec".split("_"),n=[/^jan/i,/^feb/i,/^(maart|mrt\.?)$/i,/^apr/i,/^mei$/i,/^jun[i.]?$/i,/^jul[i.]?$/i,/^aug/i,/^sep/i,/^okt/i,/^nov/i,/^dec/i],r=/^(januari|februari|maart|april|mei|ju[nl]i|augustus|september|oktober|november|december|jan\.?|feb\.?|mrt\.?|apr\.?|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i;e.defineLocale("nl",{months:"januari_februari_maart_april_mei_juni_juli_augustus_september_oktober_november_december".split("_"),monthsShort:function(e,n){return e?/-MMM-/.test(n)?i[e.month()]:t[e.month()]:t},monthsRegex:r,monthsShortRegex:r,monthsStrictRegex:/^(januari|februari|maart|april|mei|ju[nl]i|augustus|september|oktober|november|december)/i,monthsShortStrictRegex:/^(jan\.?|feb\.?|mrt\.?|apr\.?|mei|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i,monthsParse:n,longMonthsParse:n,shortMonthsParse:n,weekdays:"zondag_maandag_dinsdag_woensdag_donderdag_vrijdag_zaterdag".split("_"),weekdaysShort:"zo._ma._di._wo._do._vr._za.".split("_"),weekdaysMin:"zo_ma_di_wo_do_vr_za".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD-MM-YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[vandaag om] LT",nextDay:"[morgen om] LT",nextWeek:"dddd [om] LT",lastDay:"[gisteren om] LT",lastWeek:"[afgelopen] dddd [om] LT",sameElse:"L"},relativeTime:{future:"over %s",past:"%s geleden",s:"een paar seconden",ss:"%d seconden",m:"één minuut",mm:"%d minuten",h:"één uur",hh:"%d uur",d:"één dag",dd:"%d dagen",w:"één week",ww:"%d weken",M:"één maand",MM:"%d maanden",y:"één jaar",yy:"%d jaar"},dayOfMonthOrdinalParse:/\d{1,2}(ste|de)/,ordinal:function(e){return e+(1===e||8===e||e>=20?"ste":"de")},week:{dow:1,doy:4}})}(i(5093))},2632:(e,t,i)=>{"use strict";function n(e){return e.split("-")[0]}i.d(t,{A:()=>n})},2648:function(e,t,i){!function(e){"use strict";e.defineLocale("zh-cn",{months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"周日_周一_周二_周三_周四_周五_周六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日Ah点mm分",LLLL:"YYYY年M月D日ddddAh点mm分",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},meridiemParse:/凌晨|早上|上午|中午|下午|晚上/,meridiemHour:function(e,t){return 12===e&&(e=0),"凌晨"===t||"早上"===t||"上午"===t?e:"下午"===t||"晚上"===t?e+12:e>=11?e:e+12},meridiem:function(e,t,i){var n=100*e+t;return n<600?"凌晨":n<900?"早上":n<1130?"上午":n<1230?"中午":n<1800?"下午":"晚上"},calendar:{sameDay:"[今天]LT",nextDay:"[明天]LT",nextWeek:function(e){return e.week()!==this.week()?"[下]dddLT":"[本]dddLT"},lastDay:"[昨天]LT",lastWeek:function(e){return this.week()!==e.week()?"[上]dddLT":"[本]dddLT"},sameElse:"L"},dayOfMonthOrdinalParse:/\d{1,2}(日|月|周)/,ordinal:function(e,t){switch(t){case"d":case"D":case"DDD":return e+"日";case"M":return e+"月";case"w":case"W":return e+"周";default:return e}},relativeTime:{future:"%s后",past:"%s前",s:"几秒",ss:"%d 秒",m:"1 分钟",mm:"%d 分钟",h:"1 小时",hh:"%d 小时",d:"1 天",dd:"%d 天",w:"1 周",ww:"%d 周",M:"1 个月",MM:"%d 个月",y:"1 年",yy:"%d 年"},week:{dow:1,doy:4}})}(i(5093))},2682:function(e,t,i){!function(e){"use strict";var t={1:"١",2:"٢",3:"٣",4:"٤",5:"٥",6:"٦",7:"٧",8:"٨",9:"٩",0:"٠"},i={"١":"1","٢":"2","٣":"3","٤":"4","٥":"5","٦":"6","٧":"7","٨":"8","٩":"9","٠":"0"};e.defineLocale("ar-sa",{months:"يناير_فبراير_مارس_أبريل_مايو_يونيو_يوليو_أغسطس_سبتمبر_أكتوبر_نوفمبر_ديسمبر".split("_"),monthsShort:"يناير_فبراير_مارس_أبريل_مايو_يونيو_يوليو_أغسطس_سبتمبر_أكتوبر_نوفمبر_ديسمبر".split("_"),weekdays:"الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),weekdaysShort:"أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت".split("_"),weekdaysMin:"ح_ن_ث_ر_خ_ج_س".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},meridiemParse:/ص|م/,isPM:function(e){return"م"===e},meridiem:function(e,t,i){return e<12?"ص":"م"},calendar:{sameDay:"[اليوم على الساعة] LT",nextDay:"[غدا على الساعة] LT",nextWeek:"dddd [على الساعة] LT",lastDay:"[أمس على الساعة] LT",lastWeek:"dddd [على الساعة] LT",sameElse:"L"},relativeTime:{future:"في %s",past:"منذ %s",s:"ثوان",ss:"%d ثانية",m:"دقيقة",mm:"%d دقائق",h:"ساعة",hh:"%d ساعات",d:"يوم",dd:"%d أيام",M:"شهر",MM:"%d أشهر",y:"سنة",yy:"%d سنوات"},preparse:function(e){return e.replace(/[١٢٣٤٥٦٧٨٩٠]/g,function(e){return i[e]}).replace(/،/g,",")},postformat:function(e){return e.replace(/\d/g,function(e){return t[e]}).replace(/,/g,"،")},week:{dow:0,doy:6}})}(i(5093))},2883:(e,t,i)=>{"use strict";if(i.d(t,{A:()=>y}),/^(7(06|92|96)|140)$/.test(i.j))var n=i(4278);if(/^(7(06|92|96)|140)$/.test(i.j))var r=i(5487);if(/^(7(06|92|96)|140)$/.test(i.j))var s=i(8848);if(/^(7(06|92|96)|140)$/.test(i.j))var o=i(3341);if(/^(7(06|92|96)|140)$/.test(i.j))var a=i(5128);if(/^(7(06|92|96)|140)$/.test(i.j))var l=i(9760);if(/^(7(06|92|96)|140)$/.test(i.j))var c=i(271);if(/^(7(06|92|96)|140)$/.test(i.j))var h=i(5581);if(/^(7(06|92|96)|140)$/.test(i.j))var d=i(6354);if(/^(7(06|92|96)|140)$/.test(i.j))var u=i(2083);if(/^(7(06|92|96)|140)$/.test(i.j))var f=i(5446);if(/^(7(06|92|96)|140)$/.test(i.j))var p=i(7604);if(/^(7(06|92|96)|140)$/.test(i.j))var m=i(4426);if(/^(7(06|92|96)|140)$/.test(i.j))var g=i(6906);function _(e,t,i){return t===n.R9?(0,m.A)((0,r.A)(e,i)):(0,h.vq)(t)?function(e,t){var i=(0,d.A)(e,!1,"fixed"===t);return i.top=i.top+e.clientTop,i.left=i.left+e.clientLeft,i.bottom=i.top+e.clientHeight,i.right=i.left+e.clientWidth,i.width=e.clientWidth,i.height=e.clientHeight,i.x=i.left,i.y=i.top,i}(t,i):(0,m.A)((0,s.A)((0,l.A)(e)))}function y(e,t,i,n){var r="clippingParents"===t?function(e){var t=(0,o.A)((0,u.A)(e)),i=["absolute","fixed"].indexOf((0,c.A)(e).position)>=0&&(0,h.sb)(e)?(0,a.A)(e):e;return(0,h.vq)(i)?t.filter(function(e){return(0,h.vq)(e)&&(0,f.A)(e,i)&&"body"!==(0,p.A)(e)}):[]}(e):[].concat(t),s=[].concat(r,[i]),l=s[0],d=s.reduce(function(t,i){var r=_(e,i,n);return t.top=(0,g.T9)(r.top,t.top),t.right=(0,g.jk)(r.right,t.right),t.bottom=(0,g.jk)(r.bottom,t.bottom),t.left=(0,g.T9)(r.left,t.left),t},_(e,l,n));return d.width=d.right-d.left,d.height=d.bottom-d.top,d.x=d.left,d.y=d.top,d}},2934:function(e,t,i){!function(e){"use strict";e.defineLocale("eo",{months:"januaro_februaro_marto_aprilo_majo_junio_julio_aŭgusto_septembro_oktobro_novembro_decembro".split("_"),monthsShort:"jan_feb_mart_apr_maj_jun_jul_aŭg_sept_okt_nov_dec".split("_"),weekdays:"dimanĉo_lundo_mardo_merkredo_ĵaŭdo_vendredo_sabato".split("_"),weekdaysShort:"dim_lun_mard_merk_ĵaŭ_ven_sab".split("_"),weekdaysMin:"di_lu_ma_me_ĵa_ve_sa".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY-MM-DD",LL:"[la] D[-an de] MMMM, YYYY",LLL:"[la] D[-an de] MMMM, YYYY HH:mm",LLLL:"dddd[n], [la] D[-an de] MMMM, YYYY HH:mm",llll:"ddd, [la] D[-an de] MMM, YYYY HH:mm"},meridiemParse:/[ap]\.t\.m/i,isPM:function(e){return"p"===e.charAt(0).toLowerCase()},meridiem:function(e,t,i){return e>11?i?"p.t.m.":"P.T.M.":i?"a.t.m.":"A.T.M."},calendar:{sameDay:"[Hodiaŭ je] LT",nextDay:"[Morgaŭ je] LT",nextWeek:"dddd[n je] LT",lastDay:"[Hieraŭ je] LT",lastWeek:"[pasintan] dddd[n je] LT",sameElse:"L"},relativeTime:{future:"post %s",past:"antaŭ %s",s:"kelkaj sekundoj",ss:"%d sekundoj",m:"unu minuto",mm:"%d minutoj",h:"unu horo",hh:"%d horoj",d:"unu tago",dd:"%d tagoj",M:"unu monato",MM:"%d monatoj",y:"unu jaro",yy:"%d jaroj"},dayOfMonthOrdinalParse:/\d{1,2}a/,ordinal:"%da",week:{dow:1,doy:7}})}(i(5093))},3004:function(e,t,i){!function(e){"use strict";e.defineLocale("en-sg",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},dayOfMonthOrdinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(e){var t=e%10;return e+(1==~~(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th")},week:{dow:1,doy:4}})}(i(5093))},3035:function(e,t,i){!function(e){"use strict";function t(e,t,i,n){var r={s:["mõne sekundi","mõni sekund","paar sekundit"],ss:[e+"sekundi",e+"sekundit"],m:["ühe minuti","üks minut"],mm:[e+" minuti",e+" minutit"],h:["ühe tunni","tund aega","üks tund"],hh:[e+" tunni",e+" tundi"],d:["ühe päeva","üks päev"],M:["kuu aja","kuu aega","üks kuu"],MM:[e+" kuu",e+" kuud"],y:["ühe aasta","aasta","üks aasta"],yy:[e+" aasta",e+" aastat"]};return t?r[i][2]?r[i][2]:r[i][1]:n?r[i][0]:r[i][1]}e.defineLocale("et",{months:"jaanuar_veebruar_märts_aprill_mai_juuni_juuli_august_september_oktoober_november_detsember".split("_"),monthsShort:"jaan_veebr_märts_apr_mai_juuni_juuli_aug_sept_okt_nov_dets".split("_"),weekdays:"pühapäev_esmaspäev_teisipäev_kolmapäev_neljapäev_reede_laupäev".split("_"),weekdaysShort:"P_E_T_K_N_R_L".split("_"),weekdaysMin:"P_E_T_K_N_R_L".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm",LLLL:"dddd, D. MMMM YYYY H:mm"},calendar:{sameDay:"[Täna,] LT",nextDay:"[Homme,] LT",nextWeek:"[Järgmine] dddd LT",lastDay:"[Eile,] LT",lastWeek:"[Eelmine] dddd LT",sameElse:"L"},relativeTime:{future:"%s pärast",past:"%s tagasi",s:t,ss:t,m:t,mm:t,h:t,hh:t,d:t,dd:"%d päeva",M:t,MM:t,y:t,yy:t},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(i(5093))},3041:(e,t,i)=>{"use strict";i.d(t,{A:()=>g});var n=i(7363),r=i(9174),s=i(172);class o extends r.B{constructor(){super(...arguments),this.state={textId:(0,r.a3)()}}render(){let{theme:e,dateEnv:t,options:i,viewApi:n}=this.context,{cellId:o,dayDate:l,todayRange:c}=this.props,{textId:h}=this.state,d=(0,r.aY)(l,c),u=i.listDayFormat?t.format(l,i.listDayFormat):"",f=i.listDaySideFormat?t.format(l,i.listDaySideFormat):"",p=Object.assign({date:t.toDate(l),view:n,textId:h,text:u,sideText:f,navLinkAttrs:(0,r.a_)(this.context,l),sideNavLinkAttrs:(0,r.a_)(this.context,l,"day",!1)},d);return(0,s.n)(r.C,{elTag:"tr",elClasses:["fc-list-day",...(0,r.aX)(d,e)],elAttrs:{"data-date":(0,r.bt)(l)},renderProps:p,generatorName:"dayHeaderContent",customGenerator:i.dayHeaderContent,defaultGenerator:a,classNameGenerator:i.dayHeaderClassNames,didMount:i.dayHeaderDidMount,willUnmount:i.dayHeaderWillUnmount},t=>(0,s.n)("th",{scope:"colgroup",colSpan:3,id:o,"aria-labelledby":h},(0,s.n)(t,{elTag:"div",elClasses:["fc-list-day-cushion",e.getClass("tableCellShaded")]})))}}function a(e){return(0,s.n)(s.FK,null,e.text&&(0,s.n)("a",Object.assign({id:e.textId,className:"fc-list-day-text"},e.navLinkAttrs),e.text),e.sideText&&(0,s.n)("a",Object.assign({"aria-hidden":!0,className:"fc-list-day-side-text"},e.sideNavLinkAttrs),e.sideText))}const l=(0,r.x)({hour:"numeric",minute:"2-digit",meridiem:"short"});class c extends r.B{render(){let{props:e,context:t}=this,{options:i}=t,{seg:n,timeHeaderId:o,eventHeaderId:a,dateHeaderId:c}=e,d=i.eventTimeFormat||l;return(0,s.n)(r.ck,Object.assign({},e,{elTag:"tr",elClasses:["fc-list-event",n.eventRange.def.url&&"fc-event-forced-url"],defaultGenerator:()=>function(e,t){let i=(0,r.bS)(e,t);return(0,s.n)("a",Object.assign({},i),e.eventRange.def.title)}(n,t),seg:n,timeText:"",disableDragging:!0,disableResizing:!0}),(e,i)=>(0,s.n)(s.FK,null,function(e,t,i,n,o){let{options:a}=i;if(!1!==a.displayEventTime){let l,c=e.eventRange.def,d=e.eventRange.instance,u=!1;if(c.allDay?u=!0:(0,r.ax)(e.eventRange.range)?e.isStart?l=(0,r.bO)(e,t,i,null,null,d.range.start,e.end):e.isEnd?l=(0,r.bO)(e,t,i,null,null,e.start,d.range.end):u=!0:l=(0,r.bO)(e,t,i),u){let e={text:i.options.allDayText,view:i.viewApi};return(0,s.n)(r.C,{elTag:"td",elClasses:["fc-list-event-time"],elAttrs:{headers:`${n} ${o}`},renderProps:e,generatorName:"allDayContent",customGenerator:a.allDayContent,defaultGenerator:h,classNameGenerator:a.allDayClassNames,didMount:a.allDayDidMount,willUnmount:a.allDayWillUnmount})}return(0,s.n)("td",{className:"fc-list-event-time"},l)}return null}(n,d,t,o,c),(0,s.n)("td",{"aria-hidden":!0,className:"fc-list-event-graphic"},(0,s.n)("span",{className:"fc-list-event-dot",style:{borderColor:i.borderColor||i.backgroundColor}})),(0,s.n)(e,{elTag:"td",elClasses:["fc-list-event-title"],elAttrs:{headers:`${a} ${c}`}})))}}function h(e){return e.text}class d extends r.bc{constructor(){super(...arguments),this.computeDateVars=(0,r.z)(f),this.eventStoreToSegs=(0,r.z)(this._eventStoreToSegs),this.state={timeHeaderId:(0,r.a3)(),eventHeaderId:(0,r.a3)(),dateHeaderIdRoot:(0,r.a3)()},this.setRootEl=e=>{e?this.context.registerInteractiveComponent(this,{el:e}):this.context.unregisterInteractiveComponent(this)}}render(){let{props:e,context:t}=this,{dayDates:i,dayRanges:n}=this.computeDateVars(e.dateProfile),o=this.eventStoreToSegs(e.eventStore,e.eventUiBases,n);return(0,s.n)(r.cq,{elRef:this.setRootEl,elClasses:["fc-list",t.theme.getClass("table"),!1!==t.options.stickyHeaderDates?"fc-list-sticky":""],viewSpec:t.viewSpec},(0,s.n)(r.cb,{liquid:!e.isHeightAuto,overflowX:e.isHeightAuto?"visible":"hidden",overflowY:e.isHeightAuto?"visible":"auto"},o.length>0?this.renderSegList(o,i):this.renderEmptyMessage()))}renderEmptyMessage(){let{options:e,viewApi:t}=this.context,i={text:e.noEventsText,view:t};return(0,s.n)(r.C,{elTag:"div",elClasses:["fc-list-empty"],renderProps:i,generatorName:"noEventsContent",customGenerator:e.noEventsContent,defaultGenerator:u,classNameGenerator:e.noEventsClassNames,didMount:e.noEventsDidMount,willUnmount:e.noEventsWillUnmount},e=>(0,s.n)(e,{elTag:"div",elClasses:["fc-list-empty-cushion"]}))}renderSegList(e,t){let{theme:i,options:n}=this.context,{timeHeaderId:a,eventHeaderId:l,dateHeaderIdRoot:h}=this.state,d=function(e){let t,i,n=[];for(t=0;t{let f=[];for(let i=0;i*{border-left:0;border-right:0}.fc .fc-list-sticky .fc-list-day>*{background:var(--fc-page-bg-color);position:sticky;top:0}.fc .fc-list-table thead{left:-10000px;position:absolute}.fc .fc-list-table tbody>tr:first-child th{border-top:0}.fc .fc-list-table th{padding:0}.fc .fc-list-day-cushion,.fc .fc-list-table td{padding:8px 14px}.fc .fc-list-day-cushion:after{clear:both;content:"";display:table}.fc-theme-standard .fc-list-day-cushion{background-color:var(--fc-neutral-bg-color)}.fc-direction-ltr .fc-list-day-text,.fc-direction-rtl .fc-list-day-side-text{float:left}.fc-direction-ltr .fc-list-day-side-text,.fc-direction-rtl .fc-list-day-text{float:right}.fc-direction-ltr .fc-list-table .fc-list-event-graphic{padding-right:0}.fc-direction-rtl .fc-list-table .fc-list-event-graphic{padding-left:0}.fc .fc-list-event.fc-event-forced-url{cursor:pointer}.fc .fc-list-event:hover td{background-color:var(--fc-list-event-hover-bg-color)}.fc .fc-list-event-graphic,.fc .fc-list-event-time{white-space:nowrap;width:1px}.fc .fc-list-event-dot{border:calc(var(--fc-list-event-dot-width)/2) solid var(--fc-event-border-color);border-radius:calc(var(--fc-list-event-dot-width)/2);box-sizing:content-box;display:inline-block;height:0;width:0}.fc .fc-list-event-title a{color:inherit;text-decoration:none}.fc .fc-list-event.fc-event-forced-url:hover a{text-decoration:underline}');const p={listDayFormat:m,listDaySideFormat:m,noEventsClassNames:r.n,noEventsContent:r.n,noEventsDidMount:r.n,noEventsWillUnmount:r.n};function m(e){return!1===e?null:(0,r.x)(e)}var g=(0,n.i1)({name:"@fullcalendar/list",optionRefiners:p,views:{list:{component:d,buttonTextKey:"list",listDayFormat:{month:"long",day:"numeric",year:"numeric"}},listDay:{type:"list",duration:{days:1},listDayFormat:{weekday:"long"}},listWeek:{type:"list",duration:{weeks:1},listDayFormat:{weekday:"long"},listDaySideFormat:{month:"long",day:"numeric",year:"numeric"}},listMonth:{type:"list",duration:{month:1},listDaySideFormat:{weekday:"long"}},listYear:{type:"list",duration:{year:1},listDaySideFormat:{weekday:"long"}}}})},3104:(e,t,i)=>{"use strict";i.d(t,{A:()=>mt});var n=i(4692);function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);i=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,a=!1;return{s:function(){i=i.call(e)},n:function(){var e=i.next();return o=e.done,e},e:function(e){a=!0,s=e},f:function(){try{o||null==i.return||i.return()}finally{if(a)throw s}}}}function h(e,t,i){return(t=x(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function d(e){return d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},d(e)}function u(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(u=function(){return!!e})()}function f(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function p(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function m(){m=function(){return t};var e,t={},i=Object.prototype,n=i.hasOwnProperty,r=Object.defineProperty||function(e,t,i){e[t]=i.value},s="function"==typeof Symbol?Symbol:{},o=s.iterator||"@@iterator",a=s.asyncIterator||"@@asyncIterator",l=s.toStringTag||"@@toStringTag";function c(e,t,i){return Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,i){return e[t]=i}}function h(e,t,i,n){var s=t&&t.prototype instanceof _?t:_,o=Object.create(s.prototype),a=new L(n||[]);return r(o,"_invoke",{value:M(e,i,a)}),o}function d(e,t,i){try{return{type:"normal",arg:e.call(t,i)}}catch(e){return{type:"throw",arg:e}}}t.wrap=h;var u="suspendedStart",f="executing",p="completed",g={};function _(){}function y(){}function v(){}var x={};c(x,o,function(){return this});var b=Object.getPrototypeOf,w=b&&b(b(E([])));w&&w!==i&&n.call(w,o)&&(x=w);var S=v.prototype=_.prototype=Object.create(x);function T(e){["next","throw","return"].forEach(function(t){c(e,t,function(e){return this._invoke(t,e)})})}function k(e,t){function i(r,s,o,a){var l=d(e[r],e,s);if("throw"!==l.type){var c=l.arg,h=c.value;return h&&"object"==typeof h&&n.call(h,"__await")?t.resolve(h.__await).then(function(e){i("next",e,o,a)},function(e){i("throw",e,o,a)}):t.resolve(h).then(function(e){c.value=e,o(c)},function(e){return i("throw",e,o,a)})}a(l.arg)}var s;r(this,"_invoke",{value:function(e,n){function r(){return new t(function(t,r){i(e,n,t,r)})}return s=s?s.then(r,r):r()}})}function M(t,i,n){var r=u;return function(s,o){if(r===f)throw Error("Generator is already running");if(r===p){if("throw"===s)throw o;return{value:e,done:!0}}for(n.method=s,n.arg=o;;){var a=n.delegate;if(a){var l=A(a,n);if(l){if(l===g)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===u)throw r=p,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=f;var c=d(t,i,n);if("normal"===c.type){if(r=n.done?p:"suspendedYield",c.arg===g)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(r=p,n.method="throw",n.arg=c.arg)}}}function A(t,i){var n=i.method,r=t.iterator[n];if(r===e)return i.delegate=null,"throw"===n&&t.iterator.return&&(i.method="return",i.arg=e,A(t,i),"throw"===i.method)||"return"!==n&&(i.method="throw",i.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var s=d(r,t.iterator,i.arg);if("throw"===s.type)return i.method="throw",i.arg=s.arg,i.delegate=null,g;var o=s.arg;return o?o.done?(i[t.resultName]=o.value,i.next=t.nextLoc,"return"!==i.method&&(i.method="next",i.arg=e),i.delegate=null,g):o:(i.method="throw",i.arg=new TypeError("iterator result is not an object"),i.delegate=null,g)}function C(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function D(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(C,this),this.reset(!0)}function E(t){if(t||""===t){var i=t[o];if(i)return i.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,s=function i(){for(;++r=0;--s){var o=this.tryEntries[s],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var l=n.call(o,"catchLoc"),c=n.call(o,"finallyLoc");if(l&&c){if(this.prev=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev=0;--t){var i=this.tryEntries[t];if(i.finallyLoc===e)return this.complete(i.completion,i.afterLoc),D(i),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var i=this.tryEntries[t];if(i.tryLoc===e){var n=i.completion;if("throw"===n.type){var r=n.arg;D(i)}return r}}throw Error("illegal catch attempt")},delegateYield:function(t,i,n){return this.delegate={iterator:E(t),resultName:i,nextLoc:n},"next"===this.method&&(this.arg=e),g}},t}function g(e,t){return g=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},g(e,t)}function _(e,t){return s(e)||function(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(i=i.call(e)).next,0===t){if(Object(i)!==i)return;l=!1}else for(;!(l=(n=s.call(i)).done)&&(a.push(n.value),a.length!==t);l=!0);}catch(e){c=!0,r=e}finally{try{if(!l&&null!=i.return&&(o=i.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}(e,t)||w(e,t)||p()}function y(e){return s(e)||f(e)||w(e)||p()}function v(e){return function(e){if(Array.isArray(e))return r(e)}(e)||f(e)||w(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function x(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var i=t.call(e,"string");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}function b(e){return b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},b(e)}function w(e,t){if(e){if("string"==typeof e)return r(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?r(e,t):void 0}}function S(e,t){var i={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(i[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r0){var n,r=c(i);try{for(r.s();!(n=r.n()).done;){var s=k(n.value);"string"==typeof s.element&&(s.element=M(s.element)),s.hintPosition=s.hintPosition||e.getOption("hintPosition"),s.hintAnimation=s.hintAnimation||e.getOption("hintAnimation"),null!==s.element&&e.addHint(s)}}catch(e){r.e(e)}finally{r.f()}}else{var o=Array.from(A("*[".concat("data-hint","]"),t));if(!o||!o.length)return!1;for(var a=0,l=o;a1?t-1:0),n=1;n2?o-2:0),l=2;l1?t-1:0),n=1;n1?t-1:0),n=1;nt.width?(r.val="".concat(t.width-n-e.left,"px"),!1):(r.val="".concat(i,"px"),!0)}var Le=function(e,t){var i=e.position,n=e.element,r=e.refreshes,s=e.hintMode,o=void 0!==s&&s,a=e.showStepNumbers,l=void 0!==a&&a,c=e.transitionDuration,h=void 0===c?0:c,d=e.positionPrecedence,u=void 0===d?[]:d,f=e.className,p=e.autoPosition,m=void 0===p||p,g=e.onClick,_=de.state("auto"),y=de.state("auto"),v=de.state("auto"),x=de.state("auto"),b=de.state("0"),w=de.state("0"),S=de.state(0),T=de.state(250),k=de.state(300),M=de.state(i),A=de.state(ke()),C=de.state(me(n)),D=de.derive(function(){return C.val.top+T.val>A.val.height});de.derive(function(){void 0!==r.val&&(A.val=ke(),C.val=me(n))}),de.derive(function(){void 0!==M.val&&"floating"!==i&&m&&k.val&&T.val&&C.val&&A.val&&(M.val=function(e,t,i,n,r,s){var o=e.slice();n+=10,i+=20;var a="floating";if(t.absoluteBottom+n>s.height&&Me(o,"bottom"),t.absoluteTop-n<0&&Me(o,"top"),t.absoluteRight+i>s.width&&Me(o,"right"),t.absoluteLeft-i<0&&Me(o,"left"),r&&(r=r.split("-")[0]),o.length&&(a=o[0],o.includes(r)&&(a=r)),"top"===a||"bottom"===a){var l,c=[];"top"===a?(l="top-middle-aligned",c=["top-left-aligned","top-middle-aligned","top-right-aligned"]):(l="bottom-middle-aligned",c=["bottom-left-aligned","bottom-middle-aligned","bottom-right-aligned"]),a=function(e,t,i,n){var r=t/2,s=Math.min(i,window.screen.width);return s-e=0&&(this._hintsAutoRefreshFunction=(e=function(){return n.refresh()},t=r,function(){for(var n=arguments.length,r=new Array(n),s=0;s0?i[u-1]=p:a.push(p)}}for(var m=0;a.length>0;m++)if(void 0===i[m]){var g=a.shift();if(!g)break;g.step=m+1,i[m]=g}}return(i=i.filter(function(e){return e})).sort(function(e,t){return e.step-t.step}),i},$e=function(e){return T(void 0,void 0,void 0,m().mark(function t(){var i,n;return m().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(e.isActive()){t.next=2;break}return t.abrupt("return",!1);case 2:if(!e.hasStarted()){t.next=4;break}return t.abrupt("return",!1);case 4:return t.next=6,null===(i=e.callback("start"))||void 0===i?void 0:i.call(e,e.getTargetElement());case 6:if(0!==(n=Ue(e)).length){t.next=9;break}return t.abrupt("return",!1);case 9:return e.setSteps(n),t.next=12,Ve(e);case 12:return t.abrupt("return",!0);case 13:case"end":return t.stop()}},t)}))};function Ge(e){var t,i,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return T(this,void 0,void 0,m().mark(function r(){var s,o;return m().wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return s=e.getTargetElement(),o=!0,r.next=4,null===(t=e.callback("beforeExit"))||void 0===t?void 0:t.call(e,s);case 4:if(o=r.sent,n||!1!==o){r.next=7;break}return r.abrupt("return",!1);case 7:return je(),r.next=10,null===(i=e.callback("exit"))||void 0===i?void 0:i.call(e);case 10:return e.resetCurrentStep(),r.abrupt("return",!0);case 12:case"end":return r.stop()}},r)}))}function Xe(e,t,i){var n,r=(h(n={},e,t),h(n,"path","/"),h(n,"expires",void 0),n);if(i){var s=new Date;s.setTime(s.getTime()+24*i*60*60*1e3),r.expires=s.toUTCString()}var o=[];for(var a in r)o.push("".concat(a,"=").concat(r[a]));return document.cookie=o.join("; "),qe(e)}function qe(e){return(t={},document.cookie.split(";").forEach(function(e){var i=_(e.split("="),2),n=i[0],r=i[1];t[n.trim()]=r}),t)[e];var t}var Ze=function(e,t,i,n){Te(e,t,i.element,"floating"===i.position?0:n)},Je=de.tags,Ke=Je.h1,Qe=Je.div,et=Je.input,tt=Je.label,it=Je.ul,nt=Je.li,rt=Je.a,st=function(e){var t=e.label,i=e.onClick,n=e.disabled,r=e.className;return rt({role:"button",tabIndex:0,ariaDisabled:null!=n&&n,onclick:i,className:null!=r?r:""},[t])},ot=function(e){var t=e.step,i=e.currentStep,n=e.steps,r=e.onBulletClick,s=e.bullets,o=e.buttons,a=e.nextLabel,l=e.onNextClick,c=e.prevLabel,d=e.onPrevClick,u=e.skipLabel,f=e.onSkipClick,p=e.buttonClass,m=e.nextToDone,g=e.doneLabel,_=e.hideNext,y=e.hidePrev,x=e.progress,b=e.progressBarAdditionalClass,w=e.stepNumbers,T=e.stepNumbersOfLabel,k=e.scrollToElement,M=e.scrollPadding,A=e.dontShowAgain,C=e.onDontShowAgainChange,D=e.dontShowAgainLabel,L=e.renderAsHtml,E=S(e,["step","currentStep","steps","onBulletClick","bullets","buttons","nextLabel","onNextClick","prevLabel","onPrevClick","skipLabel","onSkipClick","buttonClass","nextToDone","doneLabel","hideNext","hidePrev","progress","progressBarAdditionalClass","stepNumbers","stepNumbersOfLabel","scrollToElement","scrollPadding","dontShowAgain","onDontShowAgainChange","dontShowAgainLabel","renderAsHtml"]),I=[],P=t.title,R=t.intro,O=t.position;I.push(function(e){var t=e.skipLabel,i=e.onSkipClick,n=Ee({text:e.title,tooltipRenderAsHtml:e.renderAsHtml,container:Ke({className:"introjs-tooltip-title"})});return Qe({className:"introjs-tooltip-header"},[n,st({className:"introjs-skipbutton",label:t,onClick:i})])}({title:P,skipLabel:u,renderAsHtml:L,onSkipClick:f})),I.push(Ee({text:R,tooltipRenderAsHtml:L,container:Qe({className:"introjs-tooltiptext"})})),A&&I.push(function(e){var t=e.dontShowAgainLabel,i=e.onDontShowAgainChange;return Qe({className:"introjs-dontShowAgain"},[et({type:"checkbox",id:"introjs-dontShowAgain",name:"introjs-dontShowAgain",onchange:function(e){i(e.target.checked)}}),tt({for:"introjs-dontShowAgain"},t)])}({dontShowAgainLabel:D,onDontShowAgainChange:C})),s&&I.push(function(e){var t=e.step,i=e.onBulletClick;return Qe({className:"introjs-bullets"},[it({role:"tablist"},v(e.steps.map(function(e){var n=e.step;return nt({role:"presentation"},[rt(h({role:"tab",className:function(){return"".concat(t.step===n?"active":"")},onclick:function(e){var t=e.target.getAttribute("data-step-number");t&&i(parseInt(t,10))},innerHTML:" "},"data-step-number",n))])})))])}({step:t,steps:n,onBulletClick:r})),x&&I.push(function(e){var t=e.progressBarAdditionalClass,i=(e.currentStep+1)/e.steps.length*100;return Qe({className:"introjs-progress"},[Qe({className:"".concat("introjs-progressbar"," ").concat(t||""),role:"progress","aria-valuemin":"0","aria-valuemax":"100","aria-valuenow":function(){return i.toString()},style:"width:".concat(i,"%;")})])}({steps:n,currentStep:i,progressBarAdditionalClass:b})),w&&I.push(function(e){var t=e.steps,i=e.stepNumbersOfLabel;return Qe({className:"introjs-helperNumberLayer"},["".concat(e.step.step," ").concat(i," ").concat(t.length)])}({step:t,steps:n,stepNumbersOfLabel:T})),o&&I.push(function(e){var t=e.steps,i=e.currentStep,n=e.buttonClass,r=e.nextToDone,s=e.doneLabel,o=e.hideNext,a=e.nextLabel,l=e.onNextClick,c=e.hidePrev,h=e.prevLabel,d=e.onPrevClick;return Qe({className:"introjs-tooltipbuttons"},t.length>1?function(e){var t=e.label,i=e.steps,n=e.currentStep,r=e.hidePrev,s=e.hideNext,o=e.onClick,a=e.buttonClass,l=0===n&&i.length>1,c=l&&!r,h=l&&r,d=(n===i.length-1||1===i.length)&&s;return st({label:t,onClick:o,disabled:c,className:function(){var e=[a,"introjs-prevbutton"];return d&&e.push("introjs-fullbutton"),c&&e.push("introjs-disabled"),h&&e.push("introjs-hidden"),e.filter(Boolean).join(" ")}})}({label:h,steps:t,currentStep:i,hidePrev:c,hideNext:o,onClick:d,buttonClass:n}):null,function(e){var t=e.steps,i=e.currentStep,n=e.nextLabel,r=e.doneLabel,s=e.hideNext,o=e.hidePrev,a=e.nextToDone,l=e.onClick,c=e.buttonClass,h=0===i&&t.length>1&&o,d=i===t.length-1||1===t.length,u=de.derive(function(){return d&&!s&&!a}),f=de.derive(function(){return d&&!s&&a}),p=st({label:f.val?r:n,onClick:l,className:function(){var e=[c,"introjs-nextbutton"];return f.val&&e.push("introjs-donebutton"),u.val&&e.push("introjs-disabled"),h&&e.push("introjs-fullbutton"),e.filter(Boolean).join(" ")}});return setTimeout(function(){p.focus()},1),p}({currentStep:i,steps:t,doneLabel:s,nextLabel:a,onClick:l,hideNext:o,hidePrev:c,nextToDone:r,buttonClass:n}))}({steps:n,currentStep:i,nextLabel:a,onNextClick:l,prevLabel:c,onPrevClick:d,buttonClass:p,nextToDone:m,doneLabel:g,hideNext:_,hidePrev:y}));var z=Le(Object.assign(Object.assign({},E),{element:t.element,hintMode:!1,position:O}),I);return function(e){var t=e.step,i=e.tooltip,n=e.scrollToElement,r=e.scrollPadding;(function(e,t){if(e){var i=function(e){var t=window.getComputedStyle(e),i="absolute"===t.position,n=/(auto|scroll)/;if("fixed"===t.position)return document.body;for(var r=e;r=r.parentElement;)if(t=window.getComputedStyle(r),(!i||"static"!==t.position)&&n.test(t.overflow+t.overflowY+t.overflowX))return r;return document.body}(t);i!==document.body&&(i.scrollTop=t.offsetTop-i.offsetTop)}})(n,t.element),function(e,t,i,n,r){var s;if("off"!==t&&e&&(s="tooltip"===t?r.getBoundingClientRect():n.getBoundingClientRect(),!function(e){var t=e.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom+80<=window.innerHeight&&t.right<=window.innerWidth}(n))){var o=ke().height;s.bottom-(s.bottom-s.top)<0||n.clientHeight>o?window.scrollBy(0,s.top-(o/2-s.height/2)-i):window.scrollBy(0,s.top-(o/2-s.height/2)+i)}}(n,t.scrollTo,r,t.element,i)}({step:t,tooltip:z,scrollToElement:k,scrollPadding:M}),z},at=de.tags.div,lt=de.tags.div,ct=de.tags.div,ht=de.tags.div,dt=de.tags.div,ut=de.tags.div,ft=function(){function e(t,i){o(this,e),this._steps=[],this._currentStepSignal=de.state(void 0),this._refreshesSignal=de.state(0),this.callbacks={},this._targetElement=N(t),this._options=i?L(this._options,i):{steps:[],isActive:!0,nextLabel:"Next",prevLabel:"Back",skipLabel:"×",doneLabel:"Done",hidePrev:!1,hideNext:!1,nextToDone:!0,tooltipPosition:"bottom",tooltipClass:"",group:"",highlightClass:"",exitOnEsc:!0,exitOnOverlayClick:!0,showStepNumbers:!1,stepNumbersOfLabel:"of",keyboardNavigation:!0,showButtons:!0,showBullets:!0,showProgress:!1,scrollToElement:!0,scrollTo:"element",scrollPadding:30,overlayOpacity:.5,autoPosition:!0,positionPrecedence:["bottom","top","right","left"],disableInteraction:!1,dontShowAgain:!1,dontShowAgainLabel:"Don't show this again",dontShowAgainCookie:"introjs-dontShowAgain",dontShowAgainCookieDays:365,helperElementPadding:10,buttonClass:"introjs-button",progressBarAdditionalClass:"",tooltipRenderAsHtml:!0}}return l(e,[{key:"callback",value:function(e){var t=this.callbacks[e];if(z(t))return t}},{key:"goToStep",value:function(e){return T(this,void 0,void 0,m().mark(function t(){return m().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return this.setCurrentStep(e-2),t.next=3,Ve(this);case 3:return t.abrupt("return",this);case 4:case"end":return t.stop()}},t,this)}))}},{key:"goToStepNumber",value:function(e){return T(this,void 0,void 0,m().mark(function t(){var i;return m().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:i=0;case 1:if(!(i=this._currentStepSignal.val?this._direction="forward":this._direction="backward",this._currentStepSignal.val=e,this}},{key:"incrementCurrentStep",value:function(){var e=this.getCurrentStep();return void 0===e?this.setCurrentStep(0):this.setCurrentStep(e+1),this}},{key:"decrementCurrentStep",value:function(){var e=this.getCurrentStep();return void 0!==e&&e>0&&this.setCurrentStep(e-1),this}},{key:"getDirection",value:function(){return this._direction}},{key:"nextStep",value:function(){return T(this,void 0,void 0,m().mark(function e(){return m().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ve(this);case 2:return e.abrupt("return",this);case 3:case"end":return e.stop()}},e,this)}))}},{key:"previousStep",value:function(){return T(this,void 0,void 0,m().mark(function e(){return m().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,We(this);case 2:return e.abrupt("return",this);case 3:case"end":return e.stop()}},e,this)}))}},{key:"isEnd",value:function(){var e=this.getCurrentStep();return void 0!==e&&e>=this._steps.length}},{key:"isLastStep",value:function(){return this.getCurrentStep()===this._steps.length-1}},{key:"getTargetElement",value:function(){return this._targetElement}},{key:"setOptions",value:function(e){return this._options=L(this._options,e),this}},{key:"setOption",value:function(e,t){return this._options=D(this._options,e,t),this}},{key:"getOption",value:function(e){return this._options[e]}},{key:"clone",value:function(){return new e(this._targetElement,this._options)}},{key:"isActive",value:function(){return(!this.getOption("dontShowAgain")||""===(e=qe(this.getOption("dontShowAgainCookie")))||"true"!==e)&&this.getOption("isActive");var e}},{key:"hasStarted",value:function(){return void 0!==this.getCurrentStep()}},{key:"setDontShowAgain",value:function(e){return function(e,t,i){e?Xe(t,"true",i):Xe(t,"",-1)}(e,this.getOption("dontShowAgainCookie"),this.getOption("dontShowAgainCookieDays")),this}},{key:"enableKeyboardNavigation",value:function(){var e=this;return this.getOption("keyboardNavigation")&&(this._keyboardNavigationHandler=function(t){return function(e,t){var i;return T(this,void 0,void 0,m().mark(function n(){var r,s;return m().wrap(function(n){for(;;)switch(n.prev=n.next){case 0:if(null===(r=void 0===t.code?t.which:t.code)&&(r=null===t.charCode?t.keyCode:t.charCode),"Escape"!==r&&27!==r||!0!==e.getOption("exitOnEsc")){n.next=7;break}return n.next=5,e.exit();case 5:n.next=39;break;case 7:if("ArrowLeft"!==r&&37!==r){n.next=12;break}return n.next=10,We(e);case 10:n.next=39;break;case 12:if("ArrowRight"!==r&&39!==r){n.next=17;break}return n.next=15,Ve(e);case 15:n.next=39;break;case 17:if("Enter"!==r&&"NumpadEnter"!==r&&13!==r){n.next=39;break}if(!(s=t.target||t.srcElement)||!s.className.match("introjs-prevbutton")){n.next=24;break}return n.next=22,We(e);case 22:n.next=38;break;case 24:if(!s||!s.className.match("introjs-skipbutton")){n.next=32;break}if(!e.isEnd()){n.next=28;break}return n.next=28,null===(i=e.callback("complete"))||void 0===i?void 0:i.call(e,e.getCurrentStep(),"skip");case 28:return n.next=30,e.exit();case 30:n.next=38;break;case 32:if(!s||!s.getAttribute("data-step-number")){n.next=36;break}s.click(),n.next=38;break;case 36:return n.next=38,Ve(e);case 38:t.preventDefault?t.preventDefault():t.returnValue=!1;case 39:case"end":return n.stop()}},n)}))}(e,t)},F.on(window,"keydown",this._keyboardNavigationHandler,!0)),this}},{key:"disableKeyboardNavigation",value:function(){return this._keyboardNavigationHandler&&(F.off(window,"keydown",this._keyboardNavigationHandler,!0),this._keyboardNavigationHandler=void 0),this}},{key:"enableRefreshOnResize",value:function(){var e=this;this._refreshOnResizeHandler=function(t){return e.refresh()},F.on(window,"resize",this._refreshOnResizeHandler,!0)}},{key:"disableRefreshOnResize",value:function(){this._refreshOnResizeHandler&&(F.off(window,"resize",this._refreshOnResizeHandler,!0),this._refreshOnResizeHandler=void 0)}},{key:"appendFloatingElement",value:function(){var e,t,i;return this._floatingElement||(this._floatingElement=(e={currentStep:this.getCurrentStepSignal()},t=e.currentStep,i=ut({className:"introjsFloatingElement"}),de.derive(function(){void 0===t.val&&i.remove()}),i),de.add(this.getTargetElement(),this._floatingElement)),this._floatingElement}},{key:"createRoot",value:function(){this._root||(this._root=function(e){var t=e.tour,i=t.getCurrentStepSignal(),n=t.getRefreshesSignal(),r=t.getSteps(),s=function(e){var t=e.currentStep,i=e.steps,n=e.refreshes,r=e.targetElement,s=e.tourHighlightClass,o=e.overlayOpacity,a=e.helperLayerPadding,l=de.derive(function(){return void 0!==t.val?i[t.val]:null}),c=lt({className:function(){return function(e){var t=e.step,i=e.tourHighlightClass,n="introjs-helperLayer";return t.val&&"string"==typeof t.val.highlightClass&&(n+=" ".concat(t.val.highlightClass)),"string"==typeof i&&(n+=" ".concat(i)),n}({step:l,tourHighlightClass:s})},style:Se({"box-shadow":"0 0 1px 2px rgba(33, 33, 33, 0.8), rgba(33, 33, 33, ".concat(o.toString(),") 0 0 0 5000px")})});return de.derive(function(){l.val&&void 0!==n.val&&Ze(r,c,l.val,a)}),c}({currentStep:i,steps:r,refreshes:n,targetElement:t.getTargetElement(),tourHighlightClass:t.getOption("highlightClass"),overlayOpacity:t.getOption("overlayOpacity"),helperLayerPadding:t.getOption("helperElementPadding")}),o=de.state(0),a=0,l=dt({className:"introjs-tour",style:function(){return Se({opacity:"".concat(o.val)})}},s,function(){if(void 0===i.val)return null;var e=de.derive(function(){return void 0!==i.val?r[i.val]:null});if(!e.val)return null;var s=function(e){var t=e.exitOnOverlayClick,i=e.onExitTour,n=ht({className:"introjs-overlay",style:Se({top:0,bottom:0,left:0,right:0,position:"fixed",cursor:t?"pointer":"auto"})});return t&&(n.onclick=function(){return T(void 0,void 0,void 0,m().mark(function e(){return m().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,i();case 2:case"end":return e.stop()}},e)}))}),n}({exitOnOverlayClick:!0===t.getOption("exitOnOverlayClick"),onExitTour:function(){return T(void 0,void 0,void 0,m().mark(function e(){return m().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",t.exit());case 1:case"end":return e.stop()}},e)}))}}),o=function(e){var t=e.targetElement,i=e.helperElementPadding,n=S(e,["targetElement","helperElementPadding"]),r=at({className:"introjs-tooltipReferenceLayer"},ot(n));return de.derive(function(){null!=n.refreshes.val&&Ze(t,r,n.step,i)}),r}({step:e.val,targetElement:t.getTargetElement(),refreshes:n,helperElementPadding:t.getOption("helperElementPadding"),transitionDuration:a,positionPrecedence:t.getOption("positionPrecedence"),autoPosition:t.getOption("autoPosition"),showStepNumbers:t.getOption("showStepNumbers"),steps:t.getSteps(),currentStep:i.val,onBulletClick:function(e){t.goToStep(e)},bullets:t.getOption("showBullets"),buttons:t.getOption("showButtons"),nextLabel:t.getOption("nextLabel"),onNextClick:function(e){return T(void 0,void 0,void 0,m().mark(function i(){var n;return m().wrap(function(i){for(;;)switch(i.prev=i.next){case 0:if(t.isLastStep()){i.next=5;break}return i.next=3,Ve(t);case 3:i.next=10;break;case 5:if(!new RegExp("introjs-donebutton","gi").test(e.target.className)){i.next=10;break}return i.next=8,null===(n=t.callback("complete"))||void 0===n?void 0:n.call(t,t.getCurrentStep(),"done");case 8:return i.next=10,t.exit();case 10:case"end":return i.stop()}},i)}))},prevLabel:t.getOption("prevLabel"),onPrevClick:function(){return T(void 0,void 0,void 0,m().mark(function e(){var i;return m().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(void 0!==(i=t.getCurrentStep())&&i>0)){e.next=4;break}return e.next=4,We(t);case 4:case"end":return e.stop()}},e)}))},skipLabel:t.getOption("skipLabel"),onSkipClick:function(){return T(void 0,void 0,void 0,m().mark(function e(){var i,n;return m().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.isLastStep()){e.next=3;break}return e.next=3,null===(i=t.callback("complete"))||void 0===i?void 0:i.call(t,t.getCurrentStep(),"skip");case 3:return e.next=5,null===(n=t.callback("skip"))||void 0===n?void 0:n.call(t,t.getCurrentStep());case 5:return e.next=7,t.exit();case 7:case"end":return e.stop()}},e)}))},buttonClass:t.getOption("buttonClass"),nextToDone:t.getOption("nextToDone"),doneLabel:t.getOption("doneLabel"),hideNext:t.getOption("hideNext"),hidePrev:t.getOption("hidePrev"),className:e.val.tooltipClass||t.getOption("tooltipClass"),progress:t.getOption("showProgress"),progressBarAdditionalClass:t.getOption("progressBarAdditionalClass"),stepNumbers:t.getOption("showStepNumbers"),stepNumbersOfLabel:t.getOption("stepNumbersOfLabel"),scrollToElement:t.getOption("scrollToElement"),scrollPadding:t.getOption("scrollPadding"),dontShowAgain:t.getOption("dontShowAgain"),onDontShowAgainChange:function(e){t.setDontShowAgain(e)},dontShowAgainLabel:t.getOption("dontShowAgainLabel"),renderAsHtml:t.getOption("tooltipRenderAsHtml")}),l=e.val.disableInteraction?function(e){var t=e.currentStep,i=e.steps,n=e.refreshes,r=e.targetElement,s=e.helperElementPadding,o=de.derive(function(){return void 0!==t.val?i[t.val]:null});return function(){if(!o.val)return null;var e=ct({className:"introjs-disableInteraction"});return de.derive(function(){o.val&&null!=n.val&&Ze(r,e,o.val,s)}),e}}({currentStep:i,steps:t.getSteps(),refreshes:n,targetElement:t.getTargetElement(),helperElementPadding:t.getOption("helperElementPadding")}):null;return a=300,dt(s,o,l)});return de.derive(function(){void 0===i.val&&(o.val=0,setTimeout(function(){l.remove()},250))}),setTimeout(function(){o.val=1},1),l}({tour:this}),de.add(this.getTargetElement(),this._root))}},{key:"recreateRoot",value:function(){this._root&&(this._root.remove(),this._root=void 0,this.createRoot())}},{key:"start",value:function(){return T(this,void 0,void 0,m().mark(function e(){return m().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,$e(this);case 2:if(!e.sent){e.next=6;break}this.createRoot(),this.enableKeyboardNavigation(),this.enableRefreshOnResize();case 6:return e.abrupt("return",this);case 7:case"end":return e.stop()}},e,this)}))}},{key:"exit",value:function(e){return T(this,void 0,void 0,m().mark(function t(){return m().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Ge(this,null!=e&&e);case 2:if(!t.sent){t.next=5;break}this.disableKeyboardNavigation(),this.disableRefreshOnResize();case 5:return t.abrupt("return",this);case 6:case"end":return t.stop()}},t,this)}))}},{key:"refresh",value:function(e){return void 0===this.getCurrentStep()||(void 0!==this._refreshesSignal.val&&(this._refreshesSignal.val+=1),e&&(this.setSteps(Ue(this)),this.recreateRoot())),this}},{key:"onbeforechange",value:function(e){return this.onBeforeChange(e)}},{key:"onBeforeChange",value:function(e){if(!z(e))throw new Error("Provided callback for onBeforeChange was not a function");return this.callbacks.beforeChange=e,this}},{key:"onchange",value:function(e){this.onChange(e)}},{key:"onChange",value:function(e){if(!z(e))throw new Error("Provided callback for onChange was not a function.");return this.callbacks.change=e,this}},{key:"onafterchange",value:function(e){this.onAfterChange(e)}},{key:"onAfterChange",value:function(e){if(!z(e))throw new Error("Provided callback for onAfterChange was not a function");return this.callbacks.afterChange=e,this}},{key:"oncomplete",value:function(e){return this.onComplete(e)}},{key:"onComplete",value:function(e){if(!z(e))throw new Error("Provided callback for oncomplete was not a function.");return this.callbacks.complete=e,this}},{key:"onstart",value:function(e){return this.onStart(e)}},{key:"onStart",value:function(e){if(!z(e))throw new Error("Provided callback for onstart was not a function.");return this.callbacks.start=e,this}},{key:"onexit",value:function(e){return this.onExit(e)}},{key:"onExit",value:function(e){if(!z(e))throw new Error("Provided callback for onexit was not a function.");return this.callbacks.exit=e,this}},{key:"onskip",value:function(e){return this.onSkip(e)}},{key:"onSkip",value:function(e){if(!z(e))throw new Error("Provided callback for onskip was not a function.");return this.callbacks.skip=e,this}},{key:"onbeforeexit",value:function(e){return this.onBeforeExit(e)}},{key:"onBeforeExit",value:function(e){if(!z(e))throw new Error("Provided callback for onbeforeexit was not a function.");return this.callbacks.beforeExit=e,this}}]),e}(),pt=function(){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&g(e,t)}(t,ft);var e=function(e){var t=u();return function(){var i,n=d(e);if(t){var r=d(this).constructor;i=Reflect.construct(n,arguments,r)}else i=n.apply(this,arguments);return function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,i)}}(t);function t(){return o(this,t),e.apply(this,arguments)}return l(t,[{key:"addHints",value:function(){console.error("introJs().addHints() is deprecated, please use introJs.hint.addHints() instead.")}},{key:"addHint",value:function(){console.error("introJs().addHint() is deprecated, please use introJs.hint.addHint() instead.")}},{key:"removeHints",value:function(){console.error("introJs().removeHints() is deprecated, please use introJs.hint.removeHints() instead.")}}]),t}(),mt=function(e){return console.warn("introJs() is deprecated. Please use introJs.tour() or introJs.hint() instead."),new pt(e)};mt.tour=function(e){return new ft(e)},mt.hint=function(e){return new Ye(e)},mt.version="8.3.2"},3164:function(e,t,i){!function(e){"use strict";e.defineLocale("ko",{months:"1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월".split("_"),monthsShort:"1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월".split("_"),weekdays:"일요일_월요일_화요일_수요일_목요일_금요일_토요일".split("_"),weekdaysShort:"일_월_화_수_목_금_토".split("_"),weekdaysMin:"일_월_화_수_목_금_토".split("_"),longDateFormat:{LT:"A h:mm",LTS:"A h:mm:ss",L:"YYYY.MM.DD.",LL:"YYYY년 MMMM D일",LLL:"YYYY년 MMMM D일 A h:mm",LLLL:"YYYY년 MMMM D일 dddd A h:mm",l:"YYYY.MM.DD.",ll:"YYYY년 MMMM D일",lll:"YYYY년 MMMM D일 A h:mm",llll:"YYYY년 MMMM D일 dddd A h:mm"},calendar:{sameDay:"오늘 LT",nextDay:"내일 LT",nextWeek:"dddd LT",lastDay:"어제 LT",lastWeek:"지난주 dddd LT",sameElse:"L"},relativeTime:{future:"%s 후",past:"%s 전",s:"몇 초",ss:"%d초",m:"1분",mm:"%d분",h:"한 시간",hh:"%d시간",d:"하루",dd:"%d일",M:"한 달",MM:"%d달",y:"일 년",yy:"%d년"},dayOfMonthOrdinalParse:/\d{1,2}(일|월|주)/,ordinal:function(e,t){switch(t){case"d":case"D":case"DDD":return e+"일";case"M":return e+"월";case"w":case"W":return e+"주";default:return e}},meridiemParse:/오전|오후/,isPM:function(e){return"오후"===e},meridiem:function(e,t,i){return e<12?"오전":"오후"}})}(i(5093))},3177:(e,t,i)=>{"use strict";i.d(t,{Ay:()=>Be});const n="undefined"!=typeof window&&void 0!==window.document,r=n?window:{},s=!!n&&"ontouchstart"in r.document.documentElement,o=!!n&&"PointerEvent"in r,a="cropper",l=`${a}-canvas`,c=`${a}-crosshair`,h=`${a}-grid`,d=`${a}-handle`,u=`${a}-image`,f=`${a}-selection`,p=`${a}-shade`,m=`${a}-viewer`,g="select",_="move",y="scale",v="rotate",x="transform",b="none",w="n-resize",S="e-resize",T="s-resize",k="w-resize",M="ne-resize",A="nw-resize",C="se-resize",D="sw-resize",L=o?"pointerdown":s?"touchstart":"mousedown",E=o?"pointermove":s?"touchmove":"mousemove",I=o?"pointerup pointercancel":s?"touchend touchcancel":"mouseup",P="error",R="keydown",O="load",z="wheel",F="action",N="actionend",Y="actionstart",B="change",H="transform";function j(e){return"string"==typeof e}const V=Number.isNaN||r.isNaN;function W(e){return"number"==typeof e&&!V(e)}function U(e){return W(e)&&e>0&&e<1/0}function $(e){return"object"==typeof e&&null!==e}const{hasOwnProperty:G}=Object.prototype;function X(e){if(!$(e))return!1;try{const{constructor:t}=e,{prototype:i}=t;return t&&i&&G.call(i,"isPrototypeOf")}catch(e){return!1}}function q(e){return"function"==typeof e}function Z(e){return"object"==typeof e&&null!==e&&1===e.nodeType}const J=/([a-z\d])([A-Z])/g;function K(e){return String(e).replace(J,"$1-$2").toLowerCase()}const Q=/-[A-z\d]/g;function ee(e){return e.replace(Q,e=>e.slice(1).toUpperCase())}const te=/\s\s*/;function ie(e,t,i,n){t.trim().split(te).forEach(t=>{e.removeEventListener(t,i,n)})}function ne(e,t,i,n){t.trim().split(te).forEach(t=>{e.addEventListener(t,i,n)})}function re(e,t,i,n){ne(e,t,i,Object.assign(Object.assign({},n),{once:!0}))}const se={bubbles:!0,cancelable:!0,composed:!0},oe=Promise.resolve();function ae(e){const{documentElement:t}=e.ownerDocument,i=e.getBoundingClientRect();return{left:i.left+(r.pageXOffset-t.clientLeft),top:i.top+(r.pageYOffset-t.clientTop)}}const le=/deg|g?rad|turn$/i;function ce(e){const t=parseFloat(e)||0;if(0!==t){const[i="rad"]=String(e).match(le)||[];switch(i.toLowerCase()){case"deg":return t/360*(2*Math.PI);case"grad":return t/400*(2*Math.PI);case"turn":return t*(2*Math.PI)}}return t}const he="contain";function de(e,t=he){const{aspectRatio:i}=e;let{width:n,height:r}=e;const s=U(n),o=U(r);if(s&&o){const e=r*i;t===he&&e>n||"cover"===t&&e{const t=ee(e);let i=this[t];(function(e){return void 0===e})(i)||this.$propertyChangedCallback(t,void 0,i),Object.defineProperty(this,t,{enumerable:!0,configurable:!0,get:()=>i,set(e){const n=i;i=e,this.$propertyChangedCallback(t,n,e)}})});const e=this.attachShadow({mode:this.shadowRootMode||pe});if(this.shadowRoot||me.set(this,e),ge.set(this,this.$addStyles(this.$sharedStyle)),this.$style&&this.$addStyles(this.$style),this.$template){const t=document.createElement("template");t.innerHTML=this.$template,e.appendChild(t.content)}if(this.slottable){const t=document.createElement("slot");e.appendChild(t)}}disconnectedCallback(){ge.has(this)&&ge.delete(this),me.has(this)&&me.delete(this)}$getTagNameOf(e){var t;return null!==(t=_e.get(e))&&void 0!==t?t:e}$setStyles(e){return Object.keys(e).forEach(t=>{let i=e[t];W(i)&&(i=0!==i&&fe.test(t)?`${i}px`:String(i)),this.style[t]=i}),this}$getShadowRoot(){return this.shadowRoot||me.get(this)}$addStyles(e){let t;const i=this.$getShadowRoot();return ye?(t=new CSSStyleSheet,t.replaceSync(e),i.adoptedStyleSheets=i.adoptedStyleSheets.concat(t)):(t=document.createElement("style"),t.textContent=e,i.appendChild(t)),t}$emit(e,t,i){return function(e,t,i,n){return e.dispatchEvent(new CustomEvent(t,Object.assign(Object.assign(Object.assign({},se),{detail:i}),n)))}(this,e,t,i)}$nextTick(e){return function(e,t){return t?oe.then(e?t.bind(e):t):oe}(this,e)}static $define(e,t){$(e)&&(t=e,e=""),e||(e=this.$name||this.name),e=K(e),n&&r.customElements&&!r.customElements.get(e)&&customElements.define(e,this,t)}}ve.$version="2.0.0";class xe extends ve{constructor(){super(...arguments),this.$onPointerDown=null,this.$onPointerMove=null,this.$onPointerUp=null,this.$onWheel=null,this.$wheeling=!1,this.$pointers=new Map,this.$style=':host{display:block;min-height:100px;min-width:200px;overflow:hidden;position:relative;touch-action:none;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}:host([background]){background-color:#fff;background-image:repeating-linear-gradient(45deg,#ccc 25%,transparent 0,transparent 75%,#ccc 0,#ccc),repeating-linear-gradient(45deg,#ccc 25%,transparent 0,transparent 75%,#ccc 0,#ccc);background-image:repeating-conic-gradient(#ccc 0 25%,#fff 0 50%);background-position:0 0,.5rem .5rem;background-size:1rem 1rem}:host([disabled]){pointer-events:none}:host([disabled]):after{bottom:0;content:"";cursor:not-allowed;display:block;left:0;pointer-events:none;position:absolute;right:0;top:0}',this.$action=b,this.background=!1,this.disabled=!1,this.scaleStep=.1,this.themeColor="#39f"}static get observedAttributes(){return super.observedAttributes.concat(["background","disabled","scale-step"])}connectedCallback(){super.connectedCallback(),this.disabled||this.$bind()}disconnectedCallback(){this.disabled||this.$unbind(),super.disconnectedCallback()}$propertyChangedCallback(e,t,i){Object.is(i,t)||(super.$propertyChangedCallback(e,t,i),"disabled"!==e)||(i?this.$unbind():this.$bind())}$bind(){this.$onPointerDown||(this.$onPointerDown=this.$handlePointerDown.bind(this),ne(this,L,this.$onPointerDown)),this.$onPointerMove||(this.$onPointerMove=this.$handlePointerMove.bind(this),ne(this.ownerDocument,E,this.$onPointerMove)),this.$onPointerUp||(this.$onPointerUp=this.$handlePointerUp.bind(this),ne(this.ownerDocument,I,this.$onPointerUp)),this.$onWheel||(this.$onWheel=this.$handleWheel.bind(this),ne(this,z,this.$onWheel,{passive:!1,capture:!0}))}$unbind(){this.$onPointerDown&&(ie(this,L,this.$onPointerDown),this.$onPointerDown=null),this.$onPointerMove&&(ie(this.ownerDocument,E,this.$onPointerMove),this.$onPointerMove=null),this.$onPointerUp&&(ie(this.ownerDocument,I,this.$onPointerUp),this.$onPointerUp=null),this.$onWheel&&(ie(this,z,this.$onWheel,{capture:!0}),this.$onWheel=null)}$handlePointerDown(e){const{buttons:t,button:i,type:n}=e;if(this.disabled||("pointerdown"===n&&"mouse"===e.pointerType||"mousedown"===n)&&(W(t)&&1!==t||W(i)&&0!==i||e.ctrlKey))return;const{$pointers:r}=this;let s="";if(e.changedTouches)Array.from(e.changedTouches).forEach(({identifier:e,pageX:t,pageY:i})=>{r.set(e,{startX:t,startY:i,endX:t,endY:i})});else{const{pointerId:t=0,pageX:i,pageY:n}=e;r.set(t,{startX:i,startY:n,endX:i,endY:n})}r.size>1?s=x:Z(e.target)&&(s=e.target.action||e.target.getAttribute("action")||""),!1!==this.$emit(Y,{action:s,relatedEvent:e})&&(e.preventDefault(),this.$action=s,this.style.willChange="transform")}$handlePointerMove(e){const{$action:t,$pointers:i}=this;if(this.disabled||t===b||0===i.size)return;if(!1===this.$emit("actionmove",{action:t,relatedEvent:e}))return;if(e.preventDefault(),e.changedTouches)Array.from(e.changedTouches).forEach(({identifier:e,pageX:t,pageY:n})=>{const r=i.get(e);r&&Object.assign(r,{endX:t,endY:n})});else{const{pointerId:t=0,pageX:n,pageY:r}=e,s=i.get(t);s&&Object.assign(s,{endX:n,endY:r})}const n={action:t,relatedEvent:e};if(t===x){const t=new Map(i);let r=0,s=0,o=0,a=0,l=e.pageX,c=e.pageY;i.forEach((e,i)=>{t.delete(i),t.forEach(t=>{let i=t.startX-e.startX,n=t.startY-e.startY,h=t.endX-e.endX,d=t.endY-e.endY,u=0,f=0,p=0,m=0;if(0===i?n<0?p=2*Math.PI:n>0&&(p=Math.PI):i>0?p=Math.PI/2+Math.atan(n/i):i<0&&(p=1.5*Math.PI+Math.atan(n/i)),0===h?d<0?m=2*Math.PI:d>0&&(m=Math.PI):h>0?m=Math.PI/2+Math.atan(d/h):h<0&&(m=1.5*Math.PI+Math.atan(d/h)),m>0||p>0){const i=m-p,n=Math.abs(i);n>r&&(r=n,o=i,l=(e.startX+t.startX)/2,c=(e.startY+t.startY)/2)}if(i=Math.abs(i),n=Math.abs(n),h=Math.abs(h),d=Math.abs(d),i>0&&n>0?u=Math.sqrt(i*i+n*n):i>0?u=i:n>0&&(u=n),h>0&&d>0?f=Math.sqrt(h*h+d*d):h>0?f=h:d>0&&(f=d),u>0&&f>0){const i=(f-u)/u,n=Math.abs(i);n>s&&(s=n,a=i,l=(e.startX+t.startX)/2,c=(e.startY+t.startY)/2)}})});const h=r>0,d=s>0;h&&d?(n.rotate=o,n.scale=a,n.centerX=l,n.centerY=c):h?(n.action=v,n.rotate=o,n.centerX=l,n.centerY=c):d?(n.action=y,n.scale=a,n.centerX=l,n.centerY=c):n.action=b}else{const[e]=Array.from(i.values());Object.assign(n,e)}i.forEach(e=>{e.startX=e.endX,e.startY=e.endY}),n.action!==b&&this.$emit(F,n,{cancelable:!1})}$handlePointerUp(e){const{$action:t,$pointers:i}=this;if(!this.disabled&&t!==b&&!1!==this.$emit(N,{action:t,relatedEvent:e})){if(e.preventDefault(),e.changedTouches)Array.from(e.changedTouches).forEach(({identifier:e})=>{i.delete(e)});else{const{pointerId:t=0}=e;i.delete(t)}0===i.size&&(this.style.willChange="",this.$action=b)}}$handleWheel(e){if(this.disabled)return;if(e.preventDefault(),this.$wheeling)return;this.$wheeling=!0,setTimeout(()=>{this.$wheeling=!1},50);const t=(e.deltaY>0?-1:1)*this.scaleStep;this.$emit(F,{action:y,scale:t,relatedEvent:e},{cancelable:!1})}$setAction(e){return j(e)&&(this.$action=e),this}$toCanvas(e){return new Promise((t,i)=>{if(!this.isConnected)return void i(new Error("The current element is not connected to the DOM."));const n=document.createElement("canvas");let r=this.offsetWidth,s=this.offsetHeight,o=1;X(e)&&(U(e.width)||U(e.height))&&(({width:r,height:s}=de({aspectRatio:r/s,width:e.width,height:e.height})),o=r/this.offsetWidth),n.width=r,n.height=s;const a=this.querySelector(this.$getTagNameOf(u));a?a.$ready().then(i=>{const l=n.getContext("2d");if(l){const[t,c,h,d,u,f]=a.$getTransform();let p=u,m=f,g=i.naturalWidth,_=i.naturalHeight;1!==o&&(p*=o,m*=o,g*=o,_*=o);const y=g/2,v=_/2;l.fillStyle="transparent",l.fillRect(0,0,r,s),X(e)&&q(e.beforeDraw)&&e.beforeDraw.call(this,l,n),l.save(),l.translate(y,v),l.transform(t,c,h,d,p,m),l.translate(-y,-v),l.drawImage(i,0,0,g,_),l.restore()}t(n)}).catch(i):t(n)})}}xe.$name=l,xe.$version="2.0.0";const be=new WeakMap,we=["alt","crossorigin","decoding","importance","loading","referrerpolicy","sizes","src","srcset"];class Se extends ve{constructor(){super(...arguments),this.$matrix=[1,0,0,1,0,0],this.$onLoad=null,this.$onCanvasAction=null,this.$onCanvasActionEnd=null,this.$onCanvasActionStart=null,this.$actionStartTarget=null,this.$style=":host{display:inline-block}img{display:block;height:100%;max-height:none!important;max-width:none!important;min-height:0!important;min-width:0!important;width:100%}",this.$image=new Image,this.initialCenterSize="contain",this.rotatable=!1,this.scalable=!1,this.skewable=!1,this.slottable=!1,this.translatable=!1}set $canvas(e){be.set(this,e)}get $canvas(){return be.get(this)}static get observedAttributes(){return super.observedAttributes.concat(we,["initial-center-size","rotatable","scalable","skewable","translatable"])}attributeChangedCallback(e,t,i){Object.is(i,t)||(super.attributeChangedCallback(e,t,i),we.includes(e)&&this.$image.setAttribute(e,i))}$propertyChangedCallback(e,t,i){Object.is(i,t)||(super.$propertyChangedCallback(e,t,i),"initialCenterSize"!==e)||this.$nextTick(()=>{this.$center(i)})}connectedCallback(){super.connectedCallback();const{$image:e}=this,t=this.closest(this.$getTagNameOf(l));t&&(this.$canvas=t,this.$setStyles({display:"block",position:"absolute"}),this.$onCanvasActionStart=e=>{var t,i;this.$actionStartTarget=null===(i=null===(t=e.detail)||void 0===t?void 0:t.relatedEvent)||void 0===i?void 0:i.target},this.$onCanvasActionEnd=()=>{this.$actionStartTarget=null},this.$onCanvasAction=this.$handleAction.bind(this),ne(t,Y,this.$onCanvasActionStart),ne(t,N,this.$onCanvasActionEnd),ne(t,F,this.$onCanvasAction)),this.$onLoad=this.$handleLoad.bind(this),ne(e,O,this.$onLoad),this.$getShadowRoot().appendChild(e)}disconnectedCallback(){const{$image:e,$canvas:t}=this;t&&(this.$onCanvasActionStart&&(ie(t,Y,this.$onCanvasActionStart),this.$onCanvasActionStart=null),this.$onCanvasActionEnd&&(ie(t,N,this.$onCanvasActionEnd),this.$onCanvasActionEnd=null),this.$onCanvasAction&&(ie(t,F,this.$onCanvasAction),this.$onCanvasAction=null)),e&&this.$onLoad&&(ie(e,O,this.$onLoad),this.$onLoad=null),this.$getShadowRoot().removeChild(e),super.disconnectedCallback()}$handleLoad(){const{$image:e}=this;this.$setStyles({width:e.naturalWidth,height:e.naturalHeight}),this.$canvas&&this.$center(this.initialCenterSize)}$handleAction(e){if(this.hidden||!(this.rotatable||this.scalable||this.translatable))return;const{$canvas:t}=this,{detail:i}=e;if(i){const{relatedEvent:e}=i;let{action:n}=i;switch(n!==x||this.rotatable&&this.scalable||(n=this.rotatable?v:this.scalable?y:b),n){case _:if(this.translatable){let n=null;e&&(n=e.target.closest(this.$getTagNameOf(f))),n||(n=t.querySelector(this.$getTagNameOf(f))),n&&n.multiple&&!n.active&&(n=t.querySelector(`${this.$getTagNameOf(f)}[active]`)),n&&!n.hidden&&n.movable&&!n.dynamic&&this.$actionStartTarget&&n.contains(this.$actionStartTarget)||this.$move(i.endX-i.startX,i.endY-i.startY)}break;case v:if(this.rotatable)if(e){const{x:t,y:n}=this.getBoundingClientRect();this.$rotate(i.rotate,e.clientX-t,e.clientY-n)}else this.$rotate(i.rotate);break;case y:if(this.scalable)if(e){const t=e.target.closest(this.$getTagNameOf(f));if(!t||!t.zoomable||t.zoomable&&t.dynamic){const{x:t,y:n}=this.getBoundingClientRect();this.$zoom(i.scale,e.clientX-t,e.clientY-n)}}else this.$zoom(i.scale);break;case x:if(this.rotatable&&this.scalable){const{rotate:t}=i;let{scale:n}=i;n<0?n=1/(1-n):n+=1;const r=Math.cos(t),s=Math.sin(t),[o,a,l,c]=[r*n,s*n,-s*n,r*n];if(e){const t=this.getBoundingClientRect(),i=e.clientX-t.x,n=e.clientY-t.y,[r,s,h,d]=this.$matrix,u=i-t.width/2,f=n-t.height/2,p=(u*d-h*f)/(r*d-h*s),m=(f*r-s*u)/(r*d-h*s);this.$transform(o,a,l,c,p*(1-o)+m*l,m*(1-c)+p*a)}else this.$transform(o,a,l,c,0,0)}}}}$ready(e){const{$image:t}=this,i=new Promise((e,i)=>{const n=new Error("Failed to load the image source");if(t.complete)t.naturalWidth>0&&t.naturalHeight>0?e(t):i(n);else{const r=()=>{ie(t,P,s),e(t)},s=()=>{ie(t,O,r),i(n)};re(t,O,r),re(t,P,s)}});return q(e)&&i.then(t=>(e(t),t)),i}$center(e){const{parentElement:t}=this;if(!t)return this;const i=t.getBoundingClientRect(),n=i.width,r=i.height,{x:s,y:o,width:a,height:l}=this.getBoundingClientRect(),c=s+a/2,h=o+l/2,d=i.x+n/2,u=i.y+r/2;if(this.$move(d-c,u-h),e&&(a!==n||l!==r)){const t=n/a,i=r/l;switch(e){case"cover":this.$scale(Math.max(t,i));break;case"contain":this.$scale(Math.min(t,i))}}return this}$move(e,t=e){if(this.translatable&&W(e)&&W(t)){const[i,n,r,s]=this.$matrix,o=(e*s-r*t)/(i*s-r*n),a=(t*i-n*e)/(i*s-r*n);this.$translate(o,a)}return this}$moveTo(e,t=e){if(this.translatable&&W(e)&&W(t)){const[i,n,r,s]=this.$matrix,o=(e*s-r*t)/(i*s-r*n),a=(t*i-n*e)/(i*s-r*n);this.$setTransform(i,n,r,s,o,a)}return this}$rotate(e,t,i){if(this.rotatable){const n=ce(e),r=Math.cos(n),s=Math.sin(n),[o,a,l,c]=[r,s,-s,r];if(W(t)&&W(i)){const[e,n,r,s]=this.$matrix,{width:h,height:d}=this.getBoundingClientRect(),u=t-h/2,f=i-d/2,p=(u*s-r*f)/(e*s-r*n),m=(f*e-n*u)/(e*s-r*n);this.$transform(o,a,l,c,p*(1-o)-m*l,m*(1-c)-p*a)}else this.$transform(o,a,l,c,0,0)}return this}$zoom(e,t,i){if(!this.scalable||0===e)return this;if(e<0?e=1/(1-e):e+=1,W(t)&&W(i)){const[n,r,s,o]=this.$matrix,{width:a,height:l}=this.getBoundingClientRect(),c=t-a/2,h=i-l/2,d=(c*o-s*h)/(n*o-s*r),u=(h*n-r*c)/(n*o-s*r);this.$transform(e,0,0,e,d*(1-e),u*(1-e))}else this.$scale(e);return this}$scale(e,t=e){return this.scalable&&this.$transform(e,0,0,t,0,0),this}$skew(e,t=0){if(this.skewable){const i=ce(e),n=ce(t);this.$transform(1,Math.tan(n),Math.tan(i),1,0,0)}return this}$translate(e,t=e){return this.translatable&&W(e)&&W(t)&&this.$transform(1,0,0,1,e,t),this}$transform(e,t,i,n,r,s){return W(e)&&W(t)&&W(i)&&W(n)&&W(r)&&W(s)?this.$setTransform(ue(this.$matrix,[e,t,i,n,r,s])):this}$setTransform(e,t,i,n,r,s){if((this.rotatable||this.scalable||this.skewable||this.translatable)&&(Array.isArray(e)&&([e,t,i,n,r,s]=e),W(e)&&W(t)&&W(i)&&W(n)&&W(r)&&W(s))){const o=[...this.$matrix],a=[e,t,i,n,r,s];if(!1===this.$emit(H,{matrix:a,oldMatrix:o}))return this;this.$matrix=a,this.style.transform=`matrix(${a.join(", ")})`}return this}$getTransform(){return this.$matrix.slice()}$resetTransform(){return this.$setTransform([1,0,0,1,0,0])}}Se.$name=u,Se.$version="2.0.0";const Te=new WeakMap;class ke extends ve{constructor(){super(...arguments),this.$onCanvasChange=null,this.$onCanvasActionEnd=null,this.$onCanvasActionStart=null,this.$style=":host{display:block;height:0;left:0;outline:var(--theme-color) solid 1px;position:relative;top:0;width:0}:host([transparent]){outline-color:transparent}",this.x=0,this.y=0,this.width=0,this.height=0,this.slottable=!1,this.themeColor="rgba(0, 0, 0, 0.65)"}set $canvas(e){Te.set(this,e)}get $canvas(){return Te.get(this)}static get observedAttributes(){return super.observedAttributes.concat(["height","width","x","y"])}connectedCallback(){super.connectedCallback();const e=this.closest(this.$getTagNameOf(l));if(e){this.$canvas=e,this.style.position="absolute";const t=e.querySelector(this.$getTagNameOf(f));t&&(this.$onCanvasActionStart=e=>{t.hidden&&e.detail.action===g&&(this.hidden=!1)},this.$onCanvasActionEnd=e=>{t.hidden&&e.detail.action===g&&(this.hidden=!0)},this.$onCanvasChange=e=>{const{x:i,y:n,width:r,height:s}=e.detail;this.$change(i,n,r,s),(t.hidden||0===i&&0===n&&0===r&&0===s)&&(this.hidden=!0)},ne(e,Y,this.$onCanvasActionStart),ne(e,N,this.$onCanvasActionEnd),ne(e,B,this.$onCanvasChange))}this.$render()}disconnectedCallback(){const{$canvas:e}=this;e&&(this.$onCanvasActionStart&&(ie(e,Y,this.$onCanvasActionStart),this.$onCanvasActionStart=null),this.$onCanvasActionEnd&&(ie(e,N,this.$onCanvasActionEnd),this.$onCanvasActionEnd=null),this.$onCanvasChange&&(ie(e,B,this.$onCanvasChange),this.$onCanvasChange=null)),super.disconnectedCallback()}$change(e,t,i=this.width,n=this.height){return W(e)&&W(t)&&W(i)&&W(n)&&(e!==this.x||t!==this.y||i!==this.width||n!==this.height)?(this.hidden&&(this.hidden=!1),this.x=e,this.y=t,this.width=i,this.height=n,this.$render()):this}$reset(){return this.$change(0,0,0,0)}$render(){return this.$setStyles({transform:`translate(${this.x}px, ${this.y}px)`,width:this.width,height:this.height,outlineWidth:r.innerWidth})}}ke.$name=p,ke.$version="2.0.0";class Me extends ve{constructor(){super(...arguments),this.$onCanvasCropEnd=null,this.$onCanvasCropStart=null,this.$style=':host{background-color:var(--theme-color);display:block}:host([action=move]),:host([action=select]){height:100%;left:0;position:absolute;top:0;width:100%}:host([action=move]){cursor:move}:host([action=select]){cursor:crosshair}:host([action$=-resize]){background-color:transparent;height:15px;position:absolute;width:15px}:host([action$=-resize]):after{background-color:var(--theme-color);content:"";display:block;height:5px;left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);width:5px}:host([action=n-resize]),:host([action=s-resize]){cursor:ns-resize;left:50%;transform:translateX(-50%);width:100%}:host([action=n-resize]){top:-8px}:host([action=s-resize]){bottom:-8px}:host([action=e-resize]),:host([action=w-resize]){cursor:ew-resize;height:100%;top:50%;transform:translateY(-50%)}:host([action=e-resize]){right:-8px}:host([action=w-resize]){left:-8px}:host([action=ne-resize]){cursor:nesw-resize;right:-8px;top:-8px}:host([action=nw-resize]){cursor:nwse-resize;left:-8px;top:-8px}:host([action=se-resize]){bottom:-8px;cursor:nwse-resize;right:-8px}:host([action=se-resize]):after{height:15px;width:15px}@media (pointer:coarse){:host([action=se-resize]):after{height:10px;width:10px}}@media (pointer:fine){:host([action=se-resize]):after{height:5px;width:5px}}:host([action=sw-resize]){bottom:-8px;cursor:nesw-resize;left:-8px}:host([plain]){background-color:transparent}',this.action=b,this.plain=!1,this.slottable=!1,this.themeColor="rgba(51, 153, 255, 0.5)"}static get observedAttributes(){return super.observedAttributes.concat(["action","plain"])}}Me.$name=d,Me.$version="2.0.0";const Ae=new WeakMap;class Ce extends ve{constructor(){super(...arguments),this.$onCanvasAction=null,this.$onCanvasActionStart=null,this.$onCanvasActionEnd=null,this.$onDocumentKeyDown=null,this.$action="",this.$actionStartTarget=null,this.$changing=!1,this.$style=':host{display:block;left:0;position:relative;right:0}:host([outlined]){outline:1px solid var(--theme-color)}:host([multiple]){outline:1px dashed hsla(0,0%,100%,.5)}:host([multiple]):after{bottom:0;content:"";cursor:pointer;display:block;left:0;position:absolute;right:0;top:0}:host([multiple][active]){outline-color:var(--theme-color);z-index:1}:host([multiple])>*{visibility:hidden}:host([multiple][active])>*{visibility:visible}:host([multiple][active]):after{display:none}',this.$initialSelection={x:0,y:0,width:0,height:0},this.x=0,this.y=0,this.width=0,this.height=0,this.aspectRatio=NaN,this.initialAspectRatio=NaN,this.initialCoverage=NaN,this.active=!1,this.linked=!1,this.dynamic=!1,this.movable=!1,this.resizable=!1,this.zoomable=!1,this.multiple=!1,this.keyboard=!1,this.outlined=!1,this.precise=!1}set $canvas(e){Ae.set(this,e)}get $canvas(){return Ae.get(this)}static get observedAttributes(){return super.observedAttributes.concat(["active","aspect-ratio","dynamic","height","initial-aspect-ratio","initial-coverage","keyboard","linked","movable","multiple","outlined","precise","resizable","width","x","y","zoomable"])}$propertyChangedCallback(e,t,i){if(!Object.is(i,t))switch(super.$propertyChangedCallback(e,t,i),e){case"x":case"y":case"width":case"height":this.$changing||this.$nextTick(()=>{this.$change(this.x,this.y,this.width,this.height,this.aspectRatio,!0)});break;case"aspectRatio":case"initialAspectRatio":this.$nextTick(()=>{this.$initSelection()});break;case"initialCoverage":this.$nextTick(()=>{U(i)&&i<=1&&this.$initSelection(!0,!0)});break;case"keyboard":this.$nextTick(()=>{this.$canvas&&(i?this.$onDocumentKeyDown||(this.$onDocumentKeyDown=this.$handleKeyDown.bind(this),ne(this.ownerDocument,R,this.$onDocumentKeyDown)):this.$onDocumentKeyDown&&(ie(this.ownerDocument,R,this.$onDocumentKeyDown),this.$onDocumentKeyDown=null))});break;case"multiple":this.$nextTick(()=>{if(this.$canvas){const e=this.$getSelections();i?(e.forEach(e=>{e.active=!1}),this.active=!0,this.$emit(B,{x:this.x,y:this.y,width:this.width,height:this.height})):(this.active=!1,e.slice(1).forEach(e=>{this.$removeSelection(e)}))}});break;case"precise":this.$nextTick(()=>{this.$change(this.x,this.y)});break;case"linked":i&&(this.dynamic=!0)}}connectedCallback(){super.connectedCallback();const e=this.closest(this.$getTagNameOf(l));e?(this.$canvas=e,this.$setStyles({position:"absolute",transform:`translate(${this.x}px, ${this.y}px)`}),this.hidden||this.$render(),this.$initSelection(!0),this.$onCanvasActionStart=this.$handleActionStart.bind(this),this.$onCanvasActionEnd=this.$handleActionEnd.bind(this),this.$onCanvasAction=this.$handleAction.bind(this),ne(e,Y,this.$onCanvasActionStart),ne(e,N,this.$onCanvasActionEnd),ne(e,F,this.$onCanvasAction)):this.$render()}disconnectedCallback(){const{$canvas:e}=this;e&&(this.$onCanvasActionStart&&(ie(e,Y,this.$onCanvasActionStart),this.$onCanvasActionStart=null),this.$onCanvasActionEnd&&(ie(e,N,this.$onCanvasActionEnd),this.$onCanvasActionEnd=null),this.$onCanvasAction&&(ie(e,F,this.$onCanvasAction),this.$onCanvasAction=null)),super.disconnectedCallback()}$getSelections(){let e=[];return this.parentElement&&(e=Array.from(this.parentElement.querySelectorAll(this.$getTagNameOf(f)))),e}$initSelection(e=!1,t=!1){const{initialCoverage:i,parentElement:n}=this;if(U(i)&&n){const r=this.aspectRatio||this.initialAspectRatio;let s=(t?0:this.width)||n.offsetWidth*i,o=(t?0:this.height)||n.offsetHeight*i;U(r)&&({width:s,height:o}=de({aspectRatio:r,width:s,height:o})),this.$change(this.x,this.y,s,o),e&&this.$center(),this.$initialSelection={x:this.x,y:this.y,width:this.width,height:this.height}}}$createSelection(){const e=this.cloneNode(!0);return this.hasAttribute("id")&&e.removeAttribute("id"),e.initialCoverage=NaN,this.active=!1,this.parentElement&&this.parentElement.insertBefore(e,this.nextSibling),e}$removeSelection(e=this){if(this.parentElement){const t=this.$getSelections();if(t.length>1){const i=t.indexOf(e),n=t[i+1]||t[i-1];n&&(e.active=!1,this.parentElement.removeChild(e),n.active=!0,n.$emit(B,{x:n.x,y:n.y,width:n.width,height:n.height}))}else this.$clear()}}$handleActionStart(e){var t,i;const n=null===(i=null===(t=e.detail)||void 0===t?void 0:t.relatedEvent)||void 0===i?void 0:i.target;this.$action="",this.$actionStartTarget=n,!this.hidden&&this.multiple&&!this.active&&n===this&&this.parentElement&&(this.$getSelections().forEach(e=>{e.active=!1}),this.active=!0,this.$emit(B,{x:this.x,y:this.y,width:this.width,height:this.height}))}$handleAction(e){const{currentTarget:t,detail:i}=e;if(!t||!i)return;const{relatedEvent:n}=i;let{action:r}=i;if(!r&&this.multiple&&(r=this.$action||(null==n?void 0:n.target.action),this.$action=r),!r||this.hidden&&r!==g||this.multiple&&!this.active&&r!==y)return;const s=i.endX-i.startX,o=i.endY-i.startY,{width:a,height:l}=this;let{aspectRatio:c}=this;switch(!U(c)&&n.shiftKey&&(c=U(a)&&U(l)?a/l:1),r){case g:if(0!==s&&0!==o){const{$canvas:e}=this,n=ae(t);(this.multiple&&!this.hidden?this.$createSelection():this).$change(i.startX-n.left,i.startY-n.top,Math.abs(s),Math.abs(o),c),s<0?o<0?r=A:o>0&&(r=D):s>0&&(o<0?r=M:o>0&&(r=C)),e&&(e.$action=r)}break;case _:this.movable&&(this.dynamic||this.$actionStartTarget&&this.contains(this.$actionStartTarget))&&this.$move(s,o);break;case y:if(n&&this.zoomable&&(this.dynamic||this.contains(n.target))){const e=ae(t);this.$zoom(i.scale,n.pageX-e.left,n.pageY-e.top)}break;default:this.$resize(r,s,o,c)}}$handleActionEnd(){this.$action="",this.$actionStartTarget=null}$handleKeyDown(e){if(this.hidden||!this.keyboard||this.multiple&&!this.active||e.defaultPrevented)return;const{activeElement:t}=document;if(!t||!["INPUT","TEXTAREA"].includes(t.tagName)&&!["true","plaintext-only"].includes(t.contentEditable))switch(e.key){case"Backspace":e.metaKey&&(e.preventDefault(),this.$removeSelection());break;case"Delete":e.preventDefault(),this.$removeSelection();break;case"ArrowLeft":e.preventDefault(),this.$move(-1,0);break;case"ArrowRight":e.preventDefault(),this.$move(1,0);break;case"ArrowUp":e.preventDefault(),this.$move(0,-1);break;case"ArrowDown":e.preventDefault(),this.$move(0,1);break;case"+":e.preventDefault(),this.$zoom(.1);break;case"-":e.preventDefault(),this.$zoom(-.1)}}$center(){const{parentElement:e}=this;if(!e)return this;const t=(e.offsetWidth-this.width)/2,i=(e.offsetHeight-this.height)/2;return this.$change(t,i)}$move(e,t=e){return this.$moveTo(this.x+e,this.y+t)}$moveTo(e,t=e){return this.movable?this.$change(e,t):this}$resize(e,t=0,i=0,n=this.aspectRatio){if(!this.resizable)return this;const r=U(n),{$canvas:s}=this;let{x:o,y:a,width:l,height:c}=this;switch(e){case w:a+=i,c-=i,c<0&&(e=T,c=-c,a-=c),r&&(o+=(t=i*n)/2,l-=t,l<0&&(l=-l,o-=l));break;case S:l+=t,l<0&&(e=k,l=-l,o-=l),r&&(a-=(i=t/n)/2,c+=i,c<0&&(c=-c,a-=c));break;case T:c+=i,c<0&&(e=w,c=-c,a-=c),r&&(o-=(t=i*n)/2,l+=t,l<0&&(l=-l,o-=l));break;case k:o+=t,l-=t,l<0&&(e=S,l=-l,o-=l),r&&(a+=(i=t/n)/2,c-=i,c<0&&(c=-c,a-=c));break;case M:r&&(i=-t/n),a+=i,c-=i,l+=t,l<0&&c<0?(e=D,l=-l,c=-c,o-=l,a-=c):l<0?(e=A,l=-l,o-=l):c<0&&(e=C,c=-c,a-=c);break;case A:r&&(i=t/n),o+=t,a+=i,l-=t,c-=i,l<0&&c<0?(e=C,l=-l,c=-c,o-=l,a-=c):l<0?(e=M,l=-l,o-=l):c<0&&(e=D,c=-c,a-=c);break;case C:r&&(i=t/n),l+=t,c+=i,l<0&&c<0?(e=A,l=-l,c=-c,o-=l,a-=c):l<0?(e=D,l=-l,o-=l):c<0&&(e=M,c=-c,a-=c);break;case D:r&&(i=-t/n),o+=t,l-=t,c+=i,l<0&&c<0?(e=M,l=-l,c=-c,o-=l,a-=c):l<0?(e=C,l=-l,o-=l):c<0&&(e=A,c=-c,a-=c)}return s&&s.$setAction(e),this.$change(o,a,l,c)}$zoom(e,t,i){if(!this.zoomable||0===e)return this;e<0?e=1/(1-e):e+=1;const{width:n,height:r}=this,s=n*e,o=r*e;let a=this.x,l=this.y;return W(t)&&W(i)?(a-=(s-n)*((t-this.x)/n),l-=(o-r)*((i-this.y)/r)):(a-=(s-n)/2,l-=(o-r)/2),this.$change(a,l,s,o)}$change(e,t,i=this.width,n=this.height,r=this.aspectRatio,s=!1){return this.$changing||!W(e)||!W(t)||!W(i)||!W(n)||i<0||n<0?this:(U(r)&&({width:i,height:n}=de({aspectRatio:r,width:i,height:n},"cover")),this.precise||(e=Math.round(e),t=Math.round(t),i=Math.round(i),n=Math.round(n)),e===this.x&&t===this.y&&i===this.width&&n===this.height&&Object.is(r,this.aspectRatio)&&!s?this:(this.hidden&&(this.hidden=!1),!1===this.$emit(B,{x:e,y:t,width:i,height:n})?this:(this.$changing=!0,this.x=e,this.y=t,this.width=i,this.height=n,this.$changing=!1,this.$render())))}$reset(){const{x:e,y:t,width:i,height:n}=this.$initialSelection;return this.$change(e,t,i,n)}$clear(){return this.$change(0,0,0,0,NaN,!0),this.hidden=!0,this}$render(){return this.$setStyles({transform:`translate(${this.x}px, ${this.y}px)`,width:this.width,height:this.height})}$toCanvas(e){return new Promise((t,i)=>{if(!this.isConnected)return void i(new Error("The current element is not connected to the DOM."));const n=document.createElement("canvas");let{width:r,height:s}=this,o=1;if(X(e)&&(U(e.width)||U(e.height))&&(({width:r,height:s}=de({aspectRatio:r/s,width:e.width,height:e.height})),o=r/this.width),n.width=r,n.height=s,!this.$canvas)return void t(n);const a=this.$canvas.querySelector(this.$getTagNameOf(u));a?a.$ready().then(i=>{const l=n.getContext("2d");if(l){const[t,c,h,d,u,f]=a.$getTransform(),p=-this.x,m=-this.y,g=(p*d-h*m)/(t*d-h*c),_=(m*t-c*p)/(t*d-h*c);let y=t*g+h*_+u,v=c*g+d*_+f,x=i.naturalWidth,b=i.naturalHeight;1!==o&&(y*=o,v*=o,x*=o,b*=o);const w=x/2,S=b/2;l.fillStyle="transparent",l.fillRect(0,0,r,s),X(e)&&q(e.beforeDraw)&&e.beforeDraw.call(this,l,n),l.save(),l.translate(w,S),l.transform(t,c,h,d,y,v),l.translate(-w,-S),l.drawImage(i,0,0,x,b),l.restore()}t(n)}).catch(i):t(n)})}}Ce.$name=f,Ce.$version="2.0.0";class De extends ve{constructor(){super(...arguments),this.$style=":host{display:flex;flex-direction:column;position:relative;touch-action:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}:host([bordered]){border:1px dashed var(--theme-color)}:host([covered]){bottom:0;left:0;position:absolute;right:0;top:0}:host>span{display:flex;flex:1}:host>span+span{border-top:1px dashed var(--theme-color)}:host>span>span{flex:1}:host>span>span+span{border-left:1px dashed var(--theme-color)}",this.bordered=!1,this.columns=3,this.covered=!1,this.rows=3,this.slottable=!1,this.themeColor="rgba(238, 238, 238, 0.5)"}static get observedAttributes(){return super.observedAttributes.concat(["bordered","columns","covered","rows"])}$propertyChangedCallback(e,t,i){Object.is(i,t)||(super.$propertyChangedCallback(e,t,i),"rows"!==e&&"columns"!==e||this.$nextTick(()=>{this.$render()}))}connectedCallback(){super.connectedCallback(),this.$render()}$render(){const e=this.$getShadowRoot(),t=document.createDocumentFragment();for(let e=0;e{setTimeout(()=>{this.$render()},50)}))}$handleSourceImageTransform(e){this.$render(void 0,e.detail.matrix)}$render(e,t){const{$canvas:i,$selection:n}=this;e||n.hidden||(e=n),(!e||0===e.x&&0===e.y&&0===e.width&&0===e.height)&&(e={x:0,y:0,width:i.offsetWidth,height:i.offsetHeight});const{x:r,y:s,width:o,height:a}=e,l={},{clientWidth:c,clientHeight:h}=this;let d=c,u=h,f=NaN;switch(this.resize){case"both":f=1,d=o,u=a,l.width=o,l.height=a;break;case"horizontal":f=a>0?h/a:0,d=o*f,l.width=d;break;case Oe:f=o>0?c/o:0,u=a*f,l.height=u;break;default:c>0?f=o>0?c/o:0:h>0&&(f=a>0?h/a:0)}this.$scale=f,this.$setStyles(l),this.$sourceImage&&this.$transformImageByOffset(null!=t?t:this.$sourceImage.$getTransform(),-r,-s)}$transformImageByOffset(e,t,i){const{$image:n,$scale:r,$sourceImage:s}=this;if(s&&n&&r>=0){const[s,o,a,l,c,h]=e,d=(t*l-a*i)/(s*l-a*o),u=(i*s-o*t)/(s*l-a*o),f=s*d+a*u+c,p=o*d+l*u+h;n.$ready(e=>{this.$setStyles.call(n,{width:e.naturalWidth*r,height:e.naturalHeight*r})}),n.$setTransform(s,o,a,l,f*r,p*r)}}}ze.$name=m,ze.$version="2.0.0";const Fe=/^img|canvas$/,Ne=/<(\/?(?:script|style)[^>]*)>/gi,Ye={template:''};xe.$define(),Le.$define(),De.$define(),Me.$define(),Se.$define(),Ce.$define(),ke.$define(),ze.$define();class Be{constructor(e,t){if(this.options=Ye,j(e)&&(e=document.querySelector(e)),!Z(e)||!Fe.test(e.localName))throw new Error("The first argument is required and must be an or element.");this.element=e,t=Object.assign(Object.assign({},Ye),t),this.options=t;const{ownerDocument:i}=e;let{container:n}=t;if(n&&(j(n)&&(n=i.querySelector(n)),!Z(n)))throw new Error("The `container` option must be an element or a valid selector.");Z(n)||(n=e.parentElement?e.parentElement:i.body),this.container=n;const r=e.localName;let s="";"img"===r?({src:s}=e):"canvas"===r&&window.HTMLCanvasElement&&(s=e.toDataURL());const{template:o}=t;if(o&&j(o)){const t=document.createElement("template"),i=document.createDocumentFragment();t.innerHTML=o.replace(Ne,"<$1>"),i.appendChild(t.content),Array.from(i.querySelectorAll(u)).forEach(t=>{t.setAttribute("src",s),t.setAttribute("alt",e.alt||"The image to crop")}),e.parentElement?(e.style.display="none",n.insertBefore(i,e.nextSibling)):n.appendChild(i)}}getCropperCanvas(){return this.container.querySelector(l)}getCropperImage(){return this.container.querySelector(u)}getCropperSelection(){return this.container.querySelector(f)}getCropperSelections(){return this.container.querySelectorAll(f)}}Be.version="2.0.0"},3318:(e,t,i)=>{"use strict";if(i.d(t,{A:()=>a}),/^(7(06|92|96)|140)$/.test(i.j))var n=i(222);if(/^(7(06|92|96)|140)$/.test(i.j))var r=i(8979);if(/^(7(06|92|96)|140)$/.test(i.j))var s=i(5581);if(/^(7(06|92|96)|140)$/.test(i.j))var o=i(6233);function a(e){return e!==(0,r.A)(e)&&(0,s.sb)(e)?(0,o.A)(e):(0,n.A)(e)}},3322:function(e,t,i){!function(e){"use strict";var t={words:{ss:["секунда","секунде","секунди"],m:["један минут","једног минута"],mm:["минут","минута","минута"],h:["један сат","једног сата"],hh:["сат","сата","сати"],d:["један дан","једног дана"],dd:["дан","дана","дана"],M:["један месец","једног месеца"],MM:["месец","месеца","месеци"],y:["једну годину","једне године"],yy:["годину","године","година"]},correctGrammaticalCase:function(e,t){return e%10>=1&&e%10<=4&&(e%100<10||e%100>=20)?e%10==1?t[0]:t[1]:t[2]},translate:function(e,i,n,r){var s,o=t.words[n];return 1===n.length?"y"===n&&i?"једна година":r||i?o[0]:o[1]:(s=t.correctGrammaticalCase(e,o),"yy"===n&&i&&"годину"===s?e+" година":e+" "+s)}};e.defineLocale("sr-cyrl",{months:"јануар_фебруар_март_април_мај_јун_јул_август_септембар_октобар_новембар_децембар".split("_"),monthsShort:"јан._феб._мар._апр._мај_јун_јул_авг._сеп._окт._нов._дец.".split("_"),monthsParseExact:!0,weekdays:"недеља_понедељак_уторак_среда_четвртак_петак_субота".split("_"),weekdaysShort:"нед._пон._уто._сре._чет._пет._суб.".split("_"),weekdaysMin:"не_по_ут_ср_че_пе_су".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"D. M. YYYY.",LL:"D. MMMM YYYY.",LLL:"D. MMMM YYYY. H:mm",LLLL:"dddd, D. MMMM YYYY. H:mm"},calendar:{sameDay:"[данас у] LT",nextDay:"[сутра у] LT",nextWeek:function(){switch(this.day()){case 0:return"[у] [недељу] [у] LT";case 3:return"[у] [среду] [у] LT";case 6:return"[у] [суботу] [у] LT";case 1:case 2:case 4:case 5:return"[у] dddd [у] LT"}},lastDay:"[јуче у] LT",lastWeek:function(){return["[прошле] [недеље] [у] LT","[прошлог] [понедељка] [у] LT","[прошлог] [уторка] [у] LT","[прошле] [среде] [у] LT","[прошлог] [четвртка] [у] LT","[прошлог] [петка] [у] LT","[прошле] [суботе] [у] LT"][this.day()]},sameElse:"L"},relativeTime:{future:"за %s",past:"пре %s",s:"неколико секунди",ss:t.translate,m:t.translate,mm:t.translate,h:t.translate,hh:t.translate,d:t.translate,dd:t.translate,M:t.translate,MM:t.translate,y:t.translate,yy:t.translate},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}})}(i(5093))},3335:function(e,t,i){var n,r;n=[i(5093),i(4692)],void 0===(r=function(e,t){return t.fn||(t.fn={}),"function"!=typeof e&&e.hasOwnProperty("default")&&(e=e.default),function(e,t){var i=function(i,n,r){if(this.parentEl="body",this.element=t(i),this.startDate=e().startOf("day"),this.endDate=e().endOf("day"),this.minDate=!1,this.maxDate=!1,this.maxSpan=!1,this.autoApply=!1,this.singleDatePicker=!1,this.showDropdowns=!1,this.minYear=e().subtract(100,"year").format("YYYY"),this.maxYear=e().add(100,"year").format("YYYY"),this.showWeekNumbers=!1,this.showISOWeekNumbers=!1,this.showCustomRangeLabel=!0,this.timePicker=!1,this.timePicker24Hour=!1,this.timePickerIncrement=1,this.timePickerSeconds=!1,this.linkedCalendars=!0,this.autoUpdateInput=!0,this.alwaysShowCalendars=!1,this.ranges={},this.opens="right",this.element.hasClass("pull-right")&&(this.opens="left"),this.drops="down",this.element.hasClass("dropup")&&(this.drops="up"),this.buttonClasses="btn btn-sm",this.applyButtonClasses="btn-primary",this.cancelButtonClasses="btn-default",this.locale={direction:"ltr",format:e.localeData().longDateFormat("L"),separator:" - ",applyLabel:"Apply",cancelLabel:"Cancel",weekLabel:"W",customRangeLabel:"Custom Range",daysOfWeek:e.weekdaysMin(),monthNames:e.monthsShort(),firstDay:e.localeData().firstDayOfWeek()},this.callback=function(){},this.isShowing=!1,this.leftCalendar={},this.rightCalendar={},"object"==typeof n&&null!==n||(n={}),"string"==typeof(n=t.extend(this.element.data(),n)).template||n.template instanceof t||(n.template='
'),this.parentEl=n.parentEl&&t(n.parentEl).length?t(n.parentEl):t(this.parentEl),this.container=t(n.template).appendTo(this.parentEl),"object"==typeof n.locale&&("string"==typeof n.locale.direction&&(this.locale.direction=n.locale.direction),"string"==typeof n.locale.format&&(this.locale.format=n.locale.format),"string"==typeof n.locale.separator&&(this.locale.separator=n.locale.separator),"object"==typeof n.locale.daysOfWeek&&(this.locale.daysOfWeek=n.locale.daysOfWeek.slice()),"object"==typeof n.locale.monthNames&&(this.locale.monthNames=n.locale.monthNames.slice()),"number"==typeof n.locale.firstDay&&(this.locale.firstDay=n.locale.firstDay),"string"==typeof n.locale.applyLabel&&(this.locale.applyLabel=n.locale.applyLabel),"string"==typeof n.locale.cancelLabel&&(this.locale.cancelLabel=n.locale.cancelLabel),"string"==typeof n.locale.weekLabel&&(this.locale.weekLabel=n.locale.weekLabel),"string"==typeof n.locale.customRangeLabel)){(u=document.createElement("textarea")).innerHTML=n.locale.customRangeLabel;var s=u.value;this.locale.customRangeLabel=s}if(this.container.addClass(this.locale.direction),"string"==typeof n.startDate&&(this.startDate=e(n.startDate,this.locale.format)),"string"==typeof n.endDate&&(this.endDate=e(n.endDate,this.locale.format)),"string"==typeof n.minDate&&(this.minDate=e(n.minDate,this.locale.format)),"string"==typeof n.maxDate&&(this.maxDate=e(n.maxDate,this.locale.format)),"object"==typeof n.startDate&&(this.startDate=e(n.startDate)),"object"==typeof n.endDate&&(this.endDate=e(n.endDate)),"object"==typeof n.minDate&&(this.minDate=e(n.minDate)),"object"==typeof n.maxDate&&(this.maxDate=e(n.maxDate)),this.minDate&&this.startDate.isBefore(this.minDate)&&(this.startDate=this.minDate.clone()),this.maxDate&&this.endDate.isAfter(this.maxDate)&&(this.endDate=this.maxDate.clone()),"string"==typeof n.applyButtonClasses&&(this.applyButtonClasses=n.applyButtonClasses),"string"==typeof n.applyClass&&(this.applyButtonClasses=n.applyClass),"string"==typeof n.cancelButtonClasses&&(this.cancelButtonClasses=n.cancelButtonClasses),"string"==typeof n.cancelClass&&(this.cancelButtonClasses=n.cancelClass),"object"==typeof n.maxSpan&&(this.maxSpan=n.maxSpan),"object"==typeof n.dateLimit&&(this.maxSpan=n.dateLimit),"string"==typeof n.opens&&(this.opens=n.opens),"string"==typeof n.drops&&(this.drops=n.drops),"boolean"==typeof n.showWeekNumbers&&(this.showWeekNumbers=n.showWeekNumbers),"boolean"==typeof n.showISOWeekNumbers&&(this.showISOWeekNumbers=n.showISOWeekNumbers),"string"==typeof n.buttonClasses&&(this.buttonClasses=n.buttonClasses),"object"==typeof n.buttonClasses&&(this.buttonClasses=n.buttonClasses.join(" ")),"boolean"==typeof n.showDropdowns&&(this.showDropdowns=n.showDropdowns),"number"==typeof n.minYear&&(this.minYear=n.minYear),"number"==typeof n.maxYear&&(this.maxYear=n.maxYear),"boolean"==typeof n.showCustomRangeLabel&&(this.showCustomRangeLabel=n.showCustomRangeLabel),"boolean"==typeof n.singleDatePicker&&(this.singleDatePicker=n.singleDatePicker,this.singleDatePicker&&(this.endDate=this.startDate.clone())),"boolean"==typeof n.timePicker&&(this.timePicker=n.timePicker),"boolean"==typeof n.timePickerSeconds&&(this.timePickerSeconds=n.timePickerSeconds),"number"==typeof n.timePickerIncrement&&(this.timePickerIncrement=n.timePickerIncrement),"boolean"==typeof n.timePicker24Hour&&(this.timePicker24Hour=n.timePicker24Hour),"boolean"==typeof n.autoApply&&(this.autoApply=n.autoApply),"boolean"==typeof n.autoUpdateInput&&(this.autoUpdateInput=n.autoUpdateInput),"boolean"==typeof n.linkedCalendars&&(this.linkedCalendars=n.linkedCalendars),"function"==typeof n.isInvalidDate&&(this.isInvalidDate=n.isInvalidDate),"function"==typeof n.isCustomDate&&(this.isCustomDate=n.isCustomDate),"boolean"==typeof n.alwaysShowCalendars&&(this.alwaysShowCalendars=n.alwaysShowCalendars),0!=this.locale.firstDay)for(var o=this.locale.firstDay;o>0;)this.locale.daysOfWeek.push(this.locale.daysOfWeek.shift()),o--;var a,l,c;if(void 0===n.startDate&&void 0===n.endDate&&t(this.element).is(":text")){var h=t(this.element).val(),d=h.split(this.locale.separator);a=l=null,2==d.length?(a=e(d[0],this.locale.format),l=e(d[1],this.locale.format)):this.singleDatePicker&&""!==h&&(a=e(h,this.locale.format),l=e(h,this.locale.format)),null!==a&&null!==l&&(this.setStartDate(a),this.setEndDate(l))}if("object"==typeof n.ranges){for(c in n.ranges){a="string"==typeof n.ranges[c][0]?e(n.ranges[c][0],this.locale.format):e(n.ranges[c][0]),l="string"==typeof n.ranges[c][1]?e(n.ranges[c][1],this.locale.format):e(n.ranges[c][1]),this.minDate&&a.isBefore(this.minDate)&&(a=this.minDate.clone());var u,f=this.maxDate;this.maxSpan&&f&&a.clone().add(this.maxSpan).isAfter(f)&&(f=a.clone().add(this.maxSpan)),f&&l.isAfter(f)&&(l=f.clone()),this.minDate&&l.isBefore(this.minDate,this.timepicker?"minute":"day")||f&&a.isAfter(f,this.timepicker?"minute":"day")||((u=document.createElement("textarea")).innerHTML=c,s=u.value,this.ranges[s]=[a,l])}var p="
    ";for(c in this.ranges)p+='
  • '+c+"
  • ";this.showCustomRangeLabel&&(p+='
  • '+this.locale.customRangeLabel+"
  • "),p+="
",this.container.find(".ranges").prepend(p)}"function"==typeof r&&(this.callback=r),this.timePicker||(this.startDate=this.startDate.startOf("day"),this.endDate=this.endDate.endOf("day"),this.container.find(".calendar-time").hide()),this.timePicker&&this.autoApply&&(this.autoApply=!1),this.autoApply&&this.container.addClass("auto-apply"),"object"==typeof n.ranges&&this.container.addClass("show-ranges"),this.singleDatePicker&&(this.container.addClass("single"),this.container.find(".drp-calendar.left").addClass("single"),this.container.find(".drp-calendar.left").show(),this.container.find(".drp-calendar.right").hide(),!this.timePicker&&this.autoApply&&this.container.addClass("auto-apply")),(void 0===n.ranges&&!this.singleDatePicker||this.alwaysShowCalendars)&&this.container.addClass("show-calendar"),this.container.addClass("opens"+this.opens),this.container.find(".applyBtn, .cancelBtn").addClass(this.buttonClasses),this.applyButtonClasses.length&&this.container.find(".applyBtn").addClass(this.applyButtonClasses),this.cancelButtonClasses.length&&this.container.find(".cancelBtn").addClass(this.cancelButtonClasses),this.container.find(".applyBtn").html(this.locale.applyLabel),this.container.find(".cancelBtn").html(this.locale.cancelLabel),this.container.find(".drp-calendar").on("click.daterangepicker",".prev",t.proxy(this.clickPrev,this)).on("click.daterangepicker",".next",t.proxy(this.clickNext,this)).on("mousedown.daterangepicker","td.available",t.proxy(this.clickDate,this)).on("mouseenter.daterangepicker","td.available",t.proxy(this.hoverDate,this)).on("change.daterangepicker","select.yearselect",t.proxy(this.monthOrYearChanged,this)).on("change.daterangepicker","select.monthselect",t.proxy(this.monthOrYearChanged,this)).on("change.daterangepicker","select.hourselect,select.minuteselect,select.secondselect,select.ampmselect",t.proxy(this.timeChanged,this)),this.container.find(".ranges").on("click.daterangepicker","li",t.proxy(this.clickRange,this)),this.container.find(".drp-buttons").on("click.daterangepicker","button.applyBtn",t.proxy(this.clickApply,this)).on("click.daterangepicker","button.cancelBtn",t.proxy(this.clickCancel,this)),this.element.is("input")||this.element.is("button")?this.element.on({"click.daterangepicker":t.proxy(this.show,this),"focus.daterangepicker":t.proxy(this.show,this),"keyup.daterangepicker":t.proxy(this.elementChanged,this),"keydown.daterangepicker":t.proxy(this.keydown,this)}):(this.element.on("click.daterangepicker",t.proxy(this.toggle,this)),this.element.on("keydown.daterangepicker",t.proxy(this.toggle,this))),this.updateElement()};return i.prototype={constructor:i,setStartDate:function(t){"string"==typeof t&&(this.startDate=e(t,this.locale.format)),"object"==typeof t&&(this.startDate=e(t)),this.timePicker||(this.startDate=this.startDate.startOf("day")),this.timePicker&&this.timePickerIncrement&&this.startDate.minute(Math.round(this.startDate.minute()/this.timePickerIncrement)*this.timePickerIncrement),this.minDate&&this.startDate.isBefore(this.minDate)&&(this.startDate=this.minDate.clone(),this.timePicker&&this.timePickerIncrement&&this.startDate.minute(Math.round(this.startDate.minute()/this.timePickerIncrement)*this.timePickerIncrement)),this.maxDate&&this.startDate.isAfter(this.maxDate)&&(this.startDate=this.maxDate.clone(),this.timePicker&&this.timePickerIncrement&&this.startDate.minute(Math.floor(this.startDate.minute()/this.timePickerIncrement)*this.timePickerIncrement)),this.isShowing||this.updateElement(),this.updateMonthsInView()},setEndDate:function(t){"string"==typeof t&&(this.endDate=e(t,this.locale.format)),"object"==typeof t&&(this.endDate=e(t)),this.timePicker||(this.endDate=this.endDate.endOf("day")),this.timePicker&&this.timePickerIncrement&&this.endDate.minute(Math.round(this.endDate.minute()/this.timePickerIncrement)*this.timePickerIncrement),this.endDate.isBefore(this.startDate)&&(this.endDate=this.startDate.clone()),this.maxDate&&this.endDate.isAfter(this.maxDate)&&(this.endDate=this.maxDate.clone()),this.maxSpan&&this.startDate.clone().add(this.maxSpan).isBefore(this.endDate)&&(this.endDate=this.startDate.clone().add(this.maxSpan)),this.previousRightTime=this.endDate.clone(),this.container.find(".drp-selected").html(this.startDate.format(this.locale.format)+this.locale.separator+this.endDate.format(this.locale.format)),this.isShowing||this.updateElement(),this.updateMonthsInView()},isInvalidDate:function(){return!1},isCustomDate:function(){return!1},updateView:function(){this.timePicker&&(this.renderTimePicker("left"),this.renderTimePicker("right"),this.endDate?this.container.find(".right .calendar-time select").prop("disabled",!1).removeClass("disabled"):this.container.find(".right .calendar-time select").prop("disabled",!0).addClass("disabled")),this.endDate&&this.container.find(".drp-selected").html(this.startDate.format(this.locale.format)+this.locale.separator+this.endDate.format(this.locale.format)),this.updateMonthsInView(),this.updateCalendars(),this.updateFormInputs()},updateMonthsInView:function(){if(this.endDate){if(!this.singleDatePicker&&this.leftCalendar.month&&this.rightCalendar.month&&(this.startDate.format("YYYY-MM")==this.leftCalendar.month.format("YYYY-MM")||this.startDate.format("YYYY-MM")==this.rightCalendar.month.format("YYYY-MM"))&&(this.endDate.format("YYYY-MM")==this.leftCalendar.month.format("YYYY-MM")||this.endDate.format("YYYY-MM")==this.rightCalendar.month.format("YYYY-MM")))return;this.leftCalendar.month=this.startDate.clone().date(2),this.linkedCalendars||this.endDate.month()==this.startDate.month()&&this.endDate.year()==this.startDate.year()?this.rightCalendar.month=this.startDate.clone().date(2).add(1,"month"):this.rightCalendar.month=this.endDate.clone().date(2)}else this.leftCalendar.month.format("YYYY-MM")!=this.startDate.format("YYYY-MM")&&this.rightCalendar.month.format("YYYY-MM")!=this.startDate.format("YYYY-MM")&&(this.leftCalendar.month=this.startDate.clone().date(2),this.rightCalendar.month=this.startDate.clone().date(2).add(1,"month"));this.maxDate&&this.linkedCalendars&&!this.singleDatePicker&&this.rightCalendar.month>this.maxDate&&(this.rightCalendar.month=this.maxDate.clone().date(2),this.leftCalendar.month=this.maxDate.clone().date(2).subtract(1,"month"))},updateCalendars:function(){var e,t,i,n;this.timePicker&&(this.endDate?(e=parseInt(this.container.find(".left .hourselect").val(),10),t=parseInt(this.container.find(".left .minuteselect").val(),10),isNaN(t)&&(t=parseInt(this.container.find(".left .minuteselect option:last").val(),10)),i=this.timePickerSeconds?parseInt(this.container.find(".left .secondselect").val(),10):0,this.timePicker24Hour||("PM"===(n=this.container.find(".left .ampmselect").val())&&e<12&&(e+=12),"AM"===n&&12===e&&(e=0))):(e=parseInt(this.container.find(".right .hourselect").val(),10),t=parseInt(this.container.find(".right .minuteselect").val(),10),isNaN(t)&&(t=parseInt(this.container.find(".right .minuteselect option:last").val(),10)),i=this.timePickerSeconds?parseInt(this.container.find(".right .secondselect").val(),10):0,this.timePicker24Hour||("PM"===(n=this.container.find(".right .ampmselect").val())&&e<12&&(e+=12),"AM"===n&&12===e&&(e=0))),this.leftCalendar.month.hour(e).minute(t).second(i),this.rightCalendar.month.hour(e).minute(t).second(i)),this.renderCalendar("left"),this.renderCalendar("right"),this.container.find(".ranges li").removeClass("active"),null!=this.endDate&&this.calculateChosenLabel()},renderCalendar:function(i){var n,r=(n="left"==i?this.leftCalendar:this.rightCalendar).month.month(),s=n.month.year(),o=n.month.hour(),a=n.month.minute(),l=n.month.second(),c=e([s,r]).daysInMonth(),h=e([s,r,1]),d=e([s,r,c]),u=e(h).subtract(1,"month").month(),f=e(h).subtract(1,"month").year(),p=e([f,u]).daysInMonth(),m=h.day();(n=[]).firstDay=h,n.lastDay=d;for(var g=0;g<6;g++)n[g]=[];var _=p-m+this.locale.firstDay+1;_>p&&(_-=7),m==this.locale.firstDay&&(_=p-6);for(var y=e([f,u,_,12,a,l]),v=(g=0,0),x=0;g<42;g++,v++,y=e(y).add(24,"hour"))g>0&&v%7==0&&(v=0,x++),n[x][v]=y.clone().hour(o).minute(a).second(l),y.hour(12),this.minDate&&n[x][v].format("YYYY-MM-DD")==this.minDate.format("YYYY-MM-DD")&&n[x][v].isBefore(this.minDate)&&"left"==i&&(n[x][v]=this.minDate.clone()),this.maxDate&&n[x][v].format("YYYY-MM-DD")==this.maxDate.format("YYYY-MM-DD")&&n[x][v].isAfter(this.maxDate)&&"right"==i&&(n[x][v]=this.maxDate.clone());"left"==i?this.leftCalendar.calendar=n:this.rightCalendar.calendar=n;var b="left"==i?this.minDate:this.startDate,w=this.maxDate,S=("left"==i?this.startDate:this.endDate,this.locale.direction,'');S+="",S+="",(this.showWeekNumbers||this.showISOWeekNumbers)&&(S+=""),b&&!b.isBefore(n.firstDay)||this.linkedCalendars&&"left"!=i?S+="":S+='';var T=this.locale.monthNames[n[1][1].month()]+n[1][1].format(" YYYY");if(this.showDropdowns){for(var k=n[1][1].month(),M=n[1][1].year(),A=w&&w.year()||this.maxYear,C=b&&b.year()||this.minYear,D=M==C,L=M==A,E='";for(var P='")}if(S+='",w&&!w.isAfter(n.lastDay)||this.linkedCalendars&&"right"!=i&&!this.singleDatePicker?S+="":S+='',S+="",S+="",(this.showWeekNumbers||this.showISOWeekNumbers)&&(S+='"),t.each(this.locale.daysOfWeek,function(e,t){S+=""}),S+="",S+="",S+="",null==this.endDate&&this.maxSpan){var O=this.startDate.clone().add(this.maxSpan).endOf("day");w&&!O.isBefore(w)||(w=O)}for(x=0;x<6;x++){for(S+="",this.showWeekNumbers?S+='":this.showISOWeekNumbers&&(S+='"),v=0;v<7;v++){var z=[];n[x][v].isSame(new Date,"day")&&z.push("today"),n[x][v].isoWeekday()>5&&z.push("weekend"),n[x][v].month()!=n[1][1].month()&&z.push("off","ends"),this.minDate&&n[x][v].isBefore(this.minDate,"day")&&z.push("off","disabled"),w&&n[x][v].isAfter(w,"day")&&z.push("off","disabled"),this.isInvalidDate(n[x][v])&&z.push("off","disabled"),n[x][v].format("YYYY-MM-DD")==this.startDate.format("YYYY-MM-DD")&&z.push("active","start-date"),null!=this.endDate&&n[x][v].format("YYYY-MM-DD")==this.endDate.format("YYYY-MM-DD")&&z.push("active","end-date"),null!=this.endDate&&n[x][v]>this.startDate&&n[x][v]'+n[x][v].date()+""}S+=""}S+="",S+="
'+T+"
'+this.locale.weekLabel+""+t+"
'+n[x][0].week()+"'+n[x][0].isoWeek()+"
",this.container.find(".drp-calendar."+i+" .calendar-table").html(S)},renderTimePicker:function(e){if("right"!=e||this.endDate){var t,i,n,r=this.maxDate;if(!this.maxSpan||this.maxDate&&!this.startDate.clone().add(this.maxSpan).isBefore(this.maxDate)||(r=this.startDate.clone().add(this.maxSpan)),"left"==e)i=this.startDate.clone(),n=this.minDate;else if("right"==e){i=this.endDate.clone(),n=this.startDate;var s=this.container.find(".drp-calendar.right .calendar-time");if(""!=s.html()&&(i.hour(isNaN(i.hour())?s.find(".hourselect option:selected").val():i.hour()),i.minute(isNaN(i.minute())?s.find(".minuteselect option:selected").val():i.minute()),i.second(isNaN(i.second())?s.find(".secondselect option:selected").val():i.second()),!this.timePicker24Hour)){var o=s.find(".ampmselect option:selected").val();"PM"===o&&i.hour()<12&&i.hour(i.hour()+12),"AM"===o&&12===i.hour()&&i.hour(0)}i.isBefore(this.startDate)&&(i=this.startDate.clone()),r&&i.isAfter(r)&&(i=r.clone())}t=' ",t+=': ",this.timePickerSeconds){for(t+=': "}if(!this.timePicker24Hour){t+='"}this.container.find(".drp-calendar."+e+" .calendar-time").html(t)}},updateFormInputs:function(){this.singleDatePicker||this.endDate&&(this.startDate.isBefore(this.endDate)||this.startDate.isSame(this.endDate))?this.container.find("button.applyBtn").prop("disabled",!1):this.container.find("button.applyBtn").prop("disabled",!0)},move:function(){var e,i={top:0,left:0},n=this.drops,r=t(window).width();switch(this.parentEl.is("body")||(i={top:this.parentEl.offset().top-this.parentEl.scrollTop(),left:this.parentEl.offset().left-this.parentEl.scrollLeft()},r=this.parentEl[0].clientWidth+this.parentEl.offset().left),n){case"auto":(e=this.element.offset().top+this.element.outerHeight()-i.top)+this.container.outerHeight()>=this.parentEl[0].scrollHeight&&(e=this.element.offset().top-this.container.outerHeight()-i.top,n="up");break;case"up":e=this.element.offset().top-this.container.outerHeight()-i.top;break;default:e=this.element.offset().top+this.element.outerHeight()-i.top}this.container.css({top:0,left:0,right:"auto"});var s=this.container.outerWidth();if(this.container.toggleClass("drop-up","up"==n),"left"==this.opens){var o=r-this.element.offset().left-this.element.outerWidth();s+o>t(window).width()?this.container.css({top:e,right:"auto",left:9}):this.container.css({top:e,right:o,left:"auto"})}else if("center"==this.opens)(a=this.element.offset().left-i.left+this.element.outerWidth()/2-s/2)<0?this.container.css({top:e,right:"auto",left:9}):a+s>t(window).width()?this.container.css({top:e,left:"auto",right:0}):this.container.css({top:e,left:a,right:"auto"});else{var a;(a=this.element.offset().left-i.left)+s>t(window).width()?this.container.css({top:e,left:"auto",right:0}):this.container.css({top:e,left:a,right:"auto"})}},show:function(e){this.isShowing||(this._outsideClickProxy=t.proxy(function(e){this.outsideClick(e)},this),t(document).on("mousedown.daterangepicker",this._outsideClickProxy).on("touchend.daterangepicker",this._outsideClickProxy).on("click.daterangepicker","[data-toggle=dropdown]",this._outsideClickProxy).on("focusin.daterangepicker",this._outsideClickProxy),t(window).on("resize.daterangepicker",t.proxy(function(e){this.move(e)},this)),this.oldStartDate=this.startDate.clone(),this.oldEndDate=this.endDate.clone(),this.previousRightTime=this.endDate.clone(),this.updateView(),this.container.show(),this.move(),this.element.trigger("show.daterangepicker",this),this.isShowing=!0)},hide:function(e){this.isShowing&&(this.endDate||(this.startDate=this.oldStartDate.clone(),this.endDate=this.oldEndDate.clone()),this.startDate.isSame(this.oldStartDate)&&this.endDate.isSame(this.oldEndDate)||this.callback(this.startDate.clone(),this.endDate.clone(),this.chosenLabel),this.updateElement(),t(document).off(".daterangepicker"),t(window).off(".daterangepicker"),this.container.hide(),this.element.trigger("hide.daterangepicker",this),this.isShowing=!1)},toggle:function(e){this.isShowing?this.hide():this.show()},outsideClick:function(e){var i=t(e.target);"focusin"==e.type||i.closest(this.element).length||i.closest(this.container).length||i.closest(".calendar-table").length||(this.hide(),this.element.trigger("outsideClick.daterangepicker",this))},showCalendars:function(){this.container.addClass("show-calendar"),this.move(),this.element.trigger("showCalendar.daterangepicker",this)},hideCalendars:function(){this.container.removeClass("show-calendar"),this.element.trigger("hideCalendar.daterangepicker",this)},clickRange:function(e){var t=e.target.getAttribute("data-range-key");if(this.chosenLabel=t,t==this.locale.customRangeLabel)this.showCalendars();else{var i=this.ranges[t];this.startDate=i[0],this.endDate=i[1],this.timePicker||(this.startDate.startOf("day"),this.endDate.endOf("day")),this.alwaysShowCalendars||this.hideCalendars(),this.clickApply()}},clickPrev:function(e){t(e.target).parents(".drp-calendar").hasClass("left")?(this.leftCalendar.month.subtract(1,"month"),this.linkedCalendars&&this.rightCalendar.month.subtract(1,"month")):this.rightCalendar.month.subtract(1,"month"),this.updateCalendars()},clickNext:function(e){t(e.target).parents(".drp-calendar").hasClass("left")?this.leftCalendar.month.add(1,"month"):(this.rightCalendar.month.add(1,"month"),this.linkedCalendars&&this.leftCalendar.month.add(1,"month")),this.updateCalendars()},hoverDate:function(e){if(t(e.target).hasClass("available")){var i=t(e.target).attr("data-title"),n=i.substr(1,1),r=i.substr(3,1),s=t(e.target).parents(".drp-calendar").hasClass("left")?this.leftCalendar.calendar[n][r]:this.rightCalendar.calendar[n][r],o=this.leftCalendar,a=this.rightCalendar,l=this.startDate;this.endDate||this.container.find(".drp-calendar tbody td").each(function(e,i){if(!t(i).hasClass("week")){var n=t(i).attr("data-title"),r=n.substr(1,1),c=n.substr(3,1),h=t(i).parents(".drp-calendar").hasClass("left")?o.calendar[r][c]:a.calendar[r][c];h.isAfter(l)&&h.isBefore(s)||h.isSame(s,"day")?t(i).addClass("in-range"):t(i).removeClass("in-range")}})}},clickDate:function(e){if(t(e.target).hasClass("available")){var i=t(e.target).attr("data-title"),n=i.substr(1,1),r=i.substr(3,1),s=t(e.target).parents(".drp-calendar").hasClass("left")?this.leftCalendar.calendar[n][r]:this.rightCalendar.calendar[n][r];if(this.endDate||s.isBefore(this.startDate,"day")){if(this.timePicker){var o=parseInt(this.container.find(".left .hourselect").val(),10);this.timePicker24Hour||("PM"===(c=this.container.find(".left .ampmselect").val())&&o<12&&(o+=12),"AM"===c&&12===o&&(o=0));var a=parseInt(this.container.find(".left .minuteselect").val(),10);isNaN(a)&&(a=parseInt(this.container.find(".left .minuteselect option:last").val(),10));var l=this.timePickerSeconds?parseInt(this.container.find(".left .secondselect").val(),10):0;s=s.clone().hour(o).minute(a).second(l)}this.endDate=null,this.setStartDate(s.clone())}else if(!this.endDate&&s.isBefore(this.startDate))this.setEndDate(this.startDate.clone());else{var c;this.timePicker&&(o=parseInt(this.container.find(".right .hourselect").val(),10),this.timePicker24Hour||("PM"===(c=this.container.find(".right .ampmselect").val())&&o<12&&(o+=12),"AM"===c&&12===o&&(o=0)),a=parseInt(this.container.find(".right .minuteselect").val(),10),isNaN(a)&&(a=parseInt(this.container.find(".right .minuteselect option:last").val(),10)),l=this.timePickerSeconds?parseInt(this.container.find(".right .secondselect").val(),10):0,s=s.clone().hour(o).minute(a).second(l)),this.setEndDate(s.clone()),this.autoApply&&(this.calculateChosenLabel(),this.clickApply())}this.singleDatePicker&&(this.setEndDate(this.startDate),!this.timePicker&&this.autoApply&&this.clickApply()),this.updateView(),e.stopPropagation()}},calculateChosenLabel:function(){var e=!0,t=0;for(var i in this.ranges){if(this.timePicker){var n=this.timePickerSeconds?"YYYY-MM-DD HH:mm:ss":"YYYY-MM-DD HH:mm";if(this.startDate.format(n)==this.ranges[i][0].format(n)&&this.endDate.format(n)==this.ranges[i][1].format(n)){e=!1,this.chosenLabel=this.container.find(".ranges li:eq("+t+")").addClass("active").attr("data-range-key");break}}else if(this.startDate.format("YYYY-MM-DD")==this.ranges[i][0].format("YYYY-MM-DD")&&this.endDate.format("YYYY-MM-DD")==this.ranges[i][1].format("YYYY-MM-DD")){e=!1,this.chosenLabel=this.container.find(".ranges li:eq("+t+")").addClass("active").attr("data-range-key");break}t++}e&&(this.showCustomRangeLabel?this.chosenLabel=this.container.find(".ranges li:last").addClass("active").attr("data-range-key"):this.chosenLabel=null,this.showCalendars())},clickApply:function(e){this.hide(),this.element.trigger("apply.daterangepicker",this)},clickCancel:function(e){this.startDate=this.oldStartDate,this.endDate=this.oldEndDate,this.hide(),this.element.trigger("cancel.daterangepicker",this)},monthOrYearChanged:function(e){var i=t(e.target).closest(".drp-calendar").hasClass("left"),n=i?"left":"right",r=this.container.find(".drp-calendar."+n),s=parseInt(r.find(".monthselect").val(),10),o=r.find(".yearselect").val();i||(othis.maxDate.year()||o==this.maxDate.year()&&s>this.maxDate.month())&&(s=this.maxDate.month(),o=this.maxDate.year()),i?(this.leftCalendar.month.month(s).year(o),this.linkedCalendars&&(this.rightCalendar.month=this.leftCalendar.month.clone().add(1,"month"))):(this.rightCalendar.month.month(s).year(o),this.linkedCalendars&&(this.leftCalendar.month=this.rightCalendar.month.clone().subtract(1,"month"))),this.updateCalendars()},timeChanged:function(e){var i=t(e.target).closest(".drp-calendar"),n=i.hasClass("left"),r=parseInt(i.find(".hourselect").val(),10),s=parseInt(i.find(".minuteselect").val(),10);isNaN(s)&&(s=parseInt(i.find(".minuteselect option:last").val(),10));var o=this.timePickerSeconds?parseInt(i.find(".secondselect").val(),10):0;if(!this.timePicker24Hour){var a=i.find(".ampmselect").val();"PM"===a&&r<12&&(r+=12),"AM"===a&&12===r&&(r=0)}if(n){var l=this.startDate.clone();l.hour(r),l.minute(s),l.second(o),this.setStartDate(l),this.singleDatePicker?this.endDate=this.startDate.clone():this.endDate&&this.endDate.format("YYYY-MM-DD")==l.format("YYYY-MM-DD")&&this.endDate.isBefore(l)&&this.setEndDate(l.clone())}else if(this.endDate){var c=this.endDate.clone();c.hour(r),c.minute(s),c.second(o),this.setEndDate(c)}this.updateCalendars(),this.updateFormInputs(),this.renderTimePicker("left"),this.renderTimePicker("right")},elementChanged:function(){if(this.element.is("input")&&this.element.val().length){var t=this.element.val().split(this.locale.separator),i=null,n=null;2===t.length&&(i=e(t[0],this.locale.format),n=e(t[1],this.locale.format)),(this.singleDatePicker||null===i||null===n)&&(n=i=e(this.element.val(),this.locale.format)),i.isValid()&&n.isValid()&&(this.setStartDate(i),this.setEndDate(n),this.updateView())}},keydown:function(e){9!==e.keyCode&&13!==e.keyCode||this.hide(),27===e.keyCode&&(e.preventDefault(),e.stopPropagation(),this.hide())},updateElement:function(){if(this.element.is("input")&&this.autoUpdateInput){var e=this.startDate.format(this.locale.format);this.singleDatePicker||(e+=this.locale.separator+this.endDate.format(this.locale.format)),e!==this.element.val()&&this.element.val(e).trigger("change")}},remove:function(){this.container.remove(),this.element.off(".daterangepicker"),this.element.removeData()}},t.fn.daterangepicker=function(e,n){var r=t.extend(!0,{},t.fn.daterangepicker.defaultOptions,e);return this.each(function(){var e=t(this);e.data("daterangepicker")&&e.data("daterangepicker").remove(),e.data("daterangepicker",new i(e,r,n))}),this},i}(e,t)}.apply(t,n))||(e.exports=r)},3341:(e,t,i)=>{"use strict";if(i.d(t,{A:()=>a}),/^(7(06|92|96)|140)$/.test(i.j))var n=i(9970);if(/^(7(06|92|96)|140)$/.test(i.j))var r=i(2083);if(/^(7(06|92|96)|140)$/.test(i.j))var s=i(8979);if(/^(7(06|92|96)|140)$/.test(i.j))var o=i(134);function a(e,t){var i;void 0===t&&(t=[]);var l=(0,n.A)(e),c=l===(null==(i=e.ownerDocument)?void 0:i.body),h=(0,s.A)(l),d=c?[h].concat(h.visualViewport||[],(0,o.A)(l)?l:[]):l,u=t.concat(d);return c?u:u.concat(a((0,r.A)(d)))}},3383:function(e,t,i){!function(e){"use strict";function t(e,t,i,n){var r={s:["thoddea sekondamni","thodde sekond"],ss:[e+" sekondamni",e+" sekond"],m:["eka mintan","ek minut"],mm:[e+" mintamni",e+" mintam"],h:["eka voran","ek vor"],hh:[e+" voramni",e+" voram"],d:["eka disan","ek dis"],dd:[e+" disamni",e+" dis"],M:["eka mhoinean","ek mhoino"],MM:[e+" mhoineamni",e+" mhoine"],y:["eka vorsan","ek voros"],yy:[e+" vorsamni",e+" vorsam"]};return n?r[i][0]:r[i][1]}e.defineLocale("gom-latn",{months:{standalone:"Janer_Febrer_Mars_Abril_Mai_Jun_Julai_Agost_Setembr_Otubr_Novembr_Dezembr".split("_"),format:"Janerachea_Febrerachea_Marsachea_Abrilachea_Maiachea_Junachea_Julaiachea_Agostachea_Setembrachea_Otubrachea_Novembrachea_Dezembrachea".split("_"),isFormat:/MMMM(\s)+D[oD]?/},monthsShort:"Jan._Feb._Mars_Abr._Mai_Jun_Jul._Ago._Set._Otu._Nov._Dez.".split("_"),monthsParseExact:!0,weekdays:"Aitar_Somar_Mongllar_Budhvar_Birestar_Sukrar_Son'var".split("_"),weekdaysShort:"Ait._Som._Mon._Bud._Bre._Suk._Son.".split("_"),weekdaysMin:"Ai_Sm_Mo_Bu_Br_Su_Sn".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"A h:mm [vazta]",LTS:"A h:mm:ss [vazta]",L:"DD-MM-YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY A h:mm [vazta]",LLLL:"dddd, MMMM Do, YYYY, A h:mm [vazta]",llll:"ddd, D MMM YYYY, A h:mm [vazta]"},calendar:{sameDay:"[Aiz] LT",nextDay:"[Faleam] LT",nextWeek:"[Fuddlo] dddd[,] LT",lastDay:"[Kal] LT",lastWeek:"[Fattlo] dddd[,] LT",sameElse:"L"},relativeTime:{future:"%s",past:"%s adim",s:t,ss:t,m:t,mm:t,h:t,hh:t,d:t,dd:t,M:t,MM:t,y:t,yy:t},dayOfMonthOrdinalParse:/\d{1,2}(er)/,ordinal:function(e,t){return"D"===t?e+"er":e},week:{dow:0,doy:3},meridiemParse:/rati|sokallim|donparam|sanje/,meridiemHour:function(e,t){return 12===e&&(e=0),"rati"===t?e<4?e:e+12:"sokallim"===t?e:"donparam"===t?e>12?e:e+12:"sanje"===t?e+12:void 0},meridiem:function(e,t,i){return e<4?"rati":e<12?"sokallim":e<16?"donparam":e<20?"sanje":"rati"}})}(i(5093))},3386:function(e,t,i){!function(e){"use strict";e.defineLocale("ms",{months:"Januari_Februari_Mac_April_Mei_Jun_Julai_Ogos_September_Oktober_November_Disember".split("_"),monthsShort:"Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ogs_Sep_Okt_Nov_Dis".split("_"),weekdays:"Ahad_Isnin_Selasa_Rabu_Khamis_Jumaat_Sabtu".split("_"),weekdaysShort:"Ahd_Isn_Sel_Rab_Kha_Jum_Sab".split("_"),weekdaysMin:"Ah_Is_Sl_Rb_Km_Jm_Sb".split("_"),longDateFormat:{LT:"HH.mm",LTS:"HH.mm.ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY [pukul] HH.mm",LLLL:"dddd, D MMMM YYYY [pukul] HH.mm"},meridiemParse:/pagi|tengahari|petang|malam/,meridiemHour:function(e,t){return 12===e&&(e=0),"pagi"===t?e:"tengahari"===t?e>=11?e:e+12:"petang"===t||"malam"===t?e+12:void 0},meridiem:function(e,t,i){return e<11?"pagi":e<15?"tengahari":e<19?"petang":"malam"},calendar:{sameDay:"[Hari ini pukul] LT",nextDay:"[Esok pukul] LT",nextWeek:"dddd [pukul] LT",lastDay:"[Kelmarin pukul] LT",lastWeek:"dddd [lepas pukul] LT",sameElse:"L"},relativeTime:{future:"dalam %s",past:"%s yang lepas",s:"beberapa saat",ss:"%d saat",m:"seminit",mm:"%d minit",h:"sejam",hh:"%d jam",d:"sehari",dd:"%d hari",M:"sebulan",MM:"%d bulan",y:"setahun",yy:"%d tahun"},week:{dow:1,doy:7}})}(i(5093))},3411:function(t,i,n){"use strict";var r,s,o,a,l,c,h,d,u,f,p,m=n(4692);t.exports=(o=function(e,t){var i;if(e===t)return e;for(i in t)void 0!==t[i]&&(e[i]=t[i]);return e},a=function(e,t){var i,n=Array.prototype.slice.call(arguments,2),r=[],s=e.length;if(Array.prototype.map&&e.map===Array.prototype.map)r=Array.prototype.map.call(e,function(e){var i=n.slice(0);return i.splice(0,0,e),t.apply(this,i)});else for(i=0;i0&&"object"==typeof e[i][0]?e[i]=h(e[i],t):e[i]=c(e[i],t));return e},d=function(e,t){var i=e.replace(".","");return"jQuery"in this&&t?m("."+i,t)[0]:document.getElementsByClassName(i)[0]},u=function(e,t){return e=e.replace("#",""),"jQuery"in window&&t?m("#"+e,t)[0]:document.getElementById(e)},f=function(e){var t=0,i=0;if(e.getBoundingClientRect){var n=e.getBoundingClientRect(),r=-(window.scrollX?window.scrollX:window.pageXOffset),s=-(window.scrollY?window.scrollY:window.pageYOffset);return[n.left-r,n.top-s]}if(e.offsetParent)do{t+=e.offsetLeft,i+=e.offsetTop}while(e=e.offsetParent);return[t,i]},p=function(){var e=document,t=function(i){if("object"!=typeof window.google||!window.google.maps)return"object"==typeof window.console&&window.console.error&&console.error("Google Maps API is required. Please register the following JavaScript library https://maps.googleapis.com/maps/api/js."),function(){};if(!this)return new t(i);i.zoom=i.zoom||15,i.mapType=i.mapType||"roadmap";var n,r=function(e,t){return void 0===e?t:e},s=this,a=["bounds_changed","center_changed","click","dblclick","drag","dragend","dragstart","idle","maptypeid_changed","projection_changed","resize","tilesloaded","zoom_changed"],l=["mousemove","mouseout","mouseover"],c=["el","lat","lng","mapType","width","height","markerClusterer","enableNewStyle"],h=i.el||i.div,p=i.markerClusterer,m=google.maps.MapTypeId[i.mapType.toUpperCase()],g=new google.maps.LatLng(i.lat,i.lng),_=r(i.zoomControl,!0),y=i.zoomControlOpt||{style:"DEFAULT",position:"TOP_LEFT"},v=y.style||"DEFAULT",x=y.position||"TOP_LEFT",b=r(i.panControl,!0),w=r(i.mapTypeControl,!0),S=r(i.scaleControl,!0),T=r(i.streetViewControl,!0),k=r(k,!0),M={},A={zoom:this.zoom,center:g,mapTypeId:m},C={panControl:b,zoomControl:_,zoomControlOptions:{style:google.maps.ZoomControlStyle[v],position:google.maps.ControlPosition[x]},mapTypeControl:w,scaleControl:S,streetViewControl:T,overviewMapControl:k};if("string"==typeof i.el||"string"==typeof i.div?h.indexOf("#")>-1?this.el=u(h,i.context):this.el=d.apply(this,[h,i.context]):this.el=h,void 0===this.el||null===this.el)throw"No element defined.";for(window.context_menu=window.context_menu||{},window.context_menu[s.el.id]={},this.controls=[],this.overlays=[],this.layers=[],this.singleLayers={},this.markers=[],this.polylines=[],this.routes=[],this.polygons=[],this.infoWindow=null,this.overlay_el=null,this.zoom=i.zoom,this.registered_events={},this.el.style.width=i.width||this.el.scrollWidth||this.el.offsetWidth,this.el.style.height=i.height||this.el.scrollHeight||this.el.offsetHeight,google.maps.visualRefresh=i.enableNewStyle,n=0;n'+o.title+""}if(u("gmaps_context_menu")){var a=u("gmaps_context_menu");a.innerHTML=i;var l=a.getElementsByTagName("a"),c=l.length;for(r=0;r-1&&((r=this.markers[n]).setMap(null),this.markerClusterer&&this.markerClusterer.removeMarker(r),p.fire("marker_removed",r,this))}for(i=0;i0&&e.paths[0].length>0&&(e.paths=l(a(e.paths,h,t)));for(var i=new google.maps.Polygon(e),n=["click","dblclick","mousedown","mousemove","mouseout","mouseover","mouseup","rightclick"],r=0;r0&&e.locations[0].length>0&&(e.locations=l(a([e.locations],h,!1)));var t=e.callback;delete e.callback;var i=new google.maps.ElevationService;if(e.path){var n={path:e.locations,samples:e.samples};i.getElevationAlongPath(n,function(e,i){t&&"function"==typeof t&&t(e,i)})}else delete e.path,delete e.samples,i.getElevationForLocations(e,function(e,i){t&&"function"==typeof t&&t(e,i)})},p.prototype.cleanRoute=p.prototype.removePolylines,p.prototype.renderRoute=function(e,t){var i,n="string"==typeof t.panel?document.getElementById(t.panel.replace("#","")):t.panel;t.panel=n,t=o({map:this.map},t),i=new google.maps.DirectionsRenderer(t),this.getRoutes({origin:e.origin,destination:e.destination,travelMode:e.travelMode,waypoints:e.waypoints,unitSystem:e.unitSystem,error:e.error,avoidHighways:e.avoidHighways,avoidTolls:e.avoidTolls,optimizeWaypoints:e.optimizeWaypoints,callback:function(e,t,n){n===google.maps.DirectionsStatus.OK&&i.setDirections(t)}})},p.prototype.drawRoute=function(e){var t=this;this.getRoutes({origin:e.origin,destination:e.destination,travelMode:e.travelMode,waypoints:e.waypoints,unitSystem:e.unitSystem,error:e.error,avoidHighways:e.avoidHighways,avoidTolls:e.avoidTolls,optimizeWaypoints:e.optimizeWaypoints,callback:function(i){if(i.length>0){var n={path:i[i.length-1].overview_path,strokeColor:e.strokeColor,strokeOpacity:e.strokeOpacity,strokeWeight:e.strokeWeight};e.hasOwnProperty("icons")&&(n.icons=e.icons),t.drawPolyline(n),e.callback&&e.callback(i[i.length-1])}}})},p.prototype.travelRoute=function(e){if(e.origin&&e.destination)this.getRoutes({origin:e.origin,destination:e.destination,travelMode:e.travelMode,waypoints:e.waypoints,unitSystem:e.unitSystem,error:e.error,callback:function(t){if(t.length>0&&e.start&&e.start(t[t.length-1]),t.length>0&&e.step){var i=t[t.length-1];if(i.legs.length>0)for(var n,r=i.legs[0].steps,s=0;n=r[s];s++)n.step_number=s,e.step(n,i.legs[0].steps.length-1)}t.length>0&&e.end&&e.end(t[t.length-1])}});else if(e.route&&e.route.legs.length>0)for(var t,i=e.route.legs[0].steps,n=0;t=i[n];n++)t.step_number=n,e.step(t)},p.prototype.drawSteppedRoute=function(e){var t=this;if(e.origin&&e.destination)this.getRoutes({origin:e.origin,destination:e.destination,travelMode:e.travelMode,waypoints:e.waypoints,error:e.error,callback:function(i){if(i.length>0&&e.start&&e.start(i[i.length-1]),i.length>0&&e.step){var n=i[i.length-1];if(n.legs.length>0)for(var r,s=n.legs[0].steps,o=0;r=s[o];o++){r.step_number=o;var a={path:r.path,strokeColor:e.strokeColor,strokeOpacity:e.strokeOpacity,strokeWeight:e.strokeWeight};e.hasOwnProperty("icons")&&(a.icons=e.icons),t.drawPolyline(a),e.step(r,n.legs[0].steps.length-1)}}i.length>0&&e.end&&e.end(i[i.length-1])}});else if(e.route&&e.route.legs.length>0)for(var i,n=e.route.legs[0].steps,r=0;i=n[r];r++){i.step_number=r;var s={path:i.path,strokeColor:e.strokeColor,strokeOpacity:e.strokeOpacity,strokeWeight:e.strokeWeight};e.hasOwnProperty("icons")&&(s.icons=e.icons),t.drawPolyline(s),e.step(i)}},p.Route=function(e){this.origin=e.origin,this.destination=e.destination,this.waypoints=e.waypoints,this.map=e.map,this.route=e.route,this.step_count=0,this.steps=this.route.legs[0].steps,this.steps_length=this.steps.length;var t={path:new google.maps.MVCArray,strokeColor:e.strokeColor,strokeOpacity:e.strokeOpacity,strokeWeight:e.strokeWeight};e.hasOwnProperty("icons")&&(t.icons=e.icons),this.polyline=this.map.drawPolyline(t).getPath()},p.Route.prototype.getRoute=function(t){var i=this;this.map.getRoutes({origin:this.origin,destination:this.destination,travelMode:t.travelMode,waypoints:this.waypoints||[],error:t.error,callback:function(){i.route=e[0],t.callback&&t.callback.call(i)}})},p.Route.prototype.back=function(){if(this.step_count>0){this.step_count--;var e=this.route.legs[0].steps[this.step_count].path;for(var t in e)e.hasOwnProperty(t)&&this.polyline.pop()}},p.Route.prototype.forward=function(){if(this.step_count0){t.markers=[];for(var i=0;i0){var n=this.polylines[0];t.polyline={},t.polyline.path=google.maps.geometry.encoding.encodePath(n.getPath()),t.polyline.strokeColor=n.strokeColor,t.polyline.strokeOpacity=n.strokeOpacity,t.polyline.strokeWeight=n.strokeWeight}return p.staticMapURL(t)},p.staticMapURL=function(e){var t,i=[],n=("file:"===location.protocol?"http:":location.protocol)+"//maps.googleapis.com/maps/api/staticmap";e.url&&(n=e.url,delete e.url),n+="?";var r=e.markers;delete e.markers,!r&&e.marker&&(r=[e.marker],delete e.marker);var s=e.styles;delete e.styles;var o=e.polyline;if(delete e.polyline,e.center)i.push("center="+e.center),delete e.center;else if(e.address)i.push("center="+e.address),delete e.address;else if(e.lat)i.push(["center=",e.lat,",",e.lng].join("")),delete e.lat,delete e.lng;else if(e.visible){var a=encodeURI(e.visible.join("|"));i.push("visible="+a)}var l=e.size;l?(l.join&&(l=l.join("x")),delete e.size):l="630x300",i.push("size="+l),e.zoom||!1===e.zoom||(e.zoom=15);var c=!e.hasOwnProperty("sensor")||!!e.sensor;for(var h in delete e.sensor,i.push("sensor="+c),e)e.hasOwnProperty(h)&&i.push(h+"="+e[h]);if(r)for(var d,u,f=0;t=r[f];f++){for(var h in d=[],t.size&&"normal"!==t.size?(d.push("size:"+t.size),delete t.size):t.icon&&(d.push("icon:"+encodeURI(t.icon)),delete t.icon),t.color&&(d.push("color:"+t.color.replace("#","0x")),delete t.color),t.label&&(d.push("label:"+t.label[0].toUpperCase()),delete t.label),u=t.address?t.address:t.lat+","+t.lng,delete t.address,delete t.lat,delete t.lng,t)t.hasOwnProperty(h)&&d.push(h+":"+t[h]);d.length||0===f?(d.push(u),d=d.join("|"),i.push("markers="+encodeURI(d))):(d=i.pop()+encodeURI("|"+u),i.push(d))}if(s)for(f=0;f=e.lng()||h.lng()=e.lng())&&c.lat()+(e.lng()-c.lng())/(h.lng()-c.lng())*(h.lat()-c.lat())>>0;if(0===i)return-1;var n=0;if(arguments.length>1&&((n=Number(arguments[1]))!=n?n=0:0!=n&&n!=1/0&&n!=-1/0&&(n=(n>0||-1)*Math.floor(Math.abs(n)))),n>=i)return-1;for(var r=n>=0?n:Math.max(i-Math.abs(n),0);r{"use strict";if(i.d(t,{UD:()=>f,n4:()=>p}),/^(7(06|92|96)|140)$/.test(i.j))var n=i(7310);if(/^(7(06|92|96)|140)$/.test(i.j))var r=i(6979);if(/^(7(06|92|96)|140)$/.test(i.j))var s=i(3341);if(/^(7(06|92|96)|140)$/.test(i.j))var o=i(5128);if(/^(7(06|92|96)|140)$/.test(i.j))var a=i(1206);if(/^(7(06|92|96)|140)$/.test(i.j))var l=i(571);if(/^(7(06|92|96)|140)$/.test(i.j))var c=i(844);if(/^(7(06|92|96)|140)$/.test(i.j))var h=i(5581);var d={placement:"bottom",modifiers:[],strategy:"absolute"};function u(){for(var e=arguments.length,t=new Array(e),i=0;i=4||"ഉച്ച കഴിഞ്ഞ്"===t||"വൈകുന്നേരം"===t?e+12:e},meridiem:function(e,t,i){return e<4?"രാത്രി":e<12?"രാവിലെ":e<17?"ഉച്ച കഴിഞ്ഞ്":e<20?"വൈകുന്നേരം":"രാത്രി"}})}(i(5093))},3784:function(e,t,i){!function(e){"use strict";var t="jan._feb._mrt._apr._mei_jun._jul._aug._sep._okt._nov._dec.".split("_"),i="jan_feb_mrt_apr_mei_jun_jul_aug_sep_okt_nov_dec".split("_"),n=[/^jan/i,/^feb/i,/^(maart|mrt\.?)$/i,/^apr/i,/^mei$/i,/^jun[i.]?$/i,/^jul[i.]?$/i,/^aug/i,/^sep/i,/^okt/i,/^nov/i,/^dec/i],r=/^(januari|februari|maart|april|mei|ju[nl]i|augustus|september|oktober|november|december|jan\.?|feb\.?|mrt\.?|apr\.?|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i;e.defineLocale("nl-be",{months:"januari_februari_maart_april_mei_juni_juli_augustus_september_oktober_november_december".split("_"),monthsShort:function(e,n){return e?/-MMM-/.test(n)?i[e.month()]:t[e.month()]:t},monthsRegex:r,monthsShortRegex:r,monthsStrictRegex:/^(januari|februari|maart|april|mei|ju[nl]i|augustus|september|oktober|november|december)/i,monthsShortStrictRegex:/^(jan\.?|feb\.?|mrt\.?|apr\.?|mei|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i,monthsParse:n,longMonthsParse:n,shortMonthsParse:n,weekdays:"zondag_maandag_dinsdag_woensdag_donderdag_vrijdag_zaterdag".split("_"),weekdaysShort:"zo._ma._di._wo._do._vr._za.".split("_"),weekdaysMin:"zo_ma_di_wo_do_vr_za".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[vandaag om] LT",nextDay:"[morgen om] LT",nextWeek:"dddd [om] LT",lastDay:"[gisteren om] LT",lastWeek:"[afgelopen] dddd [om] LT",sameElse:"L"},relativeTime:{future:"over %s",past:"%s geleden",s:"een paar seconden",ss:"%d seconden",m:"één minuut",mm:"%d minuten",h:"één uur",hh:"%d uur",d:"één dag",dd:"%d dagen",M:"één maand",MM:"%d maanden",y:"één jaar",yy:"%d jaar"},dayOfMonthOrdinalParse:/\d{1,2}(ste|de)/,ordinal:function(e){return e+(1===e||8===e||e>=20?"ste":"de")},week:{dow:1,doy:4}})}(i(5093))},3827:function(e,t,i){!function(e){"use strict";e.defineLocale("ja",{eras:[{since:"2019-05-01",offset:1,name:"令和",narrow:"㋿",abbr:"R"},{since:"1989-01-08",until:"2019-04-30",offset:1,name:"平成",narrow:"㍻",abbr:"H"},{since:"1926-12-25",until:"1989-01-07",offset:1,name:"昭和",narrow:"㍼",abbr:"S"},{since:"1912-07-30",until:"1926-12-24",offset:1,name:"大正",narrow:"㍽",abbr:"T"},{since:"1873-01-01",until:"1912-07-29",offset:6,name:"明治",narrow:"㍾",abbr:"M"},{since:"0001-01-01",until:"1873-12-31",offset:1,name:"西暦",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"紀元前",narrow:"BC",abbr:"BC"}],eraYearOrdinalRegex:/(元|\d+)年/,eraYearOrdinalParse:function(e,t){return"元"===t[1]?1:parseInt(t[1]||e,10)},months:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),weekdays:"日曜日_月曜日_火曜日_水曜日_木曜日_金曜日_土曜日".split("_"),weekdaysShort:"日_月_火_水_木_金_土".split("_"),weekdaysMin:"日_月_火_水_木_金_土".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日 HH:mm",LLLL:"YYYY年M月D日 dddd HH:mm",l:"YYYY/MM/DD",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日(ddd) HH:mm"},meridiemParse:/午前|午後/i,isPM:function(e){return"午後"===e},meridiem:function(e,t,i){return e<12?"午前":"午後"},calendar:{sameDay:"[今日] LT",nextDay:"[明日] LT",nextWeek:function(e){return e.week()!==this.week()?"[来週]dddd LT":"dddd LT"},lastDay:"[昨日] LT",lastWeek:function(e){return this.week()!==e.week()?"[先週]dddd LT":"dddd LT"},sameElse:"L"},dayOfMonthOrdinalParse:/\d{1,2}日/,ordinal:function(e,t){switch(t){case"y":return 1===e?"元年":e+"年";case"d":case"D":case"DDD":return e+"日";default:return e}},relativeTime:{future:"%s後",past:"%s前",s:"数秒",ss:"%d秒",m:"1分",mm:"%d分",h:"1時間",hh:"%d時間",d:"1日",dd:"%d日",M:"1ヶ月",MM:"%dヶ月",y:"1年",yy:"%d年"}})}(i(5093))},3861:function(e,t,i){!function(e){"use strict";var t={1:"१",2:"२",3:"३",4:"४",5:"५",6:"६",7:"७",8:"८",9:"९",0:"०"},i={"१":"1","२":"2","३":"3","४":"4","५":"5","६":"6","७":"7","८":"8","९":"9","०":"0"},n=[/^जन/i,/^फ़र|फर/i,/^मार्च/i,/^अप्रै/i,/^मई/i,/^जून/i,/^जुल/i,/^अग/i,/^सितं|सित/i,/^अक्टू/i,/^नव|नवं/i,/^दिसं|दिस/i];e.defineLocale("hi",{months:{format:"जनवरी_फ़रवरी_मार्च_अप्रैल_मई_जून_जुलाई_अगस्त_सितम्बर_अक्टूबर_नवम्बर_दिसम्बर".split("_"),standalone:"जनवरी_फरवरी_मार्च_अप्रैल_मई_जून_जुलाई_अगस्त_सितंबर_अक्टूबर_नवंबर_दिसंबर".split("_")},monthsShort:"जन._फ़र._मार्च_अप्रै._मई_जून_जुल._अग._सित._अक्टू._नव._दिस.".split("_"),weekdays:"रविवार_सोमवार_मंगलवार_बुधवार_गुरूवार_शुक्रवार_शनिवार".split("_"),weekdaysShort:"रवि_सोम_मंगल_बुध_गुरू_शुक्र_शनि".split("_"),weekdaysMin:"र_सो_मं_बु_गु_शु_श".split("_"),longDateFormat:{LT:"A h:mm बजे",LTS:"A h:mm:ss बजे",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm बजे",LLLL:"dddd, D MMMM YYYY, A h:mm बजे"},monthsParse:n,longMonthsParse:n,shortMonthsParse:[/^जन/i,/^फ़र/i,/^मार्च/i,/^अप्रै/i,/^मई/i,/^जून/i,/^जुल/i,/^अग/i,/^सित/i,/^अक्टू/i,/^नव/i,/^दिस/i],monthsRegex:/^(जनवरी|जन\.?|फ़रवरी|फरवरी|फ़र\.?|मार्च?|अप्रैल|अप्रै\.?|मई?|जून?|जुलाई|जुल\.?|अगस्त|अग\.?|सितम्बर|सितंबर|सित\.?|अक्टूबर|अक्टू\.?|नवम्बर|नवंबर|नव\.?|दिसम्बर|दिसंबर|दिस\.?)/i,monthsShortRegex:/^(जनवरी|जन\.?|फ़रवरी|फरवरी|फ़र\.?|मार्च?|अप्रैल|अप्रै\.?|मई?|जून?|जुलाई|जुल\.?|अगस्त|अग\.?|सितम्बर|सितंबर|सित\.?|अक्टूबर|अक्टू\.?|नवम्बर|नवंबर|नव\.?|दिसम्बर|दिसंबर|दिस\.?)/i,monthsStrictRegex:/^(जनवरी?|फ़रवरी|फरवरी?|मार्च?|अप्रैल?|मई?|जून?|जुलाई?|अगस्त?|सितम्बर|सितंबर|सित?\.?|अक्टूबर|अक्टू\.?|नवम्बर|नवंबर?|दिसम्बर|दिसंबर?)/i,monthsShortStrictRegex:/^(जन\.?|फ़र\.?|मार्च?|अप्रै\.?|मई?|जून?|जुल\.?|अग\.?|सित\.?|अक्टू\.?|नव\.?|दिस\.?)/i,calendar:{sameDay:"[आज] LT",nextDay:"[कल] LT",nextWeek:"dddd, LT",lastDay:"[कल] LT",lastWeek:"[पिछले] dddd, LT",sameElse:"L"},relativeTime:{future:"%s में",past:"%s पहले",s:"कुछ ही क्षण",ss:"%d सेकंड",m:"एक मिनट",mm:"%d मिनट",h:"एक घंटा",hh:"%d घंटे",d:"एक दिन",dd:"%d दिन",M:"एक महीने",MM:"%d महीने",y:"एक वर्ष",yy:"%d वर्ष"},preparse:function(e){return e.replace(/[१२३४५६७८९०]/g,function(e){return i[e]})},postformat:function(e){return e.replace(/\d/g,function(e){return t[e]})},meridiemParse:/रात|सुबह|दोपहर|शाम/,meridiemHour:function(e,t){return 12===e&&(e=0),"रात"===t?e<4?e:e+12:"सुबह"===t?e:"दोपहर"===t?e>=10?e:e+12:"शाम"===t?e+12:void 0},meridiem:function(e,t,i){return e<4?"रात":e<10?"सुबह":e<17?"दोपहर":e<20?"शाम":"रात"},week:{dow:0,doy:6}})}(i(5093))},3872:function(e,t,i){!function(e){"use strict";e.defineLocale("en-au",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY h:mm A",LLLL:"dddd, D MMMM YYYY h:mm A"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},dayOfMonthOrdinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(e){var t=e%10;return e+(1==~~(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th")},week:{dow:0,doy:4}})}(i(5093))},4051:function(e,t,i){!function(e){"use strict";e.defineLocale("x-pseudo",{months:"J~áñúá~rý_F~ébrú~árý_~Márc~h_Áp~ríl_~Máý_~Júñé~_Júl~ý_Áú~gúst~_Sép~témb~ér_Ó~ctób~ér_Ñ~óvém~bér_~Décé~mbér".split("_"),monthsShort:"J~áñ_~Féb_~Már_~Ápr_~Máý_~Júñ_~Júl_~Áúg_~Sép_~Óct_~Ñóv_~Déc".split("_"),monthsParseExact:!0,weekdays:"S~úñdá~ý_Mó~ñdáý~_Túé~sdáý~_Wéd~ñésd~áý_T~húrs~dáý_~Fríd~áý_S~átúr~dáý".split("_"),weekdaysShort:"S~úñ_~Móñ_~Túé_~Wéd_~Thú_~Frí_~Sát".split("_"),weekdaysMin:"S~ú_Mó~_Tú_~Wé_T~h_Fr~_Sá".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[T~ódá~ý át] LT",nextDay:"[T~ómó~rró~w át] LT",nextWeek:"dddd [át] LT",lastDay:"[Ý~ést~érdá~ý át] LT",lastWeek:"[L~ást] dddd [át] LT",sameElse:"L"},relativeTime:{future:"í~ñ %s",past:"%s á~gó",s:"á ~féw ~sécó~ñds",ss:"%d s~écóñ~ds",m:"á ~míñ~úté",mm:"%d m~íñú~tés",h:"á~ñ hó~úr",hh:"%d h~óúrs",d:"á ~dáý",dd:"%d d~áýs",M:"á ~móñ~th",MM:"%d m~óñt~hs",y:"á ~ýéár",yy:"%d ý~éárs"},dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10;return e+(1==~~(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th")},week:{dow:1,doy:4}})}(i(5093))},4063:function(e,t,i){!function(e){"use strict";e.defineLocale("id",{months:"Januari_Februari_Maret_April_Mei_Juni_Juli_Agustus_September_Oktober_November_Desember".split("_"),monthsShort:"Jan_Feb_Mar_Apr_Mei_Jun_Jul_Agt_Sep_Okt_Nov_Des".split("_"),weekdays:"Minggu_Senin_Selasa_Rabu_Kamis_Jumat_Sabtu".split("_"),weekdaysShort:"Min_Sen_Sel_Rab_Kam_Jum_Sab".split("_"),weekdaysMin:"Mg_Sn_Sl_Rb_Km_Jm_Sb".split("_"),longDateFormat:{LT:"HH.mm",LTS:"HH.mm.ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY [pukul] HH.mm",LLLL:"dddd, D MMMM YYYY [pukul] HH.mm"},meridiemParse:/pagi|siang|sore|malam/,meridiemHour:function(e,t){return 12===e&&(e=0),"pagi"===t?e:"siang"===t?e>=11?e:e+12:"sore"===t||"malam"===t?e+12:void 0},meridiem:function(e,t,i){return e<11?"pagi":e<15?"siang":e<19?"sore":"malam"},calendar:{sameDay:"[Hari ini pukul] LT",nextDay:"[Besok pukul] LT",nextWeek:"dddd [pukul] LT",lastDay:"[Kemarin pukul] LT",lastWeek:"dddd [lalu pukul] LT",sameElse:"L"},relativeTime:{future:"dalam %s",past:"%s yang lalu",s:"beberapa detik",ss:"%d detik",m:"semenit",mm:"%d menit",h:"sejam",hh:"%d jam",d:"sehari",dd:"%d hari",M:"sebulan",MM:"%d bulan",y:"setahun",yy:"%d tahun"},week:{dow:0,doy:6}})}(i(5093))},4226:function(e,t,i){!function(e){"use strict";e.defineLocale("cy",{months:"Ionawr_Chwefror_Mawrth_Ebrill_Mai_Mehefin_Gorffennaf_Awst_Medi_Hydref_Tachwedd_Rhagfyr".split("_"),monthsShort:"Ion_Chwe_Maw_Ebr_Mai_Meh_Gor_Aws_Med_Hyd_Tach_Rhag".split("_"),weekdays:"Dydd Sul_Dydd Llun_Dydd Mawrth_Dydd Mercher_Dydd Iau_Dydd Gwener_Dydd Sadwrn".split("_"),weekdaysShort:"Sul_Llun_Maw_Mer_Iau_Gwe_Sad".split("_"),weekdaysMin:"Su_Ll_Ma_Me_Ia_Gw_Sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Heddiw am] LT",nextDay:"[Yfory am] LT",nextWeek:"dddd [am] LT",lastDay:"[Ddoe am] LT",lastWeek:"dddd [diwethaf am] LT",sameElse:"L"},relativeTime:{future:"mewn %s",past:"%s yn ôl",s:"ychydig eiliadau",ss:"%d eiliad",m:"munud",mm:"%d munud",h:"awr",hh:"%d awr",d:"diwrnod",dd:"%d diwrnod",M:"mis",MM:"%d mis",y:"blwyddyn",yy:"%d flynedd"},dayOfMonthOrdinalParse:/\d{1,2}(fed|ain|af|il|ydd|ed|eg)/,ordinal:function(e){var t="";return e>20?t=40===e||50===e||60===e||80===e||100===e?"fed":"ain":e>0&&(t=["","af","il","ydd","ydd","ed","ed","ed","fed","fed","fed","eg","fed","eg","eg","fed","eg","eg","fed","eg","fed"][e]),e+t},week:{dow:1,doy:4}})}(i(5093))},4278:(e,t,i)=>{"use strict";i.d(t,{DD:()=>g,EP:()=>w,GM:()=>M,LF:()=>y,LG:()=>x,M9:()=>T,Mn:()=>n,OM:()=>l,Ol:()=>m,R9:()=>u,SE:()=>k,WY:()=>d,_N:()=>h,ci:()=>_,iW:()=>b,ir:()=>p,kb:()=>o,ni:()=>c,pA:()=>S,pG:()=>s,qZ:()=>a,sQ:()=>r,v5:()=>v,xf:()=>f});var n="top",r="bottom",s="right",o="left",a="auto",l=[n,r,s,o],c="start",h="end",d="clippingParents",u="viewport",f="popper",p="reference",m=/^(7(06|92|96)|140)$/.test(i.j)?l.reduce(function(e,t){return e.concat([t+"-"+c,t+"-"+h])},[]):null,g=/^(7(06|92|96)|140)$/.test(i.j)?[].concat(l,[a]).reduce(function(e,t){return e.concat([t,t+"-"+c,t+"-"+h])},[]):null,_="beforeRead",y="read",v="afterRead",x="beforeMain",b="main",w="afterMain",S="beforeWrite",T="write",k="afterWrite",M=[_,y,v,x,b,w,S,T,k]},4318:(e,t,i)=>{"use strict";if(i.d(t,{A:()=>r}),/^(7(06|92|96)|140)$/.test(i.j))var n=i(7364);function r(e){return Object.assign({},(0,n.A)(),e)}},4418:function(e,t,i){!function(e){"use strict";var t="styczeń_luty_marzec_kwiecień_maj_czerwiec_lipiec_sierpień_wrzesień_październik_listopad_grudzień".split("_"),i="stycznia_lutego_marca_kwietnia_maja_czerwca_lipca_sierpnia_września_października_listopada_grudnia".split("_"),n=[/^sty/i,/^lut/i,/^mar/i,/^kwi/i,/^maj/i,/^cze/i,/^lip/i,/^sie/i,/^wrz/i,/^paź/i,/^lis/i,/^gru/i];function r(e){return e%10<5&&e%10>1&&~~(e/10)%10!=1}function s(e,t,i){var n=e+" ";switch(i){case"ss":return n+(r(e)?"sekundy":"sekund");case"m":return t?"minuta":"minutę";case"mm":return n+(r(e)?"minuty":"minut");case"h":return t?"godzina":"godzinę";case"hh":return n+(r(e)?"godziny":"godzin");case"ww":return n+(r(e)?"tygodnie":"tygodni");case"MM":return n+(r(e)?"miesiące":"miesięcy");case"yy":return n+(r(e)?"lata":"lat")}}e.defineLocale("pl",{months:function(e,n){return e?/D MMMM/.test(n)?i[e.month()]:t[e.month()]:t},monthsShort:"sty_lut_mar_kwi_maj_cze_lip_sie_wrz_paź_lis_gru".split("_"),monthsParse:n,longMonthsParse:n,shortMonthsParse:n,weekdays:"niedziela_poniedziałek_wtorek_środa_czwartek_piątek_sobota".split("_"),weekdaysShort:"ndz_pon_wt_śr_czw_pt_sob".split("_"),weekdaysMin:"Nd_Pn_Wt_Śr_Cz_Pt_So".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Dziś o] LT",nextDay:"[Jutro o] LT",nextWeek:function(){switch(this.day()){case 0:return"[W niedzielę o] LT";case 2:return"[We wtorek o] LT";case 3:return"[W środę o] LT";case 6:return"[W sobotę o] LT";default:return"[W] dddd [o] LT"}},lastDay:"[Wczoraj o] LT",lastWeek:function(){switch(this.day()){case 0:return"[W zeszłą niedzielę o] LT";case 3:return"[W zeszłą środę o] LT";case 6:return"[W zeszłą sobotę o] LT";default:return"[W zeszły] dddd [o] LT"}},sameElse:"L"},relativeTime:{future:"za %s",past:"%s temu",s:"kilka sekund",ss:s,m:s,mm:s,h:s,hh:s,d:"1 dzień",dd:"%d dni",w:"tydzień",ww:s,M:"miesiąc",MM:s,y:"rok",yy:s},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(i(5093))},4426:(e,t,i)=>{"use strict";function n(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}i.d(t,{A:()=>n})},4429:function(e,t,i){!function(e){"use strict";function t(e,t,i){var n=e+" ";switch(i){case"ss":return n+(1===e?"sekunda":2===e||3===e||4===e?"sekunde":"sekundi");case"mm":return n+(1===e?"minuta":2===e||3===e||4===e?"minute":"minuta");case"h":return"jedan sat";case"hh":return n+(1===e?"sat":2===e||3===e||4===e?"sata":"sati");case"dd":return n+(1===e?"dan":"dana");case"MM":return n+(1===e?"mjesec":2===e||3===e||4===e?"mjeseca":"mjeseci");case"yy":return n+(1===e?"godina":2===e||3===e||4===e?"godine":"godina")}}e.defineLocale("bs",{months:"januar_februar_mart_april_maj_juni_juli_august_septembar_oktobar_novembar_decembar".split("_"),monthsShort:"jan._feb._mar._apr._maj._jun._jul._aug._sep._okt._nov._dec.".split("_"),monthsParseExact:!0,weekdays:"nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota".split("_"),weekdaysShort:"ned._pon._uto._sri._čet._pet._sub.".split("_"),weekdaysMin:"ne_po_ut_sr_če_pe_su".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm",LLLL:"dddd, D. MMMM YYYY H:mm"},calendar:{sameDay:"[danas u] LT",nextDay:"[sutra u] LT",nextWeek:function(){switch(this.day()){case 0:return"[u] [nedjelju] [u] LT";case 3:return"[u] [srijedu] [u] LT";case 6:return"[u] [subotu] [u] LT";case 1:case 2:case 4:case 5:return"[u] dddd [u] LT"}},lastDay:"[jučer u] LT",lastWeek:function(){switch(this.day()){case 0:case 3:return"[prošlu] dddd [u] LT";case 6:return"[prošle] [subote] [u] LT";case 1:case 2:case 4:case 5:return"[prošli] dddd [u] LT"}},sameElse:"L"},relativeTime:{future:"za %s",past:"prije %s",s:"par sekundi",ss:t,m:function(e,t,i,n){if("m"===i)return t?"jedna minuta":n?"jednu minutu":"jedne minute"},mm:t,h:t,hh:t,d:"dan",dd:t,M:"mjesec",MM:t,y:"godinu",yy:t},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}})}(i(5093))},4451:function(e,t,i){!function(e){"use strict";var t={1:"೧",2:"೨",3:"೩",4:"೪",5:"೫",6:"೬",7:"೭",8:"೮",9:"೯",0:"೦"},i={"೧":"1","೨":"2","೩":"3","೪":"4","೫":"5","೬":"6","೭":"7","೮":"8","೯":"9","೦":"0"};e.defineLocale("kn",{months:"ಜನವರಿ_ಫೆಬ್ರವರಿ_ಮಾರ್ಚ್_ಏಪ್ರಿಲ್_ಮೇ_ಜೂನ್_ಜುಲೈ_ಆಗಸ್ಟ್_ಸೆಪ್ಟೆಂಬರ್_ಅಕ್ಟೋಬರ್_ನವೆಂಬರ್_ಡಿಸೆಂಬರ್".split("_"),monthsShort:"ಜನ_ಫೆಬ್ರ_ಮಾರ್ಚ್_ಏಪ್ರಿಲ್_ಮೇ_ಜೂನ್_ಜುಲೈ_ಆಗಸ್ಟ್_ಸೆಪ್ಟೆಂ_ಅಕ್ಟೋ_ನವೆಂ_ಡಿಸೆಂ".split("_"),monthsParseExact:!0,weekdays:"ಭಾನುವಾರ_ಸೋಮವಾರ_ಮಂಗಳವಾರ_ಬುಧವಾರ_ಗುರುವಾರ_ಶುಕ್ರವಾರ_ಶನಿವಾರ".split("_"),weekdaysShort:"ಭಾನು_ಸೋಮ_ಮಂಗಳ_ಬುಧ_ಗುರು_ಶುಕ್ರ_ಶನಿ".split("_"),weekdaysMin:"ಭಾ_ಸೋ_ಮಂ_ಬು_ಗು_ಶು_ಶ".split("_"),longDateFormat:{LT:"A h:mm",LTS:"A h:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm",LLLL:"dddd, D MMMM YYYY, A h:mm"},calendar:{sameDay:"[ಇಂದು] LT",nextDay:"[ನಾಳೆ] LT",nextWeek:"dddd, LT",lastDay:"[ನಿನ್ನೆ] LT",lastWeek:"[ಕೊನೆಯ] dddd, LT",sameElse:"L"},relativeTime:{future:"%s ನಂತರ",past:"%s ಹಿಂದೆ",s:"ಕೆಲವು ಕ್ಷಣಗಳು",ss:"%d ಸೆಕೆಂಡುಗಳು",m:"ಒಂದು ನಿಮಿಷ",mm:"%d ನಿಮಿಷ",h:"ಒಂದು ಗಂಟೆ",hh:"%d ಗಂಟೆ",d:"ಒಂದು ದಿನ",dd:"%d ದಿನ",M:"ಒಂದು ತಿಂಗಳು",MM:"%d ತಿಂಗಳು",y:"ಒಂದು ವರ್ಷ",yy:"%d ವರ್ಷ"},preparse:function(e){return e.replace(/[೧೨೩೪೫೬೭೮೯೦]/g,function(e){return i[e]})},postformat:function(e){return e.replace(/\d/g,function(e){return t[e]})},meridiemParse:/ರಾತ್ರಿ|ಬೆಳಿಗ್ಗೆ|ಮಧ್ಯಾಹ್ನ|ಸಂಜೆ/,meridiemHour:function(e,t){return 12===e&&(e=0),"ರಾತ್ರಿ"===t?e<4?e:e+12:"ಬೆಳಿಗ್ಗೆ"===t?e:"ಮಧ್ಯಾಹ್ನ"===t?e>=10?e:e+12:"ಸಂಜೆ"===t?e+12:void 0},meridiem:function(e,t,i){return e<4?"ರಾತ್ರಿ":e<10?"ಬೆಳಿಗ್ಗೆ":e<17?"ಮಧ್ಯಾಹ್ನ":e<20?"ಸಂಜೆ":"ರಾತ್ರಿ"},dayOfMonthOrdinalParse:/\d{1,2}(ನೇ)/,ordinal:function(e){return e+"ನೇ"},week:{dow:0,doy:6}})}(i(5093))},4457:function(e,t,i){!function(e){"use strict";function t(e,t,i){var n=" ";return(e%100>=20||e>=100&&e%100==0)&&(n=" de "),e+n+{ss:"secunde",mm:"minute",hh:"ore",dd:"zile",ww:"săptămâni",MM:"luni",yy:"ani"}[i]}e.defineLocale("ro",{months:"ianuarie_februarie_martie_aprilie_mai_iunie_iulie_august_septembrie_octombrie_noiembrie_decembrie".split("_"),monthsShort:"ian._feb._mart._apr._mai_iun._iul._aug._sept._oct._nov._dec.".split("_"),monthsParseExact:!0,weekdays:"duminică_luni_marți_miercuri_joi_vineri_sâmbătă".split("_"),weekdaysShort:"Dum_Lun_Mar_Mie_Joi_Vin_Sâm".split("_"),weekdaysMin:"Du_Lu_Ma_Mi_Jo_Vi_Sâ".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY H:mm",LLLL:"dddd, D MMMM YYYY H:mm"},calendar:{sameDay:"[azi la] LT",nextDay:"[mâine la] LT",nextWeek:"dddd [la] LT",lastDay:"[ieri la] LT",lastWeek:"[fosta] dddd [la] LT",sameElse:"L"},relativeTime:{future:"peste %s",past:"%s în urmă",s:"câteva secunde",ss:t,m:"un minut",mm:t,h:"o oră",hh:t,d:"o zi",dd:t,w:"o săptămână",ww:t,M:"o lună",MM:t,y:"un an",yy:t},week:{dow:1,doy:7}})}(i(5093))},4496:function(e,t,i){!function(e){"use strict";e.defineLocale("ar-ma",{months:"يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر".split("_"),monthsShort:"يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر".split("_"),weekdays:"الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),weekdaysShort:"احد_اثنين_ثلاثاء_اربعاء_خميس_جمعة_سبت".split("_"),weekdaysMin:"ح_ن_ث_ر_خ_ج_س".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[اليوم على الساعة] LT",nextDay:"[غدا على الساعة] LT",nextWeek:"dddd [على الساعة] LT",lastDay:"[أمس على الساعة] LT",lastWeek:"dddd [على الساعة] LT",sameElse:"L"},relativeTime:{future:"في %s",past:"منذ %s",s:"ثوان",ss:"%d ثانية",m:"دقيقة",mm:"%d دقائق",h:"ساعة",hh:"%d ساعات",d:"يوم",dd:"%d أيام",M:"شهر",MM:"%d أشهر",y:"سنة",yy:"%d سنوات"},week:{dow:1,doy:4}})}(i(5093))},4566:function(e,t,i){!function(e){"use strict";e.defineLocale("nn",{months:"januar_februar_mars_april_mai_juni_juli_august_september_oktober_november_desember".split("_"),monthsShort:"jan._feb._mars_apr._mai_juni_juli_aug._sep._okt._nov._des.".split("_"),monthsParseExact:!0,weekdays:"sundag_måndag_tysdag_onsdag_torsdag_fredag_laurdag".split("_"),weekdaysShort:"su._må._ty._on._to._fr._lau.".split("_"),weekdaysMin:"su_må_ty_on_to_fr_la".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY [kl.] H:mm",LLLL:"dddd D. MMMM YYYY [kl.] HH:mm"},calendar:{sameDay:"[I dag klokka] LT",nextDay:"[I morgon klokka] LT",nextWeek:"dddd [klokka] LT",lastDay:"[I går klokka] LT",lastWeek:"[Føregåande] dddd [klokka] LT",sameElse:"L"},relativeTime:{future:"om %s",past:"%s sidan",s:"nokre sekund",ss:"%d sekund",m:"eit minutt",mm:"%d minutt",h:"ein time",hh:"%d timar",d:"ein dag",dd:"%d dagar",w:"ei veke",ww:"%d veker",M:"ein månad",MM:"%d månader",y:"eit år",yy:"%d år"},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(i(5093))},4691:function(e,t,i){!function(e){"use strict";e.defineLocale("el",{monthsNominativeEl:"Ιανουάριος_Φεβρουάριος_Μάρτιος_Απρίλιος_Μάιος_Ιούνιος_Ιούλιος_Αύγουστος_Σεπτέμβριος_Οκτώβριος_Νοέμβριος_Δεκέμβριος".split("_"),monthsGenitiveEl:"Ιανουαρίου_Φεβρουαρίου_Μαρτίου_Απριλίου_Μαΐου_Ιουνίου_Ιουλίου_Αυγούστου_Σεπτεμβρίου_Οκτωβρίου_Νοεμβρίου_Δεκεμβρίου".split("_"),months:function(e,t){return e?"string"==typeof t&&/D/.test(t.substring(0,t.indexOf("MMMM")))?this._monthsGenitiveEl[e.month()]:this._monthsNominativeEl[e.month()]:this._monthsNominativeEl},monthsShort:"Ιαν_Φεβ_Μαρ_Απρ_Μαϊ_Ιουν_Ιουλ_Αυγ_Σεπ_Οκτ_Νοε_Δεκ".split("_"),weekdays:"Κυριακή_Δευτέρα_Τρίτη_Τετάρτη_Πέμπτη_Παρασκευή_Σάββατο".split("_"),weekdaysShort:"Κυρ_Δευ_Τρι_Τετ_Πεμ_Παρ_Σαβ".split("_"),weekdaysMin:"Κυ_Δε_Τρ_Τε_Πε_Πα_Σα".split("_"),meridiem:function(e,t,i){return e>11?i?"μμ":"ΜΜ":i?"πμ":"ΠΜ"},isPM:function(e){return"μ"===(e+"").toLowerCase()[0]},meridiemParse:/[ΠΜ]\.?Μ?\.?/i,longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY h:mm A",LLLL:"dddd, D MMMM YYYY h:mm A"},calendarEl:{sameDay:"[Σήμερα {}] LT",nextDay:"[Αύριο {}] LT",nextWeek:"dddd [{}] LT",lastDay:"[Χθες {}] LT",lastWeek:function(){return 6===this.day()?"[το προηγούμενο] dddd [{}] LT":"[την προηγούμενη] dddd [{}] LT"},sameElse:"L"},calendar:function(e,t){var i,n=this._calendarEl[e],r=t&&t.hours();return i=n,("undefined"!=typeof Function&&i instanceof Function||"[object Function]"===Object.prototype.toString.call(i))&&(n=n.apply(t)),n.replace("{}",r%12==1?"στη":"στις")},relativeTime:{future:"σε %s",past:"%s πριν",s:"λίγα δευτερόλεπτα",ss:"%d δευτερόλεπτα",m:"ένα λεπτό",mm:"%d λεπτά",h:"μία ώρα",hh:"%d ώρες",d:"μία μέρα",dd:"%d μέρες",M:"ένας μήνας",MM:"%d μήνες",y:"ένας χρόνος",yy:"%d χρόνια"},dayOfMonthOrdinalParse:/\d{1,2}η/,ordinal:"%dη",week:{dow:1,doy:4}})}(i(5093))},4692:function(e,t){var i;!function(t,i){"use strict";"object"==typeof e.exports?e.exports=t.document?i(t,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return i(e)}:i(t)}("undefined"!=typeof window?window:this,function(n,r){"use strict";var s=[],o=Object.getPrototypeOf,a=s.slice,l=s.flat?function(e){return s.flat.call(e)}:function(e){return s.concat.apply([],e)},c=s.push,h=s.indexOf,d={},u=d.toString,f=d.hasOwnProperty,p=f.toString,m=p.call(Object),g={},_=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType&&"function"!=typeof e.item},y=function(e){return null!=e&&e===e.window},v=n.document,x={type:!0,src:!0,nonce:!0,noModule:!0};function b(e,t,i){var n,r,s=(i=i||v).createElement("script");if(s.text=e,t)for(n in x)(r=t[n]||t.getAttribute&&t.getAttribute(n))&&s.setAttribute(n,r);i.head.appendChild(s).parentNode.removeChild(s)}function w(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?d[u.call(e)]||"object":typeof e}var S="3.7.1",T=/HTML$/i,k=function(e,t){return new k.fn.init(e,t)};function M(e){var t=!!e&&"length"in e&&e.length,i=w(e);return!_(e)&&!y(e)&&("array"===i||0===t||"number"==typeof t&&t>0&&t-1 in e)}function A(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()}k.fn=k.prototype={jquery:S,constructor:k,length:0,toArray:function(){return a.call(this)},get:function(e){return null==e?a.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var t=k.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return k.each(this,e)},map:function(e){return this.pushStack(k.map(this,function(t,i){return e.call(t,i,t)}))},slice:function(){return this.pushStack(a.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},even:function(){return this.pushStack(k.grep(this,function(e,t){return(t+1)%2}))},odd:function(){return this.pushStack(k.grep(this,function(e,t){return t%2}))},eq:function(e){var t=this.length,i=+e+(e<0?t:0);return this.pushStack(i>=0&&i+~]|"+E+")"+E+"*"),H=new RegExp(E+"|>"),j=new RegExp(F),V=new RegExp("^"+P+"$"),W={ID:new RegExp("^#("+P+")"),CLASS:new RegExp("^\\.("+P+")"),TAG:new RegExp("^("+P+"|[*])"),ATTR:new RegExp("^"+R),PSEUDO:new RegExp("^"+F),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+E+"*(even|odd|(([+-]|)(\\d*)n|)"+E+"*(?:([+-]|)"+E+"*(\\d+)|))"+E+"*\\)|)","i"),bool:new RegExp("^(?:"+M+")$","i"),needsContext:new RegExp("^"+E+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+E+"*((?:-\\d)?\\d*)"+E+"*\\)|)(?=[^-]|$)","i")},U=/^(?:input|select|textarea|button)$/i,$=/^h\d$/i,G=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,X=/[+~]/,q=new RegExp("\\\\[\\da-fA-F]{1,6}"+E+"?|\\\\([^\\r\\n\\f])","g"),Z=function(e,t){var i="0x"+e.slice(1)-65536;return t||(i<0?String.fromCharCode(i+65536):String.fromCharCode(i>>10|55296,1023&i|56320))},J=function(){le()},K=ue(function(e){return!0===e.disabled&&A(e,"fieldset")},{dir:"parentNode",next:"legend"});try{m.apply(s=a.call(O.childNodes),O.childNodes),s[O.childNodes.length].nodeType}catch(e){m={apply:function(e,t){z.apply(e,a.call(t))},call:function(e){z.apply(e,a.call(arguments,1))}}}function Q(e,t,i,n){var r,s,o,a,c,h,f,p=t&&t.ownerDocument,y=t?t.nodeType:9;if(i=i||[],"string"!=typeof e||!e||1!==y&&9!==y&&11!==y)return i;if(!n&&(le(t),t=t||l,d)){if(11!==y&&(c=G.exec(e)))if(r=c[1]){if(9===y){if(!(o=t.getElementById(r)))return i;if(o.id===r)return m.call(i,o),i}else if(p&&(o=p.getElementById(r))&&Q.contains(t,o)&&o.id===r)return m.call(i,o),i}else{if(c[2])return m.apply(i,t.getElementsByTagName(e)),i;if((r=c[3])&&t.getElementsByClassName)return m.apply(i,t.getElementsByClassName(r)),i}if(!(S[e+" "]||u&&u.test(e))){if(f=e,p=t,1===y&&(H.test(e)||B.test(e))){for((p=X.test(e)&&ae(t.parentNode)||t)==t&&g.scope||((a=t.getAttribute("id"))?a=k.escapeSelector(a):t.setAttribute("id",a=_)),s=(h=he(e)).length;s--;)h[s]=(a?"#"+a:":scope")+" "+de(h[s]);f=h.join(",")}try{return m.apply(i,p.querySelectorAll(f)),i}catch(t){S(e,!0)}finally{a===_&&t.removeAttribute("id")}}}return ye(e.replace(I,"$1"),t,i,n)}function ee(){var e=[];return function i(n,r){return e.push(n+" ")>t.cacheLength&&delete i[e.shift()],i[n+" "]=r}}function te(e){return e[_]=!0,e}function ie(e){var t=l.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function ne(e){return function(t){return A(t,"input")&&t.type===e}}function re(e){return function(t){return(A(t,"input")||A(t,"button"))&&t.type===e}}function se(e){return function(t){return"form"in t?t.parentNode&&!1===t.disabled?"label"in t?"label"in t.parentNode?t.parentNode.disabled===e:t.disabled===e:t.isDisabled===e||t.isDisabled!==!e&&K(t)===e:t.disabled===e:"label"in t&&t.disabled===e}}function oe(e){return te(function(t){return t=+t,te(function(i,n){for(var r,s=e([],i.length,t),o=s.length;o--;)i[r=s[o]]&&(i[r]=!(n[r]=i[r]))})})}function ae(e){return e&&void 0!==e.getElementsByTagName&&e}function le(e){var i,n=e?e.ownerDocument||e:O;return n!=l&&9===n.nodeType&&n.documentElement?(c=(l=n).documentElement,d=!k.isXMLDoc(l),p=c.matches||c.webkitMatchesSelector||c.msMatchesSelector,c.msMatchesSelector&&O!=l&&(i=l.defaultView)&&i.top!==i&&i.addEventListener("unload",J),g.getById=ie(function(e){return c.appendChild(e).id=k.expando,!l.getElementsByName||!l.getElementsByName(k.expando).length}),g.disconnectedMatch=ie(function(e){return p.call(e,"*")}),g.scope=ie(function(){return l.querySelectorAll(":scope")}),g.cssHas=ie(function(){try{return l.querySelector(":has(*,:jqfake)"),!1}catch(e){return!0}}),g.getById?(t.filter.ID=function(e){var t=e.replace(q,Z);return function(e){return e.getAttribute("id")===t}},t.find.ID=function(e,t){if(void 0!==t.getElementById&&d){var i=t.getElementById(e);return i?[i]:[]}}):(t.filter.ID=function(e){var t=e.replace(q,Z);return function(e){var i=void 0!==e.getAttributeNode&&e.getAttributeNode("id");return i&&i.value===t}},t.find.ID=function(e,t){if(void 0!==t.getElementById&&d){var i,n,r,s=t.getElementById(e);if(s){if((i=s.getAttributeNode("id"))&&i.value===e)return[s];for(r=t.getElementsByName(e),n=0;s=r[n++];)if((i=s.getAttributeNode("id"))&&i.value===e)return[s]}return[]}}),t.find.TAG=function(e,t){return void 0!==t.getElementsByTagName?t.getElementsByTagName(e):t.querySelectorAll(e)},t.find.CLASS=function(e,t){if(void 0!==t.getElementsByClassName&&d)return t.getElementsByClassName(e)},u=[],ie(function(e){var t;c.appendChild(e).innerHTML="",e.querySelectorAll("[selected]").length||u.push("\\["+E+"*(?:value|"+M+")"),e.querySelectorAll("[id~="+_+"-]").length||u.push("~="),e.querySelectorAll("a#"+_+"+*").length||u.push(".#.+[+~]"),e.querySelectorAll(":checked").length||u.push(":checked"),(t=l.createElement("input")).setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),c.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&u.push(":enabled",":disabled"),(t=l.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||u.push("\\["+E+"*name"+E+"*="+E+"*(?:''|\"\")")}),g.cssHas||u.push(":has"),u=u.length&&new RegExp(u.join("|")),T=function(e,t){if(e===t)return o=!0,0;var i=!e.compareDocumentPosition-!t.compareDocumentPosition;return i||(1&(i=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!g.sortDetached&&t.compareDocumentPosition(e)===i?e===l||e.ownerDocument==O&&Q.contains(O,e)?-1:t===l||t.ownerDocument==O&&Q.contains(O,t)?1:r?h.call(r,e)-h.call(r,t):0:4&i?-1:1)},l):l}for(e in Q.matches=function(e,t){return Q(e,null,null,t)},Q.matchesSelector=function(e,t){if(le(e),d&&!S[t+" "]&&(!u||!u.test(t)))try{var i=p.call(e,t);if(i||g.disconnectedMatch||e.document&&11!==e.document.nodeType)return i}catch(e){S(t,!0)}return Q(t,l,null,[e]).length>0},Q.contains=function(e,t){return(e.ownerDocument||e)!=l&&le(e),k.contains(e,t)},Q.attr=function(e,i){(e.ownerDocument||e)!=l&&le(e);var n=t.attrHandle[i.toLowerCase()],r=n&&f.call(t.attrHandle,i.toLowerCase())?n(e,i,!d):void 0;return void 0!==r?r:e.getAttribute(i)},Q.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},k.uniqueSort=function(e){var t,i=[],n=0,s=0;if(o=!g.sortStable,r=!g.sortStable&&a.call(e,0),D.call(e,T),o){for(;t=e[s++];)t===e[s]&&(n=i.push(s));for(;n--;)L.call(e,i[n],1)}return r=null,e},k.fn.uniqueSort=function(){return this.pushStack(k.uniqueSort(a.apply(this)))},t=k.expr={cacheLength:50,createPseudo:te,match:W,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(q,Z),e[3]=(e[3]||e[4]||e[5]||"").replace(q,Z),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||Q.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&Q.error(e[0]),e},PSEUDO:function(e){var t,i=!e[6]&&e[2];return W.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":i&&j.test(i)&&(t=he(i,!0))&&(t=i.indexOf(")",i.length-t)-i.length)&&(e[0]=e[0].slice(0,t),e[2]=i.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(q,Z).toLowerCase();return"*"===e?function(){return!0}:function(e){return A(e,t)}},CLASS:function(e){var t=x[e+" "];return t||(t=new RegExp("(^|"+E+")"+e+"("+E+"|$)"))&&x(e,function(e){return t.test("string"==typeof e.className&&e.className||void 0!==e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(e,t,i){return function(n){var r=Q.attr(n,e);return null==r?"!="===t:!t||(r+="","="===t?r===i:"!="===t?r!==i:"^="===t?i&&0===r.indexOf(i):"*="===t?i&&r.indexOf(i)>-1:"$="===t?i&&r.slice(-i.length)===i:"~="===t?(" "+r.replace(N," ")+" ").indexOf(i)>-1:"|="===t&&(r===i||r.slice(0,i.length+1)===i+"-"))}},CHILD:function(e,t,i,n,r){var s="nth"!==e.slice(0,3),o="last"!==e.slice(-4),a="of-type"===t;return 1===n&&0===r?function(e){return!!e.parentNode}:function(t,i,l){var c,h,d,u,f,p=s!==o?"nextSibling":"previousSibling",m=t.parentNode,g=a&&t.nodeName.toLowerCase(),v=!l&&!a,x=!1;if(m){if(s){for(;p;){for(d=t;d=d[p];)if(a?A(d,g):1===d.nodeType)return!1;f=p="only"===e&&!f&&"nextSibling"}return!0}if(f=[o?m.firstChild:m.lastChild],o&&v){for(x=(u=(c=(h=m[_]||(m[_]={}))[e]||[])[0]===y&&c[1])&&c[2],d=u&&m.childNodes[u];d=++u&&d&&d[p]||(x=u=0)||f.pop();)if(1===d.nodeType&&++x&&d===t){h[e]=[y,u,x];break}}else if(v&&(x=u=(c=(h=t[_]||(t[_]={}))[e]||[])[0]===y&&c[1]),!1===x)for(;(d=++u&&d&&d[p]||(x=u=0)||f.pop())&&(!(a?A(d,g):1===d.nodeType)||!++x||(v&&((h=d[_]||(d[_]={}))[e]=[y,x]),d!==t)););return(x-=r)===n||x%n===0&&x/n>=0}}},PSEUDO:function(e,i){var n,r=t.pseudos[e]||t.setFilters[e.toLowerCase()]||Q.error("unsupported pseudo: "+e);return r[_]?r(i):r.length>1?(n=[e,e,"",i],t.setFilters.hasOwnProperty(e.toLowerCase())?te(function(e,t){for(var n,s=r(e,i),o=s.length;o--;)e[n=h.call(e,s[o])]=!(t[n]=s[o])}):function(e){return r(e,0,n)}):r}},pseudos:{not:te(function(e){var t=[],i=[],n=_e(e.replace(I,"$1"));return n[_]?te(function(e,t,i,r){for(var s,o=n(e,null,r,[]),a=e.length;a--;)(s=o[a])&&(e[a]=!(t[a]=s))}):function(e,r,s){return t[0]=e,n(t,null,s,i),t[0]=null,!i.pop()}}),has:te(function(e){return function(t){return Q(e,t).length>0}}),contains:te(function(e){return e=e.replace(q,Z),function(t){return(t.textContent||k.text(t)).indexOf(e)>-1}}),lang:te(function(e){return V.test(e||"")||Q.error("unsupported lang: "+e),e=e.replace(q,Z).toLowerCase(),function(t){var i;do{if(i=d?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return(i=i.toLowerCase())===e||0===i.indexOf(e+"-")}while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(e){var t=n.location&&n.location.hash;return t&&t.slice(1)===e.id},root:function(e){return e===c},focus:function(e){return e===function(){try{return l.activeElement}catch(e){}}()&&l.hasFocus()&&!!(e.type||e.href||~e.tabIndex)},enabled:se(!1),disabled:se(!0),checked:function(e){return A(e,"input")&&!!e.checked||A(e,"option")&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,!0===e.selected},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!t.pseudos.empty(e)},header:function(e){return $.test(e.nodeName)},input:function(e){return U.test(e.nodeName)},button:function(e){return A(e,"input")&&"button"===e.type||A(e,"button")},text:function(e){var t;return A(e,"input")&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:oe(function(){return[0]}),last:oe(function(e,t){return[t-1]}),eq:oe(function(e,t,i){return[i<0?i+t:i]}),even:oe(function(e,t){for(var i=0;it?t:i;--n>=0;)e.push(n);return e}),gt:oe(function(e,t,i){for(var n=i<0?i+t:i;++n1?function(t,i,n){for(var r=e.length;r--;)if(!e[r](t,i,n))return!1;return!0}:e[0]}function pe(e,t,i,n,r){for(var s,o=[],a=0,l=e.length,c=null!=t;a-1&&(s[c]=!(o[c]=u))}}else f=pe(f===o?f.splice(_,f.length):f),r?r(null,o,f,l):m.apply(o,f)})}function ge(e){for(var n,r,s,o=e.length,a=t.relative[e[0].type],l=a||t.relative[" "],c=a?1:0,d=ue(function(e){return e===n},l,!0),u=ue(function(e){return h.call(n,e)>-1},l,!0),f=[function(e,t,r){var s=!a&&(r||t!=i)||((n=t).nodeType?d(e,t,r):u(e,t,r));return n=null,s}];c1&&fe(f),c>1&&de(e.slice(0,c-1).concat({value:" "===e[c-2].type?"*":""})).replace(I,"$1"),r,c0,s=e.length>0,o=function(o,a,c,h,u){var f,p,g,_=0,v="0",x=o&&[],b=[],w=i,S=o||s&&t.find.TAG("*",u),T=y+=null==w?1:Math.random()||.1,M=S.length;for(u&&(i=a==l||a||u);v!==M&&null!=(f=S[v]);v++){if(s&&f){for(p=0,a||f.ownerDocument==l||(le(f),c=!d);g=e[p++];)if(g(f,a||l,c)){m.call(h,f);break}u&&(y=T)}r&&((f=!g&&f)&&_--,o&&x.push(f))}if(_+=v,r&&v!==_){for(p=0;g=n[p++];)g(x,b,a,c);if(o){if(_>0)for(;v--;)x[v]||b[v]||(b[v]=C.call(h));b=pe(b)}m.apply(h,b),u&&!o&&b.length>0&&_+n.length>1&&k.uniqueSort(h)}return u&&(y=T,i=w),x};return r?te(o):o}(o,s)),a.selector=e}return a}function ye(e,i,n,r){var s,o,a,l,c,h="function"==typeof e&&e,u=!r&&he(e=h.selector||e);if(n=n||[],1===u.length){if((o=u[0]=u[0].slice(0)).length>2&&"ID"===(a=o[0]).type&&9===i.nodeType&&d&&t.relative[o[1].type]){if(!(i=(t.find.ID(a.matches[0].replace(q,Z),i)||[])[0]))return n;h&&(i=i.parentNode),e=e.slice(o.shift().value.length)}for(s=W.needsContext.test(e)?0:o.length;s--&&(a=o[s],!t.relative[l=a.type]);)if((c=t.find[l])&&(r=c(a.matches[0].replace(q,Z),X.test(o[0].type)&&ae(i.parentNode)||i))){if(o.splice(s,1),!(e=r.length&&de(o)))return m.apply(n,r),n;break}}return(h||_e(e,u))(r,i,!d,n,!i||X.test(e)&&ae(i.parentNode)||i),n}ce.prototype=t.filters=t.pseudos,t.setFilters=new ce,g.sortStable=_.split("").sort(T).join("")===_,le(),g.sortDetached=ie(function(e){return 1&e.compareDocumentPosition(l.createElement("fieldset"))}),k.find=Q,k.expr[":"]=k.expr.pseudos,k.unique=k.uniqueSort,Q.compile=_e,Q.select=ye,Q.setDocument=le,Q.tokenize=he,Q.escape=k.escapeSelector,Q.getText=k.text,Q.isXML=k.isXMLDoc,Q.selectors=k.expr,Q.support=k.support,Q.uniqueSort=k.uniqueSort}();var F=function(e,t,i){for(var n=[],r=void 0!==i;(e=e[t])&&9!==e.nodeType;)if(1===e.nodeType){if(r&&k(e).is(i))break;n.push(e)}return n},N=function(e,t){for(var i=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&i.push(e);return i},Y=k.expr.match.needsContext,B=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function H(e,t,i){return _(t)?k.grep(e,function(e,n){return!!t.call(e,n,e)!==i}):t.nodeType?k.grep(e,function(e){return e===t!==i}):"string"!=typeof t?k.grep(e,function(e){return h.call(t,e)>-1!==i}):k.filter(t,e,i)}k.filter=function(e,t,i){var n=t[0];return i&&(e=":not("+e+")"),1===t.length&&1===n.nodeType?k.find.matchesSelector(n,e)?[n]:[]:k.find.matches(e,k.grep(t,function(e){return 1===e.nodeType}))},k.fn.extend({find:function(e){var t,i,n=this.length,r=this;if("string"!=typeof e)return this.pushStack(k(e).filter(function(){for(t=0;t1?k.uniqueSort(i):i},filter:function(e){return this.pushStack(H(this,e||[],!1))},not:function(e){return this.pushStack(H(this,e||[],!0))},is:function(e){return!!H(this,"string"==typeof e&&Y.test(e)?k(e):e||[],!1).length}});var j,V=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/;(k.fn.init=function(e,t,i){var n,r;if(!e)return this;if(i=i||j,"string"==typeof e){if(!(n="<"===e[0]&&">"===e[e.length-1]&&e.length>=3?[null,e,null]:V.exec(e))||!n[1]&&t)return!t||t.jquery?(t||i).find(e):this.constructor(t).find(e);if(n[1]){if(t=t instanceof k?t[0]:t,k.merge(this,k.parseHTML(n[1],t&&t.nodeType?t.ownerDocument||t:v,!0)),B.test(n[1])&&k.isPlainObject(t))for(n in t)_(this[n])?this[n](t[n]):this.attr(n,t[n]);return this}return(r=v.getElementById(n[2]))&&(this[0]=r,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):_(e)?void 0!==i.ready?i.ready(e):e(k):k.makeArray(e,this)}).prototype=k.fn,j=k(v);var W=/^(?:parents|prev(?:Until|All))/,U={children:!0,contents:!0,next:!0,prev:!0};function $(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}k.fn.extend({has:function(e){var t=k(e,this),i=t.length;return this.filter(function(){for(var e=0;e-1:1===i.nodeType&&k.find.matchesSelector(i,e))){s.push(i);break}return this.pushStack(s.length>1?k.uniqueSort(s):s)},index:function(e){return e?"string"==typeof e?h.call(k(e),this[0]):h.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(k.uniqueSort(k.merge(this.get(),k(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),k.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return F(e,"parentNode")},parentsUntil:function(e,t,i){return F(e,"parentNode",i)},next:function(e){return $(e,"nextSibling")},prev:function(e){return $(e,"previousSibling")},nextAll:function(e){return F(e,"nextSibling")},prevAll:function(e){return F(e,"previousSibling")},nextUntil:function(e,t,i){return F(e,"nextSibling",i)},prevUntil:function(e,t,i){return F(e,"previousSibling",i)},siblings:function(e){return N((e.parentNode||{}).firstChild,e)},children:function(e){return N(e.firstChild)},contents:function(e){return null!=e.contentDocument&&o(e.contentDocument)?e.contentDocument:(A(e,"template")&&(e=e.content||e),k.merge([],e.childNodes))}},function(e,t){k.fn[e]=function(i,n){var r=k.map(this,t,i);return"Until"!==e.slice(-5)&&(n=i),n&&"string"==typeof n&&(r=k.filter(n,r)),this.length>1&&(U[e]||k.uniqueSort(r),W.test(e)&&r.reverse()),this.pushStack(r)}});var G=/[^\x20\t\r\n\f]+/g;function X(e){return e}function q(e){throw e}function Z(e,t,i,n){var r;try{e&&_(r=e.promise)?r.call(e).done(t).fail(i):e&&_(r=e.then)?r.call(e,t,i):t.apply(void 0,[e].slice(n))}catch(e){i.apply(void 0,[e])}}k.Callbacks=function(e){e="string"==typeof e?function(e){var t={};return k.each(e.match(G)||[],function(e,i){t[i]=!0}),t}(e):k.extend({},e);var t,i,n,r,s=[],o=[],a=-1,l=function(){for(r=r||e.once,n=t=!0;o.length;a=-1)for(i=o.shift();++a-1;)s.splice(i,1),i<=a&&a--}),this},has:function(e){return e?k.inArray(e,s)>-1:s.length>0},empty:function(){return s&&(s=[]),this},disable:function(){return r=o=[],s=i="",this},disabled:function(){return!s},lock:function(){return r=o=[],i||t||(s=i=""),this},locked:function(){return!!r},fireWith:function(e,i){return r||(i=[e,(i=i||[]).slice?i.slice():i],o.push(i),t||l()),this},fire:function(){return c.fireWith(this,arguments),this},fired:function(){return!!n}};return c},k.extend({Deferred:function(e){var t=[["notify","progress",k.Callbacks("memory"),k.Callbacks("memory"),2],["resolve","done",k.Callbacks("once memory"),k.Callbacks("once memory"),0,"resolved"],["reject","fail",k.Callbacks("once memory"),k.Callbacks("once memory"),1,"rejected"]],i="pending",r={state:function(){return i},always:function(){return s.done(arguments).fail(arguments),this},catch:function(e){return r.then(null,e)},pipe:function(){var e=arguments;return k.Deferred(function(i){k.each(t,function(t,n){var r=_(e[n[4]])&&e[n[4]];s[n[1]](function(){var e=r&&r.apply(this,arguments);e&&_(e.promise)?e.promise().progress(i.notify).done(i.resolve).fail(i.reject):i[n[0]+"With"](this,r?[e]:arguments)})}),e=null}).promise()},then:function(e,i,r){var s=0;function o(e,t,i,r){return function(){var a=this,l=arguments,c=function(){var n,c;if(!(e=s&&(i!==q&&(a=void 0,l=[n]),t.rejectWith(a,l))}};e?h():(k.Deferred.getErrorHook?h.error=k.Deferred.getErrorHook():k.Deferred.getStackHook&&(h.error=k.Deferred.getStackHook()),n.setTimeout(h))}}return k.Deferred(function(n){t[0][3].add(o(0,n,_(r)?r:X,n.notifyWith)),t[1][3].add(o(0,n,_(e)?e:X)),t[2][3].add(o(0,n,_(i)?i:q))}).promise()},promise:function(e){return null!=e?k.extend(e,r):r}},s={};return k.each(t,function(e,n){var o=n[2],a=n[5];r[n[1]]=o.add,a&&o.add(function(){i=a},t[3-e][2].disable,t[3-e][3].disable,t[0][2].lock,t[0][3].lock),o.add(n[3].fire),s[n[0]]=function(){return s[n[0]+"With"](this===s?void 0:this,arguments),this},s[n[0]+"With"]=o.fireWith}),r.promise(s),e&&e.call(s,s),s},when:function(e){var t=arguments.length,i=t,n=Array(i),r=a.call(arguments),s=k.Deferred(),o=function(e){return function(i){n[e]=this,r[e]=arguments.length>1?a.call(arguments):i,--t||s.resolveWith(n,r)}};if(t<=1&&(Z(e,s.done(o(i)).resolve,s.reject,!t),"pending"===s.state()||_(r[i]&&r[i].then)))return s.then();for(;i--;)Z(r[i],o(i),s.reject);return s.promise()}});var J=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;k.Deferred.exceptionHook=function(e,t){n.console&&n.console.warn&&e&&J.test(e.name)&&n.console.warn("jQuery.Deferred exception: "+e.message,e.stack,t)},k.readyException=function(e){n.setTimeout(function(){throw e})};var K=k.Deferred();function Q(){v.removeEventListener("DOMContentLoaded",Q),n.removeEventListener("load",Q),k.ready()}k.fn.ready=function(e){return K.then(e).catch(function(e){k.readyException(e)}),this},k.extend({isReady:!1,readyWait:1,ready:function(e){(!0===e?--k.readyWait:k.isReady)||(k.isReady=!0,!0!==e&&--k.readyWait>0||K.resolveWith(v,[k]))}}),k.ready.then=K.then,"complete"===v.readyState||"loading"!==v.readyState&&!v.documentElement.doScroll?n.setTimeout(k.ready):(v.addEventListener("DOMContentLoaded",Q),n.addEventListener("load",Q));var ee=function(e,t,i,n,r,s,o){var a=0,l=e.length,c=null==i;if("object"===w(i))for(a in r=!0,i)ee(e,t,a,i[a],!0,s,o);else if(void 0!==n&&(r=!0,_(n)||(o=!0),c&&(o?(t.call(e,n),t=null):(c=t,t=function(e,t,i){return c.call(k(e),i)})),t))for(;a1,null,!0)},removeData:function(e){return this.each(function(){le.remove(this,e)})}}),k.extend({queue:function(e,t,i){var n;if(e)return t=(t||"fx")+"queue",n=ae.get(e,t),i&&(!n||Array.isArray(i)?n=ae.access(e,t,k.makeArray(i)):n.push(i)),n||[]},dequeue:function(e,t){t=t||"fx";var i=k.queue(e,t),n=i.length,r=i.shift(),s=k._queueHooks(e,t);"inprogress"===r&&(r=i.shift(),n--),r&&("fx"===t&&i.unshift("inprogress"),delete s.stop,r.call(e,function(){k.dequeue(e,t)},s)),!n&&s&&s.empty.fire()},_queueHooks:function(e,t){var i=t+"queueHooks";return ae.get(e,i)||ae.access(e,i,{empty:k.Callbacks("once memory").add(function(){ae.remove(e,[t+"queue",i])})})}}),k.fn.extend({queue:function(e,t){var i=2;return"string"!=typeof e&&(t=e,e="fx",i--),arguments.length\x20\t\r\n\f]*)/i,Ae=/^$|^module$|\/(?:java|ecma)script/i;Se=v.createDocumentFragment().appendChild(v.createElement("div")),(Te=v.createElement("input")).setAttribute("type","radio"),Te.setAttribute("checked","checked"),Te.setAttribute("name","t"),Se.appendChild(Te),g.checkClone=Se.cloneNode(!0).cloneNode(!0).lastChild.checked,Se.innerHTML="",g.noCloneChecked=!!Se.cloneNode(!0).lastChild.defaultValue,Se.innerHTML="",g.option=!!Se.lastChild;var Ce={thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};function De(e,t){var i;return i=void 0!==e.getElementsByTagName?e.getElementsByTagName(t||"*"):void 0!==e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&A(e,t)?k.merge([e],i):i}function Le(e,t){for(var i=0,n=e.length;i",""]);var Ee=/<|&#?\w+;/;function Ie(e,t,i,n,r){for(var s,o,a,l,c,h,d=t.createDocumentFragment(),u=[],f=0,p=e.length;f-1)r&&r.push(s);else if(c=ge(s),o=De(d.appendChild(s),"script"),c&&Le(o),i)for(h=0;s=o[h++];)Ae.test(s.type||"")&&i.push(s);return d}var Pe=/^([^.]*)(?:\.(.+)|)/;function Re(){return!0}function Oe(){return!1}function ze(e,t,i,n,r,s){var o,a;if("object"==typeof t){for(a in"string"!=typeof i&&(n=n||i,i=void 0),t)ze(e,a,i,n,t[a],s);return e}if(null==n&&null==r?(r=i,n=i=void 0):null==r&&("string"==typeof i?(r=n,n=void 0):(r=n,n=i,i=void 0)),!1===r)r=Oe;else if(!r)return e;return 1===s&&(o=r,r=function(e){return k().off(e),o.apply(this,arguments)},r.guid=o.guid||(o.guid=k.guid++)),e.each(function(){k.event.add(this,t,r,n,i)})}function Fe(e,t,i){i?(ae.set(e,t,!1),k.event.add(e,t,{namespace:!1,handler:function(e){var i,n=ae.get(this,t);if(1&e.isTrigger&&this[t]){if(n)(k.event.special[t]||{}).delegateType&&e.stopPropagation();else if(n=a.call(arguments),ae.set(this,t,n),this[t](),i=ae.get(this,t),ae.set(this,t,!1),n!==i)return e.stopImmediatePropagation(),e.preventDefault(),i}else n&&(ae.set(this,t,k.event.trigger(n[0],n.slice(1),this)),e.stopPropagation(),e.isImmediatePropagationStopped=Re)}})):void 0===ae.get(e,t)&&k.event.add(e,t,Re)}k.event={global:{},add:function(e,t,i,n,r){var s,o,a,l,c,h,d,u,f,p,m,g=ae.get(e);if(se(e))for(i.handler&&(i=(s=i).handler,r=s.selector),r&&k.find.matchesSelector(me,r),i.guid||(i.guid=k.guid++),(l=g.events)||(l=g.events=Object.create(null)),(o=g.handle)||(o=g.handle=function(t){return void 0!==k&&k.event.triggered!==t.type?k.event.dispatch.apply(e,arguments):void 0}),c=(t=(t||"").match(G)||[""]).length;c--;)f=m=(a=Pe.exec(t[c])||[])[1],p=(a[2]||"").split(".").sort(),f&&(d=k.event.special[f]||{},f=(r?d.delegateType:d.bindType)||f,d=k.event.special[f]||{},h=k.extend({type:f,origType:m,data:n,handler:i,guid:i.guid,selector:r,needsContext:r&&k.expr.match.needsContext.test(r),namespace:p.join(".")},s),(u=l[f])||((u=l[f]=[]).delegateCount=0,d.setup&&!1!==d.setup.call(e,n,p,o)||e.addEventListener&&e.addEventListener(f,o)),d.add&&(d.add.call(e,h),h.handler.guid||(h.handler.guid=i.guid)),r?u.splice(u.delegateCount++,0,h):u.push(h),k.event.global[f]=!0)},remove:function(e,t,i,n,r){var s,o,a,l,c,h,d,u,f,p,m,g=ae.hasData(e)&&ae.get(e);if(g&&(l=g.events)){for(c=(t=(t||"").match(G)||[""]).length;c--;)if(f=m=(a=Pe.exec(t[c])||[])[1],p=(a[2]||"").split(".").sort(),f){for(d=k.event.special[f]||{},u=l[f=(n?d.delegateType:d.bindType)||f]||[],a=a[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),o=s=u.length;s--;)h=u[s],!r&&m!==h.origType||i&&i.guid!==h.guid||a&&!a.test(h.namespace)||n&&n!==h.selector&&("**"!==n||!h.selector)||(u.splice(s,1),h.selector&&u.delegateCount--,d.remove&&d.remove.call(e,h));o&&!u.length&&(d.teardown&&!1!==d.teardown.call(e,p,g.handle)||k.removeEvent(e,f,g.handle),delete l[f])}else for(f in l)k.event.remove(e,f+t[c],i,n,!0);k.isEmptyObject(l)&&ae.remove(e,"handle events")}},dispatch:function(e){var t,i,n,r,s,o,a=new Array(arguments.length),l=k.event.fix(e),c=(ae.get(this,"events")||Object.create(null))[l.type]||[],h=k.event.special[l.type]||{};for(a[0]=l,t=1;t=1))for(;c!==this;c=c.parentNode||this)if(1===c.nodeType&&("click"!==e.type||!0!==c.disabled)){for(s=[],o={},i=0;i-1:k.find(r,this,null,[c]).length),o[r]&&s.push(n);s.length&&a.push({elem:c,handlers:s})}return c=this,l\s*$/g;function He(e,t){return A(e,"table")&&A(11!==t.nodeType?t:t.firstChild,"tr")&&k(e).children("tbody")[0]||e}function je(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function Ve(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function We(e,t){var i,n,r,s,o,a;if(1===t.nodeType){if(ae.hasData(e)&&(a=ae.get(e).events))for(r in ae.remove(t,"handle events"),a)for(i=0,n=a[r].length;i1&&"string"==typeof p&&!g.checkClone&&Ye.test(p))return e.each(function(r){var s=e.eq(r);m&&(t[0]=p.call(this,r,s.html())),$e(s,t,i,n)});if(u&&(s=(r=Ie(t,e[0].ownerDocument,!1,e,n)).firstChild,1===r.childNodes.length&&(r=s),s||n)){for(a=(o=k.map(De(r,"script"),je)).length;d0&&Le(o,!l&&De(e,"script")),a},cleanData:function(e){for(var t,i,n,r=k.event.special,s=0;void 0!==(i=e[s]);s++)if(se(i)){if(t=i[ae.expando]){if(t.events)for(n in t.events)r[n]?k.event.remove(i,n):k.removeEvent(i,n,t.handle);i[ae.expando]=void 0}i[le.expando]&&(i[le.expando]=void 0)}}}),k.fn.extend({detach:function(e){return Ge(this,e,!0)},remove:function(e){return Ge(this,e)},text:function(e){return ee(this,function(e){return void 0===e?k.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=e)})},null,e,arguments.length)},append:function(){return $e(this,arguments,function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||He(this,e).appendChild(e)})},prepend:function(){return $e(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=He(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return $e(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return $e(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(k.cleanData(De(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map(function(){return k.clone(this,e,t)})},html:function(e){return ee(this,function(e){var t=this[0]||{},i=0,n=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!Ne.test(e)&&!Ce[(Me.exec(e)||["",""])[1].toLowerCase()]){e=k.htmlPrefilter(e);try{for(;i=0&&(l+=Math.max(0,Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-s-l-a-.5))||0),l+c}function ht(e,t,i){var n=Ze(e),r=(!g.boxSizingReliable()||i)&&"border-box"===k.css(e,"boxSizing",!1,n),s=r,o=Qe(e,t,n),a="offset"+t[0].toUpperCase()+t.slice(1);if(Xe.test(o)){if(!i)return o;o="auto"}return(!g.boxSizingReliable()&&r||!g.reliableTrDimensions()&&A(e,"tr")||"auto"===o||!parseFloat(o)&&"inline"===k.css(e,"display",!1,n))&&e.getClientRects().length&&(r="border-box"===k.css(e,"boxSizing",!1,n),(s=a in e)&&(o=e[a])),(o=parseFloat(o)||0)+ct(e,t,i||(r?"border":"content"),s,n,o)+"px"}function dt(e,t,i,n,r){return new dt.prototype.init(e,t,i,n,r)}k.extend({cssHooks:{opacity:{get:function(e,t){if(t){var i=Qe(e,"opacity");return""===i?"1":i}}}},cssNumber:{animationIterationCount:!0,aspectRatio:!0,borderImageSlice:!0,columnCount:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,scale:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeMiterlimit:!0,strokeOpacity:!0},cssProps:{},style:function(e,t,i,n){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var r,s,o,a=re(t),l=qe.test(t),c=e.style;if(l||(t=rt(a)),o=k.cssHooks[t]||k.cssHooks[a],void 0===i)return o&&"get"in o&&void 0!==(r=o.get(e,!1,n))?r:c[t];"string"==(s=typeof i)&&(r=fe.exec(i))&&r[1]&&(i=ve(e,t,r),s="number"),null!=i&&i==i&&("number"!==s||l||(i+=r&&r[3]||(k.cssNumber[a]?"":"px")),g.clearCloneStyle||""!==i||0!==t.indexOf("background")||(c[t]="inherit"),o&&"set"in o&&void 0===(i=o.set(e,i,n))||(l?c.setProperty(t,i):c[t]=i))}},css:function(e,t,i,n){var r,s,o,a=re(t);return qe.test(t)||(t=rt(a)),(o=k.cssHooks[t]||k.cssHooks[a])&&"get"in o&&(r=o.get(e,!0,i)),void 0===r&&(r=Qe(e,t,n)),"normal"===r&&t in at&&(r=at[t]),""===i||i?(s=parseFloat(r),!0===i||isFinite(s)?s||0:r):r}}),k.each(["height","width"],function(e,t){k.cssHooks[t]={get:function(e,i,n){if(i)return!st.test(k.css(e,"display"))||e.getClientRects().length&&e.getBoundingClientRect().width?ht(e,t,n):Je(e,ot,function(){return ht(e,t,n)})},set:function(e,i,n){var r,s=Ze(e),o=!g.scrollboxSize()&&"absolute"===s.position,a=(o||n)&&"border-box"===k.css(e,"boxSizing",!1,s),l=n?ct(e,t,n,a,s):0;return a&&o&&(l-=Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-parseFloat(s[t])-ct(e,t,"border",!1,s)-.5)),l&&(r=fe.exec(i))&&"px"!==(r[3]||"px")&&(e.style[t]=i,i=k.css(e,t)),lt(0,i,l)}}}),k.cssHooks.marginLeft=et(g.reliableMarginLeft,function(e,t){if(t)return(parseFloat(Qe(e,"marginLeft"))||e.getBoundingClientRect().left-Je(e,{marginLeft:0},function(){return e.getBoundingClientRect().left}))+"px"}),k.each({margin:"",padding:"",border:"Width"},function(e,t){k.cssHooks[e+t]={expand:function(i){for(var n=0,r={},s="string"==typeof i?i.split(" "):[i];n<4;n++)r[e+pe[n]+t]=s[n]||s[n-2]||s[0];return r}},"margin"!==e&&(k.cssHooks[e+t].set=lt)}),k.fn.extend({css:function(e,t){return ee(this,function(e,t,i){var n,r,s={},o=0;if(Array.isArray(t)){for(n=Ze(e),r=t.length;o1)}}),k.Tween=dt,dt.prototype={constructor:dt,init:function(e,t,i,n,r,s){this.elem=e,this.prop=i,this.easing=r||k.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=n,this.unit=s||(k.cssNumber[i]?"":"px")},cur:function(){var e=dt.propHooks[this.prop];return e&&e.get?e.get(this):dt.propHooks._default.get(this)},run:function(e){var t,i=dt.propHooks[this.prop];return this.options.duration?this.pos=t=k.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),i&&i.set?i.set(this):dt.propHooks._default.set(this),this}},dt.prototype.init.prototype=dt.prototype,dt.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=k.css(e.elem,e.prop,""))&&"auto"!==t?t:0},set:function(e){k.fx.step[e.prop]?k.fx.step[e.prop](e):1!==e.elem.nodeType||!k.cssHooks[e.prop]&&null==e.elem.style[rt(e.prop)]?e.elem[e.prop]=e.now:k.style(e.elem,e.prop,e.now+e.unit)}}},dt.propHooks.scrollTop=dt.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},k.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},k.fx=dt.prototype.init,k.fx.step={};var ut,ft,pt=/^(?:toggle|show|hide)$/,mt=/queueHooks$/;function gt(){ft&&(!1===v.hidden&&n.requestAnimationFrame?n.requestAnimationFrame(gt):n.setTimeout(gt,k.fx.interval),k.fx.tick())}function _t(){return n.setTimeout(function(){ut=void 0}),ut=Date.now()}function yt(e,t){var i,n=0,r={height:e};for(t=t?1:0;n<4;n+=2-t)r["margin"+(i=pe[n])]=r["padding"+i]=e;return t&&(r.opacity=r.width=e),r}function vt(e,t,i){for(var n,r=(xt.tweeners[t]||[]).concat(xt.tweeners["*"]),s=0,o=r.length;s1)},removeAttr:function(e){return this.each(function(){k.removeAttr(this,e)})}}),k.extend({attr:function(e,t,i){var n,r,s=e.nodeType;if(3!==s&&8!==s&&2!==s)return void 0===e.getAttribute?k.prop(e,t,i):(1===s&&k.isXMLDoc(e)||(r=k.attrHooks[t.toLowerCase()]||(k.expr.match.bool.test(t)?bt:void 0)),void 0!==i?null===i?void k.removeAttr(e,t):r&&"set"in r&&void 0!==(n=r.set(e,i,t))?n:(e.setAttribute(t,i+""),i):r&&"get"in r&&null!==(n=r.get(e,t))?n:null==(n=k.find.attr(e,t))?void 0:n)},attrHooks:{type:{set:function(e,t){if(!g.radioValue&&"radio"===t&&A(e,"input")){var i=e.value;return e.setAttribute("type",t),i&&(e.value=i),t}}}},removeAttr:function(e,t){var i,n=0,r=t&&t.match(G);if(r&&1===e.nodeType)for(;i=r[n++];)e.removeAttribute(i)}}),bt={set:function(e,t,i){return!1===t?k.removeAttr(e,i):e.setAttribute(i,i),i}},k.each(k.expr.match.bool.source.match(/\w+/g),function(e,t){var i=wt[t]||k.find.attr;wt[t]=function(e,t,n){var r,s,o=t.toLowerCase();return n||(s=wt[o],wt[o]=r,r=null!=i(e,t,n)?o:null,wt[o]=s),r}});var St=/^(?:input|select|textarea|button)$/i,Tt=/^(?:a|area)$/i;function kt(e){return(e.match(G)||[]).join(" ")}function Mt(e){return e.getAttribute&&e.getAttribute("class")||""}function At(e){return Array.isArray(e)?e:"string"==typeof e&&e.match(G)||[]}k.fn.extend({prop:function(e,t){return ee(this,k.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each(function(){delete this[k.propFix[e]||e]})}}),k.extend({prop:function(e,t,i){var n,r,s=e.nodeType;if(3!==s&&8!==s&&2!==s)return 1===s&&k.isXMLDoc(e)||(t=k.propFix[t]||t,r=k.propHooks[t]),void 0!==i?r&&"set"in r&&void 0!==(n=r.set(e,i,t))?n:e[t]=i:r&&"get"in r&&null!==(n=r.get(e,t))?n:e[t]},propHooks:{tabIndex:{get:function(e){var t=k.find.attr(e,"tabindex");return t?parseInt(t,10):St.test(e.nodeName)||Tt.test(e.nodeName)&&e.href?0:-1}}},propFix:{for:"htmlFor",class:"className"}}),g.optSelected||(k.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),k.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){k.propFix[this.toLowerCase()]=this}),k.fn.extend({addClass:function(e){var t,i,n,r,s,o;return _(e)?this.each(function(t){k(this).addClass(e.call(this,t,Mt(this)))}):(t=At(e)).length?this.each(function(){if(n=Mt(this),i=1===this.nodeType&&" "+kt(n)+" "){for(s=0;s-1;)i=i.replace(" "+r+" "," ");o=kt(i),n!==o&&this.setAttribute("class",o)}}):this:this.attr("class","")},toggleClass:function(e,t){var i,n,r,s,o=typeof e,a="string"===o||Array.isArray(e);return _(e)?this.each(function(i){k(this).toggleClass(e.call(this,i,Mt(this),t),t)}):"boolean"==typeof t&&a?t?this.addClass(e):this.removeClass(e):(i=At(e),this.each(function(){if(a)for(s=k(this),r=0;r-1)return!0;return!1}});var Ct=/\r/g;k.fn.extend({val:function(e){var t,i,n,r=this[0];return arguments.length?(n=_(e),this.each(function(i){var r;1===this.nodeType&&(null==(r=n?e.call(this,i,k(this).val()):e)?r="":"number"==typeof r?r+="":Array.isArray(r)&&(r=k.map(r,function(e){return null==e?"":e+""})),(t=k.valHooks[this.type]||k.valHooks[this.nodeName.toLowerCase()])&&"set"in t&&void 0!==t.set(this,r,"value")||(this.value=r))})):r?(t=k.valHooks[r.type]||k.valHooks[r.nodeName.toLowerCase()])&&"get"in t&&void 0!==(i=t.get(r,"value"))?i:"string"==typeof(i=r.value)?i.replace(Ct,""):null==i?"":i:void 0}}),k.extend({valHooks:{option:{get:function(e){var t=k.find.attr(e,"value");return null!=t?t:kt(k.text(e))}},select:{get:function(e){var t,i,n,r=e.options,s=e.selectedIndex,o="select-one"===e.type,a=o?null:[],l=o?s+1:r.length;for(n=s<0?l:o?s:0;n-1)&&(i=!0);return i||(e.selectedIndex=-1),s}}}}),k.each(["radio","checkbox"],function(){k.valHooks[this]={set:function(e,t){if(Array.isArray(t))return e.checked=k.inArray(k(e).val(),t)>-1}},g.checkOn||(k.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})});var Dt=n.location,Lt={guid:Date.now()},Et=/\?/;k.parseXML=function(e){var t,i;if(!e||"string"!=typeof e)return null;try{t=(new n.DOMParser).parseFromString(e,"text/xml")}catch(e){}return i=t&&t.getElementsByTagName("parsererror")[0],t&&!i||k.error("Invalid XML: "+(i?k.map(i.childNodes,function(e){return e.textContent}).join("\n"):e)),t};var It=/^(?:focusinfocus|focusoutblur)$/,Pt=function(e){e.stopPropagation()};k.extend(k.event,{trigger:function(e,t,i,r){var s,o,a,l,c,h,d,u,p=[i||v],m=f.call(e,"type")?e.type:e,g=f.call(e,"namespace")?e.namespace.split("."):[];if(o=u=a=i=i||v,3!==i.nodeType&&8!==i.nodeType&&!It.test(m+k.event.triggered)&&(m.indexOf(".")>-1&&(g=m.split("."),m=g.shift(),g.sort()),c=m.indexOf(":")<0&&"on"+m,(e=e[k.expando]?e:new k.Event(m,"object"==typeof e&&e)).isTrigger=r?2:3,e.namespace=g.join("."),e.rnamespace=e.namespace?new RegExp("(^|\\.)"+g.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=void 0,e.target||(e.target=i),t=null==t?[e]:k.makeArray(t,[e]),d=k.event.special[m]||{},r||!d.trigger||!1!==d.trigger.apply(i,t))){if(!r&&!d.noBubble&&!y(i)){for(l=d.delegateType||m,It.test(l+m)||(o=o.parentNode);o;o=o.parentNode)p.push(o),a=o;a===(i.ownerDocument||v)&&p.push(a.defaultView||a.parentWindow||n)}for(s=0;(o=p[s++])&&!e.isPropagationStopped();)u=o,e.type=s>1?l:d.bindType||m,(h=(ae.get(o,"events")||Object.create(null))[e.type]&&ae.get(o,"handle"))&&h.apply(o,t),(h=c&&o[c])&&h.apply&&se(o)&&(e.result=h.apply(o,t),!1===e.result&&e.preventDefault());return e.type=m,r||e.isDefaultPrevented()||d._default&&!1!==d._default.apply(p.pop(),t)||!se(i)||c&&_(i[m])&&!y(i)&&((a=i[c])&&(i[c]=null),k.event.triggered=m,e.isPropagationStopped()&&u.addEventListener(m,Pt),i[m](),e.isPropagationStopped()&&u.removeEventListener(m,Pt),k.event.triggered=void 0,a&&(i[c]=a)),e.result}},simulate:function(e,t,i){var n=k.extend(new k.Event,i,{type:e,isSimulated:!0});k.event.trigger(n,null,t)}}),k.fn.extend({trigger:function(e,t){return this.each(function(){k.event.trigger(e,t,this)})},triggerHandler:function(e,t){var i=this[0];if(i)return k.event.trigger(e,t,i,!0)}});var Rt=/\[\]$/,Ot=/\r?\n/g,zt=/^(?:submit|button|image|reset|file)$/i,Ft=/^(?:input|select|textarea|keygen)/i;function Nt(e,t,i,n){var r;if(Array.isArray(t))k.each(t,function(t,r){i||Rt.test(e)?n(e,r):Nt(e+"["+("object"==typeof r&&null!=r?t:"")+"]",r,i,n)});else if(i||"object"!==w(t))n(e,t);else for(r in t)Nt(e+"["+r+"]",t[r],i,n)}k.param=function(e,t){var i,n=[],r=function(e,t){var i=_(t)?t():t;n[n.length]=encodeURIComponent(e)+"="+encodeURIComponent(null==i?"":i)};if(null==e)return"";if(Array.isArray(e)||e.jquery&&!k.isPlainObject(e))k.each(e,function(){r(this.name,this.value)});else for(i in e)Nt(i,e[i],t,r);return n.join("&")},k.fn.extend({serialize:function(){return k.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=k.prop(this,"elements");return e?k.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!k(this).is(":disabled")&&Ft.test(this.nodeName)&&!zt.test(e)&&(this.checked||!ke.test(e))}).map(function(e,t){var i=k(this).val();return null==i?null:Array.isArray(i)?k.map(i,function(e){return{name:t.name,value:e.replace(Ot,"\r\n")}}):{name:t.name,value:i.replace(Ot,"\r\n")}}).get()}});var Yt=/%20/g,Bt=/#.*$/,Ht=/([?&])_=[^&]*/,jt=/^(.*?):[ \t]*([^\r\n]*)$/gm,Vt=/^(?:GET|HEAD)$/,Wt=/^\/\//,Ut={},$t={},Gt="*/".concat("*"),Xt=v.createElement("a");function qt(e){return function(t,i){"string"!=typeof t&&(i=t,t="*");var n,r=0,s=t.toLowerCase().match(G)||[];if(_(i))for(;n=s[r++];)"+"===n[0]?(n=n.slice(1)||"*",(e[n]=e[n]||[]).unshift(i)):(e[n]=e[n]||[]).push(i)}}function Zt(e,t,i,n){var r={},s=e===$t;function o(a){var l;return r[a]=!0,k.each(e[a]||[],function(e,a){var c=a(t,i,n);return"string"!=typeof c||s||r[c]?s?!(l=c):void 0:(t.dataTypes.unshift(c),o(c),!1)}),l}return o(t.dataTypes[0])||!r["*"]&&o("*")}function Jt(e,t){var i,n,r=k.ajaxSettings.flatOptions||{};for(i in t)void 0!==t[i]&&((r[i]?e:n||(n={}))[i]=t[i]);return n&&k.extend(!0,e,n),e}Xt.href=Dt.href,k.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Dt.href,type:"GET",isLocal:/^(?:about|app|app-storage|.+-extension|file|res|widget):$/.test(Dt.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Gt,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":k.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?Jt(Jt(e,k.ajaxSettings),t):Jt(k.ajaxSettings,e)},ajaxPrefilter:qt(Ut),ajaxTransport:qt($t),ajax:function(e,t){"object"==typeof e&&(t=e,e=void 0),t=t||{};var i,r,s,o,a,l,c,h,d,u,f=k.ajaxSetup({},t),p=f.context||f,m=f.context&&(p.nodeType||p.jquery)?k(p):k.event,g=k.Deferred(),_=k.Callbacks("once memory"),y=f.statusCode||{},x={},b={},w="canceled",S={readyState:0,getResponseHeader:function(e){var t;if(c){if(!o)for(o={};t=jt.exec(s);)o[t[1].toLowerCase()+" "]=(o[t[1].toLowerCase()+" "]||[]).concat(t[2]);t=o[e.toLowerCase()+" "]}return null==t?null:t.join(", ")},getAllResponseHeaders:function(){return c?s:null},setRequestHeader:function(e,t){return null==c&&(e=b[e.toLowerCase()]=b[e.toLowerCase()]||e,x[e]=t),this},overrideMimeType:function(e){return null==c&&(f.mimeType=e),this},statusCode:function(e){var t;if(e)if(c)S.always(e[S.status]);else for(t in e)y[t]=[y[t],e[t]];return this},abort:function(e){var t=e||w;return i&&i.abort(t),T(0,t),this}};if(g.promise(S),f.url=((e||f.url||Dt.href)+"").replace(Wt,Dt.protocol+"//"),f.type=t.method||t.type||f.method||f.type,f.dataTypes=(f.dataType||"*").toLowerCase().match(G)||[""],null==f.crossDomain){l=v.createElement("a");try{l.href=f.url,l.href=l.href,f.crossDomain=Xt.protocol+"//"+Xt.host!=l.protocol+"//"+l.host}catch(e){f.crossDomain=!0}}if(f.data&&f.processData&&"string"!=typeof f.data&&(f.data=k.param(f.data,f.traditional)),Zt(Ut,f,t,S),c)return S;for(d in(h=k.event&&f.global)&&0===k.active++&&k.event.trigger("ajaxStart"),f.type=f.type.toUpperCase(),f.hasContent=!Vt.test(f.type),r=f.url.replace(Bt,""),f.hasContent?f.data&&f.processData&&0===(f.contentType||"").indexOf("application/x-www-form-urlencoded")&&(f.data=f.data.replace(Yt,"+")):(u=f.url.slice(r.length),f.data&&(f.processData||"string"==typeof f.data)&&(r+=(Et.test(r)?"&":"?")+f.data,delete f.data),!1===f.cache&&(r=r.replace(Ht,"$1"),u=(Et.test(r)?"&":"?")+"_="+Lt.guid+++u),f.url=r+u),f.ifModified&&(k.lastModified[r]&&S.setRequestHeader("If-Modified-Since",k.lastModified[r]),k.etag[r]&&S.setRequestHeader("If-None-Match",k.etag[r])),(f.data&&f.hasContent&&!1!==f.contentType||t.contentType)&&S.setRequestHeader("Content-Type",f.contentType),S.setRequestHeader("Accept",f.dataTypes[0]&&f.accepts[f.dataTypes[0]]?f.accepts[f.dataTypes[0]]+("*"!==f.dataTypes[0]?", "+Gt+"; q=0.01":""):f.accepts["*"]),f.headers)S.setRequestHeader(d,f.headers[d]);if(f.beforeSend&&(!1===f.beforeSend.call(p,S,f)||c))return S.abort();if(w="abort",_.add(f.complete),S.done(f.success),S.fail(f.error),i=Zt($t,f,t,S)){if(S.readyState=1,h&&m.trigger("ajaxSend",[S,f]),c)return S;f.async&&f.timeout>0&&(a=n.setTimeout(function(){S.abort("timeout")},f.timeout));try{c=!1,i.send(x,T)}catch(e){if(c)throw e;T(-1,e)}}else T(-1,"No Transport");function T(e,t,o,l){var d,u,v,x,b,w=t;c||(c=!0,a&&n.clearTimeout(a),i=void 0,s=l||"",S.readyState=e>0?4:0,d=e>=200&&e<300||304===e,o&&(x=function(e,t,i){for(var n,r,s,o,a=e.contents,l=e.dataTypes;"*"===l[0];)l.shift(),void 0===n&&(n=e.mimeType||t.getResponseHeader("Content-Type"));if(n)for(r in a)if(a[r]&&a[r].test(n)){l.unshift(r);break}if(l[0]in i)s=l[0];else{for(r in i){if(!l[0]||e.converters[r+" "+l[0]]){s=r;break}o||(o=r)}s=s||o}if(s)return s!==l[0]&&l.unshift(s),i[s]}(f,S,o)),!d&&k.inArray("script",f.dataTypes)>-1&&k.inArray("json",f.dataTypes)<0&&(f.converters["text script"]=function(){}),x=function(e,t,i,n){var r,s,o,a,l,c={},h=e.dataTypes.slice();if(h[1])for(o in e.converters)c[o.toLowerCase()]=e.converters[o];for(s=h.shift();s;)if(e.responseFields[s]&&(i[e.responseFields[s]]=t),!l&&n&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),l=s,s=h.shift())if("*"===s)s=l;else if("*"!==l&&l!==s){if(!(o=c[l+" "+s]||c["* "+s]))for(r in c)if((a=r.split(" "))[1]===s&&(o=c[l+" "+a[0]]||c["* "+a[0]])){!0===o?o=c[r]:!0!==c[r]&&(s=a[0],h.unshift(a[1]));break}if(!0!==o)if(o&&e.throws)t=o(t);else try{t=o(t)}catch(e){return{state:"parsererror",error:o?e:"No conversion from "+l+" to "+s}}}return{state:"success",data:t}}(f,x,S,d),d?(f.ifModified&&((b=S.getResponseHeader("Last-Modified"))&&(k.lastModified[r]=b),(b=S.getResponseHeader("etag"))&&(k.etag[r]=b)),204===e||"HEAD"===f.type?w="nocontent":304===e?w="notmodified":(w=x.state,u=x.data,d=!(v=x.error))):(v=w,!e&&w||(w="error",e<0&&(e=0))),S.status=e,S.statusText=(t||w)+"",d?g.resolveWith(p,[u,w,S]):g.rejectWith(p,[S,w,v]),S.statusCode(y),y=void 0,h&&m.trigger(d?"ajaxSuccess":"ajaxError",[S,f,d?u:v]),_.fireWith(p,[S,w]),h&&(m.trigger("ajaxComplete",[S,f]),--k.active||k.event.trigger("ajaxStop")))}return S},getJSON:function(e,t,i){return k.get(e,t,i,"json")},getScript:function(e,t){return k.get(e,void 0,t,"script")}}),k.each(["get","post"],function(e,t){k[t]=function(e,i,n,r){return _(i)&&(r=r||n,n=i,i=void 0),k.ajax(k.extend({url:e,type:t,dataType:r,data:i,success:n},k.isPlainObject(e)&&e))}}),k.ajaxPrefilter(function(e){var t;for(t in e.headers)"content-type"===t.toLowerCase()&&(e.contentType=e.headers[t]||"")}),k._evalUrl=function(e,t,i){return k.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,converters:{"text script":function(){}},dataFilter:function(e){k.globalEval(e,t,i)}})},k.fn.extend({wrapAll:function(e){var t;return this[0]&&(_(e)&&(e=e.call(this[0])),t=k(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){for(var e=this;e.firstElementChild;)e=e.firstElementChild;return e}).append(this)),this},wrapInner:function(e){return _(e)?this.each(function(t){k(this).wrapInner(e.call(this,t))}):this.each(function(){var t=k(this),i=t.contents();i.length?i.wrapAll(e):t.append(e)})},wrap:function(e){var t=_(e);return this.each(function(i){k(this).wrapAll(t?e.call(this,i):e)})},unwrap:function(e){return this.parent(e).not("body").each(function(){k(this).replaceWith(this.childNodes)}),this}}),k.expr.pseudos.hidden=function(e){return!k.expr.pseudos.visible(e)},k.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},k.ajaxSettings.xhr=function(){try{return new n.XMLHttpRequest}catch(e){}};var Kt={0:200,1223:204},Qt=k.ajaxSettings.xhr();g.cors=!!Qt&&"withCredentials"in Qt,g.ajax=Qt=!!Qt,k.ajaxTransport(function(e){var t,i;if(g.cors||Qt&&!e.crossDomain)return{send:function(r,s){var o,a=e.xhr();if(a.open(e.type,e.url,e.async,e.username,e.password),e.xhrFields)for(o in e.xhrFields)a[o]=e.xhrFields[o];for(o in e.mimeType&&a.overrideMimeType&&a.overrideMimeType(e.mimeType),e.crossDomain||r["X-Requested-With"]||(r["X-Requested-With"]="XMLHttpRequest"),r)a.setRequestHeader(o,r[o]);t=function(e){return function(){t&&(t=i=a.onload=a.onerror=a.onabort=a.ontimeout=a.onreadystatechange=null,"abort"===e?a.abort():"error"===e?"number"!=typeof a.status?s(0,"error"):s(a.status,a.statusText):s(Kt[a.status]||a.status,a.statusText,"text"!==(a.responseType||"text")||"string"!=typeof a.responseText?{binary:a.response}:{text:a.responseText},a.getAllResponseHeaders()))}},a.onload=t(),i=a.onerror=a.ontimeout=t("error"),void 0!==a.onabort?a.onabort=i:a.onreadystatechange=function(){4===a.readyState&&n.setTimeout(function(){t&&i()})},t=t("abort");try{a.send(e.hasContent&&e.data||null)}catch(e){if(t)throw e}},abort:function(){t&&t()}}}),k.ajaxPrefilter(function(e){e.crossDomain&&(e.contents.script=!1)}),k.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return k.globalEval(e),e}}}),k.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),k.ajaxTransport("script",function(e){var t,i;if(e.crossDomain||e.scriptAttrs)return{send:function(n,r){t=k("